diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 09:13:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 12:52:36 +0200 |
commit | 09c757cbdd3f973c97151203d8ff522141102da7 (patch) | |
tree | d1424cd2d3698965f847dc161c282ce1d00f9a94 | |
parent | 22a4b7e621cbb6cab1d82d57c370e3cf33b4e74e (diff) |
use for-range on Sequence in testtools..xmloff
Change-Id: I05b02a2f8b4b9091c7de0f7e98409d5b608ed250
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94610
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | ucb/source/cacher/cachedcontentresultset.cxx | 7 | ||||
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 6 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Tools.hxx | 4 | ||||
-rw-r--r-- | vcl/osx/OSXTransferable.cxx | 4 | ||||
-rw-r--r-- | vcl/osx/a11ytextattributeswrapper.mm | 3 | ||||
-rw-r--r-- | vcl/osx/a11ywrapper.mm | 10 | ||||
-rw-r--r-- | vcl/osx/printaccessoryview.mm | 14 | ||||
-rw-r--r-- | vcl/osx/salprn.cxx | 6 | ||||
-rw-r--r-- | vcl/qt5/Qt5AccessibleWidget.cxx | 21 | ||||
-rw-r--r-- | vcl/source/window/NotebookBarAddonsMerger.cxx | 38 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TagLogger.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 6 |
13 files changed, 62 insertions, 68 deletions
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index 762d3f192bc1..9ebc51357fd2 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -558,9 +558,8 @@ sal_Int32 CCRS_PropertySetInfo bool CCRS_PropertySetInfo ::impl_queryProperty( const OUString& rName, Property& rProp ) const { - for( sal_Int32 nN = m_pProperties->getLength(); nN--; ) + for( const Property& rMyProp : std::as_const(*m_pProperties) ) { - const Property& rMyProp = (*m_pProperties)[nN]; if( rMyProp.Name == rName ) { rProp.Name = rMyProp.Name; @@ -598,9 +597,9 @@ sal_Int32 CCRS_PropertySetInfo while( bFound ) { bFound = false; - for( sal_Int32 nN = m_pProperties->getLength(); nN--; ) + for( const auto & rProp : std::as_const(*m_pProperties) ) { - if( nHandle == (*m_pProperties)[nN].Handle ) + if( nHandle == rProp.Handle ) { bFound = true; nHandle++; diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index 59b542879655..d81517f255a0 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -997,11 +997,9 @@ bool SvtSecurityOptions::isUntrustedReferer(OUString const & referer) const { bool SvtSecurityOptions::isTrustedLocationUri(OUString const & uri) const { MutexGuard g(GetInitMutex()); - for (sal_Int32 i = 0; i != m_pImpl->m_seqSecureURLs.getLength(); - ++i) + for (const auto & url : std::as_const(m_pImpl->m_seqSecureURLs)) { - if (UCBContentHelper::IsSubPath( - m_pImpl->m_seqSecureURLs[i], uri)) + if (UCBContentHelper::IsSubPath(url, uri)) { return true; } diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx index 88a85f89be55..1b58750ecbf9 100644 --- a/vcl/inc/qt5/Qt5Tools.hxx +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -91,9 +91,9 @@ Qt::DropAction getPreferredDropAction(sal_Int8 dragOperation); inline QList<int> toQList(const css::uno::Sequence<sal_Int32>& aSequence) { QList<int> aList; - for (sal_Int32 i = 0; i < aSequence.getLength(); i++) + for (sal_Int32 i : aSequence) { - aList.append(aSequence[i]); + aList.append(i); } return aList; } diff --git a/vcl/osx/OSXTransferable.cxx b/vcl/osx/OSXTransferable.cxx index 426b618c95bd..77417f3c29bb 100644 --- a/vcl/osx/OSXTransferable.cxx +++ b/vcl/osx/OSXTransferable.cxx @@ -143,8 +143,8 @@ Sequence< DataFlavor > SAL_CALL OSXTransferable::getTransferDataFlavors( ) sal_Bool SAL_CALL OSXTransferable::isDataFlavorSupported(const DataFlavor& aFlavor) { - for (sal_Int32 i = 0; i < mFlavorList.getLength(); i++) - if (compareDataFlavors(aFlavor, mFlavorList[i])) + for (const DataFlavor& rFlavor : mFlavorList) + if (compareDataFlavors(aFlavor, rFlavor)) return true; return false; diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm index 28489268f4ee..433906d7d9b3 100644 --- a/vcl/osx/a11ytextattributeswrapper.mm +++ b/vcl/osx/a11ytextattributeswrapper.mm @@ -212,8 +212,7 @@ using namespace ::com::sun::star::uno; sal_Int32 underlineColor = 0; bool underlineHasColor = false; // add attributes to string - for ( int attrIndex = 0; attrIndex < attributes.getLength(); attrIndex++ ) { - PropertyValue property = attributes [ attrIndex ]; + for ( const PropertyValue& property : attributes ) { // TODO: NSAccessibilityMisspelledTextAttribute, NSAccessibilityAttachmentTextAttribute, NSAccessibilityLinkTextAttribute // NSAccessibilityStrikethroughColorTextAttribute is unsupported by UNP-API if ( property.Value.hasValue() ) { diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm index ec09d61b479b..d3a42058dca9 100644 --- a/vcl/osx/a11ywrapper.mm +++ b/vcl/osx/a11ywrapper.mm @@ -315,8 +315,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) { Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet(); AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF ); if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) { - for ( int index = 0; index < relationMemberOf.TargetSet.getLength(); index++ ) { - Reference < XAccessible > rMateAccessible( relationMemberOf.TargetSet[index], UNO_QUERY ); + for ( const auto& i : relationMemberOf.TargetSet ) { + Reference < XAccessible > rMateAccessible( i, UNO_QUERY ); if ( rMateAccessible.is() ) { Reference< XAccessibleContext > rMateAccessibleContext( rMateAccessible -> getAccessibleContext() ); if ( rMateAccessibleContext.is() ) { @@ -1046,11 +1046,13 @@ static Reference < XAccessibleContext > hitTestRunner ( css::awt::Point point, if ( relationSet.is() && relationSet -> containsRelation ( AccessibleRelationType::SUB_WINDOW_OF )) { // we have a valid relation to the parent element AccessibleRelation relation = relationSet -> getRelationByType ( AccessibleRelationType::SUB_WINDOW_OF ); - for ( int i = 0; i < relation.TargetSet.getLength() && !hitChild.is(); i++ ) { - Reference < XAccessible > rxAccessible ( relation.TargetSet [ i ], UNO_QUERY ); + for ( const auto & i : relation.TargetSet ) { + Reference < XAccessible > rxAccessible ( i, UNO_QUERY ); if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) { // hit test for children of parent hitChild = hitTestRunner ( hitPoint, rxAccessible -> getAccessibleContext() ); + if (hitChild.is()) + break; } } } diff --git a/vcl/osx/printaccessoryview.mm b/vcl/osx/printaccessoryview.mm index c6490ee36f68..932b65dd3609 100644 --- a/vcl/osx/printaccessoryview.mm +++ b/vcl/osx/printaccessoryview.mm @@ -1006,19 +1006,18 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf // prepend a "selection" checkbox if the properties have such a selection in PrintContent bool bAddSelectionCheckBox = false, bSelectionBoxEnabled = false, bSelectionBoxChecked = false; - for( int i = 0; i < rOptions.getLength(); i++ ) + for( const PropertyValue & prop : rOptions ) { Sequence< beans::PropertyValue > aOptProp; - rOptions[i].Value >>= aOptProp; + prop.Value >>= aOptProp; OUString aCtrlType; OUString aPropertyName; Sequence< OUString > aChoices; Sequence< sal_Bool > aChoicesDisabled; sal_Int32 aSelectionChecked = 0; - for( int n = 0; n < aOptProp.getLength(); n++ ) + for( const beans::PropertyValue& rEntry : aOptProp ) { - const beans::PropertyValue& rEntry( aOptProp[ n ] ); if( rEntry.Name == "ControlType" ) { rEntry.Value >>= aCtrlType; @@ -1051,10 +1050,10 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf } } - for( int i = 0; i < rOptions.getLength(); i++ ) + for( const PropertyValue & prop : rOptions ) { Sequence< beans::PropertyValue > aOptProp; - rOptions[i].Value >>= aOptProp; + prop.Value >>= aOptProp; // extract ui element OUString aCtrlType; @@ -1067,9 +1066,8 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf long nAttachOffset = 0; bool bIgnore = false; - for( int n = 0; n < aOptProp.getLength(); n++ ) + for( const beans::PropertyValue& rEntry : aOptProp ) { - const beans::PropertyValue& rEntry( aOptProp[ n ] ); if( rEntry.Name == "Text" ) { rEntry.Value >>= aText; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 9831bd24bd06..a1e5a0908b3b 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -334,12 +334,12 @@ static Size getPageSize( vcl::PrinterController const & i_rController, sal_Int32 { Size aPageSize; uno::Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) ); - for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty ) + for( const PropertyValue & pv : aPageParms ) { - if ( aPageParms[ nProperty ].Name == "PageSize" ) + if ( pv.Name == "PageSize" ) { awt::Size aSize; - aPageParms[ nProperty].Value >>= aSize; + pv.Value >>= aSize; aPageSize.setWidth( aSize.Width ); aPageSize.setHeight( aSize.Height ); break; diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index 0ffdf102a10a..829e7e3a818d 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -848,26 +848,25 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf return QString(); } - Sequence<PropertyValue> attribs = xText->getCharacterAttributes(offset, Sequence<OUString>()); - const PropertyValue* pValues = attribs.getConstArray(); + const Sequence<PropertyValue> attribs + = xText->getCharacterAttributes(offset, Sequence<OUString>()); OUString aRet; - for (sal_Int32 i = 0; i < attribs.getLength(); i++) + for (PropertyValue const& prop : attribs) { - if (pValues[i].Name == "CharFontName") + if (prop.Name == "CharFontName") { - aRet += "font-family:" + *o3tl::doAccess<OUString>(pValues[i].Value) + ";"; + aRet += "font-family:" + *o3tl::doAccess<OUString>(prop.Value) + ";"; continue; } - if (pValues[i].Name == "CharHeight") + if (prop.Name == "CharHeight") { - aRet += "font-size:" + OUString::number(*o3tl::doAccess<double>(pValues[i].Value)) - + "pt;"; + aRet += "font-size:" + OUString::number(*o3tl::doAccess<double>(prop.Value)) + "pt;"; continue; } - if (pValues[i].Name == "CharWeight") + if (prop.Name == "CharWeight") { - aRet += "font-weight:" - + lcl_convertFontWeight(*o3tl::doAccess<double>(pValues[i].Value)) + ";"; + aRet += "font-weight:" + lcl_convertFontWeight(*o3tl::doAccess<double>(prop.Value)) + + ";"; continue; } } diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx index 689f26dbaf6d..9d6bf3dd98ea 100644 --- a/vcl/source/window/NotebookBarAddonsMerger.cxx +++ b/vcl/source/window/NotebookBarAddonsMerger.cxx @@ -43,24 +43,24 @@ static const char MERGE_NOTEBOOKBAR_STYLE[] = "Style"; static void GetAddonNotebookBarItem(const css::uno::Sequence<css::beans::PropertyValue>& pExtension, AddonNotebookBarItem& aAddonNotebookBarItem) { - for (int nIdx = 0; nIdx < pExtension.getLength(); nIdx++) + for (const auto& i : pExtension) { - if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_URL) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sCommandURL; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_TITLE) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sLabel; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_IMAGEID) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sImageIdentifier; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_CONTEXT) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sContext; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_TARGET) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sTarget; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_CONTROLTYPE) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sControlType; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_WIDTH) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.nWidth; - else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_STYLE) - pExtension[nIdx].Value >>= aAddonNotebookBarItem.sStyle; + if (i.Name == MERGE_NOTEBOOKBAR_URL) + i.Value >>= aAddonNotebookBarItem.sCommandURL; + else if (i.Name == MERGE_NOTEBOOKBAR_TITLE) + i.Value >>= aAddonNotebookBarItem.sLabel; + else if (i.Name == MERGE_NOTEBOOKBAR_IMAGEID) + i.Value >>= aAddonNotebookBarItem.sImageIdentifier; + else if (i.Name == MERGE_NOTEBOOKBAR_CONTEXT) + i.Value >>= aAddonNotebookBarItem.sContext; + else if (i.Name == MERGE_NOTEBOOKBAR_TARGET) + i.Value >>= aAddonNotebookBarItem.sTarget; + else if (i.Name == MERGE_NOTEBOOKBAR_CONTROLTYPE) + i.Value >>= aAddonNotebookBarItem.sControlType; + else if (i.Name == MERGE_NOTEBOOKBAR_WIDTH) + i.Value >>= aAddonNotebookBarItem.nWidth; + else if (i.Name == MERGE_NOTEBOOKBAR_STYLE) + i.Value >>= aAddonNotebookBarItem.sStyle; } } @@ -124,7 +124,8 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons( { aExtension = aNotebookBarAddonsItem.aAddonValues[nIdx]; - for (int nSecIdx = 0; nSecIdx < aExtension.getLength(); nSecIdx++) + for (const css::uno::Sequence<css::beans::PropertyValue>& pExtension : + std::as_const(aExtension)) { VclPtr<vcl::Window> pOptionalParent; pOptionalParent = VclPtr<OptionalBox>::Create(pParent); @@ -139,7 +140,6 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons( pFunction(pNotebookbarToolBox, pOptionalParent, rMap); AddonNotebookBarItem aAddonNotebookBarItem; - const css::uno::Sequence<css::beans::PropertyValue> pExtension = aExtension[nSecIdx]; GetAddonNotebookBarItem(pExtension, aAddonNotebookBarItem); CreateNotebookBarToolBox(pNotebookbarToolBox, m_xFrame, aAddonNotebookBarItem, diff --git a/writerfilter/source/dmapper/TagLogger.cxx b/writerfilter/source/dmapper/TagLogger.cxx index 94b65fbebece..6c655589d8cc 100644 --- a/writerfilter/source/dmapper/TagLogger.cxx +++ b/writerfilter/source/dmapper/TagLogger.cxx @@ -115,14 +115,14 @@ struct TheTagLogger: void TagLogger::unoPropertySet(const uno::Reference<beans::XPropertySet>& rPropSet) { uno::Reference<beans::XPropertySetInfo> xPropSetInfo(rPropSet->getPropertySetInfo()); - uno::Sequence<beans::Property> aProps(xPropSetInfo->getProperties()); + const uno::Sequence<beans::Property> aProps(xPropSetInfo->getProperties()); startElement( "unoPropertySet" ); - for (int i = 0; i < aProps.getLength(); ++i) + for (beans::Property const & prop : aProps) { startElement( "property" ); - OUString sName(aProps[i].Name); + OUString sName(prop.Name); attribute( "name", sName ); try diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index d32e29fcd167..7c4209a9ea8e 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -970,10 +970,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap { uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; basegfx::B2DPolygon aPoly; - for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) + for (const awt::Point& rPoint : std::as_const(rPolygon)) { - const awt::Point& rPoint = rPolygon[i]; - aPoly.insert(i, basegfx::B2DPoint(rPoint.X, rPoint.Y)); + aPoly.append(basegfx::B2DPoint(rPoint.X, rPoint.Y)); } basegfx::B2DHomMatrix aTransformation; aTransformation.scale(1.0, obRelFlipV ? -1.0 : 1.0); diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 706998f68387..b5f85d77dda4 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -136,11 +136,11 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen // count all charttype groups to be able to leave at least one sal_Int32 nRemainingGroups = 0; uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDia, uno::UNO_QUERY_THROW ); - uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > + const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nI = aCooSysSeq.getLength(); nI--; ) + for( auto const & i : aCooSysSeq ) { - uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nI], uno::UNO_QUERY_THROW ); + uno::Reference< chart2::XChartTypeContainer > xCTCnt( i, uno::UNO_QUERY_THROW ); nRemainingGroups += xCTCnt->getChartTypes().getLength(); } |