summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-26 09:08:01 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-26 07:43:58 +0000
commit17c4f7f0bc986ed2623a60eea99be01036899af3 (patch)
treece231cac5d9b2d91fb175f22a45bf9dd664057f8 /editeng
parent501720afbf226443c1121379efb661d2902113df (diff)
clang-tidy modernize-loop-convert in e*
Change-Id: If56abefa81b41479e3ea9890dee1c43f006086de Reviewed-on: https://gerrit.libreoffice.org/24384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx4
-rw-r--r--editeng/source/editeng/editeng.cxx3
-rw-r--r--editeng/source/editeng/editobj.cxx20
-rw-r--r--editeng/source/editeng/editundo.cxx4
-rw-r--r--editeng/source/editeng/eehtml.cxx6
-rw-r--r--editeng/source/editeng/eertfpar.cxx6
-rw-r--r--editeng/source/editeng/fieldupdater.cxx8
-rw-r--r--editeng/source/editeng/impedit.cxx3
-rw-r--r--editeng/source/editeng/impedit2.cxx57
-rw-r--r--editeng/source/editeng/impedit3.cxx25
-rw-r--r--editeng/source/editeng/impedit4.cxx7
-rw-r--r--editeng/source/editeng/impedit5.cxx12
-rw-r--r--editeng/source/items/frmitems.cxx4
-rw-r--r--editeng/source/items/numitem.cxx4
-rw-r--r--editeng/source/lookuptree/Trie.cxx11
-rw-r--r--editeng/source/misc/svxacorr.cxx7
-rw-r--r--editeng/source/outliner/outliner.cxx3
-rw-r--r--editeng/source/uno/unoipset.cxx7
18 files changed, 88 insertions, 103 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index f728553e068c..7ac78d69dd70 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -803,9 +803,9 @@ void ParaPortionList::Reset()
long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
{
long nHeight = 0;
- for (sal_Int32 i = 0, n = maPortions.size(); i < n; ++i)
+ for (const auto & maPortion : maPortions)
{
- const ParaPortion* pTmpPortion = maPortions[i].get();
+ const ParaPortion* pTmpPortion = maPortion.get();
if ( pTmpPortion == pPPortion )
return nHeight;
nHeight += pTmpPortion->GetHeight();
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index aa66312d8e5f..74f5f7198baf 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -397,9 +397,8 @@ void EditEngine::SetPaperSize( const Size& rNewSize )
bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize();
if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) )
{
- for (size_t nView = 0; nView < pImpEditEngine->aEditViews.size(); ++nView)
+ for (EditView* pView : pImpEditEngine->aEditViews)
{
- EditView* pView = pImpEditEngine->aEditViews[nView];
if ( bAutoPageSize )
pView->pImpEditView->RecalcOutputArea();
else if ( pView->pImpEditView->DoAutoSize() )
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index eadcd4cfb471..fe784e0d097d 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -127,9 +127,9 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse
// this should ensure that the Items end up in the correct Pool!
aParaAttribs.Set( rCopyFrom.GetParaAttribs() );
- for (size_t i = 0; i < rCopyFrom.aAttribs.size(); ++i)
+ for (const auto & aAttrib : rCopyFrom.aAttribs)
{
- const XEditAttribute& rAttr = *rCopyFrom.aAttribs[i].get();
+ const XEditAttribute& rAttr = *aAttrib.get();
XEditAttribute* pMyAttr = MakeXEditAttribute(
rPoolToUse, *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd());
aAttribs.push_back(std::unique_ptr<XEditAttribute>(pMyAttr));
@@ -712,9 +712,9 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttr
rLst.clear();
const ContentInfo& rC = *aContents[nPara].get();
- for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr)
+ for (const auto & aAttrib : rC.aAttribs)
{
- const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
+ const XEditAttribute& rAttr = *aAttrib.get();
EECharAttrib aEEAttr;
aEEAttr.pAttr = rAttr.GetItem();
aEEAttr.nPara = nPara;
@@ -880,9 +880,9 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
SectionBordersType& rBorders = aParaBorders[nPara];
rBorders.push_back(0);
rBorders.push_back(rC.GetText().getLength());
- for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr)
+ for (const auto & aAttrib : rC.aAttribs)
{
- const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
+ const XEditAttribute& rAttr = *aAttrib.get();
const SfxPoolItem* pItem = rAttr.GetItem();
if (!pItem)
continue;
@@ -946,9 +946,9 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
return;
}
- for (size_t i = 0; i < rC.aAttribs.size(); ++i)
+ for (const auto & aAttrib : rC.aAttribs)
{
- const XEditAttribute& rXAttr = *rC.aAttribs[i].get();
+ const XEditAttribute& rXAttr = *aAttrib.get();
const SfxPoolItem* pItem = rXAttr.GetItem();
if (!pItem)
continue;
@@ -1524,9 +1524,9 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
// Works only if tab positions are set, not when DefTab.
if ( nVersion < 500 )
{
- for (size_t i = 0, n = aContents.size(); i < n; ++i)
+ for (std::unique_ptr<ContentInfo> & aContent : aContents)
{
- ContentInfo& rC = *aContents[i].get();
+ ContentInfo& rC = *aContent.get();
const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rC.GetParaAttribs().Get(EE_PARA_LRSPACE));
if ( rLRSpace.GetTextLeft() && ( rC.GetParaAttribs().GetItemState( EE_PARA_TABS ) == SfxItemState::SET ) )
{
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 63ced0a9457a..fdaeefa8450a 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -538,9 +538,9 @@ void EditUndoSetAttribs::Undo()
pEE->RemoveCharAttribs(nPara, 0, true);
DBG_ASSERT( pEE->GetEditDoc().GetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
ContentNode* pNode = pEE->GetEditDoc().GetObject( nPara );
- for (size_t nAttr = 0; nAttr < rInf.GetPrevCharAttribs().size(); ++nAttr)
+ for (const auto & nAttr : rInf.GetPrevCharAttribs())
{
- const EditCharAttrib& rX = *rInf.GetPrevCharAttribs()[nAttr].get();
+ const EditCharAttrib& rX = *nAttr.get();
// is automatically "poolsized"
pEE->GetEditDoc().InsertAttrib(pNode, rX.GetStart(), rX.GetEnd(), *rX.GetItem());
if (rX.Which() == EE_FEATURE_FIELD)
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index cb3c14442f34..410d99f17f88 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -705,9 +705,8 @@ void EditHTMLParser::StartPara( bool bReal )
{
const HTMLOptions& aOptions = GetOptions();
SvxAdjust eAdjust = SVX_ADJUST_LEFT;
- for ( size_t i = 0, n = aOptions.size(); i < n; ++i )
+ for (const auto & aOption : aOptions)
{
- const HTMLOption& aOption = aOptions[i];
switch( aOption.GetToken() )
{
case HTML_O_ALIGN:
@@ -766,9 +765,8 @@ void EditHTMLParser::AnchorStart()
const HTMLOptions& aOptions = GetOptions();
OUString aRef;
- for ( size_t i = 0, n = aOptions.size(); i < n; ++i )
+ for (const auto & aOption : aOptions)
{
- const HTMLOption& aOption = aOptions[i];
switch( aOption.GetToken() )
{
case HTML_O_HREF:
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 210181c41346..fa8b36b0efe2 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -313,15 +313,15 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
if (eDestUnit != eSrcUnit)
{
sal_uInt16 aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL };
- for (size_t i = 0; i < SAL_N_ELEMENTS(aFntHeightIems); ++i)
+ for (unsigned short aFntHeightIem : aFntHeightIems)
{
- if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( aFntHeightIems[i], false, &pItem ))
+ if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( aFntHeightIem, false, &pItem ))
{
sal_uInt32 nHeight = static_cast<const SvxFontHeightItem*>(pItem)->GetHeight();
long nNewHeight;
nNewHeight = OutputDevice::LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit );
- SvxFontHeightItem aFntHeightItem( nNewHeight, 100, aFntHeightIems[i] );
+ SvxFontHeightItem aFntHeightItem( nNewHeight, 100, aFntHeightIem );
aFntHeightItem.SetProp(
static_cast<const SvxFontHeightItem*>(pItem)->GetProp(),
static_cast<const SvxFontHeightItem*>(pItem)->GetPropUnit());
diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx
index a5db406e112b..5a2e93751277 100644
--- a/editeng/source/editeng/fieldupdater.cxx
+++ b/editeng/source/editeng/fieldupdater.cxx
@@ -29,13 +29,13 @@ public:
{
SfxItemPool* pPool = mrObj.GetPool();
EditTextObjectImpl::ContentInfosType& rContents = mrObj.GetContents();
- for (size_t i = 0; i < rContents.size(); ++i)
+ for (std::unique_ptr<ContentInfo> & i : rContents)
{
- ContentInfo& rContent = *rContents[i].get();
+ ContentInfo& rContent = *i.get();
ContentInfo::XEditAttributesType& rAttribs = rContent.GetAttribs();
- for (size_t j = 0; j < rAttribs.size(); ++j)
+ for (std::unique_ptr<XEditAttribute> & rAttrib : rAttribs)
{
- XEditAttribute& rAttr = *rAttribs[j].get();
+ XEditAttribute& rAttr = *rAttrib.get();
const SfxPoolItem* pItem = rAttr.GetItem();
if (pItem->Which() != EE_FEATURE_FIELD)
// This is not a field item.
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index f4a6dcc32611..59f20a4587b3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -349,9 +349,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
}
std::vector<OString> v;
- for (size_t i = 0; i < aRectangles.size(); ++i)
+ for (Rectangle & rRectangle : aRectangles)
{
- Rectangle& rRectangle = aRectangles[i];
if (bMm100ToTwip)
rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP);
rRectangle.Move(aOrigin.getX(), aOrigin.getY());
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 6d19ff01ce87..95329d2f10ac 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -636,9 +636,8 @@ EditPaM ImpEditEngine::RemoveText()
EditPaM aStartPaM = aEditDoc.GetStartPaM();
EditSelection aEmptySel( aStartPaM, aStartPaM );
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
pView->pImpEditView->SetEditSelection( aEmptySel );
}
ResetUndoManager();
@@ -659,9 +658,8 @@ void ImpEditEngine::SetText(const OUString& rText)
if (!rText.isEmpty())
aPaM = ImpInsertText( aEmptySel, rText );
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
pView->pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) );
// If no text then also no Format&Update
// => The text remains.
@@ -1684,11 +1682,11 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
// i89825: Use CTL font for numbers embedded into an RTL run:
WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
- for ( size_t n = 0; n < rDirInfos.size(); ++n )
+ for (WritingDirectionInfo & rDirInfo : rDirInfos)
{
- const sal_Int32 nStart = rDirInfos[n].nStartPos;
- const sal_Int32 nEnd = rDirInfos[n].nEndPos;
- const sal_uInt8 nCurrDirType = rDirInfos[n].nType;
+ const sal_Int32 nStart = rDirInfo.nStartPos;
+ const sal_Int32 nEnd = rDirInfo.nEndPos;
+ const sal_uInt8 nCurrDirType = rDirInfo.nType;
if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run
( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
@@ -1805,15 +1803,15 @@ SvtScriptType ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) cons
++nE;
}
- for (size_t n = 0; n < rTypes.size(); ++n)
+ for (const ScriptTypePosInfo & rType : rTypes)
{
- bool bStartInRange = rTypes[n].nStartPos <= nS && nS < rTypes[n].nEndPos;
- bool bEndInRange = rTypes[n].nStartPos < nE && nE <= rTypes[n].nEndPos;
+ bool bStartInRange = rType.nStartPos <= nS && nS < rType.nEndPos;
+ bool bEndInRange = rType.nStartPos < nE && nE <= rType.nEndPos;
if (bStartInRange || bEndInRange)
{
- if ( rTypes[n].nScriptType != i18n::ScriptType::WEAK )
- nScriptType |= SvtLanguageOptions::FromI18NToSvtScriptType( rTypes[n].nScriptType );
+ if ( rType.nScriptType != i18n::ScriptType::WEAK )
+ nScriptType |= SvtLanguageOptions::FromI18NToSvtScriptType( rType.nScriptType );
}
}
}
@@ -1833,9 +1831,9 @@ bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
const sal_Int32 nPos = rPaM.GetIndex();
- for ( size_t n = 0; n < rTypes.size(); n++ )
+ for (const ScriptTypePosInfo & rType : rTypes)
{
- if ( rTypes[n].nStartPos == nPos )
+ if ( rType.nStartPos == nPos )
{
bScriptChange = true;
break;
@@ -1870,9 +1868,9 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
bool bCTL = false;
ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- for ( size_t n = 0; n < rTypes.size(); n++ )
+ for (ScriptTypePosInfo & rType : rTypes)
{
- if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX )
+ if ( rType.nScriptType == i18n::ScriptType::COMPLEX )
{
bCTL = true;
break;
@@ -1984,15 +1982,15 @@ sal_uInt8 ImpEditEngine::GetRightToLeft( sal_Int32 nPara, sal_Int32 nPos, sal_In
InitWritingDirections( nPara );
WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
- for ( size_t n = 0; n < rDirInfos.size(); n++ )
+ for (const WritingDirectionInfo & rDirInfo : rDirInfos)
{
- if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) )
+ if ( ( rDirInfo.nStartPos <= nPos ) && ( rDirInfo.nEndPos >= nPos ) )
{
- nRightToLeft = rDirInfos[n].nType;
+ nRightToLeft = rDirInfo.nType;
if ( pStart )
- *pStart = rDirInfos[n].nStartPos;
+ *pStart = rDirInfo.nStartPos;
if ( pEnd )
- *pEnd = rDirInfos[n].nEndPos;
+ *pEnd = rDirInfo.nEndPos;
break;
}
}
@@ -2044,9 +2042,9 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars )
const sal_Int32 nStart = rPaM.GetIndex();
const sal_Int32 nEnd = nStart + nChars;
const CharAttribList::AttribsType& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs();
- for (size_t i = 0, n = rAttribs.size(); i < n; ++i)
+ for (const auto & rAttrib : rAttribs)
{
- const EditCharAttrib& rAttr = *rAttribs[i].get();
+ const EditCharAttrib& rAttr = *rAttrib.get();
if (rAttr.GetEnd() >= nStart && rAttr.GetStart() < nEnd)
{
EditSelection aSel( rPaM );
@@ -2919,9 +2917,9 @@ bool ImpEditEngine::UpdateFields()
ContentNode* pNode = GetEditDoc().GetObject( nPara );
OSL_ENSURE( pNode, "NULL-Pointer in Doc" );
CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs();
- for (size_t nAttr = 0; nAttr < rAttribs.size(); ++nAttr)
+ for (std::unique_ptr<EditCharAttrib> & rAttrib : rAttribs)
{
- EditCharAttrib& rAttr = *rAttribs[nAttr].get();
+ EditCharAttrib& rAttr = *rAttrib.get();
if (rAttr.Which() == EE_FEATURE_FIELD)
{
EditCharAttribField& rField = static_cast<EditCharAttribField&>(rAttr);
@@ -3279,14 +3277,13 @@ void ImpEditEngine::UpdateSelections()
{
// Check whether one of the selections is at a deleted node...
// If the node is valid, the index has yet to be examined!
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
bool bChanged = false;
- for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i)
+ for (std::unique_ptr<DeletedNodeInfo> & aDeletedNode : aDeletedNodes)
{
- const DeletedNodeInfo& rInf = *aDeletedNodes[i].get();
+ const DeletedNodeInfo& rInf = *aDeletedNode.get();
if ( ( aCurSel.Min().GetNode() == rInf.GetNode() ) ||
( aCurSel.Max().GetNode() == rInf.GetNode() ) )
{
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 41d84715c35d..aa131dbc6f16 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -276,9 +276,8 @@ void ImpEditEngine::UpdateViews( EditView* pCurView )
DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" );
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
pView->HideCursor();
Rectangle aClipRect( aInvalidRect );
@@ -319,9 +318,9 @@ IMPL_LINK_NOARG_TYPED(ImpEditEngine, IdleFormatHdl, Idle *, void)
// else probably the idle format timer fired while we're already
// downing
EditView* pView = aIdleFormatter.GetView();
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* aEditView : aEditViews)
{
- if( aEditViews[nView] == pView )
+ if( aEditView == pView )
{
FormatAndUpdate( pView );
break;
@@ -445,9 +444,8 @@ void ImpEditEngine::FormatDoc()
CheckAutoPageSize();
else if ( nDiff )
{
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
ImpEditView* pImpView = pView->pImpEditView;
if ( pImpView->DoAutoHeight() )
{
@@ -548,9 +546,8 @@ void ImpEditEngine::CheckAutoPageSize()
aInvalidRect = Rectangle( Point(), aSz );
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
pView->pImpEditView->RecalcOutputArea();
}
}
@@ -2336,12 +2333,12 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rS
InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) );
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- for ( size_t nT = 0; nT < rTypes.size(); nT++ )
- aPositions.insert( rTypes[nT].nStartPos );
+ for (const ScriptTypePosInfo& rType : rTypes)
+ aPositions.insert( rType.nStartPos );
const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos;
- for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ )
- aPositions.insert( rWritingDirections[nD].nStartPos );
+ for (const WritingDirectionInfo & rWritingDirection : rWritingDirections)
+ aPositions.insert( rWritingDirection.nStartPos );
if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) )
{
@@ -4429,9 +4426,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
nCompressPercent /= nCompressed;
}
- for (size_t i = 0, n = aCompressedPortions.size(); i < n; ++i)
+ for (TextPortion* pTP2 : aCompressedPortions)
{
- pTP = aCompressedPortions[i];
+ pTP = pTP2;
pTP->GetExtraInfos()->bCompressed = false;
pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth;
if ( nCompressPercent )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 64960f1396cb..fb6e284c7dd4 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2407,9 +2407,8 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC
}
else if ( bSimpleRepaint )
{
- for (size_t nView = 0; nView < aEditViews.size(); ++nView)
+ for (EditView* pView : aEditViews)
{
- EditView* pView = aEditViews[nView];
Rectangle aClipRect( aInvalidRect );
aClipRect.Intersection( pView->GetVisArea() );
if ( !aClipRect.IsEmpty() )
@@ -2952,9 +2951,9 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
{
// adjust selection to include all changes
- for (size_t i = 0; i < aChanges.size(); ++i)
+ for (eeTransliterationChgData & aChange : aChanges)
{
- const EditSelection &rSel = aChanges[i].aSelection;
+ const EditSelection &rSel = aChange.aSelection;
if (aSel.Min().GetNode() == rSel.Min().GetNode() &&
aSel.Min().GetIndex() > rSel.Min().GetIndex())
aSel.Min().SetIndex( rSel.Min().GetIndex() );
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index bab347ee53e7..0d10336de6cd 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -424,9 +424,9 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
pNode->GetCharAttribs().OptimizeRanges(const_cast<SfxItemPool&>(rPool));
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for (size_t nAttr = 0; nAttr < rAttrs.size(); ++nAttr)
+ for (const auto & nAttr : rAttrs)
{
- const EditCharAttrib& rAttr = *rAttrs[nAttr].get();
+ const EditCharAttrib& rAttr = *nAttr.get();
if ( nStart == nEnd )
{
@@ -538,9 +538,9 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
if ( nSpecial == ATTRSPECIAL_EDGE )
{
CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs();
- for (size_t i = 0, n = rAttribs.size(); i < n; ++i)
+ for (std::unique_ptr<EditCharAttrib> & rAttrib : rAttribs)
{
- EditCharAttrib& rAttr = *rAttribs[i].get();
+ EditCharAttrib& rAttr = *rAttrib.get();
if (rAttr.GetStart() > nEndPos)
break;
@@ -726,9 +726,9 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>&
{
rLst.reserve(pNode->GetCharAttribs().Count());
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for (size_t i = 0; i < rAttrs.size(); ++i)
+ for (const auto & i : rAttrs)
{
- const EditCharAttrib& rAttr = *rAttrs[i].get();
+ const EditCharAttrib& rAttr = *i.get();
EECharAttrib aEEAttr;
aEEAttr.pAttr = rAttr.GetItem();
aEEAttr.nPara = nPara;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index ee96b672e60f..62e4a42141df 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2255,11 +2255,11 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const
if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 )
{
- for( sal_uInt16 i=0; i < 4; i++ )
+ for(SvxBoxItemLine & i : aLineMap)
{
sal_uInt16 nDist;
rStrm.ReadUInt16( nDist );
- pAttr->SetDistance( nDist, aLineMap[i] );
+ pAttr->SetDistance( nDist, i );
}
}
else
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 44205833db53..41ef9f0d992d 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -716,8 +716,8 @@ void SvxNumRule::Store( SvStream &rStream )
SvxNumRule::~SvxNumRule()
{
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- delete aFmts[i];
+ for(SvxNumberFormat* aFmt : aFmts)
+ delete aFmt;
if(!--nRefCount)
{
DELETEZ(pStdNumFmt);
diff --git a/editeng/source/lookuptree/Trie.cxx b/editeng/source/lookuptree/Trie.cxx
index 234a8f5e344f..8f2fddbd4bfd 100644
--- a/editeng/source/lookuptree/Trie.cxx
+++ b/editeng/source/lookuptree/Trie.cxx
@@ -41,9 +41,9 @@ TrieNode::TrieNode(sal_Unicode aCharacter) :
mCharacter(aCharacter),
mMarker(false)
{
- for (int i=0; i<LATIN_ARRAY_SIZE; i++)
+ for (TrieNode* & i : mLatinArray)
{
- mLatinArray[i] = nullptr;
+ i = nullptr;
}
}
@@ -55,9 +55,9 @@ TrieNode::~TrieNode()
delete *iNode;
}
- for (int i=0; i<LATIN_ARRAY_SIZE; i++)
+ for (TrieNode* i : mLatinArray)
{
- delete mLatinArray[i];
+ delete i;
}
}
@@ -102,9 +102,8 @@ TrieNode* TrieNode::findChild(sal_Unicode aInputCharacter)
void TrieNode::collectSuggestions(const OUString& sPath, vector<OUString>& rSuggestionList)
{
// first traverse nodes for alphabet characters
- for (int i=0; i<LATIN_ARRAY_SIZE; i++)
+ for (TrieNode* pCurrent : mLatinArray)
{
- TrieNode* pCurrent = mLatinArray[i];
if (pCurrent != nullptr)
collectSuggestionsForCurrentNode(pCurrent, sPath, rSuggestionList);
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 641c59fc7d56..e3552f79bbc2 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2475,9 +2475,8 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo
if( bRet )
{
- for ( size_t i=0; i < aDeleteEntries.size(); i++ )
+ for (SvxAutocorrWord & aWordToDelete : aDeleteEntries)
{
- SvxAutocorrWord aWordToDelete = aDeleteEntries[i];
SvxAutocorrWord *pFoundEntry = pAutocorr_List->FindAndRemove( &aWordToDelete );
if( pFoundEntry )
{
@@ -2499,9 +2498,9 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo
}
}
- for ( size_t i=0; i < aNewEntries.size(); i++ )
+ for (SvxAutocorrWord & aNewEntrie : aNewEntries)
{
- SvxAutocorrWord *pWordToAdd = new SvxAutocorrWord( aNewEntries[i].GetShort(), aNewEntries[i].GetLong(), true );
+ SvxAutocorrWord *pWordToAdd = new SvxAutocorrWord( aNewEntrie.GetShort(), aNewEntrie.GetLong(), true );
SvxAutocorrWord *pRemoved = pAutocorr_List->FindAndRemove( pWordToAdd );
if( pRemoved )
{
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 257316810b28..c39f8d610321 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1072,9 +1072,8 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
void Outliner::InvalidateBullet(sal_Int32 nPara)
{
long nLineHeight = (long)pEditEngine->GetLineHeight(nPara );
- for ( size_t i = 0, n = aViewList.size(); i < n; ++i )
+ for (OutlinerView* pView : aViewList)
{
- OutlinerView* pView = aViewList[ i ];
Point aPos( pView->pEditView->GetWindowPosTopLeft(nPara ) );
Rectangle aRect( pView->GetOutputArea() );
aRect.Right() = aPos.X();
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 2bfbbed02f5a..dc3f77477a42 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -54,9 +54,8 @@ SvxItemPropertySet::~SvxItemPropertySet()
uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const
{
- for ( size_t i = 0, n = aCombineList.size(); i < n; ++i )
+ for (SvxIDPropertyCombine* pActual : aCombineList)
{
- SvxIDPropertyCombine* pActual = aCombineList[ i ];
if( pActual->nWID == nWID )
return &pActual->aAny;
}
@@ -75,8 +74,8 @@ void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID)
void SvxItemPropertySet::ClearAllUsrAny()
{
- for ( size_t i = 0, n = aCombineList.size(); i < n; ++i )
- delete aCombineList[ i ];
+ for (SvxIDPropertyCombine* i : aCombineList)
+ delete i;
aCombineList.clear();
}