diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-11 09:53:05 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-12 07:12:21 +0000 |
commit | 875984617cfd6c773eb93f339929eb3fabd3e97b (patch) | |
tree | abb092c1b0d995d55f2f4508801df23377c9cc6d /svx/source | |
parent | 6bc3c2bdc5279314881b7e950d76d4d813470d11 (diff) |
clang-tidy modernize-loop-convert in svx
Change-Id: I09e5243e5dff46ceccef1a707e648ee9cb0c37c5
Reviewed-on: https://gerrit.libreoffice.org/24875
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx/source')
41 files changed, 174 insertions, 202 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index f263ac8469ae..4bad1d5f3abd 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2181,9 +2181,8 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) { std::vector< SdrPathObj* > vTempList; - for(size_t i = 0; i < vObjectList.size(); ++i) + for(SdrPathObj* pObj : vObjectList) { - SdrPathObj* pObj(vObjectList[i]); const drawing::LineStyle eLineStyle =static_cast<const XLineStyleItem&>(pObj->GetMergedItem(XATTR_LINESTYLE)).GetValue(); const drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue(); @@ -2208,10 +2207,8 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) sal_Int32 nAreaObjectCount = 0; // correct some values and collect content data - for ( size_t i = 0; i < vObjectList.size(); ++i ) + for (SdrPathObj* pObj : vObjectList) { - SdrPathObj* pObj( vObjectList[ i ] ); - if(pObj->IsLine()) { nLineObjectCount++; @@ -2234,20 +2231,16 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) std::vector< SdrPathObj* > vTempList; vTempList.reserve(vObjectList.size()); - for ( size_t i = 0; i < vObjectList.size(); ++i ) + for (SdrPathObj* pObj : vObjectList) { - SdrPathObj* pObj( vObjectList[ i ] ); - if ( !pObj->IsLine() ) { vTempList.push_back(pObj); } } - for ( size_t i = 0; i < vObjectList.size(); ++i ) + for (SdrPathObj* pObj : vObjectList) { - SdrPathObj* pObj( vObjectList[ i ] ); - if ( pObj->IsLine() ) { vTempList.push_back(pObj); @@ -2267,9 +2260,8 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) { pRet = new SdrObjGroup; - for (size_t i = 0; i < vObjectList.size(); ++i) + for (SdrPathObj* pObj : vObjectList) { - SdrObject* pObj(vObjectList[i]); pRet->GetSubList()->NbcInsertObject(pObj); } } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index a7cc7e914962..77bf6dfd9913 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -279,8 +279,8 @@ SvxFontWorkDialog::~SvxFontWorkDialog() void SvxFontWorkDialog::dispose() { - for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++) - pCtrlItems[i]->dispose(); + for (SvxFontWorkControllerItem* pCtrlItem : pCtrlItems) + pCtrlItem->dispose(); m_pTbxStyle.clear(); m_pTbxAdjust.clear(); m_pFbDistance.clear(); diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 4cd862a3f138..983d90fffa84 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -155,8 +155,8 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window //as entries are added later on TargetList aTmpList; SfxFrame::GetDefaultTargetList(aTmpList); - for (size_t i = 0, n = aTmpList.size(); i < n; ++i) - m_pCbbTarget->InsertEntry(aTmpList[i]); + for (const OUString & s : aTmpList) + m_pCbbTarget->InsertEntry(s); Size aPrefSize(m_pCbbTarget->get_preferred_size()); m_pCbbTarget->set_width_request(aPrefSize.Width()); m_pCbbTarget->Clear(); @@ -301,8 +301,8 @@ void SvxIMapDlg::SetTargetList( const TargetList& rTargetList ) m_pCbbTarget->Clear(); - for ( size_t i = 0, n = aNewList.size(); i < n; ++i ) - m_pCbbTarget->InsertEntry( aNewList[ i ] ); + for (const OUString & s : aNewList) + m_pCbbTarget->InsertEntry( s ); } void SvxIMapDlg::UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap, @@ -328,8 +328,8 @@ void SvxIMapDlg::UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap, { TargetList aTargetList( *pTargetList ); - for ( size_t i = 0, n = aTargetList.size(); i < n; ++i ) - pOwnData->aUpdateTargetList.push_back( aTargetList[ i ] ); + for (const OUString & s : aTargetList) + pOwnData->aUpdateTargetList.push_back( s ); } pOwnData->aIdle.Start(); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 59e25e6c1ade..3adfe2828d3c 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -175,8 +175,8 @@ void IMapWindow::SetTargetList( TargetList& rTargetList ) aTargetList.clear(); // Fill with the provided list - for( size_t i = 0, n = rTargetList.size(); i < n; ++i ) - aTargetList.push_back( rTargetList[ i ] ); + for(const OUString & s : rTargetList) + aTargetList.push_back( s ); pModel->SetChanged( false ); } diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 1c390e9dcd81..426d8e79e502 100755 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -143,10 +143,10 @@ void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, ComboBox { std::vector<OUString> aLst = pSrchItem->GetList(); - for ( size_t i = 0; i < aLst.size(); ++i ) + for (const OUString & s : aLst) { - rStrLst.push_back(aLst[i]); - rCBox.InsertEntry(aLst[i]); + rStrLst.push_back(s); + rCBox.InsertEntry(s); } } } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index bdbfa8658f2d..38d59412bee6 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -290,10 +290,10 @@ SvxRuler::SvxRuler( mpIndents.resize(5 + INDENT_GAP); - for(size_t nIn = 0; nIn < mpIndents.size(); nIn++) + for(RulerIndent & rIndent : mpIndents) { - mpIndents[nIn].nPos = 0; - mpIndents[nIn].nStyle = RulerIndentStyle::Top; + rIndent.nPos = 0; + rIndent.nStyle = RulerIndentStyle::Top; } mpIndents[0].nStyle = RulerIndentStyle::Top; diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index d0f1376fc719..c9b47b3394d2 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -200,9 +200,9 @@ void getAllHit3DObjectsSortedFrontToBack( ::std::vector< basegfx::B3DPoint > aHitsWithObject; getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject, false); - for(size_t a(0); a < aHitsWithObject.size(); a++) + for(basegfx::B3DPoint & a : aHitsWithObject) { - const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[a]); + const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * a); aDepthAndObjectResults.push_back(ImplPairDephAndObject(pCandidate, aPointInViewCoordinates.getZ())); } } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 2f9e9d48eaee..b1460e4e06b5 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1616,9 +1616,9 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol) }; Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aPropsListenedTo); ++i) - if (xInfo->hasPropertyByName(aPropsListenedTo[i])) - xCol->removePropertyChangeListener(aPropsListenedTo[i], this); + for (const auto & i : aPropsListenedTo) + if (xInfo->hasPropertyByName(i)) + xCol->removePropertyChangeListener(i, this); } @@ -1833,9 +1833,8 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value) t // need to forward this to the columns DbGridColumns& rColumns = const_cast<DbGridColumns&>(pGrid->GetColumns()); - for ( size_t i = 0, n = rColumns.size(); i < n; ++i ) + for (DbGridColumn* pLoop : rColumns) { - DbGridColumn* pLoop = rColumns[ i ]; FmXGridCell* pXCell = pLoop->GetCell(); if (pXCell) { diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 6680f180c603..6ca782c34fdf 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -718,35 +718,35 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet if ((_eInitWhat & InitWritingMode) != 0) { - for (size_t i = 0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - if (pWindows[i]) - pWindows[i]->EnableRTL(rParent.IsRTLEnabled()); + if (pWindow) + pWindow->EnableRTL(rParent.IsRTLEnabled()); } } if ((_eInitWhat & InitFontFacet) != 0) { - for (size_t i = 0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - if (!pWindows[i]) + if (!pWindow) continue; - pWindows[i]->SetZoom(rParent.GetZoom()); + pWindow->SetZoom(rParent.GetZoom()); - const StyleSettings& rStyleSettings = pWindows[i]->GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings(); vcl::Font aFont = rStyleSettings.GetFieldFont(); aFont.SetTransparent(isTransparent()); if (rParent.IsControlFont()) { - pWindows[i]->SetControlFont(rParent.GetControlFont()); + pWindow->SetControlFont(rParent.GetControlFont()); aFont.Merge(rParent.GetControlFont()); } else - pWindows[i]->SetControlFont(); + pWindow->SetControlFont(); - pWindows[i]->SetZoomedPointFont(*pWindows[i], aFont); // FIXME RenderContext + pWindow->SetZoomedPointFont(*pWindow, aFont); // FIXME RenderContext } } @@ -757,18 +757,18 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet bool bTextLineColor = rParent.IsTextLineColor(); Color aTextLineColor(rParent.GetTextLineColor()); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - if (pWindows[i]) + if (pWindow) { - pWindows[i]->SetTextColor(aTextColor); + pWindow->SetTextColor(aTextColor); if (rParent.IsControlForeground()) - pWindows[i]->SetControlForeground(aTextColor); + pWindow->SetControlForeground(aTextColor); if (bTextLineColor) - pWindows[i]->SetTextLineColor(); + pWindow->SetTextLineColor(); else - pWindows[i]->SetTextLineColor(aTextLineColor); + pWindow->SetTextLineColor(aTextLineColor); } } } @@ -778,18 +778,18 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet if (rParent.IsControlBackground()) { Color aColor(rParent.GetControlBackground()); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - if (pWindows[i]) + if (pWindow) { if (isTransparent()) - pWindows[i]->SetBackground(); + pWindow->SetBackground(); else { - pWindows[i]->SetBackground(aColor); - pWindows[i]->SetControlBackground(aColor); + pWindow->SetBackground(aColor); + pWindow->SetControlBackground(aColor); } - pWindows[i]->SetFillColor(aColor); + pWindow->SetFillColor(aColor); } } } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 4cad691ca1d9..20830d55b552 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -541,16 +541,16 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls() m_aNewBtn.get() }; - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - if (pWindows[i]->GetPosPixel().X() < 0) - pWindows[i]->SetSizePixel(Size(0, nH)); - aSize = pWindows[i]->GetSizePixel(); - auto nExcess = (pWindows[i]->GetPosPixel().X() + aSize.Width()) - nW; + if (pWindow->GetPosPixel().X() < 0) + pWindow->SetSizePixel(Size(0, nH)); + aSize = pWindow->GetSizePixel(); + auto nExcess = (pWindow->GetPosPixel().X() + aSize.Width()) - nW; if (nExcess > 0) { aSize.Width() -= nExcess; - pWindows[i]->SetSizePixel(aSize); + pWindow->SetSizePixel(aSize); } } @@ -812,8 +812,8 @@ void DbGridControl::NavigationBar::StateChanged(StateChangedType nType) case StateChangedType::Mirroring: { bool bIsRTLEnabled = IsRTLEnabled(); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) - pWindows[i]->EnableRTL( bIsRTLEnabled ); + for (vcl::Window* pWindow : pWindows) + pWindow->EnableRTL( bIsRTLEnabled ); } break; @@ -826,10 +826,10 @@ void DbGridControl::NavigationBar::StateChanged(StateChangedType nType) if (IsControlFont()) aFont.Merge(GetControlFont()); - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - pWindows[i]->SetZoom(aZoom); - pWindows[i]->SetZoomedPointFont(*pWindows[i], aFont); + pWindow->SetZoom(aZoom); + pWindow->SetZoomedPointFont(*pWindow, aFont); } SetZoomedPointFont(*this, aFont); @@ -891,8 +891,8 @@ DbGridRow::DbGridRow(CursorWrapper* pCur, bool bPaintCursor) DbGridRow::~DbGridRow() { - for ( size_t i = 0, n = m_aVariants.size(); i < n; ++i ) - delete m_aVariants[ i ]; + for (DataColumn* p : m_aVariants) + delete p; m_aVariants.clear(); } @@ -1118,9 +1118,8 @@ void DbGridControl::Select() void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { - for ( size_t i = 0; i < m_aColumns.size(); ++i ) + for (DbGridColumn* pCol : m_aColumns) { - DbGridColumn* pCol = m_aColumns[ i ]; if (pCol) pCol->ImplInitWindow( GetDataWindow(), _eInitWhat ); } @@ -1190,8 +1189,8 @@ void DbGridControl::RemoveRows() // de-initialize all columns // if there are columns, free all controllers - for (size_t i = 0; i < m_aColumns.size(); i++) - m_aColumns[ i ]->Clear(); + for (DbGridColumn* pColumn : m_aColumns) + pColumn->Clear(); DELETEZ(m_pSeekCursor); DELETEZ(m_pDataCursor); @@ -1665,8 +1664,8 @@ void DbGridControl::RemoveColumns() if ( IsEditing() ) DeactivateCell(); - for (size_t i = 0, n = m_aColumns.size(); i < n; i++) - delete m_aColumns[ i ]; + for (DbGridColumn* pColumn : m_aColumns) + delete pColumn; m_aColumns.clear(); DbGridControl_Base::RemoveColumns(); @@ -2665,9 +2664,8 @@ void DbGridControl::SetFilterMode(bool bMode) m_xEmptyRow = new DbGridRow(); // setting the new filter controls - for ( size_t i = 0; i < m_aColumns.size(); ++i ) + for (DbGridColumn* pCurCol : m_aColumns) { - DbGridColumn* pCurCol = m_aColumns[ i ]; if (!pCurCol->IsHidden()) pCurCol->UpdateControl(); } @@ -3582,9 +3580,8 @@ void DbGridControl::ConnectToFields() m_pFieldListeners = pListeners; } - for ( size_t i = 0; i < m_aColumns.size(); ++i ) + for (DbGridColumn* pCurrent : m_aColumns) { - DbGridColumn* pCurrent = m_aColumns[ i ]; sal_uInt16 nViewPos = pCurrent ? GetViewColumnPos(pCurrent->GetId()) : GRID_COLUMN_NOT_FOUND; if (GRID_COLUMN_NOT_FOUND == nViewPos) continue; diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 70c7aadbda38..64665c8817b4 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -271,8 +271,8 @@ void FmPropBrw::dispose() , OUString( "DialogParentWindow" ) , OUString( "ControlContext" ) , OUString( "ControlShapeAccess" ) }; - for ( size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i ) - xName->removeByName( pProps[i] ); + for (const auto & i : pProps) + xName->removeByName( i ); } } catch (const Exception& ) diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index edb5c82093c7..3ca6326362b0 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -168,8 +168,8 @@ void FmEntryDataList::insert( FmEntryData* pItem, size_t Index ) void FmEntryDataList::clear() { - for ( size_t i = 0, n = maEntryDataList.size(); i < n; ++i ) - delete maEntryDataList[ i ]; + for (FmEntryData* p : maEntryDataList) + delete p; maEntryDataList.clear(); } diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index 0b4277dc671a..486936983cf7 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -189,8 +189,8 @@ bool FmFormPage::RequestHelp( vcl::Window* pWindow, SdrView* pView, INetProtocol::Https, INetProtocol::Javascript, INetProtocol::Ldap }; - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(s_aQuickHelpSupported); ++i) - if (s_aQuickHelpSupported[i] == aProtocol) + for (const INetProtocol& i : s_aQuickHelpSupported) + if (i == aProtocol) { aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), INetURLObject::DECODE_UNAMBIGUOUS); break; diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 192d71721783..b61f9d0eb6dd 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1058,8 +1058,8 @@ PopupMenu* FmXFormShell::GetConversionMenu() bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId ) { - for ( size_t i = 0; i < SAL_N_ELEMENTS(nConvertSlots); ++i ) - if (nConvertSlots[i] == nSlotId) + for (sal_Int16 nConvertSlot : nConvertSlots) + if (nConvertSlot == nSlotId) return true; return false; } @@ -2023,8 +2023,8 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection ) impl_updateCurrentForm( xNewCurrentForm ); // ensure some slots are updated - for ( size_t i = 0; i < SAL_N_ELEMENTS(SelObjectSlotMap); ++i ) - InvalidateSlot( SelObjectSlotMap[i], false); + for (sal_Int16 i : SelObjectSlotMap) + InvalidateSlot( i, false); return true; } @@ -2063,8 +2063,8 @@ void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurFo pPage->GetImpl().setCurForm( m_xCurrentForm ); // ensure the UI which depends on the current form is up-to-date - for ( size_t i = 0; i < SAL_N_ELEMENTS( DlgSlotMap ); ++i ) - InvalidateSlot( DlgSlotMap[i], false ); + for (sal_Int16 i : DlgSlotMap) + InvalidateSlot( i, false ); } diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index d653f5c782ac..0e10c589198a 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -785,9 +785,9 @@ void FmSearchEngine::fillControlTexts(const InterfaceArray& arrFields) { clearControlTexts(); Reference< XInterface > xCurrent; - for (size_t i=0; i<arrFields.size(); ++i) + for (const auto & rField : arrFields) { - xCurrent = arrFields.at(i); + xCurrent = rField; DBG_ASSERT(xCurrent.is(), "FmSearchEngine::fillControlTexts : invalid field interface !"); // check which type of control this is Reference< css::awt::XTextComponent > xAsText(xCurrent, UNO_QUERY); @@ -1246,12 +1246,12 @@ void FmSearchEngine::RebuildUsedFields(sal_Int32 nFieldIndex, bool bForce) if (nFieldIndex == -1) { Reference< css::container::XIndexAccess > xFields; - for (size_t i=0; i<m_arrFieldMapping.size(); ++i) + for (sal_Int32 i : m_arrFieldMapping) { Reference< css::sdbcx::XColumnsSupplier > xSupplyCols(IFACECAST(m_xSearchCursor), UNO_QUERY); DBG_ASSERT(xSupplyCols.is(), "FmSearchEngine::RebuildUsedFields : invalid cursor (no columns supplier) !"); xFields.set(xSupplyCols->getColumns(), UNO_QUERY); - BuildAndInsertFieldInfo(xFields, m_arrFieldMapping[i]); + BuildAndInsertFieldInfo(xFields, i); } } else diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx index 2d93b6357256..8255ccc5dfd3 100644 --- a/svx/source/form/formcontrolling.cxx +++ b/svx/source/form/formcontrolling.cxx @@ -105,8 +105,8 @@ namespace svx { OUString(FMURL_FORM_APPLY_FILTER), SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter }, { OUString(FMURL_FORM_REMOVE_FILTER), SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort } }; - for ( size_t i=0; i<SAL_N_ELEMENTS(aDescriptions); ++i ) - s_aFeatureDescriptions.push_back( aDescriptions[i] ); + for (FeatureDescription & rDescription : aDescriptions) + s_aFeatureDescriptions.push_back( rDescription ); } }; return s_aFeatureDescriptions; diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index f86971271b8d..d9b5ce52477e 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -170,8 +170,8 @@ Gallery::Gallery( const OUString& rMultiPath ) Gallery::~Gallery() { // erase theme list - for ( size_t i = 0, n = aThemeList.size(); i < n; ++i ) - delete aThemeList[ i ]; + for (GalleryThemeEntry* p : aThemeList) + delete p; aThemeList.clear(); } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 9ecaca4f5202..bd3ea97c6e7f 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -77,9 +77,8 @@ GalleryTheme::~GalleryTheme() { ImplWrite(); - for ( size_t i = 0, n = aObjectList.size(); i < n; ++i ) + for (GalleryObject* pEntry : aObjectList) { - GalleryObject* pEntry = aObjectList[ i ]; Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) ); Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) ); delete pEntry; @@ -221,9 +220,9 @@ void GalleryTheme::ImplWrite() const GalleryObject* GalleryTheme::ImplGetGalleryObject( const INetURLObject& rURL ) { - for ( size_t i = 0, n = aObjectList.size(); i < n; ++i ) - if ( aObjectList[ i ]->aURL == rURL ) - return aObjectList[ i ]; + for (GalleryObject* i : aObjectList) + if ( i->aURL == rURL ) + return i; return nullptr; } @@ -294,8 +293,8 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDat bExists = false; - for ( size_t i = 0, n = aObjectList.size(); i < n; ++i ) - if ( aObjectList[ i ]->aURL == aNewURL ) + for (GalleryObject* p : aObjectList) + if ( p->aURL == aNewURL ) { bExists = true; break; @@ -616,9 +615,9 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize if( pIStm && pTmpStm ) { - for ( size_t i = 0, n = aObjectList.size(); i < n; ++i ) + for (GalleryObject* i : aObjectList) { - pEntry = aObjectList[ i ]; + pEntry = i; std::unique_ptr<SgaObject> pObj; switch( pEntry->eObjKind ) @@ -1397,9 +1396,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) sal_uInt32 nId1, nId2; bool bRel; - for( size_t i = 0, n = aObjectList.size(); i < n; ++i ) + for(GalleryObject* i : aObjectList) { - pObj = aObjectList[ i ]; + pObj = i; Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pObj ) ) ); Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pObj ) ) ); delete pObj; diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 637a7d1f7e90..d86e1f2f4053 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -1562,9 +1562,9 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, pFormatter->GetCurrencyFormatStrings( aWSStringsDtor, *pTmpCurrencyEntry, bTmpBanking ); - for(size_t i=0;i<aWSStringsDtor.size();i++) + for(const OUString & s : aWSStringsDtor) { - if (aWSStringsDtor[i] == rFmtString) + if (s == rFmtString) { bFlag=true; break; diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index a1b57725166b..04bb93c85325 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -516,10 +516,9 @@ GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr() GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): NBOTypeMgrBase(aTypeMgr) { - for (size_t i=0, n = aTypeMgr.aGrfDataLst.size(); i < n; ++i) + for (const GrfBulDataRelation* pSrcEntry : aTypeMgr.aGrfDataLst) { GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); - GrfBulDataRelation* pSrcEntry = aTypeMgr.aGrfDataLst[i]; if (pSrcEntry) { pEntry->bIsCustomized = pSrcEntry->bIsCustomized; @@ -536,8 +535,8 @@ GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTy GraphyicBulletsTypeMgr::~GraphyicBulletsTypeMgr() { - for (size_t i = 0; i < aGrfDataLst.size(); ++i) - delete aGrfDataLst[i]; + for (const GrfBulDataRelation* p : aGrfDataLst) + delete p; } class theGraphyicBulletsTypeMgr : public rtl::Static<GraphyicBulletsTypeMgr, theGraphyicBulletsTypeMgr> {}; @@ -593,9 +592,8 @@ sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uI if ( pGrf ) { Graphic aGraphic; - for (size_t i=0; i < aGrfDataLst.size(); ++i) + for (const GrfBulDataRelation* pEntry : aGrfDataLst) { - GrfBulDataRelation* pEntry = aGrfDataLst[i]; bool bExist = false; if ( pEntry) bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index ee99934ecdc1..81f22238c536 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -91,9 +91,9 @@ void SmartTagMgr::RecognizeString( const OUString& rText, const lang::Locale& rLocale, sal_uInt32 nStart, sal_uInt32 nLen ) const { - for ( size_t i = 0; i < maRecognizerList.size(); i++ ) + for (const auto & i : maRecognizerList) { - Reference < smarttags::XSmartTagRecognizer > xRecognizer = maRecognizerList[i]; + Reference < smarttags::XSmartTagRecognizer > xRecognizer = i; // if all smart tag types supported by this recognizer have been // disabled, we do not have to call the recognizer: @@ -109,7 +109,7 @@ void SmartTagMgr::RecognizeString( const OUString& rText, if ( bCallRecognizer ) { CreateBreakIterator(); - maRecognizerList[i]->recognize( rText, nStart, nLen, + i->recognize( rText, nStart, nLen, smarttags::SmartTagRecognizerMode_PARAGRAPH, rLocale, xMarkup, maApplicationName, xController, mxBreakIter ); @@ -121,10 +121,8 @@ void SmartTagMgr::RecognizeTextRange(const Reference< text::XTextRange>& xRange, const Reference< text::XTextMarkup >& xMarkup, const Reference< frame::XController >& xController) const { - for ( size_t i = 0; i < maRecognizerList.size(); i++ ) + for (const Reference<smarttags::XSmartTagRecognizer>& xRecognizer : maRecognizerList) { - Reference < smarttags::XSmartTagRecognizer > xRecognizer = maRecognizerList[i]; - Reference< smarttags::XRangeBasedSmartTagRecognizer > xRangeBasedRecognizer( xRecognizer, UNO_QUERY); if (!xRangeBasedRecognizer.is()) continue; diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index d578582d81b6..adb35db6167e 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -62,11 +62,11 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 { Image arr[3] = {mpImpl->maImage, mpImpl->maImageBroken, mpImpl->maImageNotValidated}; - for (int i = 0; i < 3; i++) + for (Image & i : arr) { - BitmapEx b = arr[i].GetBitmapEx(); + BitmapEx b = i.GetBitmapEx(); b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), BmpScaleFlag::Fast); - arr[i] = Image(b); + i = Image(b); } mpImpl->maImage = arr[0]; diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 504ffa027fa1..ab313c8599f1 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -113,10 +113,10 @@ void ColorSets::init() const ColorSet& ColorSets::getColorSet(const OUString& rName) { - for (size_t i = 0; i < maColorSets.size(); ++i) + for (ColorSet & rColorSet : maColorSets) { - if (maColorSets[i].getName() == rName) - return maColorSets[i]; + if (rColorSet.getName() == rName) + return rColorSet; } return maColorSets[0]; } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 5996b50eaecd..fc96f3d74f5c 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -308,9 +308,9 @@ basegfx::B2DRange SdrDragMethod::getCurrentRange() const void SdrDragMethod::clearSdrDragEntries() { - for(size_t a(0); a < maSdrDragEntries.size(); a++) + for(SdrDragEntry* p : maSdrDragEntries) { - delete maSdrDragEntries[a]; + delete p; } maSdrDragEntries.clear(); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 8408869ea207..a1d0de23144f 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -878,8 +878,8 @@ void SdrEditView::DistributeMarkedObjects() } // clear list - for ( size_t i = 0, n = aEntryList.size(); i < n; ++i ) - delete aEntryList[ i ]; + for (ImpDistributeEntry* p : aEntryList) + delete p; aEntryList.clear(); } @@ -973,8 +973,8 @@ void SdrEditView::DistributeMarkedObjects() } // clear list - for ( size_t i = 0, n = aEntryList.size(); i < n; ++i ) - delete aEntryList[ i ]; + for (ImpDistributeEntry* p : aEntryList) + delete p; aEntryList.clear(); } diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 6c4484d02242..439371b23d21 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -155,9 +155,8 @@ void OLEObjCache::UnloadOnDemand() uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY ); if ( xUnloadModel.is() ) { - for (size_t nCheckInd = 0; nCheckInd < maObjs.size(); nCheckInd++) + for (SdrOle2Obj* pCacheObj : maObjs) { - SdrOle2Obj* pCacheObj = maObjs[nCheckInd]; if ( pCacheObj && pCacheObj != pUnloadObj ) { uno::Reference< frame::XModel > xParentModel = pCacheObj->GetParentXModel(); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 87bd59ba9cac..31d488b6611a 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -295,9 +295,8 @@ size_t ImpSdrGDIMetaFileImport::DoImport( SdrInsertReason aReason(SDRREASON_VIEWCALL); - for(size_t i = 0; i < maTmpList.size(); ++i) + for(SdrObject* pObj : maTmpList) { - SdrObject* pObj = maTmpList[i]; rOL.NbcInsertObject(pObj, nInsPos, &aReason); nInsPos++; diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx index 8e0ed0287a6e..9374733d3652 100644 --- a/svx/source/svdraw/svdlayer.cxx +++ b/svx/source/svdraw/svdlayer.cxx @@ -26,9 +26,9 @@ bool SetOfByte::IsEmpty() const { - for(sal_uInt16 i(0); i < 32; i++) + for(sal_uInt8 i : aData) { - if(aData[i] != 0) + if(i != 0) return false; } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 81394baa6cb9..0316c9a416ea 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2394,9 +2394,9 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDas if(!aExtractedHairlines.empty()) { // for SdrObject creation, just copy all to a single Hairline-PolyPolygon - for(size_t a(0); a < aExtractedHairlines.size(); a++) + for(basegfx::B2DPolygon & rExtractedHairline : aExtractedHairlines) { - aMergedHairlinePolyPolygon.append(aExtractedHairlines[a]); + aMergedHairlinePolyPolygon.append(rExtractedHairline); } } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 930ae61a0099..fdc9c9c63a5d 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -615,9 +615,8 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const if(aDelta.X() || aDelta.Y()) { - for(size_t a(0); a < mpSdrPathDragData->maHandles.size(); a++) + for(SdrHdl* pHandle : mpSdrPathDragData->maHandles) { - SdrHdl* pHandle = mpSdrPathDragData->maHandles[a]; const sal_uInt16 nPolyIndex((sal_uInt16)pHandle->GetPolyNum()); const sal_uInt16 nPointIndex((sal_uInt16)pHandle->GetPointNum()); const XPolygon& rOrig = mpSdrPathDragData->maOrig[nPolyIndex]; diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index cc5f37de2dd9..a1f1b2fcc6f8 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -217,10 +217,8 @@ namespace drawinglayer::primitive2d::TextLayouterDevice aTextLayouter; double fRetval(0.0); - for(size_t a(0); a < rTextPortions.size(); a++) + for(const impPathTextPortion* pCandidate : rTextPortions) { - const impPathTextPortion* pCandidate = rTextPortions[a]; - if(pCandidate && pCandidate->getTextLength()) { aTextLayouter.setFont(pCandidate->getFont()); @@ -593,9 +591,9 @@ namespace { std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives; - for(size_t a(0); a < rSource.size(); a++) + for(drawinglayer::primitive2d::BasePrimitive2D* a : rSource) { - const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTextCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(rSource[a]); + const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTextCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(a); if(pTextCandidate) { @@ -720,10 +718,8 @@ void SdrTextObj::impDecomposePathTextPrimitive( // filter text portions for this paragraph ::std::vector< const impPathTextPortion* > aParagraphTextPortions; - for(size_t b(0); b < rPathTextPortions.size(); b++) + for(const auto & rCandidate : rPathTextPortions) { - const impPathTextPortion& rCandidate = rPathTextPortions[b]; - if(static_cast<sal_uInt32>(rCandidate.getParagraph()) == a) { aParagraphTextPortions.push_back(&rCandidate); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 8270f34bed2b..c50cd7fee065 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -687,13 +687,10 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* rObjVector1.push_back( pMark ); } - for( size_t n = 0, nCount = aObjVectors.size(); n < nCount; ++n ) + for(std::vector<SdrMark*> & rObjVector : aObjVectors) { - ::std::vector< SdrMark* >& rObjVector = aObjVectors[ n ]; - - for( size_t i = 0; i < rObjVector.size(); ++i ) + for(SdrMark* pMark : rObjVector) { - SdrMark* pMark = rObjVector[ i ]; aRetval.push_back(pMark->GetMarkedSdrObj()); } } @@ -734,9 +731,8 @@ SdrModel* SdrExchangeView::GetMarkedObjModel() const // New mechanism to re-create the connections of cloned connectors CloneList aCloneList; - for( size_t i(0); i < aSdrObjects.size(); i++ ) + for(SdrObject* pObj : aSdrObjects) { - const SdrObject* pObj = aSdrObjects[i]; SdrObject* pNeuObj; if( dynamic_cast<const SdrPageObj*>( pObj) != nullptr ) diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index d774530e0be0..ea4aa3358105 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -390,8 +390,8 @@ void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& void SAL_CALL TableDesignStyle::disposing() { - for( sal_Int32 nIndex = 0; nIndex < style_count; nIndex++ ) - maCellStyles[nIndex].clear(); + for(Reference<XStyle> & rCellStyle : maCellStyles) + rCellStyle.clear(); } diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index e500aa4d9952..d0e43ab67581 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -249,8 +249,8 @@ void SvxUndoRedoControl::StateChanged( const SfxStringListItem &rItem = *static_cast<const SfxStringListItem *>(pState); const std::vector<OUString> &aLst = rItem.GetList(); - for( long nI = 0, nEnd = aLst.size(); nI < nEnd; ++nI ) - aUndoRedoList.push_back( aLst[nI] ); + for(const auto & i : aLst) + aUndoRedoList.push_back( i ); } } } @@ -271,8 +271,8 @@ VclPtr<SfxPopupWindow> SvxUndoRedoControl::CreatePopupWindow() ListBox &rListBox = pPopupWin->GetListBox(); rListBox.SetSelectHdl( LINK( this, SvxUndoRedoControl, SelectHdl ) ); - for( size_t n = 0; n < aUndoRedoList.size(); n++ ) - rListBox.InsertEntry( aUndoRedoList[n] ); + for(const OUString & s : aUndoRedoList) + rListBox.InsertEntry( s ); rListBox.SelectEntryPos( 0 ); aActionStr = SVX_RESSTR(SID_UNDO == GetSlotId() ? diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index bcc310560b7f..49da834f9227 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -358,8 +358,8 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent, , m_aMenu ( SVX_RES( RID_SVX_STYLE_MENU ) ) { m_aMenu.SetSelectHdl( LINK( this, SvxStyleBox_Impl, MenuSelectHdl ) ); - for(int i = 0; i < MAX_STYLES_ENTRIES; i++) - m_pButtons[i] = nullptr; + for(VclPtr<MenuButton> & rpButton : m_pButtons) + rpButton = nullptr; aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT ); SetOptimalSize(); EnableAutocomplete( true ); @@ -377,9 +377,9 @@ void SvxStyleBox_Impl::dispose() { RemoveEventListener(LINK(this, SvxStyleBox_Impl, CalcOptimalExtraUserWidth)); - for (int i = 0; i < MAX_STYLES_ENTRIES; i++) + for (VclPtr<MenuButton>& rButton : m_pButtons) { - m_pButtons[i].disposeAndClear(); + rButton.disposeAndClear(); } ComboBox::dispose(); @@ -2147,11 +2147,11 @@ struct SvxStyleToolBoxControl::Impl }; Reference<container::XNameAccess> xCellStyles; xStylesSupplier->getStyleFamilies()->getByName("CellStyles") >>= xCellStyles; - for( sal_uInt32 nStyle = 0; nStyle < SAL_N_ELEMENTS(aCalcStyles); ++nStyle ) + for(const char* pCalcStyle : aCalcStyles) { try { - const OUString sStyleName( OUString::createFromAscii( aCalcStyles[nStyle] ) ); + const OUString sStyleName( OUString::createFromAscii( pCalcStyle ) ); if( xCellStyles->hasByName( sStyleName ) ) { Reference< beans::XPropertySet > xStyle( xCellStyles->getByName( sStyleName), UNO_QUERY_THROW ); @@ -2262,8 +2262,8 @@ void SAL_CALL SvxStyleToolBoxControl::update() throw (RuntimeException, std::exc SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>(GetToolBox().GetItemWindow( GetId() )); if ( pBox->IsVisible() ) { - for ( int i=0; i<MAX_FAMILIES; i++ ) - pBoundItems [i]->ReBind(); + for (SfxStyleControllerItem_Impl* pBoundItem : pBoundItems) + pBoundItem->ReBind(); bindListener(); } @@ -2487,15 +2487,15 @@ IMPL_LINK_NOARG_TYPED(SvxStyleToolBoxControl, VisibilityNotification, SvxStyleBo if ( pBox && pBox->IsVisible() && !isBound() ) { - for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) - pBoundItems [i]->ReBind(); + for (SfxStyleControllerItem_Impl* pBoundItem : pBoundItems) + pBoundItem->ReBind(); bindListener(); } else if ( (!pBox || !pBox->IsVisible()) && isBound() ) { - for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) - pBoundItems[i]->UnBind(); + for (SfxStyleControllerItem_Impl* pBoundItem : pBoundItems) + pBoundItem->UnBind(); unbindListener(); } } diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 678a30420304..37b311ac8e0e 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -849,8 +849,8 @@ const UHashMapImpl& GetUHashImpl() { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG }, }; - for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++) - aImpl[OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id; + for (const auto& i : aInit) + aImpl[OUString( i.name, i.length, RTL_TEXTENCODING_ASCII_US ) ] = i.id; bInited = true; } @@ -910,8 +910,8 @@ SvxUnoPropertyMapProvider::SvxUnoPropertyMapProvider() SvxUnoPropertyMapProvider::~SvxUnoPropertyMapProvider() { - for(sal_uInt16 i=0;i<SVXMAP_END; i++) - delete aSetArr[i]; + for(SvxItemPropertySet* p : aSetArr) + delete p; } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 8a8720620360..28f6b4733dff 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -549,9 +549,9 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, bool bCompressed = aMimeType.isEmpty(); if( !bCompressed ) { - for( size_t i = 0; i < SAL_N_ELEMENTS(aCompressiblePics); ++i ) + for(const char* p : aCompressiblePics) { - if( aMimeType.equalsIgnoreAsciiCaseAscii(aCompressiblePics[i]) ) + if( aMimeType.equalsIgnoreAsciiCaseAscii(p) ) { bCompressed = true; break; diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx index ae5819ba0f2c..de87258087c8 100644 --- a/svx/source/xoutdev/_xpoly.cxx +++ b/svx/source/xoutdev/_xpoly.cxx @@ -886,14 +886,14 @@ ImpXPolyPolygon::ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly ) : nRefCount = 1; // duplicate elements - for ( size_t i = 0, n = aXPolyList.size(); i < n; ++i ) - aXPolyList[ i ] = new XPolygon( *aXPolyList[ i ] ); + for (XPolygon*& rp : aXPolyList) + rp = new XPolygon( *rp ); } ImpXPolyPolygon::~ImpXPolyPolygon() { - for ( size_t i = 0, n = aXPolyList.size(); i < n; ++i ) - delete aXPolyList[ i ]; + for (XPolygon* p : aXPolyList) + delete p; aXPolyList.clear(); } @@ -972,8 +972,8 @@ void XPolyPolygon::Clear() } else { - for( size_t i = 0, n = pImpXPolyPolygon->aXPolyList.size(); i < n; ++i ) - delete pImpXPolyPolygon->aXPolyList[ i ]; + for(XPolygon* p : pImpXPolyPolygon->aXPolyList) + delete p; pImpXPolyPolygon->aXPolyList.clear(); } } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index e86cb4aafc63..9fc5d04cb8ed 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -291,9 +291,9 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) { sal_uInt16 aArray[64]; - for(sal_uInt16 i(0); i < 64; i++) + for(sal_uInt16 & i : aArray) { - rIn.ReadUInt16( aArray[i] ); + rIn.ReadUInt16( i ); } Color aColorPix; diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index 56fbd47014d6..52c2209f0a3c 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -114,9 +114,9 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) if(!aDotDashArray.empty()) { - for(size_t a(0); a < aDotDashArray.size(); a++) + for(double & a : aDotDashArray) { - aDotDashArray[a] *= fScaleValue; + a *= fScaleValue; } fFullDotDashLen *= fScaleValue; diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index f7776f15eb25..e73fd080a4be 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -126,8 +126,8 @@ XPropertyList::XPropertyList( XPropertyList::~XPropertyList() { // fprintf (stderr, "Destroy type %d count %d\n", (int)meType, --count); - for( size_t i = 0, n = maList.size(); i < n; ++i ) - delete maList[ i ]; + for(XPropertyEntry* p : maList) + delete p; maList.clear(); } @@ -386,10 +386,10 @@ static struct { OUString XPropertyList::GetDefaultExt( XPropertyListType t ) { - for (size_t i = 0; i < SAL_N_ELEMENTS (pExtnMap); i++) + for (const auto & i : pExtnMap) { - if( pExtnMap[i].t == t ) - return OUString::createFromAscii( pExtnMap[ i ].pExt ); + if( i.t == t ) + return OUString::createFromAscii( i.pExt ); } return OUString(); } |