diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 09:05:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 12:29:46 +0200 |
commit | 639511d7194726b188a2ecae9b3489a250532d03 (patch) | |
tree | af8195623e940c171934b9bbbe16acbc38e0d378 /sd | |
parent | cf46500243c51071227e08c5067041e414180ebc (diff) |
use for-range on Sequence in i18npool..sd
Change-Id: I19eba57bc6058c317473d0746f06699a09ba2830
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94608
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 3 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 16 | ||||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 3 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/ConfigurationTracer.cxx | 8 |
5 files changed, 18 insertions, 24 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 9ed04b1a4c53..5de8eaf770c6 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -644,9 +644,8 @@ void SdOOXMLExportTest1::testBulletCharAndFont() uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level OUString sBulletChar(u'\xf06c'); - for (int i = 0; i < aProps.getLength(); ++i) + for (beans::PropertyValue const & rProp : std::as_const(aProps)) { - const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "BulletChar") CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletChar incorrect.", sBulletChar ,rProp.Value.get<OUString>()); if (rProp.Name == "BulletFont") diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 378189e15fa3..69ee1650d780 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -805,16 +805,14 @@ void SdOOXMLExportTest2::testTdf92527() uno::Sequence<beans::PropertyValue> aProps; xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps; uno::Sequence<beans::PropertyValue> aPathProps; - for (int i = 0; i < aProps.getLength(); ++i) + for (beans::PropertyValue const & rProp : std::as_const(aProps)) { - const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "Path") aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >(); } uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates; - for (int i = 0; i < aPathProps.getLength(); ++i) + for (beans::PropertyValue const & rProp : std::as_const(aPathProps)) { - const beans::PropertyValue& rProp = aPathProps[i]; if (rProp.Name == "Coordinates") aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >(); } @@ -1874,9 +1872,9 @@ void SdOOXMLExportTest2::testTdf115005() // check that the document contains original vector images const uno::Sequence<OUString> names = xNameAccess->getElementNames(); int nSVMFiles = 0; - for (int i=0; i<names.getLength(); i++) + for (OUString const & s : names) { - if(names[i].endsWith(".svm")) + if(s.endsWith(".svm")) nSVMFiles++; } CPPUNIT_ASSERT_EQUAL(3, nSVMFiles); @@ -1906,11 +1904,11 @@ int SdOOXMLExportTest2::testTdf115005_FallBack_Images(bool bAddReplacementImages const uno::Sequence<OUString> names = xNameAccess->getElementNames(); int nSVMFiles = 0; int nPNGFiles = 0; - for (int i=0; i<names.getLength(); i++) + for (OUString const & n :names) { - if(names[i].endsWith(".svm")) + if(n.endsWith(".svm")) nSVMFiles++; - if(names[i].endsWith(".png")) + if(n.endsWith(".png")) nPNGFiles++; } diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index a94e5ccb5103..e3b71703293f 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1308,9 +1308,8 @@ void SdImportTestSmartArt::testMissingBulletAndIndent() uno::Sequence<beans::PropertyValue> aBulletProps; xNumRule->getByIndex(1) >>= aBulletProps; - for (int i = 0; i < aBulletProps.getLength(); ++i) + for (beans::PropertyValue const & rProp : std::as_const(aBulletProps)) { - const beans::PropertyValue& rProp = aBulletProps[i]; if(rProp.Name == "LeftMargin") CPPUNIT_ASSERT_EQUAL(sal_Int32(309), rProp.Value.get<sal_Int32>()); } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 591ec734c77c..6d8ff3e3904d 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -2078,9 +2078,8 @@ void SdImportTest::testTdf104445() uno::Sequence<beans::PropertyValue> aBulletProps; xNumRule->getByIndex(0) >>= aBulletProps; - for (int i = 0; i < aBulletProps.getLength(); ++i) + for (beans::PropertyValue const & rProp : std::as_const(aBulletProps)) { - const beans::PropertyValue& rProp = aBulletProps[i]; if(rProp.Name == "NumberingType") CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::NUMBER_NONE), rProp.Value.get<sal_Int16>()); if(rProp.Name == "LeftMargin") @@ -2099,9 +2098,8 @@ void SdImportTest::testTdf104445() uno::Sequence<beans::PropertyValue> aBulletProps; xNumRule->getByIndex(0) >>= aBulletProps; - for(int i = 0; i < aBulletProps.getLength(); ++i) + for(beans::PropertyValue const & rProp : std::as_const(aBulletProps)) { - const beans::PropertyValue& rProp = aBulletProps[i]; if(rProp.Name == "NumberingType") CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::CHAR_SPECIAL), rProp.Value.get<sal_Int16>()); if(rProp.Name == "LeftMargin") @@ -2965,13 +2963,13 @@ void SdImportTest::testOOXTheme() xPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; bool bTheme = false; - for (int i = 0; i < aGrabBag.getLength(); i++) + for (beans::PropertyValue const & prop : std::as_const(aGrabBag)) { - if (aGrabBag[i].Name == "OOXTheme") + if (prop.Name == "OOXTheme") { bTheme = true; uno::Reference<xml::dom::XDocument> aThemeDom; - CPPUNIT_ASSERT(aGrabBag[i].Value >>= aThemeDom); // PropertyValue of proper type + CPPUNIT_ASSERT(prop.Value >>= aThemeDom); // PropertyValue of proper type CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty } } diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx index 4fb4a82165cb..11533fde3e2a 100644 --- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx @@ -54,16 +54,16 @@ void ConfigurationTracer::TraceBoundResources ( const Reference<XResourceId>& rxResourceId, const int nIndentation) { - Sequence<Reference<XResourceId> > aResourceList ( + const Sequence<Reference<XResourceId> > aResourceList ( rxConfiguration->getResources(rxResourceId, OUString(), AnchorBindingMode_DIRECT)); const OUString sIndentation (" "); - for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex) + for (Reference<XResourceId> const & resourceId : aResourceList) { - OUString sLine (aResourceList[nIndex]->getResourceURL()); + OUString sLine (resourceId->getResourceURL()); for (int i=0; i<nIndentation; ++i) sLine = sIndentation + sLine; SAL_INFO("sd.ui", "" << sLine); - TraceBoundResources(rxConfiguration, aResourceList[nIndex], nIndentation+1); + TraceBoundResources(rxConfiguration, resourceId, nIndentation+1); } } #endif |