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