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

Fakabbir Amin fakabbir at gmail.com
Sun May 14 19:41:54 UTC 2017


 include/oox/token/relationship.hxx           |   29 +++++++++++++++++++++-
 oox/source/export/chartexport.cxx            |    5 ++-
 oox/source/export/drawingml.cxx              |    7 +++--
 oox/source/export/shapes.cxx                 |   35 +++++++++++++--------------
 oox/source/token/relationship.inc            |   27 ++++++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    7 +++--
 sw/source/filter/ww8/docxexport.cxx          |   35 +++++++++++++--------------
 sw/source/filter/ww8/docxsdrexport.cxx       |   13 +++++-----
 8 files changed, 109 insertions(+), 49 deletions(-)

New commits:
commit b08e9f08072ec2f632dd8bbbc8d0b5ca2de8b532
Author: Fakabbir Amin <fakabbir at gmail.com>
Date:   Tue May 9 14:22:52 2017 +0530

    tdf#107197 Replace relationship URI
    
    Hard coded relationship URI in sd/source/,
    sw/source/filter and oox/source/export/ directory has been replaced with
    method calls.
    
    Change-Id: Ie1b9542325fa4143bddea2582aa5e946094e457d
    Reviewed-on: https://gerrit.libreoffice.org/37433
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/oox/token/relationship.hxx b/include/oox/token/relationship.hxx
index 4b697b705de6..bc42c7922df4 100644
--- a/include/oox/token/relationship.hxx
+++ b/include/oox/token/relationship.hxx
@@ -15,7 +15,34 @@ namespace oox {
 
 enum class Relationship
 {
-    HYPERLINK
+    ACTIVEXCONTROLBINARY,
+    CHART,
+    COMMENTS,
+    CONTROL,
+    CUSTOMXML,
+    CUSTOMXMLPROPS,
+    DIAGRAMCOLORS,
+    DIAGRAMDATA,
+    DIAGRAMDRAWING,
+    DIAGRAMLAYOUT,
+    DIAGRAMQUICKSTYLE,
+    ENDNOTES,
+    FONT,
+    FONTTABLE,
+    FOOTER,
+    FOOTNOTES,
+    GLOSSARYDOCUMENT,
+    HDPHOTO,
+    HEADER,
+    HYPERLINK,
+    IMAGE,
+    NUMBERING,
+    OFFICEDOCUMENT,
+    OLEOBJECT,
+    PACKAGE,
+    SETTINGS,
+    STYLES,
+    THEME
 };
 
 OUString OOX_DLLPUBLIC getRelationship(Relationship eRelationship);
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 500a80143878..e594a2f47bdd 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -21,6 +21,7 @@
 #include <oox/token/tokens.hxx>
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/export/chartexport.hxx"
+#include <oox/token/relationship.hxx>
 #include "oox/export/utils.hxx"
 #include "drawingml/chart/typegroupconverter.hxx"
 
@@ -805,9 +806,9 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen
             }
         }
         FSHelperPtr pFS = GetFS();
-        OUString type = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        OUString type = oox::getRelationship(Relationship::PACKAGE);
         if (relationPath.endsWith(".bin"))
