[Libreoffice-commits] core.git: sw/source

Matúš Kukan matus.kukan at collabora.com
Thu Sep 18 06:38:15 PDT 2014


 sw/source/filter/html/htmlgrin.cxx |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 72703173066a2db5c977d422ace59d60b998bbfc
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Sep 17 21:36:02 2014 +0200

    HTML import: fix importing of inlined images (related: fdo#50763)
    
    Regression from 3914a711060341345f15b83656457f90095f32d6
    
    Change-Id: I0523d2b07dc33c74caa711cf7aae274c935f8eed

diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 5a08056..f4e1e44 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -694,21 +694,30 @@ IMAGE_SETEVENT:
     aFrmSize.SetHeightPercent( nPrcHeight );
     aFrmSet.Put( aFrmSize );
 
-    Graphic aEmptyGrf;
+    Graphic aGraphic;
     INetURLObject aGraphicURL( sGrfNm );
-    if (aGraphicURL.GetProtocol() == INET_PROT_DATA ||
-        aGraphicURL.GetProtocol() == INET_PROT_FILE)
+    if( aGraphicURL.GetProtocol() == INET_PROT_DATA )
     {
-        if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aEmptyGrf, aGraphicURL))
+        SvMemoryStream* aStream = aGraphicURL.getData();
+        if( aStream )
+        {
+            if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *aStream))
+                sGrfNm = "";
+            free( aStream );
+        }
+    }
+    else if (aGraphicURL.GetProtocol() == INET_PROT_FILE)
+    {
+        if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))
             sGrfNm = "";
     }
     if (!sGrfNm.isEmpty())
     {
-        aEmptyGrf.SetDefaultType();
+        aGraphic.SetDefaultType();
     }
 
     // passing empty sGrfNm here, means we don't want the graphic to be linked
-    SwFrmFmt *pFlyFmt = pDoc->getIDocumentContentOperations().Insert( *pPam, sGrfNm, aEmptyOUStr, &aEmptyGrf,
+    SwFrmFmt *pFlyFmt = pDoc->getIDocumentContentOperations().Insert( *pPam, sGrfNm, aEmptyOUStr, &aGraphic,
                                       &aFrmSet, NULL, NULL );
     SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()
                                   ->GetIndex()+1 ]->GetGrfNode();


More information about the Libreoffice-commits mailing list