summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-09-17 11:57:24 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-09-17 19:08:15 +0200
commit3914a711060341345f15b83656457f90095f32d6 (patch)
treec10daa15c9da89e135f9eddf0f62e344fc836c1f
parent636dd4aba3bf9fbe83f74532c2df4bace3fdf712 (diff)
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
-rw-r--r--sw/source/filter/html/htmlgrin.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 19d11dae7804..5a0805682832 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -696,23 +696,18 @@ IMAGE_SETEVENT:
Graphic aEmptyGrf;
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( aStream )
- {
- GraphicFilter::GetGraphicFilter().ImportGraphic( aEmptyGrf, OUString(), *aStream );
- free( aStream );
- }
- else
- {
- aEmptyGrf.SetDefaultType();
- }
+ if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aEmptyGrf, aGraphicURL))
+ sGrfNm = "";
}
- else
+ if (!sGrfNm.isEmpty())
{
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,
&aFrmSet, NULL, NULL );
SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()