Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #undef SC_DLLIMPLEMENTATION
31 : :
32 : :
33 : :
34 : : #include "scitems.hxx"
35 : :
36 : : #include <sfx2/objsh.hxx>
37 : : #include <sfx2/tabdlg.hxx>
38 : : #include <svl/cjkoptions.hxx>
39 : :
40 : : #include "tabpages.hxx"
41 : : #include "attrdlg.hxx"
42 : : #include "scresid.hxx"
43 : : #include "attrdlg.hrc"
44 : : #include <svx/svxdlg.hxx>
45 : : #include <svx/dialogs.hrc>
46 : : #include <svx/flagsdef.hxx>
47 : : #include <editeng/flstitem.hxx>
48 : : #include <sfx2/app.hxx>
49 : :
50 : : //==================================================================
51 : :
52 : 0 : ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP,
53 : : Window* pParent,
54 : : const SfxItemSet* pCellAttrs )
55 : :
56 : : : SfxTabDialog( pFrameP,
57 : : pParent,
58 : : ScResId( RID_SCDLG_ATTR ),
59 : 0 : pCellAttrs )
60 : : {
61 : 0 : SvtCJKOptions aCJKOptions;
62 : 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
63 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
64 : :
65 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
66 : 0 : AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 );
67 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
68 : 0 : AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
69 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
70 : 0 : AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
71 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
72 : 0 : AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 );
73 : :
74 : 0 : if ( aCJKOptions.IsAsianTypographyEnabled() )
75 : : {
76 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
77 : 0 : AddTabPage( TP_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 );
78 : : }
79 : : else
80 : 0 : RemoveTabPage( TP_ASIAN );
81 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
82 : 0 : AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
83 : : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
84 : 0 : AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
85 : 0 : AddTabPage( TP_PROTECTION, ScTabPageProtection::Create, 0 );
86 : 0 : FreeResource();
87 : 0 : }
88 : :
89 : : // -----------------------------------------------------------------------
90 : :
91 : 0 : ScAttrDlg::~ScAttrDlg()
92 : : {
93 : 0 : }
94 : :
95 : : // -----------------------------------------------------------------------
96 : :
97 : 0 : void ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
98 : : {
99 : 0 : SfxObjectShell* pDocSh = SfxObjectShell::Current();
100 : 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
101 : 0 : switch ( nPageId )
102 : : {
103 : : case TP_NUMBER:
104 : : {
105 : 0 : aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
106 : 0 : rTabPage.PageCreated(aSet);
107 : : }
108 : 0 : break;
109 : :
110 : : case TP_FONT:
111 : : {
112 : 0 : const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
113 : :
114 : : OSL_ENSURE( pInfoItem, "FontListItem not found :-(" );
115 : :
116 : 0 : aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
117 : 0 : rTabPage.PageCreated(aSet);
118 : : }
119 : 0 : break;
120 : :
121 : : default:
122 : 0 : break;
123 : 0 : }
124 : 0 : }
125 : :
126 : : // -----------------------------------------------------------------------
127 : :
128 : 0 : IMPL_LINK_NOARG(ScAttrDlg, OkHandler)
129 : : {
130 : 0 : ((Link&)GetOKButton().GetClickHdl()).Call( NULL );
131 : :
132 : 0 : return 0;
133 : : }
134 : :
135 : :
136 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|