xmloff/source/style/XMLPageExport.cxx | 8 ++++++-- xmloff/source/style/styleexp.cxx | 8 ++++++-- xmloff/source/style/xmlnume.cxx | 8 ++++++-- xmloff/source/style/xmlstyle.cxx | 7 +++++++ 4 files changed, 25 insertions(+), 6 deletions(-)
New commits: commit 7f41eb8768160f79297712f3ac61a25a72dcd5a0 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Apr 22 20:52:52 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri May 8 18:38:32 2020 +0200 xmloff: ODF export: fix style:hidden nonsense, step 1 a0dcf961879ab644a52f801f65466756cb144b72 introduced style:hidden attribute, fix the obvious problems with this: * as a non-ODF attribute it should use LO_EXT namespace * import LO_EXT namespace too * comparing == ODFVER_LATEST is wrong; it already prevents exporting in ODFVER_012_EXT_COMPAT case. Don't remove export to STYLE namespace yet even though it's invalid, because existing LO releases expect that. Change-Id: I258202cc572a7c50f3b2620da3b9970d34fbf80b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92730 Reviewed-by: Michael Stahl <michael.st...@cib.de> Tested-by: Jenkins diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index 7a07e732626d..f3b27b7d88f5 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -119,8 +119,12 @@ bool XMLPageExport::exportStyle( { uno::Any aValue = xPropSet->getPropertyValue( "Hidden" ); bool bHidden = false; - if ( ( aValue >>= bHidden ) && bHidden && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) - GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + if ((aValue >>= bHidden) && bHidden + && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) + { + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDDEN, "true"); + GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility + } } if( bEncoded ) diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 32c8be5408e6..dcfe8b9f7c63 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -169,8 +169,12 @@ bool XMLStyleExport::exportStyle( { aAny = xPropSet->getPropertyValue( "Hidden" ); bool bHidden = false; - if ( ( aAny >>= bHidden ) && bHidden && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) - GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + if ((aAny >>= bHidden) && bHidden + && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) + { + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDDEN, "true"); + GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility + } } // style:parent-style-name="..." diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index b6a99a179b4b..78635379f6da 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -656,8 +656,12 @@ void SvxXMLNumRuleExport::exportNumberingRule( } // style:hidden="..." - if ( bIsHidden && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) - GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + if (bIsHidden + && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) + { + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDDEN, "true"); + GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility + } // text:consecutive-numbering="..." bool bContNumbering = false; diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 9c396efba82e..8b8745d6325f 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -126,6 +126,13 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, mbHidden = rValue.toBoolean(); } } + else if (XML_NAMESPACE_LO_EXT == nPrefixKey) + { + if (IsXMLToken(rLocalName, XML_HIDDEN)) + { + mbHidden = rValue.toBoolean(); + } + } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits