Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : : *
5 : : * The contents of this file are subject to the Mozilla Public License Version
6 : : * 1.1 (the "License"); you may not use this file except in compliance with
7 : : * the License or as specified alternatively below. You may obtain a copy of
8 : : * the License at http://www.mozilla.org/MPL/
9 : : *
10 : : * Software distributed under the License is distributed on an "AS IS" basis,
11 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : : * for the specific language governing rights and limitations under the
13 : : * License.
14 : : *
15 : : * Major Contributor(s):
16 : : * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
17 : : *
18 : : * All Rights Reserved.
19 : : *
20 : : * For minor contributions see the git repository.
21 : : *
22 : : * Alternatively, the contents of this file may be used under the terms of
23 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : : * instead of those above.
27 : : */
28 : :
29 : : #include <vcl/button.hxx>
30 : : #include <vcl/dialog.hxx>
31 : : #include <vcl/lstbox.hxx>
32 : : #include <vcl/scrbar.hxx>
33 : : #include <vcl/fixed.hxx>
34 : : #include <vcl/edit.hxx>
35 : : #include <svx/fntctrl.hxx>
36 : : #include <svtools/ctrlbox.hxx>
37 : :
38 : : #include "rangelst.hxx"
39 : : #include "condformathelper.hxx"
40 : :
41 : : #include <boost/ptr_container/ptr_vector.hpp>
42 : : #include <boost/scoped_ptr.hpp>
43 : :
44 : : class ScDocument;
45 : : class ScConditionalFormat;
46 : : class ScFormatEntry;
47 : : class ScConditionalFormat;
48 : : struct ScDataBarFormatData;
49 : :
50 : : class ScCondFrmtEntry : public Control
51 : : {
52 : : private:
53 : : bool mbActive;
54 : : ScCondFormatEntryType meType;
55 : :
56 : : Link maClickHdl;
57 : :
58 : : //general ui elements
59 : : ListBox maLbType;
60 : : FixedText maFtCondNr;
61 : : FixedText maFtCondition;
62 : :
63 : : //cond format ui elements
64 : : ListBox maLbCondType;
65 : : Edit maEdVal1;
66 : : Edit maEdVal2;
67 : : FixedText maFtStyle;
68 : : ListBox maLbStyle;
69 : : SvxFontPrevWindow maWdPreview;
70 : :
71 : : //color format ui elements
72 : : ListBox maLbColorFormat;
73 : : //color scale ui elements
74 : : ListBox maLbColScale2;
75 : : ListBox maLbColScale3;
76 : :
77 : : ListBox maLbEntryTypeMin;
78 : : ListBox maLbEntryTypeMiddle;
79 : : ListBox maLbEntryTypeMax;
80 : :
81 : : Edit maEdMin;
82 : : Edit maEdMiddle;
83 : : Edit maEdMax;
84 : :
85 : : ColorListBox maLbColMin;
86 : : ColorListBox maLbColMiddle;
87 : : ColorListBox maLbColMax;
88 : :
89 : : //data bar ui elements
90 : : ListBox maLbDataBarMinType;
91 : : ListBox maLbDataBarMaxType;
92 : : Edit maEdDataBarMin;
93 : : Edit maEdDataBarMax;
94 : : PushButton maBtOptions;
95 : :
96 : : boost::scoped_ptr<ScDataBarFormatData> mpDataBarData;
97 : :
98 : : //
99 : : void SwitchToType(ScCondFormatEntryType eType);
100 : : void SetCondType();
101 : : void SetColorScaleType();
102 : : void SetDataBarType();
103 : : void SetFormulaType();
104 : : void HideCondElements();
105 : : void HideColorScaleElements();
106 : : void HideDataBarElements();
107 : :
108 : : void SetHeight();
109 : : void Init();
110 : :
111 : : ScFormatEntry* createConditionEntry() const;
112 : : ScFormatEntry* createColorscaleEntry() const;
113 : : ScFormatEntry* createDatabarEntry() const;
114 : : ScFormatEntry* createFormulaEntry() const;
115 : :
116 : : ScDocument* mpDoc;
117 : : ScAddress maPos;
118 : : sal_Int32 mnIndex;
119 : : rtl::OUString maStrCondition;
120 : :
121 : : DECL_LINK( TypeListHdl, void*);
122 : : DECL_LINK( ColFormatTypeHdl, void*);
123 : : DECL_LINK( StyleSelectHdl, void* );
124 : : DECL_LINK( OptionBtnHdl, void* );
125 : : DECL_LINK( DataBarTypeSelectHdl, void* );
126 : : DECL_LINK( ConditionTypeSelectHdl, void* );
127 : : DECL_LINK( EntryTypeHdl, ListBox* );
128 : : DECL_LINK( EdModifyHdl, Edit* );
129 : :
130 : : public:
131 : : ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos );
132 : : ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScFormatEntry* pFormatEntry, const ScAddress& rPos );
133 : : virtual ~ScCondFrmtEntry();
134 : :
135 : : virtual long Notify( NotifyEvent& rNEvt );
136 : :
137 : : void Select();
138 : : void Deselect();
139 : :
140 : : bool IsSelected() const;
141 : : void SetIndex(sal_Int32 nIndex);
142 : :
143 : : ScFormatEntry* GetEntry() const;
144 : : };
145 : :
146 : 0 : class ScCondFormatList : public Control
147 : : {
148 : : private:
149 : : typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer;
150 : : EntryContainer maEntries;
151 : :
152 : : bool mbHasScrollBar;
153 : : boost::scoped_ptr<ScrollBar> mpScrollBar;
154 : : long mnTopIndex;
155 : :
156 : : ScDocument* mpDoc;
157 : : ScAddress maPos;
158 : : ScRangeList maRanges;
159 : :
160 : : void RecalcAll();
161 : : void DoScroll(long nDiff);
162 : : public:
163 : : ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos);
164 : :
165 : : ScConditionalFormat* GetConditionalFormat() const;
166 : :
167 : : DECL_LINK( AddBtnHdl, void* );
168 : : DECL_LINK( RemoveBtnHdl, void* );
169 : : DECL_LINK( ScrollHdl, void* );
170 : : DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
171 : :
172 : : };
173 : :
174 : 0 : class ScCondFormatDlg : public ModalDialog
175 : : {
176 : : private:
177 : : PushButton maBtnAdd;
178 : : PushButton maBtnRemove;
179 : : OKButton maBtnOk;
180 : : CancelButton maBtnCancel;
181 : :
182 : : ScCondFormatList maCondFormList;
183 : :
184 : : ScDocument* mpDoc;
185 : : const ScConditionalFormat* mpFormat;
186 : : ScAddress maPos;
187 : :
188 : : public:
189 : : ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos);
190 : :
191 : : ScConditionalFormat* GetConditionalFormat() const;
192 : : };
193 : :
194 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|