[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/kotext/styles
From:       Thomas Zander <zander () kde ! org>
Date:       2010-12-29 14:25:16
Message-ID: 20101229142516.5CA073E1F1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1210092 by zander:

On adding a style, add all the parents too.

A style manager is the one that is responsible for deleting
a style, and as such it would be a bug if we are allowed to
add a child style without auto-adding a parent style.

 M  +10 -1     KoStyleManager.cpp  


--- trunk/koffice/libs/kotext/styles/KoStyleManager.cpp #1210091:1210092
@@ -235,7 +235,16 @@
         if (style->characterStyle()->name().isEmpty())
             style->characterStyle()->setName(style->name());
     }
-    // TODO add the list style too?
+    if (style->listStyle() && style->listStyle()->styleId() == 0)
+        add(style->listStyle());
+    KoParagraphStyle *root = style;
+    while (root->parentStyle()) {
+        root = root->parentStyle();
+        if (root->styleId() == 0)
+            add(root);
+    }
+    if (root != d->defaultParagraphStyle && root->parentStyle() == 0)
+        root->setParentStyle(d->defaultParagraphStyle);
 
     emit styleAdded(style);
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic