[Libreoffice-commits] core.git: svx/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 8 09:07:53 UTC 2021
svx/source/tbxctrls/fontworkgallery.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 9279dce41152ed692c125edfed4c80a7c28c7a0b
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 20 10:02:53 2021 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Mar 8 10:06:49 2021 +0100
Don't insert fontwork outside view
Change-Id: Ib518cc6c70e2595cc191cd353b628729fd220de7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109665
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112151
Tested-by: Jenkins
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 12fb590622b3..bfcde08d09c8 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -195,8 +195,14 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
Point aPagePos = aVisArea.Center();
- aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
- aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
+ bool bIsInsertedObjectSmallerThanVisibleArea =
+ aVisArea.GetSize().getHeight() > aObjRect.GetSize().getHeight() &&
+ aVisArea.GetSize().getWidth() > aObjRect.GetSize().getWidth();
+ if (bIsInsertedObjectSmallerThanVisibleArea)
+ {
+ aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
+ aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
+ }
tools::Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
pNewObject->SetLogicRect(aNewObjectRectangle);
More information about the Libreoffice-commits
mailing list