Kaydet (Commit) b51f83a1 authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Noel Grandin

Simplify containers iterations in svx/source/[f-i]*

Use range-based loop or replace with STL functions

Change-Id: Icd11c895b7eca5ad438a8b0e29a762bb22d43b1b
Reviewed-on: https://gerrit.libreoffice.org/63531
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst f26e9dc3
......@@ -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; });
}
......
......@@ -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; });
}
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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();
}
......
......@@ -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;
......
......@@ -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 );
}
}
}
......
......@@ -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;
}
}
......
......@@ -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);
}
......
......@@ -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
);
}
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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!" );
......
......@@ -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 )
{