diff options
-rw-r--r-- | svx/source/fmcomp/dbaexchange.cxx | 51 | ||||
-rw-r--r-- | svx/source/fmcomp/dbaobjectex.cxx | 14 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 5 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 12 | ||||
-rw-r--r-- | svx/source/form/dataaccessdescriptor.cxx | 12 | ||||
-rw-r--r-- | svx/source/form/filtnav.cxx | 31 | ||||
-rw-r--r-- | svx/source/form/fmcontrolbordermanager.cxx | 13 | ||||
-rw-r--r-- | svx/source/form/fmexch.cxx | 16 | ||||
-rw-r--r-- | svx/source/form/fmexpl.cxx | 12 | ||||
-rw-r--r-- | svx/source/form/fmobjfac.cxx | 9 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 49 | ||||
-rw-r--r-- | svx/source/form/fmtextcontrolshell.cxx | 27 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 74 | ||||
-rw-r--r-- | svx/source/form/formcontroller.cxx | 135 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 54 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 6 | ||||
-rw-r--r-- | svx/source/gallery2/galini.cxx | 8 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 37 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 6 | ||||
-rw-r--r-- | svx/source/gengal/gengal.cxx | 10 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 24 |
21 files changed, 208 insertions, 397 deletions
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index 3ffe3d0693be..00014f83244c 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -238,20 +238,13 @@ namespace svx bool bFieldFormat = bool(_nFormats & ColumnTransferFormatFlags::FIELD_DESCRIPTOR); bool bControlFormat = bool(_nFormats & ColumnTransferFormatFlags::CONTROL_EXCHANGE); bool bDescriptorFormat = bool(_nFormats & ColumnTransferFormatFlags::COLUMN_DESCRIPTOR); - for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin(); - aCheck != _rFlavors.end(); - ++aCheck - ) - { - if (bFieldFormat && (SotClipboardFormatId::SBA_FIELDDATAEXCHANGE == aCheck->mnSotId)) - return true; - if (bControlFormat && (SotClipboardFormatId::SBA_CTRLDATAEXCHANGE == aCheck->mnSotId)) - return true; - if (bDescriptorFormat && (getDescriptorFormatId() == aCheck->mnSotId)) - return true; - } - - return false; + SotClipboardFormatId nFormatId = getDescriptorFormatId(); + return std::any_of(_rFlavors.begin(), _rFlavors.end(), + [&](const DataFlavorEx& rCheck) { + return (bFieldFormat && (SotClipboardFormatId::SBA_FIELDDATAEXCHANGE == rCheck.mnSotId)) + || (bControlFormat && (SotClipboardFormatId::SBA_CTRLDATAEXCHANGE == rCheck.mnSotId)) + || (bDescriptorFormat && (nFormatId == rCheck.mnSotId)); + }); } @@ -470,19 +463,12 @@ namespace svx bool ODataAccessObjectTransferable::canExtractObjectDescriptor(const DataFlavorExVector& _rFlavors) { - for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin(); - aCheck != _rFlavors.end(); - ++aCheck - ) - { - if (SotClipboardFormatId::DBACCESS_TABLE == aCheck->mnSotId) - return true; - if (SotClipboardFormatId::DBACCESS_QUERY == aCheck->mnSotId) - return true; - if (SotClipboardFormatId::DBACCESS_COMMAND == aCheck->mnSotId) - return true; - } - return false; + return std::any_of(_rFlavors.begin(), _rFlavors.end(), + [](const DataFlavorEx& rCheck) { + return SotClipboardFormatId::DBACCESS_TABLE == rCheck.mnSotId + || SotClipboardFormatId::DBACCESS_QUERY == rCheck.mnSotId + || SotClipboardFormatId::DBACCESS_COMMAND == rCheck.mnSotId; + }); } @@ -634,14 +620,9 @@ namespace svx bool OMultiColumnTransferable::canExtractDescriptor(const DataFlavorExVector& _rFlavors) { - DataFlavorExVector::const_iterator aCheck = _rFlavors.begin(); - for ( ; - aCheck != _rFlavors.end() && getDescriptorFormatId() == aCheck->mnSotId; - ++aCheck - ) - ; - - return aCheck == _rFlavors.end(); + const SotClipboardFormatId nFormatId = getDescriptorFormatId(); + return std::all_of(_rFlavors.begin(), _rFlavors.end(), + [&nFormatId](const DataFlavorEx& rCheck) { return nFormatId == rCheck.mnSotId; }); } diff --git a/svx/source/fmcomp/dbaobjectex.cxx b/svx/source/fmcomp/dbaobjectex.cxx index bfb427a47897..7d02064faa61 100644 --- a/svx/source/fmcomp/dbaobjectex.cxx +++ b/svx/source/fmcomp/dbaobjectex.cxx @@ -94,17 +94,9 @@ namespace svx bool OComponentTransferable::canExtractComponentDescriptor(const DataFlavorExVector& _rFlavors, bool _bForm ) { - DataFlavorExVector::const_iterator aEnd = _rFlavors.end(); - for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin(); - aCheck != aEnd; - ++aCheck - ) - { - if ( getDescriptorFormatId(_bForm) == aCheck->mnSotId ) - return true; - } - - return false; + SotClipboardFormatId nFormatId = getDescriptorFormatId(_bForm); + return std::any_of(_rFlavors.begin(), _rFlavors.end(), + [&nFormatId](const DataFlavorEx& rCheck) { return nFormatId == rCheck.mnSotId; }); } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 526917920bee..8946bc010d7a 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -3079,9 +3079,8 @@ void DbFilterField::Update() } // filling the entries for the combobox - for (::std::vector< OUString >::const_iterator iter = aStringList.begin(); - iter != aStringList.end(); ++iter) - static_cast<ComboBox*>(m_pWindow.get())->InsertEntry(*iter); + for (const auto& rString : aStringList) + static_cast<ComboBox*>(m_pWindow.get())->InsertEntry(rString); } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index a0e898c3d571..2403b92245e1 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -3467,13 +3467,11 @@ void DbGridControl::BeginCursorAction() if (m_pFieldListeners) { ColumnFieldValueListeners* pListeners = static_cast<ColumnFieldValueListeners*>(m_pFieldListeners); - ColumnFieldValueListeners::const_iterator aIter = pListeners->begin(); - while (aIter != pListeners->end()) + for (const auto& rListener : *pListeners) { - GridFieldValueListener* pCurrent = (*aIter).second; + GridFieldValueListener* pCurrent = rListener.second; if (pCurrent) pCurrent->suspend(); - ++aIter; } } @@ -3486,13 +3484,11 @@ void DbGridControl::EndCursorAction() if (m_pFieldListeners) { ColumnFieldValueListeners* pListeners = static_cast<ColumnFieldValueListeners*>(m_pFieldListeners); - ColumnFieldValueListeners::const_iterator aIter = pListeners->begin(); - while (aIter != pListeners->end()) + for (const auto& rListener : *pListeners) { - GridFieldValueListener* pCurrent = (*aIter).second; + GridFieldValueListener* pCurrent = rListener.second; if (pCurrent) pCurrent->resume(); - ++aIter; } } diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx index a5dc96a34e58..7d6cac0b4543 100644 --- a/svx/source/form/dataaccessdescriptor.cxx +++ b/svx/source/form/dataaccessdescriptor.cxx @@ -208,14 +208,10 @@ namespace svx DataAccessDescriptorProperty nNeededHandle = _rPos->first; - for ( MapString2PropertyEntry::const_iterator loop = rProperties.begin(); - loop != rProperties.end(); - ++loop - ) - { - if ( nNeededHandle == loop->second->mnHandle ) - return loop->second; - } + auto loop = std::find_if(rProperties.begin(), rProperties.end(), + [&nNeededHandle](const MapString2PropertyEntry::value_type& rProp) { return nNeededHandle == rProp.second->mnHandle; }); + if (loop != rProperties.end()) + return loop->second; throw RuntimeException(); } diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 48ca4b5cecf9..744ce393f5c8 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -599,9 +599,9 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar FmFormItem* FmFilterModel::Find(const ::std::vector<std::unique_ptr<FmFilterData>>& rItems, const Reference< XFormController > & xController) const { - for (auto i = rItems.begin(); i != rItems.end(); ++i) + for (const auto& rItem : rItems) { - FmFormItem* pForm = dynamic_cast<FmFormItem*>( i->get() ); + FmFormItem* pForm = dynamic_cast<FmFormItem*>( rItem.get() ); if (pForm) { if ( xController == pForm->GetController() ) @@ -620,9 +620,9 @@ FmFormItem* FmFilterModel::Find(const ::std::vector<std::unique_ptr<FmFilterData FmFormItem* FmFilterModel::Find(const ::std::vector<std::unique_ptr<FmFilterData>>& rItems, const Reference< XForm >& xForm) const { - for (auto i = rItems.begin(); i != rItems.end(); ++i) + for (const auto& rItem : rItems) { - FmFormItem* pForm = dynamic_cast<FmFormItem*>( i->get() ); + FmFormItem* pForm = dynamic_cast<FmFormItem*>( rItem.get() ); if (pForm) { if (xForm == pForm->GetController()->getModel()) @@ -669,13 +669,8 @@ void FmFilterModel::SetCurrentController(const Reference< XFormController > & xC void FmFilterModel::AppendFilterItems( FmFormItem& _rFormItem ) { // insert the condition behind the last filter items - auto aEnd = _rFormItem.GetChildren().rend(); - auto iter = _rFormItem.GetChildren().rbegin(); - while ( iter != aEnd ) - { - if (dynamic_cast<const FmFilterItems*>(iter->get()) != nullptr) - break; - } + auto iter = std::find_if(_rFormItem.GetChildren().rbegin(), _rFormItem.GetChildren().rend(), + [](const std::unique_ptr<FmFilterData>& rChild) { return dynamic_cast<const FmFilterItems*>(rChild.get()) != nullptr; }); sal_Int32 nInsertPos = iter.base() - _rFormItem.GetChildren().begin(); // delegate this to the FilterController, it will notify us, which will let us update our model @@ -913,18 +908,17 @@ void FmFilterModel::EnsureEmptyFilterRows( FmParentData& _rItem ) // checks whether for each form there's one free level for input ::std::vector< std::unique_ptr<FmFilterData> >& rChildren = _rItem.GetChildren(); bool bAppendLevel = dynamic_cast<const FmFormItem*>(&_rItem) != nullptr; - auto aEnd = rChildren.end(); - for ( auto i = rChildren.begin(); i != aEnd; ++i ) + for ( auto& rpChild : rChildren ) { - FmFilterItems* pItems = dynamic_cast<FmFilterItems*>( i->get() ); + FmFilterItems* pItems = dynamic_cast<FmFilterItems*>( rpChild.get() ); if ( pItems && pItems->GetChildren().empty() ) { bAppendLevel = false; break; } - FmFormItem* pFormItem = dynamic_cast<FmFormItem*>( i->get() ); + FmFormItem* pFormItem = dynamic_cast<FmFormItem*>( rpChild.get() ); if (pFormItem) { EnsureEmptyFilterRows( *pFormItem ); @@ -1494,13 +1488,8 @@ FmFormItem* FmFilterNavigator::getSelectedFilterItems(::std::vector<FmFilterItem void FmFilterNavigator::insertFilterItem(const ::std::vector<FmFilterItem*>& _rFilterList,FmFilterItems* _pTargetItems,bool _bCopy) { - ::std::vector<FmFilterItem*>::const_iterator aEnd = _rFilterList.end(); - for ( ::std::vector< FmFilterItem* >::const_iterator i = _rFilterList.begin(); - i != aEnd; - ++i - ) + for (FmFilterItem* pLookupItem : _rFilterList) { - FmFilterItem* pLookupItem( *i ); if ( pLookupItem->GetParent() == _pTargetItems ) continue; diff --git a/svx/source/form/fmcontrolbordermanager.cxx b/svx/source/form/fmcontrolbordermanager.cxx index 301b146b933f..d49af12c95a4 100644 --- a/svx/source/form/fmcontrolbordermanager.cxx +++ b/svx/source/form/fmcontrolbordermanager.cxx @@ -311,17 +311,14 @@ namespace svxform ControlBag aInvalidControls; m_aInvalidControls.swap( aInvalidControls ); - for ( ControlBag::const_iterator loop = aInvalidControls.begin(); - loop != aInvalidControls.end(); - ++loop - ) + for (const auto& rControl : aInvalidControls) { - Reference< XVclWindowPeer > xPeer( loop->xControl->getPeer(), UNO_QUERY ); + Reference< XVclWindowPeer > xPeer( rControl.xControl->getPeer(), UNO_QUERY ); if ( xPeer.is() ) { - updateBorderStyle( loop->xControl, xPeer, *loop ); - xPeer->setProperty( FM_PROP_HELPTEXT, makeAny( loop->sOriginalHelpText ) ); - setUnderline( xPeer, *loop ); + updateBorderStyle( rControl.xControl, xPeer, rControl ); + xPeer->setProperty( FM_PROP_HELPTEXT, makeAny( rControl.sOriginalHelpText ) ); + setUnderline( xPeer, rControl ); } } } diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx index c21f29fe000a..a4db6149c2e1 100644 --- a/svx/source/form/fmexch.cxx +++ b/svx/source/form/fmexch.cxx @@ -98,13 +98,8 @@ namespace svxform bool OLocalExchange::hasFormat( const DataFlavorExVector& _rFormats, SotClipboardFormatId _nFormatId ) { - DataFlavorExVector::const_iterator aSearch; - - for ( aSearch = _rFormats.begin(); aSearch != _rFormats.end(); ++aSearch ) - if ( aSearch->mnSotId == _nFormatId ) - break; - - return aSearch != _rFormats.end(); + return std::any_of(_rFormats.begin(), _rFormats.end(), + [&_nFormatId](const DataFlavorEx& rFormat) { return rFormat.mnSotId == _nFormatId; }); } @@ -220,14 +215,10 @@ namespace svxform m_aControlPaths.realloc(nEntryCount); css::uno::Sequence<sal_uInt32>* pAllPaths = m_aControlPaths.getArray(); - for ( ListBoxEntrySet::const_iterator loop = m_aSelectedEntries.begin(); - loop != m_aSelectedEntries.end(); - ++loop, ++pAllPaths - ) + for (SvTreeListEntry* pCurrentEntry : m_aSelectedEntries) { // first we collect the path in an array ::std::vector< sal_uInt32 > aCurrentPath; - SvTreeListEntry* pCurrentEntry = *loop; SvTreeListEntry* pLoop = pCurrentEntry; while (pLoop != pRoot) @@ -248,6 +239,7 @@ namespace svxform sal_Int32 j,k; for (j = nDepth - 1, k = 0; k<nDepth; --j, ++k) pSeq[j] = aCurrentPath[k]; + ++pAllPaths; } } diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 8fec9e0f5798..32f4f8d4d646 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -134,14 +134,12 @@ FmEntryDataList::~FmEntryDataList() void FmEntryDataList::remove( FmEntryData* pItem ) { - auto aEnd = maEntryDataList.end(); - for ( auto it = maEntryDataList.begin(); it != aEnd; ++it ) + auto it = std::find_if(maEntryDataList.begin(), maEntryDataList.end(), + [&pItem](const std::unique_ptr<FmEntryData>& rEntryData) { return rEntryData.get() == pItem; }); + if (it != maEntryDataList.end()) { - if ( it->get() == pItem ) - { - maEntryDataList.erase( it ); - return; - } + maEntryDataList.erase( it ); + return; } assert(false); } diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx index 4eea3c8761e2..b698d43fd053 100644 --- a/svx/source/form/fmobjfac.cxx +++ b/svx/source/form/fmobjfac.cxx @@ -217,15 +217,12 @@ IMPL_STATIC_LINK(FmFormObjFactory, MakeObject, SdrObjCreatorParams, aParams, Sdr pNewObj = new FmFormObj(aParams.rSdrModel); // initialize some properties which we want to differ from the defaults - for ( PropertyValueArray::const_iterator aInitProp = aInitialProperties.begin(); - aInitProp != aInitialProperties.end(); - ++aInitProp - ) + for (const auto& rInitProp : aInitialProperties) { lcl_initProperty( static_cast< FmFormObj* >( pNewObj ), - aInitProp->first, - aInitProp->second + rInitProp.first, + rInitProp.second ); } } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 14f1ba9e3c60..f1b03ea828ef 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1002,10 +1002,10 @@ IMPL_LINK_NOARG(FmXFormShell, OnInvalidateSlots_Lock, void*,void) m_nInvalidationEvent = nullptr; - for (std::vector<InvalidSlotInfo>::const_iterator i = m_arrInvalidSlots.begin(); i < m_arrInvalidSlots.end(); ++i) + for (const auto& rInvalidSlot : m_arrInvalidSlots) { - if (i->id) - m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(i->id, true, (i->flags & 0x01)); + if (rInvalidSlot.id) + m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(rInvalidSlot.id, true, (rInvalidSlot.flags & 0x01)); else m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell); } @@ -2001,12 +2001,9 @@ bool FmXFormShell::setCurrentSelection_Lock( const InterfaceBag& _rSelection ) // determine the form which all the selected objects belong to, if any Reference< XForm > xNewCurrentForm; - for ( InterfaceBag::const_iterator loop = m_aCurrentSelection.begin(); - loop != m_aCurrentSelection.end(); - ++loop - ) + for (const auto& rpSelection : m_aCurrentSelection) { - Reference< XForm > xThisRoundsForm( GetForm( *loop ) ); + Reference< XForm > xThisRoundsForm( GetForm( rpSelection ) ); OSL_ENSURE( xThisRoundsForm.is(), "FmXFormShell::setCurrentSelection: *everything* should belong to a form!" ); if ( !xNewCurrentForm.is() ) @@ -2955,12 +2952,9 @@ void FmXFormShell::startFiltering_Lock() if ( pAdapter.is() ) { const ::std::vector< Reference< runtime::XFormController> >& rControllerList = pAdapter->GetList(); - for ( ::std::vector< Reference< runtime::XFormController> >::const_iterator j = rControllerList.begin(); - j != rControllerList.end(); - ++j - ) + for (const auto& rpController : rControllerList) { - Reference< XModeSelector> xModeSelector(*j, UNO_QUERY); + Reference< XModeSelector> xModeSelector(rpController, UNO_QUERY); if (xModeSelector.is()) xModeSelector->setMode( "FilterMode" ); } @@ -3037,13 +3031,12 @@ void FmXFormShell::stopFiltering_Lock(bool bSave) if (bSave) { - for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin(); - j != rControllerList.end(); ++j) + for (const auto& rpController : rControllerList) { // remember the current filter settings in case we're going to reload the forms below (which may fail) try { - Reference< XPropertySet > xFormAsSet((*j)->getModel(), UNO_QUERY); + Reference< XPropertySet > xFormAsSet(rpController->getModel(), UNO_QUERY); aOriginalFilters.push_back(::comphelper::getString(xFormAsSet->getPropertyValue(FM_PROP_FILTER))); aOriginalApplyFlags.push_back(::comphelper::getBOOL(xFormAsSet->getPropertyValue(FM_PROP_APPLYFILTER))); } @@ -3057,14 +3050,13 @@ void FmXFormShell::stopFiltering_Lock(bool bSave) aOriginalFilters.emplace_back( ); aOriginalApplyFlags.push_back( false ); } - saveFilter(*j); + saveFilter(rpController); } } - for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin(); - j != rControllerList.end(); ++j) + for (const auto& rController : rControllerList) { - Reference< XModeSelector> xModeSelector(*j, UNO_QUERY); + Reference< XModeSelector> xModeSelector(rController, UNO_QUERY); if (xModeSelector.is()) xModeSelector->setMode( "DataMode" ); } @@ -3406,21 +3398,17 @@ void FmXFormShell::CreateExternalView_Lock() // properties describing the "direct" column properties const sal_Int16 nListBoxDescription = 6; Sequence< PropertyValue> aListBoxDescription(nListBoxDescription); - for ( FmMapUString2UString::const_iterator aCtrlSource = aRadioControlSources.begin(); - aCtrlSource != aRadioControlSources.end(); - ++aCtrlSource, ++nOffset - ) + for (const auto& rCtrlSource : aRadioControlSources) { - PropertyValue* pListBoxDescription = aListBoxDescription.getArray(); // label pListBoxDescription->Name = FM_PROP_LABEL; - pListBoxDescription->Value <<= (*aCtrlSource).first; + pListBoxDescription->Value <<= rCtrlSource.first; ++pListBoxDescription; // control source pListBoxDescription->Name = FM_PROP_CONTROLSOURCE; - pListBoxDescription->Value <<= (*aCtrlSource).second; + pListBoxDescription->Value <<= rCtrlSource.second; ++pListBoxDescription; // bound column @@ -3434,7 +3422,7 @@ void FmXFormShell::CreateExternalView_Lock() ++pListBoxDescription; // list source - MapUString2UstringSeq::const_iterator aCurrentListSource = aRadioListSources.find((*aCtrlSource).first); + MapUString2UstringSeq::const_iterator aCurrentListSource = aRadioListSources.find(rCtrlSource.first); DBG_ASSERT(aCurrentListSource != aRadioListSources.end(), "FmXFormShell::CreateExternalView : inconsistent radio descriptions !"); pListBoxDescription->Name = FM_PROP_LISTSOURCE; @@ -3442,7 +3430,7 @@ void FmXFormShell::CreateExternalView_Lock() ++pListBoxDescription; // value list - MapUString2UstringSeq::const_iterator aCurrentValueList = aRadioValueLists.find((*aCtrlSource).first); + MapUString2UstringSeq::const_iterator aCurrentValueList = aRadioValueLists.find(rCtrlSource.first); DBG_ASSERT(aCurrentValueList != aRadioValueLists.end(), "FmXFormShell::CreateExternalView : inconsistent radio descriptions !"); pListBoxDescription->Name = FM_PROP_STRINGITEMLIST; @@ -3466,7 +3454,7 @@ void FmXFormShell::CreateExternalView_Lock() // column position pDispatchArgs->Name = FMARG_ADDCOL_COLUMNPOS; - FmMapUString2Int16::const_iterator aOffset = aRadioPositions.find((*aCtrlSource).first); + FmMapUString2Int16::const_iterator aOffset = aRadioPositions.find(rCtrlSource.first); DBG_ASSERT(aOffset != aRadioPositions.end(), "FmXFormShell::CreateExternalView : inconsistent radio descriptions !"); sal_Int16 nPosition = (*aOffset).second; @@ -3485,6 +3473,7 @@ void FmXFormShell::CreateExternalView_Lock() // dispatch the "add column" xAddColumnDispatch->dispatch(aAddColumnURL, aDispatchArgs); ++nAddedColumns; + ++nOffset; } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 07f73e9f4297..bb419edcc9da 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -555,12 +555,9 @@ namespace svx { SfxItemPool& rPool = *_rSet.GetPool(); - for ( ControlFeatures::const_iterator aFeature = _rDispatchers.begin(); - aFeature != _rDispatchers.end(); - ++aFeature - ) + for (const auto& rFeature : _rDispatchers) { - SfxSlotId nSlotId( aFeature->first ); + SfxSlotId nSlotId( rFeature.first ); #if OSL_DEBUG_LEVEL > 0 OUString sUnoSlotName; if ( SfxGetpApp() ) @@ -600,14 +597,14 @@ namespace svx if ( bIsInPool ) { #if OSL_DEBUG_LEVEL > 0 - bool bFeatureIsEnabled = aFeature->second->isFeatureEnabled(); + bool bFeatureIsEnabled = rFeature.second->isFeatureEnabled(); OString sMessage = "found a feature state for " + sUnoSlotNameAscii; if ( !bFeatureIsEnabled ) sMessage += " (disabled)"; SAL_INFO("svx.form", sMessage ); #endif - lcl_translateUnoStateToItem( nSlotId, aFeature->second->getFeatureState(), _rSet ); + lcl_translateUnoStateToItem( nSlotId, rFeature.second->getFeatureState(), _rSet ); } #if OSL_DEBUG_LEVEL > 0 else @@ -1096,13 +1093,9 @@ namespace svx OSL_PRECOND( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" ); // dispose all listeners associated with the controls of the active controller - FocusListenerAdapters::const_iterator aEnd = m_aControlObservers.end(); - for ( FocusListenerAdapters::iterator aLoop = m_aControlObservers.begin(); - aLoop != aEnd; - ++aLoop - ) + for (auto& rpObserver : m_aControlObservers) { - (*aLoop)->dispose(); + rpObserver->dispose(); } FocusListenerAdapters aEmpty; @@ -1115,13 +1108,9 @@ namespace svx void FmTextControlShell::implClearActiveControlRef() { // no more features for this control - ControlFeatures::const_iterator aEnd = m_aControlFeatures.end(); - for ( ControlFeatures::iterator aLoop = m_aControlFeatures.begin(); - aLoop != aEnd; - ++aLoop - ) + for (auto& rFeature : m_aControlFeatures) { - aLoop->second->dispose(); + rFeature.second->dispose(); } ControlFeatures aEmpty; diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 508a5067b393..6db43dd3c449 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -285,14 +285,13 @@ static Reference< XFormController > getControllerSearchChildren( const Referenc Reference< XFormController > FormViewPageWindowAdapter::getController( const Reference< XForm > & xForm ) const { Reference< XTabControllerModel > xModel(xForm, UNO_QUERY); - for (::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin(); - i != m_aControllerList.end(); ++i) + for (const auto& rpController : m_aControllerList) { - if ((*i)->getModel().get() == xModel.get()) - return *i; + if (rpController->getModel().get() == xModel.get()) + return rpController; // the current-round controller isn't the right one. perhaps one of its children ? - Reference< XFormController > xChildSearch = getControllerSearchChildren(Reference< XIndexAccess > (*i, UNO_QUERY), xModel); + Reference< XFormController > xChildSearch = getControllerSearchChildren(Reference< XIndexAccess > (rpController, UNO_QUERY), xModel); if (xChildSearch.is()) return xChildSearch; } @@ -442,12 +441,9 @@ FmXFormView::~FmXFormView() DBG_ASSERT( m_aPageWindowAdapters.empty(), "FmXFormView::~FmXFormView: Window list not empty!" ); if ( !m_aPageWindowAdapters.empty() ) { - for ( PageWindowAdapterList::const_iterator loop = m_aPageWindowAdapters.begin(); - loop != m_aPageWindowAdapters.end(); - ++loop - ) + for (const auto& rpAdapter : m_aPageWindowAdapters) { - (*loop)->dispose(); + rpAdapter->dispose(); } } @@ -527,14 +523,10 @@ void SAL_CALL FmXFormView::elementRemoved(const ContainerEvent& /*evt*/) PFormViewPageWindowAdapter FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const { - for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin(); - i != m_aPageWindowAdapters.end(); - ++i - ) - { - if ( _rxCC == (*i)->getControlContainer() ) - return *i; - } + auto i = std::find_if(m_aPageWindowAdapters.begin(), m_aPageWindowAdapters.end(), + [&_rxCC](const PFormViewPageWindowAdapter& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); + if (i != m_aPageWindowAdapters.end()) + return *i; return nullptr; } @@ -568,21 +560,16 @@ void FmXFormView::removeWindow( const Reference< XControlContainer >& _rxCC ) // - a window is deleted while in the design mode // - the control container for a window is removed while the active mode is on - for ( PageWindowAdapterList::iterator i = m_aPageWindowAdapters.begin(); - i != m_aPageWindowAdapters.end(); - ++i - ) + auto i = std::find_if(m_aPageWindowAdapters.begin(), m_aPageWindowAdapters.end(), + [&_rxCC](const PFormViewPageWindowAdapter& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); + if (i != m_aPageWindowAdapters.end()) { - if ( _rxCC != (*i)->getControlContainer() ) - continue; - Reference< XContainer > xContainer( _rxCC, UNO_QUERY ); if ( xContainer.is() ) xContainer->removeContainerListener( this ); (*i)->dispose(); m_aPageWindowAdapters.erase( i ); - break; } } @@ -624,21 +611,15 @@ void FmXFormView::resumeTabOrderUpdate() m_isTabOrderUpdateSuspended = false; // update the tab orders for all components which were collected since the suspendTabOrderUpdate call. - for ( MapControlContainerToSetOfForms::const_iterator container = m_aNeedTabOrderUpdate.begin(); - container != m_aNeedTabOrderUpdate.end(); - ++container - ) + for (const auto& rContainer : m_aNeedTabOrderUpdate) { - PFormViewPageWindowAdapter pAdapter = findWindow( container->first ); + PFormViewPageWindowAdapter pAdapter = findWindow( rContainer.first ); if ( !pAdapter.is() ) continue; - for ( SetOfForms::const_iterator form = container->second.begin(); - form != container->second.end(); - ++form - ) + for (const auto& rForm : rContainer.second) { - pAdapter->updateTabOrder( *form ); + pAdapter->updateTabOrder( rForm ); } } m_aNeedTabOrderUpdate.clear(); @@ -727,24 +708,17 @@ IMPL_LINK_NOARG(FmXFormView, OnActivate, void*, void) vcl::Window* pWindow = const_cast<vcl::Window*>(static_cast<const vcl::Window*>(m_pView->GetActualOutDev())); PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; - for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin(); - i != m_aPageWindowAdapters.end(); - ++i - ) + for (const auto& rpPageWindowAdapter : m_aPageWindowAdapters) { - if ( pWindow == (*i)->getWindow() ) - pAdapter =*i; + if ( pWindow == rpPageWindowAdapter->getWindow() ) + pAdapter = rpPageWindowAdapter; } if ( pAdapter.is() ) { Reference< XFormController > xControllerToActivate; - for ( ::std::vector< Reference< XFormController > >::const_iterator i = pAdapter->GetList().begin(); - i != pAdapter->GetList().end(); - ++i - ) + for (const Reference< XFormController > & xController : pAdapter->GetList()) { - const Reference< XFormController > & xController = *i; if ( !xController.is() ) continue; @@ -915,12 +889,8 @@ Reference< XFormController > FmXFormView::getFormController( const Reference< XF { Reference< XFormController > xController; - for ( PageWindowAdapterList::const_iterator pos = m_aPageWindowAdapters.begin(); - pos != m_aPageWindowAdapters.end(); - ++pos - ) + for (const PFormViewPageWindowAdapter& pAdapter : m_aPageWindowAdapters) { - const PFormViewPageWindowAdapter pAdapter( *pos ); if ( !pAdapter.get() ) { SAL_WARN( "svx.form", "FmXFormView::getFormController: invalid page window adapter!" ); diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 9d224871e8bc..e4766576e452 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -318,13 +318,9 @@ namespace void ColumnInfoCache::deinitializeControls() { - ColumnInfos::const_iterator aEnd = m_aColumns.end(); - for ( ColumnInfos::iterator col = m_aColumns.begin(); - col != aEnd; - ++col - ) + for (auto& rCol : m_aColumns) { - lcl_resetColumnControlInfo( *col ); + lcl_resetColumnControlInfo( rCol ); } m_bControlsInitialized = false; } @@ -334,19 +330,15 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > { try { - ColumnInfos::const_iterator aEnd = m_aColumns.end(); // for every of our known columns, find the controls which are bound to this column - for ( ColumnInfos::iterator col = m_aColumns.begin(); - col != aEnd; - ++col - ) + for (auto& rCol : m_aColumns) { - OSL_ENSURE( !col->xFirstControlWithInputRequired.is() && !col->xFirstGridWithInputRequiredColumn.is() - && ( col->nRequiredGridColumn == -1 ), "ColumnInfoCache::initializeControls: called me twice?" ); + OSL_ENSURE( !rCol.xFirstControlWithInputRequired.is() && !rCol.xFirstGridWithInputRequiredColumn.is() + && ( rCol.nRequiredGridColumn == -1 ), "ColumnInfoCache::initializeControls: called me twice?" ); - lcl_resetColumnControlInfo( *col ); + lcl_resetColumnControlInfo( rCol ); - Reference< XInterface > xNormColumn( col->xColumn, UNO_QUERY_THROW ); + Reference< XInterface > xNormColumn( rCol.xColumn, UNO_QUERY_THROW ); const Reference< XControl >* pControl( _rControls.getConstArray() ); const Reference< XControl >* pControlEnd( pControl + _rControls.getLength() ); @@ -380,8 +372,8 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > if ( gridCol < gridColCount ) { // found a grid column which is bound to the given - col->xFirstGridWithInputRequiredColumn = xGrid; - col->nRequiredGridColumn = gridCol; + rCol.xFirstGridWithInputRequiredColumn = xGrid; + rCol.nRequiredGridColumn = gridCol; break; } @@ -401,7 +393,7 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > // did not find a control which is bound to this particular column, and for which the input is required continue; // with next DB column - col->xFirstControlWithInputRequired = *pControl; + rCol.xFirstControlWithInputRequired = *pControl; } } catch( const Exception& ) @@ -513,12 +505,9 @@ struct UpdateAllListeners IMPL_LINK_NOARG( FormController, OnInvalidateFeatures, Timer*, void ) { ::osl::MutexGuard aGuard( m_aMutex ); - for ( ::std::set< sal_Int16 >::const_iterator aLoop = m_aInvalidFeatures.begin(); - aLoop != m_aInvalidFeatures.end(); - ++aLoop - ) + for (const auto& rFeature : m_aInvalidFeatures) { - DispatcherContainer::const_iterator aDispatcherPos = m_aFeatureDispatchers.find( *aLoop ); + DispatcherContainer::const_iterator aDispatcherPos = m_aFeatureDispatchers.find( rFeature ); if ( aDispatcherPos != m_aFeatureDispatchers.end() ) { // TODO: for the real and actual listener notifications, we should release @@ -748,12 +737,9 @@ void FormController::impl_setTextOnAllFilter_throw() if ( static_cast<size_t>(m_nCurrentFilterPosition) < m_aFilterRows.size() ) { FmFilterRow& rRow = m_aFilterRows[ m_nCurrentFilterPosition ]; - for ( FmFilterRow::const_iterator iter2 = rRow.begin(); - iter2 != rRow.end(); - ++iter2 - ) + for (const auto& rEntry : rRow) { - iter2->first->setText( iter2->second ); + rEntry.first->setText( rEntry.second ); } } } @@ -788,10 +774,8 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons // now add the filter rows try { - for ( FmFilterRows::const_iterator row = m_aFilterRows.begin(); row != m_aFilterRows.end(); ++row ) + for (const FmFilterRow& rRow : m_aFilterRows) { - const FmFilterRow& rRow = *row; - if ( rRow.empty() ) continue; @@ -946,26 +930,20 @@ Sequence< Sequence< OUString > > FormController::getPredicateExpressions() Sequence< Sequence< OUString > > aExpressions( m_aFilterRows.size() ); sal_Int32 termIndex = 0; - for ( FmFilterRows::const_iterator row = m_aFilterRows.begin(); - row != m_aFilterRows.end(); - ++row, ++termIndex - ) + for (const FmFilterRow& rRow : m_aFilterRows) { - const FmFilterRow& rRow( *row ); - Sequence< OUString > aConjunction( m_aFilterComponents.size() ); sal_Int32 componentIndex = 0; - for ( FilterComponents::const_iterator comp = m_aFilterComponents.begin(); - comp != m_aFilterComponents.end(); - ++comp, ++componentIndex - ) + for (const auto& rComp : m_aFilterComponents) { - FmFilterRow::const_iterator predicate = rRow.find( *comp ); + FmFilterRow::const_iterator predicate = rRow.find( rComp ); if ( predicate != rRow.end() ) aConjunction[ componentIndex ] = predicate->second; + ++componentIndex; } aExpressions[ termIndex ] = aConjunction; + ++termIndex; } return aExpressions; @@ -1117,15 +1095,11 @@ void SAL_CALL FormController::disposing(const EventObject& e) void FormController::disposeAllFeaturesAndDispatchers() { - DispatcherContainer::const_iterator aEnd = m_aFeatureDispatchers.end(); - for ( DispatcherContainer::iterator aDispatcher = m_aFeatureDispatchers.begin(); - aDispatcher != aEnd; - ++aDispatcher - ) + for (auto& rDispatcher : m_aFeatureDispatchers) { try { - ::comphelper::disposeComponent( aDispatcher->second ); + ::comphelper::disposeComponent( rDispatcher.second ); } catch( const Exception& ) { @@ -1165,11 +1139,10 @@ void FormController::disposing() implSetCurrentControl( nullptr ); // clean up our children - for (FmFormControllers::const_iterator i = m_aChildren.begin(); - i != m_aChildren.end(); ++i) + for (const auto& rpChild : m_aChildren) { // search the position of the model within the form - Reference< XFormComponent > xForm((*i)->getModel(), UNO_QUERY); + Reference< XFormComponent > xForm(rpChild->getModel(), UNO_QUERY); sal_uInt32 nPos = m_xModelAsIndex->getCount(); Reference< XFormComponent > xTemp; for( ; nPos; ) @@ -1178,13 +1151,13 @@ void FormController::disposing() m_xModelAsIndex->getByIndex( --nPos ) >>= xTemp; if ( xForm.get() == xTemp.get() ) { - Reference< XInterface > xIfc( *i, UNO_QUERY ); + Reference< XInterface > xIfc( rpChild, UNO_QUERY ); m_xModelAsManager->detach( nPos, xIfc ); break; } } - Reference< XComponent > (*i, UNO_QUERY)->dispose(); + Reference< XComponent > (rpChild, UNO_QUERY)->dispose(); } m_aChildren.clear(); @@ -3063,14 +3036,12 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) Reference< XNameAccess > xQueryColumns = Reference< XColumnsSupplier >( m_xComposer, UNO_QUERY_THROW )->getColumns(); - ::std::vector<FmFieldInfo>::const_iterator aEnd = rFieldInfos.end(); - for (::std::vector<FmFieldInfo>::iterator iter = rFieldInfos.begin(); - iter != aEnd; ++iter) + for (auto& rFieldInfo : rFieldInfos) { - if ( xQueryColumns->hasByName((*iter).aFieldName) ) + if ( xQueryColumns->hasByName(rFieldInfo.aFieldName) ) { - if ( (xQueryColumns->getByName((*iter).aFieldName) >>= (*iter).xField) && (*iter).xField.is() ) - (*iter).xField->getPropertyValue(FM_PROP_REALNAME) >>= (*iter).aFieldName; + if ( (xQueryColumns->getByName(rFieldInfo.aFieldName) >>= rFieldInfo.xField) && rFieldInfo.xField.is() ) + rFieldInfo.xField->getPropertyValue(FM_PROP_REALNAME) >>= rFieldInfo.aFieldName; } } @@ -3146,22 +3117,21 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) } // find the text component - for (::std::vector<FmFieldInfo>::const_iterator iter = rFieldInfos.begin(); - iter != aEnd; ++iter) + for (const auto& rFieldInfo : rFieldInfos) { // we found the field so insert a new entry to the filter row - if ((*iter).xField == xField) + if (rFieldInfo.xField == xField) { // do we already have the control ? - if (aRow.find((*iter).xText) != aRow.end()) + if (aRow.find(rFieldInfo.xText) != aRow.end()) { - OUString aCompText = aRow[(*iter).xText]; + OUString aCompText = aRow[rFieldInfo.xText]; aCompText += " "; OString aVal = m_pParser->getContext().getIntlKeywordAscii(IParseContext::InternationalKeyCode::And); aCompText += OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US); aCompText += " "; aCompText += ::comphelper::getString(pRefValues[j].Value); - aRow[(*iter).xText] = aCompText; + aRow[rFieldInfo.xText] = aCompText; } else { @@ -3212,7 +3182,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) ,aAppLocale ,cDecimalSeparator ,getParseContext()); - aRow[(*iter).xText] = sCriteria; + aRow[rFieldInfo.xText] = sCriteria; } } } @@ -3227,12 +3197,9 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) } // now set the filter controls - for ( ::std::vector<FmFieldInfo>::const_iterator field = rFieldInfos.begin(), aEnd = rFieldInfos.end(); - field != aEnd; - ++field - ) + for (const auto& rFieldInfo : rFieldInfos) { - m_aFilterComponents.push_back( field->xText ); + m_aFilterComponents.push_back( rFieldInfo.xText ); } } @@ -3477,10 +3444,9 @@ void FormController::setMode(const OUString& Mode) else stopFiltering(); - for (FmFormControllers::const_iterator i = m_aChildren.begin(); - i != m_aChildren.end(); ++i) + for (const auto& rChild : m_aChildren) { - Reference< XModeSelector > xMode(*i, UNO_QUERY); + Reference< XModeSelector > xMode(rChild, UNO_QUERY); if ( xMode.is() ) xMode->setMode(Mode); } @@ -4224,19 +4190,16 @@ void FormController::deleteInterceptor(const Reference< XDispatchProviderInterce { OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" ); // search the interceptor responsible for the given object - const auto aEnd = m_aControlDispatchInterceptors.end(); - for ( auto aIter = m_aControlDispatchInterceptors.begin(); - aIter != aEnd; - ++aIter - ) + auto aIter = std::find_if(m_aControlDispatchInterceptors.begin(), m_aControlDispatchInterceptors.end(), + [&_xInterception](const rtl::Reference<DispatchInterceptionMultiplexer>& rpInterceptor) { + return rpInterceptor->getIntercepted() == _xInterception; + }); + if (aIter != m_aControlDispatchInterceptors.end()) { - if ((*aIter)->getIntercepted() == _xInterception) { - // log off the interception from its interception object - (*aIter)->dispose(); - // remove the interceptor from our array - m_aControlDispatchInterceptors.erase(aIter); - return; - } + // log off the interception from its interception object + (*aIter)->dispose(); + // remove the interceptor from our array + m_aControlDispatchInterceptors.erase(aIter); } } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 29392f811489..8e982de47387 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -231,16 +231,11 @@ namespace svxform // check whether there are only hidden controls // I may add a format to pCtrlExch - bool bHasNonHidden = false; - for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it ) - { - FmEntryData* pCurrent = static_cast< FmEntryData* >( (*it)->GetUserData() ); - if ( IsHiddenControl( pCurrent ) ) - continue; - bHasNonHidden = true; - break; - } + bool bHasNonHidden = std::any_of(m_arrCurrentSelection.begin(), m_arrCurrentSelection.end(), + [](const SvTreeListEntry* pEntry) { + FmEntryData* pCurrent = static_cast< FmEntryData* >( pEntry->GetUserData() ); + return !IsHiddenControl( pCurrent ); + }); if ( bHasNonHidden && ( 0 == ( _nAction & DND_ACTION_MOVE ) ) ) // non-hidden controls need to be moved @@ -264,9 +259,8 @@ namespace svxform m_aControlExchange.prepareDrag(); m_aControlExchange->setFocusEntry( GetCurEntry() ); - for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it ) - m_aControlExchange->addSelectedEntry(*it); + for (const auto& rpEntry : m_arrCurrentSelection) + m_aControlExchange->addSelectedEntry(rpEntry); m_aControlExchange->setFormsRoot( GetNavModel()->GetFormPage()->GetForms() ); m_aControlExchange->buildPathFormat( this, m_pRootEntry ); @@ -276,10 +270,11 @@ namespace svxform // create a sequence Sequence< Reference< XInterface > > seqIFaces(m_arrCurrentSelection.size()); Reference< XInterface >* pArray = seqIFaces.getArray(); - for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it, ++pArray ) - *pArray = static_cast< FmEntryData* >( (*it)->GetUserData() )->GetElement(); - + for (const auto& rpEntry : m_arrCurrentSelection) + { + *pArray = static_cast< FmEntryData* >( rpEntry->GetUserData() )->GetElement(); + ++pArray; + } // and the new format m_aControlExchange->addHiddenControlsFormat(seqIFaces); } @@ -795,12 +790,8 @@ namespace svxform pLoop = GetParent(pLoop); } - for ( ListBoxEntrySet::const_iterator dropped = aDropped.begin(); - dropped != aDropped.end(); - ++dropped - ) + for (SvTreeListEntry* pCurrent : aDropped) { - SvTreeListEntry* pCurrent = *dropped; SvTreeListEntry* pCurrentParent = GetParent(pCurrent); // test for 0) @@ -1241,10 +1232,8 @@ namespace svxform m_bKeyboardCut = true; // mark all the entries we just "cut" into the clipboard as "nearly moved" - for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it ) + for ( SvTreeListEntry* pEntry : m_arrCurrentSelection ) { - SvTreeListEntry* pEntry = *it; if ( pEntry ) { m_aCutEntries.insert( pEntry ); @@ -1530,12 +1519,8 @@ namespace svxform { if ( doingKeyboardCut() ) { - for ( ListBoxEntrySet::const_iterator i = m_aCutEntries.begin(); - i != m_aCutEntries.end(); - ++i - ) + for (SvTreeListEntry* pEntry : m_aCutEntries) { - SvTreeListEntry* pEntry = *i; if ( !pEntry ) continue; @@ -1754,10 +1739,9 @@ namespace svxform } // remove remaining structure - for (SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it) + for (const auto& rpSelection : m_arrCurrentSelection) { - FmEntryData* pCurrent = static_cast<FmEntryData*>((*it)->GetUserData()); + FmEntryData* pCurrent = static_cast<FmEntryData*>(rpSelection->GetUserData()); // if the entry still has children, we skipped deletion of one of those children. // This may for instance be because the shape is in a hidden layer, where we're unable @@ -1943,10 +1927,8 @@ namespace svxform UnmarkAllViewObj(); - for (SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); - it != m_arrCurrentSelection.end(); ++it) + for (SvTreeListEntry* pSelectionLoop : m_arrCurrentSelection) { - SvTreeListEntry* pSelectionLoop = *it; // When form selection, mark all controls of form if (IsFormEntry(pSelectionLoop) && (pSelectionLoop != m_pRootEntry)) MarkViewObj(static_cast<FmFormData*>(pSelectionLoop->GetUserData()), false/*deep*/); diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 319944412d4b..dd19615bb66f 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -263,13 +263,11 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY ); css::uno::Reference< css::util::XURLTransformer > xTransformer( mpBrowser->GetURLTransformer() ); - CommandInfoMap::const_iterator aEnd = m_aCommandInfo.end(); - for ( CommandInfoMap::iterator it = m_aCommandInfo.begin(); - it != aEnd; ++it ) + for ( auto& rInfo : m_aCommandInfo ) { try { - CommandInfo &rCmdInfo = it->second; + CommandInfo &rCmdInfo = rInfo.second; if ( xTransformer.is() ) xTransformer->parseStrict( rCmdInfo.URL ); diff --git a/svx/source/gallery2/galini.cxx b/svx/source/gallery2/galini.cxx index 59c52719dd2d..1775aeb20142 100644 --- a/svx/source/gallery2/galini.cxx +++ b/svx/source/gallery2/galini.cxx @@ -77,14 +77,14 @@ OUString GalleryThemeEntry::ReadStrFromIni(const OUString &aKeyName ) /* FIXME-BCP47: what is this supposed to do? */ n = 0; OUString aLang = aLocale.replace('_','-'); - for( std::vector< OUString >::const_iterator i = aFallbacks.begin(); - i != aFallbacks.end(); ++i, ++n ) + for( const auto& rFallback : aFallbacks ) { - SAL_INFO( "svx", "compare '" << aLang << "' with '" << *i << "' rank " << nRank << " vs. " << n ); - if( *i == aLang && n < nRank ) { + SAL_INFO( "svx", "compare '" << aLang << "' with '" << rFallback << "' rank " << nRank << " vs. " << n ); + if( rFallback == aLang && n < nRank ) { nRank = n; // try to get the most accurate match aResult = aValue; } + ++n; } } } diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index daeaa702732c..81d7d73cd3cb 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -666,14 +666,10 @@ bool Gallery::RemoveTheme( const OUString& rThemeName ) KillFile( aStrURL ); } - auto aEnd = aThemeList.end(); - for ( auto it = aThemeList.begin(); it != aEnd; ++it ) - { - if ( pThemeEntry == it->get() ) { - aThemeList.erase( it ); - break; - } - } + auto it = std::find_if(aThemeList.begin(), aThemeList.end(), + [&pThemeEntry](const std::unique_ptr<GalleryThemeEntry>& rpEntry) { return pThemeEntry == rpEntry.get(); }); + if (it != aThemeList.end()) + aThemeList.erase( it ); Broadcast( GalleryHint( GalleryHintType::THEME_REMOVED, rThemeName ) ); @@ -689,14 +685,10 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry) if( pThemeEntry ) { - for (GalleryCacheThemeList::const_iterator it = aThemeCache.begin(); it != aThemeCache.end(); ++it) - { - if (pThemeEntry == (*it)->GetThemeEntry()) - { - pTheme = (*it)->GetTheme(); - break; - } - } + auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(), + [&pThemeEntry](const GalleryThemeCacheEntry* pEntry) { return pThemeEntry == pEntry->GetThemeEntry(); }); + if (it != aThemeCache.end()) + pTheme = (*it)->GetTheme(); if( !pTheme ) { @@ -736,15 +728,12 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry) void Gallery::ImplDeleteCachedTheme( GalleryTheme const * pTheme ) { - GalleryCacheThemeList::const_iterator aEnd = aThemeCache.end(); - for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aEnd; ++it) + auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(), + [&pTheme](const GalleryThemeCacheEntry* pEntry) { return pTheme == pEntry->GetTheme(); }); + if (it != aThemeCache.end()) { - if (pTheme == (*it)->GetTheme()) - { - delete *it; - aThemeCache.erase(it); - break; - } + delete *it; + aThemeCache.erase(it); } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 5ac71a218e39..79b00202abad 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1122,10 +1122,8 @@ bool GalleryTheme::InsertFileOrDirURL(const INetURLObject& rFileOrDirURL, sal_uI { } - ::std::vector< INetURLObject >::const_iterator aIter( aURLVector.begin() ), aEnd( aURLVector.end() ); - - while( aIter != aEnd ) - bRet = bRet || InsertURL( *aIter++, nInsertPos ); + for( const auto& rURL : aURLVector ) + bRet = bRet || InsertURL( rURL, nInsertPos ); return bRet; } diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index f9e324160d0a..304b22b11b47 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -92,9 +92,7 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL OUStringToOString( aDestDir, RTL_TEXTENCODING_UTF8 ).getStr() ); pGalTheme->SetDestDir( aDestDir, bRelativeURLs ); - std::vector<INetURLObject>::const_iterator aIter; - - for( aIter = rFiles.begin(); aIter != rFiles.end(); ++aIter ) + for( const auto& rFile : rFiles ) { // Should/could use: // if ( ! pGalTheme->InsertFileOrDirURL( aURL ) ) { @@ -102,12 +100,12 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL Graphic aGraphic; - if ( ! pGalTheme->InsertURL( *aIter ) ) + if ( ! pGalTheme->InsertURL( rFile ) ) fprintf( stderr, "Failed to import '%s'\n", - OUStringToOString( aIter->GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr() ); + OUStringToOString( rFile.GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr() ); else fprintf( stderr, "Imported file '%s' (%" SAL_PRIuUINT32 ")\n", - OUStringToOString( aIter->GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr(), + OUStringToOString( rFile.GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr(), pGalTheme->GetObjectCount() ); } diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 923a0db04f4b..cb68b9be56b7 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -162,8 +162,8 @@ SvxNumberFormatShell::~SvxNumberFormatShell() { // Added formats are invalid => remove them - for (std::vector<sal_uInt32>::const_iterator it(aAddList.begin()); it != aAddList.end(); ++it) - pFormatter->DeleteEntry(*it); + for (const auto& rItem : aAddList) + pFormatter->DeleteEntry(rItem); } } @@ -802,11 +802,10 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys(std::vector<OUString>& rLi if (nCurCategory != SvNumFormatType::ALL) { - for (SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); - it != aEnd; ++it) + for (const auto& rEntry : *pCurFmtTable) { - sal_uInt32 nKey = it->first; - const SvNumberformat* pNumEntry = it->second; + sal_uInt32 nKey = rEntry.first; + const SvNumberformat* pNumEntry = rEntry.second; if (!IsRemoved_Impl(nKey)) { @@ -893,10 +892,10 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys(std::vector<OUString>& rL rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking, true); } - for (SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it) + for (const auto& rEntry : *pCurFmtTable) { - sal_uInt32 nKey = it->first; - const SvNumberformat* pNumEntry = it->second; + sal_uInt32 nKey = rEntry.first; + const SvNumberformat* pNumEntry = rEntry.second; if (!IsRemoved_Impl(nKey)) { @@ -1032,10 +1031,9 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl(std::vector<OUString>& rList, const bool bCatDefined = (eCategory == SvNumFormatType::DEFINED); const bool bCategoryMatch = (eCategory != SvNumFormatType::ALL && !bCatDefined); - for (SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); - it != aEnd; ++it) + for (const auto& rEntry : *pCurFmtTable) { - const SvNumberformat* pNumEntry = it->second; + const SvNumberformat* pNumEntry = rEntry.second; if (bCategoryMatch && pNumEntry->GetMaskedType() != eCategory) continue; // for; type does not match category if not ALL @@ -1047,7 +1045,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl(std::vector<OUString>& rList, if (!(bUserDefined || (!bCatDefined && pNumEntry->IsAdditionalBuiltin()))) continue; // for; does not match criteria at all - const sal_uInt32 nKey = it->first; + const sal_uInt32 nKey = rEntry.first; if (!IsRemoved_Impl(nKey)) { aNewFormNInfo = pNumEntry->GetFormatstring(); |