summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2018-03-07 14:09:51 +0100
committerJan Holesovsky <kendy@collabora.com>2018-03-13 17:32:47 +0100
commit983bf5a49297fcef8c45fcf3a95d87a8fc428072 (patch)
tree8cf413f43c13de7150c929f03954a5c5a4800c09 /sc
parent3b05be050d4cadfa37e7e4db052ba2e070d0bbc1 (diff)
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@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/gridwin.cxx108
-rw-r--r--sc/source/ui/view/gridwin4.cxx41
2 files changed, 102 insertions, 47 deletions
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();