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