summaryrefslogtreecommitdiff
path: root/cui
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 /cui
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 'cui')
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx38
-rw-r--r--cui/source/options/optlingu.cxx30
-rw-r--r--cui/source/options/optpath.cxx79
3 files changed, 65 insertions, 82 deletions
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 6195662e4300..75425a9672df 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -357,38 +357,30 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton, void )
if (m_ppbApproxSettings == pButton)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if (pFact)
+ ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
+ m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ));
+ if (pDlg->Execute() == RET_OK)
{
- ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
- m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ));
- DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" );
- if (pDlg && pDlg->Execute() == RET_OK)
- {
- m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() );
- m_pSearchEngine->SetLevOther( pDlg->GetOther() );
- m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
- m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
- }
+ m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() );
+ m_pSearchEngine->SetLevOther( pDlg->GetOther() );
+ m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
+ m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
}
}
else if (m_pSoundsLikeCJKSettings == pButton)
{
SfxItemSet aSet( SfxGetpApp()->GetPool() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if(pFact)
- {
- ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() ));
- aDlg->Execute();
+ ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() ));
+ aDlg->Execute();
+ TransliterationFlags nFlags = aDlg->GetTransliterationFlags();
+ m_pSearchEngine->SetTransliterationFlags(nFlags);
- TransliterationFlags nFlags = aDlg->GetTransliterationFlags();
- m_pSearchEngine->SetTransliterationFlags(nFlags);
-
- m_pcbCase->Check(m_pSearchEngine->GetCaseSensitive());
- OnCheckBoxToggled( *m_pcbCase );
- m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() );
- OnCheckBoxToggled( *m_pHalfFullFormsCJK );
- }
+ m_pcbCase->Check(m_pSearchEngine->GetCaseSensitive());
+ OnCheckBoxToggled( *m_pcbCase );
+ m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() );
+ OnCheckBoxToggled( *m_pHalfFullFormsCJK );
}
}
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 20018047d8af..6ee8ea97aa67 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1491,22 +1491,19 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void )
else if (m_pLinguDicsNewPB == pBtn)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if(pFact)
+ ScopedVclPtr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog(GetFrameWeld()));
+ uno::Reference< XDictionary > xNewDic;
+ if ( aDlg->Execute() == RET_OK )
+ xNewDic.set( aDlg->GetNewDictionary(), UNO_QUERY );
+ if ( xNewDic.is() )
{
- ScopedVclPtr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog(GetFrameWeld()));
- uno::Reference< XDictionary > xNewDic;
- if ( aDlg->Execute() == RET_OK )
- xNewDic.set( aDlg->GetNewDictionary(), UNO_QUERY );
- if ( xNewDic.is() )
- {
- // add new dics to the end
- sal_Int32 nLen = aDics.getLength();
- aDics.realloc( nLen + 1 );
+ // add new dics to the end
+ sal_Int32 nLen = aDics.getLength();
+ aDics.realloc( nLen + 1 );
- aDics.getArray()[ nLen ] = xNewDic;
+ aDics.getArray()[ nLen ] = xNewDic;
- AddDicBoxEntry( xNewDic, static_cast<sal_uInt16>(nLen) );
- }
+ AddDicBoxEntry( xNewDic, static_cast<sal_uInt16>(nLen) );
}
}
else if (m_pLinguDicsEditPB == pBtn)
@@ -1524,11 +1521,8 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void )
if (xDic.is())
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if(pFact)
- {
- ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName() ));
- aDlg->Execute();
- }
+ ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName() ));
+ aDlg->Execute();
}
}
}
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 2275ce332e6e..7b3ebad23a64 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -555,56 +555,53 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, Button*, void)
if ( IsMultiPath_Impl( nPos ) )
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
- ScopedVclPtr<AbstractSvxMultiPathDialog> pMultiDlg(
- pFact->CreateSvxMultiPathDialog( this ));
+ ScopedVclPtr<AbstractSvxMultiPathDialog> pMultiDlg(
+ pFact->CreateSvxMultiPathDialog( this ));
- OUString sPath( sUser );
- if ( !sPath.isEmpty() )
- sPath += OUStringLiteral1(MULTIPATH_DELIMITER);
- sPath += sWritable;
- pMultiDlg->SetPath( sPath );
+ OUString sPath( sUser );
+ if ( !sPath.isEmpty() )
+ sPath += OUStringLiteral1(MULTIPATH_DELIMITER);
+ sPath += sWritable;
+ pMultiDlg->SetPath( sPath );
- const OUString sPathName = SvTabListBox::GetEntryText( pEntry, 0 );
- const OUString sNewTitle = pImpl->m_sMultiPathDlg.replaceFirst( VAR_ONE, sPathName );
- pMultiDlg->SetTitle( sNewTitle );
+ const OUString sPathName = SvTabListBox::GetEntryText( pEntry, 0 );
+ const OUString sNewTitle = pImpl->m_sMultiPathDlg.replaceFirst( VAR_ONE, sPathName );
+ pMultiDlg->SetTitle( sNewTitle );
- if ( pMultiDlg->Execute() == RET_OK && pEntry )
+ if ( pMultiDlg->Execute() == RET_OK && pEntry )
+ {
+ sUser.clear();
+ sWritable.clear();
+ OUString sFullPath;
+ OUString sNewPath = pMultiDlg->GetPath();
+ if ( !sNewPath.isEmpty() )
{
- sUser.clear();
- sWritable.clear();
- OUString sFullPath;
- OUString sNewPath = pMultiDlg->GetPath();
- if ( !sNewPath.isEmpty() )
+ sal_Int32 nNextPos = 0;
+ for (;;)
{
- sal_Int32 nNextPos = 0;
- for (;;)
+ const OUString sToken(sNewPath.getToken( 0, MULTIPATH_DELIMITER, nNextPos ));
+ if ( nNextPos<0 )
{
- const OUString sToken(sNewPath.getToken( 0, MULTIPATH_DELIMITER, nNextPos ));
- if ( nNextPos<0 )
- {
- // Last token need a different handling
- sWritable = sToken;
- break;
- }
- if ( !sUser.isEmpty() )
- sUser += OUStringLiteral1(MULTIPATH_DELIMITER);
- sUser += sToken;
+ // Last token need a different handling
+ sWritable = sToken;
+ break;
}
- sFullPath = sUser;
- if ( !sFullPath.isEmpty() )
- sFullPath += OUStringLiteral1(MULTIPATH_DELIMITER);
- sFullPath += sWritable;
+ if ( !sUser.isEmpty() )
+ sUser += OUStringLiteral1(MULTIPATH_DELIMITER);
+ sUser += sToken;
}
-
- pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 );
- // save modified flag
- PathUserData_Impl* pPathImpl = static_cast<PathUserData_Impl*>(pEntry->GetUserData());
- pPathImpl->eState = SfxItemState::SET;
- pPathImpl->sUserPath = sUser;
- pPathImpl->sWritablePath = sWritable;
+ sFullPath = sUser;
+ if ( !sFullPath.isEmpty() )
+ sFullPath += OUStringLiteral1(MULTIPATH_DELIMITER);
+ sFullPath += sWritable;
}
+
+ pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 );
+ // save modified flag
+ PathUserData_Impl* pPathImpl = static_cast<PathUserData_Impl*>(pEntry->GetUserData());
+ pPathImpl->eState = SfxItemState::SET;
+ pPathImpl->sUserPath = sUser;
+ pPathImpl->sWritablePath = sWritable;
}
}
else if (pEntry && !bPickFile)