diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2017-04-17 20:54:46 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2017-04-18 17:55:29 +0200 |
commit | e0d164754f4b1a83ad58b2fcbbebb0017110d2ae (patch) | |
tree | e3a6a71d87df2308026f93cb5f398bcfe5cbd047 /sfx2 | |
parent | ee82052acf89f17bdbba0641324f96060b285a3d (diff) |
Reduce scope and simplify by early return
Change-Id: I12f8c6cb002cb0af63a096c7b66dd1e7d2db92a5
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 4c09b9543b82..3e40d2c3ff36 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1136,37 +1136,29 @@ bool SfxDocumentTemplates::GetLogicNames aFullPath.SetURL( rPath ); const OUString aPath( aFullPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - RegionData_Impl *pData = nullptr; - DocTempl_EntryData_Impl *pEntry = nullptr; - bool bFound = false; - const sal_uInt16 nCount = GetRegionCount(); - for ( sal_uInt16 i=0; !bFound && (i<nCount); i++ ) + for ( sal_uInt16 i=0; i<nCount; ++i ) { - pData = pImp->GetRegion( i ); + RegionData_Impl *pData = pImp->GetRegion( i ); if ( pData ) { - sal_uInt16 nChildCount = pData->GetCount(); + const sal_uInt16 nChildCount = pData->GetCount(); - for ( sal_uInt16 j=0; !bFound && (j<nChildCount); j++ ) + for ( sal_uInt16 j=0; j<nChildCount; ++j ) { - pEntry = pData->GetEntry( j ); + DocTempl_EntryData_Impl *pEntry = pData->GetEntry( j ); if ( pEntry && pEntry->GetTargetURL() == aPath ) { - bFound = true; + rRegion = pData->GetTitle(); + rName = pEntry->GetTitle(); + return true; } } } } - if ( bFound ) - { - rRegion = pData->GetTitle(); - rName = pEntry->GetTitle(); - } - - return bFound; + return false; } |