summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-24 09:36:00 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-02-24 10:19:36 +0000
commit30847af56329975a8b6afc5c59991aae8f868d2e (patch)
treed7a03c4bee2062c9e8bd0941c071fba67378f0e9 /sfx2
parent48e83f7be240cd0af5b9f1ee5b87c4d9376c102e (diff)
don't have to create SfxApplication if it doesn't already exist
Change-Id: I3ade4e2c2513f334217a85c676ada93c5ed683ff
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 43e0c1f5f8bf..73e29f3994e8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -37,8 +37,12 @@ int SfxLokHelper::createView()
void SfxLokHelper::destroyView(int nId)
{
+ SfxApplication* pApp = SfxApplication::Get();
+ if (!pApp)
+ return;
+
unsigned nViewShellId = nId;
- SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+ SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
for (SfxViewShell* pViewShell : rViewArr)
{
@@ -54,8 +58,12 @@ void SfxLokHelper::destroyView(int nId)
void SfxLokHelper::setView(int nId)
{
+ SfxApplication* pApp = SfxApplication::Get();
+ if (!pApp)
+ return;
+
unsigned nViewShellId = nId;
- SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+ SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
for (SfxViewShell* pViewShell : rViewArr)
{
@@ -90,13 +98,17 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
std::size_t SfxLokHelper::getViewsCount()
{
- SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
- return rViewArr.size();
+ SfxApplication* pApp = SfxApplication::Get();
+ return !pApp ? 0 : pApp->GetViewShells_Impl().size();
}
bool SfxLokHelper::getViewIds(int* pArray, size_t nSize)
{
- SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
+ SfxApplication* pApp = SfxApplication::Get();
+ if (!pApp)
+ return false;
+
+ SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
if (rViewArr.size() > nSize)
return false;