Line data Source code
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 : #ifndef SC_CONDFORMATDLGENTRY_HXX
11 : #define SC_CONDFORMATDLGENTRY_HXX
12 :
13 : #include "colorscale.hxx"
14 : #include "conditio.hxx"
15 : #include <formula/funcutl.hxx>
16 :
17 : #include <svl/lstner.hxx>
18 :
19 : class ScIconSetFrmtDataEntry;
20 :
21 : namespace condformat {
22 :
23 : namespace entry {
24 :
25 : enum ScCondFrmtEntryType
26 : {
27 : CONDITION,
28 : FORMULA,
29 : COLORSCALE2,
30 : COLORSCALE3,
31 : DATABAR,
32 : ICONSET,
33 : DATE
34 : };
35 :
36 : }
37 :
38 : }
39 :
40 : class ScCondFrmtEntry : public Control
41 : {
42 : private:
43 : bool mbActive;
44 :
45 : Link maClickHdl;
46 :
47 : //general ui elements
48 : FixedText maFtCondNr;
49 : FixedText maFtCondition;
50 :
51 : sal_Int32 mnIndex;
52 : OUString maStrCondition;
53 : protected:
54 : ListBox maLbType;
55 :
56 : ScDocument* mpDoc;
57 : ScAddress maPos;
58 :
59 : DECL_LINK( EdModifyHdl, Edit* );
60 :
61 : void Select();
62 : void Deselect();
63 :
64 : virtual OUString GetExpressionString() = 0;
65 :
66 : public:
67 : ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos );
68 : virtual ~ScCondFrmtEntry();
69 :
70 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
71 :
72 : bool IsSelected() const;
73 : void SetIndex(sal_Int32 nIndex);
74 : sal_Int32 GetIndex() const { return mnIndex; }
75 : void SetHeight();
76 :
77 : virtual ScFormatEntry* GetEntry() const = 0;
78 : virtual void SetActive() = 0;
79 : virtual void SetInactive() = 0;
80 :
81 : virtual condformat::entry::ScCondFrmtEntryType GetType() = 0;
82 : };
83 :
84 0 : class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
85 : {
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;
94 :
95 : ScFormatEntry* createConditionEntry() const;
96 :
97 : virtual OUString GetExpressionString() SAL_OVERRIDE;
98 : void Init();
99 : DECL_LINK( StyleSelectHdl, void* );
100 : DECL_LINK( ConditionTypeSelectHdl, void* );
101 :
102 : public:
103 : ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL );
104 :
105 : virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE;
106 : virtual void SetActive() SAL_OVERRIDE;
107 : virtual void SetInactive() SAL_OVERRIDE;
108 :
109 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
110 : using ScCondFrmtEntry::Notify;
111 :
112 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::CONDITION; }
113 : };
114 :
115 0 : class ScFormulaFrmtEntry : public ScCondFrmtEntry
116 : {
117 : FixedText maFtStyle;
118 : ListBox maLbStyle;
119 : SvxFontPrevWindow maWdPreview;
120 : formula::RefEdit maEdFormula;
121 :
122 : ScFormatEntry* createFormulaEntry() const;
123 : virtual OUString GetExpressionString() SAL_OVERRIDE;
124 : void Init();
125 :
126 : DECL_LINK( StyleSelectHdl, void* );
127 :
128 : public:
129 : ScFormulaFrmtEntry( Window* pParent, ScDocument* PDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL );
130 :
131 : virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE;
132 : virtual void SetActive() SAL_OVERRIDE;
133 : virtual void SetInactive() SAL_OVERRIDE;
134 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::FORMULA; }
135 : };
136 :
137 0 : class ScColorScale2FrmtEntry : public ScCondFrmtEntry
138 : {
139 :
140 : //color format ui elements
141 : ListBox maLbColorFormat;
142 :
143 : //color scale ui elements
144 : ListBox maLbEntryTypeMin;
145 : ListBox maLbEntryTypeMax;
146 :
147 : Edit maEdMin;
148 : Edit maEdMax;
149 :
150 : ColorListBox maLbColMin;
151 : ColorListBox maLbColMax;
152 :
153 : ScFormatEntry* createColorscaleEntry() const;
154 :
155 : virtual OUString GetExpressionString() SAL_OVERRIDE;
156 : void Init();
157 :
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 SAL_OVERRIDE;
162 : virtual void SetActive() SAL_OVERRIDE;
163 : virtual void SetInactive() SAL_OVERRIDE;
164 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::COLORSCALE2; }
165 : };
166 :
167 0 : class ScColorScale3FrmtEntry : public ScCondFrmtEntry
168 : {
169 :
170 : //color format ui elements
171 : ListBox maLbColorFormat;
172 :
173 : //color scale ui elements
174 : ListBox maLbEntryTypeMin;
175 : ListBox maLbEntryTypeMiddle;
176 : ListBox maLbEntryTypeMax;
177 :
178 : Edit maEdMin;
179 : Edit maEdMiddle;
180 : Edit maEdMax;
181 :
182 : ColorListBox maLbColMin;
183 : ColorListBox maLbColMiddle;
184 : ColorListBox maLbColMax;
185 :
186 : ScFormatEntry* createColorscaleEntry() const;
187 :
188 : virtual OUString GetExpressionString() SAL_OVERRIDE;
189 : void Init();
190 :
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 SAL_OVERRIDE;
195 : virtual void SetActive() SAL_OVERRIDE;
196 : virtual void SetInactive() SAL_OVERRIDE;
197 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::COLORSCALE3; }
198 : };
199 :
200 0 : class ScDataBarFrmtEntry : public ScCondFrmtEntry
201 : {
202 : //color format ui elements
203 : ListBox maLbColorFormat;
204 :
205 : //data bar ui elements
206 : ListBox maLbDataBarMinType;
207 : ListBox maLbDataBarMaxType;
208 : Edit maEdDataBarMin;
209 : Edit maEdDataBarMax;
210 :
211 : PushButton maBtOptions;
212 :
213 : boost::scoped_ptr<ScDataBarFormatData> mpDataBarData;
214 :
215 : ScFormatEntry* createDatabarEntry() const;
216 :
217 : virtual OUString GetExpressionString() SAL_OVERRIDE;
218 : void Init();
219 :
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 SAL_OVERRIDE;
225 : virtual void SetActive() SAL_OVERRIDE;
226 : virtual void SetInactive() SAL_OVERRIDE;
227 :
228 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::DATABAR; }
229 : };
230 :
231 0 : class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener
232 : {
233 : public:
234 : ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = NULL );
235 : virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE;
236 : virtual void SetActive() SAL_OVERRIDE;
237 : virtual void SetInactive() SAL_OVERRIDE;
238 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::DATE; }
239 :
240 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
241 : using ScCondFrmtEntry::Notify;
242 : protected:
243 : virtual OUString GetExpressionString() SAL_OVERRIDE;
244 :
245 : private:
246 : void Init();
247 :
248 : DECL_LINK( StyleSelectHdl, void* );
249 :
250 : ListBox maLbDateEntry;
251 : FixedText maFtStyle;
252 : ListBox maLbStyle;
253 : SvxFontPrevWindow maWdPreview;
254 :
255 : bool mbIsInStyleCreate;
256 : };
257 :
258 0 : class ScIconSetFrmtEntry : public ScCondFrmtEntry
259 : {
260 : //color format ui elements
261 : ListBox maLbColorFormat;
262 :
263 : // icon set ui elements
264 : ListBox maLbIconSetType;
265 :
266 : typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType;
267 : ScIconSetFrmtDataEntriesType maEntries;
268 :
269 : virtual OUString GetExpressionString() SAL_OVERRIDE;
270 :
271 : void Init();
272 :
273 : DECL_LINK( IconSetTypeHdl, void* );
274 :
275 : public:
276 : ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = NULL );
277 : virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE;
278 : virtual void SetActive() SAL_OVERRIDE;
279 : virtual void SetInactive() SAL_OVERRIDE;
280 0 : virtual condformat::entry::ScCondFrmtEntryType GetType() SAL_OVERRIDE { return condformat::entry::ICONSET; }
281 : };
282 :
283 : #endif
284 :
285 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|