summaryrefslogtreecommitdiff
path: root/sw/source/uibase/ribbar
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-01-17 14:46:47 +0100
committerJan Holesovsky <kendy@collabora.com>2019-01-18 15:39:05 +0100
commit74b23279c342f2484cdad64b211fb1972644d5a5 (patch)
tree33dafc263ff0ff95fa35cc91a14a320b2f10150a /sw/source/uibase/ribbar
parenta40f12c3f18e4262336fcd51d26dd099eae1e070 (diff)
lok sw: When inserting shapes, do that in the middle of the visible area.
Instead of in the middle of the entire document, which may be far away. Change-Id: I50a1a5f159b73a3803cd7a549939b73a366e7dc5 Reviewed-on: https://gerrit.libreoffice.org/66584 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw/source/uibase/ribbar')
-rw-r--r--sw/source/uibase/ribbar/drawbase.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx
index fdd09bab6dc9..4aa0bdeedd64 100644
--- a/sw/source/uibase/ribbar/drawbase.cxx
+++ b/sw/source/uibase/ribbar/drawbase.cxx
@@ -18,6 +18,7 @@
*/
#include <hintids.hxx>
+#include <comphelper/lok.hxx>
#include <svx/svdview.hxx>
#include <svx/svdobj.hxx>
#include <svl/ptitem.hxx>
@@ -524,13 +525,21 @@ void SwDrawBase::CreateDefaultObject()
Point SwDrawBase::GetDefaultCenterPos()
{
Size aDocSz(m_pSh->GetDocSize());
- const SwRect& rVisArea = m_pSh->VisArea();
- Point aStartPos = rVisArea.Center();
- if(rVisArea.Width() > aDocSz.Width())
- aStartPos.setX( aDocSz.Width() / 2 + rVisArea.Left() );
- if(rVisArea.Height() > aDocSz.Height())
- aStartPos.setY( aDocSz.Height() / 2 + rVisArea.Top() );
- return aStartPos;
+
+ SwRect aVisArea(m_pSh->VisArea());
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ aVisArea = m_pSh->getLOKVisibleArea();
+ aVisArea.Intersection(SwRect(Point(), aDocSz));
+ }
+
+ Point aCenter = aVisArea.Center();
+ if (aVisArea.Width() > aDocSz.Width())
+ aCenter.setX(aDocSz.Width() / 2 + aVisArea.Left());
+ if (aVisArea.Height() > aDocSz.Height())
+ aCenter.setY(aDocSz.Height() / 2 + aVisArea.Top());
+
+ return aCenter;
}
// #i33136#