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_REGIONSW_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_REGIONSW_HXX
22 #include <sfx2/basedlgs.hxx>
23 #include <sfx2/tabdlg.hxx>
25 #include "condedit.hxx"
26 #include <section.hxx>
27 #include <fmtftntx.hxx>
28 #include <numberingtypelistbox.hxx>
29 #include <svx/paraprev.hxx>
38 class DocumentInserter
;
39 class FileDialogHelper
;
42 // dialog "edit regions"
44 typedef std::map
<size_t, std::unique_ptr
<SectRepr
>> SectReprs_t
;
46 class SwEditRegionDlg final
: public SfxDialogController
48 bool m_bSubRegionsFilled
;
51 SectReprs_t m_SectReprs
;
52 const SwSection
* m_pCurrSect
;
53 std::unique_ptr
<sfx2::DocumentInserter
> m_pDocInserter
;
55 bool m_bDontCheckPasswd
: 1;
57 std::unique_ptr
<weld::Entry
> m_xCurName
;
58 std::unique_ptr
<weld::TreeView
> m_xTree
;
59 std::unique_ptr
<weld::CheckButton
> m_xFileCB
;
60 std::unique_ptr
<weld::CheckButton
> m_xDDECB
;
61 std::unique_ptr
<weld::Widget
> m_xDDEFrame
;
62 std::unique_ptr
<weld::Label
> m_xFileNameFT
;
63 std::unique_ptr
<weld::Label
> m_xDDECommandFT
;
64 std::unique_ptr
<weld::Entry
> m_xFileNameED
;
65 std::unique_ptr
<weld::Button
> m_xFilePB
;
66 std::unique_ptr
<weld::Label
> m_xSubRegionFT
;
67 std::unique_ptr
<weld::ComboBox
> m_xSubRegionED
;
68 std::unique_ptr
<weld::CheckButton
> m_xProtectCB
;
69 std::unique_ptr
<weld::CheckButton
> m_xPasswdCB
;
70 std::unique_ptr
<weld::Button
> m_xPasswdPB
;
71 std::unique_ptr
<weld::CheckButton
> m_xHideCB
;
72 std::unique_ptr
<weld::Label
> m_xConditionFT
;
73 std::unique_ptr
<ConditionEdit
<weld::Entry
>> m_xConditionED
;
74 // #114856# edit in readonly sections
75 std::unique_ptr
<weld::CheckButton
> m_xEditInReadonlyCB
;
76 std::unique_ptr
<weld::Button
> m_xOK
;
77 std::unique_ptr
<weld::Button
> m_xOptionsPB
;
78 std::unique_ptr
<weld::Button
> m_xDismiss
;
79 std::unique_ptr
<weld::Widget
> m_xHideFrame
;
80 std::unique_ptr
<weld::Frame
> m_xLinkFrame
;
82 void RecurseList(const SwSectionFormat
* pFormat
, const weld::TreeIter
* pIter
);
83 size_t FindArrPos(const SwSectionFormat
* pFormat
);
85 DECL_LINK(GetFirstEntryHdl
, weld::TreeView
&, void);
87 DECL_LINK(OkHdl
, weld::Button
&, void);
88 DECL_LINK(NameEditHdl
, weld::Entry
&, void);
89 DECL_LINK(ConditionEditHdl
, weld::Entry
&, void);
91 void ChangePasswd(bool bChange
);
92 DECL_LINK(TogglePasswdHdl
, weld::Toggleable
&, void);
93 DECL_LINK(ChangePasswdHdl
, weld::Button
&, void);
94 DECL_LINK(ChangeProtectHdl
, weld::Toggleable
&, void);
95 DECL_LINK(ChangeHideHdl
, weld::Toggleable
&, void);
96 // #114856# edit in readonly sections
97 DECL_LINK(ChangeEditInReadonlyHdl
, weld::Toggleable
&, void);
98 DECL_LINK(ChangeDismissHdl
, weld::Button
&, void);
99 DECL_LINK(UseFileHdl
, weld::Toggleable
&, void);
100 DECL_LINK(FileSearchHdl
, weld::Button
&, void);
101 DECL_LINK(OptionsHdl
, weld::Button
&, void);
102 DECL_LINK(FileNameComboBoxHdl
, weld::ComboBox
&, void);
103 DECL_LINK(FileNameEntryHdl
, weld::Entry
&, void);
104 DECL_LINK(DDEHdl
, weld::Toggleable
&, void);
105 DECL_LINK(DlgClosedHdl
, sfx2::FileDialogHelper
*, void);
106 DECL_LINK(SubRegionEventHdl
, weld::ComboBox
&, void);
108 bool CheckPasswd(weld::Toggleable
* pBox
= nullptr);
111 SwEditRegionDlg(weld::Window
* pParent
, SwWrtShell
& rWrtSh
);
112 virtual ~SwEditRegionDlg() override
;
114 void SelectSection(std::u16string_view rSectionName
);
117 // dialog "insert region"
118 class SwInsertSectionTabPage final
: public SfxTabPage
120 OUString m_sFileName
;
121 OUString m_sFilterName
;
122 OUString m_sFilePasswd
;
124 css::uno::Sequence
<sal_Int8
> m_aNewPasswd
;
125 SwWrtShell
* m_pWrtSh
;
126 std::unique_ptr
<sfx2::DocumentInserter
> m_pDocInserter
;
128 std::unique_ptr
<weld::EntryTreeView
> m_xCurName
;
129 std::unique_ptr
<weld::CheckButton
> m_xFileCB
;
130 std::unique_ptr
<weld::CheckButton
> m_xDDECB
;
131 std::unique_ptr
<weld::Label
> m_xDDECommandFT
;
132 std::unique_ptr
<weld::Label
> m_xFileNameFT
;
133 std::unique_ptr
<weld::Entry
> m_xFileNameED
;
134 std::unique_ptr
<weld::Button
> m_xFilePB
;
135 std::unique_ptr
<weld::Label
> m_xSubRegionFT
;
136 std::unique_ptr
<weld::ComboBox
> m_xSubRegionED
;
137 std::unique_ptr
<weld::CheckButton
> m_xProtectCB
;
138 std::unique_ptr
<weld::CheckButton
> m_xPasswdCB
;
139 std::unique_ptr
<weld::Button
> m_xPasswdPB
;
140 std::unique_ptr
<weld::CheckButton
> m_xHideCB
;
141 std::unique_ptr
<weld::Label
> m_xConditionFT
;
142 std::unique_ptr
<ConditionEdit
<weld::Entry
>> m_xConditionED
;
143 // #114856# edit in readonly sections
144 std::unique_ptr
<weld::CheckButton
> m_xEditInReadonlyCB
;
146 void ChangePasswd(bool bChange
);
148 DECL_LINK(ChangeHideHdl
, weld::Toggleable
&, void);
149 DECL_LINK(ChangeProtectHdl
, weld::Toggleable
&, void);
150 DECL_LINK(ChangePasswdHdl
, weld::Button
&, void);
151 DECL_LINK(TogglePasswdHdl
, weld::Toggleable
&, void);
152 DECL_LINK(NameEditHdl
, weld::ComboBox
&, void);
153 DECL_LINK(UseFileHdl
, weld::Toggleable
&, void);
154 DECL_LINK(FileSearchHdl
, weld::Button
&, void);
155 DECL_LINK(DDEHdl
, weld::Toggleable
&, void);
156 DECL_LINK(DlgClosedHdl
, sfx2::FileDialogHelper
*, void);
159 SwInsertSectionTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
160 const SfxItemSet
& rAttrSet
);
161 virtual ~SwInsertSectionTabPage() override
;
163 void SetWrtShell(SwWrtShell
& rSh
);
165 virtual bool FillItemSet(SfxItemSet
*) override
;
166 virtual void Reset(const SfxItemSet
*) override
;
168 static std::unique_ptr
<SfxTabPage
>
169 Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
172 class SwSectionFootnoteEndTabPage final
: public SfxTabPage
174 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtAtTextEndCB
;
175 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtNumCB
;
176 std::unique_ptr
<weld::Label
> m_xFootnoteOffsetLbl
;
177 std::unique_ptr
<weld::SpinButton
> m_xFootnoteOffsetField
;
178 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtNumFormatCB
;
179 std::unique_ptr
<weld::Label
> m_xFootnotePrefixFT
;
180 std::unique_ptr
<weld::Entry
> m_xFootnotePrefixED
;
181 std::unique_ptr
<SwNumberingTypeListBox
> m_xFootnoteNumViewBox
;
182 std::unique_ptr
<weld::Label
> m_xFootnoteSuffixFT
;
183 std::unique_ptr
<weld::Entry
> m_xFootnoteSuffixED
;
184 std::unique_ptr
<weld::CheckButton
> m_xEndNtAtTextEndCB
;
185 std::unique_ptr
<weld::CheckButton
> m_xEndNtNumCB
;
186 std::unique_ptr
<weld::Label
> m_xEndOffsetLbl
;
187 std::unique_ptr
<weld::SpinButton
> m_xEndOffsetField
;
188 std::unique_ptr
<weld::CheckButton
> m_xEndNtNumFormatCB
;
189 std::unique_ptr
<weld::Label
> m_xEndPrefixFT
;
190 std::unique_ptr
<weld::Entry
> m_xEndPrefixED
;
191 std::unique_ptr
<SwNumberingTypeListBox
> m_xEndNumViewBox
;
192 std::unique_ptr
<weld::Label
> m_xEndSuffixFT
;
193 std::unique_ptr
<weld::Entry
> m_xEndSuffixED
;
195 DECL_LINK(FootEndHdl
, weld::Toggleable
&, void);
196 void ResetState(bool bFootnote
, const SwFormatFootnoteEndAtTextEnd
&);
199 SwSectionFootnoteEndTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
200 const SfxItemSet
& rAttrSet
);
201 virtual ~SwSectionFootnoteEndTabPage() override
;
203 virtual bool FillItemSet(SfxItemSet
*) override
;
204 virtual void Reset(const SfxItemSet
*) override
;
206 static std::unique_ptr
<SfxTabPage
>
207 Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
210 class SwSectionIndentTabPage final
: public SfxTabPage
212 SvxParaPrevWindow m_aPreviewWin
;
213 std::unique_ptr
<weld::MetricSpinButton
> m_xBeforeMF
;
214 std::unique_ptr
<weld::MetricSpinButton
> m_xAfterMF
;
215 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWin
;
217 DECL_LINK(IndentModifyHdl
, weld::MetricSpinButton
&, void);
220 SwSectionIndentTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
221 const SfxItemSet
& rAttrSet
);
222 virtual ~SwSectionIndentTabPage() override
;
224 virtual bool FillItemSet(SfxItemSet
*) override
;
225 virtual void Reset(const SfxItemSet
*) override
;
227 static std::unique_ptr
<SfxTabPage
>
228 Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
230 void SetWrtShell(SwWrtShell
const& rSh
);
233 class SwInsertSectionTabDialog final
: public SfxTabDialogController
235 SwWrtShell
& m_rWrtSh
;
236 std::unique_ptr
<SwSectionData
> m_pSectionData
;
238 virtual void PageCreated(const OUString
& rId
, SfxTabPage
& rPage
) override
;
239 virtual short Ok() override
;
242 SwInsertSectionTabDialog(weld::Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
243 virtual ~SwInsertSectionTabDialog() override
;
245 void SetSectionData(SwSectionData
const& rSect
);
246 SwSectionData
* GetSectionData() { return m_pSectionData
.get(); }
249 class SwSectionPropertyTabDialog final
: public SfxTabDialogController
251 SwWrtShell
& m_rWrtSh
;
253 virtual void PageCreated(const OUString
& rId
, SfxTabPage
& rPage
) override
;
256 SwSectionPropertyTabDialog(weld::Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
257 virtual ~SwSectionPropertyTabDialog() override
;
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */