summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-04-19 18:04:47 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-04-26 13:08:35 +0200
commit546741148863ae0b2a25cc994a7323c8113cb573 (patch)
tree3ac95fa9e8a7e8084ded179ec4f4559b470bddf5 /xmloff
parentac05822b8957d80018d3ce1cbf97cd9faa0dfe99 (diff)
tdf#114287 tdf#159366 xmloff: ODF import: revert text:list override
This reverts commit ade0a153f453500f15343380ac937252992733e0 "tdf#114287 xmloff: ODF import: fix text:list override of list style" and subsequent commits 7cf5faec6fdbc27dd77d2d36fb2ff205322cba0d and 1b2a6b98291cf8b7022951be19b915fe2a9e18e6. It turns out that there is actually a paragraph in ODF 1.2 and later that gives paragraph's indent priority over the list style's, which i unfortunately missed when investigating the above issues: 17.20 <style:list-level-label-alignment> ... The fo:text-indent and fo:margin-left attributes are evaluated only for paragraphs inside list items whose paragraph styles do not specify them. If one of the two properties, or both, are specified by the paragraph style, the text indent and/or left margin are taken from the paragraph style. In this case the paragraph style's properties are used to determine the indent and margin for the text lines and thus also the alignment position. This is usually interpreted as "on the same level", so applying a list-style at a paragraph style overrides the indents inherited from a parent paragraph style, but if the style then specifies its own indents that overrides the list style's indents. Furthermore it turns out that Google Docs now imports this bugdoc the same way as LO 7.5 does; unclear if that changed recently (it shows it like Word does in the preview, but like LO 7.5 does after opening it). This means the way MS Word imports the bugdoc, which remains unchanged, now looks like a bug and we should not change LO to be compatible with it (when the same structure is created in Word, storing to ODF and loading again, it looks different too). Change-Id: I0c65bde38de9e6fcbccec55899c60c3245adb5ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166309 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/XMLTextListBlockContext.hxx1
-rw-r--r--xmloff/source/text/txtimp.cxx72
2 files changed, 2 insertions, 71 deletions
diff --git a/xmloff/source/text/XMLTextListBlockContext.hxx b/xmloff/source/text/XMLTextListBlockContext.hxx
index 4b18d625cc36..a529afd1e476 100644
--- a/xmloff/source/text/XMLTextListBlockContext.hxx
+++ b/xmloff/source/text/XMLTextListBlockContext.hxx
@@ -66,7 +66,6 @@ public:
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 b0790da2cf46..21870f73a063 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1002,45 +1002,6 @@ static bool lcl_HasListStyle( const OUString& sStyleName,
return bRet;
}
-namespace {
-
-auto IsPropertySet(uno::Reference<container::XNameContainer> const& rxParaStyles,
- uno::Reference<beans::XPropertySet> const& rxPropSet,
- OUString const& rProperty)
-{
- uno::Reference<beans::XPropertyState> const xPropState(rxPropSet, uno::UNO_QUERY);
- // note: this is true only if it is set in automatic style
- if (xPropState->getPropertyState(rProperty) == beans::PropertyState_DIRECT_VALUE)
- {
- return true;
- }
- if (xPropState->getPropertyState("NumberingStyleName") == beans::PropertyState_DIRECT_VALUE)
- {
- return false; // tdf#159903 this overrides value in the parent style
- }
- // check if it is set by any parent common style
- OUString style;
- rxPropSet->getPropertyValue("ParaStyleName") >>= style;
- while (!style.isEmpty() && rxParaStyles.is() && rxParaStyles->hasByName(style))
- {
- uno::Reference<style::XStyle> const xStyle(rxParaStyles->getByName(style), uno::UNO_QUERY);
- assert(xStyle.is());
- uno::Reference<beans::XPropertyState> const xStyleProps(xStyle, uno::UNO_QUERY);
- if (xStyleProps->getPropertyState(rProperty) == beans::PropertyState_DIRECT_VALUE)
- {
- return true;
- }
- if (xStyleProps->getPropertyState("NumberingStyleName") == beans::PropertyState_DIRECT_VALUE)
- {
- return false; // tdf#159903 this overrides value in the parent style
- }
- style = xStyle->getParentStyle();
- }
- return false;
-};
-
-} // namespace
-
OUString XMLTextImportHelper::SetStyleAndAttrs(
SvXMLImport & rImport,
const Reference < XTextCursor >& rCursor,
@@ -1124,17 +1085,8 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
bool bNumberingIsNumber(true);
// Assure that list style of automatic paragraph style is applied at paragraph. (#i101349#)
bool bApplyNumRules(pStyle && pStyle->IsListStyleSet());
- bool bApplyNumRulesFix(false);
if (pListBlock) {
- // the xNumRules is always created, even without a list-style-name
- if (!bApplyNumRules
- && (pListBlock->HasListStyleName()
- || (pListItem != nullptr && pListItem->HasNumRulesOverride())))
- {
- bApplyNumRules = true; // tdf#114287
- bApplyNumRulesFix = rImport.isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_76);
- }
if (!pListItem) {
bNumberingIsNumber = false; // list-header
@@ -1166,7 +1118,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
if (pListBlock || pNumberedParagraph)
{
- if (!bApplyNumRules || bApplyNumRulesFix)
+ if (!bApplyNumRules)
{
bool bSameNumRules = xNewNumRules == xNumRules;
if( !bSameNumRules && xNewNumRules.is() && xNumRules.is() )
@@ -1190,14 +1142,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
}
}
}
- if (!bApplyNumRules)
- {
- bApplyNumRules = !bSameNumRules;
- }
- if (!bSameNumRules)
- {
- bApplyNumRulesFix = false;
- }
+ bApplyNumRules = !bSameNumRules;
}
if ( bApplyNumRules )
@@ -1211,19 +1156,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
{
xPropSet->setPropertyValue(
s_NumberingRules, Any(xNewNumRules) );
- if (bApplyNumRulesFix)
- { // tdf#156146 override list margins for bug compatibility
- if (IsPropertySet(m_xImpl->m_xParaStyles, xPropSet, "ParaLeftMargin"))
- {
- uno::Any const left(xPropSet->getPropertyValue("ParaLeftMargin"));
- xPropSet->setPropertyValue("ParaLeftMargin", left);
- }
- if (IsPropertySet(m_xImpl->m_xParaStyles, xPropSet, "ParaFirstLineIndent"))
- {
- uno::Any const first(xPropSet->getPropertyValue("ParaFirstLineIndent"));
- xPropSet->setPropertyValue("ParaFirstLineIndent", first);
- }
- }
}
catch(const Exception&)
{