summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel/xecontent.cxx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-08-24 09:59:42 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-08-25 09:58:15 +0200
commit51e610e584e09ecdec4cbc5c7c550bc806d7ee1c (patch)
treef4811e90caf1542a3d909758d3d2c3b4477df5fc /sc/source/filter/excel/xecontent.cxx
parentf0b0123fa3f70ede8592befcd01381542db76617 (diff)
tdf#111876 Save correct relative links in Calc
Relative links were saved as: file:///a/file.odt instead of: ../a/file.odt Relative path was based on source document, not target. Unit test contains spreadsheet with relative link to the "../xls/bug-fixes.xls" file. Change-Id: I803b7b8936bde9644ae5760756ee7249677f2641 Reviewed-on: https://gerrit.libreoffice.org/41500 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sc/source/filter/excel/xecontent.cxx')
-rw-r--r--sc/source/filter/excel/xecontent.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 5a0045753612..4814bde09dfd 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -386,9 +386,18 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
m_Repr = aFileName;
msTarget = XclXmlUtils::ToOUString( aLink );
- // ooxml expects the file:/// part appended ( or at least
- // ms2007 does, ms2010 is more tolerant )
- msTarget = "file:///" + msTarget;
+
+ if( bRel )
+ {
+ for( int i = 0; i < nLevel; ++i )
+ msTarget = "../" + msTarget;
+ }
+ else
+ {
+ // ooxml expects the file:/// part appended ( or at least
+ // ms2007 does, ms2010 is more tolerant )
+ msTarget = "file:///" + msTarget;
+ }
}
else if( eProtocol != INetProtocol::NotValid )
{