summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-31 08:29:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-12 08:24:04 +0200
commit51c879d8649c7aad7a0c9be0c7ea042d041254d8 (patch)
treed454d885be767ba7d113547b1fa91ee85cabcf6a /sfx2/source
parentaf66cd6e0809982d61b962fbcf2042981084f770 (diff)
simplify calls to *DialogFactory::Create methods
we don't need to check for nullptr here, it's never null. Change-Id: I3cc5337a8f4dec6747821679e39ccba3cec20f56 Reviewed-on: https://gerrit.libreoffice.org/55114 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/app.cxx27
-rw-r--r--sfx2/source/appl/appserv.cxx93
-rw-r--r--sfx2/source/dialog/tabdlg.cxx8
-rw-r--r--sfx2/source/doc/iframe.cxx3
-rw-r--r--sfx2/source/doc/objmisc.cxx11
5 files changed, 57 insertions, 85 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 721b5e9e3734..aa3b29329cef 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -496,27 +496,24 @@ SfxApplication::ChooseScript()
#if HAVE_FEATURE_SCRIPTING
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- SAL_INFO( "sfx.appl", "create selector dialog");
+ SAL_INFO( "sfx.appl", "create selector dialog");
- const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
- uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() );
+ const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
+ uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() );
- ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(
- pFact->CreateScriptSelectorDialog( nullptr, xFrame ));
+ ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(
+ pFact->CreateScriptSelectorDialog( nullptr, xFrame ));
- SAL_INFO( "sfx.appl", "done, now exec it");
+ SAL_INFO( "sfx.appl", "done, now exec it");
- sal_uInt16 nRet = pDlg->Execute();
+ sal_uInt16 nRet = pDlg->Execute();
- SAL_INFO( "sfx.appl", "has returned");
+ SAL_INFO( "sfx.appl", "has returned");
- if ( nRet == RET_OK )
- {
- aScriptURL = pDlg->GetScriptURL();
- }
+ if ( nRet == RET_OK )
+ {
+ aScriptURL = pDlg->GetScriptURL();
}
#endif
return aScriptURL;
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 60cd0ddb28ee..519bcf1d89f5 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -445,31 +445,25 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
SfxAbstractDialogFactory* pFact =
SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG);
+ const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG);
- SfxItemSet aSet(
- GetPool(), svl::Items<SID_CONFIG, SID_CONFIG>{} );
+ SfxItemSet aSet(
+ GetPool(), svl::Items<SID_CONFIG, SID_CONFIG>{} );
- if ( pStringItem )
- {
- aSet.Put( SfxStringItem(
- SID_CONFIG, pStringItem->GetValue() ) );
- }
+ if ( pStringItem )
+ {
+ aSet.Put( SfxStringItem(
+ SID_CONFIG, pStringItem->GetValue() ) );
+ }
- Reference <XFrame> xFrame(GetRequestFrame(rReq));
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCustomizeTabDialog(
- &aSet, xFrame ));
+ Reference <XFrame> xFrame(GetRequestFrame(rReq));
+ ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCustomizeTabDialog(
+ &aSet, xFrame ));
- if ( pDlg )
- {
- const short nRet = pDlg->Execute();
+ const short nRet = pDlg->Execute();
- if ( nRet )
- bDone = true;
- }
- }
+ if ( nRet )
+ bDone = true;
break;
}
@@ -642,12 +636,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_ABOUT:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_ABOUT ));
- pDlg->Execute();
- bDone = true;
- }
+ ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_ABOUT ));
+ pDlg->Execute();
+ bDone = true;
break;
}
@@ -1350,24 +1341,21 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
sPageURL = pURLItem->GetValue();
Reference <XFrame> xFrame(GetRequestFrame(rReq));
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
+ VclPtr<VclAbstractDialog> pDlg =
+ pFact->CreateFrameDialog(rReq.GetFrameWindow(), xFrame, rReq.GetSlot(), sPageURL );
+ short nRet = pDlg->Execute();
+ pDlg.disposeAndClear();
+ SfxViewFrame* pView = SfxViewFrame::GetFirst();
+ while ( pView )
{
- VclPtr<VclAbstractDialog> pDlg =
- pFact->CreateFrameDialog(rReq.GetFrameWindow(), xFrame, rReq.GetSlot(), sPageURL );
- short nRet = pDlg->Execute();
- pDlg.disposeAndClear();
- SfxViewFrame* pView = SfxViewFrame::GetFirst();
- while ( pView )
+ if (nRet == RET_OK)
{
- if (nRet == RET_OK)
- {
- SfxObjectShell* pObjSh = pView->GetObjectShell();
- if (pObjSh)
- pObjSh->SetConfigOptionsChecked(false);
- }
- pView->GetBindings().InvalidateAll(false);
- pView = SfxViewFrame::GetNext( *pView );
+ SfxObjectShell* pObjSh = pView->GetObjectShell();
+ if (pObjSh)
+ pObjSh->SetConfigOptionsChecked(false);
}
+ pView->GetBindings().InvalidateAll(false);
+ pView = SfxViewFrame::GetNext( *pView );
}
break;
}
@@ -1608,19 +1596,16 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
case SID_AUTO_CORRECT_DLG:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- SfxItemSet aSet(GetPool(), svl::Items<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG>{});
- const SfxPoolItem* pItem=nullptr;
- const SfxItemSet* pSet = rReq.GetArgs();
- SfxItemPool* pSetPool = pSet ? pSet->GetPool() : nullptr;
- if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), false, &pItem ) == SfxItemState::SET )
- aSet.Put( *pItem );
-
- const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame? &pViewFrame->GetWindow(): nullptr, &aSet));
- pDlg->Execute();
- }
+ SfxItemSet aSet(GetPool(), svl::Items<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG>{});
+ const SfxPoolItem* pItem=nullptr;
+ const SfxItemSet* pSet = rReq.GetArgs();
+ SfxItemPool* pSetPool = pSet ? pSet->GetPool() : nullptr;
+ if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), false, &pItem ) == SfxItemState::SET )
+ aSet.Put( *pItem );
+
+ const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame? &pViewFrame->GetWindow(): nullptr, &aSet));
+ pDlg->Execute();
break;
}
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 93c90965a9ca..fcbc22b46783 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -81,11 +81,8 @@ struct Data_Impl
if ( !fnCreatePage )
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
- fnGetRanges = pFact->GetTabPageRangesFunc( nId );
- }
+ fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ fnGetRanges = pFact->GetTabPageRangesFunc( nId );
}
}
};
@@ -667,7 +664,6 @@ sal_uInt16 SfxTabDialog::AddTabPage
)
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- assert(pFact);
CreateTabPage pCreateFunc = pFact->GetTabPageCreatorFunc(nPageCreateId);
assert(pCreateFunc);
GetTabPageRanges pRangesFunc = pFact->GetTabPageRangesFunc(nPageCreateId);
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 7d7fdb02ad98..363b0e266c4c 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -395,8 +395,7 @@ void SAL_CALL IFrameObject::removeVetoableChangeListener(const OUString&, const
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
//we really should set a parent here
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateEditObjectDialog(nullptr, ".uno:InsertObjectFloatingFrame", mxObj));
- if ( pDlg )
- pDlg->Execute();
+ pDlg->Execute();
return 0;
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 8bee369851ec..01064386a81f 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1402,14 +1402,9 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
if ( bCaughtException && bRaiseError )
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if ( pFact )
- {
- ScopedVclPtr<VclAbstractDialog> pScriptErrDlg( pFact->CreateScriptErrorDialog( aException ) );
- OSL_ENSURE( pScriptErrDlg.get(), "SfxObjectShell::CallXScript: no script error dialog!" );
-
- if ( pScriptErrDlg.get() )
- pScriptErrDlg->Execute();
- }
+ ScopedVclPtr<VclAbstractDialog> pScriptErrDlg( pFact->CreateScriptErrorDialog( aException ) );
+ if ( pScriptErrDlg.get() )
+ pScriptErrDlg->Execute();
}
SAL_INFO("sfx", "leaving CallXScript" );