diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-02-27 20:52:39 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-02-28 15:43:40 +0000 |
commit | ade0a153f453500f15343380ac937252992733e0 (patch) | |
tree | 379bbeb1039fc6d4f984bff895b8619cac87fc3c /xmloff/source | |
parent | f36265ed0e0229dc9dacd18cc16867b22d655dbe (diff) |
tdf#114287 xmloff: ODF import: fix text:list override of list style
The problem is that the list element applies a list style, which should
override the list style that's set in the common style
"myStyleWithNumbering" of the paragraph, but these happend to be the
same list styles and so the override was skipped, resulting in bad text
formatting.
<text:list xml:id="list3425910577850" text:continue-numbering="true" text:style-name="Numbering_20_123">
The same problem exists if the list-item element has a style-override.
This is similar to bug i#101349 which fixed it for an automatic
paragraph style applying the same list style as its parent style.
Change-Id: Idc6f10f93976de7e7bdceccbe3012c4157f61ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147930
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/text/XMLTextListBlockContext.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xmloff/source/text/XMLTextListBlockContext.hxx b/xmloff/source/text/XMLTextListBlockContext.hxx index 9446ee5e90b4..4b18d625cc36 100644 --- a/xmloff/source/text/XMLTextListBlockContext.hxx +++ b/xmloff/source/text/XMLTextListBlockContext.hxx @@ -65,6 +65,8 @@ public: bool IsRestartNumbering() const { return mbRestartNumbering; } void ResetRestartNumbering() { mbRestartNumbering = false; } + /// does this list have (possibly inherited from parent) list-style-name? + bool HasListStyleName() { return !msListStyleName.isEmpty(); } const css::uno::Reference < css::container::XIndexReplace >& GetNumRules() const { return mxNumRules; } diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index e9858e31a722..f699b8b22379 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1084,12 +1084,21 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( OUString sListId; sal_Int16 nStartValue(-1); bool bNumberingIsNumber(true); + // Assure that list style of automatic paragraph style is applied at paragraph. (#i101349#) + bool bApplyNumRules(pStyle && pStyle->IsListStyleSet()); if (pListBlock) { + // the xNumRules is always created, even without a list-style-name + if (pListBlock->HasListStyleName() + || (pListItem != nullptr && pListItem->HasNumRulesOverride())) + { + bApplyNumRules = true; // tdf#114287 + } if (!pListItem) { bNumberingIsNumber = false; // list-header } + // consider text:style-override property of <text:list-item> xNewNumRules.set( (pListItem != nullptr && pListItem->HasNumRulesOverride()) @@ -1116,8 +1125,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( if (pListBlock || pNumberedParagraph) { - // Assure that list style of automatic paragraph style is applied at paragraph. (#i101349#) - bool bApplyNumRules = pStyle && pStyle->IsListStyleSet(); if ( !bApplyNumRules ) { bool bSameNumRules = xNewNumRules == xNumRules; |