LibreOffice Module cui (master)  1
autocdlg.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 <i18nutil/unicode.hxx>
21 #include <vcl/event.hxx>
22 #include <vcl/keycodes.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/transfer.hxx>
25 #include <sfx2/app.hxx>
26 #include <sfx2/objsh.hxx>
27 #include <sfx2/viewsh.hxx>
28 #include <unotools/charclass.hxx>
31 #include <comphelper/string.hxx>
32 #include <vcl/svapp.hxx>
33 #include <sfx2/module.hxx>
34 #include <svl/eitem.hxx>
35 #include <svl/languageoptions.hxx>
36 #include <svx/SmartTagMgr.hxx>
37 #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
38 #include <rtl/strbuf.hxx>
39 #include <osl/diagnose.h>
40 #include <tools/debug.hxx>
41 
42 #include <autocdlg.hxx>
43 #include <editeng/acorrcfg.hxx>
44 #include <editeng/svxacorr.hxx>
45 #include <cui/cuicharmap.hxx>
46 #include <strings.hrc>
47 #include <dialmgr.hxx>
48 #include <svx/svxids.hrc>
49 
51 
52 using namespace ::com::sun::star::util;
53 using namespace ::com::sun::star;
54 
56  : SfxTabDialogController(pParent, "cui/ui/autocorrectdialog.ui", "AutoCorrectDialog", _pSet)
57  , m_xLanguageBox(m_xBuilder->weld_widget("langbox"))
58  , m_xLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("lang")))
59 {
60  bool bShowSWOptions = false;
61  bool bOpenSmartTagOptions = false;
62 
63  if ( _pSet )
64  {
65  const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_AUTO_CORRECT_DLG, false);
66  if ( pItem && pItem->GetValue() )
67  bShowSWOptions = true;
68 
69  const SfxBoolItem* pItem2 = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_OPEN_SMARTTAGOPTIONS, false);
70  if ( pItem2 && pItem2->GetValue() )
71  bOpenSmartTagOptions = true;
72  }
73 
74  AddTabPage("options", OfaAutocorrOptionsPage::Create, nullptr);
75  AddTabPage("applypage", OfaSwAutoFmtOptionsPage::Create, nullptr);
76  AddTabPage("wordcompletion", OfaAutoCompleteTabPage::Create, nullptr);
77  AddTabPage("smarttags", OfaSmartTagOptionsTabPage::Create, nullptr);
78 
79  if (!bShowSWOptions)
80  {
81  RemoveTabPage("applypage");
82  RemoveTabPage("wordcompletion");
83  RemoveTabPage("smarttags");
84  }
85  else
86  {
87  // remove smart tag tab page if no extensions are installed
89  SvxSwAutoFormatFlags& rOpt = pAutoCorrect->GetSwFlags();
90  if (!rOpt.pSmartTagMgr || 0 == rOpt.pSmartTagMgr->NumberOfRecognizers())
91  RemoveTabPage("smarttags");
92 
93  RemoveTabPage("options");
94  }
95 
96  AddTabPage("replace", OfaAutocorrReplacePage::Create, nullptr);
97  AddTabPage("exceptions", OfaAutocorrExceptPage::Create, nullptr);
98  AddTabPage("localized", OfaQuoteTabPage::Create, nullptr);
99 
100  // initialize languages
103  SvxLanguageListFlags nLangList = SvxLanguageListFlags::WESTERN;
104 
105  if( SvtLanguageOptions().IsCTLFontEnabled() )
106  nLangList |= SvxLanguageListFlags::CTL;
107  if( SvtLanguageOptions().IsCJKFontEnabled() )
108  nLangList |= SvxLanguageListFlags::CJK;
109  m_xLanguageLB->SetLanguageList( nLangList, true, true );
110  m_xLanguageLB->set_active_id( LANGUAGE_NONE );
111  int nPos = m_xLanguageLB->get_active();
112  DBG_ASSERT(nPos != -1, "listbox entry missing" );
113  m_xLanguageLB->set_id(nPos, LANGUAGE_UNDETERMINED);
114 
115  // Initializing doesn't work for static on linux - therefore here
116  if (LANGUAGE_SYSTEM == eLastDialogLanguage)
117  eLastDialogLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
118 
119  LanguageType nSelectLang = LANGUAGE_UNDETERMINED;
120  nPos = m_xLanguageLB->find_id(eLastDialogLanguage);
121  if (nPos != -1)
122  nSelectLang = eLastDialogLanguage;
123  m_xLanguageLB->set_active_id(nSelectLang);
124 
125  m_xLanguageLB->connect_changed(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl));
126 
127  if ( bOpenSmartTagOptions )
128  SetCurPageId("smarttags");
129 }
130 
132 {
133 }
134 
136 {
137  m_xLanguageBox->set_sensitive(bEnable);
138 }
139 
140 static bool lcl_FindEntry(weld::TreeView& rLB, const OUString& rEntry,
141  CollatorWrapper const & rCmpClass)
142 {
143  int nCount = rLB.n_children();
144  int nSelPos = rLB.get_selected_index();
145  for (int i = 0; i < nCount; i++)
146  {
147  if (0 == rCmpClass.compareString(rEntry, rLB.get_text(i)))
148  {
149  rLB.select(i);
150  return true;
151  }
152  }
153  if (nSelPos != -1)
154  rLB.unselect(nSelPos);
155  return false;
156 }
157 
158 IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox&, void)
159 {
160  LanguageType eNewLang = m_xLanguageLB->get_active_id();
161  // save old settings and fill anew
162  if(eNewLang != eLastDialogLanguage)
163  {
164  OString sPageId = GetCurPageId();
165  if (sPageId == "replace")
166  {
167  OfaAutocorrReplacePage* pPage = static_cast<OfaAutocorrReplacePage*>(GetTabPage(sPageId));
168  assert(pPage);
169  pPage->SetLanguage(eNewLang);
170  }
171  else if (sPageId == "exceptions")
172  {
173  OfaAutocorrExceptPage* pPage = static_cast<OfaAutocorrExceptPage*>(GetTabPage(sPageId));
174  assert(pPage);
175  pPage->SetLanguage(eNewLang);
176  }
177  }
178 }
179 
181  : SfxTabPage(pPage, pController, "cui/ui/acoroptionspage.ui", "AutocorrectOptionsPage", &rSet)
182  , m_sInput(CuiResId(RID_SVXSTR_USE_REPLACE))
183  , m_sDoubleCaps(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
184  , m_sStartCap(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
185  , m_sBoldUnderline(CuiResId(RID_SVXSTR_BOLD_UNDER))
186  , m_sURL(CuiResId(RID_SVXSTR_DETECT_URL))
187  , m_sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
188  , m_sDash(CuiResId(RID_SVXSTR_DASH))
189  , m_sAccidentalCaps(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
190  , m_xCheckLB(m_xBuilder->weld_tree_view("checklist"))
191 {
192  std::vector<int> aWidths;
193  aWidths.push_back(m_xCheckLB->get_checkbox_column_width());
194  m_xCheckLB->set_column_fixed_widths(aWidths);
195  m_xCheckLB->set_size_request(-1, m_xCheckLB->get_height_rows(10));
196 }
197 
199 {
200 }
201 
202 std::unique_ptr<SfxTabPage> OfaAutocorrOptionsPage::Create(weld::Container* pPage, weld::DialogController* pController,
203  const SfxItemSet* rSet)
204 {
205  return std::make_unique<OfaAutocorrOptionsPage>(pPage, pController, *rSet);
206 }
207 
208 #define CBCOL_FIRST 0
209 #define CBCOL_SECOND 1
210 #define CBCOL_BOTH 2
211 
213 {
215  ACFlags nFlags = pAutoCorrect->GetFlags();
216 
217  int nPos = 0;
218  pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
219  pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
220  pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
221  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
222  pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
223  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
224  pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
225  pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
226 
227  bool bReturn = nFlags != pAutoCorrect->GetFlags();
228  if(bReturn )
229  {
231  rCfg.SetModified();
232  rCfg.Commit();
233  }
234  return bReturn;
235 }
236 
238 {
239  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false);
240 }
241 
242 void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt)
243 {
244  m_xCheckLB->append();
245  const int nRow = m_xCheckLB->n_children() - 1;
246  m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST);
247  m_xCheckLB->set_text(nRow, rTxt, 1);
248 }
249 
251 {
253  const ACFlags nFlags = pAutoCorrect->GetFlags();
254 
255  m_xCheckLB->freeze();
256  m_xCheckLB->clear();
257 
266 
267  int nPos = 0;
268  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::Autocorrect) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
269  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartWord) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
270  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
271  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
272  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
273  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
274  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
275  m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST );
276 
277  m_xCheckLB->thaw();
278 }
279 
280 /*********************************************************************/
281 /* */
282 /* helping struct for dUserData of the Checklistbox */
283 /* */
284 /*********************************************************************/
285 
287 {
288  OUString *pString;
290 
291  ImpUserData(OUString* pText, vcl::Font* pFnt)
292  { pString = pText; pFont = pFnt;}
293 };
294 
295 
296 /*********************************************************************/
297 /* */
298 /* dialog for per cent settings */
299 /* */
300 /*********************************************************************/
301 
303 {
304  std::unique_ptr<weld::MetricSpinButton> m_xPrcntMF;
305 public:
306  explicit OfaAutoFmtPrcntSet(weld::Window* pParent)
307  : GenericDialogController(pParent, "cui/ui/percentdialog.ui", "PercentDialog")
308  , m_xPrcntMF(m_xBuilder->weld_metric_spin_button("margin", FieldUnit::PERCENT))
309  {
310  }
311 
313  {
314  return *m_xPrcntMF;
315  }
316 };
317 
318 /*********************************************************************/
319 /* */
320 /* use TabPage autoformat */
321 /* */
322 /*********************************************************************/
323 
325 {
344 };
345 
347  const SfxItemSet& rSet )
348  : SfxTabPage(pPage, pController, "cui/ui/applyautofmtpage.ui", "ApplyAutoFmtPage", &rSet)
349  , sDeleteEmptyPara(CuiResId(RID_SVXSTR_DEL_EMPTY_PARA))
350  , sUseReplaceTbl(CuiResId(RID_SVXSTR_USE_REPLACE))
351  , sCapitalStartWord(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
352  , sCapitalStartSentence(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
353  , sUserStyle(CuiResId(RID_SVXSTR_USER_STYLE))
354  , sBullet(CuiResId(RID_SVXSTR_BULLET))
355  , sBoldUnder(CuiResId(RID_SVXSTR_BOLD_UNDER))
356  , sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
357  , sCorrectCapsLock(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
358  , sDetectURL(CuiResId(RID_SVXSTR_DETECT_URL))
359  , sDash(CuiResId(RID_SVXSTR_DASH))
360  , sRightMargin(CuiResId(RID_SVXSTR_RIGHT_MARGIN))
361  , sNum(CuiResId(RID_SVXSTR_NUM))
362  , sBorder(CuiResId(RID_SVXSTR_BORDER))
363  , sTable(CuiResId(RID_SVXSTR_CREATE_TABLE))
364  , sReplaceTemplates(CuiResId(RID_SVXSTR_REPLACE_TEMPLATES))
365  , sDelSpaceAtSttEnd(CuiResId(RID_SVXSTR_DEL_SPACES_AT_STT_END))
366  , sDelSpaceBetweenLines(CuiResId(RID_SVXSTR_DEL_SPACES_BETWEEN_LINES))
367  , nPercent(50)
368  , m_xCheckLB(m_xBuilder->weld_tree_view("list"))
369  , m_xEditPB(m_xBuilder->weld_button("edit"))
370 {
371  m_xCheckLB->connect_changed(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl));
372  m_xCheckLB->connect_row_activated(LINK(this, OfaSwAutoFmtOptionsPage, DoubleClickEditHdl));
373 
374  std::vector<int> aWidths;
375  aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(0)).Width() * 2);
376  aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(1)).Width() * 2);
377  m_xCheckLB->set_column_fixed_widths(aWidths);
378 
379  m_xEditPB->connect_clicked(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl));
380 }
381 
382 void OfaSwAutoFmtOptionsPage::CreateEntry(const OUString& rTxt, sal_uInt16 nCol)
383 {
384  m_xCheckLB->append();
385  const int nRow = m_xCheckLB->n_children() - 1;
386  if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH)
387  m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST);
388  if (nCol == CBCOL_SECOND || nCol == CBCOL_BOTH)
389  m_xCheckLB->set_toggle(nRow, TRISTATE_FALSE, CBCOL_SECOND);
390  m_xCheckLB->set_text(nRow, rTxt, 2);
391 }
392 
394 {
395  delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(REPLACE_BULLETS).toInt64());
396  delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(APPLY_NUMBERING).toInt64());
397  delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA).toInt64());
398 }
399 
400 std::unique_ptr<SfxTabPage> OfaSwAutoFmtOptionsPage::Create(weld::Container* pPage, weld::DialogController* pController,
401  const SfxItemSet* rAttrSet)
402 {
403  return std::make_unique<OfaSwAutoFmtOptionsPage>(pPage, pController, *rAttrSet);
404 }
405 
407 {
408  bool bModified = false;
410  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
411  ACFlags nFlags = pAutoCorrect->GetFlags();
412 
413  bool bCheck = m_xCheckLB->get_toggle(USE_REPLACE_TABLE, CBCOL_FIRST) == TRISTATE_TRUE;
414  bModified |= pOpt->bAutoCorrect != bCheck;
415  pOpt->bAutoCorrect = bCheck;
416  pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect,
418 
419  bCheck = m_xCheckLB->get_toggle(CORR_UPPER, CBCOL_FIRST) == TRISTATE_TRUE;
420  bModified |= pOpt->bCapitalStartWord != bCheck;
421  pOpt->bCapitalStartWord = bCheck;
422  pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord,
424 
425  bCheck = m_xCheckLB->get_toggle(BEGIN_UPPER, CBCOL_FIRST) == TRISTATE_TRUE;
426  bModified |= pOpt->bCapitalStartSentence != bCheck;
427  pOpt->bCapitalStartSentence = bCheck;
428  pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence,
430 
431  bCheck = m_xCheckLB->get_toggle(BOLD_UNDERLINE, CBCOL_FIRST) == TRISTATE_TRUE;
432  bModified |= pOpt->bChgWeightUnderl != bCheck;
433  pOpt->bChgWeightUnderl = bCheck;
434  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl,
436 
437  pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace,
439 
440  pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock,
442 
443  bCheck = m_xCheckLB->get_toggle(DETECT_URL, CBCOL_FIRST) == TRISTATE_TRUE;
444  bModified |= pOpt->bSetINetAttr != bCheck;
445  pOpt->bSetINetAttr = bCheck;
446  pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr,
448 
449  bCheck = m_xCheckLB->get_toggle(DEL_EMPTY_NODE, CBCOL_FIRST) == TRISTATE_TRUE;
450  bModified |= pOpt->bDelEmptyNode != bCheck;
451  pOpt->bDelEmptyNode = bCheck;
452 
453  bCheck = m_xCheckLB->get_toggle(REPLACE_USER_COLL, CBCOL_FIRST) == TRISTATE_TRUE;
454  bModified |= pOpt->bChgUserColl != bCheck;
455  pOpt->bChgUserColl = bCheck;
456 
457  bCheck = m_xCheckLB->get_toggle(REPLACE_BULLETS, CBCOL_FIRST) == TRISTATE_TRUE;
458  bModified |= pOpt->bChgEnumNum != bCheck;
459  pOpt->bChgEnumNum = bCheck;
460  bModified |= aBulletFont != pOpt->aBulletFont;
461  pOpt->aBulletFont = aBulletFont;
462  bModified |= !comphelper::string::equals(sBulletChar, pOpt->cBullet);
463  pOpt->cBullet = sBulletChar[0];
464 
465  bModified |= aByInputBulletFont != pOpt->aByInputBulletFont;
469 
471  bModified |= pOpt->bRightMargin != bCheck;
472  pOpt->bRightMargin = bCheck;
473  bModified |= nPercent != pOpt->nRightMargin;
474  pOpt->nRightMargin = static_cast<sal_uInt8>(nPercent);
475 
476  bCheck = m_xCheckLB->get_toggle(APPLY_NUMBERING, CBCOL_SECOND) == TRISTATE_TRUE;
477  bModified |= pOpt->bSetNumRule != bCheck;
478  pOpt->bSetNumRule = bCheck;
479 
480  bCheck = m_xCheckLB->get_toggle(INSERT_BORDER, CBCOL_SECOND) == TRISTATE_TRUE;
481  bModified |= pOpt->bSetBorder != bCheck;
482  pOpt->bSetBorder = bCheck;
483 
484  bCheck = m_xCheckLB->get_toggle(CREATE_TABLE, CBCOL_SECOND) == TRISTATE_TRUE;
485  bModified |= pOpt->bCreateTable != bCheck;
486  pOpt->bCreateTable = bCheck;
487 
488  bCheck = m_xCheckLB->get_toggle(REPLACE_STYLES, CBCOL_SECOND) == TRISTATE_TRUE;
489  bModified |= pOpt->bReplaceStyles != bCheck;
490  pOpt->bReplaceStyles = bCheck;
491 
492  bCheck = m_xCheckLB->get_toggle(REPLACE_DASHES, CBCOL_FIRST) == TRISTATE_TRUE;
493  bModified |= pOpt->bChgToEnEmDash != bCheck;
494  pOpt->bChgToEnEmDash = bCheck;
495  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash,
497 
498  bCheck = m_xCheckLB->get_toggle(DEL_SPACES_AT_STT_END, CBCOL_FIRST) == TRISTATE_TRUE;
499  bModified |= pOpt->bAFormatDelSpacesAtSttEnd != bCheck;
500  pOpt->bAFormatDelSpacesAtSttEnd = bCheck;
502  bModified |= pOpt->bAFormatByInpDelSpacesAtSttEnd != bCheck;
503  pOpt->bAFormatByInpDelSpacesAtSttEnd = bCheck;
504 
506  bModified |= pOpt->bAFormatDelSpacesBetweenLines != bCheck;
507  pOpt->bAFormatDelSpacesBetweenLines = bCheck;
509  bModified |= pOpt->bAFormatByInpDelSpacesBetweenLines != bCheck;
510  pOpt->bAFormatByInpDelSpacesBetweenLines = bCheck;
511 
512  if(bModified || nFlags != pAutoCorrect->GetFlags())
513  {
515  rCfg.SetModified();
516  rCfg.Commit();
517  }
518 
519  return true;
520 }
521 
523 {
524  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false);
525 }
526 
528 {
530  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
531  const ACFlags nFlags = pAutoCorrect->GetFlags();
532 
533  aBulletFont = pOpt->aBulletFont;
534  sBulletChar = OUString(pOpt->cBullet);
535 
537  sByInputBulletChar = OUString( pOpt->cByInputBullet );
538 
539  nPercent = pOpt->nRightMargin;
541 
542  m_xCheckLB->freeze();
543  m_xCheckLB->clear();
544 
545  // The following entries have to be inserted in the same order
546  // as in the OfaAutoFmtOptions-enum!
555 
558  CreateEntry(sNum.replaceFirst("%1", sBulletChar), CBCOL_SECOND);
564  CreateEntry(sBullet.replaceFirst("%1", sByInputBulletChar), CBCOL_FIRST);
565  CreateEntry(sRightMargin.replaceFirst("%1", sMargin), CBCOL_FIRST);
566 
568  m_xCheckLB->set_toggle(USE_REPLACE_TABLE, bool(nFlags & ACFlags::Autocorrect) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
569  m_xCheckLB->set_toggle(CORR_UPPER, pOpt->bCapitalStartWord ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
570  m_xCheckLB->set_toggle(CORR_UPPER, bool(nFlags & ACFlags::CapitalStartWord) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
571  m_xCheckLB->set_toggle(BEGIN_UPPER, pOpt->bCapitalStartSentence ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
572  m_xCheckLB->set_toggle(BEGIN_UPPER, bool(nFlags & ACFlags::CapitalStartSentence) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
573  m_xCheckLB->set_toggle(BOLD_UNDERLINE, pOpt->bChgWeightUnderl ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
574  m_xCheckLB->set_toggle(BOLD_UNDERLINE, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
575  m_xCheckLB->set_toggle(DETECT_URL, pOpt->bSetINetAttr ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
576  m_xCheckLB->set_toggle(DETECT_URL, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
577  m_xCheckLB->set_toggle(REPLACE_DASHES, pOpt->bChgToEnEmDash ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
578  m_xCheckLB->set_toggle(REPLACE_DASHES, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
583  m_xCheckLB->set_toggle(IGNORE_DBLSPACE, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
584  m_xCheckLB->set_toggle(CORRECT_CAPS_LOCK, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
585  m_xCheckLB->set_toggle(APPLY_NUMBERING, pOpt->bSetNumRule ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
586  m_xCheckLB->set_toggle(INSERT_BORDER, pOpt->bSetBorder ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
587  m_xCheckLB->set_toggle(CREATE_TABLE, pOpt->bCreateTable ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
588  m_xCheckLB->set_toggle(REPLACE_STYLES, pOpt->bReplaceStyles ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
589  m_xCheckLB->set_toggle(DEL_EMPTY_NODE, pOpt->bDelEmptyNode ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
590  m_xCheckLB->set_toggle(REPLACE_USER_COLL, pOpt->bChgUserColl ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
591  m_xCheckLB->set_toggle(REPLACE_BULLETS, pOpt->bChgEnumNum ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
592  m_xCheckLB->set_toggle(MERGE_SINGLE_LINE_PARA, pOpt->bRightMargin ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
593 
594  ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont);
595  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
596  m_xCheckLB->set_id(REPLACE_BULLETS, sId);
597 
598  pUserData = new ImpUserData(&sMargin, nullptr);
599  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
600  m_xCheckLB->set_id(MERGE_SINGLE_LINE_PARA, sId);
601 
603  sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData2));
604  m_xCheckLB->set_id(APPLY_NUMBERING, sId);
605 
606  m_xCheckLB->thaw();
607 }
608 
610 {
611  m_xEditPB->set_sensitive(rBox.get_selected_id().toInt64() != 0);
612 }
613 
615 {
616  EditHdl(*m_xEditPB);
617  return true;
618 }
619 
621 {
622  int nSelEntryPos = m_xCheckLB->get_selected_index();
623  if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
624  {
625  SvxCharacterMap aMapDlg(GetFrameWeld(), nullptr, nullptr);
626  ImpUserData* pUserData = reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos).toInt64());
627  aMapDlg.SetCharFont(*pUserData->pFont);
628  aMapDlg.SetChar( (*pUserData->pString)[0] );
629  if (RET_OK == aMapDlg.run())
630  {
631  const vcl::Font& aFont(aMapDlg.GetCharFont());
632  *pUserData->pFont = aFont;
633  sal_UCS4 aChar = aMapDlg.GetChar();
634  // using the UCS4 constructor
635  OUString aOUStr( &aChar, 1 );
636  *pUserData->pString = aOUStr;
637  if (nSelEntryPos == REPLACE_BULLETS)
638  m_xCheckLB->set_text(nSelEntryPos, sNum.replaceFirst("%1", aOUStr), 2);
639  else
640  m_xCheckLB->set_text(nSelEntryPos, sBullet.replaceFirst("%1", aOUStr), 2);
641  }
642  }
643  else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
644  {
645  // dialog for per cent settings
647  aDlg.GetPrcntFld().set_value(nPercent, FieldUnit::PERCENT);
648  if (aDlg.run() == RET_OK)
649  {
650  nPercent = static_cast<sal_uInt16>(aDlg.GetPrcntFld().get_value(FieldUnit::PERCENT));
651  sMargin = unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
652  m_xCheckLB->set_text(nSelEntryPos, sRightMargin.replaceFirst("%1", sMargin), 2);
653  }
654  }
655 }
656 
657 
659  const SfxItemSet& rSet)
660  : SfxTabPage(pPage, pController, "cui/ui/acorreplacepage.ui", "AcorReplacePage", &rSet)
661  , eLang(eLastDialogLanguage)
662  , bHasSelectionText(false)
663  , bFirstSelect(true)
664  , bReplaceEditChanged(false)
665  , bSWriter(true)
666  , m_xTextOnlyCB(m_xBuilder->weld_check_button("textonly"))
667  , m_xShortED(m_xBuilder->weld_entry("origtext"))
668  , m_xReplaceED(m_xBuilder->weld_entry("newtext"))
669  , m_xReplaceTLB(m_xBuilder->weld_tree_view("tabview"))
670  , m_xNewReplacePB(m_xBuilder->weld_button("new"))
671  , m_xReplacePB(m_xBuilder->weld_button("replace"))
672  , m_xDeleteReplacePB(m_xBuilder->weld_button("delete"))
673  , m_xButtonBox(m_xBuilder->weld_container("buttonbox"))
674 {
675  sNew = m_xNewReplacePB->get_label();
676  sModify = m_xReplacePB->get_label();
677 
678  // lock down the width of the button box to its max
679  // desired width
680  auto nMaxWidth = m_xButtonBox->get_preferred_size().Width();
681  m_xButtonBox->set_size_request(nMaxWidth, -1);
682  m_xReplacePB->hide();
683 
684  // tdf#125348 set some small but fixed initial width size, final width will
685  // depend on the size of the entry boxes
686  m_xReplaceTLB->set_size_request(42, m_xReplaceTLB->get_height_rows(10));
687 
688  SfxModule *pMod = SfxApplication::GetModule(SfxToolsModule::Writer);
690 
691  LanguageTag aLanguageTag( eLastDialogLanguage );
693  pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
694  pCharClass.reset( new CharClass( aLanguageTag ) );
695 
696  auto nColWidth = m_xReplaceTLB->get_approximate_digit_width() * 32;
697  m_aReplaceFixedWidths.push_back(nColWidth);
698  m_aReplaceFixedWidths.push_back(nColWidth);
699 
700  m_xReplaceTLB->connect_changed( LINK(this, OfaAutocorrReplacePage, SelectHdl) );
701  m_xNewReplacePB->connect_clicked( LINK(this, OfaAutocorrReplacePage, NewDelButtonHdl) );
702  m_xDeleteReplacePB->connect_clicked( LINK(this, OfaAutocorrReplacePage, NewDelButtonHdl) );
703  m_xShortED->connect_changed( LINK(this, OfaAutocorrReplacePage, ModifyHdl) );
704  m_xReplaceED->connect_changed( LINK(this, OfaAutocorrReplacePage, ModifyHdl) );
705  m_xShortED->connect_activate( LINK(this, OfaAutocorrReplacePage, NewDelActionHdl) );
706  m_xReplaceED->connect_activate( LINK(this, OfaAutocorrReplacePage, NewDelActionHdl) );
707  m_xShortED->connect_size_allocate(LINK(this, OfaAutocorrReplacePage, EntrySizeAllocHdl));
708  m_xReplaceED->connect_size_allocate(LINK(this, OfaAutocorrReplacePage, EntrySizeAllocHdl));
709 }
710 
712 {
713  aDoubleStringTable.clear();
714  aChangesTable.clear();
715 
716  pCompareClass.reset();
717  pCharClass.reset();
718 }
719 
720 std::unique_ptr<SfxTabPage> OfaAutocorrReplacePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
721 {
722  return std::make_unique<OfaAutocorrReplacePage>(pPage, pController, *rSet);
723 }
724 
726 {
727  if(eLang != eLastDialogLanguage)
728  SetLanguage(eLastDialogLanguage);
729  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(true);
730 }
731 
733 {
734  return DeactivateRC::LeavePage;
735 }
736 
738 {
740 
741  for (StringChangeTable::reverse_iterator it = aChangesTable.rbegin(); it != aChangesTable.rend(); ++it)
742  {
743  LanguageType eCurrentLang = it->first;
744  StringChangeList& rStringChangeList = it->second;
745  std::vector<SvxAutocorrWord> aDeleteWords;
746  std::vector<SvxAutocorrWord> aNewWords;
747 
748  aDeleteWords.reserve( rStringChangeList.aDeletedEntries.size() );
749  for (const DoubleString & deleteEntry : rStringChangeList.aDeletedEntries)
750  {
751  SvxAutocorrWord aDeleteWord( deleteEntry.sShort, deleteEntry.sLong );
752  aDeleteWords.push_back( aDeleteWord );
753  }
754 
755  aNewWords.reserve( rStringChangeList.aNewEntries.size() );
756  for (const DoubleString & newEntry : rStringChangeList.aNewEntries)
757  {
758  //fdo#67697 if the user data is set then we want to retain the
759  //source formatting of the entry, so don't use the optimized
760  //text-only MakeCombinedChanges for this entry
761  bool bKeepSourceFormatting = newEntry.pUserData == &bHasSelectionText;
762  if (bKeepSourceFormatting)
763  {
764  pAutoCorrect->PutText(newEntry.sShort, *SfxObjectShell::Current(), eCurrentLang);
765  continue;
766  }
767 
768  SvxAutocorrWord aNewWord( newEntry.sShort, newEntry.sLong );
769  aNewWords.push_back( aNewWord );
770  }
771  pAutoCorrect->MakeCombinedChanges( aNewWords, aDeleteWords, eCurrentLang );
772  }
773  aChangesTable.clear();
774  return false;
775 }
776 
778  LanguageType eOldLanguage,
779  LanguageType eNewLanguage)
780 {
781  eLang = eNewLanguage;
782  if(bFromReset)
783  {
784  aDoubleStringTable.clear();
785  aChangesTable.clear();
786  }
787  else
788  {
789  DoubleStringArray* pArray;
790  if(aDoubleStringTable.find(eOldLanguage) != aDoubleStringTable.end())
791  {
792  pArray = &aDoubleStringTable[eOldLanguage];
793  pArray->clear();
794  }
795  else
796  {
797  pArray = &aDoubleStringTable[eOldLanguage]; // create new array
798  }
799 
800  m_xReplaceTLB->all_foreach([this, &pArray](weld::TreeIter& rIter) {
801  pArray->push_back(DoubleString());
802  DoubleString& rDouble = pArray->back();
803  rDouble.sShort = m_xReplaceTLB->get_text(rIter, 0);
804  rDouble.sLong = m_xReplaceTLB->get_text(rIter, 1);
805  rDouble.pUserData = reinterpret_cast<void*>(m_xReplaceTLB->get_id(rIter).toInt64());
806  return false;
807  });
808  }
809 
810  if( !bSWriter )
811  aFormatText.clear();
812 
813  if (aDoubleStringTable.find(eLang) != aDoubleStringTable.end())
814  {
815  DoubleStringArray& rArray = aDoubleStringTable[eNewLanguage];
816 
817  m_xReplaceTLB->bulk_insert_for_each(rArray.size(), [this, &rArray](weld::TreeIter& rIter, int nIndex) {
818  DoubleString &rDouble = rArray[nIndex];
819  bool bTextOnly = nullptr == rDouble.pUserData;
820  // formatted text is only in Writer
821  if (bSWriter || bTextOnly)
822  {
823  if (!bTextOnly)
824  {
825  // that means: with format info or even with selection text
826  OUString sId = OUString::number(reinterpret_cast<sal_Int64>(rDouble.pUserData));
827  m_xReplaceTLB->set_id(rIter, sId);
828  }
829  m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
830  m_xReplaceTLB->set_text(rIter, rDouble.sLong, 1);
831  }
832  else
833  {
834  aFormatText.insert(rDouble.sShort);
835  }
837  }
838  else
839  {
841  SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang);
842  const SvxAutocorrWordList::AutocorrWordSetType & rContent = pWordList->getSortedContent();
843  m_xReplaceTLB->bulk_insert_for_each(rContent.size(), [this, rContent](weld::TreeIter& rIter, int nIndex) {
844  auto const& elem = rContent[nIndex];
845  bool bTextOnly = elem.IsTextOnly();
846  // formatted text is only in Writer
847  if (bSWriter || bTextOnly)
848  {
849  if (!bTextOnly)
850  {
851  // that means: with format info or even with selection text
852  OUString sId = OUString::number(reinterpret_cast<sal_Int64>(m_xTextOnlyCB.get()));
853  m_xReplaceTLB->set_id(rIter, sId);
854  }
855  m_xReplaceTLB->set_text(rIter, elem.GetShort(), 0);
856  m_xReplaceTLB->set_text(rIter, elem.GetLong(), 1);
857  }
858  else
859  {
860  aFormatText.insert(elem.GetShort());
861  }
863  m_xNewReplacePB->set_sensitive(false);
864  m_xDeleteReplacePB->set_sensitive(false);
865  }
866 
867  SfxViewShell* pViewShell = SfxViewShell::Current();
868  if (pViewShell && pViewShell->HasSelection())
869  {
870  bHasSelectionText = true;
871  const OUString sSelection( pViewShell->GetSelectionText() );
872  m_xReplaceED->set_text(sSelection);
873  m_xTextOnlyCB->set_active(!bSWriter);
874  m_xTextOnlyCB->set_sensitive(bSWriter && !sSelection.isEmpty());
875  }
876  else
877  {
878  m_xTextOnlyCB->set_active(true);
879  m_xTextOnlyCB->set_sensitive(false);
880  }
881 }
882 
884 {
885  RefillReplaceBox(true, eLang, eLang);
886  m_xShortED->grab_focus();
887 }
888 
890 {
891  //save old settings and refill
892  if(eSet != eLang)
893  {
894  RefillReplaceBox(false, eLang, eSet);
895  eLastDialogLanguage = eSet;
896 
897  LanguageTag aLanguageTag( eLastDialogLanguage );
899  pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
900  pCharClass.reset( new CharClass( aLanguageTag ) );
901  ModifyHdl(*m_xShortED);
902  }
903 }
904 
906 {
907  if(!bFirstSelect || !bHasSelectionText)
908  {
909  int nEntry = rBox.get_selected_index();
910  OUString sTmpShort(rBox.get_text(nEntry, 0));
911  // if the text is set via ModifyHdl, the cursor is always at the beginning
912  // of a word, although you're editing here
913  bool bSameContent = 0 == pCompareClass->compareString(sTmpShort, m_xShortED->get_text());
914  int nStartPos, nEndPos;
915  m_xShortED->get_selection_bounds(nStartPos, nEndPos);
916  if (m_xShortED->get_text() != sTmpShort)
917  {
918  m_xShortED->set_text(sTmpShort);
919  // if it was only a different notation, the selection has to be set again
920  if (bSameContent)
921  {
922  m_xShortED->select_region(nStartPos, nEndPos);
923  }
924  }
925  m_xReplaceED->set_text(rBox.get_text(nEntry, 1));
926  // with UserData there is a Formatinfo
927  m_xTextOnlyCB->set_active(rBox.get_id(nEntry).isEmpty());
928  }
929  else
930  {
931  bFirstSelect = false;
932  }
933 
934  m_xNewReplacePB->set_sensitive(false);
935  m_xDeleteReplacePB->set_sensitive(true);
936 };
937 
938 void OfaAutocorrReplacePage::NewEntry(const OUString& sShort, const OUString& sLong, bool bKeepSourceFormatting)
939 {
940  DoubleStringArray& rNewArray = aChangesTable[eLang].aNewEntries;
941  for (size_t i = 0; i < rNewArray.size(); i++)
942  {
943  if (rNewArray[i].sShort == sShort)
944  {
945  rNewArray.erase(rNewArray.begin() + i);
946  break;
947  }
948  }
949 
950  DoubleStringArray& rDeletedArray = aChangesTable[eLang].aDeletedEntries;
951  for (size_t i = 0; i < rDeletedArray.size(); i++)
952  {
953  if (rDeletedArray[i].sShort == sShort)
954  {
955  rDeletedArray.erase(rDeletedArray.begin() + i);
956  break;
957  }
958  }
959 
960  DoubleString aNewString;
961  aNewString.sShort = sShort;
962  aNewString.sLong = sLong;
963  rNewArray.push_back(aNewString);
964  if (bKeepSourceFormatting)
965  rNewArray.back().pUserData = &bHasSelectionText;
966 }
967 
968 void OfaAutocorrReplacePage::DeleteEntry(const OUString& sShort, const OUString& sLong)
969 {
970  DoubleStringArray& rNewArray = aChangesTable[eLang].aNewEntries;
971  for (size_t i = 0; i < rNewArray.size(); i++)
972  {
973  if (rNewArray[i].sShort == sShort)
974  {
975  rNewArray.erase(rNewArray.begin() + i);
976  break;
977  }
978  }
979 
980  DoubleStringArray& rDeletedArray = aChangesTable[eLang].aDeletedEntries;
981  for (size_t i = 0; i < rDeletedArray.size(); i++)
982  {
983  if (rDeletedArray[i].sShort == sShort)
984  {
985  rDeletedArray.erase(rDeletedArray.begin() + i);
986  break;
987  }
988  }
989 
990  DoubleString aDeletedString;
991  aDeletedString.sShort = sShort;
992  aDeletedString.sLong = sLong;
993  rDeletedArray.push_back(aDeletedString);
994 }
995 
996 IMPL_LINK(OfaAutocorrReplacePage, NewDelButtonHdl, weld::Button&, rBtn, void)
997 {
998  NewDelHdl(&rBtn);
999 }
1000 
1001 IMPL_LINK(OfaAutocorrReplacePage, NewDelActionHdl, weld::Entry&, rEdit, bool)
1002 {
1003  return NewDelHdl(&rEdit);
1004 }
1005 
1006 IMPL_LINK_NOARG(OfaAutocorrReplacePage, EntrySizeAllocHdl, const Size&, void)
1007 {
1008  m_aReplaceFixedWidths.clear();
1009  int x, y, width, height;
1010  if (m_xReplaceED->get_extents_relative_to(*m_xReplaceTLB, x, y, width, height))
1011  {
1012  m_aReplaceFixedWidths.push_back(x);
1013  m_aReplaceFixedWidths.push_back(width - 1);
1014  m_xReplaceTLB->set_column_fixed_widths(m_aReplaceFixedWidths);
1015  }
1016 }
1017 
1019 {
1020  int nEntry = m_xReplaceTLB->get_selected_index();
1021  if (pBtn == m_xDeleteReplacePB.get())
1022  {
1023  DBG_ASSERT( nEntry != -1, "no entry selected" );
1024  if (nEntry != -1)
1025  {
1026  DeleteEntry(m_xReplaceTLB->get_text(nEntry, 0), m_xReplaceTLB->get_text(nEntry, 1));
1027  m_xReplaceTLB->remove(nEntry);
1028  ModifyHdl(*m_xShortED);
1029  return false;
1030  }
1031  }
1032 
1033  if (pBtn == m_xNewReplacePB.get() || m_xNewReplacePB->get_sensitive())
1034  {
1035  OUString sEntry(m_xShortED->get_text());
1036  if (!sEntry.isEmpty() && (!m_xReplaceED->get_text().isEmpty() ||
1037  ( bHasSelectionText && bSWriter ) ))
1038  {
1039  bool bKeepSourceFormatting = !bReplaceEditChanged && !m_xTextOnlyCB->get_active();
1040 
1041  NewEntry(m_xShortED->get_text(), m_xReplaceED->get_text(), bKeepSourceFormatting);
1042  m_xReplaceTLB->freeze();
1043  int nPos = -1;
1044  if (nEntry != -1)
1045  {
1046  nPos = nEntry;
1047  m_xReplaceTLB->remove(nEntry);
1048  }
1049  else
1050  {
1051  int j;
1052  int nCount = m_xReplaceTLB->n_children();
1053  for (j = 0; j < nCount; ++j)
1054  {
1055  if (0 >= pCompareClass->compareString(sEntry, m_xReplaceTLB->get_text(j, 0)))
1056  break;
1057  }
1058  nPos = j;
1059  }
1060 
1061  OUString sId;
1062  if (bKeepSourceFormatting)
1063  {
1064  sId = OUString::number(reinterpret_cast<sal_Int64>(&bHasSelectionText)); // new formatted text
1065  }
1066 
1067  m_xReplaceTLB->insert(nPos, sEntry, &sId, nullptr, nullptr);
1068  m_xReplaceTLB->set_text(nPos, m_xReplaceED->get_text(), 1);
1069  m_xReplaceTLB->thaw();
1070  m_xReplaceTLB->scroll_to_row(nPos);
1071  // if the request came from the ReplaceEdit, give focus to the ShortEdit
1072  if (m_xReplaceED->has_focus())
1073  {
1074  m_xShortED->grab_focus();
1075  }
1076  }
1077  }
1078  else
1079  {
1080  // this can only be an enter in one of the two edit fields
1081  // which means EndDialog() - has to be evaluated in KeyInput
1082  return false;
1083  }
1084  ModifyHdl(*m_xShortED);
1085  return true;
1086 }
1087 
1089 {
1090  std::unique_ptr<weld::TreeIter> xFirstSel(m_xReplaceTLB->make_iterator());
1091  bool bFirstSelIterSet = m_xReplaceTLB->get_selected(xFirstSel.get());
1092  bool bShort = &rEdt == m_xShortED.get();
1093  const OUString rEntry = rEdt.get_text();
1094  const OUString rRepString = m_xReplaceED->get_text();
1095  OUString aWordStr(pCharClass->lowercase(rEntry));
1096 
1097  if(bShort)
1098  {
1099  if(!rEntry.isEmpty())
1100  {
1101  bool bFound = false;
1102  bool bTmpSelEntry=false;
1103 
1104  m_xReplaceTLB->all_foreach([this, &rEntry, &rRepString, &bFound,
1105  &bTmpSelEntry, &bFirstSelIterSet,
1106  &xFirstSel, &aWordStr](weld::TreeIter& rIter){
1107  OUString aTestStr = m_xReplaceTLB->get_text(rIter, 0);
1108  if( pCompareClass->compareString(rEntry, aTestStr ) == 0 )
1109  {
1110  if (!rRepString.isEmpty())
1111  bFirstSelect = true;
1112  m_xReplaceTLB->set_cursor(rIter);
1113  m_xReplaceTLB->copy_iterator(rIter, *xFirstSel);
1114  bFirstSelIterSet = true;
1115  m_xNewReplacePB->set_label(sModify);
1116  bFound = true;
1117  return true;
1118  }
1119  else
1120  {
1121  aTestStr = pCharClass->lowercase( aTestStr );
1122  if( aTestStr.startsWith(aWordStr) && !bTmpSelEntry )
1123  {
1124  m_xReplaceTLB->scroll_to_row(rIter);
1125  bTmpSelEntry = true;
1126  }
1127  }
1128  return false;
1129  });
1130  if( !bFound )
1131  {
1132  m_xReplaceTLB->select(-1);
1133  bFirstSelIterSet = false;
1134  m_xNewReplacePB->set_label(sNew);
1135  if( bReplaceEditChanged )
1136  m_xTextOnlyCB->set_sensitive(false);
1137  }
1138  m_xDeleteReplacePB->set_sensitive(bFound);
1139  }
1140  else if (m_xReplaceTLB->n_children() > 0)
1141  {
1142  m_xReplaceTLB->scroll_to_row(0);
1143  }
1144 
1145  }
1146  else if( !bShort )
1147  {
1148  bReplaceEditChanged = true;
1149  if (bFirstSelIterSet)
1150  {
1151  m_xNewReplacePB->set_label(sModify);
1152  }
1153  }
1154 
1155  const OUString& rShortTxt = m_xShortED->get_text();
1156  bool bEnableNew = !rShortTxt.isEmpty() &&
1157  ( !rRepString.isEmpty() ||
1158  ( bHasSelectionText && bSWriter )) &&
1159  ( !bFirstSelIterSet || rRepString !=
1160  m_xReplaceTLB->get_text(*xFirstSel, 1) );
1161  if( bEnableNew )
1162  {
1163  for (auto const& elem : aFormatText)
1164  {
1165  if(elem == rShortTxt)
1166  {
1167  bEnableNew = false;
1168  break;
1169  }
1170  }
1171  }
1172  m_xNewReplacePB->set_sensitive(bEnableNew);
1173 }
1174 
1175 static bool lcl_FindInArray(std::vector<OUString>& rStrings, const OUString& rString)
1176 {
1177  for (auto const& elem : rStrings)
1178  {
1179  if(elem == rString)
1180  {
1181  return true;
1182  }
1183  }
1184  return false;
1185 }
1186 
1188  : SfxTabPage(pPage, pController, "cui/ui/acorexceptpage.ui", "AcorExceptPage", &rSet)
1189  , eLang(eLastDialogLanguage)
1190  , m_xAbbrevED(m_xBuilder->weld_entry("abbrev"))
1191  , m_xAbbrevLB(m_xBuilder->weld_tree_view("abbrevlist"))
1192  , m_xNewAbbrevPB(m_xBuilder->weld_button("newabbrev"))
1193  , m_xDelAbbrevPB(m_xBuilder->weld_button("delabbrev"))
1194  , m_xAutoAbbrevCB(m_xBuilder->weld_check_button("autoabbrev"))
1195  , m_xDoubleCapsED(m_xBuilder->weld_entry("double"))
1196  , m_xDoubleCapsLB(m_xBuilder->weld_tree_view("doublelist"))
1197  , m_xNewDoublePB(m_xBuilder->weld_button("newdouble"))
1198  , m_xDelDoublePB(m_xBuilder->weld_button("deldouble"))
1199  , m_xAutoCapsCB(m_xBuilder->weld_check_button("autodouble"))
1200 {
1201  m_xAbbrevLB->make_sorted();
1202  m_xAbbrevLB->set_size_request(-1, m_xAbbrevLB->get_height_rows(6));
1203 
1204  m_xDoubleCapsLB->make_sorted();
1205  m_xDoubleCapsLB->set_size_request(-1, m_xDoubleCapsLB->get_height_rows(6));
1206 
1207  css::lang::Locale aLcl( LanguageTag::convertToLocale(eLastDialogLanguage ));
1209  pCompareClass->loadDefaultCollator( aLcl, 0 );
1210 
1211  m_xNewAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
1212  m_xDelAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
1213  m_xNewDoublePB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
1214  m_xDelDoublePB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
1215 
1216  m_xAbbrevLB->connect_changed(LINK(this, OfaAutocorrExceptPage, SelectHdl));
1217  m_xDoubleCapsLB->connect_changed(LINK(this, OfaAutocorrExceptPage, SelectHdl));
1218  m_xAbbrevED->connect_changed(LINK(this, OfaAutocorrExceptPage, ModifyHdl));
1219  m_xDoubleCapsED->connect_changed(LINK(this, OfaAutocorrExceptPage, ModifyHdl));
1220 
1221  m_xAbbrevED->connect_activate(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl));
1222  m_xDoubleCapsED->connect_activate(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl));
1223 }
1224 
1226 {
1227  aStringsTable.clear();
1228  pCompareClass.reset();
1229 }
1230 
1231 std::unique_ptr<SfxTabPage> OfaAutocorrExceptPage::Create(weld::Container* pPage, weld::DialogController* pController,
1232  const SfxItemSet* rSet)
1233 {
1234  return std::make_unique<OfaAutocorrExceptPage>(pPage, pController, *rSet);
1235 }
1236 
1238 {
1239  if(eLang != eLastDialogLanguage)
1240  SetLanguage(eLastDialogLanguage);
1241  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(true);
1242 }
1243 
1245 {
1246  return DeactivateRC::LeavePage;
1247 }
1248 
1250 {
1252  for(StringsTable::reverse_iterator it1 = aStringsTable.rbegin(); it1 != aStringsTable.rend(); ++it1)
1253  {
1254  LanguageType eCurLang = it1->first;
1255  StringsArrays& rArrays = it1->second;
1256  if(eCurLang != eLang) // current language is treated later
1257  {
1258  SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang);
1259 
1260  if(pWrdList)
1261  {
1262  size_t nCount = pWrdList->size();
1263  size_t i;
1264  for( i = nCount; i; )
1265  {
1266  OUString aString = (*pWrdList)[ --i ];
1267 
1268  if( !lcl_FindInArray(rArrays.aDoubleCapsStrings, aString))
1269  {
1270  pWrdList->erase(i);
1271  }
1272  }
1273 
1274  for (auto const& elem : rArrays.aDoubleCapsStrings)
1275  {
1276  pWrdList->insert(elem);
1277  }
1278  pAutoCorrect->SaveWrdSttExceptList(eCurLang);
1279  }
1280 
1281  SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang);
1282 
1283  if(pCplList)
1284  {
1285  size_t nCount = pCplList->size();
1286  size_t i;
1287  for( i = nCount; i; )
1288  {
1289  OUString aString = (*pCplList)[ --i ];
1290  if( !lcl_FindInArray(rArrays.aAbbrevStrings, aString))
1291  {
1292  pCplList->erase(i);
1293  }
1294  }
1295 
1296  for (auto const& elem : rArrays.aAbbrevStrings)
1297  {
1298  pCplList->insert(elem);
1299  }
1300 
1301  pAutoCorrect->SaveCplSttExceptList(eCurLang);
1302  }
1303  }
1304  }
1305  aStringsTable.clear();
1306 
1307  SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang);
1308 
1309  if(pWrdList)
1310  {
1311  size_t nCount = pWrdList->size();
1312  size_t i;
1313  for( i = nCount; i; )
1314  {
1315  OUString aString = (*pWrdList)[ --i ];
1316  if (m_xDoubleCapsLB->find_text(aString) == -1)
1317  {
1318  pWrdList->erase(i);
1319  }
1320  }
1321  nCount = m_xDoubleCapsLB->n_children();
1322  for( i = 0; i < nCount; ++i )
1323  {
1324  pWrdList->insert(m_xDoubleCapsLB->get_text(i));
1325  }
1326  pAutoCorrect->SaveWrdSttExceptList(eLang);
1327  }
1328 
1329  SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang);
1330 
1331  if(pCplList)
1332  {
1333  size_t nCount = pCplList->size();
1334  for( size_t i = nCount; i; )
1335  {
1336  OUString aString = (*pCplList)[ --i ];
1337  if (m_xAbbrevLB->find_text(aString) == -1)
1338  {
1339  pCplList->erase(i);
1340  }
1341  }
1342  sal_Int32 nAbbrevCount = m_xAbbrevLB->n_children();
1343  for( sal_Int32 ia = 0; ia < nAbbrevCount; ++ia )
1344  {
1345  pCplList->insert(m_xAbbrevLB->get_text(ia));
1346  }
1347  pAutoCorrect->SaveCplSttExceptList(eLang);
1348  }
1349  if (m_xAutoAbbrevCB->get_state_changed_from_saved())
1350  pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordCplSttLst, m_xAutoAbbrevCB->get_active());
1351  if (m_xAutoCapsCB->get_state_changed_from_saved())
1352  pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordWrdSttLst, m_xAutoCapsCB->get_active());
1353  return false;
1354 }
1355 
1357 {
1358  if(eLang != eSet)
1359  {
1360  // save old settings and fill anew
1361  RefillReplaceBoxes(false, eLang, eSet);
1362  eLastDialogLanguage = eSet;
1364  pCompareClass->loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage ), 0 );
1365  ModifyHdl(*m_xAbbrevED);
1366  ModifyHdl(*m_xDoubleCapsED);
1367  }
1368 }
1369 
1371  LanguageType eOldLanguage,
1372  LanguageType eNewLanguage)
1373 {
1374  eLang = eNewLanguage;
1375  if(bFromReset)
1376  {
1377  aStringsTable.clear();
1378  }
1379  else
1380  {
1381  StringsArrays* pArrays;
1382  if(aStringsTable.find(eOldLanguage) != aStringsTable.end())
1383  {
1384  pArrays = &aStringsTable[eOldLanguage];
1385  pArrays->aAbbrevStrings.clear();
1386  pArrays->aDoubleCapsStrings.clear();
1387  }
1388  else
1389  {
1390  pArrays = &aStringsTable[eOldLanguage]; // create new array
1391  }
1392 
1393  sal_Int32 i, nCount;
1394  nCount = m_xAbbrevLB->n_children();
1395  for(i = 0; i < nCount; i++)
1396  pArrays->aAbbrevStrings.push_back(m_xAbbrevLB->get_text(i));
1397 
1398  nCount = m_xDoubleCapsLB->n_children();
1399  for(i = 0; i < nCount; i++)
1400  pArrays->aDoubleCapsStrings.push_back(m_xDoubleCapsLB->get_text(i));
1401  }
1402  m_xDoubleCapsLB->clear();
1403  m_xAbbrevLB->clear();
1404  OUString sTemp;
1405  m_xAbbrevED->set_text(sTemp);
1406  m_xDoubleCapsED->set_text(sTemp);
1407 
1408  if(aStringsTable.find(eLang) != aStringsTable.end())
1409  {
1410  StringsArrays& rArrays = aStringsTable[eLang];
1411  for (auto const& elem : rArrays.aAbbrevStrings)
1412  m_xAbbrevLB->append_text(elem);
1413 
1414  for (auto const& elem : rArrays.aDoubleCapsStrings)
1415  m_xDoubleCapsLB->append_text(elem);
1416  }
1417  else
1418  {
1420  const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang);
1421  const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang);
1422  size_t i;
1423  for( i = 0; i < pCplList->size(); i++ )
1424  {
1425  m_xAbbrevLB->append_text((*pCplList)[i]);
1426  }
1427  for( i = 0; i < pWrdList->size(); i++ )
1428  {
1429  m_xDoubleCapsLB->append_text((*pWrdList)[i]);
1430  }
1431  }
1432 }
1433 
1435 {
1437  RefillReplaceBoxes(true, eLang, eLang);
1438  m_xAutoAbbrevCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordCplSttLst));
1439  m_xAutoCapsCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordWrdSttLst));
1440  m_xAutoAbbrevCB->save_state();
1441  m_xAutoCapsCB->save_state();
1442 }
1443 
1444 IMPL_LINK(OfaAutocorrExceptPage, NewDelButtonHdl, weld::Button&, rBtn, void)
1445 {
1446  NewDelHdl(&rBtn);
1447 }
1448 
1449 IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, weld::Entry&, rEdit, bool)
1450 {
1451  NewDelHdl(&rEdit);
1452  return false;
1453 }
1454 
1456 {
1457  if ((pBtn == m_xNewAbbrevPB.get() || pBtn == m_xAbbrevED.get())
1458  && !m_xAbbrevED->get_text().isEmpty())
1459  {
1460  m_xAbbrevLB->append_text(m_xAbbrevED->get_text());
1461  ModifyHdl(*m_xAbbrevED);
1462  }
1463  else if(pBtn == m_xDelAbbrevPB.get())
1464  {
1465  m_xAbbrevLB->remove_text(m_xAbbrevED->get_text());
1466  ModifyHdl(*m_xAbbrevED);
1467  }
1468  else if((pBtn == m_xNewDoublePB.get() || pBtn == m_xDoubleCapsED.get() )
1469  && !m_xDoubleCapsED->get_text().isEmpty())
1470  {
1471  m_xDoubleCapsLB->append_text(m_xDoubleCapsED->get_text());
1472  ModifyHdl(*m_xDoubleCapsED);
1473  }
1474  else if (pBtn == m_xDelDoublePB.get())
1475  {
1476  m_xDoubleCapsLB->remove_text(m_xDoubleCapsED->get_text());
1477  ModifyHdl(*m_xDoubleCapsED);
1478  }
1479 }
1480 
1482 {
1483  if (&rBox == m_xAbbrevLB.get())
1484  {
1485  m_xAbbrevED->set_text(rBox.get_selected_text());
1486  m_xNewAbbrevPB->set_sensitive(false);
1487  m_xDelAbbrevPB->set_sensitive(true);
1488  }
1489  else
1490  {
1491  m_xDoubleCapsED->set_text(rBox.get_selected_text());
1492  m_xNewDoublePB->set_sensitive(false);
1493  m_xDelDoublePB->set_sensitive(true);
1494  }
1495 }
1496 
1498 {
1499  const OUString& sEntry = rEdt.get_text();
1500  bool bEntryLen = !sEntry.isEmpty();
1501  if (&rEdt == m_xAbbrevED.get())
1502  {
1503  bool bSame = lcl_FindEntry(*m_xAbbrevLB, sEntry, *pCompareClass);
1504  if(bSame && sEntry != m_xAbbrevLB->get_selected_text())
1505  rEdt.set_text(m_xAbbrevLB->get_selected_text());
1506  m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen);
1507  m_xDelAbbrevPB->set_sensitive(bSame && bEntryLen);
1508  }
1509  else
1510  {
1511  bool bSame = lcl_FindEntry(*m_xDoubleCapsLB, sEntry, *pCompareClass);
1512  if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text())
1513  rEdt.set_text(m_xDoubleCapsLB->get_selected_text());
1514  m_xNewDoublePB->set_sensitive(!bSame && bEntryLen);
1515  m_xDelDoublePB->set_sensitive(bSame && bEntryLen);
1516  }
1517 }
1518 
1520 {
1523 };
1524 
1525 void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
1526 {
1527  rCheckLB.append();
1528  const int nRow = rCheckLB.n_children() - 1;
1529  if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH)
1530  rCheckLB.set_toggle(nRow, TRISTATE_FALSE, CBCOL_FIRST);
1531  if (nCol == CBCOL_SECOND || nCol == CBCOL_BOTH)
1532  rCheckLB.set_toggle(nRow, TRISTATE_FALSE, CBCOL_SECOND);
1533  rCheckLB.set_text(nRow, rTxt, nTextCol);
1534 }
1535 
1537  : SfxTabPage(pPage, pController, "cui/ui/applylocalizedpage.ui", "ApplyLocalizedPage", &rSet)
1538  , sNonBrkSpace(CuiResId(RID_SVXSTR_NON_BREAK_SPACE))
1539  , sOrdinal(CuiResId(RID_SVXSTR_ORDINAL))
1540  , cSglStartQuote(0)
1541  , cSglEndQuote(0)
1542  , cStartQuote(0)
1543  , cEndQuote(0)
1544  , m_xSingleTypoCB(m_xBuilder->weld_check_button("singlereplace"))
1545  , m_xSglStartQuotePB(m_xBuilder->weld_button("startsingle"))
1546  , m_xSglStartExFT(m_xBuilder->weld_label("singlestartex"))
1547  , m_xSglEndQuotePB(m_xBuilder->weld_button("endsingle"))
1548  , m_xSglEndExFT(m_xBuilder->weld_label("singleendex"))
1549  , m_xSglStandardPB(m_xBuilder->weld_button("defaultsingle"))
1550  , m_xDoubleTypoCB(m_xBuilder->weld_check_button("doublereplace"))
1551  , m_xDblStartQuotePB(m_xBuilder->weld_button("startdouble"))
1552  , m_xDblStartExFT(m_xBuilder->weld_label("doublestartex"))
1553  , m_xDblEndQuotePB(m_xBuilder->weld_button("enddouble"))
1554  , m_xDblEndExFT(m_xBuilder->weld_label("doubleendex"))
1555  , m_xDblStandardPB(m_xBuilder->weld_button("defaultdouble"))
1556  , m_xStandard(m_xBuilder->weld_label("singlestartex"))
1557  , m_xCheckLB(m_xBuilder->weld_tree_view("checklist"))
1558  , m_xSwCheckLB(m_xBuilder->weld_tree_view("list"))
1559 {
1560  m_xSwCheckLB->set_size_request(m_xSwCheckLB->get_approximate_digit_width() * 50,
1561  m_xSwCheckLB->get_height_rows(6));
1562 
1563  bool bShowSWOptions = false;
1564 
1565  const SfxBoolItem* pItem = rSet.GetItem<SfxBoolItem>(SID_AUTO_CORRECT_DLG, false);
1566  if ( pItem && pItem->GetValue() )
1567  bShowSWOptions = true;
1568 
1569  if ( bShowSWOptions )
1570  {
1571  std::vector<int> aWidths;
1572  aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(0)).Width() * 2);
1573  aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(1)).Width() * 2);
1574  m_xSwCheckLB->set_column_fixed_widths(aWidths);
1575  m_xCheckLB->hide();
1576  }
1577  else
1578  {
1579  std::vector<int> aWidths;
1580  aWidths.push_back(m_xSwCheckLB->get_checkbox_column_width());
1581  m_xCheckLB->set_column_fixed_widths(aWidths);
1582  m_xSwCheckLB->hide();
1583  }
1584 
1585  m_xDblStartQuotePB->connect_clicked(LINK(this, OfaQuoteTabPage, QuoteHdl));
1586  m_xDblEndQuotePB->connect_clicked(LINK(this, OfaQuoteTabPage, QuoteHdl));
1587  m_xSglStartQuotePB->connect_clicked(LINK(this, OfaQuoteTabPage, QuoteHdl));
1588  m_xSglEndQuotePB->connect_clicked(LINK(this, OfaQuoteTabPage, QuoteHdl));
1589  m_xDblStandardPB->connect_clicked(LINK(this, OfaQuoteTabPage, StdQuoteHdl));
1590  m_xSglStandardPB->connect_clicked(LINK(this, OfaQuoteTabPage, StdQuoteHdl));
1591 }
1592 
1594 {
1595 }
1596 
1597 std::unique_ptr<SfxTabPage> OfaQuoteTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1598  const SfxItemSet* rAttrSet)
1599 {
1600  return std::make_unique<OfaQuoteTabPage>(pPage, pController, *rAttrSet);
1601 }
1602 
1604 {
1606 
1607  ACFlags nFlags = pAutoCorrect->GetFlags();
1608 
1609  if (m_xCheckLB->get_visible())
1610  {
1611  int nPos = 0;
1612  pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
1613  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
1614  }
1615 
1616  bool bModified = false;
1617  if (m_xSwCheckLB->get_visible())
1618  {
1619  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
1620 
1621  bool bCheck = m_xSwCheckLB->get_toggle(ADD_NONBRK_SPACE, CBCOL_FIRST) == TRISTATE_TRUE;
1622  bModified |= pOpt->bAddNonBrkSpace != bCheck;
1623  pOpt->bAddNonBrkSpace = bCheck;
1624  pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace,
1626 
1627  bCheck = m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_FIRST) == TRISTATE_TRUE;
1628  bModified |= pOpt->bChgOrdinalNumber != bCheck;
1629  pOpt->bChgOrdinalNumber = bCheck;
1630  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber,
1632  }
1633 
1634  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgQuotes, m_xDoubleTypoCB->get_active());
1635  pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgSglQuotes, m_xSingleTypoCB->get_active());
1636  bool bReturn = nFlags != pAutoCorrect->GetFlags();
1637  if(cStartQuote != pAutoCorrect->GetStartDoubleQuote())
1638  {
1639  bReturn = true;
1640  sal_Unicode cUCS2 = static_cast<sal_Unicode>(cStartQuote); //TODO
1641  pAutoCorrect->SetStartDoubleQuote(cUCS2);
1642  }
1643  if(cEndQuote != pAutoCorrect->GetEndDoubleQuote())
1644  {
1645  bReturn = true;
1646  sal_Unicode cUCS2 = static_cast<sal_Unicode>(cEndQuote); //TODO
1647  pAutoCorrect->SetEndDoubleQuote(cUCS2);
1648  }
1649  if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote())
1650  {
1651  bReturn = true;
1652  sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglStartQuote); //TODO
1653  pAutoCorrect->SetStartSingleQuote(cUCS2);
1654  }
1655  if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote())
1656  {
1657  bReturn = true;
1658  sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglEndQuote); //TODO
1659  pAutoCorrect->SetEndSingleQuote(cUCS2);
1660  }
1661 
1662  if( bModified || bReturn )
1663  {
1665  rCfg.SetModified();
1666  rCfg.Commit();
1667  }
1668  return bReturn;
1669 }
1670 
1672 {
1673  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false);
1674 }
1675 
1677 {
1679  const ACFlags nFlags = pAutoCorrect->GetFlags();
1680 
1681  // Initialize the Sw options
1682  if (m_xSwCheckLB->get_visible())
1683  {
1684  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
1685 
1686  m_xSwCheckLB->freeze();
1687  m_xSwCheckLB->clear();
1688 
1691 
1693  m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
1694  m_xSwCheckLB->set_toggle(REPLACE_1ST, pOpt->bChgOrdinalNumber ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
1695  m_xSwCheckLB->set_toggle(REPLACE_1ST, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
1696 
1697  m_xSwCheckLB->thaw();
1698  }
1699 
1700  // Initialize the non Sw options
1701  if (m_xCheckLB->get_visible())
1702  {
1703  m_xCheckLB->freeze();
1704  m_xCheckLB->clear();
1705 
1708 
1709  int nPos = 0;
1710  m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
1711  m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
1712 
1713  m_xCheckLB->thaw();
1714  }
1715 
1716  // Initialize the quote stuffs
1717  m_xDoubleTypoCB->set_active(bool(nFlags & ACFlags::ChgQuotes));
1718  m_xSingleTypoCB->set_active(bool(nFlags & ACFlags::ChgSglQuotes));
1719  m_xDoubleTypoCB->save_state();
1720  m_xSingleTypoCB->save_state();
1721 
1722  cStartQuote = pAutoCorrect->GetStartDoubleQuote();
1723  cEndQuote = pAutoCorrect->GetEndDoubleQuote();
1724  cSglStartQuote = pAutoCorrect->GetStartSingleQuote();
1725  cSglEndQuote = pAutoCorrect->GetEndSingleQuote();
1726 
1731 }
1732 
1733 #define SGL_START 0
1734 #define DBL_START 1
1735 #define SGL_END 2
1736 #define DBL_END 3
1737 
1738 
1739 IMPL_LINK(OfaQuoteTabPage, QuoteHdl, weld::Button&, rBtn, void)
1740 {
1741  sal_uInt16 nMode = SGL_START;
1742  if (&rBtn == m_xSglEndQuotePB.get())
1743  nMode = SGL_END;
1744  else if (&rBtn == m_xDblStartQuotePB.get())
1745  nMode = DBL_START;
1746  else if (&rBtn == m_xDblEndQuotePB.get())
1747  nMode = DBL_END;
1748  // start character selection dialog
1749  SvxCharacterMap aMap(GetFrameWeld(), nullptr, nullptr);
1750  aMap.SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT,
1751  LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne ));
1752  aMap.set_title(nMode < SGL_END ? CuiResId(RID_SVXSTR_STARTQUOTE) : CuiResId(RID_SVXSTR_ENDQUOTE));
1753  sal_UCS4 cDlg;
1756  switch( nMode )
1757  {
1758  case SGL_START:
1759  cDlg = cSglStartQuote;
1760  if(cDlg == 0)
1761  cDlg = pAutoCorrect->GetQuote('\'', true, eLang);
1762  break;
1763  case SGL_END:
1764  cDlg = cSglEndQuote;
1765  if(cDlg == 0)
1766  cDlg = pAutoCorrect->GetQuote('\'', false, eLang);
1767  break;
1768  case DBL_START:
1769  cDlg = cStartQuote;
1770  if(cDlg == 0)
1771  cDlg = pAutoCorrect->GetQuote('\"', true, eLang);
1772  break;
1773  case DBL_END:
1774  cDlg = cEndQuote;
1775  if(cDlg == 0)
1776  cDlg = pAutoCorrect->GetQuote('\"', false, eLang);
1777  break;
1778  default:
1779  OSL_FAIL("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" );
1780  cDlg = 0;
1781  break;
1782 
1783  }
1784  aMap.SetChar( cDlg );
1785  aMap.DisableFontSelection();
1786  if (aMap.run() == RET_OK)
1787  {
1788  sal_UCS4 cNewChar = aMap.GetChar();
1789  switch( nMode )
1790  {
1791  case SGL_START:
1792  cSglStartQuote = cNewChar;
1793  m_xSglStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1794  break;
1795  case SGL_END:
1796  cSglEndQuote = cNewChar;
1797  m_xSglEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1798  break;
1799  case DBL_START:
1800  cStartQuote = cNewChar;
1801  m_xDblStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1802  break;
1803  case DBL_END:
1804  cEndQuote = cNewChar;
1805  m_xDblEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1806  break;
1807  }
1808  }
1809 }
1810 
1811 IMPL_LINK(OfaQuoteTabPage, StdQuoteHdl, weld::Button&, rBtn, void)
1812 {
1813  if (&rBtn == m_xDblStandardPB.get())
1814  {
1815  cStartQuote = 0;
1816  m_xDblStartExFT->set_label(ChangeStringExt_Impl(0));
1817  cEndQuote = 0;
1818  m_xDblEndExFT->set_label(ChangeStringExt_Impl(0));
1819 
1820  }
1821  else
1822  {
1823  cSglStartQuote = 0;
1824  m_xSglStartExFT->set_label(ChangeStringExt_Impl(0));
1825  cSglEndQuote = 0;
1826  m_xSglEndExFT->set_label(ChangeStringExt_Impl(0));
1827  }
1828 }
1829 
1831 {
1832  if (!cChar)
1833  return m_xStandard->get_label();
1834 
1835  // convert codepoint value to unicode-hex string
1836  sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' };
1837  aStrCodes[0] = cChar;
1838  int nFullLen = 5;
1839  int nHexLen = 4;
1840  while( (cChar >> (4*nHexLen)) != 0 )
1841  ++nHexLen;
1842  for( int i = nHexLen; --i >= 0;)
1843  {
1844  sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0';
1845  if( cHexDigit > '9' )
1846  cHexDigit += 'A' - ('9' + 1);
1847  aStrCodes[ nFullLen++ ] = cHexDigit;
1848  }
1849  aStrCodes[ nFullLen++ ] = ')';
1850  // using the new UCS4 constructor
1851  OUString aOUStr( aStrCodes, nFullLen );
1852  return aOUStr;
1853 }
1854 
1856  const SfxItemSet& rSet)
1857  : SfxTabPage(pPage, pController, "cui/ui/wordcompletionpage.ui",
1858  "WordCompletionPage", &rSet)
1859  , m_pAutoCompleteList(nullptr)
1860  , m_nAutoCmpltListCnt(0)
1861  , m_xCBActiv(m_xBuilder->weld_check_button("enablewordcomplete"))
1862  , m_xCBAppendSpace(m_xBuilder->weld_check_button("appendspace"))
1863  , m_xCBAsTip(m_xBuilder->weld_check_button("showastip"))
1864  , m_xCBCollect(m_xBuilder->weld_check_button("collectwords"))
1865  , m_xCBRemoveList(m_xBuilder->weld_check_button("whenclosing"))
1866  , m_xDCBExpandKey(m_xBuilder->weld_combo_box("acceptwith"))
1867  , m_xNFMinWordlen(m_xBuilder->weld_spin_button("minwordlen"))
1868  , m_xNFMaxEntries(m_xBuilder->weld_spin_button("maxentries"))
1869  , m_xLBEntries(m_xBuilder->weld_tree_view("entries"))
1870  , m_xPBEntries(m_xBuilder->weld_button("delete"))
1871 {
1872  //fdo#65595, we need height-for-width support here, but for now we can
1873  //bodge it
1874  Size aPrefSize(m_xCBRemoveList->get_preferred_size());
1875  int nMaxWidth = m_xCBRemoveList->get_approximate_digit_width() * 40;
1876  if (aPrefSize.Width() > nMaxWidth)
1877  {
1878  m_xCBRemoveList->set_label_line_wrap(true);
1879  m_xCBRemoveList->set_size_request(nMaxWidth, -1);
1880  }
1881 
1882  m_xLBEntries->set_size_request(m_xLBEntries->get_approximate_digit_width() * 30,
1883  m_xLBEntries->get_height_rows(10));
1884 
1885  // the defined KEYs
1886  static const sal_uInt16 aKeyCodes[] = {
1887  KEY_END,
1888  KEY_RETURN,
1889  KEY_SPACE,
1890  KEY_RIGHT,
1891  KEY_TAB,
1892  0
1893  };
1894 
1895  for( const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys )
1896  {
1897  vcl::KeyCode aKCode(*pKeys);
1898  m_xDCBExpandKey->append(OUString::number(static_cast<sal_Int32>(*pKeys)), aKCode.GetName());
1899  if (KEY_RETURN == *pKeys) // default to RETURN
1900  m_xDCBExpandKey->set_active(std::distance(aKeyCodes, pKeys));
1901  }
1902 
1903  m_xPBEntries->connect_clicked(LINK(this, OfaAutoCompleteTabPage, DeleteHdl));
1904  m_xCBActiv->connect_toggled(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
1905  m_xCBCollect->connect_toggled(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
1906  m_xLBEntries->connect_key_release(LINK(this, OfaAutoCompleteTabPage, KeyReleaseHdl));
1907 }
1908 
1910 {
1911 }
1912 
1913 std::unique_ptr<SfxTabPage> OfaAutoCompleteTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1914  const SfxItemSet* rSet)
1915 {
1916  return std::make_unique<OfaAutoCompleteTabPage>(pPage, pController, *rSet);
1917 }
1918 
1920 {
1921  bool bModified = false, bCheck;
1923  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
1924  sal_uInt16 nVal;
1925 
1926  bCheck = m_xCBActiv->get_active();
1927  bModified |= pOpt->bAutoCompleteWords != bCheck;
1928  pOpt->bAutoCompleteWords = bCheck;
1929  bCheck = m_xCBCollect->get_active();
1930  bModified |= pOpt->bAutoCmpltCollectWords != bCheck;
1931  pOpt->bAutoCmpltCollectWords = bCheck;
1932  bCheck = !m_xCBRemoveList->get_active(); // inverted value!
1933  bModified |= pOpt->bAutoCmpltKeepList != bCheck;
1934  pOpt->bAutoCmpltKeepList = bCheck;
1935  bCheck = m_xCBAppendSpace->get_active();
1936  bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck;
1937  pOpt->bAutoCmpltAppendBlanc = bCheck;
1938  bCheck = m_xCBAsTip->get_active();
1939  bModified |= pOpt->bAutoCmpltShowAsTip != bCheck;
1940  pOpt->bAutoCmpltShowAsTip = bCheck;
1941 
1942  nVal = static_cast<sal_uInt16>(m_xNFMinWordlen->get_value());
1943  bModified |= nVal != pOpt->nAutoCmpltWordLen;
1944  pOpt->nAutoCmpltWordLen = nVal;
1945 
1946  nVal = static_cast<sal_uInt16>(m_xNFMaxEntries->get_value());
1947  bModified |= nVal != pOpt->nAutoCmpltListLen;
1948  pOpt->nAutoCmpltListLen = nVal;
1949 
1950  const int nPos = m_xDCBExpandKey->get_active();
1951  if (nPos != -1)
1952  {
1953  sal_Int32 nKey = m_xDCBExpandKey->get_id(nPos).toInt32();
1954  bModified |= nKey != pOpt->nAutoCmpltExpandKey;
1955  pOpt->nAutoCmpltExpandKey = static_cast<sal_uInt16>(nKey);
1956  }
1957 
1958  if (m_pAutoCompleteList && m_nAutoCmpltListCnt != m_xLBEntries->n_children())
1959  {
1960  bModified = true;
1962  }
1963  if( bModified )
1964  {
1966  rCfg.SetModified();
1967  rCfg.Commit();
1968  }
1969  return true;
1970 }
1971 
1973 {
1975  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
1976 
1977  m_xCBActiv->set_active( pOpt->bAutoCompleteWords );
1978  m_xCBCollect->set_active( pOpt->bAutoCmpltCollectWords );
1979  m_xCBRemoveList->set_active( !pOpt->bAutoCmpltKeepList ); //inverted value!
1980  m_xCBAppendSpace->set_active( pOpt->bAutoCmpltAppendBlanc );
1981  m_xCBAsTip->set_active( pOpt->bAutoCmpltShowAsTip );
1982 
1983  m_xNFMinWordlen->set_value( pOpt->nAutoCmpltWordLen );
1984  m_xNFMaxEntries->set_value( pOpt->nAutoCmpltListLen );
1985 
1986  // select the specific KeyCode:
1987  {
1988  sal_Int32 nKey = pOpt->nAutoCmpltExpandKey;
1989  for (int n = 0, nCnt = m_xDCBExpandKey->get_count(); n < nCnt; ++n)
1990  {
1991  if (nKey == m_xDCBExpandKey->get_id(n).toInt32())
1992  {
1993  m_xDCBExpandKey->set_active(n);
1994  break;
1995  }
1996  }
1997  }
1998 
1999  if (pOpt->m_pAutoCompleteList && !pOpt->m_pAutoCompleteList->empty())
2000  {
2002  pOpt->m_pAutoCompleteList);
2003  pOpt->m_pAutoCompleteList = nullptr;
2005  for (size_t n = 0; n < m_nAutoCmpltListCnt; ++n)
2006  {
2007  const OUString* pStr =
2008  &(*m_pAutoCompleteList)[n]->GetAutoCompleteString();
2009  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pStr)));
2010  m_xLBEntries->append(sId, *pStr);
2011  }
2012  }
2013  else
2014  {
2015  m_xLBEntries->set_sensitive(false);
2016  m_xPBEntries->set_sensitive(false);
2017  }
2018 
2019  CheckHdl(*m_xCBActiv);
2020  CheckHdl(*m_xCBCollect);
2021 }
2022 
2024 {
2025  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage( false );
2026 }
2027 
2029 {
2030  auto rows = m_xLBEntries->get_selected_rows();
2031  std::sort(rows.begin(), rows.end());
2032  while (!rows.empty())
2033  {
2034  sal_Int32 nPos = rows.back();
2035  OUString* pStr = reinterpret_cast<OUString*>(m_xLBEntries->get_id(nPos).toInt64());
2036  m_xLBEntries->remove(nPos);
2037  editeng::IAutoCompleteString hack(*pStr); // UGLY
2038  m_pAutoCompleteList->erase(&hack);
2039  rows.pop_back();
2040  }
2041 }
2042 
2044 {
2045  bool bEnable = rBox.get_active();
2046  if (&rBox == m_xCBActiv.get())
2047  {
2048  m_xCBAppendSpace->set_sensitive(bEnable);
2049  m_xCBAppendSpace->set_sensitive(bEnable);
2050  m_xCBAsTip->set_sensitive(bEnable);
2051  m_xDCBExpandKey->set_sensitive(bEnable);
2052  }
2053  else if (&rBox == m_xCBCollect.get())
2054  m_xCBRemoveList->set_sensitive(bEnable);
2055 }
2056 
2058 {
2059  auto rows = m_xLBEntries->get_selected_rows();
2060  if (m_pAutoCompleteList && !rows.empty())
2061  {
2063 
2064  OStringBuffer sData;
2065 
2066  rtl_TextEncoding nEncode = osl_getThreadTextEncoding();
2067 
2068  for (auto a : rows)
2069  {
2070  sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode));
2071 #if defined(_WIN32)
2072  sData.append("\015\012");
2073 #else
2074  sData.append("\012");
2075 #endif
2076  }
2077  pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
2078  pCntnr->CopyToClipboard(GetSystemClipboard());
2079  }
2080 }
2081 
2082 IMPL_LINK(OfaAutoCompleteTabPage, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
2083 {
2084  bool bHandled = false;
2085  const vcl::KeyCode& rKeyCode = rEvent.GetKeyCode();
2086  switch (rKeyCode.GetModifier() | rKeyCode.GetCode())
2087  {
2088  case KEY_DELETE:
2089  DeleteHdl(*m_xPBEntries);
2090  bHandled = true;
2091  break;
2092  default:
2093  if (KeyFuncType::COPY == rKeyCode.GetFunction())
2094  {
2095  CopyToClipboard();
2096  bHandled = true;
2097  }
2098  break;
2099  }
2100  return bHandled;
2101 }
2102 
2103 // class OfaSmartTagOptionsTabPage ---------------------------------------------
2104 
2106  const SfxItemSet& rSet )
2107  : SfxTabPage(pPage, pController, "cui/ui/smarttagoptionspage.ui", "SmartTagOptionsPage", &rSet)
2108  , m_xMainCB(m_xBuilder->weld_check_button("main"))
2109  , m_xSmartTagTypesLB(m_xBuilder->weld_tree_view("list"))
2110  , m_xPropertiesPB(m_xBuilder->weld_button("properties"))
2111 {
2112  m_xSmartTagTypesLB->set_size_request(m_xSmartTagTypesLB->get_approximate_digit_width() * 50,
2113  m_xSmartTagTypesLB->get_height_rows(6));
2114 
2115  std::vector<int> aWidths;
2116  aWidths.push_back(m_xSmartTagTypesLB->get_checkbox_column_width());
2117  m_xSmartTagTypesLB->set_column_fixed_widths(aWidths);
2118 
2119  // set the handlers:
2120  m_xMainCB->connect_toggled(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl));
2121  m_xPropertiesPB->connect_clicked(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl));
2122  m_xSmartTagTypesLB->connect_changed(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl));
2123 }
2124 
2126 {
2127 }
2128 
2129 std::unique_ptr<SfxTabPage> OfaSmartTagOptionsTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
2130 {
2131  return std::make_unique<OfaSmartTagOptionsTabPage>(pPage, pController, *rSet);
2132 }
2133 
2137 {
2138  OUString maSmartTagType;
2139  uno::Reference< smarttags::XSmartTagRecognizer > mxRec;
2140  sal_Int32 mnSmartTagIdx;
2141 
2142  ImplSmartTagLBUserData( const OUString& rSmartTagType,
2143  uno::Reference< smarttags::XSmartTagRecognizer > const & xRec,
2144  sal_Int32 nSmartTagIdx ) :
2145  maSmartTagType( rSmartTagType ),
2146  mxRec( xRec ),
2147  mnSmartTagIdx( nSmartTagIdx ) {}
2148 };
2149 
2153 {
2154  const int nCount = m_xSmartTagTypesLB->n_children();
2155  for (int i = 0; i < nCount; ++i)
2156  {
2157  const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
2158  delete pUserData;
2159  }
2160 
2161  m_xSmartTagTypesLB->clear();
2162 }
2163 
2167 {
2168  // first we have to clear the list box:
2169  ClearListBox();
2170 
2171  // fill list box:
2172  const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers();
2173  const lang::Locale aLocale( LanguageTag::convertToLocale( eLastDialogLanguage ) );
2174 
2175  for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i )
2176  {
2177  const uno::Reference< smarttags::XSmartTagRecognizer >& xRec = rSmartTagMgr.GetRecognizer(i);
2178 
2179  const OUString aName = xRec->getName( aLocale );
2180  const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount();
2181 
2182  for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j )
2183  {
2184  const OUString aSmartTagType = xRec->getSmartTagName(j);
2185  OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale );
2186 
2187  if ( aSmartTagCaption.isEmpty() )
2188  aSmartTagCaption = aSmartTagType;
2189 
2190  const OUString aLBEntry = aSmartTagCaption + " (" + aName + ")";
2191 
2192  m_xSmartTagTypesLB->append();
2193  const int nRow = m_xSmartTagTypesLB->n_children() - 1;
2194  const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType );
2195  m_xSmartTagTypesLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
2196  m_xSmartTagTypesLB->set_text(nRow, aLBEntry, 1);
2197  m_xSmartTagTypesLB->set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(new ImplSmartTagLBUserData(aSmartTagType, xRec, j))));
2198  }
2199  }
2200 }
2201 
2205 {
2206  const int nPos = m_xSmartTagTypesLB->get_selected_index();
2207  const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
2208  uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
2209  const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2210 
2211  const lang::Locale aLocale( LanguageTag::convertToLocale( eLastDialogLanguage ) );
2212  if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2213  xRec->displayPropertyPage( nSmartTagIdx, aLocale );
2214 }
2215 
2219 {
2220  const bool bEnable = m_xMainCB->get_active();
2221  m_xSmartTagTypesLB->set_sensitive(bEnable);
2222  m_xPropertiesPB->set_sensitive(false);
2223 
2224  // if the controls are currently enabled, we still have to check
2225  // if the properties button should be disabled because the currently
2226  // selected smart tag type does not have a properties dialog.
2227  // We do this by calling SelectHdl:
2228  if (bEnable)
2229  SelectHdl(*m_xSmartTagTypesLB);
2230 }
2231 
2235 {
2236  const int nPos = m_xSmartTagTypesLB->get_selected_index();
2237  if (nPos == -1)
2238  return;
2239  const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
2240  uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
2241  const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2242 
2243  const lang::Locale aLocale( LanguageTag::convertToLocale( eLastDialogLanguage ) );
2244  if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2245  m_xPropertiesPB->set_sensitive(true);
2246  else
2247  m_xPropertiesPB->set_sensitive(false);
2248 }
2249 
2253 {
2255  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
2256  SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
2257 
2258  // robust!
2259  if ( !pSmartTagMgr )
2260  return false;
2261 
2262  bool bModifiedSmartTagTypes = false;
2263  std::vector< OUString > aDisabledSmartTagTypes;
2264 
2265  const int nCount = m_xSmartTagTypesLB->n_children();
2266 
2267  for (int i = 0; i < nCount; ++i)
2268  {
2269  const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
2270  const bool bChecked = m_xSmartTagTypesLB->get_toggle(i, CBCOL_FIRST) == TRISTATE_TRUE;
2271  const bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType );
2272 
2273  bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled );
2274 
2275  if ( !bChecked )
2276  aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType );
2277 
2278  delete pUserData;
2279  }
2280 
2281  const bool bModifiedRecognize = ( !m_xMainCB->get_active() != !pSmartTagMgr->IsLabelTextWithSmartTags() );
2282  if ( bModifiedSmartTagTypes || bModifiedRecognize )
2283  {
2284  bool bLabelTextWithSmartTags = m_xMainCB->get_active();
2285  pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : nullptr,
2286  bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : nullptr );
2287  }
2288 
2289  return true;
2290 }
2291 
2295 {
2297  SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
2298  const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
2299 
2300  // robust, should not happen!
2301  if ( !pSmartTagMgr )
2302  return;
2303 
2304  FillListBox(*pSmartTagMgr);
2305  m_xSmartTagTypesLB->select(0);
2306  m_xMainCB->set_active(pSmartTagMgr->IsLabelTextWithSmartTags());
2307  CheckHdl(*m_xMainCB);
2308 }
2309 
2311 {
2312  static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage( false );
2313 }
2314 
2315 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void set_text(int row, const OUString &rText, int col=-1)=0
bool GetValue() const
#define DBL_END
Definition: autocdlg.cxx:1736
OUString * pString
Definition: autocdlg.cxx:288
sal_Unicode GetEndDoubleQuote() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:1434
#define LANGUAGE_NONE
std::unique_ptr< weld::TreeView > m_xDoubleCapsLB
Definition: autocdlg.hxx:234
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
bool NewDelHdl(const weld::Widget *)
Definition: autocdlg.cxx:1018
FieldUnit
std::unique_ptr< weld::CheckButton > m_xCBAppendSpace
Append space.
Definition: autocdlg.hxx:324
std::unique_ptr< weld::CheckButton > m_xAutoCapsCB
Definition: autocdlg.hxx:237
bool bAFormatByInpDelSpacesBetweenLines
#define KEY_DELETE
static SvxAutoCorrCfg & Get()
virtual ~OfaSwAutoFmtOptionsPage() override
Definition: autocdlg.cxx:393
std::unique_ptr< weld::Button > m_xDeleteReplacePB
Definition: autocdlg.hxx:179
bool IsAutoCorrFlag(ACFlags nFlag) const
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
LanguageType eLang
Definition: autocdlg.hxx:165
#define KEY_SPACE
std::unique_ptr< weld::Builder > m_xBuilder
virtual bool FillItemSet(SfxItemSet *rSet) override
Propagates the current settings to the smart tag manager.
Definition: autocdlg.cxx:2252
#define LANGUAGE_ENGLISH_US
std::unique_ptr< weld::CheckButton > m_xMainCB
Definition: autocdlg.hxx:364
std::unique_ptr< weld::Entry > m_xShortED
Definition: autocdlg.hxx:174
#define KEY_TAB
std::unique_ptr< weld::CheckButton > m_xSingleTypoCB
Definition: autocdlg.hxx:277
void ClearListBox()
Clears the m_aSmartTagTypesLB.
Definition: autocdlg.cxx:2152
void NewEntry(const OUString &sShort, const OUString &sLong, bool bKeepSourceFormatting)
Definition: autocdlg.cxx:938
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:1237
void CreateEntry(const OUString &rTxt, sal_uInt16 nCol)
Definition: autocdlg.cxx:382
LanguageType getLanguageType(bool bResolveSystem=true) const
std::unique_ptr< weld::SpinButton > m_xNFMaxEntries
Definition: autocdlg.hxx:332
sal_uInt16 nAutoCmpltExpandKey
std::unique_ptr< weld::Button > m_xNewAbbrevPB
Definition: autocdlg.hxx:229
const SvStringsISortDtor * GetCplSttExceptList(LanguageType eLang)
static const AllSettings & GetSettings()
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:1972
virtual ~OfaAutoCompleteTabPage() override
Definition: autocdlg.cxx:1909
void SetChar(sal_UCS4)
Definition: cuicharmap.cxx:203
std::unique_ptr< weld::Label > m_xDblStartExFT
Definition: autocdlg.hxx:285
std::unique_ptr< weld::ComboBox > m_xDCBExpandKey
Definition: autocdlg.hxx:330
virtual ~OfaAutocorrReplacePage() override
Definition: autocdlg.cxx:711
std::unique_ptr< weld::MetricSpinButton > m_xPrcntMF
Definition: autocdlg.cxx:304
void RemoveTabPage(const OString &rName)
std::vector< SvxAutocorrWord > AutocorrWordSetType
std::vector< OUString > aAbbrevStrings
Definition: autocdlg.hxx:213
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
sal_uInt16 GetCode() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemClipboard()
OUString sCapitalStartSentence
Definition: autocdlg.hxx:88
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:720
const vcl::Font & GetCharFont() const
Definition: cuicharmap.hxx:156
static SfxObjectShell * Current()
std::unique_ptr< CollatorWrapper > pCompareClass
Definition: autocdlg.hxx:163
static bool lcl_FindInArray(std::vector< OUString > &rStrings, const OUString &rString)
Definition: autocdlg.cxx:1175
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:2310
virtual OUString GetSelectionText(bool bCompleteWords=false)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:1231
#define SGL_START
Definition: autocdlg.cxx:1733
float x
TRISTATE_TRUE
void SetStartSingleQuote(const sal_Unicode cStart)
static LanguageType eLastDialogLanguage
Definition: autocdlg.cxx:50
std::unique_ptr< weld::Button > m_xReplacePB
Definition: autocdlg.hxx:178
std::unique_ptr< weld::CheckButton > m_xDoubleTypoCB
Definition: autocdlg.hxx:283
void InsertEntry(const OUString &rTxt)
Definition: autocdlg.cxx:242
std::unique_ptr< weld::Widget > m_xLanguageBox
Definition: autocdlg.hxx:38
void RefillReplaceBox(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
Definition: autocdlg.cxx:777
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
std::unique_ptr< weld::Button > m_xSglStandardPB
Definition: autocdlg.hxx:282
static bool lcl_FindEntry(weld::TreeView &rLB, const OUString &rEntry, CollatorWrapper const &rCmpClass)
Definition: autocdlg.cxx:140
bool IsLabelTextWithSmartTags() const
bool bAFormatByInpDelSpacesAtSttEnd
ImplSmartTagLBUserData(const OUString &rSmartTagType, uno::Reference< smarttags::XSmartTagRecognizer > const &xRec, sal_Int32 nSmartTagIdx)
Definition: autocdlg.cxx:2142
sal_uInt16 sal_Unicode
std::unique_ptr< weld::TreeView > m_xLBEntries
Definition: autocdlg.hxx:333
OUString sShort
Definition: autocdlg.hxx:136
std::unique_ptr< weld::Label > m_xDblEndExFT
Definition: autocdlg.hxx:287
void SaveWrdSttExceptList(LanguageType eLang)
static void CreateEntry(weld::TreeView &rLstBox, const OUString &rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
Definition: autocdlg.cxx:1525
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:737
ACFlags
OfaAutocorrOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:180
This struct is used to associate list box entries with smart tag data.
Definition: autocdlg.cxx:2136
sal_Unicode GetStartSingleQuote() const
OfaSwAutoFmtOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:346
std::unique_ptr< SvxLanguageBox > m_xLanguageLB
Definition: autocdlg.hxx:39
std::unique_ptr< weld::Entry > m_xReplaceED
Definition: autocdlg.hxx:175
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:212
void SetEndDoubleQuote(const sal_Unicode cEnd)
void SetLanguage(LanguageType eSet)
Definition: autocdlg.cxx:889
virtual int n_children() const =0
sal_uInt16 m_nAutoCmpltListCnt
Definition: autocdlg.hxx:321
static SfxViewShell * Current()
void NewDelHdl(const weld::Widget *)
Definition: autocdlg.cxx:1455
SvxSwAutoFormatFlags & GetSwFlags()
std::unique_ptr< weld::Label > m_xSglEndExFT
Definition: autocdlg.hxx:281
sal_uInt16 GetModifier() const
#define CBCOL_SECOND
Definition: autocdlg.cxx:209
OUString m_sURL
std::unique_ptr< weld::TreeView > m_xCheckLB
Definition: autocdlg.hxx:64
#define LANGUAGE_UNDETERMINED
void MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries, LanguageType eLang)
OUString m_sAccidentalCaps
Definition: autocdlg.hxx:62
std::unique_ptr< weld::TreeView > m_xCheckLB
For anything but writer.
Definition: autocdlg.hxx:291
std::unique_ptr< weld::Button > m_xNewReplacePB
Definition: autocdlg.hxx:177
const AutocorrWordSetType & getSortedContent() const
OfaAutoFmtPrcntSet(weld::Window *pParent)
Definition: autocdlg.cxx:306
void SetModified()
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:2023
const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList
const LanguageTag & GetLanguageTag() const
float y
virtual ~OfaSmartTagOptionsTabPage() override
Definition: autocdlg.cxx:2125
StringChangeTable aChangesTable
Definition: autocdlg.hxx:155
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
sal_uInt16 nAutoCmpltWordLen
weld::MetricSpinButton & GetPrcntFld()
Definition: autocdlg.cxx:312
OfaAutocorrReplacePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:658
std::unique_ptr< weld::Entry > m_xAbbrevED
Definition: autocdlg.hxx:227
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:883
#define DBG_ASSERT(sCon, aError)
bool bAFormatDelSpacesBetweenLines
OfaQuoteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:1536
virtual void set_toggle(int row, TriState eState, int col)=0
DoubleStringArray aNewEntries
Definition: autocdlg.hxx:145
std::unique_ptr< weld::CheckButton > m_xCBActiv
Enable word completion.
Definition: autocdlg.hxx:323
std::unique_ptr< weld::Button > m_xPropertiesPB
Definition: autocdlg.hxx:366
OUString sOrdinal
Definition: autocdlg.hxx:269
IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, weld::TreeView &, rBox, void)
Definition: autocdlg.cxx:609
virtual ~OfaQuoteTabPage() override
Definition: autocdlg.cxx:1593
sal_uInt16 nAutoCmpltListLen
std::vector< OUString > aDoubleCapsStrings
Definition: autocdlg.hxx:214
virtual int get_selected_index() const =0
#define LANGUAGE_SYSTEM
SmartTagMgr * pSmartTagMgr
std::unique_ptr< weld::Button > m_xDelDoublePB
Definition: autocdlg.hxx:236
void WriteConfiguration(const bool *bLabelTextWithSmartTags, const std::vector< OUString > *pDisabledTypes) const
editeng::SortedAutoCompleteStrings * m_pAutoCompleteList
Definition: autocdlg.hxx:320
OfaAutoCorrDlg(weld::Window *pParent, const SfxItemSet *pSet)
Definition: autocdlg.cxx:55
OUString m_sBoldUnderline
Definition: autocdlg.hxx:58
bool equals(const OUString &rIn, sal_Unicode c)
SvxAutoCorrect * GetAutoCorrect()
LanguageType eLang
Definition: autocdlg.hxx:225
void DeleteEntry(const OUString &sShort, const OUString &sLong)
Definition: autocdlg.cxx:968
int i
TRISTATE_FALSE
sal_Unicode GetStartDoubleQuote() const
std::unique_ptr< weld::Button > m_xSglStartQuotePB
Definition: autocdlg.hxx:278
sal_UCS4 cEndQuote
Definition: autocdlg.hxx:275
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:1671
SvxAutocorrWordList * LoadAutocorrWordList(LanguageType eLang)
std::unique_ptr< weld::TreeView > m_xSwCheckLB
Just for writer.
Definition: autocdlg.hxx:293
std::vector< int > m_aReplaceFixedWidths
Definition: autocdlg.hxx:172
void * pUserData
CheckBox -> form. Text Bool -> selection text.
Definition: autocdlg.hxx:138
#define CBCOL_FIRST
Definition: autocdlg.cxx:208
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:400
OfaSmartTagOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
construction via Create()
Definition: autocdlg.cxx:2105
OUString GetName(vcl::Window *pWindow=nullptr) const
virtual void unselect(int pos)=0
sal_Unicode cByInputBullet
void set_value(int nValue, FieldUnit eValueUnit)
virtual OUString get_text(int row, int col=-1) const =0
vcl::Font * pFont
Definition: autocdlg.cxx:289
const SvStringsISortDtor * GetWrdSttExceptList(LanguageType eLang)
OfaAutocorrExceptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:1187
sal_UCS4 cSglEndQuote
Definition: autocdlg.hxx:272
vcl::Font aByInputBulletFont
std::unique_ptr< weld::Label > m_xSglStartExFT
Definition: autocdlg.hxx:279
void SetAutoCorrFlag(ACFlags nFlag, bool bOn=true)
void SaveCplSttExceptList(LanguageType eLang)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: autocdlg.cxx:732
KeyFuncType GetFunction() const
virtual void Reset(const SfxItemSet *rSet) override
Sets the controls based on the current settings at SmartTagMgr.
Definition: autocdlg.cxx:2294
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:1913
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
OUString sNonBrkSpace
Definition: autocdlg.hxx:268
void CopyToClipboard() const
Definition: autocdlg.cxx:2057
#define KEY_END
std::unique_ptr< weld::Button > m_xDelAbbrevPB
Definition: autocdlg.hxx:230
std::unique_ptr< weld::Button > m_xEditPB
Definition: autocdlg.hxx:113
css::uno::Reference< css::smarttags::XSmartTagRecognizer > const & GetRecognizer(sal_uInt32 i) const
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:527
std::unique_ptr< weld::CheckButton > m_xCBAsTip
Show as tip.
Definition: autocdlg.hxx:325
GenericDialogController(weld::Widget *pParent, const OUString &rUIFile, const OString &rDialogId)
virtual short run() override
Definition: cuicharmap.cxx:182
std::unique_ptr< weld::Button > m_xDblStartQuotePB
Definition: autocdlg.hxx:284
std::unique_ptr< weld::CheckButton > m_xCBCollect
Collect words.
Definition: autocdlg.hxx:327
void SetEndSingleQuote(const sal_Unicode cEnd)
OUString sLong
Definition: autocdlg.hxx:137
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
#define SGL_END
Definition: autocdlg.cxx:1735
virtual ~OfaAutoCorrDlg() override
Definition: autocdlg.cxx:131
#define KEY_RETURN
std::unique_ptr< weld::TreeView > m_xAbbrevLB
Definition: autocdlg.hxx:228
void RefillReplaceBoxes(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
Box filled with new language.
Definition: autocdlg.cxx:1370
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:2129
void EnableLanguage(bool bEnable)
Definition: autocdlg.cxx:135
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:250
void set_title(const OUString &rTitle)
Definition: cuicharmap.hxx:150
void SetStartDoubleQuote(const sal_Unicode cStart)
std::vector< DoubleString > DoubleStringArray
Definition: autocdlg.hxx:141
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:1597
virtual void select(int pos)=0
SvStringsISortDtor * LoadWrdSttExceptList(LanguageType eLang)
#define DBL_START
Definition: autocdlg.cxx:1734
std::unique_ptr< CharClass > pCharClass
Definition: autocdlg.hxx:164
virtual ~OfaAutocorrOptionsPage() override
Definition: autocdlg.cxx:198
void FillListBox(const SmartTagMgr &rSmartTagMgr)
Inserts items into m_aSmartTagTypesLB.
Definition: autocdlg.cxx:2166
bool PutText(const OUString &rShort, const OUString &rLong, LanguageType eLang)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
weld::Entry & rEdit
virtual ~OfaAutocorrExceptPage() override
Definition: autocdlg.cxx:1225
IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox &, void)
Definition: autocdlg.cxx:158
unsigned char sal_uInt8
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: autocdlg.cxx:202
std::unique_ptr< weld::SpinButton > m_xNFMinWordlen
Definition: autocdlg.hxx:331
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:1249
DoubleStringArray aDeletedEntries
Definition: autocdlg.hxx:146
SvStringsISortDtor * LoadCplSttExceptList(LanguageType eLang)
virtual void Reset(const SfxItemSet *rSet) override
Definition: autocdlg.cxx:1676
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:725
sal_Unicode GetEndSingleQuote() const
RET_OK
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:1603
bool IsSmartTagTypeEnabled(const OUString &rSmartTagType) const
std::unique_ptr< CollatorWrapper > pCompareClass
Definition: autocdlg.hxx:224
const OUString PERCENT("Percent")
virtual short run()
SvxLanguageListFlags
Reference< XComponentContext > getProcessComponentContext()
SfxOkDialogController * GetDialogController() const
void SetCharFont(const vcl::Font &rFont)
Definition: cuicharmap.cxx:571
std::unique_ptr< weld::TreeView > m_xSmartTagTypesLB
Definition: autocdlg.hxx:365
void SetLanguage(LanguageType eSet)
Definition: autocdlg.cxx:1356
void DisableFontSelection()
Definition: cuicharmap.cxx:214
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:406
uno::Reference< smarttags::XSmartTagRecognizer > mxRec
Definition: autocdlg.cxx:2139
OUString sCapitalStartWord
Definition: autocdlg.hxx:87
std::unique_ptr< weld::Button > m_xNewDoublePB
Definition: autocdlg.hxx:235
std::unique_ptr< weld::TreeView > m_xReplaceTLB
Definition: autocdlg.hxx:176
std::unique_ptr< weld::Button > m_xDblEndQuotePB
Definition: autocdlg.hxx:286
DeactivateRC
void append(TreeIter *pRet=nullptr)
OString const aName
OfaAutoCompleteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: autocdlg.cxx:1855
StringsTable aStringsTable
Definition: autocdlg.hxx:223
int get_value(FieldUnit eDestUnit) const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: autocdlg.cxx:1244
sal_UCS4 GetChar() const
Definition: cuicharmap.cxx:209
#define CBCOL_BOTH
Definition: autocdlg.cxx:210
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
Definition: cuicharmap.hxx:71
OUString GetSmartTagCaption(const OUString &rSmartTagType, const css::lang::Locale &rLocale) const
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:522
sal_uInt32 sal_UCS4
std::unique_ptr< weld::Button > m_xSglEndQuotePB
Definition: autocdlg.hxx:280
vcl::Font aByInputBulletFont
Definition: autocdlg.hxx:109
sal_UCS4 cSglStartQuote
Definition: autocdlg.hxx:271
virtual bool HasSelection(bool bText=true) const
std::unique_ptr< weld::Button > m_xDblStandardPB
Definition: autocdlg.hxx:288
sal_uInt32 NumberOfRecognizers() const
ACFlags GetFlags() const
OfaAutoFmtOptions
Definition: autocdlg.cxx:324
std::unique_ptr< weld::Label > m_xStandard
Definition: autocdlg.hxx:289
Smart tag options tab page.
Definition: autocdlg.hxx:359
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
std::unique_ptr< weld::Entry > m_xDoubleCapsED
Definition: autocdlg.hxx:233
std::map< LanguageType, DoubleStringArray > aDoubleStringTable
Definition: autocdlg.hxx:162
sal_Int32 nPos
ImpUserData(OUString *pText, vcl::Font *pFnt)
Definition: autocdlg.cxx:291
sal_UCS4 cStartQuote
Definition: autocdlg.hxx:274
OfaQuoteOptions
Definition: autocdlg.cxx:1519
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
std::set< OUString > aFormatText
Definition: autocdlg.hxx:160
OUString sDelSpaceBetweenLines
Definition: autocdlg.hxx:102
static SfxModule * GetModule(SfxToolsModule nSharedLib)
#define KEY_RIGHT
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: autocdlg.cxx:1919
virtual void ActivatePage(const SfxItemSet &) override
Definition: autocdlg.cxx:237
std::unique_ptr< weld::CheckButton > m_xCBRemoveList
...save the list for later use...
Definition: autocdlg.hxx:328
std::unique_ptr< weld::CheckButton > m_xAutoAbbrevCB
Definition: autocdlg.hxx:231
std::unique_ptr< weld::Button > m_xPBEntries
Definition: autocdlg.hxx:334
std::unique_ptr< weld::Container > m_xButtonBox
Definition: autocdlg.hxx:180
std::unique_ptr< weld::TreeView > m_xCheckLB
Definition: autocdlg.hxx:112
void SetCurPageId(const OString &rName)
OUString ChangeStringExt_Impl(sal_UCS4)
Definition: autocdlg.cxx:1830
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
OUString sId
std::unique_ptr< weld::CheckButton > m_xTextOnlyCB
Definition: autocdlg.hxx:173