bump product version to 4.1.6.2
[LibreOffice.git] / sc / source / ui / attrdlg / attrdlg.cxx
blobfcd0da3eaf62b0f63c2db9541d15edfebbde520a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <svx/svxdlg.hxx>
35 #include <svx/dialogs.hrc>
36 #include <svx/flagsdef.hxx>
37 #include <editeng/flstitem.hxx>
38 #include <sfx2/app.hxx>
40 //==================================================================
42 ScAttrDlg::ScAttrDlg(SfxViewFrame* pFrameP, Window* pParent, const SfxItemSet* pCellAttrs)
43 : SfxTabDialog(pFrameP, pParent, "FormatCellsDialog", "modules/scalc/ui/formatcellsdialog.ui", pCellAttrs)
45 SvtCJKOptions aCJKOptions;
46 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
47 OSL_ENSURE(pFact, "Dialogdiet fail!");
49 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
50 m_nNumberPageId = AddTabPage( "numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 );
51 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
52 m_nFontPageId = AddTabPage( "font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
53 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
54 AddTabPage( "fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
55 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
56 AddTabPage( "alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 );
58 if ( aCJKOptions.IsAsianTypographyEnabled() )
60 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
61 AddTabPage( "asiantypography", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 );
63 else
64 RemoveTabPage( "asiantypography" );
65 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
66 AddTabPage( "borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
67 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
68 AddTabPage( "background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
69 AddTabPage( "cellprotection" , ScTabPageProtection::Create, 0 );
72 // -----------------------------------------------------------------------
74 ScAttrDlg::~ScAttrDlg()
78 // -----------------------------------------------------------------------
80 void ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
82 SfxObjectShell* pDocSh = SfxObjectShell::Current();
83 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
84 if (nPageId == m_nNumberPageId)
86 aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler )));
87 rTabPage.PageCreated(aSet);
89 else if (nPageId == m_nFontPageId)
91 const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
93 OSL_ENSURE( pInfoItem, "FontListItem not found :-(" );
95 aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
96 rTabPage.PageCreated(aSet);
100 // -----------------------------------------------------------------------
102 IMPL_LINK_NOARG(ScAttrDlg, OkHandler)
104 ((Link&)GetOKButton().GetClickHdl()).Call( NULL );
106 return 0;
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */