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