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 <osl/mutex.hxx>
34 #include <osl/thread.h>
35 #include <unotools/pathoptions.hxx>
36 #include <unotools/lingucfg.hxx>
37 #include <unotools/resmgr.hxx>
38 
39 #include <rtl/string.hxx>
40 #include <rtl/ustrbuf.hxx>
41 #include <rtl/textenc.h>
42 
43 #include <svtools/strings.hrc>
44 
45 #include "nthesimp.hxx"
46 #include <linguistic/misc.hxx>
47 #include <linguistic/lngprops.hxx>
48 #include "nthesdta.hxx"
49 
50 #include <vector>
51 #include <set>
52 #include <string.h>
53 
54 // XML-header to query SPELLML support
55 #define SPELLML_SUPPORT "<?xml?>"
56 
57 using namespace osl;
58 using namespace com::sun::star;
59 using namespace com::sun::star::beans;
60 using namespace com::sun::star::lang;
61 using namespace com::sun::star::uno;
62 using namespace com::sun::star::linguistic2;
63 using namespace linguistic;
64 
65 static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
66 {
67  uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
68  uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create( xContext ) ;
69  return xRes;
70 }
71 
73  aEvtListeners ( GetLinguMutex() )
74 {
75  bDisposing = false;
76  pPropHelper = nullptr;
78 }
79 
81 {
82  mvThesInfo.clear();
83  if (pPropHelper)
84  {
86  }
87 }
88 
90 {
91  if (!pPropHelper)
92  {
93  Reference< XLinguProperties > xPropSet( GetLinguProperties(), UNO_QUERY );
94 
95  pPropHelper = new PropertyHelper_Thesaurus( static_cast<XThesaurus *>(this), xPropSet );
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  sal_Int32 nLen = aFormatList.getLength();
117  for (sal_Int32 i = 0; i < nLen; ++i)
118  {
119  std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
120  aLinguCfg.GetActiveDictionariesByFormat( aFormatList[i] ) );
121  aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
122  }
123 
127  std::vector< SvtLinguConfigDictionaryEntry > aOldStyleDics(
128  GetOldStyleDics( "THES" ) );
129 
130  // to prefer dictionaries with configuration entries we will only
131  // use those old style dictionaries that add a language that
132  // is not yet supported by the list od new style dictionaries
133  MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
134 
135  sal_Int32 numthes = aDics.size();
136  if (numthes)
137  {
138  // get supported locales from the dictionaries-to-use...
139  sal_Int32 k = 0;
140  std::set<OUString> aLocaleNamesSet;
141  for (auto const& dict : aDics)
142  {
143  uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
144  sal_Int32 nLen2 = aLocaleNames.getLength();
145  for (k = 0; k < nLen2; ++k)
146  {
148  continue;
149 
150  aLocaleNamesSet.insert( aLocaleNames[k] );
151  }
152  }
153  // ... and add them to the resulting sequence
154  aSuppLocales.realloc( aLocaleNamesSet.size() );
155  std::set<OUString>::const_iterator aItB;
156  k = 0;
157  for (auto const& localeName : aLocaleNamesSet)
158  {
159  Locale aTmp( LanguageTag::convertToLocale(localeName));
160  aSuppLocales[k++] = aTmp;
161  }
162 
168  numthes = 0;
169  for (auto const& dict : aDics)
170  numthes = numthes + dict.aLocaleNames.getLength();
171 
172  // add dictionary information
173  mvThesInfo.resize(numthes);
174 
175  k = 0;
176  for (auto const& dict : aDics)
177  {
178  if (dict.aLocaleNames.hasElements() &&
179  dict.aLocations.hasElements())
180  {
181  uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
182  sal_Int32 nLocales = aLocaleNames.getLength();
183 
184  // currently only one language per dictionary is supported in the actual implementation...
185  // Thus here we work-around this by adding the same dictionary several times.
186  // Once for each of its supported locales.
187  for (sal_Int32 i = 0; i < nLocales; ++i)
188  {
189  LanguageTag aLanguageTag(dict.aLocaleNames[i]);
190  mvThesInfo[k].aEncoding = RTL_TEXTENCODING_DONTKNOW;
191  mvThesInfo[k].aLocale = aLanguageTag.getLocale();
192  mvThesInfo[k].aCharSetInfo.reset( new CharClass( aLanguageTag ) );
193  // also both files have to be in the same directory and the
194  // file names must only differ in the extension (.aff/.dic).
195  // Thus we use the first location only and strip the extension part.
196  OUString aLocation = dict.aLocations[0];
197  sal_Int32 nPos = aLocation.lastIndexOf( '.' );
198  aLocation = aLocation.copy( 0, nPos );
199  mvThesInfo[k].aName = aLocation;
200 
201  ++k;
202  }
203  }
204  }
205  DBG_ASSERT( k == numthes, "index mismatch?" );
206  }
207  else
208  {
209  /* no dictionary found so register no dictionaries */
210  mvThesInfo.clear();
211  aSuppLocales.realloc(0);
212  }
213  }
214 
215  return aSuppLocales;
216 }
217 
218 sal_Bool SAL_CALL Thesaurus::hasLocale(const Locale& rLocale)
219 {
220  MutexGuard aGuard( GetLinguMutex() );
221 
222  bool bRes = false;
223  if (!aSuppLocales.hasElements())
224  getLocales();
225  sal_Int32 nLen = aSuppLocales.getLength();
226  for (sal_Int32 i = 0; i < nLen; ++i)
227  {
228  const Locale *pLocale = aSuppLocales.getConstArray();
229  if (rLocale == pLocale[i])
230  {
231  bRes = true;
232  break;
233  }
234  }
235  return bRes;
236 }
237 
239  const OUString& qTerm, const Locale& rLocale,
240  const css::uno::Sequence< css::beans::PropertyValue >& rProperties)
241 {
242  MutexGuard aGuard( GetLinguMutex() );
243 
244  uno::Sequence< Reference< XMeaning > > aMeanings( 1 );
245  uno::Sequence< Reference< XMeaning > > noMeanings( 0 );
246  uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() );
247  uno::Reference< XSpellChecker1 > xSpell;
248 
249  OUString aRTerm(qTerm);
250  OUString aPTerm(qTerm);
251  CapType ct = CapType::UNKNOWN;
252  sal_Int32 stem = 0;
253  sal_Int32 stem2 = 0;
254 
255  LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
256 
257  if (LinguIsUnspecified( nLanguage) || aRTerm.isEmpty())
258  return noMeanings;
259 
260  if (!hasLocale( rLocale ))
261 #ifdef LINGU_EXCEPTIONS
262  throw( IllegalArgumentException() );
263 #else
264  return noMeanings;
265 #endif
266 
267  if (prevTerm == qTerm && prevLocale == nLanguage)
268  return prevMeanings;
269 
270  mentry * pmean = nullptr;
271  sal_Int32 nmean = 0;
272 
274  rHelper.SetTmpPropVals( rProperties );
275 
276  MyThes * pTH = nullptr;
277  rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
278  CharClass * pCC = nullptr;
279 
280  // find the first thesaurus that matches the locale
281  for (size_t i =0; i < mvThesInfo.size(); i++)
282  {
283  if (rLocale == mvThesInfo[i].aLocale)
284  {
285  // open up and initialize this thesaurus if need be
286  if (!mvThesInfo[i].aThes)
287  {
288  OUString datpath = mvThesInfo[i].aName + ".dat";
289  OUString idxpath = mvThesInfo[i].aName + ".idx";
290  OUString ndat;
291  OUString nidx;
292  osl::FileBase::getSystemPathFromFileURL(datpath,ndat);
293  osl::FileBase::getSystemPathFromFileURL(idxpath,nidx);
294 
295 #if defined(_WIN32)
296  // MyThes waits UTF-8 encoded paths with \\?\ long path prefix.
297  OString aTmpidx = Win_AddLongPathPrefix(OUStringToOString(nidx, RTL_TEXTENCODING_UTF8));
298  OString aTmpdat = Win_AddLongPathPrefix(OUStringToOString(ndat, RTL_TEXTENCODING_UTF8));
299 #else
300  OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding()));
301  OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding()));
302 #endif
303 
304  mvThesInfo[i].aThes.reset( new MyThes(aTmpidx.getStr(),aTmpdat.getStr()) );
305  mvThesInfo[i].aEncoding = getTextEncodingFromCharset(mvThesInfo[i].aThes->get_th_encoding());
306  }
307  pTH = mvThesInfo[i].aThes.get();
308  eEnc = mvThesInfo[i].aEncoding;
309  pCC = mvThesInfo[i].aCharSetInfo.get();
310 
311  if (pTH)
312  break;
313  }
314  }
315 
316  // we don't want to work with a default text encoding since following incorrect
317  // results may occur only for specific text and thus may be hard to notice.
318  // Thus better always make a clean exit here if the text encoding is in question.
319  // Hopefully something not working at all will raise proper attention quickly. ;-)
320  DBG_ASSERT( eEnc != RTL_TEXTENCODING_DONTKNOW, "failed to get text encoding! (maybe incorrect encoding string in file)" );
321  if (eEnc == RTL_TEXTENCODING_DONTKNOW)
322  return noMeanings;
323 
324  while (pTH)
325  {
326  // convert word to all lower case for searching
327  if (!stem)
328  ct = capitalType(aRTerm, pCC);
329  OUString nTerm(makeLowerCase(aRTerm, pCC));
330  OString aTmp( OU2ENC(nTerm, eEnc) );
331  nmean = pTH->Lookup(aTmp.getStr(),aTmp.getLength(),&pmean);
332 
333  if (nmean)
334  aMeanings.realloc( nmean );
335 
336  mentry * pe = pmean;
337  OUString codeTerm = qTerm;
339 
340  if (stem)
341  {
342  xTmpRes2 = xSpell->spell( "<?xml?><query type='analyze'><word>" +
343  aPTerm + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
344  if (xTmpRes2.is())
345  {
346  Sequence<OUString>seq = xTmpRes2->getAlternatives();
347  if (seq.hasElements())
348  {
349  codeTerm = seq[0];
350  stem2 = 1;
351  }
352  }
353  }
354 
355  for (int j = 0; j < nmean; j++)
356  {
357  int count = pe->count;
358  if (count)
359  {
360  Sequence< OUString > aStr( count );
361  OUString *pStr = aStr.getArray();
362 
363  for (int i=0; i < count; i++)
364  {
365  OUString sTerm(pe->psyns[i],strlen(pe->psyns[i]),eEnc );
366  sal_Int32 catpos = sTerm.indexOf('(');
367  OUString catst;
368  if (catpos > 2)
369  {
370  // remove category name for affixation and casing
371  catst = " " + sTerm.copy(catpos);
372  sTerm = sTerm.copy(0, catpos);
373  sTerm = sTerm.trim();
374  }
375  // generate synonyms with affixes
376  if (stem && stem2)
377  {
379  xTmpRes = xSpell->spell( "<?xml?><query type='generate'><word>" +
380  sTerm + "</word>" + codeTerm + "</query>", static_cast<sal_uInt16>(nLanguage), rProperties );
381  if (xTmpRes.is())
382  {
383  Sequence<OUString>seq = xTmpRes->getAlternatives();
384  if (seq.hasElements())
385  sTerm = seq[0];
386  }
387  }
388 
389  CapType ct1 = capitalType(sTerm, pCC);
390  if (CapType::MIXED == ct1)
391  ct = ct1;
392  OUString cTerm;
393  switch (ct)
394  {
395  case CapType::ALLCAP:
396  cTerm = makeUpperCase(sTerm, pCC);
397  break;
398  case CapType::INITCAP:
399  cTerm = makeInitCap(sTerm, pCC);
400  break;
401  default:
402  cTerm = sTerm;
403  break;
404  }
405  OUString aAlt( cTerm + catst);
406  pStr[i] = aAlt;
407  }
408  Meaning * pMn = new Meaning(aRTerm);
409  OUString dTerm(pe->defn,strlen(pe->defn),eEnc );
410  pMn->SetMeaning(dTerm);
411  pMn->SetSynonyms(aStr);
412  Reference<XMeaning>* pMeaning = aMeanings.getArray();
413  pMeaning[j] = pMn;
414  }
415  pe++;
416  }
417  pTH->CleanUpAfterLookup(&pmean,nmean);
418 
419  if (nmean)
420  {
421  prevTerm = qTerm;
422  prevMeanings = aMeanings;
423  prevLocale = nLanguage;
424  return aMeanings;
425  }
426 
427  if (stem || !xLngSvcMgr.is())
428  return noMeanings;
429  stem = 1;
430 
431  xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
432  if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, static_cast<sal_uInt16>(nLanguage), rProperties ))
433  return noMeanings;
435  xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
436  aRTerm + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
437  if (xTmpRes.is())
438  {
439  Sequence<OUString>seq = xTmpRes->getAlternatives();
440  if (seq.hasElements())
441  {
442  aRTerm = seq[0]; // XXX Use only the first stem
443  continue;
444  }
445  }
446 
447  // stem the last word of the synonym (for categories after affixation)
448  aRTerm = aRTerm.trim();
449  sal_Int32 pos = aRTerm.lastIndexOf(' ');
450  if (!pos)
451  return noMeanings;
452  xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
453  aRTerm.copy(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
454  if (xTmpRes.is())
455  {
456  Sequence<OUString>seq = xTmpRes->getAlternatives();
457  if (seq.hasElements())
458  {
459  aPTerm = aRTerm.copy(pos + 1);
460  aRTerm = aRTerm.copy(0, pos + 1) + seq[0];
461 #if 0
462  for (int i = 0; i < seq.getLength(); i++)
463  {
464  OString o = OUStringToOString(seq[i], RTL_TEXTENCODING_UTF8);
465  fprintf(stderr, "%d: %s\n", i + 1, o.pData->buffer);
466  }
467 #endif
468  continue;
469  }
470  }
471  break;
472  }
473  return noMeanings;
474 }
475 
478  const Reference< XMultiServiceFactory > & /*rSMgr*/ )
479 {
480  Reference< XInterface > xService = static_cast<cppu::OWeakObject*>(new Thesaurus);
481  return xService;
482 }
483 
484 OUString SAL_CALL Thesaurus::getServiceDisplayName(const Locale& rLocale)
485 {
486  std::locale loc(Translate::Create("svt", LanguageTag(rLocale)));
487  return Translate::get(STR_DESCRIPTION_MYTHES, loc);
488 }
489 
490 void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments )
491 {
492  MutexGuard aGuard( GetLinguMutex() );
493 
494  if (!pPropHelper)
495  {
496  sal_Int32 nLen = rArguments.getLength();
497  if (1 == nLen)
498  {
500  rArguments.getConstArray()[0] >>= xPropSet;
501 
506  pPropHelper = new PropertyHelper_Thesaurus( static_cast<XThesaurus *>(this), xPropSet );
508  }
509  else
510  OSL_FAIL( "wrong number of arguments in sequence" );
511  }
512 }
513 
514 OUString Thesaurus::makeLowerCase(const OUString& aTerm, CharClass const * pCC)
515 {
516  if (pCC)
517  return pCC->lowercase(aTerm);
518  return aTerm;
519 }
520 
521 OUString Thesaurus::makeUpperCase(const OUString& aTerm, CharClass const * pCC)
522 {
523  if (pCC)
524  return pCC->uppercase(aTerm);
525  return aTerm;
526 }
527 
528 OUString Thesaurus::makeInitCap(const OUString& aTerm, CharClass const * pCC)
529 {
530  sal_Int32 tlen = aTerm.getLength();
531  if (pCC && tlen)
532  {
533  OUString bTemp = aTerm.copy(0,1);
534  if (tlen > 1)
535  {
536  return ( pCC->uppercase(bTemp, 0, 1)
537  + pCC->lowercase(aTerm,1,(tlen-1)) );
538  }
539 
540  return pCC->uppercase(bTemp, 0, 1);
541  }
542  return aTerm;
543 }
544 
545 void SAL_CALL Thesaurus::dispose()
546 {
547  MutexGuard aGuard( GetLinguMutex() );
548 
549  if (!bDisposing)
550  {
551  bDisposing = true;
552  EventObject aEvtObj( static_cast<XThesaurus *>(this) );
553  aEvtListeners.disposeAndClear( aEvtObj );
554  if (pPropHelper)
555  {
557  delete pPropHelper;
558  pPropHelper = nullptr;
559  }
560  }
561 }
562 
564 {
565  MutexGuard aGuard( GetLinguMutex() );
566 
567  if (!bDisposing && rxListener.is())
568  aEvtListeners.addInterface( rxListener );
569 }
570 
572 {
573  MutexGuard aGuard( GetLinguMutex() );
574 
575  if (!bDisposing && rxListener.is())
576  aEvtListeners.removeInterface( rxListener );
577 }
578 
579 // Service specific part
581 {
583 }
584 
585 sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName )
586 {
587  return cppu::supportsService(this, ServiceName);
588 }
589 
591 {
593 }
594 
596  throw()
597 {
599  return aSNS;
600 }
601 
602 extern "C"
603 {
604 SAL_DLLPUBLIC_EXPORT void * lnth_component_getFactory(
605  const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
606 {
607  void * pRet = nullptr;
608  if ( Thesaurus::getImplementationName_Static().equalsAscii( pImplName ) )
609  {
610 
613  static_cast< XMultiServiceFactory * >( pServiceManager ),
617  // acquire, because we return an interface pointer instead of a reference
618  xFactory->acquire();
619  pRet = xFactory.get();
620  }
621  return pRet;
622 }
623 }
624 
625 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT void * lnth_component_getFactory(const sal_Char *pImplName, void *pServiceManager, void *)
Definition: nthesimp.cxx:604
#define SPELLML_SUPPORT
Definition: nthesimp.cxx:55
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:521
const char * pLocale
virtual void SAL_CALL dispose() override
Definition: nthesimp.cxx:545
linguistic::PropertyHelper_Thesaurus & GetPropHelper_Impl()
Definition: nthesimp.cxx:89
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
std::locale Create(const sal_Char *pPrefixName, const LanguageTag &rLocale)
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:514
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
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
char sal_Char
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:571
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: nthesimp.cxx:590
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)
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:238
int i
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: nthesimp.cxx:490
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:528
static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
Definition: nthesimp.cxx:65
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:585
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: nthesimp.cxx:563
static Reference< XInterface > Thesaurus_CreateInstance(const Reference< XMultiServiceFactory > &)
Definition: nthesimp.cxx:477
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: nthesimp.cxx:484
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:218
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
#define SN_THESAURUS
linguistic::PropertyHelper_Thesaurus * pPropHelper
Definition: nthesimp.hxx:69
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()
void SetTmpPropVals(const css::beans::PropertyValues &rPropVals)
uno::Reference< XLinguProperties > GetLinguProperties()
Sequence< Reference< css::linguistic2::XMeaning > > prevMeanings
Definition: nthesimp.hxx:82
OUString get(const char *pContextAndId, const std::locale &loc)
CapType capitalType(const OUString &aTerm, CharClass const *pCC)
sal_Int32 nPos
aStr
virtual OUString SAL_CALL getImplementationName() override
Definition: nthesimp.cxx:580
static Sequence< OUString > getSupportedServiceNames_Static()
Definition: nthesimp.cxx:595
rtl_TextEncoding getTextEncodingFromCharset(const sal_Char *pCharset)
Definition: lingutil.cxx:275
::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)