Author: alg
Date: Fri Jan 17 01:37:00 2014
New Revision: 1558977

URL: http://svn.apache.org/r1558977
Log:
i123042 corrected reload of linked content to have access to it's own path

Modified:
    openoffice/trunk/main/sfx2/source/appl/fileobj.cxx
    openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx
    openoffice/trunk/main/svx/source/svdraw/svdograf.cxx

Modified: openoffice/trunk/main/sfx2/source/appl/fileobj.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/appl/fileobj.cxx?rev=1558977&r1=1558976&r2=1558977&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/appl/fileobj.cxx (original)
+++ openoffice/trunk/main/sfx2/source/appl/fileobj.cxx Fri Jan 17 01:37:00 2014
@@ -349,7 +349,9 @@ sal_Bool SvFileObject::GetGraphic_Impl( 
        else if( !pDownLoadData )
        {
                pStream->Seek( STREAM_SEEK_TO_BEGIN );
-               nRes = pGF->ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter );
+
+        // #123042# for e.g. SVG the path is needed, see same TaskID in svx 
for more info
+        nRes = pGF->ImportGraphic( rGrf, sFileNm, *pStream, nFilter );
        }
        else
        {

Modified: openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx?rev=1558977&r1=1558976&r2=1558977&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx Fri Jan 17 
01:37:00 2014
@@ -241,21 +241,32 @@ namespace svgio
                     else if(maUrl.getLength())
                     {
                         const rtl::OUString& rPath = 
getDocument().getAbsolutePath();
-                        const rtl::OUString 
aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl));
 
-                        if(aAbsUrl.getLength())
+                        if(rPath.getLength())
                         {
-                            SvFileStream aStream(aAbsUrl, STREAM_STD_READ);
-                            Graphic aGraphic;
+                            const rtl::OUString 
aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl));
 
-                            if(GRFILTER_OK == 
GraphicFilter::GetGraphicFilter()->ImportGraphic(
-                                aGraphic, 
-                                aAbsUrl, 
-                                aStream))
+                            if(aAbsUrl.getLength())
                             {
-                                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
+                        {
+                            // #123042# 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.getLength())
                     {

Modified: openoffice/trunk/main/svx/source/svdraw/svdograf.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdograf.cxx?rev=1558977&r1=1558976&r2=1558977&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdograf.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdograf.cxx Fri Jan 17 01:37:00 
2014
@@ -135,7 +135,6 @@ const Graphic ImpLoadLinkedGraphic( cons
                                                        ? 
pGF->GetImportFormatNumber( aFilterName )
                                                        : 
GRFILTER_FORMAT_DONTKNOW;
 
-               String aEmptyStr;
                com::sun::star::uno::Sequence< 
com::sun::star::beans::PropertyValue > aFilterData( 1 );
 
                // Room for improvment:
@@ -144,7 +143,14 @@ const Graphic ImpLoadLinkedGraphic( cons
                // there we should create a new service to provide this data if 
needed
                aFilterData[ 0 ].Name = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) );
                aFilterData[ 0 ].Value = Any( sal_True );
-               pGF->ImportGraphic( aGraphic, aEmptyStr, *pInStrm, nFilter, 
NULL, 0, &aFilterData );
+
+        // #123042# 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.
+        pGF->ImportGraphic( aGraphic, aFileName, *pInStrm, nFilter, NULL, 0, 
&aFilterData );
        }
        return aGraphic;
 }


Reply via email to