1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX
22 #include <sfx2/tabdlg.hxx>
23 #include <svx/langbox.hxx>
24 #include <vcl/idle.hxx>
25 #include <vcl/weld.hxx>
26 #include <vcl/customweld.hxx>
33 class IndexEntryResource
;
34 class IndexEntrySupplierWrapper
;
38 class SwTOXEntryTabPage
;
39 class SwOneExampleFrame
;
42 namespace com::sun::star
{
49 struct SwIndexSections_Impl
51 css::uno::Reference
< css::text::XTextSection
> xContainerSection
;
52 css::uno::Reference
< css::text::XDocumentIndex
> xDocumentIndex
;
55 class SwMultiTOXTabDialog final
: public SfxTabDialogController
57 std::unique_ptr
<SwTOXMgr
> m_pMgr
;
58 SwWrtShell
& m_rWrtShell
;
62 std::unique_ptr
<SwForm
> m_pForm
;
63 std::unique_ptr
<SwTOXDescription
> m_pDescription
;
64 std::optional
<SwIndexSections_Impl
> m_oIndexSections
;
66 std::vector
<TypeData
> m_vTypeData
;
68 SwTOXBase
* m_pParamTOXBase
;
70 CurTOXType m_eCurrentTOXType
;
72 OUString m_sUserDefinedIndex
;
73 sal_uInt16 m_nInitialTOXType
;
76 bool m_bExampleCreated
;
79 std::unique_ptr
<SwOneExampleFrame
> m_xExampleFrame
;
80 std::unique_ptr
<weld::CheckButton
> m_xShowExampleCB
;
81 std::unique_ptr
<weld::CustomWeld
> m_xExampleFrameWin
;
83 virtual short Ok() override
;
84 std::unique_ptr
<SwTOXDescription
> CreateTOXDescFromTOXBase(const SwTOXBase
*pCurTOX
);
87 DECL_LINK(CreateExample_Hdl
, SwOneExampleFrame
&, void);
88 DECL_LINK(ShowPreviewHdl
, weld::Toggleable
&, void);
91 SwMultiTOXTabDialog(weld::Widget
* pParent
, const SfxItemSet
& rSet
,
93 SwTOXBase
* pCurTOX
, sal_uInt16 nToxType
,
95 virtual ~SwMultiTOXTabDialog() override
;
97 virtual void PageCreated(const OUString
& rId
, SfxTabPage
&rPage
) override
;
99 SwForm
* GetForm(CurTOXType eType
);
101 const CurTOXType
& GetCurrentTOXType() const { return m_eCurrentTOXType
;}
102 void SetCurrentTOXType(const CurTOXType
& eSet
)
104 m_eCurrentTOXType
= eSet
;
107 bool IsTOXEditMode() const { return m_bEditTOX
;}
109 SwWrtShell
& GetWrtShell() {return m_rWrtShell
;}
111 SwTOXDescription
& GetTOXDescription(CurTOXType eTOXTypes
);
112 void CreateOrUpdateExample(
113 TOXTypes nTOXIndex
, sal_uInt16 nPage
= 0, sal_uInt16 nCurLevel
= USHRT_MAX
);
115 static bool IsNoNum(SwWrtShell
& rSh
, const OUString
& rName
);
118 class SwTOXSelectTabPage final
: public SfxTabPage
120 std::unique_ptr
<IndexEntryResource
> m_pIndexRes
;
122 OUString m_aStyleArr
[MAXLEVEL
];
123 OUString m_sAutoMarkURL
;
124 OUString m_sAutoMarkType
;
125 OUString m_sAddStyleUser
;
126 OUString m_sAddStyleContent
;
128 std::unique_ptr
<const IndexEntrySupplierWrapper
> m_pIndexEntryWrapper
;
130 bool m_bWaitingInitialSettings
;
132 std::unique_ptr
<weld::Entry
> m_xTitleED
;
133 std::unique_ptr
<weld::Label
> m_xTypeFT
;
134 std::unique_ptr
<weld::ComboBox
> m_xTypeLB
;
135 std::unique_ptr
<weld::CheckButton
> m_xReadOnlyCB
;
137 std::unique_ptr
<weld::Widget
> m_xAreaFrame
;
138 std::unique_ptr
<weld::ComboBox
> m_xAreaLB
;
139 std::unique_ptr
<weld::Widget
> m_xLevelFT
; //content, user
140 std::unique_ptr
<weld::SpinButton
> m_xLevelNF
; //content, user
143 std::unique_ptr
<weld::Widget
> m_xCreateFrame
; // content, user, illustration
144 std::unique_ptr
<weld::CheckButton
> m_xFromHeadingsCB
;
145 std::unique_ptr
<weld::CheckButton
> m_xStylesCB
;
146 std::unique_ptr
<weld::CheckButton
> m_xAddStylesCB
;
147 std::unique_ptr
<weld::Button
> m_xAddStylesPB
;
149 std::unique_ptr
<weld::CheckButton
> m_xFromTablesCB
;
150 std::unique_ptr
<weld::CheckButton
> m_xFromFramesCB
;
151 std::unique_ptr
<weld::CheckButton
> m_xFromGraphicsCB
;
152 std::unique_ptr
<weld::CheckButton
> m_xFromOLECB
;
153 std::unique_ptr
<weld::CheckButton
> m_xLevelFromChapterCB
;
155 //illustration + table
156 std::unique_ptr
<weld::RadioButton
> m_xFromCaptionsRB
;
157 std::unique_ptr
<weld::RadioButton
> m_xFromObjectNamesRB
;
159 //illustration and tables
160 std::unique_ptr
<weld::Label
> m_xCaptionSequenceFT
;
161 std::unique_ptr
<weld::ComboBox
> m_xCaptionSequenceLB
;
162 std::unique_ptr
<weld::Label
> m_xDisplayTypeFT
;
163 std::unique_ptr
<weld::ComboBox
> m_xDisplayTypeLB
;
164 std::unique_ptr
<weld::CheckButton
> m_xParaStyleCB
;
165 std::unique_ptr
<weld::ComboBox
> m_xParaStyleLB
;
167 //all but illustration and table
168 std::unique_ptr
<weld::CheckButton
> m_xTOXMarksCB
;
171 std::unique_ptr
<weld::Widget
> m_xIdxOptionsFrame
;
172 std::unique_ptr
<weld::CheckButton
> m_xCollectSameCB
;
173 std::unique_ptr
<weld::CheckButton
> m_xUseFFCB
;
174 std::unique_ptr
<weld::CheckButton
> m_xUseDashCB
;
175 std::unique_ptr
<weld::CheckButton
> m_xCaseSensitiveCB
;
176 std::unique_ptr
<weld::CheckButton
> m_xInitialCapsCB
;
177 std::unique_ptr
<weld::CheckButton
> m_xKeyAsEntryCB
;
178 std::unique_ptr
<weld::CheckButton
> m_xFromFileCB
;
179 std::unique_ptr
<weld::MenuButton
> m_xAutoMarkPB
;
182 std::unique_ptr
<weld::TreeView
> m_xFromObjCLB
;
183 std::unique_ptr
<weld::Widget
> m_xFromObjFrame
;
185 std::unique_ptr
<weld::CheckButton
> m_xSequenceCB
;
186 std::unique_ptr
<weld::ComboBox
> m_xBracketLB
;
187 std::unique_ptr
<weld::Widget
> m_xAuthorityFrame
;
190 std::unique_ptr
<weld::Widget
> m_xSortFrame
;
191 std::unique_ptr
<SvxLanguageBox
> m_xLanguageLB
;
192 std::unique_ptr
<weld::ComboBox
> m_xSortAlgorithmLB
;
194 DECL_LINK(TOXTypeHdl
, weld::ComboBox
&, void );
195 DECL_LINK(AddStylesHdl
, weld::Button
&, void );
196 DECL_LINK(MenuEnableHdl
, weld::Toggleable
&, void);
197 DECL_LINK(MenuExecuteHdl
, const OUString
&, void);
198 DECL_LINK(LanguageListBoxHdl
, weld::ComboBox
&, void);
199 void LanguageHdl(const weld::ComboBox
*);
200 DECL_LINK(CheckBoxHdl
, weld::Toggleable
&, void );
201 DECL_LINK(RadioButtonHdl
, weld::Toggleable
&, void);
202 DECL_LINK(ModifyEntryHdl
, weld::Entry
&, void);
203 DECL_LINK(ModifySpinHdl
, weld::SpinButton
&, void);
204 DECL_LINK(ModifyListBoxHdl
, weld::ComboBox
&, void);
207 void ApplyTOXDescription();
208 void FillTOXDescription();
211 SwTOXSelectTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
212 virtual ~SwTOXSelectTabPage() override
;
214 virtual bool FillItemSet( SfxItemSet
* ) override
;
215 virtual void Reset( const SfxItemSet
* ) override
;
217 virtual void ActivatePage( const SfxItemSet
& ) override
;
218 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
220 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
221 const SfxItemSet
* rAttrSet
);
223 void SelectType(TOXTypes eSet
); //preset TOXType, GlobalDoc
224 void SetWrtShell(SwWrtShell
const & rSh
);
232 OUString m_aButtonTexts
[TOKEN_END
]; // Text of the buttons
233 OUString m_aButtonHelpTexts
[TOKEN_END
]; // QuickHelpText of the buttons
234 OUString m_sCharStyle
;
235 Link
<SwFormToken
&,void> m_aButtonSelectedHdl
;
236 SwTOXWidget
* m_pActiveCtrl
;
237 Link
<LinkParamNone
*,void> m_aModifyHdl
;
238 OUString m_sAccessibleName
;
239 OUString m_sAdditionalAccnameString1
;
240 OUString m_sAdditionalAccnameString2
;
241 OUString m_sAdditionalAccnameString3
;
243 Idle m_aAdjustPositionsIdle
;
245 SwTOXEntryTabPage
* m_pParent
;
246 std::unique_ptr
<weld::Container
> m_xParentWidget
;
247 std::unique_ptr
<weld::Builder
> m_xBuilder
;
248 std::unique_ptr
<weld::Container
> m_xContainer
;
249 std::unique_ptr
<weld::Button
> m_xLeftScrollWin
;
250 std::unique_ptr
<weld::Container
> m_xCtrlParentWin
;
251 std::unique_ptr
<weld::ScrolledWindow
> m_xScrollWin
;
252 std::unique_ptr
<weld::Button
> m_xRightScrollWin
;
253 std::vector
<std::unique_ptr
<SwTOXWidget
>> m_aControlList
;
255 DECL_LINK(EditResize
, SwTOXEdit
&, void);
256 DECL_LINK(NextItemHdl
, SwTOXEdit
&, void);
257 DECL_LINK(TbxFocusHdl
, SwTOXWidget
&, void);
258 DECL_LINK(NextItemBtnHdl
, SwTOXButton
&, void);
259 DECL_LINK(TbxFocusBtnHdl
, SwTOXWidget
&, void);
260 DECL_LINK(ScrollBtnHdl
, weld::Button
&, void);
261 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
262 DECL_LINK(AdjustPositionsHdl
, const Size
&, void);
264 void SetActiveControl(SwTOXWidget
* pSet
);
266 SwTOXWidget
* InsertItem(const OUString
& rText
, const SwFormToken
& aToken
);
267 void AdjustPositions();
268 void AdjustScrolling();
269 void MoveControls(tools::Long nOffset
);
272 SwTokenWindow(std::unique_ptr
<weld::Container
> xParent
);
273 weld::Container
* get_child_container() { return m_xCtrlParentWin
.get(); }
276 void SetTabPage(SwTOXEntryTabPage
*pParent
) { m_pParent
= pParent
; }
278 void SetForm(SwForm
& rForm
, sal_uInt16 nLevel
);
279 sal_uInt16
GetLastLevel()const {return m_nLevel
;};
281 bool IsValid() const {return m_bValid
;}
283 void SetInvalid() {m_bValid
= false;}
285 OUString
GetPattern() const;
287 void SetButtonSelectedHdl(const Link
<SwFormToken
&,void>& rLink
)
288 { m_aButtonSelectedHdl
= rLink
;}
290 void SetModifyHdl(const Link
<LinkParamNone
*,void>& rLink
){m_aModifyHdl
= rLink
;}
292 SwTOXWidget
* GetActiveControl() { return m_pActiveCtrl
; }
294 void InsertAtSelection(const SwFormToken
& aToken
);
295 void RemoveControl(const SwTOXButton
* pDel
, bool bInternalCall
= false);
297 bool Contains(FormTokenType
) const;
299 //helper for pattern buttons and edits
300 OUString
CreateQuickHelp(const SwFormToken
& rToken
);
302 void SetFocus2theAllBtn();
304 sal_uInt32
GetControlIndex(FormTokenType eType
) const;
307 class SwTOXEntryTabPage final
: public SfxTabPage
309 OUString m_sDelimStr
;
310 OUString m_sLevelStr
;
311 OUString m_sAuthTypeStr
;
313 OUString m_sNoCharStyle
;
314 SwForm
* m_pCurrentForm
;
316 CurTOXType m_aLastTOXType
;
319 std::unique_ptr
<weld::Label
> m_xTypeFT
;
320 std::unique_ptr
<weld::Label
> m_xLevelFT
;
321 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
322 std::unique_ptr
<weld::Button
> m_xAllLevelsPB
;
323 std::unique_ptr
<weld::Button
> m_xEntryNoPB
;
324 std::unique_ptr
<weld::Button
> m_xEntryPB
;
325 std::unique_ptr
<weld::Button
> m_xTabPB
;
326 std::unique_ptr
<weld::Button
> m_xChapterInfoPB
;
327 std::unique_ptr
<weld::Button
> m_xPageNoPB
;
328 std::unique_ptr
<weld::Button
> m_xHyperLinkPB
;
329 std::unique_ptr
<weld::Widget
> m_xFieldBox
;
330 std::unique_ptr
<weld::ComboBox
> m_xAuthFieldsLB
;
331 std::unique_ptr
<weld::Button
> m_xAuthInsertPB
;
332 std::unique_ptr
<weld::Button
> m_xAuthRemovePB
;
333 std::unique_ptr
<weld::ComboBox
> m_xCharStyleLB
; // character style of the current token
334 std::unique_ptr
<weld::Button
> m_xEditStylePB
;
335 std::unique_ptr
<weld::Label
> m_xChapterEntryFT
;
336 std::unique_ptr
<weld::ComboBox
> m_xChapterEntryLB
; // type of chapter info
337 std::unique_ptr
<weld::Label
> m_xNumberFormatFT
;
338 std::unique_ptr
<weld::ComboBox
> m_xNumberFormatLB
; //!< format for numbering (E#)
339 std::unique_ptr
<weld::Label
> m_xEntryOutlineLevelFT
; //!< Fixed text, for i53420
340 std::unique_ptr
<weld::SpinButton
> m_xEntryOutlineLevelNF
; //!< level to evaluate outline level to, for i53420
341 std::unique_ptr
<weld::Label
> m_xFillCharFT
;
342 std::unique_ptr
<weld::ComboBox
> m_xFillCharCB
; // fill char for tab stop
343 std::unique_ptr
<weld::Label
> m_xTabPosFT
;
344 std::unique_ptr
<weld::MetricSpinButton
> m_xTabPosMF
; // tab stop position
345 std::unique_ptr
<weld::CheckButton
> m_xAutoRightCB
;
346 std::unique_ptr
<weld::Widget
> m_xFormatFrame
;
347 std::unique_ptr
<weld::Label
> m_xMainEntryStyleFT
;
348 std::unique_ptr
<weld::ComboBox
> m_xMainEntryStyleLB
; // character style of main entries in indexes
349 std::unique_ptr
<weld::CheckButton
> m_xAlphaDelimCB
;
350 std::unique_ptr
<weld::CheckButton
> m_xCommaSeparatedCB
;
351 std::unique_ptr
<weld::CheckButton
> m_xRelToStyleCB
; // position relative to the right margin of the para style
352 std::unique_ptr
<weld::Widget
> m_xSortingFrame
;
353 std::unique_ptr
<weld::RadioButton
> m_xSortDocPosRB
;
354 std::unique_ptr
<weld::RadioButton
> m_xSortContentRB
;
355 std::unique_ptr
<weld::Widget
> m_xSortKeyFrame
;
356 std::unique_ptr
<weld::ComboBox
> m_xFirstKeyLB
;
357 std::unique_ptr
<weld::ToggleButton
> m_xFirstSortUpRB
;
358 std::unique_ptr
<weld::ToggleButton
> m_xFirstSortDownRB
;
359 std::unique_ptr
<weld::ComboBox
> m_xSecondKeyLB
;
360 std::unique_ptr
<weld::ToggleButton
> m_xSecondSortUpRB
;
361 std::unique_ptr
<weld::ToggleButton
> m_xSecondSortDownRB
;
362 std::unique_ptr
<weld::ComboBox
> m_xThirdKeyLB
;
363 std::unique_ptr
<weld::ToggleButton
> m_xThirdSortUpRB
;
364 std::unique_ptr
<weld::ToggleButton
> m_xThirdSortDownRB
;
365 std::unique_ptr
<SwTokenWindow
> m_xTokenWIN
;
367 DECL_LINK(StyleSelectHdl
, weld::ComboBox
&, void);
368 DECL_LINK(EditStyleHdl
, weld::Button
&, void);
369 DECL_LINK(InsertTokenHdl
, weld::Button
&, void);
370 DECL_LINK(LevelHdl
, weld::TreeView
&, void);
371 DECL_LINK(AutoRightHdl
, weld::Toggleable
&, void);
372 DECL_LINK(TokenSelectedHdl
, SwFormToken
&, void);
373 DECL_LINK(TabPosHdl
, weld::MetricSpinButton
&, void);
374 DECL_LINK(FillCharHdl
, weld::ComboBox
&, void);
375 DECL_LINK(RemoveInsertAuthHdl
, weld::Button
&, void);
376 DECL_LINK(SortKeyHdl
, weld::Toggleable
&, void);
377 DECL_LINK(ChapterInfoHdl
, weld::ComboBox
&, void);
378 DECL_LINK(ChapterInfoOutlineHdl
, weld::SpinButton
&, void);
379 DECL_LINK(NumberFormatHdl
, weld::ComboBox
&, void);
380 DECL_LINK(ToggleHdl
, weld::Toggleable
&, void);
382 DECL_LINK(AllLevelsHdl
, weld::Button
&, void);
384 void WriteBackLevel();
385 void UpdateDescriptor();
386 DECL_LINK(ModifyHdl
, LinkParamNone
*, void);
387 void OnModify(bool bAllLevels
);
388 DECL_LINK(ModifyClickHdl
, weld::Toggleable
&, void);
390 void ShowHideControls(int eType
);
393 SwTOXEntryTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
394 virtual ~SwTOXEntryTabPage() override
;
396 virtual bool FillItemSet( SfxItemSet
* ) override
;
397 virtual void Reset( const SfxItemSet
* ) override
;
398 virtual void ActivatePage( const SfxItemSet
& ) override
;
399 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
401 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
402 const SfxItemSet
* rAttrSet
);
403 void SetWrtShell(SwWrtShell
& rSh
);
405 void PreTokenButtonRemoved(const SwFormToken
& rToken
);
406 void SetFocus2theAllBtn();
409 class SwTOXStylesTabPage final
: public SfxTabPage
411 std::unique_ptr
<SwForm
> m_pCurrentForm
;
413 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
414 std::unique_ptr
<weld::Button
> m_xAssignBT
;
415 std::unique_ptr
<weld::TreeView
> m_xParaLayLB
;
416 std::unique_ptr
<weld::Button
> m_xStdBT
;
417 std::unique_ptr
<weld::Button
> m_xEditStyleBT
;
419 DECL_LINK(EditStyleHdl
, weld::Button
&, void);
420 DECL_LINK(StdHdl
, weld::Button
&, void);
421 DECL_LINK(EnableSelectHdl
, weld::TreeView
&, void);
422 DECL_LINK(DoubleClickHdl
, weld::TreeView
&, bool);
423 DECL_LINK(AssignHdl
, weld::Button
&, void);
428 SwMultiTOXTabDialog
* pDlg
= static_cast<SwMultiTOXTabDialog
*>(GetDialogController());
429 return *pDlg
->GetForm(pDlg
->GetCurrentTOXType());
433 SwTOXStylesTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
434 virtual ~SwTOXStylesTabPage() override
;
436 virtual bool FillItemSet( SfxItemSet
* ) override
;
437 virtual void Reset( const SfxItemSet
* ) override
;
439 virtual void ActivatePage( const SfxItemSet
& ) override
;
440 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
442 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
443 const SfxItemSet
* rAttrSet
);
447 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX
449 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */