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