Author: damjan Date: Wed Feb 24 02:12:14 2016 New Revision: 1732010 URL: http://svn.apache.org/viewvc?rev=1732010&view=rev Log: Merge r1409445 from branches/gbuild: #i116755# handle absolute paths in _rel
BUILDS Modified: openoffice/branches/gbuild-reintegration/ (props changed) openoffice/branches/gbuild-reintegration/main/writerfilter/source/ooxml/OOXMLStreamImpl.cxx Propchange: openoffice/branches/gbuild-reintegration/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Feb 24 02:12:14 2016 @@ -1,4 +1,4 @@ -/incubator/ooo/branches/gbuild:1409313-1409425,1409428,1409432-1409436,1409438,1409440,1409442,1409444,1409470 +/incubator/ooo/branches/gbuild:1409313-1409425,1409428,1409432-1409436,1409438,1409440,1409442,1409444-1409445,1409470 /openoffice/branches/AOO400:1503684 /openoffice/branches/AOO410:1572480,1573601,1583349,1583635,1583666 /openoffice/branches/alg_writerframes:1556289-1579189 Modified: openoffice/branches/gbuild-reintegration/main/writerfilter/source/ooxml/OOXMLStreamImpl.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/source/ooxml/OOXMLStreamImpl.cxx?rev=1732010&r1=1732009&r2=1732010&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/writerfilter/source/ooxml/OOXMLStreamImpl.cxx (original) +++ openoffice/branches/gbuild-reintegration/main/writerfilter/source/ooxml/OOXMLStreamImpl.cxx Wed Feb 24 02:12:14 2016 @@ -90,6 +90,42 @@ const ::rtl::OUString & OOXMLStreamImpl: 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, @@ -184,7 +220,7 @@ bool OOXMLStreamImpl::lcl_getTarget(uno: else { rDocumentTarget = msPath; - rDocumentTarget += sMyTarget; + rDocumentTarget += lcl_normalizeTarget(sMyTarget); } break;