[Libreoffice-commits] core.git: sw/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 9 08:56:13 UTC 2021
sw/source/uibase/uiview/viewdraw.cxx | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
New commits:
commit d5eeca9bf3811b8c83d497dab5edb3ee2ba79a84
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 10 07:21:30 2021 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Mar 9 09:55:25 2021 +0100
fontwork: center in online in writer
Avoid unnecessary position change
Change-Id: I338b9a28653569e1b7c19ba3a1f590363fb2f94c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110664
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112164
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 680d7ba788e7..80c42872c29b 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -162,18 +162,17 @@ void SwView::ExecDraw(SfxRequest& rReq)
const SwRect& rVisArea = comphelper::LibreOfficeKit::isActive() ?
m_pWrtShell->getLOKVisibleArea() : m_pWrtShell->VisArea();
Point aPos( rVisArea.Center() );
+ tools::Rectangle aObjRect( pObj->GetLogicRect() );
- if( rVisArea.Width() > aDocSize.Width())
+ if ( rVisArea.Width() > aDocSize.Width())
aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
+ else if (aPos.getX() > aObjRect.GetWidth() / 2)
+ aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
- if(rVisArea.Height() > aDocSize.Height())
+ if (rVisArea.Height() > aDocSize.Height())
aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
-
- tools::Rectangle aObjRect( pObj->GetLogicRect() );
- if (aPos.getX() > aObjRect.GetWidth() / 2)
- aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
- if (aPos.getY() > aObjRect.GetHeight() / 2)
- aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
+ else if (aPos.getY() > aObjRect.GetHeight() / 2)
+ aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
m_pWrtShell->EnterStdMode();
m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
More information about the Libreoffice-commits
mailing list