sc/source/ui/view/gridwin.cxx |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

New commits:
commit df6871286d7b769bc47554955213a2d727c47875
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Dec 18 22:32:07 2019 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu Dec 19 00:08:54 2019 +0100

    lok: send "EMPTY" if the rect is empty for cell selection or fill
    
    It can happen that the selection or auto-fill rectangles are
    empty and if that's the case then we need to send "EMPTY" string
    and not the content of an empty rectangle (0, 0, -32768, -32768).
    
    This can happen for CELL_SELECTION_AREA or CELL_AUTO_FILL_AREA in
    calc.
    
    Change-Id: I9a60e3907a2ab8b0e0fd1a2ff81137fba6c8e9a3
    Reviewed-on: https://gerrit.libreoffice.org/85437
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 638c8b645aa6..b591b974dabf 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5902,7 +5902,10 @@ void ScGridWindow::UpdateKitSelection(const 
std::vector<tools::Rectangle>& rRect
     }
 
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
aBoundingBox.toString().getStr());
+    OString sBoundingBoxString = "EMPTY";
+    if (!aBoundingBox.IsEmpty())
+        sBoundingBoxString = aBoundingBox.toString();
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
sBoundingBoxString.getStr());
     pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
rectanglesToString(aLogicRects).getStr());
 
     for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
@@ -5955,7 +5958,11 @@ void ScGridWindow::updateOtherKitSelections() const
         OString aRectsString = rectanglesToString(aOtherLogicRects);
         if (it == pViewShell)
         {
-            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
aBoundingBox.toString().getStr());
+            OString sBoundingBoxString = "EMPTY";
+            if (!aBoundingBox.IsEmpty())
+                sBoundingBoxString = aBoundingBox.toString();
+
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
sBoundingBoxString.getStr());
             
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
aRectsString.getStr());
         }
         else
@@ -5975,13 +5982,18 @@ void updateLibreOfficeKitAutoFill(const ScViewData* 
pViewData, tools::Rectangle
     double nPPTX = pViewData->GetPPTX();
     double nPPTY = pViewData->GetPPTY();
 
-    // selection start handle
-    tools::Rectangle aLogicRectangle(
-            rRectangle.Left()  / nPPTX, rRectangle.Top() / nPPTY,
-            rRectangle.Right() / nPPTX, rRectangle.Bottom() / nPPTY);
+    OString sRectangleString = "EMPTY";
+    if (!rRectangle.IsEmpty())
+    {
+        // selection start handle
+        tools::Rectangle aLogicRectangle(
+                rRectangle.Left()  / nPPTX, rRectangle.Top() / nPPTY,
+                rRectangle.Right() / nPPTX, rRectangle.Bottom() / nPPTY);
+        sRectangleString = aLogicRectangle.toString();
+    }
 
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, 
aLogicRectangle.toString().getStr());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, 
sRectangleString.getStr());
 }
 
 } //end anonymous namespace
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to