diff options
24 files changed, 199 insertions, 103 deletions
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 58aa2b4decf7..1e4f79d4ce44 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -1074,7 +1074,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) std::vector< XMLPropertyState > aPropertyStates; for (const auto & i : pExportHelper) { - aPropertyStates = i.first->Filter(_xProp); + aPropertyStates = i.first->Filter(*this, _xProp); if ( !aPropertyStates.empty() ) i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, aPropertyStates ) ); } @@ -1088,7 +1088,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,static_cast<FontFamily>(aFont.Family), static_cast<FontPitch>(aFont.Pitch),aFont.CharSet ); - m_aCurrentPropertyStates = m_xCellExportHelper->Filter(_xProp); + m_aCurrentPropertyStates = m_xCellExportHelper->Filter(*this, _xProp); if ( !m_aCurrentPropertyStates.empty() && !xCollection->hasElements() ) { Reference< XDataDescriptorFactory> xFac(xCollection,UNO_QUERY); @@ -1119,7 +1119,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) }; for (const auto & i : pExportHelper) { - std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp ); + std::vector< XMLPropertyState > aPropStates = i.first->Filter(*this, _xProp); if ( !aPropStates.empty() ) { const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper(); diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx index f2f1e6adf72e..5e47201a5234 100644 --- a/include/xmloff/xmlexppr.hxx +++ b/include/xmloff/xmlexppr.hxx @@ -64,6 +64,7 @@ protected: After this process It'll called 'Contextfilter' for application-specific filter-processes. */ std::vector<XMLPropertyState> Filter_( + SvXMLExport const& rExport, const css::uno::Reference<css::beans::XPropertySet>& rPropSet, bool bDefault, bool bDisableFoFontFamily ) const; @@ -114,6 +115,7 @@ public: After this process It'll called 'Contextfilter' for application-specific filter-processes. */ std::vector<XMLPropertyState> Filter( + SvXMLExport const& rExport, const css::uno::Reference<css::beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily = false ) const; /** Like Filter(), except that: @@ -122,6 +124,7 @@ public: * - instead of the property's value, its default value is exported. */ std::vector<XMLPropertyState> FilterDefaults( + SvXMLExport const& rExport, const css::uno::Reference<css::beans::XPropertySet>& rPropSet ) const; /** Provides a partial ordering over two arrays of XMLPropertyState, diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx index a501221c16bb..0a5619153917 100644 --- a/include/xmloff/xmluconv.hxx +++ b/include/xmloff/xmluconv.hxx @@ -30,6 +30,8 @@ #include <rtl/ustrbuf.hxx> #include <xmloff/xmltoken.hxx> +#include <unotools/saveopt.hxx> + #include <tools/fldunit.hxx> namespace com::sun::star { @@ -93,7 +95,8 @@ public: SvXMLUnitConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext, sal_Int16 eCoreMeasureUnit /*css::util::MeasureUnit*/, - sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/); + sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/, + SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion); ~SvXMLUnitConverter(); @@ -108,6 +111,10 @@ public: /** gets the default unit for textual measures */ sal_Int16 GetXMLMeasureUnit() const; + /// ODF version, only when exporting + SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const; + void overrideSaneDefaultVersion(SvtSaveOptions::ODFSaneDefaultVersion const); + /** gets XNumberingTypeInfo */ const css::uno::Reference< css::text::XNumberingTypeInfo >& getNumTypeInfo() const; diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 790afe812df1..7968a237ac7c 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1112,11 +1112,11 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted const uno::Reference< report::XShape> xShape(_xProp,uno::UNO_QUERY); if ( xShape.is() ) { - ::std::vector< XMLPropertyState > aPropertyStates( m_xParaPropMapper->Filter(_xProp) ); + ::std::vector<XMLPropertyState> aPropertyStates(m_xParaPropMapper->Filter(*this, _xProp)); if ( !aPropertyStates.empty() ) m_aAutoStyleNames.emplace( _xProp,GetAutoStylePool()->Add( XmlStyleFamily::TEXT_PARAGRAPH, aPropertyStates )); } - ::std::vector< XMLPropertyState > aPropertyStates( m_xCellStylesExportPropertySetMapper->Filter(_xProp) ); + ::std::vector<XMLPropertyState> aPropertyStates(m_xCellStylesExportPropertySetMapper->Filter(*this, _xProp)); Reference<XFixedLine> xFixedLine(_xProp,uno::UNO_QUERY); if ( xFixedLine.is() ) { @@ -1178,7 +1178,7 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted xBorderProp->setPropertyValue(it, aEmpty); } - ::std::vector< XMLPropertyState > aBorderStates(m_xCellStylesExportPropertySetMapper->Filter(xBorderProp)); + ::std::vector<XMLPropertyState> aBorderStates(m_xCellStylesExportPropertySetMapper->Filter(*this, xBorderProp)); aPropertyStates.insert( aPropertyStates.end(), aBorderStates.begin(), aBorderStates.end() ); } else @@ -1219,7 +1219,7 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted void ORptExport::exportAutoStyle(const Reference<XSection>& _xProp) { - ::std::vector< XMLPropertyState > aPropertyStates( m_xTableStylesExportPropertySetMapper->Filter(_xProp) ); + ::std::vector<XMLPropertyState> aPropertyStates(m_xTableStylesExportPropertySetMapper->Filter(*this, _xProp)); if ( !aPropertyStates.empty() ) m_aAutoStyleNames.emplace( _xProp.get(),GetAutoStylePool()->Add( XmlStyleFamily::TABLE_TABLE, aPropertyStates )); } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 7e95ae713000..28233c05fdd2 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1996,7 +1996,7 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x OUString sStyleName; sal_Int32 nNumberFormat(-1); sal_Int32 nValidationIndex(-1); - std::vector< XMLPropertyState > aPropStates(xCellStylesExportPropertySetMapper->Filter( xProperties )); + std::vector<XMLPropertyState> aPropStates(xCellStylesExportPropertySetMapper->Filter(*this, xProperties)); std::vector< XMLPropertyState >::iterator aItr(aPropStates.begin()); std::vector< XMLPropertyState >::iterator aEndItr(aPropStates.end()); sal_Int32 nCount(0); @@ -2130,7 +2130,7 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& xColumnProperties, const OUString* pOldName, sal_Int32& rIndex, bool& rIsVisible) { - std::vector<XMLPropertyState> aPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties)); + std::vector<XMLPropertyState> aPropStates(xColumnStylesExportPropertySetMapper->Filter(*this, xColumnProperties)); if(aPropStates.empty()) return; @@ -2167,7 +2167,7 @@ void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& void ScXMLExport::AddStyleFromRow(const uno::Reference<beans::XPropertySet>& xRowProperties, const OUString* pOldName, sal_Int32& rIndex) { - std::vector<XMLPropertyState> aPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties)); + std::vector<XMLPropertyState> aPropStates(xRowStylesExportPropertySetMapper->Filter(*this, xRowProperties)); if(aPropStates.empty()) return; @@ -2315,7 +2315,7 @@ void ScXMLExport::collectAutoStyles() uno::Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY); if (xTableProperties.is()) { - std::vector<XMLPropertyState> aPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); + std::vector<XMLPropertyState> aPropStates(xTableStylesExportPropertySetMapper->Filter(*this, xTableProperties)); OUString sName( rTableEntry.maName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TABLE_TABLE, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::TABLE_TABLE, sName); @@ -2349,7 +2349,7 @@ void ScXMLExport::collectAutoStyles() { if ( !rNoteEntry.maStyleName.isEmpty() ) { - std::vector<XMLPropertyState> aPropStates(xShapeMapper->Filter(xShapeProperties)); + std::vector<XMLPropertyState> aPropStates(xShapeMapper->Filter(*this, xShapeProperties)); OUString sName( rNoteEntry.maStyleName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::SD_GRAPHICS_ID, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::SD_GRAPHICS_ID, sName); @@ -2357,7 +2357,7 @@ void ScXMLExport::collectAutoStyles() if ( !rNoteEntry.maTextStyle.isEmpty() ) { std::vector<XMLPropertyState> aPropStates( - GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); + GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(*this, xShapeProperties)); OUString sName( rNoteEntry.maTextStyle ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TEXT_PARAGRAPH, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::TEXT_PARAGRAPH, sName); @@ -2389,7 +2389,7 @@ void ScXMLExport::collectAutoStyles() lcl_GetEnumerated( xCellText, rNoteParaEntry.maSelection.nStartPara ), uno::UNO_QUERY ); if ( xParaProp.is() ) { - std::vector<XMLPropertyState> aPropStates(xParaPropMapper->Filter(xParaProp)); + std::vector<XMLPropertyState> aPropStates(xParaPropMapper->Filter(*this, xParaProp)); OUString sName( rNoteParaEntry.maName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TEXT_PARAGRAPH, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::TEXT_PARAGRAPH, sName); @@ -2422,7 +2422,7 @@ void ScXMLExport::collectAutoStyles() { pCursor->SetSelection( rNoteTextEntry.maSelection ); - std::vector<XMLPropertyState> aPropStates(xTextPropMapper->Filter(xCursorProp)); + std::vector<XMLPropertyState> aPropStates(xTextPropMapper->Filter(*this, xCursorProp)); OUString sName( rNoteTextEntry.maName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TEXT_TEXT, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::TEXT_TEXT, sName); @@ -2463,7 +2463,7 @@ void ScXMLExport::collectAutoStyles() continue; pCursor->SetSelection( rTextEntry.maSelection ); - std::vector<XMLPropertyState> aPropStates(xTextPropMapper->Filter(xCursorProp)); + std::vector<XMLPropertyState> aPropStates(xTextPropMapper->Filter(*this, xCursorProp)); OUString sName( rTextEntry.maName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TEXT_TEXT, OUString(), aPropStates); GetAutoStylePool()->RegisterName(XmlStyleFamily::TEXT_TEXT, sName); @@ -2493,7 +2493,7 @@ void ScXMLExport::collectAutoStyles() uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY); if (xTableProperties.is()) { - std::vector<XMLPropertyState> aPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); + std::vector<XMLPropertyState> aPropStates(xTableStylesExportPropertySetMapper->Filter(*this, xTableProperties)); if(!aPropStates.empty()) { OUString sName; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index f303bc6e5e97..0b5080d23230 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -29,6 +29,7 @@ #include <svl/intitem.hxx> #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XExporter.hpp> @@ -335,7 +336,11 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto try { // older versions can not have this property set, it exists only starting from ODF1.2 - if (SvtSaveOptions::ODFSVER_013 <= nDefVersion) + uno::Reference<frame::XModule> const xModule(GetModel(), uno::UNO_QUERY); + bool const isBaseForm(xModule.is() && + xModule->getIdentifier() == "com.sun.star.sdb.FormDesign"); + SAL_INFO_IF(isBaseForm, "sfx.doc", "tdf#138209 force form export to ODF 1.2"); + if (!isBaseForm && SvtSaveOptions::ODFSVER_013 <= nDefVersion) { xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT)); } @@ -980,7 +985,11 @@ bool SfxObjectShell::DoSave() { try // tdf#134582 set Version on embedded objects as they { // could have been loaded with a different/old version - if (SvtSaveOptions::ODFSVER_013 <= nDefVersion) + uno::Reference<frame::XModule> const xModule(GetModel(), uno::UNO_QUERY); + bool const isBaseForm(xModule.is() && + xModule->getIdentifier() == "com.sun.star.sdb.FormDesign"); + SAL_INFO_IF(isBaseForm, "sfx.doc", "tdf#138209 force form export to ODF 1.2"); + if (!isBaseForm && SvtSaveOptions::ODFSVER_013 <= nDefVersion) { xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT)); } diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index ca590f6ddef6..eb5f74ced41d 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -196,7 +196,8 @@ inline void SwXMLTableItemMapper_Impl::SetAbsWidth( sal_uInt32 nAbs ) void SwXMLExport::InitItemExport() { m_pTwipUnitConverter.reset(new SvXMLUnitConverter(getComponentContext(), - util::MeasureUnit::TWIP, GetMM100UnitConverter().GetXMLMeasureUnit())); + util::MeasureUnit::TWIP, GetMM100UnitConverter().GetXMLMeasureUnit(), + getSaneDefaultVersion())); m_xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); m_xTableRowItemMap = new SvXMLItemMapEntries( aXMLTableRowItemMap ); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 6284be492afc..9281604c4fd9 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -225,7 +225,8 @@ void SwXMLImportTableItemMapper_Impl::finished( void SwXMLImport::InitItemImport() { m_pTwipUnitConv.reset( new SvXMLUnitConverter( GetComponentContext(), - util::MeasureUnit::TWIP, util::MeasureUnit::TWIP ) ); + util::MeasureUnit::TWIP, util::MeasureUnit::TWIP, + SvtSaveOptions::ODFSVER_LATEST_EXTENDED) ); m_xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); m_xTableColItemMap = new SvXMLItemMapEntries( aXMLTableColItemMap ); diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index f63d04c45fd4..ddd77f292345 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -438,7 +438,8 @@ void XMLChartExportPropertyMapper::handleSpecialItem( { if( ( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT ) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFSaneDefaultVersion() ); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentVersion < SvtSaveOptions::ODFSVER_012) sValueBuffer.append( GetXMLToken( XML_PERCENTAGE )); else @@ -495,7 +496,8 @@ void XMLChartExportPropertyMapper::handleSpecialItem( break; case XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE: { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFSaneDefaultVersion() ); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( + mrExport.getSaneDefaultVersion()); OUString aServiceName; rProperty.maValue >>= aServiceName; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index af5885d3e354..f418cebd4500 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -282,7 +282,8 @@ public: namespace { -CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex, +CustomLabelSeq lcl_getCustomLabelField(SvXMLExport const& rExport, + sal_Int32 nDataPointIndex, const uno::Reference< chart2::XDataSeries >& rSeries) { if (!rSeries.is()) @@ -291,7 +292,7 @@ CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex, // Custom data label text will be written to the <text:p> child element of a // <chart:data-label> element. That exists only since ODF 1.2. const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( - SvtSaveOptions().GetODFSaneDefaultVersion()); + rExport.getSaneDefaultVersion()); if (nCurrentODFVersion < SvtSaveOptions::ODFSVER_012) return CustomLabelSeq(); @@ -307,13 +308,17 @@ CustomLabelSeq lcl_getCustomLabelField(sal_Int32 nDataPointIndex, return CustomLabelSeq(); } -css::chart2::RelativePosition lcl_getCustomLabelPosition(sal_Int32 nDataPointIndex, +css::chart2::RelativePosition lcl_getCustomLabelPosition( + SvXMLExport const& rExport, + sal_Int32 const nDataPointIndex, const uno::Reference< chart2::XDataSeries >& rSeries) { if (!rSeries.is()) return chart2::RelativePosition(); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + rExport.getSaneDefaultVersion()); + if ((nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) == 0) // do not export to ODF 1.3 or older return chart2::RelativePosition(); @@ -1182,13 +1187,15 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > { Reference< beans::XPropertySet > xPropSet = rChartDoc->getArea(); if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) { //export data provider in xlink:href attribute - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); + if (nCurrentODFVersion >= SvtSaveOptions::ODFSVER_012) { OUString aDataProviderURL( ".." ); @@ -1272,7 +1279,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > { Reference< beans::XPropertySet > xPropSet( rChartDoc->getTitle(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) { @@ -1312,7 +1319,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > { Reference< beans::XPropertySet > xPropSet( rChartDoc->getSubTitle(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) @@ -1353,7 +1360,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > { Reference< beans::XPropertySet > xPropSet( rChartDoc->getLegend(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) @@ -1361,7 +1368,8 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > Reference< beans::XPropertySet > xProp( rChartDoc->getLegend(), uno::UNO_QUERY ); if( xProp.is()) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); // export legend anchor position try @@ -1864,7 +1872,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( if( xPropSet.is()) { if( mxExpPropMapper.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) { @@ -1983,7 +1991,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( if( xStockPropSet.is()) { aPropertyStates.clear(); - aPropertyStates = mxExpPropMapper->Filter( xStockPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xStockPropSet); if( !aPropertyStates.empty() ) { @@ -2005,7 +2013,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( if( xStockPropSet.is()) { aPropertyStates.clear(); - aPropertyStates = mxExpPropMapper->Filter( xStockPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xStockPropSet); if( !aPropertyStates.empty() ) { @@ -2027,7 +2035,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( if( xStockPropSet.is()) { aPropertyStates.clear(); - aPropertyStates = mxExpPropMapper->Filter( xStockPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xStockPropSet); if( !aPropertyStates.empty() ) { @@ -2058,7 +2066,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( Reference< beans::XPropertySet > xWallPropSet = xWallFloorSupplier->getWall(); if( xWallPropSet.is()) { - aPropertyStates = mxExpPropMapper->Filter( xWallPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xWallPropSet); if( !aPropertyStates.empty() ) { @@ -2085,7 +2093,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( if( !xFloorPropSet.is()) return; - aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xFloorPropSet); if( aPropertyStates.empty() ) return; @@ -2106,7 +2114,8 @@ void SchXMLExportHelper_Impl::exportPlotArea( void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram ) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion <= SvtSaveOptions::ODFSVER_012) //do not export to ODF 1.2 or older return; @@ -2177,7 +2186,7 @@ void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XProperty { if( !rTitleProps.is() ) return; - std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( rTitleProps ); + std::vector<XMLPropertyState> aPropertyStates = mxExpPropMapper->Filter(mrExport, rTitleProps); if( bExportContent ) { OUString aText; @@ -2205,7 +2214,7 @@ void SchXMLExportHelper_Impl::exportGrid( const Reference< beans::XPropertySet > { if( !rGridProperties.is() ) return; - std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( rGridProperties ); + std::vector<XMLPropertyState> aPropertyStates = mxExpPropMapper->Filter(mrExport, rGridProperties); if( bExportContent ) { AddAutoStyleAttribute( aPropertyStates ); @@ -2229,7 +2238,8 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis >& rChart2Axis, SvXMLExp if( !rChart2Axis.is() ) return bExportDateScale; - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + rExport.getSaneDefaultVersion()); if ((nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) == 0) //do not export to ODF 1.3 or older return bExportDateScale; @@ -2302,7 +2312,8 @@ void SchXMLExportHelper_Impl::exportAxis( // get property states for autostyles if( rAxisProps.is() && mxExpPropMapper.is() ) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED && eDimension == XML_X) { @@ -2318,7 +2329,7 @@ void SchXMLExportHelper_Impl::exportAxis( } lcl_exportNumberFormat( "NumberFormat", rAxisProps, mrExport ); - aPropertyStates = mxExpPropMapper->Filter( rAxisProps ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, rAxisProps); if (!maSrcShellID.isEmpty() && !maDestShellID.isEmpty() && maSrcShellID != maDestShellID) { @@ -2727,7 +2738,8 @@ void SchXMLExportHelper_Impl::exportSeries( TOOLS_INFO_EXCEPTION("xmloff.chart", "Required property not found in DataRowProperties" ); } - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion >= SvtSaveOptions::ODFSVER_012) { lcl_exportNumberFormat( "NumberFormat", xPropSet, mrExport ); @@ -2735,7 +2747,7 @@ void SchXMLExportHelper_Impl::exportSeries( } if( mxExpPropMapper.is()) - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) @@ -2760,7 +2772,8 @@ void SchXMLExportHelper_Impl::exportSeries( // #i75297# allow empty series, export empty range to have all ranges on import mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString()); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) // do not export to ODF 1.3 or older { if (xPropSet.is()) @@ -2898,7 +2911,7 @@ void SchXMLExportHelper_Impl::exportSeries( if( xStatProp.is() ) { - aPropertyStates = mxExpPropMapper->Filter( xStatProp ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xStatProp); if( !aPropertyStates.empty() ) { @@ -2931,7 +2944,8 @@ void SchXMLExportHelper_Impl::exportSeries( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), nSeriesLength, xNewDiagram, bExportContent ); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); // create <chart:data-label> child element if needed. if (xPropSet.is() && mxExpPropMapper.is()) @@ -3042,7 +3056,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( OUString aService = xServiceName->getServiceName(); - std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xProperties ); + std::vector<XMLPropertyState> aPropertyStates = mxExpPropMapper->Filter(mrExport, xProperties); // Add service name (which is regression type) sal_Int32 nIndex = GetPropertySetMapper()->FindEntryIndex(XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE); @@ -3057,7 +3071,8 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient") >>= bShowRSquared; bExportEquation = ( bShowEquation || bShowRSquared ); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentVersion < SvtSaveOptions::ODFSVER_012) { bExportEquation=false; @@ -3071,7 +3086,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( { mrExport.addDataStyle( nNumberFormat ); } - aEquationPropertyStates = mxExpPropMapper->Filter( xEquationProperties ); + aEquationPropertyStates = mxExpPropMapper->Filter(mrExport, xEquationProperties); } } @@ -3132,7 +3147,8 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe { assert(mxExpPropMapper.is()); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion( + mrExport.getSaneDefaultVersion()); /// Don't export X ErrorBars for older ODF versions. if (!bYError && nCurrentVersion < SvtSaveOptions::ODFSVER_012) @@ -3182,7 +3198,7 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe } } - std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp ); + std::vector<XMLPropertyState> aPropertyStates = mxExpPropMapper->Filter(mrExport, xErrorBarProp); if( aPropertyStates.empty() ) return; @@ -3347,7 +3363,8 @@ void SchXMLExportHelper_Impl::exportDataPoints( xSeriesProperties->getPropertyValue("AttributedDataPoints") >>= aDataPointSeq; xSeriesProperties->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint; - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) // do not export to ODF 1.3 or older xSeriesProperties->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; } @@ -3401,7 +3418,8 @@ void SchXMLExportHelper_Impl::exportDataPoints( SAL_WARN_IF( !xPropSet.is(), "xmloff.chart", "Pie Segments should have properties" ); if( xPropSet.is()) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion >= SvtSaveOptions::ODFSVER_012 && bExportNumFmt) { lcl_exportNumberFormat( "NumberFormat", xPropSet, mrExport ); @@ -3426,7 +3444,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( } } - aPropertyStates = mxExpPropMapper->Filter(xPropSet); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); if (!aPropertyStates.empty() || !aDataLabelPropertyStates.empty()) { if (bExportContent) @@ -3448,8 +3466,8 @@ void SchXMLExportHelper_Impl::exportDataPoints( maAutoStyleNameQueue.pop(); } if(bExportNumFmt) - aPoint.mCustomLabelText = lcl_getCustomLabelField(nElement, xSeries); - aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(nElement, xSeries); + aPoint.mCustomLabelText = lcl_getCustomLabelField(mrExport, nElement, xSeries); + aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(mrExport, nElement, xSeries); aDataPointVector.push_back( aPoint ); } @@ -3497,7 +3515,8 @@ void SchXMLExportHelper_Impl::exportDataPoints( } if( xPropSet.is()) { - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + mrExport.getSaneDefaultVersion()); if (nCurrentODFVersion >= SvtSaveOptions::ODFSVER_012) { lcl_exportNumberFormat( "NumberFormat", xPropSet, mrExport ); @@ -3511,7 +3530,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( mxExpPropMapper); } - aPropertyStates = mxExpPropMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); if (!aPropertyStates.empty() || !aDataLabelPropertyStates.empty()) { @@ -3526,8 +3545,8 @@ void SchXMLExportHelper_Impl::exportDataPoints( aPoint.maStyleName = maAutoStyleNameQueue.front(); maAutoStyleNameQueue.pop(); } - aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries); - aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(nCurrIndex, xSeries); + aPoint.mCustomLabelText = lcl_getCustomLabelField(mrExport, nCurrIndex, xSeries); + aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(mrExport, nCurrIndex, xSeries); if (!aDataLabelPropertyStates.empty()) { SAL_WARN_IF(maAutoStyleNameQueue.empty(), "xmloff.chart", diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index db6a2e6a68ee..27fa23987b59 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -609,7 +609,8 @@ void exportRangeToSomewhere( SvXMLExport& rExport, const OUString& rValue ) //#i113950# first the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore within ODF 1.2 //as an alternative the range info is now saved into the description at an empty group element (not very nice, but ODF conform) - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion( + rExport.getSaneDefaultVersion()); if (nCurrentODFVersion == SvtSaveOptions::ODFSVER_010 || nCurrentODFVersion == SvtSaveOptions::ODFSVER_011) return;//svg:desc is not allowed at draw:g in ODF1.0; but as the ranges for error bars are anyhow not allowed within ODF1.0 nor ODF1.1 we do not need the information diff --git a/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx index 0a14b506352a..c50450740db3 100644 --- a/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx +++ b/xmloff/source/chart/XMLErrorBarStylePropertyHdl.cxx @@ -18,6 +18,8 @@ */ #include "XMLErrorBarStylePropertyHdl.hxx" + +#include <xmloff/xmluconv.hxx> #include <unotools/saveopt.hxx> #include <com/sun/star/chart/ErrorBarStyle.hpp> @@ -35,10 +37,10 @@ XMLErrorBarStylePropertyHdl::~XMLErrorBarStylePropertyHdl() } bool XMLErrorBarStylePropertyHdl::exportXML( OUString& rStrExpValue, - const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const + const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter) const { uno::Any aValue(rValue); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(rUnitConverter.getSaneDefaultVersion()); if (nCurrentVersion < SvtSaveOptions::ODFSVER_012) { sal_Int32 nValue = 0; diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index c5bcc2a4db95..d355e4a0ff28 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -22,6 +22,7 @@ #include <sal/log.hxx> #include <stack> +#include <optional> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> #include <osl/mutex.hxx> @@ -58,6 +59,7 @@ #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModule.hpp> #include <xmloff/GradientStyle.hxx> #include <xmloff/HatchStyle.hxx> #include <xmloff/ImageStyle.hxx> @@ -260,6 +262,7 @@ public: uno::Reference< embed::XStorage > mxTargetStorage; SvtSaveOptions maSaveOptions; + std::optional<SvtSaveOptions::ODFSaneDefaultVersion> m_oOverrideODFVersion; /// name of stream in package, e.g., "content.xml" OUString mStreamName; @@ -418,6 +421,32 @@ void SvXMLExport::DetermineModelType_() if ( mxModel.is() ) { meModelType = SvtModuleOptions::ClassifyFactoryByModel( mxModel ); + + // note: MATH documents will throw NotInitializedException; maybe unit test problem + if (meModelType == SvtModuleOptions::EFactory::WRITER) + { + uno::Reference<frame::XModule> const xModule(mxModel, uno::UNO_QUERY); + bool const isBaseForm(xModule.is() && + xModule->getIdentifier() == "com.sun.star.sdb.FormDesign"); + if (isBaseForm) + { + switch (mpImpl->maSaveOptions.GetODFSaneDefaultVersion()) + { + case SvtSaveOptions::ODFSVER_013_EXTENDED: + SAL_INFO("xmloff.core", "tdf#138209 force form export to ODF 1.2"); + mpImpl->m_oOverrideODFVersion = SvtSaveOptions::ODFSVER_012_EXTENDED; + maUnitConv.overrideSaneDefaultVersion(SvtSaveOptions::ODFSVER_012_EXTENDED); + break; + case SvtSaveOptions::ODFSVER_013: + SAL_INFO("xmloff.core", "tdf#138209 force form export to ODF 1.2"); + mpImpl->m_oOverrideODFVersion = SvtSaveOptions::ODFSVER_012; + maUnitConv.overrideSaneDefaultVersion(SvtSaveOptions::ODFSVER_012); + break; + default: + break; + } + } + } } } @@ -430,7 +459,7 @@ SvXMLExport::SvXMLExport( m_xContext(xContext), m_implementationName(implementationName), mxAttrList( new SvXMLAttributeList ), mpNamespaceMap( new SvXMLNamespaceMap ), - maUnitConv( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit ), + maUnitConv(xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit, getSaneDefaultVersion()), meClass( eClass ), mnExportFlags( nExportFlags ), mnErrorFlags( SvXMLErrorFlags::NO ), @@ -455,7 +484,7 @@ SvXMLExport::SvXMLExport( mxAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - maUnitConv( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit ), + maUnitConv(xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit, getSaneDefaultVersion()), meClass( XML_TOKEN_INVALID ), mnExportFlags( SvXMLExportFlags::NONE ), mnErrorFlags( SvXMLErrorFlags::NO ), @@ -490,7 +519,8 @@ SvXMLExport::SvXMLExport( mpNamespaceMap( new SvXMLNamespaceMap ), maUnitConv( xContext, util::MeasureUnit::MM_100TH, - SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit) ), + SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit), + getSaneDefaultVersion()), meClass( XML_TOKEN_INVALID ), mnExportFlags( nExportFlag ), mnErrorFlags( SvXMLErrorFlags::NO ), @@ -2291,11 +2321,11 @@ uno::Reference< embed::XStorage > const & SvXMLExport::GetTargetStorage() const SvtSaveOptions::ODFSaneDefaultVersion SvXMLExport::getSaneDefaultVersion() const { - if( mpImpl ) - return mpImpl->maSaveOptions.GetODFSaneDefaultVersion(); - - // fatal error, use current version as default - return SvtSaveOptions::ODFSVER_LATEST; + if (mpImpl->m_oOverrideODFVersion) + { + return *mpImpl->m_oOverrideODFVersion; + } + return mpImpl->maSaveOptions.GetODFSaneDefaultVersion(); } void diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 9bd811775185..1f21acef1876 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -411,7 +411,8 @@ SvXMLImport::SvXMLImport( mpNamespaceMap( new SvXMLNamespaceMap ), mpUnitConv( new SvXMLUnitConverter( xContext, - util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), + util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH, + SvtSaveOptions::ODFSVER_LATEST_EXTENDED) ), mnImportFlags( nImportFlags ), maNamespaceHandler( new SvXMLImportFastNamespaceHandler() ), diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index 23f3d7017ccd..9cc7fe68370a 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -66,6 +66,7 @@ struct SvXMLUnitConverter::Impl { sal_Int16 m_eCoreMeasureUnit; /*css::util::MeasureUnit*/ sal_Int16 m_eXMLMeasureUnit; /*css::util::MeasureUnit*/ + SvtSaveOptions::ODFSaneDefaultVersion m_eODFVersion; util::Date m_aNullDate; mutable uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo; mutable uno::Reference< i18n::XCharacterClassification > m_xCharClass; @@ -73,9 +74,11 @@ struct SvXMLUnitConverter::Impl Impl(uno::Reference<uno::XComponentContext> const& xContext, sal_Int16 const eCoreMeasureUnit, - sal_Int16 const eXMLMeasureUnit) + sal_Int16 const eXMLMeasureUnit, + SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion) : m_eCoreMeasureUnit(eCoreMeasureUnit) , m_eXMLMeasureUnit(eXMLMeasureUnit) + , m_eODFVersion(nODFVersion) , m_aNullDate(30, 12, 1899) , m_xContext(xContext) { @@ -117,6 +120,17 @@ sal_Int16 SvXMLUnitConverter::GetXMLMeasureUnit() const return m_pImpl->m_eXMLMeasureUnit; } +SvtSaveOptions::ODFSaneDefaultVersion SvXMLUnitConverter::getSaneDefaultVersion() const +{ + return m_pImpl->m_eODFVersion; +} + +void SvXMLUnitConverter::overrideSaneDefaultVersion( + SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion) +{ + m_pImpl->m_eODFVersion = nODFVersion; +} + /** constructs a SvXMLUnitConverter. The core measure unit is the default unit for numerical measures, the XML measure unit is the default unit for textual measures @@ -125,8 +139,9 @@ sal_Int16 SvXMLUnitConverter::GetXMLMeasureUnit() const SvXMLUnitConverter::SvXMLUnitConverter( const uno::Reference<uno::XComponentContext>& xContext, sal_Int16 const eCoreMeasureUnit, - sal_Int16 const eXMLMeasureUnit) -: m_pImpl(new Impl(xContext, eCoreMeasureUnit, eXMLMeasureUnit)) + sal_Int16 const eXMLMeasureUnit, + SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion) +: m_pImpl(new Impl(xContext, eCoreMeasureUnit, eXMLMeasureUnit, nODFVersion)) { } diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index bab2dc2aa27f..652bce79610d 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -1528,7 +1528,7 @@ OUString SdXMLExport::ImpCreatePresPageStyleName( const Reference<XDrawPage>& xD const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() ); - std::vector< XMLPropertyState > aPropStates( aMapperRef->Filter( xPropSet ) ); + std::vector<XMLPropertyState> aPropStates(aMapperRef->Filter(*this, xPropSet)); if( !aPropStates.empty() ) { diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 96971ab4c555..e68bf388325f 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -392,7 +392,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap sal_Int32 nCount = 0; if( !bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape) ) { - aPropStates = GetPropertySetMapper()->Filter( xPropSet ); + aPropStates = GetPropertySetMapper()->Filter(mrExport, xPropSet); if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType) { @@ -443,7 +443,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap // optionally generate auto style for text attributes if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText ) { - aPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet ); + aPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(mrExport, xPropSet); // yet more additionally, we need to care for the ParaAdjust property if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType ) diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index c587394d383f..e87d8fae9fc3 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -569,7 +569,7 @@ namespace xmloff // determine a number style, if needed xColumnPropertiesMeta = xColumnProperties->getPropertySetInfo(); // get the styles of the column - ::std::vector< XMLPropertyState > aPropertyStates = m_xStyleExportMapper->Filter( xColumnProperties ); + ::std::vector<XMLPropertyState> aPropertyStates = m_xStyleExportMapper->Filter(m_rContext, xColumnProperties); // care for the number format, additionally OUString sColumnNumberStyle; diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index 0f00a2c13bb6..b9f3c95a47d6 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -71,7 +71,7 @@ void XMLPageExport::collectPageMasterAutoStyle( SAL_WARN_IF( !xPageMasterPropSetMapper.is(), "xmloff", "page master family/XMLPageMasterPropSetMapper not found" ); if( xPageMasterPropSetMapper.is() ) { - ::std::vector<XMLPropertyState> aPropStates = xPageMasterExportPropMapper->Filter( rPropSet ); + ::std::vector<XMLPropertyState> aPropStates = xPageMasterExportPropMapper->Filter(rExport, rPropSet); if( !aPropStates.empty()) { OUString sParent; @@ -84,7 +84,7 @@ void XMLPageExport::collectPageMasterAutoStyle( } assert(m_xPageMasterDrawingPageExportPropMapper.is()); ::std::vector<XMLPropertyState> const aPropStates( - m_xPageMasterDrawingPageExportPropMapper->Filter(rPropSet)); + m_xPageMasterDrawingPageExportPropMapper->Filter(rExport, rPropSet)); if (!aPropStates.empty()) { OUString sParent; @@ -287,7 +287,7 @@ void XMLPageExport::exportDefaultStyle() GetExport().CheckAttrList(); ::std::vector< XMLPropertyState > aPropStates = - xPageMasterExportPropMapper->FilterDefaults( xPropSet ); + xPageMasterExportPropMapper->FilterDefaults(rExport, xPropSet); bool bExport = false; rtl::Reference < XMLPropertySetMapper > aPropMapper(xPageMasterExportPropMapper->getPropertySetMapper()); diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx index 2834e519d122..4b6b1aebbf1d 100644 --- a/xmloff/source/style/chrlohdl.cxx +++ b/xmloff/source/style/chrlohdl.cxx @@ -218,7 +218,8 @@ bool XMLCharScriptHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue return true; } -bool XMLCharScriptHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const +bool XMLCharScriptHdl::exportXML(OUString& rStrExpValue, + const uno::Any& rValue, const SvXMLUnitConverter& rUnitConv) const { lang::Locale aLocale; if(!(rValue >>= aLocale)) @@ -233,7 +234,7 @@ bool XMLCharScriptHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue if (!aLanguageTag.hasScript()) return false; - if (SvtSaveOptions().GetODFSaneDefaultVersion() < SvtSaveOptions::ODFSVER_012) + if (rUnitConv.getSaneDefaultVersion() < SvtSaveOptions::ODFSVER_012) return false; OUString aLanguage, aCountry; @@ -346,7 +347,8 @@ bool XMLCharRfcLanguageTagHdl::importXML( const OUString& rStrImpValue, uno::Any return true; } -bool XMLCharRfcLanguageTagHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const +bool XMLCharRfcLanguageTagHdl::exportXML(OUString& rStrExpValue, + const uno::Any& rValue, const SvXMLUnitConverter& rUnitConv) const { lang::Locale aLocale; if(!(rValue >>= aLocale)) @@ -356,7 +358,7 @@ bool XMLCharRfcLanguageTagHdl::exportXML( OUString& rStrExpValue, const uno::Any if (aLocale.Variant.isEmpty()) return false; - if (SvtSaveOptions().GetODFSaneDefaultVersion() < SvtSaveOptions::ODFSVER_012) + if (rUnitConv.getSaneDefaultVersion() < SvtSaveOptions::ODFSVER_012) return false; rStrExpValue = aLocale.Variant; diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 734318a0ab13..8b4256a3d043 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -361,7 +361,7 @@ bool XMLStyleExport::exportStyle( // <style:properties> ::std::vector< XMLPropertyState > aPropStates = - rPropMapper->Filter( xPropSet, true ); + rPropMapper->Filter(GetExport(), xPropSet, true); bool const bUseExtensionNamespaceForGraphicProperties( rXMLFamily != "drawing-page" && rXMLFamily != "graphic" && @@ -401,7 +401,7 @@ void XMLStyleExport::exportDefaultStyle( true, true ); // <style:properties> ::std::vector< XMLPropertyState > aPropStates = - rPropMapper->FilterDefaults( xPropSet ); + rPropMapper->FilterDefaults(GetExport(), xPropSet); rPropMapper->exportXML( GetExport(), aPropStates, SvXmlExportFlags::IGN_WS ); } diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 129a568065c1..aeda6e081405 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -512,18 +512,21 @@ void SvXMLExportPropertyMapper::ChainExportMapper( } std::vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter( + SvXMLExport const& rExport, const uno::Reference<beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily ) const { - return Filter_(rPropSet, false, bEnableFoFontFamily); + return Filter_(rExport, rPropSet, false, bEnableFoFontFamily); } std::vector<XMLPropertyState> SvXMLExportPropertyMapper::FilterDefaults( + SvXMLExport const& rExport, const uno::Reference<beans::XPropertySet>& rPropSet ) const { - return Filter_(rPropSet, true, false/*bEnableFoFontFamily*/); + return Filter_(rExport, rPropSet, true, false/*bEnableFoFontFamily*/); } vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_( + SvXMLExport const& rExport, const Reference<XPropertySet>& xPropSet, bool bDefault, bool bEnableFoFontFamily ) const { vector< XMLPropertyState > aPropStateArray; @@ -545,7 +548,7 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_( if( !pFilterInfo ) { assert(SvtSaveOptions().GetODFDefaultVersion() != SvtSaveOptions::ODFVER_UNKNOWN); - const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion()); + const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(rExport.getSaneDefaultVersion()); pFilterInfo = new FilterPropertiesInfo_Impl; for( sal_Int32 i=0; i < nProps; i++ ) { diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 9f1bcd88ff2e..6deb085fcba7 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -235,7 +235,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) for( sal_Int32 nColumn = 0; nColumn < nColumnCount; ++nColumn ) try { Reference< XPropertySet > xPropSet( xIndexAccessCols->getByIndex(nColumn) , UNO_QUERY_THROW ); - std::vector< XMLPropertyState > aPropStates( mxColumnExportPropertySetMapper->Filter( xPropSet ) ); + std::vector<XMLPropertyState> aPropStates(mxColumnExportPropertySetMapper->Filter(mrExport, xPropSet)); if( has_states( aPropStates ) ) { @@ -259,7 +259,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) try { Reference< XPropertySet > xPropSet( xIndexAccessRows->getByIndex(nRow) , UNO_QUERY_THROW ); - std::vector< XMLPropertyState > aRowPropStates( mxRowExportPropertySetMapper->Filter( xPropSet ) ); + std::vector<XMLPropertyState> aRowPropStates(mxRowExportPropertySetMapper->Filter(mrExport, xPropSet)); if( has_states( aRowPropStates ) ) { @@ -287,7 +287,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) // create auto style, if needed OUString sStyleName; - std::vector< XMLPropertyState > aCellPropStates( mxCellExportPropertySetMapper->Filter( xCellSet ) ); + std::vector<XMLPropertyState> aCellPropStates(mxCellExportPropertySetMapper->Filter(mrExport, xCellSet)); if( has_states( aCellPropStates ) ) sStyleName = mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TABLE_CELL, aCellPropStates); else diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index bc12e93ba4be..b5c5de5b9133 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -535,7 +535,7 @@ void XMLTextParagraphExport::Add( XmlStyleFamily nFamily, SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); vector< XMLPropertyState > aPropStates = - xPropMapper->Filter( rPropSet ); + xPropMapper->Filter(GetExport(), rPropSet); if( ppAddStates ) { @@ -667,7 +667,7 @@ void XMLTextParagraphExport::Add( XmlStyleFamily nFamily, } SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); - vector< XMLPropertyState > aPropStates(xPropMapper->Filter( rPropSet )); + vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet)); if( rPropSetHelper.hasProperty( NUMBERING_RULES_AUTO ) ) { @@ -764,7 +764,7 @@ OUString XMLTextParagraphExport::Find( SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" ); if( !xPropMapper.is() ) return sName; - vector< XMLPropertyState > aPropStates(xPropMapper->Filter( rPropSet )); + vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet)); if( ppAddStates ) { while( *ppAddStates ) @@ -787,7 +787,7 @@ OUString XMLTextParagraphExport::FindTextStyleAndHyperlink( const XMLPropertyState** ppAddStates ) const { rtl::Reference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper()); - vector< XMLPropertyState > aPropStates(xPropMapper->Filter( rPropSet )); + vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet)); // Get parent and remove hyperlinks (they aren't of interest) OUString sName; |