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
: 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::unique_ptr
<SwIndexSections_Impl
> m_pxIndexSections
;
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
);
86 DECL_LINK(CreateExample_Hdl
, SwOneExampleFrame
&, void);
87 DECL_LINK(ShowPreviewHdl
, weld::ToggleButton
&, void);
90 SwMultiTOXTabDialog(weld::Window
* pParent
, const SfxItemSet
& rSet
,
92 SwTOXBase
* pCurTOX
, sal_uInt16 nToxType
,
94 virtual ~SwMultiTOXTabDialog() override
;
96 virtual void PageCreated(const OString
& rId
, SfxTabPage
&rPage
) override
;
98 SwForm
* GetForm(CurTOXType eType
);
100 const CurTOXType
& GetCurrentTOXType() const { return m_eCurrentTOXType
;}
101 void SetCurrentTOXType(const CurTOXType
& eSet
)
103 m_eCurrentTOXType
= eSet
;
106 bool IsTOXEditMode() const { return m_bEditTOX
;}
108 SwWrtShell
& GetWrtShell() {return m_rWrtShell
;}
110 SwTOXDescription
& GetTOXDescription(CurTOXType eTOXTypes
);
111 void CreateOrUpdateExample(
112 TOXTypes nTOXIndex
, sal_uInt16 nPage
= 0, sal_uInt16 nCurLevel
= USHRT_MAX
);
114 static bool IsNoNum(SwWrtShell
& rSh
, const OUString
& rName
);
117 class SwTOXSelectTabPage
: public SfxTabPage
119 std::unique_ptr
<IndexEntryResource
> pIndexRes
;
121 OUString aStyleArr
[MAXLEVEL
];
122 OUString sAutoMarkURL
;
123 OUString sAutoMarkType
;
124 OUString sAddStyleUser
;
125 OUString sAddStyleContent
;
127 std::unique_ptr
<const IndexEntrySupplierWrapper
> pIndexEntryWrapper
;
129 bool m_bWaitingInitialSettings
;
131 std::unique_ptr
<weld::Entry
> m_xTitleED
;
132 std::unique_ptr
<weld::Label
> m_xTypeFT
;
133 std::unique_ptr
<weld::ComboBox
> m_xTypeLB
;
134 std::unique_ptr
<weld::CheckButton
> m_xReadOnlyCB
;
136 std::unique_ptr
<weld::Widget
> m_xAreaFrame
;
137 std::unique_ptr
<weld::ComboBox
> m_xAreaLB
;
138 std::unique_ptr
<weld::Widget
> m_xLevelFT
; //content, user
139 std::unique_ptr
<weld::SpinButton
> m_xLevelNF
; //content, user
142 std::unique_ptr
<weld::Widget
> m_xCreateFrame
; // content, user, illustration
143 std::unique_ptr
<weld::CheckButton
> m_xFromHeadingsCB
;
144 std::unique_ptr
<weld::CheckButton
> m_xStylesCB
;
145 std::unique_ptr
<weld::CheckButton
> m_xAddStylesCB
;
146 std::unique_ptr
<weld::Button
> m_xAddStylesPB
;
148 std::unique_ptr
<weld::CheckButton
> m_xFromTablesCB
;
149 std::unique_ptr
<weld::CheckButton
> m_xFromFramesCB
;
150 std::unique_ptr
<weld::CheckButton
> m_xFromGraphicsCB
;
151 std::unique_ptr
<weld::CheckButton
> m_xFromOLECB
;
152 std::unique_ptr
<weld::CheckButton
> m_xLevelFromChapterCB
;
154 //illustration + table
155 std::unique_ptr
<weld::RadioButton
> m_xFromCaptionsRB
;
156 std::unique_ptr
<weld::RadioButton
> m_xFromObjectNamesRB
;
158 //illustration and tables
159 std::unique_ptr
<weld::Label
> m_xCaptionSequenceFT
;
160 std::unique_ptr
<weld::ComboBox
> m_xCaptionSequenceLB
;
161 std::unique_ptr
<weld::Label
> m_xDisplayTypeFT
;
162 std::unique_ptr
<weld::ComboBox
> m_xDisplayTypeLB
;
164 //all but illustration and table
165 std::unique_ptr
<weld::CheckButton
> m_xTOXMarksCB
;
168 std::unique_ptr
<weld::Widget
> m_xIdxOptionsFrame
;
169 std::unique_ptr
<weld::CheckButton
> m_xCollectSameCB
;
170 std::unique_ptr
<weld::CheckButton
> m_xUseFFCB
;
171 std::unique_ptr
<weld::CheckButton
> m_xUseDashCB
;
172 std::unique_ptr
<weld::CheckButton
> m_xCaseSensitiveCB
;
173 std::unique_ptr
<weld::CheckButton
> m_xInitialCapsCB
;
174 std::unique_ptr
<weld::CheckButton
> m_xKeyAsEntryCB
;
175 std::unique_ptr
<weld::CheckButton
> m_xFromFileCB
;
176 std::unique_ptr
<weld::MenuButton
> m_xAutoMarkPB
;
179 std::unique_ptr
<weld::TreeView
> m_xFromObjCLB
;
180 std::unique_ptr
<weld::Widget
> m_xFromObjFrame
;
182 std::unique_ptr
<weld::CheckButton
> m_xSequenceCB
;
183 std::unique_ptr
<weld::ComboBox
> m_xBracketLB
;
184 std::unique_ptr
<weld::Widget
> m_xAuthorityFrame
;
187 std::unique_ptr
<weld::Widget
> m_xSortFrame
;
188 std::unique_ptr
<SvxLanguageBox
> m_xLanguageLB
;
189 std::unique_ptr
<weld::ComboBox
> m_xSortAlgorithmLB
;
191 DECL_LINK(TOXTypeHdl
, weld::ComboBox
&, void );
192 DECL_LINK(AddStylesHdl
, weld::Button
&, void );
193 DECL_LINK(MenuEnableHdl
, weld::ToggleButton
&, void);
194 DECL_LINK(MenuExecuteHdl
, const OString
&, void);
195 DECL_LINK(LanguageListBoxHdl
, weld::ComboBox
&, void);
196 void LanguageHdl(const weld::ComboBox
*);
197 DECL_LINK(CheckBoxHdl
, weld::ToggleButton
&, void );
198 DECL_LINK(RadioButtonHdl
, weld::ToggleButton
&, void);
199 DECL_LINK(ModifyEntryHdl
, weld::Entry
&, void);
200 DECL_LINK(ModifySpinHdl
, weld::SpinButton
&, void);
201 DECL_LINK(ModifyListBoxHdl
, weld::ComboBox
&, void);
204 void ApplyTOXDescription();
205 void FillTOXDescription();
208 SwTOXSelectTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
209 virtual ~SwTOXSelectTabPage() override
;
211 virtual bool FillItemSet( SfxItemSet
* ) override
;
212 virtual void Reset( const SfxItemSet
* ) override
;
214 virtual void ActivatePage( const SfxItemSet
& ) override
;
215 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
217 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
218 const SfxItemSet
* rAttrSet
);
220 void SelectType(TOXTypes eSet
); //preset TOXType, GlobalDoc
221 void SetWrtShell(SwWrtShell
const & rSh
);
229 OUString m_aButtonTexts
[TOKEN_END
]; // Text of the buttons
230 OUString m_aButtonHelpTexts
[TOKEN_END
]; // QuickHelpText of the buttons
231 OUString m_sCharStyle
;
232 Link
<SwFormToken
&,void> m_aButtonSelectedHdl
;
233 SwTOXWidget
* m_pActiveCtrl
;
234 Link
<LinkParamNone
*,void> m_aModifyHdl
;
235 OUString m_sAccessibleName
;
236 OUString m_sAdditionalAccnameString1
;
237 OUString m_sAdditionalAccnameString2
;
238 OUString m_sAdditionalAccnameString3
;
240 Idle m_aAdjustPositionsIdle
;
242 SwTOXEntryTabPage
* m_pParent
;
243 std::unique_ptr
<weld::Container
> m_xParentWidget
;
244 std::unique_ptr
<weld::Builder
> m_xBuilder
;
245 std::unique_ptr
<weld::Container
> m_xContainer
;
246 std::unique_ptr
<weld::Button
> m_xLeftScrollWin
;
247 std::unique_ptr
<weld::Container
> m_xCtrlParentWin
;
248 std::unique_ptr
<weld::ScrolledWindow
> m_xScrollWin
;
249 std::unique_ptr
<weld::Button
> m_xRightScrollWin
;
250 std::vector
<std::unique_ptr
<SwTOXWidget
>> m_aControlList
;
252 DECL_LINK(EditResize
, SwTOXEdit
&, void);
253 DECL_LINK(NextItemHdl
, SwTOXEdit
&, void);
254 DECL_LINK(TbxFocusHdl
, SwTOXWidget
&, void);
255 DECL_LINK(NextItemBtnHdl
, SwTOXButton
&, void);
256 DECL_LINK(TbxFocusBtnHdl
, SwTOXWidget
&, void);
257 DECL_LINK(ScrollBtnHdl
, weld::Button
&, void);
258 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
259 DECL_LINK(AdjustPositionsHdl
, const Size
&, void);
261 void SetActiveControl(SwTOXWidget
* pSet
);
263 SwTOXWidget
* InsertItem(const OUString
& rText
, const SwFormToken
& aToken
);
264 void AdjustPositions();
265 void AdjustScrolling();
266 void MoveControls(tools::Long nOffset
);
269 SwTokenWindow(std::unique_ptr
<weld::Container
> xParent
);
270 weld::Container
* get_child_container() { return m_xCtrlParentWin
.get(); }
273 void SetTabPage(SwTOXEntryTabPage
*pParent
) { m_pParent
= pParent
; }
275 void SetForm(SwForm
& rForm
, sal_uInt16 nLevel
);
276 sal_uInt16
GetLastLevel()const {return m_nLevel
;};
278 bool IsValid() const {return m_bValid
;}
280 void SetInvalid() {m_bValid
= false;}
282 OUString
GetPattern() const;
284 void SetButtonSelectedHdl(const Link
<SwFormToken
&,void>& rLink
)
285 { m_aButtonSelectedHdl
= rLink
;}
287 void SetModifyHdl(const Link
<LinkParamNone
*,void>& rLink
){m_aModifyHdl
= rLink
;}
289 SwTOXWidget
* GetActiveControl() { return m_pActiveCtrl
; }
291 void InsertAtSelection(const SwFormToken
& aToken
);
292 void RemoveControl(const SwTOXButton
* pDel
, bool bInternalCall
= false);
294 bool Contains(FormTokenType
) const;
296 //helper for pattern buttons and edits
297 OUString
CreateQuickHelp(const SwFormToken
& rToken
);
299 void SetFocus2theAllBtn();
301 sal_uInt32
GetControlIndex(FormTokenType eType
) const;
304 class SwTOXEntryTabPage
: public SfxTabPage
308 OUString sAuthTypeStr
;
310 OUString sNoCharStyle
;
311 SwForm
* m_pCurrentForm
;
313 CurTOXType aLastTOXType
;
316 std::unique_ptr
<weld::Label
> m_xTypeFT
;
317 std::unique_ptr
<weld::Label
> m_xLevelFT
;
318 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
319 std::unique_ptr
<weld::Button
> m_xAllLevelsPB
;
320 std::unique_ptr
<weld::Button
> m_xEntryNoPB
;
321 std::unique_ptr
<weld::Button
> m_xEntryPB
;
322 std::unique_ptr
<weld::Button
> m_xTabPB
;
323 std::unique_ptr
<weld::Button
> m_xChapterInfoPB
;
324 std::unique_ptr
<weld::Button
> m_xPageNoPB
;
325 std::unique_ptr
<weld::Button
> m_xHyperLinkPB
;
326 std::unique_ptr
<weld::ComboBox
> m_xAuthFieldsLB
;
327 std::unique_ptr
<weld::Button
> m_xAuthInsertPB
;
328 std::unique_ptr
<weld::Button
> m_xAuthRemovePB
;
329 std::unique_ptr
<weld::ComboBox
> m_xCharStyleLB
; // character style of the current token
330 std::unique_ptr
<weld::Button
> m_xEditStylePB
;
331 std::unique_ptr
<weld::Label
> m_xChapterEntryFT
;
332 std::unique_ptr
<weld::ComboBox
> m_xChapterEntryLB
; // type of chapter info
333 std::unique_ptr
<weld::Label
> m_xNumberFormatFT
;
334 std::unique_ptr
<weld::ComboBox
> m_xNumberFormatLB
; //!< format for numbering (E#)
335 std::unique_ptr
<weld::Label
> m_xEntryOutlineLevelFT
; //!< Fixed text, for i53420
336 std::unique_ptr
<weld::SpinButton
> m_xEntryOutlineLevelNF
; //!< level to evaluate outline level to, for i53420
337 std::unique_ptr
<weld::Label
> m_xFillCharFT
;
338 std::unique_ptr
<weld::ComboBox
> m_xFillCharCB
; // fill char for tab stop
339 std::unique_ptr
<weld::Label
> m_xTabPosFT
;
340 std::unique_ptr
<weld::MetricSpinButton
> m_xTabPosMF
; // tab stop position
341 std::unique_ptr
<weld::CheckButton
> m_xAutoRightCB
;
342 std::unique_ptr
<weld::Widget
> m_xFormatFrame
;
343 std::unique_ptr
<weld::Label
> m_xMainEntryStyleFT
;
344 std::unique_ptr
<weld::ComboBox
> m_xMainEntryStyleLB
; // character style of main entries in indexes
345 std::unique_ptr
<weld::CheckButton
> m_xAlphaDelimCB
;
346 std::unique_ptr
<weld::CheckButton
> m_xCommaSeparatedCB
;
347 std::unique_ptr
<weld::CheckButton
> m_xRelToStyleCB
; // position relative to the right margin of the para style
348 std::unique_ptr
<weld::Widget
> m_xSortingFrame
;
349 std::unique_ptr
<weld::RadioButton
> m_xSortDocPosRB
;
350 std::unique_ptr
<weld::RadioButton
> m_xSortContentRB
;
351 std::unique_ptr
<weld::Widget
> m_xSortKeyFrame
;
352 std::unique_ptr
<weld::ComboBox
> m_xFirstKeyLB
;
353 std::unique_ptr
<weld::RadioButton
> m_xFirstSortUpRB
;
354 std::unique_ptr
<weld::RadioButton
> m_xFirstSortDownRB
;
355 std::unique_ptr
<weld::ComboBox
> m_xSecondKeyLB
;
356 std::unique_ptr
<weld::RadioButton
> m_xSecondSortUpRB
;
357 std::unique_ptr
<weld::RadioButton
> m_xSecondSortDownRB
;
358 std::unique_ptr
<weld::ComboBox
> m_xThirdKeyLB
;
359 std::unique_ptr
<weld::RadioButton
> m_xThirdSortUpRB
;
360 std::unique_ptr
<weld::RadioButton
> m_xThirdSortDownRB
;
361 std::unique_ptr
<SwTokenWindow
> m_xTokenWIN
;
363 DECL_LINK(StyleSelectHdl
, weld::ComboBox
&, void);
364 DECL_LINK(EditStyleHdl
, weld::Button
&, void);
365 DECL_LINK(InsertTokenHdl
, weld::Button
&, void);
366 DECL_LINK(LevelHdl
, weld::TreeView
&, void);
367 DECL_LINK(AutoRightHdl
, weld::ToggleButton
&, void);
368 DECL_LINK(TokenSelectedHdl
, SwFormToken
&, void);
369 DECL_LINK(TabPosHdl
, weld::MetricSpinButton
&, void);
370 DECL_LINK(FillCharHdl
, weld::ComboBox
&, void);
371 DECL_LINK(RemoveInsertAuthHdl
, weld::Button
&, void);
372 DECL_LINK(SortKeyHdl
, weld::ToggleButton
&, void);
373 DECL_LINK(ChapterInfoHdl
, weld::ComboBox
&, void);
374 DECL_LINK(ChapterInfoOutlineHdl
, weld::SpinButton
&, void);
375 DECL_LINK(NumberFormatHdl
, weld::ComboBox
&, void);
377 DECL_LINK(AllLevelsHdl
, weld::Button
&, void);
379 void WriteBackLevel();
380 void UpdateDescriptor();
381 DECL_LINK(ModifyHdl
, LinkParamNone
*, void);
382 void OnModify(bool bAllLevels
);
383 DECL_LINK(ModifyClickHdl
, weld::ToggleButton
&, void);
386 SwTOXEntryTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
387 virtual ~SwTOXEntryTabPage() override
;
389 virtual bool FillItemSet( SfxItemSet
* ) override
;
390 virtual void Reset( const SfxItemSet
* ) override
;
391 virtual void ActivatePage( const SfxItemSet
& ) override
;
392 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
394 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
395 const SfxItemSet
* rAttrSet
);
396 void SetWrtShell(SwWrtShell
& rSh
);
398 void PreTokenButtonRemoved(const SwFormToken
& rToken
);
399 void SetFocus2theAllBtn();
402 class SwTOXStylesTabPage
: public SfxTabPage
404 std::unique_ptr
<SwForm
> m_pCurrentForm
;
406 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
407 std::unique_ptr
<weld::Button
> m_xAssignBT
;
408 std::unique_ptr
<weld::TreeView
> m_xParaLayLB
;
409 std::unique_ptr
<weld::Button
> m_xStdBT
;
410 std::unique_ptr
<weld::Button
> m_xEditStyleBT
;
412 DECL_LINK(EditStyleHdl
, weld::Button
&, void);
413 DECL_LINK(StdHdl
, weld::Button
&, void);
414 DECL_LINK(EnableSelectHdl
, weld::TreeView
&, void);
415 DECL_LINK(DoubleClickHdl
, weld::TreeView
&, bool);
416 DECL_LINK(AssignHdl
, weld::Button
&, void);
421 SwMultiTOXTabDialog
* pDlg
= static_cast<SwMultiTOXTabDialog
*>(GetDialogController());
422 return *pDlg
->GetForm(pDlg
->GetCurrentTOXType());
426 SwTOXStylesTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
);
427 virtual ~SwTOXStylesTabPage() override
;
429 virtual bool FillItemSet( SfxItemSet
* ) override
;
430 virtual void Reset( const SfxItemSet
* ) override
;
432 virtual void ActivatePage( const SfxItemSet
& ) override
;
433 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
435 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
436 const SfxItemSet
* rAttrSet
);
440 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX
442 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */