Kaydet (Commit) 363f1c14 authored tarafından Chr. Rossmanith's avatar Chr. Rossmanith Kaydeden (comit) Andras Timar

fdo#50763: handle inlined base64 images

Conflicts:
	sw/source/filter/html/htmlgrin.cxx

Change-Id: I2e9d17dafcf91872d8ea19089e68d8fe652b3e4e
üst a4d059e2
......@@ -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;
}
......
......@@ -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,
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment