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