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

Marco Cecchetti marco.cecchetti at collabora.com
Tue Mar 20 16:40:21 UTC 2018


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

New commits:
commit d8a2736635f7e4d19c4c6bf68aefa9d825b407bd
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Mar 19 18:53:04 2018 +0100

    lok - sc: validity list drop down button callback
    
    Change-Id: Iaedc7f15147ea7f09e71877b592f932e3ecb37d5
    Reviewed-on: https://gerrit.libreoffice.org/51609
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index ccbc3b96b065..d1ac3b3d40db 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -568,6 +568,16 @@ typedef enum
      * - "close" - window is closed
      */
     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,
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 9830834a4bbd..edd5215f32ee 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -448,6 +448,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 e8eaad8e9403..0b5a3e310d8b 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4762,6 +4762,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;
@@ -4775,7 +4785,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 )
@@ -4783,7 +4800,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 ) ) );
+            }
         }
     }
 }
@@ -5827,9 +5851,16 @@ void ScGridWindow::updateLibreOfficeKitCellCursor(SfxViewShell* pOtherShell) con
     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 10b5bcca8b76..3ab531e6040e 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1551,8 +1551,6 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
 
 void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev)
 {
-    bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
-
     aComboButton.SetOutputDevice( pContentDev );
 
     ScDocument* pDoc = pViewData->GetDocument();
@@ -1687,7 +1685,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 )
         {
             Rectangle aRect = GetListValButtonRect( aListValPos );
             aComboButton.SetPosPixel( aRect.TopLeft() );
@@ -1698,45 +1696,6 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
             aComboButton.SetPosPixel( aOldPos );    // restore old state
             aComboButton.SetSizePixel( aOldSize );  // for MouseUp/Down (AutoFilter)
         }
-
-        if (bIsTiledRendering)
-        {
-            ScTabViewShell* pThisViewShell = pViewData->GetViewShell();
-            SfxViewShell* pViewShell = SfxViewShell::GetFirst();
-
-            while (pViewShell)
-            {
-                if (pViewShell != pThisViewShell)
-                {
-                    ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
-                    if (pTabViewShell)
-                    {
-                        ScViewData& rOtherViewData = pTabViewShell->GetViewData();
-                        ScGridWindow* pOtherWin = rOtherViewData.GetActiveWin();
-                        if (pOtherWin)
-                        {
-                            bool bOtherListValButton = pOtherWin->bListValButton;
-                            ScAddress aOtherListValPos = pOtherWin->aListValPos;
-
-                            if ( bOtherListValButton && pRowInfo[nArrY].nRowNo == aOtherListValPos.Row() && pRowInfo[nArrY].bChanged )
-                            {
-                                Rectangle aRect = GetListValButtonRect( aOtherListValPos );
-                                aComboButton.SetPosPixel( aRect.TopLeft() );
-                                aComboButton.SetSizePixel( aRect.GetSize() );
-                                pContentDev->SetClipRegion(vcl::Region(aRect));
-                                aComboButton.Draw();
-                                pContentDev->SetClipRegion();           // always called from Draw() without clip region
-                                aComboButton.SetPosPixel( aOldPos );    // restore old state
-                                aComboButton.SetSizePixel( aOldSize );  // for MouseUp/Down (AutoFilter)
-                            }
-
-                        }
-                    }
-                }
-
-                pViewShell = SfxViewShell::GetNext(*pViewShell);
-            }
-        }
     }
 
     pQueryParam.reset();


More information about the Libreoffice-commits mailing list