xref: /aoo42x/main/sc/source/ui/attrdlg/attrdlg.cxx (revision a479921a)
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 
28 
29 #include "scitems.hxx"
30 
31 #include <sfx2/objsh.hxx>
32 #include <sfx2/tabdlg.hxx>
33 //CHINA001 #include <svx/align.hxx>
34 //CHINA001 #include <svx/backgrnd.hxx>
35 //CHINA001 #include <svx/border.hxx>
36 //CHINA001 #include <svx/chardlg.hxx>
37 //CHINA001 #include <svx/numfmt.hxx>
38 //CHINA001 #include <svx/paragrph.hxx>
39 #include <svl/cjkoptions.hxx>
40 
41 #include "tabpages.hxx"
42 #include "attrdlg.hxx"
43 #include "scresid.hxx"
44 #include "attrdlg.hrc"
45 #include <svx/svxdlg.hxx> //CHINA001
46 #include <svx/dialogs.hrc> //CHINA001
47 #include <svx/flagsdef.hxx> //CHINA001
48 #include <editeng/flstitem.hxx> //CHINA001
49 #include <sfx2/app.hxx> //CHINA001
50 
51 #if !LAYOUT_SFX_TABDIALOG_BROKEN
52 #include <layout/layout-pre.hxx>
53 #endif
54 
55 //==================================================================
56 
ScAttrDlg(SfxViewFrame * pFrameP,Window * pParent,const SfxItemSet * pCellAttrs)57 ScAttrDlg::ScAttrDlg( SfxViewFrame*     pFrameP,
58 					  Window*			pParent,
59 					  const SfxItemSet* pCellAttrs )
60 
61     :   SfxTabDialog( pFrameP,
62 					  pParent,
63 					  ScResId( RID_SCDLG_ATTR ),
64 					  pCellAttrs )
65 {
66 	SvtCJKOptions aCJKOptions;
67 	SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
68 	DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
69 
70 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001
71 #if LAYOUT_SFX_TABDIALOG_BROKEN
72 	AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 ); //CHINA001 AddTabPage( TP_NUMBER,		SvxNumberFormatTabPage::Create,	0 );
73 #else
74     String number = rtl::OUString::createFromAscii ("Numbers");
75 	AddTabPage( TP_NUMBER, number, pFact->GetTabPageCreatorFunc (RID_SVXPAGE_NUMBERFORMAT), 0, sal_False, TAB_APPEND);
76 #endif
77 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001
78 	AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); //CHINA001 AddTabPage( TP_FONT,		SvxCharNamePage::Create,		0 );
79 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001
80 	AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); //CHINA001 AddTabPage( TP_FONTEFF,		SvxCharEffectsPage::Create,		0 );
81 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001
82 	AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ),	0 ); //CHINA001 AddTabPage( TP_ALIGNMENT,	SvxAlignmentTabPage::Create,	0 );
83 
84 	if ( aCJKOptions.IsAsianTypographyEnabled() )
85 	{
86 		//CHINA001 AddTabPage( TP_ASIAN,	SvxAsianTabPage::Create,		0 );
87 //        ::CreateTabPage pCreateTabpage = pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN);
88 		DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001
89 		AddTabPage( TP_ASIAN,	pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),		0 );
90 	}
91 	else
92 		RemoveTabPage( TP_ASIAN );
93 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001
94 	AddTabPage( TP_BORDER,		pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ),		0 ); //CHINA001 AddTabPage( TP_BORDER,		SvxBorderTabPage::Create,		0 );
95 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001
96 	AddTabPage( TP_BACKGROUND,	pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ),	0 ); //CHINA001 AddTabPage( TP_BACKGROUND,	SvxBackgroundTabPage::Create,	0 );
97 	AddTabPage( TP_PROTECTION,	ScTabPageProtection::Create,	0 );
98 	FreeResource();
99 }
100 
101 // -----------------------------------------------------------------------
102 
~ScAttrDlg()103 __EXPORT ScAttrDlg::~ScAttrDlg()
104 {
105 }
106 
107 // -----------------------------------------------------------------------
108 
PageCreated(sal_uInt16 nPageId,SfxTabPage & rTabPage)109 void __EXPORT ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
110 {
111 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
112 	SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001
113 	switch ( nPageId )
114 	{
115 		case TP_NUMBER:
116 		{
117 			//CHINA001 SvxNumberFormatTabPage& rNumPage  = (SvxNumberFormatTabPage&)rTabPage;
118 
119 			//CHINA001 rNumPage.SetOkHdl( LINK( this, ScAttrDlg, OkHandler ) );
120 			aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
121 			rTabPage.PageCreated(aSet);
122 		}
123 		break;
124 
125 		case TP_FONT:
126 		{
127 			const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
128 
129 			DBG_ASSERT( pInfoItem, "FontListItem  not found :-(" );
130 
131 			//CHINA001 ((SvxCharNamePage&)rTabPage).
132 				//CHINA001 SetFontList( *((const SvxFontListItem*)pInfoItem) );
133 			aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
134 			rTabPage.PageCreated(aSet);
135 		}
136 		break;
137 
138 		default:
139 		break;
140 	}
141 }
142 
143 // -----------------------------------------------------------------------
144 
IMPL_LINK(ScAttrDlg,OkHandler,void *,EMPTYARG)145 IMPL_LINK( ScAttrDlg, OkHandler, void*, EMPTYARG )
146 {
147 	((Link&)GetOKButton().GetClickHdl()).Call( NULL );
148 
149 	return 0;
150 }
151 
152 
153