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
: public SfxDialogController
48 bool m_bSubRegionsFilled
;
51 SectReprs_t m_SectReprs
;
52 const SwSection
* pCurrSect
;
53 std::unique_ptr
<sfx2::DocumentInserter
> m_pDocInserter
;
55 bool 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
> 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
;
81 void RecurseList(const SwSectionFormat
* pFormat
, const weld::TreeIter
* pIter
);
82 size_t FindArrPos(const SwSectionFormat
* pFormat
);
84 DECL_LINK( GetFirstEntryHdl
, weld::TreeView
&, void );
86 DECL_LINK( OkHdl
, weld::Button
&, void );
87 DECL_LINK( NameEditHdl
, weld::Entry
&, void );
88 DECL_LINK( ConditionEditHdl
, weld::Entry
&, void );
90 void ChangePasswd(bool bChange
);
91 DECL_LINK( TogglePasswdHdl
, weld::ToggleButton
&, void );
92 DECL_LINK( ChangePasswdHdl
, weld::Button
&, void );
93 DECL_LINK( ChangeProtectHdl
, weld::ToggleButton
&, void );
94 DECL_LINK( ChangeHideHdl
, weld::ToggleButton
&, void );
95 // #114856# edit in readonly sections
96 DECL_LINK( ChangeEditInReadonlyHdl
, weld::ToggleButton
&, void );
97 DECL_LINK( ChangeDismissHdl
, weld::Button
&, void);
98 DECL_LINK( UseFileHdl
, weld::ToggleButton
&, void );
99 DECL_LINK( FileSearchHdl
, weld::Button
&, void );
100 DECL_LINK( OptionsHdl
, weld::Button
&, void );
101 DECL_LINK( FileNameComboBoxHdl
, weld::ComboBox
&, void );
102 DECL_LINK( FileNameEntryHdl
, weld::Entry
&, void );
103 DECL_LINK( DDEHdl
, weld::ToggleButton
&, void );
104 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
*, void );
105 DECL_LINK( SubRegionEventHdl
, weld::ComboBox
&, void );
107 bool CheckPasswd(weld::ToggleButton
* pBox
= nullptr);
110 SwEditRegionDlg(weld::Window
* pParent
, SwWrtShell
& rWrtSh
);
111 virtual ~SwEditRegionDlg() override
;
113 void SelectSection(const OUString
& rSectionName
);
117 // dialog "insert region"
118 class SwInsertSectionTabPage
: 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
> 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::ToggleButton
&, void );
149 DECL_LINK( ChangeProtectHdl
, weld::ToggleButton
&, void );
150 DECL_LINK( ChangePasswdHdl
, weld::Button
&, void );
151 DECL_LINK( TogglePasswdHdl
, weld::ToggleButton
&, void );
152 DECL_LINK( NameEditHdl
, weld::ComboBox
&, void );
153 DECL_LINK( UseFileHdl
, weld::ToggleButton
&, void );
154 DECL_LINK( FileSearchHdl
, weld::Button
&, void );
155 DECL_LINK( DDEHdl
, weld::ToggleButton
&, void );
156 DECL_LINK( DlgClosedHdl
, sfx2::FileDialogHelper
*, void );
159 SwInsertSectionTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rAttrSet
);
160 virtual ~SwInsertSectionTabPage() override
;
162 void SetWrtShell(SwWrtShell
& rSh
);
164 virtual bool FillItemSet( SfxItemSet
* ) override
;
165 virtual void Reset( const SfxItemSet
* ) override
;
167 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
168 const SfxItemSet
* rAttrSet
);
171 class SwSectionFootnoteEndTabPage
: public SfxTabPage
173 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtAtTextEndCB
;
174 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtNumCB
;
175 std::unique_ptr
<weld::Label
> m_xFootnoteOffsetLbl
;
176 std::unique_ptr
<weld::SpinButton
> m_xFootnoteOffsetField
;
177 std::unique_ptr
<weld::CheckButton
> m_xFootnoteNtNumFormatCB
;
178 std::unique_ptr
<weld::Label
> m_xFootnotePrefixFT
;
179 std::unique_ptr
<weld::Entry
> m_xFootnotePrefixED
;
180 std::unique_ptr
<SwNumberingTypeListBox
> m_xFootnoteNumViewBox
;
181 std::unique_ptr
<weld::Label
> m_xFootnoteSuffixFT
;
182 std::unique_ptr
<weld::Entry
> m_xFootnoteSuffixED
;
183 std::unique_ptr
<weld::CheckButton
> m_xEndNtAtTextEndCB
;
184 std::unique_ptr
<weld::CheckButton
> m_xEndNtNumCB
;
185 std::unique_ptr
<weld::Label
> m_xEndOffsetLbl
;
186 std::unique_ptr
<weld::SpinButton
> m_xEndOffsetField
;
187 std::unique_ptr
<weld::CheckButton
> m_xEndNtNumFormatCB
;
188 std::unique_ptr
<weld::Label
> m_xEndPrefixFT
;
189 std::unique_ptr
<weld::Entry
> m_xEndPrefixED
;
190 std::unique_ptr
<SwNumberingTypeListBox
> m_xEndNumViewBox
;
191 std::unique_ptr
<weld::Label
> m_xEndSuffixFT
;
192 std::unique_ptr
<weld::Entry
> m_xEndSuffixED
;
194 DECL_LINK(FootEndHdl
, weld::ToggleButton
&, void);
195 void ResetState( bool bFootnote
, const SwFormatFootnoteEndAtTextEnd
& );
198 SwSectionFootnoteEndTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rAttrSet
);
199 virtual ~SwSectionFootnoteEndTabPage() override
;
201 virtual bool FillItemSet( SfxItemSet
* ) override
;
202 virtual void Reset( const SfxItemSet
* ) override
;
204 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
205 const SfxItemSet
* rAttrSet
);
208 class SwSectionIndentTabPage
: public SfxTabPage
210 SvxParaPrevWindow m_aPreviewWin
;
211 std::unique_ptr
<weld::MetricSpinButton
> m_xBeforeMF
;
212 std::unique_ptr
<weld::MetricSpinButton
> m_xAfterMF
;
213 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWin
;
215 DECL_LINK(IndentModifyHdl
, weld::MetricSpinButton
&, void);
217 SwSectionIndentTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rAttrSet
);
218 virtual ~SwSectionIndentTabPage() override
;
220 virtual bool FillItemSet( SfxItemSet
* ) override
;
221 virtual void Reset( const SfxItemSet
* ) override
;
223 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
225 void SetWrtShell(SwWrtShell
const & rSh
);
228 class SwInsertSectionTabDialog
: public SfxTabDialogController
231 std::unique_ptr
<SwSectionData
> m_pSectionData
;
234 virtual void PageCreated(const OString
& rId
, SfxTabPage
&rPage
) override
;
235 virtual short Ok() override
;
237 SwInsertSectionTabDialog(weld::Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
238 virtual ~SwInsertSectionTabDialog() override
;
240 void SetSectionData(SwSectionData
const& rSect
);
241 SwSectionData
* GetSectionData() { return m_pSectionData
.get(); }
244 class SwSectionPropertyTabDialog
: public SfxTabDialogController
249 virtual void PageCreated(const OString
& rId
, SfxTabPage
&rPage
) override
;
251 SwSectionPropertyTabDialog(weld::Window
* pParent
, const SfxItemSet
& rSet
, SwWrtShell
& rSh
);
252 virtual ~SwSectionPropertyTabDialog() override
;
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */