Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / condformatdlgentry.hxx
blob806c7ce9ca7ddddbad1605cf419825df1449b49b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef SC_CONDFORMATDLGENTRY_HXX
11 #define SC_CONDFORMATDLGENTRY_HXX
13 #include "colorscale.hxx"
14 #include "conditio.hxx"
15 #include <formula/funcutl.hxx>
17 #include <svl/lstner.hxx>
19 class ScIconSetFrmtDataEntry;
21 namespace condformat {
23 namespace entry {
25 enum ScCondFrmtEntryType
27 CONDITION,
28 FORMULA,
29 COLORSCALE2,
30 COLORSCALE3,
31 DATABAR,
32 ICONSET,
33 DATE
40 class ScCondFrmtEntry : public Control
42 private:
43 bool mbActive;
45 Link maClickHdl;
47 //general ui elements
48 FixedText maFtCondNr;
49 FixedText maFtCondition;
51 sal_Int32 mnIndex;
52 OUString maStrCondition;
53 protected:
54 ListBox maLbType;
56 ScDocument* mpDoc;
57 ScAddress maPos;
59 DECL_LINK( EdModifyHdl, Edit* );
61 void Select();
62 void Deselect();
64 virtual OUString GetExpressionString() = 0;
66 public:
67 ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos );
68 virtual ~ScCondFrmtEntry();
70 virtual long Notify( NotifyEvent& rNEvt );
72 bool IsSelected() const;
73 void SetIndex(sal_Int32 nIndex);
74 sal_Int32 GetIndex() const { return mnIndex; }
75 void SetHeight();
77 virtual ScFormatEntry* GetEntry() const = 0;
78 virtual void SetActive() = 0;
79 virtual void SetInactive() = 0;
81 virtual condformat::entry::ScCondFrmtEntryType GetType() = 0;
84 class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
86 //cond format ui elements
87 ListBox maLbCondType;
88 formula::RefEdit maEdVal1;
89 formula::RefEdit maEdVal2;
90 FixedText maFtStyle;
91 ListBox maLbStyle;
92 SvxFontPrevWindow maWdPreview;
93 bool mbIsInStyleCreate;
95 ScFormatEntry* createConditionEntry() const;
97 virtual OUString GetExpressionString();
98 void Init();
99 DECL_LINK( StyleSelectHdl, void* );
100 DECL_LINK( ConditionTypeSelectHdl, void* );
102 public:
103 ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL );
105 virtual ScFormatEntry* GetEntry() const;
106 virtual void SetActive();
107 virtual void SetInactive();
109 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
110 using ScCondFrmtEntry::Notify;
112 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::CONDITION; }
115 class ScFormulaFrmtEntry : public ScCondFrmtEntry
117 FixedText maFtStyle;
118 ListBox maLbStyle;
119 SvxFontPrevWindow maWdPreview;
120 formula::RefEdit maEdFormula;
122 ScFormatEntry* createFormulaEntry() const;
123 virtual OUString GetExpressionString();
124 void Init();
126 DECL_LINK( StyleSelectHdl, void* );
128 public:
129 ScFormulaFrmtEntry( Window* pParent, ScDocument* PDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL );
131 virtual ScFormatEntry* GetEntry() const;
132 virtual void SetActive();
133 virtual void SetInactive();
134 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::FORMULA; }
137 class ScColorScale2FrmtEntry : public ScCondFrmtEntry
140 //color format ui elements
141 ListBox maLbColorFormat;
143 //color scale ui elements
144 ListBox maLbEntryTypeMin;
145 ListBox maLbEntryTypeMax;
147 Edit maEdMin;
148 Edit maEdMax;
150 ColorListBox maLbColMin;
151 ColorListBox maLbColMax;
153 ScFormatEntry* createColorscaleEntry() const;
155 virtual OUString GetExpressionString();
156 void Init();
158 DECL_LINK( EntryTypeHdl, ListBox* );
159 public:
160 ScColorScale2FrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL );
161 virtual ScFormatEntry* GetEntry() const;
162 virtual void SetActive();
163 virtual void SetInactive();
164 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::COLORSCALE2; }
167 class ScColorScale3FrmtEntry : public ScCondFrmtEntry
170 //color format ui elements
171 ListBox maLbColorFormat;
173 //color scale ui elements
174 ListBox maLbEntryTypeMin;
175 ListBox maLbEntryTypeMiddle;
176 ListBox maLbEntryTypeMax;
178 Edit maEdMin;
179 Edit maEdMiddle;
180 Edit maEdMax;
182 ColorListBox maLbColMin;
183 ColorListBox maLbColMiddle;
184 ColorListBox maLbColMax;
186 ScFormatEntry* createColorscaleEntry() const;
188 virtual OUString GetExpressionString();
189 void Init();
191 DECL_LINK( EntryTypeHdl, ListBox* );
192 public:
193 ScColorScale3FrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL );
194 virtual ScFormatEntry* GetEntry() const;
195 virtual void SetActive();
196 virtual void SetInactive();
197 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::COLORSCALE3; }
200 class ScDataBarFrmtEntry : public ScCondFrmtEntry
202 //color format ui elements
203 ListBox maLbColorFormat;
205 //data bar ui elements
206 ListBox maLbDataBarMinType;
207 ListBox maLbDataBarMaxType;
208 Edit maEdDataBarMin;
209 Edit maEdDataBarMax;
211 PushButton maBtOptions;
213 boost::scoped_ptr<ScDataBarFormatData> mpDataBarData;
215 ScFormatEntry* createDatabarEntry() const;
217 virtual OUString GetExpressionString();
218 void Init();
220 DECL_LINK( OptionBtnHdl, void* );
221 DECL_LINK( DataBarTypeSelectHdl, void* );
222 public:
223 ScDataBarFrmtEntry( Window* pParemt, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = NULL );
224 virtual ScFormatEntry* GetEntry() const;
225 virtual void SetActive();
226 virtual void SetInactive();
228 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::DATABAR; }
231 class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener
233 public:
234 ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = NULL );
235 virtual ScFormatEntry* GetEntry() const;
236 virtual void SetActive();
237 virtual void SetInactive();
238 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::DATE; }
240 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
241 using ScCondFrmtEntry::Notify;
242 protected:
243 virtual OUString GetExpressionString();
245 private:
246 void Init();
248 DECL_LINK( StyleSelectHdl, void* );
250 ListBox maLbDateEntry;
251 FixedText maFtStyle;
252 ListBox maLbStyle;
253 SvxFontPrevWindow maWdPreview;
255 bool mbIsInStyleCreate;
258 class ScIconSetFrmtEntry : public ScCondFrmtEntry
260 //color format ui elements
261 ListBox maLbColorFormat;
263 // icon set ui elements
264 ListBox maLbIconSetType;
266 typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType;
267 ScIconSetFrmtDataEntriesType maEntries;
269 virtual OUString GetExpressionString();
271 void Init();
273 DECL_LINK( IconSetTypeHdl, void* );
275 public:
276 ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = NULL );
277 virtual ScFormatEntry* GetEntry() const;
278 virtual void SetActive();
279 virtual void SetInactive();
280 virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::ICONSET; }
283 #endif
285 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */