1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfedtdlg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include "scitems.hxx"
41 #include <svtools/eitem.hxx>
43 #include "hfedtdlg.hxx"
45 #include "globstr.hrc"
46 //CHINA001 #include "tphfedit.hxx"
47 #include "scresid.hxx"
48 #include "hfedtdlg.hrc"
49 #include "scuitphfedit.hxx" //CHINA001
50 //------------------------------------------------------------------
52 // macros from docsh4.cxx
55 #define IS_SHARE_HEADER(set) \
57 ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \
58 Get(ATTR_PAGE_SHARED)).GetValue()
60 #define IS_SHARE_FOOTER(set) \
62 ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \
63 Get(ATTR_PAGE_SHARED)).GetValue()
65 //==================================================================
67 ScHFEditDlg::ScHFEditDlg( SfxViewFrame
* pFrameP
,
69 const SfxItemSet
& rCoreSet
,
70 const String
& rPageStyle
,
72 : SfxTabDialog( pFrameP
, pParent
, ScResId( nResIdP
), &rCoreSet
)
74 eNumType
= ((const SvxPageItem
&)rCoreSet
.Get(ATTR_PAGE
)).GetNumType();
76 String aTmp
= GetText();
78 aTmp
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
79 aTmp
+= ScGlobal::GetRscString( STR_PAGESTYLE
);
80 aTmp
.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
87 case RID_SCDLG_HFED_HEADER
:
88 case RID_SCDLG_HFEDIT_HEADER
:
89 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
90 AddTabPage( 2, ScLeftHeaderEditPage::Create
, NULL
);
93 case RID_SCDLG_HFED_FOOTER
:
94 case RID_SCDLG_HFEDIT_FOOTER
:
95 AddTabPage( 1, ScRightFooterEditPage::Create
, NULL
);
96 AddTabPage( 2, ScLeftFooterEditPage::Create
, NULL
);
99 case RID_SCDLG_HFEDIT_LEFTHEADER
:
100 AddTabPage( 1, ScLeftHeaderEditPage::Create
, NULL
);
103 case RID_SCDLG_HFEDIT_RIGHTHEADER
:
104 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
107 case RID_SCDLG_HFEDIT_LEFTFOOTER
:
108 AddTabPage( 1, ScLeftFooterEditPage::Create
, NULL
);
111 case RID_SCDLG_HFEDIT_RIGHTFOOTER
:
112 AddTabPage( 1, ScRightFooterEditPage::Create
, NULL
);
115 case RID_SCDLG_HFEDIT_SHDR
:
116 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
117 AddTabPage( 2, ScRightFooterEditPage::Create
, NULL
);
118 AddTabPage( 3, ScLeftFooterEditPage::Create
, NULL
);
121 case RID_SCDLG_HFEDIT_SFTR
:
122 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
123 AddTabPage( 2, ScLeftHeaderEditPage::Create
, NULL
);
124 AddTabPage( 3, ScRightFooterEditPage::Create
, NULL
);
127 case RID_SCDLG_HFEDIT_ALL
:
128 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
129 AddTabPage( 2, ScLeftHeaderEditPage::Create
, NULL
);
130 AddTabPage( 3, ScRightFooterEditPage::Create
, NULL
);
131 AddTabPage( 4, ScLeftFooterEditPage::Create
, NULL
);
135 case RID_SCDLG_HFEDIT
:
137 const SvxPageItem
& rPageItem
= (const SvxPageItem
&)
139 rCoreSet
.GetPool()->GetWhich(SID_ATTR_PAGE
) );
141 BOOL bRightPage
= ( SVX_PAGE_LEFT
!=
142 SvxPageUsage(rPageItem
.GetPageUsage()) );
146 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
147 AddTabPage( 2, ScRightFooterEditPage::Create
, NULL
);
151 // #69193a# respect "shared" setting
153 BOOL bShareHeader
= IS_SHARE_HEADER(rCoreSet
);
155 AddTabPage( 1, ScRightHeaderEditPage::Create
, NULL
);
157 AddTabPage( 1, ScLeftHeaderEditPage::Create
, NULL
);
159 BOOL bShareFooter
= IS_SHARE_FOOTER(rCoreSet
);
161 AddTabPage( 2, ScRightFooterEditPage::Create
, NULL
);
163 AddTabPage( 2, ScLeftFooterEditPage::Create
, NULL
);
172 // -----------------------------------------------------------------------
174 __EXPORT
ScHFEditDlg::~ScHFEditDlg()
178 // -----------------------------------------------------------------------
180 void __EXPORT
ScHFEditDlg::PageCreated( USHORT
/* nId */, SfxTabPage
& rPage
)
182 // kann ja nur ne ScHFEditPage sein...
184 ((ScHFEditPage
&)rPage
).SetNumType(eNumType
);