[Libreoffice-commits] core.git: sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue May 19 15:03:21 UTC 2020


 sw/source/filter/xml/xmltble.cxx |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit d705a860936a58e40a2894a12d02be585a06e1c1
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon May 18 14:35:00 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue May 19 17:02:38 2020 +0200

    tdf#102256 sw: ODF export: don't write table:table in shapes
    
    ... for strict ODF versions, only write loext:table in extended.
    
    Since commit 62391c28fae5099dd1f67c322867933fcb05bc9f LO can read the
    loext:table elements, LO 4.4 should be sufficiently long ago.
    
    Actually with ODF 1.2, the export asserts because loext namespace was
    exported but isn't declared.
    
    Change-Id: I92318f78b3282989de1d9c2764c2ed7663cb50b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94438
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 46a1e74c5c31..ce5aaf56630d 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -1094,15 +1094,26 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd )
         AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sStyleName);
     }
 
-    sal_uInt16 nPrefix = XML_NAMESPACE_TABLE;
+    ::std::optional<sal_uInt16> oPrefix = XML_NAMESPACE_TABLE;
     if (const SwFrameFormat* pFlyFormat = rTableNd.GetFlyFormat())
     {
         if (SwTextBoxHelper::isTextBox(pFlyFormat, RES_FLYFRMFMT))
-            nPrefix = XML_NAMESPACE_LO_EXT;
+        {
+            // TODO ODF 1.4 OFFICE-3761
+            if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
+            {
+                oPrefix = XML_NAMESPACE_LO_EXT;
+            }
+            else
+            {
+                oPrefix.reset(); // no export to OASIS namespace yet
+            }
+        }
     }
 
+    if (oPrefix)
     {
-        SvXMLElementExport aElem( *this, nPrefix, XML_TABLE, true, true );
+        SvXMLElementExport aElem(*this, *oPrefix, XML_TABLE, true, true);
 
         // export DDE source (if this is a DDE table)
         if ( dynamic_cast<const SwDDETable*>( &rTable) !=  nullptr )
@@ -1137,7 +1148,7 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd )
                                        XML_DDE_SOURCE, true, false);
         }
 
-        SwXMLTableInfo_Impl aTableInfo( &rTable, nPrefix );
+        SwXMLTableInfo_Impl aTableInfo(&rTable, *oPrefix);
         ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() );
 
         for( SwTableLine *pLine : const_cast<SwTable &>(rTable).GetTabLines() )


More information about the Libreoffice-commits mailing list