1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
{
25 enum ScCondFrmtEntryType
40 class ScCondFrmtEntry
: public Control
49 FixedText maFtCondition
;
52 OUString maStrCondition
;
59 DECL_LINK( EdModifyHdl
, Edit
* );
64 virtual OUString
GetExpressionString() = 0;
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
; }
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
88 formula::RefEdit maEdVal1
;
89 formula::RefEdit maEdVal2
;
92 SvxFontPrevWindow maWdPreview
;
93 bool mbIsInStyleCreate
;
95 ScFormatEntry
* createConditionEntry() const;
97 virtual OUString
GetExpressionString();
99 DECL_LINK( StyleSelectHdl
, void* );
100 DECL_LINK( ConditionTypeSelectHdl
, void* );
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
119 SvxFontPrevWindow maWdPreview
;
120 formula::RefEdit maEdFormula
;
122 ScFormatEntry
* createFormulaEntry() const;
123 virtual OUString
GetExpressionString();
126 DECL_LINK( StyleSelectHdl
, void* );
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
;
150 ColorListBox maLbColMin
;
151 ColorListBox maLbColMax
;
153 ScFormatEntry
* createColorscaleEntry() const;
155 virtual OUString
GetExpressionString();
158 DECL_LINK( EntryTypeHdl
, ListBox
* );
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
;
182 ColorListBox maLbColMin
;
183 ColorListBox maLbColMiddle
;
184 ColorListBox maLbColMax
;
186 ScFormatEntry
* createColorscaleEntry() const;
188 virtual OUString
GetExpressionString();
191 DECL_LINK( EntryTypeHdl
, ListBox
* );
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
;
211 PushButton maBtOptions
;
213 boost::scoped_ptr
<ScDataBarFormatData
> mpDataBarData
;
215 ScFormatEntry
* createDatabarEntry() const;
217 virtual OUString
GetExpressionString();
220 DECL_LINK( OptionBtnHdl
, void* );
221 DECL_LINK( DataBarTypeSelectHdl
, void* );
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
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
;
243 virtual OUString
GetExpressionString();
248 DECL_LINK( StyleSelectHdl
, void* );
250 ListBox maLbDateEntry
;
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();
273 DECL_LINK( IconSetTypeHdl
, void* );
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
; }
285 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */