summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}