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