summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-11 09:53:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-12 07:12:44 +0000
commitb415494bf0468b74318b61f114e2ff4ae68c00ee (patch)
tree432f9397ecf4c410e4e9767f433c60e4dc0b0087
parent875984617cfd6c773eb93f339929eb3fabd3e97b (diff)
clang-tidy modernize-loop-convert in sw
Change-Id: I1f4a0ad6658bd3154c48940296aa8edc1ea1612c Reviewed-on: https://gerrit.libreoffice.org/24876 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sw/source/core/access/accfrmobjmap.cxx8
-rw-r--r--sw/source/core/bastyp/calc.cxx4
-rw-r--r--sw/source/core/bastyp/init.cxx10
-rw-r--r--sw/source/core/crsr/viscrs.cxx8
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx15
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx6
-rw-r--r--sw/source/core/doc/DocumentLinksAdministrationManager.cxx4
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx13
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx14
-rw-r--r--sw/source/core/doc/acmplwrd.cxx4
-rw-r--r--sw/source/core/doc/doc.cxx3
-rw-r--r--sw/source/core/doc/docbm.cxx12
-rw-r--r--sw/source/core/doc/doccomp.cxx3
-rw-r--r--sw/source/core/doc/doccorr.cxx4
-rw-r--r--sw/source/core/doc/docdesc.cxx6
-rw-r--r--sw/source/core/doc/docedt.cxx3
-rw-r--r--sw/source/core/doc/docfld.cxx8
-rw-r--r--sw/source/core/doc/docfmt.cxx11
-rw-r--r--sw/source/core/doc/doclay.cxx3
-rw-r--r--sw/source/core/doc/docnum.cxx4
-rw-r--r--sw/source/core/doc/docredln.cxx6
-rw-r--r--sw/source/core/doc/doctxm.cxx6
-rw-r--r--sw/source/core/doc/number.cxx14
-rw-r--r--sw/source/core/doc/sortopt.cxx4
-rw-r--r--sw/source/core/doc/tblafmt.cxx4
-rw-r--r--sw/source/core/doc/textboxhelper.cxx3
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx6
-rw-r--r--sw/source/core/draw/dcontact.cxx8
-rw-r--r--sw/source/core/draw/dview.cxx4
-rw-r--r--sw/source/core/frmedt/feshview.cxx3
-rw-r--r--sw/source/core/layout/anchoredobject.cxx9
-rw-r--r--sw/source/core/layout/atrfrm.cxx3
-rw-r--r--sw/source/core/layout/calcmove.cxx3
-rw-r--r--sw/source/core/layout/flowfrm.cxx6
-rw-r--r--sw/source/core/layout/fly.cxx6
-rw-r--r--sw/source/core/layout/flycnt.cxx4
-rw-r--r--sw/source/core/layout/flylay.cxx6
-rw-r--r--sw/source/core/layout/frmtool.cxx38
-rw-r--r--sw/source/core/layout/ftnfrm.cxx4
-rw-r--r--sw/source/core/layout/layact.cxx15
-rw-r--r--sw/source/core/layout/laycache.cxx6
-rw-r--r--sw/source/core/layout/layouter.cxx3
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.cxx3
-rw-r--r--sw/source/core/layout/pagechg.cxx12
-rw-r--r--sw/source/core/layout/paintfrm.cxx12
-rw-r--r--sw/source/core/layout/sectfrm.cxx12
-rw-r--r--sw/source/core/layout/tabfrm.cxx12
-rw-r--r--sw/source/core/layout/trvlfrm.cxx15
-rw-r--r--sw/source/core/layout/wsfrm.cxx26
-rw-r--r--sw/source/core/table/swtable.cxx3
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx24
-rw-r--r--sw/source/core/text/atrstck.cxx4
-rw-r--r--sw/source/core/text/itrcrsr.cxx3
-rw-r--r--sw/source/core/text/porfld.cxx4
-rw-r--r--sw/source/core/text/porlay.cxx4
-rw-r--r--sw/source/core/text/redlnitr.cxx4
-rw-r--r--sw/source/core/text/txtfrm.cxx12
-rw-r--r--sw/source/core/text/txtftn.cxx3
-rw-r--r--sw/source/core/text/wrong.cxx14
-rw-r--r--sw/source/core/text/xmldump.cxx3
-rw-r--r--sw/source/core/tox/tox.cxx8
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx13
-rw-r--r--sw/source/core/txtnode/txtedt.cxx6
-rw-r--r--sw/source/core/undo/undraw.cxx12
-rw-r--r--sw/source/core/undo/unins.cxx3
-rw-r--r--sw/source/core/undo/unovwr.cxx4
-rw-r--r--sw/source/core/undo/unsort.cxx18
-rw-r--r--sw/source/core/undo/untbl.cxx6
-rw-r--r--sw/source/core/unocore/unocoll.cxx11
-rw-r--r--sw/source/core/unocore/unofield.cxx4
-rw-r--r--sw/source/core/unocore/unoidx.cxx3
-rw-r--r--sw/source/core/unocore/unosect.cxx3
-rw-r--r--sw/source/core/unocore/unosett.cxx3
-rw-r--r--sw/source/core/view/viewsh.cxx3
-rw-r--r--sw/source/filter/basflt/fltini.cxx3
-rw-r--r--sw/source/filter/basflt/shellio.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx16
-rw-r--r--sw/source/filter/html/htmlcss1.cxx28
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx3
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx4
-rw-r--r--sw/source/filter/html/htmlform.cxx3
-rw-r--r--sw/source/filter/html/htmlgrin.cxx6
-rw-r--r--sw/source/filter/html/htmlplug.cxx6
-rw-r--r--sw/source/filter/html/htmltab.cxx11
-rw-r--r--sw/source/filter/html/svxcss1.cxx18
-rw-r--r--sw/source/filter/html/wrthtml.cxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx14
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx4
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx12
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx10
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx15
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx20
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx12
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx8
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx4
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx3
-rw-r--r--sw/source/filter/xml/xmlfonte.cxx4
-rw-r--r--sw/source/filter/xml/xmltble.cxx4
-rw-r--r--sw/source/filter/xml/xmltbli.cxx8
-rw-r--r--sw/source/ui/config/optpage.cxx8
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx6
-rw-r--r--sw/source/ui/envelp/label1.cxx6
-rw-r--r--sw/source/ui/envelp/labfmt.cxx4
-rw-r--r--sw/source/ui/fldui/fldref.cxx6
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx60
-rw-r--r--sw/source/ui/index/cnttab.cxx4
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx16
-rw-r--r--sw/source/ui/misc/bookmark.cxx6
-rw-r--r--sw/source/ui/table/tabledlg.cxx14
-rw-r--r--sw/source/ui/vba/vbadialog.cxx3
-rw-r--r--sw/source/uibase/app/docstyle.cxx16
-rw-r--r--sw/source/uibase/app/mainwn.cxx3
-rw-r--r--sw/source/uibase/config/uinums.cxx12
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx5
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx104
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx5
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx4
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx3
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx4
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx6
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx9
-rw-r--r--sw/source/uibase/shells/langhelper.cxx22
-rw-r--r--sw/source/uibase/sidebar/ThemePanel.cxx16
-rw-r--r--sw/source/uibase/uiview/pview.cxx6
-rw-r--r--sw/source/uibase/uiview/view2.cxx4
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx3
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx9
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx3
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx3
-rw-r--r--sw/source/uibase/utlui/gloslst.cxx3
-rw-r--r--sw/source/uibase/utlui/initui.cxx4
-rw-r--r--sw/source/uibase/utlui/viewlayoutctrl.cxx6
-rw-r--r--sw/source/uibase/wrtsh/wrtundo.cxx6
141 files changed, 544 insertions, 684 deletions
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index ec2622178b97..fc492a770e7a 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -66,9 +66,9 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
const SwSortedObjs *pObjs = pPgFrame->GetSortedObjs();
if ( pObjs )
{
- for( size_t i=0; i<pObjs->size(); ++i )
+ for(const SwAnchoredObject* pObj : *pObjs)
{
- aLower = (*pObjs)[i]->GetDrawObj();
+ aLower = pObj->GetDrawObj();
if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
{
insert( aLower.GetDrawObject(), aLower );
@@ -81,9 +81,9 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
const SwSortedObjs *pObjs = rFrame.GetDrawObjs();
if ( pObjs )
{
- for( size_t i=0; i<pObjs->size(); ++i )
+ for(const SwAnchoredObject* pObj : *pObjs)
{
- aLower = (*pObjs)[i]->GetDrawObj();
+ aLower = pObj->GetDrawObj();
if ( aLower.IsBoundAsChar() &&
( !bVisibleChildrenOnly ||
aLower.AlwaysIncludeAsChild() ||
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index a82ea0130aa6..272b89f9357f 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -364,8 +364,8 @@ SwCalc::SwCalc( SwDoc& rD )
SwCalc::~SwCalc()
{
- for( sal_uInt16 n = 0; n < TBLSZ; ++n )
- delete VarTable[n];
+ for(SwHash* p : VarTable)
+ delete p;
if( pLclData != m_aSysLocale.GetLocaleDataPtr() )
delete pLclData;
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 105a4473bef4..6441245fc443 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -819,11 +819,9 @@ void FinitCore()
delete SwStyleNameMapper::m_pNumRuleProgMap;
// delete all default attributes
- for( sal_uInt16 n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
+ for(SfxPoolItem* pHt : aAttrTab)
{
- SfxPoolItem* pHt;
- if( nullptr != ( pHt = aAttrTab[n] ))
- delete pHt;
+ delete pHt;
}
::ClearFEShellTabCols();
@@ -837,8 +835,8 @@ void FinitCore()
delete[] SwAttrPool::pVersionMap6;
delete[] SwAttrPool::pVersionMap7;
- for ( size_t i = 0; i < pGlobalOLEExcludeList->size(); ++i )
- delete (*pGlobalOLEExcludeList)[i];
+ for (SvGlobalName* p : *pGlobalOLEExcludeList)
+ delete p;
delete pGlobalOLEExcludeList;
}
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 9d8ad587bf06..03486c3abe19 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -433,10 +433,9 @@ void SwSelPaintRects::HighlightInputField()
pCursorForInputTextField->FillRects();
SwRects* pRects = static_cast<SwRects*>(pCursorForInputTextField.get());
- for (size_t a(0); a < pRects->size(); ++a)
+ for (const SwRect & rNextRect : *pRects)
{
- const SwRect aNextRect((*pRects)[a]);
- const Rectangle aPntRect(aNextRect.SVRect());
+ const Rectangle aPntRect(rNextRect.SVRect());
aInputFieldRanges.push_back(basegfx::B2DRange(
aPntRect.Left(), aPntRect.Top(),
@@ -607,9 +606,8 @@ void SwShellCursor::Show()
if (comphelper::LibreOfficeKit::isActive())
{
std::vector<OString> aRect;
- for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
+ for (const OString & rSelectionRectangle : aSelectionRectangles)
{
- const OString& rSelectionRectangle = aSelectionRectangles[i];
if (rSelectionRectangle.isEmpty())
continue;
aRect.push_back(rSelectionRectangle);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 4e9177ca6899..eab114b71ee7 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -701,10 +701,10 @@ namespace
RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
- for( size_t n = 0; n < rArr.size(); ++n )
+ for(SaveRedline & rSvRedLine : rArr)
{
- rArr[ n ].SetPos( rPos );
- pDoc->getIDocumentRedlineAccess().AppendRedline( rArr[ n ].pRedl, true );
+ rSvRedLine.SetPos( rPos );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( rSvRedLine.pRedl, true );
}
pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
@@ -798,10 +798,10 @@ namespace
RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
- for( size_t n = 0; n < rArr.size(); ++n )
+ for(SaveRedline & rSvRedLine : rArr)
{
- rArr[ n ].SetPos( nInsPos );
- pDoc->getIDocumentRedlineAccess().AppendRedline( rArr[ n ].pRedl, true );
+ rSvRedLine.SetPos( nInsPos );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( rSvRedLine.pRedl, true );
}
pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
@@ -2260,9 +2260,8 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod
if( !aSavRedlInsPosArr.empty() )
{
SwNode* pNewNd = &aIdx.GetNode();
- for( size_t n = 0; n < aSavRedlInsPosArr.size(); ++n )
+ for(SwRangeRedline* pTmp : aSavRedlInsPosArr)
{
- SwRangeRedline* pTmp = aSavRedlInsPosArr[ n ];
if( m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().Contains( pTmp ) )
{
SwPosition* pEnd = pTmp->End();
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index eed622297f2f..8c638666e873 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1299,16 +1299,16 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime )
/*3*/ RES_FILENAMEFLD,
/*4*/ RES_DATETIMEFLD }; // MUST be at the end!
- for( sal_uInt16 nStt = 0; nStt < 5; ++nStt )
+ for(sal_uInt16 aType : aTypes)
{
- SwFieldType* pFieldType = GetSysFieldType( aTypes[ nStt ] );
+ SwFieldType* pFieldType = GetSysFieldType( aType );
SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType );
for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
{
if( pFormatField && pFormatField->GetTextField() )
{
bool bChgd = false;
- switch( aTypes[ nStt ] )
+ switch( aType )
{
case RES_DOCINFOFLD:
if( static_cast<SwDocInfoField*>(pFormatField->GetField())->IsFixed() )
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
index 73b891425b30..39a803263efe 100644
--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
+++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
@@ -64,9 +64,9 @@ namespace
::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks )
{
- for( ::sfx2::SvBaseLinks::size_type n = 0; n < rLinks.size(); ++n )
+ for(const auto & rLink : rLinks)
{
- ::sfx2::SvBaseLink* pLnk = &(*rLinks[ n ]);
+ ::sfx2::SvBaseLink* pLnk = &(*rLink);
if( pLnk &&
( OBJECT_CLIENT_GRF == pLnk->GetObjType() ||
OBJECT_CLIENT_FILE == pLnk->GetObjType() ) &&
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index bbb9fba6c623..99e9fcb6b4e1 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -72,14 +72,14 @@ using namespace com::sun::star;
const SwRedlineTable& rTable = redlineAccess.GetRedlineTable();
// verify valid redline positions
- for( size_t i = 0; i < rTable.size(); ++i )
- lcl_CheckPam( rTable[ i ] );
+ for(SwRangeRedline* i : rTable)
+ lcl_CheckPam( i );
- for( size_t j = 0; j < rTable.size(); ++j )
+ for(SwRangeRedline* j : rTable)
{
// check for empty redlines
- OSL_ENSURE( ( *(rTable[j]->GetPoint()) != *(rTable[j]->GetMark()) ) ||
- ( rTable[j]->GetContentIdx() != nullptr ),
+ OSL_ENSURE( ( *(j->GetPoint()) != *(j->GetMark()) ) ||
+ ( j->GetContentIdx() != nullptr ),
ERROR_PREFIX "empty redline" );
}
@@ -2614,9 +2614,8 @@ sal_uInt16 DocumentRedlineManager::InsertRedlineAuthor( const OUString& rNew )
void DocumentRedlineManager::UpdateRedlineAttr()
{
const SwRedlineTable& rTable = GetRedlineTable();
- for( size_t n = 0; n < rTable.size(); ++n )
+ for(SwRangeRedline* pRedl : rTable)
{
- SwRangeRedline* pRedl = rTable[ n ];
if( pRedl->IsVisible() )
pRedl->InvalidateRange();
}
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 66254f434d5a..b3ced5d3825c 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -120,16 +120,16 @@ namespace
{ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
{ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
};
- for( sal_uInt16 n = 0; n < 3; ++n )
+ for(const auto & n : aArr)
{
sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem(
- aArr[n].nResLngId )).GetLanguage();
+ n.nResLngId )).GetLanguage();
vcl::Font aFnt( OutputDevice::GetDefaultFont( nFntType,
nLng, GetDefaultFontFlags::OnlyOne ) );
rSet.Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(),
OUString(), aFnt.GetPitch(),
- aFnt.GetCharSet(), aArr[n].nResFntId ));
+ aFnt.GetCharSet(), n.nResFntId ));
}
}
@@ -149,16 +149,16 @@ namespace
aArr[1].nFntType = nCJKFntType;
aArr[2].nFntType = nCTLFntType;
- for( sal_uInt16 n = 0; n < 3; ++n )
+ for(const auto & n : aArr)
{
sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem(
- aArr[n].nResLngId )).GetLanguage();
- vcl::Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
+ n.nResLngId )).GetLanguage();
+ vcl::Font aFnt( OutputDevice::GetDefaultFont( n.nFntType,
nLng, GetDefaultFontFlags::OnlyOne ) );
rSet.Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(),
OUString(), aFnt.GetPitch(),
- aFnt.GetCharSet(), aArr[n].nResFntId ));
+ aFnt.GetCharSet(), n.nResFntId ));
}
}
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 8d8c7ebe9238..634d587b3574 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -357,9 +357,9 @@ bool SwAutoCompleteWord::GetWordsMatching(const OUString& aMatch, std::vector<OU
return false;
}
- for (size_t i = 0; i < suggestions.size(); i++)
+ for (const OUString & suggestion : suggestions)
{
- aWords.push_back( suggestions[i] );
+ aWords.push_back( suggestion );
}
return true;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2c54cfe95b9d..7850ffa4b905 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -982,9 +982,8 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
// now fill the vector for calculating the page pairs with the start frames
// from the above obtained vector
std::vector< const SwPageFrame * > aVec;
- for ( std::vector< sal_Int32 >::size_type i = 0; i < aPagesToPrint.size(); ++i)
+ for (sal_Int32 nPage : aPagesToPrint)
{
- const sal_Int32 nPage = aPagesToPrint[i];
const SwPageFrame *pFrame = validStartFrames[ nPage ];
aVec.push_back( pFrame );
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d87b9d567081..2c79ac1bdad9 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1161,12 +1161,12 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
};
xmlTextWriterStartElement(pWriter, BAD_CAST("markManager"));
- for (size_t i = 0; i < SAL_N_ELEMENTS(aContainers); ++i)
+ for (const auto & rContainer : aContainers)
{
- if (!aContainers[i].pContainer->empty())
+ if (!rContainer.pContainer->empty())
{
- xmlTextWriterStartElement(pWriter, BAD_CAST(aContainers[i].pName));
- for (const_iterator_t it = aContainers[i].pContainer->begin(); it != aContainers[i].pContainer->end(); ++it)
+ xmlTextWriterStartElement(pWriter, BAD_CAST(rContainer.pName));
+ for (const_iterator_t it = rContainer.pContainer->begin(); it != rContainer.pContainer->end(); ++it)
(*it)->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
@@ -1330,11 +1330,9 @@ void DelBookmarks(
// which holds all position information as offset.
// Assignement happens after moving.
SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- for(SwRedlineTable::size_type nCnt = 0; nCnt < rTable.size(); ++nCnt )
+ for(SwRangeRedline* pRedl : rTable)
{
// Is at position?
- SwRangeRedline* pRedl = rTable[ nCnt ];
-
SwPosition *const pRStt = pRedl->Start();
SwPosition *const pREnd = pRedl->End();
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 3592073ef72f..fa2ca527c2bf 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -2079,9 +2079,8 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
const SwRedlineTable& rSrcRedlTable = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTable();
sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
- for( SwRedlineTable::size_type n = 0; n < rSrcRedlTable.size(); ++n )
+ for(const SwRangeRedline* pRedl : rSrcRedlTable)
{
- const SwRangeRedline* pRedl = rSrcRedlTable[ n ];
sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex();
RedlineType_t eType = pRedl->GetType();
if( nEndOfExtra < nNd &&
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 9496e968cfd9..4c440b8b3721 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -305,10 +305,10 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
{ // fix the Redlines
SwRedlineTable& rTable = getIDocumentRedlineAccess().GetRedlineTable();
SwPosition aNewPos(rNewPos);
- for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n )
+ for(SwRangeRedline* p : rTable)
{
// lies on the position ??
- lcl_PaMCorrRel1( rTable[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset );
+ lcl_PaMCorrRel1( p, &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset );
}
// To-Do - need to add here 'SwExtraRedlineTable' also ?
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 44c7b2670072..34df1d459d72 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -579,11 +579,11 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel)
}
}
- for (SwPageDescs::size_type j = 0; j < m_PageDescs.size(); ++j)
+ for (std::unique_ptr<SwPageDesc> & rpPageDesc : m_PageDescs)
{
- if (m_PageDescs[j]->GetFollow() == pDel)
+ if (rpPageDesc->GetFollow() == pDel)
{
- m_PageDescs[j]->SetFollow(nullptr);
+ rpPageDesc->SetFollow(nullptr);
if( bHasLayout )
{
for( auto aLayout : GetAllLayouts() )
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index ad4c8dbdccf7..0f55ea6b3724 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -57,10 +57,9 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
const SwNodeIndex* pInsertPos )
{
SwPosition aPos( rSttIdx );
- for( size_t n = 0; n < rArr.size(); ++n )
+ for(SaveFly & rSave : rArr)
{
// create new anchor
- SaveFly& rSave = rArr[n];
SwFrameFormat* pFormat = rSave.pFrameFormat;
if( rSave.bInsertPosition )
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 2734f8dcdf58..35e3696fc8aa 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -701,9 +701,9 @@ OUString SwDoc::ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
const OUString sNewName( lcl_CutOffDBCommandType(rNewName) );
OUString sFormula(rFormula);
- for( size_t i = 0; i < rUsedDBNames.size(); ++i )
+ for(const auto & rUsedDBName : rUsedDBNames)
{
- const OUString sDBName( lcl_CutOffDBCommandType(rUsedDBNames[i]) );
+ const OUString sDBName( lcl_CutOffDBCommandType(rUsedDBName) );
if (sDBName!=sNewName)
{
@@ -1176,8 +1176,8 @@ SwDocUpdateField::~SwDocUpdateField()
{
delete pFieldSortLst;
- for( int n = 0; n < TBLSZ; ++n )
- delete aFieldTypeTable[n];
+ for(SwCalcFieldType* p : aFieldTypeTable)
+ delete p;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index eb2f5d5638c2..332cb3d9b7e4 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -137,12 +137,12 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
const SfxPoolItem* pItem;
sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
- for (int n = 0; n < 3; ++n)
+ for (sal_uInt16 aSavId : aSavIds)
{
- if (SfxItemState::SET == pAttrSetOfNode->GetItemState(aSavIds[n], false, &pItem))
+ if (SfxItemState::SET == pAttrSetOfNode->GetItemState(aSavId, false, &pItem))
{
bool bSave = false;
- switch( aSavIds[ n ] )
+ switch( aSavId )
{
case RES_PAGEDESC:
bSave = nullptr != static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc();
@@ -157,7 +157,7 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
if( bSave )
{
aSavedAttrsSet.Put(*pItem);
- aClearWhichIds.push_back(aSavIds[n]);
+ aClearWhichIds.push_back(aSavId);
}
}
}
@@ -1972,9 +1972,8 @@ std::set<Color> SwDoc::GetDocColors()
std::set<Color> aDocColors;
SwAttrPool& rPool = GetAttrPool();
const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND};
- for (size_t i=0; i<SAL_N_ELEMENTS(pAttribs); i++)
+ for (sal_uInt16 nAttrib : pAttribs)
{
- const sal_uInt16 nAttrib = pAttribs[i];
const sal_uInt32 nCount = rPool.GetItemCount2(nAttrib);
for (sal_uInt32 j=0; j<nCount; j++)
{
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 3c9929f62292..3b0aff2f1a34 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -547,9 +547,8 @@ SwPosFlyFrames SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso,
if( pPage->GetSortedObjs() )
{
const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for( size_t i = 0; i < rObjs.size(); ++i)
+ for(SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
SwFrameFormat *pFly;
if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) != nullptr )
pFly = &(pAnchoredObj->GetFrameFormat());
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index bf8703fa89e7..db6ccf9a77ce 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1936,10 +1936,8 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
// All, that are in the to-be-deleted Node, need to be
// moved to the next Node
- for( size_t n = 0; n < getIDocumentRedlineAccess().GetRedlineTable().size(); ++n )
+ for(SwRangeRedline* pTmp : getIDocumentRedlineAccess().GetRedlineTable())
{
- SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTable()[ n ];
-
SwPosition* pPos;
if( ( pPos = &pTmp->GetBound())->nNode == aIdx )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 1f9e8eff90d7..39ecb4cf32cc 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1122,9 +1122,8 @@ void SwRangeRedline::MoveToSection()
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n )
+ for(SwRangeRedline* pRedl : rTable)
{
- SwRangeRedline* pRedl = rTable[ n ];
if( pRedl->GetBound() == *pStt )
pRedl->GetBound() = *pEnd;
if( pRedl->GetBound(false) == *pStt )
@@ -1270,9 +1269,8 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n )
+ for(SwRangeRedline* pRedl : rTable)
{
- SwRangeRedline* pRedl = rTable[ n ];
if( pRedl->GetBound() == *pStt )
pRedl->GetBound() = *pEnd;
if( pRedl->GetBound(false) == *pStt )
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d7a239e082a2..0b9138ca3a27 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -228,9 +228,8 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark,
SwTOXMarks aMarks;
SwTOXMark::InsertTOXMarks( aMarks, *pType );
- for( size_t nMark=0; nMark<aMarks.size(); ++nMark )
+ for(SwTOXMark* pTOXMark : aMarks)
{
- const SwTOXMark* pTOXMark = aMarks[nMark];
if ( pTOXMark == &rCurTOXMark )
continue;
@@ -1359,9 +1358,8 @@ static long lcl_IsSOObject( const SvGlobalName& rFactoryNm )
long nRet = 0;
for( const SoObjType* pArr = aArr; !nRet && pArr->nFlag; ++pArr )
- for ( int n = 0; n < 4; ++n )
+ for (auto & rId : pArr->aGlNmIds)
{
- const SoObjType::GlobalNameIds& rId = pArr->aGlNmIds[ n ];
if( !rId.n1 )
break;
SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index a6cbb5e8c8b7..459584709fff 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -487,8 +487,8 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
SwNumRule::~SwNumRule()
{
- for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
- delete maFormats[ n ];
+ for(SwNumFormat* p : maFormats)
+ delete p;
if (mpNumRuleMap)
{
@@ -521,17 +521,17 @@ SwNumRule::~SwNumRule()
void SwNumRule::CheckCharFormats( SwDoc* pDoc )
{
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ for(SwNumFormat*& rpNumFormat : maFormats)
{
SwCharFormat* pFormat;
- if( maFormats[ n ] && nullptr != ( pFormat = maFormats[ n ]->GetCharFormat() ) &&
+ if( rpNumFormat && nullptr != ( pFormat = rpNumFormat->GetCharFormat() ) &&
pFormat->GetDoc() != pDoc )
{
// copy
- SwNumFormat* pNew = new SwNumFormat( *maFormats[ n ] );
+ SwNumFormat* pNew = new SwNumFormat( *rpNumFormat );
pNew->SetCharFormat( pDoc->CopyCharFormat( *pFormat ) );
- delete maFormats[ n ];
- maFormats[ n ] = pNew;
+ delete rpNumFormat;
+ rpNumFormat = pNew;
}
}
}
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
index 7705280eb910..6dec43953f34 100644
--- a/sw/source/core/doc/sortopt.cxx
+++ b/sw/source/core/doc/sortopt.cxx
@@ -59,9 +59,9 @@ SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
bTable( rOpt.bTable ),
bIgnoreCase( rOpt.bIgnoreCase )
{
- for( size_t i=0; i < rOpt.aKeys.size(); ++i )
+ for(SwSortKey* pKey : rOpt.aKeys)
{
- SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]);
+ SwSortKey* pNew = new SwSortKey(*pKey);
aKeys.push_back( pNew );
}
}
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index a9e3d58abdb1..414895b13e1d 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -611,8 +611,8 @@ SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew )
, m_aKeepWithNextPara( false, RES_KEEP )
, m_aShadow( RES_SHADOW )
{
- for( sal_uInt8 n = 0; n < 16; ++n )
- aBoxAutoFormat[ n ] = nullptr;
+ for(SwBoxAutoFormat* & rp : aBoxAutoFormat)
+ rp = nullptr;
*this = rNew;
}
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 43908dab32da..61402fe02c94 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -162,9 +162,8 @@ std::set<const SwFrameFormat*> SwTextBoxHelper::findTextBoxes(const SwNode& rNod
const SwSortedObjs* pSortedObjs = pContentFrame->GetDrawObjs();
if (pSortedObjs)
{
- for (std::size_t i = 0; i < pSortedObjs->size(); ++i)
+ for (SwAnchoredObject* pAnchoredObject : *pSortedObjs)
{
- SwAnchoredObject* pAnchoredObject = (*pSortedObjs)[i];
SwFrameFormat* pTextBox = findTextBox(&pAnchoredObject->GetFrameFormat());
if (pTextBox)
aRet.insert(pTextBox);
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 1a2026a70e7d..2a77eaa683e3 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1514,9 +1514,9 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance )
}
}
nWish /= nCnt;
- for ( size_t i = 0; i < aWish.size(); ++i )
- if ( aWish[i] )
- aWish[i] = nWish;
+ for (sal_uInt16 & rn : aWish)
+ if ( rn )
+ rn = nWish;
}
const long nOldRight = aTabCols.GetRight();
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 853c40aacfc4..b9ef741b2d35 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -491,10 +491,10 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
}
if ( pFlyFrame->GetDrawObjs() )
{
- for ( size_t i = 0; i < pFlyFrame->GetDrawObjs()->size(); ++i)
+ for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
{
// #i28701# - consider type of objects in sorted object list.
- SdrObject* pObj = (*pFlyFrame->GetDrawObjs())[i]->DrawObj();
+ SdrObject* pObj = i->DrawObj();
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
pContact->MoveObjToVisibleLayer( pObj );
}
@@ -526,10 +526,10 @@ void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
pFlyFrame->DeleteCnt();
if ( pFlyFrame->GetDrawObjs() )
{
- for ( size_t i = 0; i < pFlyFrame->GetDrawObjs()->size(); ++i)
+ for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
{
// #i28701# - consider type of objects in sorted object list.
- SdrObject* pObj = (*pFlyFrame->GetDrawObjs())[i]->DrawObj();
+ SdrObject* pObj = i->DrawObj();
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
pContact->MoveObjToInvisibleLayer( pObj );
}
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index ba896341f825..495485c82bdd 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -259,9 +259,9 @@ SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
if ( pPage->GetSortedObjs() )
{
size_t nOrdNum = 0;
- for ( size_t i = 0; i < pPage->GetSortedObjs()->size(); ++i )
+ for (SwAnchoredObject* i : *pPage->GetSortedObjs())
{
- const SdrObject *pO = (*pPage->GetSortedObjs())[i]->GetDrawObj();
+ const SdrObject *pO = i->GetDrawObj();
if ( pO->GetOrdNumDirect() > nOrdNum )
{
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 866f8122136c..c921e7fd8fc5 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -430,9 +430,8 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
Point aCenter( pOld->Frame().Left() + pOld->Frame().Width()/2,
pOld->Frame().Top() + pOld->Frame().Height()/2 );
Point aBest;
- for( size_t i = 0; i<pPage->GetSortedObjs()->size(); ++i )
+ for(SwAnchoredObject* pAnchObj : *pPage->GetSortedObjs())
{
- SwAnchoredObject* pAnchObj = (*pPage->GetSortedObjs())[i];
if( dynamic_cast<const SwFlyFrame*>( pAnchObj) != nullptr )
{
SwFlyFrame* pTmp = static_cast<SwFlyFrame*>(pAnchObj);
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index 0e6c46a2846a..36d24d31a0b7 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -455,9 +455,8 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOfOtherObjs() const
const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
if ( pObjs->size() > 1 )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
if ( pAnchoredObj != this &&
pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
{
@@ -630,9 +629,8 @@ void SwAnchoredObject::UpdateObjInSortedList()
{
const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
// determine start index
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
else
@@ -757,9 +755,8 @@ void SwAnchoredObject::SetTmpConsiderWrapInfluenceOfOtherObjs()
const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
if ( pObjs->size() > 1 )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
if ( pAnchoredObj != this )
{
pAnchoredObj->SetTmpConsiderWrapInfluence( true/*bTmpConsiderWrapInfluence*/ );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 6190be784b1d..33753581c4bf 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2987,11 +2987,10 @@ void SwFlyFrameFormat::MakeFrames()
{
// #i28701# - new type <SwSortedObjs>
SwSortedObjs &rObjs = *pFrame->GetDrawObjs();
- for( size_t i = 0; i < rObjs.size(); ++i)
+ for(SwAnchoredObject* pObj : rObjs)
{
// #i28701# - consider changed type of
// <SwSortedObjs> entries.
- SwAnchoredObject* pObj = rObjs[i];
if( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr &&
(&pObj->GetFrameFormat()) == this )
{
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index fc9f0f6a0716..c54c7efb7bb8 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -612,11 +612,10 @@ static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, const SwFrame* pFrame,
{
// And then there can be paragraph anchored frames that sit below their paragraph.
long nMax = 0;
- for ( size_t i = 0; i < pSortedObjs->size(); ++i )
+ for (SwAnchoredObject* pObj : *pSortedObjs)
{
// #i28701# - consider changed type of <SwSortedObjs>
// entries.
- SwAnchoredObject* pObj = (*pSortedObjs)[i];
long nTmp = 0;
if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index c9698bd34fb1..39a9113a61bd 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1060,11 +1060,10 @@ bool SwFlowFrame::IsPrevObjMove() const
// #i26945# - re-factoring
// use <GetVertPosOrientFrame()> to determine, if object has followed the
// text flow to the next layout frame
- for ( size_t i = 0; i < pPre->GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pObj : *pPre->GetDrawObjs())
{
// #i28701# - consider changed type of
// <SwSortedObjs> entries.
- const SwAnchoredObject* pObj = (*pPre->GetDrawObjs())[i];
// OD 2004-01-20 #110582# - do not consider hidden objects
// #i26945# - do not consider object, which
// doesn't follow the text flow.
@@ -2257,9 +2256,8 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
// has restarted the layout process.
else if ( m_rThis.GetDrawObjs() )
{
- for ( size_t i = 0; i < m_rThis.GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *m_rThis.GetDrawObjs())
{
- SwAnchoredObject* pAnchoredObj = (*m_rThis.GetDrawObjs())[i];
// #i47697# - refine condition - see above
if ( pAnchoredObj->RestartLayoutProcess() &&
!pAnchoredObj->IsTmpConsiderWrapInfluence() )
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index c87bf59d8e9e..66c131d80f6d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2187,9 +2187,8 @@ void SwFrame::InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs )
// page.
const SwPageFrame* pPageFrame = FindPageFrame();
// #i28701# - re-factoring
- for ( size_t i = 0; i < GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *GetDrawObjs())
{
- SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
if ( _bNoInvaOfAsCharAnchoredObjs &&
(pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
== FLY_AS_CHAR) )
@@ -2254,9 +2253,8 @@ void SwLayoutFrame::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
if ( pPageFrame && pPageFrame->GetSortedObjs() )
{
SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
// #i26945# - check, if anchored object is a lower
// of the layout frame is changed to check, if its anchor frame
// is a lower of the layout frame.
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 12232ccba490..9fbc5d27641c 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -145,9 +145,9 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
{
SwFrameFormat* pMyFlyFrameFormat( &GetFrameFormat() );
SwSortedObjs &rObjs = *pContent->GetDrawObjs();
- for( size_t i = 0; i < rObjs.size(); ++i)
+ for(SwAnchoredObject* rObj : rObjs)
{
- SwFlyFrame* pFlyFrame = dynamic_cast<SwFlyFrame*>(rObjs[i]);
+ SwFlyFrame* pFlyFrame = dynamic_cast<SwFlyFrame*>(rObj);
if ( pFlyFrame &&
&(pFlyFrame->GetFrameFormat()) == pMyFlyFrameFormat )
{
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index fd7b5c3e656d..3f6a87c6ed37 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -616,9 +616,8 @@ void SwPageFrame::AppendFlyToPage( SwFlyFrame *pNew )
if ( pNew->GetDrawObjs() )
{
SwSortedObjs &rObjs = *pNew->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pTmpObj : rObjs)
{
- SwAnchoredObject* pTmpObj = rObjs[i];
if ( dynamic_cast<const SwFlyFrame*>( pTmpObj) != nullptr )
{
SwFlyFrame* pTmpFly = static_cast<SwFlyFrame*>(pTmpObj);
@@ -764,9 +763,8 @@ void SwPageFrame::MoveFly( SwFlyFrame *pToMove, SwPageFrame *pDest )
if ( pToMove->GetDrawObjs() )
{
SwSortedObjs &rObjs = *pToMove->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 96f513cb68fd..4cfcdf7d0329 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -255,13 +255,12 @@ SwFrameNotify::~SwFrameNotify()
{
const SwSortedObjs &rObjs = *mpFrame->GetDrawObjs();
SwPageFrame* pPageFrame = nullptr;
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
// OD 2004-03-31 #i26791# - no general distinction between
// Writer fly frames and drawing objects
bool bNotify = false;
bool bNotifySize = false;
- SwAnchoredObject* pObj = rObjs[i];
SwContact* pContact = ::GetUserCall( pObj->GetDrawObj() );
const bool bAnchoredAsChar = pContact->ObjAnchoredAsChar();
if ( !bAnchoredAsChar )
@@ -986,9 +985,8 @@ SwContentNotify::~SwContentNotify()
pMasterFrame->GetDrawObjs() )
{
SwSortedObjs* pObjs = pMasterFrame->GetDrawObjs();
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
== FLY_AT_CHAR )
{
@@ -2242,9 +2240,9 @@ void SwOrderIter::Top()
{
sal_uInt32 nTopOrd = 0;
(*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* i : *pObjs)
{
- const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
+ const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
@@ -2268,9 +2266,9 @@ const SdrObject *SwOrderIter::Bottom()
if ( pObjs->size() )
{
(*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* i : *pObjs)
{
- const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
+ const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
@@ -2296,9 +2294,9 @@ const SdrObject *SwOrderIter::Next()
if ( pObjs->size() )
{
(*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* i : *pObjs)
{
- const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
+ const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
@@ -2324,9 +2322,9 @@ void SwOrderIter::Prev()
{
sal_uInt32 nOrd = 0;
(*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* i : *pObjs)
{
- const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
+ const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
@@ -2354,9 +2352,8 @@ static void lcl_RemoveObjsFromPage( SwFrame* _pFrame )
{
OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_RemoveObjsFromPage." );
SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
// #115759# - reset member, at which the anchored
// object orients its vertical position
pObj->ClearVertPosOrientFrame();
@@ -2517,10 +2514,8 @@ static void lcl_AddObjsToPage( SwFrame* _pFrame, SwPageFrame* _pPage )
{
OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_AddObjsToPage." );
SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
-
// #115759# - unlock position of anchored object
// in order to get the object's position calculated.
pObj->UnlockPosition();
@@ -2712,9 +2707,8 @@ SwPageFrame * InsertNewPage( SwPageDesc &rDesc, SwFrame *pUpper,
static void lcl_Regist( SwPageFrame *pPage, const SwFrame *pAnch )
{
SwSortedObjs *pObjs = const_cast<SwSortedObjs*>(pAnch->GetDrawObjs());
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pObj : *pObjs)
{
- SwAnchoredObject* pObj = (*pObjs)[i];
if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
@@ -2886,9 +2880,8 @@ static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrame *pCnt,
if ( pCnt->GetDrawObjs() )
{
const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
@@ -3020,9 +3013,8 @@ void Notify_Background( const SdrObject* pObj,
{
pObj->GetOrdNum();
const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) != nullptr )
{
if( pAnchoredObj->GetDrawObj() == pObj )
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 698dff853ba6..38290c844fbb 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1903,10 +1903,8 @@ void SwFootnoteBossFrame::MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool b
// #i21478# - keep last inserted footnote in order to
// format the content of the following one.
SwFootnoteFrame* pLastInsertedFootnote = nullptr;
- for ( size_t i = 0; i < rFootnoteArr.size(); ++i )
+ for (SwFootnoteFrame* pFootnote : rFootnoteArr)
{
- SwFootnoteFrame *pFootnote = rFootnoteArr[i];
-
SwFootnoteBossFrame* pRefBoss = pFootnote->GetRef()->FindFootnoteBossFrame( true );
if( pRefBoss != this )
{
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 9ead11e003bb..de3b7d8f1826 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -419,9 +419,8 @@ static void unlockPositionOfObjects( SwPageFrame *pPageFrame )
SwSortedObjs* pObjs = pPageFrame->GetSortedObjs();
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pObj : *pObjs)
{
- SwAnchoredObject* pObj = (*pObjs)[i];
pObj->UnlockPosition();
}
}
@@ -914,9 +913,8 @@ static const SwFrame *lcl_FindFirstInvaContent( const SwLayoutFrame *pLay, long
if ( pCnt->GetDrawObjs() )
{
const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- const SwAnchoredObject* pObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
{
const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pObj);
@@ -950,9 +948,8 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrame* _pPage,
{
OSL_ENSURE( _pPage->GetSortedObjs(), "FindFirstInvaObj, no Objs" );
- for ( size_t i = 0; i < _pPage->GetSortedObjs()->size(); ++i )
+ for (SwAnchoredObject* pObj : *_pPage->GetSortedObjs())
{
- const SwAnchoredObject* pObj = (*_pPage->GetSortedObjs())[i];
if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
{
const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pObj);
@@ -1158,9 +1155,8 @@ bool SwLayAction::IsShortCut( SwPageFrame *&prPage )
static_cast<SwPageFrame*>(prPage->GetPrev())->GetSortedObjs();
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pObj : *pObjs)
{
- SwAnchoredObject* pObj = (*pObjs)[i];
if ( pObj->GetAnchorFrameContainingAnchPos() == pContent )
{
bRet = false;
@@ -1971,9 +1967,8 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
if ( pCnt->GetDrawObjs() )
{
const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwAnchoredObject* pObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
{
SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index f7867dcc8141..44d4fd5a42cc 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -275,9 +275,8 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
if( pPage->GetSortedObjs() )
{
SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj))
{
if( pFly->Frame().Left() != FAR_AWAY &&
@@ -939,9 +938,8 @@ void SwLayHelper::CheckFlyCache_( SwPageFrame* pPage )
// sort objects on this page by ordnum
std::set< const SdrObject*, SdrObjectCompare > aFlySet;
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj)) // a text frame?
{
if( pFly->GetAnchorFrame() &&
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index 288496cafb62..18efbe1ac51f 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -104,9 +104,8 @@ void SwEndnoter::CollectEndnote( SwFootnoteFrame* pFootnote )
}
else if( pEndArr )
{
- for ( size_t i = 0; i < pEndArr->size(); ++i )
+ for (SwFootnoteFrame* pEndFootnote : *pEndArr)
{
- SwFootnoteFrame *pEndFootnote = (*pEndArr)[i];
if( pEndFootnote->GetAttr() == pFootnote->GetAttr() )
{
SwFrame::DestroyFrame(pFootnote);
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx
index e49d700bf9f2..b59b9f57668a 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -769,9 +769,8 @@ bool SwObjectFormatterTextFrame::AtLeastOneObjIsTmpConsiderWrapInfluence()
const SwSortedObjs* pObjs = GetAnchorFrame().GetDrawObjs();
if ( pObjs && pObjs->size() > 1 )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
{
bRet = true;
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 278894cd6080..beb603900471 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -236,9 +236,8 @@ void SwPageFrame::DestroyImpl()
{
// Objects can be anchored at pages that are before their anchors (why ever...).
// In such cases, we would access already freed memory.
- for ( size_t i = 0; i < m_pSortedObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *m_pSortedObjs)
{
- SwAnchoredObject* pAnchoredObj = (*m_pSortedObjs)[i];
pAnchoredObj->SetPageFrame( nullptr );
}
delete m_pSortedObjs;
@@ -910,10 +909,9 @@ static void lcl_PrepFlyInCntRegister( SwContentFrame *pFrame )
pFrame->Prepare( PREP_REGISTER );
if( pFrame->GetDrawObjs() )
{
- for( size_t i = 0; i < pFrame->GetDrawObjs()->size(); ++i )
+ for(SwAnchoredObject* pAnchoredObj : *pFrame->GetDrawObjs())
{
// #i28701#
- SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i];
if ( dynamic_cast< const SwFlyInContentFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame* pFly = static_cast<SwFlyInContentFrame*>(pAnchoredObj);
@@ -940,10 +938,9 @@ void SwPageFrame::PrepareRegisterChg()
}
if( GetSortedObjs() )
{
- for( size_t i = 0; i < GetSortedObjs()->size(); ++i )
+ for(SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
{
// #i28701#
- SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
@@ -1767,9 +1764,8 @@ static void lcl_MoveAllLowerObjs( SwFrame* pFrame, const Point& rOffset )
// note: pSortedObj elements may be removed and inserted from
// MoveObjectIfActive(), invalidating iterators
- for (size_t i = 0; i < pSortedObj->size(); ++i)
+ for (SwAnchoredObject* pAnchoredObj : *pSortedObj)
{
- SwAnchoredObject *const pAnchoredObj = (*pSortedObj)[i];
const SwFrameFormat& rObjFormat = pAnchoredObj->GetFrameFormat();
const SwFormatAnchor& rAnchor = rObjFormat.GetAnchor();
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index b9ab3aa3c7e5..66966758119d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4613,9 +4613,8 @@ static void lcl_PaintShadow( const SwRect& rRect, SwRect& rOutRect,
pOut->SetDrawMode( nOldDrawMode );
- for ( size_t i = 0; i < aRegion.size(); ++i )
+ for (SwRect & rOut : aRegion)
{
- SwRect &rOut = aRegion[i];
aOut = rOut;
if ( rRect.IsOver( aOut ) && aOut.Height() > 0 && aOut.Width() > 0 )
{
@@ -6766,9 +6765,8 @@ void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
else if ( pLow->GetDrawObjs() )
{
const SwSortedObjs& rObjs = *(pLow->GetDrawObjs());
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- const SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( pPage->GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(
pAnchoredObj->GetDrawObj()->GetLayer() ) &&
dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
@@ -7248,9 +7246,8 @@ void SwPageFrame::RefreshExtraData( const SwRect &rRect ) const
SwLayoutFrame::RefreshExtraData( aRect );
if ( bLineInFly && GetSortedObjs() )
- for ( size_t i = 0; i < GetSortedObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
{
- const SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
@@ -7283,9 +7280,8 @@ void SwLayoutFrame::RefreshExtraData( const SwRect &rRect ) const
static_cast<const SwTextFrame*>(pCnt)->PaintExtraData( rRect );
}
if ( bLineInFly && pCnt->GetDrawObjs() )
- for ( size_t i = 0; i < pCnt->GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pCnt->GetDrawObjs())
{
- const SwAnchoredObject* pAnchoredObj = (*pCnt->GetDrawObjs())[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index c24282ca5706..833536864eb0 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1105,10 +1105,8 @@ class ExtraFormatToPositionObjs
SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
-
if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
pAnchoredObj->SetKeepPosLocked( false );
@@ -1124,10 +1122,8 @@ class ExtraFormatToPositionObjs
SwSortedObjs* pObjs = rFrame.GetDrawObjs();
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
-
pAnchoredObj->UnlockPosition();
pAnchoredObj->SetClearedEnvironment( false );
}
@@ -1199,10 +1195,8 @@ class ExtraFormatToPositionObjs
SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
-
if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
pAnchoredObj->SetKeepPosLocked( true );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index f645fcdde313..e87418fc6a6e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -275,10 +275,8 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrame& _rLayoutFrame,
}
if ( pLowerFrame->GetDrawObjs() )
{
- for ( size_t i = 0; i < pLowerFrame->GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pLowerFrame->GetDrawObjs())
{
- SwAnchoredObject* pAnchoredObj = (*pLowerFrame->GetDrawObjs())[i];
-
// invalidate position of anchored object
pAnchoredObj->SetTmpConsiderWrapInfluence( false );
pAnchoredObj->SetConsiderForTextWrap( false );
@@ -3676,13 +3674,12 @@ long CalcHeightWithFlys( const SwFrame *pFrame )
}
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- const SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
// #i26945# - if <pTmp> is follow, the
// anchor character frame has to be <pTmp>.
if ( bIsFollow &&
- const_cast<SwAnchoredObject*>(pAnchoredObj)->FindAnchorCharFrame() != pTmp )
+ pAnchoredObj->FindAnchorCharFrame() != pTmp )
{
continue;
}
@@ -4891,9 +4888,8 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
if ( pPg->GetSortedObjs() )
{
SwRect aRect( Prt() ); aRect += Frame().Pos();
- for ( size_t i = 0; i < pPg->GetSortedObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pPg->GetSortedObjs())
{
- const SwAnchoredObject* pAnchoredObj = (*pPg->GetSortedObjs())[i];
SwRect aTmp( pAnchoredObj->GetObjRect() );
if ( aTmp.IsOver( aRect ) )
{
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a1598d821141..a102300b8ba1 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -380,9 +380,8 @@ bool SwPageFrame::FillSelection( SwSelectionList& rList, const SwRect& rRect ) c
if( GetSortedObjs() )
{
const SwSortedObjs &rObjs = *GetSortedObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- const SwAnchoredObject* pAnchoredObj = rObjs[i];
if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr )
continue;
const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
@@ -1905,10 +1904,9 @@ bool SwRootFrame::MakeTableCursors( SwTableCursor& rTableCursor )
const bool bReadOnlyAvailable = rTableCursor.IsReadOnlyAvailable();
- for ( size_t i = 0; i < aUnions.size(); ++i )
+ for (SwSelUnion & rUnion : aUnions)
{
- SwSelUnion *pUnion = &aUnions[i];
- const SwTabFrame *pTable = pUnion->GetTable();
+ const SwTabFrame *pTable = rUnion.GetTable();
// Skip any repeated headlines in the follow:
SwLayoutFrame* pRow = pTable->IsFollow() ?
@@ -1917,14 +1915,14 @@ bool SwRootFrame::MakeTableCursors( SwTableCursor& rTableCursor )
while ( pRow )
{
- if ( pRow->Frame().IsOver( pUnion->GetUnion() ) )
+ if ( pRow->Frame().IsOver( rUnion.GetUnion() ) )
{
const SwLayoutFrame *pCell = pRow->FirstCell();
while ( pCell && pRow->IsAnLower( pCell ) )
{
OSL_ENSURE( pCell->IsCellFrame(), "Frame without cell" );
- if( IsFrameInTableSel( pUnion->GetUnion(), pCell ) &&
+ if( IsFrameInTableSel( rUnion.GetUnion(), pCell ) &&
(bReadOnlyAvailable ||
!pCell->GetFormat()->GetProtect().IsContentProtected()))
{
@@ -2571,9 +2569,8 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
if ( pPage->GetSortedObjs() )
{
const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr )
continue;
const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 9f04d848aff7..52042e9d0f93 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1518,9 +1518,8 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
{
const SwSortedObjs &rObjs = *pBoss->GetDrawObjs();
OSL_ENSURE( pBoss->IsPageFrame(), "Header/Footer out of page?" );
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
@@ -1882,9 +1881,8 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
const SwSortedObjs* pSorted = pPage ? pPage->GetSortedObjs() : nullptr;
if( pSorted )
{
- for ( size_t i = 0; i < pSorted->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pSorted)
{
- const SwAnchoredObject* pAnchoredObj = (*pSorted)[i];
const SwRect aBound( pAnchoredObj->GetObjRectWithSpaces() );
if( aBound.Left() > aRect.Right() )
@@ -3059,9 +3057,8 @@ void SwLayoutFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBord
static void InvaPercentFlys( SwFrame *pFrame, SwTwips nDiff )
{
OSL_ENSURE( pFrame->GetDrawObjs(), "Can't find any Objects" );
- for ( size_t i = 0; i < pFrame->GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pFrame->GetDrawObjs())
{
- SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
@@ -3315,10 +3312,8 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs,
SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
if ( pObjs )
{
- for ( size_t i = 0; i < pObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
-
if ( IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
pAnchoredObj->SetTmpConsiderWrapInfluence( false );
@@ -3511,10 +3506,8 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs,
SwSortedObjs* pTmpObjs = pTmpPageFrame ? pTmpPageFrame->GetSortedObjs() : nullptr;
if ( pTmpObjs )
{
- for ( size_t i = 0; i < pTmpObjs->size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : *pTmpObjs)
{
- SwAnchoredObject* pAnchoredObj = (*pTmpObjs)[i];
-
if ( IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
pAnchoredObj->SetTmpConsiderWrapInfluence( false );
@@ -3666,9 +3659,8 @@ static void lcl_InvalidateContent( SwContentFrame *pCnt, SwInvalidateFlags nInv
static void lcl_InvalidateAllContent( SwContentFrame *pCnt, SwInvalidateFlags nInv )
{
SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
@@ -3698,9 +3690,8 @@ void SwRootFrame::InvalidateAllContent( SwInvalidateFlags nInv )
if ( pPage->GetSortedObjs() )
{
const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
@@ -3740,9 +3731,8 @@ void SwRootFrame::InvalidateAllObjPos()
if ( pPageFrame->GetSortedObjs() )
{
const SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
const SwFormatAnchor& rAnch = pAnchoredObj->GetFrameFormat().GetAnchor();
if ((rAnch.GetAnchorId() != FLY_AT_PARA) &&
(rAnch.GetAnchorId() != FLY_AT_CHAR))
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ef3f73825753..3f997d751ecf 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -293,9 +293,8 @@ static void lcl_ModifyLines( SwTableLines &rLines, const long nOld,
::lcl_ModifyBoxes( rLines[i]->GetTabBoxes(), nOld, nNew, rFormatArr );
if( bCheckSum )
{
- for( size_t i = 0; i < rFormatArr.size(); ++i )
+ for(SwFormat* pFormat : rFormatArr)
{
- SwFormat* pFormat = rFormatArr[i];
const SwTwips nBox = lcl_MulDiv64<SwTwips>(pFormat->GetFrameSize().GetWidth(), nNew, nOld);
SwFormatFrameSize aNewBox( ATT_VAR_SIZE, nBox, 0 );
pFormat->LockModify();
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 076a2ae31e5b..24ece607d45e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1589,7 +1589,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link PageNums
std::vector<sal_Int32> aNotePageNums = CalcOutputPageNums( rNoteRect );
- for ( size_t nNumIdx = 0; nNumIdx < aNotePageNums.size(); ++nNumIdx )
+ for (sal_Int32 aNotePageNum : aNotePageNums)
{
// Link Note
vcl::PDFNote aNote;
@@ -1612,7 +1612,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link Export
Rectangle aRect(SwRectToPDFRect(pCurrPage, rNoteRect.SVRect()));
- pPDFExtOutDevData->CreateNote(aRect, aNote, aNotePageNums[nNumIdx]);
+ pPDFExtOutDevData->CreateNote(aRect, aNote, aNotePageNum);
}
}
}
@@ -1706,12 +1706,12 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link PageNums
std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( rLinkRect );
- for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
+ for (sal_Int32 aLinkPageNum : aLinkPageNums)
{
// Link Export
Rectangle aRect(SwRectToPDFRect(pSelectionPage, rLinkRect.SVRect()));
const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNums[nNumIdx]);
+ pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
@@ -1784,11 +1784,11 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
// Link Export
- for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
+ for (sal_Int32 aLinkPageNum : aLinkPageNums)
{
Rectangle aRect(SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()));
const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNums[nNumIdx]);
+ pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Connect Link and Destination:
if ( bIntern )
@@ -1875,12 +1875,12 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link PageNums
std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( rLinkRect );
- for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
+ for (sal_Int32 aLinkPageNum : aLinkPageNums)
{
// Link Export
aRect = SwRectToPDFRect(pCurrPage, rLinkRect.SVRect());
const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNums[nNumIdx]);
+ pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
@@ -1955,12 +1955,12 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Destination PageNum
const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
- for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
+ for (sal_Int32 aLinkPageNum : aLinkPageNums)
{
// Link Export
Rectangle aRect(SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()));
const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNums[nNumIdx]);
+ pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
@@ -2233,12 +2233,12 @@ void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rP
// Link PageNums
std::vector<sal_Int32> aHFLinkPageNums = CalcOutputPageNums( aHFLinkRect );
- for ( size_t nNumIdx = 0; nNumIdx < aHFLinkPageNums.size(); ++nNumIdx )
+ for (sal_Int32 aHFLinkPageNum : aHFLinkPageNums)
{
// Link Export
Rectangle aRect(SwRectToPDFRect(pPageFrame, aHFLinkRect.SVRect()));
const sal_Int32 nHFLinkId =
- rPDFExtOutDevData.CreateLink(aRect, aHFLinkPageNums[nNumIdx]);
+ rPDFExtOutDevData.CreateLink(aRect, aHFLinkPageNum);
// Connect Link and Destination:
if ( bIntern )
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index c5dea9769857..2766ac578792 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -411,8 +411,8 @@ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS,
void SwAttrHandler::Reset( )
{
- for ( sal_uInt16 i = 0; i < NUM_ATTRIBUTE_STACKS; i++ )
- aAttrStack[ i ].Reset();
+ for (SwAttrStack & i : aAttrStack)
+ i.Reset();
}
void SwAttrHandler::PushAndChg( const SwTextAttr& rAttr, SwFont& rFnt )
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 6be01454772d..3f8acaa4fb91 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1869,9 +1869,8 @@ bool SwTextFrame::FillSelection( SwSelectionList& rSelList, const SwRect& rRect
if( GetDrawObjs() )
{
const SwSortedObjs &rObjs = *GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- const SwAnchoredObject* pAnchoredObj = rObjs[i];
if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr )
continue;
const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index c8ac92c94ece..8c489de68590 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -1089,8 +1089,8 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
}
else
{
- for( int i = 0; i < 6; ++i )
- aScrType[i] = SwFontScript::Latin;
+ for(SwFontScript & rn : aScrType)
+ rn = SwFontScript::Latin;
}
memset( &aWidth, 0, sizeof(aWidth) );
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index be55e849af9d..0c9ebb64a103 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1749,9 +1749,9 @@ bool SwScriptInfo::IsArabicText( const OUString& rText, sal_Int32 nStt, sal_Int3
bool SwScriptInfo::IsKashidaValid(sal_Int32 nKashPos) const
{
- for ( size_t i = 0; i < aKashidaInvalid.size(); ++i )
+ for (sal_Int32 i : aKashidaInvalid)
{
- if ( aKashidaInvalid [ i ] == nKashPos )
+ if ( i == nKashPos )
return false;
}
return true;
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 761e0d9cebd7..83e13d221f28 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -363,9 +363,9 @@ bool SwRedlineItr::ChkSpecialUnderline_() const
// If the underlining or the escapement is caused by redlining,
// we always apply the SpecialUnderlining, i.e. the underlining
// below the base line
- for (size_t i = 0; i < m_Hints.size(); ++i)
+ for (SwTextAttr* pHint : m_Hints)
{
- const sal_uInt16 nWhich = m_Hints[i]->Which();
+ const sal_uInt16 nWhich = pHint->Which();
if( RES_CHRATR_UNDERLINE == nWhich ||
RES_CHRATR_ESCAPEMENT == nWhich )
return true;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 2400c2b8de82..acb8831c4ac9 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -575,16 +575,16 @@ void SwTextFrame::HideAndShowObjects()
if ( IsHiddenNow() )
{
// complete paragraph is hidden. Thus, hide all objects
- for ( size_t i = 0; i < GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* i : *GetDrawObjs())
{
- SdrObject* pObj = (*GetDrawObjs())[i]->DrawObj();
+ SdrObject* pObj = i->DrawObj();
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
// under certain conditions
const RndStdIds eAnchorType( pContact->GetAnchorId() );
const sal_Int32 nObjAnchorPos = pContact->GetContentAnchorIndex().GetIndex();
if ((eAnchorType != FLY_AT_CHAR) ||
sw_HideObj( *this, eAnchorType, nObjAnchorPos,
- (*GetDrawObjs())[i] ))
+ i ))
{
pContact->MoveObjToInvisibleLayer( pObj );
}
@@ -602,9 +602,9 @@ void SwTextFrame::HideAndShowObjects()
// Thus, show all objects, which are anchored at paragraph and
// hide/show objects, which are anchored at/as character, according
// to the visibility of the anchor character.
- for ( size_t i = 0; i < GetDrawObjs()->size(); ++i )
+ for (SwAnchoredObject* i : *GetDrawObjs())
{
- SdrObject* pObj = (*GetDrawObjs())[i]->DrawObj();
+ SdrObject* pObj = i->DrawObj();
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
// Determine anchor type only once
const RndStdIds eAnchorType( pContact->GetAnchorId() );
@@ -622,7 +622,7 @@ void SwTextFrame::HideAndShowObjects()
SwScriptInfo::GetBoundsOfHiddenRange( rNode, nObjAnchorPos, nHiddenStart, nHiddenEnd );
// Under certain conditions
if ( nHiddenStart != COMPLETE_STRING && bShouldBeHidden &&
- sw_HideObj( *this, eAnchorType, nObjAnchorPos, (*GetDrawObjs())[i] ) )
+ sw_HideObj( *this, eAnchorType, nObjAnchorPos, i ) )
pContact->MoveObjToInvisibleLayer( pObj );
else
pContact->MoveObjToVisibleLayer( pObj );
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 7d972ee4f760..1eb36ef6ddef 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -226,9 +226,8 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* pFrame, SwTwips nLower )
if ( pStartFrame->GetDrawObjs() )
{
const SwSortedObjs &rObjs = *pStartFrame->GetDrawObjs();
- for ( size_t i = 0; i < rObjs.size(); ++i )
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwAnchoredObject* pAnchoredObj = rObjs[i];
SwRect aRect( pAnchoredObj->GetObjRect() );
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr ||
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index e0a14d168f10..40d315e85c19 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -72,20 +72,20 @@ void SwWrongList::CopyFrom( const SwWrongList& rCopy )
meType = rCopy.meType;
nBeginInvalid = rCopy.nBeginInvalid;
nEndInvalid = rCopy.nEndInvalid;
- for( size_t i = 0; i < maList.size(); ++i )
+ for(SwWrongArea & i : maList)
{
- if( maList[i].mpSubList )
- maList[i].mpSubList = maList[i].mpSubList->Clone();
+ if( i.mpSubList )
+ i.mpSubList = i.mpSubList->Clone();
}
}
void SwWrongList::ClearList()
{
- for ( size_t i = 0; i < maList.size(); ++i)
+ for (SwWrongArea & i : maList)
{
- if (maList[i].mpSubList)
- delete maList[i].mpSubList;
- maList[i].mpSubList = nullptr;
+ if (i.mpSubList)
+ delete i.mpSubList;
+ i.mpSubList = nullptr;
}
maList.clear();
}
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index cedffc9dee73..808503684817 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -309,9 +309,8 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
{
xmlTextWriterStartElement( writer, BAD_CAST( "anchored" ) );
- for ( size_t i = 0, len = pAnchored->size(); i < len; ++i )
+ for (SwAnchoredObject* pObject : *pAnchored)
{
- SwAnchoredObject* pObject = (*pAnchored)[i];
pObject->dumpAsXml( writer );
}
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 171755e310f1..ee0617d95114 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -677,14 +677,14 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken,
{ SwForm::GetFormAuth(), 3, TOKEN_AUTHORITY }
};
- for( size_t i = 0; i<SAL_N_ELEMENTS(aTokenArr); ++i )
+ for(const auto & i : aTokenArr)
{
- const sal_Int32 nLen(aTokenArr[i].sNm.getLength());
- if( sToken.startsWith( aTokenArr[i].sNm.copy(0, nLen - aTokenArr[i].nOffset) ))
+ const sal_Int32 nLen(i.sNm.getLength());
+ if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) ))
{
if (pTokenLen)
*pTokenLen = nLen;
- return aTokenArr[ i ].eToken;
+ return i.eToken;
}
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 99b7768f9cdb..13064a1c2f6a 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1036,9 +1036,8 @@ void SwTextNode::Update(
if ( !bNegative && !bDelete )
{
const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
- for ( size_t i = 0; i < rTable.size(); ++i )
+ for (SwRangeRedline* pRedl : rTable)
{
- SwRangeRedline *const pRedl = rTable[ i ];
if ( pRedl->HasMark() )
{
SwPosition* const pEnd = pRedl->End();
@@ -1873,16 +1872,15 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
// nur falls im Array Attribute stehen (kann nur beim Kopieren
// sich selbst passieren!!)
- for ( size_t i = 0; i < aArr.size(); ++i )
+ for (SwTextAttr* i : aArr)
{
- InsertHint( aArr[ i ], SetAttrMode::NOTXTATRCHR );
+ InsertHint( i, SetAttrMode::NOTXTATRCHR );
}
if( pDest->GetpSwpHints() )
{
- for ( size_t i = 0; i < aRefMrkArr.size(); ++i )
+ for (SwTextAttr* pNewHt : aRefMrkArr)
{
- SwTextAttr * const pNewHt = aRefMrkArr[i];
if( pNewHt->GetEnd() )
{
pDest->GetpSwpHints()->Delete( pNewHt );
@@ -2216,9 +2214,8 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
}
Update( rStart, nLen, true, true );
- for (size_t n = 0; n < aArr.size(); ++n)
+ for (SwTextAttr* pHt : aArr)
{
- SwTextAttr * const pHt = aArr[ n ];
pHt->GetStart() = *pHt->GetEnd() = rStart.GetIndex();
InsertHint( pHt );
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 5a3805b15a71..2e8a57e31ccd 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1195,11 +1195,11 @@ bool SwTextNode::Convert( SwConversionArgs &rArgs )
} while (!bFound && aIter.Next()); /* loop while nothing was found and still sth is left to be searched */
// Apply implicit changes, if any, now that aIter is no longer used
- for (size_t i = 0; i < aImplicitChanges.size(); ++i)
+ for (const std::pair<int,int> & rImplicitChange : aImplicitChanges)
{
- SwPaM aPaM( *this, aImplicitChanges[i].first );
+ SwPaM aPaM( *this, rImplicitChange.first );
aPaM.SetMark();
- aPaM.GetPoint()->nContent = aImplicitChanges[i].second;
+ aPaM.GetPoint()->nContent = rImplicitChange.second;
SetLanguageAndFont( aPaM, rArgs.nConvTargetLang, RES_CHRATR_CJK_LANGUAGE, rArgs.pTargetFont, RES_CHRATR_CJK_FONT );
}
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index 56d5331b2f46..ba52ed4e4942 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -457,10 +457,9 @@ SwUndoDrawUnGroupConnectToLayout::~SwUndoDrawUnGroupConnectToLayout()
void
SwUndoDrawUnGroupConnectToLayout::UndoImpl(::sw::UndoRedoContext &)
{
- for ( std::vector< SdrObject >::size_type i = 0;
- i < aDrawFormatsAndObjs.size(); ++i )
+ for (const std::pair< SwDrawFrameFormat*, SdrObject* > & rPair : aDrawFormatsAndObjs)
{
- SdrObject* pObj( aDrawFormatsAndObjs[i].second );
+ SdrObject* pObj( rPair.second );
SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(pObj->GetUserCall()) );
OSL_ENSURE( pDrawContact,
"<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" );
@@ -477,11 +476,10 @@ SwUndoDrawUnGroupConnectToLayout::UndoImpl(::sw::UndoRedoContext &)
void
SwUndoDrawUnGroupConnectToLayout::RedoImpl(::sw::UndoRedoContext &)
{
- for ( std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >::size_type i = 0;
- i < aDrawFormatsAndObjs.size(); ++i )
+ for (const std::pair< SwDrawFrameFormat*, SdrObject* > & rPair : aDrawFormatsAndObjs)
{
- SwDrawFrameFormat* pFormat( aDrawFormatsAndObjs[i].first );
- SdrObject* pObj( aDrawFormatsAndObjs[i].second );
+ SwDrawFrameFormat* pFormat( rPair.first );
+ SdrObject* pObj( rPair.second );
SwDrawContact *pContact = new SwDrawContact( pFormat, pObj );
pContact->ConnectToLayout();
pContact->MoveObjToVisibleLayer( pObj );
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 436a00683ef6..f105bbcb5ad8 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -170,9 +170,8 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
{
SwRedlineData aRData( nsRedlineType_t::REDLINE_INSERT, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
const SwIndexReg* pIReg = rPos.nContent.GetIdxReg();
- for( size_t i = 0; i < rTable.size(); ++i )
+ for(SwRangeRedline* pRedl : rTable)
{
- SwRangeRedline* pRedl = rTable[ i ];
SwIndex* pIdx = &pRedl->End()->nContent;
if( pIReg == pIdx->GetIdxReg() &&
nContent == pIdx->GetIndex() )
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index 1fe602192674..25c178b48005 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -349,8 +349,8 @@ SwUndoTransliterate::SwUndoTransliterate(
SwUndoTransliterate::~SwUndoTransliterate()
{
- for (size_t i = 0; i < aChanges.size(); ++i)
- delete aChanges[i];
+ for (UndoTransliterate_Data* p : aChanges)
+ delete p;
}
void SwUndoTransliterate::UndoImpl(::sw::UndoRedoContext & rContext)
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index 483354586dec..1f62d4235874 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -92,12 +92,12 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
const SwTable& rTable = pTableNd->GetTable();
SwMovedBoxes aMovedList;
- for (size_t i=0; i < m_SortList.size(); i++)
+ for (std::unique_ptr<SwSortUndoElement> & i : m_SortList)
{
const SwTableBox* pSource = rTable.GetTableBox(
- *m_SortList[i]->SORT_TXT_TBL.TBL.pSource );
+ *i->SORT_TXT_TBL.TBL.pSource );
const SwTableBox* pTarget = rTable.GetTableBox(
- *m_SortList[i]->SORT_TXT_TBL.TBL.pTarget );
+ *i->SORT_TXT_TBL.TBL.pTarget );
// move back
MoveCell(&rDoc, pTarget, pSource,
@@ -125,12 +125,12 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
for (size_t i = 0; i < m_SortList.size(); ++i)
{
- for (size_t ii = 0; ii < m_SortList.size(); ++ii)
+ for (std::unique_ptr<SwSortUndoElement> & j : m_SortList)
{
- if (m_SortList[ii]->SORT_TXT_TBL.TXT.nSource == nSttNode + i)
+ if (j->SORT_TXT_TBL.TXT.nSource == nSttNode + i)
{
SwNodeIndex* pIdx = new SwNodeIndex( rDoc.GetNodes(),
- m_SortList[ii]->SORT_TXT_TBL.TXT.nTarget );
+ j->SORT_TXT_TBL.TXT.nTarget );
aIdxList.insert( aIdxList.begin() + i, pIdx );
break;
}
@@ -171,12 +171,12 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
const SwTable& rTable = pTableNd->GetTable();
SwMovedBoxes aMovedList;
- for (size_t i = 0; i < m_SortList.size(); ++i)
+ for (std::unique_ptr<SwSortUndoElement> & i : m_SortList)
{
const SwTableBox* pSource = rTable.GetTableBox(
- *m_SortList[i]->SORT_TXT_TBL.TBL.pSource );
+ *i->SORT_TXT_TBL.TBL.pSource );
const SwTableBox* pTarget = rTable.GetTableBox(
- *m_SortList[i]->SORT_TXT_TBL.TBL.pTarget );
+ *i->SORT_TXT_TBL.TBL.pTarget );
// move back
MoveCell(&rDoc, pSource, pTarget,
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index f6d17a1688c9..c6c1e695c002 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1787,12 +1787,12 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
// do this _after_ deleting Frames because disposing SwAccessible requires
// connection to the nodes, see SwAccessibleChild::IsAccessible()
- for (size_t i = 0; i < aDelNodes.size(); ++i)
+ for (const std::pair<SwTableBox *, sal_uLong> & rDelNode : aDelNodes)
{
// first disconnect box from node, otherwise ~SwTableBox would
// access pBox->pSttNd, deleted by DeleteSection
- aDelNodes[i].first->RemoveFromTable();
- rDoc.getIDocumentContentOperations().DeleteSection(rDoc.GetNodes()[ aDelNodes[i].second ]);
+ rDelNode.first->RemoveFromTable();
+ rDoc.getIDocumentContentOperations().DeleteSection(rDoc.GetNodes()[ rDelNode.second ]);
}
// Remove boxes from table structure
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index b66916db1416..09ee314ace34 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -485,9 +485,9 @@ uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
uno::Sequence<OUString> aRet(nEntries);
OUString* pArray = aRet.getArray();
sal_uInt16 n = 0;
- for(sal_uInt16 i = 0; i < nEntries; i++)
+ for(const ProvNamesId_Type & i : aProvNamesId)
{
- OUString sProv(OUString::createFromAscii(aProvNamesId[i].pName));
+ OUString sProv(OUString::createFromAscii(i.pName));
if(!sProv.isEmpty())
{
pArray[n] = sProv;
@@ -501,11 +501,10 @@ uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName)
{
- const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
- for(sal_uInt16 i = 0; i < nEntries; i++ )
+ for(const ProvNamesId_Type & i : aProvNamesId)
{
- if (rServiceName.equalsAscii(aProvNamesId[i].pName))
- return aProvNamesId[i].nType;
+ if (rServiceName.equalsAscii(i.pName))
+ return i.nType;
}
return SW_SERVICE_INVALID;
}
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 69ded111f711..beea48cb9c83 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -3022,9 +3022,9 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc & rDoc)
// now handle meta-fields, which are not SwFields
const ::std::vector< uno::Reference<text::XTextField> > MetaFields(
m_pImpl->m_pDoc->GetMetaFieldManager().getMetaFields() );
- for (size_t i = 0; i < MetaFields.size(); ++i)
+ for (const auto & rMetaField : MetaFields)
{
- m_pImpl->m_Items.push_back( MetaFields[i] );
+ m_pImpl->m_Items.push_back( rMetaField );
}
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 61812a615018..cb901d591c90 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -936,9 +936,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
SwSections aSectArr;
pSectionFormat->GetChildSections(aSectArr,
SORTSECT_NOT, false);
- for(size_t i = 0; i < aSectArr.size(); ++i)
+ for(SwSection* pSect : aSectArr)
{
- SwSection* pSect = aSectArr[i];
if(pSect->GetType() == TOX_HEADER_SECTION)
{
const uno::Reference <text::XTextSection> xHeader =
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 9f8333f1c7bd..dbad25a0ad77 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1134,9 +1134,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
const SwRedlineTable& rRedTable =
pFormat->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
- for (size_t nRed = 0; nRed < rRedTable.size(); ++nRed)
+ for (SwRangeRedline* pRedline : rRedTable)
{
- const SwRangeRedline* pRedline = rRedTable[nRed];
const SwNode& rRedPointNode = pRedline->GetNode();
const SwNode& rRedMarkNode = pRedline->GetNode(false);
if ((&rRedPointNode == pSectNode) ||
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 92b493197351..cd84531a3558 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1514,9 +1514,8 @@ static PropertyValue const* lcl_FindProperty(
const char* cName, std::vector<PropertyValue const*> const& rPropertyValues)
{
const OUString sCmp = OUString::createFromAscii(cName);
- for(size_t i = 0; i < rPropertyValues.size(); ++i)
+ for(const PropertyValue* pTemp : rPropertyValues)
{
- PropertyValue const*const pTemp = rPropertyValues[i];
if (sCmp == pTemp->Name)
return pTemp;
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 79fc84e1582c..319b4ac8006b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1128,9 +1128,8 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
{
const long nOfst = GetOut()->PixelToLogic(
Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
- for ( size_t i = 0; i < pPage->GetSortedObjs()->size(); ++i )
+ for (SwAnchoredObject* pObj : *pPage->GetSortedObjs())
{
- SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
// ignore objects that are not actually placed on the page
if (pObj->IsFormatPossible())
{
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 8075b89bec5a..a40c11f7e210 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -126,9 +126,8 @@ Filters::Filters()
Filters::~Filters()
{
// kill Readers
- for( sal_uInt16 n = 0; n < MAXFILTER; ++n )
+ for(SwReaderWriterEntry & rEntry : aReaderWriter)
{
- SwReaderWriterEntry& rEntry = aReaderWriter[n];
if( rEntry.bDelReader && rEntry.pReader )
{
delete rEntry.pReader;
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index a5be1d655303..d0a54298e5b3 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -628,9 +628,9 @@ void Reader::ResetFrameFormats( SwDoc& rDoc )
sal_uInt16 const s_ids[3] = {
RES_POOLFRM_FRAME, RES_POOLFRM_GRAPHIC, RES_POOLFRM_OLE
};
- for (size_t i = 0; i < SAL_N_ELEMENTS(s_ids); ++i)
+ for (sal_uInt16 i : s_ids)
{
- SwFrameFormat *const pFrameFormat = rDoc.getIDocumentStylePoolAccess().GetFrameFormatFromPool( s_ids[i] );
+ SwFrameFormat *const pFrameFormat = rDoc.getIDocumentStylePoolAccess().GetFrameFormatFromPool( i );
pFrameFormat->ResetFormatAttr( RES_LR_SPACE );
pFrameFormat->ResetFormatAttr( RES_UL_SPACE );
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index a53a59dd6079..9c09330a3feb 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -358,9 +358,9 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
for( int i=0; i<4; ++i )
{
const SfxPoolItem& rRef = pFormat->GetFormatAttr( aWhichIds[nRef][i] );
- for( size_t j=0; j<SAL_N_ELEMENTS(aSets); ++j )
+ for(sal_uInt16 nSet : aSets)
{
- const SfxPoolItem& rSet = pFormat->GetFormatAttr( aWhichIds[aSets[j]][i] );
+ const SfxPoolItem& rSet = pFormat->GetFormatAttr( aWhichIds[nSet][i] );
if( rSet != rRef )
{
if( !pItemSet )
@@ -402,12 +402,12 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
static const sal_uInt16 aWhichIds[3] =
{ RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
RES_CHRATR_CTL_LANGUAGE };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
- if( aWhichIds[i] != nWhichId )
+ if( i != nWhichId )
{
const SvxLanguageItem& rTmpLang =
- static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr(aWhichIds[i]));
+ static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr(i));
if( rTmpLang.GetLanguage() != eLang )
{
if( !pItemSet )
@@ -825,14 +825,14 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
{
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
// export language if it differs from the default language only.
const SfxPoolItem *pTmpItem;
- if( SfxItemState::SET == rInfo.pItemSet->GetItemState( aWhichIds[i],
+ if( SfxItemState::SET == rInfo.pItemSet->GetItemState( i,
true, &pTmpItem ) &&
static_cast<const SvxLanguageItem *>(pTmpItem)->GetLanguage() == eLang )
- rInfo.pItemSet->ClearItem( aWhichIds[i] );
+ rInfo.pItemSet->ClearItem( i );
}
}
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 392845f4f57d..f78711bea863 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -188,14 +188,14 @@ static void SetCharFormatAttrs( SwCharFormat *pCharFormat, SfxItemSet& rItemSet
const SfxPoolItem *pItem;
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONTSIZE,RES_CHRATR_CJK_FONTSIZE,
RES_CHRATR_CTL_FONTSIZE };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
- if( SfxItemState::SET == rItemSet.GetItemState( aWhichIds[i], false,
+ if( SfxItemState::SET == rItemSet.GetItemState( i, false,
&pItem ) &&
static_cast<const SvxFontHeightItem *>(pItem)->GetProp() != 100)
{
// %-Angaben beim FontHeight-Item werden nicht unterstuetzt
- rItemSet.ClearItem( aWhichIds[i] );
+ rItemSet.ClearItem( i );
}
}
@@ -319,14 +319,14 @@ static void SetTextCollAttrs( SwTextFormatColl *pColl, SfxItemSet& rItemSet,
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONTSIZE,RES_CHRATR_CJK_FONTSIZE,
RES_CHRATR_CTL_FONTSIZE };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
- if( SfxItemState::SET == rItemSet.GetItemState( aWhichIds[i], false,
+ if( SfxItemState::SET == rItemSet.GetItemState( i, false,
&pItem ) &&
static_cast<const SvxFontHeightItem *>(pItem)->GetProp() != 100)
{
// %-Angaben beim FontHeight-Item werden nicht unterstuetzt
- rItemSet.ClearItem( aWhichIds[i] );
+ rItemSet.ClearItem( i );
}
}
@@ -423,9 +423,9 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
{
static sal_uInt16 aPoolIds[] = { RES_POOLPAGE_HTML, RES_POOLPAGE_FIRST,
RES_POOLPAGE_LEFT, RES_POOLPAGE_RIGHT };
- for( size_t i=0; i<SAL_N_ELEMENTS(aPoolIds); i++ )
+ for(sal_uInt16 i : aPoolIds)
{
- const SwPageDesc *pPageDesc = GetPageDesc( aPoolIds[i], false );
+ const SwPageDesc *pPageDesc = GetPageDesc( i, false );
if( pPageDesc )
{
SwPageDesc aNewPageDesc( *pPageDesc );
@@ -2293,16 +2293,16 @@ static void lcl_swcss1_setEncoding( SwFormat& rFormat, rtl_TextEncoding eEnc )
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
RES_CHRATR_CTL_FONT };
const SfxPoolItem *pItem;
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
- if( SfxItemState::SET == rItemSet.GetItemState( aWhichIds[i], false,&pItem ) )
+ if( SfxItemState::SET == rItemSet.GetItemState( i, false,&pItem ) )
{
const SvxFontItem& rFont = *static_cast<const SvxFontItem *>(pItem);
if( RTL_TEXTENCODING_SYMBOL != rFont.GetCharSet() )
{
SvxFontItem aFont( rFont.GetFamily(), rFont.GetFamilyName(),
rFont.GetStyleName(), rFont.GetPitch(),
- eEnc, aWhichIds[i]);
+ eEnc, i);
rFormat.SetFormatAttr( aFont );
}
}
@@ -2318,15 +2318,15 @@ void SwCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
// Set new encoding as pool default
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
RES_CHRATR_CTL_FONT };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
const SvxFontItem& rDfltFont =
- static_cast<const SvxFontItem&>(pDoc->GetDefault( aWhichIds[i]));
+ static_cast<const SvxFontItem&>(pDoc->GetDefault( i));
SvxFontItem aFont( rDfltFont.GetFamily(),
rDfltFont.GetFamilyName(),
rDfltFont.GetStyleName(),
rDfltFont.GetPitch(),
- eEnc, aWhichIds[i] );
+ eEnc, i );
pDoc->SetDefault( aFont );
}
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index 1c52d6bd593a..22c650016267 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -266,9 +266,8 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
Color aBGColor;
const HTMLOptions& rHTMLOptions = GetOptions();
- for (size_t i = 0, n = rHTMLOptions.size(); i < n; ++i)
+ for (const auto & rOption : rHTMLOptions)
{
- const HTMLOption& rOption = rHTMLOptions[i];
switch( rOption.GetToken() )
{
case HTML_O_ID:
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 914ca8a62a60..591fc649da8b 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1104,11 +1104,11 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con
do
{
bFound = false;
- for (size_t i = 0; i < rHTMLWrt.m_aImgMapNames.size(); ++i)
+ for (const OUString & rImgMapName : rHTMLWrt.m_aImgMapNames)
{
// TODO: Unicode: Comparison is case insensitive for ASCII
// characters only now!
- if (aIMapName.equalsIgnoreAsciiCase(rHTMLWrt.m_aImgMapNames[i]))
+ if (aIMapName.equalsIgnoreAsciiCase(rImgMapName))
{
bFound = true;
break;
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index a93a7812caf5..5fb9e1ade649 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -831,9 +831,8 @@ static void lcl_html_setEvents(
OUString sSearch( sListener );
sSearch += "-" +sMethod + "-";
sal_Int32 nLen = sSearch.getLength();
- for(size_t j = 0; j < rUnoMacroParamTable.size(); ++j)
+ for(const auto & rParam : rUnoMacroParamTable)
{
- const OUString& rParam = rUnoMacroParamTable[j];
if( rParam.startsWith( sSearch ) && rParam.getLength() > nLen )
{
rDesc.AddListenerParam = rParam.copy(nLen);
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index c7c600e3e5a5..c83eafe5d36c 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -985,16 +985,16 @@ void SwHTMLParser::InsertBodyOptions()
static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONTSIZE,
RES_CHRATR_CJK_FONTSIZE,
RES_CHRATR_CTL_FONTSIZE };
- for( size_t i=0; i<SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 i : aWhichIds)
{
- if( SfxItemState::SET == aItemSet.GetItemState( aWhichIds[i], false,
+ if( SfxItemState::SET == aItemSet.GetItemState( i, false,
&pItem ) &&
static_cast <const SvxFontHeightItem * >(pItem)->GetProp() != 100)
{
sal_uInt32 nHeight =
( m_aFontHeights[2] *
static_cast <const SvxFontHeightItem * >(pItem)->GetProp() ) / 100;
- SvxFontHeightItem aNewItem( nHeight, 100, aWhichIds[i] );
+ SvxFontHeightItem aNewItem( nHeight, 100, i );
aItemSet.Put( aNewItem );
}
}
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 90dd59e0df58..18154b42fc6f 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -309,9 +309,8 @@ void SwHTMLParser::InsertEmbed()
// Die Optionen werden vorwaerts gelesen, weil die Plugins sie in
// dieser Reihenfolge erwarten. Trotzdem darf immer nur der erste
// Wert einer Option beruecksichtigt werden.
- for (size_t i = 0, n = rHTMLOptions.size(); i < n; ++i)
+ for (const auto & rOption : rHTMLOptions)
{
- const HTMLOption& rOption = rHTMLOptions[i];
switch( rOption.GetToken() )
{
case HTML_O_ID:
@@ -837,9 +836,8 @@ void SwHTMLParser::InsertFloatingFrame()
const HTMLOptions& rHTMLOptions = GetOptions();
// Erstmal die Optionen f?r das Writer-Frame-Format holen
- for (size_t i = 0, n = rHTMLOptions.size(); i < n; ++i)
+ for (const auto & rOption : rHTMLOptions)
{
- const HTMLOption& rOption = rHTMLOptions[i];
switch( rOption.GetToken() )
{
case HTML_O_ID:
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 3f6a93092572..fc407fd7ec7b 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -871,8 +871,8 @@ HTMLTableColumn::HTMLTableColumn():
eAdjust(SVX_ADJUST_END), eVertOri(text::VertOrientation::TOP),
bLeftBorder(false)
{
- for( sal_uInt16 i=0; i<6; i++ )
- aFrameFormats[i] = nullptr;
+ for(SwFrameFormat* & rp : aFrameFormats)
+ rp = nullptr;
}
inline void HTMLTableColumn::SetWidth( sal_uInt16 nWdth, bool bRelWdth )
@@ -3552,8 +3552,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
// verschoben. Deshalb entfernen wir alle harten
// Attribute des Absatzes
- for( size_t i=0; i<m_aParaAttrs.size(); i++ )
- m_aParaAttrs[i]->Invalidate();
+ for(HTMLAttr* i : m_aParaAttrs)
+ i->Invalidate();
}
m_aParaAttrs.clear();
@@ -3853,9 +3853,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
// erste Option immer gewinnt.
bool bNeedsSection = false;
const HTMLOptions& rHTMLOptions = GetOptions();
- for (size_t i = 0; i < rHTMLOptions.size(); ++i)
+ for (const auto & rOption : rHTMLOptions)
{
- const HTMLOption& rOption = rHTMLOptions[i];
if( HTML_O_ALIGN==rOption.GetToken() )
{
SvxAdjust eAdjust =
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 23fce2fd99b7..6c371e0978ab 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -340,8 +340,8 @@ void SvxCSS1BorderInfo::SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem &rBoxIte
SvxCSS1PropertyInfo::SvxCSS1PropertyInfo()
{
- for( size_t i=0; i<SAL_N_ELEMENTS(aBorderInfos); ++i )
- aBorderInfos[i] = nullptr;
+ for(SvxCSS1BorderInfo* & rp : aBorderInfos)
+ rp = nullptr;
Clear();
}
@@ -387,10 +387,10 @@ SvxCSS1PropertyInfo::~SvxCSS1PropertyInfo()
void SvxCSS1PropertyInfo::DestroyBorderInfos()
{
- for( size_t i=0; i<SAL_N_ELEMENTS(aBorderInfos); ++i )
+ for(SvxCSS1BorderInfo* & rp : aBorderInfos)
{
- delete aBorderInfos[i];
- aBorderInfos[i] = nullptr;
+ delete rp;
+ rp = nullptr;
}
}
@@ -656,9 +656,9 @@ bool SvxCSS1Parser::SelectorParsed( CSS1Selector *pSelector, bool bFirst )
{
OSL_ENSURE( pSheetItemSet, "Where is the Item-Set for Style-Sheets?" );
- for (size_t i = 0; i < m_Selectors.size(); ++i)
+ for (std::unique_ptr<CSS1Selector> & rpSelection : m_Selectors)
{
- StyleParsed(m_Selectors[i].get(), *pSheetItemSet, *pSheetPropInfo);
+ StyleParsed(rpSelection.get(), *pSheetItemSet, *pSheetPropInfo);
}
pSheetItemSet->ClearItem();
pSheetPropInfo->Clear();
@@ -820,9 +820,9 @@ bool SvxCSS1Parser::ParseStyleSheet( const OUString& rIn )
bool bSuccess = CSS1Parser::ParseStyleSheet( rIn );
- for (size_t i = 0; i < m_Selectors.size(); ++i)
+ for (std::unique_ptr<CSS1Selector> & rpSelector : m_Selectors)
{
- StyleParsed(m_Selectors[i].get(), *pSheetItemSet, *pSheetPropInfo);
+ StyleParsed(rpSelector.get(), *pSheetItemSet, *pSheetPropInfo);
}
// und etwas aufrauemen
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 1bb9512046bd..abc371493dad 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -488,8 +488,8 @@ sal_uLong SwHTMLWriter::WriteStream()
ClearNextNumInfo();
- for( int i=0; i<MAXLEVEL; ++i )
- m_aBulletGrfs[i].clear();
+ for(OUString & s : m_aBulletGrfs)
+ s.clear();
m_aNonConvertableCharacters.clear();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8bee90926d3a..9eba299b355b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1998,13 +1998,13 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
if (!m_aTextEffectsGrabBag.empty())
{
- for (size_t i = 0; i < m_aTextEffectsGrabBag.size(); ++i)
+ for (beans::PropertyValue & i : m_aTextEffectsGrabBag)
{
- boost::optional<sal_Int32> aElementId = lclGetElementIdForName(m_aTextEffectsGrabBag[i].Name);
+ boost::optional<sal_Int32> aElementId = lclGetElementIdForName(i.Name);
if(aElementId)
{
uno::Sequence<beans::PropertyValue> aGrabBagSeq;
- m_aTextEffectsGrabBag[i].Value >>= aGrabBagSeq;
+ i.Value >>= aGrabBagSeq;
lclProcessRecursiveGrabBag(*aElementId, aGrabBagSeq, m_pSerializer);
}
}
@@ -6652,12 +6652,10 @@ void DocxAttributeOutput::WritePostitFieldReference()
void DocxAttributeOutput::WritePostitFields()
{
- for( size_t i = 0;
- i < m_postitFields.size();
- ++i )
+ for(const std::pair<const SwPostItField*,int> & rPair : m_postitFields)
{
- OString idstr = OString::number( m_postitFields[ i ].second);
- const SwPostItField* f = m_postitFields[ i ].first;
+ OString idstr = OString::number( rPair.second);
+ const SwPostItField* f = rPair.first;
m_pSerializer->startElementNS( XML_w, XML_comment, FSNS( XML_w, XML_id ), idstr.getStr(),
FSNS( XML_w, XML_author ), OUStringToOString( f->GetPar1(), RTL_TEXTENCODING_UTF8 ).getStr(),
FSNS( XML_w, XML_date ), DateTimeToOString(f->GetDateTime()).getStr(),
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 043608caa470..fbc99db2a13d 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -673,8 +673,8 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>&
tableStyleRPr(aRPr);
tableStyleTablePr(aTablePr);
tableStyleTcPr(aTcPr);
- for (std::size_t i = 0; i < aTableStylePrs.size(); ++i)
- tableStyleTableStylePr(aTableStylePrs[i]);
+ for (uno::Sequence<beans::PropertyValue> & i : aTableStylePrs)
+ tableStyleTableStylePr(i);
m_pSerializer->endElementNS(XML_w, XML_style);
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index b2fa8387d549..9cd98a688a31 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1880,13 +1880,13 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
lcl_TextFrameShadow(m_aFlyProperties, rFrameFormat);
lcl_TextFrameRelativeSize(m_aFlyProperties, rFrameFormat);
- for (std::size_t i = 0; i < m_aFlyProperties.size(); ++i)
+ for (std::pair<OString,OString> & rPair : m_aFlyProperties)
{
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
- m_rExport.Strm().WriteCharPtr(m_aFlyProperties[i].first.getStr());
+ m_rExport.Strm().WriteCharPtr(rPair.first.getStr());
m_rExport.Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " ");
- m_rExport.Strm().WriteCharPtr(m_aFlyProperties[i].second.getStr());
+ m_rExport.Strm().WriteCharPtr(rPair.second.getStr());
m_rExport.Strm().WriteCharPtr("}}");
}
m_aFlyProperties.clear();
@@ -3966,13 +3966,13 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
if (!pFlyFrameFormat->GetOpaque().GetValue())
aFlyProperties.push_back(std::make_pair<OString, OString>("fBehindDocument", "1"));
- for (std::size_t i = 0; i < aFlyProperties.size(); ++i)
+ for (std::pair<OString,OString> & rPair : aFlyProperties)
{
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
- m_rExport.Strm().WriteCharPtr(aFlyProperties[i].first.getStr());
+ m_rExport.Strm().WriteCharPtr(rPair.first.getStr());
m_rExport.Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " ");
- m_rExport.Strm().WriteCharPtr(aFlyProperties[i].second.getStr());
+ m_rExport.Strm().WriteCharPtr(rPair.second.getStr());
m_rExport.Strm().WriteCharPtr("}}");
}
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " ");
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 1752e3c99f3c..c57280488b56 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -253,10 +253,8 @@ void RtfExport::WriteRevTab()
// RTF always seems to use Unknown as the default first entry
GetRedline(OUString("Unknown"));
- for (std::size_t i = 0; i < m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++i)
+ for (SwRangeRedline* pRedl : m_pDoc->getIDocumentRedlineAccess().GetRedlineTable())
{
- const SwRangeRedline* pRedl = m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ i ];
-
GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor()));
}
@@ -394,13 +392,13 @@ void RtfExport::WriteMainText()
std::vector< std::pair<OString, OString> > aProperties;
aProperties.push_back(std::make_pair<OString, OString>("shapeType", "1"));
aProperties.push_back(std::make_pair<OString, OString>("fillColor", OString::number(msfilter::util::BGRToRGB(oBrush->GetColor().GetColor()))));
- for (std::size_t i = 0; i < aProperties.size(); ++i)
+ for (std::pair<OString,OString> & rPair : aProperties)
{
Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
- Strm().WriteCharPtr(aProperties[i].first.getStr());
+ Strm().WriteCharPtr(rPair.first.getStr());
Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " ");
- Strm().WriteCharPtr(aProperties[i].second.getStr());
+ Strm().WriteCharPtr(rPair.second.getStr());
Strm().WriteCharPtr("}}");
}
Strm().WriteChar('}'); // shpinst
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 6f389342a1a0..773e167e1a21 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -708,14 +708,14 @@ namespace sw
{ RTL_TEXTENCODING_MS_950, 0x88 }, // Big5
{ RTL_TEXTENCODING_MS_949, 0x81 }, // EUC-KR
};
- for (size_t i = 0; i < SAL_N_ELEMENTS(s_fallbacks); ++i)
+ for (const auto & i : s_fallbacks)
{
// fall back to a charset that can at least encode the
// font's name
- if (CanEncode(rFontName, s_fallbacks[i].enc)
- && CanEncode(rAltName, s_fallbacks[i].enc))
+ if (CanEncode(rFontName, i.enc)
+ && CanEncode(rAltName, i.enc))
{
- return s_fallbacks[i].charset;
+ return i.charset;
}
}
SAL_INFO("sw.rtf", "no fallback charset found for font: "
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 4def1d155e85..879f39a2d138 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -352,9 +352,9 @@ namespace
{
rDstArr.clear();
rDstArr.reserve(rSrcArr.size());
- for(size_t i = 0; i < rSrcArr.size(); ++i)
+ for(DrawObj & i : rSrcArr)
{
- rDstArr.push_back( &rSrcArr[i] );
+ rDstArr.push_back( &i );
}
std::sort(rDstArr.begin(), rDstArr.end(), CompareDrawObjs(rWrt));
}
@@ -3101,9 +3101,9 @@ void SwEscherEx::MakeZOrderArrAndFollowIds(
//Now set up the follow IDs
aFollowShpIds.clear();
- for (size_t n = 0; n < rDstArr.size(); ++n)
+ for (DrawObj* p : rDstArr)
{
- const SwFrameFormat &rFormat = rDstArr[n]->maContent.GetFrameFormat();
+ const SwFrameFormat &rFormat = p->maContent.GetFrameFormat();
bool bNeedsShapeId = false;
if (RES_FLYFRMFMT == rFormat.Which())
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 718a1470a4db..3704b3ac8619 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1388,10 +1388,8 @@ const SwRedlineData* SwWW8AttrIter::GetParagraphLevelRedline( )
pCurRedline = nullptr;
// ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos'
- for( size_t nRedlinePos = 0; nRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedlinePos )
+ for(SwRangeRedline* pRedl : m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable())
{
- const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedlinePos ];
-
const SwPosition* pCheckedStt = pRedl->Start();
if( pCheckedStt->nNode == rNd )
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 123f23aeb53d..bc52d44c2ab6 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1781,12 +1781,11 @@ bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt )
unsigned int nOldIndex = rWrt.GetHdFtIndex();
rWrt.SetHdFtIndex( 0 );
- for ( size_t i = 0; i < aSects.size(); ++i )
+ for (WW8_SepInfo & rSepInfo : aSects)
{
std::shared_ptr<WW8_PdAttrDesc> const pAttrDesc(new WW8_PdAttrDesc);
m_SectionAttributes.push_back(pAttrDesc);
- WW8_SepInfo& rSepInfo = aSects[i];
rWrt.SectionProperties( rSepInfo, pAttrDesc.get() );
// FIXME: this writes the section properties, but not of all sections;
@@ -1825,9 +1824,9 @@ void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const
{
OSL_ENSURE(m_SectionAttributes.size() == static_cast<size_t>(aSects.size())
, "WriteSepx(): arrays out of sync!");
- for (size_t i = 0; i < m_SectionAttributes.size(); i++) // all sections
+ for (const auto & rSectionAttribute : m_SectionAttributes) // all sections
{
- WW8_PdAttrDesc *const pA = m_SectionAttributes[i].get();
+ WW8_PdAttrDesc *const pA = rSectionAttribute.get();
if (pA->m_nLen && pA->m_pData != nullptr)
{
SVBT16 nL;
@@ -1857,10 +1856,10 @@ void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const
static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
- for (size_t j = 0; j < m_SectionAttributes.size(); j++ )
+ for (const auto & rSectionAttribute : m_SectionAttributes)
{
// Sepx-Pos
- UInt32ToSVBT32( m_SectionAttributes[j]->m_nSepxFcPos, aSed.fcSepx );
+ UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx );
rWrt.pTableStrm->Write( &aSed, sizeof( aSed ) );
}
rWrt.pFib->fcPlcfsed = nFcStart;
@@ -2008,8 +2007,8 @@ bool WW8_WrPlcAnnotations::IsNewRedlineComment( const SwRedlineData *pRedline )
WW8_WrPlcAnnotations::~WW8_WrPlcAnnotations()
{
- for( size_t n=0; n < aContent.size(); n++ )
- delete static_cast<WW8_Annotation const *>(aContent[n]);
+ for(const void * p : aContent)
+ delete static_cast<WW8_Annotation const *>(p);
}
bool WW8_WrPlcSubDoc::WriteGenericText( WW8Export& rWrt, sal_uInt8 nTTyp,
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 2275a3a84de0..278cec8760e5 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -846,8 +846,8 @@ void WW8_WrPlc1::Finish( sal_uLong nLastCp, sal_uLong nSttCp )
{
aPos.push_back( nLastCp );
if( nSttCp )
- for( size_t n = 0; n < aPos.size(); ++n )
- aPos[ n ] -= nSttCp;
+ for(WW8_CP & rCp : aPos)
+ rCp -= nSttCp;
}
}
@@ -1047,9 +1047,9 @@ void WW8_WrPlcPn::WriteFkps()
{
nFkpStartPage = (sal_uInt16) ( SwWW8Writer::FillUntil( rWrt.Strm() ) >> 9 );
- for( size_t i = 0; i < m_Fkps.size(); i++ )
+ for(const std::unique_ptr<WW8_WrFkp> & rp : m_Fkps)
{
- m_Fkps[ i ]->Write( rWrt.Strm(), *rWrt.m_pGrf );
+ rp->Write( rWrt.Strm(), *rWrt.m_pGrf );
}
if( CHP == ePlc )
@@ -1441,9 +1441,9 @@ void WW8Export::AppendBookmarks( const SwTextNode& rNd, sal_Int32 nAktPos, sal_I
if( GetWriter().GetBookmarks( rNd, nAktPos, nAktEnd, aArr ))
{
sal_uLong nNd = rNd.GetIndex(), nSttCP = Fc2Cp( Strm().Tell() );
- for( size_t n = 0; n < aArr.size(); ++n )
+ for(const ::sw::mark::IMark* p : aArr)
{
- const ::sw::mark::IMark& rBkmk = *(aArr[ n ]);
+ const ::sw::mark::IMark& rBkmk = *p;
if(dynamic_cast< const ::sw::mark::IFieldmark *>(&rBkmk))
continue;
@@ -1553,9 +1553,9 @@ int MSWordExportBase::CollectGrfsOfBullets()
if ( pGraf )
{
bool bHas = false;
- for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
+ for (const Graphic* p : m_vecBulletPic)
{
- if (m_vecBulletPic[i]->GetChecksum() == pGraf->GetChecksum())
+ if (p->GetChecksum() == pGraf->GetChecksum())
{
bHas = true;
break;
@@ -2557,9 +2557,9 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t
if (nBoxes0 > 21)
nBoxes0 = 21;
- for (sal_uInt32 m = 0; m < 2; m++)
+ for (sal_uInt32 m : aSprmIds)
{
- m_rWW8Export.InsUInt16( aSprmIds[m] );
+ m_rWW8Export.InsUInt16( m );
m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(nBoxes0 * 10) );
for ( sal_uInt8 n = 0; n < nBoxes0; n++ )
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 54d1306335b7..35122b2eeab1 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -540,14 +540,14 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const ww8::Frame &rFly,
static const SvxBoxItemLine aLnArr[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT };
- for( sal_uInt8 i = 0; i < 4; ++i )
+ for(const SvxBoxItemLine & i : aLnArr)
{
- const ::editeng::SvxBorderLine* pLn = pBox->GetLine( aLnArr[i] );
+ const ::editeng::SvxBorderLine* pLn = pBox->GetLine( i );
WW8_BRC aBrc;
if (pLn)
{
WW8_BRCVer9 aBrc90 = WW8Export::TranslateBorderLine( *pLn,
- pBox->GetDistance( aLnArr[i] ), bShadow );
+ pBox->GetDistance( i ), bShadow );
sal_uInt8 ico = msfilter::util::TransColToIco(msfilter::util::BGRToRGB(
aBrc90.cv()));
aBrc = WW8_BRC(aBrc90.dptLineWidth(), aBrc90.brcType(), ico,
@@ -558,7 +558,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const ww8::Frame &rFly,
// border will really be in word and adjust accordingly
short nSpacing;
short nThick = aBrc.DetermineBorderProperties(&nSpacing);
- switch (aLnArr[i])
+ switch (i)
{
case SvxBoxItemLine::TOP:
case SvxBoxItemLine::BOTTOM:
@@ -694,13 +694,13 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf,
static const SvxBoxItemLine aLnArr[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT };
- for( sal_uInt8 i = 0; i < 4; ++i )
+ for(const SvxBoxItemLine & i : aLnArr)
{
WW8_BRC aBrc;
short nSpacing;
short nThick = aBrc.DetermineBorderProperties(&nSpacing);
- switch (aLnArr[i])
+ switch (i)
{
case SvxBoxItemLine::TOP:
case SvxBoxItemLine::BOTTOM:
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 5b97f009ef90..6c4cab4577c2 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4073,11 +4073,11 @@ void WW8Export::Out_SwFormatTableBox( ww::bytes& rO, const SvxBoxItem * pBox )
};
static const SvxBorderLine aBorderLine;
- for( int i = 0; i < 4; ++i )
+ for(const SvxBoxItemLine & rBorder : aBorders)
{
const SvxBorderLine* pLn;
if (pBox != nullptr)
- pLn = pBox->GetLine( aBorders[i] );
+ pLn = pBox->GetLine( rBorder );
else
pLn = & aBorderLine;
@@ -5133,10 +5133,8 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox )
const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTextNode& rNode, RedlineType_t aRedlineType)
{
// ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos'
- for( size_t nRedlinePos = 0; nRedlinePos < GetExport().m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedlinePos )
+ for(SwRangeRedline* pRedl : GetExport().m_pDoc->getIDocumentRedlineAccess().GetRedlineTable())
{
- const SwRangeRedline* pRedl = GetExport().m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedlinePos ];
-
// Only check redlines that are of type 'Delete'
if ( pRedl->GetRedlineData().GetType() != aRedlineType )
continue;
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 022a59c7e6a5..0fe0bf5287cf 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1647,9 +1647,9 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj,
RES_UL_SPACE // Aussenabstand Oben/unten: SvxULSpaceItem
};
const SfxPoolItem* pPoolItem;
- for(sal_uInt16 nItem = 0; nItem < nDirectMatch; ++nItem)
+ for(RES_FRMATR i : aDirectMatch)
if( SfxItemState::SET == rOldSet.GetItemState(
- static_cast< sal_uInt16 >(aDirectMatch[ nItem ]), false, &pPoolItem) )
+ static_cast< sal_uInt16 >(i), false, &pPoolItem) )
{
rFlySet.Put( *pPoolItem );
}
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index fc015f486159..e4a5f382c59b 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -446,8 +446,8 @@ void SwWW8ImplReader::PicRead(SvStream *pDataStream, WW8_PIC *pPic,
WW8_PIC_SHADOW aPicS;
pDataStream->Read( &aPicS, sizeof( aPicS ) );
WW8PicShadowToReal( &aPicS, pPic );
- for (int i=0;i<4;i++)
- pDataStream->Read( &pPic->rgbrc[i], bVer67 ? 2 : 4);
+ for (WW8_BRC & i : pPic->rgbrc)
+ pDataStream->Read( &i, bVer67 ? 2 : 4);
pDataStream->ReadInt16( pPic->dxaOrigin );
pDataStream->ReadInt16( pPic->dyaOrigin );
if (!bVer67)
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 97240285f392..48ad5d0ce09a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5386,9 +5386,9 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
}
}
// Remove additional pictures
- for (size_t i = 0; i < vecFrameFormat.size(); ++i)
+ for (SwFrameFormat* p : vecFrameFormat)
{
- m_rDoc.getIDocumentLayoutAccess().DelLayoutFormat(vecFrameFormat[i]);
+ m_rDoc.getIDocumentLayoutAccess().DelLayoutFormat(p);
}
}
}
@@ -5848,10 +5848,8 @@ void SwWW8ImplReader::SetOutlineStyles()
const SwNumRule* pChosenWW8ListStyle = nullptr;
{
std::map<const SwNumRule*, int> aWW8ListStyleCounts;
- for (size_t nI = 0; nI < m_vColl.size(); ++nI)
+ for (SwWW8StyInf & rSI : m_vColl)
{
- SwWW8StyInf& rSI = m_vColl[nI];
-
if (!rSI.IsWW8BuiltInHeadingStyle() || !rSI.HasWW8OutlineLevel())
{
continue;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 5364347f8c9c..b7f2129093c9 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -94,8 +94,8 @@ public:
WW8TabBandDesc::WW8TabBandDesc()
{
memset(this, 0, sizeof(*this));
- for (size_t i = 0; i < sizeof(maDirections)/sizeof(sal_uInt16); ++i)
- maDirections[i] = 4;
+ for (sal_uInt16 & rn : maDirections)
+ rn = 4;
}
WW8TabBandDesc::~WW8TabBandDesc()
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index efc41222338c..7b0d024df430 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1192,8 +1192,8 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
rSt.ReadUInt32( aLST.nIdLst );
rSt.ReadUInt32( aLST.nTplC );
- for (sal_uInt16 nLevel = 0; nLevel < nMaxLevel; ++nLevel)
- rSt.ReadUInt16( aLST.aIdSty[ nLevel ] );
+ for (sal_uInt16 & nLevel : aLST.aIdSty)
+ rSt.ReadUInt16( nLevel );
sal_uInt8 aBits1(0);
rSt.ReadUChar( aBits1 );
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index ef9f474d1613..a72b08365fa3 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -3241,9 +3241,8 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
// the entry correctly, but I currently have no clue how to obtain
// the tab stop position. It is _not_ set at the paragraph style.
SwForm* pForm = nullptr;
- for (size_t nI = 0; nI < m_vColl.size(); ++nI)
+ for (SwWW8StyInf & rSI : m_vColl)
{
- const SwWW8StyInf& rSI = m_vColl[nI];
if (rSI.IsOutlineNumbered())
{
sal_uInt16 nStyleLevel = rSI.mnWW8OutlineLevel;
diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx
index 73bee7ba6d89..49a10ccf3e01 100644
--- a/sw/source/filter/xml/xmlfonte.cxx
+++ b/sw/source/filter/xml/xmlfonte.cxx
@@ -46,10 +46,8 @@ SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(
const SfxItemPool& rPool = _rExport.getDoc()->GetAttrPool();
const SfxPoolItem* pItem;
- for( size_t i=0; i < SAL_N_ELEMENTS(aWhichIds); ++i )
+ for(sal_uInt16 nWhichId : aWhichIds)
{
- const sal_uInt16 nWhichId = aWhichIds[i];
-
const SvxFontItem& rFont =
static_cast<const SvxFontItem&>(rPool.GetDefaultItem( nWhichId ));
Add( rFont.GetFamilyName(), rFont.GetStyleName(),
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 1b4a1802746f..d1bb91069812 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -1198,8 +1198,8 @@ void SwXMLExport::DeleteTableLines()
{
if ( pTableLines )
{
- for ( size_t i = 0, n = pTableLines->size(); i < n; ++i )
- delete pTableLines->at( i );
+ for (SwXMLTableLines_Impl* p : *pTableLines)
+ delete p;
pTableLines->clear();
delete pTableLines;
}
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 8b0cf830db5d..96915cd1de80 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2781,8 +2781,8 @@ void SwXMLTableContext::MakeTable()
pFrameFormat->SetFormatAttr( aSize );
pFrameFormat->UnlockModify();
- for (size_t i = 0; i < m_pRows->size(); i++)
- (*m_pRows)[i]->Dispose();
+ for (std::unique_ptr<SwXMLTableRow_Impl> & rRow : *m_pRows)
+ rRow->Dispose();
// now that table is complete, change into DDE table (if appropriate)
if (nullptr != m_pDDESource)
@@ -2822,10 +2822,10 @@ void SwXMLTableContext::MakeTable( SwTableBox *pBox, sal_Int32 nW )
MakeTable_( pBox );
- for (size_t i = 0; i < m_pRows->size(); ++i)
+ for (std::unique_ptr<SwXMLTableRow_Impl> & rpRow : *m_pRows)
{
// i#113600, to break the cyclic reference to SwXMLTableContext object
- (*m_pRows)[i]->Dispose();
+ rpRow->Dispose();
}
}
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 9a0d509bfa02..84c3cf26df57 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -502,9 +502,9 @@ IMPL_LINK_NOARG_TYPED(SwAddPrinterTabPage, AutoClickHdl, Button*, void)
void SwAddPrinterTabPage::SetFax( const std::vector<OUString>& rFaxLst )
{
m_pFaxLB->InsertEntry(sNone);
- for(size_t i = 0; i < rFaxLst.size(); ++i)
+ for(const auto & i : rFaxLst)
{
- m_pFaxLB->InsertEntry(rFaxLst[i]);
+ m_pFaxLB->InsertEntry(i);
}
m_pFaxLB->SelectEntryPos(0);
}
@@ -527,8 +527,8 @@ void SwAddPrinterTabPage::PageCreated( const SfxAllItemSet& aSet)
{
std::vector<OUString> aFaxList;
const std::vector<OUString>& rPrinters = Printer::GetPrinterQueues();
- for (size_t i = 0; i < rPrinters.size(); ++i)
- aFaxList.insert(aFaxList.begin(), rPrinters[i]);
+ for (const auto & rPrinter : rPrinters)
+ aFaxList.insert(aFaxList.begin(), rPrinter);
SetFax( aFaxList );
}
}
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index e9f706e2b4d2..c1babe196bbf 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1446,10 +1446,10 @@ void SwInsertDBColAutoPilot::SetTabSet()
SvxBrushItem aBrush( RES_BACKGROUND );
static const sal_uInt16 aIds[3] =
{ RES_BACKGROUND, SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE };
- for( int i = 0; i < 3; ++i )
- if( SfxItemState::SET == pTableSet->GetItemState( aIds[ i ],
+ for(sal_uInt16 i : aIds)
+ if( SfxItemState::SET == pTableSet->GetItemState( i,
false, &pItem ) && *pItem == aBrush )
- pTableSet->ClearItem( aIds[ i ] );
+ pTableSet->ClearItem( i );
}
if( SfxItemState::SET == pTableSet->GetItemState( FN_PARAM_TABLE_NAME, false,
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index ec3db5868a60..60eaf5c04fdf 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -137,10 +137,10 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
bool bDouble = false;
- for (size_t nRecPos = 0; nRecPos < m_pRecs->size(); ++nRecPos)
+ for (std::unique_ptr<SwLabRec> & i : *m_pRecs)
{
- if (pRec->aMake == (*m_pRecs)[nRecPos]->aMake &&
- pRec->aType == (*m_pRecs)[nRecPos]->aType)
+ if (pRec->aMake == i->aMake &&
+ pRec->aType == i->aType)
{
bDouble = true;
break;
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index c85dd0029432..f5b0a9393efd 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -612,9 +612,9 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFormatPage* pParent, SwLabRec& rRec)
SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig();
const std::vector<OUString>& rMan = rCfg.GetManufacturers();
- for (size_t i = 0; i < rMan.size(); ++i)
+ for (const auto & i : rMan)
{
- m_pMakeCB->InsertEntry(rMan[i]);
+ m_pMakeCB->InsertEntry(i);
}
}
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index c9df9c01070f..4c880b932754 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -679,12 +679,12 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
{
std::vector<OUString> aLst;
GetFieldMgr().GetSubTypes(nTypeId, aLst);
- for(size_t i = 0; i < aLst.size(); ++i)
+ for(const OUString & i : aLst)
{
- bool isSubstring = MatchSubstring( aLst[i] , filterString );
+ bool isSubstring = MatchSubstring( i , filterString );
if(isSubstring)
{
- m_pSelectionLB->InsertEntry(aLst[i]);
+ m_pSelectionLB->InsertEntry(i);
}
}
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 075a0b683565..8b7a175b82db 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -514,11 +514,11 @@ static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePo
{SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
{SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
};
- for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex)
+ for(const StringIdPair_Impl & rHoriId : aHoriIds)
{
- if(aHoriIds[nIndex].eHori == eStringId)
+ if(rHoriId.eHori == eStringId)
{
- eStringId = aHoriIds[nIndex].eVert;
+ eStringId = rHoriId.eVert;
return eStringId;
}
}
@@ -552,12 +552,11 @@ static sal_uLong lcl_GetLBRelationsForRelations( const sal_Int16 _nRel )
{
sal_uLong nLBRelations = 0L;
- const size_t nRelMapSize = SAL_N_ELEMENTS(aRelationMap);
- for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
+ for (RelationMap & i : aRelationMap)
{
- if ( aRelationMap[nRelMapPos].nRelation == _nRel )
+ if ( i.nRelation == _nRel )
{
- nLBRelations |= aRelationMap[nRelMapPos].nLBRelation;
+ nLBRelations |= i.nLBRelation;
}
}
@@ -792,12 +791,12 @@ void SwFramePage::setOptimalFrameWidth()
};
std::vector<SvxSwFramePosString::StringId> aFrames;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
+ for (const FrameMaps & rMap : aMaps)
{
- for (size_t j = 0; j < aMaps[i].nCount; ++j)
+ for (size_t j = 0; j < rMap.nCount; ++j)
{
- aFrames.push_back(aMaps[i].pMap[j].eStrId);
- aFrames.push_back(aMaps[i].pMap[j].eMirrorStrId);
+ aFrames.push_back(rMap.pMap[j].eStrId);
+ aFrames.push_back(rMap.pMap[j].eMirrorStrId);
}
}
@@ -833,12 +832,12 @@ void SwFramePage::setOptimalRelWidth()
};
std::vector<SvxSwFramePosString::StringId> aRels;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aMaps); ++i)
+ for (const RelationMaps & rMap : aMaps)
{
- for (size_t j = 0; j < aMaps[i].nCount; ++j)
+ for (size_t j = 0; j < rMap.nCount; ++j)
{
- aRels.push_back(aMaps[i].pMap[j].eStrId);
- aRels.push_back(aMaps[i].pMap[j].eMirrorStrId);
+ aRels.push_back(rMap.pMap[j].eStrId);
+ aRels.push_back(rMap.pMap[j].eMirrorStrId);
}
}
@@ -1464,7 +1463,6 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap,
if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
{
const OUString sOldEntry(_rLB.GetSelectEntry());
- const size_t nRelCount = SAL_N_ELEMENTS(aAsCharRelationMap);
SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
@@ -1472,11 +1470,11 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap,
if (_pMap[nMapPos].eStrId == eStrId)
{
nLBRelations = _pMap[nMapPos].nLBRelations;
- for (size_t nRelPos = 0; nRelPos < nRelCount; ++nRelPos)
+ for (RelationMap & rCharMap : aAsCharRelationMap)
{
- if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
+ if (nLBRelations & rCharMap.nLBRelation)
{
- SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId;
+ SvxSwFramePosString::StringId sStrId1 = rCharMap.eStrId;
// --> OD 2009-08-31 #mongolianlayout#
sStrId1 =
@@ -1486,7 +1484,7 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap,
m_bIsInRightToLeft);
const OUString sEntry = m_aFramePosString.GetString(sStrId1);
sal_Int32 nPos = _rLB.InsertEntry(sEntry);
- _rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]);
+ _rLB.SetEntryData(nPos, &rCharMap);
if (_pMap[nMapPos].nAlign == _nAlign)
sSelEntry = sEntry;
break;
@@ -1531,18 +1529,16 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap,
nLBRelations = _pMap[_nLBSelPos].nLBRelations;
}
- const size_t nRelCount = SAL_N_ELEMENTS(aRelationMap);
-
for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
{
if (nLBRelations & nBit)
{
- for (size_t nRelPos = 0; nRelPos < nRelCount; ++nRelPos)
+ for (RelationMap & rMap : aRelationMap)
{
- if (aRelationMap[nRelPos].nLBRelation == nBit)
+ if (rMap.nLBRelation == nBit)
{
SvxSwFramePosString::StringId eStrId1 = m_pMirrorPagesCB->IsChecked() ?
- aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
+ rMap.eMirrorStrId : rMap.eStrId;
// --> OD 2009-08-31 #mongolianlayout#
eStrId1 =
lcl_ChangeResIdToVerticalOrRTL( eStrId1,
@@ -1551,8 +1547,8 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap,
m_bIsInRightToLeft);
const OUString sEntry = m_aFramePosString.GetString(eStrId1);
sal_Int32 nPos = _rLB.InsertEntry(sEntry);
- _rLB.SetEntryData(nPos, &aRelationMap[nRelPos]);
- if (sSelEntry.isEmpty() && aRelationMap[nRelPos].nRelation == _nRel)
+ _rLB.SetEntryData(nPos, &rMap);
+ if (sSelEntry.isEmpty() && rMap.nRelation == _nRel)
sSelEntry = sEntry;
}
}
@@ -1866,10 +1862,10 @@ void SwFramePage::RangeModifyHdl()
const SwFormatCol& rCol = static_cast<const SwFormatCol&>(GetTabDialog()->GetExampleSet()->Get(RES_COL));
if ( rCol.GetColumns().size() > 1 )
{
- for ( size_t i = 0; i < rCol.GetColumns().size(); ++i )
+ for (const SwColumn & i : rCol.GetColumns())
{
- aVal.nMinWidth += rCol.GetColumns()[i].GetLeft() +
- rCol.GetColumns()[i].GetRight() +
+ aVal.nMinWidth += i.GetLeft() +
+ i.GetRight() +
MINFLY;
}
aVal.nMinWidth -= MINFLY;//one was already in there!
@@ -2170,9 +2166,7 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset)
} aGlbNmIds[4] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
{ SO3_SM_CLASSID_40 }, { SO3_SM_CLASSID_30 } };
- for ( int i = 0; i < 4; ++i ) {
- const GlobalNameId& rId = aGlbNmIds[ i ];
-
+ for (const GlobalNameId & rId : aGlbNmIds) {
SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
rId.b8, rId.b9, rId.b10, rId.b11,
rId.b12, rId.b13, rId.b14, rId.b15 );
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 4a329ebb372e..c7a5e82f59ed 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -4121,9 +4121,9 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 ));
rtl_TextEncoding eTEnc = osl_getThreadTextEncoding();
- for(size_t i = 0; i < m_Entries.size(); i++)
+ for(std::unique_ptr<AutoMarkEntry> & rpEntry : m_Entries)
{
- AutoMarkEntry* pEntry = m_Entries[i].get();
+ AutoMarkEntry* pEntry = rpEntry.get();
if(!pEntry->sComment.isEmpty())
{
rOutStr.WriteByteStringLine( "#" + pEntry->sComment, eTEnc );
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 96e9c497c96d..2419980d65ad 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1188,8 +1188,8 @@ IMPL_LINK_TYPED( SwAuthorMarkPane, CompEntryHdl, ListBox&, rBox, void)
}
if (rBox.GetSelectEntry().isEmpty())
{
- for(int i = 0; i < AUTH_FIELD_END; i++)
- m_sFields[i].clear();
+ for(OUString & s : m_sFields)
+ s.clear();
}
m_pAuthorFI->SetText(m_sFields[AUTH_FIELD_AUTHOR]);
m_pTitleFI->SetText(m_sFields[AUTH_FIELD_TITLE]);
@@ -1223,9 +1223,9 @@ IMPL_LINK_NOARG_TYPED(SwAuthorMarkPane, InsertHdl, Button*, void)
SwFieldMgr aMgr(pSh);
OUString sFields;
- for(int i = 0; i < AUTH_FIELD_END; i++)
+ for(OUString & s : m_sFields)
{
- sFields += m_sFields[i] + OUStringLiteral1<TOX_STYLE_DELIMITER>();
+ sFields += s + OUStringLiteral1<TOX_STYLE_DELIMITER>();
}
if(bNewEntry)
{
@@ -1343,8 +1343,8 @@ IMPL_LINK_TYPED(SwAuthorMarkPane, ChangeSourceHdl, Button*, pButton, void)
{
std::vector<OUString> aIds;
pFType->GetAllEntryIdentifiers( aIds );
- for(size_t n = 0; n < aIds.size(); ++n)
- m_pEntryLB->InsertEntry(aIds[n]);
+ for(const OUString & i : aIds)
+ m_pEntryLB->InsertEntry(i);
}
if(!m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].isEmpty())
m_pEntryLB->InsertEntry(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
@@ -1486,8 +1486,8 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
{
std::vector<OUString> aIds;
pFType->GetAllEntryIdentifiers( aIds );
- for(size_t n = 0; n < aIds.size(); ++n)
- pIdentifierBox->InsertEntry(aIds[n]);
+ for(const OUString & i : aIds)
+ pIdentifierBox->InsertEntry(i);
}
pIdentifierBox->SetText(pFields[aCurInfo.nToxField]);
pIdentifierBox->set_grid_left_attach(1);
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index a72004ed603d..03b7f6269ea4 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -250,12 +250,12 @@ bool SwInsertBookmarkDlg::HaveBookmarksChanged()
return true;
IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
- for (sal_Int32 i = 0; i < static_cast<sal_Int32>(aTableBookmarks.size()); i++)
+ for (std::pair<sw::mark::IMark*,OUString> & aTableBookmark : aTableBookmarks)
{
if (IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
{
- if (aTableBookmarks[i].first != ppBookmark->get() ||
- aTableBookmarks[i].second != ppBookmark->get()->GetName())
+ if (aTableBookmark.first != ppBookmark->get() ||
+ aTableBookmark.second != ppBookmark->get()->GetName())
return true;
}
++ppBookmark;
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index bd335e1892d4..ce1ea9b90ed7 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -874,16 +874,16 @@ IMPL_LINK_TYPED( SwTableColumnPage, AutoClickHdl, Button*, pControl, void )
{
if(aValueTable[0] > 0)
{
- for( sal_uInt16 i=0; i < MET_FIELDS; i++ )
- aValueTable[i] -= 1;
+ for(sal_uInt16 & rn : aValueTable)
+ rn -= 1;
}
}
if (pControl == m_pUpBtn.get())
{
if( aValueTable[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
{
- for(sal_uInt16 i=0;i < MET_FIELDS;i++)
- aValueTable[i] += 1;
+ for(sal_uInt16 & rn : aValueTable)
+ rn += 1;
}
}
for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
@@ -939,11 +939,11 @@ IMPL_LINK_TYPED( SwTableColumnPage, ModeHdl, Button*, pBox, void )
bool SwTableColumnPage::FillItemSet( SfxItemSet* )
{
- for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
+ for(PercentField & i : m_aFieldArr)
{
- if (m_aFieldArr[i].HasFocus())
+ if (i.HasFocus())
{
- LoseFocusHdl(*m_aFieldArr[i].get());
+ LoseFocusHdl(*i.get());
break;
}
}
diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx
index e9b0cd34942d..cb1384d1122e 100644
--- a/sw/source/ui/vba/vbadialog.cxx
+++ b/sw/source/ui/vba/vbadialog.cxx
@@ -40,9 +40,8 @@ static const WordDialogTable aWordDialogTable[] =
OUString
SwVbaDialog::mapIndexToName( sal_Int32 nIndex )
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(aWordDialogTable); ++i)
+ for (const WordDialogTable & rTable : aWordDialogTable)
{
- const WordDialogTable& rTable = aWordDialogTable[i];
if( nIndex == rTable.wdDialog )
{
return OUString::createFromAscii( rTable.ooDialog );
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index a4a0a557621c..dcbfba26e97e 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -2956,43 +2956,43 @@ void SwStyleSheetIterator::AppendStyleList(const ::std::vector<OUString>& rList,
{
SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
bool bUsed = false;
- for ( size_t i=0; i < rList.size(); ++i )
+ for (const auto & i : rList)
{
bool bHidden = false;
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rList[i], (SwGetPoolIdFromName)nSection);
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, (SwGetPoolIdFromName)nSection);
switch ( nSection )
{
case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
{
bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
- SwFormat* pFormat = rDoc.FindTextFormatCollByName( rList[i] );
+ SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
bHidden = pFormat && pFormat->IsHidden( );
}
break;
case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
{
bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
- SwFormat* pFormat = rDoc.FindCharFormatByName( rList[i] );
+ SwFormat* pFormat = rDoc.FindCharFormatByName( i );
bHidden = pFormat && pFormat->IsHidden( );
}
break;
case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
{
bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
- SwFormat* pFormat = rDoc.FindFrameFormatByName( rList[i] );
+ SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
bHidden = pFormat && pFormat->IsHidden( );
}
break;
case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
{
bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
- SwPageDesc* pPgDesc = rDoc.FindPageDesc(rList[i]);
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
bHidden = pPgDesc && pPgDesc->IsHidden( );
}
break;
case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE:
{
- SwNumRule* pRule = rDoc.FindNumRulePtr( rList[i] );
+ SwNumRule* pRule = rDoc.FindNumRulePtr( i );
bUsed = pRule && SwDoc::IsUsed( *pRule );
bHidden = pRule && pRule->IsHidden( );
}
@@ -3003,7 +3003,7 @@ void SwStyleSheetIterator::AppendStyleList(const ::std::vector<OUString>& rList,
bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
- aLst.Append( cType, rList[i] );
+ aLst.Append( cType, i );
}
}
diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx
index b61d681cda91..a1968cf4b4bc 100644
--- a/sw/source/uibase/app/mainwn.cxx
+++ b/sw/source/uibase/app/mainwn.cxx
@@ -38,9 +38,8 @@ static std::vector<SwProgress*> *pProgressContainer = nullptr;
static SwProgress *lcl_SwFindProgress( SwDocShell *pDocShell )
{
- for ( size_t i = 0; i < pProgressContainer->size(); ++i )
+ for (SwProgress* pTmp : *pProgressContainer)
{
- SwProgress *pTmp = (*pProgressContainer)[i];
if ( pTmp->pDocShell == pDocShell )
return pTmp;
}
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 01805bca5bd1..277b8244dd9d 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -73,14 +73,14 @@ void SwChapterNumRules::Save()
SwChapterNumRules::~SwChapterNumRules()
{
- for( sal_uInt16 i = 0; i < nMaxRules; ++i )
- delete pNumRules[i];
+ for(SwNumRulesWithName* pNumRule : pNumRules)
+ delete pNumRule;
}
void SwChapterNumRules::Init()
{
- for(sal_uInt16 i = 0; i < nMaxRules; ++i )
- pNumRules[i] = nullptr;
+ for(SwNumRulesWithName* & rpNumRule : pNumRules)
+ rpNumRule = nullptr;
OUString sNm(CHAPTER_FILENAME);
SvtPathOptions aOpt;
@@ -136,8 +136,8 @@ SwNumRulesWithName::SwNumRulesWithName( const SwNumRulesWithName& rCopy )
SwNumRulesWithName::~SwNumRulesWithName()
{
- for( int n = 0; n < MAXLEVEL; ++n )
- delete aFormats[ n ];
+ for(SwNumFormatGlobal* p : aFormats)
+ delete p;
}
const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCopy)
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 630149f39d9b..08bf9c1b29d3 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -441,10 +441,9 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName,
std::unique_ptr<AbstractSwSelGlossaryDlg> pDlg(pFact->CreateSwSelGlossaryDlg(aShortName));
assert(pDlg && "Dialog creation failed!");
- for(size_t i = 0; i < aFoundArr.size(); ++i)
+ for(TextBlockInfo_Impl & i : aFoundArr)
{
- TextBlockInfo_Impl* pData = &aFoundArr[i];
- pDlg->InsertGlos(pData->sTitle, pData->sLongName);
+ pDlg->InsertGlos(i.sTitle, i.sLongName);
}
pDlg->SelectEntryPos(0);
const sal_Int32 nRet = RET_OK == pDlg->Execute()?
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 36acfa22a632..1ef3524c1872 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -606,40 +606,40 @@ void SwPostItMgr::LayoutPostIts()
// - place SwPostIts on their initial position
// - calculate necessary height for all PostIts together
bool bUpdate = false;
- for (unsigned long n=0;n<mPages.size();n++)
+ for (SwPostItPageItem* pPage : mPages)
{
// only layout if there are notes on this page
- if (mPages[n]->mList->size()>0)
+ if (pPage->mList->size()>0)
{
std::list<SwSidebarWin*> aVisiblePostItList;
unsigned long lNeededHeight = 0;
long mlPageBorder = 0;
long mlPageEnd = 0;
- for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i != mPages[n]->mList->end(); ++i)
+ for(SwSidebarItem_iterator i = pPage->mList->begin(); i != pPage->mList->end(); ++i)
{
SwSidebarItem* pItem = (*i);
SwSidebarWin* pPostIt = pItem->pPostIt;
- if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
+ if (pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
{
// x value for notes positioning
- mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true);
+ mlPageBorder = mpEditWin->LogicToPixel( Point( pPage->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true);
//bending point
mlPageEnd =
mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE)
? pItem->maLayoutInfo.mPagePrtArea.Left()
- : mPages[n]->mPageRect.Left() + 350;
+ : pPage->mPageRect.Left() + 350;
}
- else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
+ else if (pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
{
// x value for notes positioning
- mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true);
+ mlPageBorder = mpEditWin->LogicToPixel( Point(pPage->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true);
//bending point
mlPageEnd =
mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE)
? pItem->maLayoutInfo.mPagePrtArea.Right() :
- mPages[n]->mPageRect.Right() - 350;
+ pPage->mPageRect.Right() - 350;
}
if (pItem->bShow)
@@ -666,7 +666,7 @@ void SwPostItMgr::LayoutPostIts()
pPostIt->SetChangeTracking(
pItem->mLayoutStatus,
GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
- pPostIt->SetSidebarPosition(mPages[n]->eSidebarPosition);
+ pPostIt->SetSidebarPosition(pPage->eSidebarPosition);
pPostIt->SetFollow(pPostIt->CalcFollow());
aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
? pPostIt->GetMinimumSizeWithoutMeta()
@@ -699,25 +699,25 @@ void SwPostItMgr::LayoutPostIts()
if ((!aVisiblePostItList.empty()) && ShowNotes())
{
- bool bOldScrollbar = mPages[n]->bScrollbar;
+ bool bOldScrollbar = pPage->bScrollbar;
if (ShowNotes())
- mPages[n]->bScrollbar = LayoutByPage(aVisiblePostItList, mPages[n]->mPageRect.SVRect(), lNeededHeight);
+ pPage->bScrollbar = LayoutByPage(aVisiblePostItList, pPage->mPageRect.SVRect(), lNeededHeight);
else
- mPages[n]->bScrollbar = false;
- if (!mPages[n]->bScrollbar)
+ pPage->bScrollbar = false;
+ if (!pPage->bScrollbar)
{
- mPages[n]->lOffset = 0;
+ pPage->lOffset = 0;
}
else
{
//when we changed our zoom level, the offset value can be to big, so lets check for the largest possible zoom value
- long aAvailableHeight = mpEditWin->LogicToPixel(Size(0,mPages[n]->mPageRect.Height())).Height() - 2 * GetSidebarScrollerHeight();
+ long aAvailableHeight = mpEditWin->LogicToPixel(Size(0,pPage->mPageRect.Height())).Height() - 2 * GetSidebarScrollerHeight();
long lOffset = -1 * GetScrollSize() * (aVisiblePostItList.size() - aAvailableHeight / GetScrollSize());
- if (mPages[n]->lOffset < lOffset)
- mPages[n]->lOffset = lOffset;
+ if (pPage->lOffset < lOffset)
+ pPage->lOffset = lOffset;
}
- bUpdate = (bOldScrollbar != mPages[n]->bScrollbar) || bUpdate;
- const long aSidebarheight = mPages[n]->bScrollbar ? mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height() : 0;
+ bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
+ const long aSidebarheight = pPage->bScrollbar ? mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height() : 0;
/*
TODO
- enlarge all notes till GetNextBorder(), as we resized to average value before
@@ -725,36 +725,36 @@ void SwPostItMgr::LayoutPostIts()
//lets hide the ones which overlap the page
for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
{
- if (mPages[n]->lOffset != 0)
- (*i)->TranslateTopPosition(mPages[n]->lOffset);
+ if (pPage->lOffset != 0)
+ (*i)->TranslateTopPosition(pPage->lOffset);
- bool bBottom = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y()+(*i)->VirtualSize().Height())).Y() <= (mPages[n]->mPageRect.Bottom()-aSidebarheight);
- bool bTop = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() >= (mPages[n]->mPageRect.Top()+aSidebarheight);
+ bool bBottom = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y()+(*i)->VirtualSize().Height())).Y() <= (pPage->mPageRect.Bottom()-aSidebarheight);
+ bool bTop = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() >= (pPage->mPageRect.Top()+aSidebarheight);
if ( bBottom && bTop )
{
(*i)->ShowNote();
}
else
{
- if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (mPages[n]->mPageRect.Top()+aSidebarheight))
+ if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (pPage->mPageRect.Top()+aSidebarheight))
{
- if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
- (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Left(),
- mPages[n]->mPageRect.Top()));
- else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
- (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Right(),
- mPages[n]->mPageRect.Top()));
+ if ( pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
+ (*i)->ShowAnchorOnly(Point( pPage->mPageRect.Left(),
+ pPage->mPageRect.Top()));
+ else if ( pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
+ (*i)->ShowAnchorOnly(Point( pPage->mPageRect.Right(),
+ pPage->mPageRect.Top()));
}
else
{
- if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
- (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Left(),
- mPages[n]->mPageRect.Bottom()));
- else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
- (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Right(),
- mPages[n]->mPageRect.Bottom()));
+ if ( pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
+ (*i)->ShowAnchorOnly(Point(pPage->mPageRect.Left(),
+ pPage->mPageRect.Bottom()));
+ else if ( pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT )
+ (*i)->ShowAnchorOnly(Point(pPage->mPageRect.Right(),
+ pPage->mPageRect.Bottom()));
}
- OSL_ENSURE(mPages[n]->bScrollbar,"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
+ OSL_ENSURE(pPage->bScrollbar,"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
}
}
}
@@ -763,17 +763,17 @@ void SwPostItMgr::LayoutPostIts()
for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
(*i)->SetPosAndSize();
- bool bOldScrollbar = mPages[n]->bScrollbar;
- mPages[n]->bScrollbar = false;
- bUpdate = (bOldScrollbar != mPages[n]->bScrollbar) || bUpdate;
+ bool bOldScrollbar = pPage->bScrollbar;
+ pPage->bScrollbar = false;
+ bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
}
aVisiblePostItList.clear();
}
else
{
- if (mPages[n]->bScrollbar)
+ if (pPage->bScrollbar)
bUpdate = true;
- mPages[n]->bScrollbar = false;
+ pPage->bScrollbar = false;
}
}
@@ -1584,24 +1584,24 @@ SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
long SwPostItMgr::GetNextBorder()
{
- for (unsigned long n=0;n<mPages.size();n++)
+ for (SwPostItPageItem* pPage : mPages)
{
- for(SwSidebarItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); ++b)
+ for(SwSidebarItem_iterator b = pPage->mList->begin(); b!= pPage->mList->end(); ++b)
{
if ((*b)->pPostIt == mpActivePostIt)
{
SwSidebarItem_iterator aNext = b;
++aNext;
- bool bFollow = (aNext != mPages[n]->mList->end()) && (*aNext)->pPostIt->IsFollow();
- if ( mPages[n]->bScrollbar || bFollow )
+ bool bFollow = (aNext != pPage->mList->end()) && (*aNext)->pPostIt->IsFollow();
+ if ( pPage->bScrollbar || bFollow )
{
return -1;
}
else
{
//if this is the last item, return the bottom border otherwise the next item
- if (aNext == mPages[n]->mList->end())
- return mpEditWin->LogicToPixel(Point(0,mPages[n]->mPageRect.Bottom())).Y() - GetSpaceBetween();
+ if (aNext == pPage->mList->end())
+ return mpEditWin->LogicToPixel(Point(0,pPage->mPageRect.Bottom())).Y() - GetSpaceBetween();
else
return (*aNext)->pPostIt->GetPosPixel().Y() - GetSpaceBetween();
}
@@ -1830,14 +1830,14 @@ void SwPostItMgr::CorrectPositions()
{
long aAnchorPosX = 0;
long aAnchorPosY = 0;
- for (unsigned long n=0;n<mPages.size();n++)
+ for (SwPostItPageItem* pPage : mPages)
{
- for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i != mPages[n]->mList->end(); ++i)
+ for(SwSidebarItem_iterator i = pPage->mList->begin(); i != pPage->mList->end(); ++i)
{
// check, if anchor overlay object exists.
if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() )
{
- aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT
+ aAnchorPosX = pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT
? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
: mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 621277e0a475..91ada90b7358 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -917,10 +917,9 @@ void SwSidebarWin::SetPosAndSize()
pTmpCursorForAnnotationTextRange->FillRects();
SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
- for( size_t a(0); a < pRects->size(); ++a )
+ for(SwRect & rNextRect : *pRects)
{
- const SwRect aNextRect((*pRects)[a]);
- const Rectangle aPntRect(aNextRect.SVRect());
+ const Rectangle aPntRect(rNextRect.SVRect());
aAnnotationTextRanges.push_back(basegfx::B2DRange(
aPntRect.Left(), aPntRect.Top(),
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 5a4c0b7ddf3a..39cc8eaba67f 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6137,10 +6137,8 @@ void QuickHelpData::FillStrArr( SwWrtShell& rSh, const OUString& rWord )
if ( rACList.GetWordsMatching( rWord, strings ) )
{
- for (size_t i= 0; i<strings.size(); i++)
+ for (const OUString & aCompletedString : strings)
{
- OUString aCompletedString = strings[i];
-
// when we have a matching current date, avoid to suggest
// other words with the same matching starting characters,
// for example 2016-01-3 instead of 2016-01-30
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 7ceaf547d2aa..f5784b87e3ba 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -725,9 +725,8 @@ void SwSrcEditWindow::ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineO
}
}
- for ( size_t i = 0; i < aPortionList.size(); i++ )
+ for (TextPortion & r : aPortionList)
{
- TextPortion& r = aPortionList[i];
if ( r.nStart > r.nEnd ) // only until Bug from MD is resolved
continue;
if(r.eType != svtools::HTMLSGML &&
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index b8c04d8b5a2a..9f02086a8aa4 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1604,9 +1604,9 @@ void SwFieldType::GetFieldName_()
// insert infos for fields
SwFieldType::s_pFieldNames = new std::vector<OUString>;
SwFieldType::s_pFieldNames->reserve(SAL_N_ELEMENTS(coFieldNms));
- for( sal_uInt16 nIdx = 0; nIdx < SAL_N_ELEMENTS(coFieldNms); ++nIdx )
+ for(sal_uInt16 i : coFieldNms)
{
- const OUString aTmp(SW_RES( coFieldNms[ nIdx ] ));
+ const OUString aTmp(SW_RES( i ));
SwFieldType::s_pFieldNames->push_back(MnemonicGenerator::EraseAllMnemonicChars( aTmp ));
}
}
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 16cf70852094..0eff29ad9929 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -614,18 +614,16 @@ void SwSpellPopup::checkRedline()
};
SwDoc *pDoc = m_pSh->GetDoc();
SfxItemSet aSet(pDoc->GetAttrPool(), FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_PREV_CHANGE);
- for (size_t i = 0; i < SAL_N_ELEMENTS(pRedlineIds); ++i)
+ for (sal_uInt16 nWhich : pRedlineIds)
{
- const sal_uInt16 nWhich = pRedlineIds[i];
aSet.Put(SfxVoidItem(nWhich), nWhich);
}
m_pSh->GetView().GetState(aSet);
// Enable/disable items based on if the which id of the void items are
// cleared or not.
- for (size_t i = 0; i < SAL_N_ELEMENTS(pRedlineIds); ++i)
+ for (sal_uInt16 nWhich : pRedlineIds)
{
- const sal_uInt16 nWhich = pRedlineIds[i];
EnableItem(nWhich, aSet.Get(nWhich).Which());
}
}
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index d2e85e9e6c39..009211c77d91 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -56,8 +56,6 @@
#error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added?
#endif
-#define ZOOM_ENTRIES 9
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -304,9 +302,8 @@ void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt )
void SwScrollNaviPopup::ApplyImageList()
{
ImageList& rImgLst = aIList;
- for(sal_uInt16 i = 0; i < NID_COUNT; i++)
+ for(sal_uInt16 nNaviId : aNavigationInsertIds)
{
- sal_uInt16 nNaviId = aNavigationInsertIds[i];
m_pToolBox->SetItemImage(nNaviId, rImgLst.GetImage(nNaviId));
}
}
@@ -413,9 +410,9 @@ SwZoomBox_Impl::SwZoomBox_Impl(
RID_SVXSTR_ZOOM_150 , RID_SVXSTR_ZOOM_200 ,
RID_SVXSTR_ZOOM_WHOLE_PAGE, RID_SVXSTR_ZOOM_PAGE_WIDTH ,
RID_SVXSTR_ZOOM_OPTIMAL_VIEW };
- for(sal_uInt16 i = 0; i < ZOOM_ENTRIES ; i++)
+ for(sal_uInt16 aZoomValue : aZoomValues)
{
- OUString sEntry = SVX_RESSTR( aZoomValues[i] );
+ OUString sEntry = SVX_RESSTR( aZoomValue );
InsertEntry(sEntry);
}
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index 8ac54052c7c1..bc9aa3268445 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -339,25 +339,25 @@ namespace SwLangHelper
OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
if (pEditEngine)
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLangWhichId_EE); ++i)
- rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_EE[i] ));
+ for (sal_uInt16 i : aLangWhichId_EE)
+ rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
}
else
{
rWrtSh.GetCurAttr( rCoreSet );
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLangWhichId_Writer); ++i)
- rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ));
+ for (sal_uInt16 i : aLangWhichId_Writer)
+ rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
rWrtSh.SetAttrSet( rCoreSet );
}
}
else // change language for all text
{
std::set<sal_uInt16> aAttribs;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLangWhichId_Writer); ++i)
+ for (sal_uInt16 i : aLangWhichId_Writer)
{
- rWrtSh.SetDefault( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ) );
- aAttribs.insert( aLangWhichId_Writer[i] );
+ rWrtSh.SetDefault( SvxLanguageItem( LANGUAGE_NONE, i ) );
+ aAttribs.insert( i );
}
// set all language attributes to default
@@ -471,9 +471,9 @@ namespace SwLangHelper
RES_CHRATR_CTL_LANGUAGE
};
nCurrentLang = LANGUAGE_NONE;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aScriptTypes); ++i)
+ for (sal_uInt16 aScriptType : aScriptTypes)
{
- LanguageType nTmpLang = GetLanguage( rSh, aScriptTypes[i] );
+ LanguageType nTmpLang = GetLanguage( rSh, aScriptType );
if (nTmpLang != LANGUAGE_NONE)
{
nCurrentLang = LANGUAGE_DONTKNOW;
@@ -519,9 +519,9 @@ namespace SwLangHelper
EE_CHAR_LANGUAGE_CTL
};
nCurrentLang = LANGUAGE_NONE;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aScriptTypes); ++i)
+ for (sal_uInt16 aScriptType : aScriptTypes)
{
- LanguageType nTmpLang = GetLanguage( aSet, aScriptTypes[i] );
+ LanguageType nTmpLang = GetLanguage( aSet, aScriptType );
if (nTmpLang != LANGUAGE_NONE)
{
nCurrentLang = LANGUAGE_DONTKNOW;
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 8be3911e478d..32a0f60973cb 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -122,11 +122,11 @@ public:
StyleRedefinition* get(const OUString& aString)
{
- for (size_t i = 0; i < maStyles.size(); i++)
+ for (StyleRedefinition & rStyle : maStyles)
{
- if (maStyles[i].maElementName == aString)
+ if (rStyle.maElementName == aString)
{
- return &maStyles[i];
+ return &rStyle;
}
}
return nullptr;
@@ -341,10 +341,10 @@ std::vector<FontSet> initFontSets()
FontSet getFontSet(const OUString& rFontVariant, std::vector<FontSet>& aFontSets)
{
- for (size_t i = 0; i < aFontSets.size(); ++i)
+ for (FontSet & rFontSet : aFontSets)
{
- if (aFontSets[i].maName == rFontVariant)
- return aFontSets[i];
+ if (rFontSet.maName == rFontVariant)
+ return rFontSet;
}
return aFontSets[0];
}
@@ -453,9 +453,9 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
mpValueSetColors->SetDoubleClickHdl(LINK(this, ThemePanel, DoubleClickValueSetHdl));
std::vector<FontSet> aFontSets = initFontSets();
- for (size_t i = 0; i < aFontSets.size(); ++i)
+ for (FontSet & rFontSet : aFontSets)
{
- mpListBoxFonts->InsertEntry(aFontSets[i].maName);
+ mpListBoxFonts->InsertEntry(rFontSet.maName);
}
maColorSets.init();
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 103dabff8563..de1b914a0a25 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -121,10 +121,10 @@ static sal_uInt16 lcl_GetNextZoomStep(sal_uInt16 nCurrentZoom, bool bZoomIn)
}
else
{
- for(int i = 0; i < nZoomArrSize; ++i)
+ for(sal_uInt16 i : aZoomArr)
{
- if(nCurrentZoom < aZoomArr[i])
- return aZoomArr[i];
+ if(nCurrentZoom < i)
+ return i;
}
}
return bZoomIn ? MAX_PREVIEW_ZOOM : MIN_PREVIEW_ZOOM;
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 5d6991b389de..ad55f89b1265 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -326,9 +326,9 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
const ::std::vector<OUString>& rFramePoolArr(
SwStyleNameMapper::GetFrameFormatUINameArray());
- for( size_t i = 0; i < rFramePoolArr.size(); ++i )
+ for(const auto & i : rFramePoolArr)
{
- aFormats.push_back(rFramePoolArr[i]);
+ aFormats.push_back(i);
}
std::sort(aFormats.begin(), aFormats.end());
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 974999f9bc2e..a15c1ade2871 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -115,9 +115,8 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem* pSearchItem, SwWrtShell
std::vector<OString> aSelectionRectangles;
pShellCursor->SwSelPaintRects::Show(&aSelectionRectangles);
std::vector<OString> aRect;
- for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
+ for (const OString & rSelectionRectangle : aSelectionRectangles)
{
- const OString& rSelectionRectangle = aSelectionRectangles[i];
if (rSelectionRectangle.isEmpty())
continue;
aRect.push_back(rSelectionRectangle);
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 7b94a1dad07f..b4d865c0786a 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -71,10 +71,9 @@ static void lcl_FillSvxColumn(const SwFormatCol& rCol,
if( bOrtho )
{
nInnerWidth = nTotalWidth;
- for ( size_t i = 0; i < rCols.size(); ++i )
+ for (const auto & i : rCols)
{
- const SwColumn* pCol = &rCols[i];
- nInnerWidth -= pCol->GetLeft() + pCol->GetRight();
+ nInnerWidth -= i.GetLeft() + i.GetRight();
}
if( nInnerWidth < 0 )
nInnerWidth = 0;
@@ -193,9 +192,9 @@ void ResizeFrameCols(SwFormatCol& rCol,
// If the desired width is getting too large, then all values
// must be scaled appropriately.
long nScale = (0xffffl << 8)/ nNewWishWidth;
- for(size_t i = 0; i < rArr.size(); ++i)
+ for(SwColumn & i : rArr)
{
- SwColumn* pCol = &rArr[i];
+ SwColumn* pCol = &i;
long nVal = pCol->GetWishWidth();
lcl_Scale(nVal, nScale);
pCol->SetWishWidth((sal_uInt16) nVal);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a4e7b2af702e..19038c74bbe0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3586,10 +3586,10 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
IStyleAccess::AUTO_STYLE_CHAR,
IStyleAccess::AUTO_STYLE_PARA
};
- for (int i = 0; i < 2; ++i)
+ for (IStyleAccess::SwAutoStyleFamily i : aFam)
{
std::vector< SfxItemSet_Pointer_t > rStyles;
- pDoc->GetIStyleAccess().getAllStyles(rStyles, aFam[i]);
+ pDoc->GetIStyleAccess().getAllStyles(rStyles, i);
while (!rStyles.empty())
{
SfxItemSet_Pointer_t pStyle = rStyles.back();
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 8a16929974a1..79275c247364 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -305,9 +305,8 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface)
pDrawView->SdrEndTextEdit();
pDrawView->UnmarkAll();
- for (size_t i = 0; i < sdrObjects.size(); ++i)
+ for (SdrObject* pSdrObject : sdrObjects)
{
- SdrObject *const pSdrObject(sdrObjects[i]);
// GetSelectableFromAny did not check pSdrObject is in right doc!
if (pPV && pSdrObject->GetPage() == pPV->GetPage())
{
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 16984874bce7..b5c95e684c8a 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1372,9 +1372,8 @@ IMPL_LINK_TYPED( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileD
Sequence< OUString >aFileNames( pMedList->size() );
OUString* pFileNames = aFileNames.getArray();
sal_Int32 nPos = 0;
- for ( size_t i = 0, n = pMedList->size(); i < n; ++i )
+ for (SfxMedium* pMed : *pMedList)
{
- SfxMedium* pMed = pMedList->at( i );
OUString sFileName = pMed->GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
sFileName += OUString(sfx2::cTokenSeparator);
sFileName += pMed->GetFilter()->GetFilterName();
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 21fa08f59d04..03f479a31774 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -358,9 +358,8 @@ void SwGlossaryList::Invoke()
AutoTextGroup* SwGlossaryList::FindGroup(const OUString& rGroupName)
{
- for(size_t i = 0; i < aGroupArr.size(); ++i)
+ for(AutoTextGroup* pRet : aGroupArr)
{
- AutoTextGroup* pRet = aGroupArr[i];
if(pRet->sName == rGroupName)
return pRet;
}
diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx
index cd2880950653..5829a7a9bedc 100644
--- a/sw/source/uibase/utlui/initui.cxx
+++ b/sw/source/uibase/utlui/initui.cxx
@@ -78,9 +78,9 @@ inline void SetCachedString(CachedStringID id, const OUString& sStr)
void ClearStringCache()
{
- for (int i=0; i<CachedStrings; ++i)
+ for (OUString* p : StringCache)
{
- delete StringCache[i];
+ delete p;
}
}
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 3721c9727ec6..0531e0432f8e 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -59,11 +59,11 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageAutomatic, mpImpl->maImageAutomatic_Active,
mpImpl->maImageBookMode, mpImpl->maImageBookMode_Active};
- for (int i = 0; i < 6; i++)
+ for (Image & i : arr)
{
- BitmapEx aBitmap = arr[i].GetBitmapEx();
+ BitmapEx aBitmap = i.GetBitmapEx();
aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast);
- arr[i] = Image(aBitmap);
+ i = Image(aBitmap);
}
mpImpl->maImageSingleColumn = arr[0];
diff --git a/sw/source/uibase/wrtsh/wrtundo.cxx b/sw/source/uibase/wrtsh/wrtundo.cxx
index d8e7ed8498a0..ea1c37e32783 100644
--- a/sw/source/uibase/wrtsh/wrtundo.cxx
+++ b/sw/source/uibase/wrtsh/wrtundo.cxx
@@ -129,10 +129,10 @@ void SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
}
OUString buf;
- for (size_t i = 0; i < comments.size(); ++i)
+ for (const OUString & comment : comments)
{
- OSL_ENSURE(!comments[i].isEmpty(), "no Undo/Redo Text set");
- buf += comments[i] + "\n";
+ OSL_ENSURE(!comment.isEmpty(), "no Undo/Redo Text set");
+ buf += comment + "\n";
}
rStrs.SetString(buf);
}