diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-29 01:31:19 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-29 23:15:40 +0200 |
commit | 00e2762c664614a1b33f54dfc990ba29f0f81a07 (patch) | |
tree | 976d1d94d6d1e52812e128a5dfbcb3540ef9a42b /cui/source/options | |
parent | 8755c80018bec656e1b102da25edc450da4eee52 (diff) |
Drop uses of css::uno::Sequence::getConstArray in cppuhelper .. cui
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: Ia2b60af973183bbe79656e67b5e37d7efa39a308
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166817
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'cui/source/options')
-rw-r--r-- | cui/source/options/connpoolconfig.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/dbregisterednamesconfig.cxx | 20 | ||||
-rw-r--r-- | cui/source/options/optdict.cxx | 50 | ||||
-rw-r--r-- | cui/source/options/optgdlg.cxx | 25 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 104 | ||||
-rw-r--r-- | cui/source/options/optpath.cxx | 14 | ||||
-rw-r--r-- | cui/source/options/optsave.cxx | 19 |
7 files changed, 70 insertions, 169 deletions
diff --git a/cui/source/options/connpoolconfig.cxx b/cui/source/options/connpoolconfig.cxx index 0d0f45be10b9..12aee9933f4e 100644 --- a/cui/source/options/connpoolconfig.cxx +++ b/cui/source/options/connpoolconfig.cxx @@ -67,13 +67,10 @@ namespace offapp // then look for which of them settings are stored in the configuration OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS); - Sequence< OUString > aDriverKeys = aDriverSettings.getNodeNames(); - const OUString* pDriverKeys = aDriverKeys.getConstArray(); - const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys) + for (auto& driverKey : aDriverSettings.getNodeNames()) { // the name of the driver in this round - OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys); + OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(driverKey); OUString sThisDriverName; aThisDriverSettings.getNodeValue(DRIVER_NAME) >>= sThisDriverName; diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx index 6539506e9614..9c087d2823d0 100644 --- a/cui/source/options/dbregisterednamesconfig.cxx +++ b/cui/source/options/dbregisterednamesconfig.cxx @@ -43,14 +43,11 @@ namespace svx Reference< XDatabaseContext > xRegistrations( DatabaseContext::create(xContext) ); - Sequence< OUString > aRegistrationNames( xRegistrations->getRegistrationNames() ); - const OUString* pRegistrationName = aRegistrationNames.getConstArray(); - const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); - for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) + for (auto& registrationName : xRegistrations->getRegistrationNames()) { - OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) ); - aSettings[ *pRegistrationName ] = - DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) ); + aSettings[registrationName] = DatabaseRegistration( + xRegistrations->getDatabaseLocation(registrationName), + xRegistrations->isDatabaseRegistrationReadOnly(registrationName)); } } catch( const Exception& ) @@ -99,13 +96,10 @@ namespace svx } // delete unused entries - Sequence< OUString > aRegistrationNames = xRegistrations->getRegistrationNames(); - const OUString* pRegistrationName = aRegistrationNames.getConstArray(); - const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); - for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) + for (auto& registrationName : xRegistrations->getRegistrationNames()) { - if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() ) - xRegistrations->revokeDatabaseLocation( *pRegistrationName ); + if (rNewRegistrations.find(registrationName) == rNewRegistrations.end()) + xRegistrations->revokeDatabaseLocation(registrationName); } } catch( const Exception& ) diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index dbe7f80e3d6b..a9f4720419a7 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -136,18 +136,6 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void) Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() ); - Sequence< Reference< XDictionary > > aDics; - if (xDicList.is()) - aDics = xDicList->getDictionaries(); - const Reference< XDictionary > *pDic = aDics.getConstArray(); - sal_Int32 nCount = aDics.getLength(); - - bool bFound = false; - sal_Int32 i; - for (i = 0; !bFound && i < nCount; ++i ) - if ( sDict.equalsIgnoreAsciiCase( pDic[i]->getName()) ) - bFound = true; - if ( sDict.indexOf("/") != -1 || sDict.indexOf("\\") != -1 ) { // Detected an invalid character. @@ -159,7 +147,12 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void) return; } - if ( bFound ) + Sequence< Reference< XDictionary > > aDics; + if (xDicList.is()) + aDics = xDicList->getDictionaries(); + + if (std::any_of(aDics.begin(), aDics.end(), + [&sDict](auto& d) { return sDict.equalsIgnoreAsciiCase(d->getName()); })) { // duplicate names? std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(), @@ -276,13 +269,9 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16 m_xReplaceED->connect_activate(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl)); // fill listbox with all available WB's - const Reference< XDictionary > *pDic = aDics.getConstArray(); - sal_Int32 nCount = aDics.getLength(); - OUString aLookUpEntry; - for ( sal_Int32 i = 0; i < nCount; ++i ) + for (auto& xDic : aDics) { - Reference< XDictionary > xDic = pDic[i]; if (xDic.is()) { bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE; @@ -298,7 +287,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16 m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true ); - if ( nCount > 0 ) + if (aDics.hasElements()) { m_xAllDictsLB->set_active_text(aLookUpEntry); int nPos = m_xAllDictsLB->get_active(); @@ -396,7 +385,7 @@ void SvxEditDictionaryDialog::RemoveDictEntry(int nEntry) { OUString sTmpShort(m_pWordsLB->get_text(nEntry, 0)); - Reference<XDictionary> xDic = aDics.getConstArray()[nLBPos]; + Reference<XDictionary> xDic = aDics[nLBPos]; if (xDic->remove(sTmpShort)) // sal_True on success { m_pWordsLB->remove(nEntry); @@ -462,7 +451,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, vo void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) { - Reference< XDictionary > xDic = aDics.getConstArray()[ nId ]; + Reference<XDictionary> xDic = aDics[nId]; weld::WaitObject aWait(m_xDialog.get()); @@ -512,16 +501,14 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) m_pWordsLB->clear(); Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() ); - const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - sal_Int32 nCount = aEntries.getLength(); std::vector<OUString> aSortedDicEntries; - aSortedDicEntries.reserve(nCount); - for (sal_Int32 i = 0; i < nCount; i++) + aSortedDicEntries.reserve(aEntries.getLength()); + for (auto& xDictionaryEntry : aEntries) { - OUString aStr = pEntry[i]->getDictionaryWord(); - if(!pEntry[i]->getReplacementText().isEmpty()) + OUString aStr = xDictionaryEntry->getDictionaryWord(); + if (!xDictionaryEntry->getReplacementText().isEmpty()) { - aStr += "\t" + pEntry[i]->getReplacementText(); + aStr += "\t" + xDictionaryEntry->getReplacementText(); } aSortedDicEntries.push_back(aStr); } @@ -540,10 +527,11 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) int nRow = 0; for (OUString const & rStr : aSortedDicEntries) { - m_pWordsLB->append_text(rStr.getToken(0, '\t')); - if (m_pWordsLB == m_xDoubleColumnLB.get()) + sal_Int32 index = 0; + m_pWordsLB->append_text(rStr.getToken(0, '\t', index)); + if (index != -1 && m_pWordsLB == m_xDoubleColumnLB.get()) { - OUString sReplace = rStr.getToken(1, '\t'); + OUString sReplace = rStr.getToken(0, '\t', index); m_pWordsLB->set_text(nRow, sReplace, 1); ++nRow; } diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 1b8e6f58fde7..c449bc4a652e 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -464,23 +464,18 @@ CanvasSettings::CanvasSettings() : Reference<XHierarchicalNameAccess> xHierarchicalNameAccess( xNameAccess, UNO_QUERY_THROW); - Sequence<OUString> serviceNames = xNameAccess->getElementNames(); - const OUString* pCurr = serviceNames.getConstArray(); - const OUString* const pEnd = pCurr + serviceNames.getLength(); - while( pCurr != pEnd ) + for (auto& serviceName : xNameAccess->getElementNames()) { Reference<XNameAccess> xEntryNameAccess( - xHierarchicalNameAccess->getByHierarchicalName(*pCurr), + xHierarchicalNameAccess->getByHierarchicalName(serviceName), UNO_QUERY ); if( xEntryNameAccess.is() ) { Sequence<OUString> preferredImplementations; if( xEntryNameAccess->getByName("PreferredImplementations") >>= preferredImplementations ) - maAvailableImplementations.emplace_back(*pCurr,preferredImplementations ); + maAvailableImplementations.emplace_back(serviceName, preferredImplementations); } - - ++pCurr; } } catch (const Exception&) @@ -500,15 +495,12 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const // implementation that presents the "HardwareAcceleration" property for (auto const& availableImpl : maAvailableImplementations) { - const OUString* pCurrImpl = availableImpl.second.getConstArray(); - const OUString* const pEndImpl = pCurrImpl + availableImpl.second.getLength(); - - while( pCurrImpl != pEndImpl ) + for (auto& currImpl : availableImpl.second) { try { Reference<XPropertySet> xPropSet( xFactory->createInstance( - pCurrImpl->trim() ), + currImpl.trim() ), UNO_QUERY_THROW ); bool bHasAccel(false); if( xPropSet->getPropertyValue("HardwareAcceleration") >>= bHasAccel ) @@ -521,8 +513,6 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const catch (const Exception&) { } - - ++pCurrImpl; } } } @@ -1144,10 +1134,9 @@ static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocal SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern"); if (nPatterns) { - const OUString* pPatterns = aDateAcceptancePatterns.getConstArray(); - aBuf.append( pPatterns[0]); + aBuf.append(aDateAcceptancePatterns[0]); for (sal_Int32 i=1; i < nPatterns; ++i) - aBuf.append(";" + pPatterns[i]); + aBuf.append(";" + aDateAcceptancePatterns[i]); } return aBuf.makeStringAndClear(); } diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 4ec9bd987462..960fd62e1ebf 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -84,15 +84,8 @@ constexpr OUString cThes(SN_THESAURUS); static sal_Int32 lcl_SeqGetEntryPos( const Sequence< OUString > &rSeq, std::u16string_view rEntry ) { - sal_Int32 i; - sal_Int32 nLen = rSeq.getLength(); - const OUString *pItem = rSeq.getConstArray(); - for (i = 0; i < nLen; ++i) - { - if (rEntry == pItem[i]) - break; - } - return i < nLen ? i : -1; + auto it = std::find(rSeq.begin(), rSeq.end(), rEntry); + return it == rSeq.end() ? -1 : std::distance(rSeq.begin(), it); } static bool KillFile_Impl( const OUString& rURL ) @@ -407,20 +400,6 @@ public: }; -static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, std::u16string_view rTxt ) -{ - sal_Int32 nRes = -1; - sal_Int32 nLen = rSeq.getLength(); - const OUString *pString = rSeq.getConstArray(); - for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i) - { - if (pString[i] == rTxt) - nRes = i; - } - return nRes; -} - - Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, sal_uInt8 nType ) { LangImplNameTable *pTable = nullptr; @@ -457,7 +436,7 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break; } - if (!aImplName.isEmpty() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added + if (!aImplName.isEmpty() && (lcl_SeqGetEntryPos( aRes, aImplName) == -1)) // name not yet added { DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" ); if (nIdx < aRes.getLength()) @@ -745,20 +724,12 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna pInfo->bConfigured = bEnable; - Sequence< Locale > aLocales; - const Locale *pLocale = nullptr; - sal_Int32 nLocales = 0; - sal_Int32 i; - // update configured spellchecker entries if (pInfo->xSpell.is()) { - aLocales = pInfo->xSpell->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) + for (auto& locale : pInfo->xSpell->getLocales()) { - LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] ); + LanguageType nLang = LanguageTag::convertToLanguageType(locale); if (!aCfgSpellTable.count( nLang ) && bEnable) aCfgSpellTable[ nLang ] = Sequence< OUString >(); if (aCfgSpellTable.count( nLang )) @@ -769,12 +740,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna // update configured grammar checker entries if (pInfo->xGrammar.is()) { - aLocales = pInfo->xGrammar->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) + for (auto& locale : pInfo->xGrammar->getLocales()) { - LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] ); + LanguageType nLang = LanguageTag::convertToLanguageType(locale); if (!aCfgGrammarTable.count( nLang ) && bEnable) aCfgGrammarTable[ nLang ] = Sequence< OUString >(); if (aCfgGrammarTable.count( nLang )) @@ -785,12 +753,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna // update configured hyphenator entries if (pInfo->xHyph.is()) { - aLocales = pInfo->xHyph->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) + for (auto& locale : pInfo->xHyph->getLocales()) { - LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] ); + LanguageType nLang = LanguageTag::convertToLanguageType(locale); if (!aCfgHyphTable.count( nLang ) && bEnable) aCfgHyphTable[ nLang ] = Sequence< OUString >(); if (aCfgHyphTable.count( nLang )) @@ -802,12 +767,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna if (!pInfo->xThes.is()) return; - aLocales = pInfo->xThes->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) + for (auto& locale : pInfo->xThes->getLocales()) { - LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] ); + LanguageType nLang = LanguageTag::convertToLanguageType(locale); if (!aCfgThesTable.count( nLang ) && bEnable) aCfgThesTable[ nLang ] = Sequence< OUString >(); if (aCfgThesTable.count( nLang )) @@ -1017,7 +979,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) if (aData.GetEntryId() < nDics) { bool bChecked = m_xLinguDicsCLB->get_toggle(i) == TRISTATE_TRUE; - uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] ); + uno::Reference<XDictionary> xDic(aDics[i]); if (xDic.is()) { if (LinguMgr::GetIgnoreAllList() == xDic) @@ -1124,11 +1086,9 @@ void SvxLinguTabPage::UpdateDicBox_Impl() m_xLinguDicsCLB->freeze(); m_xLinguDicsCLB->clear(); - sal_Int32 nDics = aDics.getLength(); - const uno::Reference< XDictionary > *pDic = aDics.getConstArray(); - for (sal_Int32 i = 0; i < nDics; ++i) + for (sal_Int32 i = 0; i < aDics.getLength(); ++i) { - const uno::Reference< XDictionary > &rDic = pDic[i]; + const uno::Reference<XDictionary>& rDic = aDics[i]; if (rDic.is()) AddDicBoxEntry( rDic, static_cast<sal_uInt16>(i) ); } @@ -1373,7 +1333,7 @@ IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const weld::TreeView:: IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void) { - const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)]; + const uno::Reference<XDictionary> &rDic = aDics[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)]; if (LinguMgr::GetIgnoreAllList() == rDic) m_xLinguDicsCLB->set_toggle(rRowCol.first, TRISTATE_TRUE); } @@ -1438,7 +1398,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void) sal_Int32 nDics = aDics.getLength(); if (nDicPos < nDics) { - uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ]; + uno::Reference<XDictionary> xDic = aDics[nDicPos]; if (xDic.is()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); @@ -1463,7 +1423,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void) sal_Int32 nDics = aDics.getLength(); if (nDicPos < nDics) { - uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ]; + uno::Reference<XDictionary> xDic = aDics[nDicPos]; if (xDic.is()) { if (LinguMgr::GetIgnoreAllList() == xDic) @@ -1778,8 +1738,6 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox) if (LANGUAGE_DONTKNOW != eCurLanguage) { - sal_Int32 n; - ServiceInfo_Impl* pInfo; bool bReadOnly = false; int nRow = 0; @@ -1802,16 +1760,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox) bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0; } - Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) ); - const OUString *pName = aNames.getConstArray(); - sal_Int32 nNames = aNames.getLength(); sal_Int32 nLocalIndex = 0; // index relative to parent - for (n = 0; n < nNames; ++n) + for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_SPELL)) { OUString aImplName; bool bIsSuppLang = false; - pInfo = rLinguData.GetInfoByImplName( pName[n] ); + ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name); if (pInfo) { bIsSuppLang = pInfo->xSpell.is() && @@ -1860,16 +1815,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox) bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0; } - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR ); - pName = aNames.getConstArray(); - nNames = aNames.getLength(); nLocalIndex = 0; - for (n = 0; n < nNames; ++n) + for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_GRAMMAR)) { OUString aImplName; bool bIsSuppLang = false; - pInfo = rLinguData.GetInfoByImplName( pName[n] ); + ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name); if (pInfo) { bIsSuppLang = pInfo->xGrammar.is() && @@ -1919,16 +1871,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox) bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0; } - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH ); - pName = aNames.getConstArray(); - nNames = aNames.getLength(); nLocalIndex = 0; - for (n = 0; n < nNames; ++n) + for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_HYPH)) { OUString aImplName; bool bIsSuppLang = false; - pInfo = rLinguData.GetInfoByImplName( pName[n] ); + ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name); if (pInfo) { bIsSuppLang = pInfo->xHyph.is() && @@ -1977,16 +1926,13 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox) bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0; } - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES ); - pName = aNames.getConstArray(); - nNames = aNames.getLength(); nLocalIndex = 0; - for (n = 0; n < nNames; ++n) + for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_THES)) { OUString aImplName; bool bIsSuppLang = false; - pInfo = rLinguData.GetInfoByImplName( pName[n] ); + ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name); if (pInfo) { bIsSuppLang = pInfo->xThes.is() && diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 4a410af07c4b..f75f354c9c6f 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -621,14 +621,11 @@ void SvxPathTabPage::GetPathList( Sequence< OUString > aPathSeq; if ( aAny >>= aPathSeq ) { - tools::Long i, nCount = aPathSeq.getLength(); - const OUString* pPaths = aPathSeq.getConstArray(); - - for ( i = 0; i < nCount; ++i ) + for (auto& path : aPathSeq) { if ( !_rInternalPath.isEmpty() ) _rInternalPath += ";"; - _rInternalPath += pPaths[i]; + _rInternalPath += path; } } // load user paths @@ -636,14 +633,11 @@ void SvxPathTabPage::GetPathList( sCfgName + POSTFIX_USER); if ( aAny >>= aPathSeq ) { - tools::Long i, nCount = aPathSeq.getLength(); - const OUString* pPaths = aPathSeq.getConstArray(); - - for ( i = 0; i < nCount; ++i ) + for (auto& path : aPathSeq) { if ( !_rUserPath.isEmpty() ) _rUserPath += ";"; - _rUserPath += pPaths[i]; + _rUserPath += path; } } // then the writable path diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index ecf23f377ec3..368a6d425186 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -576,29 +576,22 @@ IMPL_LINK_NOARG(SvxSaveTabPage, BackupClickHdl_Impl, weld::Toggleable&, void) static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension) { OUString sName; - const PropertyValue* pPropVal = rProperties.getConstArray(); - const PropertyValue* const pEnd = pPropVal + rProperties.getLength(); - for( ; pPropVal != pEnd; pPropVal++ ) + for (auto& propVal : rProperties) { - const OUString &rName = pPropVal->Name; + const OUString &rName = propVal.Name; if (rName == "UIName") { OUString sUIName; - if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() ) + if ((propVal.Value >>= sUIName) && sUIName.getLength()) { if (!rExtension.empty()) - { - return sUIName + " (" + rExtension + ")"; - } - else - { - return sUIName; - } + sUIName += OUString::Concat(" (") + rExtension + ")"; + return sUIName; } } else if (rName == "Name") { - pPropVal->Value >>= sName; + propVal.Value >>= sName; } } |