diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-23 14:10:10 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-23 15:23:18 +0200 |
commit | a0f5c5e6d16ef9e3db140a922912ff2a49a224b7 (patch) | |
tree | 2f813cb48409c8a53fdc99defaa79266ea9a2117 /sw/source | |
parent | cd511523fdf2cae9c28588aaf181259d04dfa932 (diff) |
sw HTML import: lazy-read inline images
Also prefer Graphic::GetPrefSize() over Graphic::GetSizePixel(), since the
previous does not swap in the image.
Change-Id: I100da14716448e72b687ce8ad1800326f0b3735e
Reviewed-on: https://gerrit.libreoffice.org/53322
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/html/htmlgrin.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 869d92c3c435..cb25a316277f 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -480,8 +480,25 @@ IMAGE_SETEVENT: std::unique_ptr<SvMemoryStream> const pStream(aGraphicURL.getData()); if (pStream) { - if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream)) + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); + aGraphic = rFilter.ImportUnloadedGraphic(*pStream); + if (aGraphic) + { sGrfNm.clear(); + + if (!bHeightProvided || !bWidthProvided) + { + Size aPrefSize = aGraphic.GetPrefSize(); + nWidth = aPrefSize.getWidth(); + nHeight = aPrefSize.getHeight(); + } + } + + if (!sGrfNm.isEmpty()) + { + if (ERRCODE_NONE == rFilter.ImportGraphic(aGraphic, "", *pStream)) + sGrfNm.clear(); + } } } else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty()) @@ -497,7 +514,7 @@ IMAGE_SETEVENT: aGraphic.SetDefaultType(); } - if (!bHeightProvided || !bWidthProvided) + if (!nHeight || !nWidth) { Size aPixelSize = aGraphic.GetSizePixel(Application::GetDefaultDevice()); if (!bWidthProvided) |