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 20450d7aa48718923423b6fdc56bb63266085ae5
Author: Jim Jagielski <[email protected]>
AuthorDate: Fri Oct 30 09:58:01 2026 -0400

    unotools, xmloff, sc: Write the ODF 1.3 forms of coordinate-region, 
tab-color, drop-down, creator-initials, scale-to-X/Y, legend size, chart shapes 
and index links in the 1.3 modes
---
 main/sc/source/filter/xml/xmlstyle.cxx             |  5 ++++-
 main/unotools/inc/unotools/saveopt.hxx             |  1 +
 main/xmloff/inc/xmloff/xmltoken.hxx                |  3 +++
 main/xmloff/source/chart/SchXMLExport.cxx          | 13 ++++++------
 main/xmloff/source/core/xmltoken.cxx               |  3 +++
 .../source/style/PageMasterExportPropMapper.cxx    | 11 ++++++++++-
 main/xmloff/source/style/xmlexppr.cxx              | 16 ++++++++++-----
 main/xmloff/source/text/XMLSectionExport.cxx       | 10 +++++++---
 main/xmloff/source/text/txtflde.cxx                | 23 ++++++++++++++--------
 main/xmloff/source/text/txtfldi.cxx                |  5 +++++
 main/xmloff/source/text/txtimp.cxx                 |  2 ++
 11 files changed, 67 insertions(+), 25 deletions(-)

diff --git a/main/sc/source/filter/xml/xmlstyle.cxx 
b/main/sc/source/filter/xml/xmlstyle.cxx
index 3ced99a570..74d40aa81a 100644
--- a/main/sc/source/filter/xml/xmlstyle.cxx
+++ b/main/sc/source/filter/xml/xmlstyle.cxx
@@ -63,6 +63,8 @@ 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_EXTENSION }
+#define MAP_EXT_PRE13(name,prefix,token,type,context)  { name, sizeof(name)-1, 
prefix, token, type, context, SvtSaveOptions::ODFVER_EXTENSION_PRE_013 }
+#define MAP13(name,prefix,token,type,context)  { name, sizeof(name)-1, prefix, 
token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_013 }
 #define MAP_END()      { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, 
SvtSaveOptions::ODFVER_010 }
 
 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
@@ -170,7 +172,8 @@ const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
        MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, 
XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
        MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, 
XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, 
CTF_SC_MASTERPAGENAME ),
     MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, 
XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
-    MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, 
XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+    MAP_EXT_PRE13( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, 
XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
+    MAP13( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, 
XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
     MAP_END()
 };
 
diff --git a/main/unotools/inc/unotools/saveopt.hxx 
b/main/unotools/inc/unotools/saveopt.hxx
index f437a1e75a..d23b8c29b7 100644
--- a/main/unotools/inc/unotools/saveopt.hxx
+++ b/main/unotools/inc/unotools/saveopt.hxx
@@ -67,6 +67,7 @@ public:
         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
+        ODFVER_EXTENSION_PRE_013 = SAL_MAX_ENUM - 1,   // only in property map 
tables: export in the extended modes below ODF 1.3
     };
 
     // Test the mode with these, not with a compare against a version: the 
