LibreOffice Module cui (master)  1
optlingu.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 <vcl/settings.hxx>
21 #include <vcl/weld.hxx>
23 #include <i18nlangtag/mslangid.hxx>
24 #include <unotools/lingucfg.hxx>
25 #include <unotools/linguprops.hxx>
26 #include <editeng/unolingu.hxx>
27 #include <linguistic/misc.hxx>
28 #include <sfx2/sfxsids.hrc>
29 #include <tools/debug.hxx>
30 #include <tools/urlobj.hxx>
31 #include <tools/diagnose_ex.h>
33 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
34 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
35 #include <com/sun/star/linguistic2/XProofreader.hpp>
36 #include <com/sun/star/linguistic2/XHyphenator.hpp>
37 #include <com/sun/star/linguistic2/XThesaurus.hpp>
38 #include <com/sun/star/linguistic2/XDictionary.hpp>
39 #include <com/sun/star/linguistic2/XDictionaryList.hpp>
40 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
41 #include <com/sun/star/lang/XServiceDisplayName.hpp>
42 #include <com/sun/star/frame/XStorable.hpp>
44 #include <svl/eitem.hxx>
45 #include <vcl/svapp.hxx>
46 #include <sal/log.hxx>
47 #include <osl/diagnose.h>
48 
49 #include <svx/svxdlg.hxx>
50 #include <editeng/optitems.hxx>
51 #include <optlingu.hxx>
52 #include <dialmgr.hxx>
53 #include <strings.hrc>
54 
55 #include <ucbhelper/content.hxx>
56 
57 #include <vector>
58 #include <map>
59 
60 using namespace ::ucbhelper;
61 using namespace ::com::sun::star;
62 using namespace css::lang;
63 using namespace css::uno;
64 using namespace css::linguistic2;
65 using namespace css::beans;
66 
67 static const sal_Char cSpell[] = SN_SPELLCHECKER;
69 static const sal_Char cHyph[] = SN_HYPHENATOR;
70 static const sal_Char cThes[] = SN_THESAURUS;
71 
72 // static ----------------------------------------------------------------
73 
74 static sal_Int32 lcl_SeqGetEntryPos(
75  const Sequence< OUString > &rSeq, const OUString &rEntry )
76 {
77  sal_Int32 i;
78  sal_Int32 nLen = rSeq.getLength();
79  const OUString *pItem = rSeq.getConstArray();
80  for (i = 0; i < nLen; ++i)
81  {
82  if (rEntry == pItem[i])
83  break;
84  }
85  return i < nLen ? i : -1;
86 }
87 
88 static bool KillFile_Impl( const OUString& rURL )
89 {
90  bool bRet = true;
91  try
92  {
93  Content aCnt( rURL, uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
94  aCnt.executeCommand( "delete", Any( true ) );
95  }
96  catch( ... )
97  {
98  TOOLS_WARN_EXCEPTION( "cui.options", "KillFile" );
99  bRet = false;
100  }
101 
102  return bRet;
103 }
104 
105 // 0x 0p 0t 0c nn
106 // p: 1 -> parent
107 // t: 1 -> spell, 2 -> hyph, 3 -> thes, 4 -> grammar
108 // c: 1 -> checked 0 -> unchecked
109 // n: index
110 
111 #define TYPE_SPELL sal_uInt8(1)
112 #define TYPE_GRAMMAR sal_uInt8(2)
113 #define TYPE_HYPH sal_uInt8(3)
114 #define TYPE_THES sal_uInt8(4)
115 
117 {
118  bool bParent;
122  OUString sImplName;
123 
124 public:
125  ModuleUserData_Impl( const OUString& sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
126  bParent(bIsParent),
127  bIsChecked(bChecked),
128  nType(nSetType),
129  nIndex(nSetIndex),
130  sImplName(sImpName)
131  {
132  }
133  bool IsParent() const {return bParent;}
134  sal_uInt8 GetType() const {return nType;}
135  bool IsChecked() const {return bIsChecked;}
136  sal_uInt8 GetIndex() const {return nIndex;}
137  const OUString& GetImplName() const {return sImplName;}
138 
139 };
140 
141 
142 // User for user-dictionaries (XDictionary interface)
143 
145 {
146  sal_uInt32 nVal;
147 
148 public:
149  explicit DicUserData(sal_uInt32 nUserData) : nVal( nUserData ) {}
150  DicUserData( sal_uInt16 nEID,
151  bool bChecked, bool bEditable, bool bDeletable );
152 
153  sal_uInt32 GetUserData() const { return nVal; }
154  sal_uInt16 GetEntryId() const { return static_cast<sal_uInt16>(nVal >> 16); }
155  bool IsChecked() const { return static_cast<bool>((nVal >> 8) & 0x01); }
156  bool IsDeletable() const { return static_cast<bool>((nVal >> 10) & 0x01); }
157 };
158 
159 
161  sal_uInt16 nEID,
162  bool bChecked, bool bEditable, bool bDeletable )
163 {
164  DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
165  nVal = (static_cast<sal_uInt32>(0xFFFF & nEID) << 16) |
166  (static_cast<sal_uInt32>(bChecked ? 1 : 0) << 8) |
167  (static_cast<sal_uInt32>(bEditable ? 1 : 0) << 9) |
168  (static_cast<sal_uInt32>(bDeletable ? 1 : 0) << 10);
169 }
170 
171 /*--------------------------------------------------
172  Entry IDs for options listbox of dialog
173 --------------------------------------------------*/
174 
175 namespace {
176 
178 {
179  EID_SPELL_AUTO,
180  EID_GRAMMAR_AUTO,
181  EID_CAPITAL_WORDS,
182  EID_WORDS_WITH_DIGITS,
183  EID_SPELL_SPECIAL,
184  EID_NUM_MIN_WORDLEN,
185  EID_NUM_PRE_BREAK,
186  EID_NUM_POST_BREAK,
187  EID_HYPH_AUTO,
188  EID_HYPH_SPECIAL
189 };
190 
191 }
192 
194 // It is used to get the respective property name.
195 static const char * aEidToPropName[] =
196 {
197  UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
198  UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
199  UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
200  UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
201  UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
202  UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
203  UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
204  UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
205  UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
206  UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
207 };
208 
209 static OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
210 {
211  DBG_ASSERT( static_cast<unsigned int>(eEntryId) < SAL_N_ELEMENTS(aEidToPropName), "index out of range" );
212  return OUString::createFromAscii( aEidToPropName[ static_cast<int>(eEntryId) ] );
213 }
214 
216 {
217  std::unique_ptr<weld::Widget> m_xBeforeFrame;
218  std::unique_ptr<weld::Widget> m_xAfterFrame;
219  std::unique_ptr<weld::Widget> m_xMinimalFrame;
220  std::unique_ptr<weld::SpinButton> m_xBreakNF;
221 
222 public:
223  OptionsBreakSet(weld::Window* pParent, sal_uInt16 nRID)
224  : GenericDialogController(pParent, "cui/ui/breaknumberoption.ui", "BreakNumberOption")
225  , m_xBeforeFrame(m_xBuilder->weld_widget("beforeframe"))
226  , m_xAfterFrame(m_xBuilder->weld_widget("afterframe"))
227  , m_xMinimalFrame(m_xBuilder->weld_widget("miniframe"))
228  {
229  assert(EID_NUM_PRE_BREAK == nRID || EID_NUM_POST_BREAK == nRID || EID_NUM_MIN_WORDLEN == nRID); //unexpected ID
230 
231  if (nRID == EID_NUM_PRE_BREAK)
232  {
233  m_xBeforeFrame->show();
234  m_xBreakNF = m_xBuilder->weld_spin_button("beforebreak");
235  }
236  else if(nRID == EID_NUM_POST_BREAK)
237  {
238  m_xAfterFrame->show();
239  m_xBreakNF = m_xBuilder->weld_spin_button("afterbreak");
240  }
241  else if(nRID == EID_NUM_MIN_WORDLEN)
242  {
243  m_xMinimalFrame->show();
244  m_xBreakNF = m_xBuilder->weld_spin_button("wordlength");
245  }
246  }
247 
249  {
250  return *m_xBreakNF;
251  }
252 };
253 
254 // class OptionsUserData -------------------------------------------------
255 
257 {
258  sal_uInt32 nVal;
259 
260 public:
261  explicit OptionsUserData( sal_uInt32 nUserData ) : nVal( nUserData ) {}
262  OptionsUserData( sal_uInt16 nEID,
263  bool bHasNV, sal_uInt16 nNumVal,
264  bool bCheckable, bool bChecked );
265 
266  sal_uInt32 GetUserData() const { return nVal; }
267  sal_uInt16 GetEntryId() const { return static_cast<sal_uInt16>(nVal >> 16); }
268  bool HasNumericValue() const { return static_cast<bool>((nVal >> 10) & 0x01); }
269  sal_uInt16 GetNumericValue() const { return static_cast<sal_uInt16>(nVal & 0xFF); }
270  bool IsCheckable() const { return static_cast<bool>((nVal >> 9) & 0x01); }
271  bool IsModified() const { return static_cast<bool>((nVal >> 11) & 0x01); }
272 
273  void SetNumericValue( sal_uInt8 nNumVal );
274 };
275 
277  bool bHasNV, sal_uInt16 nNumVal,
278  bool bCheckable, bool bChecked )
279 {
280  DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
281  DBG_ASSERT( nNumVal < 256, "value out of range" );
282  nVal = (static_cast<sal_uInt32>(0xFFFF & nEID) << 16) |
283  (static_cast<sal_uInt32>(bHasNV ? 1 : 0) << 10) |
284  (static_cast<sal_uInt32>(bCheckable ? 1 : 0) << 9) |
285  (static_cast<sal_uInt32>(bChecked ? 1 : 0) << 8) |
286  static_cast<sal_uInt32>(0xFF & nNumVal);
287 }
288 
290 {
291  if (HasNumericValue() && (GetNumericValue() != nNumVal))
292  {
293  nVal &= 0xffffff00;
294  nVal |= nNumVal;
295  nVal |= sal_uInt32(1) << 11; // mark as modified
296  }
297 }
298 
299 // ServiceInfo_Impl ----------------------------------------------------
300 
302 {
303  OUString sDisplayName;
304  OUString sSpellImplName;
305  OUString sHyphImplName;
306  OUString sThesImplName;
308  uno::Reference< XSpellChecker > xSpell;
309  uno::Reference< XHyphenator > xHyph;
310  uno::Reference< XThesaurus > xThes;
311  uno::Reference< XProofreader > xGrammar;
313 
314  ServiceInfo_Impl() : bConfigured(false) {}
315 };
316 
317 typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
318 typedef std::map< LanguageType, Sequence< OUString > > LangImplNameTable;
319 
320 
321 // SvxLinguData_Impl ----------------------------------------------------
322 
324 {
325  //contains services and implementation names sorted by implementation names
327  sal_uInt32 nDisplayServices;
328 
329  Sequence< Locale > aAllServiceLocales;
334  uno::Reference< XLinguServiceManager2 > xLinguSrvcMgr;
335 
336 
337  static bool AddRemove( Sequence< OUString > &rConfigured,
338  const OUString &rImplName, bool bAdd );
339 
340 public:
342 
343  uno::Reference<XLinguServiceManager2> & GetManager() { return xLinguSrvcMgr; }
344 
345  void SetChecked( const Sequence< OUString > &rConfiguredServices );
346  void Reconfigure( const OUString &rDisplayName, bool bEnable );
347 
348  const Sequence<Locale> & GetAllSupportedLocales() const { return aAllServiceLocales; }
349 
350  LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
351  LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
352  LangImplNameTable & GetThesTable() { return aCfgThesTable; }
353  LangImplNameTable & GetGrammarTable() { return aCfgGrammarTable; }
354 
355  ServiceInfoArr & GetDisplayServiceArray() { return aDisplayServiceArr; }
356 
357  const sal_uInt32 & GetDisplayServiceCount() const { return nDisplayServices; }
358  void SetDisplayServiceCount( sal_uInt32 nVal ) { nDisplayServices = nVal; }
359 
360  // returns the list of service implementation names for the specified
361  // language and service (TYPE_SPELL, TYPE_HYPH, TYPE_THES) sorted in
362  // the proper order for the SvxEditModulesDlg (the ones from the
363  // configuration (keeping that order!) first and then the other ones.
364  // I.e. the ones available but not configured in arbitrary order).
365  // They available ones may contain names that do not(!) support that
366  // language.
367  Sequence< OUString > GetSortedImplNames( LanguageType nLang, sal_uInt8 nType );
368 
369  ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
370 };
371 
372 
373 static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt )
374 {
375  sal_Int32 nRes = -1;
376  sal_Int32 nLen = rSeq.getLength();
377  const OUString *pString = rSeq.getConstArray();
378  for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i)
379  {
380  if (pString[i] == rTxt)
381  nRes = i;
382  }
383  return nRes;
384 }
385 
386 
388 {
389  LangImplNameTable *pTable = nullptr;
390  switch (nType)
391  {
392  case TYPE_SPELL : pTable = &aCfgSpellTable; break;
393  case TYPE_HYPH : pTable = &aCfgHyphTable; break;
394  case TYPE_THES : pTable = &aCfgThesTable; break;
395  case TYPE_GRAMMAR : pTable = &aCfgGrammarTable; break;
396  }
398  if (!pTable)
399  {
400  SAL_WARN( "cui.options", "unknown linguistic type" );
401  return aRes;
402  }
403  if (pTable->count( nLang ))
404  aRes = (*pTable)[ nLang ]; // add configured services
405  sal_Int32 nIdx = aRes.getLength();
406  DBG_ASSERT( static_cast<sal_Int32>(nDisplayServices) >= nIdx, "size mismatch" );
407  aRes.realloc( nDisplayServices );
408  OUString *pRes = aRes.getArray();
409 
410  // add not configured services
411  for (sal_Int32 i = 0; i < static_cast<sal_Int32>(nDisplayServices); ++i)
412  {
413  const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ];
414  OUString aImplName;
415  switch (nType)
416  {
417  case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break;
418  case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break;
419  case TYPE_THES : aImplName = rInfo.sThesImplName; break;
420  case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
421  }
422 
423  if (!aImplName.isEmpty() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
424  {
425  DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" );
426  if (nIdx < aRes.getLength())
427  pRes[ nIdx++ ] = aImplName;
428  }
429  }
430  // don't forget to put aRes back to its actual size just in case you allocated too much
431  // since all of the names may have already been added
432  // otherwise you get duplicate entries in the edit dialog
433  aRes.realloc( nIdx );
434  return aRes;
435 }
436 
437 
439 {
440  for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
441  {
442  ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ];
443  if (rTmp.sSpellImplName == rSvcImplName ||
444  rTmp.sHyphImplName == rSvcImplName ||
445  rTmp.sThesImplName == rSvcImplName ||
446  rTmp.sGrammarImplName == rSvcImplName)
447  {
448  return &rTmp;
449  }
450  }
451  return nullptr;
452 }
453 
454 
455 static void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
456 {
457  const Locale* pAdd = rAdd.getConstArray();
458  Sequence<Locale> aLocToAdd(rAdd.getLength());
459  const Locale* pAllLocales = aAllLocales.getConstArray();
460  Locale* pLocToAdd = aLocToAdd.getArray();
461  sal_Int32 nFound = 0;
462  sal_Int32 i;
463  for(i = 0; i < rAdd.getLength(); i++)
464  {
465  bool bFound = false;
466  for(sal_Int32 j = 0; j < aAllLocales.getLength() && !bFound; j++)
467  {
468  bFound = pAdd[i].Language == pAllLocales[j].Language &&
469  pAdd[i].Country == pAllLocales[j].Country &&
470  pAdd[i].Variant == pAllLocales[j].Variant;
471  }
472  if(!bFound)
473  {
474  pLocToAdd[nFound++] = pAdd[i];
475  }
476  }
477  sal_Int32 nLength = aAllLocales.getLength();
478  aAllLocales.realloc( nLength + nFound);
479  Locale* pAllLocales2 = aAllLocales.getArray();
480  for(i = 0; i < nFound; i++)
481  pAllLocales2[nLength++] = pLocToAdd[i];
482 }
483 
485  SvxLinguData_Impl &rData,
486  const ServiceInfo_Impl &rToAdd )
487 {
488  sal_uInt32 nCnt = 0;
489 
490  ServiceInfoArr &rSvcInfoArr = rData.GetDisplayServiceArray();
491  sal_uInt32 nEntries = rData.GetDisplayServiceCount();
492 
493  for (sal_uInt32 i = 0; i < nEntries; ++i)
494  {
495  ServiceInfo_Impl& rEntry = rSvcInfoArr[i];
496  if (rEntry.sDisplayName == rToAdd.sDisplayName)
497  {
498  if(rToAdd.xSpell.is())
499  {
500  DBG_ASSERT( !rEntry.xSpell.is() &&
501  rEntry.sSpellImplName.isEmpty(),
502  "merge conflict" );
503  rEntry.sSpellImplName = rToAdd.sSpellImplName;
504  rEntry.xSpell = rToAdd.xSpell;
505  }
506  if(rToAdd.xGrammar.is())
507  {
508  DBG_ASSERT( !rEntry.xGrammar.is() &&
509  rEntry.sGrammarImplName.isEmpty(),
510  "merge conflict" );
511  rEntry.sGrammarImplName = rToAdd.sGrammarImplName;
512  rEntry.xGrammar = rToAdd.xGrammar;
513  }
514  if(rToAdd.xHyph.is())
515  {
516  DBG_ASSERT( !rEntry.xHyph.is() &&
517  rEntry.sHyphImplName.isEmpty(),
518  "merge conflict" );
519  rEntry.sHyphImplName = rToAdd.sHyphImplName;
520  rEntry.xHyph = rToAdd.xHyph;
521  }
522  if(rToAdd.xThes.is())
523  {
524  DBG_ASSERT( !rEntry.xThes.is() &&
525  rEntry.sThesImplName.isEmpty(),
526  "merge conflict" );
527  rEntry.sThesImplName = rToAdd.sThesImplName;
528  rEntry.xThes = rToAdd.xThes;
529  }
530  return ;
531  }
532  ++nCnt;
533  }
534  rData.GetDisplayServiceArray().push_back( rToAdd );
535  rData.SetDisplayServiceCount( nCnt + 1 );
536 }
537 
539  nDisplayServices (0)
540 {
541  uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
542  xLinguSrvcMgr = LinguServiceManager::create(xContext);
543 
544  const Locale& rCurrentLocale = Application::GetSettings().GetLanguageTag().getLocale();
545  Sequence<Any> aArgs(2);//second arguments has to be empty!
546  aArgs.getArray()[0] <<= LinguMgr::GetLinguPropertySet();
547 
548  //read spell checker
549  Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices(
550  cSpell, Locale() );
551  const OUString* pSpellNames = aSpellNames.getConstArray();
552 
553  sal_Int32 nIdx;
554  for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++)
555  {
556  ServiceInfo_Impl aInfo;
557  aInfo.sSpellImplName = pSpellNames[nIdx];
558  aInfo.xSpell.set(
559  xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aInfo.sSpellImplName, aArgs, xContext), UNO_QUERY);
560 
561  uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY);
562  if(xDispName.is())
563  aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
564 
565  const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() );
567  if (aLocales.hasElements())
568  {
570  lcl_MergeDisplayArray( *this, aInfo );
571  }
572  }
573 
574  //read grammar checker
575  Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices(
576  cGrammar, Locale() );
577  const OUString* pGrammarNames = aGrammarNames.getConstArray();
578  for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++)
579  {
580  ServiceInfo_Impl aInfo;
581  aInfo.sGrammarImplName = pGrammarNames[nIdx];
582  aInfo.xGrammar.set(
583  xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aInfo.sGrammarImplName, aArgs, xContext), UNO_QUERY);
584 
585  uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY);
586  if(xDispName.is())
587  aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
588 
589  const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() );
591  if (aLocales.hasElements())
592  {
594  lcl_MergeDisplayArray( *this, aInfo );
595  }
596  }
597 
598  //read hyphenator
599  Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices(
600  cHyph, Locale() );
601  const OUString* pHyphNames = aHyphNames.getConstArray();
602  for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++)
603  {
604  ServiceInfo_Impl aInfo;
605  aInfo.sHyphImplName = pHyphNames[nIdx];
606  aInfo.xHyph.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aInfo.sHyphImplName, aArgs, xContext), UNO_QUERY);
607 
608  uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY);
609  if(xDispName.is())
610  aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
611 
612  const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() );
614  if (aLocales.hasElements())
615  {
617  lcl_MergeDisplayArray( *this, aInfo );
618  }
619  }
620 
621  //read thesauri
622  Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices(
623  cThes, Locale() );
624  const OUString* pThesNames = aThesNames.getConstArray();
625  for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++)
626  {
627  ServiceInfo_Impl aInfo;
628  aInfo.sThesImplName = pThesNames[nIdx];
629  aInfo.xThes.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aInfo.sThesImplName, aArgs, xContext), UNO_QUERY);
630 
631  uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY);
632  if(xDispName.is())
633  aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
634 
635  const Sequence< Locale > aLocales( aInfo.xThes->getLocales() );
637  if (aLocales.hasElements())
638  {
640  lcl_MergeDisplayArray( *this, aInfo );
641  }
642  }
643 
644  Sequence< OUString > aCfgSvcs;
645  const Locale* pAllLocales = aAllServiceLocales.getConstArray();
646  for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++)
647  {
648  LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[nLocale] );
649 
650  aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cSpell, pAllLocales[nLocale]);
651  SetChecked( aCfgSvcs );
652  if (aCfgSvcs.hasElements())
653  aCfgSpellTable[ nLang ] = aCfgSvcs;
654 
655  aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cGrammar, pAllLocales[nLocale]);
656  SetChecked( aCfgSvcs );
657  if (aCfgSvcs.hasElements())
658  aCfgGrammarTable[ nLang ] = aCfgSvcs;
659 
660  aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cHyph, pAllLocales[nLocale]);
661  SetChecked( aCfgSvcs );
662  if (aCfgSvcs.hasElements())
663  aCfgHyphTable[ nLang ] = aCfgSvcs;
664 
665  aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cThes, pAllLocales[nLocale]);
666  SetChecked( aCfgSvcs );
667  if (aCfgSvcs.hasElements())
668  aCfgThesTable[ nLang ] = aCfgSvcs;
669  }
670 }
671 
672 void SvxLinguData_Impl::SetChecked(const Sequence<OUString>& rConfiguredServices)
673 {
674  const OUString* pConfiguredServices = rConfiguredServices.getConstArray();
675  for(sal_Int32 n = 0; n < rConfiguredServices.getLength(); n++)
676  {
677  for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
678  {
680  if (!rEntry.bConfigured)
681  {
682  const OUString &rSrvcImplName = pConfiguredServices[n];
683  if (!rSrvcImplName.isEmpty() &&
684  (rEntry.sSpellImplName == rSrvcImplName ||
685  rEntry.sGrammarImplName == rSrvcImplName ||
686  rEntry.sHyphImplName == rSrvcImplName ||
687  rEntry.sThesImplName == rSrvcImplName))
688  {
689  rEntry.bConfigured = true;
690  break;
691  }
692  }
693  }
694  }
695 }
696 
698  Sequence< OUString > &rConfigured,
699  const OUString &rImplName, bool bAdd )
700 {
701  bool bRet = false; // modified?
702 
703  sal_Int32 nEntries = rConfigured.getLength();
704  sal_Int32 nPos = lcl_SeqGetEntryPos(rConfigured, rImplName);
705  if (bAdd && nPos < 0) // add new entry
706  {
707  rConfigured.realloc( ++nEntries );
708  OUString *pConfigured = rConfigured.getArray();
709  pConfigured[nEntries - 1] = rImplName;
710  bRet = true;
711  }
712  else if (!bAdd && nPos >= 0) // remove existing entry
713  {
714  OUString *pConfigured = rConfigured.getArray();
715  for (sal_Int32 i = nPos; i < nEntries - 1; ++i)
716  pConfigured[i] = pConfigured[i + 1];
717  rConfigured.realloc(--nEntries);
718  bRet = true;
719  }
720 
721  return bRet;
722 }
723 
724 
725 void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable )
726 {
727  DBG_ASSERT( !rDisplayName.isEmpty(), "empty DisplayName" );
728 
729  ServiceInfo_Impl *pInfo = nullptr;
730  for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
731  {
733  if (rTmp.sDisplayName == rDisplayName)
734  {
735  pInfo = &rTmp;
736  break;
737  }
738  }
739  DBG_ASSERT( pInfo, "DisplayName entry not found" );
740  if (pInfo)
741  {
742  pInfo->bConfigured = bEnable;
743 
744  Sequence< Locale > aLocales;
745  const Locale *pLocale = nullptr;
746  sal_Int32 nLocales = 0;
747  sal_Int32 i;
748 
749  // update configured spellchecker entries
750  if (pInfo->xSpell.is())
751  {
752  aLocales = pInfo->xSpell->getLocales();
753  pLocale = aLocales.getConstArray();
754  nLocales = aLocales.getLength();
755  for (i = 0; i < nLocales; ++i)
756  {
757  LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
758  if (!aCfgSpellTable.count( nLang ) && bEnable)
760  if (aCfgSpellTable.count( nLang ))
761  AddRemove( aCfgSpellTable[ nLang ], pInfo->sSpellImplName, bEnable );
762  }
763  }
764 
765  // update configured grammar checker entries
766  if (pInfo->xGrammar.is())
767  {
768  aLocales = pInfo->xGrammar->getLocales();
769  pLocale = aLocales.getConstArray();
770  nLocales = aLocales.getLength();
771  for (i = 0; i < nLocales; ++i)
772  {
773  LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
774  if (!aCfgGrammarTable.count( nLang ) && bEnable)
776  if (aCfgGrammarTable.count( nLang ))
777  AddRemove( aCfgGrammarTable[ nLang ], pInfo->sGrammarImplName, bEnable );
778  }
779  }
780 
781  // update configured hyphenator entries
782  if (pInfo->xHyph.is())
783  {
784  aLocales = pInfo->xHyph->getLocales();
785  pLocale = aLocales.getConstArray();
786  nLocales = aLocales.getLength();
787  for (i = 0; i < nLocales; ++i)
788  {
789  LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
790  if (!aCfgHyphTable.count( nLang ) && bEnable)
791  aCfgHyphTable[ nLang ] = Sequence< OUString >();
792  if (aCfgHyphTable.count( nLang ))
793  AddRemove( aCfgHyphTable[ nLang ], pInfo->sHyphImplName, bEnable );
794  }
795  }
796 
797  // update configured spellchecker entries
798  if (pInfo->xThes.is())
799  {
800  aLocales = pInfo->xThes->getLocales();
801  pLocale = aLocales.getConstArray();
802  nLocales = aLocales.getLength();
803  for (i = 0; i < nLocales; ++i)
804  {
805  LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
806  if (!aCfgThesTable.count( nLang ) && bEnable)
807  aCfgThesTable[ nLang ] = Sequence< OUString >();
808  if (aCfgThesTable.count( nLang ))
809  AddRemove( aCfgThesTable[ nLang ], pInfo->sThesImplName, bEnable );
810  }
811  }
812  }
813 }
814 
815 
816 // class SvxLinguTabPage -------------------------------------------------
817 
819  : SfxTabPage(pPage, pController, "cui/ui/optlingupage.ui", "OptLinguPage", &rSet)
820  , sCapitalWords (CuiResId(RID_SVXSTR_CAPITAL_WORDS))
821  , sWordsWithDigits(CuiResId(RID_SVXSTR_WORDS_WITH_DIGITS))
822  , sSpellSpecial (CuiResId(RID_SVXSTR_SPELL_SPECIAL))
823  , sSpellAuto (CuiResId(RID_SVXSTR_SPELL_AUTO))
824  , sGrammarAuto (CuiResId(RID_SVXSTR_GRAMMAR_AUTO))
825  , sNumMinWordlen (CuiResId(RID_SVXSTR_NUM_MIN_WORDLEN))
826  , sNumPreBreak (CuiResId(RID_SVXSTR_NUM_PRE_BREAK))
827  , sNumPostBreak (CuiResId(RID_SVXSTR_NUM_POST_BREAK))
828  , sHyphAuto (CuiResId(RID_SVXSTR_HYPH_AUTO))
829  , sHyphSpecial (CuiResId(RID_SVXSTR_HYPH_SPECIAL))
830  , nUPN_HYPH_MIN_WORD_LENGTH(-1)
831  , nUPN_HYPH_MIN_LEADING(-1)
832  , nUPN_HYPH_MIN_TRAILING(-1)
833  , m_xLinguModulesFT(m_xBuilder->weld_label("lingumodulesft"))
834  , m_xLinguModulesCLB(m_xBuilder->weld_tree_view("lingumodules"))
835  , m_xLinguModulesEditPB(m_xBuilder->weld_button("lingumodulesedit"))
836  , m_xLinguDicsFT(m_xBuilder->weld_label("lingudictsft"))
837  , m_xLinguDicsCLB(m_xBuilder->weld_tree_view("lingudicts"))
838  , m_xLinguDicsNewPB(m_xBuilder->weld_button("lingudictsnew"))
839  , m_xLinguDicsEditPB(m_xBuilder->weld_button("lingudictsedit"))
840  , m_xLinguDicsDelPB(m_xBuilder->weld_button("lingudictsdelete"))
841  , m_xLinguOptionsCLB(m_xBuilder->weld_tree_view("linguoptions"))
842  , m_xLinguOptionsEditPB(m_xBuilder->weld_button("linguoptionsedit"))
843  , m_xMoreDictsLink(m_xBuilder->weld_link_button("moredictslink"))
844 {
845  std::vector<int> aWidths;
846  aWidths.push_back(m_xLinguModulesCLB->get_checkbox_column_width());
847 
848  m_xLinguModulesCLB->set_column_fixed_widths(aWidths);
849  m_xLinguDicsCLB->set_column_fixed_widths(aWidths);
850  m_xLinguOptionsCLB->set_column_fixed_widths(aWidths);
851 
852  m_xLinguModulesCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
853  m_xLinguModulesCLB->connect_row_activated(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
854  m_xLinguModulesCLB->connect_toggled(LINK(this, SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl));
855 
856  m_xLinguModulesEditPB->connect_clicked( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
857  m_xLinguOptionsEditPB->connect_clicked( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
858 
859  m_xLinguDicsCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
860  m_xLinguDicsCLB->connect_toggled(LINK(this, SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl));
861 
862  m_xLinguDicsNewPB->connect_clicked( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
863  m_xLinguDicsEditPB->connect_clicked( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
864  m_xLinguDicsDelPB->connect_clicked( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
865 
866  m_xLinguOptionsCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
867  m_xLinguOptionsCLB->connect_row_activated(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
868 
869  if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
870  m_xMoreDictsLink->hide();
871 
873  xDicList.set( LinguMgr::GetDictionaryList(), UNO_QUERY );
874  if (xDicList.is())
875  {
876  // keep references to all **currently** available dictionaries,
877  // since the diclist may get changed meanwhile (e.g. through the API).
878  // We want the dialog to operate on the same set of dictionaries it
879  // was started with.
880  // Also we have to take care to not lose the last reference when
881  // someone else removes a dictionary from the list.
882  // removed dics will be replaced by NULL new entries be added to the end
883  // Thus we may use indices as consistent references.
884  aDics = xDicList->getDictionaries();
885 
887  }
888  else
889  {
890  m_xLinguDicsFT->set_sensitive(false);
891  m_xLinguDicsCLB->set_sensitive(false);
892  m_xLinguDicsNewPB->set_sensitive(false);
893  m_xLinguDicsEditPB->set_sensitive(false);
894  m_xLinguDicsDelPB->set_sensitive(false);
895  }
896 }
897 
899 {
900  pLinguData.reset();
901 }
902 
903 std::unique_ptr<SfxTabPage> SvxLinguTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
904  const SfxItemSet* rAttrSet )
905 {
906  return std::make_unique<SvxLinguTabPage>( pPage, pController, *rAttrSet );
907 }
908 
910 {
911  bool bModified = true; // !!!!
912 
913  // if not HideGroups was called with GROUP_MODULES...
914  if (m_xLinguModulesCLB->get_visible())
915  {
916  DBG_ASSERT( pLinguData, "pLinguData not yet initialized" );
917  if (!pLinguData)
918  pLinguData.reset( new SvxLinguData_Impl );
919 
920  // update spellchecker configuration entries
921  const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
922  for (auto const& elem : *pTable)
923  {
924  LanguageType nLang = elem.first;
925  const Sequence< OUString > aImplNames(elem.second);
926  uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
927  Locale aLocale( LanguageTag::convertToLocale(nLang) );
928  if (xMgr.is())
929  xMgr->setConfiguredServices( cSpell, aLocale, aImplNames );
930  }
931 
932  // update grammar checker configuration entries
933  pTable = &pLinguData->GetGrammarTable();
934  for (auto const& elem : *pTable)
935  {
936  LanguageType nLang = elem.first;
937  const Sequence< OUString > aImplNames(elem.second);
938  uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
939  Locale aLocale( LanguageTag::convertToLocale(nLang) );
940  if (xMgr.is())
941  xMgr->setConfiguredServices( cGrammar, aLocale, aImplNames );
942  }
943 
944  // update hyphenator configuration entries
945  pTable = &pLinguData->GetHyphTable();
946  for (auto const& elem : *pTable)
947  {
948  LanguageType nLang = elem.first;
949  const Sequence< OUString > aImplNames(elem.second);
950  uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
951  Locale aLocale( LanguageTag::convertToLocale(nLang) );
952  if (xMgr.is())
953  xMgr->setConfiguredServices( cHyph, aLocale, aImplNames );
954  }
955 
956  // update thesaurus configuration entries
957  pTable = &pLinguData->GetThesTable();
958  for (auto const& elem : *pTable)
959  {
960  LanguageType nLang = elem.first;
961  const Sequence< OUString > aImplNames(elem.second);
962  uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
963  Locale aLocale( LanguageTag::convertToLocale(nLang) );
964  if (xMgr.is())
965  xMgr->setConfiguredServices( cThes, aLocale, aImplNames );
966  }
967  }
968 
969 
970  // activate dictionaries according to checkbox state
971 
972  Sequence< OUString > aActiveDics;
973  sal_Int32 nActiveDics = 0;
974  int nEntries = m_xLinguDicsCLB->n_children();
975  for (int i = 0; i < nEntries; ++i)
976  {
977  sal_Int32 nDics = aDics.getLength();
978 
979  aActiveDics.realloc( nDics );
980  OUString *pActiveDic = aActiveDics.getArray();
981 
982  DicUserData aData(m_xLinguDicsCLB->get_id(i).toUInt32());
983  if (aData.GetEntryId() < nDics)
984  {
985  bool bChecked = m_xLinguDicsCLB->get_toggle(i, 0) == TRISTATE_TRUE;
986  uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] );
987  if (xDic.is())
988  {
989  if (LinguMgr::GetIgnoreAllList() == xDic)
990  bChecked = true;
991  xDic->setActive( bChecked );
992 
993  if (bChecked)
994  {
995  OUString aDicName( xDic->getName() );
996  pActiveDic[ nActiveDics++ ] = aDicName;
997  }
998  }
999  }
1000  }
1001 
1002  aActiveDics.realloc( nActiveDics );
1003  Any aTmp;
1004  aTmp <<= aActiveDics;
1005  SvtLinguConfig aLngCfg;
1006  aLngCfg.SetProperty( UPH_ACTIVE_DICTIONARIES, aTmp );
1007 
1008 
1009  nEntries = m_xLinguOptionsCLB->n_children();
1010  for (int j = 0; j < nEntries; ++j)
1011  {
1012  OptionsUserData aData(m_xLinguOptionsCLB->get_id(j).toUInt32());
1013  OUString aPropName( lcl_GetPropertyName( static_cast<EID_OPTIONS>(aData.GetEntryId()) ) );
1014 
1015  Any aAny;
1016  if (aData.IsCheckable())
1017  {
1018  bool bChecked = m_xLinguOptionsCLB->get_toggle(j, 0) == TRISTATE_TRUE;
1019  aAny <<= bChecked;
1020  }
1021  else if (aData.HasNumericValue())
1022  {
1023  sal_Int16 nVal = aData.GetNumericValue();
1024  aAny <<= nVal;
1025  }
1026 
1027  if (xProp.is())
1028  xProp->setPropertyValue( aPropName, aAny );
1029  aLngCfg.SetProperty( aPropName, aAny );
1030  }
1031 
1032  OptionsUserData aPreBreakData(m_xLinguOptionsCLB->get_id(EID_NUM_PRE_BREAK).toUInt32());
1033  OptionsUserData aPostBreakData(m_xLinguOptionsCLB->get_id(EID_NUM_POST_BREAK).toUInt32());
1034  if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() )
1035  {
1036  SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) );
1037  aHyp.GetMinLead() = static_cast<sal_uInt8>(aPreBreakData.GetNumericValue());
1038  aHyp.GetMinTrail() = static_cast<sal_uInt8>(aPostBreakData.GetNumericValue());
1039  rCoreSet->Put( aHyp );
1040  }
1041 
1042  // automatic spell checking
1043  bool bNewAutoCheck = m_xLinguOptionsCLB->get_toggle(EID_SPELL_AUTO, 0) == TRISTATE_TRUE;
1044  const SfxPoolItem* pOld = GetOldItem( *rCoreSet, SID_AUTOSPELL_CHECK );
1045  if ( !pOld || static_cast<const SfxBoolItem*>(pOld)->GetValue() != bNewAutoCheck )
1046  {
1047  rCoreSet->Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ),
1048  bNewAutoCheck ) );
1049  bModified = true;
1050  }
1051 
1052  return bModified;
1053 }
1054 
1055 sal_uInt32 SvxLinguTabPage::GetDicUserData( const uno::Reference< XDictionary > &rxDic, sal_uInt16 nIdx )
1056 {
1057  sal_uInt32 nRes = 0;
1058  DBG_ASSERT( rxDic.is(), "dictionary not supplied" );
1059  if (rxDic.is())
1060  {
1061  uno::Reference< frame::XStorable > xStor( rxDic, UNO_QUERY );
1062 
1063  bool bChecked = rxDic->isActive();
1064  bool bEditable = !xStor.is() || !xStor->isReadonly();
1065  bool bDeletable = bEditable;
1066 
1067  nRes = DicUserData( nIdx,
1068  bChecked, bEditable, bDeletable ).GetUserData();
1069  }
1070  return nRes;
1071 }
1072 
1073 
1075  const uno::Reference< XDictionary > &rxDic,
1076  sal_uInt16 nIdx )
1077 {
1078  m_xLinguDicsCLB->freeze();
1079 
1080  OUString aTxt( ::GetDicInfoStr( rxDic->getName(),
1081  LanguageTag( rxDic->getLocale() ).getLanguageType(),
1082  DictionaryType_NEGATIVE == rxDic->getDictionaryType() ) );
1083  m_xLinguDicsCLB->append(); // append at end
1084  int nEntry = m_xLinguDicsCLB->n_children() - 1;
1085  DicUserData aData( GetDicUserData( rxDic, nIdx ) );
1086  m_xLinguDicsCLB->set_id(nEntry, OUString::number(aData.GetUserData()));
1087  m_xLinguDicsCLB->set_toggle(nEntry, aData.IsChecked() ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1088  m_xLinguDicsCLB->set_text(nEntry, aTxt, 1); // append at end
1089 
1090  m_xLinguDicsCLB->thaw();
1091 }
1092 
1094 {
1095  m_xLinguDicsCLB->freeze();
1096  m_xLinguDicsCLB->clear();
1097 
1098  sal_Int32 nDics = aDics.getLength();
1099  const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
1100  for (sal_Int32 i = 0; i < nDics; ++i)
1101  {
1102  const uno::Reference< XDictionary > &rDic = pDic[i];
1103  if (rDic.is())
1104  AddDicBoxEntry( rDic, static_cast<sal_uInt16>(i) );
1105  }
1106 
1107  m_xLinguDicsCLB->thaw();
1108  if (m_xLinguDicsCLB->n_children())
1109  {
1110  m_xLinguDicsCLB->select(0);
1111  SelectHdl_Impl(*m_xLinguDicsCLB);
1112  }
1113 }
1114 
1116 {
1117  if (pLinguData)
1118  {
1119  const ServiceInfoArr &rAllDispSrvcArr = pLinguData->GetDisplayServiceArray();
1120  const sal_uInt32 nDispSrvcCount = pLinguData->GetDisplayServiceCount();
1121 
1122  m_xLinguModulesCLB->clear();
1123 
1124  for (sal_uInt32 i = 0; i < nDispSrvcCount; ++i)
1125  {
1126  const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
1127  m_xLinguModulesCLB->append();
1128  m_xLinguModulesCLB->set_id(i, OUString::number(reinterpret_cast<sal_Int64>(&rInfo)));
1129  m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1130  m_xLinguModulesCLB->set_text(i, rInfo.sDisplayName, 1);
1131  }
1132  if (nDispSrvcCount)
1133  {
1134  m_xLinguModulesCLB->select(0);
1135  SelectHdl_Impl(*m_xLinguModulesCLB);
1136  }
1137  m_xLinguModulesEditPB->set_sensitive( nDispSrvcCount > 0 );
1138  }
1139 }
1140 
1142 {
1143  // if not HideGroups was called with GROUP_MODULES...
1144  if (m_xLinguModulesCLB->get_visible())
1145  {
1146  if (!pLinguData)
1147  pLinguData.reset( new SvxLinguData_Impl );
1149  }
1150 
1151 
1152  // get data from configuration
1153  SvtLinguConfig aLngCfg;
1154 
1155  m_xLinguOptionsCLB->freeze();
1156  m_xLinguOptionsCLB->clear();
1157 
1158  sal_Int16 nVal = 0;
1159  bool bVal = false;
1160  sal_uInt32 nUserData = 0;
1161 
1162  m_xLinguOptionsCLB->append();
1163  int nEntry = 0;
1164 
1165  aLngCfg.GetProperty( UPN_IS_SPELL_AUTO ) >>= bVal;
1166  const SfxPoolItem* pItem = GetItem( *rSet, SID_AUTOSPELL_CHECK );
1167  if (pItem)
1168  bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
1169  nUserData = OptionsUserData( EID_SPELL_AUTO, false, 0, true, bVal).GetUserData();
1170  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1171  m_xLinguOptionsCLB->set_text(nEntry, sSpellAuto, 1);
1172  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1173 
1174  m_xLinguOptionsCLB->append();
1175  ++nEntry;
1176 
1177  aLngCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bVal;
1178  nUserData = OptionsUserData( EID_GRAMMAR_AUTO, false, 0, true, bVal).GetUserData();
1179  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1180  m_xLinguOptionsCLB->set_text(nEntry, sGrammarAuto, 1);
1181  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1182 
1183  m_xLinguOptionsCLB->append();
1184  ++nEntry;
1185 
1186  aLngCfg.GetProperty( UPN_IS_SPELL_UPPER_CASE ) >>= bVal;
1187  nUserData = OptionsUserData( EID_CAPITAL_WORDS, false, 0, true, bVal).GetUserData();
1188  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1189  m_xLinguOptionsCLB->set_text(nEntry, sCapitalWords, 1);
1190  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1191 
1192  m_xLinguOptionsCLB->append();
1193  ++nEntry;
1194 
1195  aLngCfg.GetProperty( UPN_IS_SPELL_WITH_DIGITS ) >>= bVal;
1196  nUserData = OptionsUserData( EID_WORDS_WITH_DIGITS, false, 0, true, bVal).GetUserData();
1197  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1198  m_xLinguOptionsCLB->set_text(nEntry, sWordsWithDigits, 1);
1199  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1200 
1201  m_xLinguOptionsCLB->append();
1202  ++nEntry;
1203 
1204  aLngCfg.GetProperty( UPN_IS_SPELL_SPECIAL ) >>= bVal;
1205  nUserData = OptionsUserData( EID_SPELL_SPECIAL, false, 0, true, bVal).GetUserData();
1206  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1207  m_xLinguOptionsCLB->set_text(nEntry, sSpellSpecial, 1);
1208  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1209 
1210  m_xLinguOptionsCLB->append();
1211  ++nEntry;
1212 
1213  aLngCfg.GetProperty( UPN_HYPH_MIN_WORD_LENGTH ) >>= nVal;
1214  nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
1215  m_xLinguOptionsCLB->set_text(nEntry, sNumMinWordlen + " " + OUString::number(nVal), 1);
1216  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1217  nUPN_HYPH_MIN_WORD_LENGTH = nEntry;
1218 
1219  const SfxHyphenRegionItem *pHyp = nullptr;
1220  sal_uInt16 nWhich = GetWhich( SID_ATTR_HYPHENREGION );
1221  if ( rSet->GetItemState( nWhich, false ) == SfxItemState::SET )
1222  pHyp = &static_cast<const SfxHyphenRegionItem &>( rSet->Get( nWhich ) );
1223 
1224  m_xLinguOptionsCLB->append();
1225  ++nEntry;
1226 
1227  aLngCfg.GetProperty( UPN_HYPH_MIN_LEADING ) >>= nVal;
1228  if (pHyp)
1229  nVal = static_cast<sal_Int16>(pHyp->GetMinLead());
1230  nUserData = OptionsUserData( EID_NUM_PRE_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
1231  m_xLinguOptionsCLB->set_text(nEntry, sNumPreBreak + " " + OUString::number(nVal), 1);
1232  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1233  nUPN_HYPH_MIN_LEADING = nEntry;
1234 
1235  m_xLinguOptionsCLB->append();
1236  ++nEntry;
1237 
1238  aLngCfg.GetProperty( UPN_HYPH_MIN_TRAILING ) >>= nVal;
1239  if (pHyp)
1240  nVal = static_cast<sal_Int16>(pHyp->GetMinTrail());
1241  nUserData = OptionsUserData( EID_NUM_POST_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
1242  m_xLinguOptionsCLB->set_text(nEntry, sNumPostBreak + " " + OUString::number(nVal), 1);
1243  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1244  nUPN_HYPH_MIN_TRAILING = nEntry;
1245 
1246  m_xLinguOptionsCLB->append();
1247  ++nEntry;
1248 
1249  aLngCfg.GetProperty( UPN_IS_HYPH_AUTO ) >>= bVal;
1250  nUserData = OptionsUserData( EID_HYPH_AUTO, false, 0, true, bVal).GetUserData();
1251  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1252  m_xLinguOptionsCLB->set_text(nEntry, sHyphAuto, 1);
1253  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1254 
1255  m_xLinguOptionsCLB->append();
1256  ++nEntry;
1257 
1258  aLngCfg.GetProperty( UPN_IS_HYPH_SPECIAL ) >>= bVal;
1259  nUserData = OptionsUserData( EID_HYPH_SPECIAL, false, 0, true, bVal).GetUserData();
1260  m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1261  m_xLinguOptionsCLB->set_text(nEntry, sHyphSpecial, 1);
1262  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
1263 
1264  m_xLinguOptionsCLB->thaw();
1265 
1266  m_xLinguOptionsCLB->select(0);
1267  SelectHdl_Impl(*m_xLinguOptionsCLB);
1268 
1269  m_xLinguModulesCLB->set_size_request(m_xLinguModulesCLB->get_preferred_size().Width(),
1270  m_xLinguModulesCLB->get_height_rows(3));
1271  m_xLinguDicsCLB->set_size_request(m_xLinguDicsCLB->get_preferred_size().Width(),
1272  m_xLinguDicsCLB->get_height_rows(5));
1273  m_xLinguOptionsCLB->set_size_request(m_xLinguOptionsCLB->get_preferred_size().Width(),
1274  m_xLinguOptionsCLB->get_height_rows(5));
1275 }
1276 
1277 IMPL_LINK(SvxLinguTabPage, BoxDoubleClickHdl_Impl, weld::TreeView&, rBox, bool)
1278 {
1279  if (&rBox == m_xLinguModulesCLB.get())
1280  {
1285  this, SvxLinguTabPage, PostDblClickHdl_Impl ), nullptr, true);
1286  }
1287  else if (&rBox == m_xLinguOptionsCLB.get())
1288  {
1289  ClickHdl_Impl(*m_xLinguOptionsEditPB);
1290  }
1291  return true;
1292 }
1293 
1294 IMPL_LINK_NOARG(SvxLinguTabPage, PostDblClickHdl_Impl, void*, void)
1295 {
1296  ClickHdl_Impl(*m_xLinguModulesEditPB);
1297 }
1298 
1299 IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const row_col&, rRowCol, void)
1300 {
1301  if (!pLinguData)
1302  return;
1303  auto nPos = rRowCol.first;
1304  pLinguData->Reconfigure(m_xLinguModulesCLB->get_text(nPos, 1),
1305  m_xLinguModulesCLB->get_toggle(nPos, 0) == TRISTATE_TRUE);
1306 }
1307 
1308 IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const row_col&, rRowCol, void)
1309 {
1310  auto nPos = rRowCol.first;
1311  const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[ nPos ];
1312  if (LinguMgr::GetIgnoreAllList() == rDic)
1313  m_xLinguDicsCLB->set_toggle(nPos, TRISTATE_TRUE, 0);
1314 }
1315 
1316 IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
1317 {
1318  if (m_xLinguModulesEditPB.get() == &rBtn)
1319  {
1320  if (!pLinguData)
1321  pLinguData.reset( new SvxLinguData_Impl );
1322 
1323  SvxLinguData_Impl aOldLinguData( *pLinguData );
1324  SvxEditModulesDlg aDlg(GetFrameWeld(), *pLinguData);
1325  if (aDlg.run() != RET_OK)
1326  *pLinguData = aOldLinguData;
1327 
1328  // evaluate new status of 'bConfigured' flag
1329  sal_uInt32 nLen = pLinguData->GetDisplayServiceCount();
1330  for (sal_uInt32 i = 0; i < nLen; ++i)
1331  pLinguData->GetDisplayServiceArray()[i].bConfigured = false;
1332  const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray();
1333  sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
1334  for (sal_Int32 k = 0; k < nLocales; ++k)
1335  {
1336  LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[k] );
1337  if (pLinguData->GetSpellTable().count( nLang ))
1338  pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
1339  if (pLinguData->GetGrammarTable().count( nLang ))
1340  pLinguData->SetChecked( pLinguData->GetGrammarTable()[ nLang ] );
1341  if (pLinguData->GetHyphTable().count( nLang ))
1342  pLinguData->SetChecked( pLinguData->GetHyphTable()[ nLang ] );
1343  if (pLinguData->GetThesTable().count( nLang ))
1344  pLinguData->SetChecked( pLinguData->GetThesTable()[ nLang ] );
1345  }
1346 
1347  // show new status of modules
1348  UpdateModulesBox_Impl();
1349  }
1350  else if (m_xLinguDicsNewPB.get() == &rBtn)
1351  {
1354  uno::Reference< XDictionary > xNewDic;
1355  if ( aDlg->Execute() == RET_OK )
1356  xNewDic = aDlg->GetNewDictionary();
1357  if ( xNewDic.is() )
1358  {
1359  // add new dics to the end
1360  sal_Int32 nLen = aDics.getLength();
1361  aDics.realloc( nLen + 1 );
1362 
1363  aDics.getArray()[ nLen ] = xNewDic;
1364 
1365  AddDicBoxEntry( xNewDic, static_cast<sal_uInt16>(nLen) );
1366  }
1367  }
1368  else if (m_xLinguDicsEditPB.get() == &rBtn)
1369  {
1370  int nEntry = m_xLinguDicsCLB->get_selected_index();
1371  if (nEntry != -1)
1372  {
1373  DicUserData aData(m_xLinguDicsCLB->get_id(nEntry).toUInt32());
1374  sal_uInt16 nDicPos = aData.GetEntryId();
1375  sal_Int32 nDics = aDics.getLength();
1376  if (nDicPos < nDics)
1377  {
1378  uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
1379  if (xDic.is())
1380  {
1383  aDlg->Execute();
1384  }
1385  }
1386  }
1387  }
1388  else if (m_xLinguDicsDelPB.get() == &rBtn)
1389  {
1390  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletedictionarydialog.ui"));
1391  std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteDictionaryDialog"));
1392  if (RET_NO == xQuery->run())
1393  return;
1394 
1395  int nEntry = m_xLinguDicsCLB->get_selected_index();
1396  if (nEntry != -1)
1397  {
1398  DicUserData aData(m_xLinguDicsCLB->get_id(nEntry).toUInt32());
1399  sal_uInt16 nDicPos = aData.GetEntryId();
1400  sal_Int32 nDics = aDics.getLength();
1401  if (nDicPos < nDics)
1402  {
1403  uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
1404  if (xDic.is())
1405  {
1406  if (LinguMgr::GetIgnoreAllList() == xDic)
1407  xDic->clear();
1408  else
1409  {
1410  if (xDicList.is())
1411  xDicList->removeDictionary( xDic );
1412 
1413  uno::Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
1414  if ( xStor->hasLocation() && !xStor->isReadonly() )
1415  {
1416  OUString sURL = xStor->getLocation();
1417  INetURLObject aObj(sURL);
1418  DBG_ASSERT( aObj.GetProtocol() == INetProtocol::File,
1419  "non-file URLs cannot be deleted" );
1420  if ( aObj.GetProtocol() == INetProtocol::File )
1421  {
1423  }
1424  }
1425 
1426  aDics.getArray()[ nDicPos ] = nullptr;
1427 
1428  // remove entry from checklistbox
1429  int nCnt = m_xLinguDicsCLB->n_children();
1430  for (int i = 0; i < nCnt; ++i)
1431  {
1432  DicUserData aDicData(m_xLinguDicsCLB->get_id(i).toUInt32());
1433  if (aDicData.GetEntryId() == nDicPos )
1434  {
1435  m_xLinguDicsCLB->remove(i);
1436  break;
1437  }
1438  }
1439  DBG_ASSERT( nCnt > m_xLinguDicsCLB->n_children(),
1440  "remove failed ?");
1441  }
1442  }
1443  }
1444  }
1445  }
1446  else if (m_xLinguOptionsEditPB.get() == &rBtn)
1447  {
1448  int nEntry = m_xLinguOptionsCLB->get_selected_index();
1449  DBG_ASSERT(nEntry != -1, "no entry selected");
1450  if (nEntry != -1)
1451  {
1452  OptionsUserData aData(m_xLinguOptionsCLB->get_id(nEntry).toUInt32());
1453  if (aData.HasNumericValue())
1454  {
1455  sal_uInt16 nRID = aData.GetEntryId();
1456  OptionsBreakSet aDlg(GetFrameWeld(), nRID);
1457  aDlg.GetNumericFld().set_value(aData.GetNumericValue());
1458  if (RET_OK == aDlg.run())
1459  {
1460  int nVal = aDlg.GetNumericFld().get_value();
1461  if (-1 != nVal && aData.GetNumericValue() != nVal)
1462  {
1463  aData.SetNumericValue( static_cast<sal_uInt8>(nVal) );
1464  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(aData.GetUserData()));
1465  if (nEntry == nUPN_HYPH_MIN_WORD_LENGTH)
1466  m_xLinguOptionsCLB->set_text(nEntry, sNumMinWordlen + " " + OUString::number(nVal), 1);
1467  else if (nEntry == nUPN_HYPH_MIN_LEADING)
1468  m_xLinguOptionsCLB->set_text(nEntry, sNumPreBreak + " " + OUString::number(nVal), 1);
1469  else if (nEntry == nUPN_HYPH_MIN_TRAILING)
1470  m_xLinguOptionsCLB->set_text(nEntry, sNumPostBreak + " " + OUString::number(nVal), 1);
1471  m_xLinguOptionsCLB->set_id(nEntry, OUString::number(aData.GetUserData()));
1472  }
1473  }
1474  }
1475  }
1476  }
1477  else
1478  {
1479  OSL_FAIL( "rBtn unexpected value" );
1480  }
1481 }
1482 
1483 IMPL_LINK(SvxLinguTabPage, SelectHdl_Impl, weld::TreeView&, rBox, void)
1484 {
1485  if (m_xLinguModulesCLB.get() == &rBox)
1486  {
1487  }
1488  else if (m_xLinguDicsCLB.get() == &rBox)
1489  {
1490  int nEntry = rBox.get_selected_index();
1491  if (nEntry != -1)
1492  {
1493  DicUserData aData(rBox.get_id(nEntry).toUInt32());
1494 
1495  // always allow to edit (i.e. at least view the content of the dictionary)
1496  m_xLinguDicsEditPB->set_sensitive( true );
1497  m_xLinguDicsDelPB->set_sensitive( aData.IsDeletable() );
1498  }
1499  }
1500  else if (m_xLinguOptionsCLB.get() == &rBox)
1501  {
1502  int nEntry = rBox.get_selected_index();
1503  if (nEntry != -1)
1504  {
1505  OptionsUserData aData(rBox.get_id(nEntry).toUInt32());
1506  m_xLinguOptionsEditPB->set_sensitive( aData.HasNumericValue() );
1507  }
1508  }
1509  else
1510  {
1511  OSL_FAIL( "rBox unexpected value" );
1512  }
1513 }
1514 
1515 void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
1516 {
1517  if ( 0 != ( GROUP_MODULES & nGrp ) )
1518  {
1519  m_xLinguModulesFT->hide();
1520  m_xLinguModulesCLB->hide();
1521  m_xLinguModulesEditPB->hide();
1522 
1523  if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
1525  {
1526  m_xMoreDictsLink->show();
1527  }
1528  }
1529 }
1530 
1532  : GenericDialogController(pParent, "cui/ui/editmodulesdialog.ui", "EditModulesDialog")
1533  , sSpell(CuiResId(RID_SVXSTR_SPELL))
1534  , sHyph(CuiResId(RID_SVXSTR_HYPH))
1535  , sThes(CuiResId(RID_SVXSTR_THES))
1536  , sGrammar(CuiResId(RID_SVXSTR_GRAMMAR))
1537  , rLinguData(rData)
1538  , m_xModulesCLB(m_xBuilder->weld_tree_view("lingudicts"))
1539  , m_xPrioUpPB(m_xBuilder->weld_button("up"))
1540  , m_xPrioDownPB(m_xBuilder->weld_button("down"))
1541  , m_xBackPB(m_xBuilder->weld_button("back"))
1542  , m_xMoreDictsLink(m_xBuilder->weld_link_button("moredictslink"))
1543  , m_xClosePB(m_xBuilder->weld_button("close"))
1544  , m_xLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("language")))
1545 {
1546  m_xModulesCLB->set_size_request(m_xModulesCLB->get_approximate_digit_width() * 40,
1547  m_xModulesCLB->get_height_rows(12));
1548 
1549  std::vector<int> aWidths;
1550  aWidths.push_back(m_xModulesCLB->get_checkbox_column_width());
1551  m_xModulesCLB->set_column_fixed_widths(aWidths);
1552 
1554 
1555  m_xModulesCLB->connect_changed( LINK( this, SvxEditModulesDlg, SelectHdl_Impl ));
1556  m_xModulesCLB->connect_toggled(LINK(this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl));
1557 
1558  m_xClosePB->connect_clicked( LINK( this, SvxEditModulesDlg, ClickHdl_Impl ));
1559  m_xPrioUpPB->connect_clicked( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
1560  m_xPrioDownPB->connect_clicked( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
1561  m_xBackPB->connect_clicked( LINK( this, SvxEditModulesDlg, BackHdl_Impl ));
1562  // in case of not installed language modules
1563  m_xPrioUpPB->set_sensitive( false );
1564  m_xPrioDownPB->set_sensitive( false );
1565 
1566  if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
1567  m_xMoreDictsLink->hide();
1568 
1569  // set that we want the checkbox shown if spellchecking is available
1570  m_xLanguageLB->SetLanguageList(SvxLanguageListFlags::EMPTY, false, false, true);
1571 
1572  //fill language box
1573  const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
1574  const Locale* pLocales = rLoc.getConstArray();
1575  for (int i = 0; i < rLoc.getLength(); ++i)
1576  {
1577  LanguageType nLang = LanguageTag::convertToLanguageType( pLocales[i] );
1578  m_xLanguageLB->InsertLanguage(nLang);
1579  }
1581  m_xLanguageLB->set_active_id( eSysLang );
1582  if (m_xLanguageLB->get_active_id() != eSysLang)
1583  m_xLanguageLB->set_active(0);
1584 
1585  m_xLanguageLB->connect_changed( LINK( this, SvxEditModulesDlg, LangSelectListBoxHdl_Impl ));
1587 }
1588 
1590 {
1591  for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
1592  delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
1593 }
1594 
1595 IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
1596 {
1597  int nCurPos = rBox.get_selected_index();
1598  if (nCurPos != -1)
1599  {
1600  bool bDisableUp = true;
1601  bool bDisableDown = true;
1602  ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos).toInt64());
1603  if (!pData->IsParent() && pData->GetType() != TYPE_HYPH)
1604  {
1605  if (nCurPos < rBox.n_children() - 1)
1606  {
1607  bDisableDown = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1).toInt64())->IsParent();
1608  }
1609  if (nCurPos > 1)
1610  {
1611  bDisableUp = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1).toInt64())->IsParent();
1612  }
1613  }
1614  m_xPrioUpPB->set_sensitive(!bDisableUp);
1615  m_xPrioDownPB->set_sensitive(!bDisableDown);
1616  }
1617 }
1618 
1619 IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const row_col&, rRowCol, void )
1620 {
1621  auto nPos = rRowCol.first;
1622  ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(nPos).toInt64());
1623  if (!pData->IsParent() && pData->GetType() == TYPE_HYPH)
1624  {
1625  // make hyphenator checkboxes function as radio-buttons
1626  // (at most one box may be checked)
1627  for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
1628  {
1629  pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
1630  if (!pData->IsParent() && pData->GetType() == TYPE_HYPH && i != nPos)
1631  {
1632  m_xModulesCLB->set_toggle(i, TRISTATE_FALSE, 0);
1633  }
1634  }
1635  }
1636 }
1637 
1638 IMPL_LINK_NOARG(SvxEditModulesDlg, LangSelectListBoxHdl_Impl, weld::ComboBox&, void)
1639 {
1640  LangSelectHdl_Impl(m_xLanguageLB.get());
1641 }
1642 
1644 {
1645  LanguageType eCurLanguage = m_xLanguageLB->get_active_id();
1646  static Locale aLastLocale;
1647  Locale aCurLocale( LanguageTag::convertToLocale( eCurLanguage));
1648 
1649  if (pBox)
1650  {
1651  // save old probably changed settings
1652  // before switching to new language entries
1653 
1654  LanguageType nLang = LanguageTag::convertToLanguageType( aLastLocale );
1655 
1656  sal_Int32 nStart = 0, nLocalIndex = 0;
1657  Sequence< OUString > aChange;
1658  bool bChanged = false;
1659  for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
1660  {
1661  ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
1662  if (pData->IsParent())
1663  {
1664  if (bChanged)
1665  {
1666  LangImplNameTable *pTable = nullptr;
1667  sal_uInt8 nType = pData->GetType();
1668  switch (nType - 1)
1669  {
1670  case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break;
1671  case TYPE_GRAMMAR : pTable = &rLinguData.GetGrammarTable(); break;
1672  case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break;
1673  case TYPE_THES : pTable = &rLinguData.GetThesTable(); break;
1674  }
1675  if (pTable)
1676  {
1677  aChange.realloc(nStart);
1678  (*pTable)[ nLang ] = aChange;
1679  }
1680  }
1681  nLocalIndex = nStart = 0;
1682  aChange.realloc(nEntryCount);
1683  bChanged = false;
1684  }
1685  else
1686  {
1687  OUString* pChange = aChange.getArray();
1688  pChange[nStart] = pData->GetImplName();
1689  bChanged |= pData->GetIndex() != nLocalIndex ||
1690  static_cast<TriState>(pData->IsChecked()) != m_xModulesCLB->get_toggle(i, 0);
1691  if (m_xModulesCLB->get_toggle(i, 0))
1692  nStart++;
1693  ++nLocalIndex;
1694  }
1695  }
1696  if(bChanged)
1697  {
1698  aChange.realloc(nStart);
1699  rLinguData.GetThesTable()[ nLang ] = aChange;
1700  }
1701  }
1702 
1703  for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
1704  delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
1705  m_xModulesCLB->clear();
1706 
1707  // display entries for new selected language
1708 
1709  if (LANGUAGE_DONTKNOW != eCurLanguage)
1710  {
1711  sal_uLong n;
1712  ServiceInfo_Impl* pInfo;
1713 
1714  int nRow = 0;
1715  // spellchecker entries
1716 
1717  ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
1718  OUString(), true, false, TYPE_SPELL, 0 );
1719  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
1720  m_xModulesCLB->append(nullptr);
1721  m_xModulesCLB->set_id(nRow, sId);
1722  m_xModulesCLB->set_text(nRow, sSpell, 1);
1723  m_xModulesCLB->set_text_emphasis(nRow, true, 1);
1724  ++nRow;
1725 
1726  Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
1727  const OUString *pName = aNames.getConstArray();
1728  sal_uLong nNames = static_cast<sal_uLong>(aNames.getLength());
1729  sal_Int32 nLocalIndex = 0; // index relative to parent
1730  for (n = 0; n < nNames; ++n)
1731  {
1732  OUString aImplName;
1733  bool bIsSuppLang = false;
1734 
1735  pInfo = rLinguData.GetInfoByImplName( pName[n] );
1736  if (pInfo)
1737  {
1738  bIsSuppLang = pInfo->xSpell.is() &&
1739  pInfo->xSpell->hasLocale( aCurLocale );
1740  aImplName = pInfo->sSpellImplName;
1741  }
1742  if (!aImplName.isEmpty() && bIsSuppLang)
1743  {
1744  OUString aTxt( pInfo->sDisplayName );
1745 
1747  const bool bHasLang = rTable.count( eCurLanguage );
1748  if (!bHasLang)
1749  {
1750  SAL_INFO( "cui.options", "language entry missing" ); // only relevant if all languages found should be supported
1751  }
1752  const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
1753  pUserData = new ModuleUserData_Impl( aImplName, false,
1754  bCheck, TYPE_SPELL, static_cast<sal_uInt8>(nLocalIndex++) );
1755  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1756 
1757  m_xModulesCLB->append(nullptr);
1758  m_xModulesCLB->set_id(nRow, sId);
1759  m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1760  m_xModulesCLB->set_text(nRow, aTxt, 1);
1761  ++nRow;
1762  }
1763  }
1764 
1765  // grammar checker entries
1766 
1767  pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_GRAMMAR, 0 );
1768  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1769  m_xModulesCLB->append(nullptr);
1770  m_xModulesCLB->set_id(nRow, sId);
1771  m_xModulesCLB->set_text(nRow, sGrammar, 1);
1772  m_xModulesCLB->set_text_emphasis(nRow, true, 1);
1773  ++nRow;
1774 
1775  aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
1776  pName = aNames.getConstArray();
1777  nNames = static_cast<sal_uLong>(aNames.getLength());
1778  nLocalIndex = 0;
1779  for (n = 0; n < nNames; ++n)
1780  {
1781  OUString aImplName;
1782  bool bIsSuppLang = false;
1783 
1784  pInfo = rLinguData.GetInfoByImplName( pName[n] );
1785  if (pInfo)
1786  {
1787  bIsSuppLang = pInfo->xGrammar.is() &&
1788  pInfo->xGrammar->hasLocale( aCurLocale );
1789  aImplName = pInfo->sGrammarImplName;
1790  }
1791  if (!aImplName.isEmpty() && bIsSuppLang)
1792  {
1793  OUString aTxt( pInfo->sDisplayName );
1794 
1796  const bool bHasLang = rTable.count( eCurLanguage );
1797  if (!bHasLang)
1798  {
1799  SAL_INFO( "cui.options", "language entry missing" ); // only relevant if all languages found should be supported
1800  }
1801  const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
1802  pUserData = new ModuleUserData_Impl( aImplName, false,
1803  bCheck, TYPE_GRAMMAR, static_cast<sal_uInt8>(nLocalIndex++) );
1804 
1805  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1806 
1807  m_xModulesCLB->append(nullptr);
1808  m_xModulesCLB->set_id(nRow, sId);
1809  m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1810  m_xModulesCLB->set_text(nRow, aTxt, 1);
1811  ++nRow;
1812  }
1813  }
1814 
1815  // hyphenator entries
1816 
1817  pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_HYPH, 0 );
1818  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1819  m_xModulesCLB->append(nullptr);
1820  m_xModulesCLB->set_id(nRow, sId);
1821  m_xModulesCLB->set_text(nRow, sHyph, 1);
1822  m_xModulesCLB->set_text_emphasis(nRow, true, 1);
1823  ++nRow;
1824 
1825  aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
1826  pName = aNames.getConstArray();
1827  nNames = static_cast<sal_uLong>(aNames.getLength());
1828  nLocalIndex = 0;
1829  for (n = 0; n < nNames; ++n)
1830  {
1831  OUString aImplName;
1832  bool bIsSuppLang = false;
1833 
1834  pInfo = rLinguData.GetInfoByImplName( pName[n] );
1835  if (pInfo)
1836  {
1837  bIsSuppLang = pInfo->xHyph.is() &&
1838  pInfo->xHyph->hasLocale( aCurLocale );
1839  aImplName = pInfo->sHyphImplName;
1840  }
1841  if (!aImplName.isEmpty() && bIsSuppLang)
1842  {
1843  OUString aTxt( pInfo->sDisplayName );
1844 
1846  const bool bHasLang = rTable.count( eCurLanguage );
1847  if (!bHasLang)
1848  {
1849  SAL_INFO( "cui.options", "language entry missing" ); // only relevant if all languages found should be supported
1850  }
1851  const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
1852  pUserData = new ModuleUserData_Impl( aImplName, false,
1853  bCheck, TYPE_HYPH, static_cast<sal_uInt8>(nLocalIndex++) );
1854  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1855 
1856  m_xModulesCLB->append(nullptr);
1857  m_xModulesCLB->set_id(nRow, sId);
1858  m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1859  m_xModulesCLB->set_text(nRow, aTxt, 1);
1860  ++nRow;
1861  }
1862  }
1863 
1864  // thesaurus entries
1865 
1866  pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_THES, 0 );
1867  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1868  m_xModulesCLB->append(nullptr);
1869  m_xModulesCLB->set_id(nRow, sId);
1870  m_xModulesCLB->set_text(nRow, sThes, 1);
1871  m_xModulesCLB->set_text_emphasis(nRow, true, 1);
1872  ++nRow;
1873 
1874  aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
1875  pName = aNames.getConstArray();
1876  nNames = static_cast<sal_uLong>(aNames.getLength());
1877  nLocalIndex = 0;
1878  for (n = 0; n < nNames; ++n)
1879  {
1880  OUString aImplName;
1881  bool bIsSuppLang = false;
1882 
1883  pInfo = rLinguData.GetInfoByImplName( pName[n] );
1884  if (pInfo)
1885  {
1886  bIsSuppLang = pInfo->xThes.is() &&
1887  pInfo->xThes->hasLocale( aCurLocale );
1888  aImplName = pInfo->sThesImplName;
1889  }
1890  if (!aImplName.isEmpty() && bIsSuppLang)
1891  {
1892  OUString aTxt( pInfo->sDisplayName );
1893 
1895  const bool bHasLang = rTable.count( eCurLanguage );
1896  if (!bHasLang)
1897  {
1898  SAL_INFO( "cui.options", "language entry missing" ); // only relevant if all languages found should be supported
1899  }
1900  const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
1901  pUserData = new ModuleUserData_Impl( aImplName, false,
1902  bCheck, TYPE_THES, static_cast<sal_uInt8>(nLocalIndex++) );
1903  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
1904 
1905  m_xModulesCLB->append(nullptr);
1906  m_xModulesCLB->set_id(nRow, sId);
1907  m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1908  m_xModulesCLB->set_text(nRow, aTxt, 1);
1909  ++nRow;
1910  }
1911  }
1912  }
1913  aLastLocale = aCurLocale;
1914 }
1915 
1916 IMPL_LINK( SvxEditModulesDlg, UpDownHdl_Impl, weld::Button&, rBtn, void )
1917 {
1918  bool bUp = m_xPrioUpPB.get() == &rBtn;
1919  int nCurPos = m_xModulesCLB->get_selected_index();
1920  if (nCurPos != -1)
1921  {
1922  m_xModulesCLB->freeze();
1923 
1924  OUString sId(m_xModulesCLB->get_id(nCurPos));
1925  OUString sStr(m_xModulesCLB->get_text(nCurPos));
1926  bool bIsChecked = m_xModulesCLB->get_toggle(nCurPos, nCurPos);
1927 
1928  m_xModulesCLB->remove(nCurPos);
1929 
1930  int nDestPos = bUp ? nCurPos - 1 : nCurPos + 1;
1931 
1932  m_xModulesCLB->insert_text(nDestPos, sStr);
1933  m_xModulesCLB->set_id(nDestPos, sId);
1934  m_xModulesCLB->set_toggle(nDestPos, bIsChecked ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
1935 
1936  m_xModulesCLB->thaw();
1937 
1938  m_xModulesCLB->select(nDestPos);
1939  SelectHdl_Impl(*m_xModulesCLB);
1940  }
1941 }
1942 
1944 {
1945  // store language config
1946  LangSelectHdl_Impl(m_xLanguageLB.get());
1947  m_xDialog->response(RET_OK);
1948 }
1949 
1951 {
1952  rLinguData = *pDefaultLinguData;
1953  LangSelectHdl_Impl(nullptr);
1954 }
1955 
1956 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual VclPtr< AbstractSvxNewDictionaryDialog > CreateSvxNewDictionaryDialog(weld::Window *pParent)=0
SvxEditModulesDlg(weld::Window *pParent, SvxLinguData_Impl &rData)
Definition: optlingu.cxx:1531
static bool KillFile_Impl(const OUString &rURL)
Definition: optlingu.cxx:88
std::unique_ptr< weld::Button > m_xLinguDicsDelPB
Definition: optlingu.hxx:116
OUString sHyphSpecial
Definition: optlingu.hxx:92
void UpdateDicBox_Impl()
Definition: optlingu.cxx:1093
SvxLinguData_Impl & rLinguData
Definition: optlingu.hxx:54
uno::Reference< XLinguServiceManager2 > xLinguSrvcMgr
Definition: optlingu.cxx:334
#define TYPE_HYPH
Definition: optlingu.cxx:113
static sal_Int32 lcl_SeqGetEntryPos(const Sequence< OUString > &rSeq, const OUString &rEntry)
Definition: optlingu.cxx:74
sal_uInt32 nVal
Definition: optlingu.cxx:146
Sequence< OUString > GetSortedImplNames(LanguageType nLang, sal_uInt8 nType)
Definition: optlingu.cxx:387
OUString sNumMinWordlen
Definition: optlingu.hxx:88
std::unique_ptr< SvxLanguageBox > m_xLanguageLB
Definition: optlingu.hxx:62
bool IsDeletable() const
Definition: optlingu.cxx:156
const char * pLocale
std::unique_ptr< weld::LinkButton > m_xMoreDictsLink
Definition: optlingu.hxx:119
#define UPN_IS_HYPH_AUTO
const char aData[]
sal_uInt32 nDisplayServices
Definition: optlingu.cxx:327
#define UPN_HYPH_MIN_WORD_LENGTH
std::string GetValue
std::unique_ptr< weld::Label > m_xLinguModulesFT
Definition: optlingu.hxx:109
ServiceInfoArr aDisplayServiceArr
Definition: optlingu.cxx:326
static const sal_Char cHyph[]
Definition: optlingu.cxx:69
OptionsUserData(sal_uInt32 nUserData)
Definition: optlingu.cxx:261
std::unique_ptr< weld::Label > m_xLinguDicsFT
Definition: optlingu.hxx:112
sal_uInt8 & GetMinTrail()
static bool AddRemove(Sequence< OUString > &rConfigured, const OUString &rImplName, bool bAdd)
Definition: optlingu.cxx:697
std::unique_ptr< SvxLinguData_Impl > pLinguData
Definition: optlingu.hxx:107
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
void HideGroups(sal_uInt16 nGrp)
Definition: optlingu.cxx:1515
static SvxAbstractDialogFactory * Create()
sal_uIntPtr sal_uLong
bool IsChecked() const
Definition: optlingu.cxx:135
static const AllSettings & GetSettings()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optlingu.cxx:903
static const sal_Char cThes[]
Definition: optlingu.cxx:70
std::unique_ptr< weld::Button > m_xPrioUpPB
Definition: optlingu.hxx:57
#define TYPE_THES
Definition: optlingu.cxx:114
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
OUString sThesImplName
Definition: optlingu.cxx:306
bool IsChecked() const
Definition: optlingu.cxx:155
void SetNumericValue(sal_uInt8 nNumVal)
Definition: optlingu.cxx:289
OUString sSpellImplName
Definition: optlingu.cxx:304
std::unique_ptr< weld::Widget > m_xAfterFrame
Definition: optlingu.cxx:218
virtual short Execute()=0
TRISTATE_TRUE
std::unique_ptr< SvxLinguData_Impl > pDefaultLinguData
Definition: optlingu.hxx:53
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
#define UPN_HYPH_MIN_TRAILING
static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet()
#define UPN_IS_SPELL_SPECIAL
void LangSelectHdl_Impl(const SvxLanguageBox *pBox)
Definition: optlingu.cxx:1643
RET_NO
LangImplNameTable & GetThesTable()
Definition: optlingu.cxx:352
virtual ~SvxLinguTabPage() override
Definition: optlingu.cxx:898
sal_uInt8 & GetMinLead()
void UpdateModulesBox_Impl()
Definition: optlingu.cxx:1115
#define UPN_IS_GRAMMAR_AUTO
#define UPN_IS_SPELL_UPPER_CASE
char sal_Char
virtual VclPtr< VclAbstractDialog > CreateSvxEditDictionaryDialog(weld::Window *pParent, const OUString &rName)=0
static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList()
std::unique_ptr< weld::TreeView > m_xModulesCLB
Definition: optlingu.hxx:56
OUString sHyphImplName
Definition: optlingu.cxx:305
static const sal_Char cSpell[]
Definition: optlingu.cxx:67
OUString sHyphAuto
Definition: optlingu.hxx:91
std::map< LanguageType, Sequence< OUString > > LangImplNameTable
Definition: optlingu.cxx:318
virtual int get_value() const =0
sal_uInt16 GetEntryId() const
Definition: optlingu.cxx:267
std::unique_ptr< weld::Button > m_xLinguDicsNewPB
Definition: optlingu.hxx:114
std::unique_ptr< weld::Button > m_xClosePB
Definition: optlingu.hxx:61
std::unique_ptr< weld::TreeView > m_xLinguModulesCLB
Definition: optlingu.hxx:110
#define TYPE_GRAMMAR
Definition: optlingu.cxx:112
std::unique_ptr< weld::LinkButton > m_xMoreDictsLink
Definition: optlingu.hxx:60
std::unique_ptr< weld::Button > m_xLinguOptionsEditPB
Definition: optlingu.hxx:118
OUString sThes
Definition: optlingu.hxx:50
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
OUString GetDicInfoStr(const OUString &rName, const LanguageType nLang, bool bNeg)
std::unique_ptr< weld::SpinButton > m_xBreakNF
Definition: optlingu.cxx:220
std::unique_ptr< weld::Button > m_xPrioDownPB
Definition: optlingu.hxx:58
const LanguageTag & GetLanguageTag() const
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< weld::Widget > m_xMinimalFrame
Definition: optlingu.cxx:219
static void lcl_MergeLocales(Sequence< Locale > &aAllLocales, const Sequence< Locale > &rAdd)
Definition: optlingu.cxx:455
ServiceInfo_Impl * GetInfoByImplName(const OUString &rSvcImplName)
Definition: optlingu.cxx:438
#define UPN_IS_SPELL_WITH_DIGITS
int nUPN_HYPH_MIN_LEADING
Definition: optlingu.hxx:95
LangImplNameTable & GetSpellTable()
Definition: optlingu.cxx:350
static LanguageType getSystemLanguage()
OUString sGrammarAuto
Definition: optlingu.hxx:87
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
void SetDisplayServiceCount(sal_uInt32 nVal)
Definition: optlingu.cxx:358
static const sal_Char cGrammar[]
Definition: optlingu.cxx:68
#define TOOLS_WARN_EXCEPTION(area, stream)
SvxLinguTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreSet)
Definition: optlingu.cxx:818
OUString sSpellAuto
Definition: optlingu.hxx:86
#define GROUP_MODULES
Definition: optlingu.hxx:42
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
OUString sSpellSpecial
Definition: optlingu.hxx:85
uno::Reference< XSpellChecker > xSpell
Definition: optlingu.cxx:308
ServiceInfoArr & GetDisplayServiceArray()
Definition: optlingu.cxx:355
bool IsParent() const
Definition: optlingu.cxx:133
void Reconfigure(const OUString &rDisplayName, bool bEnable)
Definition: optlingu.cxx:725
sal_uInt16 GetNumericValue() const
Definition: optlingu.cxx:269
std::vector< ServiceInfo_Impl > ServiceInfoArr
Definition: optlingu.cxx:317
#define UPN_IS_SPELL_AUTO
DicUserData(sal_uInt32 nUserData)
Definition: optlingu.cxx:149
int i
QPRO_FUNC_TYPE const nType
TRISTATE_FALSE
uno::Reference< XThesaurus > xThes
Definition: optlingu.cxx:310
std::unique_ptr< weld::TreeView > m_xLinguOptionsCLB
Definition: optlingu.hxx:117
std::unique_ptr< weld::TreeView > m_xLinguDicsCLB
Definition: optlingu.hxx:113
uno::Reference< XProofreader > xGrammar
Definition: optlingu.cxx:311
#define LANGUAGE_DONTKNOW
#define SN_HYPHENATOR
static const char * aEidToPropName[]
this array must have an entry for every value of EID_OPTIONS.
Definition: optlingu.cxx:195
OptionsBreakSet(weld::Window *pParent, sal_uInt16 nRID)
Definition: optlingu.cxx:223
sal_uInt16 sal_Char * pName
css::uno::Reference< css::linguistic2::XDictionaryList > xDicList
Definition: optlingu.hxx:102
#define UPN_IS_HYPH_SPECIAL
std::unique_ptr< weld::Widget > m_xBeforeFrame
Definition: optlingu.cxx:217
LangImplNameTable aCfgGrammarTable
Definition: optlingu.cxx:333
static sal_Int32 lcl_SeqGetIndex(const Sequence< OUString > &rSeq, const OUString &rTxt)
Definition: optlingu.cxx:373
std::unique_ptr< weld::Button > m_xBackPB
Definition: optlingu.hxx:59
#define UPH_ACTIVE_DICTIONARIES
OUString sGrammarImplName
Definition: optlingu.cxx:307
OUString sSpell
Definition: optlingu.hxx:48
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
int nUPN_HYPH_MIN_TRAILING
Definition: optlingu.hxx:96
IMPL_LINK_NOARG(SvxLinguTabPage, PostDblClickHdl_Impl, void *, void)
Definition: optlingu.cxx:1294
sal_uInt8 GetIndex() const
Definition: optlingu.cxx:136
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString sGrammar
Definition: optlingu.hxx:51
sal_uInt16 GetEntryId() const
Definition: optlingu.cxx:154
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
weld::SpinButton & GetNumericFld()
Definition: optlingu.cxx:248
bool IsCheckable() const
Definition: optlingu.cxx:270
sal_uInt32 nVal
Definition: optlingu.cxx:258
#define SN_THESAURUS
LangImplNameTable aCfgHyphTable
Definition: optlingu.cxx:331
virtual void set_value(int value)=0
OUString sWordsWithDigits
Definition: optlingu.hxx:84
const sal_uInt32 & GetDisplayServiceCount() const
Definition: optlingu.cxx:357
LangImplNameTable aCfgThesTable
Definition: optlingu.cxx:332
bool IsModified() const
Definition: optlingu.cxx:271
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString sCapitalWords
Definition: optlingu.hxx:83
unsigned char sal_uInt8
const Sequence< Locale > & GetAllSupportedLocales() const
Definition: optlingu.cxx:348
static sal_uInt32 GetDicUserData(const css::uno::Reference< css::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx)
Definition: optlingu.cxx:1055
#define SAL_INFO(area, stream)
EID_OPTIONS
Definition: optlingu.cxx:177
INetProtocol GetProtocol() const
Sequence< Locale > aAllServiceLocales
Definition: optlingu.cxx:329
RET_OK
#define UPN_HYPH_MIN_LEADING
uno::Reference< XHyphenator > xHyph
Definition: optlingu.cxx:309
OUString sHyph
Definition: optlingu.hxx:49
bool SetProperty(const OUString &rPropertyName, const css::uno::Any &rValue)
std::unique_ptr< weld::Button > m_xLinguModulesEditPB
Definition: optlingu.hxx:111
virtual short run()
ModuleUserData_Impl(const OUString &sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex)
Definition: optlingu.cxx:125
Reference< XComponentContext > getProcessComponentContext()
static void lcl_MergeDisplayArray(SvxLinguData_Impl &rData, const ServiceInfo_Impl &rToAdd)
Definition: optlingu.cxx:484
int nUPN_HYPH_MIN_WORD_LENGTH
Definition: optlingu.hxx:94
const OUString & GetImplName() const
Definition: optlingu.cxx:137
css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionary > > aDics
Definition: optlingu.hxx:105
virtual css::uno::Reference< css::linguistic2::XDictionary > GetNewDictionary()=0
static OUString lcl_GetPropertyName(EID_OPTIONS eEntryId)
Definition: optlingu.cxx:209
LangImplNameTable & GetHyphTable()
Definition: optlingu.cxx:351
sal_uInt32 GetUserData() const
Definition: optlingu.cxx:266
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optlingu.cxx:909
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile)
#define SAL_WARN(area, stream)
OUString sNumPostBreak
Definition: optlingu.hxx:90
css::uno::Any GetProperty(const OUString &rPropertyName) const
virtual void Reset(const SfxItemSet *rSet) override
Definition: optlingu.cxx:1141
virtual ~SvxEditModulesDlg() override
Definition: optlingu.cxx:1589
OUString sDisplayName
Definition: optlingu.cxx:303
#define SN_GRAMMARCHECKER
std::unique_ptr< weld::Button > m_xLinguDicsEditPB
Definition: optlingu.hxx:115
sal_Int32 const nLength
void AddDicBoxEntry(const css::uno::Reference< css::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx)
Definition: optlingu.cxx:1074
void SetChecked(const Sequence< OUString > &rConfiguredServices)
Definition: optlingu.cxx:672
LangImplNameTable aCfgSpellTable
Definition: optlingu.cxx:330
uno::Reference< XLinguServiceManager2 > & GetManager()
Definition: optlingu.cxx:343
TriState
sal_Int32 nPos
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define TYPE_SPELL
Definition: optlingu.cxx:111
sal_uInt32 GetUserData() const
Definition: optlingu.cxx:153
css::uno::Reference< css::linguistic2::XLinguProperties > xProp
Definition: optlingu.hxx:99
OUString sNumPreBreak
Definition: optlingu.hxx:89
#define SN_SPELLCHECKER
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
bool HasNumericValue() const
Definition: optlingu.cxx:268
IMPL_LINK(SvxLinguTabPage, BoxDoubleClickHdl_Impl, weld::TreeView &, rBox, bool)
Definition: optlingu.cxx:1277
sal_uInt8 GetType() const
Definition: optlingu.cxx:134
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
LangImplNameTable & GetGrammarTable()
Definition: optlingu.cxx:353
OUString sId