diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-06 10:09:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 08:19:14 +0100 |
commit | 536a6d6ca67d01c8470c242c6f1fd0750496eed4 (patch) | |
tree | cc2aed75621456aaeb31d26e910cc61baf3bfdd7 /sfx2/source/doc/doctempl.cxx | |
parent | 53a318196859140deb4b3c317db583a90cfd604c (diff) |
loplugin:flatten in sfx2
Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421
Reviewed-on: https://gerrit.libreoffice.org/67435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/doc/doctempl.cxx')
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index d92c89644526..5dcbd550ec9f 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1347,23 +1347,23 @@ void RegionData_Impl::AddEntry( const OUString& rTitle, bool bFound = false; size_t nPos = GetEntryPos( rTitle, bFound ); - if ( !bFound ) - { - if ( pPos ) - nPos = *pPos; - - auto pEntry = std::make_unique<DocTempl_EntryData_Impl>( - this, rTitle ); - pEntry->SetTargetURL( rTargetURL ); - pEntry->SetHierarchyURL( aLinkURL ); - if ( nPos < maEntries.size() ) { - auto it = maEntries.begin(); - std::advance( it, nPos ); - maEntries.insert( it, std::move(pEntry) ); - } - else - maEntries.push_back( std::move(pEntry) ); + if ( bFound ) + return; + + if ( pPos ) + nPos = *pPos; + + auto pEntry = std::make_unique<DocTempl_EntryData_Impl>( + this, rTitle ); + pEntry->SetTargetURL( rTargetURL ); + pEntry->SetHierarchyURL( aLinkURL ); + if ( nPos < maEntries.size() ) { + auto it = maEntries.begin(); + std::advance( it, nPos ); + maEntries.insert( it, std::move(pEntry) ); } + else + maEntries.push_back( std::move(pEntry) ); } @@ -1514,19 +1514,19 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle, } catch ( Exception& ) {} - if ( xResultSet.is() ) - { - uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); + if ( !xResultSet.is() ) + return; - try + uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); + + try + { + while ( xResultSet->next() ) { - while ( xResultSet->next() ) - { - pRegionTmp->AddEntry( xRow->getString( 1 ), xRow->getString( 2 ), nullptr ); - } + pRegionTmp->AddEntry( xRow->getString( 1 ), xRow->getString( 2 ), nullptr ); } - catch ( Exception& ) {} } + catch ( Exception& ) {} } @@ -1544,24 +1544,24 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot ) } catch ( Exception& ) {} - if ( xResultSet.is() ) - { - uno::Reference< XCommandEnvironment > aCmdEnv; - uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY ); - uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); + if ( !xResultSet.is() ) + return; - try + uno::Reference< XCommandEnvironment > aCmdEnv; + uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY ); + uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); + + try + { + while ( xResultSet->next() ) { - while ( xResultSet->next() ) - { - const OUString aId = xContentAccess->queryContentIdentifierString(); - Content aContent( aId, aCmdEnv, comphelper::getProcessComponentContext() ); + const OUString aId = xContentAccess->queryContentIdentifierString(); + Content aContent( aId, aCmdEnv, comphelper::getProcessComponentContext() ); - AddRegion( xRow->getString( 1 ), aContent ); - } + AddRegion( xRow->getString( 1 ), aContent ); } - catch ( Exception& ) {} } + catch ( Exception& ) {} } |