1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #undef SC_DLLIMPLEMENTATION
25 #include "scitems.hxx"
27 #include <sfx2/objsh.hxx>
28 #include <sfx2/tabdlg.hxx>
29 #include <svl/cjkoptions.hxx>
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>
41 //==================================================================
43 ScAttrDlg::ScAttrDlg( SfxViewFrame
* pFrameP
,
45 const SfxItemSet
* pCellAttrs
)
47 : SfxTabDialog( pFrameP
,
49 ScResId( RID_SCDLG_ATTR
),
52 SvtCJKOptions aCJKOptions
;
53 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
54 OSL_ENSURE(pFact
, "Dialogdiet fail!");
56 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), "GetTabPageCreatorFunc fail!");
57 AddTabPage( TP_NUMBER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), 0 );
58 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), "GetTabPageCreatorFunc fail!");
59 AddTabPage( TP_FONT
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), 0 );
60 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), "GetTabPageCreatorFunc fail!");
61 AddTabPage( TP_FONTEFF
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), 0 );
62 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), "GetTabPageCreatorFunc fail!");
63 AddTabPage( TP_ALIGNMENT
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), 0 );
65 if ( aCJKOptions
.IsAsianTypographyEnabled() )
67 OSL_ENSURE(pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), "GetTabPageCreatorFunc fail!");
68 AddTabPage( TP_ASIAN
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), 0 );
71 RemoveTabPage( TP_ASIAN
);
72 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), "GetTabPageCreatorFunc fail!");
73 AddTabPage( TP_BORDER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), 0 );
74 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageCreatorFunc fail!");
75 AddTabPage( TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0 );
76 AddTabPage( TP_PROTECTION
, ScTabPageProtection::Create
, 0 );
80 // -----------------------------------------------------------------------
82 ScAttrDlg::~ScAttrDlg()
86 // -----------------------------------------------------------------------
88 void ScAttrDlg::PageCreated( sal_uInt16 nPageId
, SfxTabPage
& rTabPage
)
90 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
91 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
96 aSet
.Put (SfxLinkItem( SID_LINK_TYPE
, LINK( this, ScAttrDlg
, OkHandler
)));
97 rTabPage
.PageCreated(aSet
);
103 const SfxPoolItem
* pInfoItem
= pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
105 OSL_ENSURE( pInfoItem
, "FontListItem not found :-(" );
107 aSet
.Put (SvxFontListItem(((const SvxFontListItem
*)pInfoItem
)->GetFontList(), SID_ATTR_CHAR_FONTLIST
));
108 rTabPage
.PageCreated(aSet
);
117 // -----------------------------------------------------------------------
119 IMPL_LINK_NOARG(ScAttrDlg
, OkHandler
)
121 ((Link
&)GetOKButton().GetClickHdl()).Call( NULL
);
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */