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