Kaydet (Commit) 3914a711 authored tarafından Matúš Kukan's avatar Matúš Kukan

bnc#580834: HTML import: Embed images if source URL is a local file.

Use also INET_PROT_FILE to determine whether to import images as links.

Change-Id: I072be21086505f6300463e4e3cfb276cbe506803
üst 636dd4ab
...@@ -696,23 +696,18 @@ IMAGE_SETEVENT: ...@@ -696,23 +696,18 @@ IMAGE_SETEVENT:
Graphic aEmptyGrf; Graphic aEmptyGrf;
INetURLObject aGraphicURL( sGrfNm ); INetURLObject aGraphicURL( sGrfNm );
if( aGraphicURL.GetProtocol() == INET_PROT_DATA ) if (aGraphicURL.GetProtocol() == INET_PROT_DATA ||
aGraphicURL.GetProtocol() == INET_PROT_FILE)
{ {
SvMemoryStream* aStream = aGraphicURL.getData(); if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aEmptyGrf, aGraphicURL))
if( aStream ) sGrfNm = "";
{
GraphicFilter::GetGraphicFilter().ImportGraphic( aEmptyGrf, OUString(), *aStream );
free( aStream );
}
else
{
aEmptyGrf.SetDefaultType();
}
} }
else if (!sGrfNm.isEmpty())
{ {
aEmptyGrf.SetDefaultType(); aEmptyGrf.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, &aEmptyGrf,
&aFrmSet, NULL, NULL ); &aFrmSet, NULL, NULL );
SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx() 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