xref: /aoo41x/main/sc/source/ui/styleui/styledlg.cxx (revision b3f79822)
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_sc.hxx"
26 
27 #undef SC_DLLIMPLEMENTATION
28 
29 
30 
31 //------------------------------------------------------------------
32 
33 #include "scitems.hxx"
34 //CHINA001 #include <svx/align.hxx>
35 //CHINA001 #include <svx/backgrnd.hxx>
36 //CHINA001 #include <svx/border.hxx>
37 //CHINA001 #include <svx/chardlg.hxx>
38 //CHINA001 #include <svx/numfmt.hxx>
39 #include <svx/numinf.hxx> //CHINA001
40 //CHINA001 #include <svx/page.hxx>
41 //CHINA001 #include <svx/paragrph.hxx>
42 #include <sfx2/objsh.hxx>
43 #include <svl/style.hxx>
44 #include <svl/cjkoptions.hxx>
45 
46 #include "styledlg.hxx"
47 #include "tabpages.hxx"		// Zellvorlagen
48 #include "tphf.hxx"			// Seitenvorlage: Kopf-/Fusszeilen
49 #include "tptable.hxx"		// Seitenvorlage: Tabelle
50 #include "scresid.hxx"
51 #include "sc.hrc"
52 #include "styledlg.hrc"
53 #include <svx/svxdlg.hxx> //CHINA001
54 #include <svx/svxids.hrc> //CHINA001
55 #include <svx/dialogs.hrc> //CHINA001
56 #include <svl/intitem.hxx> //CHINA001
57 #include <editeng/flstitem.hxx> //CHINA001
58 #include <svl/aeitem.hxx> //CHINA001
59 #include <svx/flagsdef.hxx> //CHINA001
60 //==================================================================
61 
ScStyleDlg(Window * pParent,SfxStyleSheetBase & rStyleBase,sal_uInt16 nRscId)62 ScStyleDlg::ScStyleDlg( Window*				pParent,
63 						SfxStyleSheetBase&	rStyleBase,
64 						sal_uInt16				nRscId )
65 
66 	:	SfxStyleDialog	( pParent,
67 						  ScResId( nRscId ),
68 						  rStyleBase,
69 						  sal_False ),
70 		nDlgRsc			( nRscId )
71 {
72 	SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); //CHINA001
73 	DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
74 	switch ( nRscId )
75 	{
76 		case RID_SCDLG_STYLES_PAR:	// Zellformatvorlagen
77 			{
78 				SvtCJKOptions aCJKOptions;
79 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001
80 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageRangesFunc fail!");//CHINA001
81 				AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ) );  //CHINA001 AddTabPage( TP_NUMBER, &SvxNumberFormatTabPage::Create, &SvxNumberFormatTabPage::GetRanges );
82 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001
83 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");//CHINA001
84 				AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) ); //CHINA001 AddTabPage( TP_FONT, &SvxCharNamePage::Create,		    &SvxCharNamePage::GetRanges );
85 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001
86 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");//CHINA001
87 				AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) ); //CHINA001 AddTabPage( TP_FONTEFF, &SvxCharEffectsPage::Create,		    &SvxCharEffectsPage::GetRanges );
88 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001
89 				DBG_ASSERT( pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageRangesFunc fail!");//CHINA001
90 				AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ) ); //CHINA001 AddTabPage( TP_ALIGNMENT, &SvxAlignmentTabPage::Create,	&SvxAlignmentTabPage::GetRanges );
91 				if ( aCJKOptions.IsAsianTypographyEnabled() )
92 				{
93 				//CHINA001 	AddTabPage( TP_ASIAN, &SvxAsianTabPage::Create,		&SvxAsianTabPage::GetRanges );
94 
95 					DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001
96 					DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");//CHINA001
97 					AddTabPage( TP_ASIAN,	pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),		pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
98 				}
99 				else
100 					RemoveTabPage( TP_ASIAN );
101 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001
102 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");//CHINA001
103 				AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create,		&SvxBorderTabPage::GetRanges );
104 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001
105 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");//CHINA001
106 				AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create,	&SvxBackgroundTabPage::GetRanges );
107 				AddTabPage( TP_PROTECTION, &ScTabPageProtection::Create,	&ScTabPageProtection::GetRanges );
108 			}
109 			break;
110 
111 		case RID_SCDLG_STYLES_PAGE:	// Seitenvorlagen
112 			{
113 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");//CHINA001
114 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");//CHINA001
115 				AddTabPage( TP_PAGE_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) ); //CHINA001 AddTabPage( TP_PAGE_STD, &SvxPageDescPage::Create,	&SvxPageDescPage::GetRanges );
116 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001
117 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");//CHINA001
118 				AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create,	&SvxBorderTabPage::GetRanges );
119 				DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001
120 				DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");//CHINA001
121 				AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create,	&SvxBackgroundTabPage::GetRanges );
122 				AddTabPage( TP_PAGE_HEADER, &ScHeaderPage::Create,	  	&ScHeaderPage::GetRanges );
123 				AddTabPage( TP_PAGE_FOOTER, &ScFooterPage::Create,	 	&ScFooterPage::GetRanges );
124 				AddTabPage( TP_TABLE, &ScTablePage::Create,		&ScTablePage::GetRanges );
125 			}
126 			break;
127 
128 		default:
129 			DBG_ERROR( "Family not supported" );
130 	}
131 
132 	//--------------------------------------------------------------------
133 	FreeResource();
134 }
135 
136 // -----------------------------------------------------------------------
137 
~ScStyleDlg()138 __EXPORT ScStyleDlg::~ScStyleDlg()
139 {
140 }
141 
142 // -----------------------------------------------------------------------
143 
PageCreated(sal_uInt16 nPageId,SfxTabPage & rTabPage)144 void __EXPORT ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
145 {
146 	if ( nDlgRsc == RID_SCDLG_STYLES_PAR )
147 	{
148 		SfxObjectShell* pDocSh = SfxObjectShell::Current();
149 		SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001
150 		switch ( nPageId )
151 		{
152 			case TP_NUMBER:
153 				{
154 					const SfxPoolItem* pInfoItem
155 						= pDocSh->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
156 
157 					DBG_ASSERT( pInfoItem, "NumberInfoItem nicht gefunden!" );
158 
159 					//CHINA001 ((SvxNumberFormatTabPage&)rTabPage).
160 						//CHINA001 SetNumberFormatList(
161 							//CHINA001 (const SvxNumberInfoItem&)*pInfoItem ) ;
162 					aSet.Put (SvxNumberInfoItem( (const SvxNumberInfoItem&)*pInfoItem ) );
163 					rTabPage.PageCreated(aSet);
164 				}
165 				break;
166 
167 			case TP_FONT:
168 				{
169 					const SfxPoolItem* pInfoItem
170 						= pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
171 
172 					DBG_ASSERT( pInfoItem, "FontListItem nicht gefunden!" );
173 
174 					//CHINA001 ((SvxCharNamePage&)rTabPage).
175 						//CHINA001 SetFontList(
176 							//CHINA001 (const SvxFontListItem&)*pInfoItem );
177 					aSet.Put (SvxFontListItem(((const SvxFontListItem&)*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST));
178 					rTabPage.PageCreated(aSet);
179 				}
180 				break;
181 
182 			default:
183 			break;
184 		}
185 	}
186 	else if ( nDlgRsc == RID_SCDLG_STYLES_PAGE )
187 	{
188 		SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));//CHINA001
189 		switch ( nPageId )
190 		{
191 			case TP_PAGE_STD:
192 				//CHINA001 ((SvxPageDescPage&)rTabPage).SetMode( SVX_PAGE_MODE_CENTER );
193 				aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER)); //CHINA001
194 				rTabPage.PageCreated(aSet); //CHINA001
195 				break;
196 
197 			case TP_PAGE_HEADER:
198 			case TP_PAGE_FOOTER:
199 				((ScHFPage&)rTabPage).SetStyleDlg( this );
200 				((ScHFPage&)rTabPage).SetPageStyle( GetStyleSheet().GetName() );
201 				((ScHFPage&)rTabPage).DisableDeleteQueryBox();
202 				break;
203 			case TP_BACKGROUND:
204 					if( nDlgRsc == RID_SCDLG_STYLES_PAGE)
205 						//CHINA001 ((SvxBackgroundTabPage&)rTabPage).ShowSelector();
206 					{	//add CHINA001
207 						aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
208 						rTabPage.PageCreated(aSet);
209 					}
210 				break;
211 
212 			default:
213 				break;
214 		}
215 	}
216 }
217 
218 
219 // -----------------------------------------------------------------------
220 
GetRefreshedSet()221 const SfxItemSet* __EXPORT ScStyleDlg::GetRefreshedSet()
222 {
223     SfxItemSet* pItemSet = GetInputSetImpl();
224     pItemSet->ClearItem();
225     pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
226     return pItemSet;
227 }
228 
229 
230 
231