summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/htmlplug.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-06-17 12:43:34 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-07-22 22:01:35 +0200
commit3bbe38a60b4a9ae50b59e41a02292e639ec28c09 (patch)
tree42e19382da2f9a12d63043c63a94ba4ccd58ee90 /sw/source/filter/html/htmlplug.cxx
parent55d47fd99c673ecb9830e9a60c55a3cc0d008b28 (diff)
set size properly when setting embed size from fallback graphic
When loading e.g. OLE from ReqIF, the file contains object tag for the OLE and then as a fallback also an image. This loading code apparently sets the OLE geometry to the same as the image, for whatever reason, but if that's to be done, at least do it consistently, the same way it's done when reading the OLE. Otherwise e.g. relative width is ignored. Change-Id: Ifeafaefa4274db9ddffc6ff16210f7ecc2301a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117464 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sw/source/filter/html/htmlplug.cxx')
-rw-r--r--sw/source/filter/html/htmlplug.cxx17
1 files changed, 3 insertions, 14 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 2c06177f539c..9ae5abc57095 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -516,25 +516,14 @@ bool SwHTMLParser::InsertEmbed()
rObj.SetGraphic(aGraphic, aType);
// Set the size of the OLE frame to the size of the graphic.
- OutputDevice* pDevice = Application::GetDefaultDevice();
- if (aSize.getHeight() == USHRT_MAX || aSize.getWidth() == USHRT_MAX)
- {
- Size aPixelSize = aGraphic.GetSizePixel(pDevice);
- if (aSize.getWidth() == USHRT_MAX)
- aSize.setWidth(aPixelSize.getWidth());
- if (aSize.getHeight() == USHRT_MAX)
- aSize.setHeight(aPixelSize.getHeight());
- }
-
SwFrameFormat* pFormat = pOLENode->GetFlyFormat();
if (!pFormat)
return true;
-
SwAttrSet aAttrSet(pFormat->GetAttrSet());
aAttrSet.ClearItem(RES_CNTNT);
- Size aTwipSize(pDevice->PixelToLogic(aSize, MapMode(MapUnit::MapTwip)));
- SwFormatFrameSize aFrameSize(SwFrameSize::Fixed, aTwipSize.Width(), aTwipSize.Height());
- aAttrSet.Put(aFrameSize);
+ OutputDevice* pDevice = Application::GetDefaultDevice();
+ Size aDefaultTwipSize(pDevice->PixelToLogic(aGraphic.GetSizePixel(pDevice), MapMode(MapUnit::MapTwip)));
+ SetFixSize(aSize, aDefaultTwipSize, bPercentWidth, bPercentHeight, aPropInfo, aAttrSet);
pOLENode->GetDoc().SetFlyFrameAttr(*pFormat, aAttrSet);
return true;
}