diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx index 024e95d588cc..69370f9e4a4c 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx @@ -345,7 +345,7 @@ sal_Int64 AccessibleBrowseBoxHeaderBar::implGetChildIndexFromSelectedIndex( if( (nSelectedChildIndex < 0) || (nSelectedChildIndex >= aSelSeq.getLength()) ) throw lang::IndexOutOfBoundsException(); - return aSelSeq.getConstArray()[ nSelectedChildIndex ]; + return aSelSeq[ nSelectedChildIndex ]; } void AccessibleBrowseBoxHeaderBar::ensureIsValidHeaderIndex( sal_Int32 nIndex ) 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 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 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 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 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 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 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 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 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 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 xLibDlg; Sequence< OUString > aLibNames = GetMergedLibraryNames( xModLibContImport, xDlgLibContImport ); - sal_Int32 nLibCount = aLibNames.getLength(); - if (nLibCount) + if (aLibNames.hasElements()) { // library import dialog xLibDlg = std::make_shared(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; + } + + if (nResOffset > nTotalLen || nResOffset < 0) + nResOffset = nTotalLen; + + sal_Int32 nResDataLen = nTotalLen - nResOffset; + sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4; + + DialogModelBytes.realloc(nDialogDataLen); + memcpy(DialogModelBytes.getArray(), aCombinedData.getConstArray() + 4, nDialogDataLen); + + aResData.realloc(nResDataLen); + memcpy(aResData.getArray(), aCombinedData.getConstArray() + nResOffset, nResDataLen); } - - sal_Int32 nResDataLen = nTotalLen - nResOffset; - sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4; - - DialogModelBytes.realloc( nDialogDataLen ); - memcpy( DialogModelBytes.getArray(), pCombinedData + 4, nDialogDataLen ); - - aResData.realloc( nResDataLen ); - memcpy( aResData.getArray(), pCombinedData + 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 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(); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 482d35d4df1d..92beaa21fd0a 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3250,12 +3250,10 @@ namespace basegfx::utils if(nLength) { aRetval.reserve(nLength); - const css::awt::Point* pArray = rPointSequenceSource.getConstArray(); - const css::awt::Point* pArrayEnd = pArray + rPointSequenceSource.getLength(); - for(;pArray != pArrayEnd; pArray++) + for(auto& point : rPointSequenceSource) { - aRetval.append(B2DPoint(pArray->X, pArray->Y)); + aRetval.append(B2DPoint(point.X, point.Y)); } // check for closed state flag @@ -3301,7 +3299,7 @@ namespace basegfx::utils // copy first point if closed if(bIsClosed) { - *pSequence = *rPointSequenceRetval.getConstArray(); + *pSequence = rPointSequenceRetval[0]; } } else @@ -3317,8 +3315,8 @@ namespace basegfx::utils const css::drawing::PointSequence& rPointSequenceSource, const css::drawing::FlagSequence& rFlagSequenceSource) { - const sal_uInt32 nCount(static_cast(rPointSequenceSource.getLength())); - OSL_ENSURE(nCount == static_cast(rFlagSequenceSource.getLength()), + const sal_Int32 nCount(rPointSequenceSource.getLength()); + OSL_ENSURE(nCount == rFlagSequenceSource.getLength(), "UnoPolygonBezierCoordsToB2DPolygon: Unequal count of Points and Flags (!)"); // prepare new polygon @@ -3328,12 +3326,9 @@ namespace basegfx::utils { aRetval.reserve(nCount); - const css::awt::Point* pPointSequence = rPointSequenceSource.getConstArray(); - const css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceSource.getConstArray(); - // get first point and flag - B2DPoint aNewCoordinatePair(pPointSequence->X, pPointSequence->Y); pPointSequence++; - css::drawing::PolygonFlags ePolygonFlag(*pFlagSequence); pFlagSequence++; + B2DPoint aNewCoordinatePair(rPointSequenceSource[0].X, rPointSequenceSource[0].Y); + css::drawing::PolygonFlags ePolygonFlag(rFlagSequenceSource[0]); B2DPoint aControlA; B2DPoint aControlB; @@ -3344,16 +3339,16 @@ namespace basegfx::utils // add first point as start point aRetval.append(aNewCoordinatePair); - for(sal_uInt32 b(1); b < nCount;) + for(sal_Int32 b(1); b < nCount;) { // prepare loop bool bControlA(false); bool bControlB(false); // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) { @@ -3361,9 +3356,9 @@ namespace basegfx::utils bControlA = true; // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; } if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) @@ -3372,9 +3367,9 @@ namespace basegfx::utils bControlB = true; // get next point and flag - aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); - ePolygonFlag = *pFlagSequence; - pPointSequence++; pFlagSequence++; b++; + aNewCoordinatePair = B2DPoint(rPointSequenceSource[b].X, rPointSequenceSource[b].Y); + ePolygonFlag = rFlagSequenceSource[b]; + b++; } // two or no control points are consumed, another one would be an error. @@ -3559,7 +3554,7 @@ namespace basegfx::utils if(bClosed) { // add first point as closing point - *pPointSequence = *rPointSequenceRetval.getConstArray(); + *pPointSequence = rPointSequenceRetval[0]; *pFlagSequence = css::drawing::PolygonFlags_NORMAL; } } diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index faf734f6e79e..cccd168bde00 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -554,13 +554,10 @@ namespace basegfx::utils { B2DPolyPolygon aRetval; aRetval.reserve(rPointSequenceSequenceSource.getLength()); - const css::drawing::PointSequence* pPointSequence = rPointSequenceSequenceSource.getConstArray(); - const css::drawing::PointSequence* pPointSeqEnd = pPointSequence + rPointSequenceSequenceSource.getLength(); - for(;pPointSequence != pPointSeqEnd; pPointSequence++) + for (auto& rPointSequence : rPointSequenceSequenceSource) { - const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence); - aRetval.append(aNewPolygon); + aRetval.append(UnoPointSequenceToB2DPolygon(rPointSequence)); } return aRetval; @@ -595,23 +592,19 @@ namespace basegfx::utils const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource) { B2DPolyPolygon aRetval; - const sal_uInt32 nSequenceCount(static_cast(rPolyPolygonBezierCoordsSource.Coordinates.getLength())); + const sal_Int32 nSequenceCount(rPolyPolygonBezierCoordsSource.Coordinates.getLength()); if(nSequenceCount) { - OSL_ENSURE(nSequenceCount == static_cast(rPolyPolygonBezierCoordsSource.Flags.getLength()), + OSL_ENSURE(nSequenceCount == rPolyPolygonBezierCoordsSource.Flags.getLength(), "UnoPolyPolygonBezierCoordsToB2DPolyPolygon: unequal number of Points and Flags (!)"); - const css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsSource.Coordinates.getConstArray(); - const css::drawing::FlagSequence* pFlagSequence = rPolyPolygonBezierCoordsSource.Flags.getConstArray(); - for(sal_uInt32 a(0); a < nSequenceCount; a++) + for(sal_Int32 a(0); a < nSequenceCount; a++) { const B2DPolygon aNewPolygon(UnoPolygonBezierCoordsToB2DPolygon( - *pPointSequence, - *pFlagSequence)); + rPolyPolygonBezierCoordsSource.Coordinates[a], + rPolyPolygonBezierCoordsSource.Flags[a])); - pPointSequence++; - pFlagSequence++; aRetval.append(aNewPolygon); } } diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index ffd8bded4d59..856fc40dff7e 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -472,32 +472,25 @@ namespace basegfx::utils "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have the same " "length (!)" ); - const css::drawing::DoubleSequence* pInnerSequenceX = rPolyPolygonShape3DSource.SequenceX.getConstArray(); - const css::drawing::DoubleSequence* pInnerSequenceY = rPolyPolygonShape3DSource.SequenceY.getConstArray(); - const css::drawing::DoubleSequence* pInnerSequenceZ = rPolyPolygonShape3DSource.SequenceZ.getConstArray(); - for(sal_Int32 a(0); a < nOuterSequenceCount; a++) { basegfx::B3DPolygon aNewPolygon; - const sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength()); - assert(nInnerSequenceCount == pInnerSequenceY->getLength() - && nInnerSequenceCount == pInnerSequenceZ->getLength() + + auto& rInnerSequenceX = rPolyPolygonShape3DSource.SequenceX[a]; + auto& rInnerSequenceY = rPolyPolygonShape3DSource.SequenceY[a]; + auto& rInnerSequenceZ = rPolyPolygonShape3DSource.SequenceZ[a]; + + const sal_Int32 nInnerSequenceCount(rInnerSequenceX.getLength()); + assert(nInnerSequenceCount == rInnerSequenceY.getLength() + && nInnerSequenceCount == rInnerSequenceZ.getLength() && "UnoPolyPolygonShape3DToB3DPolygon: Not all double sequences have " "the same length (!)"); - const double* pArrayX = pInnerSequenceX->getConstArray(); - const double* pArrayY = pInnerSequenceY->getConstArray(); - const double* pArrayZ = pInnerSequenceZ->getConstArray(); - for(sal_Int32 b(0); b < nInnerSequenceCount; b++) { - aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++)); + aNewPolygon.append(basegfx::B3DPoint(rInnerSequenceX[b], rInnerSequenceY[b], rInnerSequenceZ[b])); } - pInnerSequenceX++; - pInnerSequenceY++; - pInnerSequenceZ++; - // #i101520# correction is needed for imported polygons of old format, // see callers basegfx::utils::checkClosed(aNewPolygon);