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