Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #undef SC_DLLIMPLEMENTATION
22 :
23 :
24 :
25 : #include "scitems.hxx"
26 :
27 : #include <sfx2/objsh.hxx>
28 : #include <sfx2/tabdlg.hxx>
29 : #include <svl/cjkoptions.hxx>
30 :
31 : #include "tabpages.hxx"
32 : #include "attrdlg.hxx"
33 : #include "scresid.hxx"
34 : #include "attrdlg.hrc"
35 : #include <svx/svxdlg.hxx>
36 : #include <svx/dialogs.hrc>
37 : #include <svx/flagsdef.hxx>
38 : #include <editeng/flstitem.hxx>
39 : #include <sfx2/app.hxx>
40 :
41 : //==================================================================
42 :
43 0 : ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP,
44 : Window* pParent,
45 : const SfxItemSet* pCellAttrs )
46 :
47 : : SfxTabDialog( pFrameP,
48 : pParent,
49 : ScResId( RID_SCDLG_ATTR ),
50 0 : pCellAttrs )
51 : {
52 0 : SvtCJKOptions aCJKOptions;
53 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
54 : OSL_ENSURE(pFact, "Dialogdiet fail!");
55 :
56 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
57 0 : AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 );
58 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
59 0 : AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
60 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
61 0 : AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
62 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
63 0 : AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 );
64 :
65 0 : if ( aCJKOptions.IsAsianTypographyEnabled() )
66 : {
67 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
68 0 : AddTabPage( TP_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 );
69 : }
70 : else
71 0 : RemoveTabPage( TP_ASIAN );
72 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
73 0 : AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
74 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
75 0 : AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
76 0 : AddTabPage( TP_PROTECTION, ScTabPageProtection::Create, 0 );
77 0 : FreeResource();
78 0 : }
79 :
80 : // -----------------------------------------------------------------------
81 :
82 0 : ScAttrDlg::~ScAttrDlg()
83 : {
84 0 : }
85 :
86 : // -----------------------------------------------------------------------
87 :
88 0 : void ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
89 : {
90 0 : SfxObjectShell* pDocSh = SfxObjectShell::Current();
91 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
92 0 : switch ( nPageId )
93 : {
94 : case TP_NUMBER:
95 : {
96 0 : aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
97 0 : rTabPage.PageCreated(aSet);
98 : }
99 0 : break;
100 :
101 : case TP_FONT:
102 : {
103 0 : const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
104 :
105 : OSL_ENSURE( pInfoItem, "FontListItem not found :-(" );
106 :
107 0 : aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
108 0 : rTabPage.PageCreated(aSet);
109 : }
110 0 : break;
111 :
112 : default:
113 0 : break;
114 0 : }
115 0 : }
116 :
117 : // -----------------------------------------------------------------------
118 :
119 0 : IMPL_LINK_NOARG(ScAttrDlg, OkHandler)
120 : {
121 0 : ((Link&)GetOKButton().GetClickHdl()).Call( NULL );
122 :
123 0 : return 0;
124 0 : }
125 :
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|