summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-04-24 18:32:11 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-05-09 09:17:36 +0200
commit7c20c3c2a9fc85c66dad9d09908b257beeedd78d (patch)
tree84d07d36ea2c72df61afa031657db2535da363a0 /xmloff
parent21ac2dae6a84b2c686abdbefb5d9bd10fed42680 (diff)
xmloff: ODF export: adapt all checks of ODFSVER_012 etc.
Most of these actually want to check ODFSVER_EXTENDED because the extension didn't get into ODF 1.3. Change-Id: I1b625a329f7a3d146c616c62c15b56e2c314c2c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92872 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/PropertyMaps.cxx4
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx19
-rw-r--r--xmloff/source/draw/shapeexport.cxx16
-rw-r--r--xmloff/source/style/xmlexppr.cxx2
-rw-r--r--xmloff/source/style/xmlnumfe.cxx10
-rw-r--r--xmloff/source/text/txtflde.cxx10
-rw-r--r--xmloff/source/text/txtparae.cxx6
7 files changed, 34 insertions, 33 deletions
diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
index bfa7ea8829d3..8e2dccaf8ec5 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -488,9 +488,9 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
sValueBuffer.append( GetXMLToken( XML_EXPONENTIAL ));
else if (aServiceName == "com.sun.star.chart2.PotentialRegressionCurve")
sValueBuffer.append( GetXMLToken( XML_POWER ));
- else if (nCurrentVersion > SvtSaveOptions::ODFSVER_012 && aServiceName == "com.sun.star.chart2.PolynomialRegressionCurve")
+ else if (nCurrentVersion & SvtSaveOptions::ODFSVER_EXTENDED && aServiceName == "com.sun.star.chart2.PolynomialRegressionCurve")
sValueBuffer.append( GetXMLToken( XML_POLYNOMIAL ));
- else if (nCurrentVersion > SvtSaveOptions::ODFSVER_012 && aServiceName == "com.sun.star.chart2.MovingAverageRegressionCurve")
+ else if (nCurrentVersion & SvtSaveOptions::ODFSVER_EXTENDED && aServiceName == "com.sun.star.chart2.MovingAverageRegressionCurve")
sValueBuffer.append( GetXMLToken( XML_MOVING_AVERAGE ));
}
break;
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 49cd2dbb9945..a0a2d2bf401a 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -286,7 +286,7 @@ CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex,
return CustomLabelSeq();
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion <= SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if ((nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) == 0) // do not export to ODF 1.3 or older
return CustomLabelSeq();
if(Reference<beans::XPropertySet> xLabels = rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
@@ -308,7 +308,7 @@ css::chart2::RelativePosition lcl_getCustomLabelPosition(sal_Int32 nDataPointInd
return chart2::RelativePosition();
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion <= SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if ((nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) == 0) // do not export to ODF 1.3 or older
return chart2::RelativePosition();
if (Reference<beans::XPropertySet> xLabels = rSeries->getDataPointByIndex(nDataPointIndex); xLabels.is())
@@ -1214,7 +1214,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >
}
Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider(xNewDoc->getDataProvider(), uno::UNO_QUERY);
- if (xPivotTableDataProvider.is() && nCurrentODFVersion > SvtSaveOptions::ODFSVER_012)
+ if (xPivotTableDataProvider.is() && nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED)
{
OUString sPivotTableName = xPivotTableDataProvider->getPivotTableName();
mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_DATA_PILOT_SOURCE, sPivotTableName);
@@ -1387,7 +1387,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >
// export legend overlay
try
{
- if (nCurrentODFVersion > SvtSaveOptions::ODFSVER_012)
+ if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED)
{
Any aAny( xProp->getPropertyValue("Overlay"));
if(aAny.get<bool>())
@@ -2226,7 +2226,7 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis >& rChart2Axis, SvXMLExp
return bExportDateScale;
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion <= SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if ((nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) == 0) //do not export to ODF 1.3 or older
return bExportDateScale;
chart2::ScaleData aScale( rChart2Axis->getScaleData() );
@@ -2299,7 +2299,8 @@ void SchXMLExportHelper_Impl::exportAxis(
if( rAxisProps.is() && mxExpPropMapper.is() )
{
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion > SvtSaveOptions::ODFSVER_012 && eDimension == XML_X)
+ if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED
+ && eDimension == XML_X)
{
chart2::ScaleData aScaleData(rChart2Axis->getScaleData());
bool bShiftedCatPos = aScaleData.ShiftedCategoryPosition;
@@ -2698,7 +2699,7 @@ void SchXMLExportHelper_Impl::exportSeries(
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString());
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion > SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) // do not export to ODF 1.3 or older
{
if (xPropSet.is())
{
@@ -2869,7 +2870,7 @@ void SchXMLExportHelper_Impl::exportSeries(
nSeriesLength, xNewDiagram, bExportContent );
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (bExportContent && nCurrentODFVersion > SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if (bExportContent && nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) // do not export to ODF 1.3 or older
{
Sequence< OUString > aSupportedMappings = rChartType->getSupportedPropertyRoles();
exportPropertyMapping( xSource, aSupportedMappings );
@@ -3252,7 +3253,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
xSeriesProperties->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint;
const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentODFVersion > SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older
+ if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) // do not export to ODF 1.3 or older
xSeriesProperties->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
}
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index f75e334a246c..d1d46bf32dab 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -727,8 +727,8 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
}
}
- // export draw:display (do not export in ODF 1.2 or older)
- if (xSet.is() && (mrExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012))
+ // export draw:display (do not export in ODF 1.3 or older)
+ if (xSet.is() && (mrExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED))
{
if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape )
@@ -1563,9 +1563,9 @@ void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xSh
{
if (eExtensionNS == TextPNS::EXTENSION)
{
- if (mrExport.getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012)
+ if ((mrExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
{
- return; // do not export to ODF 1.1/1.2
+ return; // do not export to ODF 1.1/1.2/1.3
}
}
uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
@@ -2475,7 +2475,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
ImpExportDescription( xShape ); // #i68101#
// Signature Line, QR Code - needs to be after the images!
- if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
ImpExportSignatureLine(xShape);
ImpExportQRCode(xShape);
@@ -4116,7 +4116,7 @@ static void ImpExportEnhancedPath( SvXMLExport& rExport,
}
aStr = aStrBuffer.makeStringAndClear();
rExport.AddAttribute( bExtended ? XML_NAMESPACE_DRAW_EXT : XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr );
- if (!bExtended && bNeedExtended && (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012))
+ if (!bExtended && bNeedExtended && (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED))
ImpExportEnhancedPath( rExport, rCoordinates, rSegments, true );
}
@@ -4578,8 +4578,8 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
{
case EAS_SubViewSize:
{
- // export draw:sub-view-size (do not export in ODF 1.2 or older)
- if (rExport.getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012)
+ // export draw:sub-view-size (do not export in ODF 1.3 or older)
+ if ((rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
{
continue;
}
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index d2843f71441d..7601bf1f12c6 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -841,7 +841,7 @@ void SvXMLExportPropertyMapper::exportXML(
aPropTokens[i].eToken == xmloff::token::XML_GRAPHIC_PROPERTIES)
{
nNamespace = XML_NAMESPACE_LO_EXT;
- if (rExport.getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012)
+ if ((rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
{
continue; // don't write for ODF <= 1.2
}
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index d17266d5f15a..178815c54316 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -743,7 +743,7 @@ void SvXMLNumFmtExport::WriteFractionElement_Impl(
SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
if ( !aIntegerFractionDelimiterString.isEmpty() && aIntegerFractionDelimiterString != " "
&& ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0) )
- { // Export only for 1.2 with extensions or 1.3 and later.
+ { // Export only for 1.2/1.3 with extensions.
rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_INTEGER_FRACTION_DELIMITER,
aIntegerFractionDelimiterString );
}
@@ -753,7 +753,7 @@ void SvXMLNumFmtExport::WriteFractionElement_Impl(
nMinNumeratorDigits++;
rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_NUMERATOR_DIGITS,
OUString::number( nMinNumeratorDigits ) );
- // Export only for 1.2 with extensions or 1.3 and later.
+ // Export only for 1.2/1.3 with extensions.
if ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0)
{
// For extended ODF use loext namespace
@@ -1211,9 +1211,9 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
LanguageTag aLanguageTag( aAttr.Locale);
OUString aLanguage, aScript, aCountry;
aLanguageTag.getIsoLanguageScriptCountry( aLanguage, aScript, aCountry);
- // For 1.2+ use loext namespace, for 1.3 use number namespace.
- rExport.AddAttribute( ((eVersion < SvtSaveOptions::ODFSVER_013) ?
- XML_NAMESPACE_LO_EXT : XML_NAMESPACE_NUMBER),
+ // For 1.2/1.3+ use loext namespace.
+ rExport.AddAttribute( /*((eVersion < SvtSaveOptions::ODFSVER_)
+ ? */ XML_NAMESPACE_LO_EXT /*: XML_NAMESPACE_NUMBER)*/,
XML_TRANSLITERATION_SPELLOUT, aAttr.Spellout );
rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE,
aLanguage );
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index b6876a1e63c5..d2aefc403292 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1619,7 +1619,7 @@ void XMLTextFieldExport::ExportFieldHelper(
GetInt16Property(gsPropertySequenceNumber, rPropSet),
GetStringProperty(gsPropertySourceName, rPropSet) ) );
if (xPropSetInfo->hasPropertyByName(gsPropertyReferenceFieldLanguage) &&
- SvtSaveOptions().GetODFSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// export text:reference-language attribute, if not empty
ProcessString(XML_REFERENCE_LANGUAGE,
@@ -1641,7 +1641,7 @@ void XMLTextFieldExport::ExportFieldHelper(
ProcessString(XML_REF_NAME,
GetStringProperty(gsPropertySourceName, rPropSet));
if (xPropSetInfo->hasPropertyByName(gsPropertyReferenceFieldLanguage) &&
- SvtSaveOptions().GetODFSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// export text:reference-language attribute, if not empty
ProcessString(XML_REFERENCE_LANGUAGE,
@@ -1666,7 +1666,7 @@ void XMLTextFieldExport::ExportFieldHelper(
MakeFootnoteRefName(GetInt16Property(
gsPropertySequenceNumber, rPropSet)));
if (xPropSetInfo->hasPropertyByName(gsPropertyReferenceFieldLanguage) &&
- SvtSaveOptions().GetODFSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// export text:reference-language attribute, if not empty
ProcessString(XML_REFERENCE_LANGUAGE,
@@ -1694,7 +1694,7 @@ void XMLTextFieldExport::ExportFieldHelper(
case FIELD_ID_PAGENAME:
{
- if (SvtSaveOptions().GetODFSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT, XML_PAGE_NAME, false, false );
GetExport().Characters( sPresentation );
@@ -1758,7 +1758,7 @@ void XMLTextFieldExport::ExportFieldHelper(
{
GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, aName);
SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
- if(eVersion > SvtSaveOptions::ODFSVER_012)
+ if (eVersion & SvtSaveOptions::ODFSVER_EXTENDED)
{
bool b = GetBoolProperty("Resolved", rPropSet);
OUString aResolvedText;
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index a3de06e07939..928005e3211d 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2244,7 +2244,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
/* As of now, textmarks are a proposed extension to the OpenDocument standard. */
if (!bAutoStyles)
{
- if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
if (xBookmark.is())
@@ -2310,7 +2310,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
{
Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
- if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
SvXMLElementExport aElem( GetExport(), !bAutoStyles,
XML_NAMESPACE_FIELD, XML_FIELDMARK_END,
@@ -2346,7 +2346,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
{
if (!bAutoStyles)
{
- if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
if (xBookmark.is())