From 72703173066a2db5c977d422ace59d60b998bbfc Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Wed, 17 Sep 2014 21:36:02 +0200 Subject: HTML import: fix importing of inlined images (related: fdo#50763) Regression from 3914a711060341345f15b83656457f90095f32d6 Change-Id: I0523d2b07dc33c74caa711cf7aae274c935f8eed --- sw/source/filter/html/htmlgrin.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 5a0805682832..f4e1e4421410 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -694,21 +694,30 @@ IMAGE_SETEVENT: aFrmSize.SetHeightPercent( nPrcHeight ); aFrmSet.Put( aFrmSize ); - Graphic aEmptyGrf; + Graphic aGraphic; INetURLObject aGraphicURL( sGrfNm ); - if (aGraphicURL.GetProtocol() == INET_PROT_DATA || - aGraphicURL.GetProtocol() == INET_PROT_FILE) + if( aGraphicURL.GetProtocol() == INET_PROT_DATA ) { - if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aEmptyGrf, aGraphicURL)) + SvMemoryStream* aStream = aGraphicURL.getData(); + if( aStream ) + { + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *aStream)) + sGrfNm = ""; + free( aStream ); + } + } + else if (aGraphicURL.GetProtocol() == INET_PROT_FILE) + { + if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL)) sGrfNm = ""; } if (!sGrfNm.isEmpty()) { - aEmptyGrf.SetDefaultType(); + aGraphic.SetDefaultType(); } // passing empty sGrfNm here, means we don't want the graphic to be linked - SwFrmFmt *pFlyFmt = pDoc->getIDocumentContentOperations().Insert( *pPam, sGrfNm, aEmptyOUStr, &aEmptyGrf, + SwFrmFmt *pFlyFmt = pDoc->getIDocumentContentOperations().Insert( *pPam, sGrfNm, aEmptyOUStr, &aGraphic, &aFrmSet, NULL, NULL ); SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx() ->GetIndex()+1 ]->GetGrfNode(); -- cgit