From 5751291e8cefea4d07b701c51051fc06ce14486e Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Thu, 20 Apr 2017 12:48:59 +0200 Subject: LOK - Calc: changed the way header is updated on row/col insert/remove This patch introduce a new LOK callback for informing the client that the row/col header is no more valid and needs to be updated. Change-Id: I21a3a41d69bd1a3c11c9ffaf1d7d53dbc3b9681d Reviewed-on: https://gerrit.libreoffice.org/36733 Tested-by: Jenkins Reviewed-by: Jan Holesovsky --- sc/source/ui/view/viewfunc.cxx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 7d4720bbbad7..9c3ff1118dbd 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -78,6 +78,7 @@ #include "tokenarray.hxx" #include #include +#include #include @@ -1458,17 +1459,26 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, false, bPartOfPaste ); if (bSuccess) { + bool bInsertCols = ( eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER); + bool bInsertRows = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ); + pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); ResetAutoSpell(); - if ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_INSCOLS_AFTER ) + if ( bInsertCols || bInsertRows ) { - OUString aOperation = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ) ? + OUString aOperation = bInsertRows ? OUString("insert-rows"): OUString("insert-columns"); HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation); } + + if (bInsertCols) + SfxLokHelper::notifyAllViewsHeaderInvalidation("column"); + + if (bInsertRows) + SfxLokHelper::notifyAllViewsHeaderInvalidation("row"); } return bSuccess; } @@ -1535,6 +1545,12 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd ) else nCurY = aRange.aStart.Row(); SetCursor( nCurX, nCurY ); + + if (eCmd == DEL_DELCOLS) + SfxLokHelper::notifyAllViewsHeaderInvalidation("column"); + + if (eCmd == DEL_DELROWS) + SfxLokHelper::notifyAllViewsHeaderInvalidation("row"); } else { @@ -2128,6 +2144,12 @@ void ScViewFunc::SetWidthOrHeight( HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "column-resize"); } } + + if (comphelper::LibreOfficeKit::isActive()) + { + OString aPayload = bWidth ? "column" : "row"; + SfxLokHelper::notifyAllViewsHeaderInvalidation(aPayload); + } } // column width/row height (via marked range) -- cgit