LibreOffice Module sc (master) 1
styledlg.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 <svx/numinf.hxx>
23#include <sfx2/objsh.hxx>
24#include <sfx2/sfxdlg.hxx>
25#include <svl/style.hxx>
26#include <svl/cjkoptions.hxx>
27#include <osl/diagnose.h>
28
29#include <styledlg.hxx>
30#include <tabpages.hxx>
31#include <tphf.hxx>
32#include <tptable.hxx>
33#include <svx/svxids.hrc>
34#include <svx/dialogs.hrc>
35#include <svl/intitem.hxx>
36#include <editeng/flstitem.hxx>
37#include <svx/flagsdef.hxx>
38
40 SfxStyleSheetBase& rStyleBase,
41 bool bPage)
43 bPage ?
44 OUString("modules/scalc/ui/pagetemplatedialog.ui") :
45 OUString("modules/scalc/ui/paratemplatedialog.ui"),
46 bPage ?
47 OString("PageTemplateDialog") :
48 OString("ParaTemplateDialog"),
49 rStyleBase )
50 , m_bPage(bPage)
51{
53 if (m_bPage) // page styles
54 {
55 AddTabPage("page", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
56 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
57 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ) );
61 }
62 else // cell format styles
63 {
64 AddTabPage("numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ));
65 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
66 AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
67 AddTabPage("alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ));
69 {
70 AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN));
71 }
72 else
73 RemoveTabPage("asiantypo");
74 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
75 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
77 }
78}
79
80void ScStyleDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
81{
82 if (m_bPage)
83 {
84 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
85 if (rPageId == "page")
86 {
87 aSet.Put (SfxUInt16Item(sal_uInt16(SID_ENUM_PAGE_MODE), SVX_PAGE_MODE_CENTER));
88 rTabPage.PageCreated(aSet);
89 }
90 else if (rPageId == "header" || rPageId == "footer")
91 {
92 static_cast<ScHFPage&>(rTabPage).SetStyleDlg( this );
93 static_cast<ScHFPage&>(rTabPage).SetPageStyle( GetStyleSheet().GetName() );
94 static_cast<ScHFPage&>(rTabPage).DisableDeleteQueryBox();
95 }
96 else if (rPageId == "background")
97 {
98 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
99 rTabPage.PageCreated(aSet);
100 }
101 }
102 else
103 {
105 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
106 if (rPageId == "numbers")
107 {
108 const SfxPoolItem* pInfoItem
109 = pDocSh->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
110
111 OSL_ENSURE( pInfoItem, "NumberInfoItem not found!" );
112
113 aSet.Put ( static_cast<const SvxNumberInfoItem&>(*pInfoItem) );
114 rTabPage.PageCreated(aSet);
115 }
116 else if (rPageId == "font")
117 {
118 const SfxPoolItem* pInfoItem
119 = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
120
121 OSL_ENSURE( pInfoItem, "FontListItem not found!" );
122
123 aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST));
124 rTabPage.PageCreated(aSet);
125 }
126 else if (rPageId == "background")
127 {
128 rTabPage.PageCreated(aSet);
129 }
130 }
131}
132
134{
135 SfxItemSet* pItemSet = GetInputSetImpl();
136 pItemSet->ClearItem();
137 pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
138}
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: tphf.cxx:252
static WhichRangesContainer GetRanges()
Definition: tphf.cxx:257
static WhichRangesContainer GetRanges()
Definition: tphf.cxx:241
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: tphf.cxx:236
virtual void RefreshInputSet() override
Definition: styledlg.cxx:133
bool m_bPage
Definition: styledlg.hxx:38
ScStyleDlg(weld::Window *pParent, SfxStyleSheetBase &rStyleBase, bool bPage)
Definition: styledlg.cxx:39
virtual void PageCreated(const OString &rPageId, SfxTabPage &rTabPage) override
Definition: styledlg.cxx:80
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tabpages.cxx:56
static WhichRangesContainer GetRanges()
Definition: tabpages.hxx:33
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
Definition: tptable.cxx:133
static WhichRangesContainer GetRanges()
Definition: tptable.hxx:32
virtual GetTabPageRanges GetTabPageRangesFunc(sal_uInt16 nId)=0
static SfxAbstractDialogFactory * Create()
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
void SetParent(const SfxItemSet *pNew)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static SfxObjectShell * Current()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
SfxStyleSheetBase & GetStyleSheet()
const OUString & GetName() const
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OString &rName)
SfxItemSet * GetInputSetImpl()
virtual void PageCreated(const SfxAllItemSet &aSet)
const FontList * GetFontList() const
SVX_PAGE_MODE_CENTER
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
bool IsAsianTypographyEnabled()