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

Rosemary Sebastian rosemary.seb8 at gmail.com
Wed Jan 4 17:23:50 UTC 2017


 oox/source/core/xmlfilterbase.cxx      |   18 +++++++++---------
 oox/source/export/chartexport.cxx      |   13 ++++++++-----
 oox/source/export/drawingml.cxx        |    3 ++-
 oox/source/export/shapes.cxx           |    6 ++++--
 oox/source/token/namespaces-strict.txt |    2 ++
 oox/source/token/namespaces.txt        |    2 ++
 6 files changed, 27 insertions(+), 17 deletions(-)

New commits:
commit 0fa23d9b499411407c1a0fed41e91f24d59d2ac0
Author: Rosemary Sebastian <rosemary.seb8 at gmail.com>
Date:   Wed Jan 4 09:43:27 2017 +0530

    replace namespace URL strings with function calls...
    
    Change-Id: I0b8b265df487aaeb76238013bc93c78e49a9e1a6
    Reviewed-on: https://gerrit.libreoffice.org/32723
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 85cfc9f..569110c 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -597,11 +597,11 @@ writeCoreProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties
             "docProps/core.xml",
             "application/vnd.openxmlformats-package.core-properties+xml" );
     pCoreProps->startElementNS( XML_cp, XML_coreProperties,
-            FSNS( XML_xmlns, XML_cp ),          "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
-            FSNS( XML_xmlns, XML_dc ),          "http://purl.org/dc/elements/1.1/",
-            FSNS( XML_xmlns, XML_dcterms ),     "http://purl.org/dc/terms/",
-            FSNS( XML_xmlns, XML_dcmitype ),    "http://purl.org/dc/dcmitype/",
-            FSNS( XML_xmlns, XML_xsi ),         "http://www.w3.org/2001/XMLSchema-instance",
+            FSNS( XML_xmlns, XML_cp ),          OUStringToOString(rSelf.getNamespaceURL(OOX_NS(packageMetaCorePr)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_dc ),          OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dc)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_dcterms ),     OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dcTerms)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_dcmitype ),    OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dcmiType)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_xsi ),         OUStringToOString(rSelf.getNamespaceURL(OOX_NS(xsi)), RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
 #ifdef OOXTODO
@@ -640,8 +640,8 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties >
             "docProps/app.xml",
             "application/vnd.openxmlformats-officedocument.extended-properties+xml" );
     pAppProps->startElement( XML_Properties,
-            XML_xmlns,                  "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",
-            FSNS( XML_xmlns, XML_vt ),  "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
+            XML_xmlns,                  OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeExtPr)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_vt ),  OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)), RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     writeElement( pAppProps, XML_Template,              xProperties->getTemplateName() );
@@ -742,8 +742,8 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie
             "docProps/custom.xml",
             "application/vnd.openxmlformats-officedocument.custom-properties+xml" );
     pAppProps->startElement( XML_Properties,
-            XML_xmlns,                  "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
-            FSNS( XML_xmlns, XML_vt ),  "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
+            XML_xmlns,                  OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeCustomPr)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_vt ),  OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)), RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     for ( sal_Int32 n = 0; n < nbCustomProperties; ++n )
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 79d0699..1bdd683 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/export/chartexport.hxx"
@@ -594,9 +595,10 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nC
             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
             &sId );
 
