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 #include "colorscale.hxx"
11 #include "conditio.hxx"
12 #include <formula/funcutl.hxx>
14 #include <svl/lstner.hxx>
16 class ScIconSetFrmtDataEntry
;
18 namespace condformat
{
22 enum ScCondFrmtEntryType
37 class ScCondFrmtEntry
: public Control
46 FixedText maFtCondition
;
49 OUString maStrCondition
;
56 DECL_LINK( EdModifyHdl
, Edit
* );
61 virtual OUString
GetExpressionString() = 0;
64 ScCondFrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScAddress
& rPos
);
65 virtual ~ScCondFrmtEntry();
67 virtual long Notify( NotifyEvent
& rNEvt
);
69 bool IsSelected() const;
70 void SetIndex(sal_Int32 nIndex
);
71 sal_Int32
GetIndex() const { return mnIndex
; }
74 virtual ScFormatEntry
* GetEntry() const = 0;
75 virtual void SetActive() = 0;
76 virtual void SetInactive() = 0;
78 virtual condformat::entry::ScCondFrmtEntryType
GetType() = 0;
81 class ScConditionFrmtEntry
: public ScCondFrmtEntry
, public SfxListener
83 //cond format ui elements
85 formula::RefEdit maEdVal1
;
86 formula::RefEdit maEdVal2
;
89 SvxFontPrevWindow maWdPreview
;
90 bool mbIsInStyleCreate
;
92 ScFormatEntry
* createConditionEntry() const;
94 virtual OUString
GetExpressionString();
96 DECL_LINK( StyleSelectHdl
, void* );
97 DECL_LINK( ConditionTypeSelectHdl
, void* );
100 ScConditionFrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScAddress
& rPos
, const ScCondFormatEntry
* pFormatEntry
= NULL
);
102 virtual ScFormatEntry
* GetEntry() const;
103 virtual void SetActive();
104 virtual void SetInactive();
106 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
107 using ScCondFrmtEntry::Notify
;
109 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::CONDITION
; }
112 class ScFormulaFrmtEntry
: public ScCondFrmtEntry
116 SvxFontPrevWindow maWdPreview
;
117 formula::RefEdit maEdFormula
;
119 ScFormatEntry
* createFormulaEntry() const;
120 virtual OUString
GetExpressionString();
123 DECL_LINK( StyleSelectHdl
, void* );
126 ScFormulaFrmtEntry( Window
* pParent
, ScDocument
* PDoc
, const ScAddress
& rPos
, const ScCondFormatEntry
* pFormatEntry
= NULL
);
128 virtual ScFormatEntry
* GetEntry() const;
129 virtual void SetActive();
130 virtual void SetInactive();
131 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::FORMULA
; }
134 class ScColorScale2FrmtEntry
: public ScCondFrmtEntry
137 //color format ui elements
138 ListBox maLbColorFormat
;
140 //color scale ui elements
141 ListBox maLbEntryTypeMin
;
142 ListBox maLbEntryTypeMax
;
147 ColorListBox maLbColMin
;
148 ColorListBox maLbColMax
;
150 ScFormatEntry
* createColorscaleEntry() const;
152 virtual OUString
GetExpressionString();
155 DECL_LINK( EntryTypeHdl
, ListBox
* );
157 ScColorScale2FrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScAddress
& rPos
, const ScColorScaleFormat
* pFormat
= NULL
);
158 virtual ScFormatEntry
* GetEntry() const;
159 virtual void SetActive();
160 virtual void SetInactive();
161 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::COLORSCALE2
; }
164 class ScColorScale3FrmtEntry
: public ScCondFrmtEntry
167 //color format ui elements
168 ListBox maLbColorFormat
;
170 //color scale ui elements
171 ListBox maLbEntryTypeMin
;
172 ListBox maLbEntryTypeMiddle
;
173 ListBox maLbEntryTypeMax
;
179 ColorListBox maLbColMin
;
180 ColorListBox maLbColMiddle
;
181 ColorListBox maLbColMax
;
183 ScFormatEntry
* createColorscaleEntry() const;
185 virtual OUString
GetExpressionString();
188 DECL_LINK( EntryTypeHdl
, ListBox
* );
190 ScColorScale3FrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScAddress
& rPos
, const ScColorScaleFormat
* pFormat
= NULL
);
191 virtual ScFormatEntry
* GetEntry() const;
192 virtual void SetActive();
193 virtual void SetInactive();
194 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::COLORSCALE3
; }
197 class ScDataBarFrmtEntry
: public ScCondFrmtEntry
199 //color format ui elements
200 ListBox maLbColorFormat
;
202 //data bar ui elements
203 ListBox maLbDataBarMinType
;
204 ListBox maLbDataBarMaxType
;
208 PushButton maBtOptions
;
210 boost::scoped_ptr
<ScDataBarFormatData
> mpDataBarData
;
212 ScFormatEntry
* createDatabarEntry() const;
214 virtual OUString
GetExpressionString();
217 DECL_LINK( OptionBtnHdl
, void* );
218 DECL_LINK( DataBarTypeSelectHdl
, void* );
220 ScDataBarFrmtEntry( Window
* pParemt
, ScDocument
* pDoc
, const ScAddress
& rPos
, const ScDataBarFormat
* pFormat
= NULL
);
221 virtual ScFormatEntry
* GetEntry() const;
222 virtual void SetActive();
223 virtual void SetInactive();
225 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::DATABAR
; }
228 class ScDateFrmtEntry
: public ScCondFrmtEntry
, public SfxListener
231 ScDateFrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScCondDateFormatEntry
* pFormat
= NULL
);
232 virtual ScFormatEntry
* GetEntry() const;
233 virtual void SetActive();
234 virtual void SetInactive();
235 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::DATE
; }
237 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
238 using ScCondFrmtEntry::Notify
;
240 virtual OUString
GetExpressionString();
245 DECL_LINK( StyleSelectHdl
, void* );
247 ListBox maLbDateEntry
;
250 SvxFontPrevWindow maWdPreview
;
252 bool mbIsInStyleCreate
;
255 class ScIconSetFrmtEntry
: public ScCondFrmtEntry
257 //color format ui elements
258 ListBox maLbColorFormat
;
260 // icon set ui elements
261 ListBox maLbIconSetType
;
263 typedef boost::ptr_vector
<ScIconSetFrmtDataEntry
> ScIconSetFrmtDataEntriesType
;
264 ScIconSetFrmtDataEntriesType maEntries
;
266 virtual OUString
GetExpressionString();
270 DECL_LINK( IconSetTypeHdl
, void* );
273 ScIconSetFrmtEntry( Window
* pParent
, ScDocument
* pDoc
, const ScAddress
& rPos
, const ScIconSetFormat
* pFormat
= NULL
);
274 virtual ScFormatEntry
* GetEntry() const;
275 virtual void SetActive();
276 virtual void SetInactive();
277 virtual condformat::entry::ScCondFrmtEntryType
GetType() { return condformat::entry::ICONSET
; }
280 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */