From 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 17 Mar 2022 17:36:18 +0100 Subject: sw image dialog: fix fallback width/height for images with relative sizes Make sure that we work with the up to date layout size of the image in the dialog, otherwise 80% shows up as 237%. Also fix SfxMacroTabPage::FillItemSet() to not put anything to the output item set when the macro table is empty, this way clicking OK in the image dialog results in an unmodified document when the user doesn't change anything. Change-Id: I4b987bd3e3818ee737e37ea10861f9043c25bc93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131714 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/uibase/shells/grfsh.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sw/source/uibase') diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index bb60338f1ce0..86dde1851c3a 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include constexpr OUStringLiteral TOOLBOX_NAME = u"colorbar"; @@ -317,6 +318,15 @@ void SwGrfShell::Execute(SfxRequest &rReq) aSet.Put( aFrameSize ); aSet.Put( aMgr.GetAttrSet() ); + SwFlyFrame* pFly = rSh.GetSelectedFlyFrame(); + if (pFly) + { + // Work with the up to date layout size if possible. + SwFormatFrameSize aSize = aSet.Get(RES_FRM_SIZE); + aSize.SetWidth(pFly->getFrameArea().Width()); + aSize.SetHeight(pFly->getFrameArea().Height()); + aSet.Put(aSize); + } aSet.SetParent( aMgr.GetAttrSet().GetParent() ); // At percentage values initialize size -- cgit