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 <sfx2/objsh.hxx>
23 #include <sfx2/tabdlg.hxx>
24 #include <sfx2/sfxdlg.hxx>
25 #include <svl/cjkoptions.hxx>
27 #include <tabpages.hxx>
28 #include <attrdlg.hxx>
29 #include <svx/dialogs.hrc>
30 #include <editeng/editids.hrc>
31 #include <editeng/flstitem.hxx>
32 #include <osl/diagnose.h>
34 ScAttrDlg::ScAttrDlg(weld::Window
* pParent
, const SfxItemSet
* pCellAttrs
)
35 : SfxTabDialogController(pParent
, u
"modules/scalc/ui/formatcellsdialog.ui"_ustr
,
36 u
"FormatCellsDialog"_ustr
, pCellAttrs
)
38 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
40 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), "GetTabPageCreatorFunc fail!");
41 AddTabPage( u
"numbers"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT
), nullptr );
42 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), "GetTabPageCreatorFunc fail!");
43 AddTabPage( u
"font"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME
), nullptr );
44 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), "GetTabPageCreatorFunc fail!");
45 AddTabPage( u
"fonteffects"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS
), nullptr );
46 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), "GetTabPageCreatorFunc fail!");
47 AddTabPage( u
"alignment"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT
), nullptr );
49 if (SvtCJKOptions::IsAsianTypographyEnabled())
51 OSL_ENSURE(pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), "GetTabPageCreatorFunc fail!");
52 AddTabPage( u
"asiantypography"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN
), nullptr );
55 RemoveTabPage( u
"asiantypography"_ustr
);
56 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), "GetTabPageCreatorFunc fail!");
57 AddTabPage( u
"borders"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), nullptr );
58 OSL_ENSURE(pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BKG
), "GetTabPageCreatorFunc fail!");
59 AddTabPage( u
"background"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BKG
), nullptr );
60 AddTabPage( u
"cellprotection"_ustr
, ScTabPageProtection::Create
, nullptr );
63 ScAttrDlg::~ScAttrDlg()
67 void ScAttrDlg::PageCreated(const OUString
& rPageId
, SfxTabPage
& rTabPage
)
69 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
70 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
71 if (rPageId
== "numbers")
73 rTabPage
.PageCreated(aSet
);
75 else if (rPageId
== "font" && pDocSh
)
77 const SfxPoolItem
* pInfoItem
= pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
78 SAL_WARN_IF(!pInfoItem
, "sc.ui", "we should have a FontListItem normally here");
81 aSet
.Put (SvxFontListItem(static_cast<const SvxFontListItem
*>(pInfoItem
)->GetFontList(), SID_ATTR_CHAR_FONTLIST
));
82 rTabPage
.PageCreated(aSet
);
85 else if (rPageId
== "background")
87 rTabPage
.PageCreated(aSet
);
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */