summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-22 13:20:49 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-25 12:34:40 +0200
commite9260633df07b6796b19bc92523671cb345597a1 (patch)
tree88ec562b1fc57bf49deabed28166079c5880d53a /sc
parentdb0e7e3715bdef7ad6c1f536e9cf1ea84773fbe8 (diff)
lok: deduplicate code related to notifyDocumentSizeChanged() call
Change-Id: Ia4cef7b23fc682ec32aeb9be4dcdd582464c64e9 co-author: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79498 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document.cxx36
-rw-r--r--sc/source/ui/docshell/docsh3.cxx9
2 files changed, 10 insertions, 35 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 81cdc056daf1..e94d0b4f0db5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -584,13 +584,8 @@ bool ScDocument::InsertTab(
if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
@@ -755,13 +750,8 @@ bool ScDocument::DeleteTab( SCTAB nTab )
if (comphelper::LibreOfficeKit::isActive())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
bValid = true;
@@ -852,13 +842,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
if (comphelper::LibreOfficeKit::isActive())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
bValid = true;
@@ -904,13 +889,8 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc
if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index c9267f436ebe..cf0fecf46fd6 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -172,13 +172,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa
// the document size too - cell size affects that, obviously)
if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}