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

Marco Cecchetti marco.cecchetti at collabora.com
Tue Mar 13 16:33:10 UTC 2018


 include/vcl/ITiledRenderable.hxx |    2 
 sc/source/ui/view/gridwin.cxx    |  108 ++++++++++++++++++++++-----------------
 sc/source/ui/view/gridwin4.cxx   |   41 ++++++++++++++
 3 files changed, 103 insertions(+), 48 deletions(-)

New commits:
commit 983bf5a49297fcef8c45fcf3a95d87a8fc428072
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Wed Mar 7 14:09:51 2018 +0100

    lok - sc - list validation
    
    This provide the correct invalidation and drawing of the combo box
    control which is used for cell where a validation list has been set
    up.
    
    This patch fixes also tunneling issue for the floating window showing
    the list of valid entries.
    
    Change-Id: I9f7277688293eff443504221c7c7e46097a5da4a
    Reviewed-on: https://gerrit.libreoffice.org/51131
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index dd8d950e5dbb..95775be55913 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -124,7 +124,7 @@ public:
             // sometimes MouseButtonDown captures mouse and starts tracking, and VCL
             // will not take care of releasing that with tiled rendering
             if (pLOKEv->mpWindow->IsTracking())
-                pLOKEv->mpWindow->EndTracking(TrackingEventFlags::DontCallHdl);
+                pLOKEv->mpWindow->EndTracking();
 
             break;
         case VCLEVENT_WINDOW_MOUSEMOVE:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0a4c69ceded8..6bf960dcd45e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1095,6 +1095,10 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
     aPos.Y() += nSizeY - 1;
 
     mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER)));
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        mpFilterFloat->SetLOKNotifier(SfxViewShell::Current());
+    }
     mpFilterFloat->SetPopupModeEndHdl(LINK( this, ScGridWindow, PopupModeEndHdl));
     ScFilterBoxMode eFilterMode = SC_FILTERBOX_DATASELECT;
     mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, eFilterMode));
@@ -1979,12 +1983,61 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
     }
 }
 
+void lcl_executeList( ScViewData* pViewData, ScModule* pScMod, ScMarkData& rMark )
+{
+    pViewData->GetView()->SelectionChanged();
+
+    SfxDispatcher* pDisp = pViewData->GetViewShell()->GetDispatcher();
+    bool bFormulaMode = pScMod->IsFormulaMode();
+    OSL_ENSURE( pDisp || bFormulaMode, "Cursor moved on inactive View ?" );
+
+    //  #i14927# execute SID_CURRENTCELL (for macro recording) only if there is no
+    //  multiple selection, so the argument string completely describes the selection,
+    //  and executing the slot won't change the existing selection (executing the slot
+    //  here and from a recorded macro is treated equally)
+    if ( pDisp && !bFormulaMode && !rMark.IsMultiMarked() )
+    {
+        OUString aAddr;                               // CurrentCell
+        if( rMark.IsMarked() )
+        {
+            ScRange aScRange;
+            rMark.GetMarkArea( aScRange );
+            aAddr = aScRange.Format(ScRefFlags::RANGE_ABS);
+            if ( aScRange.aStart == aScRange.aEnd )
+            {
+                //  make sure there is a range selection string even for a single cell
+                aAddr = aAddr + ":" + aAddr;
+            }
+
+            //! SID_MARKAREA does not exist anymore ???
+            //! What happens when selecting with the cursor ???
+        }
+        else                                        // only move cursor
+        {
+            ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 0 );
+            aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS);
+        }
+
+        SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
+        // We don't want to align to the cursor position because if the
+        // cell cursor isn't visible after making selection, it would jump
+        // back to the origin of the selection where the cell cursor is.
+        SfxBoolItem aAlignCursorItem( FN_PARAM_2, false );
+        pDisp->ExecuteList(SID_CURRENTCELL,
+                SfxCallMode::SLOT | SfxCallMode::RECORD,
+                { &aPosItem, &aAlignCursorItem });
+
+        pViewData->GetView()->InvalidateAttribs();
+
+    }
+    pViewData->GetViewShell()->SelectionChanged();
+}
+
 void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
 {
     aCurMousePos = rMEvt.GetPosPixel();
     ScDocument* pDoc = pViewData->GetDocument();
     ScMarkData& rMark = pViewData->GetMarkData();
-
     // #i41690# detect a MouseButtonUp call from within MouseButtonDown
     // (possible through Reschedule from storing an OLE object that is deselected)
 
@@ -2325,6 +2378,12 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
                 pTabView->SelectionChanged();
         }
 
+        if ( bIsTiledRendering && rMEvt.IsLeft() && pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) )
+        {
+            lcl_executeList( pViewData, pScMod, rMark);
+            return;
+        }
+
         return;
     }
 
@@ -2417,52 +2476,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
 
     if ( rMEvt.IsLeft() && pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) )
     {
-        pViewData->GetView()->SelectionChanged();
-
-        SfxDispatcher* pDisp = pViewData->GetViewShell()->GetDispatcher();
-        bool bFormulaMode = pScMod->IsFormulaMode();
-        OSL_ENSURE( pDisp || bFormulaMode, "Cursor moved on inactive View ?" );
-
-        //  #i14927# execute SID_CURRENTCELL (for macro recording) only if there is no
-        //  multiple selection, so the argument string completely describes the selection,
-        //  and executing the slot won't change the existing selection (executing the slot
-        //  here and from a recorded macro is treated equally)
-
-        if ( pDisp && !bFormulaMode && !rMark.IsMultiMarked() )
-        {
-            OUString aAddr;                               // CurrentCell
-            if( rMark.IsMarked() )
-            {
-                ScRange aScRange;
-                rMark.GetMarkArea( aScRange );
-                aAddr = aScRange.Format(ScRefFlags::RANGE_ABS);
-                if ( aScRange.aStart == aScRange.aEnd )
-                {
-                    //  make sure there is a range selection string even for a single cell
-                    aAddr = aAddr + ":" + aAddr;
-                }
-
-                //! SID_MARKAREA does not exist anymore ???
-                //! What happens when selecting with the cursor ???
-            }
-            else                                        // only move cursor
-            {
-                ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 0 );
-                aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS);
-            }
-
-            SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
-            // We don't want to align to the cursor position because if the
-            // cell cursor isn't visible after making selection, it would jump
-            // back to the origin of the selection where the cell cursor is.
-            SfxBoolItem aAlignCursorItem( FN_PARAM_2, false );
-            pDisp->ExecuteList(SID_CURRENTCELL,
-                    SfxCallMode::SLOT | SfxCallMode::RECORD,
-                    { &aPosItem, &aAlignCursorItem });
-
-            pViewData->GetView()->InvalidateAttribs();
-        }
-        pViewData->GetViewShell()->SelectionChanged();
+        lcl_executeList( pViewData, pScMod, rMark);
         return;
     }
 }
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f89deb007e0a..5adf5a4bc52a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1551,6 +1551,8 @@ 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();
@@ -1696,6 +1698,45 @@ 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 )
+                            {
+                                tools::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