summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2014-02-13 22:30:53 +0100
committerAndras Timar <andras.timar@collabora.com>2014-02-14 10:42:24 +0100
commit047913ea8f0cb8b03f78be0780c5e828be9ef323 (patch)
treec3b501bdb5febaadbd54f02bd3958feaa1f75dab /sw
parentd5fba1856ff1f939a9ebd523da3aa6578fbc3a25 (diff)
fdo#50763: handle inlined base64 images
Signed-off-by: Andras Timar <andras.timar@collabora.com> Conflicts: sw/source/filter/html/htmlgrin.cxx Change-Id: I2e9d17dafcf91872d8ea19089e68d8fe652b3e4e Signed-off-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/notxtfrm.cxx2
-rw-r--r--sw/source/core/graphic/ndgrf.cxx9
-rw-r--r--sw/source/filter/html/htmlgrin.cxx20
3 files changed, 29 insertions, 2 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index fb4abbfcd37b..4d29dece3696 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 21cc72a4c6d9..725296ffd57b 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 221b9674800f..231555e318ac 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()