LibreOffice Module sc (master)  1
condformatuno.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_UI_INC_CONDFORMATUNO_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATUNO_HXX
12 
13 #include <types.hxx>
14 
15 #include <com/sun/star/beans/XPropertySet.hpp>
16 #include <com/sun/star/sheet/XConditionalFormats.hpp>
17 #include <com/sun/star/sheet/XConditionalFormat.hpp>
18 #include <com/sun/star/sheet/XConditionEntry.hpp>
19 #include <com/sun/star/sheet/XColorScaleEntry.hpp>
20 #include <com/sun/star/sheet/XDataBarEntry.hpp>
21 #include <com/sun/star/sheet/XIconSetEntry.hpp>
22 
23 #include <cppuhelper/implbase.hxx>
24 #include <svl/itemprop.hxx>
25 #include <svl/lstner.hxx>
26 #include <rtl/ref.hxx>
27 
28 class ScDocShell;
31 class ScIconSetFormat;
32 class ScDataBarFormat;
33 class ScColorScaleFormat;
34 class ScCondFormatEntry;
35 class ScColorScaleEntry;
37 
38 using namespace com::sun::star;
39 
40 namespace com::sun::star::sheet { class XSheetCellRanges; }
41 
42 class ScCondFormatsObj : public cppu::WeakImplHelper<css::sheet::XConditionalFormats>,
43  public SfxListener
44 {
45 public:
46  ScCondFormatsObj(ScDocShell* pDocShell, SCTAB nTab);
47 
48  virtual ~ScCondFormatsObj() override;
49 
50  virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
51 
52  // XConditionalFormats
53  virtual sal_Int32 SAL_CALL createByRange(const uno::Reference<sheet::XSheetCellRanges>& xRanges) override;
54 
55  virtual void SAL_CALL removeByID( const sal_Int32 nID ) override;
56 
57  virtual uno::Sequence< uno::Reference< sheet::XConditionalFormat > > SAL_CALL getConditionalFormats() override;
58 
59  virtual sal_Int32 SAL_CALL getLength() override;
60 
61  ScConditionalFormatList* getCoreObject();
62 
63 private:
66 };
67 
68 class ScCondFormatObj : public cppu::WeakImplHelper<css::sheet::XConditionalFormat,
69  css::beans::XPropertySet>
70 {
71 public:
72  ScCondFormatObj(ScDocShell* pDocShell, rtl::Reference<ScCondFormatsObj> const & xCondFormats, sal_Int32 nKey);
73 
74  virtual ~ScCondFormatObj() override;
75 
77 
78  // XConditionalFormat
79  virtual void SAL_CALL createEntry(const sal_Int32 nType, const sal_Int32 nPos) override;
80 
81  virtual void SAL_CALL removeByIndex(const sal_Int32 nIndex) override;
82 
83  // XIndexAccess
84 
85  virtual uno::Type SAL_CALL getElementType() override;
86 
87  virtual sal_Bool SAL_CALL hasElements() override;
88 
89  virtual sal_Int32 SAL_CALL getCount() override;
90 
91  virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
92 
93  // XPropertySet
94  virtual css::uno::Reference< css::beans::XPropertySetInfo >
95  SAL_CALL getPropertySetInfo() override;
96  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
97  const css::uno::Any& aValue ) override;
98  virtual css::uno::Any SAL_CALL getPropertyValue(
99  const OUString& PropertyName ) override;
100  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
101  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
102  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
103  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
104  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
105  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
106  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
107  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
108 
109  ScConditionalFormat* getCoreObject();
110 
111 private:
115  sal_Int32 mnKey;
116 };
117 
118 class ScConditionEntryObj : public cppu::WeakImplHelper<css::beans::XPropertySet,
119  css::sheet::XConditionEntry>
120 {
121 public:
122 
124  const ScCondFormatEntry* pFormat);
125  virtual ~ScConditionEntryObj() override;
126 
127  ScCondFormatEntry* getCoreObject();
128 
129  // XConditionEntry
130  virtual sal_Int32 SAL_CALL getType() override;
131 
132  // XPropertySet
133  virtual css::uno::Reference< css::beans::XPropertySetInfo >
134  SAL_CALL getPropertySetInfo() override;
135  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
136  const css::uno::Any& aValue ) override;
137  virtual css::uno::Any SAL_CALL getPropertyValue(
138  const OUString& PropertyName ) override;
139  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
140  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
141  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
142  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
143  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
144  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
145  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
146  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
147 
148 private:
153 };
154 
155 class ScColorScaleFormatObj : public cppu::WeakImplHelper<css::beans::XPropertySet,
156  css::sheet::XConditionEntry>
157 {
158 public:
159 
161  virtual ~ScColorScaleFormatObj() override;
162 
163  // XConditionEntry
164  virtual sal_Int32 SAL_CALL getType() override;
165 
166 
167  ScColorScaleFormat* getCoreObject();
168 
169  // XPropertySet
170  virtual css::uno::Reference< css::beans::XPropertySetInfo >
171  SAL_CALL getPropertySetInfo() override;
172  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
173  const css::uno::Any& aValue ) override;
174  virtual css::uno::Any SAL_CALL getPropertyValue(
175  const OUString& PropertyName ) override;
176  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
177  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
178  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
179  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
180  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
181  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
182  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
183  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
184 
185 private:
189 };
190 
191 class ScColorScaleEntryObj : public cppu::WeakImplHelper<css::sheet::XColorScaleEntry>
192 {
193 public:
195 
196  virtual ~ScColorScaleEntryObj() override;
197 
198  virtual sal_Int32 SAL_CALL getColor() override;
199 
200  virtual void SAL_CALL setColor(sal_Int32 aColor) override;
201 
202  virtual sal_Int32 SAL_CALL getType() override;
203 
204  virtual void SAL_CALL setType(sal_Int32 nType) override;
205 
206  virtual OUString SAL_CALL getFormula() override;
207 
208  virtual void SAL_CALL setFormula(const OUString& rString) override;
209 
210 private:
211  ScColorScaleEntry* getCoreObject();
212 
214  size_t mnPos;
215 };
216 
217 class ScDataBarFormatObj : public cppu::WeakImplHelper<css::beans::XPropertySet,
218  css::sheet::XConditionEntry>
219 {
220 public:
222  const ScDataBarFormat* pFormat);
223  virtual ~ScDataBarFormatObj() override;
224 
225  ScDataBarFormat* getCoreObject();
226 
227  // XConditionEntry
228  virtual sal_Int32 SAL_CALL getType() override;
229 
230  // XPropertySet
231  virtual css::uno::Reference< css::beans::XPropertySetInfo >
232  SAL_CALL getPropertySetInfo() override;
233  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
234  const css::uno::Any& aValue ) override;
235  virtual css::uno::Any SAL_CALL getPropertyValue(
236  const OUString& PropertyName ) override;
237  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
238  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
239  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
240  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
241  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
242  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
243  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
244  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
245 
246 private:
250 };
251 
252 class ScDataBarEntryObj : public cppu::WeakImplHelper<css::sheet::XDataBarEntry>
253 {
254 public:
256 
257  virtual ~ScDataBarEntryObj() override;
258 
259  virtual sal_Int32 SAL_CALL getType() override;
260 
261  virtual void SAL_CALL setType(sal_Int32 nType) override;
262 
263  virtual OUString SAL_CALL getFormula() override;
264 
265  virtual void SAL_CALL setFormula(const OUString& rString) override;
266 
267 private:
268  ScColorScaleEntry* getCoreObject();
269 
271  size_t mnPos;
272 };
273 
274 class ScIconSetFormatObj : public cppu::WeakImplHelper<css::beans::XPropertySet,
275  css::sheet::XConditionEntry>
276 {
277 public:
279  const ScIconSetFormat* pFormat);
280  virtual ~ScIconSetFormatObj() override;
281 
282  ScIconSetFormat* getCoreObject();
283 
284  // XConditionEntry
285  virtual sal_Int32 SAL_CALL getType() override;
286 
287  // XPropertySet
288  virtual css::uno::Reference< css::beans::XPropertySetInfo >
289  SAL_CALL getPropertySetInfo() override;
290  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
291  const css::uno::Any& aValue ) override;
292  virtual css::uno::Any SAL_CALL getPropertyValue(
293  const OUString& PropertyName ) override;
294  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
295  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
296  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
297  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
298  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
299  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
300  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
301  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
302 
303 private:
307 };
308 
309 class ScIconSetEntryObj : public cppu::WeakImplHelper<css::sheet::XIconSetEntry>
310 {
311 public:
313 
314  virtual ~ScIconSetEntryObj() override;
315 
316  virtual sal_Int32 SAL_CALL getType() override;
317 
318  virtual void SAL_CALL setType(sal_Int32 nType) override;
319 
320  virtual OUString SAL_CALL getFormula() override;
321 
322  virtual void SAL_CALL setFormula(const OUString& rString) override;
323 
324 private:
325  ScColorScaleEntry* getCoreObject();
326 
328  size_t mnPos;
329 };
330 
331 class ScCondDateFormatObj : public cppu::WeakImplHelper<css::beans::XPropertySet,
332  css::sheet::XConditionEntry>
333 {
334 public:
336  const ScCondDateFormatEntry* pFormat);
337 
338  virtual ~ScCondDateFormatObj() override;
339 
340  ScCondDateFormatEntry* getCoreObject();
341 
342  // XConditionEntry
343  virtual sal_Int32 SAL_CALL getType() override;
344 
345  // XPropertySet
346  virtual css::uno::Reference< css::beans::XPropertySetInfo >
347  SAL_CALL getPropertySetInfo() override;
348  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
349  const css::uno::Any& aValue ) override;
350  virtual css::uno::Any SAL_CALL getPropertyValue(
351  const OUString& PropertyName ) override;
352  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
353  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
354  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
355  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
356  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
357  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
358  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
359  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
360 
361 private:
365 };
366 
367 #endif
368 
369 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const ScDataBarFormat * mpFormat
sal_Int32 nIndex
rtl::Reference< ScColorScaleFormatObj > mxParent
bool getType(BSTR name, Type &type)
const ScCondFormatEntry * mpFormat
SfxItemPropertySet maPropSet
SfxItemPropertySet maPropSet
SfxItemPropertySet maPropSet
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
ScDocShell * mpDocShell
rtl::Reference< ScCondFormatsObj > mxCondFormatList
ScDocShell * getDocShell(const css::uno::Reference< css::frame::XModel > &xModel)
SfxItemPropertySet maPropSet
const ScCondDateFormatEntry * mpFormat
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:477
ScDocShell * mpDocShell
SfxItemPropertySet maPropSet
rtl::Reference< ScCondFormatObj > mxParent
unsigned char sal_Bool
bool setPropertyValue(uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName, const uno::Any &aValue)
rtl::Reference< ScCondFormatObj > mxParent
const ScColorScaleFormat * mpFormat
rtl::Reference< ScIconSetFormatObj > mxParent
rtl::Reference< ScCondFormatObj > mxParent
SfxItemPropertySet maPropSet
ScDocShell * mpDocShell
const ScIconSetFormat * mpFormat
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
double getLength(const B2DPolygon &rCandidate)
rtl::Reference< ScCondFormatObj > mxParent
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
rtl::Reference< ScDataBarFormatObj > mxParent
rtl::Reference< ScCondFormatObj > mxParent