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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include <scitems.hxx>
23 #include <svl/eitem.hxx>
25 #include <hfedtdlg.hxx>
26 #include <globstr.hrc>
27 #include <scresid.hxx>
28 #include <scuitphfedit.hxx>
29 #include <svx/svxids.hrc>
30 #include <svx/pageitem.hxx>
32 ScHFEditDlg::ScHFEditDlg(weld::Window
* pParent
,
33 const SfxItemSet
& rCoreSet
,
34 std::u16string_view rPageStyle
,
35 const OUString
& rUIXMLDescription
,
37 : SfxTabDialogController(pParent
, rUIXMLDescription
, rID
, &rCoreSet
)
39 eNumType
= rCoreSet
.Get(ATTR_PAGE
).GetNumType();
41 OUString aTmp
= m_xDialog
->get_title() +
42 " (" + ScResId( STR_PAGESTYLE
) + ": " + rPageStyle
+ ")";
44 m_xDialog
->set_title(aTmp
);
47 ScHFEditHeaderDlg::ScHFEditHeaderDlg(
48 weld::Window
* pParent
,
49 const SfxItemSet
& rCoreSet
,
50 std::u16string_view rPageStyle
)
51 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
52 "modules/scalc/ui/headerdialog.ui", "HeaderDialog")
54 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create
, nullptr);
55 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
56 AddTabPage("headerleft", ScLeftHeaderEditPage::Create
, nullptr);
59 ScHFEditFooterDlg::ScHFEditFooterDlg(
60 weld::Window
* pParent
,
61 const SfxItemSet
& rCoreSet
,
62 std::u16string_view rPageStyle
)
63 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
64 "modules/scalc/ui/footerdialog.ui", "FooterDialog" )
66 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
67 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
68 AddTabPage("footerleft", ScLeftFooterEditPage::Create
, nullptr);
71 ScHFEditSharedFirstHeaderDlg::ScHFEditSharedFirstHeaderDlg(
72 weld::Window
* pParent
,
73 const SfxItemSet
& rCoreSet
,
74 std::u16string_view rPageStyle
)
75 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
76 "modules/scalc/ui/sharedfirstheaderdialog.ui", "SharedFirstHeaderDialog" )
78 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
79 AddTabPage("headerleft", ScLeftHeaderEditPage::Create
, nullptr);
82 ScHFEditSharedFirstFooterDlg::ScHFEditSharedFirstFooterDlg(
83 weld::Window
* pParent
,
84 const SfxItemSet
& rCoreSet
,
85 std::u16string_view rPageStyle
)
86 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
87 "modules/scalc/ui/sharedfirstfooterdialog.ui", "SharedFirstFooterDialog" )
89 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
90 AddTabPage("footerleft", ScLeftFooterEditPage::Create
, nullptr);
93 ScHFEditSharedLeftHeaderDlg::ScHFEditSharedLeftHeaderDlg(
94 weld::Window
* pParent
,
95 const SfxItemSet
& rCoreSet
,
96 std::u16string_view rPageStyle
)
97 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
98 "modules/scalc/ui/sharedleftheaderdialog.ui", "SharedLeftHeaderDialog" )
100 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create
, nullptr);
101 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
104 ScHFEditSharedLeftFooterDlg::ScHFEditSharedLeftFooterDlg(
105 weld::Window
* pParent
,
106 const SfxItemSet
& rCoreSet
,
107 std::u16string_view rPageStyle
)
108 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
109 "modules/scalc/ui/sharedleftfooterdialog.ui", "SharedLeftFooterDialog" )
111 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
112 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
115 ScHFEditFirstHeaderDlg::ScHFEditFirstHeaderDlg(
116 weld::Window
* pParent
,
117 const SfxItemSet
& rCoreSet
,
118 std::u16string_view rPageStyle
)
119 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
120 "modules/scalc/ui/firstheaderdialog.ui", "FirstHeaderDialog" )
122 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create
, nullptr);
125 ScHFEditLeftHeaderDlg::ScHFEditLeftHeaderDlg(
126 weld::Window
* pParent
,
127 const SfxItemSet
& rCoreSet
,
128 std::u16string_view rPageStyle
)
129 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
130 "modules/scalc/ui/leftheaderdialog.ui", "LeftHeaderDialog" )
132 AddTabPage("headerleft", ScLeftHeaderEditPage::Create
, nullptr);
135 ScHFEditRightHeaderDlg::ScHFEditRightHeaderDlg(
136 weld::Window
* pParent
,
137 const SfxItemSet
& rCoreSet
,
138 std::u16string_view rPageStyle
)
139 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
140 "modules/scalc/ui/rightheaderdialog.ui", "RightHeaderDialog" )
142 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
145 ScHFEditFirstFooterDlg::ScHFEditFirstFooterDlg(
146 weld::Window
* pParent
,
147 const SfxItemSet
& rCoreSet
,
148 std::u16string_view rPageStyle
)
149 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
150 "modules/scalc/ui/firstfooterdialog.ui", "FirstFooterDialog" )
152 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
155 ScHFEditLeftFooterDlg::ScHFEditLeftFooterDlg(
156 weld::Window
* pParent
,
157 const SfxItemSet
& rCoreSet
,
158 std::u16string_view rPageStyle
)
159 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
160 "modules/scalc/ui/leftfooterdialog.ui", "LeftFooterDialog" )
162 AddTabPage("footerleft", ScLeftFooterEditPage::Create
, nullptr);
165 ScHFEditRightFooterDlg::ScHFEditRightFooterDlg(
166 weld::Window
* pParent
,
167 const SfxItemSet
& rCoreSet
,
168 std::u16string_view rPageStyle
)
169 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
170 "modules/scalc/ui/rightfooterdialog.ui", "RightFooterDialog" )
172 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
175 ScHFEditSharedHeaderDlg::ScHFEditSharedHeaderDlg(
176 weld::Window
* pParent
,
177 const SfxItemSet
& rCoreSet
,
178 std::u16string_view rPageStyle
)
179 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
180 "modules/scalc/ui/sharedheaderdialog.ui", "SharedHeaderDialog" )
182 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create
, nullptr);
183 AddTabPage("header", ScRightHeaderEditPage::Create
, nullptr);
184 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
185 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
186 AddTabPage("footerleft", ScLeftFooterEditPage::Create
, nullptr);
189 ScHFEditSharedFooterDlg::ScHFEditSharedFooterDlg(
190 weld::Window
* pParent
,
191 const SfxItemSet
& rCoreSet
,
192 std::u16string_view rPageStyle
)
193 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
194 "modules/scalc/ui/sharedfooterdialog.ui", "SharedFooterDialog" )
196 AddTabPage("headerfirst", ScFirstFooterEditPage::Create
, nullptr);
197 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
198 AddTabPage("headerleft", ScLeftHeaderEditPage::Create
, nullptr);
199 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
200 AddTabPage("footer", ScRightFooterEditPage::Create
, nullptr);
203 ScHFEditAllDlg::ScHFEditAllDlg(
204 weld::Window
* pParent
,
205 const SfxItemSet
& rCoreSet
,
206 std::u16string_view rPageStyle
)
207 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
208 "modules/scalc/ui/allheaderfooterdialog.ui", "AllHeaderFooterDialog" )
210 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create
, nullptr);
211 AddTabPage("headerright", ScRightHeaderEditPage::Create
, nullptr);
212 AddTabPage("headerleft", ScLeftHeaderEditPage::Create
, nullptr);
213 AddTabPage("footerfirst", ScFirstFooterEditPage::Create
, nullptr);
214 AddTabPage("footerright", ScRightFooterEditPage::Create
, nullptr);
215 AddTabPage("footerleft", ScLeftFooterEditPage::Create
, nullptr);
218 ScHFEditActiveDlg::ScHFEditActiveDlg(
219 weld::Window
* pParent
,
220 const SfxItemSet
& rCoreSet
,
221 std::u16string_view rPageStyle
)
222 : ScHFEditDlg( pParent
, rCoreSet
, rPageStyle
,
223 "modules/scalc/ui/headerfooterdialog.ui", "HeaderFooterDialog" )
225 const SvxPageItem
& rPageItem
=
227 rCoreSet
.GetPool()->GetWhich(SID_ATTR_PAGE
) );
229 bool bRightPage
= SvxPageUsage::Left
!= rPageItem
.GetPageUsage();
233 AddTabPage("header", ScRightHeaderEditPage::Create
, nullptr);
234 AddTabPage("footer", ScRightFooterEditPage::Create
, nullptr);
238 // #69193a# respect "shared" setting
240 bool bShareHeader
= rCoreSet
.Get(ATTR_PAGE_HEADERSET
).GetItemSet().
241 Get(ATTR_PAGE_SHARED
).GetValue();
243 AddTabPage("header", ScRightHeaderEditPage::Create
, nullptr);
245 AddTabPage("header", ScLeftHeaderEditPage::Create
, nullptr);
247 bool bShareFooter
= rCoreSet
.Get(ATTR_PAGE_FOOTERSET
).GetItemSet().
248 Get(ATTR_PAGE_SHARED
).GetValue();
250 AddTabPage("footer", ScRightFooterEditPage::Create
, nullptr);
252 AddTabPage("footer", ScLeftFooterEditPage::Create
, nullptr);
256 void ScHFEditDlg::PageCreated(const OString
& /* rId */, SfxTabPage
& rPage
)
258 // Can only be a ScHFEditPage...
260 static_cast<ScHFEditPage
&>(rPage
).SetNumType(eNumType
);
263 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */