From e0d164754f4b1a83ad58b2fcbbebb0017110d2ae Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Mon, 17 Apr 2017 20:54:46 +0200 Subject: Reduce scope and simplify by early return Change-Id: I12f8c6cb002cb0af63a096c7b66dd1e7d2db92a5 --- sfx2/source/doc/doctempl.cxx | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'sfx2') 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 && (iGetRegion( 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 && (jGetEntry( 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; } -- cgit