LibreOffice Module sc (master) 1
condformatdlgentry.hxx
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
10#pragma once
11
12#include <conditio.hxx>
13#include <formula/funcutl.hxx>
14#include <vcl/weld.hxx>
15#include <svl/lstner.hxx>
16#include <svx/fntctrl.hxx>
17
19class ScCondFormatDlg;
21class ColorListBox;
23class ScDataBarFormat;
24class ScIconSetFormat;
26
28
30{
37 DATE
38};
39
40}
41
43{
44protected:
46 std::unique_ptr<weld::Builder> mxBuilder;
47
48private:
49 //general ui elements
50 std::unique_ptr<weld::Widget> mxBorder;
51 std::unique_ptr<weld::Container> mxGrid;
52 std::unique_ptr<weld::Label> mxFtCondNr;
53 std::unique_ptr<weld::Label> mxFtCondition;
54
56 OUString const maStrCondition;
58
59 DECL_LINK( EntrySelectHdl, const MouseEvent&, bool );
60
61protected:
62 std::unique_ptr<weld::ComboBox> mxLbType;
63
66
67 virtual void Select();
68 virtual void Deselect();
69
70 virtual OUString GetExpressionString() = 0;
71
72public:
73 ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos);
74 virtual ~ScCondFrmtEntry();
75
76 void Show() { mxGrid->show(); }
77
78 void set_grid_top_attach(int nAttach) { mxBorder->set_grid_top_attach(nAttach); }
79 int get_preferred_height() const { return mxBorder->get_preferred_size().Height(); }
80
81 void SetPos(const ScAddress& rPos) { maPos = rPos; };
82 bool IsSelected() const { return mbActive;}
83 void SetIndex(sal_Int32 nIndex);
84
85 virtual ScFormatEntry* GetEntry() const = 0;
86 virtual void SetActive() = 0;
87 virtual void SetInactive() = 0;
88
90};
91
93{
94 //cond format ui elements
96 std::unique_ptr<weld::ComboBox> mxLbCondType;
97 std::unique_ptr<formula::RefEdit> mxEdVal1;
98 std::unique_ptr<formula::RefEdit> mxEdVal2;
99 std::unique_ptr<weld::Label> mxFtVal;
100 std::unique_ptr<weld::Label> mxFtStyle;
101 std::unique_ptr<weld::ComboBox> mxLbStyle;
102 std::unique_ptr<weld::Widget> mxWdPreviewWin;
103 std::unique_ptr<weld::CustomWeld> mxWdPreview;
105
106 static const sal_Int32 NUM_COND_ENTRIES = 24;
107 // Lookup table from positions in maLbCondType to the condition mode enum
109
111
112 virtual OUString GetExpressionString() override;
113 void Init(ScCondFormatDlg* pDialogParent);
114 DECL_LINK( StyleSelectHdl, weld::ComboBox&, void );
115 DECL_LINK( ConditionTypeSelectHdl, weld::ComboBox&, void );
116 DECL_LINK( OnEdChanged, formula::RefEdit&, void );
117
118 // Searches the lookup table for the entry position, given condition mode
119 static sal_Int32 ConditionModeToEntryPos( ScConditionMode eMode );
120 // Accesses the lookup table for the condition mode, given entry position
121 static ScConditionMode EntryPosToConditionMode( sal_Int32 aEntryPos );
122 // Returns the number of edit fields used for a given condition mode
123 static sal_Int32 GetNumberEditFields( ScConditionMode eMode );
124
125protected:
126 virtual void Select() override;
127 virtual void Deselect() override;
128
129public:
130 ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent,
131 const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = nullptr);
132 virtual ~ScConditionFrmtEntry() override;
133
134 virtual ScFormatEntry* GetEntry() const override;
135 virtual void SetActive() override;
136 virtual void SetInactive() override;
137
138 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
139
141};
142
144{
146 std::unique_ptr<weld::Label> mxFtStyle;
147 std::unique_ptr<weld::ComboBox> mxLbStyle;
148 std::unique_ptr<weld::Widget> mxWdPreviewWin;
149 std::unique_ptr<weld::CustomWeld> mxWdPreview;
150 std::unique_ptr<formula::RefEdit> mxEdFormula;
151
153 virtual OUString GetExpressionString() override;
154 void Init(ScCondFormatDlg* pDialogParent);
155
156 DECL_LINK(StyleSelectHdl, weld::ComboBox&, void);
157
158public:
159 ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument* PDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = nullptr);
160 virtual ~ScFormulaFrmtEntry() override;
161
162 virtual ScFormatEntry* GetEntry() const override;
163 virtual void SetActive() override;
164 virtual void SetInactive() override;
166};
167
169{
170
171 //color format ui elements
172 std::unique_ptr<weld::ComboBox> mxLbColorFormat;
173
174 //color scale ui elements
175 std::unique_ptr<weld::ComboBox> mxLbEntryTypeMin;
176 std::unique_ptr<weld::ComboBox> mxLbEntryTypeMax;
177
178 std::unique_ptr<weld::Entry> mxEdMin;
179 std::unique_ptr<weld::Entry> mxEdMax;
180
181 std::unique_ptr<ColorListBox> mxLbColMin;
182 std::unique_ptr<ColorListBox> mxLbColMax;
183
184 std::unique_ptr<weld::Label> mxFtMin;
185 std::unique_ptr<weld::Label> mxFtMax;
186
188
189 virtual OUString GetExpressionString() override;
190 void Init();
191
192 DECL_LINK( EntryTypeHdl, weld::ComboBox&, void );
193public:
194 ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr);
195 virtual ~ScColorScale2FrmtEntry() override;
196 virtual ScFormatEntry* GetEntry() const override;
197 virtual void SetActive() override;
198 virtual void SetInactive() override;
200};
201
203{
204
205 //color format ui elements
206 std::unique_ptr<weld::ComboBox> mxLbColorFormat;
207
208 //color scale ui elements
209 std::unique_ptr<weld::ComboBox> mxLbEntryTypeMin;
210 std::unique_ptr<weld::ComboBox> mxLbEntryTypeMiddle;
211 std::unique_ptr<weld::ComboBox> mxLbEntryTypeMax;
212
213 std::unique_ptr<weld::Entry> mxEdMin;
214 std::unique_ptr<weld::Entry> mxEdMiddle;
215 std::unique_ptr<weld::Entry> mxEdMax;
216
217 std::unique_ptr<ColorListBox> mxLbColMin;
218 std::unique_ptr<ColorListBox> mxLbColMiddle;
219 std::unique_ptr<ColorListBox> mxLbColMax;
220
221 std::unique_ptr<weld::Label> mxFtMin;
222 std::unique_ptr<weld::Label> mxFtMax;
223
225
226 virtual OUString GetExpressionString() override;
227 void Init();
228
229 DECL_LINK( EntryTypeHdl, weld::ComboBox&, void );
230public:
231 ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr);
232 virtual ~ScColorScale3FrmtEntry() override;
233 virtual ScFormatEntry* GetEntry() const override;
234 virtual void SetActive() override;
235 virtual void SetInactive() override;
237};
238
240{
241 //color format ui elements
242 std::unique_ptr<weld::ComboBox> mxLbColorFormat;
243
244 //data bar ui elements
245 std::unique_ptr<weld::ComboBox> mxLbDataBarMinType;
246 std::unique_ptr<weld::ComboBox> mxLbDataBarMaxType;
247 std::unique_ptr<weld::Entry> mxEdDataBarMin;
248 std::unique_ptr<weld::Entry> mxEdDataBarMax;
249 std::unique_ptr<weld::Button> mxBtOptions;
250
251 std::unique_ptr<weld::Label> mxFtMin;
252 std::unique_ptr<weld::Label> mxFtMax;
253
254 std::unique_ptr<ScDataBarFormatData> mpDataBarData;
255
257
258 virtual OUString GetExpressionString() override;
259 void Init();
260
261 DECL_LINK( OptionBtnHdl, weld::Button&, void );
262 DECL_LINK( DataBarTypeSelectHdl, weld::ComboBox&, void );
263public:
264 ScDataBarFrmtEntry(ScCondFormatList* pParemt, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = nullptr);
265 virtual ~ScDataBarFrmtEntry() override;
266 virtual ScFormatEntry* GetEntry() const override;
267 virtual void SetActive() override;
268 virtual void SetInactive() override;
269
271};
272
274{
275public:
276 ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = nullptr);
277 virtual ~ScDateFrmtEntry() override;
278 virtual ScFormatEntry* GetEntry() const override;
279 virtual void SetActive() override;
280 virtual void SetInactive() override;
282
283 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
284
285protected:
286 virtual OUString GetExpressionString() override;
287
288private:
289 void Init();
290
291 DECL_LINK( StyleSelectHdl, weld::ComboBox&, void );
292
294 std::unique_ptr<weld::ComboBox> mxLbDateEntry;
295 std::unique_ptr<weld::Label> mxFtStyle;
296 std::unique_ptr<weld::ComboBox> mxLbStyle;
297 std::unique_ptr<weld::Widget> mxWdPreviewWin;
298 std::unique_ptr<weld::CustomWeld> mxWdPreview;
299
301};
302
304{
305 //color format ui elements
306 std::unique_ptr<weld::ComboBox> mxLbColorFormat;
307
308 // icon set ui elements
309 std::unique_ptr<weld::ComboBox> mxLbIconSetType;
310
311 std::unique_ptr<weld::Container> mxIconParent;
312
313 typedef std::vector<std::unique_ptr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType;
315
316 virtual OUString GetExpressionString() override;
317
318 void Init();
319
320 DECL_LINK(IconSetTypeHdl, weld::ComboBox&, void);
321
322public:
323 ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = nullptr);
324 virtual ~ScIconSetFrmtEntry() override;
325 virtual ScFormatEntry* GetEntry() const override;
326 virtual void SetActive() override;
327 virtual void SetInactive() override;
329};
330
331/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ScFormatEntry * GetEntry() const override
DECL_LINK(EntryTypeHdl, weld::ComboBox &, void)
ScFormatEntry * createColorscaleEntry() const
std::unique_ptr< weld::ComboBox > mxLbColorFormat
std::unique_ptr< weld::Label > mxFtMin
std::unique_ptr< weld::Entry > mxEdMin
virtual condformat::entry::ScCondFrmtEntryType GetType() override
ScColorScale2FrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScColorScaleFormat *pFormat=nullptr)
std::unique_ptr< weld::Entry > mxEdMax
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMax
std::unique_ptr< weld::Label > mxFtMax
virtual ~ScColorScale2FrmtEntry() override
virtual OUString GetExpressionString() override
std::unique_ptr< ColorListBox > mxLbColMax
virtual void SetActive() override
std::unique_ptr< ColorListBox > mxLbColMin
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMin
virtual void SetInactive() override
std::unique_ptr< weld::ComboBox > mxLbColorFormat
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMax
std::unique_ptr< weld::Label > mxFtMin
virtual void SetActive() override
std::unique_ptr< ColorListBox > mxLbColMiddle
std::unique_ptr< weld::Entry > mxEdMin
std::unique_ptr< weld::Label > mxFtMax
virtual ~ScColorScale3FrmtEntry() override
ScFormatEntry * createColorscaleEntry() const
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMiddle
virtual void SetInactive() override
ScColorScale3FrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScColorScaleFormat *pFormat=nullptr)
std::unique_ptr< ColorListBox > mxLbColMin
virtual OUString GetExpressionString() override
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::Entry > mxEdMax
DECL_LINK(EntryTypeHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMin
std::unique_ptr< weld::Entry > mxEdMiddle
std::unique_ptr< ColorListBox > mxLbColMax
virtual condformat::entry::ScCondFrmtEntryType GetType() override
std::unique_ptr< weld::Label > mxFtCondition
std::unique_ptr< weld::Label > mxFtCondNr
int get_preferred_height() const
ScCondFormatList * mpParent
std::unique_ptr< weld::Container > mxGrid
virtual condformat::entry::ScCondFrmtEntryType GetType()=0
std::unique_ptr< weld::ComboBox > mxLbType
OUString const maStrCondition
virtual void SetInactive()=0
std::unique_ptr< weld::Builder > mxBuilder
virtual ScFormatEntry * GetEntry() const =0
void SetPos(const ScAddress &rPos)
void set_grid_top_attach(int nAttach)
ScCondFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos)
std::unique_ptr< weld::Widget > mxBorder
virtual void SetActive()=0
virtual OUString GetExpressionString()=0
virtual void Deselect()
void SetIndex(sal_Int32 nIndex)
bool IsSelected() const
Link< ScCondFrmtEntry &, void > maClickHdl
DECL_LINK(EntrySelectHdl, const MouseEvent &, bool)
virtual void Select()
SvxFontPrevWindow maWdPreview
virtual void Deselect() override
std::unique_ptr< weld::Label > mxFtVal
virtual condformat::entry::ScCondFrmtEntryType GetType() override
ScConditionFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, ScCondFormatDlg *pDialogParent, const ScAddress &rPos, const ScCondFormatEntry *pFormatEntry=nullptr)
virtual ScFormatEntry * GetEntry() const override
virtual void SetActive() override
std::unique_ptr< formula::RefEdit > mxEdVal2
DECL_LINK(OnEdChanged, formula::RefEdit &, void)
std::unique_ptr< weld::ComboBox > mxLbStyle
DECL_LINK(StyleSelectHdl, weld::ComboBox &, void)
virtual void Select() override
static sal_Int32 ConditionModeToEntryPos(ScConditionMode eMode)
std::unique_ptr< formula::RefEdit > mxEdVal1
std::unique_ptr< weld::Label > mxFtStyle
static const ScConditionMode mpEntryToCond[NUM_COND_ENTRIES]
void Init(ScCondFormatDlg *pDialogParent)
std::unique_ptr< weld::Widget > mxWdPreviewWin
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual OUString GetExpressionString() override
virtual void SetInactive() override
static const sal_Int32 NUM_COND_ENTRIES
static ScConditionMode EntryPosToConditionMode(sal_Int32 aEntryPos)
std::unique_ptr< weld::ComboBox > mxLbCondType
DECL_LINK(ConditionTypeSelectHdl, weld::ComboBox &, void)
ScFormatEntry * createConditionEntry() const
std::unique_ptr< weld::CustomWeld > mxWdPreview
virtual ~ScConditionFrmtEntry() override
static sal_Int32 GetNumberEditFields(ScConditionMode eMode)
ScDataBarFrmtEntry(ScCondFormatList *pParemt, ScDocument *pDoc, const ScAddress &rPos, const ScDataBarFormat *pFormat=nullptr)
virtual ~ScDataBarFrmtEntry() override
std::unique_ptr< weld::ComboBox > mxLbDataBarMinType
virtual void SetInactive() override
DECL_LINK(DataBarTypeSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > mxLbDataBarMaxType
std::unique_ptr< weld::Label > mxFtMax
DECL_LINK(OptionBtnHdl, weld::Button &, void)
std::unique_ptr< weld::Entry > mxEdDataBarMax
virtual condformat::entry::ScCondFrmtEntryType GetType() override
virtual OUString GetExpressionString() override
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::Entry > mxEdDataBarMin
ScFormatEntry * createDatabarEntry() const
std::unique_ptr< ScDataBarFormatData > mpDataBarData
std::unique_ptr< weld::Button > mxBtOptions
virtual void SetActive() override
std::unique_ptr< weld::Label > mxFtMin
std::unique_ptr< weld::ComboBox > mxLbColorFormat
virtual ScFormatEntry * GetEntry() const override
SvxFontPrevWindow maWdPreview
virtual void SetActive() override
DECL_LINK(StyleSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::CustomWeld > mxWdPreview
std::unique_ptr< weld::Label > mxFtStyle
virtual ~ScDateFrmtEntry() override
virtual OUString GetExpressionString() override
ScDateFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScCondDateFormatEntry *pFormat=nullptr)
std::unique_ptr< weld::Widget > mxWdPreviewWin
virtual void SetInactive() override
std::unique_ptr< weld::ComboBox > mxLbDateEntry
std::unique_ptr< weld::ComboBox > mxLbStyle
virtual condformat::entry::ScCondFrmtEntryType GetType() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::unique_ptr< weld::Label > mxFtStyle
std::unique_ptr< weld::ComboBox > mxLbStyle
std::unique_ptr< formula::RefEdit > mxEdFormula
virtual void SetInactive() override
ScFormatEntry * createFormulaEntry() const
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::CustomWeld > mxWdPreview
virtual condformat::entry::ScCondFrmtEntryType GetType() override
ScFormulaFrmtEntry(ScCondFormatList *pParent, ScDocument *PDoc, ScCondFormatDlg *pDialogParent, const ScAddress &rPos, const ScCondFormatEntry *pFormatEntry=nullptr)
virtual OUString GetExpressionString() override
virtual void SetActive() override
SvxFontPrevWindow maWdPreview
std::unique_ptr< weld::Widget > mxWdPreviewWin
void Init(ScCondFormatDlg *pDialogParent)
DECL_LINK(StyleSelectHdl, weld::ComboBox &, void)
virtual ~ScFormulaFrmtEntry() override
std::unique_ptr< weld::ComboBox > mxLbIconSetType
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::ComboBox > mxLbColorFormat
ScIconSetFrmtDataEntriesType maEntries
virtual ~ScIconSetFrmtEntry() override
virtual OUString GetExpressionString() override
virtual void SetActive() override
std::vector< std::unique_ptr< ScIconSetFrmtDataEntry > > ScIconSetFrmtDataEntriesType
ScIconSetFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScIconSetFormat *pFormat=nullptr)
std::unique_ptr< weld::Container > mxIconParent
virtual void SetInactive() override
virtual condformat::entry::ScCondFrmtEntryType GetType() override
DECL_LINK(IconSetTypeHdl, weld::ComboBox &, void)
ScConditionMode
Definition: conditio.hxx:60