[calligra/calligra/2.4] libs/kotext/opendocument: Save autostyle in the correct file.

Thorsten Zachmann t.zachmann at zagge.de
Sun Mar 25 05:39:26 BST 2012


Git commit f01a313b6a8d70d08735bd8b2c79f149aa0c23cb by Thorsten Zachmann.
Committed on 24/03/2012 at 06:32.
Pushed by zachmann into branch 'calligra/2.4'.

Save autostyle in the correct file.

When KoShapeSavingContext::AutoStyleInStyleXml is set styles auto styles needed to be written
to the styles.xml. This fixes the problem that the style in bug 296664 for the list was saved to content.xml
instead styles.xml.

BUG: 296664

Please review so I can backport to 2.4 branch.

Roundtrip tested with my odp and odt test set.

CCMAIL: calligra-devel at kde.org
Reviewed by: boemann
(cherry picked from commit c26b92c959324c9b5703255a5ee65b99bf2a82f4)

M  +4    -0    libs/kotext/opendocument/KoTextWriter_p.cpp

http://commits.kde.org/calligra/f01a313b6a8d70d08735bd8b2c79f149aa0c23cb

diff --git a/libs/kotext/opendocument/KoTextWriter_p.cpp b/libs/kotext/opendocument/KoTextWriter_p.cpp
index 54acc22..16970e8 100644
--- a/libs/kotext/opendocument/KoTextWriter_p.cpp
+++ b/libs/kotext/opendocument/KoTextWriter_p.cpp
@@ -193,6 +193,8 @@ QHash<QTextList *, QString> KoTextWriter::Private::saveListStyles(QTextBlock blo
             }
             bool automatic = listStyle->styleId() == 0;
             KoGenStyle style(automatic ? KoGenStyle::ListAutoStyle : KoGenStyle::ListStyle);
+            if (automatic && context.isSet(KoShapeSavingContext::AutoStyleInStyleXml))
+                style.setAutoStyleInStylesDotXml(true);
             listStyle->saveOdf(style, context);
             QString generatedName = context.mainStyles().insert(style, listStyle->name(), listStyle->isNumberingStyle() ? KoGenStyles::AllowDuplicates : KoGenStyles::DontAddNumberToName);
             listStyles[textList] = generatedName;
@@ -202,6 +204,8 @@ QHash<QTextList *, QString> KoTextWriter::Private::saveListStyles(QTextBlock blo
                 continue;
             KoListLevelProperties llp = KoListLevelProperties::fromTextList(textList);
             KoGenStyle style(KoGenStyle::ListAutoStyle);
+            if (context.isSet(KoShapeSavingContext::AutoStyleInStyleXml))
+                style.setAutoStyleInStylesDotXml(true);
             KoListStyle listStyle;
             listStyle.setLevelProperties(llp);
             if (listStyle.isOulineStyle()) {




More information about the calligra-devel mailing list