summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 10:14:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 13:11:35 +0200
commite41106332982faef3c8b343b96904eeaa9ff6f60 (patch)
tree4c468229353f295eaeca6e1970e414159da9d608
parent6a2d03e7c796ad90c4d9d134ad1a91d527953c66 (diff)
loplugin:flatten in linguistic
Change-Id: I5dc83e3f3697ccd6a482c799af267587a77563c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91799 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--linguistic/source/convdicxml.cxx26
-rw-r--r--linguistic/source/dicimp.cxx38
-rw-r--r--linguistic/source/dlistimp.cxx118
-rw-r--r--linguistic/source/gciterator.cxx70
-rw-r--r--linguistic/source/iprcache.cxx26
-rw-r--r--linguistic/source/lngprophelp.cxx164
-rw-r--r--linguistic/source/lngsvcmgr.cxx620
7 files changed, 531 insertions, 531 deletions
diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index fe5ff97105aa..99e9959957ff 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -228,21 +228,21 @@ void ConvDicXMLEntryTextContext_Impl::startFastElement(
sal_Int32 /*Element*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttrList )
{
- if ( rxAttrList.is() )
- {
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( rxAttrList );
+ if ( !rxAttrList.is() )
+ return;
- for (auto &aIter : *pAttribList)
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( rxAttrList );
+
+ for (auto &aIter : *pAttribList)
+ {
+ switch (aIter.getToken())
{
- switch (aIter.getToken())
- {
- case XML_NAMESPACE_TCD | XML_LEFT_TEXT:
- aLeftText = aIter.toString();
- break;
- default:
- ;
- }
+ case XML_NAMESPACE_TCD | XML_LEFT_TEXT:
+ aLeftText = aIter.toString();
+ break;
+ default:
+ ;
}
}
}
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index e2fc1d53832c..cae5f9871858 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -764,31 +764,31 @@ void SAL_CALL DictionaryNeo::setActive( sal_Bool bActivate )
{
MutexGuard aGuard( GetLinguMutex() );
- if (bIsActive != bool(bActivate))
+ if (bIsActive == bool(bActivate))
+ return;
+
+ bIsActive = bActivate;
+ sal_Int16 nEvent = bIsActive ?
+ DictionaryEventFlags::ACTIVATE_DIC : DictionaryEventFlags::DEACTIVATE_DIC;
+
+ // remove entries from memory if dictionary is deactivated
+ if (!bIsActive)
{
- bIsActive = bActivate;
- sal_Int16 nEvent = bIsActive ?
- DictionaryEventFlags::ACTIVATE_DIC : DictionaryEventFlags::DEACTIVATE_DIC;
+ bool bIsEmpty = aEntries.empty();
- // remove entries from memory if dictionary is deactivated
- if (!bIsActive)
+ // save entries first if necessary
+ if (bIsModified && hasLocation() && !isReadonly())
{
- bool bIsEmpty = aEntries.empty();
-
- // save entries first if necessary
- if (bIsModified && hasLocation() && !isReadonly())
- {
- store();
+ store();
- aEntries.clear();
- bNeedEntries = !bIsEmpty;
- }
- DBG_ASSERT( !bIsModified || !hasLocation() || isReadonly(),
- "lng : dictionary is still modified" );
+ aEntries.clear();
+ bNeedEntries = !bIsEmpty;
}
-
- launchEvent(nEvent, nullptr);
+ DBG_ASSERT( !bIsModified || !hasLocation() || isReadonly(),
+ "lng : dictionary is still modified" );
}
+
+ launchEvent(nEvent, nullptr);
}
sal_Bool SAL_CALL DictionaryNeo::isActive( )
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 27ad955ca886..98ed47202f55 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -522,46 +522,46 @@ void SAL_CALL
{
osl::MutexGuard aGuard( GetLinguMutex() );
- if (!bDisposing)
- {
- bDisposing = true;
- EventObject aEvtObj( static_cast<XDictionaryList *>(this) );
+ if (bDisposing)
+ return;
+
+ bDisposing = true;
+ EventObject aEvtObj( static_cast<XDictionaryList *>(this) );
- aEvtListeners.disposeAndClear( aEvtObj );
- if (mxDicEvtLstnrHelper.is())
- mxDicEvtLstnrHelper->DisposeAndClear( aEvtObj );
+ aEvtListeners.disposeAndClear( aEvtObj );
+ if (mxDicEvtLstnrHelper.is())
+ mxDicEvtLstnrHelper->DisposeAndClear( aEvtObj );
- //! avoid creation of dictionaries if not already done
- if ( !aDicList.empty() )
+ //! avoid creation of dictionaries if not already done
+ if ( !aDicList.empty() )
+ {
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t nCount = rDicList.size();
+ for (size_t i = 0; i < nCount; i++)
{
- DictionaryVec_t& rDicList = GetOrCreateDicList();
- size_t nCount = rDicList.size();
- for (size_t i = 0; i < nCount; i++)
- {
- uno::Reference< XDictionary > xDic( rDicList[i], UNO_QUERY );
+ uno::Reference< XDictionary > xDic( rDicList[i], UNO_QUERY );
- // save (modified) dictionaries
- uno::Reference< frame::XStorable > xStor( xDic , UNO_QUERY );
- if (xStor.is())
+ // save (modified) dictionaries
+ uno::Reference< frame::XStorable > xStor( xDic , UNO_QUERY );
+ if (xStor.is())
+ {
+ try
+ {
+ if (!xStor->isReadonly() && xStor->hasLocation())
+ xStor->store();
+ }
+ catch(Exception &)
{
- try
- {
- if (!xStor->isReadonly() && xStor->hasLocation())
- xStor->store();
- }
- catch(Exception &)
- {
- }
}
-
- // release references to (members of) this object hold by
- // dictionaries
- if (xDic.is())
- xDic->removeDictionaryEventListener( mxDicEvtLstnrHelper.get() );
}
+
+ // release references to (members of) this object hold by
+ // dictionaries
+ if (xDic.is())
+ xDic->removeDictionaryEventListener( mxDicEvtLstnrHelper.get() );
}
- mxDicEvtLstnrHelper.clear();
}
+ mxDicEvtLstnrHelper.clear();
}
void SAL_CALL
@@ -639,25 +639,25 @@ void DicList::SaveDics()
{
// save dics only if they have already been used/created.
//! don't create them just for the purpose of saving them !
- if ( !aDicList.empty() )
+ if ( aDicList.empty() )
+ return;
+
+ // save (modified) dictionaries
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t nCount = rDicList.size();
+ for (size_t i = 0; i < nCount; i++)
{
// save (modified) dictionaries
- DictionaryVec_t& rDicList = GetOrCreateDicList();
- size_t nCount = rDicList.size();
- for (size_t i = 0; i < nCount; i++)
+ uno::Reference< frame::XStorable > xStor( rDicList[i], UNO_QUERY );
+ if (xStor.is())
{
- // save (modified) dictionaries
- uno::Reference< frame::XStorable > xStor( rDicList[i], UNO_QUERY );
- if (xStor.is())
+ try
+ {
+ if (!xStor->isReadonly() && xStor->hasLocation())
+ xStor->store();
+ }
+ catch(Exception &)
{
- try
- {
- if (!xStor->isReadonly() && xStor->hasLocation())
- xStor->store();
- }
- catch(Exception &)
- {
- }
}
}
}
@@ -745,21 +745,21 @@ static void AddInternal(
const uno::Reference<XDictionary> &rDic,
const OUString& rNew )
{
- if (rDic.is())
+ if (!rDic.is())
+ return;
+
+ //! TL TODO: word iterator should be used to break up the text
+ OUString aDelim("!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n");
+ OSL_ENSURE(aDelim.indexOf(u'.') == -1,
+ "ensure no '.'");
+
+ OUString aToken;
+ sal_Int32 nPos = 0;
+ while (-1 != (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim )))
{
- //! TL TODO: word iterator should be used to break up the text
- OUString aDelim("!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n");
- OSL_ENSURE(aDelim.indexOf(u'.') == -1,
- "ensure no '.'");
-
- OUString aToken;
- sal_Int32 nPos = 0;
- while (-1 != (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim )))
+ if( !aToken.isEmpty() && !IsNumeric( aToken ) )
{
- if( !aToken.isEmpty() && !IsNumeric( aToken ) )
- {
- rDic->add( aToken, false, OUString() );
- }
+ rDic->add( aToken, false, OUString() );
}
}
}
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 2c95c33a690f..ac8fd2bf2cf4 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -354,24 +354,24 @@ void GrammarCheckingIterator::AddEntry(
// we may not need/have a xFlatParaIterator (e.g. if checkGrammarAtPos was called)
// but we always need a xFlatPara...
uno::Reference< text::XFlatParagraph > xPara( xFlatPara );
- if (xPara.is())
- {
- FPEntry aNewFPEntry;
- aNewFPEntry.m_xParaIterator = xFlatParaIterator;
- aNewFPEntry.m_xPara = xFlatPara;
- aNewFPEntry.m_aDocId = rDocId;
- aNewFPEntry.m_nStartIndex = nStartIndex;
- aNewFPEntry.m_bAutomatic = bAutomatic;
-
- // add new entry to the end of this queue
- ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
- if (!m_thread)
- m_thread = osl_createThread( lcl_workerfunc, this );
- m_aFPEntriesQueue.push_back( aNewFPEntry );
+ if (!xPara.is())
+ return;
- // wake up the thread in order to do grammar checking
- m_aWakeUpThread.set();
- }
+ FPEntry aNewFPEntry;
+ aNewFPEntry.m_xParaIterator = xFlatParaIterator;
+ aNewFPEntry.m_xPara = xFlatPara;
+ aNewFPEntry.m_aDocId = rDocId;
+ aNewFPEntry.m_nStartIndex = nStartIndex;
+ aNewFPEntry.m_bAutomatic = bAutomatic;
+
+ // add new entry to the end of this queue
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+ if (!m_thread)
+ m_thread = osl_createThread( lcl_workerfunc, this );
+ m_aFPEntriesQueue.push_back( aNewFPEntry );
+
+ // wake up the thread in order to do grammar checking
+ m_aWakeUpThread.set();
}
@@ -922,25 +922,25 @@ sal_Bool SAL_CALL GrammarCheckingIterator::isProofreading(
void SAL_CALL GrammarCheckingIterator::processLinguServiceEvent(
const linguistic2::LinguServiceEvent& rLngSvcEvent )
{
- if (rLngSvcEvent.nEvent == linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN)
+ if (rLngSvcEvent.nEvent != linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN)
+ return;
+
+ try
{
- try
- {
- uno::Reference< uno::XInterface > xThis( static_cast< OWeakObject * >(this) );
- linguistic2::LinguServiceEvent aEvent( xThis, linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
- m_aNotifyListeners.notifyEach(
- &linguistic2::XLinguServiceEventListener::processLinguServiceEvent,
- aEvent);
- }
- catch (uno::RuntimeException &)
- {
- throw;
- }
- catch (const ::uno::Exception &)
- {
- // ignore
- TOOLS_WARN_EXCEPTION("linguistic", "processLinguServiceEvent");
- }
+ uno::Reference< uno::XInterface > xThis( static_cast< OWeakObject * >(this) );
+ linguistic2::LinguServiceEvent aEvent( xThis, linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
+ m_aNotifyListeners.notifyEach(
+ &linguistic2::XLinguServiceEventListener::processLinguServiceEvent,
+ aEvent);
+ }
+ catch (uno::RuntimeException &)
+ {
+ throw;
+ }
+ catch (const ::uno::Exception &)
+ {
+ // ignore
+ TOOLS_WARN_EXCEPTION("linguistic", "processLinguServiceEvent");
}
}
diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx
index 8f81551eebeb..eb49db33892f 100644
--- a/linguistic/source/iprcache.cxx
+++ b/linguistic/source/iprcache.cxx
@@ -149,19 +149,19 @@ void SAL_CALL FlushListener::processDictionaryListEvent(
{
MutexGuard aGuard( GetLinguMutex() );
- if (rDicListEvent.Source == xDicList)
- {
- sal_Int16 nEvt = rDicListEvent.nCondensedEvent;
- sal_Int16 const nFlushFlags =
- DictionaryListEventFlags::ADD_NEG_ENTRY |
- DictionaryListEventFlags::DEL_POS_ENTRY |
- DictionaryListEventFlags::ACTIVATE_NEG_DIC |
- DictionaryListEventFlags::DEACTIVATE_POS_DIC;
- bool bFlush = 0 != (nEvt & nFlushFlags);
-
- if (bFlush)
- mrSpellCache.Flush();
- }
+ if (rDicListEvent.Source != xDicList)
+ return;
+
+ sal_Int16 nEvt = rDicListEvent.nCondensedEvent;
+ sal_Int16 const nFlushFlags =
+ DictionaryListEventFlags::ADD_NEG_ENTRY |
+ DictionaryListEventFlags::DEL_POS_ENTRY |
+ DictionaryListEventFlags::ACTIVATE_NEG_DIC |
+ DictionaryListEventFlags::DEACTIVATE_POS_DIC;
+ bool bFlush = 0 != (nEvt & nFlushFlags);
+
+ if (bFlush)
+ mrSpellCache.Flush();
}
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index ba3fbd52e7af..1c066e7eba34 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -108,29 +108,29 @@ void PropertyChgHelper::SetDefaultValues()
void PropertyChgHelper::GetCurrentValues()
{
const auto& rPropNames = GetPropNames();
- if (GetPropSet().is() && rPropNames.hasElements())
+ if (!(GetPropSet().is() && rPropNames.hasElements()))
+ return;
+
+ for (const OUString& rPropName : rPropNames)
{
- for (const OUString& rPropName : rPropNames)
- {
- bool *pbVal = nullptr,
- *pbResVal = nullptr;
+ bool *pbVal = nullptr,
+ *pbResVal = nullptr;
- if ( rPropName == UPN_IS_IGNORE_CONTROL_CHARACTERS )
- {
- pbVal = &bIsIgnoreControlCharacters;
- pbResVal = &bResIsIgnoreControlCharacters;
- }
- else if ( rPropName == UPN_IS_USE_DICTIONARY_LIST )
- {
- pbVal = &bIsUseDictionaryList;
- pbResVal = &bResIsUseDictionaryList;
- }
+ if ( rPropName == UPN_IS_IGNORE_CONTROL_CHARACTERS )
+ {
+ pbVal = &bIsIgnoreControlCharacters;
+ pbResVal = &bResIsIgnoreControlCharacters;
+ }
+ else if ( rPropName == UPN_IS_USE_DICTIONARY_LIST )
+ {
+ pbVal = &bIsUseDictionaryList;
+ pbResVal = &bResIsUseDictionaryList;
+ }
- if (pbVal && pbResVal)
- {
- GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
- *pbResVal = *pbVal;
- }
+ if (pbVal && pbResVal)
+ {
+ GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
+ *pbResVal = *pbVal;
}
}
}
@@ -358,34 +358,34 @@ void PropertyHelper_Spell::GetCurrentValues()
PropertyChgHelper::GetCurrentValues();
const auto& rPropNames = GetPropNames();
- if (GetPropSet().is() && rPropNames.hasElements())
+ if (!(GetPropSet().is() && rPropNames.hasElements()))
+ return;
+
+ for (const OUString& rPropName : rPropNames)
{
- for (const OUString& rPropName : rPropNames)
- {
- bool *pbVal = nullptr,
- *pbResVal = nullptr;
+ bool *pbVal = nullptr,
+ *pbResVal = nullptr;
- if ( rPropName == UPN_IS_SPELL_UPPER_CASE )
- {
- pbVal = &bIsSpellUpperCase;
- pbResVal = &bResIsSpellUpperCase;
- }
- else if ( rPropName == UPN_IS_SPELL_WITH_DIGITS )
- {
- pbVal = &bIsSpellWithDigits;
- pbResVal = &bResIsSpellWithDigits;
- }
- else if ( rPropName == UPN_IS_SPELL_CAPITALIZATION )
- {
- pbVal = &bIsSpellCapitalization;
- pbResVal = &bResIsSpellCapitalization;
- }
+ if ( rPropName == UPN_IS_SPELL_UPPER_CASE )
+ {
+ pbVal = &bIsSpellUpperCase;
+ pbResVal = &bResIsSpellUpperCase;
+ }
+ else if ( rPropName == UPN_IS_SPELL_WITH_DIGITS )
+ {
+ pbVal = &bIsSpellWithDigits;
+ pbResVal = &bResIsSpellWithDigits;
+ }
+ else if ( rPropName == UPN_IS_SPELL_CAPITALIZATION )
+ {
+ pbVal = &bIsSpellCapitalization;
+ pbResVal = &bResIsSpellCapitalization;
+ }
- if (pbVal && pbResVal)
- {
- GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
- *pbResVal = *pbVal;
- }
+ if (pbVal && pbResVal)
+ {
+ GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
+ *pbResVal = *pbVal;
}
}
}
@@ -531,46 +531,46 @@ void PropertyHelper_Hyphen::GetCurrentValues()
PropertyChgHelper::GetCurrentValues();
const auto& rPropNames = GetPropNames();
- if (GetPropSet().is() && rPropNames.hasElements())
+ if (!(GetPropSet().is() && rPropNames.hasElements()))
+ return;
+
+ for (const OUString& rPropName : rPropNames)
{
- for (const OUString& rPropName : rPropNames)
- {
- sal_Int16 *pnVal = nullptr,
- *pnResVal = nullptr;
- bool *pbVal = nullptr;
- bool *pbResVal = nullptr;
+ sal_Int16 *pnVal = nullptr,
+ *pnResVal = nullptr;
+ bool *pbVal = nullptr;
+ bool *pbResVal = nullptr;
- if ( rPropName == UPN_HYPH_MIN_LEADING )
- {
- pnVal = &nHyphMinLeading;
- pnResVal = &nResHyphMinLeading;
- }
- else if ( rPropName == UPN_HYPH_MIN_TRAILING )
- {
- pnVal = &nHyphMinTrailing;
- pnResVal = &nResHyphMinTrailing;
- }
- else if ( rPropName == UPN_HYPH_MIN_WORD_LENGTH )
- {
- pnVal = &nHyphMinWordLength;
- pnResVal = &nResHyphMinWordLength;
- }
- else if ( rPropName == UPN_HYPH_NO_CAPS )
- {
- pbVal = &bNoHyphenateCaps;
- pbResVal = &bResNoHyphenateCaps;
- }
+ if ( rPropName == UPN_HYPH_MIN_LEADING )
+ {
+ pnVal = &nHyphMinLeading;
+ pnResVal = &nResHyphMinLeading;
+ }
+ else if ( rPropName == UPN_HYPH_MIN_TRAILING )
+ {
+ pnVal = &nHyphMinTrailing;
+ pnResVal = &nResHyphMinTrailing;
+ }
+ else if ( rPropName == UPN_HYPH_MIN_WORD_LENGTH )
+ {
+ pnVal = &nHyphMinWordLength;
+ pnResVal = &nResHyphMinWordLength;
+ }
+ else if ( rPropName == UPN_HYPH_NO_CAPS )
+ {
+ pbVal = &bNoHyphenateCaps;
+ pbResVal = &bResNoHyphenateCaps;
+ }
- if (pnVal && pnResVal)
- {
- GetPropSet()->getPropertyValue( rPropName ) >>= *pnVal;
- *pnResVal = *pnVal;
- }
- else if (pbVal && pbResVal)
- {
- GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
- *pbResVal = *pbVal;
- }
+ if (pnVal && pnResVal)
+ {
+ GetPropSet()->getPropertyValue( rPropName ) >>= *pnVal;
+ *pnResVal = *pnVal;
+ }
+ else if (pbVal && pbResVal)
+ {
+ GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
+ *pbResVal = *pbVal;
}
}
}
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index afa5f0795804..2cf8524f851f 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -480,19 +480,19 @@ void LngSvcMgr::stopListening()
{
osl::MutexGuard aGuard(GetLinguMutex());
- if (xMB.is())
- {
- try
- {
- uno::Reference<util::XModifyListener> xListener(this);
- xMB->removeModifyListener(xListener);
- }
- catch (const uno::Exception&)
- {
- }
+ if (!xMB.is())
+ return;
- xMB.clear();
+ try
+ {
+ uno::Reference<util::XModifyListener> xListener(this);
+ xMB->removeModifyListener(xListener);
}
+ catch (const uno::Exception&)
+ {
+ }
+
+ xMB.clear();
}
void LngSvcMgr::disposing(const lang::EventObject&)
@@ -873,27 +873,27 @@ void LngSvcMgr::GetSpellCheckerDsp_Impl( bool bSetSvcList )
void LngSvcMgr::GetGrammarCheckerDsp_Impl( bool bSetSvcList )
{
- if (!mxGrammarDsp.is() && SvtLinguConfig().HasGrammarChecker())
+ if (!(!mxGrammarDsp.is() && SvtLinguConfig().HasGrammarChecker()))
+ return;
+
+ //! since the grammar checking iterator needs to be a one instance service
+ //! we need to create it the correct way!
+ uno::Reference< linguistic2::XProofreadingIterator > xGCI;
+ try
{
- //! since the grammar checking iterator needs to be a one instance service
- //! we need to create it the correct way!
- uno::Reference< linguistic2::XProofreadingIterator > xGCI;
- try
- {
- xGCI = linguistic2::ProofreadingIterator::create( comphelper::getProcessComponentContext() );
- }
- catch (const uno::Exception &)
- {
- }
- SAL_WARN_IF( !xGCI.is(), "linguistic", "instantiating grammar checking iterator failed" );
+ xGCI = linguistic2::ProofreadingIterator::create( comphelper::getProcessComponentContext() );
+ }
+ catch (const uno::Exception &)
+ {
+ }
+ SAL_WARN_IF( !xGCI.is(), "linguistic", "instantiating grammar checking iterator failed" );
- if (xGCI.is())
- {
- mxGrammarDsp = dynamic_cast< GrammarCheckingIterator * >(xGCI.get());
- SAL_WARN_IF( mxGrammarDsp == nullptr, "linguistic", "failed to get implementation" );
- if (bSetSvcList && mxGrammarDsp.is())
- SetCfgServiceLists( *mxGrammarDsp );
- }
+ if (xGCI.is())
+ {
+ mxGrammarDsp = dynamic_cast< GrammarCheckingIterator * >(xGCI.get());
+ SAL_WARN_IF( mxGrammarDsp == nullptr, "linguistic", "failed to get implementation" );
+ if (bSetSvcList && mxGrammarDsp.is())
+ SetCfgServiceLists( *mxGrammarDsp );
}
}
@@ -922,115 +922,115 @@ void LngSvcMgr::GetThesaurusDsp_Impl( bool bSetSvcList )
void LngSvcMgr::GetAvailableSpellSvcs_Impl()
{
- if (!pAvailSpellSvcs)
- {
- pAvailSpellSvcs.reset(new SvcInfoArray);
+ if (pAvailSpellSvcs)
+ return;
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ pAvailSpellSvcs.reset(new SvcInfoArray);
- uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
- uno::Reference< container::XEnumeration > xEnum;
- if (xEnumAccess.is())
- xEnum = xEnumAccess->createContentEnumeration( SN_SPELLCHECKER );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
- if (xEnum.is())
- {
- while (xEnum->hasMoreElements())
- {
- uno::Any aCurrent = xEnum->nextElement();
- uno::Reference< lang::XSingleComponentFactory > xCompFactory;
- uno::Reference< lang::XSingleServiceFactory > xFactory;
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
+ if (xEnumAccess.is())
+ xEnum = xEnumAccess->createContentEnumeration( SN_SPELLCHECKER );
- uno::Reference< linguistic2::XSpellChecker > xSvc;
- xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
- if (!xCompFactory.is())
- {
- xFactory.set(aCurrent, css::uno::UNO_QUERY);
- }
- if ( xCompFactory.is() || xFactory.is() )
- {
- try
- {
- xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
- }
- catch (const uno::Exception &)
- {
- SAL_WARN( "linguistic", "createInstance failed" );
- }
- }
+ if (!xEnum.is())
+ return;
- if (xSvc.is())
- {
- OUString aImplName;
- std::vector< LanguageType > aLanguages;
- uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
- if (xInfo.is())
- aImplName = xInfo->getImplementationName();
- SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
- uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
- aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-
- pAvailSpellSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
- }
+ while (xEnum->hasMoreElements())
+ {
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ uno::Reference< linguistic2::XSpellChecker > xSvc;
+ xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
+ if (!xCompFactory.is())
+ {
+ xFactory.set(aCurrent, css::uno::UNO_QUERY);
+ }
+ if ( xCompFactory.is() || xFactory.is() )
+ {
+ try
+ {
+ xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
+ }
+ catch (const uno::Exception &)
+ {
+ SAL_WARN( "linguistic", "createInstance failed" );
}
}
+
+ if (xSvc.is())
+ {
+ OUString aImplName;
+ std::vector< LanguageType > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+ if (xInfo.is())
+ aImplName = xInfo->getImplementationName();
+ SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
+ uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
+ aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+
+ pAvailSpellSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
+ }
}
}
void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
{
- if (!pAvailGrammarSvcs)
- {
- pAvailGrammarSvcs.reset(new SvcInfoArray);
+ if (pAvailGrammarSvcs)
+ return;
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ pAvailGrammarSvcs.reset(new SvcInfoArray);
- uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
- uno::Reference< container::XEnumeration > xEnum;
- if (xEnumAccess.is())
- xEnum = xEnumAccess->createContentEnumeration( SN_GRAMMARCHECKER );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
- if (xEnum.is())
- {
- while (xEnum->hasMoreElements())
- {
- uno::Any aCurrent = xEnum->nextElement();
- uno::Reference< lang::XSingleComponentFactory > xCompFactory;
- uno::Reference< lang::XSingleServiceFactory > xFactory;
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
+ if (xEnumAccess.is())
+ xEnum = xEnumAccess->createContentEnumeration( SN_GRAMMARCHECKER );
- uno::Reference< linguistic2::XProofreader > xSvc;
- xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
- if (!xCompFactory.is())
- {
- xFactory.set(aCurrent, css::uno::UNO_QUERY);
- }
- if ( xCompFactory.is() || xFactory.is() )
- {
- try
- {
- xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
- }
- catch (const uno::Exception &)
- {
- SAL_WARN( "linguistic", "createInstance failed" );
- }
- }
+ if (!xEnum.is())
+ return;
- if (xSvc.is() && pAvailGrammarSvcs)
- {
- OUString aImplName;
- std::vector< LanguageType > aLanguages;
- uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
- if (xInfo.is())
- aImplName = xInfo->getImplementationName();
- SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
- uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
- aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-
- pAvailGrammarSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
- }
+ while (xEnum->hasMoreElements())
+ {
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ uno::Reference< linguistic2::XProofreader > xSvc;
+ xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
+ if (!xCompFactory.is())
+ {
+ xFactory.set(aCurrent, css::uno::UNO_QUERY);
+ }
+ if ( xCompFactory.is() || xFactory.is() )
+ {
+ try
+ {
+ xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
+ catch (const uno::Exception &)
+ {
+ SAL_WARN( "linguistic", "createInstance failed" );
+ }
+ }
+
+ if (xSvc.is() && pAvailGrammarSvcs)
+ {
+ OUString aImplName;
+ std::vector< LanguageType > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+ if (xInfo.is())
+ aImplName = xInfo->getImplementationName();
+ SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
+ uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
+ aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+
+ pAvailGrammarSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
}
}
@@ -1038,112 +1038,112 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
void LngSvcMgr::GetAvailableHyphSvcs_Impl()
{
- if (!pAvailHyphSvcs)
- {
- pAvailHyphSvcs.reset(new SvcInfoArray);
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ if (pAvailHyphSvcs)
+ return;
- uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
- uno::Reference< container::XEnumeration > xEnum;
- if (xEnumAccess.is())
- xEnum = xEnumAccess->createContentEnumeration( SN_HYPHENATOR );
+ pAvailHyphSvcs.reset(new SvcInfoArray);
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
- if (xEnum.is())
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
+ if (xEnumAccess.is())
+ xEnum = xEnumAccess->createContentEnumeration( SN_HYPHENATOR );
+
+ if (!xEnum.is())
+ return;
+
+ while (xEnum->hasMoreElements())
+ {
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ uno::Reference< linguistic2::XHyphenator > xSvc;
+ xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
+ if (!xCompFactory.is())
+ {
+ xFactory.set(aCurrent, css::uno::UNO_QUERY);
+ }
+ if ( xCompFactory.is() || xFactory.is() )
{
- while (xEnum->hasMoreElements())
+ try
{
- uno::Any aCurrent = xEnum->nextElement();
- uno::Reference< lang::XSingleComponentFactory > xCompFactory;
- uno::Reference< lang::XSingleServiceFactory > xFactory;
-
- uno::Reference< linguistic2::XHyphenator > xSvc;
- xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
- if (!xCompFactory.is())
- {
- xFactory.set(aCurrent, css::uno::UNO_QUERY);
- }
- if ( xCompFactory.is() || xFactory.is() )
- {
- try
- {
- xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
- }
- catch (const uno::Exception &)
- {
- SAL_WARN( "linguistic", "createInstance failed" );
- }
- }
- if (xSvc.is())
- {
- OUString aImplName;
- std::vector< LanguageType > aLanguages;
- uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
- if (xInfo.is())
- aImplName = xInfo->getImplementationName();
- SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
- uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
- aLanguages = LocaleSeqToLangVec( aLocaleSequence );
- pAvailHyphSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
- }
+ xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
+ }
+ catch (const uno::Exception &)
+ {
+ SAL_WARN( "linguistic", "createInstance failed" );
}
}
+ if (xSvc.is())
+ {
+ OUString aImplName;
+ std::vector< LanguageType > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+ if (xInfo.is())
+ aImplName = xInfo->getImplementationName();
+ SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
+ uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
+ aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+ pAvailHyphSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
+ }
}
}
void LngSvcMgr::GetAvailableThesSvcs_Impl()
{
- if (!pAvailThesSvcs)
- {
- pAvailThesSvcs.reset(new SvcInfoArray);
+ if (pAvailThesSvcs)
+ return;
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ pAvailThesSvcs.reset(new SvcInfoArray);
+
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
+ if (xEnumAccess.is())
+ xEnum = xEnumAccess->createContentEnumeration( SN_THESAURUS );
+
+ if (!xEnum.is())
+ return;
- uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xContext->getServiceManager(), uno::UNO_QUERY );
- uno::Reference< container::XEnumeration > xEnum;
- if (xEnumAccess.is())
- xEnum = xEnumAccess->createContentEnumeration( SN_THESAURUS );
+ while (xEnum->hasMoreElements())
+ {
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
- if (xEnum.is())
+ uno::Reference< linguistic2::XThesaurus > xSvc;
+ xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
+ if (!xCompFactory.is())
+ {
+ xFactory.set(aCurrent, css::uno::UNO_QUERY);
+ }
+ if ( xCompFactory.is() || xFactory.is() )
{
- while (xEnum->hasMoreElements())
+ try
{
- uno::Any aCurrent = xEnum->nextElement();
- uno::Reference< lang::XSingleComponentFactory > xCompFactory;
- uno::Reference< lang::XSingleServiceFactory > xFactory;
-
- uno::Reference< linguistic2::XThesaurus > xSvc;
- xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
- if (!xCompFactory.is())
- {
- xFactory.set(aCurrent, css::uno::UNO_QUERY);
- }
- if ( xCompFactory.is() || xFactory.is() )
- {
- try
- {
- xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
- }
- catch (const uno::Exception &)
- {
- SAL_WARN( "linguistic", "createInstance failed" );
- }
- }
- if (xSvc.is())
- {
- OUString aImplName;
- std::vector< LanguageType > aLanguages;
- uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
- if (xInfo.is())
- aImplName = xInfo->getImplementationName();
- SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
- uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
- aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-
- pAvailThesSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
- }
+ xSvc.set( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
+ }
+ catch (const uno::Exception &)
+ {
+ SAL_WARN( "linguistic", "createInstance failed" );
}
}
+ if (xSvc.is())
+ {
+ OUString aImplName;
+ std::vector< LanguageType > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+ if (xInfo.is())
+ aImplName = xInfo->getImplementationName();
+ SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
+ uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
+ aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+
+ pAvailThesSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
+ }
}
}
@@ -1163,19 +1163,19 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
}
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
- if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
+ if (!(aNames.hasElements() && aNames.getLength() == aValues.getLength()))
+ return;
+
+ const OUString *pNames = aNames.getConstArray();
+ for (const uno::Any& rValue : aValues)
{
- const OUString *pNames = aNames.getConstArray();
- for (const uno::Any& rValue : aValues)
+ uno::Sequence< OUString > aSvcImplNames;
+ if (rValue >>= aSvcImplNames)
{
- uno::Sequence< OUString > aSvcImplNames;
- if (rValue >>= aSvcImplNames)
- {
- OUString aLocaleStr( *pNames++ );
- sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
- aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
- rSpellDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
- }
+ OUString aLocaleStr( *pNames++ );
+ sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
+ aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
+ rSpellDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
}
}
}
@@ -1196,23 +1196,23 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
}
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
- if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
+ if (!(aNames.hasElements() && aNames.getLength() == aValues.getLength()))
+ return;
+
+ const OUString *pNames = aNames.getConstArray();
+ for (const uno::Any& rValue : aValues)
{
- const OUString *pNames = aNames.getConstArray();
- for (const uno::Any& rValue : aValues)
+ uno::Sequence< OUString > aSvcImplNames;
+ if (rValue >>= aSvcImplNames)
{
- uno::Sequence< OUString > aSvcImplNames;
- if (rValue >>= aSvcImplNames)
- {
- // there should only be one grammar checker in use per language...
- if (aSvcImplNames.getLength() > 1)
- aSvcImplNames.realloc(1);
-
- OUString aLocaleStr( *pNames++ );
- sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
- aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
- rGrammarDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
- }
+ // there should only be one grammar checker in use per language...
+ if (aSvcImplNames.getLength() > 1)
+ aSvcImplNames.realloc(1);
+
+ OUString aLocaleStr( *pNames++ );
+ sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
+ aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
+ rGrammarDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
}
}
}
@@ -1233,23 +1233,23 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
}
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
- if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
+ if (!(aNames.hasElements() && aNames.getLength() == aValues.getLength()))
+ return;
+
+ const OUString *pNames = aNames.getConstArray();
+ for (const uno::Any& rValue : aValues)
{
- const OUString *pNames = aNames.getConstArray();
- for (const uno::Any& rValue : aValues)
+ uno::Sequence< OUString > aSvcImplNames;
+ if (rValue >>= aSvcImplNames)
{
- uno::Sequence< OUString > aSvcImplNames;
- if (rValue >>= aSvcImplNames)
- {
- // there should only be one hyphenator in use per language...
- if (aSvcImplNames.getLength() > 1)
- aSvcImplNames.realloc(1);
-
- OUString aLocaleStr( *pNames++ );
- sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
- aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
- rHyphDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
- }
+ // there should only be one hyphenator in use per language...
+ if (aSvcImplNames.getLength() > 1)
+ aSvcImplNames.realloc(1);
+
+ OUString aLocaleStr( *pNames++ );
+ sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
+ aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
+ rHyphDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
}
}
}
@@ -1270,19 +1270,19 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
}
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
- if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
+ if (!(aNames.hasElements() && aNames.getLength() == aValues.getLength()))
+ return;
+
+ const OUString *pNames = aNames.getConstArray();
+ for (const uno::Any& rValue : aValues)
{
- const OUString *pNames = aNames.getConstArray();
- for (const uno::Any& rValue : aValues)
+ uno::Sequence< OUString > aSvcImplNames;
+ if (rValue >>= aSvcImplNames)
{
- uno::Sequence< OUString > aSvcImplNames;
- if (rValue >>= aSvcImplNames)
- {
- OUString aLocaleStr( *pNames++ );
- sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
- aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
- rThesDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
- }
+ OUString aLocaleStr( *pNames++ );
+ sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
+ aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
+ rThesDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
}
}
}
@@ -1479,68 +1479,68 @@ void SAL_CALL
osl::MutexGuard aGuard( GetLinguMutex() );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
- if (!LinguIsUnspecified( nLanguage))
+ if (LinguIsUnspecified( nLanguage))
+ return;
+
+ if (rServiceName == SN_SPELLCHECKER)
{
- if (rServiceName == SN_SPELLCHECKER)
+ if (!mxSpellDsp.is())
+ GetSpellCheckerDsp_Impl();
+ bool bChanged = !IsEqSvcList( rServiceImplNames,
+ mxSpellDsp->GetServiceList( rLocale ) );
+ if (bChanged)
{
- if (!mxSpellDsp.is())
- GetSpellCheckerDsp_Impl();
- bool bChanged = !IsEqSvcList( rServiceImplNames,
- mxSpellDsp->GetServiceList( rLocale ) );
- if (bChanged)
- {
- mxSpellDsp->SetServiceList( rLocale, rServiceImplNames );
- SaveCfgSvcs( SN_SPELLCHECKER );
+ mxSpellDsp->SetServiceList( rLocale, rServiceImplNames );
+ SaveCfgSvcs( SN_SPELLCHECKER );
- if (mxListenerHelper)
- mxListenerHelper->AddLngSvcEvt(
- linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN |
- linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN );
- }
+ if (mxListenerHelper)
+ mxListenerHelper->AddLngSvcEvt(
+ linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN |
+ linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN );
}
- else if (rServiceName == SN_GRAMMARCHECKER)
+ }
+ else if (rServiceName == SN_GRAMMARCHECKER)
+ {
+ if (!mxGrammarDsp.is())
+ GetGrammarCheckerDsp_Impl();
+ bool bChanged = !IsEqSvcList( rServiceImplNames,
+ mxGrammarDsp->GetServiceList( rLocale ) );
+ if (bChanged)
{
- if (!mxGrammarDsp.is())
- GetGrammarCheckerDsp_Impl();
- bool bChanged = !IsEqSvcList( rServiceImplNames,
- mxGrammarDsp->GetServiceList( rLocale ) );
- if (bChanged)
- {
- mxGrammarDsp->SetServiceList( rLocale, rServiceImplNames );
- SaveCfgSvcs( SN_GRAMMARCHECKER );
+ mxGrammarDsp->SetServiceList( rLocale, rServiceImplNames );
+ SaveCfgSvcs( SN_GRAMMARCHECKER );
- if (mxListenerHelper)
- mxListenerHelper->AddLngSvcEvt(
- linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
- }
+ if (mxListenerHelper)
+ mxListenerHelper->AddLngSvcEvt(
+ linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
}
- else if (rServiceName == SN_HYPHENATOR)
+ }
+ else if (rServiceName == SN_HYPHENATOR)
+ {
+ if (!mxHyphDsp.is())
+ GetHyphenatorDsp_Impl();
+ bool bChanged = !IsEqSvcList( rServiceImplNames,
+ mxHyphDsp->GetServiceList( rLocale ) );
+ if (bChanged)
{
- if (!mxHyphDsp.is())
- GetHyphenatorDsp_Impl();
- bool bChanged = !IsEqSvcList( rServiceImplNames,
- mxHyphDsp->GetServiceList( rLocale ) );
- if (bChanged)
- {
- mxHyphDsp->SetServiceList( rLocale, rServiceImplNames );
- SaveCfgSvcs( SN_HYPHENATOR );
+ mxHyphDsp->SetServiceList( rLocale, rServiceImplNames );
+ SaveCfgSvcs( SN_HYPHENATOR );
- if (mxListenerHelper)
- mxListenerHelper->AddLngSvcEvt(
- linguistic2::LinguServiceEventFlags::HYPHENATE_AGAIN );
- }
+ if (mxListenerHelper)
+ mxListenerHelper->AddLngSvcEvt(
+ linguistic2::LinguServiceEventFlags::HYPHENATE_AGAIN );
}
- else if (rServiceName == SN_THESAURUS)
+ }
+ else if (rServiceName == SN_THESAURUS)
+ {
+ if (!mxThesDsp.is())
+ GetThesaurusDsp_Impl();
+ bool bChanged = !IsEqSvcList( rServiceImplNames,
+ mxThesDsp->GetServiceList( rLocale ) );
+ if (bChanged)
{
- if (!mxThesDsp.is())
- GetThesaurusDsp_Impl();
- bool bChanged = !IsEqSvcList( rServiceImplNames,
- mxThesDsp->GetServiceList( rLocale ) );
- if (bChanged)
- {
- mxThesDsp->SetServiceList( rLocale, rServiceImplNames );
- SaveCfgSvcs( SN_THESAURUS );
- }
+ mxThesDsp->SetServiceList( rLocale, rServiceImplNames );
+ SaveCfgSvcs( SN_THESAURUS );
}
}
}