[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 10 09:14:20 UTC 2021
sw/source/uibase/uiview/viewdraw.cxx | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
New commits:
commit acda15662abfad136d7fc0165f32fd25e775d728
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Feb 10 07:21:30 2021 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Feb 10 10:13:42 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>
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 233d1cfcff95..d5c2ff4284c7 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -169,18 +169,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