-            type = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+            type = oox::getRelationship(Relationship::OLEOBJECT);
 
         OUString sRelId = GetFB()->addRelation(pFS->getOutputStream(),
                         type,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5f049f26b98c..94c70ffdb642 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -25,6 +25,7 @@
 #include <oox/drawingml/color.hxx>
 #include <drawingml/fillproperties.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/token/relationship.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
 
@@ -944,7 +945,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
     if ( bRelPathToMedia )
         sRelPathToMedia = "../" + sRelPathToMedia;
     sRelId = mpFB->addRelation( mpFS->getOutputStream(),
-                                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
+                                oox::getRelationship(Relationship::IMAGE),
                                 OUStringBuffer()
                                 .appendAscii( GetRelationCompPrefix() )
                                 .appendAscii( sRelPathToMedia.getStr() )
@@ -1477,7 +1478,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
         mAny >>= sURL;
         if( !sURL.isEmpty() ) {
             OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(),
-                                  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
+                                  oox::getRelationship(Relationship::HYPERLINK),
                                   sURL, true );
 
             mpFS->singleElementNS( XML_a, XML_hlinkClick,
@@ -3454,7 +3455,7 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal
     xOutStream->closeOutput();
 
     sId = mpFB->addRelation( mpFS->getOutputStream(),
-                             "http://schemas.microsoft.com/office/2007/relationships/hdphoto",
+                             oox::getRelationship(Relationship::HDPHOTO),
                              sFileName );
 
     maWdpCache[rFileId] = sId;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index fc662db95a7b..7d94310e0a11 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -26,6 +26,7 @@
 #include "oox/export/shapes.hxx"
 #include "oox/export/utils.hxx"
 #include <oox/token/namespaces.hxx>
+#include <oox/token/relationship.hxx>
 #include <oox/token/tokens.hxx>
 
 #include <cstdio>
@@ -123,91 +124,91 @@ static void lcl_ConvertProgID(OUString const& rProgID,
     if (rProgID == "Excel.Sheet.12")
     {
         o_rMediaType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "xlsx";
     }
     else if (rProgID.startsWith("Excel.SheetBinaryMacroEnabled.12") )
     {
         o_rMediaType = "application/vnd.ms-excel.sheet.binary.macroEnabled.12";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "xlsb";
     }
     else if (rProgID.startsWith("Excel.SheetMacroEnabled.12"))
     {
         o_rMediaType = "application/vnd.ms-excel.sheet.macroEnabled.12";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "xlsm";
     }
     else if (rProgID.startsWith("Excel.Sheet"))
     {
         o_rMediaType = "application/vnd.ms-excel";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "xls";
     }
     else if (rProgID == "PowerPoint.Show.12")
     {
         o_rMediaType = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "pptx";
     }
     else if (rProgID == "PowerPoint.ShowMacroEnabled.12")
     {
         o_rMediaType = "application/vnd.ms-powerpoint.presentation.macroEnabled.12";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "pptm";
     }
     else if (rProgID.startsWith("PowerPoint.Show"))
     {
         o_rMediaType = "application/vnd.ms-powerpoint";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "ppt";
     }
     else if (rProgID.startsWith("PowerPoint.Slide.12"))
     {
         o_rMediaType = "application/vnd.openxmlformats-officedocument.presentationml.slide";
-       o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+       o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
        o_rFileExtension = "sldx";
     }
     else if (rProgID == "PowerPoint.SlideMacroEnabled.12")
     {
        o_rMediaType = "application/vnd.ms-powerpoint.slide.macroEnabled.12";
-       o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+       o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
        o_rFileExtension = "sldm";
     }
     else if (rProgID == "Word.DocumentMacroEnabled.12")
     {
         o_rMediaType = "application/vnd.ms-word.document.macroEnabled.12";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "docm";
     }
     else if (rProgID == "Word.Document.12")
     {
         o_rMediaType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+        o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
         o_rFileExtension = "docx";
     }
     else if (rProgID == "Word.Document.8")
     {
         o_rMediaType = "application/msword";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "doc";
     }
     else if (rProgID == "Excel.Chart.8")
     {
         o_rMediaType = "application/vnd.ms-excel";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "xls";
     }
     else if (rProgID == "AcroExch.Document.11")
     {
         o_rMediaType = "application/pdf";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "pdf";
     }
     else
     {
         o_rMediaType = "application/vnd.openxmlformats-officedocument.oleObject";
-        o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        o_rRelationType = oox::getRelationship(Relationship::OLEOBJECT);
         o_rFileExtension = "bin";
     }
 }
@@ -252,7 +253,7 @@ static uno::Reference<io::XInputStream> lcl_StoreOwnAsOOXML(
             o_rMediaType = OUString::createFromAscii(i.pMediaType);
             o_rpProgID = i.pProgID;
             o_rSuffix = OUString::createFromAscii(i.pSuffix);
-            o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
+            o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
             break;
         }
     }
@@ -775,7 +776,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
             if( !sURL.isEmpty() )
             {
                 OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(),
-                        "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
+                        oox::getRelationship(Relationship::HYPERLINK),
                         mpURLTransformer->getTransformedString(sURL),
                         mpURLTransformer->isExternalURL(sURL));
 
diff --git a/oox/source/token/relationship.inc b/oox/source/token/relationship.inc
index b36c627530c6..d0b38e04ca3a 100644
--- a/oox/source/token/relationship.inc
+++ b/oox/source/token/relationship.inc
@@ -1 +1,28 @@
+{Relationship::ACTIVEXCONTROLBINARY, "http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"},
+{Relationship::CHART, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"},
+{Relationship::COMMENTS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"},
+{Relationship::CONTROL, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"},
+{Relationship::CUSTOMXML, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"},
+{Relationship::CUSTOMXMLPROPS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"},
+{Relationship::DIAGRAMCOLORS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"},
+{Relationship::DIAGRAMDATA, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"},
+{Relationship::DIAGRAMDRAWING, "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"},
+{Relationship::DIAGRAMLAYOUT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"},
+{Relationship::DIAGRAMQUICKSTYLE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"},
+{Relationship::ENDNOTES, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"},
+{Relationship::FONT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font"},
+{Relationship::FONTTABLE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"},
+{Relationship::FOOTER, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"},
+{Relationship::FOOTNOTES, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"},
+{Relationship::GLOSSARYDOCUMENT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"},
+{Relationship::HDPHOTO, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hdphoto"},
+{Relationship::HEADER, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"},
 {Relationship::HYPERLINK, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"},
+{Relationship::IMAGE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"},
+{Relationship::NUMBERING, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"},
+{Relationship::OFFICEDOCUMENT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"},
+{Relationship::OLEOBJECT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"},
+{Relationship::PACKAGE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"},
+{Relationship::SETTINGS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"},
+{Relationship::STYLES, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"},
+{Relationship::THEME, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e4abf74e5bd4..83dfe43b5372 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -48,6 +48,7 @@
 #include <oox/export/utils.hxx>
 #include <oox/mathml/export.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/token/relationship.hxx>
 
 #include <editeng/autokernitem.hxx>
 #include <editeng/unoprnms.hxx>
@@ -2336,7 +2337,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge
         if ( !bBookmarkOnly )
         {
             OString sId = OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
-                        "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
+                        oox::getRelationship(Relationship::HYPERLINK),
                         sUrl, true ), RTL_TEXTENCODING_UTF8 );
 
             m_pHyperlinkAttrList->add( FSNS( XML_r, XML_id), sId.getStr());
@@ -4288,7 +4289,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
         // TODO Convert the file name to relative for better interoperability
 
         aRelId = m_rExport.AddRelation(
-                    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
+                    oox::getRelationship(Relationship::IMAGE),
                     aFileName );
 
         nImageType = XML_link;
@@ -6019,7 +6020,7 @@ void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, FontFam
         }
         xOutStream->closeOutput();
         OString relId = OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
+            oox::getRelationship(Relationship::FONT),
             "fonts/font" + OUString::number( m_nextFontId ) + ".odttf" ), RTL_TEXTENCODING_UTF8 );
         EmbeddedFontRef ref;
         ref.relId = relId;
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index ba7350b458d8..69cd9444a85d 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -38,6 +38,7 @@
 #include <oox/export/chartexport.hxx>
 #include <oox/export/shapes.hxx>
 #include <oox/helper/propertyset.hxx>
+#include <oox/token/relationship.hxx>
 
 #include <map>
 #include <algorithm>
@@ -356,7 +357,7 @@ OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, sal_In
 {
     OUString aFileName = "charts/chart" + OUString::number(nCount) + ".xml";
     OUString sId = m_pFilter->addRelation( m_pSerializer->getOutputStream(),
-                    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
+                    oox::getRelationship(Relationship::CHART),
                     aFileName );
     aFileName = "word/charts/chart" + OUString::number(nCount) + ".xml";
     ::sax_fastparser::FSHelperPtr pChartFS =
@@ -572,7 +573,7 @@ void DocxExport::InitStyles()
 
     // setup word/styles.xml and the relations + content type
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
+            oox::getRelationship(Relationship::STYLES),
             "styles.xml" );
 
     ::sax_fastparser::FSHelperPtr pStylesFS =
@@ -595,7 +596,7 @@ void DocxExport::WriteFootnotesEndnotes()
     {
         // setup word/styles.xml and the relations + content type
         m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
+                oox::getRelationship(Relationship::FOOTNOTES),
                 "footnotes.xml" );
 
         ::sax_fastparser::FSHelperPtr pFootnotesFS =
@@ -619,7 +620,7 @@ void DocxExport::WriteFootnotesEndnotes()
     {
         // setup word/styles.xml and the relations + content type
         m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",
+                oox::getRelationship(Relationship::ENDNOTES),
                 "endnotes.xml" );
 
         ::sax_fastparser::FSHelperPtr pEndnotesFS =
@@ -645,7 +646,7 @@ void DocxExport::WritePostitFields()
     if ( m_pAttrOutput->HasPostitFields() )
     {
         m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
+                oox::getRelationship(Relationship::COMMENTS),
                 "comments.xml" );
 
         ::sax_fastparser::FSHelperPtr pPostitFS =
@@ -666,7 +667,7 @@ void DocxExport::WriteNumbering()
         return; // no numbering is used
 
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-        "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",
+        oox::getRelationship(Relationship::NUMBERING),
         "numbering.xml" );
 
     ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openFragmentStreamWithSerializer( "word/numbering.xml",
@@ -706,7 +707,7 @@ void DocxExport::WriteHeaderFooter( const SwFormat& rFormat, bool bHeader, const
         OUString aName( OUStringBuffer().append("header").append( ++m_nHeaders ).append(".xml").makeStringAndClear() );
 
         aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
+                oox::getRelationship(Relationship::HEADER),
                 aName );
 
         pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
@@ -719,7 +720,7 @@ void DocxExport::WriteHeaderFooter( const SwFormat& rFormat, bool bHeader, const
         OUString aName( OUStringBuffer().append("footer").append( ++m_nFooters ).append(".xml").makeStringAndClear() );
 
         aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
+                oox::getRelationship(Relationship::FOOTER),
                 aName );
 
         pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
@@ -777,7 +778,7 @@ void DocxExport::WriteHeaderFooter( const SwFormat& rFormat, bool bHeader, const
 void DocxExport::WriteFonts()
 {
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",
+            oox::getRelationship(Relationship::FONTTABLE),
             "fontTable.xml" );
 
     ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer(
@@ -823,7 +824,7 @@ void DocxExport::WriteSettings()
         return;
 
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",
+            oox::getRelationship(Relationship::SETTINGS),
             "settings.xml" );
 
     ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer(
@@ -1003,7 +1004,7 @@ void DocxExport::WriteTheme()
         return;
 
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
+            oox::getRelationship(Relationship::THEME),
             "theme/theme1.xml" );
 
     uno::Reference< xml::sax::XSAXSerializable > serializer( themeDom, uno::UNO_QUERY );
@@ -1050,7 +1051,7 @@ void DocxExport::WriteGlossary()
         return;
 
     m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument",
+            oox::getRelationship(Relationship::GLOSSARYDOCUMENT),
             "glossary/document.xml" );
 
     uno::Reference< io::XOutputStream > xOutputStream = GetFilter().openFragmentStream( "word/glossary/document.xml",
@@ -1125,7 +1126,7 @@ void DocxExport::WriteCustomXml()
         if ( customXmlDom.is() )
         {
             m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
+                    oox::getRelationship(Relationship::CUSTOMXML),
                     "../customXml/item"+OUString::number((j+1))+".xml" );
 
             uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDom, uno::UNO_QUERY );
@@ -1149,7 +1150,7 @@ void DocxExport::WriteCustomXml()
             // Adding itemprops's relationship entry to item.xml.rels file
             m_pFilter->addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml",
                     "application/xml" ) ,
-                    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",
+                    oox::getRelationship(Relationship::CUSTOMXMLPROPS),
                     "itemProps"+OUString::number((j+1))+".xml" );
 
         }
@@ -1197,7 +1198,7 @@ void DocxExport::WriteActiveX()
         if ( activeXDom.is() )
         {
             m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
-                    "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control",
+                    oox::getRelationship(Relationship::CONTROL),
                     "activeX/activeX"+OUString::number((j+1))+".xml" );
 
             uno::Reference< xml::sax::XSAXSerializable > serializer( activeXDom, uno::UNO_QUERY );
@@ -1243,7 +1244,7 @@ void DocxExport::WriteActiveX()
             // Adding itemprops's relationship entry to item.xml.rels file
             m_pFilter->addRelation( GetFilter().openFragmentStream( "/word/activeX/activeX"+OUString::number((j+1))+".xml",
                     "application/vnd.ms-office.activeX+xml" ) ,
-                    "http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary",
+                    oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY),
                     "activeX"+OUString::number((j+1))+".bin" );
 
         }
@@ -1462,7 +1463,7 @@ DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCur
     WriteProperties( );
 
     // relations for the document
-    m_pFilter->addRelation( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
+    m_pFilter->addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT),
             "word/document.xml" );
 
     // the actual document
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index a7a69e1e1f5a..dd44481799e8 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -17,6 +17,7 @@
 #include <svx/svdogrp.hxx>
 #include <oox/helper/propertyset.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/token/relationship.hxx>
 #include <oox/token/properties.hxx>
 #include <textboxhelper.hxx>
 #include <fmtanchr.hxx>
@@ -1037,7 +1038,7 @@ void DocxSdrExport::writeDiagramRels(const uno::Sequence< uno::Sequence< uno::An
                                      int nAnchorId)
 {
     // add image relationships of OOXData, OOXDiagram
-    OUString sType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image");
+    OUString sType(oox::getRelationship(Relationship::IMAGE));
     uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(comphelper::getProcessComponentContext());
     xWriter->setOutputStream(xOutStream);
 
@@ -1175,26 +1176,26 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
     // add data relation
     OUString dataFileName = "diagrams/data" + OUString::number(diagramCount) + ".xml";
     OString dataRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
-                                          "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",
+                                          oox::getRelationship(Relationship::DIAGRAMDATA),
                                           dataFileName), RTL_TEXTENCODING_UTF8);
 
 
     // add layout relation
     OUString layoutFileName = "diagrams/layout" + OUString::number(diagramCount) + ".xml";
     OString layoutRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
-                                            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout",
+                                            oox::getRelationship(Relationship::DIAGRAMLAYOUT),
                                             layoutFileName), RTL_TEXTENCODING_UTF8);
 
     // add style relation
     OUString styleFileName = "diagrams/quickStyle" + OUString::number(diagramCount) + ".xml";
     OString styleRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
-                                           "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle",
+                                           oox::getRelationship(Relationship::DIAGRAMQUICKSTYLE),
                                            styleFileName), RTL_TEXTENCODING_UTF8);
 
     // add color relation
     OUString colorFileName = "diagrams/colors" + OUString::number(diagramCount) + ".xml";
     OString colorRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
-                                           "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors",
+                                           oox::getRelationship(Relationship::DIAGRAMCOLORS),
                                            colorFileName), RTL_TEXTENCODING_UTF8);
 
     OUString drawingFileName;
@@ -1203,7 +1204,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
         // add drawing relation
         drawingFileName = "diagrams/drawing" + OUString::number(diagramCount) + ".xml";
         OUString drawingRelId = m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
-                                "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing",
+                                oox::getRelationship(Relationship::DIAGRAMDRAWING),
                                 drawingFileName);
 
         // the data dom contains a reference to the drawing relation. We need to update it with the new generated


More information about the Libreoffice-commits mailing list