[calligra] libs/kotext/opendocument: Save autostyle in the correct file.
Thorsten Zachmann
t.zachmann at zagge.de
Sat Mar 24 06:12:11 GMT 2012
Git commit c26b92c959324c9b5703255a5ee65b99bf2a82f4 by Thorsten Zachmann.
Committed on 24/03/2012 at 06:32.
Pushed by zachmann into branch 'master'.
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
M +4 -0 libs/kotext/opendocument/KoTextWriter_p.cpp
http://commits.kde.org/calligra/c26b92c959324c9b5703255a5ee65b99bf2a82f4
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