summaryrefslogtreecommitdiff
path: root/framework/source/uielement/thesaurusmenucontroller.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 20:32:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-08 11:01:31 +0200
commitff25a4a6f4b9763b09abbbd6a711fa4d18f40ade (patch)
treeded29238e8fb782c20b429f6d5df6c40a3bb2604 /framework/source/uielement/thesaurusmenucontroller.cxx
parent32343bcbb786168df62f85a57e30c620c3d3bdb4 (diff)
loplugin:flatten in framework
Change-Id: I2a74a7543b5edd853396efa31a3e2568e6607778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/uielement/thesaurusmenucontroller.cxx')
-rw-r--r--framework/source/uielement/thesaurusmenucontroller.cxx82
1 files changed, 41 insertions, 41 deletions
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index 8cc84c1bdf3b..492da8593ac2 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -84,61 +84,61 @@ void ThesaurusMenuController::fillPopupMenu()
VCLXMenu* pAwtMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu );
Menu* pVCLMenu = pAwtMenu->GetMenu();
pVCLMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics );
- if ( !aSynonyms.empty() )
- {
- SvtLinguConfig aCfg;
- Image aImage;
- OUString aThesImplName( getThesImplName( aLocale ) );
- OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( aThesImplName ) );
- if ( !aThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty() )
- aImage = Image( aSynonymsImageUrl );
-
- sal_uInt16 nId = 1;
- for ( const auto& aSynonym : aSynonyms )
- {
- OUString aItemText( linguistic::GetThesaurusReplaceText( aSynonym ) );
- pVCLMenu->InsertItem( nId, aItemText );
- pVCLMenu->SetItemCommand( nId, ".uno:ThesaurusFromContext?WordReplace:string=" + aItemText );
+ if ( aSynonyms.empty() )
+ return;
- if ( !aSynonymsImageUrl.isEmpty() )
- pVCLMenu->SetItemImage( nId, aImage );
- nId++;
- }
+ SvtLinguConfig aCfg;
+ Image aImage;
+ OUString aThesImplName( getThesImplName( aLocale ) );
+ OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( aThesImplName ) );
+ if ( !aThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty() )
+ aImage = Image( aSynonymsImageUrl );
- pVCLMenu->InsertSeparator();
- OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aThesaurusDialogCmd, m_aModuleName);
- pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
- pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
+ sal_uInt16 nId = 1;
+ for ( const auto& aSynonym : aSynonyms )
+ {
+ OUString aItemText( linguistic::GetThesaurusReplaceText( aSynonym ) );
+ pVCLMenu->InsertItem( nId, aItemText );
+ pVCLMenu->SetItemCommand( nId, ".uno:ThesaurusFromContext?WordReplace:string=" + aItemText );
+
+ if ( !aSynonymsImageUrl.isEmpty() )
+ pVCLMenu->SetItemImage( nId, aImage );
+ nId++;
}
+
+ pVCLMenu->InsertSeparator();
+ OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aThesaurusDialogCmd, m_aModuleName);
+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
+ pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
}
void ThesaurusMenuController::getMeanings( std::vector< OUString >& rSynonyms, const OUString& rWord,
const css::lang::Locale& rLocale, size_t nMaxSynonms )
{
rSynonyms.clear();
- if ( m_xThesaurus.is() && m_xThesaurus->hasLocale( rLocale ) && !rWord.isEmpty() && nMaxSynonms > 0 )
+ if ( !(m_xThesaurus.is() && m_xThesaurus->hasLocale( rLocale ) && !rWord.isEmpty() && nMaxSynonms > 0) )
+ return;
+
+ try
{
- try
- {
- const css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > aMeaningSeq(
- m_xThesaurus->queryMeanings( rWord, rLocale, css::uno::Sequence< css::beans::PropertyValue >() ) );
+ const css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > aMeaningSeq(
+ m_xThesaurus->queryMeanings( rWord, rLocale, css::uno::Sequence< css::beans::PropertyValue >() ) );
- for ( const auto& xMeaning : aMeaningSeq )
+ for ( const auto& xMeaning : aMeaningSeq )
+ {
+ const css::uno::Sequence< OUString > aSynonymSeq( xMeaning->querySynonyms() );
+ for ( const auto& aSynonym : aSynonymSeq )
{
- const css::uno::Sequence< OUString > aSynonymSeq( xMeaning->querySynonyms() );
- for ( const auto& aSynonym : aSynonymSeq )
- {
- rSynonyms.push_back( aSynonym );
- if ( rSynonyms.size() == nMaxSynonms )
- return;
- }
+ rSynonyms.push_back( aSynonym );
+ if ( rSynonyms.size() == nMaxSynonms )
+ return;
}
}
- catch ( const css::uno::Exception& )
- {
- SAL_WARN( "fwk.uielement", "Failed to get synonyms" );
- }
+ }
+ catch ( const css::uno::Exception& )
+ {
+ SAL_WARN( "fwk.uielement", "Failed to get synonyms" );
}
}