summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-04-22 20:52:52 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-05-08 18:38:32 +0200
commit7f41eb8768160f79297712f3ac61a25a72dcd5a0 (patch)
treeec9c69101d131b6b150dced9c10b674cd40361ff
parente43ad1a8ae20cbd00c5c3346e1810196af6669a6 (diff)
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.stahl@cib.de> Tested-by: Jenkins
-rw-r--r--xmloff/source/style/XMLPageExport.cxx8
-rw-r--r--xmloff/source/style/styleexp.cxx8
-rw-r--r--xmloff/source/style/xmlnume.cxx8
-rw-r--r--xmloff/source/style/xmlstyle.cxx7
4 files changed, 25 insertions, 6 deletions
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();
+ }
+ }
}