[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/source

Chr. Rossmanith ChrRossmanith at gmx.de
Fri Feb 14 10:43:24 CET 2014


 sw/source/core/doc/notxtfrm.cxx    |    2 ++
 sw/source/core/graphic/ndgrf.cxx   |    9 ++++++++-
 sw/source/filter/html/htmlgrin.cxx |   20 +++++++++++++++++++-
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 047913ea8f0cb8b03f78be0780c5e828be9ef323
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Thu Feb 13 22:30:53 2014 +0100

    fdo#50763: handle inlined base64 images
    
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Conflicts:
    	sw/source/filter/html/htmlgrin.cxx
    
    Change-Id: I2e9d17dafcf91872d8ea19089e68d8fe652b3e4e
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index fb4abbf..4d29dec 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -83,6 +83,8 @@ inline bool GetRealURL( const SwGrfNode& rNd, OUString& rTxt )
     if( bRet )
         rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED,
                                            INetURLObject::DECODE_UNAMBIGUOUS);
+    if (rTxt.startsWith("data:image")) rTxt = "inline image";
+
     return bRet;
 }
 
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 21cc72a..725296f 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -76,7 +76,14 @@ SwGrfNode::SwGrfNode(
         bFrameInPaint = bScaleImageMap = sal_False;
 
     bGrafikArrived = sal_True;
-    ReRead(rGrfName,rFltName, pGraphic, 0, sal_False);
+
+    // fdo#50763 inline image has already been read into memory
+    if (rGrfName.startsWith("data:")) {
+        maGrfObj.SetGraphic( *pGraphic, rGrfName );
+    }
+    else {
+        ReRead(rGrfName,rFltName, pGraphic, 0, sal_False);
+    }
 }
 
 SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 221b967..231555e 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -68,6 +68,9 @@
 #include <numrule.hxx>
 #include <boost/shared_ptr.hpp>
 
+#include <sax/tools/converter.hxx>
+#include <vcl/graphicfilter.hxx>
+
 using namespace ::com::sun::star;
 
 
@@ -694,7 +697,22 @@ IMAGE_SETEVENT:
     aFrmSet.Put( aFrmSize );
 
     Graphic aEmptyGrf;
-    aEmptyGrf.SetDefaultType();
+    if( sGrfNm.startsWith("data:") )
+    {
+        // use embedded base64 encoded data
+        ::com::sun::star::uno::Sequence< sal_Int8 > aPass;
+        OUString sBase64Data = sGrfNm.replaceAt(0,22,"");
+        ::sax::Converter::decodeBase64(aPass, sBase64Data);
+        if( aPass.hasElements() )
+        {
+                SvMemoryStream aStream(aPass.getArray(), aPass.getLength(), STREAM_READ);
+                GraphicFilter::GetGraphicFilter().ImportGraphic( aEmptyGrf, OUString(), aStream );
+        }
+    }
+    else
+    {
+        aEmptyGrf.SetDefaultType();
+    }
     SwFrmFmt *pFlyFmt = pDoc->Insert( *pPam, sGrfNm, aEmptyOUStr, &aEmptyGrf,
                                       &aFrmSet, NULL, NULL );
     SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()


More information about the Libreoffice-commits mailing list