xref: /aoo41x/main/sc/source/ui/attrdlg/attrdlg.cxx (revision b3f79822)
1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3f79822SAndrew Rist  * distributed with this work for additional information
6*b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b3f79822SAndrew Rist  *
11*b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist  *
13*b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3f79822SAndrew Rist  * specific language governing permissions and limitations
18*b3f79822SAndrew Rist  * under the License.
19*b3f79822SAndrew Rist  *
20*b3f79822SAndrew Rist  *************************************************************/
21*b3f79822SAndrew Rist 
22*b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #undef SC_DLLIMPLEMENTATION
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "scitems.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <sfx2/objsh.hxx>
34cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
35cdf0e10cSrcweir //CHINA001 #include <svx/align.hxx>
36cdf0e10cSrcweir //CHINA001 #include <svx/backgrnd.hxx>
37cdf0e10cSrcweir //CHINA001 #include <svx/border.hxx>
38cdf0e10cSrcweir //CHINA001 #include <svx/chardlg.hxx>
39cdf0e10cSrcweir //CHINA001 #include <svx/numfmt.hxx>
40cdf0e10cSrcweir //CHINA001 #include <svx/paragrph.hxx>
41cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include "tabpages.hxx"
44cdf0e10cSrcweir #include "attrdlg.hxx"
45cdf0e10cSrcweir #include "scresid.hxx"
46cdf0e10cSrcweir #include "attrdlg.hrc"
47cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
48cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
49cdf0e10cSrcweir #include <svx/flagsdef.hxx> //CHINA001
50cdf0e10cSrcweir #include <editeng/flstitem.hxx> //CHINA001
51cdf0e10cSrcweir #include <sfx2/app.hxx> //CHINA001
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #if !LAYOUT_SFX_TABDIALOG_BROKEN
54cdf0e10cSrcweir #include <layout/layout-pre.hxx>
55cdf0e10cSrcweir #endif
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //==================================================================
58cdf0e10cSrcweir 
ScAttrDlg(SfxViewFrame * pFrameP,Window * pParent,const SfxItemSet * pCellAttrs)59cdf0e10cSrcweir ScAttrDlg::ScAttrDlg( SfxViewFrame*     pFrameP,
60cdf0e10cSrcweir 					  Window*			pParent,
61cdf0e10cSrcweir 					  const SfxItemSet* pCellAttrs )
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     :   SfxTabDialog( pFrameP,
64cdf0e10cSrcweir 					  pParent,
65cdf0e10cSrcweir 					  ScResId( RID_SCDLG_ATTR ),
66cdf0e10cSrcweir 					  pCellAttrs )
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	SvtCJKOptions aCJKOptions;
69cdf0e10cSrcweir 	SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
70cdf0e10cSrcweir 	DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001
73cdf0e10cSrcweir #if LAYOUT_SFX_TABDIALOG_BROKEN
74cdf0e10cSrcweir 	AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 ); //CHINA001 AddTabPage( TP_NUMBER,		SvxNumberFormatTabPage::Create,	0 );
75cdf0e10cSrcweir #else
76cdf0e10cSrcweir     String number = rtl::OUString::createFromAscii ("Numbers");
77cdf0e10cSrcweir 	AddTabPage( TP_NUMBER, number, pFact->GetTabPageCreatorFunc (RID_SVXPAGE_NUMBERFORMAT), 0, sal_False, TAB_APPEND);
78cdf0e10cSrcweir #endif
79cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001
80cdf0e10cSrcweir 	AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); //CHINA001 AddTabPage( TP_FONT,		SvxCharNamePage::Create,		0 );
81cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001
82cdf0e10cSrcweir 	AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); //CHINA001 AddTabPage( TP_FONTEFF,		SvxCharEffectsPage::Create,		0 );
83cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001
84cdf0e10cSrcweir 	AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ),	0 ); //CHINA001 AddTabPage( TP_ALIGNMENT,	SvxAlignmentTabPage::Create,	0 );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	if ( aCJKOptions.IsAsianTypographyEnabled() )
87cdf0e10cSrcweir 	{
88cdf0e10cSrcweir 		//CHINA001 AddTabPage( TP_ASIAN,	SvxAsianTabPage::Create,		0 );
89cdf0e10cSrcweir //        ::CreateTabPage pCreateTabpage = pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN);
90cdf0e10cSrcweir 		DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001
91cdf0e10cSrcweir 		AddTabPage( TP_ASIAN,	pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),		0 );
92cdf0e10cSrcweir 	}
93cdf0e10cSrcweir 	else
94cdf0e10cSrcweir 		RemoveTabPage( TP_ASIAN );
95cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001
96cdf0e10cSrcweir 	AddTabPage( TP_BORDER,		pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ),		0 ); //CHINA001 AddTabPage( TP_BORDER,		SvxBorderTabPage::Create,		0 );
97cdf0e10cSrcweir 	DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001
98cdf0e10cSrcweir 	AddTabPage( TP_BACKGROUND,	pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ),	0 ); //CHINA001 AddTabPage( TP_BACKGROUND,	SvxBackgroundTabPage::Create,	0 );
99cdf0e10cSrcweir 	AddTabPage( TP_PROTECTION,	ScTabPageProtection::Create,	0 );
100cdf0e10cSrcweir 	FreeResource();
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir // -----------------------------------------------------------------------
104cdf0e10cSrcweir 
~ScAttrDlg()105cdf0e10cSrcweir __EXPORT ScAttrDlg::~ScAttrDlg()
106cdf0e10cSrcweir {
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // -----------------------------------------------------------------------
110cdf0e10cSrcweir 
PageCreated(sal_uInt16 nPageId,SfxTabPage & rTabPage)111cdf0e10cSrcweir void __EXPORT ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
114cdf0e10cSrcweir 	SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001
115cdf0e10cSrcweir 	switch ( nPageId )
116cdf0e10cSrcweir 	{
117cdf0e10cSrcweir 		case TP_NUMBER:
118cdf0e10cSrcweir 		{
119cdf0e10cSrcweir 			//CHINA001 SvxNumberFormatTabPage& rNumPage  = (SvxNumberFormatTabPage&)rTabPage;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 			//CHINA001 rNumPage.SetOkHdl( LINK( this, ScAttrDlg, OkHandler ) );
122cdf0e10cSrcweir 			aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
123cdf0e10cSrcweir 			rTabPage.PageCreated(aSet);
124cdf0e10cSrcweir 		}
125cdf0e10cSrcweir 		break;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 		case TP_FONT:
128cdf0e10cSrcweir 		{
129cdf0e10cSrcweir 			const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 			DBG_ASSERT( pInfoItem, "FontListItem  not found :-(" );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 			//CHINA001 ((SvxCharNamePage&)rTabPage).
134cdf0e10cSrcweir 				//CHINA001 SetFontList( *((const SvxFontListItem*)pInfoItem) );
135cdf0e10cSrcweir 			aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
136cdf0e10cSrcweir 			rTabPage.PageCreated(aSet);
137cdf0e10cSrcweir 		}
138cdf0e10cSrcweir 		break;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		default:
141cdf0e10cSrcweir 		break;
142cdf0e10cSrcweir 	}
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir // -----------------------------------------------------------------------
146cdf0e10cSrcweir 
IMPL_LINK(ScAttrDlg,OkHandler,void *,EMPTYARG)147cdf0e10cSrcweir IMPL_LINK( ScAttrDlg, OkHandler, void*, EMPTYARG )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir 	((Link&)GetOKButton().GetClickHdl()).Call( NULL );
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	return 0;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155