LibreOffice Module sw (master)  1
cnttab.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 <config_folders.h>
21 
22 #include <sal/log.hxx>
23 #include <svl/style.hxx>
24 #include <vcl/help.hxx>
25 #include <vcl/weld.hxx>
26 #include <svl/stritem.hxx>
27 #include <svl/urihelper.hxx>
28 #include <unotools/pathoptions.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <sfx2/dispatch.hxx>
32 #include <sfx2/docfile.hxx>
33 #include <svtools/simptabl.hxx>
34 #include <svx/dialogs.hrc>
35 #include <svx/svxdlg.hxx>
36 #include <svx/flagsdef.hxx>
37 #include <svx/svxids.hrc>
38 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
39 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
40 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
42 #include <editeng/unolingu.hxx>
43 #include <column.hxx>
44 #include <fmtfsize.hxx>
45 #include <shellio.hxx>
46 #include <authfld.hxx>
47 #include <swtypes.hxx>
48 #include <wrtsh.hxx>
49 #include <view.hxx>
50 #include <basesh.hxx>
51 #include <outline.hxx>
52 #include <cnttab.hxx>
53 #include <swuicnttab.hxx>
54 #include <poolfmt.hxx>
55 #include <strings.hrc>
56 #include <uitool.hxx>
57 #include <fmtcol.hxx>
58 #include <fldbas.hxx>
59 #include <expfld.hxx>
60 #include <unotools.hxx>
61 #include <unotxdoc.hxx>
62 #include <docsh.hxx>
63 #include <swmodule.hxx>
64 #include <modcfg.hxx>
65 
66 #include <cmdid.h>
67 #include <globals.hrc>
68 #include <cnttab.hrc>
69 #include <SwStyleNameMapper.hxx>
70 #include <sfx2/filedlghelper.hxx>
71 #include <toxwrap.hxx>
72 #include <chpfld.hxx>
73 
74 #include <sfx2/app.hxx>
75 
76 #include <unomid.h>
77 
78 #include <cmath>
79 #include <memory>
80 #include <vector>
81 #include <numeric>
82 
83 
84 using namespace ::com::sun::star;
85 using namespace ::com::sun::star::lang;
86 using namespace ::com::sun::star::uno;
87 using namespace com::sun::star::ui::dialogs;
88 using namespace ::sfx2;
90 
91 static const sal_Unicode aDeliStart = '['; // for the form
92 static const sal_Unicode aDeliEnd = ']'; // for the form
93 
94 static OUString lcl_CreateAutoMarkFileDlg(weld::Window* pParent, const OUString& rURL,
95  const OUString& rFileString, bool bOpen)
96 {
97  OUString sRet;
98 
99  FileDialogHelper aDlgHelper( bOpen ?
100  TemplateDescription::FILEOPEN_SIMPLE : TemplateDescription::FILESAVE_AUTOEXTENSION,
101  FileDialogFlags::NONE, pParent);
102  uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
103 
104  xFP->appendFilter( rFileString, "*.sdi" );
105  xFP->setCurrentFilter( rFileString ) ;
106 
107  if( !rURL.isEmpty() )
108  xFP->setDisplayDirectory( rURL );
109  else
110  {
111  SvtPathOptions aPathOpt;
112  xFP->setDisplayDirectory( aPathOpt.GetUserConfigPath() );
113  }
114 
115  if( aDlgHelper.Execute() == ERRCODE_NONE )
116  {
117  sRet = xFP->getSelectedFiles().getConstArray()[0];
118  }
119 
120  return sRet;
121 }
122 
124 {
125  OUString sSearch;
126  OUString sAlternative;
127  OUString sPrimKey;
128  OUString sSecKey;
129  OUString sComment;
130  bool bCase;
131  bool bWord;
132 
134  bCase(false),
135  bWord(false){}
136 };
137 
138 typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base;
139 
141 {
144 
145  OUString m_sSearch;
146  OUString m_sAlternative;
147  OUString m_sPrimKey;
148  OUString m_sSecKey;
149  OUString m_sComment;
151  OUString m_sWordOnly;
152  OUString m_sYes;
153  OUString m_sNo;
154 
155  std::vector<std::unique_ptr<AutoMarkEntry>> m_Entries;
156 
159 
162 
163 protected:
164  virtual bool SeekRow( long nRow ) override;
165  virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId) const override;
166  virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol) override;
167  virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) override;
168  virtual bool SaveModified() override;
169 
170  std::vector<long> GetOptimalColWidths() const;
171 
172 public:
173  SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pBuilder);
174  virtual ~SwEntryBrowseBox() override;
175  virtual void dispose() override;
176  void ReadEntries(SvStream& rInStr);
177  void WriteEntries(SvStream& rOutStr);
178 
179  bool IsModified()const override;
180 
181  virtual OUString GetCellText( long nRow, sal_uInt16 nColumn ) const override;
182  virtual void Resize() override;
183  virtual Size GetOptimalSize() const override;
184 };
185 
187 {
189 
191 
192  OUString sAutoMarkURL;
193 
195 
196  DECL_LINK(OkHdl, Button*, void);
197 public:
198  SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL,
199  bool bCreate);
200  virtual ~SwAutoMarkDlg_Impl() override;
201  virtual void dispose() override;
202 
203 };
204 
205 sal_uInt16 CurTOXType::GetFlatIndex() const
206 {
207  return static_cast< sal_uInt16 >( (eType == TOX_USER && nIndex)
208  ? TOX_AUTHORITIES + nIndex : eType );
209 }
210 
212  SwWrtShell &rShell, SwTOXBase* pCurTOX,
213  sal_uInt16 nToxType, bool bGlobal)
214  : SfxTabDialogController(pParent, "modules/swriter/ui/tocdialog.ui", "TocDialog", &rSet)
215  , m_pMgr( new SwTOXMgr( &rShell ) )
216  , m_rWrtShell(rShell)
217  , m_pParamTOXBase(pCurTOX)
218  , m_sUserDefinedIndex(SwResId(STR_USER_DEFINED_INDEX))
219  , m_nInitialTOXType(nToxType)
220  , m_bEditTOX(false)
221  , m_bExampleCreated(false)
222  , m_bGlobalFlag(bGlobal)
223  , m_xShowExampleCB(m_xBuilder->weld_check_button("showexample"))
224 {
227 
228  const sal_uInt16 nUserTypeCount = m_rWrtShell.GetTOXTypeCount(TOX_USER);
229  m_vTypeData.resize(nUserTypeCount + 6);
230  //the standard user index is on position TOX_USER
231  //all user indexes follow after position TOX_AUTHORITIES
232  if(pCurTOX)
233  {
234  m_bEditTOX = true;
235  }
236  for(int i = m_vTypeData.size() - 1; i > -1; i--)
237  {
238  m_vTypeData[i].m_pxIndexSections.reset(new SwIndexSections_Impl);
239  if(pCurTOX)
240  {
241  m_eCurrentTOXType.eType = pCurTOX->GetType();
242  sal_uInt16 nArrayIndex = static_cast< sal_uInt16 >(m_eCurrentTOXType.eType);
244  {
245  //which user type is it?
246  for(sal_uInt16 nUser = 0; nUser < nUserTypeCount; nUser++)
247  {
248  const SwTOXType* pTemp = m_rWrtShell.GetTOXType(TOX_USER, nUser);
249  if(pCurTOX->GetTOXType() == pTemp)
250  {
251  m_eCurrentTOXType.nIndex = nUser;
252  nArrayIndex = static_cast< sal_uInt16 >(nUser > 0 ? TOX_AUTHORITIES + nUser : TOX_USER);
253  break;
254  }
255  }
256  }
257  m_vTypeData[nArrayIndex].m_pForm.reset(new SwForm(pCurTOX->GetTOXForm()));
258  m_vTypeData[nArrayIndex].m_pDescription = CreateTOXDescFromTOXBase(pCurTOX);
260  {
261  const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
263  if(pFType)
264  {
265  OUString sBrackets;
266  if(pFType->GetPrefix())
267  sBrackets += OUStringLiteral1(pFType->GetPrefix());
268  if(pFType->GetSuffix())
269  sBrackets += OUStringLiteral1(pFType->GetSuffix());
270  m_vTypeData[nArrayIndex].m_pDescription->SetAuthBrackets(sBrackets);
271  m_vTypeData[nArrayIndex].m_pDescription->SetAuthSequence(pFType->IsSequence());
272  }
273  else
274  {
275  m_vTypeData[nArrayIndex].m_pDescription->SetAuthBrackets("[]");
276  }
277  }
278  }
279  }
281  AddTabPage("index", SwTOXSelectTabPage::Create, nullptr);
282  AddTabPage("styles", SwTOXStylesTabPage::Create, nullptr);
283  AddTabPage("columns", SwColumnPage::Create, nullptr);
284  AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
285  AddTabPage("entries", SwTOXEntryTabPage::Create, nullptr);
286  if (!pCurTOX)
287  SetCurPageId("index");
288 
289  m_xShowExampleCB->connect_toggled(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl));
290  m_xShowExampleCB->set_active(SW_MOD()->GetModuleConfig()->IsShowIndexPreview());
291 
292  ShowPreviewHdl(*m_xShowExampleCB);
293 }
294 
296 {
297  SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_xShowExampleCB->get_active());
298 }
299 
300 void SwMultiTOXTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
301 {
302  if (rId == "background")
303  {
304  SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
305  aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
306  rPage.PageCreated(aSet);
307  }
308  else if (rId == "columns")
309  {
311 
312  static_cast<SwColumnPage&>(rPage).SetPageWidth(rSize.GetWidth());
313  }
314  else if (rId == "entries")
315  static_cast<SwTOXEntryTabPage&>(rPage).SetWrtShell(m_rWrtShell);
316  else if (rId == "index")
317  {
318  static_cast<SwTOXSelectTabPage&>(rPage).SetWrtShell(m_rWrtShell);
320  static_cast<SwTOXSelectTabPage&>(rPage).SelectType(static_cast<TOXTypes>(m_nInitialTOXType));
321  }
322 }
323 
325 {
326  short nRet = SfxTabDialogController::Ok();
329 
330  const sal_uInt16 nIndex = m_eCurrentTOXType.GetFlatIndex();
331  if(m_vTypeData[nIndex].m_pForm)
332  {
333  rDesc.SetForm(*m_vTypeData[nIndex].m_pForm);
334  aNewDef.SetTOXForm(*m_vTypeData[nIndex].m_pForm);
335  }
336  rDesc.ApplyTo(aNewDef);
337  if(!m_bGlobalFlag)
338  m_pMgr->UpdateOrInsertTOX(
339  rDesc, nullptr, GetOutputItemSet());
340  else if(m_bEditTOX)
341  m_pMgr->UpdateOrInsertTOX(
342  rDesc, &m_pParamTOXBase, GetOutputItemSet());
343 
346 
347  return nRet;
348 }
349 
351 {
352  const sal_uInt16 nIndex = eType.GetFlatIndex();
353  if(!m_vTypeData[nIndex].m_pForm)
354  m_vTypeData[nIndex].m_pForm.reset(new SwForm(eType.eType));
355  return m_vTypeData[nIndex].m_pForm.get();
356 }
357 
359 {
360  const sal_uInt16 nIndex = eType.GetFlatIndex();
361  if(!m_vTypeData[nIndex].m_pDescription)
362  {
363  const SwTOXBase* pDef = m_rWrtShell.GetDefaultTOXBase( eType.eType );
364  if(pDef)
365  m_vTypeData[nIndex].m_pDescription = CreateTOXDescFromTOXBase(pDef);
366  else
367  {
368  m_vTypeData[nIndex].m_pDescription.reset(new SwTOXDescription(eType.eType));
369  if(eType.eType == TOX_USER)
370  m_vTypeData[nIndex].m_pDescription->SetTitle(m_sUserDefinedIndex);
371  else
372  m_vTypeData[nIndex].m_pDescription->SetTitle(
373  m_rWrtShell.GetTOXType(eType.eType, 0)->GetTypeName());
374  }
375  if(TOX_AUTHORITIES == eType.eType)
376  {
377  const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
379  if(pFType)
380  {
381  m_vTypeData[nIndex].m_pDescription->SetAuthBrackets(OUStringLiteral1(pFType->GetPrefix()) +
382  OUStringLiteral1(pFType->GetSuffix()));
383  m_vTypeData[nIndex].m_pDescription->SetAuthSequence(pFType->IsSequence());
384  }
385  else
386  {
387  m_vTypeData[nIndex].m_pDescription->SetAuthBrackets("[]");
388  }
389  }
390  else if(TOX_INDEX == eType.eType)
391  m_vTypeData[nIndex].m_pDescription->SetMainEntryCharStyle(SwResId(STR_POOLCHR_IDX_MAIN_ENTRY));
392 
393  }
394  return *m_vTypeData[nIndex].m_pDescription;
395 }
396 
397 std::unique_ptr<SwTOXDescription> SwMultiTOXTabDialog::CreateTOXDescFromTOXBase(
398  const SwTOXBase*pCurTOX)
399 {
400  std::unique_ptr<SwTOXDescription> pDesc(new SwTOXDescription(pCurTOX->GetType()));
401  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
402  pDesc->SetStyleNames(pCurTOX->GetStyleNames(i), i);
403  pDesc->SetAutoMarkURL(m_rWrtShell.GetTOIAutoMarkURL());
404  pDesc->SetTitle(pCurTOX->GetTitle());
405 
406  pDesc->SetContentOptions(pCurTOX->GetCreateType());
407  if(pDesc->GetTOXType() == TOX_INDEX)
408  pDesc->SetIndexOptions(pCurTOX->GetOptions());
409  pDesc->SetMainEntryCharStyle(pCurTOX->GetMainEntryCharStyle());
410  if(pDesc->GetTOXType() != TOX_INDEX)
411  pDesc->SetLevel(static_cast<sal_uInt8>(pCurTOX->GetLevel()));
412  pDesc->SetCreateFromObjectNames(pCurTOX->IsFromObjectNames());
413  pDesc->SetSequenceName(pCurTOX->GetSequenceName());
414  pDesc->SetCaptionDisplay(pCurTOX->GetCaptionDisplay());
415  pDesc->SetFromChapter(pCurTOX->IsFromChapter());
416  pDesc->SetReadonly(pCurTOX->IsProtected());
417  pDesc->SetOLEOptions(pCurTOX->GetOLEOptions());
418  pDesc->SetLevelFromChapter(pCurTOX->IsLevelFromChapter());
419  pDesc->SetLanguage(pCurTOX->GetLanguage());
420  pDesc->SetSortAlgorithm(pCurTOX->GetSortAlgorithm());
421  return pDesc;
422 }
423 
425 {
426  if (m_xShowExampleCB->get_active())
427  {
428  if(!m_xExampleFrame && !m_bExampleCreated)
429  {
430  m_bExampleCreated = true;
431  OUString sTemplate("internal/idxexample.odt");
432 
433  SvtPathOptions aOpt;
434  bool bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE );
435 
436  if(!bExist)
437  {
438  OUString sInfo(SwResId(STR_FILE_NOT_FOUND));
439  sInfo = sInfo.replaceFirst( "%1", sTemplate );
440  sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() );
441  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
442  VclMessageType::Info, VclButtonsType::Ok,
443  sInfo));
444  xInfoBox->run();
445  }
446  else
447  {
448  Link<SwOneExampleFrame&,void> aLink(LINK(this, SwMultiTOXTabDialog, CreateExample_Hdl));
449  m_xExampleFrame.reset(new SwOneExampleFrame(EX_SHOW_ONLINE_LAYOUT, &aLink, &sTemplate));
450  m_xExampleFrameWin.reset(new weld::CustomWeld(*m_xBuilder, "example", *m_xExampleFrame));
451  }
452  m_xShowExampleCB->set_visible(m_xExampleFrame != nullptr);
453  }
454  }
455 
456  if (m_xExampleFrame)
457  {
458  const bool bSetViewWindow = m_xShowExampleCB->get_active();
459  if (bSetViewWindow)
460  m_xExampleFrame->Show();
461  else
462  m_xExampleFrame->Hide();
463  }
464 
465  m_xDialog->resize_to_request();
466 }
467 
468 bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const OUString& rName)
469 {
470  SwTextFormatColl* pColl = rSh.GetParaStyle(rName);
471  if(pColl && ! pColl->IsAssignedToListLevelOfOutlineStyle())
472  return true;
473 
474  const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(
476  return nId != USHRT_MAX &&
478 }
479 
481 {
482  OUString* pStyleArr;
483 
484  std::unique_ptr<weld::Button> m_xOk;
485  std::unique_ptr<weld::Button> m_xLeftPB;
486  std::unique_ptr<weld::Button> m_xRightPB;
487  std::unique_ptr<weld::TreeView> m_xHeaderTree;
488 
489  DECL_LINK(OkHdl, weld::Button&, void);
490  DECL_LINK(LeftRightHdl, weld::Button&, void);
491  DECL_LINK(KeyInput, const KeyEvent&, bool);
492  DECL_LINK(TreeSizeAllocHdl, const Size&, void);
493  typedef std::pair<int, int> row_col;
494  DECL_LINK(RadioToggleOnHdl, const row_col&, void);
495 
496 public:
497  SwAddStylesDlg_Impl(weld::Window* pParent, SwWrtShell const & rWrtSh, OUString rStringArr[]);
498 };
499 
501  SwWrtShell const & rWrtSh, OUString rStringArr[])
502  : SfxDialogController(pParent, "modules/swriter/ui/assignstylesdialog.ui", "AssignStylesDialog")
503  , pStyleArr(rStringArr)
504  , m_xOk(m_xBuilder->weld_button("ok"))
505  , m_xLeftPB(m_xBuilder->weld_button("left"))
506  , m_xRightPB(m_xBuilder->weld_button("right"))
507  , m_xHeaderTree(m_xBuilder->weld_tree_view("styles"))
508 {
509  m_xOk->connect_clicked(LINK(this, SwAddStylesDlg_Impl, OkHdl));
510  m_xLeftPB->connect_clicked(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
511  m_xRightPB->connect_clicked(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
512  m_xHeaderTree->connect_size_allocate(LINK(this, SwAddStylesDlg_Impl, TreeSizeAllocHdl));
513 
514  std::vector<int> aRadioColumns;
515  for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
516  aRadioColumns.push_back(i + 1);
517  m_xHeaderTree->set_toggle_columns_as_radio(aRadioColumns);
518  m_xHeaderTree->connect_toggled(LINK(this, SwAddStylesDlg_Impl, RadioToggleOnHdl));
519 
520  std::vector<int> aWidths;
521  aWidths.push_back(m_xHeaderTree->get_approximate_digit_width() * 30);
522  int nPadding = m_xHeaderTree->get_approximate_digit_width() * 2;
523  OUString sTitle(m_xHeaderTree->get_column_title(1));
524  for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
525  {
526  sTitle = OUString::number(i);
527  m_xHeaderTree->set_column_title(i + 1, sTitle);
528  aWidths.push_back(m_xHeaderTree->get_pixel_size(sTitle).Width() + nPadding);
529  }
530  m_xHeaderTree->set_column_fixed_widths(aWidths);
531  auto nWidth = std::accumulate(aWidths.begin(), aWidths.end(), 0);
532  m_xHeaderTree->set_size_request(nWidth, m_xHeaderTree->get_height_rows(15));
533 
534  int nRow(0);
535  for (sal_uInt16 i = 0; i < MAXLEVEL; ++i)
536  {
537  const OUString &rStyles{rStringArr[i]};
538  if (rStyles.isEmpty())
539  continue;
540  sal_Int32 nPos(0);
541  do
542  {
543  OUString sEntry = rStyles.getToken(0, TOX_STYLE_DELIMITER, nPos);
544  m_xHeaderTree->append_text(sEntry);
545  for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
546  {
547  TriState eState = i == j - 1 ? TRISTATE_TRUE : TRISTATE_FALSE;
548  m_xHeaderTree->set_toggle(nRow, eState, j + 1);
549  }
550  ++nRow;
551  } while (nPos>=0);
552  }
553  // now the other styles
554 
555  const sal_uInt16 nSz = rWrtSh.GetTextFormatCollCount();
556  for (sal_uInt16 j = 0; j < nSz; ++j)
557  {
558  const SwTextFormatColl& rColl = rWrtSh.GetTextFormatColl(j);
559  if (rColl.IsDefault())
560  continue;
561 
562  const OUString aName = rColl.GetName();
563  if (!aName.isEmpty())
564  {
565  bool bEntry = false;
566  int nChildren = m_xHeaderTree->n_children();
567  for (int i = 0; i < nChildren; ++i)
568  {
569  if (m_xHeaderTree->get_text(i, 0) == aName)
570  {
571  bEntry = true;
572  break;
573  }
574  }
575  if (!bEntry)
576  {
577  m_xHeaderTree->append_text(aName);
578  for (sal_uInt16 k = 0; k <= MAXLEVEL; ++k)
579  {
580  TriState eState = k == 0 ? TRISTATE_TRUE : TRISTATE_FALSE;
581  m_xHeaderTree->set_toggle(nRow, eState, k + 1);
582  }
583  ++nRow;
584  }
585  }
586  }
587  m_xHeaderTree->make_sorted();
588  m_xHeaderTree->select(0);
589  m_xHeaderTree->connect_key_release(LINK(this, SwAddStylesDlg_Impl, KeyInput));
590 }
591 
592 IMPL_LINK(SwAddStylesDlg_Impl, TreeSizeAllocHdl, const Size&, rSize, void)
593 {
594  auto nWidth = rSize.Width();
595 
596  std::vector<int> aWidths;
597  aWidths.push_back(0);
598  int nPadding = m_xHeaderTree->get_approximate_digit_width() * 2;
599  for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
600  {
601  OUString sTitle(m_xHeaderTree->get_column_title(i + 1));
602  aWidths.push_back(m_xHeaderTree->get_pixel_size(sTitle).Width() + nPadding);
603  }
604  auto nOtherWidth = std::accumulate(aWidths.begin(), aWidths.end(), 0);
605  aWidths[0] = nWidth - nOtherWidth;
606  m_xHeaderTree->set_column_fixed_widths(aWidths);
607 }
608 
609 IMPL_LINK(SwAddStylesDlg_Impl, RadioToggleOnHdl, const row_col&, rRowCol, void)
610 {
611  for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
612  {
613  TriState eState = rRowCol.second == i + 1 ? TRISTATE_TRUE : TRISTATE_FALSE;
614  m_xHeaderTree->set_toggle(rRowCol.first, eState, i + 1);
615  }
616 }
617 
618 IMPL_LINK(SwAddStylesDlg_Impl, KeyInput, const KeyEvent&, rKEvt, bool)
619 {
620  vcl::KeyCode aCode = rKEvt.GetKeyCode();
621  bool bHandled = false;
622 
623  if (aCode.GetCode() == KEY_ADD || aCode.GetCode() == KEY_RIGHT)
624  {
625  LeftRightHdl(*m_xRightPB);
626  bHandled = true;
627  }
628  else if (aCode.GetCode() == KEY_SUBTRACT || aCode.GetCode() == KEY_LEFT)
629  {
630  LeftRightHdl(*m_xLeftPB);
631  bHandled = true;
632  }
633 
634  return bHandled;
635 }
636 
638 {
639  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
640  pStyleArr[i].clear();
641 
642  int nChildren = m_xHeaderTree->n_children();
643  for (int i = 0; i < nChildren; ++i)
644  {
645  int nToggleColumn = 0;
646  for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
647  {
648  if (m_xHeaderTree->get_toggle(i, j + 1) == TRISTATE_TRUE)
649  {
650  nToggleColumn = j;
651  break;
652  }
653  }
654  if (nToggleColumn)
655  {
656  int nLevel = nToggleColumn - 1;
657  if(!pStyleArr[nLevel].isEmpty())
658  pStyleArr[nLevel] += OUStringLiteral1(TOX_STYLE_DELIMITER);
659  pStyleArr[nLevel] += m_xHeaderTree->get_text(i, 0);
660  }
661  }
662 
663  //TODO write back style names
664  m_xDialog->response(RET_OK);
665 }
666 
667 IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, weld::Button&, rBtn, void)
668 {
669  bool bLeft = &rBtn == m_xLeftPB.get();
670  int nEntry = m_xHeaderTree->get_selected_index();
671  if (nEntry != -1)
672  {
673  int nToggleColumn = 0;
674  for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
675  {
676  if (m_xHeaderTree->get_toggle(nEntry, j + 1) == TRISTATE_TRUE)
677  {
678  nToggleColumn = j;
679  break;
680  }
681  }
682 
683  if (bLeft)
684  {
685  if (nToggleColumn)
686  --nToggleColumn;
687  }
688  else
689  {
690  if (nToggleColumn < MAXLEVEL)
691  ++nToggleColumn;
692  }
693 
694  for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
695  {
696  m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn ? TRISTATE_TRUE : TRISTATE_FALSE, j + 1);
697  }
698  }
699 }
700 
702  : SfxTabPage(pParent, "modules/swriter/ui/tocindexpage.ui", "TocIndexPage", &rAttrSet)
703  , sAutoMarkType(SwResId(STR_AUTOMARK_TYPE))
704  , m_bWaitingInitialSettings(true)
705  , m_xTitleED(m_xBuilder->weld_entry("title"))
706  , m_xTypeFT(m_xBuilder->weld_label("typeft"))
707  , m_xTypeLB(m_xBuilder->weld_combo_box("type"))
708  , m_xReadOnlyCB(m_xBuilder->weld_check_button("readonly"))
709  , m_xAreaFrame(m_xBuilder->weld_widget("areaframe"))
710  , m_xAreaLB(m_xBuilder->weld_combo_box("scope"))
711  , m_xLevelFT(m_xBuilder->weld_label("levelft"))
712  , m_xLevelNF(m_xBuilder->weld_spin_button("level"))
713  , m_xCreateFrame(m_xBuilder->weld_widget("createframe"))
714  , m_xFromHeadingsCB(m_xBuilder->weld_check_button("fromheadings"))
715  , m_xStylesCB(m_xBuilder->weld_check_button("stylescb"))
716  , m_xAddStylesCB(m_xBuilder->weld_check_button("addstylescb"))
717  , m_xAddStylesPB(m_xBuilder->weld_button("styles"))
718  , m_xFromTablesCB(m_xBuilder->weld_check_button("fromtables"))
719  , m_xFromFramesCB(m_xBuilder->weld_check_button("fromframes"))
720  , m_xFromGraphicsCB(m_xBuilder->weld_check_button("fromgraphics"))
721  , m_xFromOLECB(m_xBuilder->weld_check_button("fromoles"))
722  , m_xLevelFromChapterCB(m_xBuilder->weld_check_button("uselevel"))
723  , m_xFromCaptionsRB(m_xBuilder->weld_radio_button("captions"))
724  , m_xFromObjectNamesRB(m_xBuilder->weld_radio_button("objnames"))
725  , m_xCaptionSequenceFT(m_xBuilder->weld_label("categoryft"))
726  , m_xCaptionSequenceLB(m_xBuilder->weld_combo_box("category"))
727  , m_xDisplayTypeFT(m_xBuilder->weld_label("displayft"))
728  , m_xDisplayTypeLB(m_xBuilder->weld_combo_box("display"))
729  , m_xTOXMarksCB(m_xBuilder->weld_check_button("indexmarks"))
730  , m_xIdxOptionsFrame(m_xBuilder->weld_widget("optionsframe"))
731  , m_xCollectSameCB(m_xBuilder->weld_check_button("combinesame"))
732  , m_xUseFFCB(m_xBuilder->weld_check_button("useff"))
733  , m_xUseDashCB(m_xBuilder->weld_check_button("usedash"))
734  , m_xCaseSensitiveCB(m_xBuilder->weld_check_button("casesens"))
735  , m_xInitialCapsCB(m_xBuilder->weld_check_button("initcaps"))
736  , m_xKeyAsEntryCB(m_xBuilder->weld_check_button("keyasentry"))
737  , m_xFromFileCB(m_xBuilder->weld_check_button("fromfile"))
738  , m_xAutoMarkPB(m_xBuilder->weld_menu_button("file"))
739  , m_xFromObjCLB(m_xBuilder->weld_tree_view("objects"))
740  , m_xFromObjFrame(m_xBuilder->weld_widget("objectframe"))
741  , m_xSequenceCB(m_xBuilder->weld_check_button("numberentries"))
742  , m_xBracketLB(m_xBuilder->weld_combo_box("brackets"))
743  , m_xAuthorityFrame(m_xBuilder->weld_widget("authframe"))
744  , m_xSortFrame(m_xBuilder->weld_widget("sortframe"))
745  , m_xLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box("lang")))
746  , m_xSortAlgorithmLB(m_xBuilder->weld_combo_box("keytype"))
747 {
748  sAddStyleUser = m_xStylesCB->get_label();
750 
751  m_xLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN,
752  false );
753 
754  //Default mode is arranged to be the tallest mode
755  //of alphabetical index, lock that size in now
756  LanguageHdl(nullptr); //fill sort algorithm list
757  Size aPrefSize(m_xContainer->get_preferred_size());
758  m_xContainer->set_size_request(aPrefSize.Width(), aPrefSize.Height());
759 
760  sAddStyleContent = m_xAddStylesCB->get_label();
761 
762  std::vector<int> aWidths;
763  aWidths.push_back(m_xFromObjCLB->get_checkbox_column_width());
764  m_xFromObjCLB->set_column_fixed_widths(aWidths);
765 
766  for (size_t i = 0; i < SAL_N_ELEMENTS(RES_SRCTYPES); ++i)
767  {
768  OUString sId(OUString::number(static_cast<sal_uInt32>(RES_SRCTYPES[i].second)));
769  m_xFromObjCLB->append();
770  m_xFromObjCLB->set_toggle(i, TRISTATE_FALSE, 0);
771  m_xFromObjCLB->set_text(i, SwResId(RES_SRCTYPES[i].first), 1);
772  m_xFromObjCLB->set_id(i, sId);
773  }
774 
776  m_xTypeLB->connect_changed(LINK(this, SwTOXSelectTabPage, TOXTypeHdl));
777 
778  m_xAddStylesPB->connect_clicked(LINK(this, SwTOXSelectTabPage, AddStylesHdl));
779 
780  m_xAutoMarkPB->connect_toggled(LINK(this, SwTOXSelectTabPage, MenuEnableHdl));
781  m_xAutoMarkPB->connect_selected(LINK(this, SwTOXSelectTabPage, MenuExecuteHdl));
782 
783  Link<weld::ToggleButton&,void> aLk = LINK(this, SwTOXSelectTabPage, CheckBoxHdl);
784  m_xAddStylesCB->connect_toggled(aLk);
785  m_xFromHeadingsCB->connect_toggled(aLk);
786  m_xTOXMarksCB->connect_toggled(aLk);
787  m_xFromFileCB->connect_toggled(aLk);
788  m_xCollectSameCB->connect_toggled(aLk);
789  m_xUseFFCB->connect_toggled(aLk);
790  m_xUseDashCB->connect_toggled(aLk);
791  m_xInitialCapsCB->connect_toggled(aLk);
792  m_xKeyAsEntryCB->connect_toggled(aLk);
793 
794  m_xTitleED->connect_changed(LINK(this, SwTOXSelectTabPage, ModifyEntryHdl));
795  m_xLevelNF->connect_value_changed(LINK(this, SwTOXSelectTabPage, ModifySpinHdl));
796  m_xSortAlgorithmLB->connect_changed(LINK(this, SwTOXSelectTabPage, ModifyListBoxHdl));
797 
798  aLk = LINK(this, SwTOXSelectTabPage, RadioButtonHdl);
799  m_xFromCaptionsRB->connect_toggled(aLk);
800  m_xFromObjectNamesRB->connect_toggled(aLk);
801  RadioButtonHdl(*m_xFromCaptionsRB);
802 
803  m_xLanguageLB->connect_changed(LINK(this, SwTOXSelectTabPage, LanguageListBoxHdl));
804  m_xTypeLB->set_active(0);
805  m_xTitleED->save_value();
806 }
807 
809 {
810  disposeOnce();
811 }
812 
814 {
815  pIndexRes.reset();
816  pIndexEntryWrapper.reset();
817  m_xLanguageLB.reset();
819 }
820 
822 {
823  const sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
824  if(nUserTypeCount > 1)
825  {
826  //insert all new user indexes names after the standard user index
827  sal_Int32 nPos = m_xTypeLB->find_id(OUString::number(sal_uInt32(TO_USER))) + 1;
828  for (sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++)
829  {
830  sal_uInt32 nEntryData = nUser << 8;
831  nEntryData |= TO_USER;
832  OUString sId(OUString::number(nEntryData));
833  m_xTypeLB->insert(nPos++, rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(),
834  &sId, nullptr, nullptr);
835  }
836  }
837 }
838 
840 {
841  return true;
842 }
843 
845 {
846  sal_uInt16 nRet = TOX_INDEX;
847  switch(eType.eType)
848  {
849  case TOX_INDEX : nRet = TO_INDEX; break;
850  case TOX_USER :
851  {
852  nRet = eType.nIndex << 8;
853  nRet |= TO_USER;
854  }
855  break;
856  case TOX_CONTENT : nRet = TO_CONTENT; break;
857  case TOX_ILLUSTRATIONS:nRet = TO_ILLUSTRATION; break;
858  case TOX_OBJECTS : nRet = TO_OBJECT; break;
859  case TOX_TABLES : nRet = TO_TABLE; break;
860  case TOX_AUTHORITIES : nRet = TO_AUTHORITIES; break;
861  case TOX_BIBLIOGRAPHY : nRet = TO_BIBLIOGRAPHY; break;
862  case TOX_CITATION :break;
863  }
864  return nRet;
865 }
866 
868 {
869  CurTOXType eCurType (eSet);
870 
871  sal_uInt32 nData = lcl_TOXTypesToUserData(eCurType);
872  m_xTypeLB->set_active_id(OUString::number(nData));
873  m_xTypeFT->set_sensitive(false);
874  m_xTypeLB->set_sensitive(false);
875  TOXTypeHdl(*m_xTypeLB);
876 }
877 
878 static CurTOXType lcl_UserData2TOXTypes(sal_uInt16 nData)
879 {
880  CurTOXType eRet;
881 
882  switch(nData&0xff)
883  {
884  case TO_INDEX : eRet.eType = TOX_INDEX; break;
885  case TO_USER :
886  {
887  eRet.eType = TOX_USER;
888  eRet.nIndex = (nData&0xff00) >> 8;
889  }
890  break;
891  case TO_CONTENT : eRet.eType = TOX_CONTENT; break;
892  case TO_ILLUSTRATION: eRet.eType = TOX_ILLUSTRATIONS; break;
893  case TO_OBJECT : eRet.eType = TOX_OBJECTS; break;
894  case TO_TABLE : eRet.eType = TOX_TABLES; break;
895  case TO_AUTHORITIES : eRet.eType = TOX_AUTHORITIES; break;
896  case TO_BIBLIOGRAPHY : eRet.eType = TOX_BIBLIOGRAPHY; break;
897  default: OSL_FAIL("what a type?");
898  }
899  return eRet;
900 }
901 
903 {
904  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
905  const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
906  SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
907  m_xReadOnlyCB->set_active(rDesc.IsReadonly());
908  if (!m_xTitleED->get_value_changed_from_saved())
909  {
910  if (rDesc.GetTitle())
911  m_xTitleED->set_text(*rDesc.GetTitle());
912  else
913  m_xTitleED->set_text(OUString());
914  m_xTitleED->save_value();
915  }
916 
917  m_xAreaLB->set_active(rDesc.IsFromChapter() ? 1 : 0);
918 
919  if (aCurType.eType != TOX_INDEX)
920  m_xLevelNF->set_value(rDesc.GetLevel()); //content, user
921 
922  SwTOXElement nCreateType = rDesc.GetContentOptions();
923 
924  //user + content
925  bool bHasStyleNames = false;
926 
927  for( sal_uInt16 i = 0; i < MAXLEVEL; i++)
928  if(!rDesc.GetStyleNames(i).isEmpty())
929  {
930  bHasStyleNames = true;
931  break;
932  }
933  m_xAddStylesCB->set_active(bHasStyleNames && (nCreateType & SwTOXElement::Template));
934 
935  m_xFromOLECB->set_active( bool(nCreateType & SwTOXElement::Ole) );
936  m_xFromTablesCB->set_active( bool(nCreateType & SwTOXElement::Table) );
937  m_xFromGraphicsCB->set_active( bool(nCreateType & SwTOXElement::Graphic) );
938  m_xFromFramesCB->set_active( bool(nCreateType & SwTOXElement::Frame) );
939 
940  m_xLevelFromChapterCB->set_active(rDesc.IsLevelFromChapter());
941 
942  //all but illustration and table
943  m_xTOXMarksCB->set_active( bool(nCreateType & SwTOXElement::Mark) );
944 
945  //content
946  if(TOX_CONTENT == aCurType.eType)
947  {
948  m_xFromHeadingsCB->set_active( bool(nCreateType & SwTOXElement::OutlineLevel) );
949  m_xAddStylesCB->set_label(sAddStyleContent);
950  m_xAddStylesPB->set_sensitive(m_xAddStylesCB->get_active());
951  }
952  //index only
953  else if(TOX_INDEX == aCurType.eType)
954  {
955  const SwTOIOptions nIndexOptions = rDesc.GetIndexOptions();
956  m_xCollectSameCB->set_active( bool(nIndexOptions & SwTOIOptions::SameEntry) );
957  m_xUseFFCB->set_active( bool(nIndexOptions & SwTOIOptions::FF) );
958  m_xUseDashCB->set_active( bool(nIndexOptions & SwTOIOptions::Dash) );
959  if (m_xUseFFCB->get_active())
960  m_xUseDashCB->set_sensitive(false);
961  else if (m_xUseDashCB->get_active())
962  m_xUseFFCB->set_sensitive(false);
963 
964  m_xCaseSensitiveCB->set_active( bool(nIndexOptions & SwTOIOptions::CaseSensitive) );
965  m_xInitialCapsCB->set_active( bool(nIndexOptions & SwTOIOptions::InitialCaps) );
966  m_xKeyAsEntryCB->set_active( bool(nIndexOptions & SwTOIOptions::KeyAsEntry) );
967  }
968  else if (TOX_ILLUSTRATIONS == aCurType.eType || TOX_TABLES == aCurType.eType)
969  {
970  m_xFromObjectNamesRB->set_active(rDesc.IsCreateFromObjectNames());
971  m_xFromCaptionsRB->set_active(!rDesc.IsCreateFromObjectNames());
972  OUString sName(rDesc.GetSequenceName());
973  int nIndex = m_xCaptionSequenceLB->find_text(sName);
974  if (nIndex != -1)
975  m_xCaptionSequenceLB->set_active(nIndex);
976  m_xDisplayTypeLB->set_active(static_cast<sal_Int32>(rDesc.GetCaptionDisplay()));
977  if (m_xDisplayTypeLB->get_active() == -1)
978  m_xDisplayTypeLB->set_active(0);
979  RadioButtonHdl(*m_xFromCaptionsRB);
980 
981  }
982  else if(TOX_OBJECTS == aCurType.eType)
983  {
984  SwTOOElements nOLEData = rDesc.GetOLEOptions();
985  for (int nFromObj = 0, nCount = m_xFromObjCLB->n_children(); nFromObj < nCount; ++nFromObj)
986  {
987  SwTOOElements nData = static_cast<SwTOOElements>(m_xFromObjCLB->get_id(nFromObj).toInt32());
988  m_xFromObjCLB->set_toggle(nFromObj, bool(nData & nOLEData) ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
989  }
990  }
991  else if(TOX_AUTHORITIES == aCurType.eType)
992  {
993  const OUString& sBrackets(rDesc.GetAuthBrackets());
994  if(sBrackets.isEmpty() || sBrackets == " ")
995  m_xBracketLB->set_active(0);
996  else
997  m_xBracketLB->set_active_text(sBrackets);
998  m_xSequenceCB->set_active(rDesc.IsAuthSequence());
999  }
1000  m_xAutoMarkPB->set_sensitive(m_xFromFileCB->get_active());
1001 
1002  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1003  aStyleArr[i] = rDesc.GetStyleNames(i);
1004 
1005  m_xLanguageLB->set_active_id(rDesc.GetLanguage());
1006  LanguageHdl(nullptr);
1007  for (int nCnt = 0, nEntryCount = m_xSortAlgorithmLB->get_count(); nCnt < nEntryCount; ++nCnt)
1008  {
1009  const OUString& rEntryData = m_xSortAlgorithmLB->get_id(nCnt);
1010  if (rEntryData == rDesc.GetSortAlgorithm())
1011  {
1012  m_xSortAlgorithmLB->set_active(nCnt);
1013  break;
1014  }
1015  }
1016 }
1017 
1019 {
1020  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1021  CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
1022  SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
1023  rDesc.SetTitle(m_xTitleED->get_text());
1024  rDesc.SetFromChapter(1 == m_xAreaLB->get_active());
1025  SwTOXElement nContentOptions = SwTOXElement::NONE;
1026  if (m_xTOXMarksCB->get_visible() && m_xTOXMarksCB->get_active())
1027  nContentOptions |= SwTOXElement::Mark;
1028 
1030  switch(rDesc.GetTOXType())
1031  {
1032  case TOX_CONTENT:
1033  if(m_xFromHeadingsCB->get_active())
1034  nContentOptions |= SwTOXElement::OutlineLevel;
1035  break;
1036  case TOX_USER:
1037  {
1038  rDesc.SetTOUName(m_xTypeLB->get_active_text());
1039 
1040  if(m_xFromOLECB->get_active())
1041  nContentOptions |= SwTOXElement::Ole;
1042  if(m_xFromTablesCB->get_active())
1043  nContentOptions |= SwTOXElement::Table;
1044  if(m_xFromFramesCB->get_active())
1045  nContentOptions |= SwTOXElement::Frame;
1046  if(m_xFromGraphicsCB->get_active())
1047  nContentOptions |= SwTOXElement::Graphic;
1048  }
1049  break;
1050  case TOX_INDEX:
1051  {
1052  nContentOptions = SwTOXElement::Mark;
1053 
1054  if(m_xCollectSameCB->get_active())
1055  nIndexOptions |= SwTOIOptions::SameEntry;
1056  if(m_xUseFFCB->get_active())
1057  nIndexOptions |= SwTOIOptions::FF;
1058  if(m_xUseDashCB->get_active())
1059  nIndexOptions |= SwTOIOptions::Dash;
1060  if(m_xCaseSensitiveCB->get_active())
1061  nIndexOptions |= SwTOIOptions::CaseSensitive;
1062  if(m_xInitialCapsCB->get_active())
1063  nIndexOptions |= SwTOIOptions::InitialCaps;
1064  if(m_xKeyAsEntryCB->get_active())
1065  nIndexOptions |= SwTOIOptions::KeyAsEntry;
1066  if(m_xFromFileCB->get_active())
1068  else
1069  rDesc.SetAutoMarkURL(OUString());
1070  }
1071  break;
1072  case TOX_ILLUSTRATIONS:
1073  case TOX_TABLES :
1074  rDesc.SetCreateFromObjectNames(m_xFromObjectNamesRB->get_active());
1075  rDesc.SetSequenceName(m_xCaptionSequenceLB->get_active_text());
1076  rDesc.SetCaptionDisplay(static_cast<SwCaptionDisplay>(m_xDisplayTypeLB->get_active()));
1077  break;
1078  case TOX_OBJECTS:
1079  {
1081  for (int i = 0, nCount = m_xFromObjCLB->n_children(); i < nCount; ++i)
1082  {
1083  if (m_xFromObjCLB->get_toggle(i, 0) == TRISTATE_TRUE)
1084  {
1085  SwTOOElements nData = static_cast<SwTOOElements>(m_xFromObjCLB->get_id(i).toInt32());
1086  nOLEData |= nData;
1087  }
1088  }
1089  rDesc.SetOLEOptions(nOLEData);
1090  }
1091  break;
1092  case TOX_AUTHORITIES:
1093  case TOX_BIBLIOGRAPHY :
1094  {
1095  if (m_xBracketLB->get_active())
1096  rDesc.SetAuthBrackets(m_xBracketLB->get_active_text());
1097  else
1098  rDesc.SetAuthBrackets(OUString());
1099  rDesc.SetAuthSequence(m_xSequenceCB->get_active());
1100  }
1101  break;
1102  case TOX_CITATION :
1103  break;
1104  }
1105 
1106  rDesc.SetLevelFromChapter( m_xLevelFromChapterCB->get_visible() &&
1107  m_xLevelFromChapterCB->get_active());
1108  if (m_xTOXMarksCB->get_active() && m_xTOXMarksCB->get_visible())
1109  nContentOptions |= SwTOXElement::Mark;
1110  if (m_xFromHeadingsCB->get_active() && m_xFromHeadingsCB->get_visible())
1111  nContentOptions |= SwTOXElement::OutlineLevel;
1112  if (m_xAddStylesCB->get_active() && m_xAddStylesCB->get_visible())
1113  nContentOptions |= SwTOXElement::Template;
1114 
1115  rDesc.SetContentOptions(nContentOptions);
1116  rDesc.SetIndexOptions(nIndexOptions);
1117  rDesc.SetLevel(m_xLevelNF->get_value());
1118 
1119  rDesc.SetReadonly(m_xReadOnlyCB->get_active());
1120 
1121  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1122  rDesc.SetStyleNames(aStyleArr[i], i);
1123 
1124  rDesc.SetLanguage(m_xLanguageLB->get_active_id());
1125  const OUString& rEntryData = m_xSortAlgorithmLB->get_active_id();
1126  rDesc.SetSortAlgorithm(rEntryData);
1127 }
1128 
1130 {
1131  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1132  SwWrtShell& rSh = pTOXDlg->GetWrtShell();
1133  const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
1134  sal_uInt32 nData = lcl_TOXTypesToUserData(aCurType);
1135  m_xTypeLB->set_active_id(OUString::number(nData));
1136 
1139  m_xFromFileCB->set_active(!sAutoMarkURL.isEmpty());
1140 
1141  m_xCaptionSequenceLB->clear();
1142  const size_t nCount = rSh.GetFieldTypeCount(SwFieldIds::SetExp);
1143  for (size_t i = 0; i < nCount; ++i)
1144  {
1145  SwFieldType *pType = rSh.GetFieldType( i, SwFieldIds::SetExp );
1146  if( pType->Which() == SwFieldIds::SetExp &&
1147  static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
1148  m_xCaptionSequenceLB->append_text(pType->GetName());
1149  }
1150 
1151  if(pTOXDlg->IsTOXEditMode())
1152  {
1153  m_xTypeFT->set_sensitive(false);
1154  m_xTypeLB->set_sensitive(false);
1155  }
1156 
1158  {
1159  // save current values into the proper TOXDescription
1161  }
1162  m_bWaitingInitialSettings = false;
1163 
1164  TOXTypeHdl(*m_xTypeLB);
1165  CheckBoxHdl(*m_xAddStylesCB);
1166 }
1167 
1169 {
1170  //nothing to do
1171 }
1172 
1174 {
1175  if (_pSet)
1176  _pSet->Put(SfxUInt16Item(FN_PARAM_TOX_TYPE, m_xTypeLB->get_active_id().toUInt32()));
1178  return DeactivateRC::LeavePage;
1179 }
1180 
1182 {
1183  return VclPtr<SwTOXSelectTabPage>::Create(pParent, *rAttrSet);
1184 }
1185 
1186 IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, weld::ComboBox&, rBox, void)
1187 {
1188  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1189  const sal_uInt16 nType = rBox.get_active_id().toUInt32();
1190  CurTOXType eCurType = lcl_UserData2TOXTypes(nType);
1191  pTOXDlg->SetCurrentTOXType(eCurType);
1192 
1193  m_xAreaLB->set_visible( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) );
1194  m_xLevelFT->set_visible( 0 != (nType & (TO_CONTENT)) );
1195  m_xLevelNF->set_visible( 0 != (nType & (TO_CONTENT)) );
1196  m_xLevelFromChapterCB->set_visible( 0 != (nType & (TO_USER)) );
1197  m_xAreaFrame->set_visible( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) );
1198 
1199  m_xFromHeadingsCB->set_visible( 0 != (nType & (TO_CONTENT)) );
1200  m_xAddStylesCB->set_visible( 0 != (nType & (TO_CONTENT|TO_USER)) );
1201  m_xAddStylesPB->set_visible( 0 != (nType & (TO_CONTENT|TO_USER)) );
1202 
1203  m_xFromTablesCB->set_visible( 0 != (nType & (TO_USER)) );
1204  m_xFromFramesCB->set_visible( 0 != (nType & (TO_USER)) );
1205  m_xFromGraphicsCB->set_visible( 0 != (nType & (TO_USER)) );
1206  m_xFromOLECB->set_visible( 0 != (nType & (TO_USER)) );
1207 
1208  m_xFromCaptionsRB->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1209  m_xFromObjectNamesRB->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1210 
1211  m_xTOXMarksCB->set_visible( 0 != (nType & (TO_CONTENT|TO_USER)) );
1212 
1213  m_xCreateFrame->set_visible( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_TABLE)) );
1214  m_xCaptionSequenceFT->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1215  m_xCaptionSequenceLB->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1216  m_xDisplayTypeFT->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1217  m_xDisplayTypeLB->set_visible( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
1218 
1219  m_xAuthorityFrame->set_visible( 0 != (nType & TO_AUTHORITIES) );
1220 
1221  bool bEnableSortLanguage = 0 != (nType & (TO_INDEX|TO_AUTHORITIES));
1222  m_xSortFrame->set_visible(bEnableSortLanguage);
1223 
1224  if( nType & TO_ILLUSTRATION )
1225  {
1227  m_xCaptionSequenceLB->set_active_text(sName);
1228  }
1229  else if( nType & TO_TABLE )
1230  {
1232  m_xCaptionSequenceLB->set_active_text(sName);
1233  }
1234  else if( nType & TO_USER )
1235  {
1236  m_xAddStylesCB->set_label(sAddStyleUser);
1237  }
1238 
1239  m_xIdxOptionsFrame->set_visible( 0 != (nType & TO_INDEX) );
1240 
1241  //object index
1242  m_xFromObjFrame->set_visible( 0 != (nType & TO_OBJECT) );
1243 
1244  //set control values from the proper TOXDescription
1245  {
1246  ApplyTOXDescription();
1247  }
1248  ModifyHdl();
1249 }
1250 
1252 {
1254  {
1256  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1258  }
1259 }
1260 
1262 {
1263  ModifyHdl();
1264 }
1265 
1267 {
1268  ModifyHdl();
1269 }
1270 
1272 {
1273  ModifyHdl();
1274 }
1275 
1276 IMPL_LINK(SwTOXSelectTabPage, CheckBoxHdl, weld::ToggleButton&, rButton, void)
1277 {
1278  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1279  const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
1280  if(TOX_CONTENT == aCurType.eType)
1281  {
1282  //at least one of the three CheckBoxes must be checked
1283  if (!m_xAddStylesCB->get_active() && !m_xFromHeadingsCB->get_active() && !m_xTOXMarksCB->get_active())
1284  {
1285  //TODO: InfoBox?
1286  rButton.set_active(true);
1287  }
1288  m_xAddStylesPB->set_sensitive(m_xAddStylesCB->get_active());
1289  }
1290  if (TOX_USER == aCurType.eType)
1291  {
1292  m_xAddStylesPB->set_sensitive(m_xAddStylesCB->get_active());
1293  }
1294  else if (TOX_INDEX == aCurType.eType)
1295  {
1296  m_xAutoMarkPB->set_sensitive(m_xFromFileCB->get_active());
1297  m_xUseFFCB->set_sensitive(m_xCollectSameCB->get_active() && !m_xUseDashCB->get_active());
1298  m_xUseDashCB->set_sensitive(m_xCollectSameCB->get_active() && !m_xUseFFCB->get_active());
1299  m_xCaseSensitiveCB->set_sensitive(m_xCollectSameCB->get_active());
1300  }
1301  ModifyHdl();
1302 };
1303 
1305 {
1306  bool bEnable = m_xFromCaptionsRB->get_active();
1307  m_xCaptionSequenceFT->set_sensitive(bEnable);
1308  m_xCaptionSequenceLB->set_sensitive(bEnable);
1309  m_xDisplayTypeFT->set_sensitive(bEnable);
1310  m_xDisplayTypeLB->set_sensitive(bEnable);
1311  ModifyHdl();
1312 }
1313 
1314 IMPL_LINK(SwTOXSelectTabPage, LanguageListBoxHdl, weld::ComboBox&, rBox, void)
1315 {
1316  LanguageHdl(&rBox);
1317 }
1318 
1320 {
1321  lang::Locale aLcl( LanguageTag( m_xLanguageLB->get_active_id() ).getLocale() );
1322  Sequence< OUString > aSeq = pIndexEntryWrapper->GetAlgorithmList( aLcl );
1323 
1324  if( !pIndexRes )
1325  pIndexRes.reset(new IndexEntryResource());
1326 
1327  OUString sOldString = m_xSortAlgorithmLB->get_active_id();
1328  m_xSortAlgorithmLB->clear();
1329 
1330  sal_Int32 nEnd = aSeq.getLength();
1331  for( sal_Int32 nCnt = 0; nCnt < nEnd; ++nCnt )
1332  {
1333  const OUString sAlg(aSeq[ nCnt ]);
1334  const OUString sUINm = pIndexRes->GetTranslation( sAlg );
1335  m_xSortAlgorithmLB->append(sAlg, sUINm);
1336  if( sAlg == sOldString )
1337  m_xSortAlgorithmLB->set_active(nCnt);
1338  }
1339 
1340  if (m_xSortAlgorithmLB->get_active() == -1)
1341  m_xSortAlgorithmLB->set_active(0);
1342 
1343  if (pBox)
1344  ModifyHdl();
1345 };
1346 
1348 {
1349  SwAddStylesDlg_Impl aDlg(GetDialogFrameWeld(), static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell(),
1350  aStyleArr);
1351  aDlg.run();
1352  ModifyHdl();
1353 }
1354 
1356 {
1357  m_xAutoMarkPB->set_item_sensitive("edit", !sAutoMarkURL.isEmpty());
1358 }
1359 
1360 IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, const OString&, rIdent, void)
1361 {
1362  const OUString sSaveAutoMarkURL = sAutoMarkURL;
1363 
1364  if (rIdent == "open")
1365  {
1366  sAutoMarkURL = lcl_CreateAutoMarkFileDlg(GetDialogFrameWeld(),
1367  sAutoMarkURL, sAutoMarkType, true);
1368  }
1369  else if (rIdent == "new" || rIdent == "edit")
1370  {
1371  bool bNew = (rIdent == "new");
1372  if (bNew)
1373  {
1374  sAutoMarkURL = lcl_CreateAutoMarkFileDlg(GetDialogFrameWeld(),
1375  sAutoMarkURL, sAutoMarkType, false);
1376  if (sAutoMarkURL.isEmpty())
1377  return;
1378  }
1379 
1380  VclPtrInstance<SwAutoMarkDlg_Impl> pAutoMarkDlg(nullptr, sAutoMarkURL, bNew);
1381 
1382  if( RET_OK != pAutoMarkDlg->Execute() && bNew )
1383  sAutoMarkURL = sSaveAutoMarkURL;
1384  }
1385 }
1386 
1388 {
1389 protected:
1391 public:
1392  virtual WindowType GetType() const = 0;
1393  virtual void GrabFocus() = 0;
1394  virtual void Hide() = 0;
1395  virtual void set_grid_left_attach(int nPos) = 0;
1396  virtual void get_extents_relative_to(weld::Widget& rRelative, int& x, int& y, int& width, int& height) = 0;
1397  void SetGetFocusHdl(const Link<SwTOXWidget&,void>& rLink) { aGetFocusLink = rLink; }
1398  virtual ~SwTOXWidget() {}
1399 };
1400 
1401 class SwTOXEdit : public SwTOXWidget
1402 {
1403  std::unique_ptr<weld::Builder> m_xBuilder;
1409  std::unique_ptr<weld::Entry> m_xEntry;
1410 
1411  DECL_LINK(ModifyHdl, weld::Entry&, void);
1412 public:
1413  SwTOXEdit(SwTokenWindow* pTokenWin, const SwFormToken& rToken)
1414  : m_xBuilder(Application::CreateBuilder(pTokenWin->get_child_container(), "modules/swriter/ui/toxentrywidget.ui"))
1415  , aFormToken(rToken)
1416  , bNextControl(false)
1417  , m_pParent(pTokenWin)
1418  , m_xEntry(m_xBuilder->weld_entry("entry", true))
1419  {
1420  m_xEntry->connect_changed(LINK(this, SwTOXEdit, ModifyHdl));
1421  m_xEntry->connect_key_press(LINK(this, SwTOXEdit, KeyInputHdl));
1422  m_xEntry->connect_focus_in(LINK(this, SwTOXEdit, FocusInHdl));
1423  m_xEntry->set_tooltip_text(m_pParent->CreateQuickHelp(rToken));
1424  }
1425 
1426  virtual WindowType GetType() const override
1427  {
1428  return WindowType::EDIT;
1429  }
1430 
1431  virtual void GrabFocus() override
1432  {
1433  m_xEntry->grab_focus();
1434  }
1435 
1436  virtual void Hide() override
1437  {
1438  m_xEntry->hide();
1439  }
1440 
1441  void Show()
1442  {
1443  m_xEntry->show();
1444  }
1445 
1446  void SetAccessibleName(const OUString& rName)
1447  {
1448  m_xEntry->set_accessible_name(rName);
1449  }
1450 
1451  virtual void set_grid_left_attach(int nPos) override
1452  {
1453  m_xEntry->set_grid_left_attach(nPos);
1454  }
1455 
1456  virtual void get_extents_relative_to(weld::Widget& rRelative, int& x, int& y, int& width, int& height) override
1457  {
1458  m_xEntry->get_extents_relative_to(rRelative, x, y, width, height);
1459  }
1460 
1461  OUString GetText() const
1462  {
1463  return m_xEntry->get_text();
1464  }
1465 
1466  void SetText(const OUString& rText)
1467  {
1468  m_xEntry->set_text(rText);
1469  }
1470 
1471  void get_selection_bounds(int& rStartPos, int& rEndPos)
1472  {
1473  m_xEntry->get_selection_bounds(rStartPos, rEndPos);
1474  }
1475 
1476  void select_region(int nStartPos, int nEndPos)
1477  {
1478  m_xEntry->select_region(nStartPos, nEndPos);
1479  }
1480 
1482  {
1483  aModifiedLink = rLink;
1484  }
1485 
1486  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
1487  DECL_LINK(FocusInHdl, weld::Widget&, void);
1488 
1489  bool IsNextControl() const { return bNextControl; }
1490  void SetPrevNextLink(const Link<SwTOXEdit&,void>& rLink) { aPrevNextControlLink = rLink; }
1491 
1493  {
1494  aFormToken.sText = m_xEntry->get_text();
1495  return aFormToken;
1496  }
1497 
1498  void SetCharStyleName(const OUString& rSet, sal_uInt16 nPoolId)
1499  {
1500  aFormToken.sCharStyleName = rSet;
1501  aFormToken.nPoolId = nPoolId;
1502  }
1503 
1504  void AdjustSize();
1505 };
1506 
1508 {
1509  aModifiedLink.Call(*this);
1510 }
1511 
1512 IMPL_LINK(SwTOXEdit, KeyInputHdl, const KeyEvent&, rKEvt, bool)
1513 {
1514  bool bCall = false;
1515  int nStartPos, nEndPos;
1516  bool bStartIsEnd = !m_xEntry->get_selection_bounds(nStartPos, nEndPos);
1517  int nMin = std::min(nStartPos, nEndPos);
1518  const sal_Int32 nTextLen = GetText().getLength();
1519  if ((bStartIsEnd && !nMin) || nMin == nTextLen)
1520  {
1521  vcl::KeyCode aCode = rKEvt.GetKeyCode();
1522  if (aCode.GetCode() == KEY_RIGHT && nMin == nTextLen)
1523  {
1524  bNextControl = true;
1525  bCall = true;
1526  }
1527  else if (aCode.GetCode() == KEY_LEFT && !nMin)
1528  {
1529  bNextControl = false;
1530  bCall = true;
1531  }
1532  else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
1533  {
1534  if (m_pParent)
1535  {
1536  m_pParent->SetFocus2theAllBtn();
1537  }
1538  }
1539  if (bCall && aPrevNextControlLink.IsSet())
1540  aPrevNextControlLink.Call(*this);
1541  else
1542  bCall = false;
1543 
1544  }
1545  return bCall;
1546 }
1547 
1549 {
1550  aGetFocusLink.Call(*this);
1551 }
1552 
1554 {
1555  auto nWidth = m_xEntry->get_pixel_size(GetText()).Width();
1556  float fChars = nWidth / m_xEntry->get_approximate_digit_width();
1557  m_xEntry->set_width_chars(std::max(1.0f, std::ceil(fChars)));
1558 }
1559 
1560 class SwTOXButton : public SwTOXWidget
1561 {
1562  std::unique_ptr<weld::Builder> m_xBuilder;
1567  std::unique_ptr<weld::ToggleButton> m_xButton;
1568 public:
1569  SwTOXButton(SwTokenWindow* pTokenWin, const SwFormToken& rToken)
1570  : m_xBuilder(Application::CreateBuilder(pTokenWin->get_child_container(), "modules/swriter/ui/toxbuttonwidget.ui"))
1571  , aFormToken(rToken)
1572  , bNextControl(false)
1573  , m_pParent(pTokenWin)
1574  , m_xButton(m_xBuilder->weld_toggle_button("button", true))
1575  {
1576  m_xButton->connect_key_press(LINK(this, SwTOXButton, KeyInputHdl));
1577  m_xButton->connect_focus_in(LINK(this, SwTOXButton, FocusInHdl));
1578  m_xButton->set_tooltip_text(m_pParent->CreateQuickHelp(rToken));
1579  }
1580 
1581  virtual WindowType GetType() const override
1582  {
1583  return WindowType::PUSHBUTTON;
1584  }
1585 
1586  virtual void GrabFocus() override
1587  {
1588  m_xButton->grab_focus();
1589  }
1590 
1591  virtual void Hide() override
1592  {
1593  m_xButton->hide();
1594  }
1595 
1596  void Show()
1597  {
1598  m_xButton->show();
1599  }
1600 
1601  void SetAccessibleName(const OUString& rName)
1602  {
1603  m_xButton->set_accessible_name(rName);
1604  }
1605 
1606  virtual void set_grid_left_attach(int nPos) override
1607  {
1608  m_xButton->set_grid_left_attach(nPos);
1609  }
1610 
1611  void get_extents_relative_to(weld::Widget& rRelative, int& x, int& y, int& width, int& height) override
1612  {
1613  m_xButton->get_extents_relative_to(rRelative, x, y, width, height);
1614  }
1615 
1616  void Check(bool bCheck = true)
1617  {
1618  m_xButton->set_active(bCheck);
1619  }
1620 
1621  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
1622  DECL_LINK(FocusInHdl, weld::Widget&, void);
1623 
1624  bool IsNextControl() const {return bNextControl;}
1625  void SetPrevNextLink(const Link<SwTOXButton&,void>& rLink) {aPrevNextControlLink = rLink;}
1626  const SwFormToken& GetFormToken() const {return aFormToken;}
1627 
1628  void SetCharStyleName(const OUString& rSet, sal_uInt16 nPoolId)
1629  {
1630  aFormToken.sCharStyleName = rSet;
1631  aFormToken.nPoolId = nPoolId;
1632  }
1633 
1635  { aFormToken.nTabStopPosition = nSet; }
1636 
1638  { aFormToken.cTabFillChar = cSet; }
1639 
1641  { aFormToken.eTabAlign = eAlign;}
1642 
1643 //---> i89791
1644  //used for entry number format, in TOC only
1645  //needed for different UI dialog position
1646  void SetEntryNumberFormat(sal_uInt16 nSet) {
1647  switch(nSet)
1648  {
1649  default:
1650  case 0:
1651  aFormToken.nChapterFormat = CF_NUMBER;
1652  break;
1653  case 1:
1655  break;
1656  }
1657  }
1658 
1659  void SetChapterInfo(sal_uInt16 nSet) {
1660  switch(nSet)
1661  {
1662  default:
1663  case 0:
1665  break;
1666  case 1:
1667  aFormToken.nChapterFormat = CF_TITLE;
1668  break;
1669  case 2:
1670  aFormToken.nChapterFormat = CF_NUMBER_NOPREPST;
1671  break;
1672  }
1673  }
1674 
1675  void SetOutlineLevel( sal_uInt16 nSet ) { aFormToken.nOutlineLevel = nSet;}//i53420
1676 
1677  void SetText(const OUString& rText)
1678  {
1679  m_xButton->set_label(rText);
1680  }
1681 
1682  void SetLinkEnd()
1683  {
1684  OSL_ENSURE(TOKEN_LINK_START == aFormToken.eTokenType,
1685  "call SetLinkEnd for link start only!");
1686  aFormToken.eTokenType = TOKEN_LINK_END;
1687  aFormToken.sText = SwForm::GetFormLinkEnd();
1688  SetText(aFormToken.sText);
1689  }
1690 
1692  {
1693  OSL_ENSURE(TOKEN_LINK_END == aFormToken.eTokenType,
1694  "call SetLinkStart for link start only!");
1695  aFormToken.eTokenType = TOKEN_LINK_START;
1696  aFormToken.sText = SwForm::GetFormLinkStt();
1697  SetText(aFormToken.sText);
1698  }
1699 };
1700 
1701 IMPL_LINK(SwTOXButton, KeyInputHdl, const KeyEvent&, rKEvt, bool)
1702 {
1703  bool bCall = false;
1704  vcl::KeyCode aCode = rKEvt.GetKeyCode();
1705  if (aCode.GetCode() == KEY_RIGHT)
1706  {
1707  bNextControl = true;
1708  bCall = true;
1709  }
1710  else if (aCode.GetCode() == KEY_LEFT)
1711  {
1712  bNextControl = false;
1713  bCall = true;
1714  }
1715  else if (aCode.GetCode() == KEY_DELETE)
1716  {
1717  m_pParent->RemoveControl(this, true);
1718  //this is invalid here
1719  return true;
1720  }
1721  else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
1722  {
1723  if (m_pParent)
1724  {
1725  m_pParent->SetFocus2theAllBtn();
1726  }
1727  }
1728  if (bCall && aPrevNextControlLink.IsSet())
1729  aPrevNextControlLink.Call(*this);
1730  else
1731  bCall = false;
1732  return bCall;
1733 }
1734 
1736 {
1737  aGetFocusLink.Call(*this);
1738 }
1739 
1740 namespace
1741 {
1742  const char* STR_AUTH_FIELD_ARY[] =
1743  {
1744  STR_AUTH_FIELD_IDENTIFIER,
1745  STR_AUTH_FIELD_AUTHORITY_TYPE,
1746  STR_AUTH_FIELD_ADDRESS,
1747  STR_AUTH_FIELD_ANNOTE,
1748  STR_AUTH_FIELD_AUTHOR,
1749  STR_AUTH_FIELD_BOOKTITLE,
1750  STR_AUTH_FIELD_CHAPTER,
1751  STR_AUTH_FIELD_EDITION,
1752  STR_AUTH_FIELD_EDITOR,
1753  STR_AUTH_FIELD_HOWPUBLISHED,
1754  STR_AUTH_FIELD_INSTITUTION,
1755  STR_AUTH_FIELD_JOURNAL,
1756  STR_AUTH_FIELD_MONTH,
1757  STR_AUTH_FIELD_NOTE,
1758  STR_AUTH_FIELD_NUMBER,
1759  STR_AUTH_FIELD_ORGANIZATIONS,
1760  STR_AUTH_FIELD_PAGES,
1761  STR_AUTH_FIELD_PUBLISHER,
1762  STR_AUTH_FIELD_SCHOOL,
1763  STR_AUTH_FIELD_SERIES,
1764  STR_AUTH_FIELD_TITLE,
1765  STR_AUTH_FIELD_TYPE,
1766  STR_AUTH_FIELD_VOLUME,
1767  STR_AUTH_FIELD_YEAR,
1768  STR_AUTH_FIELD_URL,
1769  STR_AUTH_FIELD_CUSTOM1,
1770  STR_AUTH_FIELD_CUSTOM2,
1771  STR_AUTH_FIELD_CUSTOM3,
1772  STR_AUTH_FIELD_CUSTOM4,
1773  STR_AUTH_FIELD_CUSTOM5,
1774  STR_AUTH_FIELD_ISBN
1775  };
1776 }
1777 
1779  : SfxTabPage(pParent, "modules/swriter/ui/tocentriespage.ui", "TocEntriesPage", &rAttrSet)
1780  , sDelimStr(SwResId(STR_DELIM))
1781  , sNoCharStyle(SwResId(STR_NO_CHAR_STYLE))
1782  , m_pCurrentForm(nullptr)
1783  , bInLevelHdl(false)
1784  , m_xTypeFT(m_xBuilder->weld_label("typeft"))
1785  , m_xLevelFT(m_xBuilder->weld_label("levelft"))
1786  , m_xLevelLB(m_xBuilder->weld_tree_view("level"))
1787  , m_xAllLevelsPB(m_xBuilder->weld_button("all"))
1788  , m_xEntryNoPB(m_xBuilder->weld_button("chapterno"))
1789  , m_xEntryPB(m_xBuilder->weld_button("entrytext"))
1790  , m_xTabPB(m_xBuilder->weld_button("tabstop"))
1791  , m_xChapterInfoPB(m_xBuilder->weld_button("chapterinfo"))
1792  , m_xPageNoPB(m_xBuilder->weld_button("pageno"))
1793  , m_xHyperLinkPB(m_xBuilder->weld_button("hyperlink"))
1794  , m_xAuthFieldsLB(m_xBuilder->weld_combo_box("authfield"))
1795  , m_xAuthInsertPB(m_xBuilder->weld_button("insert"))
1796  , m_xAuthRemovePB(m_xBuilder->weld_button("remove"))
1797  , m_xCharStyleLB(m_xBuilder->weld_combo_box("charstyle"))
1798  , m_xEditStylePB(m_xBuilder->weld_button("edit"))
1799  , m_xChapterEntryFT(m_xBuilder->weld_label("chapterentryft"))
1800  , m_xChapterEntryLB(m_xBuilder->weld_combo_box("chapterentry"))
1801  , m_xNumberFormatFT(m_xBuilder->weld_label("numberformatft"))
1802  , m_xNumberFormatLB(m_xBuilder->weld_combo_box("numberformat"))
1803  , m_xEntryOutlineLevelFT(m_xBuilder->weld_label("entryoutlinelevelft"))
1804  , m_xEntryOutlineLevelNF(m_xBuilder->weld_spin_button("entryoutlinelevel"))
1805  , m_xFillCharFT(m_xBuilder->weld_label("fillcharft"))
1806  , m_xFillCharCB(m_xBuilder->weld_combo_box("fillchar"))
1807  , m_xTabPosFT(m_xBuilder->weld_label("tabstopposft"))
1808  , m_xTabPosMF(m_xBuilder->weld_metric_spin_button("tabstoppos", FieldUnit::CM))
1809  , m_xAutoRightCB(m_xBuilder->weld_check_button("alignright"))
1810  , m_xFormatFrame(m_xBuilder->weld_widget("formatframe"))
1811  , m_xMainEntryStyleFT(m_xBuilder->weld_label("mainstyleft"))
1812  , m_xMainEntryStyleLB(m_xBuilder->weld_combo_box("mainstyle"))
1813  , m_xAlphaDelimCB(m_xBuilder->weld_check_button("alphadelim"))
1814  , m_xCommaSeparatedCB(m_xBuilder->weld_check_button("commasep"))
1815  , m_xRelToStyleCB(m_xBuilder->weld_check_button("reltostyle"))
1816  , m_xSortingFrame(m_xBuilder->weld_widget("sortingframe"))
1817  , m_xSortDocPosRB(m_xBuilder->weld_radio_button("sortpos"))
1818  , m_xSortContentRB(m_xBuilder->weld_radio_button("sortcontents"))
1819  , m_xSortKeyFrame(m_xBuilder->weld_widget("sortkeyframe"))
1820  , m_xFirstKeyLB(m_xBuilder->weld_combo_box("key1lb"))
1821  , m_xFirstSortUpRB(m_xBuilder->weld_radio_button("up1cb"))
1822  , m_xFirstSortDownRB(m_xBuilder->weld_radio_button("down1cb"))
1823  , m_xSecondKeyLB(m_xBuilder->weld_combo_box("key2lb"))
1824  , m_xSecondSortUpRB(m_xBuilder->weld_radio_button("up2cb"))
1825  , m_xSecondSortDownRB(m_xBuilder->weld_radio_button("down2cb"))
1826  , m_xThirdKeyLB(m_xBuilder->weld_combo_box("key3lb"))
1827  , m_xThirdSortUpRB(m_xBuilder->weld_radio_button("up3cb"))
1828  , m_xThirdSortDownRB(m_xBuilder->weld_radio_button("down3cb"))
1829  , m_xTokenWIN(new SwTokenWindow(m_xBuilder->weld_container("token")))
1830 {
1831  const OUString sNoCharSortKey(SwResId(STR_NOSORTKEY));
1832 
1833  sAuthTypeStr = m_xTypeFT->get_label();
1834  sLevelStr = m_xLevelFT->get_label();
1835  m_xAuthFieldsLB->make_sorted();
1836  m_xTokenWIN->SetTabPage(this);
1837 
1839  aLastTOXType.nIndex = 0;
1840 
1842  m_xEntryNoPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1843  m_xEntryPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1844  m_xChapterInfoPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1845  m_xPageNoPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1846  m_xTabPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1847  m_xHyperLinkPB->connect_clicked(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
1848  m_xEditStylePB->connect_clicked(LINK(this, SwTOXEntryTabPage, EditStyleHdl));
1849  m_xLevelLB->connect_changed(LINK(this, SwTOXEntryTabPage, LevelHdl));
1850  m_xTokenWIN->SetButtonSelectedHdl(LINK(this, SwTOXEntryTabPage, TokenSelectedHdl));
1851  m_xTokenWIN->SetModifyHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl));
1852  m_xCharStyleLB->connect_changed(LINK(this, SwTOXEntryTabPage, StyleSelectHdl));
1853  m_xCharStyleLB->append_text(sNoCharStyle);
1854  m_xChapterEntryLB->connect_changed(LINK(this, SwTOXEntryTabPage, ChapterInfoHdl));
1855  m_xEntryOutlineLevelNF->connect_value_changed(LINK(this, SwTOXEntryTabPage, ChapterInfoOutlineHdl));
1856  m_xNumberFormatLB->connect_changed(LINK(this, SwTOXEntryTabPage, NumberFormatHdl));
1857 
1858  m_xTabPosMF->connect_value_changed(LINK(this, SwTOXEntryTabPage, TabPosHdl));
1859  m_xFillCharCB->connect_changed(LINK(this, SwTOXEntryTabPage, FillCharHdl));
1860  m_xAutoRightCB->connect_toggled(LINK(this, SwTOXEntryTabPage, AutoRightHdl));
1861  m_xAuthInsertPB->connect_clicked(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl));
1862  m_xAuthRemovePB->connect_clicked(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl));
1863  m_xSortDocPosRB->connect_toggled(LINK(this, SwTOXEntryTabPage, SortKeyHdl));
1864  m_xSortContentRB->connect_toggled(LINK(this, SwTOXEntryTabPage, SortKeyHdl));
1865  m_xAllLevelsPB->connect_clicked(LINK(this, SwTOXEntryTabPage, AllLevelsHdl));
1866 
1867  m_xAlphaDelimCB->connect_toggled(LINK(this, SwTOXEntryTabPage, ModifyClickHdl));
1868  m_xCommaSeparatedCB->connect_toggled(LINK(this, SwTOXEntryTabPage, ModifyClickHdl));
1869  m_xRelToStyleCB->connect_toggled(LINK(this, SwTOXEntryTabPage, ModifyClickHdl));
1870 
1871  FieldUnit aMetric = ::GetDfltMetric(false);
1872  ::SetFieldUnit(*m_xTabPosMF, aMetric);
1873 
1874  m_xSortDocPosRB->set_active(true);
1875 
1876  m_xFillCharCB->set_entry_max_length(1);
1877  m_xFillCharCB->append_text(OUString(' '));
1878  m_xFillCharCB->append_text(OUString('.'));
1879  m_xFillCharCB->append_text(OUString('-'));
1880  m_xFillCharCB->append_text(OUString('_'));
1881  m_xFillCharCB->append_text(OUString(u'\x2024')); // ONE DOT LEADER
1882  m_xFillCharCB->append_text(OUString(u'\x2025')); // TWO DOT LEADER
1883  m_xFillCharCB->append_text(OUString(u'\x2026')); // HORIZONTAL ELLIPSIS
1884 
1885  m_xEditStylePB->set_sensitive(false);
1886 
1887  //fill the types in
1888  for (sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i)
1889  {
1890  OUString sId(OUString::number(i));
1891  m_xAuthFieldsLB->append(sId, SwResId(STR_AUTH_FIELD_ARY[i]));
1892  }
1893 
1894  m_xFirstKeyLB->append(OUString::number(USHRT_MAX), sNoCharSortKey);
1895  m_xSecondKeyLB->append(OUString::number(USHRT_MAX), sNoCharSortKey);
1896  m_xThirdKeyLB->append(OUString::number(USHRT_MAX), sNoCharSortKey);
1897 
1898  for (sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i)
1899  {
1900  const OUString sTmp(m_xAuthFieldsLB->get_text(i));
1901  const OUString sEntryData(m_xAuthFieldsLB->get_id(i));
1902  m_xFirstKeyLB->append(sEntryData, sTmp);
1903  m_xSecondKeyLB->append(sEntryData, sTmp);
1904  m_xThirdKeyLB->append(sEntryData, sTmp);
1905  }
1906  m_xFirstKeyLB->set_active(0);
1907  m_xSecondKeyLB->set_active(0);
1908  m_xThirdKeyLB->set_active(0);
1909 
1910  //lock size
1911  Size aPrefSize(m_xContainer->get_preferred_size());
1912  m_xContainer->set_size_request(aPrefSize.Width(), aPrefSize.Height());
1913 }
1914 
1916 {
1917  disposeOnce();
1918 }
1919 
1921 {
1922  m_xTokenWIN.reset();
1924 }
1925 
1927 {
1928  OnModify(true);
1929 }
1930 
1932 {
1933  OnModify(false);
1934 }
1935 
1936 // bAllLevels is used as signal to change all levels of the example
1937 void SwTOXEntryTabPage::OnModify(bool bAllLevels)
1938 {
1939  UpdateDescriptor();
1940 
1941  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1942  if (pTOXDlg)
1943  {
1944  sal_uInt16 nCurLevel = m_xLevelLB->get_selected_index() + 1;
1945  if (aLastTOXType.eType == TOX_CONTENT && bAllLevels)
1946  nCurLevel = USHRT_MAX;
1947  pTOXDlg->CreateOrUpdateExample(
1948  pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_ENTRY, nCurLevel);
1949  }
1950 }
1951 
1953 {
1954  // nothing to do
1955  return true;
1956 }
1957 
1959 {
1960  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1961  const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
1962  m_pCurrentForm = pTOXDlg->GetForm(aCurType);
1963  if(TOX_INDEX == aCurType.eType)
1964  {
1965  SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
1966  const OUString& sMainEntryCharStyle = rDesc.GetMainEntryCharStyle();
1967  if(!sMainEntryCharStyle.isEmpty())
1968  {
1969  if (m_xMainEntryStyleLB->find_text(sMainEntryCharStyle) == -1)
1970  m_xMainEntryStyleLB->append_text(sMainEntryCharStyle);
1971  m_xMainEntryStyleLB->set_active_text(sMainEntryCharStyle);
1972  }
1973  else
1974  m_xMainEntryStyleLB->set_active_text(sNoCharStyle);
1975  m_xAlphaDelimCB->set_active( bool(rDesc.GetIndexOptions() & SwTOIOptions::AlphaDelimiter) );
1976  }
1977  m_xRelToStyleCB->set_active(m_pCurrentForm->IsRelTabPos());
1979 }
1980 
1982 {
1983  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
1984  const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
1985 
1986  m_pCurrentForm = pTOXDlg->GetForm(aCurType);
1987  if( !( aLastTOXType == aCurType ))
1988  {
1989  bool bToxIsAuthorities = TOX_AUTHORITIES == aCurType.eType;
1990  bool bToxIsIndex = TOX_INDEX == aCurType.eType;
1991  bool bToxIsContent = TOX_CONTENT == aCurType.eType;
1992  bool bToxSupportsLinks = TOX_CONTENT == aCurType.eType ||
1993  TOX_ILLUSTRATIONS == aCurType.eType ||
1994  TOX_TABLES == aCurType.eType ||
1995  TOX_OBJECTS == aCurType.eType ||
1996  TOX_USER == aCurType.eType;
1997 
1998  m_xLevelLB->clear();
1999  for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++)
2000  {
2001  if(bToxIsAuthorities)
2003  static_cast<ToxAuthorityType>(i - 1)) );
2004  else if( bToxIsIndex )
2005  {
2006  if(i == 1)
2007  m_xLevelLB->append_text( sDelimStr );
2008  else
2009  m_xLevelLB->append_text( OUString::number(i - 1) );
2010  }
2011  else
2012  m_xLevelLB->append_text(OUString::number(i));
2013  }
2014  if(bToxIsAuthorities)
2015  {
2016  SwWrtShell& rSh = pTOXDlg->GetWrtShell();
2017  const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
2018  rSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
2019  if(pFType)
2020  {
2021  if(pFType->IsSortByDocument())
2022  m_xSortDocPosRB->set_active(true);
2023  else
2024  {
2025  m_xSortContentRB->set_active(true);
2026  const sal_uInt16 nKeyCount = pFType->GetSortKeyCount();
2027  if(0 < nKeyCount)
2028  {
2029  const SwTOXSortKey* pKey = pFType->GetSortKey(0);
2030  m_xFirstKeyLB->set_active_id(OUString::number(pKey->eField));
2031  m_xFirstSortUpRB->set_active(pKey->bSortAscending);
2032  m_xFirstSortDownRB->set_active(!pKey->bSortAscending);
2033  }
2034  if(1 < nKeyCount)
2035  {
2036  const SwTOXSortKey* pKey = pFType->GetSortKey(1);
2037  m_xSecondKeyLB->set_active_id(OUString::number(pKey->eField));
2038  m_xSecondSortUpRB->set_active(pKey->bSortAscending);
2039  m_xSecondSortDownRB->set_active(!pKey->bSortAscending);
2040  }
2041  if(2 < nKeyCount)
2042  {
2043  const SwTOXSortKey* pKey = pFType->GetSortKey(2);
2044  m_xThirdKeyLB->set_active_id(OUString::number(pKey->eField));
2045  m_xThirdSortUpRB->set_active(pKey->bSortAscending);
2046  m_xThirdSortDownRB->set_active(!pKey->bSortAscending);
2047  }
2048  }
2049  }
2050  SortKeyHdl(m_xSortDocPosRB->get_active() ? *m_xSortDocPosRB : *m_xSortContentRB);
2051  m_xLevelFT->set_label(sAuthTypeStr);
2052  }
2053  else
2054  m_xLevelFT->set_label(sLevelStr);
2055 
2056  m_xLevelLB->select(bToxIsIndex ? 1 : 0);
2057 
2058  //show or hide controls
2059  m_xEntryNoPB->set_visible(bToxIsContent);
2060  m_xHyperLinkPB->set_visible(bToxSupportsLinks);
2061  m_xRelToStyleCB->set_visible(!bToxIsAuthorities);
2062  m_xChapterInfoPB->set_visible(!bToxIsContent && !bToxIsAuthorities);
2063  m_xEntryPB->set_visible(!bToxIsAuthorities);
2064  m_xPageNoPB->set_visible(!bToxIsAuthorities);
2065  m_xAuthFieldsLB->set_visible(bToxIsAuthorities);
2066  m_xAuthInsertPB->set_visible(bToxIsAuthorities);
2067  m_xAuthRemovePB->set_visible(bToxIsAuthorities);
2068 
2069  m_xFormatFrame->set_visible(!bToxIsAuthorities);
2070 
2071  m_xSortingFrame->set_visible(bToxIsAuthorities);
2072  m_xSortKeyFrame->set_visible(bToxIsAuthorities);
2073 
2074  m_xMainEntryStyleFT->set_visible(bToxIsIndex);
2075  m_xMainEntryStyleLB->set_visible(bToxIsIndex);
2076  m_xAlphaDelimCB->set_visible(bToxIsIndex);
2077  m_xCommaSeparatedCB->set_visible(bToxIsIndex);
2078  }
2079  aLastTOXType = aCurType;
2080 
2081  //invalidate PatternWindow
2082  m_xTokenWIN->SetInvalid();
2083  LevelHdl(*m_xLevelLB);
2084 }
2085 
2087 {
2088  WriteBackLevel();
2089  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
2090  SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aLastTOXType);
2092  {
2093  const OUString sTemp(m_xMainEntryStyleLB->get_active_text());
2094  rDesc.SetMainEntryCharStyle(sNoCharStyle == sTemp ? OUString(): sTemp);
2096  if (m_xAlphaDelimCB->get_active())
2097  nIdxOptions |= SwTOIOptions::AlphaDelimiter;
2098  rDesc.SetIndexOptions(nIdxOptions);
2099  }
2100  else if (TOX_AUTHORITIES == aLastTOXType.eType)
2101  {
2102  rDesc.SetSortByDocument(m_xSortDocPosRB->get_active());
2103  SwTOXSortKey aKey1, aKey2, aKey3;
2104  aKey1.eField = static_cast<ToxAuthorityField>(m_xFirstKeyLB->get_active_id().toInt32());
2105  aKey1.bSortAscending = m_xFirstSortUpRB->get_active();
2106  aKey2.eField = static_cast<ToxAuthorityField>(m_xSecondKeyLB->get_active_id().toInt32());
2107  aKey2.bSortAscending = m_xSecondSortUpRB->get_active();
2108  aKey3.eField = static_cast<ToxAuthorityField>(m_xThirdKeyLB->get_active_id().toInt32());
2109  aKey3.bSortAscending = m_xThirdSortUpRB->get_active();
2110 
2111  rDesc.SetSortKeys(aKey1, aKey2, aKey3);
2112  }
2113  SwForm* pCurrentForm = pTOXDlg->GetForm(aLastTOXType);
2114  if (m_xRelToStyleCB->get_visible())
2115  pCurrentForm->SetRelTabPos(m_xRelToStyleCB->get_active());
2116  if (m_xCommaSeparatedCB->get_visible())
2117  pCurrentForm->SetCommaSeparated(m_xCommaSeparatedCB->get_active());
2118 }
2119 
2121 {
2122  UpdateDescriptor();
2123  return DeactivateRC::LeavePage;
2124 }
2125 
2127 {
2128  return VclPtr<SwTOXEntryTabPage>::Create(pParent, *rAttrSet);
2129 }
2130 
2132 {
2133  if (m_xCharStyleLB->get_active() != -1)
2134  {
2135  SfxStringItem aStyle(SID_STYLE_EDIT, m_xCharStyleLB->get_active_text());
2136  SfxUInt16Item aFamily(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Char));
2137  static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell().
2138  GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT,
2139  SfxCallMode::SYNCHRON,
2140  { &aStyle, &aFamily });
2141  }
2142 }
2143 
2144 IMPL_LINK(SwTOXEntryTabPage, RemoveInsertAuthHdl, weld::Button&, rButton, void)
2145 {
2146  bool bInsert = &rButton == m_xAuthInsertPB.get();
2147  if(bInsert)
2148  {
2149  sal_Int32 nSelPos = m_xAuthFieldsLB->get_active();
2150  const OUString sToInsert(m_xAuthFieldsLB->get_active_text());
2151  SwFormToken aInsert(TOKEN_AUTHORITY);
2152  aInsert.nAuthorityField = m_xAuthFieldsLB->get_id(nSelPos).toUInt32();
2153  m_xTokenWIN->InsertAtSelection(aInsert);
2154  m_xAuthFieldsLB->remove_text(sToInsert);
2155  m_xAuthFieldsLB->set_active(nSelPos ? nSelPos - 1 : 0);
2156  }
2157  else
2158  {
2159  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2160  OSL_ENSURE(WindowType::EDIT != pCtrl->GetType(), "Remove should be disabled");
2161  if (WindowType::EDIT != pCtrl->GetType())
2162  {
2163  //fill it into the ListBox
2164  const SwFormToken& rToken = static_cast<SwTOXButton*>(pCtrl)->GetFormToken();
2165  PreTokenButtonRemoved(rToken);
2166  m_xTokenWIN->RemoveControl(static_cast<SwTOXButton*>(pCtrl));
2167  }
2168  }
2169  ModifyHdl(nullptr);
2170 }
2171 
2173 {
2174  //fill it into the ListBox
2175  sal_uInt32 nData = rToken.nAuthorityField;
2176  m_xAuthFieldsLB->append(OUString::number(nData), SwResId(STR_AUTH_FIELD_ARY[nData]));
2177 }
2178 
2180 {
2181  m_xAllLevelsPB->grab_focus();
2182 }
2183 
2185 {
2186  if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
2187  {
2188  const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
2189  vcl::KeyCode aCode = rKEvt.GetKeyCode();
2190  if ( (aCode.GetCode() == KEY_F4) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
2191  {
2192  if (SwTOXWidget* pActiveControl = m_xTokenWIN->GetActiveControl())
2193  {
2194  pActiveControl->GrabFocus();
2195  }
2196  }
2197 
2198  }
2199 
2200  return SfxTabPage::EventNotify(rNEvt);
2201 }
2202 
2203 // This function initializes the default value in the Token
2204 // put here the UI dependent initializations
2205 IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, weld::Button&, rBtn, void)
2206 {
2207  OUString sText;
2208  FormTokenType eTokenType = TOKEN_ENTRY_NO;
2209  OUString sCharStyle;
2210  sal_uInt16 nChapterFormat = CF_NUMBER; // i89791
2211  if (&rBtn == m_xEntryNoPB.get())
2212  {
2213  sText = SwForm::GetFormEntryNum();
2214  eTokenType = TOKEN_ENTRY_NO;
2215  }
2216  else if (&rBtn == m_xEntryPB.get())
2217  {
2218  if( TOX_CONTENT == m_pCurrentForm->GetTOXType() )
2219  {
2220  sText = SwForm::GetFormEntryText();
2221  eTokenType = TOKEN_ENTRY_TEXT;
2222  }
2223  else
2224  {
2225  sText = SwForm::GetFormEntry();
2226  eTokenType = TOKEN_ENTRY;
2227  }
2228  }
2229  else if (&rBtn == m_xChapterInfoPB.get())
2230  {
2231  sText = SwForm::GetFormChapterMark();
2232  eTokenType = TOKEN_CHAPTER_INFO;
2233  nChapterFormat = CF_NUM_NOPREPST_TITLE; // i89791
2234  }
2235  else if (&rBtn == m_xPageNoPB.get())
2236  {
2237  sText = SwForm::GetFormPageNums();
2238  eTokenType = TOKEN_PAGE_NUMS;
2239  }
2240  else if (&rBtn == m_xHyperLinkPB.get())
2241  {
2242  sText = SwForm::GetFormLinkStt();
2243  eTokenType = TOKEN_LINK_START;
2244  sCharStyle = SwResId(STR_POOLCHR_TOXJUMP);
2245  }
2246  else if (&rBtn == m_xTabPB.get())
2247  {
2248  sText = SwForm::GetFormTab();
2249  eTokenType = TOKEN_TAB_STOP;
2250  }
2251  SwFormToken aInsert(eTokenType);
2252  aInsert.sCharStyleName = sCharStyle;
2253  aInsert.nTabStopPosition = 0;
2254  aInsert.nChapterFormat = nChapterFormat; // i89791
2255  m_xTokenWIN->InsertAtSelection(aInsert);
2256  ModifyHdl(nullptr);
2257 }
2258 
2260 {
2261  //get current level
2262  //write it into all levels
2263  if(m_xTokenWIN->IsValid())
2264  {
2265  const OUString sNewToken = m_xTokenWIN->GetPattern();
2266  for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++)
2267  m_pCurrentForm->SetPattern(i, sNewToken);
2268 
2269  OnModify(true);
2270  }
2271 }
2272 
2274 {
2275  if(m_xTokenWIN->IsValid())
2276  {
2277  const OUString sNewToken = m_xTokenWIN->GetPattern();
2278  const sal_uInt16 nLastLevel = m_xTokenWIN->GetLastLevel();
2279  if(nLastLevel != USHRT_MAX)
2280  m_pCurrentForm->SetPattern(nLastLevel + 1, sNewToken);
2281  }
2282 }
2283 
2285 {
2286  if(bInLevelHdl)
2287  return;
2288  bInLevelHdl = true;
2289  WriteBackLevel();
2290 
2291  const sal_uInt16 nLevel = rBox.get_selected_index();
2292  m_xTokenWIN->SetForm(*m_pCurrentForm, nLevel);
2293  if(TOX_AUTHORITIES == m_pCurrentForm->GetTOXType())
2294  {
2295  //fill the types in
2296  m_xAuthFieldsLB->clear();
2297  for( sal_uInt32 i = 0; i < AUTH_FIELD_END; i++)
2298  {
2299  m_xAuthFieldsLB->append(OUString::number(i), SwResId(STR_AUTH_FIELD_ARY[i]));
2300  }
2301 
2302  // #i21237#
2303  SwFormTokens aPattern = m_pCurrentForm->GetPattern(nLevel + 1);
2304 
2305  for(const auto& aToken : aPattern)
2306  {
2307  if(TOKEN_AUTHORITY == aToken.eTokenType)
2308  {
2309  sal_uInt32 nSearch = aToken.nAuthorityField;
2310  int nLstBoxPos = m_xAuthFieldsLB->find_id(OUString::number(nSearch));
2311  OSL_ENSURE(nLstBoxPos != -1, "Entry not found?");
2312  m_xAuthFieldsLB->remove(nLstBoxPos);
2313  }
2314  }
2315  m_xAuthFieldsLB->set_active(0);
2316  }
2317  bInLevelHdl = false;
2318  rBox.grab_focus();
2319 }
2320 
2322 {
2323  bool bEnable = m_xSortContentRB->get_active();
2324  m_xSortKeyFrame->set_sensitive(bEnable);
2325 }
2326 
2327 IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken&, rToken, void)
2328 {
2329  if (!rToken.sCharStyleName.isEmpty())
2330  m_xCharStyleLB->set_active_text(rToken.sCharStyleName);
2331  else
2332  m_xCharStyleLB->set_active_text(sNoCharStyle);
2333 
2334  const OUString sEntry = m_xCharStyleLB->get_active_text();
2335  m_xEditStylePB->set_sensitive(sEntry != sNoCharStyle);
2336 
2337  if(rToken.eTokenType == TOKEN_CHAPTER_INFO)
2338  {
2339 //---> i89791
2340  switch(rToken.nChapterFormat)
2341  {
2342  default:
2343  m_xChapterEntryLB->set_active(-1);//to alert the user
2344  break;
2345  case CF_NUM_NOPREPST_TITLE:
2346  m_xChapterEntryLB->set_active(0);
2347  break;
2348  case CF_TITLE:
2349  m_xChapterEntryLB->set_active(1);
2350  break;
2351  case CF_NUMBER_NOPREPST:
2352  m_xChapterEntryLB->set_active(2);
2353  break;
2354  }
2355 //i53420
2356 
2357  m_xEntryOutlineLevelNF->set_value(rToken.nOutlineLevel);
2358  }
2359 
2360 //i53420
2361  if(rToken.eTokenType == TOKEN_ENTRY_NO)
2362  {
2363  m_xEntryOutlineLevelNF->set_value(rToken.nOutlineLevel);
2364  const sal_uInt16 nFormat =
2365  rToken.nChapterFormat == CF_NUM_NOPREPST_TITLE ? 1 : 0;
2366  m_xNumberFormatLB->set_active(nFormat);
2367  }
2368 
2369  bool bTabStop = TOKEN_TAB_STOP == rToken.eTokenType;
2370  m_xFillCharFT->set_visible(bTabStop);
2371  m_xFillCharCB->set_visible(bTabStop);
2372  m_xTabPosFT->set_visible(bTabStop);
2373  m_xTabPosMF->set_visible(bTabStop);
2374  m_xAutoRightCB->set_visible(bTabStop);
2375  m_xAutoRightCB->set_sensitive(bTabStop);
2376  if(bTabStop)
2377  {
2378  m_xTabPosMF->set_value(m_xTabPosMF->normalize(rToken.nTabStopPosition), FieldUnit::TWIP);
2379  m_xAutoRightCB->set_active(SvxTabAdjust::End == rToken.eTabAlign);
2380  m_xFillCharCB->set_entry_text(OUString(rToken.cTabFillChar));
2381  m_xTabPosFT->set_sensitive(!m_xAutoRightCB->get_active());
2382  m_xTabPosMF->set_sensitive(!m_xAutoRightCB->get_active());
2383  }
2384  else
2385  {
2386  m_xTabPosMF->set_sensitive(false);
2387  }
2388 
2389  bool bIsChapterInfo = rToken.eTokenType == TOKEN_CHAPTER_INFO;
2390  bool bIsEntryNumber = rToken.eTokenType == TOKEN_ENTRY_NO;
2391  m_xChapterEntryFT->set_visible( bIsChapterInfo );
2392  m_xChapterEntryLB->set_visible( bIsChapterInfo );
2393  m_xEntryOutlineLevelFT->set_visible( bIsChapterInfo || bIsEntryNumber );
2394  m_xEntryOutlineLevelNF->set_visible( bIsChapterInfo || bIsEntryNumber );
2395  m_xNumberFormatFT->set_visible( bIsEntryNumber );
2396  m_xNumberFormatLB->set_visible( bIsEntryNumber );
2397 
2398  //now enable the visible buttons
2399  //- inserting the same type of control is not allowed
2400  //- some types of controls can only appear once (EntryText EntryNumber)
2401 
2402  if (m_xEntryNoPB->get_visible())
2403  {
2404  m_xEntryNoPB->set_sensitive(TOKEN_ENTRY_NO != rToken.eTokenType );
2405  }
2406  if (m_xEntryPB->get_visible())
2407  {
2408  m_xEntryPB->set_sensitive(TOKEN_ENTRY_TEXT != rToken.eTokenType &&
2409  !m_xTokenWIN->Contains(TOKEN_ENTRY_TEXT)
2410  && !m_xTokenWIN->Contains(TOKEN_ENTRY));
2411  }
2412 
2413  if (m_xChapterInfoPB->get_visible())
2414  {
2415  m_xChapterInfoPB->set_sensitive(TOKEN_CHAPTER_INFO != rToken.eTokenType);
2416  }
2417  if (m_xPageNoPB->get_visible())
2418  {
2419  m_xPageNoPB->set_sensitive(TOKEN_PAGE_NUMS != rToken.eTokenType &&
2420  !m_xTokenWIN->Contains(TOKEN_PAGE_NUMS));
2421  }
2422  if (m_xTabPB->get_visible())
2423  {
2424  m_xTabPB->set_sensitive(!bTabStop);
2425  }
2426  if (m_xHyperLinkPB->get_visible())
2427  {
2428  m_xHyperLinkPB->set_sensitive(TOKEN_LINK_START != rToken.eTokenType &&
2429  TOKEN_LINK_END != rToken.eTokenType);
2430  }
2431  //table of authorities
2432  if (m_xAuthInsertPB->get_visible())
2433  {
2434  bool bText = TOKEN_TEXT == rToken.eTokenType;
2435  m_xAuthInsertPB->set_sensitive(bText && !m_xAuthFieldsLB->get_active_text().isEmpty());
2436  m_xAuthRemovePB->set_sensitive(!bText);
2437  }
2438 }
2439 
2440 IMPL_LINK(SwTOXEntryTabPage, StyleSelectHdl, weld::ComboBox&, rBox, void)
2441 {
2442  OUString sEntry = rBox.get_active_text();
2443  const sal_uInt16 nId = rBox.get_active_id().toUInt32();
2444  const bool bEqualsNoCharStyle = sEntry == sNoCharStyle;
2445  m_xEditStylePB->set_sensitive(!bEqualsNoCharStyle);
2446  if (bEqualsNoCharStyle)
2447  sEntry.clear();
2448  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2449  OSL_ENSURE(pCtrl, "no active control?");
2450  if(pCtrl)
2451  {
2452  if(WindowType::EDIT == pCtrl->GetType())
2453  static_cast<SwTOXEdit*>(pCtrl)->SetCharStyleName(sEntry, nId);
2454  else
2455  static_cast<SwTOXButton*>(pCtrl)->SetCharStyleName(sEntry, nId);
2456 
2457  }
2458  ModifyHdl(nullptr);
2459 }
2460 
2461 IMPL_LINK(SwTOXEntryTabPage, ChapterInfoHdl, weld::ComboBox&, rBox, void)
2462 {
2463  int nPos = rBox.get_active();
2464  if (nPos != -1)
2465  {
2466  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2467  OSL_ENSURE(pCtrl, "no active control?");
2468  if(pCtrl && WindowType::EDIT != pCtrl->GetType())
2469  static_cast<SwTOXButton*>(pCtrl)->SetChapterInfo(nPos);
2470  ModifyHdl(nullptr);
2471  }
2472 }
2473 
2474 IMPL_LINK(SwTOXEntryTabPage, ChapterInfoOutlineHdl, weld::SpinButton&, rEdit, void)
2475 {
2476  const sal_uInt16 nLevel = rEdit.get_value();
2477 
2478  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2479  OSL_ENSURE(pCtrl, "no active control?");
2480  if(pCtrl && WindowType::EDIT != pCtrl->GetType())
2481  static_cast<SwTOXButton*>(pCtrl)->SetOutlineLevel(nLevel);
2482 
2483  ModifyHdl(nullptr);
2484 }
2485 
2486 IMPL_LINK(SwTOXEntryTabPage, NumberFormatHdl, weld::ComboBox&, rBox, void)
2487 {
2488  const sal_Int32 nPos = rBox.get_active();
2489  if (nPos != -1)
2490  {
2491  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2492  OSL_ENSURE(pCtrl, "no active control?");
2493  if(pCtrl && WindowType::EDIT != pCtrl->GetType())
2494  {
2495  static_cast<SwTOXButton*>(pCtrl)->SetEntryNumberFormat(nPos);//i89791
2496  }
2497  ModifyHdl(nullptr);
2498  }
2499 }
2500 
2502 {
2503  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2504  OSL_ENSURE(pCtrl && WindowType::EDIT != pCtrl->GetType() &&
2505  TOKEN_TAB_STOP == static_cast<SwTOXButton*>(pCtrl)->GetFormToken().eTokenType,
2506  "no active style::TabStop control?");
2507  if( pCtrl && WindowType::EDIT != pCtrl->GetType() )
2508  {
2509  static_cast<SwTOXButton*>(pCtrl)->SetTabPosition( static_cast< SwTwips >(
2510  rEdit.denormalize(rEdit.get_value(FieldUnit::TWIP))));
2511  }
2512  ModifyHdl(nullptr);
2513 }
2514 
2515 IMPL_LINK(SwTOXEntryTabPage, FillCharHdl, weld::ComboBox&, rBox, void)
2516 {
2517  SwTOXWidget* pCtrl = m_xTokenWIN->GetActiveControl();
2518  OSL_ENSURE(pCtrl && WindowType::EDIT != pCtrl->GetType() &&
2519  TOKEN_TAB_STOP == static_cast<SwTOXButton*>(pCtrl)->GetFormToken().eTokenType,
2520  "no active style::TabStop control?");
2521  if (pCtrl && WindowType::EDIT != pCtrl->GetType())
2522  {
2523  sal_Unicode cSet;
2524  if (!rBox.get_active_text().isEmpty())
2525  cSet = rBox.get_active_text()[0];
2526  else
2527  cSet = ' ';
2528  static_cast<SwTOXButton*>(pCtrl)->SetFillChar( cSet );
2529  }
2530  ModifyHdl(nullptr);
2531 }
2532 
2533 IMPL_LINK(SwTOXEntryTabPage, AutoRightHdl, weld::ToggleButton&, rBox, void)
2534 {
2535  //the most right style::TabStop is usually right aligned
2536  SwTOXWidget* pCurCtrl = m_xTokenWIN->GetActiveControl();
2537  OSL_ENSURE(WindowType::EDIT != pCurCtrl->GetType() &&
2538  static_cast<SwTOXButton*>(pCurCtrl)->GetFormToken().eTokenType == TOKEN_TAB_STOP,
2539  "no style::TabStop selected!");
2540 
2541  const SwFormToken& rToken = static_cast<SwTOXButton*>(pCurCtrl)->GetFormToken();
2542  bool bChecked = rBox.get_active();
2543  if(rToken.eTokenType == TOKEN_TAB_STOP)
2544  static_cast<SwTOXButton*>(pCurCtrl)->SetTabAlign(
2545  bChecked ? SvxTabAdjust::End : SvxTabAdjust::Left);
2546  m_xTabPosFT->set_sensitive(!bChecked);
2547  m_xTabPosMF->set_sensitive(!bChecked);
2548  ModifyHdl(nullptr);
2549 }
2550 
2552 {
2553  SwDocShell* pDocSh = rSh.GetView().GetDocShell();
2554  ::FillCharStyleListBox(*m_xCharStyleLB, pDocSh, true, true);
2555  const OUString sDefault(SwResId(STR_POOLCOLL_STANDARD));
2556  for (int i = 0, nCount = m_xCharStyleLB->get_count(); i < nCount; ++i)
2557  {
2558  const OUString sEntry = m_xCharStyleLB->get_text(i);
2559  if(sDefault != sEntry)
2560  {
2561  m_xMainEntryStyleLB->append(m_xCharStyleLB->get_id(i), sEntry);
2562  }
2563  }
2565  RES_POOLCHR_IDX_MAIN_ENTRY, OUString()));
2566 }
2567 
2568 static const char* STR_TOKEN_ARY[] =
2569 {
2570  STR_TOKEN_ENTRY_NO,
2571  STR_TOKEN_ENTRY, //mapped from original STR_TOKEN_ENTRY_TEXT,
2572  STR_TOKEN_ENTRY,
2573  STR_TOKEN_TAB_STOP,
2574  nullptr,
2575  STR_TOKEN_PAGE_NUMS,
2576  STR_TOKEN_CHAPTER_INFO,
2577  STR_TOKEN_LINK_START,
2578  STR_TOKEN_LINK_END,
2579  STR_TOKEN_AUTHORITY
2580 };
2581 
2582 static const char* STR_TOKEN_HELP_ARY[] =
2583 {
2584  STR_TOKEN_HELP_ENTRY_NO,
2585  STR_TOKEN_HELP_ENTRY, // mapped from original STR_TOKEN_HELP_ENTRY_TEXT,
2586  STR_TOKEN_HELP_ENTRY,
2587  STR_TOKEN_HELP_TAB_STOP,
2588  STR_TOKEN_HELP_TEXT,
2589  STR_TOKEN_HELP_PAGE_NUMS,
2590  STR_TOKEN_HELP_CHAPTER_INFO,
2591  STR_TOKEN_HELP_LINK_START,
2592  STR_TOKEN_HELP_LINK_END,
2593  STR_TOKEN_HELP_AUTHORITY
2594 };
2595 
2596 SwTokenWindow::SwTokenWindow(std::unique_ptr<weld::Container> xParent)
2597  : m_pForm(nullptr)
2598  , m_nLevel(0)
2599  , m_bValid(false)
2600  , m_sCharStyle(SwResId(STR_CHARSTYLE))
2601  , m_pActiveCtrl(nullptr)
2602  , m_pParent(nullptr)
2603  , m_xParentWidget(std::move(xParent))
2604  , m_xBuilder(Application::CreateBuilder(m_xParentWidget.get(), "modules/swriter/ui/tokenwidget.ui"))
2605  , m_xContainer(m_xBuilder->weld_container("TokenWidget"))
2606  , m_xLeftScrollWin(m_xBuilder->weld_button("left"))
2607  , m_xCtrlParentWin(m_xBuilder->weld_container("ctrl"))
2608  , m_xScrollWin(m_xBuilder->weld_scrolled_window("scrollwin"))
2609  , m_xRightScrollWin(m_xBuilder->weld_button("right"))
2610 {
2611  m_xScrollWin->connect_hadjustment_changed(LINK(this, SwTokenWindow, ScrollHdl));
2612  m_xCtrlParentWin->set_size_request(-1, Edit::GetMinimumEditSize().Height());
2613  m_xCtrlParentWin->connect_size_allocate(LINK(this, SwTokenWindow, AdjustPositionsHdl));
2614 
2615  for (sal_uInt32 i = 0; i < TOKEN_END; ++i)
2616  {
2617  const char* pTextId = STR_TOKEN_ARY[i];
2618  if (pTextId)
2619  m_aButtonTexts[i] = SwResId(pTextId);
2620 
2621  const char* pHelpId = STR_TOKEN_HELP_ARY[i];
2622  m_aButtonHelpTexts[i] = SwResId(pHelpId);
2623  }
2624 
2625  m_sAccessibleName = SwResId(STR_STRUCTURE);
2626  m_sAdditionalAccnameString1 = SwResId(STR_ADDITIONAL_ACCNAME_STRING1);
2627  m_sAdditionalAccnameString2 = SwResId(STR_ADDITIONAL_ACCNAME_STRING2);
2628  m_sAdditionalAccnameString3 = SwResId(STR_ADDITIONAL_ACCNAME_STRING3);
2629 
2630  Link<weld::Button&,void> aLink(LINK(this, SwTokenWindow, ScrollBtnHdl));
2631  m_xLeftScrollWin->connect_clicked(aLink);
2632  m_xRightScrollWin->connect_clicked(aLink);
2633 }
2634 
2636 {
2637 }
2638 
2639 void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
2640 {
2641  SetActiveControl(nullptr);
2642  m_bValid = true;
2643 
2644  if (m_pForm)
2645  {
2646  //apply current level settings to the form
2647  m_aControlList.clear();
2648  }
2649 
2650  m_nLevel = nL;
2651  m_pForm = &rForm;
2652  //now the display
2653  if(m_nLevel < MAXLEVEL || rForm.GetTOXType() == TOX_AUTHORITIES)
2654  {
2655  // #i21237#
2656  SwFormTokens aPattern = m_pForm->GetPattern(m_nLevel + 1);
2657  bool bLastWasText = false; //assure alternating text - code - text
2658 
2659  SwTOXWidget* pSetActiveControl = nullptr;
2660  for (const auto& aToken : aPattern) // #i21237#
2661  {
2662  if(TOKEN_TEXT == aToken.eTokenType)
2663  {
2664  SAL_WARN_IF(bLastWasText, "sw", "text following text is invalid");
2665  SwTOXWidget* pCtrl = InsertItem(aToken.sText, aToken);
2666  bLastWasText = true;
2667  if (!GetActiveControl())
2668  SetActiveControl(pCtrl);
2669  }
2670  else
2671  {
2672  if( !bLastWasText )
2673  {
2674  SwFormToken aTemp(TOKEN_TEXT);
2675  SwTOXWidget* pCtrl = InsertItem(OUString(), aTemp);
2676  if(!pSetActiveControl)
2677  pSetActiveControl = pCtrl;
2678  }
2679 
2680  OUString sForm;
2681  switch( aToken.eTokenType )
2682  {
2683  case TOKEN_ENTRY_NO: sForm = SwForm::GetFormEntryNum(); break;
2684  case TOKEN_ENTRY_TEXT: sForm = SwForm::GetFormEntryText(); break;
2685  case TOKEN_ENTRY: sForm = SwForm::GetFormEntry(); break;
2686  case TOKEN_TAB_STOP: sForm = SwForm::GetFormTab(); break;
2687  case TOKEN_PAGE_NUMS: sForm = SwForm::GetFormPageNums(); break;
2688  case TOKEN_CHAPTER_INFO: sForm = SwForm::GetFormChapterMark(); break;
2689  case TOKEN_LINK_START: sForm = SwForm::GetFormLinkStt(); break;
2690  case TOKEN_LINK_END: sForm = SwForm::GetFormLinkEnd(); break;
2691  case TOKEN_AUTHORITY: sForm = SwForm::GetFormAuth(); break;
2692  default:; //prevent warning
2693  }
2694 
2695  InsertItem( sForm, aToken );
2696  bLastWasText = false;
2697  }
2698  }
2699  if(!bLastWasText)
2700  {
2701  SwFormToken aTemp(TOKEN_TEXT);
2702  SwTOXWidget* pCtrl = InsertItem(OUString(), aTemp);
2703  if(!pSetActiveControl)
2704  pSetActiveControl = pCtrl;
2705  }
2706  SetActiveControl(pSetActiveControl);
2707  }
2708  AdjustScrolling();
2709 }
2710 
2712 {
2713  if (pSet != m_pActiveCtrl)
2714  {
2715  m_pActiveCtrl = pSet;
2716  if( m_pActiveCtrl )
2717  {
2719  //it must be a SwTOXEdit
2720  const SwFormToken* pFToken;
2721  if( WindowType::EDIT == m_pActiveCtrl->GetType() )
2722  pFToken = &static_cast<SwTOXEdit*>(m_pActiveCtrl)->GetFormToken();
2723  else
2724  pFToken = &static_cast<SwTOXButton*>(m_pActiveCtrl)->GetFormToken();
2725 
2726  SwFormToken aTemp( *pFToken );
2727  m_aButtonSelectedHdl.Call( aTemp );
2728  }
2729  }
2730 }
2731 
2732 SwTOXWidget* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& rToken)
2733 {
2734  SwTOXWidget* pRet = nullptr;
2735 
2736  if (TOKEN_TEXT == rToken.eTokenType)
2737  {
2738  SwTOXEdit* pEdit = new SwTOXEdit(this, rToken);
2739  pEdit->set_grid_left_attach(m_aControlList.size());
2740 
2741  m_aControlList.emplace_back(pEdit);
2742 
2743  pEdit->SetText(rText);
2744  sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT );
2745  OUString strName(m_sAccessibleName + OUString::number(nIndex));
2746  if ( nIndex == 1 )
2747  {
2748  /*Press left or right arrow to choose the structure controls*/
2749  strName += " (" + m_sAdditionalAccnameString2 + ", "
2750  /*Press Ctrl+Alt+A to move focus for more operations*/
2752  /*Press Ctrl+Alt+B to move focus back to the current structure control*/
2754  }
2755  pEdit->SetAccessibleName(strName);
2756  pEdit->AdjustSize();
2757  pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
2758  pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl));
2759  pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl));
2760  pEdit->Show();
2761  pRet = pEdit;
2762  }
2763  else
2764  {
2765  SwTOXButton* pButton = new SwTOXButton(this, rToken);
2766  pButton->set_grid_left_attach(m_aControlList.size());
2767 
2768  m_aControlList.emplace_back(pButton);
2769 
2770  pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl));
2771  pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl));
2772 
2773  if(TOKEN_AUTHORITY != rToken.eTokenType)
2774  pButton->SetText(m_aButtonTexts[rToken.eTokenType]);
2775  else
2776  {
2777  //use the first two chars as symbol
2779  static_cast<ToxAuthorityField>(rToken.nAuthorityField)));
2780  pButton->SetText(sTmp.copy(0, 2));
2781  }
2782 
2783  sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );
2784  OUString sAccName = m_aButtonHelpTexts[rToken.eTokenType];
2785  if ( nIndex )
2786  {
2787  sAccName += " " + OUString::number(nIndex);
2788  }
2789  pButton->SetAccessibleName( sAccName );
2790 
2791  pButton->Show();
2792  pRet = pButton;
2793  }
2794 
2795  return pRet;
2796 }
2797 
2799 {
2800  OSL_ENSURE(m_pActiveCtrl, "no active control!");
2801 
2802  if(!m_pActiveCtrl)
2803  return;
2804 
2805  SwFormToken aToInsertToken(rToken);
2806 
2807  if(TOKEN_LINK_START == aToInsertToken.eTokenType)
2808  {
2809  //determine if start or end of hyperlink is appropriate
2810  //eventually change a following link start into a link end
2811  // groups of LS LE should be ignored
2812  // <insert>
2813  //LS <insert>
2814  //LE <insert>
2815  //<insert> LS
2816  //<insert> LE
2817  //<insert>
2818  bool bPreStartLinkFound = false;
2819  bool bPreEndLinkFound = false;
2820 
2821  const SwTOXWidget* pControl = nullptr;
2822  const SwTOXWidget* pExchange = nullptr;
2823 
2824  auto it = m_aControlList.cbegin();
2825  for( ; it != m_aControlList.cend() && m_pActiveCtrl != it->get(); ++it )
2826  {
2827  pControl = it->get();
2828 
2829  if( WindowType::EDIT != pControl->GetType())
2830  {
2831  const SwFormToken& rNewToken =
2832  static_cast<const SwTOXButton*>(pControl)->GetFormToken();
2833 
2834  if( TOKEN_LINK_START == rNewToken.eTokenType )
2835  {
2836  bPreStartLinkFound = true;
2837  pExchange = nullptr;
2838  }
2839  else if(TOKEN_LINK_END == rNewToken.eTokenType)
2840  {
2841  if( bPreStartLinkFound )
2842  bPreStartLinkFound = false;
2843  else
2844  {
2845  bPreEndLinkFound = false;
2846  pExchange = pControl;
2847  }
2848  }
2849  }
2850  }
2851 
2852  bool bPostLinkStartFound = false;
2853 
2854  if(!bPreStartLinkFound && !bPreEndLinkFound)
2855  {
2856  for( ; it != m_aControlList.cend(); ++it )
2857  {
2858  pControl = it->get();
2859 
2860  if( pControl != m_pActiveCtrl &&
2861  WindowType::EDIT != pControl->GetType())
2862  {
2863  const SwFormToken& rNewToken =
2864  static_cast<const SwTOXButton*>(pControl)->GetFormToken();
2865 
2866  if( TOKEN_LINK_START == rNewToken.eTokenType )
2867  {
2868  if(bPostLinkStartFound)
2869  break;
2870  bPostLinkStartFound = true;
2871  pExchange = pControl;
2872  }
2873  else if(TOKEN_LINK_END == rNewToken.eTokenType )
2874  {
2875  if(bPostLinkStartFound)
2876  {
2877  bPostLinkStartFound = false;
2878  pExchange = nullptr;
2879  }
2880  break;
2881  }
2882  }
2883  }
2884  }
2885 
2886  if(bPreStartLinkFound)
2887  {
2888  aToInsertToken.eTokenType = TOKEN_LINK_END;
2889  aToInsertToken.sText = m_aButtonTexts[TOKEN_LINK_END];
2890  }
2891 
2892  if(bPostLinkStartFound)
2893  {
2894  OSL_ENSURE(pExchange, "no control to exchange?");
2895  if(pExchange)
2896  {
2897  const_cast<SwTOXButton*>(static_cast<const SwTOXButton*>(pExchange))->SetLinkEnd();
2898  const_cast<SwTOXButton*>(static_cast<const SwTOXButton*>(pExchange))->SetText(m_aButtonTexts[TOKEN_LINK_END]);
2899  }
2900  }
2901 
2902  if(bPreEndLinkFound)
2903  {
2904  OSL_ENSURE(pExchange, "no control to exchange?");
2905 
2906  if(pExchange)
2907  {
2908  const_cast<SwTOXButton*>(static_cast<const SwTOXButton*>(pExchange))->SetLinkStart();
2909  const_cast<SwTOXButton*>(static_cast<const SwTOXButton*>(pExchange))->SetText(m_aButtonTexts[TOKEN_LINK_START]);
2910  }
2911  }
2912  }
2913 
2914  //if the active control is text then insert a new button at the selection
2915  //else replace the button
2916  auto iterActive = std::find_if(m_aControlList.begin(), m_aControlList.end(),
2917  [this](const auto& rControl)
2918  {
2919  SwTOXWidget* pCtrl = rControl.get();
2920  return pCtrl == m_pActiveCtrl;
2921  });
2922 
2923  assert(iterActive != m_aControlList.end());
2924  if (iterActive == m_aControlList.end())
2925  return;
2926 
2927  if (WindowType::EDIT == m_pActiveCtrl->GetType())
2928  {
2929  ++iterActive;
2930 
2931  int nStartPos, nEndPos;
2932  static_cast<SwTOXEdit*>(m_pActiveCtrl)->get_selection_bounds(nStartPos, nEndPos);
2933 
2934  const OUString sEditText = static_cast<SwTOXEdit*>(m_pActiveCtrl)->GetText();
2935  const OUString sLeft = sEditText.copy( 0, std::min(nStartPos, nEndPos) );
2936  const OUString sRight = sEditText.copy( std::max(nStartPos, nEndPos) );
2937 
2938  static_cast<SwTOXEdit*>(m_pActiveCtrl)->SetText(sLeft);
2939  static_cast<SwTOXEdit*>(m_pActiveCtrl)->AdjustSize();
2940 
2941  SwFormToken aTmpToken(TOKEN_TEXT);
2942  SwTOXEdit* pEdit = new SwTOXEdit(this, aTmpToken);
2943  iterActive = m_aControlList.emplace(iterActive, pEdit);
2944 
2945  pEdit->SetText(sRight);
2946  sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT );
2947  OUString strName(m_sAccessibleName + OUString::number(nIndex));
2948  if ( nIndex == 1)
2949  {
2950  /*Press left or right arrow to choose the structure controls*/
2951  strName += " (" + m_sAdditionalAccnameString2 + ", "
2952  /*Press Ctrl+Alt+A to move focus for more operations*/
2954  /*Press Ctrl+Alt+B to move focus back to the current structure control*/
2956  }
2957  pEdit->SetAccessibleName(strName);
2958  pEdit->AdjustSize();
2959  pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
2960  pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl));
2961  pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl));
2962  pEdit->Show();
2963  }
2964  else
2965  {
2966  m_pActiveCtrl->Hide();
2967  m_pActiveCtrl = nullptr;
2968  iterActive = m_aControlList.erase(iterActive);
2969  }
2970 
2971  //now the new button
2972  SwTOXButton* pButton = new SwTOXButton(this, aToInsertToken);
2973  m_aControlList.emplace(iterActive, pButton);
2974 
2975  pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl));
2976  pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl));
2977 
2978  if (TOKEN_AUTHORITY != aToInsertToken.eTokenType)
2979  {
2980  pButton->SetText(m_aButtonTexts[aToInsertToken.eTokenType]);
2981  }
2982  else
2983  {
2984  //use the first two chars as symbol
2986  static_cast<ToxAuthorityField>(aToInsertToken.nAuthorityField)));
2987  pButton->SetText(sTmp.copy(0, 2));
2988  }
2989 
2990  pButton->Check();
2991  pButton->Show();
2992  SetActiveControl(pButton);
2993 
2994  AdjustPositions();
2995 }
2996 
2997 void SwTokenWindow::RemoveControl(const SwTOXButton* pDel, bool bInternalCall)
2998 {
2999  if (bInternalCall && TOX_AUTHORITIES == m_pForm->GetTOXType())
3001 
3002  auto it = std::find_if(m_aControlList.begin(), m_aControlList.end(),
3003  [pDel](const auto& rControl)
3004  {
3005  SwTOXWidget* pCtrl = rControl.get();
3006  return pCtrl == pDel;
3007  });
3008  assert(it != m_aControlList.end()); //Control does not exist!
3009  if (it == m_aControlList.end())
3010  return;
3011 
3012  // the two neighbours of the box must be merged
3013  // the properties of the right one will be lost
3014  assert(it != m_aControlList.begin() && it != m_aControlList.end() - 1); //Button at first or last position?
3015  if (it == m_aControlList.begin() || it == m_aControlList.end() - 1)
3016  return;
3017 
3018  auto itLeft = it, itRight = it;
3019  --itLeft;
3020  ++itRight;
3021  SwTOXWidget* pLeftEdit = itLeft->get();
3022  SwTOXWidget* pRightEdit = itRight->get();
3023 
3024  static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() +
3025  static_cast<SwTOXEdit*>(pRightEdit)->GetText());
3026  static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize();
3027 
3028  m_pActiveCtrl->Hide();
3029  m_pActiveCtrl = nullptr;
3030 
3031  m_aControlList.erase(itRight);
3032  m_aControlList.erase(it);
3033 
3034  SetActiveControl(pLeftEdit);
3035  AdjustPositions();
3036  m_aModifyHdl.Call(nullptr);
3037 }
3038 
3039 IMPL_LINK_NOARG(SwTokenWindow, AdjustPositionsHdl, const Size&, void)
3040 {
3041  AdjustScrolling();
3042 }
3043 
3045 {
3046  for (size_t i = 0; i < m_aControlList.size(); ++i)
3047  m_aControlList[i]->set_grid_left_attach(i);
3048  AdjustScrolling();
3049 }
3050 
3052 {
3053  m_xScrollWin->hadjustment_set_value(nOffset);
3054 }
3055 
3057 {
3058  AdjustScrolling();
3059 }
3060 
3062 {
3063  if (m_aControlList.size() > 1)
3064  {
3065  //validate scroll buttons
3066 
3067  auto nLeft = m_xScrollWin->hadjustment_get_value();
3068  auto nSpace = m_xScrollWin->hadjustment_get_page_size();
3069  auto nWidth = m_xScrollWin->hadjustment_get_upper();
3070 
3071  bool bEnable = nWidth > nSpace;
3072 
3073  //the active control must be visible
3074  if (bEnable && m_pActiveCtrl)
3075  {
3076  int x, y, width, height;
3077  m_pActiveCtrl->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
3078 
3079  if (x < nLeft || x + width > nLeft + nSpace)
3080  {
3081  MoveControls(x);
3082  nLeft = x;
3083  }
3084 
3085  m_xLeftScrollWin->set_sensitive(nLeft > 0);
3086  m_xRightScrollWin->set_sensitive(nLeft + nSpace < nWidth);
3087  }
3088  else
3089  {
3090  //if the control fits into the space then the first control must be at position 0
3091  m_xRightScrollWin->set_sensitive(false);
3092  m_xLeftScrollWin->set_sensitive(false);
3093  }
3094  }
3095 }
3096 
3097 IMPL_LINK(SwTokenWindow, ScrollBtnHdl, weld::Button&, rBtn, void)
3098 {
3099  if (m_aControlList.empty())
3100  return;
3101 
3102  const auto nSpace = m_xScrollWin->hadjustment_get_page_size();
3103  const auto nWidth = m_xScrollWin->hadjustment_get_upper();
3104  const auto nLeft = m_xScrollWin->hadjustment_get_value();
3105 
3106  long nMove = nLeft;
3107  if (&rBtn == m_xLeftScrollWin.get())
3108  {
3109  //find the first completely visible control (left edge visible)
3110  auto it = std::find_if(m_aControlList.begin(), m_aControlList.end(),
3111  [this, nLeft](const auto& rControl)
3112  {
3113  SwTOXWidget* pCtrl = rControl.get();
3114 
3115  int x, y, width, height;
3116  pCtrl->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
3117 
3118  return x >= nLeft;
3119  });
3120  if (it != m_aControlList.end())
3121  {
3122  if (it == m_aControlList.begin())
3123  {
3124  nMove = 0;
3125  }
3126  else
3127  {
3128  //move the left neighbor to the start position
3129  auto itLeft = it;
3130  --itLeft;
3131  SwTOXWidget* pLeft = itLeft->get();
3132 
3133  int x, y, width, height;
3134  pLeft->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
3135 
3136  nMove = x;
3137  }
3138  }
3139  }
3140  else
3141  {
3142  //find the first completely visible control (right edge visible)
3143  auto it = std::find_if(m_aControlList.rbegin(), m_aControlList.rend(),
3144  [this, nLeft, nSpace](const auto& rControl) {
3145  SwTOXWidget* pCtrl = rControl.get();
3146 
3147  int x, y, width, height;
3148  pCtrl->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
3149 
3150  auto nXPos = x + width;
3151  return nXPos <= nLeft + nSpace;
3152  });
3153  if (it != m_aControlList.rend() && it != m_aControlList.rbegin())
3154  {
3155  //move the right neighbor to the right edge right aligned
3156  auto itRight = it;
3157  --itRight;
3158  SwTOXWidget* pRight = itRight->get();
3159 
3160  int x, y, width, height;
3161  pRight->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
3162 
3163  nMove = x + width - nSpace;
3164  }
3165 
3166  //move it left until it's completely visible
3167  }
3168 
3169  if (nMove != nLeft)
3170  {
3171  // move the complete list
3172  MoveControls(nMove);
3173  m_xLeftScrollWin->set_sensitive(nMove > 0);
3174  m_xRightScrollWin->set_sensitive(nMove + nSpace < nWidth);
3175  }
3176 }
3177 
3179 {
3180  OUStringBuffer sRet;
3181 
3182  for (const auto& elem : m_aControlList)
3183  {
3184  const SwTOXWidget* pCtrl = elem.get();
3185 
3186  const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT
3187  ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pCtrl))->GetFormToken()
3188  : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken();
3189 
3190  //TODO: prevent input of TOX_STYLE_DELIMITER in KeyInput
3191  sRet.append(rNewToken.GetString());
3192  }
3193 
3194  return sRet.makeStringAndClear();
3195 }
3196 
3197 // Check if a control of the specified TokenType is already contained in the list
3199 {
3200  bool bRet = false;
3201 
3202  for (const auto& elem : m_aControlList)
3203  {
3204  const SwTOXWidget* pCtrl = elem.get();
3205  const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT
3206  ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pCtrl))->GetFormToken()
3207  : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken();
3208 
3209  if (eSearchFor == rNewToken.eTokenType)
3210  {
3211  bRet = true;
3212  break;
3213  }
3214  }
3215 
3216  return bRet;
3217 }
3218 
3220 {
3221  OUString sEntry;
3222  if (rToken.eTokenType != TOKEN_AUTHORITY)
3223  sEntry = m_aButtonHelpTexts[rToken.eTokenType];
3224  else
3225  {
3227  static_cast<ToxAuthorityField>(rToken.nAuthorityField));
3228  }
3229 
3230  if (rToken.eTokenType != TOKEN_TAB_STOP)
3231  {
3232  if (!rToken.sCharStyleName.isEmpty())
3233  {
3234  sEntry += OUString(' ') + m_sCharStyle + rToken.sCharStyleName;
3235  }
3236  }
3237 
3238  return sEntry;
3239 }
3240 
3241 IMPL_LINK(SwTokenWindow, EditResize, SwTOXEdit&, rEdit, void)
3242 {
3243  rEdit.AdjustSize();
3244  AdjustPositions();
3245  m_aModifyHdl.Call(nullptr);
3246 }
3247 
3248 IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit&, rEdit, void)
3249 {
3250  auto it = std::find_if(m_aControlList.begin(), m_aControlList.end(),
3251  [&rEdit](const auto& rControl)
3252  {
3253  SwTOXWidget* pCtrl = rControl.get();
3254  return pCtrl == &rEdit;
3255  });
3256 
3257  if (it == m_aControlList.end())
3258  return;
3259 
3260  auto itTest = it;
3261  ++itTest;
3262 
3263  if ((it != m_aControlList.begin() && !rEdit.IsNextControl()) ||
3264  (itTest != m_aControlList.end() && rEdit.IsNextControl()))
3265  {
3266  auto iterFocus = it;
3267  rEdit.IsNextControl() ? ++iterFocus : --iterFocus;
3268 
3269  SwTOXWidget *pCtrlFocus = iterFocus->get();
3270  pCtrlFocus->GrabFocus();
3271  static_cast<SwTOXButton*>(pCtrlFocus)->Check();
3272 
3273  AdjustScrolling();
3274  }
3275 }
3276 
3277 IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXWidget&, rControl, void)
3278 {
3279  SwTOXEdit* pEdit = static_cast<SwTOXEdit*>(&rControl);
3280  for (auto& aControl : m_aControlList)
3281  {
3282  SwTOXWidget* pCtrl = aControl.get();
3283  if (pCtrl && pCtrl->GetType() != WindowType::EDIT)
3284  static_cast<SwTOXButton*>(pCtrl)->Check(false);
3285  }
3286 
3287  SetActiveControl(pEdit);
3288 }
3289 
3290 IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void )
3291 {
3292  auto it = std::find_if(m_aControlList.begin(), m_aControlList.end(),
3293  [&rBtn](const auto& rControl)
3294  {
3295  SwTOXWidget* pCtrl = rControl.get();
3296  return pCtrl == &rBtn;
3297  });
3298 
3299  if (it == m_aControlList.end())
3300  return;
3301 
3302  auto itTest = it;
3303  ++itTest;
3304 
3305  if (!rBtn.IsNextControl() || (itTest != m_aControlList.end() && rBtn.IsNextControl()))
3306  {
3307  bool isNext = rBtn.IsNextControl();
3308 
3309  auto iterFocus = it;
3310  isNext ? ++iterFocus : --iterFocus;
3311 
3312  SwTOXWidget* pCtrlFocus = iterFocus->get();
3313  pCtrlFocus->GrabFocus();
3314  int nStartPos(0), nEndPos(0);
3315 
3316  if (!isNext)
3317  {
3318  const sal_Int32 nLen = static_cast<SwTOXEdit*>(pCtrlFocus)->GetText().getLength();
3319 
3320  nStartPos = nLen;
3321  nEndPos = nLen;
3322  }
3323 
3324  static_cast<SwTOXEdit*>(pCtrlFocus)->select_region(nStartPos, nEndPos);
3325 
3326  rBtn.Check(false);
3327 
3328  AdjustScrolling();
3329  }
3330 }
3331 
3332 IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXWidget&, rControl, void)
3333 {
3334  SwTOXButton* pBtn = static_cast<SwTOXButton*>(&rControl);
3335  for (auto& aControl : m_aControlList)
3336  {
3337  SwTOXWidget* pControl = aControl.get();
3338 
3339  if (pControl && WindowType::EDIT != pControl->GetType())
3340  static_cast<SwTOXButton*>(pControl)->Check(pBtn == pControl);
3341  }
3342 
3343  SetActiveControl(pBtn);
3344 }
3345 
3347 {
3348  if (m_pParent)
3349  {
3351  }
3352 }
3353 
3355 {
3356  //there are only one entry-text button and only one page-number button,
3357  //so we need not add index for these two buttons.
3358  if ( eType == TOKEN_ENTRY_TEXT || eType == TOKEN_PAGE_NUMS )
3359  {
3360  return 0;
3361  }
3362 
3363  sal_uInt32 nIndex = 0;
3364  for (const auto& elem : m_aControlList)
3365  {
3366  const SwTOXWidget* pControl = elem.get();
3367 
3368  const SwFormToken& rNewToken = WindowType::EDIT == pControl->GetType()
3369  ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pControl))->GetFormToken()
3370  : static_cast<const SwTOXButton*>(pControl)->GetFormToken();
3371 
3372  if(eType == rNewToken.eTokenType)
3373  {
3374  ++nIndex;
3375  }
3376  }
3377 
3378  return nIndex;
3379 }
3380 
3382  : SfxTabPage(pParent, "modules/swriter/ui/tocstylespage.ui", "TocStylesPage", &rAttrSet)
3383  , m_xLevelLB(m_xBuilder->weld_tree_view("levels"))
3384  , m_xAssignBT(m_xBuilder->weld_button("assign"))
3385  , m_xParaLayLB(m_xBuilder->weld_tree_view("styles"))
3386  , m_xStdBT(m_xBuilder->weld_button("default"))
3387  , m_xEditStyleBT(m_xBuilder->weld_button("edit"))
3388 {
3389  m_xParaLayLB->make_sorted();
3390  auto nHeight = m_xLevelLB->get_height_rows(16);
3391  m_xLevelLB->set_size_request(-1, nHeight);
3392  m_xParaLayLB->set_size_request(-1, nHeight);
3393 
3395 
3396  m_xEditStyleBT->connect_clicked(LINK(this, SwTOXStylesTabPage, EditStyleHdl));
3397  m_xAssignBT->connect_clicked(LINK(this, SwTOXStylesTabPage, AssignHdl));
3398  m_xStdBT->connect_clicked(LINK(this, SwTOXStylesTabPage, StdHdl));
3399  m_xParaLayLB->connect_changed(LINK(this, SwTOXStylesTabPage, EnableSelectHdl));
3400  m_xLevelLB->connect_changed(LINK(this, SwTOXStylesTabPage, EnableSelectHdl));
3401  m_xParaLayLB->connect_row_activated(LINK(this, SwTOXStylesTabPage, DoubleClickHdl));
3402 }
3403 
3405 {
3406 }
3407 
3409 {
3410  return true;
3411 }
3412 
3414 {
3415  ActivatePage(*rSet);
3416 }
3417 
3419 {
3420  m_pCurrentForm.reset(new SwForm(GetForm()));
3421 
3422  // not hyperlink for user directories
3423  const sal_uInt16 nSize = m_pCurrentForm->GetFormMax();
3424 
3425  // display form pattern without title
3426 
3427  m_xLevelLB->freeze();
3428  m_xLevelLB->clear();
3429  // display 1st TemplateEntry
3430  OUString aStr( SwResId( STR_TITLE ));
3431  if( !m_pCurrentForm->GetTemplate( 0 ).isEmpty() )
3432  {
3433  aStr += " " + OUStringLiteral1(aDeliStart)
3434  + m_pCurrentForm->GetTemplate( 0 )
3435  + OUStringLiteral1(aDeliEnd);
3436  }
3437  m_xLevelLB->append_text(aStr);
3438 
3439  for( sal_uInt16 i=1; i < nSize; ++i )
3440  {
3441  if( TOX_INDEX == m_pCurrentForm->GetTOXType() &&
3443  {
3444  aStr = SwResId(STR_ALPHA);
3445  }
3446  else
3447  {
3448  aStr = SwResId(STR_LEVEL) + OUString::number(
3449  TOX_INDEX == m_pCurrentForm->GetTOXType() ? i - 1 : i );
3450  }
3451  if( !m_pCurrentForm->GetTemplate( i ).isEmpty() )
3452  {
3453  aStr += " " + OUStringLiteral1(aDeliStart)
3454  + m_pCurrentForm->GetTemplate( i )
3455  + OUStringLiteral1(aDeliEnd);
3456  }
3457  m_xLevelLB->append_text(aStr);
3458  }
3459  m_xLevelLB->thaw();
3460 
3461  // initialise templates
3462  SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell();
3463  const sal_uInt16 nSz = rSh.GetTextFormatCollCount();
3464 
3465  m_xParaLayLB->freeze();
3466  m_xParaLayLB->clear();
3467  for( sal_uInt16 i = 0; i < nSz; ++i )
3468  {
3469  const SwTextFormatColl *pColl = &rSh.GetTextFormatColl( i );
3470  if( !pColl->IsDefault() )
3471  m_xParaLayLB->append_text( pColl->GetName() );
3472  }
3473 
3474  // query pool collections and set them for the directory
3475  for( sal_uInt16 i = 0; i < m_pCurrentForm->GetFormMax(); ++i )
3476  {
3477  aStr = m_pCurrentForm->GetTemplate( i );
3478  if (!aStr.isEmpty() && m_xParaLayLB->find_text(aStr) == -1)
3479  m_xParaLayLB->append_text(aStr);
3480  }
3481  m_xParaLayLB->thaw();
3482 
3483  EnableSelectHdl(*m_xParaLayLB);
3484 }
3485 
3487 {
3488  GetForm() = *m_pCurrentForm;
3489  return DeactivateRC::LeavePage;
3490 }
3491 
3493  const SfxItemSet* rAttrSet)
3494 {
3495  return VclPtr<SwTOXStylesTabPage>::Create(pParent, *rAttrSet);
3496 }
3497 
3499 {
3500  if (m_xParaLayLB->get_selected_index() != -1)
3501  {
3502  SfxStringItem aStyle(SID_STYLE_EDIT, m_xParaLayLB->get_selected_text());
3503  SfxUInt16Item aFamily(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para));
3504  SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell();
3505  rSh.GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT,
3506  SfxCallMode::SYNCHRON,
3507  { &aStyle, &aFamily });
3508  }
3509 }
3510 
3511 // allocate templates
3513 {
3514  auto nLevPos = m_xLevelLB->get_selected_index();
3515  auto nTemplPos = m_xParaLayLB->get_selected_index();
3516  if (nLevPos != -1 && nTemplPos != -1)
3517  {
3518  const OUString aStr(m_xLevelLB->get_text(nLevPos).getToken(0, aDeliStart)
3519  + OUStringLiteral1(aDeliStart)
3520  + m_xParaLayLB->get_selected_text()
3521  + OUStringLiteral1(aDeliEnd));
3522 
3523  m_pCurrentForm->SetTemplate(nLevPos, m_xParaLayLB->get_selected_text());
3524 
3525  m_xLevelLB->remove(nLevPos);
3526  m_xLevelLB->insert_text(nLevPos, aStr);
3527  m_xLevelLB->select_text(aStr);
3528  Modify();
3529  }
3530 }
3531 
3533 {
3534  const auto nPos = m_xLevelLB->get_selected_index();
3535  if (nPos != -1)
3536  {
3537  const OUString aStr(m_xLevelLB->get_text(nPos).getToken(0, aDeliStart));
3538  m_xLevelLB->remove(nPos);
3539  m_xLevelLB->insert_text(nPos, aStr);
3540  m_xLevelLB->select_text(aStr);
3541  m_pCurrentForm->SetTemplate(nPos, OUString());
3542  Modify();
3543  }
3544 }
3545 
3547 {
3548  const OUString aTmpName(m_xParaLayLB->get_selected_text());
3549  SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell();
3550 
3551  if(m_xParaLayLB->get_selected_index() != -1 &&
3552  (m_xLevelLB->get_selected_index() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName)))
3553  AssignHdl(*m_xAssignBT);
3554 }
3555 
3556 // enable only when selected
3558 {
3559  m_xStdBT->set_sensitive(m_xLevelLB->get_selected_index() != -1);
3560 
3561  SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell();
3562  const OUString aTmpName(m_xParaLayLB->get_selected_text());
3563  m_xAssignBT->set_sensitive(m_xParaLayLB->get_selected_index() != -1 &&
3564  m_xLevelLB->get_selected_index() != -1 &&
3565  (m_xLevelLB->get_selected_index() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName)));
3566  m_xEditStyleBT->set_sensitive(m_xParaLayLB->get_selected_index() != -1);
3567 }
3568 
3570 {
3571  SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController());
3572  if (pTOXDlg)
3573  {
3574  GetForm() = *m_pCurrentForm;
3576  }
3577 }
3578 
3579 #define ITEM_SEARCH 1
3580 #define ITEM_ALTERNATIVE 2
3581 #define ITEM_PRIM_KEY 3
3582 #define ITEM_SEC_KEY 4
3583 #define ITEM_COMMENT 5
3584 #define ITEM_CASE 6
3585 #define ITEM_WORDONLY 7
3586 
3593  BrowserMode::HLINES |
3594  BrowserMode::VLINES |
3597  , m_aCellEdit(VclPtr<Edit>::Create(&GetDataWindow(), 0))
3598  , m_aCellCheckBox(VclPtr< ::svt::CheckBoxControl>::Create(&GetDataWindow()))
3599  , m_nCurrentRow(0)
3600  , m_bModified(false)
3601 {
3602  m_sSearch = pBuilder->get<vcl::Window>("searchterm")->GetText();
3603  m_sAlternative = pBuilder->get<vcl::Window>("alternative")->GetText();
3604  m_sPrimKey = pBuilder->get<vcl::Window>("key1")->GetText();
3605  m_sSecKey = pBuilder->get<vcl::Window>("key2")->GetText();
3606  m_sComment = pBuilder->get<vcl::Window>("comment")->GetText();
3607  m_sCaseSensitive = pBuilder->get<vcl::Window>("casesensitive")->GetText();
3608  m_sWordOnly = pBuilder->get<vcl::Window>("wordonly")->GetText();
3609  m_sYes = pBuilder->get<vcl::Window>("yes")->GetText();
3610  m_sNo = pBuilder->get<vcl::Window>("no")->GetText();
3611 
3613  m_xController = new ::svt::EditCellController(m_aCellEdit.get());
3614  m_xCheckController = new ::svt::CheckBoxCellController(m_aCellCheckBox.get());
3615 
3616  // HACK: BrowseBox doesn't invalidate its children, how it should be.
3617  // That's why WB_CLIPCHILDREN is reset in order to enforce the
3618  // children' invalidation
3619  WinBits aStyle = GetStyle();
3620  if( aStyle & WB_CLIPCHILDREN )
3621  {
3622  aStyle &= ~WB_CLIPCHILDREN;
3623  SetStyle( aStyle );
3624  }
3625 
3626  const OUString* aTitles[7] =
3627  {
3628  &m_sSearch,
3629  &m_sAlternative,
3630  &m_sPrimKey,
3631  &m_sSecKey,
3632  &m_sComment,
3634  &m_sWordOnly
3635  };
3636 
3637  long nWidth = GetSizePixel().Width();
3638  nWidth /=7;
3639  --nWidth;
3640  for(sal_uInt16 i = 1; i < 8; i++)
3641  InsertDataColumn( i, *aTitles[i - 1], nWidth );
3642 }
3643 
3645 {
3646  disposeOnce();
3647 }
3648 
3650 {
3654 }
3655 
3657 {
3659 
3660  Dialog *pDlg = GetParentDialog();
3661  if (pDlg && pDlg->isCalculatingInitialLayoutSize())
3662  {
3663  long nWidth = GetSizePixel().Width();
3664  std::vector<long> aWidths = GetOptimalColWidths();
3665  long nNaturalWidth(std::accumulate(aWidths.begin(), aWidths.end(), 0));
3666  long nExcess = ((nWidth - nNaturalWidth) / aWidths.size()) - 1;
3667 
3668  for (size_t i = 0; i < aWidths.size(); ++i)
3669  SetColumnWidth(i+1, aWidths[i] + nExcess);
3670  }
3671 }
3672 
3673 std::vector<long> SwEntryBrowseBox::GetOptimalColWidths() const
3674 {
3675  std::vector<long> aWidths;
3676 
3677  long nStandardColMinWidth = approximate_char_width() * 16;
3678  long nYesNoWidth = approximate_char_width() * 5;
3679  nYesNoWidth = std::max(nYesNoWidth, GetTextWidth(m_sYes));
3680  nYesNoWidth = std::max(nYesNoWidth, GetTextWidth(m_sNo));
3681  for (sal_uInt16 i = 1; i < 6; i++)
3682  {
3683  long nColWidth = std::max(nStandardColMinWidth,
3684  GetTextWidth(GetColumnTitle(i)));
3685  nColWidth += 12;
3686  aWidths.push_back(nColWidth);
3687  }
3688 
3689  for (sal_uInt16 i = 6; i < 8; i++)
3690  {
3691  long nColWidth = std::max(nYesNoWidth,
3692  GetTextWidth(GetColumnTitle(i)));
3693  nColWidth += 12;
3694  aWidths.push_back(nColWidth);
3695  }
3696 
3697  return aWidths;
3698 }
3699 
3701 {
3702  Size aSize = LogicToPixel(Size(276 , 175), MapMode(MapUnit::MapAppFont));
3703 
3704  std::vector<long> aWidths = GetOptimalColWidths();
3705 
3706  long nWidth(std::accumulate(aWidths.begin(), aWidths.end(), 0));
3707 
3708  aSize.setWidth( std::max(aSize.Width(), nWidth) );
3709 
3710  return aSize;
3711 }
3712 
3713 bool SwEntryBrowseBox::SeekRow( long nRow )
3714 {
3715  m_nCurrentRow = nRow;
3716  return true;
3717 }
3718 
3719 OUString SwEntryBrowseBox::GetCellText(long nRow, sal_uInt16 nColumn) const
3720 {
3721  OUString pRet;
3722  if (static_cast<size_t>(nRow) < m_Entries.size())
3723  {
3724  const AutoMarkEntry* pEntry = m_Entries[ nRow ].get();
3725  switch(nColumn)
3726  {
3727  case ITEM_SEARCH : pRet = pEntry->sSearch; break;
3728  case ITEM_ALTERNATIVE : pRet = pEntry->sAlternative; break;
3729  case ITEM_PRIM_KEY : pRet = pEntry->sPrimKey; break;
3730  case ITEM_SEC_KEY : pRet = pEntry->sSecKey; break;
3731  case ITEM_COMMENT : pRet = pEntry->sComment; break;
3732  case ITEM_CASE : pRet = pEntry->bCase ? m_sYes : m_sNo; break;
3733  case ITEM_WORDONLY : pRet = pEntry->bWord ? m_sYes : m_sNo; break;
3734  }
3735  }
3736  return pRet;
3737 }
3738 
3740  const tools::Rectangle& rRect, sal_uInt16 nColumnId) const
3741 {
3742  const DrawTextFlags nStyle = DrawTextFlags::Clip | DrawTextFlags::Center;
3743  rDev.DrawText( rRect, GetCellText( m_nCurrentRow, nColumnId ), nStyle );
3744 }
3745 
3747 {
3748  return nCol < ITEM_CASE ? m_xController.get() : m_xCheckController.get();
3749 }
3750 
3752 {
3753  m_bModified = true;
3754  const size_t nRow = GetCurRow();
3755  const sal_uInt16 nCol = GetCurColumnId();
3756 
3757  OUString sNew;
3758  bool bVal = false;
3759  ::svt::CellController* pController = nullptr;
3760  if(nCol < ITEM_CASE)
3761  {
3762  pController = m_xController.get();
3763  sNew = static_cast< ::svt::EditCellController*>(pController)->GetEditImplementation()->GetText( LINEEND_LF );
3764  }
3765  else
3766  {
3767  pController = m_xCheckController.get();
3768  bVal = static_cast< ::svt::CheckBoxCellController*>(pController)->GetCheckBox().IsChecked();
3769  }
3770  const bool bAddEntry = nRow >= m_Entries.size();
3771  std::unique_ptr<AutoMarkEntry> xNewEntry(bAddEntry ? new AutoMarkEntry : nullptr);
3772  AutoMarkEntry* pEntry = bAddEntry ? xNewEntry.get() : m_Entries[nRow].get();
3773  switch(nCol)
3774  {
3775  case ITEM_SEARCH : pEntry->sSearch = sNew; break;
3776  case ITEM_ALTERNATIVE : pEntry->sAlternative = sNew; break;
3777  case ITEM_PRIM_KEY : pEntry->sPrimKey = sNew; break;
3778  case ITEM_SEC_KEY : pEntry->sSecKey = sNew; break;
3779  case ITEM_COMMENT : pEntry->sComment = sNew; break;
3780  case ITEM_CASE : pEntry->bCase = bVal; break;
3781  case ITEM_WORDONLY : pEntry->bWord = bVal; break;
3782  }
3783  if (bAddEntry)
3784  {
3785  m_Entries.push_back(std::move(xNewEntry));
3786  RowInserted(nRow, 1, true, true);
3787  if(nCol < ITEM_WORDONLY)
3788  {
3789  pController->ClearModified();
3790  GoToRow( nRow );
3791  }
3792  }
3793  return true;
3794 }
3795 
3797  ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol)
3798 {
3799  const OUString rText = GetCellText( nRow, nCol );
3800  if(nCol < ITEM_CASE)
3801  {
3802  rController = m_xController;
3803  ::svt::CellController* pController = m_xController.get();
3804  static_cast< ::svt::EditCellController*>(pController)->GetEditImplementation()->SetText( rText );
3805  }
3806  else
3807  {
3808  rController = m_xCheckController;
3809  ::svt::CellController* pController = m_xCheckController.get();
3810  static_cast< ::svt::CheckBoxCellController*>(pController)->GetCheckBox().Check(
3811  rText == m_sYes );
3812  }
3813 }
3814 
3816 {
3817  AutoMarkEntry* pToInsert = nullptr;
3818  rtl_TextEncoding eTEnc = osl_getThreadTextEncoding();
3819  while (rInStr.good())
3820  {
3821  OUString sLine;
3822  rInStr.ReadByteStringLine( sLine, eTEnc );
3823 
3824  // # -> comment
3825  // ; -> delimiter between entries ->
3826  // Format: TextToSearchFor;AlternativeString;PrimaryKey;SecondaryKey
3827  // Leading and trailing blanks are ignored
3828  if( !sLine.isEmpty() )
3829  {
3830  //comments are contained in separate lines but are put into the struct of the following data
3831  //line (if available)
3832  if( '#' != sLine[0] )
3833  {
3834  if( !pToInsert )
3835  pToInsert = new AutoMarkEntry;
3836 
3837  sal_Int32 nSttPos = 0;
3838  pToInsert->sSearch = sLine.getToken(0, ';', nSttPos );
3839  pToInsert->sAlternative = sLine.getToken(0, ';', nSttPos );
3840  pToInsert->sPrimKey = sLine.getToken(0, ';', nSttPos );
3841  pToInsert->sSecKey = sLine.getToken(0, ';', nSttPos );
3842 
3843  OUString sStr = sLine.getToken(0, ';', nSttPos );
3844  pToInsert->bCase = !sStr.isEmpty() && sStr != "0";
3845 
3846  sStr = sLine.getToken(0, ';', nSttPos );
3847  pToInsert->bWord = !sStr.isEmpty() && sStr != "0";
3848 
3849  m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
3850  pToInsert = nullptr;
3851  }
3852  else
3853  {
3854  if(pToInsert)
3855  m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
3856  pToInsert = new AutoMarkEntry;
3857  pToInsert->sComment = sLine.copy(1);
3858  }
3859  }
3860  }
3861  if( pToInsert )
3862  m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
3863  RowInserted(0, m_Entries.size() + 1);
3864 }
3865 
3867 {
3868  //check if the current controller is modified
3869  const sal_uInt16 nCol = GetCurColumnId();
3870  ::svt::CellController* pController;
3871  if(nCol < ITEM_CASE)
3872  pController = m_xController.get();
3873  else
3874  pController = m_xCheckController.get();
3875  if(pController ->IsModified())
3876  GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 ));
3877 
3878  rtl_TextEncoding eTEnc = osl_getThreadTextEncoding();
3879  for(std::unique_ptr<AutoMarkEntry> & rpEntry : m_Entries)
3880  {
3881  AutoMarkEntry* pEntry = rpEntry.get();
3882  if(!pEntry->sComment.isEmpty())
3883  {
3884  rOutStr.WriteByteStringLine( "#" + pEntry->sComment, eTEnc );
3885  }
3886 
3887  OUString sWrite( pEntry->sSearch + ";" +
3888  pEntry->sAlternative + ";" +
3889  pEntry->sPrimKey + ";" +
3890  pEntry->sSecKey + ";" +
3891  (pEntry->bCase ? OUString("1") : OUString("0")) + ";" +
3892  (pEntry->bWord ? OUString("1") : OUString("0")) );
3893 
3894  if( sWrite.getLength() > 5 )
3895  rOutStr.WriteByteStringLine( sWrite, eTEnc );
3896  }
3897 }
3898 
3900 {
3901  if(m_bModified)
3902  return true;
3903 
3904  //check if the current controller is modified
3905  const sal_uInt16 nCol = GetCurColumnId();
3906  ::svt::CellController* pController;
3907  if(nCol < ITEM_CASE)
3908  pController = m_xController.get();
3909  else
3910  pController = m_xCheckController.get();
3911  return pController->IsModified();
3912 }
3913 
3914 SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL,
3915  bool bCreate)
3916  : ModalDialog(pParent, "CreateAutomarkDialog",
3917  "modules/swriter/ui/createautomarkdialog.ui")
3918  , sAutoMarkURL(rAutoMarkURL)
3919  , bCreateMode(bCreate)
3920 {
3921  get(m_pOKPB, "ok");
3922  m_pEntriesBB = VclPtr<SwEntryBrowseBox>::Create(get<VclContainer>("area"), this);
3923  m_pEntriesBB->set_expand(true);
3924  m_pEntriesBB->Show();
3925  m_pOKPB->SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl));
3926 
3927  SetText(GetText() + ": " + sAutoMarkURL);
3928  bool bError = false;
3929  if( bCreateMode )
3931  else
3932  {
3933  SfxMedium aMed( sAutoMarkURL, StreamMode::STD_READ );
3934  if( aMed.GetInStream() && !aMed.GetInStream()->GetError() )
3935  m_pEntriesBB->ReadEntries( *aMed.GetInStream() );
3936  else
3937  bError = true;
3938  }
3939 
3940  if(bError)
3941  EndDialog();
3942 }
3943 
3945 {
3946  disposeOnce();
3947 }
3948 
3950 {
3952  m_pOKPB.clear();
3954 }
3955 
3957 {
3958  bool bError = false;
3959  if(m_pEntriesBB->IsModified() || bCreateMode)
3960  {
3961  SfxMedium aMed( sAutoMarkURL,
3962  bCreateMode ? StreamMode::WRITE
3963  : StreamMode::WRITE| StreamMode::TRUNC );
3964  SvStream* pStrm = aMed.GetOutStream();
3965  pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 );
3966  if( !pStrm->GetError() )
3967  {
3968  m_pEntriesBB->WriteEntries( *pStrm );
3969  aMed.Commit();
3970  }
3971  else
3972  bError = true;
3973  }
3974  if( !bError )
3975  EndDialog(RET_OK);
3976 }
3977 
3978 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:68
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SfxViewFrame * GetViewFrame() const
void SetEntryNumberFormat(sal_uInt16 nSet)
Definition: cnttab.cxx:1646
std::unique_ptr< weld::MenuButton > m_xAutoMarkPB
Definition: swuicnttab.hxx:174
TOXTypes GetTOXType() const
Definition: tox.hxx:648
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
#define KEY_SUBTRACT
long Width() const
std::unique_ptr< weld::Button > m_xRightPB
Definition: cnttab.cxx:486
OUString m_aButtonHelpTexts[TOKEN_END]
Definition: swuicnttab.hxx:232
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:249
std::unique_ptr< weld::ComboBox > m_xAuthFieldsLB
Definition: swuicnttab.hxx:328
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
std::unique_ptr< weld::ScrolledWindow > m_xScrollWin
Definition: swuicnttab.hxx:250
bool IsNextControl() const
Definition: cnttab.cxx:1489
TOXTypes
Definition: toxe.hxx:39
virtual void GrabFocus()=0
void SetTOUName(const OUString &rSet)
Definition: toxmgr.hxx:103
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
boost::optional< OUString > const & GetTitle() const
Definition: toxmgr.hxx:101
::svt::CellControllerRef m_xCheckController
Definition: cnttab.cxx:158
virtual void Resize() override
FieldUnit
#define RES_FRM_SIZE
Definition: hintids.hxx:194
void OnModify(bool bAllLevels)
Definition: cnttab.cxx:1937
void MoveControls(long nOffset)
Definition: cnttab.cxx:3051
SwTOIOptions
Definition: tox.hxx:350
std::vector< TypeData > m_vTypeData
Definition: swuicnttab.hxx:64
SwTOXElement GetContentOptions() const
Definition: toxmgr.hxx:110
OUString sAutoMarkURL
Definition: cnttab.cxx:192
void SetLinkStart()
Definition: cnttab.cxx:1691
std::unique_ptr< weld::ComboBox > m_xNumberFormatLB
format for numbering (E#)
Definition: swuicnttab.hxx:336
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
#define KEY_DELETE
void Check(bool bCheck=true)
Definition: cnttab.cxx:1616
std::unique_ptr< weld::RadioButton > m_xSecondSortUpRB
Definition: swuicnttab.hxx:358
std::unique_ptr< weld::TreeView > m_xParaLayLB
Definition: swuicnttab.hxx:415
OUString m_sYes
Definition: cnttab.cxx:152
SwFormToken aFormToken
Definition: cnttab.cxx:1404
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColId) const override
Definition: cnttab.cxx:3739
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
Definition: edfmt.cxx:125
SwTOXElement GetCreateType() const
Definition: tox.hxx:671
OUString m_sAdditionalAccnameString2
Definition: swuicnttab.hxx:239
void PreTokenButtonRemoved(const SwFormToken &rToken)
Definition: cnttab.cxx:2172
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: cnttab.cxx:2126
long m_nCurrentRow
Definition: cnttab.cxx:160
SwTOIOptions GetOptions() const
Definition: tox.hxx:710
std::unique_ptr< weld::Button > m_xRightScrollWin
Definition: swuicnttab.hxx:251
void SetMainEntryCharStyle(const OUString &rSet)
Definition: toxmgr.hxx:116
bool IsDefault() const
Definition: format.hxx:109
virtual void set_grid_left_attach(int nPos) override
Definition: cnttab.cxx:1606
#define TO_BIBLIOGRAPHY
Definition: cnttab.hxx:37
EditBrowseBoxFlags
virtual void ActivatePage(const SfxItemSet &) override
Definition: cnttab.cxx:1168
virtual void PageCreated(const SfxAllItemSet &aSet)
static SfxAbstractDialogFactory * Create()
sal_uInt16 m_nLevel
Definition: swuicnttab.hxx:229
void SetClickHdl(const Link< Button *, void > &rLink)
T * get(VclPtr< T > &ret, const OString &sID)
void SetPattern(sal_uInt16 nLevel, const SwFormTokens &rName)
Definition: tox.cxx:923
std::unique_ptr< weld::Button > m_xAddStylesPB
Definition: swuicnttab.hxx:144
virtual void dispose() override
Definition: cnttab.cxx:813
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
std::unique_ptr< weld::Button > m_xEntryPB
Definition: swuicnttab.hxx:323
std::unique_ptr< weld::ComboBox > m_xTypeLB
Definition: swuicnttab.hxx:131
std::unique_ptr< weld::ComboBox > m_xFirstKeyLB
Definition: swuicnttab.hxx:354
SwTokenWindow * m_pParent
Definition: cnttab.cxx:1408
bool IsProtected() const
Definition: tox.hxx:502
SW_DLLPUBLIC void FillCharStyleListBox(weld::ComboBox &rToFill, SwDocShell *pDocSh, bool bSorted=false, bool bWithDefault=false)
Definition: uitool.cxx:716
#define KEY_F4
sal_uInt16 nOutlineLevel
Definition: tox.hxx:215
virtual bool FillItemSet(SfxItemSet *) override
Definition: cnttab.cxx:3408
const SfxItemSet * GetOutputItemSet() const
std::unique_ptr< weld::Button > m_xHyperLinkPB
Definition: swuicnttab.hxx:327
std::unique_ptr< weld::Button > m_xStdBT
Definition: swuicnttab.hxx:416
SwTOOElements
Definition: tox.hxx:373
Definition: tox.hxx:276
void SetSequenceName(const OUString &rSet)
Definition: toxmgr.hxx:125
const OUString & GetSequenceName() const
Definition: toxmgr.hxx:124
sal_uInt16 GetTextFormatCollCount() const
Definition: edfcol.cxx:694
std::unique_ptr< weld::Button > m_xLeftPB
Definition: cnttab.cxx:485
OUString aStyleArr[MAXLEVEL]
Definition: swuicnttab.hxx:119
long GetWidth() const
VclPtr< Edit > m_aCellEdit
Definition: cnttab.cxx:142
SfxDispatcher * GetDispatcher()
SwTOXDescription & GetTOXDescription(CurTOXType eTOXTypes)
Definition: cnttab.cxx:358
DECL_LINK(ModifyHdl, weld::Entry &, void)
void SelectType(TOXTypes eSet)
Definition: cnttab.cxx:867
std::unique_ptr< weld::SpinButton > m_xEntryOutlineLevelNF
level to evaluate outline level to, for i53420
Definition: swuicnttab.hxx:338
std::unique_ptr< weld::Builder > m_xBuilder
Definition: cnttab.cxx:1403
std::unique_ptr< weld::Button > m_xEditStyleBT
Definition: swuicnttab.hxx:417
Main entry in indices.
Definition: poolfmt.hxx:127
static OUString GetFormLinkStt()
Definition: tox.cxx:505
TOXTypes GetTOXType() const
Definition: toxmgr.hxx:90
std::unique_ptr< weld::TreeView > m_xHeaderTree
Definition: cnttab.cxx:487
void disposeAndClear()
void SetAuthSequence(bool bSet)
Definition: toxmgr.hxx:146
void SetReadonly(bool bSet)
Definition: toxmgr.hxx:133
std::unique_ptr< weld::ComboBox > m_xCaptionSequenceLB
Definition: swuicnttab.hxx:158
virtual void ActivatePage(const SfxItemSet &) override
Definition: cnttab.cxx:1981
SwForm * GetForm(CurTOXType eType)
Definition: cnttab.cxx:350
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:386
std::unique_ptr< weld::RadioButton > m_xSortDocPosRB
Definition: swuicnttab.hxx:351
#define ITEM_COMMENT
Definition: cnttab.cxx:3583
only chapter number without post-/prefix
Definition: chpfld.hxx:35
void CreateOrUpdateExample(TOXTypes nTOXIndex, sal_uInt16 nPage=0, sal_uInt16 nCurLevel=USHRT_MAX)
Definition: cntex.cxx:138
OUString const m_sCharStyle
Definition: swuicnttab.hxx:233
VclPtr< SwEntryBrowseBox > m_pEntriesBB
Definition: cnttab.cxx:190
virtual ~SwAutoMarkDlg_Impl() override
Definition: cnttab.cxx:3944
void SetStyleNames(const OUString &rSet, sal_uInt16 nLvl)
Definition: toxmgr.hxx:94
bool Commit()
sal_uInt16 sal_Char sal_Char * pDesc
sal_Int16 nId
Link< SwTOXEdit &, void > aModifiedLink
Definition: cnttab.cxx:1405
std::unique_ptr< weld::TreeView > m_xLevelLB
Definition: swuicnttab.hxx:413
std::unique_ptr< weld::CheckButton > m_xRelToStyleCB
Definition: swuicnttab.hxx:349
static bool IsNoNum(SwWrtShell &rSh, const OUString &rName)
Definition: cnttab.cxx:468
virtual void ActivatePage(const SfxItemSet &) override
Definition: cnttab.cxx:3418
sal_uInt16 GetCode() const
const OUString & GetTemplatePath() const
long SwTwips
Definition: swtypes.hxx:49
SwForm * m_pCurrentForm
Definition: swuicnttab.hxx:313
const KeyEvent * GetKeyEvent() const
std::unique_ptr< weld::RadioButton > m_xThirdSortDownRB
Definition: swuicnttab.hxx:362
virtual void dispose() override
void SetFocus2theAllBtn()
Definition: cnttab.cxx:2179
std::vector< long > GetOptimalColWidths() const
Definition: cnttab.cxx:3673
SfxItemSet * GetInputSetImpl()
OUString const & GetTOIAutoMarkURL() const
AutoMark file.
Definition: edtox.cxx:262
sal_uInt16 GetFormMax() const
Definition: tox.hxx:653
std::unique_ptr< weld::CheckButton > m_xFromFramesCB
Definition: swuicnttab.hxx:147
static OUString GetFormTab()
Definition: tox.cxx:503
virtual void get_extents_relative_to(weld::Widget &rRelative, int &x, int &y, int &width, int &height)=0
std::pair< int, int > row_col
Definition: cnttab.cxx:493
SwTOXEntryTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet)
Definition: cnttab.cxx:1778
void SetLevel(sal_uInt8 nSet)
Definition: toxmgr.hxx:118
void SetWrtShell(SwWrtShell &rSh)
Definition: cnttab.cxx:2551
std::unique_ptr< weld::RadioButton > m_xFirstSortUpRB
Definition: swuicnttab.hxx:355
std::vector< std::unique_ptr< AutoMarkEntry > > m_Entries
Definition: cnttab.cxx:155
sal_uInt16 nPoolId
Definition: tox.hxx:212
std::unique_ptr< weld::CheckButton > m_xFromTablesCB
Definition: swuicnttab.hxx:146
float x
virtual Size GetOptimalSize() const override
Definition: cnttab.cxx:3700
void SetModifyHdl(const Link< SwTOXEdit &, void > &rLink)
Definition: cnttab.cxx:1481
#define KEY_LEFT
TRISTATE_TRUE
void SetIndexOptions(SwTOIOptions nSet)
Definition: toxmgr.hxx:112
static OUString const & GetAuthTypeName(ToxAuthorityType eType)
Definition: initui.cxx:282
#define KEY_ADD
virtual void Reset(const SfxItemSet *) override
Definition: cnttab.cxx:3413
IMPL_LINK(SwAddStylesDlg_Impl, TreeSizeAllocHdl, const Size &, rSize, void)
Definition: cnttab.cxx:592
std::unique_ptr< weld::ToggleButton > m_xButton
Definition: cnttab.cxx:1567
chapter number without post-/prefix and title
Definition: chpfld.hxx:36
SwAddStylesDlg_Impl(weld::Window *pParent, SwWrtShell const &rWrtSh, OUString rStringArr[])
Definition: cnttab.cxx:500
std::unique_ptr< weld::Widget > m_xSortKeyFrame
Definition: swuicnttab.hxx:353
sal_Unicode cTabFillChar
Definition: tox.hxx:217
std::unique_ptr< weld::Button > m_xAuthInsertPB
Definition: swuicnttab.hxx:329
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage types of content tables.
Definition: edws.cxx:189
SwTOXWidget * m_pActiveCtrl
Definition: swuicnttab.hxx:235
virtual bool IsModified() const =0
std::unique_ptr< weld::Entry > m_xTitleED
Definition: swuicnttab.hxx:129
virtual WindowType GetType() const override
Definition: cnttab.cxx:1426
void SetRelTabPos(bool b)
Definition: tox.hxx:308
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
OUString sPrimKey
Definition: cnttab.cxx:127
DECL_LINK(OkHdl, weld::Button &, void)
virtual short Ok()
::svt::CellControllerRef m_xController
Definition: cnttab.cxx:157
SwTextFormatColl & GetTextFormatColl(sal_uInt16 nTextFormatColl) const
Definition: edfcol.cxx:699
sal_Int64 WinBits
sal_uInt16 sal_Unicode
std::unique_ptr< weld::RadioButton > m_xSecondSortDownRB
Definition: swuicnttab.hxx:359
CurTOXType aLastTOXType
Definition: swuicnttab.hxx:315
std::unique_ptr< LanguageBox > m_xLanguageLB
Definition: swuicnttab.hxx:186
SwCaptionDisplay GetCaptionDisplay() const
Definition: toxmgr.hxx:127
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
OUString m_sAdditionalAccnameString1
Definition: swuicnttab.hxx:238
const SwTOXSortKey * GetSortKey(sal_uInt16 nIdx) const
Definition: authfld.cxx:443
std::unique_ptr< weld::RadioButton > m_xSortContentRB
Definition: swuicnttab.hxx:352
const SwTOXType * GetTOXType() const
Definition: tox.hxx:668
virtual void dispose() override
OUString m_sAccessibleName
Definition: swuicnttab.hxx:237
std::unique_ptr< weld::CheckButton > m_xFromHeadingsCB
Definition: swuicnttab.hxx:141
const SwView & GetView() const
Definition: wrtsh.hxx:426
sal_Unicode GetPrefix() const
Definition: authfld.hxx:114
ErrCode GetError() const
virtual WindowType GetType() const override
Definition: cnttab.cxx:1581
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
FUNC_TYPE const nType
virtual ~SwTOXSelectTabPage() override
Definition: cnttab.cxx:808
std::unique_ptr< weld::Button > m_xAuthRemovePB
Definition: swuicnttab.hxx:330
void LanguageHdl(const weld::ComboBox *)
Definition: cnttab.cxx:1319
void SetSortByDocument(bool bSet)
Definition: toxmgr.hxx:149
SwTOIOptions GetIndexOptions() const
Definition: toxmgr.hxx:113
virtual void set_grid_left_attach(int nPos)=0
std::unique_ptr< weld::ComboBox > m_xMainEntryStyleLB
Definition: swuicnttab.hxx:346
std::unique_ptr< weld::ComboBox > m_xFillCharCB
Definition: swuicnttab.hxx:340
bool ReadByteStringLine(OUString &rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxBytesToRead=0xFFFE)
std::unique_ptr< weld::ComboBox > m_xAreaLB
Definition: swuicnttab.hxx:135
OUString sText
Definition: tox.hxx:208
const OUString & GetName() const
Definition: format.hxx:111
void SetExchangeSupport()
SwTOXEdit(SwTokenWindow *pTokenWin, const SwFormToken &rToken)
Definition: cnttab.cxx:1413
bool IsCreateFromObjectNames() const
Definition: toxmgr.hxx:122
virtual bool FillItemSet(SfxItemSet *) override
Definition: cnttab.cxx:1952
virtual ~SwEntryBrowseBox() override
Definition: cnttab.cxx:3644
virtual void Hide() override
Definition: cnttab.cxx:1591
bool IsLevelFromChapter() const
Definition: toxmgr.hxx:139
SwEntryBrowseBox(vcl::Window *pParent, VclBuilderContainer *pBuilder)
Definition: cnttab.cxx:3587
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
#define TO_USER
Definition: cnttab.hxx:34
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
void UpdateDescriptor()
Definition: cnttab.cxx:2086
SvStream * GetOutStream()
virtual void GrabFocus() override
Definition: cnttab.cxx:1431
static OUString GetFormEntry()
Definition: tox.cxx:502
std::unique_ptr< weld::Button > m_xLeftScrollWin
Definition: swuicnttab.hxx:248
void SetAuthBrackets(const OUString &rSet)
Definition: toxmgr.hxx:143
virtual short Ok() override
Definition: cnttab.cxx:324
OUString sAddStyleContent
Definition: swuicnttab.hxx:123
void SetTitle(const OUString &rSet)
Definition: toxmgr.hxx:100
virtual void dispose() override
Definition: cnttab.cxx:1920
const OUString & GetSequenceName() const
Definition: tox.hxx:505
std::unique_ptr< weld::Builder > m_xBuilder
Definition: cnttab.cxx:1562
#define ITEM_SEARCH
Definition: cnttab.cxx:3579
OUString sSearch
Definition: cnttab.cxx:125
OUString * pStyleArr
Definition: cnttab.cxx:482
std::vector< std::unique_ptr< SwTOXWidget > > m_aControlList
Definition: swuicnttab.hxx:252
virtual void dispose() override
virtual void Hide() override
Definition: cnttab.cxx:1436
SwTOOElements GetOLEOptions() const
Definition: tox.hxx:478
OUString m_sCaseSensitive
Definition: cnttab.cxx:150
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: cnttab.cxx:2184
OUString sSecKey
Definition: cnttab.cxx:128
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: cnttab.cxx:3492
std::unique_ptr< weld::Button > m_xOk
Definition: cnttab.cxx:484
#define ITEM_ALTERNATIVE
Definition: cnttab.cxx:3580
std::unique_ptr< weld::RadioButton > m_xFirstSortDownRB
Definition: swuicnttab.hxx:356
std::unique_ptr< weld::CheckButton > m_xStylesCB
Definition: swuicnttab.hxx:142
OUString m_sWordOnly
Definition: cnttab.cxx:151
virtual void GrabFocus() override
Definition: cnttab.cxx:1586
OUString sAuthTypeStr
Definition: swuicnttab.hxx:310
virtual bool SaveModified() override
Definition: cnttab.cxx:3751
OUString sAddStyleUser
Definition: swuicnttab.hxx:122
std::unique_ptr< weld::CheckButton > m_xAddStylesCB
Definition: swuicnttab.hxx:143
virtual WindowType GetType() const =0
bool IsAuthSequence() const
Definition: toxmgr.hxx:145
OUString sAlternative
Definition: cnttab.cxx:126
std::unique_ptr< weld::CheckButton > m_xCommaSeparatedCB
Definition: swuicnttab.hxx:348
void RemoveControl(const SwTOXButton *pDel, bool bInternalCall=false)
Definition: cnttab.cxx:2997
float y
Link< SwTOXWidget &, void > aGetFocusLink
Definition: cnttab.cxx:1390
bool IsFromChapter() const
Definition: toxmgr.hxx:131
static OUString GetFormEntryNum()
Definition: tox.cxx:507
#define SAL_N_ELEMENTS(arr)
OUString m_aButtonTexts[TOKEN_END]
Definition: swuicnttab.hxx:231
void SetFromChapter(bool bSet)
Definition: toxmgr.hxx:130
sal_Int32 m_nLevel
std::unique_ptr< weld::RadioButton > m_xFromCaptionsRB
Definition: swuicnttab.hxx:153
void SetText(const OUString &rText)
Definition: cnttab.cxx:1677
bool GoToColumnId(sal_uInt16 nColId)
std::unique_ptr< weld::CheckButton > m_xUseFFCB
Definition: swuicnttab.hxx:168
OUString GetString() const
Definition: tox.cxx:649
SwTOXWidget * InsertItem(const OUString &rText, const SwFormToken &aToken)
Definition: cnttab.cxx:2732
void SetPrevNextLink(const Link< SwTOXEdit &, void > &rLink)
Definition: cnttab.cxx:1490
void InsertDataColumn(sal_uInt16 nItemId, const OUString &rText, long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
std::unique_ptr< weld::ComboBox > m_xThirdKeyLB
Definition: swuicnttab.hxx:360
T * get() const
::svt::EditBrowseBox SwEntryBrowseBox_Base
Definition: cnttab.cxx:138
OUString m_sPrimKey
Definition: cnttab.cxx:147
const SwFormToken & GetFormToken()
Definition: cnttab.cxx:1492
LINEEND_LF
OUString GetPattern() const
Definition: cnttab.cxx:3178
const OUString & GetUserConfigPath() const
#define SW_MOD()
Definition: swmodule.hxx:255
Link< SwFormToken &, void > m_aButtonSelectedHdl
Definition: swuicnttab.hxx:234
sal_uInt16 const m_nInitialTOXType
Definition: swuicnttab.hxx:71
OUString GetColumnTitle(sal_uInt16 nColumnId) const
sal_uInt8 GetLevel() const
Definition: toxmgr.hxx:119
IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::ToggleButton &, void)
Definition: cnttab.cxx:424
std::unique_ptr< weld::Label > m_xLevelFT
Definition: swuicnttab.hxx:319
sal_uInt32 GetControlIndex(FormTokenType eType) const
Definition: cnttab.cxx:3354
bool Contains(FormTokenType) const
Definition: cnttab.cxx:3198
virtual void Reset(const SfxItemSet *) override
Definition: cnttab.cxx:1958
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:691
bool m_bWaitingInitialSettings
Definition: swuicnttab.hxx:127
const SwTOXBase * GetDefaultTOXBase(TOXTypes eTyp, bool bCreate=false)
Definition: edtox.cxx:118
SwTOXStylesTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet)
Definition: cnttab.cxx:3381
void SetColumnWidth(sal_uInt16 nColumnId, sal_uLong nWidth)
static OUString const & GetAuthFieldName(ToxAuthorityField eType)
Definition: initui.cxx:244
SwTOXElement
Definition: tox.hxx:328
virtual void Reset(const SfxItemSet *) override
Definition: cnttab.cxx:1129
const OUString & GetSortAlgorithm() const
Definition: toxmgr.hxx:162
CheckBox & GetBox()
bool const m_bGlobalFlag
Definition: swuicnttab.hxx:75
FormTokenType eTokenType
Definition: tox.hxx:211
const SwFormTokens & GetPattern(sal_uInt16 nLevel) const
Definition: tox.cxx:937
void SetChapterInfo(sal_uInt16 nSet)
Definition: cnttab.cxx:1659
#define TO_INDEX
Definition: cnttab.hxx:31
std::unique_ptr< SwTokenWindow > m_xTokenWIN
Definition: swuicnttab.hxx:363
OUString sCharStyleName
Definition: tox.hxx:209
SwTOOElements GetOLEOptions() const
Definition: toxmgr.hxx:136
#define TO_OBJECT
Definition: cnttab.hxx:35
std::unique_ptr< weld::TreeView > m_xLevelLB
Definition: swuicnttab.hxx:320
virtual void ClearModified()=0
SwTOXWidget * GetActiveControl()
Definition: swuicnttab.hxx:291
OUString sName
std::unique_ptr< weld::CheckButton > m_xAlphaDelimCB
Definition: swuicnttab.hxx:347
#define TOX_PAGE_SELECT
Definition: cnttab.hxx:26
std::unique_ptr< IndexEntryResource > pIndexRes
Definition: swuicnttab.hxx:117
long GetCurRow() const
int i
bool IsFromObjectNames() const
Definition: tox.hxx:496
void FillTOXDescription()
Definition: cnttab.cxx:1018
#define FORM_ALPHA_DELIMITTER
Definition: tox.hxx:170
TRISTATE_FALSE
SwWrtShell & GetWrtShell()
Definition: swuicnttab.hxx:106
SwFormToken aFormToken
Definition: cnttab.cxx:1563
std::unique_ptr< weld::SpinButton > m_xLevelNF
Definition: swuicnttab.hxx:137
void EnableTriState(bool bTriState=true)
size_t GetFieldTypeCount(SwFieldIds nResId=SwFieldIds::Unknown) const
count field types with a ResId, if SwFieldIds::Unknown count all
Definition: edfld.cxx:47
void SetFillChar(sal_Unicode cSet)
Definition: cnttab.cxx:1637
static CurTOXType lcl_UserData2TOXTypes(sal_uInt16 nData)
Definition: cnttab.cxx:878
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: cnttab.cxx:300
sal_Unicode GetSuffix() const
Definition: authfld.hxx:115
std::unique_ptr< weld::ComboBox > m_xBracketLB
Definition: swuicnttab.hxx:181
virtual OUString GetCellText(long nRow, sal_uInt16 nColumn) const override
Definition: cnttab.cxx:3719
float u
std::unique_ptr< SwTOXDescription > CreateTOXDescFromTOXBase(const SwTOXBase *pCurTOX)
Definition: cnttab.cxx:397
void SetAccessibleName(const OUString &rName)
Definition: cnttab.cxx:1601
bool isCalculatingInitialLayoutSize() const
#define TO_TABLE
Definition: cnttab.hxx:33
std::unique_ptr< SwForm > m_pCurrentForm
Definition: swuicnttab.hxx:411
bool IsReadonly() const
Definition: toxmgr.hxx:134
const OUString & GetTypeName() const
Definition: tox.hxx:660
static OUString GetFormChapterMark()
Definition: tox.cxx:509
void ApplyTOXDescription()
Definition: cnttab.cxx:902
void SetOutlineLevel(sal_uInt16 nSet)
Definition: cnttab.cxx:1675
MouseNotifyEvent GetType() const
#define ITEM_SEC_KEY
Definition: cnttab.cxx:3582
std::unique_ptr< weld::CheckButton > m_xUseDashCB
Definition: swuicnttab.hxx:169
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: cnttab.cxx:2120
sal_uInt16 nChapterFormat
Definition: tox.hxx:214
SwForm * m_pForm
Definition: swuicnttab.hxx:228
void SetAccessibleName(const OUString &rName)
Definition: cnttab.cxx:1446
bool IsSequence() const
Definition: authfld.hxx:102
void SetSortAlgorithm(const OUString &rSet)
Definition: toxmgr.hxx:163
sal_uInt16 GetFlatIndex() const
Definition: cnttab.cxx:205
static long lcl_TOXTypesToUserData(CurTOXType eType)
Definition: cnttab.cxx:844
BrowserMode
sal_uInt16 nAuthorityField
Definition: tox.hxx:216
virtual bool FillItemSet(SfxItemSet *) override
Definition: cnttab.cxx:839
DrawTextFlags
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
SwForm & GetForm()
Definition: swuicnttab.hxx:426
std::unique_ptr< weld::CheckButton > m_xFromOLECB
Definition: swuicnttab.hxx:149
Link< LinkParamNone *, void > m_aModifyHdl
Definition: swuicnttab.hxx:236
virtual void set_grid_left_attach(int nPos) override
Definition: cnttab.cxx:1451
bool IsFromChapter() const
Definition: tox.hxx:493
DocumentType const eType
sal_uInt16 GetLevel() const
Definition: tox.hxx:704
virtual ~SwTOXEntryTabPage() override
Definition: cnttab.cxx:1915
virtual void dispose() override
Definition: cnttab.cxx:3649
OUString m_sAdditionalAccnameString3
Definition: swuicnttab.hxx:240
void SetCreateFromObjectNames(bool bSet)
Definition: toxmgr.hxx:121
const OUString & GetTitle() const
Definition: tox.hxx:674
void AdjustPositions()
Definition: cnttab.cxx:3044
bool GoToRow(long nRow)
bool bSortAscending
Definition: authfld.hxx:48
void SetCurrentTOXType(const CurTOXType &eSet)
Definition: swuicnttab.hxx:99
SwCaptionDisplay GetCaptionDisplay() const
Definition: tox.hxx:508
SwDocShell * GetDocShell()
Definition: view.cxx:1115
void SetForm(SwForm &rForm, sal_uInt16 nLevel)
Definition: cnttab.cxx:2639
const SwFormToken & GetFormToken() const
Definition: cnttab.cxx:1626
Link< SwTOXEdit &, void > aPrevNextControlLink
Definition: cnttab.cxx:1406
OUString const sDelimStr
Definition: swuicnttab.hxx:308
void SetDefaultTOXBase(const SwTOXBase &rBase)
Definition: edtox.cxx:123
const OUString & GetSortAlgorithm() const
Definition: tox.hxx:519
std::unique_ptr< weld::Label > m_xTypeFT
Definition: swuicnttab.hxx:318
virtual short Execute()
std::unique_ptr< weld::Button > m_xPageNoPB
Definition: swuicnttab.hxx:326
OUString sComment
Definition: cnttab.cxx:129
std::unique_ptr< weld::CheckButton > m_xCollectSameCB
Definition: swuicnttab.hxx:167
void SetLanguage(LanguageType nLang)
Definition: toxmgr.hxx:160
ToxAuthorityField
Definition: toxe.hxx:82
bool IsNextControl() const
Definition: cnttab.cxx:1624
only the chapter number
Definition: chpfld.hxx:32
#define ITEM_PRIM_KEY
Definition: cnttab.cxx:3581
SwAutoMarkDlg_Impl(vcl::Window *pParent, const OUString &rAutoMarkURL, bool bCreate)
Definition: cnttab.cxx:3914
std::unique_ptr< weld::Label > m_xTypeFT
Definition: swuicnttab.hxx:130
void SetLevelFromChapter(bool bSet)
Definition:<