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