+    XmlFilterBase* pFB = GetFB();
     pFS->singleElement(  FSNS( XML_c, XML_chart ),
-            FSNS( XML_xmlns, XML_c ), "http://schemas.openxmlformats.org/drawingml/2006/chart",
-            FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+            FSNS( XML_xmlns, XML_c ), OUStringToOString(pFB->getNamespaceURL(OOX_NS(dmlChart)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_r ), OUStringToOString(pFB->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr(),
             FSNS( XML_r, XML_id ), USS( sId ),
             FSEND );
 
@@ -732,10 +734,11 @@ void ChartExport::exportChartSpace( const Reference< css::chart::XChartDocument
                                     bool bIncludeTable )
 {
     FSHelperPtr pFS = GetFS();
+    XmlFilterBase* pFB = GetFB();
     pFS->startElement( FSNS( XML_c, XML_chartSpace ),
-            FSNS( XML_xmlns, XML_c ), "http://schemas.openxmlformats.org/drawingml/2006/chart",
-            FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main",
-            FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+            FSNS( XML_xmlns, XML_c ), OUStringToOString(pFB->getNamespaceURL(OOX_NS(dmlChart)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_a ), OUStringToOString(pFB->getNamespaceURL(OOX_NS(dml)), RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_r ), OUStringToOString(pFB->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
     // TODO: get the correct editing language
     pFS->singleElement( FSNS( XML_c, XML_lang ),
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7de9e39..8befbca 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -24,6 +24,7 @@
 #include "oox/export/utils.hxx"
 #include <oox/drawingml/color.hxx>
 #include <oox/drawingml/fillproperties.hxx>
+#include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
 
@@ -3350,7 +3351,7 @@ void DrawingML::WriteArtisticEffect( const Reference< XPropertySet >& rXPropSet
                           XML_uri, "{BEBA8EAE-BF5A-486C-A8C5-ECC9F3942E4B}",
                           FSEND );
     mpFS->startElementNS( XML_a14, XML_imgProps,
-                          FSNS( XML_xmlns, XML_a14 ), "http://schemas.microsoft.com/office/drawing/2010/main",
+                          FSNS( XML_xmlns, XML_a14 ), OUStringToOString(mpFB->getNamespaceURL(OOX_NS(a14)), RTL_TEXTENCODING_UTF8).getStr(),
                           FSEND );
     mpFS->startElementNS( XML_a14, XML_imgLayer,
                           FSNS( XML_r, XML_embed), sRelId.getStr(),
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c28efd8..abb57d4 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -25,6 +25,7 @@
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/export/shapes.hxx"
 #include "oox/export/utils.hxx"
+#include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 
 #include <cstdio>
@@ -1079,12 +1080,13 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
     }
 
     FSHelperPtr pFS = GetFS();
+    XmlFilterBase* pFB = GetFB();
 
     if (GetDocumentType() != DOCUMENT_DOCX)
         pFS->startElementNS( mnXmlNamespace, XML_pic, FSEND );
     else
         pFS->startElementNS( mnXmlNamespace, XML_pic,
-                             FSNS(XML_xmlns, XML_pic), "http://schemas.openxmlformats.org/drawingml/2006/picture",
+                             FSNS(XML_xmlns, XML_pic), OUStringToOString(pFB->getNamespaceURL(OOX_NS(dmlPicture)), RTL_TEXTENCODING_UTF8).getStr(),
                              FSEND );
 
     pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND );
@@ -1813,7 +1815,7 @@ void ShapeExport::WriteMathShape(Reference<XShape> const& xShape)
     // WordProcessingML so write a MCE like PPT 2010 does
     mpFS->startElementNS(XML_mc, XML_AlternateContent, FSEND);
     mpFS->startElementNS(XML_mc, XML_Choice,
-        FSNS(XML_xmlns, XML_a14), "http://schemas.microsoft.com/office/drawing/2010/main",
+        FSNS(XML_xmlns, XML_a14), OUStringToOString(mpFB->getNamespaceURL(OOX_NS(a14)), RTL_TEXTENCODING_UTF8).getStr(),
         XML_Requires, "a14",
         FSEND);
     mpFS->startElementNS(mnXmlNamespace, XML_sp, FSEND);
diff --git a/oox/source/token/namespaces-strict.txt b/oox/source/token/namespaces-strict.txt
index 0f606f7..d6990e5 100644
--- a/oox/source/token/namespaces-strict.txt
+++ b/oox/source/token/namespaces-strict.txt
@@ -20,6 +20,7 @@
 
 xml                     http://www.w3.org/XML/1998/namespace
 schema                  http://purl.oclc.org/ooxml/schemaLibrary/main
+xsi                     http://www.w3.org/2001/XMLSchema-instance
 
 # package ---------------------------------------------------------------------
 
@@ -67,6 +68,7 @@ vmlWord                 urn:schemas-microsoft-com:office:word
 ax                      http://schemas.microsoft.com/office/2006/activeX
 dc                      http://purl.org/dc/elements/1.1/
 dcTerms                 http://purl.org/dc/terms/
+dcmiType                http://purl.org/dc/dcmitype/
 xm                      http://schemas.microsoft.com/office/excel/2006/main
 mce                     http://schemas.openxmlformats.org/markup-compatibility/2006
 mceTest                 http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index 4b6f49a..6045411 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -20,6 +20,7 @@
 
 xml                     http://www.w3.org/XML/1998/namespace
 schema                  http://schemas.openxmlformats.org/schemaLibrary/2006/main
+xsi                     http://www.w3.org/2001/XMLSchema-instance
 
 # package ---------------------------------------------------------------------
 
@@ -67,6 +68,7 @@ vmlWord                 urn:schemas-microsoft-com:office:word
 ax                      http://schemas.microsoft.com/office/2006/activeX
 dc                      http://purl.org/dc/elements/1.1/
 dcTerms                 http://purl.org/dc/terms/
+dcmiType                http://purl.org/dc/dcmitype/
 xm                      http://schemas.microsoft.com/office/excel/2006/main
 mce                     http://schemas.openxmlformats.org/markup-compatibility/2006
 mceTest                 http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2


More information about the Libreoffice-commits mailing list