summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-18 20:31:09 +0200
committerEike Rathke <erack@redhat.com>2014-07-21 15:02:56 +0000
commitf6445efb0e5c3de099f0425825fe1e6e8271dfb9 (patch)
treeef579f9b5c6d999da539f03950bb329c3109df0a
parent68dc545f9d269c75c3ab2df73b8adf1d2276c240 (diff)
respect flag for relative paths, fdo#79305
Change-Id: I8f4e5f8f5e489d543f81b0b20255c875b83f7afc Reviewed-on: https://gerrit.libreoffice.org/10407 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index a76033f7ea94..9fb515a58c59 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -105,6 +105,7 @@
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
+#include <tools/urlobj.hxx>
#include <rtl/math.hxx>
#include <svl/zforlist.hxx>
#include <svx/unoshape.hxx>
@@ -117,6 +118,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>
@@ -3086,7 +3090,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");