sc/source/ui/undo/undoblk.cxx | 44 ++++++++++++++++++++++++++++++++++++++++- sc/source/ui/undo/undoblk2.cxx | 3 ++ 2 files changed, 46 insertions(+), 1 deletion(-)
New commits: commit c01df160eb45e1f5a386f9ad7cb3da72fc7f278f Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Wed May 3 22:57:09 2017 +0200 lok: sc: invalidate cached position on undo row/col operations Change-Id: I822ecdeda0e7c26c65096e5a249a35f7c2f3a9fe Reviewed-on: https://gerrit.libreoffice.org/37259 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index d79fd8335c0c..6af80db9eb15 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -159,6 +159,7 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) // refresh of merged cells has to be after inserting/deleting + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); switch (eCmd) { case INS_INSROWS_BEFORE: @@ -166,12 +167,19 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) case INS_CELLSDOWN: for( i=0; i<nCount; i++ ) { + if (bUndo) rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i], aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1)); else rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i], aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1)); + + if (pViewShell) + { + const long nSign = bUndo ? -1 : 1; + pViewShell->OnLOKInsertDeleteRow(aEffRange.aStart.Row(), nSign * (aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1)); + } } break; case INS_INSCOLS_BEFORE: @@ -185,6 +193,12 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) else rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i], aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1)); + + if (pViewShell) + { + const long nSign = bUndo ? -1 : 1; + pViewShell->OnLOKInsertDeleteColumn(aEffRange.aStart.Col(), nSign * (aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1)); + } } break; default: @@ -210,7 +224,7 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) // Undo for displaced attributes? PaintPartFlags nPaint = PaintPartFlags::Grid; - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + switch (eCmd) { case INS_INSROWS_BEFORE: @@ -385,6 +399,8 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) else SetChangeTrack(); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + switch (eCmd) { case DEL_DELROWS: @@ -397,6 +413,12 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) else rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i], aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1)); + + if (pViewShell) + { + const long nSign = bUndo ? 1 : -1; + pViewShell->OnLOKInsertDeleteRow(aEffRange.aStart.Row(), nSign * (aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1)); + } } break; case DEL_DELCOLS: @@ -409,6 +431,12 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) else rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i], aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1)); + + if (pViewShell) + { + const long nSign = bUndo ? 1 : -1; + pViewShell->OnLOKInsertDeleteColumn(aEffRange.aStart.Col(), nSign * (aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1)); + } } break; default: @@ -507,6 +535,20 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) pDocShell->PostDataChanged(); // CellContentChanged comes with the selection + + if (pViewShell) + { + if (comphelper::LibreOfficeKit::isActive()) + { + if (eCmd == DEL_DELCOLS || eCmd == DEL_CELLSLEFT) + ScTabViewShell::notifyAllViewsHeaderInvalidation("column", pViewShell->GetViewData().GetTabNo()); + + if (eCmd == DEL_DELROWS || eCmd == DEL_CELLSUP) + ScTabViewShell::notifyAllViewsHeaderInvalidation("row", pViewShell->GetViewData().GetTabNo()); + } + + } + } void ScUndoDeleteCells::Undo() diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx index cdf75b9f1882..8a1247cbca14 100644 --- a/sc/source/ui/undo/undoblk2.cxx +++ b/sc/source/ui/undo/undoblk2.cxx @@ -101,6 +101,9 @@ void ScUndoWidthOrHeight::Undo() ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) { + if (pViewShell) + pViewShell->OnLOKSetWidthOrHeight(nStart, bWidth); + if (bWidth) // Width { pUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart), 0, *itr, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits