diff options
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/helpinterceptor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/linkmgr2.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/appl/sfxpicklist.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 93 |
6 files changed, 57 insertions, 75 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index de80bc8c8058..6d41236c5baa 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -875,9 +875,9 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } bool bFound = false; - for ( size_t nProt=0; nProt<aProtocols.size(); nProt++ ) + for (const OUString & rProtocol : aProtocols) { - WildCard aPattern(aProtocols[nProt]); + WildCard aPattern(rProtocol); if ( aPattern.Matches( aURL.Complete ) ) { bFound = true; diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index 100f4c2a2483..786f1c7ca269 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -50,8 +50,8 @@ HelpInterceptor_Impl::~HelpInterceptor_Impl() { if ( m_pHistory ) { - for ( size_t i = 0, n = m_pHistory->size(); i < n; ++i ) - delete m_pHistory->at( i ); + for (HelpHistoryEntry_Impl* p : *m_pHistory) + delete p; delete m_pHistory; } } diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index d2926c2a0f1d..df5d5afb08f5 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -72,9 +72,8 @@ LinkManager::LinkManager(SfxObjectShell* p) LinkManager::~LinkManager() { - for( size_t n = 0; n < aLinkTbl.size(); ++n) + for(tools::SvRef<SvBaseLink> & rTmp : aLinkTbl) { - tools::SvRef<SvBaseLink>& rTmp = aLinkTbl[ n ]; if( rTmp.Is() ) { rTmp->Disconnect(); @@ -297,14 +296,12 @@ void LinkManager::UpdateAllLinks( aTmpArr.push_back( rLink.get() ); } - for( size_t n = 0; n < aTmpArr.size(); ++n ) + for(SvBaseLink* pLink : aTmpArr) { - SvBaseLink* pLink = aTmpArr[ n ]; - // search first in the array after the entry bool bFound = false; - for( size_t i = 0; i < aLinkTbl.size(); ++i ) - if( pLink == aLinkTbl[ i ].get() ) + for(tools::SvRef<SvBaseLink> & i : aLinkTbl) + if( pLink == i.get() ) { bFound = true; break; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 051ca2258063..b7545c3e201c 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -319,9 +319,8 @@ void ContentListBox_Impl::InitRoot() std::vector< OUString > aList = SfxContentHelper::GetHelpTreeViewContents( aHelpTreeviewURL ); - for(size_t i = 0, n = aList.size(); i < n; ++i ) + for(const OUString & aRow : aList) { - const OUString& aRow = aList[i]; sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); @@ -358,9 +357,8 @@ void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent ) std::vector<OUString > aList = SfxContentHelper::GetHelpTreeViewContents( aTmpURL ); - for (size_t i = 0,n = aList.size(); i < n; ++i ) + for (const OUString & aRow : aList) { - const OUString& aRow = aList[i]; sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); @@ -583,8 +581,8 @@ void IndexTabPage_Impl::InitializeIndex() // By now more than 256 equal entries are not allowed sal_Unicode append[256]; - for( int k = 0; k < 256; ++k ) - append[k] = ' '; + for(sal_Unicode & k : append) + k = ' '; sfx2::KeywordInfo aInfo; m_pIndexCB->SetUpdateMode( false ); @@ -1040,9 +1038,8 @@ IMPL_LINK_NOARG_TYPED(SearchTabPage_Impl, SearchHdl, LinkParamNone*, void) if ( m_pScopeCB->IsChecked() ) aSearchURL.append("&Scope=Heading"); std::vector< OUString > aFactories = SfxContentHelper::GetResultSet(aSearchURL.makeStringAndClear()); - for (size_t i = 0, n = aFactories.size(); i < n; ++i ) + for (const OUString & rRow : aFactories) { - const OUString& rRow = aFactories[i]; sal_Int32 nIdx = 0; OUString aTitle = rRow.getToken( 0, '\t', nIdx ); nIdx = 0; @@ -1475,9 +1472,8 @@ void SfxHelpIndexWindow_Impl::Initialize() OUStringBuffer aHelpURL(HELP_URL); AppendConfigToken(aHelpURL, true); std::vector<OUString> aFactories = SfxContentHelper::GetResultSet(aHelpURL.makeStringAndClear()); - for (size_t i = 0, n = aFactories.size(); i < n; ++i ) + for (const OUString & rRow : aFactories) { - const OUString& rRow = aFactories[i]; sal_Int32 nIdx = 0; OUString aTitle = rRow.getToken( 0, '\t', nIdx ); nIdx = 0; diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 0f69bbdfaf52..909706a623e7 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -143,8 +143,8 @@ namespace void SfxPickList::RemovePickListEntries() { ::osl::MutexGuard aGuard( thePickListMutex::get() ); - for ( size_t i = 0; i < m_aPicklistVector.size(); i++ ) - delete m_aPicklistVector[i]; + for (PickListEntry* p : m_aPicklistVector) + delete p; m_aPicklistVector.clear(); } diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 06db2d7810be..891ddb94e03e 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -565,12 +565,11 @@ SfxWorkWindow::~SfxWorkWindow() { // Delete SplitWindows - for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) + for (VclPtr<SfxSplitWindow> & p : pSplit) { - VclPtr<SfxSplitWindow> p = pSplit[n]; if (p->GetWindowCount()) ReleaseChild_Impl(*p); - pSplit[n].disposeAndClear(); + p.disposeAndClear(); } // Delete help structure for Child-Windows @@ -669,12 +668,12 @@ void SfxWorkWindow::DeleteControllers_Impl() // Delete ObjectBars (this is done last, so that aChildren does not // receive dead Pointers) - for ( size_t i = 0; i < aObjBarList.size(); i++ ) + for (SfxObjectBar_Impl & i : aObjBarList) { // Not every position must be occupied - sal_uInt16 nId = aObjBarList[i].nId; + sal_uInt16 nId = i.nId; if ( nId ) - aObjBarList[i].nId = 0; + i.nId = 0; } } @@ -758,9 +757,9 @@ SvBorder SfxWorkWindow::Arrange_Impl() Size aSize; Rectangle aTmp( aClientArea ); - for ( size_t n=0; n<aSortedList.size(); ++n ) + for (sal_uInt16 n : aSortedList) { - SfxChild_Impl* pCli = aChildren[aSortedList[n]]; + SfxChild_Impl* pCli = aChildren[n]; if ( !pCli->pWin ) continue; @@ -885,9 +884,8 @@ SvBorder SfxWorkWindow::Arrange_Impl() bool SfxWorkWindow::PrepareClose_Impl() { - for (size_t n=0; n<aChildWins.size(); n++) + for (SfxChildWin_Impl* pCW : aChildWins) { - SfxChildWin_Impl *pCW = aChildWins[n]; SfxChildWindow *pChild = pCW->pWin; if ( pChild && !pChild->QueryClose() ) return false; @@ -964,18 +962,15 @@ void SfxWorkWindow::ShowChildren_Impl() bool bInvisible = ( !IsVisible_Impl() || ( !pWorkWin->IsReallyVisible() && !pWorkWin->IsReallyShown() )); - for ( size_t nPos = 0; nPos < aChildren.size(); ++nPos ) + for (SfxChild_Impl* pCli : aChildren) { SfxChildWin_Impl* pCW = nullptr; - SfxChild_Impl *pCli = aChildren[nPos]; - if ( pCli && pCli->pWin ) { // We have to find the SfxChildWin_Impl to retrieve the // SFX_CHILDWIN flags that can influence visibility. - for (size_t n=0; n<aChildWins.size(); n++) + for (SfxChildWin_Impl* pCWin : aChildWins) { - SfxChildWin_Impl* pCWin = aChildWins[n]; SfxChild_Impl* pChild = pCWin->pCli; if ( pChild == pCli ) { @@ -1049,11 +1044,11 @@ void SfxWorkWindow::SetObjectBar_Impl(sal_uInt16 nPos, sal_uInt32 nResId, aObjBar.nPos = nRealPos; aObjBar.nMode = (nPos & SFX_VISIBILITY_MASK); - for ( size_t n=0; n<aObjBarList.size(); n++ ) + for (SfxObjectBar_Impl & rBar : aObjBarList) { - if ( aObjBarList[n].nId == aObjBar.nId ) + if ( rBar.nId == aObjBar.nId ) { - aObjBarList[n] = aObjBar; + rBar = aObjBar; return; } } @@ -1074,9 +1069,9 @@ bool SfxWorkWindow::KnowsObjectBar_Impl( sal_uInt16 nPos ) const if ( pParent && IsAppWorkWinToolbox_Impl( nRealPos ) ) return pParent->KnowsObjectBar_Impl( nPos ); - for ( size_t n=0; n<aObjBarList.size(); n++ ) + for (const SfxObjectBar_Impl& rBar : aObjBarList) { - if ( aObjBarList[n].nPos == nRealPos ) + if ( rBar.nPos == nRealPos ) return true; } @@ -1296,9 +1291,8 @@ void SfxWorkWindow::UpdateObjectBars_Impl() void SfxWorkWindow::UpdateChildWindows_Impl() { // any current or in the context available Childwindows - for ( size_t n=0; n<aChildWins.size(); n++ ) + for (SfxChildWin_Impl* pCW : aChildWins) { - SfxChildWin_Impl *pCW = aChildWins[n]; SfxChildWindow *pChildWin = pCW->pWin; bool bCreate = false; if ( pCW->nId && !pCW->bDisabled && (pCW->aInfo.nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE || IsVisible_Impl( pCW->nVisibility ) ) ) @@ -1534,9 +1528,9 @@ bool SfxWorkWindow::IsVisible_Impl() void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId ) { - for ( size_t n = 0; n < aChildWins.size(); ++n ) + for (SfxChildWin_Impl* i : aChildWins) { - SfxChildWindow *pCW = aChildWins[n]->pWin; + SfxChildWindow *pCW = i->pWin; if (pCW && pCW->GetAlignment() == SfxChildAlignment::NOALIGNMENT && pCW->GetType() != nId) { vcl::Window *pWin = pCW->GetWindow(); @@ -1572,26 +1566,23 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, return; // configure direct childwindow - for (size_t n=0; n<aChildWins.size(); n++) + for (SfxChildWin_Impl* i : aChildWins) { - pCW = aChildWins[n]; + pCW = i; SfxChildWindow *pChild = pCW->pWin; - if ( pChild ) + if ( pChild && (pChild->GetType() == nId )) { - if ( pChild->GetType() == nId ) + if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pChild->GetWindow())) { - if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pChild->GetWindow())) - { - // it's a DockingWindow - pDockWin = pSfxDockingWindow; - } - else - { - // FloatingWindow or ModelessDialog - pWin = pChild->GetWindow(); - } - break; + // it's a DockingWindow + pDockWin = pSfxDockingWindow; } + else + { + // FloatingWindow or ModelessDialog + pWin = pChild->GetWindow(); + } + break; } } @@ -1663,9 +1654,8 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, // The current affected window is included in the calculation of // the inner rectangle! - for ( size_t m=0; m<aSortedList.size(); ++m ) + for (sal_uInt16 i : aSortedList) { - sal_uInt16 i=aSortedList[m]; SfxChild_Impl* pCli = aChildren[i]; if ( pCli && pCli->nVisible == SfxChildVisibility::VISIBLE && pCli->pWin ) @@ -2223,10 +2213,10 @@ SfxChildWindow* SfxWorkWindow::GetChildWindow_Impl(sal_uInt16 nId) void SfxWorkWindow::ResetChildWindows_Impl() { - for ( size_t n = 0; n < aChildWins.size(); ++n ) + for (SfxChildWin_Impl* pChildWin : aChildWins) { - aChildWins[n]->nId = 0; - aChildWins[n]->bEnable = false; + pChildWin->nId = 0; + pChildWin->bEnable = false; } } @@ -2383,9 +2373,9 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) { if ( !bSorted ) Sort_Impl(); - for ( size_t n=0; n<aSortedList.size(); ++n ) + for (sal_uInt16 n : aSortedList) { - SfxChild_Impl* pCli = aChildren[aSortedList[n]]; + SfxChild_Impl* pCli = aChildren[n]; if ( (pCli->eAlign == SfxChildAlignment::NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) ) pCli->nVisible |= SfxChildVisibility::ACTIVE; } @@ -2394,9 +2384,9 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) { if ( !bSorted ) Sort_Impl(); - for ( size_t n=0; n<aSortedList.size(); ++n ) + for (sal_uInt16 n : aSortedList) { - SfxChild_Impl* pCli = aChildren[aSortedList[n]]; + SfxChild_Impl* pCli = aChildren[n]; pCli->nVisible &= ~SfxChildVisibility::ACTIVE; } } @@ -2404,9 +2394,9 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin ) { - for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) + for (VclPtr<SfxSplitWindow> & pWin : pSplit) { - if ( pSplit[n].get() != pSplitWin && pSplit[n]->IsAutoHide( true ) ) + if ( pWin.get() != pSplitWin && pWin->IsAutoHide( true ) ) return true; } return false; @@ -2418,9 +2408,8 @@ void SfxWorkWindow::EndAutoShow_Impl( Point aPos ) if ( pParent ) pParent->EndAutoShow_Impl( aPos ); - for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) + for (VclPtr<SfxSplitWindow> & p : pSplit) { - SfxSplitWindow *p = pSplit[n]; if ( p && p->IsAutoHide() ) { Point aLocalPos = p->ScreenToOutputPixel( aPos ); |