LibreOffice Module sc (master) 1
attrdlg.cxx
Go to the documentation of this file.
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 <sfx2/objsh.hxx>
23#include <sfx2/tabdlg.hxx>
24#include <sfx2/sfxdlg.hxx>
25#include <svl/cjkoptions.hxx>
26
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>
33#include <comphelper/lok.hxx>
34
35ScAttrDlg::ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
36 : SfxTabDialogController(pParent, "modules/scalc/ui/formatcellsdialog.ui",
37 "FormatCellsDialog", pCellAttrs)
38{
40
41 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
42 AddTabPage( "numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), nullptr );
43 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
44 AddTabPage( "font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), nullptr );
45 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
46 AddTabPage( "fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), nullptr );
47 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
48 AddTabPage( "alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), nullptr );
49
51 {
52 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
53 AddTabPage( "asiantypography", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), nullptr );
54 }
55 else
56 RemoveTabPage( "asiantypography" );
57 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
58 AddTabPage( "borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr );
59 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), "GetTabPageCreatorFunc fail!");
60 AddTabPage( "background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), nullptr );
61
63 AddTabPage( "cellprotection" , ScTabPageProtection::Create, nullptr );
64 else
65 RemoveTabPage( "cellprotection" );
66}
67
69{
70}
71
72void ScAttrDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
73{
75 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
76 if (rPageId == "numbers")
77 {
78 rTabPage.PageCreated(aSet);
79 }
80 else if (rPageId == "font" && pDocSh)
81 {
82 const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
83 assert(pInfoItem && "FontListItem not found :-(");
84 aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem*>(pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST ));
85 rTabPage.PageCreated(aSet);
86 }
87 else if (rPageId == "background")
88 {
89 rTabPage.PageCreated(aSet);
90 }
91}
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void PageCreated(const OString &rPageId, SfxTabPage &rTabPage) override
Definition: attrdlg.cxx:72
ScAttrDlg(weld::Window *pParent, const SfxItemSet *pCellAttrs)
Definition: attrdlg.cxx:35
virtual ~ScAttrDlg() override
Definition: attrdlg.cxx:68
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tabpages.cxx:56
static SfxAbstractDialogFactory * Create()
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OString &rName)
SfxItemSet * GetInputSetImpl()
virtual void PageCreated(const SfxAllItemSet &aSet)
bool IsAsianTypographyEnabled()