include/sfx2/lokhelper.hxx | 2 -- sc/source/ui/inc/tabvwsh.hxx | 2 ++ sc/source/ui/undo/undoblk.cxx | 14 ++++++++++++++ sc/source/ui/undo/undoblk2.cxx | 10 +++++++++- sc/source/ui/view/tabvwshc.cxx | 17 +++++++++++++++++ sc/source/ui/view/viewfunc.cxx | 24 +++++++++++++++--------- sfx2/source/view/lokhelper.cxx | 11 ----------- 7 files changed, 57 insertions(+), 23 deletions(-)
New commits: commit e4168d69d7edfdf3d59a82de80f89d29aefae268 Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Wed May 3 17:22:27 2017 +0200 lok: sc: invalidate col/row header on undo row/col operations Change-Id: Ifabce9941541a615840163168af6fedaf54575cd Reviewed-on: https://gerrit.libreoffice.org/37256 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 6d0466dd1dd3..d79fd8335c0c 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -23,6 +23,8 @@ #include <editeng/boxitem.hxx> #include <editeng/justifyitem.hxx> #include <sfx2/app.hxx> +#include <comphelper/lok.hxx> +#include <sfx2/lokhelper.hxx> #include "undoblk.hxx" #include "undoutil.hxx" @@ -257,7 +259,19 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) } pDocShell->PostDataChanged(); if (pViewShell) + { pViewShell->CellContentChanged(); + + if (comphelper::LibreOfficeKit::isActive()) + { + if (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT) + ScTabViewShell::notifyAllViewsHeaderInvalidation("column", pViewShell->GetViewData().GetTabNo()); + + if (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN) + ScTabViewShell::notifyAllViewsHeaderInvalidation("row", pViewShell->GetViewData().GetTabNo()); + } + + } } void ScUndoInsertCells::Undo() diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx index 50404d5e09fc..cdf75b9f1882 100644 --- a/sc/source/ui/undo/undoblk2.cxx +++ b/sc/source/ui/undo/undoblk2.cxx @@ -30,6 +30,8 @@ #include "undoolk.hxx" +#include <comphelper/lok.hxx> +#include <sfx2/lokhelper.hxx> /** Change column widths or row heights */ ScUndoWidthOrHeight::ScUndoWidthOrHeight( ScDocShell* pNewDocShell, @@ -94,6 +96,7 @@ void ScUndoWidthOrHeight::Undo() if (pUndoTab) // Outlines are included when saving ? rDoc.SetOutlineTable( nStartTab, pUndoTab ); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); SCTAB nTabCount = rDoc.GetTableCount(); ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) @@ -117,7 +120,6 @@ void ScUndoWidthOrHeight::Undo() DoSdrUndoAction( pDrawUndo, &rDoc ); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { pViewShell->UpdateScrollBars(); @@ -125,6 +127,12 @@ void ScUndoWidthOrHeight::Undo() SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo(); if ( nCurrentTab < nStartTab || nCurrentTab > nEndTab ) pViewShell->SetTabNo( nStartTab ); + + if (comphelper::LibreOfficeKit::isActive()) + { + OString aPayload = bWidth ? "column" : "row"; + ScTabViewShell::notifyAllViewsHeaderInvalidation(aPayload, pViewShell->GetViewData().GetTabNo()); + } } EndUndo(); commit 8deb22a2cee0a931b98c359246535c9d52678f99 Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Tue May 2 10:20:11 2017 +0200 lok: sc: make row/col header updating, on row/col operations, tab-aware Now, on inserting/removing or resizing a row/col, the row/col header invalidation callback is notified to another view only if it is displaying the same tab of the view where the row/col operation is occurring. Change-Id: Ic65fd82b2e3009420c7b481e7e8c1ff8bb11bcce diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 4f7b45065fd5..f76977e6b25d 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -42,8 +42,6 @@ public: static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell* pOtherView, int nType, const OString& rKey, const OString& rPayload); /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed. static void notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload); - /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views. - static void notifyAllViewsHeaderInvalidation(const OString& rPayload); /// A special value to signify 'infinity'. /// This value is chosen such that sal_Int32 will not overflow when manipulated. static const long MaxTwips = 1e9; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index eb759055817d..cf60eb656d46 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -396,6 +396,8 @@ public: void afterCallbackRegistered() override; /// See SfxViewShell::NotifyCursor(). void NotifyCursor(SfxViewShell* pViewShell) const override; + /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex + static void notifyAllViewsHeaderInvalidation(const OString& rPayload, SCTAB nCurrentTabIndex = -1); }; #endif diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index a9e35896ca6e..287947424165 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -79,6 +79,9 @@ #include <config_orcus.h> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <sfx2/lokhelper.hxx> + void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew ) { // CurRefDlgId is stored in ScModule to find if a ref dialog is open, @@ -548,6 +551,20 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* pOtherShell) const pWin->updateLibreOfficeKitCellCursor(pOtherShell); } +void ScTabViewShell::notifyAllViewsHeaderInvalidation(const OString& rPayload, SCTAB nCurrentTabIndex) +{ + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell); + if (pTabViewShell && (nCurrentTabIndex == -1 || pTabViewShell->getPart() == nCurrentTabIndex)) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, rPayload.getStr()); + } + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList) { bool bSubTotal = false; diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index e1f02513ec9b..939c577a26d8 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1541,11 +1541,14 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, aOperation); } - if (bInsertCols) - SfxLokHelper::notifyAllViewsHeaderInvalidation("column"); + if (comphelper::LibreOfficeKit::isActive()) + { + if (bInsertCols) + ScTabViewShell::notifyAllViewsHeaderInvalidation("column", GetViewData().GetTabNo()); - if (bInsertRows) - SfxLokHelper::notifyAllViewsHeaderInvalidation("row"); + if (bInsertRows) + ScTabViewShell::notifyAllViewsHeaderInvalidation("row", GetViewData().GetTabNo()); + } } return bSuccess; } @@ -1677,11 +1680,14 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd ) nCurY = aRange.aStart.Row(); SetCursor( nCurX, nCurY ); - if (eCmd == DEL_DELCOLS) - SfxLokHelper::notifyAllViewsHeaderInvalidation("column"); + if (comphelper::LibreOfficeKit::isActive()) + { + if (eCmd == DEL_DELCOLS) + ScTabViewShell::notifyAllViewsHeaderInvalidation("column", GetViewData().GetTabNo()); - if (eCmd == DEL_DELROWS) - SfxLokHelper::notifyAllViewsHeaderInvalidation("row"); + if (eCmd == DEL_DELROWS) + ScTabViewShell::notifyAllViewsHeaderInvalidation("row", GetViewData().GetTabNo()); + } } else { @@ -2296,7 +2302,7 @@ void ScViewFunc::SetWidthOrHeight( if (comphelper::LibreOfficeKit::isActive()) { OString aPayload = bWidth ? "column" : "row"; - SfxLokHelper::notifyAllViewsHeaderInvalidation(aPayload); + ScTabViewShell::notifyAllViewsHeaderInvalidation(aPayload, GetViewData().GetTabNo()); } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 736952757ecb..bfcd000eba01 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -142,15 +142,4 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell* pThisView, const OString& rP pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aPayload.getStr()); } -void SfxLokHelper::notifyAllViewsHeaderInvalidation(const OString& rPayload) -{ - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, rPayload.getStr()); - - pViewShell = SfxViewShell::GetNext(*pViewShell); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits