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 | |
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')
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 21 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/RptObject.cxx | 11 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExport.cxx | 7 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx | 12 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx | 9 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlfilter.cxx | 28 | ||||
-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 | ||||
-rw-r--r-- | reportdesign/source/ui/inspection/GeometryHandler.cxx | 8 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/RptUndo.cxx | 10 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 27 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportSection.cxx | 17 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 14 |
15 files changed, 83 insertions, 129 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 1396c93ebb2e..7ac5e6e09d20 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -434,19 +434,15 @@ void SAL_CALL OStyle::setAllPropertiesToDefault( ) void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) { - const OUString* pIter = aPropertyNames.getConstArray(); - const OUString* pEnd = pIter + aPropertyNames.getLength(); - for(;pIter != pEnd;++pIter) - setPropertyToDefault(*pIter); + for(const OUString& rName : aPropertyNames) + setPropertyToDefault(rName); } uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) { uno::Sequence< uno::Any > aRet(aPropertyNames.getLength()); - const OUString* pIter = aPropertyNames.getConstArray(); - const OUString* pEnd = pIter + aPropertyNames.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) - aRet[i] = getPropertyDefault(*pIter); + std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(), + [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); }); return aRet; } @@ -1515,8 +1511,7 @@ bool OReportDefinition::WriteThroughComponent( // prepare arguments (prepend doc handler to given arguments) uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() ); aArgs[0] <<= xSaxWriter; - for(sal_Int32 i = 0; i < rArguments.getLength(); i++) - aArgs[i+1] = rArguments[i]; + std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin())); // get filter component uno::Reference< document::XExporter > xExporter( @@ -2007,12 +2002,10 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWith if ( aServiceSpecifier.startsWith( "com.sun.star.document.ImportEmbeddedObjectResolver") ) { uno::Reference< embed::XStorage > xStorage; - const uno::Any* pIter = _aArgs.getConstArray(); - const uno::Any* pEnd = pIter + _aArgs.getLength(); - for(;pIter != pEnd ;++pIter) + for(const uno::Any& rArg : _aArgs) { beans::NamedValue aValue; - *pIter >>= aValue; + rArg >>= aValue; if ( aValue.Name == "Storage" ) aValue.Value >>= xStorage; } diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 7a77b212e25e..0c132a93be48 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -1218,14 +1218,15 @@ uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XRepor uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName("PageStyles"),uno::UNO_QUERY); uno::Reference< style::XStyle> xReturn; - uno::Sequence< OUString> aSeq = xPageStyles->getElementNames(); - const OUString* pIter = aSeq.getConstArray(); - const OUString* pEnd = pIter + aSeq.getLength(); - for(;pIter != pEnd && !xReturn.is() ;++pIter) + const uno::Sequence< OUString> aSeq = xPageStyles->getElementNames(); + for(const OUString& rName : aSeq) { - uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(*pIter),uno::UNO_QUERY); + uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(rName),uno::UNO_QUERY); if ( xStyle->isInUse() ) + { xReturn = xStyle; + break; + } } return xReturn; } diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 1a1416994f05..ce77628ea17c 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -355,14 +355,13 @@ void ORptExport::exportMasterDetailFields(const Reference<XReportComponent>& _xR OSL_ENSURE(aDetailFields.getLength() == aMasterFields.getLength(),"not equal length for master and detail fields!"); const OUString* pDetailFieldsIter = aDetailFields.getConstArray(); - const OUString* pIter = aMasterFields.getConstArray(); - const OUString* pEnd = pIter + aMasterFields.getLength(); - for(;pIter != pEnd;++pIter,++pDetailFieldsIter) + for(const OUString& rMasterField : aMasterFields) { - AddAttribute( XML_NAMESPACE_REPORT, XML_MASTER , *pIter ); + AddAttribute( XML_NAMESPACE_REPORT, XML_MASTER , rMasterField ); if ( !pDetailFieldsIter->isEmpty() ) AddAttribute( XML_NAMESPACE_REPORT, XML_DETAIL , *pDetailFieldsIter ); SvXMLElementExport aPair(*this,XML_NAMESPACE_REPORT, XML_MASTER_DETAIL_FIELD, true, true); + ++pDetailFieldsIter; } } } diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx index 00cb0508e706..2116ca0c0893 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx @@ -321,14 +321,14 @@ void SAL_CALL ExportDocumentHandler::initialize( const uno::Sequence< uno::Any > if ( xDataProvider.is() ) { m_aColumns.realloc(1); - uno::Sequence< OUString > aColumnNames = xDataProvider->getColumnDescriptions(); - for(sal_Int32 i = 0 ; i < aColumnNames.getLength();++i) + const uno::Sequence< OUString > aColumnNames = xDataProvider->getColumnDescriptions(); + for(const auto& rColumnName : aColumnNames) { - if ( !aColumnNames[i].isEmpty() ) + if ( !rColumnName.isEmpty() ) { sal_Int32 nCount = m_aColumns.getLength(); m_aColumns.realloc(nCount+1); - m_aColumns[nCount] = aColumnNames[i]; + m_aColumns[nCount] = rColumnName; } } } @@ -388,9 +388,9 @@ void ExportDocumentHandler::exportTableRows() m_xDelegatee->endElement(sCell); } } - for(sal_Int32 i = 0; i < nCount ; ++i) + for(const auto& rColumn : std::as_const(m_aColumns)) { - OUString sFormula = "field:[" + m_aColumns[i] + "]"; + OUString sFormula = "field:[" + rColumn + "]"; SvXMLAttributeList* pList = new SvXMLAttributeList(); uno::Reference< xml::sax::XAttributeList > xAttribs = pList; pList->AddAttribute(sFormulaAttrib,sFormula); diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index 43a68a40e482..d71379715fb2 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -121,13 +121,12 @@ void SAL_CALL ImportDocumentHandler::endDocument() uno::Reference< chart2::data::XDataSource > xDataSource(m_xModel, uno::UNO_QUERY); if( xDataSource.is()) { - uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences(xDataSource->getDataSequences()); - const sal_Int32 nCount( aSequences.getLength()); - for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx ) + const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences(xDataSource->getDataSequences()); + for( const auto& rSequence : aSequences ) { - if( aSequences[nIdx].is() ) + if( rSequence.is() ) { - uno::Reference< beans::XPropertySet > xSeqProp( aSequences[nIdx]->getValues(), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xSeqProp( rSequence->getValues(), uno::UNO_QUERY ); OUString aRole; if ( xSeqProp.is() && ( xSeqProp->getPropertyValue( "Role" ) >>= aRole ) diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index c7cc090755f2..00f7fe86a9c5 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -397,28 +397,24 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) uno::Reference< embed::XStorage > xStorage; uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier; - const PropertyValue* pIter = rDescriptor.getConstArray(); - const PropertyValue* pEnd = pIter + rDescriptor.getLength(); - for(;pIter != pEnd;++pIter) + for(const PropertyValue& rProp : rDescriptor) { - if ( pIter->Name == "FileName" ) - pIter->Value >>= sFileName; - else if ( pIter->Name == "Storage" ) - pIter->Value >>= xStorage; - else if ( pIter->Name == "ComponentData" ) + if ( rProp.Name == "FileName" ) + rProp.Value >>= sFileName; + else if ( rProp.Name == "Storage" ) + rProp.Value >>= xStorage; + else if ( rProp.Name == "ComponentData" ) { Sequence< PropertyValue > aComponent; - pIter->Value >>= aComponent; + rProp.Value >>= aComponent; const PropertyValue* pComponentIter = aComponent.getConstArray(); const PropertyValue* pComponentEnd = pComponentIter + aComponent.getLength(); - for(;pComponentIter != pComponentEnd;++pComponentIter) + pComponentIter = std::find_if(pComponentIter, pComponentEnd, + [](const PropertyValue& rComponent) { return rComponent.Name == "ActiveConnection"; }); + if (pComponentIter != pComponentEnd) { - if ( pComponentIter->Name == "ActiveConnection" ) - { - uno::Reference<sdbc::XConnection> xCon(pComponentIter->Value,uno::UNO_QUERY); - xNumberFormatsSupplier = ::dbtools::getNumberFormats(xCon); - break; - } + uno::Reference<sdbc::XConnection> xCon(pComponentIter->Value, uno::UNO_QUERY); + xNumberFormatsSupplier = ::dbtools::getNumberFormats(xCon); } } } 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); diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 37631941ce21..4a724dd490a5 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -1711,12 +1711,10 @@ void GeometryHandler::impl_fillMimeTypes_nothrow(::std::vector< OUString >& _out const uno::Reference< report::XReportDefinition> xReportDefinition(m_xReportComponent,uno::UNO_QUERY); if ( xReportDefinition.is() ) { - uno::Sequence< OUString > aMimeTypes( xReportDefinition->getAvailableMimeTypes() ); - const OUString* pIter = aMimeTypes.getConstArray(); - const OUString* pEnd = pIter + aMimeTypes.getLength(); - for(;pIter != pEnd; ++pIter) + const uno::Sequence< OUString > aMimeTypes( xReportDefinition->getAvailableMimeTypes() ); + for(const OUString& rMimeType : aMimeTypes) { - const OUString sDocName( impl_ConvertMimeTypeToUI_nothrow(*pIter) ); + const OUString sDocName( impl_ConvertMimeTypeToUI_nothrow(rMimeType) ); if ( !sDocName.isEmpty() ) _out_rList.push_back(sDocName); } diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx index 1f53e763207a..121f8e76d3be 100644 --- a/reportdesign/source/ui/misc/RptUndo.cxx +++ b/reportdesign/source/ui/misc/RptUndo.cxx @@ -155,13 +155,11 @@ void OSectionUndo::collectControls(const uno::Reference< report::XSection >& _xS { // copy all properties for restoring uno::Reference< beans::XPropertySetInfo> xInfo = _xSection->getPropertySetInfo(); - uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); - const beans::Property* pIter = aSeq.getConstArray(); - const beans::Property* pEnd = pIter + aSeq.getLength(); - for(;pIter != pEnd;++pIter) + const uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); + for(const beans::Property& rProp : aSeq) { - if ( 0 == (pIter->Attributes & beans::PropertyAttribute::READONLY) ) - m_aValues.emplace_back(pIter->Name,_xSection->getPropertyValue(pIter->Name)); + if ( 0 == (rProp.Attributes & beans::PropertyAttribute::READONLY) ) + m_aValues.emplace_back(rProp.Name,_xSection->getPropertyValue(rProp.Name)); } lcl_collectElements(_xSection,m_aControls); } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index fd0a6b4ca88e..1c7d05fd1f12 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3306,12 +3306,12 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) try { bool bHandleOnlyOne = false; - const PropertyValue* pIter = aArgs.getConstArray(); - const PropertyValue* pEnd = pIter + aArgs.getLength(); - for(;pIter != pEnd && !bHandleOnlyOne;++pIter) + for(const PropertyValue& rArg : aArgs) { + if (bHandleOnlyOne) + break; Sequence< PropertyValue > aValue; - if ( !(pIter->Value >>= aValue) ) + if ( !(rArg.Value >>= aValue) ) { // the sequence has only one element which already contains the descriptor bHandleOnlyOne = true; aValue = aArgs; @@ -3666,15 +3666,13 @@ void OReportController::listen(const bool _bAdd) OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv(); uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv; - uno::Sequence< beans::Property> aSeq = m_xReportDefinition->getPropertySetInfo()->getProperties(); - const beans::Property* pIter = aSeq.getConstArray(); - const beans::Property* pEnd = pIter + aSeq.getLength(); + const uno::Sequence< beans::Property> aSeq = m_xReportDefinition->getPropertySetInfo()->getProperties(); const OUString* pPropsBegin = &aProps[0]; const OUString* pPropsEnd = pPropsBegin + SAL_N_ELEMENTS(aProps) - 3; - for(;pIter != pEnd;++pIter) + for(const beans::Property& rProp : aSeq) { - if ( ::std::find(pPropsBegin,pPropsEnd,pIter->Name) == pPropsEnd ) - (m_xReportDefinition.get()->*pPropertyListenerAction)( pIter->Name, xUndo ); + if ( ::std::find(pPropsBegin,pPropsEnd,rProp.Name) == pPropsEnd ) + (m_xReportDefinition.get()->*pPropertyListenerAction)( rProp.Name, xUndo ); } // Add Listeners to UndoEnvironment @@ -4060,14 +4058,7 @@ css::uno::Sequence< OUString > SAL_CALL OReportController::getSupportedModes( ) sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode ) { uno::Sequence< OUString> aModes = getSupportedModes(); - const OUString* pIter = aModes.getConstArray(); - const OUString* pEnd = pIter + aModes.getLength(); - for(;pIter != pEnd;++pIter) - { - if ( *pIter == aMode ) - break; - } - return pIter != pEnd; + return comphelper::findValue(aModes, aMode) != -1; } bool OReportController::isUiVisible() const diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 880a68f7b59c..6c8b6af013ab 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -244,29 +244,24 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC // unmark all objects m_pView->UnmarkAll(); const OUString sSectionName = m_xSection->getName(); - const sal_Int32 nLength = _aAllreadyCopiedObjects.getLength(); - const beans::NamedValue* pIter = _aAllreadyCopiedObjects.getConstArray(); - const beans::NamedValue* pEnd = pIter + nLength; - for(;pIter != pEnd;++pIter) + for(const beans::NamedValue& rObject : _aAllreadyCopiedObjects) { - if ( _bForce || pIter->Name == sSectionName) + if ( _bForce || rObject.Name == sSectionName) { try { uno::Sequence< uno::Reference<report::XReportComponent> > aCopies; - pIter->Value >>= aCopies; - const uno::Reference<report::XReportComponent>* pCopiesIter = aCopies.getConstArray(); - const uno::Reference<report::XReportComponent>* pCopiesEnd = pCopiesIter + aCopies.getLength(); - for (;pCopiesIter != pCopiesEnd ; ++pCopiesIter) + rObject.Value >>= aCopies; + for (const uno::Reference<report::XReportComponent>& rCopy : std::as_const(aCopies)) { - SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( *pCopiesIter ); + SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( rCopy ); SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr; if ( pObject ) { // Clone to target SdrModel SdrObject* pNewObj(pObject->CloneSdrObject(*m_pModel.get())); m_pPage->InsertObject(pNewObj, SAL_MAX_SIZE); - tools::Rectangle aRet(VCLPoint((*pCopiesIter)->getPosition()),VCLSize((*pCopiesIter)->getSize())); + tools::Rectangle aRet(VCLPoint(rCopy->getPosition()),VCLSize(rCopy->getSize())); aRet.setHeight(aRet.getHeight() + 1); aRet.setWidth(aRet.getWidth() + 1); bool bOverlapping = true; diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index f81db3a9a4bf..bbff52d5e05f 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -602,11 +602,9 @@ void OViewsWindow::setMarked(const uno::Reference< report::XSection>& _xSection, void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes, bool _bMark) { bool bFirst = true; - const uno::Reference< report::XReportComponent>* pIter = _aShapes.getConstArray(); - const uno::Reference< report::XReportComponent>* pEnd = pIter + _aShapes.getLength(); - for(;pIter != pEnd;++pIter) + for(const uno::Reference< report::XReportComponent>& rShape : _aShapes) { - const uno::Reference< report::XSection> xSection = (*pIter)->getSection(); + const uno::Reference< report::XSection> xSection = rShape->getSection(); if ( xSection.is() ) { if ( bFirst ) @@ -617,7 +615,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor OSectionWindow* pSectionWindow = getSectionWindow(xSection); if ( pSectionWindow ) { - SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( *pIter ); + SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( rShape ); SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr; OSL_ENSURE( pObject, "OViewsWindow::setMarked: no SdrObject for the shape!" ); if ( pObject ) @@ -1607,12 +1605,10 @@ void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedP void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections) { - const beans::PropertyValue* pIter = _aCollpasedSections.getConstArray(); - const beans::PropertyValue* pEnd = pIter + _aCollpasedSections.getLength(); - for (; pIter != pEnd; ++pIter) + for (const beans::PropertyValue& rSection : _aCollpasedSections) { sal_uInt16 nPos = sal_uInt16(-1); - if ( (pIter->Value >>= nPos) && nPos < m_aSections.size() ) + if ( (rSection.Value >>= nPos) && nPos < m_aSections.size() ) { m_aSections[nPos]->setCollapsed(true); } |