This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch odf13-devel in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit f46d1b7a198da73d2284fdc78b8ff5cd3ac8b39c Author: Jim Jagielski <[email protected]> AuthorDate: Fri Oct 30 09:55:44 2026 -0400 unotools, xmloff, sc, sw, sd, chart2, dbaccess, cui: replace ODFVER_LATEST with ODFVER_012_EXT and add mode predicates --- main/chart2/source/tools/DiagramHelper.cxx | 2 +- main/cui/source/options/optsave.cxx | 2 +- main/cui/source/options/optsave.src | 2 +- main/dbaccess/source/filter/xml/xmlExport.cxx | 4 ++-- .../registry/schema/org/openoffice/Office/Common.xcs | 2 +- .../sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 2 +- main/sc/source/filter/xml/XMLExportDDELinks.cxx | 2 +- main/sc/source/filter/xml/XMLExportDataPilot.cxx | 12 ++++++------ main/sc/source/filter/xml/XMLStylesExportHelper.cxx | 4 ++-- main/sc/source/filter/xml/xmlexprt.cxx | 8 ++++---- main/sc/source/filter/xml/xmlstyle.cxx | 2 +- main/sc/source/filter/xml/xmlwrap.cxx | 2 +- main/sd/source/ui/annotations/annotationmanager.cxx | 2 +- main/sw/source/filter/xml/xmlexpit.cxx | 2 +- main/sw/source/filter/xml/xmliteme.cxx | 2 +- main/unotools/inc/unotools/saveopt.hxx | 7 ++++++- main/unotools/source/config/saveopt.cxx | 8 ++++---- main/xmloff/source/chart/SchXMLExport.cxx | 12 ++++++------ main/xmloff/source/chart/SchXMLTools.cxx | 2 +- main/xmloff/source/core/xmlexp.cxx | 4 ++-- main/xmloff/source/draw/animationexport.cxx | 4 ++-- main/xmloff/source/draw/sdpropls.cxx | 4 ++-- main/xmloff/source/draw/sdxmlexp.cxx | 4 ++-- main/xmloff/source/draw/shapeexport.cxx | 2 +- main/xmloff/source/draw/shapeexport2.cxx | 4 ++-- main/xmloff/source/forms/elementexport.cxx | 14 +++++++------- main/xmloff/source/meta/MetaExportComponent.cxx | 2 +- main/xmloff/source/meta/xmlmetae.cxx | 2 +- main/xmloff/source/style/PageMasterExportPropMapper.cxx | 8 ++++---- main/xmloff/source/style/PageMasterStyleMap.cxx | 2 +- main/xmloff/source/style/XMLPageExport.cxx | 2 +- main/xmloff/source/style/bordrhdl.cxx | 2 +- main/xmloff/source/style/undlihdl.cxx | 2 +- main/xmloff/source/style/weighhdl.cxx | 2 +- main/xmloff/source/style/xmlexppr.cxx | 6 ++++-- main/xmloff/source/table/XMLTableExport.cxx | 4 ++-- main/xmloff/source/text/XMLLineNumberingExport.cxx | 2 +- main/xmloff/source/text/XMLSectionExport.cxx | 8 ++++---- main/xmloff/source/text/txtflde.cxx | 4 ++-- main/xmloff/source/text/txtparae.cxx | 6 +++--- main/xmloff/source/text/txtprmap.cxx | 2 +- 41 files changed, 88 insertions(+), 81 deletions(-) diff --git a/main/chart2/source/tools/DiagramHelper.cxx b/main/chart2/source/tools/DiagramHelper.cxx index 05e3464c17..f9010dabae 100644 --- a/main/chart2/source/tools/DiagramHelper.cxx +++ b/main/chart2/source/tools/DiagramHelper.cxx @@ -1709,7 +1709,7 @@ bool DiagramHelper::switchDiagramPositioningToExcludingPositioning( { //return true if something was changed const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//#i100778# todo: change this dependent on fileformat evolution + if( SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//#i100778# todo: change this dependent on fileformat evolution { uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartModel, uno::UNO_QUERY ) ; if( xOldDoc.is() ) diff --git a/main/cui/source/options/optsave.cxx b/main/cui/source/options/optsave.cxx index 808a056de8..6c3967dbfa 100644 --- a/main/cui/source/options/optsave.cxx +++ b/main/cui/source/options/optsave.cxx @@ -758,7 +758,7 @@ IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox ) IMPL_LINK( SfxSaveTabPage, ODFVersionHdl_Impl, ListBox *, EMPTYARG ) { long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) ); - bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != SvtSaveOptions::ODFVER_LATEST; + bool bShown = !SvtSaveOptions::IsODFExtended( SvtSaveOptions::ODFDefaultVersion( nVersion ) ); if ( bShown ) { bool bHasODFFormat = false; diff --git a/main/cui/source/options/optsave.src b/main/cui/source/options/optsave.src index d6dbca2a11..73a4336833 100644 --- a/main/cui/source/options/optsave.src +++ b/main/cui/source/options/optsave.src @@ -151,7 +151,7 @@ TabPage RID_SFXPAGE_SAVE { < "1.0/1.1" ; 2 ; > ; < "1.2" ; 4 ; > ; - < "1.2 Extended (recommended)" ; 0x7fffffff ; > ; + < "1.2 Extended (recommended)" ; 5 ; > ; }; }; CheckBox BTN_ODFENCRYPTION diff --git a/main/dbaccess/source/filter/xml/xmlExport.cxx b/main/dbaccess/source/filter/xml/xmlExport.cxx index ecbf283564..9becec6eed 100644 --- a/main/dbaccess/source/filter/xml/xmlExport.cxx +++ b/main/dbaccess/source/filter/xml/xmlExport.cxx @@ -201,7 +201,7 @@ namespace dbaxml virtual void ContextFilter( ::std::vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const { - if ( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if ( SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) { for ( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); ++aIter ) if ( aIter->mnIndex != -1 && getPropertySetMapper()->GetEntryAPIName( aIter->mnIndex ).equals( PROPERTY_FONTWIDTH ) ) @@ -614,7 +614,7 @@ void ODBExport::exportConnectionData() sal_Int32 nPort = -1; m_aTypeCollection.extractHostNamePort(sValue,sDatabaseName,sHostName,nPort); // db:type must use a declared namespace prefix in ODF 1.2, so the URL goes into the connection resource - if ( sHostName.Len() && SvtSaveOptions().GetODFDefaultVersion() != SvtSaveOptions::ODFVER_012 ) + if ( sHostName.Len() && !SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) { SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True); { diff --git a/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 7c6853a142..4acbf385e8 100644 --- a/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2218,7 +2218,7 @@ </enumeration> <enumeration oor:value="3"> <info> - <desc>ODFVER_LATEST</desc> + <desc>ODFVER_012_EXT</desc> </info> </enumeration> </constraints> diff --git a/main/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/main/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index 962c1e0787..2dfa38b57a 100644 --- a/main/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/main/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -198,7 +198,7 @@ void ScChangeTrackingExportHelper::WriteDepending(const ScChangeAction* pDependA // correct "dependency" element otherwise // ("dependence" is not in the schema, so strict ODF 1.2 always writes "dependency") const bool bSaveBackwardsCompatible = ( rExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) && - rExport.getDefaultVersion() != SvtSaveOptions::ODFVER_012; + !SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ); SvXMLElementExport aDependElem(rExport, XML_NAMESPACE_TABLE, bSaveBackwardsCompatible ? XML_DEPENDENCE : XML_DEPENDENCY, sal_True, sal_True); diff --git a/main/sc/source/filter/xml/XMLExportDDELinks.cxx b/main/sc/source/filter/xml/XMLExportDDELinks.cxx index 6ba86cf6b0..a0d426945f 100644 --- a/main/sc/source/filter/xml/XMLExportDDELinks.cxx +++ b/main/sc/source/filter/xml/XMLExportDDELinks.cxx @@ -208,7 +208,7 @@ void ScXMLExportDDELinks::WriteDDELinks(uno::Reference<sheet::XSpreadsheetDocume if (rExport.GetDocument() && rExport.GetDocument()->GetDdeLinkMode(nDDELink, nMode)) { - const sal_uInt16 nModePrefix = rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? + const sal_uInt16 nModePrefix = SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) ? XML_NAMESPACE_OFFICE : XML_NAMESPACE_TABLE; switch (nMode) { diff --git a/main/sc/source/filter/xml/XMLExportDataPilot.cxx b/main/sc/source/filter/xml/XMLExportDataPilot.cxx index 9b182b435b..fa5107b912 100644 --- a/main/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/main/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -447,7 +447,7 @@ void ScXMLExportDataPilot::WriteSubTotals(ScDPSaveDimension* pDim) sal_Int32 nSubTotalCount = pDim->GetSubTotalsCount(); const OUString* pLayoutName = NULL; - if (rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) + if (SvtSaveOptions::IsODFExtended( rExport.getDefaultVersion() )) // Export display names only for 1.2 extended or later. pLayoutName = pDim->GetSubtotalName(); @@ -479,7 +479,7 @@ void ScXMLExportDataPilot::WriteMembers(ScDPSaveDimension* pDim) { rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rtl::OUString((*i)->GetName())); - if (rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) + if (SvtSaveOptions::IsODFExtended( rExport.getDefaultVersion() )) { // Export display names only for ODF 1.2 extended or later. const OUString* pLayoutName = (*i)->GetLayoutName(); @@ -613,7 +613,7 @@ void ScXMLExportDataPilot::WriteGroupDimAttributes(const ScDPSaveGroupDimension* { if (pGroupDim) { - if (rExport.getDefaultVersion() != SvtSaveOptions::ODFVER_012) // not in the schema + if (!SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() )) // not in the schema rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_IS_GROUP_FIELD, XML_TRUE); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, pGroupDim->GetSourceDimName()); if (pGroupDim->GetDatePart()) @@ -628,7 +628,7 @@ void ScXMLExportDataPilot::WriteNumGroupDim(const ScDPSaveNumGroupDimension* pNu { if (pNumGroupDim) { - if (rExport.getDefaultVersion() != SvtSaveOptions::ODFVER_012) // not in the schema + if (!SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() )) // not in the schema rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_IS_GROUP_FIELD, XML_TRUE); // required by the schema; empty marks a numeric or date group rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, rtl::OUString()); @@ -692,7 +692,7 @@ void ScXMLExportDataPilot::WriteGroupDimElements(ScDPSaveDimension* pDim, const void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDimensionSaveData* pDimData) { rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, rtl::OUString(pDim->GetName())); - if (rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) + if (SvtSaveOptions::IsODFExtended( rExport.getDefaultVersion() )) { // Export display names only for ODF 1.2 extended or later. const OUString* pLayoutName = pDim->GetLayoutName(); @@ -819,7 +819,7 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads // grand total elements. const OUString* pGrandTotalName = pDPSave->GetGrandTotalName(); - if (pGrandTotalName && rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) + if (pGrandTotalName && SvtSaveOptions::IsODFExtended( rExport.getDefaultVersion() )) { // Use the new data-pilot-grand-total element. if (bRowGrand && bColumnGrand) diff --git a/main/sc/source/filter/xml/XMLStylesExportHelper.cxx b/main/sc/source/filter/xml/XMLStylesExportHelper.cxx index 0fe370cc93..871b9bfff3 100644 --- a/main/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/main/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -374,14 +374,14 @@ void ScMyValidationsContainer::WriteValidations(ScXMLExport& rExport) { case sheet::TableValidationVisibility::INVISIBLE: rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, - rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? XML_NONE : XML_NO); + SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) ? XML_NONE : XML_NO); break; case sheet::TableValidationVisibility::UNSORTED: rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, XML_UNSORTED); break; case sheet::TableValidationVisibility::SORTEDASCENDING: rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, - rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? XML_SORT_ASCENDING : XML_SORTED_ASCENDING); + SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) ? XML_SORT_ASCENDING : XML_SORTED_ASCENDING); break; default: DBG_ERROR("unknown ListType"); diff --git a/main/sc/source/filter/xml/xmlexprt.cxx b/main/sc/source/filter/xml/xmlexprt.cxx index cf52f5532f..06223b227c 100644 --- a/main/sc/source/filter/xml/xmlexprt.cxx +++ b/main/sc/source/filter/xml/xmlexprt.cxx @@ -1773,7 +1773,7 @@ void ScXMLExport::_ExportContent() CheckAttrList(); if ( pDoc && pDoc->GetSheetEvents( static_cast<SCTAB>(nTable) ) && - getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) { // store sheet events uno::Reference<document::XEventsSupplier> xSupplier(xTable, uno::UNO_QUERY); @@ -4260,7 +4260,7 @@ void ScXMLExport::WriteConsolidation() AddAttribute( XML_NAMESPACE_TABLE, XML_TARGET_CELL_ADDRESS, sStrData ); const XMLTokenEnum eUseLabel = - getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? XML_USE_LABELS : XML_USE_LABEL; + SvtSaveOptions::IsODFStrict( getDefaultVersion() ) ? XML_USE_LABELS : XML_USE_LABEL; if( pCons->bByCol && !pCons->bByRow ) AddAttribute( XML_NAMESPACE_TABLE, eUseLabel, XML_COLUMN ); else if( !pCons->bByCol && pCons->bByRow ) @@ -4490,7 +4490,7 @@ void ScXMLExport::CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uIn XML_NAMESPACE_PRESENTATION ); // shapes carry drawooo:display - if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) _GetNamespaceMap().Add( GetXMLToken( XML_NP_DRAW_EXT ), GetXMLToken( XML_N_DRAW_EXT ), @@ -4527,7 +4527,7 @@ sal_uInt32 ScXMLExport::exportDoc( enum XMLTokenEnum eClass ) // sheet events use officeooo namespace if( (getExportFlags() & EXPORT_CONTENT) != 0 && - getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) { bool bAnySheetEvents = false; SCTAB nTabCount = pDoc->GetTableCount(); diff --git a/main/sc/source/filter/xml/xmlstyle.cxx b/main/sc/source/filter/xml/xmlstyle.cxx index d6426325ad..3ced99a570 100644 --- a/main/sc/source/filter/xml/xmlstyle.cxx +++ b/main/sc/source/filter/xml/xmlstyle.cxx @@ -62,7 +62,7 @@ using namespace ::formula; using ::rtl::OUString; #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_010 } -#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_LATEST } +#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_EXTENSION } #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 } const XMLPropertyMapEntry aXMLScCellStylesProperties[] = diff --git a/main/sc/source/filter/xml/xmlwrap.cxx b/main/sc/source/filter/xml/xmlwrap.cxx index 534072fa6b..753438e68b 100644 --- a/main/sc/source/filter/xml/xmlwrap.cxx +++ b/main/sc/source/filter/xml/xmlwrap.cxx @@ -814,7 +814,7 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic // because without the ...DONE events, stream positions aren't updated. ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xModel)->GetSheetSaveData(); // strict ODF 1.2: no copying of sheet text that was loaded from a document that is not strict - if (pSheetData && pSheetData->IsInSupportedSave() && pExport->getDefaultVersion() != SvtSaveOptions::ODFVER_012) + if (pSheetData && pSheetData->IsInSupportedSave() && !SvtSaveOptions::IsODFStrict( pExport->getDefaultVersion() )) { try { diff --git a/main/sd/source/ui/annotations/annotationmanager.cxx b/main/sd/source/ui/annotations/annotationmanager.cxx index 43293f177d..054d156c44 100644 --- a/main/sd/source/ui/annotations/annotationmanager.cxx +++ b/main/sd/source/ui/annotations/annotationmanager.cxx @@ -603,7 +603,7 @@ void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet) const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( bReadOnly || bWrongPageKind || (nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST) ) + if( bReadOnly || bWrongPageKind || (!SvtSaveOptions::IsODFExtended( nCurrentODFVersion )) ) rSet.DisableItem( SID_INSERT_POSTIT ); rSet.Put(SfxBoolItem(SID_SHOW_POSTIT, mbShowAnnotations)); diff --git a/main/sw/source/filter/xml/xmlexpit.cxx b/main/sw/source/filter/xml/xmlexpit.cxx index 6637aeb7a0..ca045543bd 100644 --- a/main/sw/source/filter/xml/xmlexpit.cxx +++ b/main/sw/source/filter/xml/xmlexpit.cxx @@ -175,7 +175,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, for( sal_uInt16 i=0; i < nCount; i++ ) { // strict ODF 1.2: foreign attributes are invalid too - if( rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 || + if( SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) || ( rExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_012 && SvXMLIsODFNamespace( pUnknown->GetAttrNamespace( i ) ) ) ) continue; diff --git a/main/sw/source/filter/xml/xmliteme.cxx b/main/sw/source/filter/xml/xmliteme.cxx index 5721fad6ef..4a3a7c9fe2 100644 --- a/main/sw/source/filter/xml/xmliteme.cxx +++ b/main/sw/source/filter/xml/xmliteme.cxx @@ -238,7 +238,7 @@ void SwXMLExport::_InitItemExport() pTableItemMapper = new SwXMLTableItemMapper_Impl( xTableItemMap, *this ); - if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) { _GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT_EXT), diff --git a/main/unotools/inc/unotools/saveopt.hxx b/main/unotools/inc/unotools/saveopt.hxx index 796ff0df8d..ba4308410c 100644 --- a/main/unotools/inc/unotools/saveopt.hxx +++ b/main/unotools/inc/unotools/saveopt.hxx @@ -62,10 +62,15 @@ public: ODFVER_011 = 2, // ODF 1.1 DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration ODFVER_012 = 4, // ODF 1.2 + ODFVER_012_EXT = 5, // ODF 1.2 with extensions - ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements + ODFVER_EXTENSION = SAL_MAX_ENUM, // only in property map tables: export in the extended modes only }; + // Test the mode with these, not with a compare against a version: the extended modes sort above the strict ones. + static sal_Bool IsODFExtended( ODFDefaultVersion eVersion ) { return eVersion == ODFVER_012_EXT; } + static sal_Bool IsODFStrict( ODFDefaultVersion eVersion ) { return eVersion == ODFVER_012; } + SvtSaveOptions(); virtual ~SvtSaveOptions(); diff --git a/main/unotools/source/config/saveopt.cxx b/main/unotools/source/config/saveopt.cxx index 5154372512..3e8d2b2a4b 100644 --- a/main/unotools/source/config/saveopt.cxx +++ b/main/unotools/source/config/saveopt.cxx @@ -434,7 +434,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bLoadDocPrinter( sal_True ) , bUseSHA1InODF12( sal_False ) , bUseBlowfishInODF12( sal_False ) - , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) + , eODFDefaultVersion( SvtSaveOptions::ODFVER_012_EXT ) , bROAutoSaveTime( CFG_READONLY_DEFAULT ) , bROUseUserData( CFG_READONLY_DEFAULT ) , bROBackup( CFG_READONLY_DEFAULT ) @@ -490,8 +490,8 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() if ( pValues[nProp] >>= nTmp ) { if( nTmp == 3 ) - eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; - else + eODFDefaultVersion = SvtSaveOptions::ODFVER_012_EXT; + else if( nTmp >= 0 && nTmp <= 4 ) eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); } else { @@ -746,7 +746,7 @@ void SvtSaveOptions_Impl::Commit() case ODFDEFAULTVERSION: if (!bROODFDefaultVersion) { - pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion ); + pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_012_EXT) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion ); pNames[nRealCount] = pOrgNames[i]; ++nRealCount; } diff --git a/main/xmloff/source/chart/SchXMLExport.cxx b/main/xmloff/source/chart/SchXMLExport.cxx index 330a93d45a..ad80c7deed 100644 --- a/main/xmloff/source/chart/SchXMLExport.cxx +++ b/main/xmloff/source/chart/SchXMLExport.cxx @@ -1512,7 +1512,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& // export legend size const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( xLegendShape.is() && nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//do not export legend-expansion to ODF 1.0 and export size only if extensions are enabled //#i28670# todo: change this dependent on fileformat evolution + if( xLegendShape.is() && nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//do not export legend-expansion to ODF 1.0 and export size only if extensions are enabled //#i28670# todo: change this dependent on fileformat evolution { try { @@ -1594,7 +1594,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& { Any aShapesAny = xDocPropSet->getPropertyValue( OUString::createFromAscii( "AdditionalShapes" )); aShapesAny >>= mxAdditionalShapes; - if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_010 && mrExport.getDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) + if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_010 && !SvtSaveOptions::IsODFExtended( mrExport.getDefaultVersion() ) ) mxAdditionalShapes.clear(); } catch( uno::Exception & rEx ) @@ -2278,9 +2278,9 @@ void SchXMLExportHelper_Impl::exportPlotArea( void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram ) { const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older + if( !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//do not export to ODF 1.2 or older return; - if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //#i100778# todo: change this dependent on fileformat evolution + if( !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//export only if extensions are enabled //#i100778# todo: change this dependent on fileformat evolution return; Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY ); @@ -2404,7 +2404,7 @@ bool lcl_exportAxisType( const Reference< chart2::XAxis > xChart2Axis, SvXMLExpo return bExportDateScale; const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST ) //#i25706#todo: change version for next ODF version + if( !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) ) //#i25706#todo: change version for next ODF version return bExportDateScale; chart2::ScaleData aScale( xChart2Axis->getScaleData() ); @@ -3670,7 +3670,7 @@ SchXMLExport::SchXMLExport( maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) { - if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + if( SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); } diff --git a/main/xmloff/source/chart/SchXMLTools.cxx b/main/xmloff/source/chart/SchXMLTools.cxx index e2199d75af..815c8a1302 100644 --- a/main/xmloff/source/chart/SchXMLTools.cxx +++ b/main/xmloff/source/chart/SchXMLTools.cxx @@ -565,7 +565,7 @@ void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsL // text:tab-stop is not in ODF 1.2 SvXMLElementExport aElem( rExport, XML_NAMESPACE_TEXT, - ::xmloff::token::GetXMLToken( rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? ::xmloff::token::XML_TAB : ::xmloff::token::XML_TAB_STOP ), + ::xmloff::token::GetXMLToken( SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) ? ::xmloff::token::XML_TAB : ::xmloff::token::XML_TAB_STOP ), sal_False, sal_False ); } break; diff --git a/main/xmloff/source/core/xmlexp.cxx b/main/xmloff/source/core/xmlexp.cxx index 3be6e698c7..fb9d9c33d3 100644 --- a/main/xmloff/source/core/xmlexp.cxx +++ b/main/xmloff/source/core/xmlexp.cxx @@ -380,7 +380,7 @@ void SvXMLExport::_InitCtor() mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC ); mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF ); - if (getDefaultVersion() > SvtSaveOptions::ODFVER_012) + if (SvtSaveOptions::IsODFExtended( getDefaultVersion() )) { mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT); @@ -1445,7 +1445,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) const sal_Char* pVersion = 0; switch( getDefaultVersion() ) { - case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break; + case SvtSaveOptions::ODFVER_012_EXT: pVersion = sXML_1_2; break; case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break; case SvtSaveOptions::ODFVER_011: pVersion = sXML_1_1; break; case SvtSaveOptions::ODFVER_010: break; diff --git a/main/xmloff/source/draw/animationexport.cxx b/main/xmloff/source/draw/animationexport.cxx index a9fde3cf17..4e4e63ca99 100644 --- a/main/xmloff/source/draw/animationexport.cxx +++ b/main/xmloff/source/draw/animationexport.cxx @@ -1038,7 +1038,7 @@ void AnimationsExporterImpl::exportContainer( const Reference< XTimeContainer >& double fTemp = xIter->getIterateInterval(); if( fTemp ) { - if( 0 == ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) || mrExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if( 0 == ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) || SvtSaveOptions::IsODFStrict( mrExport.getDefaultVersion() ) ) { // issue 146582 sal_Int32 nSecondsFraction = static_cast<sal_Int32>(fTemp * 1000 ) % 1000; @@ -1219,7 +1219,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat nTemp = xAnimate->getAdditive(); // strict ODF 1.2 knows only replace and sum - if( nTemp != AnimationAdditiveMode::REPLACE && ( nTemp == AnimationAdditiveMode::SUM || mrExport.getDefaultVersion() != SvtSaveOptions::ODFVER_012 ) ) + if( nTemp != AnimationAdditiveMode::REPLACE && ( nTemp == AnimationAdditiveMode::SUM || !SvtSaveOptions::IsODFStrict( mrExport.getDefaultVersion() ) ) ) { SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ADDITIVE, sTmp.makeStringAndClear() ); diff --git a/main/xmloff/source/draw/sdpropls.cxx b/main/xmloff/source/draw/sdpropls.cxx index 72a27929cc..5c45266278 100644 --- a/main/xmloff/source/draw/sdpropls.cxx +++ b/main/xmloff/source/draw/sdpropls.cxx @@ -670,7 +670,7 @@ sal_Bool XMLMeasureUnitHdl::exportXML( OUString& rStrExpValue, const Any& rValue if( !XMLEnumPropertyHdl::exportXML( rStrExpValue, rValue, rUnitConverter ) ) return sal_False; - if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 && IsXMLToken( rStrExpValue, XML_UNIT_INCH ) ) + if( SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) && IsXMLToken( rStrExpValue, XML_UNIT_INCH ) ) rStrExpValue = GetXMLToken( XML_INCH ); return sal_True; } @@ -1545,7 +1545,7 @@ void XMLShapeExportPropertyMapper::ContextFilter( pClip11State->mnIndex = -1; // the FontWork attributes are not in ODF 1.2 - if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) { XMLPropertyState* aFontWork[] = { pFontWorkStyle, pFontWorkAdjust, pFontWorkDistance, pFontWorkStart, pFontWorkMirror, pFontWorkOutline, pFontWorkShadow, pFontWorkShadowColor, pFontWorkShadowOffsetx, diff --git a/main/xmloff/source/draw/sdxmlexp.cxx b/main/xmloff/source/draw/sdxmlexp.cxx index b8c6f3c14a..7f3c5661e5 100644 --- a/main/xmloff/source/draw/sdxmlexp.cxx +++ b/main/xmloff/source/draw/sdxmlexp.cxx @@ -636,7 +636,7 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent GetXMLToken(XML_N_ANIMATION), XML_NAMESPACE_ANIMATION); - if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) { _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE_EXT), @@ -2810,7 +2810,7 @@ void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDraw void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) { // do not export in ODF 1.2 or older - if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) + if( !SvtSaveOptions::IsODFExtended( getDefaultVersion() ) ) return; Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); diff --git a/main/xmloff/source/draw/shapeexport.cxx b/main/xmloff/source/draw/shapeexport.cxx index 03a634b989..2816084daa 100644 --- a/main/xmloff/source/draw/shapeexport.cxx +++ b/main/xmloff/source/draw/shapeexport.cxx @@ -704,7 +704,7 @@ 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.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) && + if( xSet.is() && ( SvtSaveOptions::IsODFExtended( mrExport.getDefaultVersion() ) ) && mrExport.GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_DRAW_EXT ).getLength() ) { if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape && diff --git a/main/xmloff/source/draw/shapeexport2.cxx b/main/xmloff/source/draw/shapeexport2.cxx index 25f217eeb8..cc853bdf4a 100644 --- a/main/xmloff/source/draw/shapeexport2.cxx +++ b/main/xmloff/source/draw/shapeexport2.cxx @@ -1594,7 +1594,7 @@ void XMLShapeExport::ImpExportOLE2Shape( sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED)); OUString sPersistName; - if( mrExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 && !bIsEmptyPresObj && !bExportEmbedded ) + if( SvtSaveOptions::IsODFStrict( mrExport.getDefaultVersion() ) && !bIsEmptyPresObj && !bExportEmbedded ) { // neither link nor content is invalid in 1.2, and the replacement image would only name an empty object sal_Bool bIsInt = sal_False; @@ -1681,7 +1681,7 @@ void XMLShapeExport::ImpExportOLE2Shape( // #i118485# Add text export, the draw OLE shape allows text now uno::Reference< text::XText > xOleText( xShape, uno::UNO_QUERY ); - if( ( mrExport.getDefaultVersion() < SvtSaveOptions::ODFVER_010 || mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) && xOleText.is() && xOleText->getString().getLength() ) ImpExportText( xShape ); + if( ( mrExport.getDefaultVersion() < SvtSaveOptions::ODFVER_010 || SvtSaveOptions::IsODFExtended( mrExport.getDefaultVersion() ) ) && xOleText.is() && xOleText->getString().getLength() ) ImpExportText( xShape ); if(bExportEmbedded && !bIsEmptyPresObj) { diff --git a/main/xmloff/source/forms/elementexport.cxx b/main/xmloff/source/forms/elementexport.cxx index 1ef68ba4bb..56038c9b8c 100644 --- a/main/xmloff/source/forms/elementexport.cxx +++ b/main/xmloff/source/forms/elementexport.cxx @@ -533,7 +533,7 @@ namespace xmloff attributeValue = handler->getAttributeValue( propValue ); // ODF 1.2 wants xsd:time for the time controls - if ( m_rContext.getGlobalContext().getDefaultVersion() == SvtSaveOptions::ODFVER_012 + if ( SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) && ( propDescription->propertyId == PID_TIME_MIN || propDescription->propertyId == PID_TIME_MAX || propDescription->propertyId == PID_DEFAULT_TIME @@ -745,7 +745,7 @@ namespace xmloff // strict ODF 1.2 knows only flat and 3d: NONE is written as flat sal_Int16 nVisualEffect = VisualEffect::LOOK3D; m_xProps->getPropertyValue( PROPERTY_VISUAL_EFFECT ) >>= nVisualEffect; - if ( m_rContext.getGlobalContext().getDefaultVersion() == SvtSaveOptions::ODFVER_012 && VisualEffect::NONE == nVisualEffect ) + if ( SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) && VisualEffect::NONE == nVisualEffect ) { AddAttributeASCII( OAttributeMetaData::getCommonControlAttributeNamespace( CCA_VISUAL_EFFECT ), @@ -883,7 +883,7 @@ namespace xmloff OSL_ENSURE((NULL == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)), "OControlExport::exportCommonControlAttributes: no property found for the value attribute!"); OSL_ENSURE((NULL == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)) || - ( VALUERANGE == m_eType && m_rContext.getGlobalContext().getDefaultVersion() == SvtSaveOptions::ODFVER_012 ), + ( VALUERANGE == m_eType && SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) ), "OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!"); #if OSL_DEBUG_LEVEL > 0 @@ -918,7 +918,7 @@ namespace xmloff if ( DA_INPUT_REQUIRED & m_nIncludeDatabase ) { // form:input-required is an ODF 1.4 attribute - if ( m_rContext.getGlobalContext().getDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if ( SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) ) exportedProperty( PROPERTY_INPUT_REQUIRED ); else exportBooleanPropertyAttribute( @@ -1520,7 +1520,7 @@ namespace xmloff knownType = true; } // form:validation is allowed on form:formatted-text only in ODF 1.2 - if ( m_rContext.getGlobalContext().getDefaultVersion() != SvtSaveOptions::ODFVER_012 ) + if ( !SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) ) m_nIncludeSpecial |= SCA_VALIDATION; // NO BREAK case FormComponentType::NUMERICFIELD: @@ -1759,7 +1759,7 @@ namespace xmloff CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE | CCA_TITLE | CCA_VALUE | CCA_ORIENTATION; // form:current-value is not allowed on form:value-range in ODF 1.2 - if ( m_rContext.getGlobalContext().getDefaultVersion() != SvtSaveOptions::ODFVER_012 ) + if ( !SvtSaveOptions::IsODFStrict( m_rContext.getGlobalContext().getDefaultVersion() ) ) m_nIncludeCommon |= CCA_CURRENT_VALUE; m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY; @@ -1821,7 +1821,7 @@ namespace xmloff // is (list-)control bound to XForms list? if( getXFormsListBindName( m_xProps ).getLength() > 0 && ( m_eType != COMBOBOX || m_rContext.getGlobalContext().getDefaultVersion() < SvtSaveOptions::ODFVER_010 || - m_rContext.getGlobalContext().getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) ) + SvtSaveOptions::IsODFExtended( m_rContext.getGlobalContext().getDefaultVersion() ) ) ) { m_nIncludeBindings |= BA_XFORMS_LISTBIND; } diff --git a/main/xmloff/source/meta/MetaExportComponent.cxx b/main/xmloff/source/meta/MetaExportComponent.cxx index 9d2e1c5de0..de1195a528 100644 --- a/main/xmloff/source/meta/MetaExportComponent.cxx +++ b/main/xmloff/source/meta/MetaExportComponent.cxx @@ -163,7 +163,7 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) const sal_Char* pVersion = 0; switch( getDefaultVersion() ) { - case SvtSaveOptions::ODFVER_LATEST: pVersion = "1.2"; break; + case SvtSaveOptions::ODFVER_012_EXT: pVersion = "1.2"; break; case SvtSaveOptions::ODFVER_012: pVersion = "1.2"; break; case SvtSaveOptions::ODFVER_011: pVersion = "1.1"; break; case SvtSaveOptions::ODFVER_010: break; diff --git a/main/xmloff/source/meta/xmlmetae.cxx b/main/xmloff/source/meta/xmlmetae.cxx index e954ff06c0..fa9dacf838 100644 --- a/main/xmloff/source/meta/xmlmetae.cxx +++ b/main/xmloff/source/meta/xmlmetae.cxx @@ -434,7 +434,7 @@ SvXMLMetaExport::startElement(const ::rtl::OUString & i_rName, const uno::Reference< xml::sax::XAttributeList > & i_xAttribs) { // strict ODF 1.2: custom metadata (foreign content) is not allowed - const bool bStrict = mrExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012; + const bool bStrict = SvtSaveOptions::IsODFStrict( mrExport.getDefaultVersion() ); if (m_skip) { ++m_skip; diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx b/main/xmloff/source/style/PageMasterExportPropMapper.cxx index e8f5ef314c..00a416bd9f 100644 --- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -546,7 +546,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( } // ext output stays as before (the ids once collided with the repeat offsets, so none was written) - if( SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFExtended( SvtSaveOptions().GetODFDefaultVersion() ) ) { if( pPMHeaderGraphicUrl ) lcl_RemoveState(pPMHeaderGraphicUrl); @@ -555,7 +555,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( } // ext output writes the page fill as the drawing page style of the master page instead - if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + if( SvtSaveOptions::IsODFExtended( SvtSaveOptions().GetODFDefaultVersion() ) ) { for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter ) { @@ -568,7 +568,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( // ODF 1.2 allows style:layout-grid-standard-mode in the default page layout only, so the other modes // drop it; extended mode keeps it so that a page style in standard mode survives a round trip - if( pPMGridBaseWidth && pPMStandardMode && SvtSaveOptions().GetODFDefaultVersion() != SvtSaveOptions::ODFVER_LATEST ) + if( pPMGridBaseWidth && pPMStandardMode && !SvtSaveOptions::IsODFExtended( SvtSaveOptions().GetODFDefaultVersion() ) ) lcl_RemoveState(pPMStandardMode); aPageBuffer.ContextFilter( rPropState ); @@ -594,7 +594,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( if( pPMScaleToPages ) lcl_RemoveStateIfZero16( pPMScaleToPages ); // style:scale-to-X and -Y are not in ODF 1.2 - const sal_Bool bStrict = SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012; + const sal_Bool bStrict = SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ); if( pPMScaleToX ) { if( bStrict ) diff --git a/main/xmloff/source/style/PageMasterStyleMap.cxx b/main/xmloff/source/style/PageMasterStyleMap.cxx index 1e27c61b75..172332c5bf 100644 --- a/main/xmloff/source/style/PageMasterStyleMap.cxx +++ b/main/xmloff/source/style/PageMasterStyleMap.cxx @@ -38,7 +38,7 @@ using namespace ::xmloff::token; //UUUU #define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context) // AOO extension, not ODF 1.2: strict export keeps only fo:background-color and style:background-image -#define _MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_LATEST } +#define _MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_EXTENSION } #define PLMAP_EXT(name,prefix,token,type,context) _MAP_EXT(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context) #define HFMAP_EXT(name,prefix,token,type,context) _MAP_EXT(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context) diff --git a/main/xmloff/source/style/XMLPageExport.cxx b/main/xmloff/source/style/XMLPageExport.cxx index ff99086d7b..a283959a63 100644 --- a/main/xmloff/source/style/XMLPageExport.cxx +++ b/main/xmloff/source/style/XMLPageExport.cxx @@ -91,7 +91,7 @@ namespace const Reference< XPropertySet >& rPropSet ) { ::std::vector< XMLPropertyState > aPropStates; - if( rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + if( SvtSaveOptions::IsODFExtended( rExport.getDefaultVersion() ) ) { UniReference< SvXMLExportPropertyMapper > xMapper( new XMLPageDrawingPageExportPropMapper( rExport ) ); aPropStates = xMapper->Filter( rPropSet ); diff --git a/main/xmloff/source/style/bordrhdl.cxx b/main/xmloff/source/style/bordrhdl.cxx index 3b149b3258..8ee0d210d8 100644 --- a/main/xmloff/source/style/bordrhdl.cxx +++ b/main/xmloff/source/style/bordrhdl.cxx @@ -295,7 +295,7 @@ sal_Bool XMLBorderWidthHdl::exportXML( OUString& rStrExpValue, const uno::Any& r // strict ODF 1.2 wants three positive lengths; a zero part is dropped on reload if( ( aBorderLine.LineDistance == 0 || aBorderLine.InnerLineWidth == 0 || aBorderLine.OuterLineWidth == 0 ) && - SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) return sal_False; rUnitConverter.convertMeasure( aOut, aBorderLine.InnerLineWidth ); diff --git a/main/xmloff/source/style/undlihdl.cxx b/main/xmloff/source/style/undlihdl.cxx index 07755f99e7..f48fdd34ff 100644 --- a/main/xmloff/source/style/undlihdl.cxx +++ b/main/xmloff/source/style/undlihdl.cxx @@ -276,7 +276,7 @@ sal_Bool XMLUnderlineStylePropHdl::exportXML( OUString& rStrExpValue, const uno: if( rValue >>= nValue ) { // small-wave is not a lineStyle in ODF 1.2 - if( FontUnderline::SMALLWAVE == nValue && SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if( FontUnderline::SMALLWAVE == nValue && SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) nValue = FontUnderline::WAVE; bRet = SvXMLUnitConverter::convertEnum( aOut, (sal_uInt16)nValue, pXML_UnderlineStyle_Enum ); diff --git a/main/xmloff/source/style/weighhdl.cxx b/main/xmloff/source/style/weighhdl.cxx index 1b50a5a65d..5c2b409a19 100644 --- a/main/xmloff/source/style/weighhdl.cxx +++ b/main/xmloff/source/style/weighhdl.cxx @@ -156,7 +156,7 @@ sal_Bool XMLFontWeightPropHdl::exportXML( OUString& rStrExpValue, const Any& rVa } // strict ODF 1.2 allows normal, bold and the hundreds only; rounding down keeps light and semilight apart - if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if( SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ) { switch( nWeight ) { diff --git a/main/xmloff/source/style/xmlexppr.cxx b/main/xmloff/source/style/xmlexppr.cxx index 1483f85189..abe30878e2 100644 --- a/main/xmloff/source/style/xmlexppr.cxx +++ b/main/xmloff/source/style/xmlexppr.cxx @@ -669,7 +669,9 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter( const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); const SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport( maPropMapper->GetEarliestODFVersionForExport( i ) ); - if( nCurrentVersion >= nEarliestODFVersionForExport + if( ( nEarliestODFVersionForExport == SvtSaveOptions::ODFVER_EXTENSION + ? SvtSaveOptions::IsODFExtended( nCurrentVersion ) + : nCurrentVersion >= nEarliestODFVersionForExport ) || nCurrentVersion == SvtSaveOptions::ODFVER_UNKNOWN || nEarliestODFVersionForExport == SvtSaveOptions::ODFVER_UNKNOWN ) pFilterInfo->AddProperty(rAPIName, i); @@ -997,7 +999,7 @@ void SvXMLExportPropertyMapper::_exportXML( xml::AttributeData aData; const sal_Bool bSkipODFNamespaces( SvtSaveOptions().GetODFDefaultVersion() >= SvtSaveOptions::ODFVER_012 ); // strict ODF 1.2: foreign attributes are invalid too - const sal_Bool bSkipForeign( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ); + const sal_Bool bSkipForeign( SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ) ); for( sal_Int32 i=0; i < nCount; i++, pAttribName++ ) { xAttrContainer->getByName( *pAttribName ) >>= aData; diff --git a/main/xmloff/source/table/XMLTableExport.cxx b/main/xmloff/source/table/XMLTableExport.cxx index 2f9fb02ba5..29d79d6b4c 100644 --- a/main/xmloff/source/table/XMLTableExport.cxx +++ b/main/xmloff/source/table/XMLTableExport.cxx @@ -125,7 +125,7 @@ protected: void XMLTableCellExportPropertyMapper::ContextFilter( std::vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const { - const bool bStrict = SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012; + const bool bStrict = SvtSaveOptions::IsODFStrict( SvtSaveOptions().GetODFDefaultVersion() ); bool bSolid = false; if( bStrict ) try { @@ -612,7 +612,7 @@ void XMLTableExport::exportTableTemplates() return; // ODF 1.2 strict: table:name, table:style-name and the part order of the schema (body before even-rows) - const bool bStrict = mrExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012; + const bool bStrict = SvtSaveOptions::IsODFStrict( mrExport.getDefaultVersion() ); const TableStyleElement* pMap = getTableStyleMap(); static const sal_Int32 aStrictPartOrder[] = { 0, 1, 2, 3, 8, 4, 5, 6, 7 }; diff --git a/main/xmloff/source/text/XMLLineNumberingExport.cxx b/main/xmloff/source/text/XMLLineNumberingExport.cxx index e0b7bf4f28..149140b61a 100644 --- a/main/xmloff/source/text/XMLLineNumberingExport.cxx +++ b/main/xmloff/source/text/XMLLineNumberingExport.cxx @@ -170,7 +170,7 @@ void XMLLineNumberingExport::Export() sal_Int16 nPosition = 0; aAny >>= nPosition; if (SvXMLUnitConverter::convertEnum(sNumPosBuf, nPosition, - rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? + SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ) ? aLineNumberPositionMapStrict : aLineNumberPositionMap)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NUMBER_POSITION, diff --git a/main/xmloff/source/text/XMLSectionExport.cxx b/main/xmloff/source/text/XMLSectionExport.cxx index 78da812f30..00b5f5806c 100644 --- a/main/xmloff/source/text/XMLSectionExport.cxx +++ b/main/xmloff/source/text/XMLSectionExport.cxx @@ -436,7 +436,7 @@ void XMLSectionExport::ExportRegularSectionStart( aAny >>= sCond; enum XMLTokenEnum eDisplay = XML_TOKEN_INVALID; // strict ODF 1.2 has no form for the condition of a visible section (display="condition" means hidden) - const sal_Bool bStrict = GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_012; + const sal_Bool bStrict = SvtSaveOptions::IsODFStrict( GetExport().getDefaultVersion() ); const sal_Bool bIsVisible = *(sal_Bool*)xPropSet->getPropertyValue(sIsVisible).getValue(); if (sCond.getLength() > 0 && !( bStrict && bIsVisible )) { @@ -1393,11 +1393,11 @@ void XMLSectionExport::ExportIndexTemplateElement( break; case TOK_TTYPE_HYPERLINK_START: // strict ODF 1.2 allows the link tokens in table-of-content templates only - if ( aODFVersion != SvtSaveOptions::ODFVER_012 || TEXT_SECTION_TYPE_TOC == eType ) + if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || TEXT_SECTION_TYPE_TOC == eType ) eElement = XML_INDEX_ENTRY_LINK_START; break; case TOK_TTYPE_HYPERLINK_END: - if ( aODFVersion != SvtSaveOptions::ODFVER_012 || TEXT_SECTION_TYPE_TOC == eType ) + if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || TEXT_SECTION_TYPE_TOC == eType ) eElement = XML_INDEX_ENTRY_LINK_END; break; case TOK_TTYPE_BIBLIOGRAPHY: @@ -1518,7 +1518,7 @@ void XMLSectionExport::ExportIndexTemplateElement( } // #i21237# - if (bWithTabStopOK && ! bWithTabStop && aODFVersion != SvtSaveOptions::ODFVER_012) + if (bWithTabStopOK && ! bWithTabStop && !SvtSaveOptions::IsODFStrict( aODFVersion )) { GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_WITH_TAB, diff --git a/main/xmloff/source/text/txtflde.cxx b/main/xmloff/source/text/txtflde.cxx index f86ea1ec76..94c03b1a33 100644 --- a/main/xmloff/source/text/txtflde.cxx +++ b/main/xmloff/source/text/txtflde.cxx @@ -281,7 +281,7 @@ inline Sequence<OUString> const GetStringSequenceProperty( // strict ODF 1.2 has no place for AOO's attributes in ODF namespaces static sal_Bool lcl_IsStrict( SvXMLExport& rExport ) { - return rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012; + return SvtSaveOptions::IsODFStrict( rExport.getDefaultVersion() ); } // office:currency is not allowed on text:variable-decl in ODF 1.2 @@ -1813,7 +1813,7 @@ void XMLTextFieldExport::ExportFieldHelper( } // initials - if ( GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) + if ( SvtSaveOptions::IsODFExtended( GetExport().getDefaultVersion() ) ) { OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) ); if ( aInitials.getLength() > 0 ) diff --git a/main/xmloff/source/text/txtparae.cxx b/main/xmloff/source/text/txtparae.cxx index dd5640e810..195a583020 100644 --- a/main/xmloff/source/text/txtparae.cxx +++ b/main/xmloff/source/text/txtparae.cxx @@ -2337,7 +2337,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { exportMeta( xPropSet, bAutoStyles, bIsProgress ); } - else if (GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_012 && + else if (SvtSaveOptions::IsODFStrict( GetExport().getDefaultVersion() ) && (sType.equals(sTextFieldStart) || sType.equals(sTextFieldEnd) || sType.equals(sTextFieldStartEnd))) { @@ -2882,7 +2882,7 @@ void XMLTextParagraphExport::_exportTextFrame( GetExport().EncodeStyleName( sAutoStyle ) ); // fo:min-width is not allowed on draw:frame in strict ODF 1.2 addTextFrameAttributes( rPropSet, sal_False, &aMinHeightValue, - GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_012 ? &aMinWidthValue : 0 ); + SvtSaveOptions::IsODFStrict( GetExport().getDefaultVersion() ) ? &aMinWidthValue : 0 ); SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, sal_False, sal_True ); @@ -3046,7 +3046,7 @@ void XMLTextParagraphExport::_exportTextGraphic( // svg:transform sal_Int16 nVal = 0; rPropSet->getPropertyValue( sGraphicRotation ) >>= nVal; - if( nVal != 0 && GetExport().getDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + if( nVal != 0 && SvtSaveOptions::IsODFStrict( GetExport().getDefaultVersion() ) ) { // draw:transform, radians and counter-clockwise like GraphicRotation, about the frame centre TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH; diff --git a/main/xmloff/source/text/txtprmap.cxx b/main/xmloff/source/text/txtprmap.cxx index 729c83071f..c9b176399c 100644 --- a/main/xmloff/source/text/txtprmap.cxx +++ b/main/xmloff/source/text/txtprmap.cxx @@ -82,7 +82,7 @@ using namespace ::xmloff::token; //UUUU #define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 } #define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context) -#define GMAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC), context, SvtSaveOptions::ODFVER_LATEST } +#define GMAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC), context, SvtSaveOptions::ODFVER_EXTENSION } XMLPropertyMapEntry aXMLParaPropMap[] = {
