LibreOffice Module lingucomponent (master) 1
macspellimp.mm
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
22#include <com/sun/star/linguistic2/SpellFailure.hpp>
23#include <com/sun/star/linguistic2/XLinguProperties.hpp>
26#include <cppuhelper/weak.hxx>
27#include <com/sun/star/registry/XRegistryKey.hpp>
28#include <com/sun/star/lang/XSingleServiceFactory.hpp>
29#include <tools/debug.hxx>
30#include <osl/mutex.hxx>
31
32#include "macspellimp.hxx"
33
37#include <osl/file.hxx>
38#include <rtl/ref.hxx>
39#include <rtl/ustrbuf.hxx>
40
41using namespace utl;
42using namespace osl;
43using namespace com::sun::star;
44using namespace com::sun::star::beans;
45using namespace com::sun::star::lang;
46using namespace com::sun::star::uno;
47using namespace com::sun::star::linguistic2;
48using namespace linguistic;
49
51 aEvtListeners( GetLinguMutex() )
52{
53 aDEncs = nullptr;
54 aDLocs = nullptr;
55 aDNames = nullptr;
56 bDisposing = false;
57 numdict = 0;
58#ifndef IOS
59 NSApplicationLoad();
60 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
61 macTag = [NSSpellChecker uniqueSpellDocumentTag];
62 [pool release];
63#else
64 pChecker = [[UITextChecker alloc] init];
65#endif
66}
67
68
70{
71 numdict = 0;
72 if (aDEncs) delete[] aDEncs;
73 aDEncs = nullptr;
74 if (aDLocs) delete[] aDLocs;
75 aDLocs = nullptr;
76 if (aDNames) delete[] aDNames;
77 aDNames = nullptr;
78 if (xPropHelper.is())
79 xPropHelper->RemoveAsPropListener();
80}
81
82
84{
85 if (!xPropHelper.is())
86 {
88
89 xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
90 xPropHelper->AddAsPropListener();
91 }
92 return *xPropHelper;
93}
94
95
97{
98 MutexGuard aGuard( GetLinguMutex() );
99
100 // this routine should return the locales supported by the installed
101 // dictionaries. So here we need to parse both the user edited
102 // dictionary list and the shared dictionary list
103 // to see what dictionaries the admin/user has installed
104
105 int numshr; // number of shared dictionary entries
106 rtl_TextEncoding aEnc = RTL_TEXTENCODING_UTF8;
107
108 std::vector<NSString *> postspdict;
109
110 if (!numdict) {
111
112 // invoke a dictionary manager to get the user dictionary list
113 // TODO How on macOS?
114
115 // invoke a second dictionary manager to get the shared dictionary list
116#ifdef MACOSX
117 NSArray *aSpellCheckLanguages = [[NSSpellChecker sharedSpellChecker] availableLanguages];
118#else
119 NSArray *aSpellCheckLanguages = [UITextChecker availableLanguages];
120#endif
121
122 for (NSUInteger i = 0; i < [aSpellCheckLanguages count]; i++)
123 {
124 NSString* pLangStr = static_cast<NSString*>([aSpellCheckLanguages objectAtIndex:i]);
125
126 // Fix up generic languages (without territory code) and odd combinations that LO
127 // doesn't handle.
128 if ([pLangStr isEqualToString:@"ar"])
129 {
130 const std::vector<NSString*> aAR
131 { @"AE", @"BH", @"DJ", @"DZ", @"EG", @"ER", @"IL", @"IQ", @"JO",
132 @"KM", @"KW", @"LB", @"LY", @"MA", @"MR", @"OM", @"PS", @"QA",
133 @"SA", @"SD", @"SO", @"SY", @"TD", @"TN", @"YE" };
134 for (auto c: aAR)
135 {
136 pLangStr = [@"ar_" stringByAppendingString: c];
137 postspdict.push_back( pLangStr );
138 }
139 }
140 else if ([pLangStr isEqualToString:@"da"])
141 {
142 postspdict.push_back( @"da_DK" );
143 }
144 else if ([pLangStr isEqualToString:@"de"])
145 {
146 // Not de_CH and de_LI, though. They need separate dictionaries.
147 const std::vector<NSString*> aDE
148 { @"AT", @"BE", @"DE", @"LU" };
149 for (auto c: aDE)
150 {
151 pLangStr = [@"de_" stringByAppendingString: c];
152 postspdict.push_back( pLangStr );
153 }
154 }
155#ifdef IOS
156 // iOS says it has specifically de_DE. Let's assume it is good enough for German as
157 // written in Austria, Belgium, and Luxembourg, too. (Not for German in Switzerland and
158 // Liechtenstein. For those you need to bundle the myspell dictionary.)
159 else if ([pLangStr isEqualToString:@"de_DE"])
160 {
161 const std::vector<NSString*> aDE
162 { @"AT", @"BE", @"DE", @"LU" };
163 for (auto c: aDE)
164 {
165 pLangStr = [@"de_" stringByAppendingString: c];
166 postspdict.push_back( pLangStr );
167 }
168 }
169#endif
170 else if ([pLangStr isEqualToString:@"en"])
171 {
172 // System has en_AU, en_CA, en_GB, and en_IN. Add the rest.
173 const std::vector<NSString*> aEN
174 { @"BW", @"BZ", @"GH", @"GM", @"IE", @"JM", @"MU", @"MW", @"MY", @"NA",
175 @"NZ", @"PH", @"TT", @"US", @"ZA", @"ZW" };
176 for (auto c: aEN)
177 {
178 pLangStr = [@"en_" stringByAppendingString: c];
179 postspdict.push_back( pLangStr );
180 }
181 }
182 else if ([pLangStr isEqualToString:@"en_JP"]
183 || [pLangStr isEqualToString:@"en_SG"])
184 {
185 // Just skip, LO doesn't have those yet in this context.
186 }
187 else if ([pLangStr isEqualToString:@"es"])
188 {
189 const std::vector<NSString*> aES
190 { @"AR", @"BO", @"CL", @"CO", @"CR", @"CU", @"DO", @"EC", @"ES", @"GT",
191 @"HN", @"MX", @"NI", @"PA", @"PE", @"PR", @"PY", @"SV", @"UY", @"VE" };
192 for (auto c: aES)
193 {
194 pLangStr = [@"es_" stringByAppendingString: c];
195 postspdict.push_back( pLangStr );
196 }
197 }
198 else if ([pLangStr isEqualToString:@"fi"])
199 {
200 postspdict.push_back( @"fi_FI" );
201 }
202 else if ([pLangStr isEqualToString:@"fr"])
203 {
204 const std::vector<NSString*> aFR
205 { @"BE", @"BF", @"BJ", @"CA", @"CH", @"CI", @"FR", @"LU", @"MC", @"ML",
206 @"MU", @"NE", @"SN", @"TG" };
207 for (auto c: aFR)
208 {
209 pLangStr = [@"fr_" stringByAppendingString: c];
210 postspdict.push_back( pLangStr );
211 }
212 }
213#ifdef IOS
214 else if ([pLangStr isEqualToString:@"fr_FR"])
215 {
216 const std::vector<NSString*> aFR
217 { @"BE", @"BF", @"BJ", @"CA", @"CH", @"CI", @"FR", @"LU", @"MC", @"ML",
218 @"MU", @"NE", @"SN", @"TG" };
219 for (auto c: aFR)
220 {
221 pLangStr = [@"fr_" stringByAppendingString: c];
222 postspdict.push_back( pLangStr );
223 }
224 }
225#endif
226 else if ([pLangStr isEqualToString:@"it"])
227 {
228 postspdict.push_back( @"it_CH" );
229 postspdict.push_back( @"it_IT" );
230 }
231#ifdef IOS
232 else if ([pLangStr isEqualToString:@"it_IT"])
233 {
234 const std::vector<NSString*> aIT
235 { @"CH", @"IT" };
236 for (auto c: aIT)
237 {
238 pLangStr = [@"it_" stringByAppendingString: c];
239 postspdict.push_back( pLangStr );
240 }
241 }
242#endif
243 else if ([pLangStr isEqualToString:@"ko"])
244 {
245 postspdict.push_back( @"ko_KR" );
246 }
247 else if ([pLangStr isEqualToString:@"nl"])
248 {
249 postspdict.push_back( @"nl_BE" );
250 postspdict.push_back( @"nl_NL" );
251 }
252 else if ([pLangStr isEqualToString:@"nb"])
253 {
254 postspdict.push_back( @"nb_NO" );
255 }
256 else if ([pLangStr isEqualToString:@"pl"])
257 {
258 postspdict.push_back( @"pl_PL" );
259 }
260 else if ([pLangStr isEqualToString:@"ru"])
261 {
262 postspdict.push_back( @"ru_RU" );
263 }
264 else if ([pLangStr isEqualToString:@"sv"])
265 {
266 postspdict.push_back( @"sv_FI" );
267 postspdict.push_back( @"sv_SE" );
268 }
269#ifdef IOS
270 else if ([pLangStr isEqualToString:@"sv_SE"])
271 {
272 postspdict.push_back( @"sv_FI" );
273 postspdict.push_back( @"sv_SE" );
274 }
275#endif
276 else if ([pLangStr isEqualToString:@"tr"])
277 {
278 postspdict.push_back( @"tr_TR" );
279 }
280 else
281 postspdict.push_back( pLangStr );
282 }
283 // System has pt_BR and pt_PT, add pt_AO.
284 postspdict.push_back( @"pt_AO" );
285
286 numshr = postspdict.size();
287
288 // we really should merge these and remove duplicates but since
289 // users can name their dictionaries anything they want it would
290 // be impossible to know if a real duplication exists unless we
291 // add some unique key to each myspell dictionary
292 numdict = numshr;
293
294 if (numdict) {
295 aDLocs = new Locale [numdict];
296 aDEncs = new rtl_TextEncoding [numdict];
297 aDNames = new OUString [numdict];
298 aSuppLocales.realloc(numdict);
299 Locale * pLocale = aSuppLocales.getArray();
300 int numlocs = 0;
301 int newloc;
302 int i,j;
303 int k = 0;
304
305 //first add the user dictionaries
306 //TODO for MAC?
307
308 // now add the shared dictionaries
309 for (i = 0; i < numshr; i++) {
310 NSDictionary *aLocDict = [ NSLocale componentsFromLocaleIdentifier:postspdict[i] ];
311 NSString* aLang = [ aLocDict objectForKey:NSLocaleLanguageCode ];
312 NSString* aCountry = [ aLocDict objectForKey:NSLocaleCountryCode ];
313 OUString lang([aLang cStringUsingEncoding: NSUTF8StringEncoding], [aLang length], aEnc);
314 OUString country([ aCountry cStringUsingEncoding: NSUTF8StringEncoding], [aCountry length], aEnc);
315 Locale nLoc( lang, country, OUString() );
316 newloc = 1;
317 //eliminate duplicates (is this needed for MacOS?)
318 for (j = 0; j < numlocs; j++) {
319 if (nLoc == pLocale[j]) newloc = 0;
320 }
321 if (newloc) {
322 pLocale[numlocs] = nLoc;
323 numlocs++;
324 }
325 aDLocs[k] = nLoc;
326 aDEncs[k] = 0;
327 k++;
328 }
329
330 aSuppLocales.realloc(numlocs);
331
332 } else {
333 /* no dictionary.lst found so register no dictionaries */
334 numdict = 0;
335 aDEncs = nullptr;
336 aDLocs = nullptr;
337 aDNames = nullptr;
338 aSuppLocales.realloc(0);
339 }
340 }
341
342 return aSuppLocales;
343}
344
345
346
347sal_Bool SAL_CALL MacSpellChecker::hasLocale(const Locale& rLocale)
348{
349 MutexGuard aGuard( GetLinguMutex() );
350
351 bool bRes = false;
352 if (!aSuppLocales.getLength())
353 getLocales();
354
355 sal_Int32 nLen = aSuppLocales.getLength();
356 for (sal_Int32 i = 0; i < nLen; ++i)
357 {
358 const Locale *pLocale = aSuppLocales.getConstArray();
359 if (rLocale == pLocale[i])
360 {
361 bRes = true;
362 break;
363 }
364 }
365 return bRes;
366}
367
368
369sal_Int16 MacSpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rLocale )
370{
371 // initialize a myspell object for each dictionary once
372 // (note: mutex is held higher up in isValid)
373
374
375 sal_Int16 nRes = -1;
376
377 // first handle smart quotes both single and double
378 OUStringBuffer rBuf(rWord);
379 sal_Int32 n = rBuf.getLength();
380 sal_Unicode c;
381 for (sal_Int32 ix=0; ix < n; ix++) {
382 c = rBuf[ix];
383 if ((c == 0x201C) || (c == 0x201D)) rBuf[ix] = u'"';
384 if ((c == 0x2018) || (c == 0x2019)) rBuf[ix] = u'\'';
385 }
386 OUString nWord(rBuf.makeStringAndClear());
387
388 if (n)
389 {
390 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
391 NSString* aNSStr = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(nWord.getStr()) length: nWord.getLength()]autorelease];
392 NSString* aLang = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Language.getStr()) length: rLocale.Language.getLength()]autorelease];
393 if(rLocale.Country.getLength()>0)
394 {
395 NSString* aCountry = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Country.getStr()) length: rLocale.Country.getLength()]autorelease];
396 NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
397 aLang = [aLang stringByAppendingString:aTaggedCountry];
398 }
399
400#ifdef MACOSX
401 NSInteger aCount;
402 NSRange range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:aNSStr startingAt:0 language:aLang wrap:false inSpellDocumentWithTag:macTag wordCount:&aCount];
403#else
404 NSRange range = [pChecker rangeOfMisspelledWordInString:aNSStr range:NSMakeRange(0, [aNSStr length]) startingAt:0 wrap:NO language:aLang];
405#endif
406 int rVal = 0;
407 if(range.length>0)
408 {
409 rVal = -1;
410 }
411 else
412 {
413 rVal = 1;
414 }
415 [pool release];
416 if (rVal != 1)
417 {
418 nRes = SpellFailure::SPELLING_ERROR;
419 } else {
420 return -1;
421 }
422 }
423 return nRes;
424}
425
426
427
428sal_Bool SAL_CALL
429 MacSpellChecker::isValid( const OUString& rWord, const Locale& rLocale,
430 const css::uno::Sequence<PropertyValue>& rProperties )
431{
432 MutexGuard aGuard( GetLinguMutex() );
433
434 if (rLocale == Locale() || !rWord.getLength())
435 return true;
436
437 if (!hasLocale( rLocale ))
438 return true;
439
440 // Get property values to be used.
441 // These are be the default values set in the SN_LINGU_PROPERTIES
442 // PropertySet which are overridden by the supplied ones from the
443 // last argument.
444 // You'll probably like to use a simpler solution than the provided
445 // one using the PropertyHelper_Spell.
446
447 PropertyHelper_Spell &rHelper = GetPropHelper();
448 rHelper.SetTmpPropVals( rProperties );
449
450 sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
451 if (nFailure != -1)
452 {
453 LanguageType nLang = LinguLocaleToLanguage( rLocale );
454 // postprocess result for errors that should be ignored
455 if ( (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang ))
456 || (!rHelper.IsSpellWithDigits() && HasDigits( rWord ))
457 || (!rHelper.IsSpellCapitalization()
458 && nFailure == SpellFailure::CAPTION_ERROR)
459 )
460 nFailure = -1;
461 }
462
463 return (nFailure == -1);
464}
465
467 MacSpellChecker::GetProposals( const OUString &rWord, const Locale &rLocale )
468{
469 // Retrieves the return values for the 'spell' function call in case
470 // of a misspelled word.
471 // Especially it may give a list of suggested (correct) words:
472
474 // note: mutex is held by higher up by spell which covers both
475
476 LanguageType nLang = LinguLocaleToLanguage( rLocale );
477 int count;
479
480 // first handle smart quotes (single and double)
481 OUStringBuffer rBuf(rWord);
482 sal_Int32 n = rBuf.getLength();
483 sal_Unicode c;
484 for (sal_Int32 ix=0; ix < n; ix++) {
485 c = rBuf[ix];
486 if ((c == 0x201C) || (c == 0x201D)) rBuf[ix] = u'"';
487 if ((c == 0x2018) || (c == 0x2019)) rBuf[ix] = u'\'';
488 }
489 OUString nWord(rBuf.makeStringAndClear());
490
491 if (n)
492 {
493 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
494 NSString* aNSStr = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(nWord.getStr()) length: nWord.getLength()]autorelease];
495 NSString* aLang = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Language.getStr()) length: rLocale.Language.getLength()]autorelease];
496 if(rLocale.Country.getLength()>0)
497 {
498 NSString* aCountry = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Country.getStr()) length: rLocale.Country.getLength()]autorelease];
499 NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
500 aLang = [aLang stringByAppendingString:aTaggedCountry];
501 }
502#ifdef MACOSX
503 [[NSSpellChecker sharedSpellChecker] setLanguage:aLang];
504 NSArray *guesses = [[NSSpellChecker sharedSpellChecker] guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0];
505 (void) this; // avoid loplugin:staticmethods, the !MACOSX case uses 'this'
506#else
507 NSArray *guesses = [pChecker guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang];
508#endif
509 count = [guesses count];
510 if (count)
511 {
512 aStr.realloc( count );
513 OUString *pStr = aStr.getArray();
514 for (int ii=0; ii < count; ii++)
515 {
516 // if needed add: if (suglst[ii] == NULL) continue;
517 NSString* guess = [guesses objectAtIndex:ii];
518 OUString cvtwrd(reinterpret_cast<const sal_Unicode*>([guess cStringUsingEncoding:NSUnicodeStringEncoding]), static_cast<sal_Int32>([guess length]));
519 pStr[ii] = cvtwrd;
520 }
521 }
522 [pool release];
523 }
524
525 // now return an empty alternative for no suggestions or the list of alternatives if some found
527 pAlt->SetWordLanguage( rWord, nLang );
528 pAlt->SetFailureType( SpellFailure::SPELLING_ERROR );
529 pAlt->SetAlternatives( aStr );
530 xRes = pAlt;
531 return xRes;
532
533}
534
536 MacSpellChecker::spell( const OUString& rWord, const Locale& rLocale,
537 const css::uno::Sequence<PropertyValue>& rProperties )
538{
539 MutexGuard aGuard( GetLinguMutex() );
540
541 if (rLocale == Locale() || !rWord.getLength())
542 return nullptr;
543
544 if (!hasLocale( rLocale ))
545 return nullptr;
546
548 if (!isValid( rWord, rLocale, rProperties ))
549 {
550 xAlt = GetProposals( rWord, rLocale );
551 }
552 return xAlt;
553}
554
555sal_Bool SAL_CALL
558{
559 MutexGuard aGuard( GetLinguMutex() );
560
561 bool bRes = false;
562 if (!bDisposing && rxLstnr.is())
563 {
564 bRes = GetPropHelper().addLinguServiceEventListener( rxLstnr );
565 }
566 return bRes;
567}
568
569
570sal_Bool SAL_CALL
573{
574 MutexGuard aGuard( GetLinguMutex() );
575
576 bool bRes = false;
577 if (!bDisposing && rxLstnr.is())
578 {
579 DBG_ASSERT( xPropHelper.is(), "xPropHelper non existent" );
580 bRes = GetPropHelper().removeLinguServiceEventListener( rxLstnr );
581 }
582 return bRes;
583}
584
585
586OUString SAL_CALL
587 MacSpellChecker::getServiceDisplayName( const Locale& /*rLocale*/ )
588{
589 MutexGuard aGuard( GetLinguMutex() );
590 return "macOS Spell Checker";
591}
592
593
594void SAL_CALL
596{
597 MutexGuard aGuard( GetLinguMutex() );
598
599 if (!xPropHelper.is())
600 {
601 sal_Int32 nLen = rArguments.getLength();
602 if (2 == nLen)
603 {
605 rArguments.getConstArray()[0] >>= xPropSet;
606 //rArguments.getConstArray()[1] >>= xDicList;
607
612 xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
613 xPropHelper->AddAsPropListener();
614 }
615 else
616 OSL_FAIL( "wrong number of arguments in sequence" );
617
618 }
619}
620
621
622void SAL_CALL
624{
625 MutexGuard aGuard( GetLinguMutex() );
626
627 if (!bDisposing)
628 {
629 bDisposing = true;
630 EventObject aEvtObj( static_cast<XSpellChecker *>(this) );
632 }
633}
634
635
636void SAL_CALL
638{
639 MutexGuard aGuard( GetLinguMutex() );
640
641 if (!bDisposing && rxListener.is())
642 aEvtListeners.addInterface( rxListener );
643}
644
645
646void SAL_CALL
648{
649 MutexGuard aGuard( GetLinguMutex() );
650
651 if (!bDisposing && rxListener.is())
652 aEvtListeners.removeInterface( rxListener );
653}
654
655// Service specific part
657{
658 return "org.openoffice.lingu.MacOSXSpellChecker";
659}
660
661sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName )
662{
664}
665
667{
668 return { SN_SPELLCHECKER };
669}
670
671extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
673 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
674{
675 return cppu::acquire(new MacSpellChecker());
676}
677
678/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FILE * init(int, char **)
virtual Sequence< Locale > SAL_CALL getLocales() override
Definition: macspellimp.mm:96
virtual void SAL_CALL dispose() override
Definition: macspellimp.mm:623
virtual Reference< XSpellAlternatives > SAL_CALL spell(const OUString &rWord, const Locale &rLocale, const css::uno::Sequence< PropertyValue > &rProperties) override
Definition: macspellimp.mm:536
virtual sal_Bool SAL_CALL removeLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: macspellimp.mm:571
virtual sal_Bool SAL_CALL addLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: macspellimp.mm:556
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: macspellimp.mm:666
linguistic::PropertyHelper_Spell & GetPropHelper_Impl()
Definition: macspellimp.mm:83
virtual OUString SAL_CALL getImplementationName() override
Definition: macspellimp.mm:656
OUString * aDNames
Definition: macspellimp.hxx:65
virtual ~MacSpellChecker() override
Definition: macspellimp.mm:69
UITextChecker * pChecker
Definition: macspellimp.hxx:70
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: macspellimp.mm:637
virtual sal_Bool SAL_CALL hasLocale(const Locale &rLocale) override
Definition: macspellimp.mm:347
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: macspellimp.mm:661
rtl::Reference< linguistic::PropertyHelper_Spell > xPropHelper
Definition: macspellimp.hxx:73
virtual sal_Bool SAL_CALL isValid(const OUString &rWord, const Locale &rLocale, const css::uno::Sequence< PropertyValue > &rProperties) override
Definition: macspellimp.mm:429
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: macspellimp.mm:647
Sequence< Locale > aSuppLocales
Definition: macspellimp.hxx:62
linguistic::PropertyHelper_Spell & GetPropHelper()
Definition: macspellimp.hxx:80
sal_Int32 numdict
Definition: macspellimp.hxx:66
Reference< XSpellAlternatives > GetProposals(const OUString &rWord, const Locale &rLocale)
Definition: macspellimp.mm:467
sal_Int16 GetSpellFailure(const OUString &rWord, const Locale &rLocale)
Definition: macspellimp.mm:369
::comphelper::OInterfaceContainerHelper3< XEventListener > aEvtListeners
Definition: macspellimp.hxx:72
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: macspellimp.mm:595
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: macspellimp.mm:587
rtl_TextEncoding * aDEncs
Definition: macspellimp.hxx:63
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
#define DBG_ASSERT(sCon, aError)
float u
sal_Int64 n
const char * pLocale
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lingucomponent_MacSpellChecker_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: macspellimp.mm:672
aStr
constexpr OUStringLiteral SN_SPELLCHECKER
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
uno::Reference< XLinguProperties > GetLinguProperties()
osl::Mutex & GetLinguMutex()
bool IsUpper(const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage)
bool HasDigits(const OUString &rText)
LanguageType LinguLocaleToLanguage(const css::lang::Locale &rLocale)
unsigned char sal_Bool
sal_uInt16 sal_Unicode