summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfunc.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-06-02 12:46:51 +0300
committerTor Lillqvist <tml@collabora.com>2020-06-24 14:29:35 +0200
commit984bd2d5e4e1277cab47f8c1053bdf9369b23935 (patch)
tree986c3a846e7310218409533670716aa5b18c42f5 /sc/source/ui/view/viewfunc.cxx
parent13bcb15f359d2c616cc375a160a5474b230a66ab (diff)
tdf#128502: Try to support multiple documents in LibreOfficeKit-using process
The LibreOfficeKit-specific code typically has assumed that all the "views" (SfxViewShell instances) are for the same document, because all LibreOfficeKit-based application processes (including the "kit" processes in Online and the iOS app) so far have only had one document open at a time. It is now possible to pass several document file names on the command line to gtktiledviewer and that is an easy way to demonstrate how badly it still works even with this patch. Introduce a unique numeric document id that is increased in the LibLODocument_Impl constructor. Add APIs to access that. When iterating over views, try to skip views that are not of the document visible in the "current" view, if we know what the "current" view is. Also add a couple of FIXMEs at places where it is a bit unclear (to me) whether it is correct to iterate over all views, or whether only views for the "current" document are what we would want. Change-Id: Id5ebb92a115723cdeb23907163d5b5f282016252 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95353 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97024 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc/source/ui/view/viewfunc.cxx')
-rw-r--r--sc/source/ui/view/viewfunc.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 21d10fcd1726..90a90e92f528 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1472,11 +1472,12 @@ void ScViewFunc::OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset)
return;
SCTAB nCurrentTabIndex = GetViewData().GetTabNo();
+ SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)
{
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
- if (pTabViewShell)
+ if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
{
pTabViewShell->GetViewData().GetLOKWidthHelper(nCurrentTabIndex)->invalidateByIndex(nStartCol);
@@ -1527,11 +1528,12 @@ void ScViewFunc::OnLOKInsertDeleteRow(SCROW nStartRow, long nOffset)
return;
SCTAB nCurrentTabIndex = GetViewData().GetTabNo();
+ SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)
{
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
- if (pTabViewShell)
+ if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
{
pTabViewShell->GetViewData().GetLOKHeightHelper(nCurrentTabIndex)->invalidateByIndex(nStartRow);
@@ -1582,11 +1584,12 @@ void ScViewFunc::OnLOKSetWidthOrHeight(SCCOLROW nStart, bool bWidth)
return;
SCTAB nCurTab = GetViewData().GetTabNo();
+ SfxViewShell* pCurrentViewShell = GetViewData().GetViewShell();
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)
{
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
- if (pTabViewShell)
+ if (pTabViewShell && pTabViewShell->GetDocId() == pCurrentViewShell->GetDocId())
{
if (bWidth)
pTabViewShell->GetViewData().GetLOKWidthHelper(nCurTab)->invalidateByIndex(nStart);
@@ -1627,10 +1630,10 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
if (comphelper::LibreOfficeKit::isActive())
{
if (bInsertCols)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), COLUMN_HEADER, GetViewData().GetTabNo());
if (bInsertRows)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), ROW_HEADER, GetViewData().GetTabNo());
}
}
OUString aStartAddress = aRange.aStart.GetColRowString();
@@ -1705,10 +1708,10 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd )
if (comphelper::LibreOfficeKit::isActive())
{
if (eCmd == DelCellCmd::Cols)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(COLUMN_HEADER, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), COLUMN_HEADER, GetViewData().GetTabNo());
if (eCmd == DelCellCmd::Rows)
- ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo());
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), ROW_HEADER, GetViewData().GetTabNo());
}
}
else