sw/source/filter/ww8/docxattributeoutput.cxx |   21 ++++++++-------
 sw/source/filter/ww8/docxexport.cxx          |   37 +++++++++++++--------------
 sw/source/filter/ww8/docxexport.hxx          |    2 -
 sw/source/filter/ww8/docxsdrexport.cxx       |   13 +++++----
 4 files changed, 38 insertions(+), 35 deletions(-)

New commits:
commit 28f50d7e387864bd41a67b2fb78b9c98a708a00e
Author: Rosemary Sebastian <rosemary.s...@gmail.com>
Date:   Mon Jan 9 11:47:19 2017 +0530

    replace namespace url strings with function calls
    
    Change-Id: I6e0c4c94ba7418ed9d7daa7f768baf703e22ab55
    Reviewed-on: https://gerrit.libreoffice.org/32915
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index ff0c60c..8ac45b2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -42,6 +42,7 @@
 #include <comphelper/random.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/flagguard.hxx>
+#include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/export/utils.hxx>
 #include <oox/mathml/export.hxx>
@@ -3774,9 +3775,9 @@ void DocxAttributeOutput::TableRowEnd( sal_uInt32 
/*nDepth*/ )
 void DocxAttributeOutput::StartStyles()
 {
     m_pSerializer->startElementNS( XML_w, XML_styles,
-            FSNS( XML_xmlns, XML_w ),   
"http://schemas.openxmlformats.org/wordprocessingml/2006/main";,
-            FSNS( XML_xmlns, XML_w14 ), 
"http://schemas.microsoft.com/office/word/2010/wordml";,
-            FSNS( XML_xmlns, XML_mc ),  
"http://schemas.openxmlformats.org/markup-compatibility/2006";,
+            FSNS( XML_xmlns, XML_w ),   
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(doc)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_w14 ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(w14)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_mc ),  
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(mce)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSNS( XML_mc, XML_Ignorable ), "w14",
             FSEND );
 
@@ -4291,20 +4292,20 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
             FSEND );
     // TODO change aspect?
     m_pSerializer->singleElementNS( XML_a, XML_graphicFrameLocks,
-            FSNS( XML_xmlns, XML_a ), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+            FSNS( XML_xmlns, XML_a ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
             XML_noChangeAspect, "1",
             FSEND );
     m_pSerializer->endElementNS( XML_wp, XML_cNvGraphicFramePr );
 
     m_pSerializer->startElementNS( XML_a, XML_graphic,
-            FSNS( XML_xmlns, XML_a ), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+            FSNS( XML_xmlns, XML_a ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
     m_pSerializer->startElementNS( XML_a, XML_graphicData,
             XML_uri, 
"http://schemas.openxmlformats.org/drawingml/2006/picture";,
             FSEND );
 
     m_pSerializer->startElementNS( XML_pic, XML_pic,
-            FSNS( XML_xmlns, XML_pic ), 
"http://schemas.openxmlformats.org/drawingml/2006/picture";,
+            FSNS( XML_xmlns, XML_pic ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(dmlPicture)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     m_pSerializer->startElementNS( XML_pic, XML_nvPicPr,
@@ -4509,7 +4510,7 @@ void DocxAttributeOutput::WritePostponedChart()
             FSEND );
 
         m_pSerializer->startElementNS( XML_a, XML_graphic,
-            FSNS( XML_xmlns, XML_a ), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+            FSNS( XML_xmlns, XML_a ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
         m_pSerializer->startElementNS( XML_a, XML_graphicData,
@@ -4522,8 +4523,8 @@ void DocxAttributeOutput::WritePostponedChart()
         aRelId = m_rExport.OutputChart( xModel, m_nChartCount, m_pSerializer );
 
         m_pSerializer->singleElementNS( 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(GetExport().GetFilter().getNamespaceURL(OOX_NS(dmlChart)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_r ), 
OUStringToOString(GetExport().GetFilter().getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSNS( XML_r, XML_id ), aRelId.getStr(),
             FSEND );
 
@@ -6886,7 +6887,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool 
bFootnotes )
     sal_Int32 nBody = bFootnotes? XML_footnotes: XML_endnotes;
     sal_Int32 nItem = bFootnotes? XML_footnote:  XML_endnote;
 
-    m_pSerializer->startElementNS( XML_w, nBody, 
DocxExport::MainXmlNamespaces() );
+    m_pSerializer->startElementNS( XML_w, nBody, m_rExport.MainXmlNamespaces() 
);
 
     sal_Int32 nIndex = 0;
 
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index ae1879f..4616cde 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/xml/sax/XSAXSerializable.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
 
+#include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/export/drawingml.hxx>
 #include <oox/export/vmlexport.hxx>
@@ -676,10 +677,10 @@ void DocxExport::WriteNumbering()
     m_pDrawingML->SetFS( pNumberingFS );
 
     pNumberingFS->startElementNS( XML_w, XML_numbering,
-            FSNS( XML_xmlns, XML_w ), 
"http://schemas.openxmlformats.org/wordprocessingml/2006/main";,
-            FSNS( XML_xmlns, XML_o ), 
"urn:schemas-microsoft-com:office:office",
-            FSNS( XML_xmlns, XML_r ), 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";,
-            FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml",
+            FSNS( XML_xmlns, XML_w ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_o ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_r ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_v ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vml)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     BulletDefinitions();
@@ -784,8 +785,8 @@ void DocxExport::WriteFonts()
             
"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" 
);
 
     pFS->startElementNS( XML_w, XML_fonts,
-            FSNS( XML_xmlns, XML_w ), 
"http://schemas.openxmlformats.org/wordprocessingml/2006/main";,
-            FSNS( XML_xmlns, XML_r ), 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";,
+            FSNS( XML_xmlns, XML_w ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), 
RTL_TEXTENCODING_UTF8).getStr(),
+            FSNS( XML_xmlns, XML_r ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     // switch the serializer to redirect the output to word/styles.xml
@@ -830,7 +831,7 @@ void DocxExport::WriteSettings()
             
"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" );
 
     pFS->startElementNS( XML_w, XML_settings,
-            FSNS( XML_xmlns, XML_w ), 
"http://schemas.openxmlformats.org/wordprocessingml/2006/main";,
+            FSNS( XML_xmlns, XML_w ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), 
RTL_TEXTENCODING_UTF8).getStr(),
             FSEND );
 
     // Zoom
@@ -1370,17 +1371,17 @@ void DocxExport::WriteMainText()
 XFastAttributeListRef DocxExport::MainXmlNamespaces()
 {
     FastAttributeList* pAttr = FastSerializerHelper::createAttrList();
-    pAttr->add( FSNS( XML_xmlns, XML_o ), 
"urn:schemas-microsoft-com:office:office" );
-    pAttr->add( FSNS( XML_xmlns, XML_r ), 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"; );
-    pAttr->add( FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml" );
-    pAttr->add( FSNS( XML_xmlns, XML_w ), 
"http://schemas.openxmlformats.org/wordprocessingml/2006/main"; );
-    pAttr->add( FSNS( XML_xmlns, XML_w10 ), 
"urn:schemas-microsoft-com:office:word" );
-    pAttr->add( FSNS( XML_xmlns, XML_wp ), 
"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"; );
-    pAttr->add( FSNS( XML_xmlns, XML_wps ), 
"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"; );
-    pAttr->add( FSNS( XML_xmlns, XML_wpg ), 
"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"; );
-    pAttr->add( FSNS( XML_xmlns, XML_mc ), 
"http://schemas.openxmlformats.org/markup-compatibility/2006"; );
-    pAttr->add( FSNS( XML_xmlns, XML_wp14 ), 
"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"; );
-    pAttr->add( FSNS( XML_xmlns, XML_w14 ), 
"http://schemas.microsoft.com/office/word/2010/wordml"; );
+    pAttr->add( FSNS( XML_xmlns, XML_o ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_r ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_v ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vml)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_w ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_w10 ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlWord)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_wp ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(dmlWordDr)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_wps ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wps)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_wpg ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wpg)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_mc ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(mce)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_wp14 ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wp14)), 
RTL_TEXTENCODING_UTF8).getStr() );
+    pAttr->add( FSNS( XML_xmlns, XML_w14 ), 
OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(w14)), 
RTL_TEXTENCODING_UTF8).getStr() );
     pAttr->add( FSNS( XML_mc, XML_Ignorable ), "w14 wp14" );
     return XFastAttributeListRef( pAttr );
 }
diff --git a/sw/source/filter/ww8/docxexport.hxx 
b/sw/source/filter/ww8/docxexport.hxx
index ad5d911..99d1368 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -246,7 +246,7 @@ private:
 
 public:
     /// All xml namespaces to be used at the top of any text .xml file (main 
doc, headers, footers,...)
-    static sax_fastparser::XFastAttributeListRef MainXmlNamespaces();
+    sax_fastparser::XFastAttributeListRef MainXmlNamespaces();
 
     /// FIXME this is temporary, remotely reminding the method of the same
     /// name in WW8Export.
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index b407082..79e5d45 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -16,6 +16,7 @@
 #include <editeng/charrotateitem.hxx>
 #include <svx/svdogrp.hxx>
 #include <oox/helper/propertyset.hxx>
+#include <oox/token/namespaces.hxx>
 #include <oox/token/properties.hxx>
 #include <textboxhelper.hxx>
 #include <fmtanchr.hxx>
@@ -835,7 +836,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* 
pSdrObject, const SwFrameFo
     else if 
(xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
         pNamespace = 
"http://schemas.openxmlformats.org/drawingml/2006/picture";;
     pFS->startElementNS(XML_a, XML_graphic,
-                        FSNS(XML_xmlns, XML_a), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+                        FSNS(XML_xmlns, XML_a), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
                         FSEND);
     pFS->startElementNS(XML_a, XML_graphicData,
                         XML_uri, pNamespace,
@@ -844,7 +845,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* 
pSdrObject, const SwFrameFo
     bool bLockedCanvas = lcl_isLockedCanvas(xShape);
     if (bLockedCanvas)
         pFS->startElementNS(XML_lc, XML_lockedCanvas,
-                            FSNS(XML_xmlns, XML_lc), 
"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas";,
+                            FSNS(XML_xmlns, XML_lc), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dmlLockedCanvas)),
 RTL_TEXTENCODING_UTF8).getStr(),
                             FSEND);
 
     m_pImpl->m_rExport.OutputDML(xShape);
