summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-20 08:43:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-20 12:11:11 +0200
commit1553d3787cbe0cdababf31382bf3376a3640d8cf (patch)
treeb829cc1f97dac33abdf1e592a636d6fb24497f13 /desktop
parentc2ead5a142be19cb74127294641ec35da9e0f5c5 (diff)
use for-range on Sequence in d*
and fix bug in GenericClipboard::initialize, where it was looping through the arguments, but always reading the first one. I'm guessing it was never an issue because it is always called with only one argument Change-Id: I8f72b6bce8c77a69c7d75115e34630e2c308261e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94553 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/check_ext_deps.cxx4
-rw-r--r--desktop/source/app/dispatchwatcher.cxx14
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx3
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx5
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx28
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx5
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx19
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_platform.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_update.cxx14
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx18
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx7
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx4
-rw-r--r--desktop/source/lib/init.cxx22
-rw-r--r--desktop/source/lib/lokinteractionhandler.cxx14
-rw-r--r--desktop/source/migration/migration.cxx83
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx14
-rw-r--r--desktop/test/deployment/active/active_native.cxx2
-rw-r--r--desktop/test/deployment/passive/passive_native.cxx2
22 files changed, 126 insertions, 150 deletions
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index 2d7c2e1b277b..cb32e3b0387a 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -261,10 +261,8 @@ static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext
sal_Int32 const nMax = 2;
#endif
- for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
+ for ( uno::Sequence< uno::Reference< deployment::XPackage > > const & xPackageList : std::as_const(xAllPackages) )
{
- uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i];
-
for ( sal_Int32 j = 0; (j<nMax) && (j < xPackageList.getLength()); ++j )
{
uno::Reference< deployment::XPackage > xPackage = xPackageList[j];
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 5bf047d591cf..450fd0e1e207 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -188,21 +188,21 @@ void scriptCat(const Reference< XModel >& xDoc )
return;
}
- Sequence< OUString > aLibNames = xLibraries->getElementNames();
+ const Sequence< OUString > aLibNames = xLibraries->getElementNames();
std::cout << "Libraries: " << aLibNames.getLength() << "\n";
- for ( sal_Int32 i = 0 ; i < aLibNames.getLength() ; ++i )
+ for (OUString const & libName : aLibNames)
{
- std::cout << "Library: '" << aLibNames[i] << "' children: ";
+ std::cout << "Library: '" << libName << "' children: ";
Reference< XNameContainer > xContainer;
try {
- if (!xLibraries->isLibraryLoaded( aLibNames[i] ))
- xLibraries->loadLibrary( aLibNames[i] );
+ if (!xLibraries->isLibraryLoaded( libName ))
+ xLibraries->loadLibrary( libName );
xContainer = Reference< XNameContainer >(
- xLibraries->getByName( aLibNames[i] ), UNO_QUERY );
+ xLibraries->getByName( libName ), UNO_QUERY );
}
catch (const css::uno::Exception &e)
{
- std::cout << "[" << aLibNames[i] << "] - failed to load library: " << e.Message << "\n";
+ std::cout << "[" << libName << "] - failed to load library: " << e.Message << "\n";
continue;
}
if( !xContainer.is() )
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index a345a87d22a9..d018edad0109 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -639,9 +639,8 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
m_pManager->getExtensionManager()->getSupportedPackageTypes() );
- for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
+ for ( uno::Reference< deployment::XPackageTypeInfo > const & xPackageType : packageTypes )
{
- uno::Reference< deployment::XPackageTypeInfo > const & xPackageType = packageTypes[ pos ];
const OUString filter( xPackageType->getFileFilter() );
if (!filter.isEmpty())
{
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index b6231ab9c73c..00ed69d515de 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -366,10 +366,9 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
std::vector< OUString > deps;
deps.reserve(depExc.UnsatisfiedDependencies.getLength());
- for (sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i)
+ for (auto const & i : std::as_const(depExc.UnsatisfiedDependencies))
{
- deps.push_back(
- dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]) );
+ deps.push_back( dp_misc::Dependencies::getErrorText(i) );
}
{
SolarMutexGuard guard;
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index e42b6e41c172..89aaed148346 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -145,10 +145,10 @@ void Entry_Impl::checkDependencies()
if ( e.Cause >>= depExc )
{
OUStringBuffer aMissingDep( DpResId( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
- for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ for ( const auto& i : std::as_const(depExc.UnsatisfiedDependencies) )
{
aMissingDep.append("\n");
- aMissingDep.append(dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]));
+ aMissingDep.append(dp_misc::Dependencies::getErrorText(i));
}
aMissingDep.append("\n");
m_sErrorText = aMissingDep.makeStringAndClear();
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 66600848abd2..1f3d8d710b03 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -220,9 +220,9 @@ void TheExtensionManager::checkUpdates()
e.Context, anyEx );
}
- for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
+ for ( auto const & i : std::as_const(xAllPackages) )
{
- uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(xAllPackages[i]);
+ uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(i);
OSL_ASSERT(xPackage.is());
if ( xPackage.is() )
{
@@ -303,13 +303,10 @@ void TheExtensionManager::createPackageList()
e.Context, anyEx );
}
- for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
+ for ( uno::Sequence< uno::Reference< deployment::XPackage > > const & xPackageList : std::as_const(xAllPackages) )
{
- uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i];
-
- for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j )
+ for ( uno::Reference< deployment::XPackage > const & xPackage : xPackageList )
{
- uno::Reference< deployment::XPackage > xPackage = xPackageList[j];
if ( xPackage.is() )
{
PackageState eState = getPackageState( xPackage );
@@ -322,11 +319,10 @@ void TheExtensionManager::createPackageList()
}
}
- uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER,
+ const uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER,
uno::Reference< ucb::XCommandEnvironment >() );
- for ( sal_Int32 i = 0; i < xNoLicPackages.getLength(); ++i )
+ for ( uno::Reference< deployment::XPackage > const & xPackage : xNoLicPackages )
{
- uno::Reference< deployment::XPackage > xPackage = xNoLicPackages[i];
if ( xPackage.is() )
{
getDialogHelper()->addPackageToList( xPackage, true );
@@ -387,11 +383,11 @@ bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPa
OSL_ASSERT( aId.IsPresent );
//iterate over all available nodes
- uno::Sequence< OUString > seqNames = m_xNameAccessNodes->getElementNames();
+ const uno::Sequence< OUString > seqNames = m_xNameAccessNodes->getElementNames();
- for ( int i = 0; i < seqNames.getLength(); i++ )
+ for ( OUString const & nodeName : seqNames )
{
- uno::Any anyNode = m_xNameAccessNodes->getByName( seqNames[i] );
+ uno::Any anyNode = m_xNameAccessNodes->getByName( nodeName );
//If we have a node then it must contain the set of leaves. This is part of OptionsDialog.xcs
uno::Reference< XInterface> xIntNode = anyNode.get< uno::Reference< XInterface > >();
uno::Reference< container::XNameAccess > xNode( xIntNode, uno::UNO_QUERY_THROW );
@@ -401,10 +397,10 @@ bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPa
uno::Reference< container::XNameAccess > xLeaves( xIntLeaves, uno::UNO_QUERY_THROW );
//iterate over all available leaves
- uno::Sequence< OUString > seqLeafNames = xLeaves->getElementNames();
- for ( int j = 0; j < seqLeafNames.getLength(); j++ )
+ const uno::Sequence< OUString > seqLeafNames = xLeaves->getElementNames();
+ for ( OUString const & leafName : seqLeafNames )
{
- uno::Any anyLeaf = xLeaves->getByName( seqLeafNames[j] );
+ uno::Any anyLeaf = xLeaves->getByName( leafName );
uno::Reference< XInterface > xIntLeaf = anyLeaf.get< uno::Reference< XInterface > >();
uno::Reference< beans::XPropertySet > xLeaf( xIntLeaf, uno::UNO_QUERY_THROW );
//investigate the Id property if it matches the extension identifier which
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 4c5269499f19..60a0337119d5 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -775,11 +775,10 @@ void UpdateDialog::getIgnoredUpdates()
args[0] <<= aValue;
uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", args), uno::UNO_QUERY_THROW );
- uno::Sequence< OUString > aElementNames = xNameAccess->getElementNames();
+ const uno::Sequence< OUString > aElementNames = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
+ for ( OUString const & aIdentifier : aElementNames )
{
- OUString aIdentifier = aElementNames[i];
OUString aVersion;
uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) );
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index b8c23c60dfdb..39bdbf65cced 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -239,9 +239,8 @@ void ExtensionManager::addExtensionsToMap(
++index;
}
- for (int i = 0; i < seqExt.getLength(); ++i)
+ for (const Reference<css::deployment::XPackage>& xExtension : seqExt)
{
- Reference<css::deployment::XPackage> const & xExtension = seqExt[i];
OUString id = dp_misc::getIdentifier(xExtension);
id2extensions::iterator ivec = mapExt.find(id);
if (ivec == mapExt.end())
@@ -1142,17 +1141,17 @@ void ExtensionManager::reinstallDeployedExtensions(
{
const uno::Sequence< Reference<css::deployment::XPackage> > extensions(
xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
- for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos )
+ for ( const Reference<css::deployment::XPackage>& package : extensions )
{
try
{
beans::Optional< beans::Ambiguous< sal_Bool > > registered(
- extensions[pos]->isRegistered(xAbortChannel, xCmdEnv));
+ package->isRegistered(xAbortChannel, xCmdEnv));
if (registered.IsPresent &&
!(registered.Value.IsAmbiguous ||
registered.Value.Value))
{
- const OUString id = dp_misc::getIdentifier(extensions[ pos ]);
+ const OUString id = dp_misc::getIdentifier(package);
OSL_ASSERT(!id.isEmpty());
disabledExts.insert(id);
}
@@ -1172,12 +1171,12 @@ void ExtensionManager::reinstallDeployedExtensions(
const uno::Sequence< Reference<css::deployment::XPackage> > extensions(
xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
- for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos )
+ for ( const Reference<css::deployment::XPackage>& package : extensions )
{
try
{
- const OUString id = dp_misc::getIdentifier(extensions[ pos ]);
- const OUString fileName = extensions[ pos ]->getName();
+ const OUString id = dp_misc::getIdentifier(package);
+ const OUString fileName = package->getName();
OSL_ASSERT(!id.isEmpty());
activateExtension(
id, fileName, disabledExts.find(id) != disabledExts.end(),
@@ -1237,10 +1236,8 @@ sal_Bool ExtensionManager::synchronize(
{
const uno::Sequence<uno::Sequence<Reference<css::deployment::XPackage> > >
seqSeqExt = getAllExtensions(xAbortChannel, xCmdEnv);
- for (sal_Int32 i = 0; i < seqSeqExt.getLength(); i++)
+ for (uno::Sequence<Reference<css::deployment::XPackage> > const & seqExt : seqSeqExt)
{
- uno::Sequence<Reference<css::deployment::XPackage> > const & seqExt =
- seqSeqExt[i];
activateExtension(seqExt, isUserDisabled(seqExt), true,
xAbortChannel, xCmdEnv);
}
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 46535e0ee0e1..ab5ccc7eb5c7 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -72,9 +72,8 @@ ExtensionProperties::ExtensionProperties(
{
m_propFileUrl = urlExtension + "properties";
- for (sal_Int32 i = 0; i < properties.getLength(); i++)
+ for (css::beans::NamedValue const & v : properties)
{
- css::beans::NamedValue const & v = properties[i];
if (v.Name == PROP_SUPPRESS_LICENSE)
{
m_prop_suppress_license = getPropertyValue(v);
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 0621cc51e099..513294535ce8 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -535,9 +535,9 @@ void disposeBridges(Reference<css::uno::XComponentContext> const & ctx)
Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(ctx) );
const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
- for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
+ for (const Reference<css::bridge::XBridge>& bridge : seqBridges)
{
- Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
+ Reference<css::lang::XComponent> comp(bridge, UNO_QUERY);
if (comp.is())
{
try {
diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx
index 50ca73a362f4..9e4fd320b39f 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -189,9 +189,9 @@ bool platform_fits( OUString const & platform_string )
bool hasValidPlatform( css::uno::Sequence<OUString> const & platformStrings)
{
bool ret = false;
- for (sal_Int32 i = 0; i < platformStrings.getLength(); i++)
+ for (const OUString& s : platformStrings)
{
- if ( isPlatformSupported( platformStrings[i] ))
+ if ( isPlatformSupported( s ) )
{
ret = true;
break;
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 09ce86610cb8..71e7d18a1c9c 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -119,10 +119,9 @@ bool create_folder(
RTL_TEXTENCODING_UTF8 ) );
const Sequence<ContentInfo> infos(
parentContent.queryCreatableContentsInfo() );
- for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos )
+ for ( ContentInfo const & info : infos )
{
// look KIND_FOLDER:
- ContentInfo const & info = infos[ pos ];
if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0)
{
// make sure the only required bootstrap property is "Title":
diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx
index 0d6f4acdee45..7116be42bf44 100644
--- a/desktop/source/deployment/misc/dp_update.cxx
+++ b/desktop/source/deployment/misc/dp_update.cxx
@@ -100,16 +100,16 @@ void getOwnUpdateInfos(
uno::Any anyError;
//It is unclear from the idl if there can be a null reference returned.
//However all valid information should be the same
- Sequence<Reference< xml::dom::XElement > >
+ const Sequence<Reference< xml::dom::XElement > >
infos(getUpdateInformation(updateInformation, urls, search_id, anyError));
if (anyError.hasValue())
out_errors.emplace_back(inout.second.extension, anyError);
- for (sal_Int32 j = 0; j < infos.getLength(); ++j)
+ for (const Reference< xml::dom::XElement >& element : infos)
{
dp_misc::DescriptionInfoset infoset(
xContext,
- Reference< xml::dom::XNode >(infos[j], UNO_QUERY_THROW));
+ Reference< xml::dom::XNode >(element, UNO_QUERY_THROW));
if (!infoset.hasDescription())
continue;
std::optional< OUString > result_id(infoset.getIdentifier());
@@ -120,7 +120,7 @@ void getOwnUpdateInfos(
if (*result_id != search_id)
continue;
inout.second.version = infoset.getVersion();
- inout.second.info.set(infos[j], UNO_QUERY_THROW);
+ inout.second.info.set(element, UNO_QUERY_THROW);
break;
}
}
@@ -142,16 +142,16 @@ void getDefaultUpdateInfos(
OSL_ASSERT(!sDefaultURL.isEmpty());
Any anyError;
- Sequence< Reference< xml::dom::XElement > >
+ const Sequence< Reference< xml::dom::XElement > >
infos(
getUpdateInformation(
updateInformation,
Sequence< OUString >(&sDefaultURL, 1), OUString(), anyError));
if (anyError.hasValue())
out_errors.emplace_back(Reference<deployment::XPackage>(), anyError);
- for (sal_Int32 i = 0; i < infos.getLength(); ++i)
+ for (const Reference< xml::dom::XElement >& element : infos)
{
- Reference< xml::dom::XNode > node(infos[i], UNO_QUERY_THROW);
+ Reference< xml::dom::XNode > node(element, UNO_QUERY_THROW);
dp_misc::DescriptionInfoset infoset(xContext, node);
std::optional< OUString > id(infoset.getIdentifier());
if (!id) {
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index cdc840762068..8cb39ce476bd 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1105,30 +1105,30 @@ void extractComponentData(
if (!registryName.endsWith("/")) {
prefix += RTL_CONSTASCII_LENGTH("/");
}
- css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ const css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
keys(registry->openKeys());
css::uno::Reference< css::lang::XMultiComponentFactory > smgr(
context->getServiceManager(), css::uno::UNO_SET_THROW);
- for (sal_Int32 i = 0; i < keys.getLength(); ++i) {
- OUString name(keys[i]->getKeyName().copy(prefix));
+ for (css::uno::Reference< css::registry::XRegistryKey > const & key : keys) {
+ OUString name(key->getKeyName().copy(prefix));
data->implementationNames.push_back(name);
css::uno::Reference< css::registry::XRegistryKey > singletons(
- keys[i]->openKey("UNO/SINGLETONS"));
+ key->openKey("UNO/SINGLETONS"));
if (singletons.is()) {
- sal_Int32 prefix2 = keys[i]->getKeyName().getLength() +
+ sal_Int32 prefix2 = key->getKeyName().getLength() +
RTL_CONSTASCII_LENGTH("/UNO/SINGLETONS/");
- css::uno::Sequence<
+ const css::uno::Sequence<
css::uno::Reference< css::registry::XRegistryKey > >
singletonKeys(singletons->openKeys());
- for (sal_Int32 j = 0; j < singletonKeys.getLength(); ++j) {
+ for (css::uno::Reference< css::registry::XRegistryKey > const & singletonKey : singletonKeys) {
data->singletons.emplace_back(
- singletonKeys[j]->getKeyName().copy(prefix2), name);
+ singletonKey->getKeyName().copy(prefix2), name);
}
}
if (factories != nullptr) {
factories->push_back(
componentLoader->activate(
- name, OUString(), componentUrl, keys[i]));
+ name, OUString(), componentUrl, key));
}
}
}
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index e6339def509a..42bbc65cdb4c 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -556,13 +556,12 @@ void Package::fireModified()
if (container == nullptr)
return;
- Sequence< Reference<XInterface> > elements(
+ const Sequence< Reference<XInterface> > elements(
container->getElements() );
lang::EventObject evt( static_cast<OWeakObject *>(this) );
- for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
+ for ( const Reference<XInterface>& x : elements )
{
- Reference<util::XModifyListener> xListener(
- elements[ pos ], UNO_QUERY );
+ Reference<util::XModifyListener> xListener( x, UNO_QUERY );
if (xListener.is())
xListener->modified( evt );
}
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index 7a63de3250f0..50d0c0c4d68e 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -184,10 +184,8 @@ void PackageRegistryImpl::insertBackend(
const Sequence< Reference<deployment::XPackageTypeInfo> > packageTypes(
xBackend->getSupportedPackageTypes() );
- for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
+ for ( Reference<deployment::XPackageTypeInfo> const & xPackageType : packageTypes )
{
- Reference<deployment::XPackageTypeInfo> const & xPackageType =
- packageTypes[ pos ];
m_typesInfos.push_back( xPackageType );
const OUString mediaType( normalizeMediaType(
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 373deb3c7c53..451f3149d67f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4347,9 +4347,9 @@ static char* getLanguages(const char* pCommand)
boost::property_tree::ptree aValues;
boost::property_tree::ptree aChild;
OUString sLanguage;
- for ( sal_Int32 itLocale = 0; itLocale < aLocales.getLength(); itLocale++ )
+ for ( css::lang::Locale const & locale : std::as_const(aLocales) )
{
- const LanguageTag aLanguageTag( aLocales[itLocale]);
+ const LanguageTag aLanguageTag( locale );
sLanguage = SvtLanguageTable::GetLanguageString(aLanguageTag.getLanguageType());
if (sLanguage.startsWith("{") && sLanguage.endsWith("}"))
continue;
@@ -4467,8 +4467,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
boost::property_tree::ptree aTree;
aTree.put("commandName", pCommand);
uno::Reference<css::style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
- uno::Sequence<OUString> aStyleFamilies = xStyleFamilies->getElementNames();
+ const uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+ const uno::Sequence<OUString> aStyleFamilies = xStyleFamilies->getElementNames();
static const std::vector<OUString> aWriterStyles =
{
@@ -4487,10 +4487,9 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
std::set<OUString> aDefaultStyleNames;
boost::property_tree::ptree aValues;
- for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam)
+ for (OUString const & sStyleFam : aStyleFamilies)
{
boost::property_tree::ptree aChildren;
- OUString sStyleFam = aStyleFamilies[nStyleFam];
uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY);
// Writer provides a huge number of styles, we have a list of 7 "default" styles which
@@ -4527,7 +4526,6 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
// Header & Footer Styles
{
- OUString sName;
boost::property_tree::ptree aChild;
boost::property_tree::ptree aChildren;
const OUString sPageStyles("PageStyles");
@@ -4536,16 +4534,16 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
if (xStyleFamilies->hasByName(sPageStyles) && (xStyleFamilies->getByName(sPageStyles) >>= xContainer))
{
- uno::Sequence<OUString> aSeqNames = xContainer->getElementNames();
- for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); itName++)
+ const uno::Sequence<OUString> aSeqNames = xContainer->getElementNames();
+ for (OUString const & sName : aSeqNames)
{
bool bIsPhysical;
- sName = aSeqNames[itName];
xProperty.set(xContainer->getByName(sName), uno::UNO_QUERY);
if (xProperty.is() && (xProperty->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical)
{
- xProperty->getPropertyValue("DisplayName") >>= sName;
- aChild.put("", sName.toUtf8());
+ OUString displayName;
+ xProperty->getPropertyValue("DisplayName") >>= displayName;
+ aChild.put("", displayName.toUtf8());
aChildren.push_back(std::make_pair("", aChild));
}
}
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
index 3dfd602b261a..0933e4c230a7 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -127,9 +127,9 @@ namespace {
/// Just approve the interaction.
void selectApproved(uno::Sequence<uno::Reference<task::XInteractionContinuation>> const &rContinuations)
{
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ for (auto const & c : rContinuations)
{
- uno::Reference<task::XInteractionApprove> xApprove(rContinuations[i], uno::UNO_QUERY);
+ uno::Reference<task::XInteractionApprove> xApprove(c, uno::UNO_QUERY);
if (xApprove.is())
xApprove->select();
}
@@ -289,19 +289,19 @@ bool LOKInteractionHandler::handlePasswordRequest(const uno::Sequence<uno::Refer
m_havePassword.reset();
}
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ for (auto const & cont : rContinuations)
{
if (m_usePassword)
{
if (bIsRequestPasswordToModify)
{
- uno::Reference<task::XInteractionPassword2> const xIPW2(rContinuations[i], uno::UNO_QUERY);
+ uno::Reference<task::XInteractionPassword2> const xIPW2(cont, uno::UNO_QUERY);
xIPW2->setPasswordToModify(m_Password);
xIPW2->select();
}
else
{
- uno::Reference<task::XInteractionPassword> const xIPW(rContinuations[i], uno::UNO_QUERY);
+ uno::Reference<task::XInteractionPassword> const xIPW(cont, uno::UNO_QUERY);
if (xIPW.is())
{
xIPW->setPassword(m_Password);
@@ -313,13 +313,13 @@ bool LOKInteractionHandler::handlePasswordRequest(const uno::Sequence<uno::Refer
{
if (bIsRequestPasswordToModify)
{
- uno::Reference<task::XInteractionPassword2> const xIPW2(rContinuations[i], uno::UNO_QUERY);
+ uno::Reference<task::XInteractionPassword2> const xIPW2(cont, uno::UNO_QUERY);
xIPW2->setRecommendReadOnly(true);
xIPW2->select();
}
else
{
- uno::Reference<task::XInteractionAbort> const xAbort(rContinuations[i], uno::UNO_QUERY);
+ uno::Reference<task::XInteractionAbort> const xAbort(cont, uno::UNO_QUERY);
if (xAbort.is())
{
xAbort->select();
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 4987adf3feb0..25964de3cb79 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -306,23 +306,23 @@ void MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigr
{
// get supported version names
uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_SET_THROW);
- uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames();
+ const uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames();
const OUString aVersionIdentifiers( "VersionIdentifiers" );
const OUString aPriorityIdentifier( "Priority" );
- for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) {
+ for (OUString const & supportedVersion :seqSupportedVersions) {
sal_Int32 nPriority( 0 );
uno::Sequence< OUString > seqVersions;
- uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW );
+ uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(supportedVersion), uno::UNO_QUERY_THROW );
xMigrationData->getByName( aVersionIdentifiers ) >>= seqVersions;
xMigrationData->getByName( aPriorityIdentifier ) >>= nPriority;
supported_migration aSupportedMigration;
- aSupportedMigration.name = seqSupportedVersions[i];
+ aSupportedMigration.name = supportedVersion;
aSupportedMigration.nPriority = nPriority;
- for (sal_Int32 j=0; j<seqVersions.getLength(); j++)
- aSupportedMigration.supported_versions.push_back(seqVersions[j].trim());
+ for (OUString const & s : std::as_const(seqVersions))
+ aSupportedMigration.supported_versions.push_back(s.trim());
insertSorted( rAvailableMigrations, aSupportedMigration );
SAL_INFO( "desktop.migration", " available migration '" << aSupportedMigration.name << "'" );
}
@@ -837,14 +837,9 @@ std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules(
uno::Reference< embed::XStorage > xToolbar = xModule->openStorageElement(TOOLBAR, embed::ElementModes::READ);
if (xToolbar.is()) {
- const OUString RESOURCEURL_CUSTOM_ELEMENT("custom_");
- sal_Int32 nCustomLen = 7;
-
- ::uno::Sequence< OUString > lToolbars = xToolbar->getElementNames();
- for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) {
- OUString sToolbarName = lToolbars[j];
- if (sToolbarName.getLength()>=nCustomLen &&
- sToolbarName.copy(0, nCustomLen) == RESOURCEURL_CUSTOM_ELEMENT)
+ const ::uno::Sequence< OUString > lToolbars = xToolbar->getElementNames();
+ for (OUString const & sToolbarName : lToolbars) {
+ if (sToolbarName.startsWith("custom_"))
continue;
aModuleInfo.sModuleShortName = sModuleShortName;
@@ -875,18 +870,18 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent,
std::vector< MigrationItem > vOldItems;
std::vector< MigrationItem > vNewItems;
- uno::Sequence< beans::PropertyValue > aProp;
+ uno::Sequence< beans::PropertyValue > aProps;
sal_Int32 nOldCount = xIndexOld->getCount();
sal_Int32 nNewCount = xIndexNew->getCount();
for (int n=0; n<nOldCount; ++n) {
MigrationItem aMigrationItem;
- if (xIndexOld->getByIndex(n) >>= aProp) {
- for(int i=0; i<aProp.getLength(); ++i) {
- if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
- aProp[i].Value >>= aMigrationItem.m_sCommandURL;
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
- aProp[i].Value >>= aMigrationItem.m_xPopupMenu;
+ if (xIndexOld->getByIndex(n) >>= aProps) {
+ for(beans::PropertyValue const & prop : std::as_const(aProps)) {
+ if ( prop.Name == ITEM_DESCRIPTOR_COMMANDURL )
+ prop.Value >>= aMigrationItem.m_sCommandURL;
+ else if ( prop.Name == ITEM_DESCRIPTOR_CONTAINER )
+ prop.Value >>= aMigrationItem.m_xPopupMenu;
}
if (!aMigrationItem.m_sCommandURL.isEmpty())
@@ -896,12 +891,12 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent,
for (int n=0; n<nNewCount; ++n) {
MigrationItem aMigrationItem;
- if (xIndexNew->getByIndex(n) >>= aProp) {
- for(int i=0; i<aProp.getLength(); ++i) {
- if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
- aProp[i].Value >>= aMigrationItem.m_sCommandURL;
- else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
- aProp[i].Value >>= aMigrationItem.m_xPopupMenu;
+ if (xIndexNew->getByIndex(n) >>= aProps) {
+ for(beans::PropertyValue const & prop : std::as_const(aProps)) {
+ if ( prop.Name == ITEM_DESCRIPTOR_COMMANDURL )
+ prop.Value >>= aMigrationItem.m_sCommandURL;
+ else if ( prop.Name == ITEM_DESCRIPTOR_CONTAINER )
+ prop.Value >>= aMigrationItem.m_xPopupMenu;
}
if (!aMigrationItem.m_sCommandURL.isEmpty())
@@ -964,14 +959,14 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat
uno::Sequence< beans::PropertyValue > aPropSeq;
xTemp->getByIndex(i) >>= aPropSeq;
- for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) {
- OUString sPropName = aPropSeq[j].Name;
+ for (beans::PropertyValue const & prop : std::as_const(aPropSeq)) {
+ OUString sPropName = prop.Name;
if ( sPropName == ITEM_DESCRIPTOR_COMMANDURL )
- aPropSeq[j].Value >>= sCommandURL;
+ prop.Value >>= sCommandURL;
else if ( sPropName == ITEM_DESCRIPTOR_LABEL )
- aPropSeq[j].Value >>= sLabel;
+ prop.Value >>= sLabel;
else if ( sPropName == ITEM_DESCRIPTOR_CONTAINER )
- aPropSeq[j].Value >>= xChild;
+ prop.Value >>= xChild;
}
if (sCommandURL == sToken) {
@@ -999,9 +994,9 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat
OUString sCmd;
uno::Sequence< beans::PropertyValue > aTempPropSeq;
xTemp->getByIndex(i) >>= aTempPropSeq;
- for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) {
- if ( aTempPropSeq[j].Name == ITEM_DESCRIPTOR_COMMANDURL ) {
- aTempPropSeq[j].Value >>= sCmd;
+ for (beans::PropertyValue const & prop : std::as_const(aTempPropSeq)) {
+ if ( prop.Name == ITEM_DESCRIPTOR_COMMANDURL ) {
+ prop.Value >>= sCmd;
break;
}
}
@@ -1041,9 +1036,9 @@ uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSett
{
uno::Reference< container::XIndexContainer > xNewMenuSettings;
- for (sal_Int32 i=0; i<m_lNewVersionMenubarSettingsSeq.getLength(); ++i) {
- if (m_lNewVersionMenubarSettingsSeq[i].Name == sModuleShortName) {
- m_lNewVersionMenubarSettingsSeq[i].Value >>= xNewMenuSettings;
+ for (auto const & prop : m_lNewVersionMenubarSettingsSeq) {
+ if (prop.Name == sModuleShortName) {
+ prop.Value >>= xNewMenuSettings;
break;
}
}
@@ -1055,13 +1050,13 @@ uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewToolbarSett
{
uno::Reference< container::XIndexContainer > xNewToolbarSettings;
- for (sal_Int32 i=0; i<m_lNewVersionToolbarSettingsSeq.getLength(); ++i) {
- if (m_lNewVersionToolbarSettingsSeq[i].Name == sModuleShortName) {
+ for (auto const & newProp : m_lNewVersionToolbarSettingsSeq) {
+ if (newProp.Name == sModuleShortName) {
uno::Sequence< beans::PropertyValue > lToolbarSettingsSeq;
- m_lNewVersionToolbarSettingsSeq[i].Value >>= lToolbarSettingsSeq;
- for (sal_Int32 j=0; j<lToolbarSettingsSeq.getLength(); ++j) {
- if (lToolbarSettingsSeq[j].Name == sToolbarName) {
- lToolbarSettingsSeq[j].Value >>= xNewToolbarSettings;
+ newProp.Value >>= lToolbarSettingsSeq;
+ for (auto const & prop : std::as_const(lToolbarSettingsSeq)) {
+ if (prop.Name == sToolbarName) {
+ prop.Value >>= xNewToolbarSettings;
break;
}
}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 8532366885c0..6c9f8ce00bae 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -164,15 +164,15 @@ Reference<deployment::XPackage> findPackage(
Reference<ucb::XCommandEnvironment > const & environment,
OUString const & idOrFileName )
{
- Sequence< Reference<deployment::XPackage> > ps(
+ const Sequence< Reference<deployment::XPackage> > ps(
manager->getDeployedExtensions(repository,
Reference<task::XAbortChannel>(), environment ) );
- for ( sal_Int32 i = 0; i < ps.getLength(); ++i )
- if ( dp_misc::getIdentifier( ps[i] ) == idOrFileName )
- return ps[i];
- for ( sal_Int32 i = 0; i < ps.getLength(); ++i )
- if ( ps[i]->getName() == idOrFileName )
- return ps[i];
+ for ( auto const & package : ps )
+ if ( dp_misc::getIdentifier( package ) == idOrFileName )
+ return package;
+ for ( auto const & package : ps )
+ if ( package->getName() == idOrFileName )
+ return package;
return Reference<deployment::XPackage>();
}
diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx
index 0f12544b6a6b..b024b5e4ff40 100644
--- a/desktop/test/deployment/active/active_native.cxx
+++ b/desktop/test/deployment/active/active_native.cxx
@@ -136,7 +136,7 @@ Provider::queryDispatches(
{
css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s(
Requests.getLength());
- for (sal_Int32 i = 0; i < s.getLength(); ++i) {
+ for (sal_Int32 i = 0; i < s.(); ++i) {
s[i] = queryDispatch(
Requests[i].FeatureURL, Requests[i].FrameName,
Requests[i].SearchFlags);
diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx
index 83b955a00313..7b95fff8b537 100644
--- a/desktop/test/deployment/passive/passive_native.cxx
+++ b/desktop/test/deployment/passive/passive_native.cxx
@@ -133,7 +133,7 @@ Provider::queryDispatches(
{
css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s(
Requests.getLength());
- for (sal_Int32 i = 0; i < s.getLength(); ++i) {
+ for (sal_Int32 i = 0; i < s.(); ++i) {
s[i] = queryDispatch(
Requests[i].FeatureURL, Requests[i].FrameName,
Requests[i].SearchFlags);