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