extended modes sort above the strict ones.
diff --git a/main/xmloff/inc/xmloff/xmltoken.hxx 
b/main/xmloff/inc/xmloff/xmltoken.hxx
index 3776abfe54..8bf88476a6 100644
--- a/main/xmloff/inc/xmloff/xmltoken.hxx
+++ b/main/xmloff/inc/xmloff/xmltoken.hxx
@@ -3147,6 +3147,9 @@ namespace xmloff { namespace token {
         XML_VERTICAL_BAR,
         XML_LAYOUT_GRID_SNAP_TO,
 
+        // ODF 1.3
+        XML_CREATOR_INITIALS,
+
         XML_TOKEN_END
     };
 
diff --git a/main/xmloff/source/chart/SchXMLExport.cxx 
b/main/xmloff/source/chart/SchXMLExport.cxx
index ad80c7deed..32e0598d58 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 && 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
+                if( xLegendShape.is() && nCurrentODFVersion >= 
SvtSaveOptions::ODFVER_012 && ( SvtSaveOptions::IsODFExtended( 
nCurrentODFVersion ) || nCurrentODFVersion >= SvtSaveOptions::ODFVER_013 ) 
)//do not export legend-expansion to ODF 1.0 and export size only if extensions 
are enabled or in ODF 1.3 //#i28670# todo: change this dependent on fileformat 
evolution
                 {
                     try
                                    {
@@ -1526,7 +1526,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< 
chart::XChartDocument >&
                             if( nLegendExpansion == 
chart::ChartLegendExpansion_CUSTOM)
                             {
                                 awt::Size aSize( xLegendShape->getSize() );
-                                addSize( aSize, true );
+                                addSize( aSize, nCurrentODFVersion < 
SvtSaveOptions::ODFVER_013 );
                                 rtl::OUStringBuffer aAspectRatioString;
                                 
SvXMLUnitConverter::convertDouble(aAspectRatioString, 
double(aSize.Width)/double(aSize.Height));
                                 mrExport.AddAttribute( XML_NAMESPACE_STYLE, 
XML_LEGEND_EXPANSION_ASPECT_RATIO, aAspectRatioString.makeStringAndClear() );
@@ -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 
&& !SvtSaveOptions::IsODFExtended( mrExport.getDefaultVersion() ) )
+                if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_010 
&& mrExport.getDefaultVersion() < SvtSaveOptions::ODFVER_013 && 
!SvtSaveOptions::IsODFExtended( mrExport.getDefaultVersion() ) )
                     mxAdditionalShapes.clear();
             }
             catch( uno::Exception & rEx )
@@ -2278,9 +2278,8 @@ void SchXMLExportHelper_Impl::exportPlotArea(
 void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< 
chart::XDiagram >& xDiagram )
 {
     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
-    if( !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//do not export 
to ODF 1.2 or older
-        return;
-    if( !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//export only if 
extensions are enabled //#i100778# todo: change this dependent on fileformat 
evolution
+    const sal_Bool bODF13( nCurrentODFVersion >= SvtSaveOptions::ODFVER_013 );
+    if( !bODF13 && !SvtSaveOptions::IsODFExtended( nCurrentODFVersion ) )//ODF 
1.2 and older have no coordinate region, extended mode writes it as an extension
         return;
 
     Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY 
);
@@ -2292,7 +2291,7 @@ void SchXMLExportHelper_Impl::exportCoordinateRegion( 
const uno::Reference< char
     addPosition( awt::Point(aRect.X,aRect.Y) );
     addSize( awt::Size(aRect.Width,aRect.Height) );
 
-    SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, 
XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart 
namespace in future - dependent on fileformat
+    SvXMLElementExport aCoordinateRegion( mrExport, bODF13 ? 
XML_NAMESPACE_CHART : XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, 
sal_True );
 }
 
 namespace
diff --git a/main/xmloff/source/core/xmltoken.cxx 
b/main/xmloff/source/core/xmltoken.cxx
index a717deb22c..193a4a62d8 100644
--- a/main/xmloff/source/core/xmltoken.cxx
+++ b/main/xmloff/source/core/xmltoken.cxx
@@ -3147,6 +3147,9 @@ namespace xmloff { namespace token {
         TOKEN( "vertical-bar",                 XML_VERTICAL_BAR ),
         TOKEN( "layout-grid-snap-to",          XML_LAYOUT_GRID_SNAP_TO ),
 
+        // ODF 1.3
+        TOKEN( "creator-initials",             XML_CREATOR_INITIALS ),
+
 #if OSL_DEBUG_LEVEL > 0
         { 0, NULL, NULL,                       XML_TOKEN_END }
 #else
diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx 
b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
index 00a416bd9f..4da851851f 100644
--- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -594,7 +594,8 @@ 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::IsODFStrict( 
SvtSaveOptions().GetODFDefaultVersion() );
+       const SvtSaveOptions::ODFDefaultVersion nODFVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
+       const sal_Bool bStrict = nODFVersion == SvtSaveOptions::ODFVER_012;
        if( pPMScaleToX )
        {
                if( bStrict )
@@ -609,6 +610,14 @@ void XMLPageMasterExportPropMapper::ContextFilter(
                else
                        lcl_RemoveStateIfZero16( pPMScaleToY );
        }
+       // ODF 1.3: style:scale-to-X and -Y exclude style:scale-to and 
style:scale-to-pages
+       if( nODFVersion >= SvtSaveOptions::ODFVER_013 && ( ( pPMScaleToX && 
pPMScaleToX->mnIndex != -1 ) || ( pPMScaleToY && pPMScaleToY->mnIndex != -1 ) ) 
)
+       {
+               if( pPMScaleTo )
+                       lcl_RemoveState( pPMScaleTo );
+               if( pPMScaleToPages )
+                       lcl_RemoveState( pPMScaleToPages );
+       }
 
     if (pPrint)
     {
diff --git a/main/xmloff/source/style/xmlexppr.cxx 
b/main/xmloff/source/style/xmlexppr.cxx
index abe30878e2..2f62c0872b 100644
--- a/main/xmloff/source/style/xmlexppr.cxx
+++ b/main/xmloff/source/style/xmlexppr.cxx
@@ -669,11 +669,17 @@ vector< XMLPropertyState > 
SvXMLExportPropertyMapper::_Filter(
                 const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( 
SvtSaveOptions().GetODFDefaultVersion() );
                 const SvtSaveOptions::ODFDefaultVersion 
nEarliestODFVersionForExport(
                         maPropMapper->GetEarliestODFVersionForExport( i ) );
-                if( ( nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_EXTENSION
-                        ? SvtSaveOptions::IsODFExtended( nCurrentVersion )
-                        : nCurrentVersion >= nEarliestODFVersionForExport )
-                        || nCurrentVersion == SvtSaveOptions::ODFVER_UNKNOWN
-                        || nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_UNKNOWN )
+                sal_Bool bExport( nCurrentVersion == 
SvtSaveOptions::ODFVER_UNKNOWN
+                        || nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_UNKNOWN );
+                if( nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_EXTENSION )
+                    bExport = bExport || SvtSaveOptions::IsODFExtended( 
nCurrentVersion );
+                else if( nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_EXTENSION_PRE_013 )
+                    bExport = bExport || ( SvtSaveOptions::IsODFExtended( 
nCurrentVersion ) && nCurrentVersion < SvtSaveOptions::ODFVER_013 );
+                else if( nEarliestODFVersionForExport == 
SvtSaveOptions::ODFVER_013 )
+                    bExport = nCurrentVersion >= SvtSaveOptions::ODFVER_013;   
// the unknown mode keeps writing what it wrote before
+                else
+                    bExport = bExport || nCurrentVersion >= 
nEarliestODFVersionForExport;
+                if( bExport )
                     pFilterInfo->AddProperty(rAPIName, i);
             }
                }
diff --git a/main/xmloff/source/text/XMLSectionExport.cxx 
b/main/xmloff/source/text/XMLSectionExport.cxx
index 00b5f5806c..cd8075853b 100644
--- a/main/xmloff/source/text/XMLSectionExport.cxx
+++ b/main/xmloff/source/text/XMLSectionExport.cxx
@@ -1392,12 +1392,16 @@ void XMLSectionExport::ExportIndexTemplateElement(
                        eElement = XML_INDEX_ENTRY_CHAPTER;
                        break;
                case TOK_TTYPE_HYPERLINK_START:
-                       // strict ODF 1.2 allows the link tokens in 
table-of-content templates only
-                       if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || 
TEXT_SECTION_TYPE_TOC == eType )
+                       // strict ODF 1.2 allows the link tokens in 
table-of-content templates only, ODF 1.3 also in the table, illustration, 
object and user index templates
+                       if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || 
TEXT_SECTION_TYPE_TOC == eType
+                               || ( aODFVersion >= SvtSaveOptions::ODFVER_013 
&& ( TEXT_SECTION_TYPE_TABLE == eType
+                                       || TEXT_SECTION_TYPE_ILLUSTRATION == 
eType || TEXT_SECTION_TYPE_OBJECT == eType || TEXT_SECTION_TYPE_USER == eType ) 
) )
                                eElement = XML_INDEX_ENTRY_LINK_START;
                        break;
                case TOK_TTYPE_HYPERLINK_END:
-                       if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || 
TEXT_SECTION_TYPE_TOC == eType )
+                       if ( !SvtSaveOptions::IsODFStrict( aODFVersion ) || 
TEXT_SECTION_TYPE_TOC == eType
+                               || ( aODFVersion >= SvtSaveOptions::ODFVER_013 
&& ( TEXT_SECTION_TYPE_TABLE == eType
+                                       || TEXT_SECTION_TYPE_ILLUSTRATION == 
eType || TEXT_SECTION_TYPE_OBJECT == eType || TEXT_SECTION_TYPE_USER == eType ) 
) )
                                eElement = XML_INDEX_ENTRY_LINK_END;
                        break;
                case TOK_TTYPE_BIBLIOGRAPHY:
diff --git a/main/xmloff/source/text/txtflde.cxx 
b/main/xmloff/source/text/txtflde.cxx
index 94c03b1a33..2552492fc3 100644
--- a/main/xmloff/source/text/txtflde.cxx
+++ b/main/xmloff/source/text/txtflde.cxx
@@ -1813,15 +1813,16 @@ void XMLTextFieldExport::ExportFieldHelper(
                }
 
         // initials
-        if ( SvtSaveOptions::IsODFExtended( GetExport().getDefaultVersion() ) )
+        const sal_Bool bODF13( GetExport().getDefaultVersion() >= 
SvtSaveOptions::ODFVER_013 );
+        if ( bODF13 || SvtSaveOptions::IsODFExtended( 
GetExport().getDefaultVersion() ) )
         {
             OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) 
);
             if ( aInitials.getLength() > 0 )
             {
                 SvXMLElementExport aCreatorElem(
                     GetExport(),
-                    XML_NAMESPACE_TEXT_EXT,
-                    XML_SENDER_INITIALS,
+                    bODF13 ? XML_NAMESPACE_META : XML_NAMESPACE_TEXT_EXT,
+                    bODF13 ? XML_CREATOR_INITIALS : XML_SENDER_INITIALS,
                     sal_True,
                     sal_False );
                 GetExport().Characters(aInitials);
@@ -1883,16 +1884,22 @@ void XMLTextFieldExport::ExportFieldHelper(
     case FIELD_ID_DROP_DOWN:
     {
         // text:drop-down is not in ODF 1.2; keep the shown item as plain text
-        if ( bStrict )
+        const sal_Bool bODF13( GetExport().getDefaultVersion() >= 
SvtSaveOptions::ODFVER_013 );
+        if ( bStrict && !bODF13 )
         {
             GetExport().Characters( sPresentation );
             break;
         }
                ProcessString(XML_NAME, GetStringProperty(sPropertyName, 
rPropSet));
-        ProcessString(XML_HELP,
-                      GetStringProperty(sPropertyHelp, rPropSet), true);
-        ProcessString(XML_HINT,
-                      GetStringProperty(sPropertyTooltip, rPropSet), true);
+        // ODF 1.3 allows no text:help and text:hint here: extended mode moves 
them to the text-ext namespace, strict mode drops them
+        if ( !bODF13 || !bStrict )
+        {
+            const sal_uInt16 nHelpPrefix( bODF13 ? XML_NAMESPACE_TEXT_EXT : 
XML_NAMESPACE_TEXT );
+            ProcessString(XML_HELP,
+                          GetStringProperty(sPropertyHelp, rPropSet), true, 
nHelpPrefix);
+            ProcessString(XML_HINT,
+                          GetStringProperty(sPropertyTooltip, rPropSet), true, 
nHelpPrefix);
+        }
         SvXMLElementExport aElem( GetExport(),
                                   XML_NAMESPACE_TEXT, XML_DROPDOWN,
                                   sal_False, sal_False );
diff --git a/main/xmloff/source/text/txtfldi.cxx 
b/main/xmloff/source/text/txtfldi.cxx
index df864d193c..7feed370e2 100644
--- a/main/xmloff/source/text/txtfldi.cxx
+++ b/main/xmloff/source/text/txtfldi.cxx
@@ -3691,6 +3691,11 @@ SvXMLImportContext* 
XMLAnnotationImportContext::CreateChildContext(
                 new XMLStringBufferImportContext( GetImport(), nPrefix, 
rLocalName, aInitialsBuffer);
         }
     }
+    else if ( XML_NAMESPACE_META == nPrefix && IsXMLToken( rLocalName, 
XML_CREATOR_INITIALS ) )
+    {
+        pContext =
+            new XMLStringBufferImportContext( GetImport(), nPrefix, 
rLocalName, aInitialsBuffer);
+    }
 
     if( !pContext )
     {
diff --git a/main/xmloff/source/text/txtimp.cxx 
b/main/xmloff/source/text/txtimp.cxx
index f49b7c859d..6bc3320142 100644
--- a/main/xmloff/source/text/txtimp.cxx
+++ b/main/xmloff/source/text/txtimp.cxx
@@ -448,6 +448,8 @@ static __FAR_DATA SvXMLTokenMapEntry 
aTextFieldAttrTokenMap[] =
     { XML_NAMESPACE_TEXT, XML_DESCRIPTION,  XML_TOK_TEXTFIELD_DESCRIPTION },
     { XML_NAMESPACE_TEXT, XML_HELP, XML_TOK_TEXTFIELD_HELP },
     { XML_NAMESPACE_TEXT, XML_HINT, XML_TOK_TEXTFIELD_HINT },
+    { XML_NAMESPACE_TEXT_EXT, XML_HELP, XML_TOK_TEXTFIELD_HELP },
+    { XML_NAMESPACE_TEXT_EXT, XML_HINT, XML_TOK_TEXTFIELD_HINT },
     { XML_NAMESPACE_TEXT, XML_PLACEHOLDER_TYPE,
                 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE },
     { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_TEXTFIELD_NAME },

Reply via email to