diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-08-10 19:07:30 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-08-17 14:08:33 +0200 |
commit | edcdfe5477559ca6c62897f0cad47d4d6149d77a (patch) | |
tree | bf97f0a716e760a3de4d95604483d26d943bd69f /reportdesign/source/ui/dlg | |
parent | 5ad254ed246cf8d11b55e50ed0ccba5736d0cdbb (diff) |
Simplify Sequence iterations in postprocess..sax
Use range-based loops, STL and comphelper functions
Change-Id: If738d8f4e792c4686870183b0c0fdfbb61fd3351
Reviewed-on: https://gerrit.libreoffice.org/77245
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'reportdesign/source/ui/dlg')
-rw-r--r-- | reportdesign/source/ui/dlg/AddField.cxx | 18 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/DateTime.cxx | 6 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 18 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.cxx | 6 |
4 files changed, 18 insertions, 30 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index ec3297328428..5a56839f1ef9 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -277,26 +277,22 @@ namespace { void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Sequence< OUString >& _rEntries ) { - const OUString* pEntries = _rEntries.getConstArray(); - sal_Int32 nEntries = _rEntries.getLength(); - for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) - _rListBox.InsertEntry( *pEntries,nullptr,false,TREELIST_APPEND,new ColumnInfo(*pEntries) ); + for ( const OUString& rEntry : _rEntries ) + _rListBox.InsertEntry( rEntry,nullptr,false,TREELIST_APPEND,new ColumnInfo(rEntry) ); } void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns ) { - uno::Sequence< OUString > aEntries = i_xColumns->getElementNames(); - const OUString* pEntries = aEntries.getConstArray(); - sal_Int32 nEntries = aEntries.getLength(); - for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + const uno::Sequence< OUString > aEntries = i_xColumns->getElementNames(); + for ( const OUString& rEntry : aEntries ) { - uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(rEntry),UNO_QUERY_THROW); OUString sLabel; if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; if ( !sLabel.isEmpty() ) - _rListBox.InsertEntry( sLabel,nullptr,false,TREELIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + _rListBox.InsertEntry( sLabel,nullptr,false,TREELIST_APPEND,new ColumnInfo(rEntry,sLabel) ); else - _rListBox.InsertEntry( *pEntries,nullptr,false,TREELIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + _rListBox.InsertEntry( rEntry,nullptr,false,TREELIST_APPEND,new ColumnInfo(rEntry,sLabel) ); } } } diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index 6aa4c1566073..4d2be17a59b5 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -86,11 +86,9 @@ void ODateTimeDialog::InsertEntry(sal_Int16 _nNumberFormatId) const uno::Reference< util::XNumberFormatter> xNumberFormatter = m_pController->getReportNumberFormatter(); const uno::Reference< util::XNumberFormats> xFormats = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats(); const uno::Sequence<sal_Int32> aFormatKeys = xFormats->queryKeys(_nNumberFormatId,m_nLocale,true); - const sal_Int32* pIter = aFormatKeys.getConstArray(); - const sal_Int32* pEnd = pIter + aFormatKeys.getLength(); - for (;pIter != pEnd; ++pIter) + for (const sal_Int32 nFormatKey : aFormatKeys) { - pListBox->append(OUString::number(*pIter), getFormatStringByKey(*pIter,xFormats,bTime)); + pListBox->append(OUString::number(nFormatKey), getFormatStringByKey(nFormatKey,xFormats,bTime)); } } diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 84e5c626b123..5bdc020c929c 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -58,20 +58,18 @@ using namespace ::comphelper; static void lcl_addToList_throw( ComboBoxControl& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns ) { - uno::Sequence< OUString > aEntries = i_xColumns->getElementNames(); - const OUString* pEntries = aEntries.getConstArray(); - sal_Int32 nEntries = aEntries.getLength(); - for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + const uno::Sequence< OUString > aEntries = i_xColumns->getElementNames(); + for ( const OUString& rEntry : aEntries ) { - uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(rEntry),uno::UNO_QUERY_THROW); OUString sLabel; if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) ) xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; - o_aColumnList.emplace_back(*pEntries,sLabel ); + o_aColumnList.emplace_back(rEntry,sLabel ); if ( !sLabel.isEmpty() ) _rListBox.InsertEntry( sLabel ); else - _rListBox.InsertEntry( *pEntries ); + _rListBox.InsertEntry( rEntry ); } } @@ -317,11 +315,9 @@ void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), sUndoAction ); uno::Reference< report::XGroups> xGroups = m_pParent->getGroups(); - const uno::Any* pIter = _aGroups.getConstArray(); - const uno::Any* pEnd = pIter + _aGroups.getLength(); - for(;pIter != pEnd;++pIter) + for(const uno::Any& rGroup : _aGroups) { - uno::Reference< report::XGroup> xGroup(*pIter,uno::UNO_QUERY); + uno::Reference< report::XGroup> xGroup(rGroup,uno::UNO_QUERY); if ( xGroup.is() ) { uno::Sequence< beans::PropertyValue > aArgs(1); diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 6dd851e5bd0c..80d018d88220 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -502,11 +502,9 @@ void NavigatorTree::_selectionChanged( const lang::EventObject& aEvent ) } else { - const uno::Reference< report::XReportComponent >* pIter = aSelection.getConstArray(); - const uno::Reference< report::XReportComponent >* pEnd = pIter + aSelection.getLength(); - for (; pIter != pEnd; ++pIter) + for (const uno::Reference<report::XReportComponent>& rElem : std::as_const(aSelection)) { - SvTreeListEntry* pEntry = find(*pIter); + SvTreeListEntry* pEntry = find(rElem); if ( pEntry && !IsSelected(pEntry) ) { Select(pEntry); |