@@ -1168,7 +1169,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrameFormat
                          FSEND);
 
     pFS->startElementNS(XML_a, XML_graphic,
-                        FSNS(XML_xmlns, XML_a), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+                        FSNS(XML_xmlns, XML_a), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
                         FSEND);
 
     pFS->startElementNS(XML_a, XML_graphicData,
@@ -1228,8 +1229,8 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrameFormat
     }
 
     pFS->singleElementNS(XML_dgm, XML_relIds,
-                         FSNS(XML_xmlns, XML_dgm), 
"http://schemas.openxmlformats.org/drawingml/2006/diagram";,
-                         FSNS(XML_xmlns, XML_r), 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";,
+                         FSNS(XML_xmlns, XML_dgm), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dmlDiagram)),
 RTL_TEXTENCODING_UTF8).getStr(),
+                         FSNS(XML_xmlns, XML_r), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(officeRel)),
 RTL_TEXTENCODING_UTF8).getStr(),
                          FSNS(XML_r, XML_dm), dataRelId.getStr(),
                          FSNS(XML_r, XML_lo), layoutRelId.getStr(),
                          FSNS(XML_r, XML_qs), styleRelId.getStr(),
@@ -1406,7 +1407,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame* 
pParentFrame, int nAnchorId, b
         pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
 
         pFS->startElementNS(XML_a, XML_graphic,
-                            FSNS(XML_xmlns, XML_a), 
"http://schemas.openxmlformats.org/drawingml/2006/main";,
+                            FSNS(XML_xmlns, XML_a), 
OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(),
                             FSEND);
         pFS->startElementNS(XML_a, XML_graphicData,
                             XML_uri, 
"http://schemas.microsoft.com/office/word/2010/wordprocessingShape";,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to