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

New commits:
commit e277f5d22943624448465e6c04f0fbabcb751c6f
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Tue Mar 13 21:39:26 2018 +0100

    lok - sc: set a min width for valid list window
    
    Change-Id: If22dbc9f0f0512d4b05e9b16c8c6414af33fb9d4
    Reviewed-on: https://gerrit.libreoffice.org/51594
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcek...@gmail.com>
    (cherry picked from commit faf24b27a731147518390bf88efccb251a911117)
    Reviewed-on: https://gerrit.libreoffice.org/53009
    Tested-by: Marco Cecchetti <mrcek...@gmail.com>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0bd73358e931..4df3462c9431 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1079,6 +1079,11 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, 
SCROW nRow )
         //  Adjust position and size to Window
         //! Check first if the entries fit (width)
 
+        // minimum width in pixel
+        const long nMinLOKWinWidth = static_cast<long>(1.3 * STD_COL_WIDTH * 
pViewData->GetPPTX());
+        if (comphelper::LibreOfficeKit::isActive() && nSizeX < nMinLOKWinWidth)
+            nSizeX = nMinLOKWinWidth;
+
         Size aParentSize = GetParent()->GetOutputSizePixel();
         Size aSize( nSizeX, nHeight );
 
commit 9721a7fe0f2d0310612a7b0a1ddbaf843131e66e
Author: Marco Cecchetti <marco.cecche...@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 <c...@libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcek...@gmail.com>
    (cherry picked from commit 1dc8aac6eeb8e97964bbe5af90ec81158afd048c)
    Reviewed-on: https://gerrit.libreoffice.org/53008
    Tested-by: Marco Cecchetti <mrcek...@gmail.com>

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index e25cdd67506a..7221f19bac48 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 495f3e6bd6fe..0bd73358e931 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.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));
     mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), 
this, nCol, nRow, ScFilterBoxMode::DataSelect));
     // Fix for bug fdo#44925
@@ -1788,12 +1792,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)
 
@@ -2134,6 +2187,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;
     }
 
@@ -2226,52 +2285,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 cc32b5ae53ba..b191fa90feb6 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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to