diff options
author | Muhammet Kara <muhammet.kara@collabora.com> | 2020-02-12 05:42:11 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-02-13 06:56:01 +0100 |
commit | 7a27ac1060fcf8a6bbf9e03ad1457633dcd1ad06 (patch) | |
tree | c718d63c1e10ecef5de42b8fd1f9d7d157211a41 | |
parent | 09e6824bc868990095233825c415556399dd0652 (diff) |
mobile: Center inserted shapes on visible area
Change-Id: I366ef5d01ee3afb072b1f67d24015c889a41f4b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88488
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | sc/source/ui/view/tabvwsh2.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 117edd72493d..da77a4278655 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -19,6 +19,7 @@ #include <comphelper/lok.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/lokhelper.hxx> #include <sfx2/viewfrm.hxx> #include <svl/whiter.hxx> #include <unotools/moduleoptions.hxx> @@ -320,6 +321,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) // calc position and size bool bLOKIsActive = comphelper::LibreOfficeKit::isActive(); + bool bIsMobile = comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()); Point aInsertPos; if(!bLOKIsActive) { @@ -328,6 +330,16 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) aInsertPos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) ); } + else if (bIsMobile) + { + aInsertPos = GetViewData().getLOKVisibleArea().Center(); + + aInsertPos.setX(sc::TwipsToHMM(aInsertPos.X())); + aInsertPos.setY(sc::TwipsToHMM(aInsertPos.Y())); + + aInsertPos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); + aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) ); + } else { aInsertPos = GetInsertPos(); |