diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-02-10 07:21:30 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-03-09 09:55:25 +0100 |
commit | d5eeca9bf3811b8c83d497dab5edb3ee2ba79a84 (patch) | |
tree | 9a198dedefeb3d667b3800294628bcaa1ee855e3 | |
parent | 878e8fe7ffeada3d6154fe4750079deb38e1ce94 (diff) |
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@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112164
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | sw/source/uibase/uiview/viewdraw.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
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 ); |