[Libreoffice-commits] core.git: 2 commits - sc/source sw/source xmloff/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 9 07:18:00 UTC 2020
sc/source/filter/xml/XMLExportDataPilot.cxx | 14 +++++++-------
sc/source/filter/xml/xmlexprt.cxx | 22 +++++++++++-----------
sc/source/filter/xml/xmlstyle.cxx | 9 ++++++---
sw/source/filter/xml/xmlexp.cxx | 2 +-
xmloff/source/chart/PropertyMaps.cxx | 4 ++--
xmloff/source/chart/SchXMLExport.cxx | 19 ++++++++++---------
xmloff/source/draw/shapeexport.cxx | 16 ++++++++--------
xmloff/source/style/PageMasterStyleMap.cxx | 16 +++++++---------
xmloff/source/style/xmlexppr.cxx | 2 +-
xmloff/source/style/xmlnumfe.cxx | 10 +++++-----
xmloff/source/text/txtflde.cxx | 10 +++++-----
xmloff/source/text/txtparae.cxx | 6 +++---
xmloff/source/text/txtprmap.cxx | 6 ++++--
13 files changed, 70 insertions(+), 66 deletions(-)
New commits:
commit 7c20c3c2a9fc85c66dad9d09908b257beeedd78d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Apr 24 18:32:11 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Sat May 9 09:17:36 2020 +0200
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 at cib.de>
Tested-by: Jenkins
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index d09b63002c7f..ab3f2f4fe665 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -432,7 +432,7 @@ void ScXMLExportDataPilot::WriteSubTotals(const ScDPSaveDimension* pDim)
{
sal_Int32 nSubTotalCount = pDim->GetSubTotalsCount();
std::optional<OUString> pLayoutName;
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
// Export display names only for 1.2 extended or later.
pLayoutName = pDim->GetSubtotalName();
@@ -464,7 +464,7 @@ void ScXMLExportDataPilot::WriteMembers(const ScDPSaveDimension* pDim)
{
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rpMember->GetName());
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// Export display names only for ODF 1.2 extended or later.
const std::optional<OUString> & pLayoutName = rpMember->GetLayoutName();
@@ -492,7 +492,7 @@ void ScXMLExportDataPilot::WriteLevels(const ScDPSaveDimension* pDim)
::sax::Converter::convertBool(sBuffer, pDim->GetShowEmpty());
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, sBuffer.makeStringAndClear());
}
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
OUStringBuffer sBuffer;
::sax::Converter::convertBool(sBuffer, pDim->GetRepeatItemLabels());
@@ -675,7 +675,7 @@ void ScXMLExportDataPilot::WriteDimension(const ScDPSaveDimension* pDim, const S
{
OUString aSrcDimName = ScDPUtil::getSourceDimensionName(pDim->GetName());
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, aSrcDimName);
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// Export display names only for ODF 1.2 extended or later.
const std::optional<OUString> & pLayoutName = pDim->GetLayoutName();
@@ -700,7 +700,7 @@ void ScXMLExportDataPilot::WriteDimension(const ScDPSaveDimension* pDim, const S
if (eOrientation == sheet::DataPilotFieldOrientation_PAGE)
{
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
rExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_IGNORE_SELECTED_PAGE, "true");
}
@@ -813,7 +813,7 @@ void ScXMLExportDataPilot::WriteDataPilots()
// grand total elements.
const std::optional<OUString> & pGrandTotalName = pDPSave->GetGrandTotalName();
- if (pGrandTotalName && rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (pGrandTotalName && rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
// Use the new data-pilot-grand-total element.
if (bRowGrand && bColumnGrand)
@@ -832,7 +832,7 @@ void ScXMLExportDataPilot::WriteDataPilots()
{
const ScSheetSourceDesc* pSheetSource = (*pDPs)[i].GetSheetDesc();
- if (rExport.getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
if (pSheetSource->HasRangeName())
{
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index b60c4959ce7c..93e4743276c8 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1707,7 +1707,7 @@ void ScXMLExport::SetBodyAttributes()
{
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
ScPassHashHelper::getHashURI(PASSHASH_XL));
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
AddAttribute(XML_NAMESPACE_LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
ScPassHashHelper::getHashURI(PASSHASH_SHA1));
}
@@ -2830,7 +2830,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
{
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
ScPassHashHelper::getHashURI(PASSHASH_XL));
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
AddAttribute(XML_NAMESPACE_LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
ScPassHashHelper::getHashURI(PASSHASH_SHA1));
}
@@ -2859,7 +2859,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT, XML_FALSE);
SvXMLElementExport aElemT(*this, sElemTab, true, true);
- if (pProtect && pProtect->isProtected() && getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (pProtect && pProtect->isProtected() && getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
if (pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS))
AddAttribute(XML_NAMESPACE_LO_EXT, XML_SELECT_PROTECTED_CELLS, XML_TRUE);
@@ -2981,7 +2981,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
WriteNamedRange(pRangeName);
}
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
//export new conditional format information
ExportConditionalFormat(nTable);
@@ -3138,7 +3138,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.maBaseCell.mfValue);
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.maBaseCell.mfValue, false, XML_NAMESPACE_CALC_EXT, false);
}
@@ -3149,7 +3149,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
OUString sCellString = aCell.maBaseCell.getString(pDoc);
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sCellString, sFormattedString);
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sCellString, sFormattedString, false, XML_NAMESPACE_CALC_EXT);
}
@@ -3185,7 +3185,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
//export calcext:value-type="error"
AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, OUString("error"));
@@ -3200,7 +3200,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, pDoc->GetValue(aCell.maCellAddress));
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, pDoc->GetValue(aCell.maCellAddress), false, XML_NAMESPACE_CALC_EXT, false );
@@ -3213,7 +3213,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, XML_STRING);
}
@@ -3998,7 +3998,7 @@ void ScXMLExport::WriteExternalDataMapping()
if (!pDoc)
return;
- if (getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012)
+ if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
// Export this only for 1.2 extended and above.
return;
@@ -4331,7 +4331,7 @@ void ScXMLExport::WriteDataStream()
// Export this only in experimental mode.
return;
- if (getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012)
+ if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
// Export this only for 1.2 extended and above.
return;
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index f966da56d26e..f1e6509798c4 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -125,7 +125,7 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
if( getExportFlags() & (SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES|
SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT))
{
- if (getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
+ if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
{
GetNamespaceMap_().Add(
GetXMLToken(XML_NP_OFFICE_EXT),
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())
commit 21ac2dae6a84b2c686abdbefb5d9bd10fed42680
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Apr 24 14:58:51 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Sat May 9 09:17:23 2020 +0200
sc,xmloff: ODF 1.3: adapt XMLPropertyMapEntry
Map the following property attributes to ODFSVER_013:
* OFFICE-2173 table:tab-color
* OFFICE-3767 text:contextual-spacing
* OFFICE-3857 table:scale-to-X/table:scale-to-Y
Change-Id: I3585560a3654c71353bbcaf66da20eacba8ebd1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92861
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
Tested-by: Jenkins
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index ff38c1cbdaaf..1cb5fb26591e 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -51,6 +51,7 @@ using namespace ::xmloff::token;
using namespace ::formula;
#define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_010, false }
+#define MAP_ODF13(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_013, false }
// extensions import/export
#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
// extensions import only
@@ -163,8 +164,8 @@ const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
- MAP( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
- MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+ MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+ MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
MAP_END()
};
@@ -173,7 +174,9 @@ const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
- MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+ // ODF 1.3 OFFICE-2173
+ MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+ MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
MAP_END()
};
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index ff897d7804d9..9229b38de7df 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -24,15 +24,12 @@
using namespace ::xmloff::token;
#define MAP(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, false }
-#define MAP_IMPORT(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, true }
#define PLMAP(name,prefix,token,type,context) \
MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_010)
#define PLMAP_12(name,prefix,token,type,context) \
MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012)
-#define PLMAP_EXT(name,prefix,token,type,context) \
- MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED)
-#define PLMAP_EXT_IMPORT(name,prefix,token,type,context) \
- MAP_IMPORT(name, prefix,token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED)
+#define PLMAP_ODF13(name,prefix,token,type,context) \
+ MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_013)
#define HFMAP(name,prefix,token,type,context) \
MAP(name, prefix, token, type|XML_TYPE_PROP_HEADER_FOOTER, context, SvtSaveOptions::ODFSVER_010)
@@ -87,10 +84,11 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "FirstPageNumber", XML_NAMESPACE_STYLE, XML_FIRST_PAGE_NUMBER, XML_PM_TYPE_FIRSTPAGENUMBER, 0 ),
PLMAP( "PageScale", XML_NAMESPACE_STYLE, XML_SCALE_TO, XML_TYPE_PERCENT16, CTF_PM_SCALETO ),
PLMAP( "ScaleToPages", XML_NAMESPACE_STYLE, XML_SCALE_TO_PAGES, XML_TYPE_NUMBER16, CTF_PM_SCALETOPAGES ),
- PLMAP_EXT_IMPORT( "ScaleToPagesX", XML_NAMESPACE_STYLE, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ),
- PLMAP_EXT_IMPORT( "ScaleToPagesY", XML_NAMESPACE_STYLE, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ),
- PLMAP_EXT( "ScaleToPagesX", XML_NAMESPACE_LO_EXT, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ),
- PLMAP_EXT( "ScaleToPagesY", XML_NAMESPACE_LO_EXT, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ),
+ // ODF 1.3 OFFICE-3857
+ PLMAP_ODF13( "ScaleToPagesX", XML_NAMESPACE_STYLE, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ),
+ PLMAP_ODF13( "ScaleToPagesY", XML_NAMESPACE_STYLE, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ),
+ PLMAP_ODF13( "ScaleToPagesX", XML_NAMESPACE_LO_EXT, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ),
+ PLMAP_ODF13( "ScaleToPagesY", XML_NAMESPACE_LO_EXT, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ),
PLMAP( "CenterHorizontally", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_HORIZONTAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
PLMAP( "CenterVertically", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
PLMAP( "TextColumns", XML_NAMESPACE_STYLE, XML_COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ),
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 60ec65b66026..4f779c43cdc2 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -74,6 +74,8 @@ using namespace ::xmloff::token;
#define MC_E( a, p, l, t, c ) \
M_E_( a, p, l, (t|XML_TYPE_PROP_TABLE_CELL), c )
+#define MAP_ODF13(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_013, false }
+
// extensions import/export
#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
// extensions import only
@@ -127,8 +129,8 @@ XMLPropertyMapEntry const aXMLParaPropMap[] =
MP_E( "ParaTopMarginRelative", FO, MARGIN_TOP, XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
MP_E( "ParaBottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARABOTTOMMARGIN ),
MP_E( "ParaBottomMarginRelative",FO, MARGIN_BOTTOM, XML_TYPE_PERCENT16, CTF_PARABOTTOMMARGIN_REL ),
- MAP_EXT_I( "ParaContextMargin", XML_NAMESPACE_STYLE, XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // proposed ODF 1.2+ and was written by LO<=4.2
- MAP_EXT( "ParaContextMargin", XML_NAMESPACE_LO_EXT, XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // extension namespace
+ MAP_ODF13( "ParaContextMargin", XML_NAMESPACE_STYLE, XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // ODF 1.3 OFFICE-3767 and was written by LO<=4.2
+ MAP_ODF13( "ParaContextMargin", XML_NAMESPACE_LO_EXT, XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // extension namespace
// RES_CHRATR_CASEMAP
MT_E( "CharCaseMap", FO, FONT_VARIANT, XML_TYPE_TEXT_CASEMAP_VAR, 0 ),
MT_E( "CharCaseMap", FO, TEXT_TRANSFORM, XML_TYPE_TEXT_CASEMAP, 0 ),
More information about the Libreoffice-commits
mailing list