merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / attrdlg / attrdlg.cxx
blob18b31960518a11d82db86b34656a8587520a03dd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: attrdlg.cxx,v $
10 * $Revision: 1.12 $
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 #include "scitems.hxx"
40 #include <sfx2/objsh.hxx>
41 #include <sfx2/tabdlg.hxx>
42 //CHINA001 #include <svx/align.hxx>
43 //CHINA001 #include <svx/backgrnd.hxx>
44 //CHINA001 #include <svx/border.hxx>
45 //CHINA001 #include <svx/chardlg.hxx>
46 //CHINA001 #include <svx/numfmt.hxx>
47 //CHINA001 #include <svx/paragrph.hxx>
48 #include <svtools/cjkoptions.hxx>
50 #include "tabpages.hxx"
51 #include "attrdlg.hxx"
52 #include "scresid.hxx"
53 #include "attrdlg.hrc"
54 #include <svx/svxdlg.hxx> //CHINA001
55 #include <svx/dialogs.hrc> //CHINA001
56 #include <svx/flagsdef.hxx> //CHINA001
57 #include <svx/flstitem.hxx> //CHINA001
58 #include <sfx2/app.hxx> //CHINA001
60 #if !LAYOUT_SFX_TABDIALOG_BROKEN
61 #include <layout/layout-pre.hxx>
62 #endif
64 //==================================================================
66 ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP,
67 Window* pParent,
68 const SfxItemSet* pCellAttrs )
70 : SfxTabDialog( pFrameP,
71 pParent,
72 ScResId( RID_SCDLG_ATTR ),
73 pCellAttrs )
75 SvtCJKOptions aCJKOptions;
76 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
77 DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
79 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001
80 #if LAYOUT_SFX_TABDIALOG_BROKEN
81 AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 ); //CHINA001 AddTabPage( TP_NUMBER, SvxNumberFormatTabPage::Create, 0 );
82 #else
83 String number = rtl::OUString::createFromAscii ("Numbers");
84 AddTabPage( TP_NUMBER, number, pFact->GetTabPageCreatorFunc (RID_SVXPAGE_NUMBERFORMAT), 0, FALSE, TAB_APPEND);
85 #endif
86 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001
87 AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); //CHINA001 AddTabPage( TP_FONT, SvxCharNamePage::Create, 0 );
88 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001
89 AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); //CHINA001 AddTabPage( TP_FONTEFF, SvxCharEffectsPage::Create, 0 );
90 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001
91 AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 ); //CHINA001 AddTabPage( TP_ALIGNMENT, SvxAlignmentTabPage::Create, 0 );
93 if ( aCJKOptions.IsAsianTypographyEnabled() )
95 //CHINA001 AddTabPage( TP_ASIAN, SvxAsianTabPage::Create, 0 );
96 // ::CreateTabPage pCreateTabpage = pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN);
97 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001
98 AddTabPage( TP_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 );
100 else
101 RemoveTabPage( TP_ASIAN );
102 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001
103 AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); //CHINA001 AddTabPage( TP_BORDER, SvxBorderTabPage::Create, 0 );
104 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001
105 AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); //CHINA001 AddTabPage( TP_BACKGROUND, SvxBackgroundTabPage::Create, 0 );
106 AddTabPage( TP_PROTECTION, ScTabPageProtection::Create, 0 );
107 FreeResource();
110 // -----------------------------------------------------------------------
112 __EXPORT ScAttrDlg::~ScAttrDlg()
116 // -----------------------------------------------------------------------
118 void __EXPORT ScAttrDlg::PageCreated( USHORT nPageId, SfxTabPage& rTabPage )
120 SfxObjectShell* pDocSh = SfxObjectShell::Current();
121 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001
122 switch ( nPageId )
124 case TP_NUMBER:
126 //CHINA001 SvxNumberFormatTabPage& rNumPage = (SvxNumberFormatTabPage&)rTabPage;
128 //CHINA001 rNumPage.SetOkHdl( LINK( this, ScAttrDlg, OkHandler ) );
129 aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
130 rTabPage.PageCreated(aSet);
132 break;
134 case TP_FONT:
136 const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
138 DBG_ASSERT( pInfoItem, "FontListItem not found :-(" );
140 //CHINA001 ((SvxCharNamePage&)rTabPage).
141 //CHINA001 SetFontList( *((const SvxFontListItem*)pInfoItem) );
142 aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
143 rTabPage.PageCreated(aSet);
145 break;
147 default:
148 break;
152 // -----------------------------------------------------------------------
154 IMPL_LINK( ScAttrDlg, OkHandler, void*, EMPTYARG )
156 ((Link&)GetOKButton().GetClickHdl()).Call( NULL );
158 return 0;