summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-01-09 13:53:27 +0100
committerEike Rathke <erack@redhat.com>2015-01-10 16:06:34 +0000
commitb460414bcd1dfd2f260696e306c49c56585c6464 (patch)
tree6f68705e4707bef8c0ff45fd71d9ce5b55bf9b24 /sc/source/filter/excel
parent6c5748de1826f9a712a9a5795b1bc81cb7c63d1d (diff)
Resolves: fdo#85617 always store fully encoded external document name
Also OOXML calls these API functions, this is the central place to handle it. (cherry picked from commit 97a8b3ed5e5bd42e213d3230fa764b0f5d10f0f2) write externalLink Relationship Target IURI encoded, fdo#85617 related (cherry picked from commit 7eb5e135422f1a5830a44d129300bc3fafb4627d) do not drop entire external reference, fdo#85617 related If there are no matching tab names for a FileId, preserve at least the known reference parts. In case of 2D references the sheet name is in the token if for example read from .xlsx, only for 3D references the second sheet name would be needed. The underlying makeExternalRefStr() and its subroutines handle the missing tabname elements gracefully. Still this situation is worth an assertion. (cherry picked from commit b6339617b1cc3136f9e527acd0746d712cd21643) Change-Id: I3df065af8e4ef44734f468fd455c3b7c93d7fbc6 Reviewed-on: https://gerrit.libreoffice.org/13835 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/xecontent.cxx12
-rw-r--r--sc/source/filter/excel/xelink.cxx2
2 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 521d1a95f81e..47de3806fe80 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -353,7 +353,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
{
sal_uInt16 nLevel;
bool bRel;
- OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) );
+ /* TODO: should we differentiate between BIFF and OOXML and write IURI
+ * encoded for OOXML? */
+ OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot, false ) );
if( eProtocol == INET_PROT_SMB )
{
@@ -444,9 +446,10 @@ XclExpHyperlink::~XclExpHyperlink()
}
OUString XclExpHyperlink::BuildFileName(
- sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot )
+ sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded )
{
- OUString aDosName( INetURLObject( rUrl ).getFSysPath( INetURLObject::FSYS_DOS ) );
+ INetURLObject aURLObject( rUrl );
+ OUString aDosName( bEncoded ? aURLObject.GetURLPath() : aURLObject.getFSysPath( INetURLObject::FSYS_DOS ) );
rnLevel = 0;
rbRel = rRoot.IsRelUrl();
@@ -455,7 +458,8 @@ OUString XclExpHyperlink::BuildFileName(
// try to convert to relative file name
OUString aTmpName( aDosName );
aDosName = INetURLObject::GetRelURL( rRoot.GetBasePath(), rUrl,
- INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET );
+ INetURLObject::WAS_ENCODED,
+ (bEncoded ? INetURLObject::DECODE_TO_IURI : INetURLObject::DECODE_WITH_CHARSET));
if (aDosName.startsWith(INET_FILE_SCHEME))
{
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index fe43ee7d2fd8..3c8dffcd483f 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1655,7 +1655,7 @@ void XclExpSupbook::SaveXml( XclExpXmlStream& rStrm )
bool bRel = true;
OUString sId = rStrm.addRelation( pExternalLink->getOutputStream(),
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
- XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot()),
+ XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot(), true),
true );
pExternalLink->startElement( XML_externalLink,