Kaydet (Commit) d849231d authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

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/37241Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst 7f2d6d84
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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());
}
}
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment