summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-15 17:12:20 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-21 10:40:22 +0200
commit3d32a7536fad8e50e6f5210688b8af1a2e6338f2 (patch)
treeaf793277db3afc9d30e6a98ce5430b38455f2e23 /sfx2
parent0f42ed98b2ca61917c98a3b5f794a80716e589de (diff)
sfx2 lok: handle when SfxViewFrame::Current() returns nullptr
In these two cases no need to call it and dereference the result unconditionally, there are other ways to get the info. Change-Id: Idb5969e909dc2faed97a5a4ac79dfcc1aec8ddcd (cherry picked from commit 85c5a172953ac29d1fcab3f4c2f19fa897074e52)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx17
1 files changed, 2 insertions, 15 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 653dd7f58e17..d027bad47f15 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -38,7 +38,7 @@ int shellToView(SfxViewShell* pViewShell)
int SfxLokHelper::createView()
{
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
pViewFrame->ExecView_Impl(aRequest);
@@ -91,21 +91,8 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
std::size_t SfxLokHelper::getViews()
{
- std::size_t nRet = 0;
-
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (!pViewFrame)
- return nRet;
-
- SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell();
SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
- for (SfxViewShell* i : rViewArr)
- {
- if (i->GetObjectShell() == pObjectShell)
- ++nRet;
- }
-
- return nRet;
+ return rViewArr.size();
}
void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload)