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

Marco Cecchetti marco.cecchetti at collabora.com
Mon Apr 16 22:01:44 UTC 2018


 include/LibreOfficeKit/LibreOfficeKitEnums.h |   11 +++++++-
 sc/source/ui/inc/gridwin.hxx                 |    2 +
 sc/source/ui/view/gridwin.cxx                |   35 +++++++++++++++++++++++++--
 sc/source/ui/view/gridwin4.cxx               |    2 -
 4 files changed, 46 insertions(+), 4 deletions(-)

New commits:
commit 4710bbfbab56b24c35cbb15652fb1793176629a4
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Tue Apr 3 16:49:08 2018 +0200

    lok - sc: validity list drop down button callback
    
    Change-Id: Iaedc7f15147ea7f09e71877b592f932e3ecb37d5
    Reviewed-on: https://gerrit.libreoffice.org/51596
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    (cherry picked from commit 00d5cbf5f2a47c1614891c071b35f4a9e0b54354)
    Reviewed-on: https://gerrit.libreoffice.org/53007
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 691018277e25..0c223463fdb8 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -570,6 +570,15 @@ typedef enum
     LOK_CALLBACK_WINDOW = 36,
 
     /**
+     * When for the current cell is defined a validity list we need to show
+     * a drop down button in the form of a marker.
+     *
+     * The payload format is: "x, y, visible" where x, y are the current
+     * cell cursor coordinates and visible is set to 0 or 1.
+     */
+    LOK_CALLBACK_VALIDITY_LIST_BUTTON = 37,
+
+    /**
      * Notification that the clipboard contents have changed.
      * Typically fired in response to copying to clipboard.
      *
@@ -578,7 +587,7 @@ typedef enum
      * in the future the contents might be included for
      * convenience.
      */
-    LOK_CALLBACK_CLIPBOARD_CHANGED = 37,
+    LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 5190385de016..e8a564d0737b 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -447,6 +447,8 @@ public:
     ScViewData* getViewData();
     virtual FactoryFunction GetUITestFactory() const override;
 
+    void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
+
 protected:
     void ImpCreateOverlayObjects();
     void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 386e7388cb89..495f3e6bd6fe 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4555,6 +4555,16 @@ void ScGridWindow::UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange)
     }
 }
 
+void ScGridWindow::updateLOKValListButton( bool bVisible, const ScAddress& rPos ) const
+{
+    SCCOL nX = rPos.Col();
+    SCROW nY = rPos.Row();
+    std::stringstream ss;
+    ss << nX << ", " << nY << ", " << static_cast<unsigned int>(bVisible);
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_LIST_BUTTON, ss.str().c_str());
+}
+
 void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
 {
     bool bOldButton = bListValButton;
@@ -4568,7 +4578,14 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
         if ( !bOldButton || aListValPos != aOldPos )
         {
             // paint area of new button
-            Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+            if ( comphelper::LibreOfficeKit::isActive() )
+            {
+                updateLOKValListButton( true, aListValPos );
+            }
+            else
+            {
+                Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+            }
         }
     }
     if ( bOldButton )
@@ -4576,7 +4593,14 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
         if ( !bListValButton || aListValPos != aOldPos )
         {
             // paint area of old button
-            Invalidate( PixelToLogic( GetListValButtonRect( aOldPos ) ) );
+            if ( comphelper::LibreOfficeKit::isActive() )
+            {
+                updateLOKValListButton( false, aOldPos );
+            }
+            else
+            {
+                Invalidate( PixelToLogic( GetListValButtonRect( aOldPos ) ) );
+            }
         }
     }
 }
@@ -5615,9 +5639,16 @@ void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShel
     if (pOtherShell)
     {
         if (pOtherShell == pViewShell)
+        {
             pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
+
+            if (bListValButton && aListValPos == pViewData->GetCurPos())
+                updateLOKValListButton(true, aListValPos);
+        }
         else
+        {
             SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+        }
     }
     else
     {
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 955c7d13783c..cc32b5ae53ba 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1659,7 +1659,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
             }
         }
 
-        if ( bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
+        if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
         {
             tools::Rectangle aRect = GetListValButtonRect( aListValPos );
             aComboButton.SetPosPixel( aRect.TopLeft() );


More information about the Libreoffice-commits mailing list