1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: styledlg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include "scitems.hxx"
41 //CHINA001 #include <svx/align.hxx>
42 //CHINA001 #include <svx/backgrnd.hxx>
43 //CHINA001 #include <svx/border.hxx>
44 //CHINA001 #include <svx/chardlg.hxx>
45 //CHINA001 #include <svx/numfmt.hxx>
46 #include <svx/numinf.hxx> //CHINA001
47 //CHINA001 #include <svx/page.hxx>
48 //CHINA001 #include <svx/paragrph.hxx>
49 #include <sfx2/objsh.hxx>
50 #include <svtools/style.hxx>
51 #include <svtools/cjkoptions.hxx>
53 #include "styledlg.hxx"
54 #include "tabpages.hxx" // Zellvorlagen
55 #include "tphf.hxx" // Seitenvorlage: Kopf-/Fusszeilen
56 #include "tptable.hxx" // Seitenvorlage: Tabelle
57 #include "scresid.hxx"
59 #include "styledlg.hrc"
60 #include <svx/svxdlg.hxx> //CHINA001
61 #include <svx/svxids.hrc> //CHINA001
62 #include <svx/dialogs.hrc> //CHINA001
63 #include <svtools/intitem.hxx> //CHINA001
64 #include <svx/flstitem.hxx> //CHINA001
65 #include <svtools/aeitem.hxx> //CHINA001
66 #include <svx/flagsdef.hxx> //CHINA001
67 //==================================================================
69 ScStyleDlg::ScStyleDlg( Window
* pParent
,
70 SfxStyleSheetBase
& rStyleBase
,
73 : SfxStyleDialog ( pParent
,
79 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create(); //CHINA001
80 DBG_ASSERT(pFact
, "Dialogdiet fail!");//CHINA001
83 case RID_SCDLG_STYLES_PAR
: // Zellformatvorlagen
85 SvtCJKOptions aCJKOptions
;
86 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), "GetTabPageCreatorFunc fail!");//CHINA001
87 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT
), "GetTabPageRangesFunc fail!");//CHINA001
88 AddTabPage( TP_NUMBER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT
) ); //CHINA001 AddTabPage( TP_NUMBER, &SvxNumberFormatTabPage::Create, &SvxNumberFormatTabPage::GetRanges );
89 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), "GetTabPageCreatorFunc fail!");//CHINA001
90 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME
), "GetTabPageRangesFunc fail!");//CHINA001
91 AddTabPage( TP_FONT
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME
) ); //CHINA001 AddTabPage( TP_FONT, &SvxCharNamePage::Create, &SvxCharNamePage::GetRanges );
92 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), "GetTabPageCreatorFunc fail!");//CHINA001
93 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS
), "GetTabPageRangesFunc fail!");//CHINA001
94 AddTabPage( TP_FONTEFF
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS
) ); //CHINA001 AddTabPage( TP_FONTEFF, &SvxCharEffectsPage::Create, &SvxCharEffectsPage::GetRanges );
95 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), "GetTabPageCreatorFunc fail!");//CHINA001
96 DBG_ASSERT( pFact
->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT
), "GetTabPageRangesFunc fail!");//CHINA001
97 AddTabPage( TP_ALIGNMENT
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT
) ); //CHINA001 AddTabPage( TP_ALIGNMENT, &SvxAlignmentTabPage::Create, &SvxAlignmentTabPage::GetRanges );
98 if ( aCJKOptions
.IsAsianTypographyEnabled() )
100 //CHINA001 AddTabPage( TP_ASIAN, &SvxAsianTabPage::Create, &SvxAsianTabPage::GetRanges );
102 DBG_ASSERT(pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), "GetTabPageCreatorFunc fail!");//CHINA001
103 DBG_ASSERT(pFact
->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN
), "GetTabPageRangesFunc fail!");//CHINA001
104 AddTabPage( TP_ASIAN
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), pFact
->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN
) );
107 RemoveTabPage( TP_ASIAN
);
108 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), "GetTabPageCreatorFunc fail!");//CHINA001
109 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BORDER
), "GetTabPageRangesFunc fail!");//CHINA001
110 AddTabPage( TP_BORDER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BORDER
) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create, &SvxBorderTabPage::GetRanges );
111 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageCreatorFunc fail!");//CHINA001
112 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageRangesFunc fail!");//CHINA001
113 AddTabPage( TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND
) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create, &SvxBackgroundTabPage::GetRanges );
114 AddTabPage( TP_PROTECTION
, &ScTabPageProtection::Create
, &ScTabPageProtection::GetRanges
);
118 case RID_SCDLG_STYLES_PAGE
: // Seitenvorlagen
120 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE
), "GetTabPageCreatorFunc fail!");//CHINA001
121 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_PAGE
), "GetTabPageRangesFunc fail!");//CHINA001
122 AddTabPage( TP_PAGE_STD
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_PAGE
) ); //CHINA001 AddTabPage( TP_PAGE_STD, &SvxPageDescPage::Create, &SvxPageDescPage::GetRanges );
123 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), "GetTabPageCreatorFunc fail!");//CHINA001
124 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BORDER
), "GetTabPageRangesFunc fail!");//CHINA001
125 AddTabPage( TP_BORDER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BORDER
) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create, &SvxBorderTabPage::GetRanges );
126 DBG_ASSERT(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageCreatorFunc fail!");//CHINA001
127 DBG_ASSERT(pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageRangesFunc fail!");//CHINA001
128 AddTabPage( TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), pFact
->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND
) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create, &SvxBackgroundTabPage::GetRanges );
129 AddTabPage( TP_PAGE_HEADER
, &ScHeaderPage::Create
, &ScHeaderPage::GetRanges
);
130 AddTabPage( TP_PAGE_FOOTER
, &ScFooterPage::Create
, &ScFooterPage::GetRanges
);
131 AddTabPage( TP_TABLE
, &ScTablePage::Create
, &ScTablePage::GetRanges
);
136 DBG_ERROR( "Family not supported" );
139 //--------------------------------------------------------------------
143 // -----------------------------------------------------------------------
145 __EXPORT
ScStyleDlg::~ScStyleDlg()
149 // -----------------------------------------------------------------------
151 void __EXPORT
ScStyleDlg::PageCreated( USHORT nPageId
, SfxTabPage
& rTabPage
)
153 if ( nDlgRsc
== RID_SCDLG_STYLES_PAR
)
155 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
156 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool())); //CHINA001
161 const SfxPoolItem
* pInfoItem
162 = pDocSh
->GetItem( SID_ATTR_NUMBERFORMAT_INFO
);
164 DBG_ASSERT( pInfoItem
, "NumberInfoItem nicht gefunden!" );
166 //CHINA001 ((SvxNumberFormatTabPage&)rTabPage).
167 //CHINA001 SetNumberFormatList(
168 //CHINA001 (const SvxNumberInfoItem&)*pInfoItem ) ;
169 aSet
.Put (SvxNumberInfoItem( (const SvxNumberInfoItem
&)*pInfoItem
) );
170 rTabPage
.PageCreated(aSet
);
176 const SfxPoolItem
* pInfoItem
177 = pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
179 DBG_ASSERT( pInfoItem
, "FontListItem nicht gefunden!" );
181 //CHINA001 ((SvxCharNamePage&)rTabPage).
182 //CHINA001 SetFontList(
183 //CHINA001 (const SvxFontListItem&)*pInfoItem );
184 aSet
.Put (SvxFontListItem(((const SvxFontListItem
&)*pInfoItem
).GetFontList(), SID_ATTR_CHAR_FONTLIST
));
185 rTabPage
.PageCreated(aSet
);
193 else if ( nDlgRsc
== RID_SCDLG_STYLES_PAGE
)
195 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));//CHINA001
199 //CHINA001 ((SvxPageDescPage&)rTabPage).SetMode( SVX_PAGE_MODE_CENTER );
200 aSet
.Put (SfxAllEnumItem((const USHORT
)SID_ENUM_PAGE_MODE
, SVX_PAGE_MODE_CENTER
)); //CHINA001
201 rTabPage
.PageCreated(aSet
); //CHINA001
206 ((ScHFPage
&)rTabPage
).SetStyleDlg( this );
207 ((ScHFPage
&)rTabPage
).SetPageStyle( GetStyleSheet().GetName() );
208 ((ScHFPage
&)rTabPage
).DisableDeleteQueryBox();
211 if( nDlgRsc
== RID_SCDLG_STYLES_PAGE
)
212 //CHINA001 ((SvxBackgroundTabPage&)rTabPage).ShowSelector();
214 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, SVX_SHOW_SELECTOR
));
215 rTabPage
.PageCreated(aSet
);
226 // -----------------------------------------------------------------------
228 const SfxItemSet
* __EXPORT
ScStyleDlg::GetRefreshedSet()
230 SfxItemSet
* pItemSet
= GetInputSetImpl();
231 pItemSet
->ClearItem();
232 pItemSet
->SetParent( GetStyleSheet().GetItemSet().GetParent() );