summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-29 01:31:19 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-29 23:15:24 +0200
commit20070d12c85ae6db8d5b1374a49f92b34137c8b1 (patch)
tree44e449ee8309cba63c6b1458af66f0b9aad3259b /basctl
parent2bad2224090eb2802111760ec83db230aeca0616 (diff)
Drop uses of css::uno::Sequence::getConstArray in accessibility .. basegfx
where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I14e3634d8e8dd294b673dcda4dde13f01c3e5112 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166813 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/IDEComboBox.cxx16
-rw-r--r--basctl/source/basicide/basides1.cxx3
-rw-r--r--basctl/source/basicide/basidesh.cxx22
-rw-r--r--basctl/source/basicide/basobj3.cxx8
-rw-r--r--basctl/source/basicide/bastype2.cxx51
-rw-r--r--basctl/source/basicide/localizationmgr.cxx121
-rw-r--r--basctl/source/basicide/moduldl2.cxx26
-rw-r--r--basctl/source/dlged/dlged.cxx59
-rw-r--r--basctl/source/dlged/dlgedobj.cxx36
-rw-r--r--basctl/source/dlged/managelang.cxx18
10 files changed, 100 insertions, 260 deletions
diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx
index d25e143d62fa..a4ad6c8ada95 100644
--- a/basctl/source/basicide/IDEComboBox.cxx
+++ b/basctl/source/basicide/IDEComboBox.cxx
@@ -250,13 +250,8 @@ void LibBox::FillBox()
void LibBox::InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLocation)
{
// get a sorted list of library names
- Sequence<OUString> aLibNames = rDocument.getLibraryNames();
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
-
- for (sal_Int32 i = 0; i < nLibCount; ++i)
+ for (auto& aLibName : rDocument.getLibraryNames())
{
- OUString aLibName = pLibNames[i];
if (eLocation == rDocument.getLibraryLocation(aLibName))
{
OUString aName(rDocument.getTitle(eLocation));
@@ -428,19 +423,18 @@ void LanguageBox::FillBox()
Locale aDefaultLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
Locale aCurrentLocale = pCurMgr->getStringResourceManager()->getCurrentLocale();
Sequence<Locale> aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
- const Locale* pLocale = aLocaleSeq.getConstArray();
sal_Int32 i, nCount = aLocaleSeq.getLength();
for (i = 0; i < nCount; ++i)
{
- bool bIsDefault = localesAreEqual(aDefaultLocale, pLocale[i]);
- bool bIsCurrent = localesAreEqual(aCurrentLocale, pLocale[i]);
- LanguageType eLangType = LanguageTag::convertToLanguageType(pLocale[i]);
+ bool bIsDefault = localesAreEqual(aDefaultLocale, aLocaleSeq[i]);
+ bool bIsCurrent = localesAreEqual(aCurrentLocale, aLocaleSeq[i]);
+ LanguageType eLangType = LanguageTag::convertToLanguageType(aLocaleSeq[i]);
OUString sLanguage = SvtLanguageTable::GetLanguageString(eLangType);
if (bIsDefault)
{
sLanguage += " " + msDefaultLanguageStr;
}
- LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
+ LanguageEntry* pEntry = new LanguageEntry(aLocaleSeq[i], bIsDefault);
OUString sId(weld::toId(pEntry));
m_xWidget->append(sId, sLanguage);
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 6fe3b9a562f6..b5ac6852986f 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -1207,7 +1207,6 @@ void Shell::GetState(SfxItemSet &rSet)
if ( pCurMgr->isLibraryLocalized() )
{
Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
- const lang::Locale* pLocale = aLocaleSeq.getConstArray();
sal_Int32 i, nCount = aLocaleSeq.getLength();
// Force different results for any combination of locales and default locale
@@ -1216,7 +1215,7 @@ void Shell::GetState(SfxItemSet &rSet)
{
lang::Locale aLocale;
if( i < nCount )
- aLocale = pLocale[i];
+ aLocale = aLocaleSeq[i];
else
aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index c478d80fdf81..bdf68e11a7dc 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -678,14 +678,8 @@ void Shell::UpdateWindows()
StartListening(*doc.getBasicManager(), DuplicateHandling::Prevent /* log on only once */);
// libraries
- Sequence< OUString > aLibNames( doc.getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
+ for (auto& aLibName : doc.getLibraryNames())
{
- OUString aLibName = pLibNames[ i ];
-
if ( m_aCurLibName.isEmpty() || ( doc == m_aCurDocument && aLibName == m_aCurLibName ) )
{
// check, if library is password protected and not verified
@@ -716,13 +710,10 @@ void Shell::UpdateWindows()
try
{
Sequence< OUString > aModNames( doc.getObjectNames( E_SCRIPTS, aLibName ) );
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
- nTotalTabs += nModCount;
+ nTotalTabs += aModNames.getLength();
- for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
+ for (auto& aModName : aModNames)
{
- OUString aModName = pModNames[ j ];
VclPtr<ModulWindow> pWin = FindBasWin( doc, aLibName, aModName );
if ( !pWin )
pWin = CreateBasWin( doc, aLibName, aModName );
@@ -746,13 +737,10 @@ void Shell::UpdateWindows()
try
{
Sequence< OUString > aDlgNames = doc.getObjectNames( E_DIALOGS, aLibName );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const OUString* pDlgNames = aDlgNames.getConstArray();
- nTotalTabs += nDlgCount;
+ nTotalTabs += aDlgNames.getLength();
- for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
+ for (auto& aDlgName : aDlgNames)
{
- OUString aDlgName = pDlgNames[ j ];
// this find only looks for non-suspended windows;
// suspended windows are handled in CreateDlgWin
VclPtr<DialogWindow> pWin = FindDlgWin( doc, aLibName, aDlgName );
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 5d5bacf0e88d..1e51cbbb2ed8 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -231,13 +231,9 @@ BasicManager* FindBasicManager( StarBASIC const * pLib )
if ( !pBasicMgr )
continue;
- Sequence< OUString > aLibNames( doc.getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
+ for (auto& rLibName : doc.getLibraryNames())
{
- StarBASIC* pL = pBasicMgr->GetLib( pLibNames[ i ] );
+ StarBASIC* pL = pBasicMgr->GetLib(rLibName);
if ( pL == pLib )
return pBasicMgr;
}
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 18ca75e01bfe..352742be8a4e 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -208,14 +208,8 @@ void SbTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation
void SbTreeListBox::ImpCreateLibEntries(const weld::TreeIter& rIter, const ScriptDocument& rDocument, LibraryLocation eLocation)
{
// get a sorted list of library names
- Sequence< OUString > aLibNames( rDocument.getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
+ for (auto& aLibName : rDocument.getLibraryNames())
{
- OUString aLibName = pLibNames[ i ];
-
if ( eLocation == rDocument.getLibraryLocation( aLibName ) )
{
// check, if the module library is loaded
@@ -284,15 +278,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry,
else
{
// get a sorted list of module names
- Sequence< OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
-
auto xTreeIter = m_xControl->make_iterator();
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ for (auto& aModName : rDocument.getObjectNames(E_SCRIPTS, rLibName))
{
- OUString aModName = pModNames[ i ];
m_xControl->copy_iterator(rLibRootEntry, *xTreeIter);
bool bModuleEntry = FindEntry(aModName, OBJ_TYPE_MODULE, *xTreeIter);
if (!bModuleEntry)
@@ -303,15 +292,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry,
// methods
if ( nMode & BrowseMode::Subs )
{
- Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName );
- sal_Int32 nCount = aNames.getLength();
- const OUString* pNames = aNames.getConstArray();
-
auto xSubTreeIter = m_xControl->make_iterator();
- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ for (auto& aName : GetMethodNames(rDocument, rLibName, aModName))
{
- OUString aName = pNames[ j ];
m_xControl->copy_iterator(*xTreeIter, *xSubTreeIter);
bool bEntry = FindEntry(aName, OBJ_TYPE_METHOD, *xSubTreeIter);
if (!bEntry)
@@ -342,15 +326,10 @@ void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry,
try
{
// get a sorted list of dialog names
- Sequence< OUString > aDlgNames( rDocument.getObjectNames( E_DIALOGS, rLibName ) );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const OUString* pDlgNames = aDlgNames.getConstArray();
-
auto xTreeIter = m_xControl->make_iterator();
- for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
+ for (auto& aDlgName : rDocument.getObjectNames(E_DIALOGS, rLibName))
{
- OUString aDlgName = pDlgNames[ i ];
m_xControl->copy_iterator(rLibRootEntry, *xTreeIter);
bool bDialogEntry = FindEntry(aDlgName, OBJ_TYPE_DIALOG, *xTreeIter);
if (!bDialogEntry)
@@ -401,16 +380,11 @@ void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLi
try
{
// get a sorted list of module names
- Sequence< OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
-
EntryDescriptor aDesc(GetEntryDescriptor(&rLibSubRootEntry));
EntryType eCurrentType(aDesc.GetType());
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ for (auto& aModName : rDocument.getObjectNames(E_SCRIPTS, rLibName))
{
- OUString aModName = pModNames[ i ];
EntryType eType = OBJ_TYPE_UNKNOWN;
switch( ModuleInfoHelper::getModuleType( xLib, aModName ) )
{
@@ -454,13 +428,8 @@ void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLi
// methods
if ( nMode & BrowseMode::Subs )
{
- Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName );
- sal_Int32 nCount = aNames.getLength();
- const OUString* pNames = aNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ for (auto& aName : GetMethodNames(rDocument, rLibName, aModName))
{
- OUString aName = pNames[ j ];
std::unique_ptr<weld::TreeIter> xEntry(m_xControl->make_iterator(xModuleEntry.get()));
bool bEntry = FindEntry(aName, OBJ_TYPE_METHOD, *xEntry);
if (!bEntry)
@@ -697,13 +666,11 @@ OUString SbTreeListBox::GetRootEntryBitmaps(const ScriptDocument& rDocument)
OUString sModule( xModuleManager->identify( rDocument.getDocument() ) );
Sequence< beans::PropertyValue > aModuleDescr;
xModuleManager->getByName( sModule ) >>= aModuleDescr;
- sal_Int32 nCount = aModuleDescr.getLength();
- const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ for (auto& rModuleDescr : aModuleDescr)
{
- if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" )
+ if (rModuleDescr.Name == "ooSetupFactoryEmptyDocumentURL")
{
- pModuleDescr[ i ].Value >>= sFactoryURL;
+ rModuleDescr.Value >>= sFactoryURL;
break;
}
}
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index 4d311741b4bb..e978e1ca130f 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -135,14 +135,9 @@ static bool isLanguageDependentProperty( std::u16string_view aName )
void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode )
{
- Sequence< OUString > aDlgNames = m_aDocument.getObjectNames( E_DIALOGS, m_aLibName );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const OUString* pDlgNames = aDlgNames.getConstArray();
-
Reference< XStringResourceResolver > xDummyStringResolver;
- for( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
+ for (auto& aDlgName : m_aDocument.getObjectNames(E_DIALOGS, m_aLibName))
{
- OUString aDlgName = pDlgNames[ i ];
if (VclPtr<DialogWindow> pWin = m_pShell->FindDlgWin(m_aDocument, m_aLibName, aDlgName))
{
Reference< container::XNameContainer > xDialog = pWin->GetDialog();
@@ -155,12 +150,8 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou
std::u16string_view(), m_xStringResourceManager, xDummyStringResolver, eMode );
// Handle all controls
- Sequence< OUString > aNames = xDialog->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 j = 0 ; j < nCtrls ; ++j )
+ for (auto& aCtrlName : xDialog->getElementNames())
{
- OUString aCtrlName( pNames[j] );
Any aCtrl = xDialog->getByName( aCtrlName );
implHandleControlResourceProperties( aCtrl, aDlgName,
aCtrlName, m_xStringResourceManager, xDummyStringResolver, eMode );
@@ -204,22 +195,16 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
if( xPropertySet.is() && xStringResourceManager.is())
{
Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
- if( nLocaleCount == 0 )
+ if (!aLocaleSeq.hasElements())
return 0;
Reference< XPropertySetInfo > xPropertySetInfo = xPropertySet->getPropertySetInfo();
if( xPropertySetInfo.is() )
{
// get sequence of control properties
- Sequence< Property > aPropSeq = xPropertySetInfo->getProperties();
- const Property* pProps = aPropSeq.getConstArray();
- sal_Int32 nCtrlProps = aPropSeq.getLength();
-
// create a map of tab indices and control names, sorted by tab index
- for( sal_Int32 j = 0 ; j < nCtrlProps ; ++j )
+ for (auto& rProp : xPropertySetInfo->getProperties())
{
- const Property& rProp = pProps[j];
OUString aPropName = rProp.Name;
TypeClass eType = rProp.Type.getTypeClass();
bool bLanguageDependentProperty =
@@ -245,10 +230,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
( aDialogName, aCtrlName, aPropName, xStringResourceManager );
// Set Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale );
}
@@ -281,10 +264,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
{
OUString aPureIdStr = aPropStr.copy( 1 );
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
try
{
xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
@@ -304,10 +285,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
( aDialogName, aCtrlName, aPropName, xStringResourceManager );
// Set new Id and remove old one for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
try
{
OUString aResStr = xStringResourceManager->resolveStringForLocale
@@ -335,10 +314,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
// Set Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
OUString aResStr;
try
{
@@ -366,10 +343,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
// Copy Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
OUString aResStr;
try
{
@@ -394,7 +369,6 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
Sequence< OUString > aPropStrings;
aPropAny >>= aPropStrings;
- const OUString* pPropStrings = aPropStrings.getConstArray();
sal_Int32 nPropStringCount = aPropStrings.getLength();
if( nPropStringCount == 0 )
continue;
@@ -402,8 +376,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
// Replace string by id, add id+string to StringResource
if( eMode == SET_IDS )
{
- Sequence< OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
+ Sequence< OUString > aIdStrings(nPropStringCount);
OUString* pIdStrings = aIdStrings.getArray();
OUString aIdStrBase = aDot
@@ -411,11 +384,10 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
+ aDot
+ aPropName;
- const Locale* pLocales = aLocaleSeq.getConstArray();
sal_Int32 i;
for ( i = 0; i < nPropStringCount; ++i )
{
- OUString aPropStr = pPropStrings[i];
+ OUString aPropStr = aPropStrings[i];
bool bEscAlreadyExisting = aPropStr.startsWith("&");
if( bEscAlreadyExisting )
{
@@ -428,9 +400,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
+ aIdStrBase;
// Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ iLocale ];
xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale );
}
@@ -441,14 +412,12 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
// Replace id by string from StringResource
else if( eMode == RESET_IDS )
{
- Sequence< OUString > aNewPropStrings;
- aNewPropStrings.realloc( nPropStringCount );
+ Sequence<OUString> aNewPropStrings(nPropStringCount);
OUString* pNewPropStrings = aNewPropStrings.getArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
+ for (sal_Int32 i = 0; i < nPropStringCount; ++i)
{
- OUString aIdStr = pPropStrings[i];
+ OUString aIdStr = aPropStrings[i];
OUString aNewPropStr = aIdStr;
if( aIdStr.getLength() > 1 )
{
@@ -468,18 +437,14 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
// Remove Id for all locales
else if( eMode == REMOVE_IDS_FROM_RESOURCE )
{
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
+ for (auto& aIdStr : aPropStrings)
{
- OUString aIdStr = pPropStrings[i];
if( aIdStr.getLength() > 1 )
{
OUString aPureIdStr = aIdStr.copy( 1 );
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[iLocale];
try
{
xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
@@ -494,8 +459,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
// Rename resource id
else if( eMode == RENAME_CONTROL_IDS )
{
- Sequence< OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
+ Sequence<OUString> aIdStrings(nPropStringCount);
OUString* pIdStrings = aIdStrings.getArray();
OUString aIdStrBase = aDot
@@ -503,11 +467,9 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
+ aDot
+ aPropName;
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
+ for (sal_Int32 i = 0; i < nPropStringCount; ++i)
{
- OUString aSourceIdStr = pPropStrings[i];
+ OUString aSourceIdStr = aPropStrings[i];
OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
@@ -515,10 +477,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
+ aIdStrBase;
// Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ iLocale ];
-
try
{
OUString aResStr = xStringResourceManager->resolveStringForLocale
@@ -537,8 +497,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
// Replace string by string from source StringResourceResolver
else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() )
{
- Sequence< OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
+ Sequence<OUString> aIdStrings(nPropStringCount);
OUString* pIdStrings = aIdStrings.getArray();
OUString aIdStrBase = aDot
@@ -548,11 +507,9 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
+ for (sal_Int32 i = 0; i < nPropStringCount; ++i)
{
- OUString aSourceIdStr = pPropStrings[i];
+ OUString aSourceIdStr = aPropStrings[i];
OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
@@ -560,10 +517,8 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
+ aIdStrBase;
// Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ iLocale ];
-
OUString aResStr;
try
{
@@ -587,18 +542,13 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
{
const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
+ for (auto& aSourceIdStr : aPropStrings)
{
- OUString aSourceIdStr = pPropStrings[i];
OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
// Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ iLocale ];
-
OUString aResStr;
try
{
@@ -625,22 +575,18 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties
void LocalizationMgr::handleAddLocales( const Sequence< Locale >& aLocaleSeq )
{
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
-
if( isLibraryLocalized() )
{
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
m_xStringResourceManager->newLocale( rLocale );
}
}
else
{
- DBG_ASSERT( nLocaleCount==1, "LocalizationMgr::handleAddLocales(): Only one first locale allowed" );
+ DBG_ASSERT( aLocaleSeq.getLength()==1, "LocalizationMgr::handleAddLocales(): Only one first locale allowed" );
- const Locale& rLocale = pLocales[ 0 ];
+ const Locale& rLocale = aLocaleSeq[0];
m_xStringResourceManager->newLocale( rLocale );
enableResourceForAllLibraryDialogs();
}
@@ -657,21 +603,18 @@ void LocalizationMgr::handleAddLocales( const Sequence< Locale >& aLocaleSeq )
void LocalizationMgr::handleRemoveLocales( const Sequence< Locale >& aLocaleSeq )
{
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
bool bConsistent = true;
bool bModified = false;
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
+ for (auto& rLocale : aLocaleSeq)
{
- const Locale& rLocale = pLocales[ i ];
bool bRemove = true;
// Check if last locale
Sequence< Locale > aResLocaleSeq = m_xStringResourceManager->getLocales();
if( aResLocaleSeq.getLength() == 1 )
{
- const Locale& rLastResLocale = aResLocaleSeq.getConstArray()[ 0 ];
+ const Locale& rLastResLocale = aResLocaleSeq[0];
if( localesAreEqual( rLocale, rLastResLocale ) )
{
disableResourceForAllLibraryDialogs();
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index cfb9adf03553..49b8927f11c5 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -640,8 +640,7 @@ void LibPage::InsertLib()
std::shared_ptr<LibDialog> xLibDlg;
Sequence< OUString > aLibNames = GetMergedLibraryNames( xModLibContImport, xDlgLibContImport );
- sal_Int32 nLibCount = aLibNames.getLength();
- if (nLibCount)
+ if (aLibNames.hasElements())
{
// library import dialog
xLibDlg = std::make_shared<LibDialog>(m_pDialog->getDialog());
@@ -650,11 +649,9 @@ void LibPage::InsertLib()
rView.make_unsorted();
rView.freeze();
- const OUString* pLibNames = aLibNames.getConstArray();
- for (sal_Int32 i = 0 ; i < nLibCount; ++i)
+ for (auto& aLibName : aLibNames)
{
// libbox entries
- OUString aLibName( pLibNames[ i ] );
if ( !( ( xModLibContImport.is() && xModLibContImport->hasByName( aLibName ) && xModLibContImport->isLibraryLink( aLibName ) ) ||
( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aLibName ) && xDlgLibContImport->isLibraryLink( aLibName ) ) ) )
{
@@ -828,12 +825,8 @@ void LibPage::InsertLib()
xModLibContImport->loadLibrary( aLibName );
// copy all modules
- Sequence< OUString > aModNames = xModLibImport->getElementNames();
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ for (auto& aModName : xModLibImport->getElementNames())
{
- OUString aModName( pModNames[ i ] );
Any aElement_ = xModLibImport->getByName( aModName );
xModLib->insertByName( aModName, aElement_ );
}
@@ -896,12 +889,8 @@ void LibPage::InsertLib()
xDlgLibContImport->loadLibrary( aLibName );
// copy all dialogs
- Sequence< OUString > aDlgNames = xDlgLibImport->getElementNames();
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const OUString* pDlgNames = aDlgNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
+ for (auto& aDlgName : xDlgLibImport->getElementNames())
{
- OUString aDlgName( pDlgNames[ i ] );
Any aElement_ = xDlgLibImport->getByName( aDlgName );
xDlgLib->insertByName( aDlgName, aElement_ );
}
@@ -1227,14 +1216,9 @@ void LibPage::SetCurLib()
m_xLibBox->clear();
// get a sorted list of library names
- Sequence< OUString > aLibNames = aDocument.getLibraryNames();
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
-
int nEntry = 0;
- for (int i = 0 ; i < nLibCount; ++i)
+ for (auto& aLibName : aDocument.getLibraryNames())
{
- OUString aLibName(pLibNames[i]);
if (eLocation == aDocument.getLibraryLocation(aLibName))
ImpInsertLibEntry(aLibName, nEntry++);
}
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 26d15e908761..40a7b5c75850 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -353,17 +353,10 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
if ( m_xUnoControlDialogModel.is() )
{
// get sequence of control names
- Sequence< OUString > aNames = m_xUnoControlDialogModel->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
-
// create a map of tab indices and control names, sorted by tab index
IndexToNameMap aIndexToNameMap;
- for ( sal_Int32 i = 0; i < nCtrls; ++i )
+ for (auto& aName : m_xUnoControlDialogModel->getElementNames())
{
- // get name
- OUString aName( pNames[i] );
-
// get tab index
sal_Int16 nTabIndex = -1;
Any aCtrl = m_xUnoControlDialogModel->getByName( aName );
@@ -669,13 +662,9 @@ void DlgEditor::Copy()
if ( xClipDialogModel.is() )
{
- Sequence< OUString > aNames = xClipDialogModel->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- sal_uInt32 nCtrls = aNames.getLength();
-
- for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ for (auto& rName : xClipDialogModel->getElementNames())
{
- xClipDialogModel->removeByName( pNames[n] );
+ xClipDialogModel->removeByName(rName);
}
}
@@ -856,27 +845,31 @@ void DlgEditor::Paste()
Any aCombinedDataAny = xTransf->getTransferData( m_ClipboardDataFlavorsResource[1] );
Sequence< sal_Int8 > aCombinedData;
aCombinedDataAny >>= aCombinedData;
- const sal_Int8* pCombinedData = aCombinedData.getConstArray();
sal_Int32 nTotalLen = aCombinedData.getLength();
-
- // Reading offset
- sal_Int32 nResOffset = 0;
- sal_Int32 nFactor = 1;
- for( sal_Int16 i = 0; i < 4; i++ )
+ if (nTotalLen > 4)
{
- nResOffset += nFactor * sal_uInt8( pCombinedData[i] );
- nFactor *= 256;
- }
+ // Reading offset
+ sal_Int32 nResOffset = 0;
+ sal_Int32 nFactor = 1;
+ for (sal_Int16 i = 0; i < 4; i++)
+ {
+ nResOffset += nFactor * sal_uInt8(aCombinedData[i]);
+ nFactor *= 256;
+ }
- sal_Int32 nResDataLen = nTotalLen - nResOffset;
- sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4;
+ if (nResOffset > nTotalLen || nResOffset < 0)
+ nResOffset = nTotalLen;
- DialogModelBytes.realloc( nDialogDataLen );
- memcpy( DialogModelBytes.getArray(), pCombinedData + 4, nDialogDataLen );
+ sal_Int32 nResDataLen = nTotalLen - nResOffset;
+ sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4;
- aResData.realloc( nResDataLen );
- memcpy( aResData.getArray(), pCombinedData + nResOffset, nResDataLen );
+ DialogModelBytes.realloc(nDialogDataLen);
+ memcpy(DialogModelBytes.getArray(), aCombinedData.getConstArray() + 4, nDialogDataLen);
+
+ aResData.realloc(nResDataLen);
+ memcpy(aResData.getArray(), aCombinedData.getConstArray() + nResOffset, nResDataLen);
+ }
}
else
{
@@ -895,18 +888,16 @@ void DlgEditor::Paste()
return;
Sequence< OUString > aNames = xClipDialogModel->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- sal_uInt32 nCtrls = aNames.getLength();
Reference< resource::XStringResourcePersistence > xStringResourcePersistence;
- if( nCtrls > 0 && bSourceIsLocalized )
+ if (aNames.hasElements() && bSourceIsLocalized)
{
xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() );
xStringResourcePersistence->importBinary( aResData );
}
- for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ for (auto& rName : aNames)
{
- Any aA = xClipDialogModel->getByName( pNames[n] );
+ Any aA = xClipDialogModel->getByName(rName);
Reference< css::awt::XControlModel > xCM;
aA >>= xCM;
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 5b87393e51bc..505c570b7f05 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -580,16 +580,12 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
{
// get sequence of control names
Sequence< OUString > aNames = xNameAcc->getElementNames();
- const OUString* pNames = aNames.getConstArray();
sal_Int32 nCtrls = aNames.getLength();
// create a map of tab indices and control names, sorted by tab index
IndexToNameMap aIndexToNameMap;
- for ( sal_Int32 i = 0; i < nCtrls; ++i )
+ for (auto& aName : aNames)
{
- // get control name
- OUString aName( pNames[i] );
-
// get tab index
sal_Int16 nTabIndex = -1;
Any aCtrl = xNameAcc->getByName( aName );
@@ -1427,17 +1423,10 @@ void DlgEdForm::UpdateTabIndices()
if ( xNameAcc.is() )
{
// get sequence of control names
- Sequence< OUString > aNames = xNameAcc->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
-
// create a map of tab indices and control names, sorted by tab index
IndexToNameMap aIndexToNameMap;
- for ( sal_Int32 i = 0; i < nCtrls; ++i )
+ for (auto& aName : xNameAcc->getElementNames())
{
- // get name
- OUString aName( pNames[i] );
-
// get tab index
sal_Int16 nTabIndex = -1;
Any aCtrl = xNameAcc->getByName( aName );
@@ -1485,11 +1474,8 @@ void DlgEdForm::UpdateTabOrder()
Reference< awt::XUnoControlContainer > xCont( GetControl(), UNO_QUERY );
if ( xCont.is() )
{
- Sequence< Reference< awt::XTabController > > aSeqTabCtrls = xCont->getTabControllers();
- const Reference< awt::XTabController >* pTabCtrls = aSeqTabCtrls.getConstArray();
- sal_Int32 nCount = aSeqTabCtrls.getLength();
- for ( sal_Int32 i = 0; i < nCount; ++i )
- pTabCtrls[i]->activateTabOrder();
+ for (auto& xTabController : xCont->getTabControllers())
+ xTabController->activateTabOrder();
}
}
@@ -1511,8 +1497,9 @@ void DlgEdForm::UpdateGroups()
std::vector<DlgEdObj*> aChildList = GetChildren();
sal_uInt32 nSize = aChildList.size();
Sequence< Reference< awt::XControl > > aSeqControls( nSize );
+ auto* pSeqControlsData = aSeqControls.getArray();
for ( sal_uInt32 i = 0; i < nSize; ++i )
- aSeqControls.getArray()[i] = aChildList[i]->GetControl();
+ pSeqControlsData[i] = aChildList[i]->GetControl();
sal_Int32 nGroupCount = xTabModel->getGroupCount();
for ( sal_Int32 nGroup = 0; nGroup < nGroupCount; ++nGroup )
@@ -1521,26 +1508,23 @@ void DlgEdForm::UpdateGroups()
OUString aName;
Sequence< Reference< awt::XControlModel > > aSeqModels;
xTabModel->getGroup( nGroup, aSeqModels, aName );
- const Reference< awt::XControlModel >* pModels = aSeqModels.getConstArray();
sal_Int32 nModelCount = aSeqModels.getLength();
// create a list of peers that belong to this group
Sequence< Reference< awt::XWindow > > aSeqPeers( nModelCount );
+ auto* pSeqPeersData = aSeqPeers.getArray();
for ( sal_Int32 nModel = 0; nModel < nModelCount; ++nModel )
{
// for each control model find the corresponding control in the global list
- const Reference< awt::XControl >* pControls = aSeqControls.getConstArray();
- sal_Int32 nControlCount = aSeqControls.getLength();
- for ( sal_Int32 nControl = 0; nControl < nControlCount; ++nControl )
+ for (auto& xCtrl : aSeqControls)
{
- const Reference< awt::XControl > xCtrl( pControls[nControl] );
if ( xCtrl.is() )
{
Reference< awt::XControlModel > xCtrlModel( xCtrl->getModel() );
- if ( xCtrlModel.get() == pModels[nModel].get() )
+ if (xCtrlModel.get() == aSeqModels[nModel].get())
{
// get the control peer and insert into the list of peers
- aSeqPeers.getArray()[ nModel ].set( xCtrl->getPeer(), UNO_QUERY );
+ pSeqPeersData[nModel].set(xCtrl->getPeer(), UNO_QUERY);
break;
}
}
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 1dc44b0f09cf..ba6ca0a01442 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -100,19 +100,16 @@ void ManageLanguageDialog::FillLanguageBox()
if ( m_xLocalizationMgr->isLibraryLocalized() )
{
Locale aDefaultLocale = m_xLocalizationMgr->getStringResourceManager()->getDefaultLocale();
- Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
- const Locale* pLocale = aLocaleSeq.getConstArray();
- sal_Int32 i, nCount = aLocaleSeq.getLength();
- for ( i = 0; i < nCount; ++i )
+ for (auto& rLocale : m_xLocalizationMgr->getStringResourceManager()->getLocales())
{
- bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] );
- LanguageType eLangType = LanguageTag::convertToLanguageType( pLocale[i] );
+ bool bIsDefault = localesAreEqual(aDefaultLocale, rLocale);
+ LanguageType eLangType = LanguageTag::convertToLanguageType(rLocale);
OUString sLanguage = SvtLanguageTable::GetLanguageString( eLangType );
if ( bIsDefault )
{
sLanguage += " " + m_sDefLangStr;
}
- LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
+ LanguageEntry* pEntry = new LanguageEntry(rLocale, bIsDefault);
m_xLanguageLB->append(weld::toId(pEntry), sLanguage);
}
}
@@ -256,11 +253,8 @@ void SetDefaultLanguageDialog::FillLanguageBox()
if (m_xLocalizationMgr->isLibraryLocalized())
{
// remove the already localized languages
- Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
- const Locale* pLocale = aLocaleSeq.getConstArray();
- const sal_Int32 nCountLoc = aLocaleSeq.getLength();
- for ( sal_Int32 i = 0; i < nCountLoc; ++i )
- m_xLanguageCB->remove_id(LanguageTag::convertToLanguageType(pLocale[i]));
+ for (auto& rLocale : m_xLocalizationMgr->getStringResourceManager()->getLocales())
+ m_xLanguageCB->remove_id(LanguageTag::convertToLanguageType(rLocale));
// fill checklistbox if not in default mode
const sal_Int32 nCountLang = m_xLanguageCB->get_count();