[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 14 19:33:08 UTC 2018


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

New commits:
commit edf6819a7dca6348954d6cbefb19631448602774
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Dec 14 16:56:25 2018 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Dec 14 20:32:43 2018 +0100

    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.
    
    Change-Id: I5c887261556c491962ed19f416ce480a63c24a9a
    Reviewed-on: https://gerrit.libreoffice.org/65177
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at 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();
 


More information about the Libreoffice-commits mailing list