diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/htmlgrin.cxx | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index ec6c8f9e2e91..4052027f6ffb 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -696,8 +696,9 @@ IMAGE_SETEVENT: aFrmSize.SetHeightPercent( nPrcHeight ); aFrmSet.Put( aFrmSize ); - Graphic aEmptyGrf; - if( sGrfNm.startsWith("data:") ) + Graphic aGraphic; + INetURLObject aGraphicURL( sGrfNm ); + if( aGraphicURL.GetProtocol() == INET_PROT_DATA ) { // use embedded base64 encoded data ::com::sun::star::uno::Sequence< sal_Int8 > aPass; @@ -705,15 +706,22 @@ IMAGE_SETEVENT: ::sax::Converter::decodeBase64(aPass, sBase64Data); if( aPass.hasElements() ) { - SvMemoryStream aStream(aPass.getArray(), aPass.getLength(), STREAM_READ); - GraphicFilter::GetGraphicFilter().ImportGraphic( aEmptyGrf, OUString(), aStream ); + SvMemoryStream aStream(aPass.getArray(), aPass.getLength(), STREAM_READ); + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", aStream)) + sGrfNm = ""; } } - else + else if (aGraphicURL.GetProtocol() == INET_PROT_FILE) + { + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL)) + sGrfNm = ""; + } + if (!sGrfNm.isEmpty()) { - aEmptyGrf.SetDefaultType(); + aGraphic.SetDefaultType(); } - SwFrmFmt *pFlyFmt = pDoc->Insert( *pPam, sGrfNm, aEmptyOUStr, &aEmptyGrf, + // passing empty sGrfNm here, means we don't want the graphic to be linked + SwFrmFmt *pFlyFmt = pDoc->Insert( *pPam, sGrfNm, aEmptyOUStr, &aGraphic, &aFrmSet, NULL, NULL ); SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx() ->GetIndex()+1 ]->GetGrfNode(); |