LibreOffice Module linguistic (master) 1
hyphdsp.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 <sal/config.h>
21#include <sal/log.hxx>
22
23#include <algorithm>
24#if OSL_DEBUG_LEVEL > 0
25#include <utility>
26#endif
27
29#include <com/sun/star/beans/XPropertySet.hpp>
30#include <com/sun/star/uno/XComponentContext.hpp>
31#include <com/sun/star/linguistic2/XLinguProperties.hpp>
32#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
33#include <rtl/ustrbuf.hxx>
34#include <i18nlangtag/lang.h>
36#include <tools/debug.hxx>
37#include <svl/lngmisc.hxx>
40#include <osl/mutex.hxx>
41
42#include "hyphdsp.hxx"
44#include <linguistic/misc.hxx>
45#include "lngsvcmgr.hxx"
46
47using namespace osl;
48using namespace com::sun::star;
49using namespace com::sun::star::beans;
50using namespace com::sun::star::lang;
51using namespace com::sun::star::uno;
52using namespace com::sun::star::linguistic2;
53using namespace linguistic;
54
55
57 rMgr (rLngSvcMgr)
58{
59}
60
61
63{
65}
66
67
69{
70 // release memory for each table entry
72}
73
74
76 const OUString& rOrigWord,
77 const Reference<XDictionaryEntry> &xEntry,
78 LanguageType nLang, sal_Int16 nMaxLeading )
79{
80 MutexGuard aGuard( GetLinguMutex() );
81
83
84 if (xEntry.is())
85 {
86 OUString aText( xEntry->getDictionaryWord() );
87 sal_Int32 nTextLen = aText.getLength();
88
89 // trailing '=' means "hyphenation should not be possible"
90 if (nTextLen > 0 && aText[ nTextLen - 1 ] != '=' && aText[ nTextLen - 1 ] != '[')
91 {
92 sal_Int16 nHyphenationPos = -1;
93 sal_Int16 nOrigHyphPos = -1;
94
95 OUStringBuffer aTmp( nTextLen );
96 bool bSkip = false;
97 bool bSkip2 = false;
98 sal_Int32 nHyphIdx = -1;
99 sal_Int32 nLeading = 0;
100 for (sal_Int32 i = 0; i < nTextLen; i++)
101 {
102 sal_Unicode cTmp = aText[i];
103 if (cTmp == '[' || cTmp == ']')
104 bSkip2 = !bSkip2;
105 if (cTmp != '=' && !bSkip2 && cTmp != ']')
106 {
107 aTmp.append( cTmp );
108 nLeading++;
109 bSkip = false;
110 nHyphIdx++;
111 }
112 else
113 {
114 if (!bSkip && nHyphIdx >= 0)
115 {
116 if (nLeading <= nMaxLeading) {
117 nHyphenationPos = static_cast<sal_Int16>(nHyphIdx);
118 nOrigHyphPos = i;
119 }
120 }
121 bSkip = true;
122 }
123 }
124
125 if (nHyphenationPos > 0)
126 {
127#if OSL_DEBUG_LEVEL > 0
128 {
129 if (std::u16string_view(aTmp) != rOrigWord)
130 {
131 // both words should only differ by a having a trailing '.'
132 // character or not...
133 std::u16string_view aShorter(aTmp), aLonger(rOrigWord);
134 if (aTmp.getLength() > rOrigWord.getLength())
135 std::swap(aShorter, aLonger);
136 sal_Int32 nS = aShorter.size();
137 sal_Int32 nL = aLonger.size();
138 if (nS > 0 && nL > 0)
139 {
140 assert( ((nS + 1 == nL) && aLonger[nL-1] == '.') && "HyphenatorDispatcher::buildHyphWord: unexpected difference between words!" );
141 }
142 }
143 }
144#endif
145 sal_Int32 nHyphenPos = -1;
146 if (aText[ nOrigHyphPos ] == '[') // alternative hyphenation
147 {
148 sal_Int16 split = 0;
149 sal_Unicode c = aText [ nOrigHyphPos + 1 ];
150 sal_Int32 endhyphpat = aText.indexOf( ']', nOrigHyphPos );
151 if ('0' <= c && c <= '9')
152 {
153 split = c - '0';
154 nOrigHyphPos++;
155 }
156 if (endhyphpat > -1)
157 {
158 OUStringBuffer aTmp2 ( aTmp.copy(0, std::max (nHyphenationPos + 1 - split, 0) ) );
159 aTmp2.append( aText.subView( nOrigHyphPos + 1, endhyphpat - nOrigHyphPos - 1) );
160 nHyphenPos = aTmp2.getLength();
161 aTmp2.append( aTmp.subView( nHyphenationPos + 1 ) );
163 if (rOrigWord[ rOrigWord.getLength() - 1 ] == '.')
164 aTmp2.append( '.' );
165 aText = aTmp2.makeStringAndClear();
166 }
167 }
168 if (nHyphenPos == -1)
169 aText = rOrigWord;
170
171 xRes = new HyphenatedWord( rOrigWord, nLang, nHyphenationPos,
172 aText, (nHyphenPos > -1) ? nHyphenPos - 1 : nHyphenationPos);
173 }
174 }
175 }
176
177 return xRes;
178}
179
180
182 const Reference< XDictionaryEntry > &xEntry, LanguageType nLanguage )
183{
184 MutexGuard aGuard( GetLinguMutex() );
185
187
188 if (xEntry.is())
189 {
190 // text with hyphenation info
191 OUString aText( xEntry->getDictionaryWord() );
192 sal_Int32 nTextLen = aText.getLength();
193
194 // trailing '=' means "hyphenation should not be possible"
195 if (nTextLen > 0 && aText[ nTextLen - 1 ] != '=' && aText[ nTextLen - 1 ] != '[')
196 {
197 // sequence to hold hyphenation positions
198 Sequence< sal_Int16 > aHyphPos( nTextLen );
199 sal_Int16 *pPos = aHyphPos.getArray();
200 sal_Int32 nHyphCount = 0;
201
202 OUStringBuffer aTmp( nTextLen );
203 bool bSkip = false;
204 bool bSkip2 = false;
205 sal_Int32 nHyphIdx = -1;
206 for (sal_Int32 i = 0; i < nTextLen; i++)
207 {
208 sal_Unicode cTmp = aText[i];
209 if (cTmp == '[' || cTmp == ']')
210 bSkip2 = !bSkip2;
211 if (cTmp != '=' && !bSkip2 && cTmp != ']')
212 {
213 aTmp.append( cTmp );
214 bSkip = false;
215 nHyphIdx++;
216 }
217 else
218 {
219 if (!bSkip && nHyphIdx >= 0)
220 pPos[ nHyphCount++ ] = static_cast<sal_Int16>(nHyphIdx);
221 bSkip = true;
222 }
223 }
224
225 // ignore (multiple) trailing '='
226 if (bSkip && nHyphIdx >= 0)
227 {
228 nHyphCount--;
229 }
230 DBG_ASSERT( nHyphCount >= 0, "lng : invalid hyphenation count");
231
232 if (nHyphCount > 0)
233 {
234 aHyphPos.realloc( nHyphCount );
235 xRes = new PossibleHyphens( aTmp.makeStringAndClear(), nLanguage,
236 aText, aHyphPos );
237 }
238 }
239 }
240
241 return xRes;
242}
243
244
246{
247 MutexGuard aGuard( GetLinguMutex() );
248
249 std::vector<Locale> aLocales;
250 aLocales.reserve(aSvcMap.size());
251
252 std::transform(aSvcMap.begin(), aSvcMap.end(), std::back_inserter(aLocales),
253 [](HyphSvcByLangMap_t::const_reference elem) { return LanguageTag::convertToLocale(elem.first); });
254
255 return comphelper::containerToSequence(aLocales);
256}
257
258
259sal_Bool SAL_CALL HyphenatorDispatcher::hasLocale(const Locale& rLocale)
260{
261 MutexGuard aGuard( GetLinguMutex() );
262 HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LinguLocaleToLanguage( rLocale ) ) );
263 return aIt != aSvcMap.end();
264}
265
266
269 const OUString& rWord, const Locale& rLocale, sal_Int16 nMaxLeading,
270 const css::uno::Sequence< ::css::beans::PropertyValue >& rProperties )
271{
272 MutexGuard aGuard( GetLinguMutex() );
273
275
276 sal_Int32 nWordLen = rWord.getLength();
277 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
278 if (LinguIsUnspecified(nLanguage) || !nWordLen ||
279 nMaxLeading == 0 || nMaxLeading == nWordLen)
280 return xRes;
281
282 // search for entry with that language
283 HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
284 LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
285
286 bool bWordModified = false;
287 if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen))
288 {
289 return nullptr;
290 }
291 else
292 {
293 OUString aChkWord( rWord );
294
295 // replace typographical apostroph by ascii apostroph
296 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
297 DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of quotation mark" );
298 if (!aSingleQuote.isEmpty())
299 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
300
301 bWordModified |= RemoveHyphens( aChkWord );
302 if (IsIgnoreControlChars( rProperties, GetPropSet() ))
303 bWordModified |= RemoveControlChars( aChkWord );
304 sal_Int16 nChkMaxLeading = static_cast<sal_Int16>(GetPosInWordToCheck( rWord, nMaxLeading ));
305
306 // check for results from (positive) dictionaries which have precedence!
308
309 if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
310 {
311 xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
312 true, false );
313 }
314
315 if (xEntry.is())
316 {
322 xRes = buildHyphWord( rWord, xEntry, nLanguage, nChkMaxLeading );
323 }
324 else
325 {
326 sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
327 DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
328 "lng : index out of range");
329
330 sal_Int32 i = 0;
332 if (pEntry->aSvcRefs.hasElements())
333 xHyph = pEntry->aSvcRefs[0];
334
335 // try already instantiated service
336 if (i <= pEntry->nLastTriedSvcIndex)
337 {
338 if (xHyph.is() && xHyph->hasLocale( rLocale ))
339 xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
340 rProperties );
341 ++i;
342 }
343 else if (pEntry->nLastTriedSvcIndex < nLen - 1)
344 // instantiate services and try it
345 {
346 Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
347
350
351 // build service initialization argument
352 Sequence< Any > aArgs(2);
353 aArgs.getArray()[0] <<= GetPropSet();
354
355 // create specific service via it's implementation name
356 try
357 {
359 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
360 pEntry->aSvcImplNames[0], aArgs, xContext ),
361 UNO_QUERY );
362 }
363 catch (uno::Exception &)
364 {
365 SAL_WARN( "linguistic", "createInstanceWithArguments failed" );
366 }
367 pRef [i] = xHyph;
368
370 xBroadcaster( xHyph, UNO_QUERY );
371 if (xBroadcaster.is())
372 rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
373
374 if (xHyph.is() && xHyph->hasLocale( rLocale ))
375 xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
376 rProperties );
377
378 pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
379 ++i;
380
381 // if language is not supported by the services
382 // remove it from the list.
383 if (xHyph.is() && !xHyph->hasLocale( rLocale ))
384 aSvcMap.erase( nLanguage );
385 }
386 } // if (xEntry.is())
387 }
388
389 if (bWordModified && xRes.is())
390 xRes = RebuildHyphensAndControlChars( rWord, xRes );
391
392 if (xRes.is() && xRes->getWord() != rWord)
393 {
394 xRes = new HyphenatedWord( rWord, nLanguage, xRes->getHyphenationPos(),
395 xRes->getHyphenatedWord(),
396 xRes->getHyphenPos() );
397 }
398
399 return xRes;
400}
401
402
405 const OUString& rWord, const Locale& rLocale, sal_Int16 nIndex,
406 const css::uno::Sequence< ::css::beans::PropertyValue >& rProperties )
407{
408 MutexGuard aGuard( GetLinguMutex() );
409
411
412 sal_Int32 nWordLen = rWord.getLength();
413 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
414 if (LinguIsUnspecified(nLanguage) || !nWordLen)
415 return xRes;
416
417 // search for entry with that language
418 HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
419 LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
420
421 bool bWordModified = false;
422 if (!pEntry || 0 > nIndex || nIndex > nWordLen - 2)
423 {
424 return nullptr;
425 }
426 else
427 {
428 OUString aChkWord( rWord );
429
430 // replace typographical apostroph by ascii apostroph
431 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
432 DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of quotation mark" );
433 if (!aSingleQuote.isEmpty())
434 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
435
436 bWordModified |= RemoveHyphens( aChkWord );
437 if (IsIgnoreControlChars( rProperties, GetPropSet() ))
438 bWordModified |= RemoveControlChars( aChkWord );
439 sal_Int16 nChkIndex = static_cast<sal_Int16>(GetPosInWordToCheck( rWord, nIndex ));
440
441 // check for results from (positive) dictionaries which have precedence!
443
444 if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
445 {
446 xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
447 true, false );
448 }
449
450 if (xEntry.is())
451 {
452 xRes = buildHyphWord(aChkWord, xEntry, nLanguage, nIndex + 1);
453 if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex)
454 return xRes;
455 }
456 else
457 {
458 sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
459 DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
460 "lng : index out of range");
461
462 sal_Int32 i = 0;
464 if (pEntry->aSvcRefs.hasElements())
465 xHyph = pEntry->aSvcRefs[0];
466
467 // try already instantiated service
468 if (i <= pEntry->nLastTriedSvcIndex)
469 {
470 if (xHyph.is() && xHyph->hasLocale( rLocale ))
471 xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale,
472 nChkIndex, rProperties );
473 ++i;
474 }
475 else if (pEntry->nLastTriedSvcIndex < nLen - 1)
476 // instantiate services and try it
477 {
478 Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
479
482
483 // build service initialization argument
484 Sequence< Any > aArgs(2);
485 aArgs.getArray()[0] <<= GetPropSet();
486
487 // create specific service via it's implementation name
488 try
489 {
491 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
492 pEntry->aSvcImplNames[0], aArgs, xContext ), UNO_QUERY );
493 }
494 catch (uno::Exception &)
495 {
496 SAL_WARN( "linguistic", "createInstanceWithArguments failed" );
497 }
498 pRef [i] = xHyph;
499
501 xBroadcaster( xHyph, UNO_QUERY );
502 if (xBroadcaster.is())
503 rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
504
505 if (xHyph.is() && xHyph->hasLocale( rLocale ))
506 xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale,
507 nChkIndex, rProperties );
508
509 pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
510 ++i;
511
512 // if language is not supported by the services
513 // remove it from the list.
514 if (xHyph.is() && !xHyph->hasLocale( rLocale ))
515 aSvcMap.erase( nLanguage );
516 }
517 } // if (xEntry.is())
518 }
519
520 if (bWordModified && xRes.is())
521 xRes = RebuildHyphensAndControlChars( rWord, xRes );
522
523 if (xRes.is() && xRes->getWord() != rWord)
524 {
525 xRes = new HyphenatedWord( rWord, nLanguage, xRes->getHyphenationPos(),
526 xRes->getHyphenatedWord(),
527 xRes->getHyphenPos() );
528 }
529
530 return xRes;
531}
532
533
536 const OUString& rWord, const Locale& rLocale,
537 const css::uno::Sequence< ::css::beans::PropertyValue >& rProperties )
538{
539 MutexGuard aGuard( GetLinguMutex() );
540
542
543 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
544 if (LinguIsUnspecified(nLanguage) || rWord.isEmpty())
545 return xRes;
546
547 // search for entry with that language
548 HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
549 LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
550
551 if (pEntry)
552 {
553 OUString aChkWord( rWord );
554
555 // replace typographical apostroph by ascii apostroph
556 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
557 DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of quotation mark" );
558 if (!aSingleQuote.isEmpty())
559 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
560
561 RemoveHyphens( aChkWord );
562 if (IsIgnoreControlChars( rProperties, GetPropSet() ))
563 RemoveControlChars( aChkWord );
564
565 // check for results from (positive) dictionaries which have precedence!
567
568 if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
569 {
570 xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
571 true, false );
572 }
573
574 if (xEntry.is())
575 {
576 xRes = buildPossHyphens( xEntry, nLanguage );
577 }
578 else
579 {
580 sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
581 DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
582 "lng : index out of range");
583
584 sal_Int32 i = 0;
586 if (pEntry->aSvcRefs.hasElements())
587 xHyph = pEntry->aSvcRefs[0];
588
589 // try already instantiated service
590 if (i <= pEntry->nLastTriedSvcIndex)
591 {
592 if (xHyph.is() && xHyph->hasLocale( rLocale ))
593 xRes = xHyph->createPossibleHyphens( aChkWord, rLocale,
594 rProperties );
595 ++i;
596 }
597 else if (pEntry->nLastTriedSvcIndex < nLen - 1)
598 // instantiate services and try it
599 {
600 Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
601
604
605 // build service initialization argument
606 Sequence< Any > aArgs(2);
607 aArgs.getArray()[0] <<= GetPropSet();
608
609 // create specific service via it's implementation name
610 try
611 {
612 xHyph.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
613 pEntry->aSvcImplNames[0], aArgs, xContext ),
614 UNO_QUERY );
615 }
616 catch (uno::Exception &)
617 {
618 SAL_WARN( "linguistic", "createWithArguments failed" );
619 }
620 pRef [i] = xHyph;
621
623 xBroadcaster( xHyph, UNO_QUERY );
624 if (xBroadcaster.is())
625 rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
626
627 if (xHyph.is() && xHyph->hasLocale( rLocale ))
628 xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties );
629
630 pEntry->nLastTriedSvcIndex = static_cast<sal_Int16>(i);
631 ++i;
632
633 // if language is not supported by the services
634 // remove it from the list.
635 if (xHyph.is() && !xHyph->hasLocale( rLocale ))
636 aSvcMap.erase( nLanguage );
637 }
638 } // if (xEntry.is())
639 }
640
641 if (xRes.is() && xRes->getWord() != rWord)
642 {
643 xRes = new PossibleHyphens( rWord, nLanguage,
644 xRes->getPossibleHyphens(),
645 xRes->getHyphenationPositions() );
646 }
647
648 return xRes;
649}
650
651
652void HyphenatorDispatcher::SetServiceList( const Locale &rLocale,
653 const Sequence< OUString > &rSvcImplNames )
654{
655 MutexGuard aGuard( GetLinguMutex() );
656
657 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
658
659 if (!rSvcImplNames.hasElements())
660 // remove entry
661 aSvcMap.erase( nLanguage );
662 else
663 {
664 // modify/add entry
665 LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
666 if (pEntry)
667 {
668 pEntry->Clear();
669 pEntry->aSvcImplNames = rSvcImplNames;
670 pEntry->aSvcImplNames.realloc(1);
672 }
673 else
674 {
675 auto pTmpEntry = std::make_shared<LangSvcEntries_Hyph>( rSvcImplNames[0] );
676 pTmpEntry->aSvcRefs = Sequence< Reference < XHyphenator > >( 1 );
677 aSvcMap[ nLanguage ] = pTmpEntry;
678 }
679 }
680}
681
682
684 HyphenatorDispatcher::GetServiceList( const Locale &rLocale ) const
685{
686 MutexGuard aGuard( GetLinguMutex() );
687
689
690 // search for entry with that language and use data from that
691 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
692 const HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( nLanguage ) );
693 const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
694 if (pEntry)
695 {
696 aRes = pEntry->aSvcImplNames;
697 if (aRes.hasElements())
698 aRes.realloc(1);
699 }
700
701 return aRes;
702}
703
704
705/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > GetServiceList(const css::lang::Locale &rLocale) const override
Definition: hyphdsp.cxx:684
virtual ~HyphenatorDispatcher() override
Definition: hyphdsp.cxx:62
virtual css::uno::Reference< css::linguistic2::XPossibleHyphens > SAL_CALL createPossibleHyphens(const OUString &aWord, const css::lang::Locale &aLocale, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:535
const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > & GetDicList()
Definition: hyphdsp.hxx:119
virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL hyphenate(const OUString &aWord, const css::lang::Locale &aLocale, sal_Int16 nMaxLeading, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:268
std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t
Definition: hyphdsp.hxx:45
static css::uno::Reference< css::linguistic2::XHyphenatedWord > buildHyphWord(const OUString &rOrigWord, const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry, LanguageType nLang, sal_Int16 nMaxLeading)
Definition: hyphdsp.cxx:75
HyphenatorDispatcher(const HyphenatorDispatcher &)=delete
LngSvcMgr & rMgr
Definition: hyphdsp.hxx:51
virtual void SetServiceList(const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames) override
Definition: hyphdsp.cxx:652
const css::uno::Reference< css::linguistic2::XLinguProperties > & GetPropSet()
Definition: hyphdsp.hxx:110
virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL queryAlternativeSpelling(const OUString &aWord, const css::lang::Locale &aLocale, sal_Int16 nIndex, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:404
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
Definition: hyphdsp.cxx:245
HyphSvcByLangMap_t aSvcMap
Definition: hyphdsp.hxx:46
virtual sal_Bool SAL_CALL hasLocale(const css::lang::Locale &aLocale) override
Definition: hyphdsp.cxx:259
static css::uno::Reference< css::linguistic2::XPossibleHyphens > buildPossHyphens(const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry, LanguageType nLanguage)
Definition: hyphdsp.cxx:181
bool AddLngSvcEvtBroadcaster(const css::uno::Reference< css::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster)
Definition: lngsvcmgr.cxx:1787
#define DBG_ASSERT(sCon, aError)
sal_Int32 nIndex
#define SAL_WARN(area, stream)
std::vector< OUString > split(std::u16string_view rStr, sal_Unicode cSeparator)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
int i
bool LinguIsUnspecified(LanguageType nLanguage)
Checks if a LanguageType is one of the values that denote absence of language or undetermined languag...
Definition: misc.cxx:88
bool RemoveHyphens(OUString &rTxt)
bool RemoveControlChars(OUString &rTxt)
uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(const OUString &rOrigWord, uno::Reference< XHyphenatedWord > const &rxHyphWord)
Definition: misc.cxx:499
sal_Int32 GetPosInWordToCheck(std::u16string_view rTxt, sal_Int32 nPos)
Definition: misc.cxx:481
osl::Mutex & GetLinguMutex()
! multi-thread safe mutex for all platforms !!
Definition: misc.cxx:60
bool IsIgnoreControlChars(const PropertyValues &rProperties, const uno::Reference< XPropertySet > &rxProp)
Definition: misc.cxx:211
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
Definition: misc.cxx:66
LanguageType LinguLocaleToLanguage(const css::lang::Locale &rLocale)
Convert Locale to LanguageType for legacy handling.
Definition: misc.cxx:74
bool IsUseDicList(const PropertyValues &rProperties, const uno::Reference< XPropertySet > &rxProp)
Definition: misc.cxx:189
css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > > aSvcRefs
Definition: defs.hxx:66
css::uno::Sequence< OUString > aSvcImplNames
Definition: defs.hxx:34
void Clear()
Definition: defs.hxx:50
sal_Int16 nLastTriedSvcIndex
Definition: defs.hxx:36
unsigned char sal_Bool
sal_uInt16 sal_Unicode