LibreOffice Module svx (master)  1
chinese_dictionarydialog.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 
22 #include <cppuhelper/bootstrap.hxx>
23 #include <com/sun/star/i18n/TextConversionOption.hpp>
24 #include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
25 #include <com/sun/star/linguistic2/ConversionPropertyType.hpp>
26 #include <com/sun/star/linguistic2/ConversionDictionaryList.hpp>
27 #include <com/sun/star/linguistic2/XConversionPropertyType.hpp>
28 #include <com/sun/star/util/XFlushable.hpp>
29 #include <com/sun/star/lang/Locale.hpp>
30 #include <unotools/lingucfg.hxx>
31 #include <unotools/linguprops.hxx>
32 #include <osl/diagnose.h>
33 
35 {
36 
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 
40 DictionaryList::DictionaryList(std::unique_ptr<weld::TreeView> xControl)
41  : m_xControl(std::move(xControl))
42  , m_xIter(m_xControl->make_iterator())
43  , m_pED_Term(nullptr)
44  , m_pED_Mapping(nullptr)
45  , m_pLB_Property(nullptr)
46 {
47  m_xControl->make_sorted();
48 }
49 
50 OUString DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const
51 {
53  return OUString();
54 
55  sal_uInt16 nPos = static_cast<sal_uInt16>( nConversionPropertyType )-1;
56  if (nPos < m_pLB_Property->get_count())
57  return m_pLB_Property->get_text(nPos);
58  return m_pLB_Property->get_text(0);
59 }
60 
62 {
63  if (!m_xDictionary.is())
64  return;
65 
66  Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
67 
68  sal_Int32 nN;
70 
71  for( nN = m_aToBeDeleted.size(); nN--; )
72  {
73  pE = m_aToBeDeleted[nN];
74  m_xDictionary->removeEntry( pE->m_aTerm, pE->m_aMapping );
75  }
76  int nRowCount = m_xControl->n_children();
77  for( nN = nRowCount; nN--; )
78  {
79  pE = getEntryOnPos( nN );
80  if(pE->m_bNewEntry)
81  {
82  try
83  {
84  m_xDictionary->addEntry( pE->m_aTerm, pE->m_aMapping );
85  xPropertyType->setPropertyType( pE->m_aTerm, pE->m_aMapping, pE->m_nConversionPropertyType );
86  }
87  catch( uno::Exception& )
88  {
89 
90  }
91  }
92  }
93  Reference< util::XFlushable > xFlush( m_xDictionary, uno::UNO_QUERY );
94  if( xFlush.is() )
95  xFlush->flush();
96 }
97 
99 {
100  sal_Int32 nN;
101  int nRowCount = m_xControl->n_children();
102  for( nN = nRowCount; nN--; )
103  deleteEntryOnPos( nN );
104  for( nN = m_aToBeDeleted.size(); nN--; )
105  {
107  delete pE;
108  }
109  m_aToBeDeleted.clear();
110 }
111 
112 void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
113 {
114  deleteAll();
115 
116  if(!m_xDictionary.is())
117  return;
118 
119  const Sequence< OUString > aLeftList( m_xDictionary->getConversionEntries( linguistic2::ConversionDirection_FROM_LEFT ) );
120 
121  Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
122 
123  OUString aRight;
124  sal_Int16 nConversionPropertyType;
125 
126  for(const OUString& aLeft : aLeftList)
127  {
128  Sequence< OUString > aRightList( m_xDictionary->getConversions(
129  aLeft, 0, aLeft.getLength()
130  , linguistic2::ConversionDirection_FROM_LEFT, nTextConversionOptions ) );
131 
132  if(aRightList.getLength()!=1)
133  {
134  OSL_FAIL("The Chinese Translation Dictionary should have exactly one Mapping for each term.");
135  continue;
136  }
137 
138  aRight = aRightList[0];
139  nConversionPropertyType = linguistic2::ConversionPropertyType::OTHER;
140  if(xPropertyType.is())
141  nConversionPropertyType = xPropertyType->getPropertyType(aLeft, aRight);
142 
143  DictionaryEntry* pEntry = new DictionaryEntry( aLeft, aRight, nConversionPropertyType );
144 
145  m_xControl->append(m_xIter.get());
146  m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
147  m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
149  m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
150  }
151 }
152 
154 {
155  DictionaryEntry* pRet=nullptr;
156  int nN = m_xControl->get_selected_index();
157  if (nN != -1)
158  pRet = getEntryOnPos( nN );
159  return pRet;
160 }
161 
163 {
164  OUString sLBEntry = m_xControl->get_id(nPos);
165  return reinterpret_cast<DictionaryEntry*>(sLBEntry.toInt64());
166 }
167 
168 DictionaryEntry* DictionaryList::getTermEntry( std::u16string_view rTerm ) const
169 {
170  int nRowCount = m_xControl->n_children();
171  for( sal_Int32 nN = nRowCount; nN--; )
172  {
174  if( pE && rTerm == pE->m_aTerm )
175  return pE;
176  }
177  return nullptr;
178 }
179 
180 bool DictionaryList::hasTerm( std::u16string_view rTerm ) const
181 {
182  return getTermEntry(rTerm) !=nullptr ;
183 }
184 
185 void DictionaryList::addEntry(const OUString& rTerm, const OUString& rMapping,
186  sal_Int16 nConversionPropertyType, int nPos)
187 {
188  if( hasTerm( rTerm ) )
189  return;
190 
191  DictionaryEntry* pEntry = new DictionaryEntry( rTerm, rMapping, nConversionPropertyType, true );
192  m_xControl->insert(nPos, m_xIter.get());
193  m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
194  m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
196  m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
197  m_xControl->select(*m_xIter);
198 }
199 
200 void DictionaryList::deleteEntryOnPos( sal_Int32 nPos )
201 {
202  DictionaryEntry* pEntry = getEntryOnPos( nPos );
203  m_xControl->remove(nPos);
204  if (pEntry)
205  {
206  if( pEntry->m_bNewEntry )
207  delete pEntry;
208  else
209  m_aToBeDeleted.push_back( pEntry );
210  }
211 }
212 
213 int DictionaryList::deleteEntries( std::u16string_view rTerm )
214 {
215  int nPos = -1;
216  int nRowCount = m_xControl->n_children();
217  for (sal_Int32 nN = nRowCount; nN--;)
218  {
219  DictionaryEntry* pCurEntry = getEntryOnPos( nN );
220  if( rTerm == pCurEntry->m_aTerm )
221  {
222  nPos = nN;
223  m_xControl->remove(nN);
224  if( pCurEntry->m_bNewEntry )
225  delete pCurEntry;
226  else
227  m_aToBeDeleted.push_back( pCurEntry );
228  }
229  }
230  return nPos;
231 }
232 
233 DictionaryEntry::DictionaryEntry( const OUString& rTerm, const OUString& rMapping
234  , sal_Int16 nConversionPropertyType
235  , bool bNewEntry )
236  : m_aTerm( rTerm )
237  , m_aMapping( rMapping )
238  , m_nConversionPropertyType( nConversionPropertyType )
239  , m_bNewEntry( bNewEntry )
240 {
241  if( m_nConversionPropertyType == 0 )
243 }
244 
246 {
247 }
248 
249 IMPL_LINK_NOARG(ChineseDictionaryDialog, SizeAllocHdl, const Size&, void)
250 {
251  DictionaryList* pControl = m_xCT_DictionaryToTraditional->get_visible() ?
252  m_xCT_DictionaryToTraditional.get() :
253  m_xCT_DictionaryToSimplified.get();
254  std::vector<int> aWidths;
255  int x1, x2, y, width, height;
256  if (!m_xED_Mapping->get_extents_relative_to(pControl->get_widget(), x1, y, width, height))
257  return;
258  aWidths.push_back(x1);
259  if (!m_xLB_Property->get_extents_relative_to(pControl->get_widget(), x2, y, width, height))
260  return;
261  aWidths.push_back(x2 - x1);
262  m_xCT_DictionaryToTraditional->get_widget().set_column_fixed_widths(aWidths);
263  m_xCT_DictionaryToSimplified->get_widget().set_column_fixed_widths(aWidths);
264 }
265 
266 void DictionaryList::init(const Reference< linguistic2::XConversionDictionary>& xDictionary,
267  weld::Entry *pED_Term, weld::Entry *pED_Mapping, weld::ComboBox *pLB_Property)
268 {
269  if (m_xDictionary.is())
270  return;
271 
272  m_xDictionary = xDictionary;
273 
274  m_pED_Term = pED_Term;
275  m_pED_Mapping = pED_Mapping;
276  m_pLB_Property = pLB_Property;
277 
278  m_xControl->set_sort_column(0);
279  m_xControl->set_sort_indicator(TRISTATE_TRUE, 0);
280 
281  std::vector<int> aWidths;
282  aWidths.push_back(m_pED_Term->get_preferred_size().Width());
283  aWidths.push_back(m_pED_Mapping->get_preferred_size().Width());
284  m_xControl->set_column_fixed_widths(aWidths);
285 }
286 
288  const Reference< linguistic2::XConversionDictionary>& xDictionary)
289 {
290  //set widgets to track the width of for columns
291  pList->init(xDictionary,
292  m_xED_Term.get(), m_xED_Mapping.get(), m_xLB_Property.get());
293 }
294 
296  : GenericDialogController(pParent, "svx/ui/chinesedictionary.ui", "ChineseDictionaryDialog")
297  , m_nTextConversionOptions(i18n::TextConversionOption::NONE)
298  , m_xRB_To_Simplified(m_xBuilder->weld_radio_button("tradtosimple"))
299  , m_xRB_To_Traditional(m_xBuilder->weld_radio_button("simpletotrad"))
300  , m_xCB_Reverse(m_xBuilder->weld_check_button("reverse"))
301  , m_xFT_Term(m_xBuilder->weld_label("termft"))
302  , m_xED_Term(m_xBuilder->weld_entry("term"))
303  , m_xFT_Mapping(m_xBuilder->weld_label("mappingft"))
304  , m_xED_Mapping(m_xBuilder->weld_entry("mapping"))
305  , m_xFT_Property(m_xBuilder->weld_label("propertyft"))
306  , m_xLB_Property(m_xBuilder->weld_combo_box("property"))
307  , m_xCT_DictionaryToSimplified(new DictionaryList(m_xBuilder->weld_tree_view("tradtosimpleview")))
308  , m_xCT_DictionaryToTraditional(new DictionaryList(m_xBuilder->weld_tree_view("simpletotradview")))
309  , m_xPB_Add(m_xBuilder->weld_button("add"))
310  , m_xPB_Modify(m_xBuilder->weld_button("modify"))
311  , m_xPB_Delete(m_xBuilder->weld_button("delete"))
312 {
313  m_xCT_DictionaryToSimplified->set_size_request(-1, m_xCT_DictionaryToSimplified->get_height_rows(8));
314  m_xCT_DictionaryToTraditional->set_size_request(-1, m_xCT_DictionaryToTraditional->get_height_rows(8));
315 
316  SvtLinguConfig aLngCfg;
317  bool bValue;
318  Any aAny( aLngCfg.GetProperty( UPN_IS_REVERSE_MAPPING ) );
319  if( aAny >>= bValue )
320  m_xCB_Reverse->set_active( bValue );
321 
322  m_xLB_Property->set_active(0);
323 
324  Reference< linguistic2::XConversionDictionary > xDictionary_To_Simplified;
325  Reference< linguistic2::XConversionDictionary > xDictionary_To_Traditional;
326  //get dictionaries
327  {
328  if(!m_xContext.is())
330  if(m_xContext.is())
331  {
332  Reference< linguistic2::XConversionDictionaryList > xDictionaryList = linguistic2::ConversionDictionaryList::create(m_xContext);
333  Reference< container::XNameContainer > xContainer( xDictionaryList->getDictionaryContainer() );
334  if(xContainer.is())
335  {
336  try
337  {
338  OUString aNameTo_Simplified("ChineseT2S");
339  OUString aNameTo_Traditional("ChineseS2T");
340  lang::Locale aLocale;
341  aLocale.Language = "zh";
342 
343  if( xContainer->hasByName( aNameTo_Simplified ) )
344  xDictionary_To_Simplified.set(
345  xContainer->getByName( aNameTo_Simplified ), UNO_QUERY );
346  else
347  {
348  aLocale.Country = "TW";
349  xDictionary_To_Simplified =
350  xDictionaryList->addNewDictionary( aNameTo_Simplified
351  , aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE
352  );
353  }
354  if (xDictionary_To_Simplified.is())
355  xDictionary_To_Simplified->setActive( true );
356 
357 
358  if( xContainer->hasByName( aNameTo_Traditional ) )
359  xDictionary_To_Traditional.set(
360  xContainer->getByName( aNameTo_Traditional ), UNO_QUERY );
361  else
362  {
363  aLocale.Country = "CN";
364  xDictionary_To_Traditional =
365  xDictionaryList->addNewDictionary( aNameTo_Traditional
366  ,aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE);
367  }
368  if (xDictionary_To_Traditional.is())
369  xDictionary_To_Traditional->setActive( true );
370 
371  }
372  catch(const uno::Exception& )
373  {
374  }
375  }
376  }
377  }
378 
379  //init dictionary controls
380  initDictionaryControl(m_xCT_DictionaryToSimplified.get(), xDictionary_To_Simplified);
381  initDictionaryControl(m_xCT_DictionaryToTraditional.get(), xDictionary_To_Traditional);
382 
383  //set hdl
384  m_xCT_DictionaryToSimplified->connect_column_clicked(LINK(this, ChineseDictionaryDialog, ToSimplifiedHeaderBarClick));
385  m_xCT_DictionaryToTraditional->connect_column_clicked(LINK(this, ChineseDictionaryDialog, ToTraditionalHeaderBarClick));
386 
388 
389  m_xED_Term->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
390  m_xED_Mapping->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
391  m_xLB_Property->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsListBoxHdl ) );
392 
393  m_xRB_To_Simplified->connect_toggled( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
394 
395  m_xCT_DictionaryToSimplified->connect_changed( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
396  m_xCT_DictionaryToTraditional->connect_changed( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
397 
398  m_xPB_Add->connect_clicked( LINK( this, ChineseDictionaryDialog, AddHdl ) );
399  m_xPB_Modify->connect_clicked( LINK( this, ChineseDictionaryDialog, ModifyHdl ) );
400  m_xPB_Delete->connect_clicked( LINK( this, ChineseDictionaryDialog, DeleteHdl ) );
401 
402  m_xED_Mapping->connect_size_allocate(LINK(this, ChineseDictionaryDialog, SizeAllocHdl));
403  m_xLB_Property->connect_size_allocate(LINK(this, ChineseDictionaryDialog, SizeAllocHdl));
404 }
405 
407 {
408 }
409 
410 void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ )
411 {
412  if( bDirectionToSimplified == m_xRB_To_Simplified->get_active()
413  && nTextConversionOptions == m_nTextConversionOptions )
414  return;
415 
416  m_nTextConversionOptions = nTextConversionOptions;
417 
418  if (bDirectionToSimplified)
419  m_xRB_To_Simplified->set_active(true);
420  else
421  m_xRB_To_Traditional->set_active(true);
423 }
424 
426 {
427  updateAfterDirectionChange();
428 }
429 
431 {
432  Reference< linguistic2::XConversionDictionary > xDictionary;
433 
434  if (m_xRB_To_Simplified->get_active())
435  {
438  xDictionary = m_xCT_DictionaryToSimplified->m_xDictionary;
439  }
440  else
441  {
444  xDictionary = m_xCT_DictionaryToTraditional->m_xDictionary;
445  }
446 
447  updateButtons();
448 }
449 
451 {
452  updateButtons();
453 }
454 
456 {
457  updateButtons();
458 }
459 
461 {
462  DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
463  if (pE)
464  {
465  m_xED_Term->set_text( pE->m_aTerm );
466  m_xED_Mapping->set_text( pE->m_aMapping );
467  sal_Int16 nPos = pE->m_nConversionPropertyType-1;
468  if (nPos<0 || nPos>=m_xLB_Property->get_count())
469  nPos=0;
470  if (m_xLB_Property->get_count())
471  m_xLB_Property->set_active(nPos);
472  }
473 
474  updateButtons();
475 }
476 
478 {
479  return !m_xED_Term->get_text().isEmpty() && !m_xED_Mapping->get_text().isEmpty();
480 }
481 
483 {
485  if( pE )
486  {
487  if (pE->m_aTerm != m_xED_Term->get_text())
488  return false;
489  if (pE->m_aMapping != m_xED_Mapping->get_text())
490  return false;
491  if (pE->m_nConversionPropertyType != m_xLB_Property->get_active() + 1)
492  return false;
493  return true;
494  }
495  return false;
496 }
497 
499 {
500  if( m_xRB_To_Traditional->get_active() )
503 }
504 
506 {
507  if( m_xRB_To_Traditional->get_active() )
510 }
511 
513 {
514  if( m_xRB_To_Traditional->get_active() )
517 }
518 
520 {
521  if( m_xRB_To_Traditional->get_active() )
524 }
525 
527 {
528  bool bAdd = isEditFieldsHaveContent() && !getActiveDictionary().hasTerm(m_xED_Term->get_text());
529  m_xPB_Add->set_sensitive( bAdd );
530 
531  m_xPB_Delete->set_sensitive(!bAdd && getActiveDictionary().get_selected_index() != -1);
532 
533  bool bModify = false;
534  {
535  DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
536  bModify = !bAdd && pFirstSelectedEntry && pFirstSelectedEntry->m_aTerm == m_xED_Term->get_text();
538  bModify = false;
539  }
540  m_xPB_Modify->set_sensitive( bModify );
541 }
542 
544 {
545  if( !isEditFieldsHaveContent() )
546  return;
547 
548  sal_Int16 nConversionPropertyType = m_xLB_Property->get_active() + 1;
549 
550  getActiveDictionary().addEntry( m_xED_Term->get_text(), m_xED_Mapping->get_text(), nConversionPropertyType );
551 
552  if( m_xCB_Reverse->get_active() )
553  {
554  getReverseDictionary().deleteEntries( m_xED_Mapping->get_text() );
555  getReverseDictionary().addEntry( m_xED_Mapping->get_text(), m_xED_Term->get_text(), nConversionPropertyType );
556  }
557 
558  updateButtons();
559 }
560 
562 {
563  OUString aTerm( m_xED_Term->get_text() );
564  OUString aMapping( m_xED_Mapping->get_text() );
565  sal_Int16 nConversionPropertyType = m_xLB_Property->get_active() + 1;
566 
567  DictionaryList& rActive = getActiveDictionary();
568  DictionaryList& rReverse = getReverseDictionary();
569 
571  if( pE && pE->m_aTerm != aTerm )
572  return;
573 
574  if( pE )
575  {
576  if( pE->m_aMapping != aMapping || pE->m_nConversionPropertyType != nConversionPropertyType )
577  {
578  if( m_xCB_Reverse->get_active() )
579  {
580  rReverse.deleteEntries( pE->m_aMapping );
581  int nPos = rReverse.deleteEntries( aMapping );
582  rReverse.addEntry( aMapping, aTerm, nConversionPropertyType, nPos );
583  }
584 
585  int nPos = rActive.deleteEntries( aTerm );
586  rActive.addEntry( aTerm, aMapping, nConversionPropertyType, nPos );
587  }
588  }
589 
590  updateButtons();
591 }
592 
594 {
595  DictionaryList& rActive = getActiveDictionary();
596  DictionaryList& rReverse = getReverseDictionary();
597 
598  int nEntry = rActive.get_selected_index();
599  if (nEntry != -1)
600  {
601  DictionaryEntry* pEntry = rActive.getEntryOnPos(nEntry);
602  if (pEntry)
603  {
604  OUString aMapping = pEntry->m_aMapping;
605  rActive.deleteEntryOnPos(nEntry);
606  if (m_xCB_Reverse->get_active())
607  rReverse.deleteEntries(aMapping);
608  }
609  }
610 
611  updateButtons();
612 }
613 
615 {
616  sal_Int32 nTextConversionOptions = m_nTextConversionOptions;
617  if(m_nTextConversionOptions & i18n::TextConversionOption::USE_CHARACTER_VARIANTS )
618  nTextConversionOptions = nTextConversionOptions^i18n::TextConversionOption::USE_CHARACTER_VARIANTS ;
619 
620  m_xCT_DictionaryToSimplified->refillFromDictionary( nTextConversionOptions );
622 
623  short nRet = GenericDialogController::run();
624 
625  if( nRet == RET_OK )
626  {
627  //save settings to configuration
628  SvtLinguConfig aLngCfg;
629  aLngCfg.SetProperty( UPN_IS_REVERSE_MAPPING, uno::Any(m_xCB_Reverse->get_active()) );
630 
633  }
634 
635  m_xCT_DictionaryToSimplified->deleteAll();
636  m_xCT_DictionaryToTraditional->deleteAll();
637 
638  return nRet;
639 }
640 
642 {
643  bool bSortAtoZ = rList.get_sort_order();
644 
645  //set new arrow positions in headerbar
646  if (nColumn == rList.get_sort_column())
647  {
648  bSortAtoZ = !bSortAtoZ;
649  rList.set_sort_order(bSortAtoZ);
650  }
651  else
652  {
654  rList.set_sort_column(nColumn);
655  }
656 
657  //sort lists
658  rList.set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
659 }
660 
661 IMPL_LINK(ChineseDictionaryDialog, ToSimplifiedHeaderBarClick, int, nColumn, void)
662 {
663  HeaderBarClick(*m_xCT_DictionaryToSimplified, nColumn);
664 }
665 
666 IMPL_LINK(ChineseDictionaryDialog, ToTraditionalHeaderBarClick, int, nColumn, void)
667 {
668  HeaderBarClick(*m_xCT_DictionaryToTraditional, nColumn);
669 }
670 
671 } //end namespace
672 
673 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void addEntry(const OUString &rTerm, const OUString &rMapping, sal_Int16 nConversionPropertyType, int nPos=-1)
void init(const css::uno::Reference< css::linguistic2::XConversionDictionary > &xDictionary, weld::Entry *pED_Term, weld::Entry *pED_Mapping, weld::ComboBox *pLB_Property)
IMPL_LINK(ChineseDictionaryDialog, ToSimplifiedHeaderBarClick, int, nColumn, void)
FormulaCommand pE
Reference< XControl > m_xControl
std::vector< DictionaryEntry * > m_aToBeDeleted
virtual OUString get_text(int pos) const =0
DictionaryEntry * getFirstSelectedEntry() const
DictionaryList(std::unique_ptr< weld::TreeView > xTreeView)
int deleteEntries(std::u16string_view rTerm)
css::uno::Reference< css::uno::XComponentContext > m_xContext
TRISTATE_TRUE
virtual int get_count() const =0
NONE
constexpr tools::Long Width() const
std::unique_ptr< weld::TreeView > m_xControl
TRISTATE_INDET
float y
void set_sort_indicator(TriState eState, int nColumn)
DictionaryEntry * getEntryOnPos(sal_Int32 nPos) const
IMPL_LINK_NOARG(ChineseDictionaryDialog, SizeAllocHdl, const Size &, void)
constexpr OUStringLiteral UPN_IS_REVERSE_MAPPING
std::unique_ptr< DictionaryList > m_xCT_DictionaryToSimplified
TRISTATE_FALSE
exports com.sun.star. i18n
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
OUString getPropertyTypeName(sal_Int16 nConversionPropertyType) const
DictionaryEntry(const OUString &rTerm, const OUString &rMapping, sal_Int16 nConversionPropertyType, bool bNewEntry=false)
virtual Size get_preferred_size() const =0
void refillFromDictionary(sal_Int32 nTextConversionOptions)
static void HeaderBarClick(DictionaryList &rList, int nColumn)
void setDirectionAndTextConversionOptions(bool bDirectionToSimplified, sal_Int32 nTextConversionOptions)
RET_OK
bool SetProperty(const OUString &rPropertyName, const css::uno::Any &rValue)
bool hasTerm(std::u16string_view rTerm) const
std::unique_ptr< weld::RadioButton > m_xRB_To_Simplified
std::unique_ptr< DictionaryList > m_xCT_DictionaryToTraditional
css::uno::Reference< css::linguistic2::XConversionDictionary > m_xDictionary
css::uno::Any GetProperty(const OUString &rPropertyName) const
DictionaryEntry * getTermEntry(std::u16string_view rTerm) const
std::unique_ptr< weld::TreeIter > m_xIter
std::unique_ptr< weld::CheckButton > m_xCB_Reverse
std::unique_ptr< weld::RadioButton > m_xRB_To_Traditional
sal_uInt16 nPos
void initDictionaryControl(DictionaryList *pList, const css::uno::Reference< css::linguistic2::XConversionDictionary > &xDictionary)