summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-04-22 20:52:52 +0200
committerJan Holesovsky <kendy@collabora.com>2021-01-07 16:32:52 +0100
commit3e31d1ca82300a8e7c3642c6584a4522e4d3a57a (patch)
tree6d8f2d7dab1822e0b4be8695bd01155ad3544f1b /xmloff
parentd6adb83a222c4536f6d3ba21918290c51e32e4aa (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
Diffstat (limited to 'xmloff')
-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 5b559e4d3b20..41f04b7df5f1 100644
--- a/xmloff/source/style/XMLPageExport.cxx
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -118,8 +118,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 ed07f7ca14d7..34cbcdc70905 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -168,8 +168,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 824fd6566c82..7acfcbe30c6a 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -654,8 +654,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 7583ca5f7faa..9444d85f9684 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -123,6 +123,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();
+ }
+ }
}