[Libreoffice-commits] core.git: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jul 25 21:10:26 UTC 2018
sc/source/ui/docshell/docfunc.cxx | 17 +++++++++++++----
sc/source/ui/undo/undoblk.cxx | 25 +++++++++++++++++++++++--
2 files changed, 36 insertions(+), 6 deletions(-)
New commits:
commit 167c3f9d94e503d99fbdcbf59bae47766cd239f3
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Wed Jul 25 14:04:35 2018 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Wed Jul 25 23:10:02 2018 +0200
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 at redhat.com>
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]);
}
More information about the Libreoffice-commits
mailing list