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/.
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>
22 #include <cppuhelper/implbase.hxx>
23 #include <svl/itemprop.hxx>
24 #include <svl/lstner.hxx>
25 #include <rtl/ref.hxx>
28 class ScConditionalFormatList
;
29 class ScConditionalFormat
;
30 class ScIconSetFormat
;
31 class ScDataBarFormat
;
32 class ScColorScaleFormat
;
33 class ScCondFormatEntry
;
34 class ScColorScaleEntry
;
35 class ScCondDateFormatEntry
;
37 using namespace com::sun::star
;
39 namespace com::sun::star::sheet
{ class XSheetCellRanges
; }
41 class ScCondFormatsObj
: public cppu::WeakImplHelper
<css::sheet::XConditionalFormats
>,
45 ScCondFormatsObj(ScDocShell
* pDocShell
, SCTAB nTab
);
47 virtual ~ScCondFormatsObj() override
;
49 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
51 // XConditionalFormats
52 virtual sal_Int32 SAL_CALL
createByRange(const uno::Reference
<sheet::XSheetCellRanges
>& xRanges
) override
;
54 virtual void SAL_CALL
removeByID( const sal_Int32 nID
) override
;
56 virtual uno::Sequence
< uno::Reference
< sheet::XConditionalFormat
> > SAL_CALL
getConditionalFormats() override
;
58 virtual sal_Int32 SAL_CALL
getLength() override
;
60 ScConditionalFormatList
* getCoreObject();
64 ScDocShell
* mpDocShell
;
67 class ScCondFormatObj
: public cppu::WeakImplHelper
<css::sheet::XConditionalFormat
,
68 css::beans::XPropertySet
>
71 ScCondFormatObj(ScDocShell
* pDocShell
, rtl::Reference
<ScCondFormatsObj
> xCondFormats
, sal_Int32 nKey
);
73 virtual ~ScCondFormatObj() override
;
75 ScDocShell
* getDocShell();
78 virtual void SAL_CALL
createEntry(const sal_Int32 nType
, const sal_Int32 nPos
) override
;
80 virtual void SAL_CALL
removeByIndex(const sal_Int32 nIndex
) override
;
84 virtual uno::Type SAL_CALL
getElementType() override
;
86 virtual sal_Bool SAL_CALL
hasElements() override
;
88 virtual sal_Int32 SAL_CALL
getCount() override
;
90 virtual uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
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
;
108 ScConditionalFormat
* getCoreObject();
111 rtl::Reference
<ScCondFormatsObj
> mxCondFormatList
;
112 ScDocShell
* mpDocShell
;
113 SfxItemPropertySet maPropSet
;
117 class ScConditionEntryObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
118 css::sheet::XConditionEntry
>
122 ScConditionEntryObj(rtl::Reference
<ScCondFormatObj
> const & xParent
,
123 const ScCondFormatEntry
* pFormat
);
124 virtual ~ScConditionEntryObj() override
;
126 ScCondFormatEntry
* getCoreObject();
129 virtual sal_Int32 SAL_CALL
getType() override
;
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
;
148 ScDocShell
* mpDocShell
;
149 rtl::Reference
<ScCondFormatObj
> mxParent
;
150 SfxItemPropertySet maPropSet
;
151 const ScCondFormatEntry
* mpFormat
;
154 class ScColorScaleFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
155 css::sheet::XConditionEntry
>
159 ScColorScaleFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
, const ScColorScaleFormat
* pFormat
);
160 virtual ~ScColorScaleFormatObj() override
;
163 virtual sal_Int32 SAL_CALL
getType() override
;
166 ScColorScaleFormat
* getCoreObject();
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
;
185 rtl::Reference
<ScCondFormatObj
> mxParent
;
186 SfxItemPropertySet maPropSet
;
187 const ScColorScaleFormat
* mpFormat
;
190 class ScColorScaleEntryObj
: public cppu::WeakImplHelper
<css::sheet::XColorScaleEntry
>
193 ScColorScaleEntryObj(rtl::Reference
<ScColorScaleFormatObj
> xParent
, size_t nPos
);
195 virtual ~ScColorScaleEntryObj() override
;
197 virtual sal_Int32 SAL_CALL
getColor() override
;
199 virtual void SAL_CALL
setColor(sal_Int32 aColor
) override
;
201 virtual sal_Int32 SAL_CALL
getType() override
;
203 virtual void SAL_CALL
setType(sal_Int32 nType
) override
;
205 virtual OUString SAL_CALL
getFormula() override
;
207 virtual void SAL_CALL
setFormula(const OUString
& rString
) override
;
210 ScColorScaleEntry
* getCoreObject();
212 rtl::Reference
<ScColorScaleFormatObj
> mxParent
;
216 class ScDataBarFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
217 css::sheet::XConditionEntry
>
220 ScDataBarFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
221 const ScDataBarFormat
* pFormat
);
222 virtual ~ScDataBarFormatObj() override
;
224 ScDataBarFormat
* getCoreObject();
227 virtual sal_Int32 SAL_CALL
getType() override
;
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
;
246 rtl::Reference
<ScCondFormatObj
> mxParent
;
247 SfxItemPropertySet maPropSet
;
248 const ScDataBarFormat
* mpFormat
;
251 class ScDataBarEntryObj
: public cppu::WeakImplHelper
<css::sheet::XDataBarEntry
>
254 ScDataBarEntryObj(rtl::Reference
<ScDataBarFormatObj
> xParent
, size_t nPos
);
256 virtual ~ScDataBarEntryObj() override
;
258 virtual sal_Int32 SAL_CALL
getType() override
;
260 virtual void SAL_CALL
setType(sal_Int32 nType
) override
;
262 virtual OUString SAL_CALL
getFormula() override
;
264 virtual void SAL_CALL
setFormula(const OUString
& rString
) override
;
267 ScColorScaleEntry
* getCoreObject();
269 rtl::Reference
<ScDataBarFormatObj
> mxParent
;
273 class ScIconSetFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
274 css::sheet::XConditionEntry
>
277 ScIconSetFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
278 const ScIconSetFormat
* pFormat
);
279 virtual ~ScIconSetFormatObj() override
;
281 ScIconSetFormat
* getCoreObject();
284 virtual sal_Int32 SAL_CALL
getType() override
;
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
;
303 rtl::Reference
<ScCondFormatObj
> mxParent
;
304 SfxItemPropertySet maPropSet
;
305 const ScIconSetFormat
* mpFormat
;
308 class ScIconSetEntryObj
: public cppu::WeakImplHelper
<css::sheet::XIconSetEntry
>
311 ScIconSetEntryObj(rtl::Reference
<ScIconSetFormatObj
> xParent
, size_t nPos
);
313 virtual ~ScIconSetEntryObj() override
;
315 virtual sal_Int32 SAL_CALL
getType() override
;
317 virtual void SAL_CALL
setType(sal_Int32 nType
) override
;
319 virtual OUString SAL_CALL
getFormula() override
;
321 virtual void SAL_CALL
setFormula(const OUString
& rString
) override
;
324 ScColorScaleEntry
* getCoreObject();
326 rtl::Reference
<ScIconSetFormatObj
> mxParent
;
330 class ScCondDateFormatObj
: public cppu::WeakImplHelper
<css::beans::XPropertySet
,
331 css::sheet::XConditionEntry
>
334 ScCondDateFormatObj(rtl::Reference
<ScCondFormatObj
> xParent
,
335 const ScCondDateFormatEntry
* pFormat
);
337 virtual ~ScCondDateFormatObj() override
;
339 ScCondDateFormatEntry
* getCoreObject();
342 virtual sal_Int32 SAL_CALL
getType() override
;
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
;
361 rtl::Reference
<ScCondFormatObj
> mxParent
;
362 SfxItemPropertySet maPropSet
;
363 const ScCondDateFormatEntry
* mpFormat
;
366 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */