diff options
author | Henning Brinkmann <hbrinkm@openoffice.org> | 2011-02-16 12:43:17 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-17 15:51:48 +0200 |
commit | 0ac54766877eba95982e2364b8b2b25ff7382534 (patch) | |
tree | b8121edb920b9e6f3b0e9d2d542ac75f23336a6e /writerfilter/source/ooxml | |
parent | 3cb4e72d58885c93d8ce3d6e54e07f64c7edc6d3 (diff) |
#i116755# handle absolute paths in _rel [hg:fb7e1780f025]
Diffstat (limited to 'writerfilter/source/ooxml')
-rw-r--r-- | writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 386442c79..e5019d644 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -94,6 +94,42 @@ const ::rtl::OUString & OOXMLStreamImpl::getTarget() const return msTarget; } +::rtl::OUString lcl_normalizeTarget(const ::rtl::OUString & s) +{ + const int nStringsToCut = 2; + const ::rtl::OUString aStringToCut[] = { + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("./")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + }; + + bool bDone = false; + sal_Int32 nIndex = 0; + while (!bDone) + { + for (int n = 0; n <= nStringsToCut; n++) + { + if (n == nStringsToCut) + { + bDone = true; + } + else + { + sal_Int32 nNewIndex = s.indexOf(aStringToCut[n], nIndex); + + if (nIndex == nNewIndex) + { + sal_Int32 nLength = aStringToCut[n].getLength(); + nIndex += nLength; + + break; + } + } + } + } + + return s.copy(nIndex); +} + bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess> xRelationshipAccess, StreamType_t nStreamType, @@ -188,7 +224,7 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess> else { rDocumentTarget = msPath; - rDocumentTarget += sMyTarget; + rDocumentTarget += lcl_normalizeTarget(sMyTarget); } break; |