25#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29#include <osl/mutex.hxx>
46 const Locale &rLocale )
48 return std::any_of(rRefs.begin(), rRefs.end(),
50 return rRef.is() && rRef->hasLocale( rLocale ); });
77 std::vector<Locale> aLocales;
78 aLocales.reserve(
aSvcMap.size());
80 std::transform(
aSvcMap.begin(),
aSvcMap.end(), std::back_inserter(aLocales),
81 [](ThesSvcByLangMap_t::const_reference elem) { return LanguageTag::convertToLocale(elem.first); });
98 const OUString& rTerm,
const Locale& rLocale,
99 const css::uno::Sequence< ::css::beans::PropertyValue >& rProperties )
110 ThesSvcByLangMap_t::iterator aIt(
aSvcMap.find( nLanguage ) );
120 sal_Int32 nLen = pEntry->
aSvcRefs.getLength();
122 "lng : sequence length mismatch");
124 "lng : index out of range");
131 while (i <= pEntry->nLastTriedSvcIndex
132 && !aMeanings.hasElements())
135 aMeanings = pRef[
i]->queryMeanings( aChkWord, rLocale, rProperties );
141 if (!aMeanings.hasElements()
144 const OUString *pImplNames = pEntry->
aSvcImplNames.getConstArray();
154 while (
i < nLen && !aMeanings.hasElements())
160 xThes.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
161 pImplNames[
i], aArgs, xContext ),
164 catch (uno::Exception &)
166 SAL_WARN(
"linguistic",
"createInstanceWithArguments failed" );
170 if (xThes.is() && xThes->hasLocale( rLocale ))
171 aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties );
179 if (
i == nLen && !aMeanings.hasElements())
198 sal_Int32 nLen = rSvcImplNames.getLength();
214 auto pTmpEntry = std::make_shared<LangSvcEntries_Thes>( rSvcImplNames );
216 aSvcMap[ nLanguage ] = pTmpEntry;
231 const ThesSvcByLangMap_t::const_iterator aIt(
aSvcMap.find( nLanguage ) );
virtual css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > SAL_CALL queryMeanings(const OUString &aTerm, const css::lang::Locale &aLocale, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
virtual ~ThesaurusDispatcher() override
std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t
virtual void SetServiceList(const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames) override
virtual sal_Bool SAL_CALL hasLocale(const css::lang::Locale &aLocale) override
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
virtual css::uno::Sequence< OUString > GetServiceList(const css::lang::Locale &rLocale) const override
const css::uno::Reference< css::linguistic2::XLinguProperties > & GetPropSet()
ThesSvcByLangMap_t aSvcMap
#define DBG_ASSERT(sCon, aError)
#define SAL_WARN(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
bool LinguIsUnspecified(LanguageType nLanguage)
Checks if a LanguageType is one of the values that denote absence of language or undetermined languag...
bool RemoveHyphens(OUString &rTxt)
bool RemoveControlChars(OUString &rTxt)
osl::Mutex & GetLinguMutex()
! multi-thread safe mutex for all platforms !!
bool IsIgnoreControlChars(const PropertyValues &rProperties, const uno::Reference< XPropertySet > &rxProp)
LanguageType LinguLocaleToLanguage(const css::lang::Locale &rLocale)
Convert Locale to LanguageType for legacy handling.
css::uno::Sequence< css::uno::Reference< css::linguistic2::XThesaurus > > aSvcRefs
css::uno::Sequence< OUString > aSvcImplNames
sal_Int16 nLastTriedSvcIndex
static bool SvcListHasLanguage(const Sequence< Reference< XThesaurus > > &rRefs, const Locale &rLocale)