LibreOffice Module lingucomponent (master)  1
nthesimp.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <com/sun/star/uno/Reference.h>
21 #include <cppuhelper/factory.hxx>
23 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
24 #include <com/sun/star/registry/XRegistryKey.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
27 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
28 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
30 #include <tools/debug.hxx>
31 #include <comphelper/lok.hxx>
33 #include <comphelper/sequence.hxx>
34 #include <osl/mutex.hxx>
35 #include <osl/thread.h>
36 #include <unotools/pathoptions.hxx>
37 #include <unotools/lingucfg.hxx>
38 #include <unotools/resmgr.hxx>
39 
40 #include <rtl/string.hxx>
41 #include <rtl/ustrbuf.hxx>
42 #include <rtl/textenc.h>
43 
44 #include <svtools/strings.hrc>
45 
46 #include "nthesimp.hxx"
47 #include <linguistic/misc.hxx>
48 #include <linguistic/lngprops.hxx>
49 #include "nthesdta.hxx"
50 
51 #include <vector>
52 #include <numeric>
53 #include <set>
54 #include <string.h>
55 
56 // XML-header to query SPELLML support
57 #define SPELLML_SUPPORT "<?xml?>"
58 
59 using namespace osl;
60 using namespace com::sun::star;
61 using namespace com::sun::star::beans;
62 using namespace com::sun::star::lang;
63 using namespace com::sun::star::uno;
64 using namespace com::sun::star::linguistic2;
65 using namespace linguistic;
66 
67 static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
68 {
69  uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
70  uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ;
71  return xRes;
72 }
73 
75  aEvtListeners ( GetLinguMutex() ), pPropHelper(nullptr), bDisposing(false),
76  prevLocale(LANGUAGE_DONTKNOW)
77 {
78 }
79 
81 {
82  mvThesInfo.clear();
83  if (pPropHelper)
84  {
85  pPropHelper->RemoveAsPropListener();
86  }
87 }
88 
89 PropertyHelper_Thesaurus& Thesaurus::GetPropHelper_Impl()
90 {
91  if (!pPropHelper)
92  {
94 
95  pPropHelper = new PropertyHelper_Thesaurus( static_cast<XThesaurus *>(this), xPropSet );
96  pPropHelper->AddAsPropListener();
97  }
98  return *pPropHelper;
99 }
100 
102 {
103  MutexGuard aGuard( GetLinguMutex() );
104 
105  // this routine should return the locales supported by the installed
106  // dictionaries.
107  if (mvThesInfo.empty())
108  {
109  SvtLinguConfig aLinguCfg;
110 
111  // get list of dictionaries-to-use
112  std::vector< SvtLinguConfigDictionaryEntry > aDics;
113  uno::Sequence< OUString > aFormatList;
114  aLinguCfg.GetSupportedDictionaryFormatsFor( "Thesauri",
115  "org.openoffice.lingu.new.Thesaurus", aFormatList );
116  for (const auto& rFormat : std::as_const(aFormatList))
117  {
118  std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
119  aLinguCfg.GetActiveDictionariesByFormat( rFormat ) );
120  aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
121  }
122 
126  std::vector< SvtLinguConfigDictionaryEntry > aOldStyleDics(
127  GetOldStyleDics( "THES" ) );
128 
129  // to prefer dictionaries with configuration entries we will only
130  // use those old style dictionaries that add a language that
131  // is not yet supported by the list of new style dictionaries
132  MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
133 
134  if (!aDics.empty())
135  {
136  // get supported locales from the dictionaries-to-use...
137  std::set<OUString> aLocaleNamesSet;
138  for (auto const& dict : aDics)
139  {
140  for (const auto& rLocaleName : dict.aLocaleNames)
141  {
143  continue;
144 
145  aLocaleNamesSet.insert( rLocaleName );
146  }
147  }
148  // ... and add them to the resulting sequence
149  std::vector<Locale> aLocalesVec;
150  aLocalesVec.reserve(aLocaleNamesSet.size());
151 
152  std::transform(aLocaleNamesSet.begin(), aLocaleNamesSet.end(), std::back_inserter(aLocalesVec),
153  [](const OUString& localeName) -> Locale { return LanguageTag::convertToLocale(localeName); });
154 
156 
162  sal_Int32 numthes = std::accumulate(aDics.begin(), aDics.end(), 0,
163  [](const sal_Int32 nSum, const SvtLinguConfigDictionaryEntry& dict) {
164  return nSum + dict.aLocaleNames.getLength(); });
165 
166  // add dictionary information
167  mvThesInfo.resize(numthes);
168 
169  sal_Int32 k = 0;
170  for (auto const& dict : aDics)
171  {
172  if (dict.aLocaleNames.hasElements() &&
173  dict.aLocations.hasElements())
174  {
175  // currently only one language per dictionary is supported in the actual implementation...
176  // Thus here we work-around this by adding the same dictionary several times.
177  // Once for each of its supported locales.
178  for (const auto& rLocaleName : dict.aLocaleNames)
179  {
180  LanguageTag aLanguageTag(rLocaleName);
181  mvThesInfo[k].aEncoding = RTL_TEXTENCODING_DONTKNOW;
182  mvThesInfo[k].aLocale = aLanguageTag.getLocale();
183  mvThesInfo[k].aCharSetInfo.reset( new CharClass( aLanguageTag ) );
184  // also both files have to be in the same directory and the
185  // file names must only differ in the extension (.aff/.dic).
186  // Thus we use the first location only and strip the extension part.
187  OUString aLocation = dict.aLocations[0];
188  sal_Int32 nPos = aLocation.lastIndexOf( '.' );
189  aLocation = aLocation.copy( 0, nPos );
190  mvThesInfo[k].aName = aLocation;
191 
192  ++k;
193  }
194  }
195  }
196  DBG_ASSERT( k == numthes, "index mismatch?" );
197  }
198  else
199  {
200  /* no dictionary found so register no dictionaries */
201  mvThesInfo.clear();
202  aSuppLocales.realloc(0);
203  }
204  }
205 
206  return aSuppLocales;
207 }
208 
209 sal_Bool SAL_CALL Thesaurus::hasLocale(const Locale& rLocale)
210 {
211  MutexGuard aGuard( GetLinguMutex() );
212 
213  if (!aSuppLocales.hasElements())
214  getLocales();
215 
216  return comphelper::findValue(aSuppLocales, rLocale) != -1;
217 }
218 
220  const OUString& qTerm, const Locale& rLocale,
221  const css::uno::Sequence< css::beans::PropertyValue >& rProperties)
222 {
223  MutexGuard aGuard( GetLinguMutex() );
224 
225  uno::Sequence< Reference< XMeaning > > aMeanings( 1 );
226  uno::Sequence< Reference< XMeaning > > noMeanings( 0 );
227  uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() );
228  uno::Reference< XSpellChecker1 > xSpell;
229 
230  OUString aRTerm(qTerm);
231  OUString aPTerm(qTerm);
232  CapType ct = CapType::UNKNOWN;
233  sal_Int32 stem = 0;
234  sal_Int32 stem2 = 0;
235 
236  LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
237 
238  if (LinguIsUnspecified( nLanguage) || aRTerm.isEmpty())
239  return noMeanings;
240 
241  if (!hasLocale( rLocale ))
242 #ifdef LINGU_EXCEPTIONS
243  throw( IllegalArgumentException() );
244 #else
245  return noMeanings;
246 #endif
247 
248  if (prevTerm == qTerm && prevLocale == nLanguage)
249  return prevMeanings;
250 
251  mentry * pmean = nullptr;
252  sal_Int32 nmean = 0;
253 
254  PropertyHelper_Thesaurus &rHelper = GetPropHelper();
255  rHelper.SetTmpPropVals( rProperties );
256 
257  MyThes * pTH = nullptr;
258  rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
259  CharClass * pCC = nullptr;
260 
261  // find the first thesaurus that matches the locale
262  for (size_t i =0; i < mvThesInfo.size(); i++)
263  {
264  if (rLocale == mvThesInfo[i].aLocale)
265  {
266  // open up and initialize this thesaurus if need be
267  if (!mvThesInfo[i].aThes)
268  {
269  OUString datpath = mvThesInfo[i].aName + ".dat";
270  OUString idxpath = mvThesInfo[i].aName + ".idx";
271  OUString ndat;
272  OUString nidx;
273  osl::FileBase::getSystemPathFromFileURL(datpath,ndat);
274  osl::FileBase::getSystemPathFromFileURL(idxpath,nidx);
275 
276 #if defined(_WIN32)
277  // MyThes waits UTF-8 encoded paths with \\?\ long path prefix.
278  OString aTmpidx = Win_AddLongPathPrefix(OUStringToOString(nidx, RTL_TEXTENCODING_UTF8));
279  OString aTmpdat = Win_AddLongPathPrefix(OUStringToOString(ndat, RTL_TEXTENCODING_UTF8));
280 #else
281  OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding()));
282  OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding()));
283 #endif
284 
285  mvThesInfo[i].aThes.reset( new MyThes(aTmpidx.getStr(),aTmpdat.getStr()) );
286  mvThesInfo[i].aEncoding = getTextEncodingFromCharset(mvThesInfo[i].aThes->get_th_encoding());
287  }
288  pTH = mvThesInfo[i].aThes.get();
289  eEnc = mvThesInfo[i].aEncoding;
290  pCC = mvThesInfo[i].aCharSetInfo.get();
291 
292  if (pTH)
293  break;
294  }
295  }
296 
297  // we don't want to work with a default text encoding since following incorrect
298  // results may occur only for specific text and thus may be hard to notice.
299  // Thus better always make a clean exit here if the text encoding is in question.
300  // Hopefully something not working at all will raise proper attention quickly. ;-)
301  DBG_ASSERT( eEnc != RTL_TEXTENCODING_DONTKNOW, "failed to get text encoding! (maybe incorrect encoding string in file)" );
302  if (eEnc == RTL_TEXTENCODING_DONTKNOW)
303  return noMeanings;
304 
305  while (pTH)
306  {
307  // convert word to all lower case for searching
308  if (!stem)
309  ct = capitalType(aRTerm, pCC);
310  OUString nTerm(makeLowerCase(aRTerm, pCC));
311  OString aTmp( OU2ENC(nTerm, eEnc) );
312  nmean = pTH->Lookup(aTmp.getStr(),aTmp.getLength(),&pmean);
313 
314  if (nmean)
315  aMeanings.realloc( nmean );
316 
317  mentry * pe = pmean;
318  OUString codeTerm = qTerm;
320 
321  if (stem)
322  {
323  xTmpRes2 = xSpell->spell( "<?xml?><query type='analyze'><word>" +
324  aPTerm + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
325  if (xTmpRes2.is())
326  {
327  Sequence<OUString>seq = xTmpRes2->getAlternatives();
328  if (seq.hasElements())
329  {
330  codeTerm = seq[0];
331  stem2 = 1;
332  }
333  }
334  }
335 
336  for (int j = 0; j < nmean; j++)
337  {
338  int count = pe->count;
339  if (count)
340  {
341  Sequence< OUString > aStr( count );
342  OUString *pStr = aStr.getArray();
343 
344  for (int i=0; i < count; i++)
345  {
346  OUString sTerm(pe->psyns[i],strlen(pe->psyns[i]),eEnc );
347  sal_Int32 catpos = sTerm.indexOf('(');
348  OUString catst;
349  if (catpos > 2)
350  {
351  // remove category name for affixation and casing
352  catst = " " + sTerm.copy(catpos);
353  sTerm = sTerm.copy(0, catpos);
354  sTerm = sTerm.trim();
355  }
356  // generate synonyms with affixes
357  if (stem && stem2)
358  {
359  Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "<?xml?><query type='generate'><word>" +
360  sTerm + "</word>" + codeTerm + "</query>", static_cast<sal_uInt16>(nLanguage), rProperties );
361  if (xTmpRes.is())
362  {
363  Sequence<OUString>seq = xTmpRes->getAlternatives();
364  if (seq.hasElements())
365  sTerm = seq[0];
366  }
367  }
368 
369  CapType ct1 = capitalType(sTerm, pCC);
370  if (CapType::MIXED == ct1)
371  ct = ct1;
372  OUString cTerm;
373  switch (ct)
374  {
375  case CapType::ALLCAP:
376  cTerm = makeUpperCase(sTerm, pCC);
377  break;
378  case CapType::INITCAP:
379  cTerm = makeInitCap(sTerm, pCC);
380  break;
381  default:
382  cTerm = sTerm;
383  break;
384  }
385  OUString aAlt( cTerm + catst);
386  pStr[i] = aAlt;
387  }
388  Meaning * pMn = new Meaning(aRTerm);
389  OUString dTerm(pe->defn,strlen(pe->defn),eEnc );
390  pMn->SetMeaning(dTerm);
391  pMn->SetSynonyms(aStr);
392  Reference<XMeaning>* pMeaning = aMeanings.getArray();
393  pMeaning[j] = pMn;
394  }
395  pe++;
396  }
397  pTH->CleanUpAfterLookup(&pmean,nmean);
398 
399  if (nmean)
400  {
401  prevTerm = qTerm;
402  prevMeanings = aMeanings;
403  prevLocale = nLanguage;
404  return aMeanings;
405  }
406 
407  if (stem || !xLngSvcMgr.is())
408  return noMeanings;
409  stem = 1;
410 
411  xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
412  if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, static_cast<sal_uInt16>(nLanguage), rProperties ))
413  return noMeanings;
414  Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
415  aRTerm + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
416  if (xTmpRes.is())
417  {
418  Sequence<OUString>seq = xTmpRes->getAlternatives();
419  if (seq.hasElements())
420  {
421  aRTerm = seq[0]; // XXX Use only the first stem
422  continue;
423  }
424  }
425 
426  // stem the last word of the synonym (for categories after affixation)
427  aRTerm = aRTerm.trim();
428  sal_Int32 pos = aRTerm.lastIndexOf(' ');
429  if (!pos)
430  return noMeanings;
431  xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
432  aRTerm.copy(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
433  if (xTmpRes.is())
434  {
435  Sequence<OUString>seq = xTmpRes->getAlternatives();
436  if (seq.hasElements())
437  {
438  aPTerm = aRTerm.copy(pos + 1);
439  aRTerm = aRTerm.copy(0, pos + 1) + seq[0];
440 #if 0
441  for (int i = 0; i < seq.getLength(); i++)
442  {
443  OString o = OUStringToOString(seq[i], RTL_TEXTENCODING_UTF8);
444  fprintf(stderr, "%d: %s\n", i + 1, o.pData->buffer);
445  }
446 #endif
447  continue;
448  }
449  }
450  break;
451  }
452  return noMeanings;
453 }
454 
457  const Reference< XMultiServiceFactory > & /*rSMgr*/ )
458 {
459  Reference< XInterface > xService = static_cast<cppu::OWeakObject*>(new Thesaurus);
460  return xService;
461 }
462 
463 OUString SAL_CALL Thesaurus::getServiceDisplayName(const Locale& rLocale)
464 {
465  std::locale loc(Translate::Create("svt", LanguageTag(rLocale)));
466  return Translate::get(STR_DESCRIPTION_MYTHES, loc);
467 }
468 
469 void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments )
470 {
471  MutexGuard aGuard( GetLinguMutex() );
472 
473  if (!pPropHelper)
474  {
475  sal_Int32 nLen = rArguments.getLength();
476  if (1 == nLen)
477  {
479  rArguments.getConstArray()[0] >>= xPropSet;
480 
485  pPropHelper = new PropertyHelper_Thesaurus( static_cast<XThesaurus *>(this), xPropSet );
486  pPropHelper->AddAsPropListener();
487  }
488  else
489  OSL_FAIL( "wrong number of arguments in sequence" );
490  }
491 }
492 
493 OUString Thesaurus::makeLowerCase(const OUString& aTerm, CharClass const * pCC)
494 {
495  if (pCC)
496  return pCC->lowercase(aTerm);
497  return aTerm;
498 }
499 
500 OUString Thesaurus::makeUpperCase(const OUString& aTerm, CharClass const * pCC)
501 {
502  if (pCC)
503  return pCC->uppercase(aTerm);
504  return aTerm;
505 }
506 
507 OUString Thesaurus::makeInitCap(const OUString& aTerm, CharClass const * pCC)
508 {
509  sal_Int32 tlen = aTerm.getLength();
510  if (pCC && tlen)
511  {
512  OUString bTemp = aTerm.copy(0,1);
513  if (tlen > 1)
514  {
515  return ( pCC->uppercase(bTemp, 0, 1)
516  + pCC->lowercase(aTerm,1,(tlen-1)) );
517  }
518 
519  return pCC->uppercase(bTemp, 0, 1);
520  }
521  return aTerm;
522 }
523 
524 void SAL_CALL Thesaurus::dispose()
525 {
526  MutexGuard aGuard( GetLinguMutex() );
527 
528  if (!bDisposing)
529  {
530  bDisposing = true;
531  EventObject aEvtObj( static_cast<XThesaurus *>(this) );
532  aEvtListeners.disposeAndClear( aEvtObj );
533  if (pPropHelper)
534  {
535  pPropHelper->RemoveAsPropListener();
536  delete pPropHelper;
537  pPropHelper = nullptr;
538  }
539  }
540 }
541 
543 {
544  MutexGuard aGuard( GetLinguMutex() );
545 
546  if (!bDisposing && rxListener.is())
547  aEvtListeners.addInterface( rxListener );
548 }
549 
551 {
552  MutexGuard aGuard( GetLinguMutex() );
553 
554  if (!bDisposing && rxListener.is())
555  aEvtListeners.removeInterface( rxListener );
556 }
557 
558 // Service specific part
560 {
562 }
563 
564 sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName )
565 {
566  return cppu::supportsService(this, ServiceName);
567 }
568 
570 {
572 }
573 
575  throw()
576 {
578  return aSNS;
579 }
580 
581 extern "C"
582 {
583 SAL_DLLPUBLIC_EXPORT void * lnth_component_getFactory(
584  const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
585 {
586  void * pRet = nullptr;
587  if ( Thesaurus::getImplementationName_Static().equalsAscii( pImplName ) )
588  {
589 
592  static_cast< XMultiServiceFactory * >( pServiceManager ),
596  // acquire, because we return an interface pointer instead of a reference
597  xFactory->acquire();
598  pRet = xFactory.get();
599  }
600  return pRet;
601 }
602 }
603 
604 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SPELLML_SUPPORT
Definition: nthesimp.cxx:57
osl::Mutex & GetLinguMutex()
const size_t count(pCandidateA->getBorderLines().size())
bool isWhitelistedLanguage(const OUString &lang)
virtual Sequence< Locale > SAL_CALL getLocales() override
Definition: nthesimp.cxx:101
static OUString makeUpperCase(const OUString &, CharClass const *)
Definition: nthesimp.cxx:500
virtual void SAL_CALL dispose() override
Definition: nthesimp.cxx:524
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
linguistic::PropertyHelper_Thesaurus & GetPropHelper_Impl()
Definition: nthesimp.cxx:89
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
void SetSynonyms(const css::uno::Sequence< OUString > &rSyn)
Definition: nthesdta.cxx:64
void disposeAndClear(const css::lang::EventObject &rEvt)
std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics(const char *pDicType)
Definition: lingutil.cxx:137
static OUString makeLowerCase(const OUString &, CharClass const *)
Definition: nthesimp.cxx:493
LanguageType prevLocale
Definition: nthesimp.hxx:84
sal_Int32 removeInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
static OUString getImplementationName_Static()
Definition: nthesimp.hxx:133
rtl_TextEncoding getTextEncodingFromCharset(const char *pCharset)
Definition: lingutil.cxx:275
bool bDisposing
Definition: nthesimp.hxx:70
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat(const OUString &rFormatName) const
void SetMeaning(const OUString &rTerm)
Definition: nthesdta.cxx:70
std::vector< ThesInfo > mvThesInfo
Definition: nthesimp.hxx:79
SAL_DLLPUBLIC_EXPORT void * lnth_component_getFactory(const char *pImplName, void *pServiceManager, void *)
Definition: nthesimp.cxx:583
std::locale Create(const char *pPrefixName, const LanguageTag &rLocale)
size_t pos
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:550
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: nthesimp.cxx:569
Sequence< Locale > aSuppLocales
Definition: nthesimp.hxx:66
bool LinguIsUnspecified(LanguageType nLanguage)
bool GetSupportedDictionaryFormatsFor(const OUString &rSetName, const OUString &rSetEntry, css::uno::Sequence< OUString > &rFormatList) const
linguistic::PropertyHelper_Thesaurus & GetPropHelper()
Definition: nthesimp.hxx:90
CapType
OUString prevTerm
Definition: nthesimp.hxx:83
#define DBG_ASSERT(sCon, aError)
int i
virtual Sequence< Reference< css::linguistic2::XMeaning > > SAL_CALL queryMeanings(const OUString &rTerm, const Locale &rLocale, const css::uno::Sequence< css::beans::PropertyValue > &rProperties) override
Definition: nthesimp.cxx:219
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: nthesimp.cxx:469
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
unsigned char sal_Bool
#define LANGUAGE_DONTKNOW
static OUString makeInitCap(const OUString &, CharClass const *)
Definition: nthesimp.cxx:507
static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
Definition: nthesimp.cxx:67
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
virtual ~Thesaurus() override
Definition: nthesimp.cxx:80
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: nthesimp.cxx:564
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:542
static Reference< XInterface > Thesaurus_CreateInstance(const Reference< XMultiServiceFactory > &)
Definition: nthesimp.cxx:456
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: nthesimp.cxx:463
Reference< XSingleServiceFactory > SAL_CALL createOneInstanceFactory(const Reference< XMultiServiceFactory > &rServiceManager, const OUString &rImplementationName, ComponentInstantiation pCreateFunction, const Sequence< OUString > &rServiceNames, rtl_ModuleCount *)
virtual sal_Bool SAL_CALL hasLocale(const Locale &rLocale) override
Definition: nthesimp.cxx:209
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
#define SN_THESAURUS
linguistic::PropertyHelper_Thesaurus * pPropHelper
Definition: nthesimp.hxx:69
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
LanguageType LinguLocaleToLanguage(const css::lang::Locale &rLocale)
void MergeNewStyleDicsAndOldStyleDics(std::vector< SvtLinguConfigDictionaryEntry > &rNewStyleDics, const std::vector< SvtLinguConfigDictionaryEntry > &rOldStyleDics)
Definition: lingutil.cxx:232
Reference< XComponentContext > getProcessComponentContext()
uno::Reference< XLinguProperties > GetLinguProperties()
Sequence< Reference< css::linguistic2::XMeaning > > prevMeanings
Definition: nthesimp.hxx:82
Reference< XSingleServiceFactory > xFactory
OUString get(const char *pContextAndId, const std::locale &loc)
CapType capitalType(const OUString &aTerm, CharClass const *pCC)
aStr
virtual OUString SAL_CALL getImplementationName() override
Definition: nthesimp.cxx:559
sal_uInt16 nPos
static Sequence< OUString > getSupportedServiceNames_Static()
Definition: nthesimp.cxx:574
::comphelper::OInterfaceContainerHelper2 aEvtListeners
Definition: nthesimp.hxx:68
#define OU2ENC(rtlOUString, rtlEncoding)
Definition: lingutil.hxx:29
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)