LibreOffice Module sc (master) 1
hfedtdlg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#undef SC_DLLIMPLEMENTATION
21
22#include <scitems.hxx>
23#include <svl/eitem.hxx>
24
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>
31
33 const SfxItemSet& rCoreSet,
34 std::u16string_view rPageStyle,
35 const OUString& rUIXMLDescription,
36 const OUString& rID)
37 : SfxTabDialogController(pParent, rUIXMLDescription, rID, &rCoreSet)
38{
39 eNumType = rCoreSet.Get(ATTR_PAGE).GetNumType();
40
41 OUString aTmp = m_xDialog->get_title() +
42 " (" + ScResId( STR_PAGESTYLE ) + ": " + rPageStyle + ")";
43
44 m_xDialog->set_title(aTmp);
45}
46
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")
53{
54 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create, nullptr);
55 AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
56 AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
57}
58
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" )
65{
66 AddTabPage("footerfirst", ScFirstFooterEditPage::Create, nullptr);
67 AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
68 AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
69}
70
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" )
77{
78 AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
79 AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
80}
81
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" )
88{
89 AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
90 AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
91}
92
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" )
99{
100 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create, nullptr);
101 AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
102}
103
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" )
110{
111 AddTabPage("footerfirst", ScFirstFooterEditPage::Create, nullptr);
112 AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
113}
114
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" )
121{
122 AddTabPage("headerfirst", ScFirstHeaderEditPage::Create, nullptr);
123}
124
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" )
131{
132 AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
133}
134
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" )
141{
142 AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
143}
144
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" )
151{
152 AddTabPage("footerfirst", ScFirstFooterEditPage::Create, nullptr);
153}
154
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" )
161{
162 AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
163}
164
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" )
171{
172 AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
173}
174
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" )
181{
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);
187}
188
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" )
195{
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);
201}
202
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" )
209{
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);
216}
217
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" )
224{
225 const SvxPageItem& rPageItem =
226 rCoreSet.Get(
227 rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
228
229 bool bRightPage = SvxPageUsage::Left != rPageItem.GetPageUsage();
230
231 if ( bRightPage )
232 {
233 AddTabPage("header", ScRightHeaderEditPage::Create, nullptr);
234 AddTabPage("footer", ScRightFooterEditPage::Create, nullptr);
235 }
236 else
237 {
238 // #69193a# respect "shared" setting
239
240 bool bShareHeader = rCoreSet.Get(ATTR_PAGE_HEADERSET).GetItemSet().
241 Get(ATTR_PAGE_SHARED).GetValue();
242 if ( bShareHeader )
243 AddTabPage("header", ScRightHeaderEditPage::Create, nullptr);
244 else
245 AddTabPage("header", ScLeftHeaderEditPage::Create, nullptr);
246
247 bool bShareFooter = rCoreSet.Get(ATTR_PAGE_FOOTERSET).GetItemSet().
248 Get(ATTR_PAGE_SHARED).GetValue();
249 if ( bShareFooter )
250 AddTabPage("footer", ScRightFooterEditPage::Create, nullptr);
251 else
252 AddTabPage("footer", ScLeftFooterEditPage::Create, nullptr);
253 }
254}
255
256void ScHFEditDlg::PageCreated(const OUString& /* rId */, SfxTabPage& rPage)
257{
258 // Can only be a ScHFEditPage...
259
260 static_cast<ScHFEditPage&>(rPage).SetNumType(eNumType);
261}
262
263/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
ScHFEditActiveDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:218
ScHFEditAllDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:203
ScHFEditDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle, const OUString &rUIXMLDescription, const OUString &rID)
Definition: hfedtdlg.cxx:32
virtual void PageCreated(const OUString &rId, SfxTabPage &rPage) override
Definition: hfedtdlg.cxx:256
SvxNumType eNumType
Definition: hfedtdlg.hxx:31
ScHFEditFirstFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:145
ScHFEditFirstHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:115
ScHFEditFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:59
ScHFEditHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:47
ScHFEditLeftFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:155
ScHFEditLeftHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:125
ScHFEditRightFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:165
ScHFEditRightHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:135
ScHFEditSharedFirstFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:82
ScHFEditSharedFirstHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:71
ScHFEditSharedFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:189
ScHFEditSharedHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:175
ScHFEditSharedLeftFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:104
ScHFEditSharedLeftHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, std::u16string_view rPageStyle)
Definition: hfedtdlg.cxx:93
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SfxItemPool * GetPool() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
SvxPageUsage GetPageUsage() const
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED(166)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
constexpr TypedWhichId< SvxPageItem > ATTR_PAGE(159)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)