sfx2/source/appl/fileobj.cxx | 4 +++- svgio/source/svgreader/svgimagenode.cxx | 29 ++++++++++++++++++++--------- svx/source/svdraw/svdograf.cxx | 12 +++++++++--- 3 files changed, 32 insertions(+), 13 deletions(-)
New commits: commit 87432aeecdfa7194bb5050f912656e03294cf6c7 Author: Armin Le Grand <a...@apache.org> Date: Fri Jan 17 01:37:00 2014 +0000 Resolves: #i123042# corrected reload of linked content... to have access to its own path (cherry picked from commit bc89d402b3df00c2402ac86896eb2ce4c3f7b7d0) Conflicts: sfx2/source/appl/fileobj.cxx svgio/source/svgreader/svgimagenode.cxx svx/source/svdraw/svdograf.cxx Change-Id: I4f3e98588f17b4271465359a7f56f9845029e012 diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 4ab7ec9..13dbfc2 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -324,7 +324,9 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) else if( !pDownLoadData ) { pStream->Seek( STREAM_SEEK_TO_BEGIN ); - nRes = rGF.ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter ); + + // #i123042# for e.g. SVG the path is needed, see same TaskID in svx for more info + nRes = rGF.ImportGraphic( rGrf, sFileNm, *pStream, nFilter ); } else { diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index 533d1be..0219a0e 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -234,21 +234,32 @@ namespace svgio else if(!maUrl.isEmpty()) { const OUString& rPath = getDocument().getAbsolutePath(); - const OUString aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl)); - if(!aAbsUrl.isEmpty()) + if (!rPath.isEmpty()) { - SvFileStream aStream(aAbsUrl, STREAM_STD_READ); - Graphic aGraphic; + const OUString aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl)); - if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic( - aGraphic, - aAbsUrl, - aStream)) + if (!aAbsUrl.isEmpty()) { - extractFromGraphic(aGraphic, aNewTarget, aViewBox, aBitmapEx); + SvFileStream aStream(aAbsUrl, STREAM_STD_READ); + Graphic aGraphic; + + if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic( + aGraphic, + aAbsUrl, + aStream)) + { + extractFromGraphic(aGraphic, aNewTarget, aViewBox, aBitmapEx); + } } } + else + { + // #i123042# detect missing path and assert - content will be missing. The + // absolute path to itself needs to be set to correctly import linked + // content in a SVG file + OSL_ENSURE(false, "SVG graphic with internal links is interpreted, but local AbsolutePath is not set: linked content will be missing (!)"); + } } else if(!maXLink.isEmpty()) { diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index ff644a5..58955ef 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -119,7 +119,6 @@ const Graphic ImpLoadLinkedGraphic( const OUString& aFileName, const OUString& a ? rGF.GetImportFormatNumber( aFilterName ) : GRFILTER_FORMAT_DONTKNOW; - OUString aEmptyStr; css::uno::Sequence< css::beans::PropertyValue > aFilterData( 1 ); // TODO: Room for improvement: @@ -127,8 +126,15 @@ const Graphic ImpLoadLinkedGraphic( const OUString& aFileName, const OUString& a // But this link is required by some filters to access the native graphic (PDF export/MS export), // there we should create a new service to provide this data if needed aFilterData[ 0 ].Name = "CreateNativeLink"; - aFilterData[ 0 ].Value = Any( true ); - rGF.ImportGraphic( aGraphic, aEmptyStr, *pInStrm, nFilter, NULL, 0, &aFilterData ); + aFilterData[ 0 ].Value = Any( sal_True ); + + // #i123042# for e.g SVG the path is needed, so hand it over here. I have no real idea + // what consequences this may have; maybe this is not handed over by purpose here. Not + // handing it over means that any GraphicFormat that internallv needs a path as base + // to interpret included links may fail. + // Alternatively the path may be set at the result after this call when it is known + // that it is a SVG graphic, but only because noone yet tried to interpret it. + rGF.ImportGraphic( aGraphic, aFileName, *pInStrm, nFilter, NULL, 0, &aFilterData ); } return aGraphic; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits