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