summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-07-25 14:04:35 +0200
committerEike Rathke <erack@redhat.com>2018-07-25 23:10:02 +0200
commit167c3f9d94e503d99fbdcbf59bae47766cd239f3 (patch)
tree52fcd200de840c0df9bb454beb201b0888d8a72a
parent81f06a142d3228a97341d0728d2aff761b5fd5a2 (diff)
Related: tdf#118867 refresh AutoFilter buttons when deleting cols/rows/cells
Also in ScUndoDeleteCells::Undo()/Redo() Change-Id: I203e447e8d1bcbad48658c26c98a1558e0d4881a Reviewed-on: https://gerrit.libreoffice.org/57989 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/ui/docshell/docfunc.cxx17
-rw-r--r--sc/source/ui/undo/undoblk.cxx25
2 files changed, 36 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index cda63a35e1e1..7edfa22b517d 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2613,15 +2613,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if( bDeletingMerge )
rDocShell.GetUndoManager()->LeaveListAction();
+ if ( eCmd==DelCellCmd::Cols || eCmd==DelCellCmd::CellsLeft )
+ nMergeTestEndCol = MAXCOL;
+ if ( eCmd==DelCellCmd::Rows || eCmd==DelCellCmd::CellsUp )
+ nMergeTestEndRow = MAXROW;
if ( bNeedRefresh )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
- if ( eCmd==DelCellCmd::Cols || eCmd==DelCellCmd::CellsLeft )
- nMergeTestEndCol = MAXCOL;
- if ( eCmd==DelCellCmd::Rows || eCmd==DelCellCmd::CellsUp )
- nMergeTestEndRow = MAXROW;
ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
@@ -2640,6 +2640,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDoc.ExtendMerge( aMergedRange, true );
}
}
+ else
+ {
+ itr = aMark.begin();
+ itrEnd = aMark.end();
+ for (; itr != itrEnd && *itr < nTabCount; ++itr)
+ {
+ rDoc.RefreshAutoFilter( nExtendStartCol, nExtendStartRow, nMergeTestEndCol, nMergeTestEndRow, *itr );
+ }
+ }
itr = aMark.begin();
itrEnd = aMark.end();
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index d4f5f03a453c..ac948a31ddc6 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -552,6 +552,20 @@ void ScUndoDeleteCells::Undo()
BeginUndo();
DoChange( true );
EndUndo();
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+
+ // Now that DBData have been restored in ScMoveUndo::EndUndo() via its
+ // pRefUndoDoc we can apply the AutoFilter buttons.
+ // Add one row for cases undoing deletion right above a cut AutoFilter
+ // range so the buttons are removed.
+ SCROW nRefreshEndRow = std::min<SCROW>( aEffRange.aEnd.Row() + 1, MAXROW);
+ for (SCTAB i=0; i < nCount; ++i)
+ {
+ rDoc.RefreshAutoFilter( aEffRange.aStart.Col(), aEffRange.aStart.Row(),
+ aEffRange.aEnd.Col(), nRefreshEndRow, pTabs[i]);
+ }
+
SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
// Selection not until EndUndo
@@ -564,7 +578,6 @@ void ScUndoDeleteCells::Undo()
}
}
- ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
rDoc.SetDrawPageSize(pTabs[i]);
}
@@ -575,13 +588,21 @@ void ScUndoDeleteCells::Redo()
BeginRedo();
DoChange( false);
EndRedo();
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+
+ for (SCTAB i=0; i < nCount; ++i)
+ {
+ rDoc.RefreshAutoFilter( aEffRange.aStart.Col(), aEffRange.aStart.Row(),
+ aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]);
+ }
+
SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->DoneBlockMode(); // current way
- ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
rDoc.SetDrawPageSize(pTabs[i]);
}