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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include "scitems.hxx"
24 #include <sfx2/objsh.hxx>
25 #include <sfx2/tabdlg.hxx>
26 #include <svl/cjkoptions.hxx>
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>
37 ScAttrDlg::ScAttrDlg(SfxViewFrame
* pFrameP
, vcl::Window
* pParent
, const SfxItemSet
* pCellAttrs
)
38 : SfxTabDialog(pFrameP
, pParent
, "FormatCellsDialog", "modules/scalc/ui/formatcellsdialog.ui", pCellAttrs
)
40 SvtCJKOptions aCJKOptions
;
41 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
42 OSL_ENSURE(pFact
, "Dialog creation failed!");
44 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), "GetTabPageCreatorFunc fail!");
45 m_nNumberPageId
= AddTabPage( "numbers", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), 0 );
46 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), "GetTabPageCreatorFunc fail!");
47 m_nFontPageId
= AddTabPage( "font", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), 0 );
48 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), "GetTabPageCreatorFunc fail!");
49 AddTabPage( "fonteffects", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), 0 );
50 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), "GetTabPageCreatorFunc fail!");
51 AddTabPage( "alignment", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), 0 );
53 if ( aCJKOptions
.IsAsianTypographyEnabled() )
55 OSL_ENSURE(pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), "GetTabPageCreatorFunc fail!");
56 AddTabPage( "asiantypography", pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), 0 );
59 RemoveTabPage( "asiantypography" );
60 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), "GetTabPageCreatorFunc fail!");
61 AddTabPage( "borders", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), 0 );
62 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), "GetTabPageCreatorFunc fail!");
63 AddTabPage( "background", pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0 );
64 AddTabPage( "cellprotection" , ScTabPageProtection::Create
, 0 );
67 ScAttrDlg::~ScAttrDlg()
71 void ScAttrDlg::PageCreated( sal_uInt16 nPageId
, SfxTabPage
& rTabPage
)
73 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
74 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
75 if (nPageId
== m_nNumberPageId
)
77 aSet
.Put (SfxLinkItem( SID_LINK_TYPE
, LINK( this, ScAttrDlg
, OkHandler
)));
78 rTabPage
.PageCreated(aSet
);
80 else if (nPageId
== m_nFontPageId
)
82 const SfxPoolItem
* pInfoItem
= pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
84 OSL_ENSURE( pInfoItem
, "FontListItem not found :-(" );
86 aSet
.Put (SvxFontListItem(static_cast<const SvxFontListItem
*>(pInfoItem
)->GetFontList(), SID_ATTR_CHAR_FONTLIST
));
87 rTabPage
.PageCreated(aSet
);
91 IMPL_LINK_NOARG(ScAttrDlg
, OkHandler
)
93 ((Link
<>&)GetOKButton().GetClickHdl()).Call( NULL
);
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */