summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-05-02 10:20:11 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2017-05-16 18:32:37 +0200
commitd849231dd2064ebed96d17bf54286a33954304ab (patch)
treeb6141d23263bcd7fc5f1eca36fef129a35d9fbfa /sc
parent7f2d6d8480f06434a1b5bc748ac2f3f80b2e71cb (diff)
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. Conflicts: sc/source/ui/view/tabvwshc.cxx Change-Id: Ic65fd82b2e3009420c7b481e7e8c1ff8bb11bcce Reviewed-on: https://gerrit.libreoffice.org/37241 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/view/tabvwshc.cxx17
-rw-r--r--sc/source/ui/view/viewfunc.cxx24
3 files changed, 34 insertions, 9 deletions
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index c08e4ee2a08f..e138c35aca4c 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -394,6 +394,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 20d02dd9a1ea..7cbcaed65b9b 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -77,6 +77,9 @@
#include "PivotLayoutDialog.hxx"
+#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,
@@ -543,6 +546,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 f6a3c1084ffb..c0d8d028eb3d 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1478,11 +1478,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;
}
@@ -1550,11 +1553,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
{
@@ -2152,7 +2158,7 @@ void ScViewFunc::SetWidthOrHeight(
if (comphelper::LibreOfficeKit::isActive())
{
OString aPayload = bWidth ? "column" : "row";
- SfxLokHelper::notifyAllViewsHeaderInvalidation(aPayload);
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(aPayload, GetViewData().GetTabNo());
}
}