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/drawitem.hxx>
23#include <svx/ofaitem.hxx>
24#include <svx/svdview.hxx>
25#include <svx/numinf.hxx>
26#include <sfx2/objsh.hxx>
27#include <sfx2/sfxdlg.hxx>
28#include <svl/style.hxx>
29#include <svl/cjkoptions.hxx>
30#include <osl/diagnose.h>
31
32#include <styledlg.hxx>
33#include <tabpages.hxx>
34#include <tphf.hxx>
35#include <tptable.hxx>
36#include <svx/svxids.hrc>
37#include <svx/dialogs.hrc>
38#include <svl/intitem.hxx>
39#include <editeng/flstitem.hxx>
40#include <svx/flagsdef.hxx>
41
43 SfxStyleSheetBase& rStyleBase,
44 bool bPage)
46 bPage ?
47 OUString("modules/scalc/ui/pagetemplatedialog.ui") :
48 OUString("modules/scalc/ui/paratemplatedialog.ui"),
49 bPage ?
50 OUString("PageTemplateDialog") :
51 OUString("ParaTemplateDialog"),
52 rStyleBase )
53 , m_bPage(bPage)
54{
56 if (m_bPage) // page styles
57 {
58 AddTabPage("page", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
59 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
60 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ) );
64 }
65 else // cell format styles
66 {
67 AddTabPage("numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ));
68 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
69 AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
70 AddTabPage("alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ));
72 {
73 AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN));
74 }
75 else
76 RemoveTabPage("asiantypo");
77 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
78 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
80 }
81}
82
83void ScStyleDlg::PageCreated(const OUString& rPageId, SfxTabPage& rTabPage)
84{
85 if (m_bPage)
86 {
87 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
88 if (rPageId == "page")
89 {
90 aSet.Put (SfxUInt16Item(SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER));
91 rTabPage.PageCreated(aSet);
92 }
93 else if (rPageId == "header" || rPageId == "footer")
94 {
95 static_cast<ScHFPage&>(rTabPage).SetStyleDlg( this );
96 static_cast<ScHFPage&>(rTabPage).SetPageStyle( GetStyleSheet().GetName() );
97 static_cast<ScHFPage&>(rTabPage).DisableDeleteQueryBox();
98 }
99 else if (rPageId == "background")
100 {
101 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_SELECTOR)));
102 rTabPage.PageCreated(aSet);
103 }
104 }
105 else if (SfxObjectShell* pDocSh = SfxObjectShell::Current())
106 {
107 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
108 if (rPageId == "numbers")
109 {
110 const SfxPoolItem* pInfoItem
111 = pDocSh->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
112
113 OSL_ENSURE( pInfoItem, "NumberInfoItem not found!" );
114
115 aSet.Put ( static_cast<const SvxNumberInfoItem&>(*pInfoItem) );
116 rTabPage.PageCreated(aSet);
117 }
118 else if (rPageId == "font")
119 {
120 const SfxPoolItem* pInfoItem
121 = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
122
123 OSL_ENSURE( pInfoItem, "FontListItem not found!" );
124
125 aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST));
126 rTabPage.PageCreated(aSet);
127 }
128 else if (rPageId == "background")
129 {
130 rTabPage.PageCreated(aSet);
131 }
132 }
133}
134
136{
137 SfxItemSet* pItemSet = GetInputSetImpl();
138 pItemSet->ClearItem();
139 pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
140}
141
143 : SfxStyleDialogController(pParent, "modules/scalc/ui/drawtemplatedialog.ui", "DrawTemplateDialog", rStyleBase)
144 , mpView(pView)
145{
146 AddTabPage("line", RID_SVXPAGE_LINE);
147 AddTabPage("area", RID_SVXPAGE_AREA);
148 AddTabPage("shadowing", RID_SVXPAGE_SHADOW);
149 AddTabPage("transparency", RID_SVXPAGE_TRANSPARENCE);
150 AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
151 AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS);
152 AddTabPage("background", RID_SVXPAGE_BKG);
153 AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH);
154 AddTabPage("text", RID_SVXPAGE_TEXTATTR);
155 AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION);
156 AddTabPage("dimensioning", RID_SVXPAGE_MEASURE);
157 AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH);
158 AddTabPage("tabs", RID_SVXPAGE_TABULATOR);
160 AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN);
161 else
162 RemoveTabPage("asiantypo");
163}
164
165void ScDrawStyleDlg::PageCreated(const OUString& rPageId, SfxTabPage& rTabPage)
166{
167 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
168 SdrModel& rModel = mpView->GetModel();
169
170 if (rPageId == "line")
171 {
172 aSet.Put(SvxColorListItem(rModel.GetColorList(), SID_COLOR_TABLE));
173 aSet.Put(SvxDashListItem(rModel.GetDashList(), SID_DASH_LIST));
174 aSet.Put(SvxLineEndListItem(rModel.GetLineEndList(), SID_LINEEND_LIST));
175 aSet.Put(SfxUInt16Item(SID_DLG_TYPE, 1));
176 rTabPage.PageCreated(aSet);
177 }
178 else if (rPageId == "area")
179 {
180 aSet.Put(SvxColorListItem(rModel.GetColorList(), SID_COLOR_TABLE));
181 aSet.Put(SvxGradientListItem(rModel.GetGradientList(), SID_GRADIENT_LIST));
182 aSet.Put(SvxHatchListItem(rModel.GetHatchList(), SID_HATCH_LIST));
183 aSet.Put(SvxBitmapListItem(rModel.GetBitmapList(), SID_BITMAP_LIST));
184 aSet.Put(SvxPatternListItem(rModel.GetPatternList(), SID_PATTERN_LIST));
185 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE, 0));
186 aSet.Put(SfxUInt16Item(SID_DLG_TYPE, 1));
187 aSet.Put(SfxUInt16Item(SID_TABPAGE_POS, 0));
188 rTabPage.PageCreated(aSet);
189 }
190 else if (rPageId == "shadowing")
191 {
192 aSet.Put(SvxColorListItem(rModel.GetColorList(), SID_COLOR_TABLE));
193 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE, 0));
194 aSet.Put(SfxUInt16Item(SID_DLG_TYPE, 1));
195 rTabPage.PageCreated(aSet);
196 }
197 else if (rPageId == "transparency")
198 {
199 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE, 0));
200 aSet.Put (SfxUInt16Item(SID_DLG_TYPE, 1));
201 rTabPage.PageCreated(aSet);
202 }
203 else if (rPageId == "font")
204 {
206 {
207 SvxFontListItem aItem(*static_cast<const SvxFontListItem*>(
208 pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST)));
209
210 aSet.Put(SvxFontListItem(aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
211 }
212 rTabPage.PageCreated(aSet);
213 }
214 else if (rPageId == "fonteffect")
215 {
216 rTabPage.PageCreated(aSet);
217 }
218 else if (rPageId == "background")
219 {
220 aSet.Put(SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR)));
221 rTabPage.PageCreated(aSet);
222 }
223 else if (rPageId == "text")
224 {
225 rTabPage.PageCreated(aSet);
226 }
227 else if (rPageId == "dimensioning")
228 {
229 aSet.Put(OfaPtrItem(SID_OBJECT_LIST, mpView));
230 rTabPage.PageCreated(aSet);
231 }
232}
233
235{
236 SfxItemSet* pItemSet = GetInputSetImpl();
237 pItemSet->ClearItem();
238 pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
239}
240
241/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrView * mpView
Definition: styledlg.hxx:54
virtual void PageCreated(const OUString &rPageId, SfxTabPage &rTabPage) override
Definition: styledlg.cxx:165
ScDrawStyleDlg(weld::Window *pParent, SfxStyleSheetBase &rStyleBase, SdrView *pView)
Definition: styledlg.cxx:142
virtual void RefreshInputSet() override
Definition: styledlg.cxx:234
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:135
bool m_bPage
Definition: styledlg.hxx:39
virtual void PageCreated(const OUString &rPageId, SfxTabPage &rTabPage) override
Definition: styledlg.cxx:83
ScStyleDlg(weld::Window *pParent, SfxStyleSheetBase &rStyleBase, bool bPage)
Definition: styledlg.cxx:42
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
XBitmapListRef GetBitmapList() const
XDashListRef GetDashList() const
XGradientListRef GetGradientList() const
XPatternListRef GetPatternList() const
XLineEndListRef GetLineEndList() const
XColorListRef GetColorList() const
XHatchListRef GetHatchList() const
SdrModel & GetModel() const
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 SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
SfxStyleSheetBase & GetStyleSheet()
const OUString & GetName() const
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OUString &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()
UnoViewSharedPtr mpView