Line data Source code
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 :
21 : #undef SC_DLLIMPLEMENTATION
22 :
23 :
24 :
25 : #include "scitems.hxx"
26 : #include <svl/eitem.hxx>
27 :
28 : #include "hfedtdlg.hxx"
29 : #include "global.hxx"
30 : #include "globstr.hrc"
31 : #include "scresid.hxx"
32 : #include "scuitphfedit.hxx"
33 :
34 :
35 : // macros from docsh4.cxx
36 : //! use SIDs?
37 :
38 : #define IS_SHARE_HEADER(set) \
39 : ((SfxBoolItem&) \
40 : ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
41 : Get(ATTR_PAGE_SHARED)).GetValue()
42 :
43 : #define IS_SHARE_FOOTER(set) \
44 : ((SfxBoolItem&) \
45 : ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
46 : Get(ATTR_PAGE_SHARED)).GetValue()
47 :
48 0 : ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP,
49 : Window* pParent,
50 : const SfxItemSet& rCoreSet,
51 : const OUString& rPageStyle,
52 : const OString& rID, const OUString& rUIXMLDescription )
53 0 : : SfxTabDialog( pFrameP, pParent, rID, rUIXMLDescription, &rCoreSet )
54 : {
55 0 : eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType();
56 :
57 0 : OUString aTmp = GetText();
58 :
59 0 : aTmp += " (" + ScGlobal::GetRscString( STR_PAGESTYLE ) + ": " + rPageStyle + ")";
60 :
61 0 : SetText( aTmp );
62 0 : }
63 :
64 0 : ScHFEditHeaderDlg::ScHFEditHeaderDlg( SfxViewFrame* pFrameP,
65 : Window* pParent,
66 : const SfxItemSet& rCoreSet,
67 : const OUString& rPageStyle)
68 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
69 0 : "HeaderDialog", "modules/scalc/ui/headerdialog.ui" )
70 : {
71 0 : AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
72 0 : AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
73 0 : }
74 :
75 0 : ScHFEditFooterDlg::ScHFEditFooterDlg( SfxViewFrame* pFrameP,
76 : Window* pParent,
77 : const SfxItemSet& rCoreSet,
78 : const OUString& rPageStyle)
79 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
80 0 : "FooterDialog", "modules/scalc/ui/footerdialog.ui" )
81 : {
82 0 : AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
83 0 : AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
84 0 : }
85 :
86 0 : ScHFEditLeftHeaderDlg::ScHFEditLeftHeaderDlg( SfxViewFrame* pFrameP,
87 : Window* pParent,
88 : const SfxItemSet& rCoreSet,
89 : const OUString& rPageStyle)
90 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
91 0 : "LeftHeaderDialog", "modules/scalc/ui/leftheaderdialog.ui" )
92 : {
93 0 : AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
94 0 : }
95 :
96 0 : ScHFEditRightHeaderDlg::ScHFEditRightHeaderDlg( SfxViewFrame* pFrameP,
97 : Window* pParent,
98 : const SfxItemSet& rCoreSet,
99 : const OUString& rPageStyle)
100 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
101 0 : "RightHeaderDialog", "modules/scalc/ui/rightheaderdialog.ui" )
102 : {
103 0 : AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
104 0 : }
105 :
106 0 : ScHFEditLeftFooterDlg::ScHFEditLeftFooterDlg( SfxViewFrame* pFrameP,
107 : Window* pParent,
108 : const SfxItemSet& rCoreSet,
109 : const OUString& rPageStyle)
110 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
111 0 : "LeftFooterDialog", "modules/scalc/ui/leftfooterdialog.ui" )
112 : {
113 0 : AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
114 0 : }
115 :
116 0 : ScHFEditRightFooterDlg::ScHFEditRightFooterDlg( SfxViewFrame* pFrameP,
117 : Window* pParent,
118 : const SfxItemSet& rCoreSet,
119 : const OUString& rPageStyle)
120 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
121 0 : "RightFooterDialog", "modules/scalc/ui/rightfooterdialog.ui" )
122 : {
123 0 : AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
124 0 : }
125 :
126 0 : ScHFEditSharedHeaderDlg::ScHFEditSharedHeaderDlg( SfxViewFrame* pFrameP,
127 : Window* pParent,
128 : const SfxItemSet& rCoreSet,
129 : const OUString& rPageStyle)
130 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
131 0 : "SharedHeaderDialog", "modules/scalc/ui/sharedheaderdialog.ui" )
132 : {
133 0 : AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
134 0 : AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
135 0 : AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
136 0 : }
137 :
138 0 : ScHFEditSharedFooterDlg::ScHFEditSharedFooterDlg( SfxViewFrame* pFrameP,
139 : Window* pParent,
140 : const SfxItemSet& rCoreSet,
141 : const OUString& rPageStyle)
142 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
143 0 : "SharedFooterDialog", "modules/scalc/ui/sharedfooterdialog.ui" )
144 : {
145 0 : AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
146 0 : AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
147 0 : AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
148 0 : }
149 :
150 0 : ScHFEditAllDlg::ScHFEditAllDlg( SfxViewFrame* pFrameP,
151 : Window* pParent,
152 : const SfxItemSet& rCoreSet,
153 : const OUString& rPageStyle)
154 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
155 0 : "AllHeaderFooterDialog", "modules/scalc/ui/allheaderfooterdialog.ui" )
156 : {
157 0 : AddTabPage( "headerright", ScRightHeaderEditPage::Create, NULL );
158 0 : AddTabPage( "headerleft", ScLeftHeaderEditPage::Create, NULL );
159 0 : AddTabPage( "footerright", ScRightFooterEditPage::Create, NULL );
160 0 : AddTabPage( "footerleft", ScLeftFooterEditPage::Create, NULL );
161 0 : }
162 :
163 0 : ScHFEditActiveDlg::ScHFEditActiveDlg( SfxViewFrame* pFrameP,
164 : Window* pParent,
165 : const SfxItemSet& rCoreSet,
166 : const OUString& rPageStyle)
167 : : ScHFEditDlg( pFrameP, pParent, rCoreSet, rPageStyle,
168 0 : "HeaderFooterDialog", "modules/scalc/ui/headerfooterdialog.ui" )
169 : {
170 : const SvxPageItem& rPageItem = (const SvxPageItem&)
171 : rCoreSet.Get(
172 0 : rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
173 :
174 0 : sal_Bool bRightPage = ( SVX_PAGE_LEFT !=
175 0 : SvxPageUsage(rPageItem.GetPageUsage()) );
176 :
177 0 : if ( bRightPage )
178 : {
179 0 : AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
180 0 : AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
181 : }
182 : else
183 : {
184 : // #69193a# respect "shared" setting
185 :
186 0 : sal_Bool bShareHeader = IS_SHARE_HEADER(rCoreSet);
187 0 : if ( bShareHeader )
188 0 : AddTabPage( "header", ScRightHeaderEditPage::Create, NULL );
189 : else
190 0 : AddTabPage( "header", ScLeftHeaderEditPage::Create, NULL );
191 :
192 0 : sal_Bool bShareFooter = IS_SHARE_FOOTER(rCoreSet);
193 0 : if ( bShareFooter )
194 0 : AddTabPage( "footer", ScRightFooterEditPage::Create, NULL );
195 : else
196 0 : AddTabPage( "footer", ScLeftFooterEditPage::Create, NULL );
197 : }
198 0 : }
199 :
200 0 : void ScHFEditDlg::PageCreated( sal_uInt16 /* nId */, SfxTabPage& rPage )
201 : {
202 : // kann ja nur ne ScHFEditPage sein...
203 :
204 0 : ((ScHFEditPage&)rPage).SetNumType(eNumType);
205 0 : }
206 :
207 :
208 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|