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