summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appopen.cxx4
-rw-r--r--sfx2/source/appl/helpinterceptor.cxx4
-rw-r--r--sfx2/source/appl/linkmgr2.cxx11
-rw-r--r--sfx2/source/appl/newhelp.cxx16
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx4
-rw-r--r--sfx2/source/appl/workwin.cxx93
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx30
-rw-r--r--sfx2/source/bastyp/frmhtml.cxx27
-rw-r--r--sfx2/source/config/evntconf.cxx4
-rw-r--r--sfx2/source/control/bindings.cxx10
-rw-r--r--sfx2/source/control/dispatch.cxx12
-rw-r--r--sfx2/source/control/msgpool.cxx4
-rw-r--r--sfx2/source/control/templatelocalview.cxx116
-rw-r--r--sfx2/source/control/thumbnailview.cxx10
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx26
-rw-r--r--sfx2/source/dialog/splitwin.cxx8
-rw-r--r--sfx2/source/dialog/styfitem.cxx8
-rw-r--r--sfx2/source/dialog/templdlg.cxx14
-rw-r--r--sfx2/source/dialog/versdlg.cxx4
-rw-r--r--sfx2/source/doc/doctempl.cxx15
-rw-r--r--sfx2/source/doc/doctemplates.cxx30
-rw-r--r--sfx2/source/doc/doctemplateslocal.cxx6
-rw-r--r--sfx2/source/doc/objxtor.cxx3
-rw-r--r--sfx2/source/doc/templatedlg.cxx34
-rw-r--r--sfx2/source/sidebar/Deck.cxx22
-rw-r--r--sfx2/source/toolbox/imgmgr.cxx11
-rw-r--r--sfx2/source/view/frmload.cxx8
-rw-r--r--sfx2/source/view/lokhelper.cxx4
-rw-r--r--sfx2/source/view/viewfrm.cxx3
-rw-r--r--sfx2/source/view/viewsh.cxx27
30 files changed, 257 insertions, 311 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 );
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 5d15dda359d6..f382ff321e40 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -234,9 +234,8 @@ std::shared_ptr<const SfxFilter> SfxFilterContainer::GetDefaultFilter_Impl( cons
if ( bFirstRead )
ReadFilters_Impl();
- for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pCheckFilter : *pFilterArr)
{
- std::shared_ptr<const SfxFilter> pCheckFilter = (*pFilterArr)[i];
if ( pCheckFilter->GetServiceName().equalsIgnoreAsciiCase(sServiceName) )
{
pFilter = pCheckFilter;
@@ -325,9 +324,8 @@ void SfxFilterMatcher_Impl::Update() const
{
// this List was already used
pList->clear();
- for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *pFilterArr)
{
- std::shared_ptr<const SfxFilter> pFilter = (*pFilterArr)[i];
if ( pFilter->GetServiceName() == aName )
pList->push_back( pFilter );
}
@@ -359,9 +357,8 @@ void SfxFilterMatcher_Impl::InitForIterating() const
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
{
m_rImpl.InitForIterating();
- for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
return pFilter;
@@ -660,9 +657,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Mime( const OUStrin
{
if ( m_rImpl.pList )
{
- for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetMimeType() == rMediaType )
return pFilter;
@@ -680,9 +676,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4EA( const OUString&
if ( m_rImpl.pList )
{
std::shared_ptr<const SfxFilter> pFirst;
- for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetTypeName() == rType )
{
@@ -706,9 +701,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Extension( const OU
{
if ( m_rImpl.pList )
{
- for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
{
@@ -754,9 +748,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4UIName( const OUStr
{
m_rImpl.InitForIterating();
std::shared_ptr<const SfxFilter> pFirstFilter;
- for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust &&
!(nFlags & nDont ) && pFilter->GetUIName() == rName )
@@ -797,9 +790,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4FilterName( const O
CreateFilterArr();
else
{
- for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *pFilterArr)
{
- std::shared_ptr<const SfxFilter> pFilter = (*pFilterArr)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ((nFlags & nMust) == nMust && !(nFlags & nDont) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
return pFilter;
@@ -814,9 +806,8 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4FilterName( const O
if ( !pList )
pList = pFilterArr;
- for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : *pList)
{
- std::shared_ptr<const SfxFilter> pFilter = (*pList)[i];
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
return pFilter;
@@ -1137,9 +1128,8 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate )
if( !rList.empty() )
{
bUpdate = true;
- for ( size_t i = 0, n = rList.size(); i < n; ++i )
+ for (std::shared_ptr<const SfxFilter>& pFilter : rList)
{
- std::shared_ptr<const SfxFilter> pFilter = rList[i];
SfxFilter* pNonConstFilter = const_cast<SfxFilter*>(pFilter.get());
pNonConstFilter->nFormatType |= SFX_FILTER_NOTINSTALLED;
}
diff --git a/sfx2/source/bastyp/frmhtml.cxx b/sfx2/source/bastyp/frmhtml.cxx
index fe458c7e9605..2182332dbfb6 100644
--- a/sfx2/source/bastyp/frmhtml.cxx
+++ b/sfx2/source/bastyp/frmhtml.cxx
@@ -59,35 +59,34 @@ void SfxFrameHTMLParser::ParseFrameOptions(
// We will not mimic that bug !
bool bMarginWidth = false, bMarginHeight = false;
- for (size_t i = 0, n = rOptions.size(); i < n; ++i)
+ for (const auto & rOption : rOptions)
{
- const HTMLOption& aOption = rOptions[i];
- switch( aOption.GetToken() )
+ switch( rOption.GetToken() )
{
case HTML_O_BORDERCOLOR:
{
Color aColor;
- aOption.GetColor( aColor );
+ rOption.GetColor( aColor );
pFrame->SetWallpaper( Wallpaper( aColor ) );
break;
}
case HTML_O_SRC:
pFrame->SetURL(
INetURLObject::GetAbsURL(
- rBaseURL, aOption.GetString()) );
+ rBaseURL, rOption.GetString()) );
break;
case HTML_O_NAME:
- pFrame->SetName( aOption.GetString() );
+ pFrame->SetName( rOption.GetString() );
break;
case HTML_O_MARGINWIDTH:
- aMargin.Width() = aOption.GetNumber();
+ aMargin.Width() = rOption.GetNumber();
if( !bMarginHeight )
aMargin.Height() = 0;
bMarginWidth = true;
break;
case HTML_O_MARGINHEIGHT:
- aMargin.Height() = aOption.GetNumber();
+ aMargin.Height() = rOption.GetNumber();
if( !bMarginWidth )
aMargin.Width() = 0;
@@ -95,12 +94,12 @@ void SfxFrameHTMLParser::ParseFrameOptions(
break;
case HTML_O_SCROLLING:
pFrame->SetScrollingMode(
- (ScrollingMode)aOption.GetEnum( aScollingTable,
+ (ScrollingMode)rOption.GetEnum( aScollingTable,
ScrollingAuto ) );
break;
case HTML_O_FRAMEBORDER:
{
- const OUString& aStr = aOption.GetString();
+ const OUString& aStr = rOption.GetString();
bool bBorder = true;
if ( aStr.equalsIgnoreAsciiCase("NO") ||
aStr.equalsIgnoreAsciiCase("0") )
@@ -112,17 +111,17 @@ void SfxFrameHTMLParser::ParseFrameOptions(
pFrame->SetResizable( false );
break;
default:
- if (aOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_READONLY))
+ if (rOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_READONLY))
{
- const OUString& aStr = aOption.GetString();
+ const OUString& aStr = rOption.GetString();
bool bReadonly = true;
if ( aStr.equalsIgnoreAsciiCase("FALSE") )
bReadonly = false;
pFrame->SetReadOnly( bReadonly );
}
- else if (aOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_EDIT))
+ else if (rOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_EDIT))
{
- const OUString& aStr = aOption.GetString();
+ const OUString& aStr = rOption.GetString();
bool bEdit = true;
if ( aStr.equalsIgnoreAsciiCase("FALSE") )
bEdit = false;
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index babdcf471f4e..f68d77cac509 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -64,8 +64,8 @@ SfxEventNamesList& SfxEventNamesList::operator=( const SfxEventNamesList& rTbl )
void SfxEventNamesList::DelDtor()
{
- for ( size_t i = 0, n = aEventNamesList.size(); i < n; ++i )
- delete aEventNamesList[ i ];
+ for (SfxEventName* i : aEventNamesList)
+ delete i;
aEventNamesList.clear();
}
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index bf96cf182904..63266b6a1d0a 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -684,8 +684,8 @@ void SfxBindings::InvalidateAll
pImp->bMsgDirty = pImp->bMsgDirty || pImp->bAllMsgDirty || bWithMsg;
pImp->bAllDirty = true;
- for ( size_t n = 0; n < pImp->pCaches->size(); ++n )
- (*pImp->pCaches)[n]->Invalidate(bWithMsg);
+ for (SfxStateCache* pCache : *pImp->pCaches)
+ pCache->Invalidate(bWithMsg);
pImp->nMsgPos = 0;
if ( !nRegLevel )
@@ -783,9 +783,8 @@ void SfxBindings::InvalidateShell
sal_uInt16 nLevel = pDispatcher->GetShellLevel(rSh);
if ( nLevel != USHRT_MAX )
{
- for ( size_t n = 0; n < pImp->pCaches->size(); ++n )
+ for (SfxStateCache* pCache : *pImp->pCaches)
{
- SfxStateCache *pCache = (*pImp->pCaches)[n];
const SfxSlotServer *pMsgServer =
pCache->GetSlotServer(*pDispatcher, pImp->xProv);
if ( pMsgServer && pMsgServer->GetShellLevel() == nLevel )
@@ -1275,9 +1274,8 @@ void SfxBindings::UpdateSlotServer_Impl()
pImp->bContextChanged = true;
}
- for (size_t i = 0, nCount = pImp->pCaches->size(); i < nCount; ++i)
+ for (SfxStateCache* pCache : *pImp->pCaches)
{
- SfxStateCache *pCache = (*pImp->pCaches)[i];
//GetSlotServer can modify pImp->pCaches
pCache->GetSlotServer(*pDispatcher, pImp->xProv);
}
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index aab0e297f59f..2cbf1ab4c6eb 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -430,8 +430,8 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
xImp->bInvalidateOnUnlock = false;
- for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
- xImp->aObjBars[n].nResId = 0;
+ for (SfxObjectBars_Impl & rObjBar : xImp->aObjBars)
+ rObjBar.nResId = 0;
Link<SfxRequest*,void> aGenLink( LINK(this, SfxDispatcher, PostMsgHandler) );
@@ -1352,8 +1352,8 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
if ( xImp->pParent && !xImp->bQuiet /* && bUIActive */ )
xImp->pParent->Update_Impl_( bUIActive, bIsMDIApp, bIsIPOwner, pTaskWin );
- for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
- xImp->aObjBars[n].nResId = 0;
+ for (SfxObjectBars_Impl & rObjBar : xImp->aObjBars)
+ rObjBar.nResId = 0;
xImp->aChildWins.clear();
// bQuiet: own shells aren't considered for UI and SlotServer
@@ -1634,8 +1634,8 @@ void SfxDispatcher::FlushImpl()
if( bAwakeBindings && GetBindings() )
GetBindings()->DLEAVEREGISTRATIONS();
- for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
- xImp->aFixedObjBars[n].nResId = 0;
+ for (SfxObjectBars_Impl & rFixedObjBar : xImp->aFixedObjBars)
+ rFixedObjBar.nResId = 0;
SAL_INFO("sfx.control", "SfxDispatcher(" << this << ")::Flush() done");
}
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index 70598d07004e..1c05652566c9 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -124,9 +124,9 @@ const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId )
return nullptr;
// First, search their own interfaces
- for ( size_t nInterf = 0; nInterf < _pInterfaces->size(); ++nInterf )
+ for (SfxInterface* _pInterface : *_pInterfaces)
{
- const SfxSlot *pDef = ((*_pInterfaces)[nInterf])->GetSlot(nId);
+ const SfxSlot *pDef = _pInterface->GetSlot(nId);
if ( pDef )
return pDef;
}
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index dd5788d48c96..5481475403d6 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -47,8 +47,8 @@ TemplateLocalView::~TemplateLocalView()
void TemplateLocalView::dispose()
{
- for (size_t i = 0; i < maRegions.size(); ++i)
- delete maRegions[i];
+ for ( TemplateContainerItem* pRegion : maRegions)
+ delete pRegion;
maRegions.clear();
@@ -58,8 +58,8 @@ void TemplateLocalView::dispose()
void TemplateLocalView::Populate ()
{
- for (size_t i = 0; i < maRegions.size(); ++i)
- delete maRegions[i];
+ for (TemplateContainerItem* pRegion : maRegions)
+ delete pRegion;
maRegions.clear();
@@ -110,11 +110,11 @@ void TemplateLocalView::reload ()
{
sal_uInt16 nRegionId = mnCurRegionId - 1; //Is offset by 1
- for (size_t i = 0; i < maRegions.size(); ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnRegionId == nRegionId)
+ if (pRegion->mnRegionId == nRegionId)
{
- showRegion(maRegions[i]);
+ showRegion(pRegion);
break;
}
}
@@ -166,12 +166,12 @@ void TemplateLocalView::showRegion(ThumbnailViewItem *pItem)
void TemplateLocalView::showRegion(const OUString &rName)
{
- for (int i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->maTitle == rName)
+ if (pRegion->maTitle == rName)
{
maFTName->SetText(rName);
- showRegion(maRegions[i]);
+ showRegion(pRegion);
break;
}
}
@@ -179,10 +179,10 @@ void TemplateLocalView::showRegion(const OUString &rName)
sal_uInt16 TemplateLocalView::getCurRegionItemId() const
{
- for (size_t i = 0; i < maRegions.size(); ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnRegionId == mnCurRegionId-1)
- return maRegions[i]->mnId;
+ if (pRegion->mnRegionId == mnCurRegionId-1)
+ return pRegion->mnId;
}
return 0;
@@ -202,10 +202,10 @@ OUString TemplateLocalView::getRegionName(const sal_uInt16 nRegionId) const
OUString TemplateLocalView::getRegionItemName(const sal_uInt16 nItemId) const
{
- for (size_t i = 0; i < maRegions.size(); ++i)
+ for (const TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nItemId)
- return maRegions[i]->maTitle;
+ if (pRegion->mnId == nItemId)
+ return pRegion->maTitle;
}
return OUString();
@@ -231,22 +231,20 @@ TemplateLocalView::getFilteredItems(const std::function<bool (const TemplateItem
{
TemplateContainerItem *pFolderItem = maRegions[mnCurRegionId-1];
- for (size_t j = 0; j < pFolderItem->maTemplates.size(); ++j)
+ for (TemplateItemProperties & rItemProps : pFolderItem->maTemplates)
{
- if (rFunc(pFolderItem->maTemplates[j]))
- aItems.push_back(pFolderItem->maTemplates[j]);
+ if (rFunc(rItemProps))
+ aItems.push_back(rItemProps);
}
}
else
{
- for (size_t i = 0; i < maRegions.size(); ++i)
+ for (const TemplateContainerItem* pFolderItem : maRegions)
{
- TemplateContainerItem *pFolderItem = maRegions[i];
-
- for (size_t j = 0; j < pFolderItem->maTemplates.size(); ++j)
+ for (const TemplateItemProperties & rItemProps : pFolderItem->maTemplates)
{
- if (rFunc(pFolderItem->maTemplates[j]))
- aItems.push_back(pFolderItem->maTemplates[j]);
+ if (rFunc(rItemProps))
+ aItems.push_back(rItemProps);
}
}
}
@@ -337,11 +335,11 @@ bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
bool TemplateLocalView::removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId)
{
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nSrcItemId)
+ if (pRegion->mnId == nSrcItemId)
{
- TemplateContainerItem *pItem = static_cast<TemplateContainerItem*>(maRegions[i]);
+ TemplateContainerItem *pItem = static_cast<TemplateContainerItem*>(pRegion);
std::vector<TemplateItemProperties>::iterator pIter;
for (pIter = pItem->maTemplates.begin(); pIter != pItem->maTemplates.end(); ++pIter)
{
@@ -352,7 +350,7 @@ bool TemplateLocalView::removeTemplate (const sal_uInt16 nItemId, const sal_uInt
pIter = pItem->maTemplates.erase(pIter);
- if (maRegions[i]->mnRegionId == mnCurRegionId-1)
+ if (pRegion->mnRegionId == mnCurRegionId-1)
{
RemoveItem(nItemId);
Invalidate();
@@ -383,12 +381,12 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
TemplateContainerItem *pTarget = nullptr;
TemplateContainerItem *pSrc = nullptr;
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nTargetItem)
- pTarget = static_cast<TemplateContainerItem*>(maRegions[i]);
- else if (maRegions[i]->mnId == nSrcItem)
- pSrc = static_cast<TemplateContainerItem*>(maRegions[i]);
+ if (pRegion->mnId == nTargetItem)
+ pTarget = static_cast<TemplateContainerItem*>(pRegion);
+ else if (pRegion->mnId == nSrcItem)
+ pSrc = static_cast<TemplateContainerItem*>(pRegion);
}
if (pTarget && pSrc)
@@ -472,12 +470,12 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
TemplateContainerItem *pTarget = nullptr;
TemplateContainerItem *pSrc = nullptr;
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nTargetItem)
- pTarget = static_cast<TemplateContainerItem*>(maRegions[i]);
- else if (maRegions[i]->mnRegionId == nSrcRegionId)
- pSrc = static_cast<TemplateContainerItem*>(maRegions[i]);
+ if (pRegion->mnId == nTargetItem)
+ pTarget = static_cast<TemplateContainerItem*>(pRegion);
+ else if (pRegion->mnRegionId == nSrcRegionId)
+ pSrc = static_cast<TemplateContainerItem*>(pRegion);
}
if (pTarget && pSrc)
@@ -572,15 +570,15 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail,
const OUString &rPath)
{
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nRegionItemId)
+ if (pRegion->mnId == nRegionItemId)
{
sal_uInt16 nId = 0;
sal_uInt16 nDocId = 0;
TemplateContainerItem *pRegionItem =
- static_cast<TemplateContainerItem*>(maRegions[i]);
+ static_cast<TemplateContainerItem*>(pRegion);
if (!pRegionItem->maTemplates.empty())
{
@@ -589,7 +587,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
}
OUString aPath(rPath);
- sal_uInt16 nRegionId = maRegions[i]->mnRegionId;
+ sal_uInt16 nRegionId = pRegion->mnRegionId;
if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath))
{
@@ -602,7 +600,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nDocId);
TemplateContainerItem *pItem =
- static_cast<TemplateContainerItem*>(maRegions[i]);
+ static_cast<TemplateContainerItem*>(pRegion);
pItem->maTemplates.push_back(aTemplate);
@@ -694,12 +692,10 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString &
bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName)
{
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegItem : maRegions)
{
- if (maRegions[i]->mnId == nRegionItemId)
+ if (pRegItem->mnId == nRegionItemId)
{
- TemplateContainerItem *pRegItem = maRegions[i];
-
std::vector<TemplateItemProperties>::iterator aIter;
for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter)
{
@@ -724,23 +720,23 @@ bool TemplateLocalView::saveTemplateAs (sal_uInt16 nItemId,
const OUString &rName)
{
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (TemplateContainerItem* pRegion : maRegions)
{
- if (maRegions[i]->mnId == nItemId)
+ if (pRegion->mnId == nItemId)
{
uno::Reference< frame::XStorable > xStorable(rModel, uno::UNO_QUERY_THROW );
uno::Reference< frame::XDocumentTemplates > xTemplates(
frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
- if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(maRegions[i]->mnRegionId),rName, xStorable ))
+ if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(pRegion->mnRegionId),rName, xStorable ))
return false;
- sal_uInt16 nDocId = maRegions[i]->maTemplates.size();
+ sal_uInt16 nDocId = pRegion->maTemplates.size();
- OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(maRegions[i]->mnRegionId),rName);
+ OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(pRegion->mnRegionId),rName);
- if(!mpDocTemplates->InsertTemplate(maRegions[i]->mnRegionId,nDocId,rName,aURL))
+ if(!mpDocTemplates->InsertTemplate(pRegion->mnRegionId,nDocId,rName,aURL))
return false;
@@ -748,14 +744,14 @@ bool TemplateLocalView::saveTemplateAs (sal_uInt16 nItemId,
aTemplate.aIsFolder = false;
aTemplate.nId = getNextItemId();
aTemplate.nDocId = nDocId;
- aTemplate.nRegionId = maRegions[i]->mnRegionId;
+ aTemplate.nRegionId = pRegion->mnRegionId;
aTemplate.aName = rName;
aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
aTemplate.aPath = aURL;
- maRegions[i]->maTemplates.push_back(aTemplate);
+ pRegion->maTemplates.push_back(aTemplate);
insertItem(aTemplate);
@@ -802,13 +798,11 @@ bool TemplateLocalView::saveTemplateAs(TemplateContainerItem *pDstItem,
bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, const OUString &rName) const
{
- for (size_t i = 0, n = maRegions.size(); i < n; ++i)
+ for (const TemplateContainerItem* pRegItem : maRegions)
{
- if (maRegions[i]->mnId == nRegionItemId)
+ if (pRegItem->mnId == nRegionItemId)
{
- TemplateContainerItem *pRegItem = maRegions[i];
-
- std::vector<TemplateItemProperties>::iterator aIter;
+ std::vector<TemplateItemProperties>::const_iterator aIter;
for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter)
{
if (aIter->aName == rName)
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index dd6f1bfaf76e..526477fa5e6f 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -1142,14 +1142,14 @@ bool ThumbnailView::IsItemSelected( sal_uInt16 nItemId ) const
void ThumbnailView::deselectItems()
{
- for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+ for (ThumbnailViewItem* p : mItemList)
{
- if (mItemList[i]->isSelected())
+ if (p->isSelected())
{
- mItemList[i]->setEditTitle(false);
- mItemList[i]->setSelection(false);
+ p->setEditTitle(false);
+ p->setSelection(false);
- maItemStateHdl.Call(mItemList[i]);
+ maItemStateHdl.Call(p);
}
}
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 8bd00e61d4ec..de3c764e6be0 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -287,10 +287,10 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
, m_bUseUserData( rItem.m_bUseUserData )
, m_bUseThumbnailSave( rItem.m_bUseThumbnailSave )
{
- for ( size_t i = 0; i < rItem.m_aCustomProperties.size(); i++ )
+ for (const CustomProperty* pOtherProp : rItem.m_aCustomProperties)
{
- CustomProperty* pProp = new CustomProperty( rItem.m_aCustomProperties[i]->m_sName,
- rItem.m_aCustomProperties[i]->m_aValue );
+ CustomProperty* pProp = new CustomProperty( pOtherProp->m_sName,
+ pOtherProp->m_aValue );
m_aCustomProperties.push_back( pProp );
}
@@ -405,12 +405,12 @@ void SfxDocumentInfoItem::UpdateDocumentInfo(
}
}
- for ( size_t k = 0; k < m_aCustomProperties.size(); ++k )
+ for (const CustomProperty* pProp : m_aCustomProperties)
{
try
{
- xContainer->addProperty( m_aCustomProperties[k]->m_sName,
- beans::PropertyAttribute::REMOVABLE, m_aCustomProperties[k]->m_aValue );
+ xContainer->addProperty( pProp->m_sName,
+ beans::PropertyAttribute::REMOVABLE, pProp->m_aValue );
}
catch ( Exception& )
{
@@ -444,10 +444,10 @@ void SfxDocumentInfoItem::SetUseThumbnailSave( bool bSet )
std::vector< CustomProperty* > SfxDocumentInfoItem::GetCustomProperties() const
{
std::vector< CustomProperty* > aRet;
- for ( size_t i = 0; i < m_aCustomProperties.size(); i++ )
+ for (CustomProperty* pOtherProp : m_aCustomProperties)
{
- CustomProperty* pProp = new CustomProperty( m_aCustomProperties[i]->m_sName,
- m_aCustomProperties[i]->m_aValue );
+ CustomProperty* pProp = new CustomProperty( pOtherProp->m_sName,
+ pOtherProp->m_aValue );
aRet.push_back( pProp );
}
@@ -456,8 +456,8 @@ std::vector< CustomProperty* > SfxDocumentInfoItem::GetCustomProperties() const
void SfxDocumentInfoItem::ClearCustomProperties()
{
- for ( size_t i = 0; i < m_aCustomProperties.size(); i++ )
- delete m_aCustomProperties[i];
+ for (CustomProperty* pProp : m_aCustomProperties)
+ delete pProp;
m_aCustomProperties.clear();
}
@@ -2256,9 +2256,9 @@ void SfxCustomPropertiesPage::Reset( const SfxItemSet* rItemSet )
m_pPropertiesCtrl->ClearAllLines();
const SfxDocumentInfoItem& rInfoItem = static_cast<const SfxDocumentInfoItem &>(rItemSet->Get(SID_DOCINFO));
std::vector< CustomProperty* > aCustomProps = rInfoItem.GetCustomProperties();
- for ( size_t i = 0; i < aCustomProps.size(); i++ )
+ for (CustomProperty* pCustomProp : aCustomProps)
{
- m_pPropertiesCtrl->AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue, false );
+ m_pPropertiesCtrl->AddLine( pCustomProp->m_sName, pCustomProp->m_aValue, false );
}
}
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index ad6c3d261af9..9873b0018457 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -441,9 +441,9 @@ void SfxSplitWindow::Split()
// apply FIXED item size as 'original' item size to improve layouting of undock-dock-cycle of a window
{
DeactivateUpdateMode aDeactivateUpdateMode( *this );
- for ( size_t i = 0; i < aNewOrgSizes.size(); ++i )
+ for (const std::pair< sal_uInt16, long > & rNewOrgSize : aNewOrgSizes)
{
- SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
+ SetItemSize( rNewOrgSize.first, rNewOrgSize.second );
}
}
@@ -780,9 +780,9 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
}
// apply new item sizes
DeactivateUpdateMode aDeactivateUpdateMode( *this );
- for ( size_t i = 0; i < aNewOrgSizes.size(); ++i )
+ for (const std::pair< sal_uInt16, long > & rNewOrgSize : aNewOrgSizes)
{
- SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
+ SetItemSize( rNewOrgSize.first, rNewOrgSize.second );
}
}
}
diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx
index afc5a2b01a3e..18d8dace5faf 100644
--- a/sfx2/source/dialog/styfitem.cxx
+++ b/sfx2/source/dialog/styfitem.cxx
@@ -76,8 +76,8 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) :
SfxStyleFamilyItem::~SfxStyleFamilyItem()
{
- for ( size_t i = 0, n = aFilterList.size(); i < n; ++i )
- delete aFilterList[ i ];
+ for (SfxFilterTupel* p : aFilterList)
+ delete p;
aFilterList.clear();
}
@@ -106,8 +106,8 @@ SfxStyleFamilies::SfxStyleFamilies( const ResId& rResId ) :
SfxStyleFamilies::~SfxStyleFamilies()
{
- for ( size_t i = 0, n = aEntryList.size(); i < n; ++i )
- delete aEntryList[ i ];
+ for (SfxStyleFamilyItem* p : aEntryList)
+ delete p;
aEntryList.clear();
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 36105009920d..4c0408382510 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -614,9 +614,9 @@ StyleTreeArr_Impl& MakeTree_Impl(StyleTreeArr_Impl& rArr)
inline bool IsExpanded_Impl( const ExpandedEntries_t& rEntries,
const OUString &rStr)
{
- for (size_t n = 0; n < rEntries.size(); ++n)
+ for (const auto & rEntry : rEntries)
{
- if (rEntries[n] == rStr)
+ if (rEntry == rStr)
return true;
}
return false;
@@ -711,8 +711,8 @@ void SfxTemplateDialog_Impl::EnableEdit(bool bEnable)
void SfxCommonTemplateDialog_Impl::ReadResource()
{
// Read global user resource
- for(sal_uInt16 i = 0; i < MAX_FAMILIES; ++i)
- pFamilyState[i] = nullptr;
+ for(SfxTemplateItem* & rp : pFamilyState)
+ rp = nullptr;
SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
pCurObjShell = pViewFrame->GetObjectShell();
@@ -1167,10 +1167,10 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
sal_Int32 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
const SfxStyleFilter& rFilter = pItem->GetFilterList();
- for( size_t i = 0; i < rFilter.size(); ++i)
+ for(const SfxFilterTupel* i : rFilter)
{
- sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags;
- nPos = aFilterLb->InsertEntry( rFilter[ i ]->aName );
+ sal_uIntPtr nFilterFlags = i->nFlags;
+ nPos = aFilterLb->InsertEntry( i->aName );
aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
}
if(nActFilter < aFilterLb->GetEntryCount() - 1)
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index e0a2cb81d29e..0d98e7d6ff5a 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -113,8 +113,8 @@ SfxVersionTableDtor::SfxVersionTableDtor( const uno::Sequence < document::CmisVe
void SfxVersionTableDtor::DelDtor()
{
- for ( size_t i = 0, n = aTableList.size(); i < n; ++i )
- delete aTableList[ i ];
+ for (SfxVersionInfo* i : aTableList)
+ delete i;
aTableList.clear();
}
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index 2ca537f04433..c3d9d34ecdec 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -1293,8 +1293,8 @@ RegionData_Impl::RegionData_Impl( const SfxDocTemplate_Impl* pParent,
RegionData_Impl::~RegionData_Impl()
{
- for ( size_t i = 0, n = maEntries.size(); i < n; ++i )
- delete maEntries[ i ];
+ for (DocTempl_EntryData_Impl* p : maEntries)
+ delete p;
maEntries.clear();
}
@@ -1498,9 +1498,8 @@ RegionData_Impl* SfxDocTemplate_Impl::GetRegion( size_t nIndex ) const
RegionData_Impl* SfxDocTemplate_Impl::GetRegion( const OUString& rName )
const
{
- for ( size_t i = 0, n = maRegions.size(); i < n; ++i )
+ for (RegionData_Impl* pData : maRegions)
{
- RegionData_Impl* pData = maRegions[ i ];
if( pData->GetTitle() == rName )
return pData;
}
@@ -1666,8 +1665,8 @@ bool SfxDocTemplate_Impl::InsertRegion( RegionData_Impl *pNew, size_t nPos )
::osl::MutexGuard aGuard( maMutex );
// return false (not inserted) if the entry already exists
- for ( size_t i = 0, n = maRegions.size(); i < n; ++i )
- if ( maRegions[ i ]->Compare( pNew ) == 0 )
+ for (const RegionData_Impl* pRegion : maRegions)
+ if ( pRegion->Compare( pNew ) == 0 )
return false;
size_t newPos = nPos;
@@ -1762,8 +1761,8 @@ void SfxDocTemplate_Impl::Clear()
if ( mnLockCounter )
return;
- for ( size_t i = 0, n = maRegions.size(); i < n; ++i )
- delete maRegions[ i ];
+ for (RegionData_Impl* pRegion : maRegions)
+ delete pRegion;
maRegions.clear();
}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 72162892ceb0..3baf4023b13c 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -507,9 +507,8 @@ OUString SfxDocTplService_Impl::getLongName( const OUString& rShortName )
{
OUString aRet;
- for ( size_t i = 0, n = maNames.size(); i < n; ++i )
+ for (NamePair_Impl* pPair : maNames)
{
- NamePair_Impl* pPair = maNames[ i ];
if ( pPair->maShortName == rShortName )
{
aRet = pPair->maLongName;
@@ -1089,8 +1088,8 @@ SfxDocTplService_Impl::~SfxDocTplService_Impl()
{
::osl::MutexGuard aGuard( maMutex );
- for ( size_t i = 0, n = maNames.size(); i < n; ++i )
- delete maNames[ i ];
+ for (NamePair_Impl* p : maNames)
+ delete p;
maNames.clear();
}
@@ -1167,9 +1166,8 @@ void SfxDocTplService_Impl::doUpdate()
}
// now check the list
- for( size_t j = 0, n = aGroupList.size(); j < n; ++j )
+ for(GroupData_Impl* pGroup : aGroupList)
{
- GroupData_Impl *pGroup = aGroupList[ j ];
if ( pGroup->getInUse() )
{
if ( pGroup->getInHierarchy() )
@@ -2481,11 +2479,11 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
return;
GroupData_Impl* pGroup = nullptr;
- for ( size_t i = 0, n = rList.size(); i < n; ++i )
+ for (GroupData_Impl* i : rList)
{
- if ( rList[ i ]->getTitle() == aTitle )
+ if ( i->getTitle() == aTitle )
{
- pGroup = rList[ i ];
+ pGroup = i;
break;
}
}
@@ -2596,10 +2594,10 @@ void SfxDocTplService_Impl::createFromContent( GroupList_Impl& rList,
else
{
OUString aUITitle;
- for ( size_t nInd = 0; nInd < aUINames.size(); nInd++ )
- if ( aUINames[nInd].First.equals( aTitle ) )
+ for (beans::StringPair & rUIName : aUINames)
+ if ( rUIName.First.equals( aTitle ) )
{
- aUITitle = aUINames[nInd].Second;
+ aUITitle = rUIName.Second;
break;
}
@@ -2721,8 +2719,8 @@ GroupData_Impl::GroupData_Impl( const OUString& rTitle )
GroupData_Impl::~GroupData_Impl()
{
- for ( size_t i = 0, n = maEntries.size(); i < n; ++i )
- delete maEntries[ i ];
+ for (DocTemplates_EntryData_Impl* p : maEntries)
+ delete p;
maEntries.clear();
}
@@ -2735,9 +2733,9 @@ DocTemplates_EntryData_Impl* GroupData_Impl::addEntry( const OUString& rTitle,
DocTemplates_EntryData_Impl* pData = nullptr;
bool EntryFound = false;
- for ( size_t i = 0, n = maEntries.size(); i < n; ++i )
+ for (DocTemplates_EntryData_Impl* p : maEntries)
{
- pData = maEntries[ i ];
+ pData = p;
if ( pData->getTitle() == rTitle )
{
EntryFound = true;
diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx
index 3a9555c64293..1cffac39ee97 100644
--- a/sfx2/source/doc/doctemplateslocal.cxx
+++ b/sfx2/source/doc/doctemplateslocal.cxx
@@ -70,12 +70,12 @@ void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::R
xWriterHandler->startDocument();
xWriterHandler->startElement( aGroupListElement, xRootAttrList );
- for ( size_t nInd = 0; nInd < aSequence.size(); nInd++ )
+ for (const auto & i : aSequence)
{
::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList;
uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList );
- pAttrList->AddAttribute( aNameAttr, aCDATAString, aSequence[nInd].First );
- pAttrList->AddAttribute( aUINameAttr, aCDATAString, aSequence[nInd].Second );
+ pAttrList->AddAttribute( aNameAttr, aCDATAString, i.First );
+ pAttrList->AddAttribute( aUINameAttr, aCDATAString, i.Second );
xWriterHandler->startElement( aGroupElement, xAttrList );
xWriterHandler->ignorableWhitespace( aWhiteSpace );
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 8d043335e6fd..0d4fb1461d96 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -471,9 +471,8 @@ SfxObjectShell* SfxObjectShell::GetFirst
SfxObjectShellArr_Impl &rDocs = SfxGetpApp()->GetObjectShells_Impl();
// search for a SfxDocument of the specified type
- for ( size_t nPos = 0; nPos < rDocs.size(); ++nPos )
+ for (SfxObjectShell* pSh : rDocs)
{
- SfxObjectShell* pSh = rDocs[ nPos ];
if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() )
continue;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index d1a52682a9c1..28e0e415de07 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -317,8 +317,8 @@ void SfxTemplateManagerDlg::dispose()
// Synchronize the config before deleting it
syncRepositories();
- for (size_t i = 0, n = maRepositories.size(); i < n; ++i)
- delete maRepositories[i];
+ for (TemplateRepository* p : maRepositories)
+ delete p;
// Ignore view events since we are cleaning the object
mpLocalView->setItemStateHdl(Link<const ThumbnailViewItem*,void>());
@@ -642,11 +642,11 @@ IMPL_LINK_TYPED(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu, bo
TemplateRepository *pRepository = nullptr;
- for (size_t i = 0, n = maRepositories.size(); i < n; ++i)
+ for (TemplateRepository* p : maRepositories)
{
- if (maRepositories[i]->mnId == nRepoId)
+ if (p->mnId == nRepoId)
{
- pRepository = maRepositories[i];
+ pRepository = p;
break;
}
}
@@ -748,21 +748,19 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, SearchUpdateHdl, Edit&, void)
std::vector<TemplateItemProperties> aItems =
mpLocalView->getFilteredItems(SearchView_Keyword(aKeyword, getCurrentFilter()));
- for (size_t i = 0; i < aItems.size(); ++i)
+ for (TemplateItemProperties& rItem : aItems)
{
- TemplateItemProperties *pItem = &aItems[i];
-
OUString aFolderName;
if (bDisplayFolder)
- aFolderName = mpLocalView->getRegionName(pItem->nRegionId);
+ aFolderName = mpLocalView->getRegionName(rItem.nRegionId);
- mpSearchView->AppendItem(pItem->nId,mpLocalView->getRegionId(pItem->nRegionId),
- pItem->nDocId,
- pItem->aName,
+ mpSearchView->AppendItem(rItem.nId,mpLocalView->getRegionId(rItem.nRegionId),
+ rItem.nDocId,
+ rItem.aName,
aFolderName,
- pItem->aPath,
- pItem->aThumbnail);
+ rItem.aPath,
+ rItem.aThumbnail);
}
mpSearchView->Invalidate();
@@ -1381,8 +1379,8 @@ void SfxTemplateManagerDlg::createRepositoryMenu()
const std::vector<TemplateRepository*> &rRepos = getRepositories();
- for (size_t i = 0, n = rRepos.size(); i < n; ++i)
- mpRepositoryMenu->InsertItem(MNI_REPOSITORY_BASE+rRepos[i]->mnId,rRepos[i]->maTitle);
+ for (const TemplateRepository* pRepo : rRepos)
+ mpRepositoryMenu->InsertItem(MNI_REPOSITORY_BASE+pRepo->mnId, pRepo->maTitle);
mpRepositoryMenu->InsertSeparator();
mpRepositoryMenu->InsertItem(MNI_REPOSITORY_NEW,SfxResId(STR_REPOSITORY_NEW).toString());
@@ -1629,9 +1627,9 @@ void SfxTemplateManagerDlg::loadRepositories()
bool SfxTemplateManagerDlg::insertRepository(const OUString &rName, const OUString &rURL)
{
- for (size_t i = 0, n = maRepositories.size(); i < n; ++i)
+ for (TemplateRepository* pRepo : maRepositories)
{
- if (maRepositories[i]->maTitle == rName)
+ if (pRepo->maTitle == rName)
return false;
}
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index d3a713b99bce..2276b02ac54f 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -79,8 +79,8 @@ void Deck::dispose()
// We have to explicitly trigger the destruction of panels.
// Otherwise that is done by one of our base class destructors
// without updating maPanels.
- for (size_t i = 0; i < aPanels.size(); i++)
- aPanels[i].disposeAndClear();
+ for (VclPtr<Panel> & rpPanel : aPanels)
+ rpPanel.disposeAndClear();
mpTitleBar.disposeAndClear();
mpFiller.disposeAndClear();
@@ -192,18 +192,18 @@ bool Deck::ProcessWheelEvent(CommandEvent* pCommandEvent)
* This container may contain existing panels that are
* being re-used, and new ones too.
*/
-void Deck::ResetPanels(const SharedPanelContainer& rPanels)
+void Deck::ResetPanels(const SharedPanelContainer& rPanelContainer)
{
// First dispose old panels we no longer need.
- for (size_t i = 0; i < maPanels.size(); i++)
+ for (VclPtr<Panel> & rpPanel : maPanels)
{
bool bFound = false;
- for (size_t j = 0; j < rPanels.size(); j++)
- bFound = bFound || (maPanels[i].get() == rPanels[j].get());
+ for (const auto & i : rPanelContainer)
+ bFound = bFound || (rpPanel.get() == i.get());
if (!bFound) // this one didn't survive.
- maPanels[i].disposeAndClear();
+ rpPanel.disposeAndClear();
}
- maPanels = rPanels;
+ maPanels = rPanelContainer;
RequestLayout();
}
@@ -224,11 +224,11 @@ vcl::Window* Deck::GetPanelParentWindow()
Panel* Deck::GetPanel(const OUString & panelId)
{
- for (size_t i = 0; i < maPanels.size(); i++)
+ for (VclPtr<Panel> & pPanel : maPanels)
{
- if(maPanels[i].get()->GetId() == panelId)
+ if(pPanel->GetId() == panelId)
{
- return maPanels[i].get();
+ return pPanel.get();
}
}
return nullptr;
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index a2d4a58aa0be..358328b23988 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -110,8 +110,8 @@ SfxImageManager_Impl::SfxImageManager_Impl(SfxModule& rModule)
{
m_nSymbolsSize = m_aOpt.GetCurrentSymbolsSize();
- for ( sal_uInt32 i = 0; i < IMAGELIST_COUNT; i++ )
- m_pImageList[i] = nullptr;
+ for (ImageList* & rp : m_pImageList)
+ rp = nullptr;
m_aOpt.AddListenerLink( LINK( this, SfxImageManager_Impl, OptionsChanged_Impl ) );
Application::AddEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) );
@@ -124,8 +124,8 @@ SfxImageManager_Impl::~SfxImageManager_Impl()
m_aOpt.RemoveListenerLink( LINK( this, SfxImageManager_Impl, OptionsChanged_Impl ) );
if (m_bAppEventListener)
Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) );
- for ( size_t i = 0; i < m_aToolBoxes.size(); i++ )
- delete m_aToolBoxes[i];
+ for (ToolBoxInf_Impl* p : m_aToolBoxes)
+ delete p;
}
@@ -159,9 +159,8 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
m_nSymbolsSize = nNewSymbolsSize;
bool bLarge( m_nSymbolsSize == SFX_SYMBOLS_SIZE_LARGE );
- for ( size_t n=0; n < m_aToolBoxes.size(); n++ )
+ for (ToolBoxInf_Impl* pInf : m_aToolBoxes)
{
- ToolBoxInf_Impl *pInf = m_aToolBoxes[n];
if ( pInf->nFlags & SfxToolboxFlags::CHANGESYMBOLSET )
{
ToolBox *pBox = pInf->pToolBox;
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 1c4e2756a1f9..da63bd9cb5e3 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -527,12 +527,12 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
};
::comphelper::NamedValueCollection aViewArgs;
- for ( size_t i=0; i < SAL_N_ELEMENTS(pKnownViewArgs); ++i )
+ for (const char* pKnownViewArg : pKnownViewArgs)
{
- if ( io_rDescriptor.has( pKnownViewArgs[i] ) )
+ if ( io_rDescriptor.has( pKnownViewArg ) )
{
- aViewArgs.put( pKnownViewArgs[i], io_rDescriptor.get( pKnownViewArgs[i] ) );
- io_rDescriptor.remove( pKnownViewArgs[i] );
+ aViewArgs.put( pKnownViewArg, io_rDescriptor.get( pKnownViewArg ) );
+ io_rDescriptor.remove( pKnownViewArg );
}
}
return aViewArgs;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 0522c6042fb4..97e17168d2c6 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -70,9 +70,9 @@ std::size_t SfxLokHelper::getViews()
SfxObjectShell* pObjectShell = SfxViewFrame::Current()->GetObjectShell();
SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
- for (std::size_t i = 0; i < rViewArr.size(); ++i)
+ for (SfxViewShell* i : rViewArr)
{
- if (rViewArr[i]->GetObjectShell() == pObjectShell)
+ if (i->GetObjectShell() == pObjectShell)
++nRet;
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ef0316bf8134..04e44a599bc2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1510,9 +1510,8 @@ SfxViewFrame* SfxViewFrame::GetFirst
SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
// search for a SfxDocument of the specified type
- for ( size_t nPos = 0; nPos < rFrames.size(); ++nPos )
+ for (SfxViewFrame* pFrame : rFrames)
{
- SfxViewFrame *pFrame = rFrames[nPos];
if ( ( !pDoc || pDoc == pFrame->GetObjectShell() )
&& ( !bOnlyIfVisible || pFrame->IsVisible() )
)
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c785f8e3639c..0852c1d255e6 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -814,9 +814,8 @@ SfxInPlaceClient* SfxViewShell::FindIPClient
if( !pObjParentWin )
pObjParentWin = GetWindow();
- for ( size_t n = 0; n < pClients->size(); n++)
+ for (SfxInPlaceClient* pIPClient : *pClients)
{
- SfxInPlaceClient *pIPClient = pClients->at( n );
if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin )
return pIPClient;
}
@@ -838,9 +837,8 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const
if ( !pClients )
return nullptr;
- for ( size_t n = 0; n < pClients->size(); n++)
+ for (SfxInPlaceClient* pIPClient : *pClients)
{
- SfxInPlaceClient* pIPClient = pClients->at( n );
if ( pIPClient->IsUIActive() )
return pIPClient;
}
@@ -854,9 +852,8 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
if ( !pClients )
return nullptr;
- for ( size_t n = 0; n < pClients->size(); n++)
+ for (SfxInPlaceClient* pIPClient : *pClients)
{
- SfxInPlaceClient* pIPClient = pClients->at( n );
if ( pIPClient->IsObjectUIActive() )
return pIPClient;
}
@@ -1341,17 +1338,15 @@ SfxViewShell* SfxViewShell::GetFirst
// search for a SfxViewShell of the specified type
SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
- for ( size_t nPos = 0; nPos < rShells.size(); ++nPos )
+ for (SfxViewShell* pShell : rShells)
{
- SfxViewShell *pShell = rShells[nPos];
if ( pShell )
{
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
// these ViewShells shouldn't be accessible anymore
// a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
- for ( size_t n=0; n<rFrames.size(); ++n )
+ for (SfxViewFrame* pFrame : rFrames)
{
- SfxViewFrame *pFrame = rFrames[n];
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
@@ -1391,9 +1386,8 @@ SfxViewShell* SfxViewShell::GetNext
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
// these ViewShells shouldn't be accessible anymore
// a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
- for ( size_t n=0; n<rFrames.size(); ++n )
+ for (SfxViewFrame* pFrame : rFrames)
{
- SfxViewFrame *pFrame = rFrames[n];
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
@@ -1423,9 +1417,8 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
{
// avoid access to dangling ViewShells
SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
- for ( size_t n=0; n<rFrames.size(); ++n )
+ for (SfxViewFrame* frame : rFrames)
{
- SfxViewFrame *frame = rFrames[n];
if ( frame == GetViewFrame() && &rBC == GetObjectShell() )
{
SfxItemSet* pSet = GetObjectShell()->GetMedium()->GetItemSet();
@@ -1522,9 +1515,8 @@ void SfxViewShell::ResetAllClients_Impl( SfxInPlaceClient *pIP )
if ( !pClients )
return;
- for ( size_t n = 0; n < pClients->size(); n++ )
+ for (SfxInPlaceClient* pIPClient : *pClients)
{
- SfxInPlaceClient* pIPClient = pClients->at( n );
if( pIPClient != pIP )
pIPClient->ResetObject();
}
@@ -1554,9 +1546,8 @@ void SfxViewShell::VisAreaChanged(const Rectangle& /*rVisArea*/)
if ( !pClients )
return;
- for ( size_t n = 0; n < pClients->size(); n++)
+ for (SfxInPlaceClient* pIPClient : *pClients)
{
- SfxInPlaceClient* pIPClient = pClients->at( n );
if ( pIPClient->IsObjectInPlaceActive() )
// client is active, notify client that the VisArea might have changed
pIPClient->VisAreaChanged();