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  const OUString& rPageStyle,
35  const OUString& rUIXMLDescription,
36  const OString& 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  const OUString& rPageStyle)
51  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
52  "modules/scalc/ui/headerdialog.ui", "HeaderDialog")
53 {
54  AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
55  AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
56 }
57 
59  weld::Window* pParent,
60  const SfxItemSet& rCoreSet,
61  const OUString& rPageStyle)
62  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
63  "modules/scalc/ui/footerdialog.ui", "FooterDialog" )
64 {
65  AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
66  AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
67 }
68 
70  weld::Window* pParent,
71  const SfxItemSet& rCoreSet,
72  const OUString& rPageStyle)
73  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
74  "modules/scalc/ui/leftheaderdialog.ui", "LeftHeaderDialog" )
75 {
76  AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
77 }
78 
80  weld::Window* pParent,
81  const SfxItemSet& rCoreSet,
82  const OUString& rPageStyle)
83  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
84  "modules/scalc/ui/rightheaderdialog.ui", "RightHeaderDialog" )
85 {
86  AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
87 }
88 
90  weld::Window* pParent,
91  const SfxItemSet& rCoreSet,
92  const OUString& rPageStyle)
93  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
94  "modules/scalc/ui/leftfooterdialog.ui", "LeftFooterDialog" )
95 {
96  AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
97 }
98 
100  weld::Window* pParent,
101  const SfxItemSet& rCoreSet,
102  const OUString& rPageStyle)
103  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
104  "modules/scalc/ui/rightfooterdialog.ui", "RightFooterDialog" )
105 {
106  AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
107 }
108 
110  weld::Window* pParent,
111  const SfxItemSet& rCoreSet,
112  const OUString& rPageStyle)
113  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
114  "modules/scalc/ui/sharedheaderdialog.ui", "SharedHeaderDialog" )
115 {
116  AddTabPage("header", ScRightHeaderEditPage::Create, nullptr);
117  AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
118  AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
119 }
120 
122  weld::Window* pParent,
123  const SfxItemSet& rCoreSet,
124  const OUString& rPageStyle)
125  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
126  "modules/scalc/ui/sharedfooterdialog.ui", "SharedFooterDialog" )
127 {
128  AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
129  AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
130  AddTabPage("footer", ScRightFooterEditPage::Create, nullptr);
131 }
132 
134  weld::Window* pParent,
135  const SfxItemSet& rCoreSet,
136  const OUString& rPageStyle)
137  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
138  "modules/scalc/ui/allheaderfooterdialog.ui", "AllHeaderFooterDialog" )
139 {
140  AddTabPage("headerright", ScRightHeaderEditPage::Create, nullptr);
141  AddTabPage("headerleft", ScLeftHeaderEditPage::Create, nullptr);
142  AddTabPage("footerright", ScRightFooterEditPage::Create, nullptr);
143  AddTabPage("footerleft", ScLeftFooterEditPage::Create, nullptr);
144 }
145 
147  weld::Window* pParent,
148  const SfxItemSet& rCoreSet,
149  const OUString& rPageStyle)
150  : ScHFEditDlg( pParent, rCoreSet, rPageStyle,
151  "modules/scalc/ui/headerfooterdialog.ui", "HeaderFooterDialog" )
152 {
153  const SvxPageItem& rPageItem = static_cast<const SvxPageItem&>(
154  rCoreSet.Get(
155  rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) ));
156 
157  bool bRightPage = SvxPageUsage::Left != rPageItem.GetPageUsage();
158 
159  if ( bRightPage )
160  {
161  AddTabPage("header", ScRightHeaderEditPage::Create, nullptr);
162  AddTabPage("footer", ScRightFooterEditPage::Create, nullptr);
163  }
164  else
165  {
166  // #69193a# respect "shared" setting
167 
168  bool bShareHeader = rCoreSet.Get(ATTR_PAGE_HEADERSET).GetItemSet().
169  Get(ATTR_PAGE_SHARED).GetValue();
170  if ( bShareHeader )
171  AddTabPage("header", ScRightHeaderEditPage::Create, nullptr);
172  else
173  AddTabPage("header", ScLeftHeaderEditPage::Create, nullptr);
174 
175  bool bShareFooter = rCoreSet.Get(ATTR_PAGE_FOOTERSET).GetItemSet().
176  Get(ATTR_PAGE_SHARED).GetValue();
177  if ( bShareFooter )
178  AddTabPage("footer", ScRightFooterEditPage::Create, nullptr);
179  else
180  AddTabPage("footer", ScLeftFooterEditPage::Create, nullptr);
181  }
182 }
183 
184 void ScHFEditDlg::PageCreated(const OString& /* rId */, SfxTabPage& rPage)
185 {
186  // Can only be a ScHFEditPage...
187 
188  static_cast<ScHFEditPage&>(rPage).SetNumType(eNumType);
189 }
190 
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScHFEditActiveDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:146
ScHFEditHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:47
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
ScHFEditFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:58
ScHFEditSharedHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:109
ScHFEditRightHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:79
ScHFEditAllDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:133
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: hfedtdlg.cxx:184
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)
ScHFEditLeftFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:89
ScHFEditRightFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:99
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(182)
SvxNumType eNumType
Definition: hfedtdlg.hxx:28
ScHFEditSharedFooterDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:121
ScHFEditLeftHeaderDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle)
Definition: hfedtdlg.cxx:69
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
SfxItemPool * GetPool() const
SvxPageUsage GetPageUsage() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
ScHFEditDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, const OUString &rPageStyle, const OUString &rUIXMLDescription, const OString &rID)
Definition: hfedtdlg.cxx:32
Reference< XExecutableDialog > m_xDialog
constexpr TypedWhichId< SvxPageItem > ATTR_PAGE(159)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(181)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED(166)