summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-06-04 14:02:52 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-06-04 14:54:45 +0200
commit26d2b19d4e9388072b8dae574efdf00d7f7a0f2f (patch)
tree15f52f1275de376a98386b9ded7d787d211aba40 /sw/source
parent4839b7ca3b5a730edf90ebebc749db145efec098 (diff)
sw HTML export: fix pixel size of shapes
- the twips logic size was set, but it was consumed as mm100 logic size, so the pixel size was about half of the correct one - the HTML export didn't write a logic size ("CSS pixels size") for shapes Change-Id: I37f6b4acde9d1298fae81f9975e9db95485631ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116691 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index ed6d646594ee..8f6608097f07 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -933,12 +933,28 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma
// "width" and/or "height"
// Only output SwFrameSize::Variable/SwFrameSize::Minimum if ANYSIZE is set
+ const SwFormatFrameSize* pFSItem = nullptr;
+ std::optional<SwFormatFrameSize> aFrameSize;
+ if (SfxItemState::SET == rItemSet.GetItemState( RES_FRM_SIZE, true, &pItem ))
+ {
+ pFSItem = static_cast<const SwFormatFrameSize *>(pItem);
+ }
+ else if (const SdrObject* pObject = rFrameFormat.FindSdrObject())
+ {
+ // Write size for Draw shapes as well.
+ const tools::Rectangle& rSnapRect = pObject->GetSnapRect();
+ aFrameSize.emplace();
+ aFrameSize->SetWidthSizeType(SwFrameSize::Fixed);
+ aFrameSize->SetWidth(rSnapRect.getWidth());
+ aFrameSize->SetHeightSizeType(SwFrameSize::Fixed);
+ aFrameSize->SetHeight(rSnapRect.getHeight());
+ pFSItem = &*aFrameSize;
+ }
if( (nFrameOptions & HtmlFrmOpts::Size) &&
- SfxItemState::SET == rItemSet.GetItemState( RES_FRM_SIZE, true, &pItem ) &&
+ pFSItem &&
( (nFrameOptions & HtmlFrmOpts::AnySize) ||
- SwFrameSize::Fixed == static_cast<const SwFormatFrameSize *>(pItem)->GetHeightSizeType()) )
+ SwFrameSize::Fixed == pFSItem->GetHeightSizeType()) )
{
- const SwFormatFrameSize *pFSItem = static_cast<const SwFormatFrameSize *>(pItem);
sal_uInt8 nPercentWidth = pFSItem->GetWidthPercent();
sal_uInt8 nPercentHeight = pFSItem->GetHeightPercent();