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 INCLUDED_SC_SOURCE_UI_INC_CONDFORMATUNO_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATUNO_HXX
13 #include "address.hxx"
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>
23 #include <cppuhelper/implbase.hxx>
24 #include <svl/itemprop.hxx>
25 #include <svl/lstner.hxx>
26 #include <rtl/ref.hxx>
30 class ScConditionalFormatList
;
31 class ScConditionalFormat
;
32 class ScIconSetFormat
;
33 class ScDataBarFormat
;
34 class ScColorScaleFormat
;
35 class ScCondFormatEntry
;
36 class ScColorScaleEntry
;
37 class ScCondDateFormatEntry
;
39 using namespace com::sun::star
;
41 namespace com
{ namespace sun
{ namespace star
{
45 class XSheetCellRanges
;
51 class ScCondFormatsObj
: public cppu::WeakImplHelper
<css::sheet::XConditionalFormats
>,
55 ScCondFormatsObj(ScDocShell
* pDocShell
, SCTAB nTab
);
57 virtual ~ScCondFormatsObj();
59 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
61 // XConditionalFormats
62 virtual sal_Int32 SAL_CALL
createByRange(const uno::Reference
<sheet::XSheetCellRanges
>& xRanges
)
63 throw(css::uno::RuntimeException
, std::exception
) override
;
65 virtual void SAL_CALL
removeByID( const sal_Int32 nID
)
66 throw(css::uno::RuntimeException
,
67 std::exception
) override
;
69 virtual uno::Sequence
< uno::Reference
< sheet::XConditionalFormat
> > SAL_CALL
getConditionalFormats()
70 throw(css::uno::RuntimeException
,
71 std::exception
) override
;
73 virtual sal_Int32 SAL_CALL
getLength()
74 throw(css::uno::RuntimeException
,
75 std::exception
) override
;
77 ScConditionalFormatList
* getCoreObject();
81 ScDocShell
* mpDocShell
;
84 class ScCondFormatObj
: public cppu::WeakImplHelper
<css::sheet::XConditionalFormat
,
85 css::beans::XPropertySet
>
88 ScCondFormatObj(ScDocShell
* pDocShell
, rtl::Reference
<ScCondFormatsObj
> xCondFormats
, sal_Int32 nKey
);
90 virtual ~ScCondFormatObj();
92 ScDocShell
* getDocShell();
95 virtual void SAL_CALL
createEntry(const sal_Int32 nType
, const sal_Int32 nPos
)
96 throw(css::uno::RuntimeException
, std::exception
) override
;
98 virtual void SAL_CALL
removeByIndex(const sal_Int32 nIndex
)
99 throw(css::uno::RuntimeException
,
100 std::exception
) override
;
104 virtual uno::Type SAL_CALL
getElementType()
105 throw(css::uno::RuntimeException
,
106 std::exception
) override
;
108 virtual sal_Bool SAL_CALL
hasElements()
109 throw(css::uno::RuntimeException
,
110 std::exception
) override
;
112 virtual sal_Int32 SAL_CALL
getCount()
113 throw(css::uno::RuntimeException
,
114 std::exception
) override
;
116 virtual uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
)
117 throw(css::uno::RuntimeException
,
118 std::exception
) override
;
121 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
122 SAL_CALL
getPropertySetInfo()
123 throw(css::uno::RuntimeException
, std::exception
) override
;
124 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
125 const css::uno::Any
& aValue
)
126 throw(css::beans::UnknownPropertyException
,
127 css::beans::PropertyVetoException
,
128 css::lang::IllegalArgumentException
,
129 css::lang::WrappedTargetException
,
130 css::uno::RuntimeException
, std::exception
) override
;
131 virtual css::uno::Any SAL_CALL
getPropertyValue(
132 const OUString
& PropertyName
)
133 throw(css::beans::UnknownPropertyException
,
134 css::lang::WrappedTargetException
,
135 css::uno::RuntimeException
, std::exception
) override
;
136 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
137 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
138 throw(css::beans::UnknownPropertyException
,
139 css::lang::WrappedTargetException
,
140 css::uno::RuntimeException
, std::exception
) override
;
141 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
142 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
143 throw(css::beans::UnknownPropertyException
,
144 css::lang::WrappedTargetException
,
145 css::uno::RuntimeException
, std::exception
) override
;
146 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
147 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
148 throw(css::beans::UnknownPropertyException
,
149 css::lang::WrappedTargetException
,
150 css::uno::RuntimeException
, std::exception
) override
;
151 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
152 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
153 throw(css::beans::UnknownPropertyException
,
154 css::lang::WrappedTargetException
,
155 css::uno::RuntimeException
, std::exception
) override
;
157 ScConditionalFormat
* getCoreObject();
160 rtl::Reference
<ScCondFormatsObj
> mxCondFormatList
;
161 ScDocShell
* mpDocShell
;
162 SfxItemPropertySet maPropSet
;
166 class ScConditionEntryObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
167 css::sheet::XConditionEntry
>
171 ScConditionEntryObj(rtl::Reference
<ScCondFormatObj
> xParent
,
172 const ScCondFormatEntry
* pFormat
);
173 virtual ~ScConditionEntryObj();
175 ScCondFormatEntry
* getCoreObject();
178 virtual sal_Int32 SAL_CALL
getType()
179 throw(css::uno::RuntimeException
, std::exception
) override
;
182 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
183 SAL_CALL
getPropertySetInfo()
184 throw(css::uno::RuntimeException
, std::exception
) override
;
185 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
186 const css::uno::Any
& aValue
)
187 throw(css::beans::UnknownPropertyException
,
188 css::beans::PropertyVetoException
,
189 css::lang::IllegalArgumentException
,
190 css::lang::WrappedTargetException
,
191 css::uno::RuntimeException
, std::exception
) override
;
192 virtual css::uno::Any SAL_CALL
getPropertyValue(
193 const OUString
& PropertyName
)
194 throw(css::beans::UnknownPropertyException
,
195 css::lang::WrappedTargetException
,
196 css::uno::RuntimeException
, std::exception
) override
;
197 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
198 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
199 throw(css::beans::UnknownPropertyException
,
200 css::lang::WrappedTargetException
,
201 css::uno::RuntimeException
, std::exception
) override
;
202 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
203 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
204 throw(css::beans::UnknownPropertyException
,
205 css::lang::WrappedTargetException
,
206 css::uno::RuntimeException
, std::exception
) override
;
207 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
208 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
209 throw(css::beans::UnknownPropertyException
,
210 css::lang::WrappedTargetException
,
211 css::uno::RuntimeException
, std::exception
) override
;
212 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
213 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
214 throw(css::beans::UnknownPropertyException
,
215 css::lang::WrappedTargetException
,
216 css::uno::RuntimeException
, std::exception
) override
;
219 ScDocShell
* mpDocShell
;
220 rtl::Reference
<ScCondFormatObj
> mxParent
;
221 SfxItemPropertySet maPropSet
;
222 const ScCondFormatEntry
* mpFormat
;
225 class ScColorScaleFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
226 css::sheet::XConditionEntry
>
230 ScColorScaleFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
, const ScColorScaleFormat
* pFormat
);
231 virtual ~ScColorScaleFormatObj();
234 virtual sal_Int32 SAL_CALL
getType()
235 throw(css::uno::RuntimeException
, std::exception
) override
;
238 ScColorScaleFormat
* getCoreObject();
241 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
242 SAL_CALL
getPropertySetInfo()
243 throw(css::uno::RuntimeException
, std::exception
) override
;
244 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
245 const css::uno::Any
& aValue
)
246 throw(css::beans::UnknownPropertyException
,
247 css::beans::PropertyVetoException
,
248 css::lang::IllegalArgumentException
,
249 css::lang::WrappedTargetException
,
250 css::uno::RuntimeException
, std::exception
) override
;
251 virtual css::uno::Any SAL_CALL
getPropertyValue(
252 const OUString
& PropertyName
)
253 throw(css::beans::UnknownPropertyException
,
254 css::lang::WrappedTargetException
,
255 css::uno::RuntimeException
, std::exception
) override
;
256 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
257 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
258 throw(css::beans::UnknownPropertyException
,
259 css::lang::WrappedTargetException
,
260 css::uno::RuntimeException
, std::exception
) override
;
261 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
262 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
263 throw(css::beans::UnknownPropertyException
,
264 css::lang::WrappedTargetException
,
265 css::uno::RuntimeException
, std::exception
) override
;
266 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
267 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
268 throw(css::beans::UnknownPropertyException
,
269 css::lang::WrappedTargetException
,
270 css::uno::RuntimeException
, std::exception
) override
;
271 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
272 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
273 throw(css::beans::UnknownPropertyException
,
274 css::lang::WrappedTargetException
,
275 css::uno::RuntimeException
, std::exception
) override
;
278 rtl::Reference
<ScCondFormatObj
> mxParent
;
279 SfxItemPropertySet maPropSet
;
280 const ScColorScaleFormat
* mpFormat
;
283 class ScColorScaleEntryObj
: public cppu::WeakImplHelper
<css::sheet::XColorScaleEntry
>
286 ScColorScaleEntryObj(rtl::Reference
<ScColorScaleFormatObj
> xParent
, size_t nPos
);
288 virtual ~ScColorScaleEntryObj();
290 virtual css::util::Color SAL_CALL
getColor()
291 throw(css::uno::RuntimeException
, std::exception
) override
;
293 virtual void SAL_CALL
setColor(css::util::Color aColor
)
294 throw(css::uno::RuntimeException
, std::exception
) override
;
296 virtual sal_Int32 SAL_CALL
getType()
297 throw(css::uno::RuntimeException
, std::exception
) override
;
299 virtual void SAL_CALL
setType(sal_Int32 nType
)
300 throw(css::uno::RuntimeException
, std::exception
) override
;
302 virtual OUString SAL_CALL
getFormula()
303 throw(css::uno::RuntimeException
, std::exception
) override
;
305 virtual void SAL_CALL
setFormula(const OUString
& rString
)
306 throw(css::uno::RuntimeException
, std::exception
) override
;
309 ScColorScaleEntry
* getCoreObject();
311 rtl::Reference
<ScColorScaleFormatObj
> mxParent
;
315 class ScDataBarFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
316 css::sheet::XConditionEntry
>
319 ScDataBarFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
320 const ScDataBarFormat
* pFormat
);
321 virtual ~ScDataBarFormatObj();
323 ScDataBarFormat
* getCoreObject();
326 virtual sal_Int32 SAL_CALL
getType()
327 throw(css::uno::RuntimeException
, std::exception
) override
;
330 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
331 SAL_CALL
getPropertySetInfo()
332 throw(css::uno::RuntimeException
, std::exception
) override
;
333 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
334 const css::uno::Any
& aValue
)
335 throw(css::beans::UnknownPropertyException
,
336 css::beans::PropertyVetoException
,
337 css::lang::IllegalArgumentException
,
338 css::lang::WrappedTargetException
,
339 css::uno::RuntimeException
, std::exception
) override
;
340 virtual css::uno::Any SAL_CALL
getPropertyValue(
341 const OUString
& PropertyName
)
342 throw(css::beans::UnknownPropertyException
,
343 css::lang::WrappedTargetException
,
344 css::uno::RuntimeException
, std::exception
) override
;
345 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
346 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
347 throw(css::beans::UnknownPropertyException
,
348 css::lang::WrappedTargetException
,
349 css::uno::RuntimeException
, std::exception
) override
;
350 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
351 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
352 throw(css::beans::UnknownPropertyException
,
353 css::lang::WrappedTargetException
,
354 css::uno::RuntimeException
, std::exception
) override
;
355 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
356 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
357 throw(css::beans::UnknownPropertyException
,
358 css::lang::WrappedTargetException
,
359 css::uno::RuntimeException
, std::exception
) override
;
360 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
361 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
362 throw(css::beans::UnknownPropertyException
,
363 css::lang::WrappedTargetException
,
364 css::uno::RuntimeException
, std::exception
) override
;
367 rtl::Reference
<ScCondFormatObj
> mxParent
;
368 SfxItemPropertySet maPropSet
;
369 const ScDataBarFormat
* mpFormat
;
372 class ScDataBarEntryObj
: public cppu::WeakImplHelper
<css::sheet::XDataBarEntry
>
375 ScDataBarEntryObj(rtl::Reference
<ScDataBarFormatObj
> xParent
, size_t nPos
);
377 virtual ~ScDataBarEntryObj();
379 virtual sal_Int32 SAL_CALL
getType()
380 throw(css::uno::RuntimeException
, std::exception
) override
;
382 virtual void SAL_CALL
setType(sal_Int32 nType
)
383 throw(css::uno::RuntimeException
, std::exception
) override
;
385 virtual OUString SAL_CALL
getFormula()
386 throw(css::uno::RuntimeException
, std::exception
) override
;
388 virtual void SAL_CALL
setFormula(const OUString
& rString
)
389 throw(css::uno::RuntimeException
, std::exception
) override
;
392 ScColorScaleEntry
* getCoreObject();
394 rtl::Reference
<ScDataBarFormatObj
> mxParent
;
398 class ScIconSetFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
399 css::sheet::XConditionEntry
>
402 ScIconSetFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
403 const ScIconSetFormat
* pFormat
);
404 virtual ~ScIconSetFormatObj();
406 ScIconSetFormat
* getCoreObject();
409 virtual sal_Int32 SAL_CALL
getType()
410 throw(css::uno::RuntimeException
, std::exception
) override
;
413 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
414 SAL_CALL
getPropertySetInfo()
415 throw(css::uno::RuntimeException
, std::exception
) override
;
416 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
417 const css::uno::Any
& aValue
)
418 throw(css::beans::UnknownPropertyException
,
419 css::beans::PropertyVetoException
,
420 css::lang::IllegalArgumentException
,
421 css::lang::WrappedTargetException
,
422 css::uno::RuntimeException
, std::exception
) override
;
423 virtual css::uno::Any SAL_CALL
getPropertyValue(
424 const OUString
& PropertyName
)
425 throw(css::beans::UnknownPropertyException
,
426 css::lang::WrappedTargetException
,
427 css::uno::RuntimeException
, std::exception
) override
;
428 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
429 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
430 throw(css::beans::UnknownPropertyException
,
431 css::lang::WrappedTargetException
,
432 css::uno::RuntimeException
, std::exception
) override
;
433 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
434 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
435 throw(css::beans::UnknownPropertyException
,
436 css::lang::WrappedTargetException
,
437 css::uno::RuntimeException
, std::exception
) override
;
438 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
439 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
440 throw(css::beans::UnknownPropertyException
,
441 css::lang::WrappedTargetException
,
442 css::uno::RuntimeException
, std::exception
) override
;
443 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
444 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
445 throw(css::beans::UnknownPropertyException
,
446 css::lang::WrappedTargetException
,
447 css::uno::RuntimeException
, std::exception
) override
;
450 rtl::Reference
<ScCondFormatObj
> mxParent
;
451 SfxItemPropertySet maPropSet
;
452 const ScIconSetFormat
* mpFormat
;
455 class ScIconSetEntryObj
: public cppu::WeakImplHelper
<css::sheet::XIconSetEntry
>
458 ScIconSetEntryObj(rtl::Reference
<ScIconSetFormatObj
> xParent
, size_t nPos
);
460 virtual ~ScIconSetEntryObj();
462 virtual sal_Int32 SAL_CALL
getType()
463 throw(css::uno::RuntimeException
, std::exception
) override
;
465 virtual void SAL_CALL
setType(sal_Int32 nType
)
466 throw(css::uno::RuntimeException
, std::exception
) override
;
468 virtual OUString SAL_CALL
getFormula()
469 throw(css::uno::RuntimeException
, std::exception
) override
;
471 virtual void SAL_CALL
setFormula(const OUString
& rString
)
472 throw(css::uno::RuntimeException
, std::exception
) override
;
475 ScColorScaleEntry
* getCoreObject();
477 rtl::Reference
<ScIconSetFormatObj
> mxParent
;
481 class ScCondDateFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
482 css::sheet::XConditionEntry
>
485 ScCondDateFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
486 const ScCondDateFormatEntry
* pFormat
);
488 virtual ~ScCondDateFormatObj();
490 ScCondDateFormatEntry
* getCoreObject();
493 virtual sal_Int32 SAL_CALL
getType()
494 throw(css::uno::RuntimeException
, std::exception
) override
;
497 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
498 SAL_CALL
getPropertySetInfo()
499 throw(css::uno::RuntimeException
, std::exception
) override
;
500 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
501 const css::uno::Any
& aValue
)
502 throw(css::beans::UnknownPropertyException
,
503 css::beans::PropertyVetoException
,
504 css::lang::IllegalArgumentException
,
505 css::lang::WrappedTargetException
,
506 css::uno::RuntimeException
, std::exception
) override
;
507 virtual css::uno::Any SAL_CALL
getPropertyValue(
508 const OUString
& PropertyName
)
509 throw(css::beans::UnknownPropertyException
,
510 css::lang::WrappedTargetException
,
511 css::uno::RuntimeException
, std::exception
) override
;
512 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
513 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
)
514 throw(css::beans::UnknownPropertyException
,
515 css::lang::WrappedTargetException
,
516 css::uno::RuntimeException
, std::exception
) override
;
517 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
518 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
)
519 throw(css::beans::UnknownPropertyException
,
520 css::lang::WrappedTargetException
,
521 css::uno::RuntimeException
, std::exception
) override
;
522 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
523 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
524 throw(css::beans::UnknownPropertyException
,
525 css::lang::WrappedTargetException
,
526 css::uno::RuntimeException
, std::exception
) override
;
527 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
528 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
)
529 throw(css::beans::UnknownPropertyException
,
530 css::lang::WrappedTargetException
,
531 css::uno::RuntimeException
, std::exception
) override
;
534 rtl::Reference
<ScCondFormatObj
> mxParent
;
535 SfxItemPropertySet maPropSet
;
536 const ScCondDateFormatEntry
* mpFormat
;
541 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */