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