summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/htmlgrin.cxx
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:39:42 +0100
commit363f1c1462963f6f032de07649dc9c4d02b4e446 (patch)
tree0ffba5d5aa689bdda124c7046e82d6b29c7b64d0 /sw/source/filter/html/htmlgrin.cxx
parenta4d059e2b139e1c0b49bbbf983112e15ea2f601b (diff)
fdo#50763: handle inlined base64 images
Conflicts: sw/source/filter/html/htmlgrin.cxx Change-Id: I2e9d17dafcf91872d8ea19089e68d8fe652b3e4e
Diffstat (limited to 'sw/source/filter/html/htmlgrin.cxx')
-rw-r--r--sw/source/filter/html/htmlgrin.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 9d82944da16c..4378c841ec0a 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;
@@ -697,7 +700,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()