1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_sc.hxx"
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #undef SC_DLLIMPLEMENTATION
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski //------------------------------------------------------------------
32*b1cdbd2cSJim Jagielski
33*b1cdbd2cSJim Jagielski #include "scitems.hxx"
34*b1cdbd2cSJim Jagielski #include <svl/eitem.hxx>
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim Jagielski #include "hfedtdlg.hxx"
37*b1cdbd2cSJim Jagielski #include "global.hxx"
38*b1cdbd2cSJim Jagielski #include "globstr.hrc"
39*b1cdbd2cSJim Jagielski //CHINA001 #include "tphfedit.hxx"
40*b1cdbd2cSJim Jagielski #include "scresid.hxx"
41*b1cdbd2cSJim Jagielski #include "hfedtdlg.hrc"
42*b1cdbd2cSJim Jagielski #include "scuitphfedit.hxx" //CHINA001
43*b1cdbd2cSJim Jagielski //------------------------------------------------------------------
44*b1cdbd2cSJim Jagielski
45*b1cdbd2cSJim Jagielski // macros from docsh4.cxx
46*b1cdbd2cSJim Jagielski //! use SIDs?
47*b1cdbd2cSJim Jagielski
48*b1cdbd2cSJim Jagielski #define IS_SHARE_HEADER(set) \
49*b1cdbd2cSJim Jagielski ((SfxBoolItem&) \
50*b1cdbd2cSJim Jagielski ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
51*b1cdbd2cSJim Jagielski Get(ATTR_PAGE_SHARED)).GetValue()
52*b1cdbd2cSJim Jagielski
53*b1cdbd2cSJim Jagielski #define IS_SHARE_FOOTER(set) \
54*b1cdbd2cSJim Jagielski ((SfxBoolItem&) \
55*b1cdbd2cSJim Jagielski ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
56*b1cdbd2cSJim Jagielski Get(ATTR_PAGE_SHARED)).GetValue()
57*b1cdbd2cSJim Jagielski
58*b1cdbd2cSJim Jagielski //==================================================================
59*b1cdbd2cSJim Jagielski
ScHFEditDlg(SfxViewFrame * pFrameP,Window * pParent,const SfxItemSet & rCoreSet,const String & rPageStyle,sal_uInt16 nResIdP)60*b1cdbd2cSJim Jagielski ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP,
61*b1cdbd2cSJim Jagielski Window* pParent,
62*b1cdbd2cSJim Jagielski const SfxItemSet& rCoreSet,
63*b1cdbd2cSJim Jagielski const String& rPageStyle,
64*b1cdbd2cSJim Jagielski sal_uInt16 nResIdP )
65*b1cdbd2cSJim Jagielski : SfxTabDialog( pFrameP, pParent, ScResId( nResIdP ), &rCoreSet )
66*b1cdbd2cSJim Jagielski {
67*b1cdbd2cSJim Jagielski eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType();
68*b1cdbd2cSJim Jagielski
69*b1cdbd2cSJim Jagielski String aTmp = GetText();
70*b1cdbd2cSJim Jagielski
71*b1cdbd2cSJim Jagielski aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
72*b1cdbd2cSJim Jagielski aTmp += ScGlobal::GetRscString( STR_PAGESTYLE );
73*b1cdbd2cSJim Jagielski aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
74*b1cdbd2cSJim Jagielski aTmp += rPageStyle;
75*b1cdbd2cSJim Jagielski aTmp += ')';
76*b1cdbd2cSJim Jagielski SetText( aTmp );
77*b1cdbd2cSJim Jagielski
78*b1cdbd2cSJim Jagielski switch ( nResIdP )
79*b1cdbd2cSJim Jagielski {
80*b1cdbd2cSJim Jagielski case RID_SCDLG_HFED_HEADER:
81*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_HEADER:
82*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
83*b1cdbd2cSJim Jagielski AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
84*b1cdbd2cSJim Jagielski break;
85*b1cdbd2cSJim Jagielski
86*b1cdbd2cSJim Jagielski case RID_SCDLG_HFED_FOOTER:
87*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_FOOTER:
88*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
89*b1cdbd2cSJim Jagielski AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
90*b1cdbd2cSJim Jagielski break;
91*b1cdbd2cSJim Jagielski
92*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_LEFTHEADER:
93*b1cdbd2cSJim Jagielski AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
94*b1cdbd2cSJim Jagielski break;
95*b1cdbd2cSJim Jagielski
96*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_RIGHTHEADER:
97*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
98*b1cdbd2cSJim Jagielski break;
99*b1cdbd2cSJim Jagielski
100*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_LEFTFOOTER:
101*b1cdbd2cSJim Jagielski AddTabPage( 1, ScLeftFooterEditPage::Create, NULL );
102*b1cdbd2cSJim Jagielski break;
103*b1cdbd2cSJim Jagielski
104*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_RIGHTFOOTER:
105*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightFooterEditPage::Create, NULL );
106*b1cdbd2cSJim Jagielski break;
107*b1cdbd2cSJim Jagielski
108*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_SHDR:
109*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
110*b1cdbd2cSJim Jagielski AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
111*b1cdbd2cSJim Jagielski AddTabPage( 3, ScLeftFooterEditPage::Create, NULL );
112*b1cdbd2cSJim Jagielski break;
113*b1cdbd2cSJim Jagielski
114*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_SFTR:
115*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
116*b1cdbd2cSJim Jagielski AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
117*b1cdbd2cSJim Jagielski AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
118*b1cdbd2cSJim Jagielski break;
119*b1cdbd2cSJim Jagielski
120*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT_ALL:
121*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
122*b1cdbd2cSJim Jagielski AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL );
123*b1cdbd2cSJim Jagielski AddTabPage( 3, ScRightFooterEditPage::Create, NULL );
124*b1cdbd2cSJim Jagielski AddTabPage( 4, ScLeftFooterEditPage::Create, NULL );
125*b1cdbd2cSJim Jagielski break;
126*b1cdbd2cSJim Jagielski
127*b1cdbd2cSJim Jagielski default:
128*b1cdbd2cSJim Jagielski case RID_SCDLG_HFEDIT:
129*b1cdbd2cSJim Jagielski {
130*b1cdbd2cSJim Jagielski const SvxPageItem& rPageItem = (const SvxPageItem&)
131*b1cdbd2cSJim Jagielski rCoreSet.Get(
132*b1cdbd2cSJim Jagielski rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) );
133*b1cdbd2cSJim Jagielski
134*b1cdbd2cSJim Jagielski sal_Bool bRightPage = ( SVX_PAGE_LEFT !=
135*b1cdbd2cSJim Jagielski SvxPageUsage(rPageItem.GetPageUsage()) );
136*b1cdbd2cSJim Jagielski
137*b1cdbd2cSJim Jagielski if ( bRightPage )
138*b1cdbd2cSJim Jagielski {
139*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
140*b1cdbd2cSJim Jagielski AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
141*b1cdbd2cSJim Jagielski }
142*b1cdbd2cSJim Jagielski else
143*b1cdbd2cSJim Jagielski {
144*b1cdbd2cSJim Jagielski // #69193a# respect "shared" setting
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski sal_Bool bShareHeader = IS_SHARE_HEADER(rCoreSet);
147*b1cdbd2cSJim Jagielski if ( bShareHeader )
148*b1cdbd2cSJim Jagielski AddTabPage( 1, ScRightHeaderEditPage::Create, NULL );
149*b1cdbd2cSJim Jagielski else
150*b1cdbd2cSJim Jagielski AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL );
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski sal_Bool bShareFooter = IS_SHARE_FOOTER(rCoreSet);
153*b1cdbd2cSJim Jagielski if ( bShareFooter )
154*b1cdbd2cSJim Jagielski AddTabPage( 2, ScRightFooterEditPage::Create, NULL );
155*b1cdbd2cSJim Jagielski else
156*b1cdbd2cSJim Jagielski AddTabPage( 2, ScLeftFooterEditPage::Create, NULL );
157*b1cdbd2cSJim Jagielski }
158*b1cdbd2cSJim Jagielski }
159*b1cdbd2cSJim Jagielski break;
160*b1cdbd2cSJim Jagielski }
161*b1cdbd2cSJim Jagielski
162*b1cdbd2cSJim Jagielski FreeResource();
163*b1cdbd2cSJim Jagielski }
164*b1cdbd2cSJim Jagielski
165*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------
166*b1cdbd2cSJim Jagielski
~ScHFEditDlg()167*b1cdbd2cSJim Jagielski __EXPORT ScHFEditDlg::~ScHFEditDlg()
168*b1cdbd2cSJim Jagielski {
169*b1cdbd2cSJim Jagielski }
170*b1cdbd2cSJim Jagielski
171*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------
172*b1cdbd2cSJim Jagielski
PageCreated(sal_uInt16,SfxTabPage & rPage)173*b1cdbd2cSJim Jagielski void __EXPORT ScHFEditDlg::PageCreated( sal_uInt16 /* nId */, SfxTabPage& rPage )
174*b1cdbd2cSJim Jagielski {
175*b1cdbd2cSJim Jagielski // kann ja nur ne ScHFEditPage sein...
176*b1cdbd2cSJim Jagielski
177*b1cdbd2cSJim Jagielski ((ScHFEditPage&)rPage).SetNumType(eNumType);
178*b1cdbd2cSJim Jagielski }
179*b1cdbd2cSJim Jagielski
180*b1cdbd2cSJim Jagielski
181*b1cdbd2cSJim Jagielski
182*b1cdbd2cSJim Jagielski
183