sc/source/ui/view/tabvwsh2.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit a2122424ff711cd25e0cec177068bafe99284b9a
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Wed Feb 12 05:42:11 2020 +0300
Commit:     Muhammet Kara <muhammet.k...@collabora.com>
CommitDate: Wed Feb 12 09:12:59 2020 +0100

    mobile: Center inserted shapes on visible area
    
    Change-Id: I366ef5d01ee3afb072b1f67d24015c889a41f4b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88507
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com>

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index b21fdd31fd0c..8bc3bbfe1d1e 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/aeitem.hxx>
 #include <svl/whiter.hxx>
@@ -325,6 +326,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)
         {
@@ -333,6 +335,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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to