[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/LibreOfficeKit libreofficekit/source sc/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 8 05:21:23 UTC 2019


 include/LibreOfficeKit/LibreOfficeKitEnums.h |   18 ++++++++++-
 libreofficekit/source/gtk/lokdocview.cxx     |    4 ++
 sc/source/ui/view/gridwin.cxx                |   44 ++++++++++++++++++++-------
 3 files changed, 55 insertions(+), 11 deletions(-)

New commits:
commit 941d6792f840ec4f9c9b90a1e96ebbef485c1ba0
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Jul 28 10:04:58 2019 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Aug 8 14:20:11 2019 +0900

    lok: send cell selection rectangle and cell area fill rectangle
    
    Instead of text selection start/end for cell selection we send a
    cell selection rectangle event. This is needed so we're able to
    differentiate when to draw cell selection and text selection
    markers.
    
    In addition send cell fill area rectangle, which is the area where
    we need to hit to trigger area fill functionality in Calc.
    
    Reviewed-on: https://gerrit.libreoffice.org/76491
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit 23ed3a19cb0d53639d817af9b802a44977e89c65)
    
    Change-Id: I54af958932815818a1a4d48364192ba43f1df7de
    Reviewed-on: https://gerrit.libreoffice.org/76571
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit f7e051d4848c37bde868e62ac9497461b488f9c6)

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 61bf237c1caa..a5cc4a92ae04 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -655,7 +655,23 @@ typedef enum
      * Profiling tracing information single string of multiple lines
      * containing <pid> <timestamp> and zone start/stop information
      */
-    LOK_CALLBACK_PROFILE_FRAME = 41
+    LOK_CALLBACK_PROFILE_FRAME = 41,
+
+    /**
+     * The position and size of the cell selection area. It is used to
+     * draw the selection handles for cells in Calc documents.
+     *
+     * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+     */
+    LOK_CALLBACK_CELL_SELECTION_AREA = 42,
+
+    /**
+     * The position and size of the cell auto fill area. It is used to
+     * trigger auto fill functionality if that area is hit.
+     *
+     * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+     */
+    LOK_CALLBACK_CELL_AUTO_FILL_AREA = 43,
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index d3363c3c8976..f335a42f87e4 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -450,6 +450,10 @@ callbackTypeToString (int nType)
         return "LOK_CALLBACK_SIGNATURE_STATUS";
     case LOK_CALLBACK_PROFILE_FRAME:
         return "LOK_CALLBACK_PROFILE_FRAME";
+    case LOK_CALLBACK_CELL_SELECTION_AREA:
+        return "LOK_CALLBACK_CELL_SELECTION_AREA";
+    case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
+        return "LOK_CALLBACK_CELL_AUTO_FILL_AREA";
     }
     g_assert(false);
     return nullptr;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 888992712295..0830a65e6152 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5890,23 +5890,41 @@ static void updateLibreOfficeKitSelection(const ScViewData* pViewData, const std
         return;
 
     // selection start handle
-    tools::Rectangle aStart(aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY,
-            aBoundingBox.Left() / nPPTX, (aBoundingBox.Top() / nPPTY) + 256);
-
-    // selection end handle
-    tools::Rectangle aEnd(aBoundingBox.Right() / nPPTX, (aBoundingBox.Bottom() / nPPTY) - 256,
+    tools::Rectangle aRectangle(
+            aBoundingBox.Left()  / nPPTX, aBoundingBox.Top() / nPPTY,
             aBoundingBox.Right() / nPPTX, aBoundingBox.Bottom() / nPPTY);
 
     // the selection itself
     OString aSelection = comphelper::string::join("; ", aRectangles).getStr();
 
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aRectangle.toString().getStr());
     pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.getStr());
     SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", aSelection.getStr());
 }
 
+namespace
+{
+
+void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle const & rRectangle)
+{
+    if (!comphelper::LibreOfficeKit::isActive())
+        return;
+
+    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);
+
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, aLogicRectangle.toString().getStr());
+}
+
+} //end anonymous namespace
+
 void ScGridWindow::UpdateCursorOverlay()
 {
     ScDocument* pDoc = pViewData->GetDocument();
@@ -6147,6 +6165,7 @@ void ScGridWindow::UpdateSelectionOverlay()
     {
         ScTabViewShell* pViewShell = pViewData->GetViewShell();
         pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY");
         SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY");
     }
 
@@ -6177,9 +6196,11 @@ void ScGridWindow::UpdateAutoFillOverlay()
         SCCOL nX = aAutoMarkPos.Col();
         SCROW nY = aAutoMarkPos.Row();
 
-        if (!maVisibleRange.isInside(nX, nY))
+        if (!maVisibleRange.isInside(nX, nY) && !comphelper::LibreOfficeKit::isActive())
+        {
             // Autofill mark is not visible.  Bail out.
             return;
+        }
 
         SCTAB nTab = pViewData->GetTabNo();
         ScDocument* pDoc = pViewData->GetDocument();
@@ -6212,8 +6233,11 @@ void ScGridWindow::UpdateAutoFillOverlay()
 
         // #i70788# get the OverlayManager safely
         rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
-
-        if (xOverlayManager.is() && !comphelper::LibreOfficeKit::isActive())
+        if (comphelper::LibreOfficeKit::isActive()) // notify the LibreOfficeKit
+        {
+            updateLibreOfficeKitAutoFill(pViewData, aFillRect);
+        }
+        else if (xOverlayManager.is())
         {
             Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
             if (pViewData->GetActivePart() != eWhich)


More information about the Libreoffice-commits mailing list