[Libreoffice-commits] core.git: include/vcl sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Tue Apr 3 19:39:42 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 1dc8aac6eeb8e97964bbe5af90ec81158afd048c
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/50893
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 0b6b52373316..46ad7677e910 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -127,7 +127,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 VclEventId::WindowMouseMove:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 803e09809a33..ccb3ed287f8c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1040,6 +1040,10 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
     aPos.AdjustY( 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));
     mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, ScFilterBoxMode::DataSelect));
     // Fix for bug fdo#44925
@@ -1785,12 +1789,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)
 
@@ -2131,6 +2184,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;
     }
 
@@ -2223,52 +2282,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 cd20ed0c493f..a6e7b484045d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1525,6 +1525,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();
@@ -1670,6 +1672,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