[Libreoffice-commits] core.git: sw/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 22 20:02:11 UTC 2021
sw/source/filter/html/htmlplug.cxx | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
New commits:
commit 3bbe38a60b4a9ae50b59e41a02292e639ec28c09
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Jun 17 12:43:34 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jul 22 22:01:35 2021 +0200
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 at collabora.com>
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;
}
More information about the Libreoffice-commits
mailing list