sc/source/ui/view/tabvwsh2.cxx |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

New commits:
commit a07f5e631d6bc0b508ed80b67053d78e57eed867
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Dec 7 13:25:59 2018 +0100
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Wed Aug 28 22:35:15 2019 +0200

    lok: Insert shape at the positon of the selected cell
    
    Calculation of the visible area is not working correctly in
    online case which leads to positioning of the shape outisde
    of the view.
    Instead of that calculation use the selected cell's position
    to insert the shape at, similar how image insertion works.
    
    (cherry picked from commit 076675d5b57ad779a15e25c2105127d86e849fbb)
    (cherry picked from commit f0863c1495a65731b1bc475bc0b5fd269b0f2764)
    
    Change-Id: I5c887261556c491962ed19f416ce480a63c24a9a
    Reviewed-on: https://gerrit.libreoffice.org/78237
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 531aa9052f9c..b21fdd31fd0c 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -324,11 +324,21 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
         sal_uInt32 nDefaultObjectSizeHeight = 
rAppOpt.GetDefaultObjectSizeHeight();
 
         // calc position and size
-        tools::Rectangle aVisArea = 
pWin->PixelToLogic(tools::Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
-        Point aPagePos = aVisArea.Center();
-        aPagePos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) );
-        aPagePos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) );
-        tools::Rectangle aNewObjectRectangle(aPagePos, 
Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
+        bool bLOKIsActive = comphelper::LibreOfficeKit::isActive();
+        Point aInsertPos;
+        if(!bLOKIsActive)
+        {
+            tools::Rectangle aVisArea = 
pWin->PixelToLogic(tools::Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
+            aInsertPos = aVisArea.Center();
+            aInsertPos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) );
+            aInsertPos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) );
+        }
+        else
+        {
+            aInsertPos = GetInsertPos();
+        }
+
+        tools::Rectangle aNewObjectRectangle(aInsertPos, 
Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
 
         ScDrawView* pDrView = GetScDrawView();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to