summaryrefslogtreecommitdiff
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
parenta4d059e2b139e1c0b49bbbf983112e15ea2f601b (diff)
fdo#50763: handle inlined base64 images
Conflicts: sw/source/filter/html/htmlgrin.cxx Change-Id: I2e9d17dafcf91872d8ea19089e68d8fe652b3e4e
-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 900859691116..e59e32ebd56c 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 d25123ff01d5..e80904dda0cf 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -74,7 +74,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 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()