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