[Libreoffice-commits] core.git: include/sfx2 sc/source sfx2/source
Marco Cecchetti
marco.cecchetti at collabora.com
Tue May 16 16:33:34 UTC 2017
include/sfx2/lokhelper.hxx | 2 --
sc/source/ui/inc/tabvwsh.hxx | 2 ++
sc/source/ui/view/tabvwshc.cxx | 17 +++++++++++++++++
sc/source/ui/view/viewfunc.cxx | 24 +++++++++++++++---------
sfx2/source/view/lokhelper.cxx | 11 -----------
5 files changed, 34 insertions(+), 22 deletions(-)
New commits:
commit d849231dd2064ebed96d17bf54286a33954304ab
Author: Marco Cecchetti <marco.cecchetti at 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.
Conflicts:
sc/source/ui/view/tabvwshc.cxx
Change-Id: Ic65fd82b2e3009420c7b481e7e8c1ff8bb11bcce
Reviewed-on: https://gerrit.libreoffice.org/37241
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 4dc088d64d59..669d0f78d226 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 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());
}
}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index caa57c62f783..2420b0903578 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -154,15 +154,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: */
More information about the Libreoffice-commits
mailing list