summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorFakabbir Amin <fakabbir@gmail.com>2017-05-09 14:22:52 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-14 21:41:14 +0200
commitb08e9f08072ec2f632dd8bbbc8d0b5ca2de8b532 (patch)
tree8c31d00439c9e0987737f250fc896bf76d7e9dfe /oox
parent74d8afec9dbd5f13b30327cd95744a87c3492176 (diff)
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@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx5
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--oox/source/export/shapes.cxx35
-rw-r--r--oox/source/token/relationship.inc27
4 files changed, 52 insertions, 22 deletions
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"}