summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-18 20:31:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-07-19 13:36:22 +0200
commit918fca99c0bb9ddf2102de9a50f074624802e9cb (patch)
tree56ee43107531accd092b1131f01fd92fae3cb64b /sc
parentca20a53315eaea218c693e0de2026eb6f957331f (diff)
respect flag for relative paths, fdo#79305
Conflicts: sc/source/filter/xml/xmlexprt.cxx Change-Id: I8f4e5f8f5e489d543f81b0b20255c875b83f7afc
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 058e7198d8d7..f0d07329bcaa 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -101,7 +101,8 @@
#include <rtl/ustring.hxx>
-#include "tools/color.hxx"
+#include <tools/color.hxx>
+#include <tools/urlobj.hxx>
#include <rtl/math.hxx>
#include <svl/zforlist.hxx>
#include <svx/unoshape.hxx>
@@ -114,6 +115,9 @@
#include <svx/svdpage.hxx>
#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNamed.hpp>
@@ -3079,7 +3083,17 @@ void writeContent(
{
// <text:a xlink:href="url" xlink:type="simple">value</text:a>
+ Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ bool bUseRelative = officecfg::Office::Common::Save::URL::FileSystem::get( xContext );
OUString aURL = static_cast<const SvxURLField*>(pField)->GetURL();
+ if(bUseRelative)
+ {
+ OUString aBase = rExport.GetOrigFileName();
+ INetURLObject aURLObject(aBase);
+ aURLObject.removeSegment();
+ aURLObject.removeSegment();
+ aURL = INetURLObject::GetRelURL(aURLObject.GetMainURL(INetURLObject::DECODE_TO_IURI), aURL);
+ }
rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aURL);
rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, "simple");