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 : //------------------------------------------------------------------
26 :
27 : #include "scitems.hxx"
28 : #include <svl/eitem.hxx>
29 :
30 : #include "hfedtdlg.hxx"
31 : #include "global.hxx"
32 : #include "globstr.hrc"
33 : #include "scresid.hxx"
34 : #include "hfedtdlg.hrc"
35 : #include "scuitphfedit.hxx"
36 : //------------------------------------------------------------------
37 :
38 : // macros from docsh4.cxx
39 : //! use SIDs?
40 :
41 : #define IS_SHARE_HEADER(set) \
42 : ((SfxBoolItem&) \
43 : ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
44 : Get(ATTR_PAGE_SHARED)).GetValue()
45 :
46 : #define IS_SHARE_FOOTER(set) \
47 : ((SfxBoolItem&) \
48 : ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
49 : Get(ATTR_PAGE_SHARED)).GetValue()
50 :
51 : //==================================================================
52 :
53 0 : ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP,
54 : Window* pParent,
55 : const SfxItemSet& rCoreSet,
56 : const String& rPageStyle,
57 : sal_uInt16 nResIdP )
58 0 : : SfxTabDialog( pFrameP, pParent, ScResId( nResIdP ), &rCoreSet )
59 : {
60 0 : eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType();
61 :
62 0 : String aTmp = GetText();
63 :
64 0 : aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
65 0 : aTmp += ScGlobal::GetRscString( STR_PAGESTYLE );
66 0 : aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
67 0 : aTmp += rPageStyle;
68 0 : aTmp += ')';
69 0 : SetText( aTmp );
70 :
71 0 : switch ( nResIdP )
72 : {
73 : case RID_SCDLG_HFED_HEADER:
74 : case RID_SCDLG_HFEDIT_HEADER:
75 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
76 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
77 0 : break;
78 :
79 : case RID_SCDLG_HFED_FOOTER:
80 : case RID_SCDLG_HFEDIT_FOOTER:
81 0 : AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
82 0 : AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
83 0 : break;
84 :
85 : case RID_SCDLG_HFEDIT_LEFTHEADER:
86 0 : AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
87 0 : break;
88 :
89 : case RID_SCDLG_HFEDIT_RIGHTHEADER:
90 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
91 0 : break;
92 :
93 : case RID_SCDLG_HFEDIT_LEFTFOOTER:
94 0 : AddTabPage( 1, ScLeftFooterEditPage::Create, NULL );
95 0 : break;
96 :
97 : case RID_SCDLG_HFEDIT_RIGHTFOOTER:
98 0 : AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
99 0 : break;
100 :
101 : case RID_SCDLG_HFEDIT_SHDR:
102 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
103 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
104 0 : AddTabPage( 3, ScLeftFooterEditPage::Create, NULL );
105 0 : break;
106 :
107 : case RID_SCDLG_HFEDIT_SFTR:
108 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
109 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
110 0 : AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
111 0 : break;
112 :
113 : case RID_SCDLG_HFEDIT_ALL:
114 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
115 0 : AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
116 0 : AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
117 0 : AddTabPage( 4, ScLeftFooterEditPage::Create, NULL );
118 0 : break;
119 :
120 : default:
121 : case RID_SCDLG_HFEDIT:
122 : {
123 : const SvxPageItem& rPageItem = (const SvxPageItem&)
124 : rCoreSet.Get(
125 0 : rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
126 :
127 : sal_Bool bRightPage = ( SVX_PAGE_LEFT !=
128 0 : SvxPageUsage(rPageItem.GetPageUsage()) );
129 :
130 0 : if ( bRightPage )
131 : {
132 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
133 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
134 : }
135 : else
136 : {
137 : // #69193a# respect "shared" setting
138 :
139 0 : sal_Bool bShareHeader = IS_SHARE_HEADER(rCoreSet);
140 0 : if ( bShareHeader )
141 0 : AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
142 : else
143 0 : AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
144 :
145 0 : sal_Bool bShareFooter = IS_SHARE_FOOTER(rCoreSet);
146 0 : if ( bShareFooter )
147 0 : AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
148 : else
149 0 : AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
150 : }
151 : }
152 0 : break;
153 : }
154 :
155 0 : FreeResource();
156 0 : }
157 :
158 : // -----------------------------------------------------------------------
159 :
160 0 : ScHFEditDlg::~ScHFEditDlg()
161 : {
162 0 : }
163 :
164 : // -----------------------------------------------------------------------
165 :
166 0 : void ScHFEditDlg::PageCreated( sal_uInt16 /* nId */, SfxTabPage& rPage )
167 : {
168 : // kann ja nur ne ScHFEditPage sein...
169 :
170 0 : ((ScHFEditPage&)rPage).SetNumType(eNumType);
171 0 : }
172 :
173 :
174 :
175 :
176 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|