summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18npool/source/localedata/localedata.cxx7
-rw-r--r--include/test/testinteractionhandler.hxx12
-rw-r--r--include/vbahelper/vbacollectionimpl.hxx9
-rw-r--r--linguistic/source/hhconvdic.cxx7
-rw-r--r--oox/source/core/xmlfilterbase.cxx4
-rw-r--r--oox/source/export/drawingml.cxx3
-rw-r--r--oox/source/helper/propertymap.cxx42
-rw-r--r--pyuno/source/module/pyuno_util.cxx5
-rw-r--r--sc/qa/extras/new_cond_format.cxx6
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx3
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx16
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx3
-rw-r--r--sd/qa/unit/import-tests.cxx12
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationTracer.cxx8
14 files changed, 63 insertions, 74 deletions
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index d72d28e12298..4a8e565dc8e1 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -1260,7 +1260,6 @@ LocaleDataImpl::getContinuousNumberingLevels( const lang::Locale& rLocale )
if ( func )
{
- int i;
// invoke function
sal_Int16 nStyles;
sal_Int16 nAttributes;
@@ -1268,12 +1267,12 @@ LocaleDataImpl::getContinuousNumberingLevels( const lang::Locale& rLocale )
// allocate memory for nAttributes attributes for each of the nStyles styles.
Sequence< Sequence<beans::PropertyValue> > pv( nStyles );
- for( i=0; i<pv.getLength(); i++ ) {
- pv[i] = Sequence<beans::PropertyValue>( nAttributes );
+ for( auto& i : pv ) {
+ i = Sequence<beans::PropertyValue>( nAttributes );
}
sal_Unicode const *** pStyle = p0;
- for( i=0; i<nStyles; i++ ) {
+ for( int i=0; i<nStyles; i++ ) {
sal_Unicode const ** pAttribute = pStyle[i];
for( int j=0; j<nAttributes; j++ ) { // prefix, numberingtype, ...
sal_Unicode const * pString = pAttribute[j];
diff --git a/include/test/testinteractionhandler.hxx b/include/test/testinteractionhandler.hxx
index 8d63b7ae9546..1cfdec663d33 100644
--- a/include/test/testinteractionhandler.hxx
+++ b/include/test/testinteractionhandler.hxx
@@ -82,9 +82,9 @@ public:
if (handlePasswordRequest(rContinuations, aRequest))
return true;
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ for (auto const & cont : rContinuations)
{
- css::uno::Reference<css::task::XInteractionApprove> xApprove(rContinuations[i], css::uno::UNO_QUERY);
+ css::uno::Reference<css::task::XInteractionApprove> xApprove(cont, css::uno::UNO_QUERY);
if (xApprove.is())
xApprove->select();
}
@@ -121,23 +121,23 @@ public:
}
mbPasswordRequested = true;
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ for (auto const & cont : rContinuations)
{
if (mode == css::task::PasswordRequestMode_PASSWORD_REENTER)
{ // cancel re-enter of wrong password, to avoid infinite loop
- css::uno::Reference<css::task::XInteractionAbort> const xAbort(rContinuations[i], css::uno::UNO_QUERY);
+ css::uno::Reference<css::task::XInteractionAbort> const xAbort(cont, css::uno::UNO_QUERY);
if (xAbort.is())
xAbort->select();
}
else if (bIsRequestPasswordToModify)
{
- css::uno::Reference<css::task::XInteractionPassword2> const xIPW2(rContinuations[i], css::uno::UNO_QUERY);
+ css::uno::Reference<css::task::XInteractionPassword2> const xIPW2(cont, css::uno::UNO_QUERY);
xIPW2->setPasswordToModify(msPassword);
xIPW2->select();
}
else
{
- css::uno::Reference<css::task::XInteractionPassword> const xIPW(rContinuations[i], css::uno::UNO_QUERY);
+ css::uno::Reference<css::task::XInteractionPassword> const xIPW(cont, css::uno::UNO_QUERY);
if (xIPW.is())
{
xIPW->setPassword(msPassword);
diff --git a/include/vbahelper/vbacollectionimpl.hxx b/include/vbahelper/vbacollectionimpl.hxx
index e2441457643f..9bb537e84f17 100644
--- a/include/vbahelper/vbacollectionimpl.hxx
+++ b/include/vbahelper/vbacollectionimpl.hxx
@@ -248,13 +248,12 @@ protected:
if( mbIgnoreCase )
{
- css::uno::Sequence< OUString > sElementNames = m_xNameAccess->getElementNames();
- for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
+ const css::uno::Sequence< OUString > sElementNames = m_xNameAccess->getElementNames();
+ for( const OUString& rName : sElementNames )
{
- OUString aName = sElementNames[i];
- if( aName.equalsIgnoreAsciiCase( sIndex ) )
+ if( rName.equalsIgnoreAsciiCase( sIndex ) )
{
- return createCollectionObject( m_xNameAccess->getByName( aName ) );
+ return createCollectionObject( m_xNameAccess->getByName( rName ) );
}
}
}
diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx
index a57df56f122b..1888e6186a81 100644
--- a/linguistic/source/hhconvdic.cxx
+++ b/linguistic/source/hhconvdic.cxx
@@ -65,13 +65,12 @@ static sal_Int16 checkScriptType(sal_Unicode c)
static bool TextIsAllScriptType( const OUString &rTxt, sal_Int16 nScriptType )
{
- bool bIsAll = true;
- for (sal_Int32 i = 0; i < rTxt.getLength() && bIsAll; ++i)
+ for (sal_Int32 i = 0; i < rTxt.getLength(); ++i)
{
if (checkScriptType( rTxt[i]) != nScriptType)
- bIsAll = false;
+ return false;
}
- return bIsAll;
+ return true;
}
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index e7a355e2c7dd..03d68fc232c4 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -597,9 +597,9 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const Sequence< OU
OUStringBuffer sRep;
sRep.append( aItems[ 0 ] );
- for( sal_Int32 i = 1, end = aItems.getLength(); i < end; ++i )
+ for( const OUString& rItem : aItems )
{
- sRep.append( " " ).append( aItems[ i ] );
+ sRep.append( " " ).append( rItem );
}
writeElement( pDoc, nXmlElement, sRep.makeStringAndClear() );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2d44aec64465..63fec0d6d18c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3095,9 +3095,8 @@ bool DrawingML::WriteCustomGeometry(
if ( pGeometrySeq )
{
- for( int i = 0; i < pGeometrySeq->getLength(); ++i )
+ for( const beans::PropertyValue& rProp : *pGeometrySeq )
{
- const beans::PropertyValue& rProp = (*pGeometrySeq)[ i ];
if ( rProp.Name == "Path" )
{
uno::Sequence<beans::PropertyValue> aPathProp;
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index f7016022b478..aff0e66452c4 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -378,9 +378,9 @@ static void lclDumpAnyValue( const Any& value)
Sequence< PropertyValue > aBulletPropSeq;
fprintf (stderr, "level %d\n", k);
if (xNumRule->getByIndex (k) >>= aBulletPropSeq) {
- for (int j=0; j<aBulletPropSeq.getLength(); j++) {
- fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name));
- lclDumpAnyValue (aBulletPropSeq[j].Value);
+ for (const PropertyValue& rProp : std::as_const(aBulletPropSeq)) {
+ fprintf(stderr, "%46s = ", USS (rProp.Name));
+ lclDumpAnyValue (rProp.Value);
}
}
}
@@ -444,18 +444,18 @@ static void lclDumpAnyValue( const Any& value)
void PropertyMap::dump( const Reference< XPropertySet >& rXPropSet )
{
Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
- Sequence< Property > props = info->getProperties ();
+ const Sequence< Property > props = info->getProperties ();
SAL_INFO("oox", "dump props, len: " << props.getLength ());
- for (int i=0; i < props.getLength (); i++) {
- OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
+ for (Property const & prop : props) {
+ OString name = OUStringToOString( prop.Name, RTL_TEXTENCODING_UTF8);
fprintf (stderr,"%30s = ", name.getStr() );
try {
- lclDumpAnyValue (rXPropSet->getPropertyValue( props [i].Name ));
+ lclDumpAnyValue (rXPropSet->getPropertyValue( prop.Name ));
} catch (const Exception&) {
- fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
+ fprintf (stderr,"unable to get '%s' value\n", USS(prop.Name));
}
}
}
@@ -807,9 +807,9 @@ static const char* lclDumpAnyValueCode( const Any& value, int level)
Sequence< PropertyValue > aBulletPropSeq;
fprintf (stderr, "level %d\n", k);
if (xNumRule->getByIndex (k) >>= aBulletPropSeq) {
- for (int j=0; j<aBulletPropSeq.getLength(); j++) {
- fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name));
- lclDumpAnyValue (aBulletPropSeq[j].Value);
+ for (const PropertyValue& rProp : std::as_const(aBulletPropSeq)) {
+ fprintf(stderr, "%46s = ", USS (rProp.Name));
+ lclDumpAnyValue (rProp.Value);
}
}
}
@@ -895,28 +895,28 @@ static const char* lclDumpAnyValueCode( const Any& value, int level)
void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet )
{
Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
- Sequence< Property > props = info->getProperties ();
+ const Sequence< Property > props = info->getProperties ();
const OUString sType = "Type";
- for (int i=0; i < props.getLength (); i++) {
+ for (const Property& rProp : props) {
// ignore Type, it is set elsewhere
- if (props[i].Name == sType)
+ if (rProp.Name == sType)
continue;
- OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
+ OString name = OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8);
int level = 1;
try {
printLevel (level);
fprintf (stderr, "{\n");
- const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (props [i].Name), level + 1);
+ const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (rProp.Name), level + 1);
printLevel (level + 1);
fprintf (stderr,"aPropertyMap.setProperty(PROP_%s, %s);\n", name.getStr(), var);
printLevel (level);
fprintf (stderr, "}\n");
} catch (const Exception&) {
- fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
+ fprintf (stderr,"unable to get '%s' value\n", USS(rProp.Name));
}
}
}
@@ -924,12 +924,12 @@ void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet )
void PropertyMap::dumpData(const Reference<XPropertySet>& xPropertySet)
{
Reference<XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
- Sequence<Property> aProperties = xPropertySetInfo->getProperties();
+ const Sequence<Property> aProperties = xPropertySetInfo->getProperties();
- for (int i = 0; i < aProperties.getLength(); ++i)
+ for (const Property& rProp : aProperties)
{
- std::cerr << aProperties[i].Name << std::endl;
- std::cerr << comphelper::anyToString(xPropertySet->getPropertyValue(aProperties[i].Name)) << std::endl;
+ std::cerr << rProp.Name << std::endl;
+ std::cerr << comphelper::anyToString(xPropertySet->getPropertyValue(rProp.Name)) << std::endl;
}
}
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index af22b7a8a8d5..77006c33acac 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -175,11 +175,10 @@ void logReply(
{
buf.append(
val2str( returnValue.getValue(), returnValue.getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
- for( int i = 0; i < aParams.getLength() ; i ++ )
+ for( const auto & p : aParams )
{
buf.append( ", " );
- buf.append(
- val2str( aParams[i].getValue(), aParams[i].getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
+ buf.append( val2str( p.getValue(), p.getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
}
}
log( cargo,LogLevel::CALL, buf.makeStringAndClear() );
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index 67d3d4bf6bd2..caebb4b4a3db 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -113,12 +113,12 @@ void ScConditionalFormatTest::testCondFormatListFormats()
uno::Reference<sheet::XConditionalFormats> xCondFormatList =
getConditionalFormatList(init());
- uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
+ const uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
xCondFormatList->getConditionalFormats();
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormats.getLength());
- for (sal_Int32 i = 0, n = xCondFormats.getLength(); i < n; ++i)
+ for (auto const & cf : xCondFormats)
{
- CPPUNIT_ASSERT(xCondFormats[i].is());
+ CPPUNIT_ASSERT(cf.is());
}
}
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