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 <svx/svxdlg.hxx>
35 : #include <svx/dialogs.hrc>
36 : #include <svx/flagsdef.hxx>
37 : #include <editeng/flstitem.hxx>
38 : #include <sfx2/app.hxx>
39 :
40 : //==================================================================
41 :
42 0 : ScAttrDlg::ScAttrDlg(SfxViewFrame* pFrameP, Window* pParent, const SfxItemSet* pCellAttrs)
43 0 : : SfxTabDialog(pFrameP, pParent, "FormatCellsDialog", "modules/scalc/ui/formatcellsdialog.ui", pCellAttrs)
44 : {
45 0 : SvtCJKOptions aCJKOptions;
46 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
47 : OSL_ENSURE(pFact, "Dialogdiet fail!");
48 :
49 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
50 0 : m_nNumberPageId = AddTabPage( "numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 );
51 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
52 0 : m_nFontPageId = AddTabPage( "font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
53 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
54 0 : AddTabPage( "fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
55 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
56 0 : AddTabPage( "alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 );
57 :
58 0 : if ( aCJKOptions.IsAsianTypographyEnabled() )
59 : {
60 : OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
61 0 : AddTabPage( "asiantypography", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 );
62 : }
63 : else
64 0 : RemoveTabPage( "asiantypography" );
65 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
66 0 : AddTabPage( "borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
67 : OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
68 0 : AddTabPage( "background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
69 0 : AddTabPage( "cellprotection" , ScTabPageProtection::Create, 0 );
70 0 : }
71 :
72 : // -----------------------------------------------------------------------
73 :
74 0 : ScAttrDlg::~ScAttrDlg()
75 : {
76 0 : }
77 :
78 : // -----------------------------------------------------------------------
79 :
80 0 : void ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
81 : {
82 0 : SfxObjectShell* pDocSh = SfxObjectShell::Current();
83 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
84 0 : if (nPageId == m_nNumberPageId)
85 : {
86 0 : aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
87 0 : rTabPage.PageCreated(aSet);
88 : }
89 0 : else if (nPageId == m_nFontPageId)
90 : {
91 0 : const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
92 :
93 : OSL_ENSURE( pInfoItem, "FontListItem not found :-(" );
94 :
95 0 : aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
96 0 : rTabPage.PageCreated(aSet);
97 0 : }
98 0 : }
99 :
100 : // -----------------------------------------------------------------------
101 :
102 0 : IMPL_LINK_NOARG(ScAttrDlg, OkHandler)
103 : {
104 0 : ((Link&)GetOKButton().GetClickHdl()).Call( NULL );
105 :
106 0 : return 0;
107 0 : }
108 :
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|