diff options
Diffstat (limited to 'linguistic/source/gciterator.cxx')
-rw-r--r-- | linguistic/source/gciterator.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 0b284d660abc..d0c51f90b464 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -417,10 +417,9 @@ void GrammarCheckingIterator::ProcessResult( text::TextMarkupDescriptor * pDescriptors = aDescriptors.getArray(); // at pos 0 .. nErrors-1 -> all grammar errors - for (sal_Int32 i = 0; i < nErrors; ++i) + for (const linguistic2::SingleProofreadingError &rError : rRes.aErrors) { - const linguistic2::SingleProofreadingError &rError = rRes.aErrors[i]; - text::TextMarkupDescriptor &rDesc = aDescriptors[i]; + text::TextMarkupDescriptor &rDesc = *pDescriptors++; rDesc.nType = rError.nErrorType; rDesc.nOffset = rError.nErrorStart; @@ -455,9 +454,9 @@ void GrammarCheckingIterator::ProcessResult( // at pos nErrors -> sentence markup // nSentenceLength: includes the white-spaces following the sentence end... const sal_Int32 nSentenceLength = rRes.nStartOfNextSentencePosition - rRes.nStartOfSentencePosition; - pDescriptors[ nErrors ].nType = text::TextMarkupType::SENTENCE; - pDescriptors[ nErrors ].nOffset = rRes.nStartOfSentencePosition; - pDescriptors[ nErrors ].nLength = nSentenceLength; + pDescriptors->nType = text::TextMarkupType::SENTENCE; + pDescriptors->nOffset = rRes.nStartOfSentencePosition; + pDescriptors->nLength = nSentenceLength; xMulti->commitMultiTextMarkup( aDescriptors ) ; } @@ -1081,20 +1080,18 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl() uno::Reference< container::XNameAccess > xNA( GetUpdateAccess(), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( "GrammarCheckerList" ), uno::UNO_QUERY_THROW ); const uno::Sequence< OUString > aElementNames( xNA->getElementNames() ); - const OUString *pElementNames = aElementNames.getConstArray(); - sal_Int32 nLen = aElementNames.getLength(); - for (sal_Int32 i = 0; i < nLen; ++i) + for (const OUString& rElementName : aElementNames) { uno::Sequence< OUString > aImplNames; - uno::Any aTmp( xNA->getByName( pElementNames[i] ) ); + uno::Any aTmp( xNA->getByName( rElementName ) ); if (aTmp >>= aImplNames) { if (aImplNames.hasElements()) { // only the first entry is used, there should be only one grammar checker per language const OUString aImplName( aImplNames[0] ); - const LanguageType nLang = LanguageTag::convertToLanguageType( pElementNames[i] ); + const LanguageType nLang = LanguageTag::convertToLanguageType( rElementName ); aTmpGCImplNamesByLang[ nLang ] = aImplName; } } |