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 f27ed690b61afac551e332473cf150353cfb03b8 Author: Jim Jagielski <[email protected]> AuthorDate: Fri Oct 30 09:55:53 2026 -0400 unotools, comphelper, xmloff, sfx2, dbaccess, embeddedobj, officecfg: add the ODF 1.3 and 1.3 Extended save modes Selectable by config value (5, 6) only; the options dialog does not list them yet. --- .../inc/comphelper/documentconstants.hxx | 2 ++ .../source/core/dataaccess/databasedocument.cxx | 4 +++- .../source/commonembedding/persistence.cxx | 4 ++-- .../schema/org/openoffice/Office/Common.xcs | 10 ++++++++++ main/sfx2/source/doc/objserv.cxx | 2 +- main/sfx2/source/doc/objstor.cxx | 8 +++++--- main/unotools/inc/unotools/saveopt.hxx | 6 ++++-- main/unotools/source/config/saveopt.cxx | 23 +++++++++++++++++++++- main/xmloff/source/core/xmlexp.cxx | 3 +++ main/xmloff/source/meta/MetaExportComponent.cxx | 2 ++ 10 files changed, 54 insertions(+), 10 deletions(-) diff --git a/main/comphelper/inc/comphelper/documentconstants.hxx b/main/comphelper/inc/comphelper/documentconstants.hxx index a7de08647d..f0c897bfd4 100644 --- a/main/comphelper/inc/comphelper/documentconstants.hxx +++ b/main/comphelper/inc/comphelper/documentconstants.hxx @@ -101,10 +101,12 @@ #define ODFVER_010_TEXT_ASCII "1.0" #define ODFVER_011_TEXT_ASCII "1.1" #define ODFVER_012_TEXT_ASCII "1.2" +#define ODFVER_013_TEXT_ASCII "1.3" #define ODFVER_010_TEXT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ODFVER_010_TEXT_ASCII ) ) #define ODFVER_011_TEXT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ODFVER_011_TEXT_ASCII ) ) #define ODFVER_012_TEXT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ODFVER_012_TEXT_ASCII ) ) +#define ODFVER_013_TEXT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ODFVER_013_TEXT_ASCII ) ) #endif // filter flags diff --git a/main/dbaccess/source/core/dataaccess/databasedocument.cxx b/main/dbaccess/source/core/dataaccess/databasedocument.cxx index 340241062d..fc846f25eb 100644 --- a/main/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/main/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1624,7 +1624,9 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion(); // older versions can not have this property set, it exists only starting from ODF1.2 - if ( nDefVersion >= SvtSaveOptions::ODFVER_012 ) + if ( nDefVersion >= SvtSaveOptions::ODFVER_013 ) + aVersion = ODFVER_013_TEXT; + else if ( nDefVersion >= SvtSaveOptions::ODFVER_012 ) aVersion = ODFVER_012_TEXT; if ( aVersion.getLength() ) diff --git a/main/embeddedobj/source/commonembedding/persistence.cxx b/main/embeddedobj/source/commonembedding/persistence.cxx index 717133e273..7ece4f1668 100644 --- a/main/embeddedobj/source/commonembedding/persistence.cxx +++ b/main/embeddedobj/source/commonembedding/persistence.cxx @@ -69,7 +69,7 @@ using namespace ::com::sun::star; //------------------------------------------------------ -// the value of Save/ODF/DefaultVersion that selects strict ODF 1.2 (SvtSaveOptions::ODFVER_012) +// the values of Save/ODF/DefaultVersion that select strict ODF 1.2 and 1.3 (SvtSaveOptions::ODFVER_012, ODFVER_013) static sal_Bool IsStrictODF12_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) { try @@ -81,7 +81,7 @@ static sal_Bool IsStrictODF12_Impl( const uno::Reference< lang::XMultiServiceFac ::rtl::OUString::createFromAscii( "Save/ODF" ), ::rtl::OUString::createFromAscii( "DefaultVersion" ), ::comphelper::ConfigurationHelper::E_READONLY ) >>= nVersion; - return nVersion == 4; + return nVersion == 4 || nVersion == 5; } catch ( uno::Exception& ) { diff --git a/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 4acbf385e8..824f2e9ca6 100644 --- a/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/main/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2221,6 +2221,16 @@ <desc>ODFVER_012_EXT</desc> </info> </enumeration> + <enumeration oor:value="5"> + <info> + <desc>ODFVER_013</desc> + </info> + </enumeration> + <enumeration oor:value="6"> + <info> + <desc>ODFVER_013_EXT</desc> + </info> + </enumeration> </constraints> <value>3</value> </prop> diff --git a/main/sfx2/source/doc/objserv.cxx b/main/sfx2/source/doc/objserv.cxx index 8551bc0fec..a00f8238b9 100644 --- a/main/sfx2/source/doc/objserv.cxx +++ b/main/sfx2/source/doc/objserv.cxx @@ -1366,7 +1366,7 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) bool bNoSig = false; if ( IsModified() || !GetMedium() || !GetMedium()->GetName().Len() - || (!aODFVersion.equals( ODFVER_012_TEXT ) && !bHasSign) ) + || (aODFVersion.compareTo( ODFVER_012_TEXT ) < 0 && !bHasSign) ) { // the document might need saving ( new, modified or in ODF1.1 format without signature ) diff --git a/main/sfx2/source/doc/objstor.cxx b/main/sfx2/source/doc/objstor.cxx index f7c05dbfea..a98dbc9dd1 100644 --- a/main/sfx2/source/doc/objstor.cxx +++ b/main/sfx2/source/doc/objstor.cxx @@ -374,7 +374,8 @@ 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 - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), uno::makeAny( ODFVER_012_TEXT ) ); + xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), + nDefVersion >= SvtSaveOptions::ODFVER_013 ? uno::makeAny( ODFVER_013_TEXT ) : uno::makeAny( ODFVER_012_TEXT ) ); } catch( uno::Exception& ) { @@ -1211,7 +1212,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl bTryToPreserveScriptSignature = pMedium->GetFilter() && pFilter && pMedium->GetFilter()->GetFilterName() == pFilter->GetFilterName(); bNoPreserveForOasis = ( - (aODFVersion.equals( ODFVER_012_TEXT ) && nVersion == SvtSaveOptions::ODFVER_011) || + (aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 && nVersion == SvtSaveOptions::ODFVER_011) || (!aODFVersion.getLength() && nVersion >= SvtSaveOptions::ODFVER_012) ); } @@ -1399,7 +1400,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl { try { - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), uno::makeAny( ODFVER_012_TEXT ) ); + xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), + aSaveOpt.GetODFDefaultVersion() >= SvtSaveOptions::ODFVER_013 ? uno::makeAny( ODFVER_013_TEXT ) : uno::makeAny( ODFVER_012_TEXT ) ); } catch( uno::Exception& ) { diff --git a/main/unotools/inc/unotools/saveopt.hxx b/main/unotools/inc/unotools/saveopt.hxx index ba4308410c..f437a1e75a 100644 --- a/main/unotools/inc/unotools/saveopt.hxx +++ b/main/unotools/inc/unotools/saveopt.hxx @@ -63,13 +63,15 @@ public: 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_013 = 6, // ODF 1.3 + ODFVER_013_EXT = 7, // ODF 1.3 with extensions 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; } + static sal_Bool IsODFExtended( ODFDefaultVersion eVersion ); + static sal_Bool IsODFStrict( ODFDefaultVersion eVersion ); SvtSaveOptions(); virtual ~SvtSaveOptions(); diff --git a/main/unotools/source/config/saveopt.cxx b/main/unotools/source/config/saveopt.cxx index 3e8d2b2a4b..b87e914388 100644 --- a/main/unotools/source/config/saveopt.cxx +++ b/main/unotools/source/config/saveopt.cxx @@ -491,6 +491,10 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() { if( nTmp == 3 ) eODFDefaultVersion = SvtSaveOptions::ODFVER_012_EXT; + else if( nTmp == 5 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_013; + else if( nTmp == 6 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_013_EXT; else if( nTmp >= 0 && nTmp <= 4 ) eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); } @@ -746,7 +750,14 @@ void SvtSaveOptions_Impl::Commit() case ODFDEFAULTVERSION: if (!bROODFDefaultVersion) { - pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_012_EXT) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion ); + sal_Int16 nODFVersion = sal_Int16( eODFDefaultVersion ); + if( eODFDefaultVersion == SvtSaveOptions::ODFVER_012_EXT ) + nODFVersion = 3; + else if( eODFDefaultVersion == SvtSaveOptions::ODFVER_013 ) + nODFVersion = 5; + else if( eODFDefaultVersion == SvtSaveOptions::ODFVER_013_EXT ) + nODFVersion = 6; + pValues[nRealCount] <<= nODFVersion; pNames[nRealCount] = pOrgNames[i]; ++nRealCount; } @@ -1054,6 +1065,16 @@ void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVe pImp->pSaveOpt->SetODFDefaultVersion( eVersion ); } +sal_Bool SvtSaveOptions::IsODFExtended( ODFDefaultVersion eVersion ) +{ + return eVersion == ODFVER_012_EXT || eVersion == ODFVER_013_EXT; +} + +sal_Bool SvtSaveOptions::IsODFStrict( ODFDefaultVersion eVersion ) +{ + return eVersion == ODFVER_012 || eVersion == ODFVER_013; +} + SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const { return pImp->pSaveOpt->GetODFDefaultVersion(); diff --git a/main/xmloff/source/core/xmlexp.cxx b/main/xmloff/source/core/xmlexp.cxx index fb9d9c33d3..2823c0e500 100644 --- a/main/xmloff/source/core/xmlexp.cxx +++ b/main/xmloff/source/core/xmlexp.cxx @@ -108,6 +108,7 @@ using namespace ::xmloff::token; sal_Char __READONLY_DATA sXML_1_1[] = "1.1"; sal_Char __READONLY_DATA sXML_1_2[] = "1.2"; +sal_Char __READONLY_DATA sXML_1_3[] = "1.3"; const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project"; @@ -1445,6 +1446,8 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) const sal_Char* pVersion = 0; switch( getDefaultVersion() ) { + case SvtSaveOptions::ODFVER_013_EXT: pVersion = sXML_1_3; break; + case SvtSaveOptions::ODFVER_013: pVersion = sXML_1_3; 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; diff --git a/main/xmloff/source/meta/MetaExportComponent.cxx b/main/xmloff/source/meta/MetaExportComponent.cxx index de1195a528..544ca61b8a 100644 --- a/main/xmloff/source/meta/MetaExportComponent.cxx +++ b/main/xmloff/source/meta/MetaExportComponent.cxx @@ -163,6 +163,8 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) const sal_Char* pVersion = 0; switch( getDefaultVersion() ) { + case SvtSaveOptions::ODFVER_013_EXT: pVersion = "1.3"; break; + case SvtSaveOptions::ODFVER_013: pVersion = "1.3"; 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;
