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