Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #undef SC_DLLIMPLEMENTATION
31 : :
32 : :
33 : :
34 : : //------------------------------------------------------------------
35 : :
36 : : #include "scitems.hxx"
37 : : #include <svl/eitem.hxx>
38 : :
39 : : #include "hfedtdlg.hxx"
40 : : #include "global.hxx"
41 : : #include "globstr.hrc"
42 : : #include "scresid.hxx"
43 : : #include "hfedtdlg.hrc"
44 : : #include "scuitphfedit.hxx"
45 : : //------------------------------------------------------------------
46 : :
47 : : // macros from docsh4.cxx
48 : : //! use SIDs?
49 : :
50 : : #define IS_SHARE_HEADER(set) \
51 : : ((SfxBoolItem&) \
52 : : ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
53 : : Get(ATTR_PAGE_SHARED)).GetValue()
54 : :
55 : : #define IS_SHARE_FOOTER(set) \
56 : : ((SfxBoolItem&) \
57 : : ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
58 : : Get(ATTR_PAGE_SHARED)).GetValue()
59 : :
60 : : //==================================================================
61 : :
62 : 0 : ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP,
63 : : Window* pParent,
64 : : const SfxItemSet& rCoreSet,
65 : : const String& rPageStyle,
66 : : sal_uInt16 nResIdP )
67 : 0 : : SfxTabDialog( pFrameP, pParent, ScResId( nResIdP ), &rCoreSet )
68 : : {
69 : 0 : eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType();
70 : :
71 : 0 : String aTmp = GetText();
72 : :
73 : 0 : aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
74 : 0 : aTmp += ScGlobal::GetRscString( STR_PAGESTYLE );
75 : 0 : aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
76 : 0 : aTmp += rPageStyle;
77 : 0 : aTmp += ')';
78 : 0 : SetText( aTmp );
79 : :
80 : 0 : switch ( nResIdP )
81 : : {
82 : : case RID_SCDLG_HFED_HEADER:
83 : : case RID_SCDLG_HFEDIT_HEADER:
84 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
85 : 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
86 : 0 : break;
87 : :
88 : : case RID_SCDLG_HFED_FOOTER:
89 : : case RID_SCDLG_HFEDIT_FOOTER:
90 : 0 : AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
91 : 0 : AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
92 : 0 : break;
93 : :
94 : : case RID_SCDLG_HFEDIT_LEFTHEADER:
95 : 0 : AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
96 : 0 : break;
97 : :
98 : : case RID_SCDLG_HFEDIT_RIGHTHEADER:
99 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
100 : 0 : break;
101 : :
102 : : case RID_SCDLG_HFEDIT_LEFTFOOTER:
103 : 0 : AddTabPage( 1, ScLeftFooterEditPage::Create, NULL );
104 : 0 : break;
105 : :
106 : : case RID_SCDLG_HFEDIT_RIGHTFOOTER:
107 : 0 : AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
108 : 0 : break;
109 : :
110 : : case RID_SCDLG_HFEDIT_SHDR:
111 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
112 : 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
113 : 0 : AddTabPage( 3, ScLeftFooterEditPage::Create, NULL );
114 : 0 : break;
115 : :
116 : : case RID_SCDLG_HFEDIT_SFTR:
117 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
118 : 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
119 : 0 : AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
120 : 0 : break;
121 : :
122 : : case RID_SCDLG_HFEDIT_ALL:
123 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
124 : 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
125 : 0 : AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
126 : 0 : AddTabPage( 4, ScLeftFooterEditPage::Create, NULL );
127 : 0 : break;
128 : :
129 : : default:
130 : : case RID_SCDLG_HFEDIT:
131 : : {
132 : : const SvxPageItem& rPageItem = (const SvxPageItem&)
133 : : rCoreSet.Get(
134 : 0 : rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
135 : :
136 : : sal_Bool bRightPage = ( SVX_PAGE_LEFT !=
137 : 0 : SvxPageUsage(rPageItem.GetPageUsage()) );
138 : :
139 : 0 : if ( bRightPage )
140 : : {
141 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
142 : 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
143 : : }
144 : : else
145 : : {
146 : : // #69193a# respect "shared" setting
147 : :
148 : 0 : sal_Bool bShareHeader = IS_SHARE_HEADER(rCoreSet);
149 : 0 : if ( bShareHeader )
150 : 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
151 : : else
152 : 0 : AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
153 : :
154 : 0 : sal_Bool bShareFooter = IS_SHARE_FOOTER(rCoreSet);
155 : 0 : if ( bShareFooter )
156 : 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
157 : : else
158 : 0 : AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
159 : : }
160 : : }
161 : 0 : break;
162 : : }
163 : :
164 : 0 : FreeResource();
165 : 0 : }
166 : :
167 : : // -----------------------------------------------------------------------
168 : :
169 : 0 : ScHFEditDlg::~ScHFEditDlg()
170 : : {
171 : 0 : }
172 : :
173 : : // -----------------------------------------------------------------------
174 : :
175 : 0 : void ScHFEditDlg::PageCreated( sal_uInt16 /* nId */, SfxTabPage& rPage )
176 : : {
177 : : // kann ja nur ne ScHFEditPage sein...
178 : :
179 : 0 : ((ScHFEditPage&)rPage).SetNumType(eNumType);
180 : 0 : }
181 : :
182 : :
183 : :
184 : :
185 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|