Branch data Line data Source code
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 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "DataSeriesPointWrapper.hxx"
21 : : #include "macros.hxx"
22 : : #include "RegressionCurveHelper.hxx"
23 : : #include "Chart2ModelContact.hxx"
24 : : #include "ChartTypeHelper.hxx"
25 : : #include "DiagramHelper.hxx"
26 : : #include "ContainerHelper.hxx"
27 : : #include "ChartModelHelper.hxx"
28 : : #include "LineProperties.hxx"
29 : : #include "FillProperties.hxx"
30 : : #include "CharacterProperties.hxx"
31 : : #include "UserDefinedProperties.hxx"
32 : : #include "WrappedCharacterHeightProperty.hxx"
33 : : #include "WrappedProperty.hxx"
34 : : #include "WrappedIgnoreProperty.hxx"
35 : : #include "WrappedStatisticProperties.hxx"
36 : : #include "WrappedSymbolProperties.hxx"
37 : : #include "WrappedDataCaptionProperties.hxx"
38 : : #include "WrappedSeriesAreaOrLineProperty.hxx"
39 : : #include "WrappedScaleTextProperties.hxx"
40 : : #include "WrappedNumberFormatProperty.hxx"
41 : : #include "WrappedTextRotationProperty.hxx"
42 : : #include <rtl/ustrbuf.hxx>
43 : : #include <rtl/math.hxx>
44 : :
45 : : #include <algorithm>
46 : : #include <comphelper/InlineContainer.hxx>
47 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
48 : : #include <com/sun/star/chart/ChartAxisAssign.hpp>
49 : : #include <com/sun/star/chart/ChartErrorCategory.hpp>
50 : : #include <com/sun/star/chart/XChartDocument.hpp>
51 : : #include <com/sun/star/drawing/FillStyle.hpp>
52 : : #include <com/sun/star/drawing/LineJoint.hpp>
53 : : #include <com/sun/star/drawing/LineStyle.hpp>
54 : :
55 : : using namespace ::com::sun::star;
56 : : using namespace ::chart::wrapper;
57 : :
58 : : using ::com::sun::star::uno::Reference;
59 : : using ::com::sun::star::uno::Sequence;
60 : : using ::com::sun::star::beans::Property;
61 : : using ::com::sun::star::uno::Any;
62 : : using ::osl::MutexGuard;
63 : :
64 : : namespace
65 : : {
66 : 16 : static const ::rtl::OUString lcl_aServiceName(
67 : : RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.DataSeries" ));
68 : :
69 : : enum
70 : : {
71 : : //data point properties
72 : : PROP_SERIES_DATAPOINT_SOLIDTYPE,
73 : : PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
74 : : PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
75 : : PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
76 : : PROP_SERIES_NUMBERFORMAT,
77 : : PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
78 : : PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
79 : : PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
80 : : //other series properties
81 : : PROP_SERIES_ATTACHED_AXIS,
82 : : PROP_SERIES_DATAPOINT_TEXT_ROTATION
83 : : };
84 : :
85 : 9 : void lcl_AddPropertiesToVector_PointProperties(
86 : : ::std::vector< Property > & rOutProperties )
87 : : {
88 : : //service chart::Chart3DBarProperties
89 : : rOutProperties.push_back(
90 : : Property( "SolidType",
91 : : PROP_SERIES_DATAPOINT_SOLIDTYPE,
92 [ + - ]: 9 : ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
93 : : beans::PropertyAttribute::BOUND
94 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEDEFAULT ));
95 : :
96 : : rOutProperties.push_back(
97 : : Property( "SegmentOffset",
98 : : PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
99 [ + - ]: 9 : ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
100 : : beans::PropertyAttribute::BOUND
101 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEDEFAULT ));
102 : :
103 : : rOutProperties.push_back(
104 : : Property( "D3DPercentDiagonal",
105 : : PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
106 [ + - ]: 9 : ::getCppuType( reinterpret_cast< sal_Int16 * >(0)),
107 : : beans::PropertyAttribute::BOUND
108 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEVOID ));
109 : :
110 : : rOutProperties.push_back(
111 : : Property( "LabelSeparator",
112 : : PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
113 [ + - ]: 9 : ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
114 : : beans::PropertyAttribute::BOUND
115 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEDEFAULT ));
116 : :
117 : : rOutProperties.push_back(
118 : : Property( "NumberFormat",
119 : : PROP_SERIES_NUMBERFORMAT,
120 [ + - ]: 9 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
121 : : beans::PropertyAttribute::BOUND
122 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEVOID ));
123 : :
124 : : rOutProperties.push_back(
125 : : Property( "PercentageNumberFormat",
126 : : PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
127 [ + - ]: 9 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
128 : : beans::PropertyAttribute::BOUND
129 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEVOID ));
130 : :
131 : : rOutProperties.push_back(
132 : : Property( "LabelPlacement",
133 : : PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
134 [ + - ]: 9 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
135 : : beans::PropertyAttribute::BOUND
136 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEVOID ));
137 : :
138 : : rOutProperties.push_back(
139 : : Property( "TextRotation",
140 : : PROP_SERIES_DATAPOINT_TEXT_ROTATION,
141 [ + - ]: 9 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
142 : : beans::PropertyAttribute::BOUND
143 [ + - ]: 9 : | beans::PropertyAttribute::MAYBEDEFAULT ));
144 : 9 : }
145 : :
146 : 7 : void lcl_AddPropertiesToVector_SeriesOnly(
147 : : ::std::vector< Property > & rOutProperties )
148 : : {
149 : : rOutProperties.push_back(
150 : : Property( "Axis",
151 : : PROP_SERIES_ATTACHED_AXIS,
152 [ + - ]: 7 : ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
153 : : beans::PropertyAttribute::BOUND
154 [ + - ]: 7 : | beans::PropertyAttribute::MAYBEDEFAULT ));
155 : :
156 : : rOutProperties.push_back(
157 : : Property( "LinkNumberFormatToSource",
158 : : PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
159 [ + - ]: 7 : ::getBooleanCppuType(),
160 : : beans::PropertyAttribute::BOUND
161 [ + - ]: 7 : | beans::PropertyAttribute::MAYBEDEFAULT ));
162 : 7 : }
163 : :
164 : 9 : uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
165 : : {
166 [ + - ]: 9 : ::std::vector< ::com::sun::star::beans::Property > aProperties;
167 : :
168 [ + - ]: 9 : lcl_AddPropertiesToVector_PointProperties( aProperties );
169 [ + + ]: 9 : if( _eType == DataSeriesPointWrapper::DATA_SERIES )
170 : : {
171 [ + - ]: 7 : lcl_AddPropertiesToVector_SeriesOnly( aProperties );
172 [ + - ]: 7 : WrappedStatisticProperties::addProperties( aProperties );
173 : : }
174 [ + - ]: 9 : WrappedSymbolProperties::addProperties( aProperties ); //for series and points
175 [ + - ]: 9 : WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points
176 : :
177 [ + - ]: 9 : ::chart::FillProperties::AddPropertiesToVector( aProperties );
178 [ + - ]: 9 : ::chart::LineProperties::AddPropertiesToVector( aProperties );
179 [ + - ]: 9 : ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
180 [ + - ]: 9 : ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
181 [ + - ]: 9 : ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
182 : :
183 [ + - ]: 9 : ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() );
184 : :
185 [ + - ]: 9 : return ::chart::ContainerHelper::ContainerToSequence( aProperties );
186 : : }
187 : :
188 : : struct StaticSeriesWrapperPropertyArray_Initializer
189 : : {
190 : 7 : Sequence< Property >* operator()()
191 : : {
192 [ + - ][ + - ]: 7 : static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
[ + - ][ # # ]
193 : 7 : return &aPropSeq;
194 : : }
195 : : };
196 : :
197 : : struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
198 : : {
199 : : };
200 : :
201 : : struct StaticPointWrapperPropertyArray_Initializer
202 : : {
203 : 2 : Sequence< Property >* operator()()
204 : : {
205 [ + - ][ + - ]: 2 : static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
[ + - ][ # # ]
206 : 2 : return &aPropSeq;
207 : : }
208 : : };
209 : :
210 : : struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer >
211 : : {
212 : : };
213 : :
214 : : //----------------------------------------------------------------------------------------------------------------------
215 : :
216 : :
217 : : //PROP_SERIES_ATTACHED_AXIS
218 : : class WrappedAttachedAxisProperty : public ::chart::WrappedProperty
219 : : {
220 : : public:
221 : : WrappedAttachedAxisProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
222 : : virtual ~WrappedAttachedAxisProperty();
223 : :
224 : : virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
225 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
226 : :
227 : : virtual Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
228 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
229 : :
230 : : virtual Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
231 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
232 : :
233 : : protected:
234 : : ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
235 : : };
236 : :
237 : 94 : WrappedAttachedAxisProperty::WrappedAttachedAxisProperty(
238 : : ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
239 : : : WrappedProperty("Axis",rtl::OUString())
240 [ + - ][ + - ]: 94 : , m_spChart2ModelContact( spChart2ModelContact )
241 : : {
242 : 94 : }
243 : :
244 [ + - ]: 94 : WrappedAttachedAxisProperty::~WrappedAttachedAxisProperty()
245 : : {
246 [ - + ]: 188 : }
247 : :
248 : 0 : Any WrappedAttachedAxisProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
249 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
250 : : {
251 : 0 : Any aRet;
252 [ # # ]: 0 : aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
253 : 0 : return aRet;
254 : : }
255 : :
256 : 74 : Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
257 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
258 : : {
259 : 74 : Any aRet;
260 : :
261 [ + - ]: 74 : uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
262 [ + - ]: 74 : bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
263 [ + - ]: 74 : if( bAttachedToMainAxis )
264 [ + - ]: 74 : aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
265 : : else
266 [ # # ]: 0 : aRet <<= ::com::sun::star::chart::ChartAxisAssign::SECONDARY_Y;
267 : 74 : return aRet;
268 : : }
269 : :
270 : 0 : void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
271 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
272 : : {
273 [ # # ]: 0 : uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
274 : :
275 : 0 : sal_Int32 nChartAxisAssign = ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
276 [ # # ]: 0 : if( ! (rOuterValue >>= nChartAxisAssign) )
277 [ # # ][ # # ]: 0 : throw lang::IllegalArgumentException("Property Axis requires value of type sal_Int32", 0, 0 );
278 : :
279 : 0 : bool bNewAttachedToMainAxis = nChartAxisAssign == ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
280 [ # # ]: 0 : bool bOldAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
281 : :
282 [ # # ]: 0 : if( bNewAttachedToMainAxis != bOldAttachedToMainAxis)
283 : : {
284 [ # # ]: 0 : Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
285 [ # # ]: 0 : if( xDiagram.is() )
286 [ # # ]: 0 : ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext, false );
287 : 0 : }
288 : 0 : }
289 : :
290 : : //----------------------------------------------------------------------------------------------------------------------
291 : :
292 : : class WrappedSegmentOffsetProperty : public ::chart::WrappedProperty
293 : : {
294 : : public:
295 : : WrappedSegmentOffsetProperty();
296 : : virtual ~WrappedSegmentOffsetProperty();
297 : :
298 : : protected:
299 : : virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
300 : : virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
301 : : };
302 : :
303 : 96 : WrappedSegmentOffsetProperty::WrappedSegmentOffsetProperty() :
304 [ + - ]: 96 : WrappedProperty("SegmentOffset","Offset")
305 : 96 : {}
306 : :
307 : 96 : WrappedSegmentOffsetProperty::~WrappedSegmentOffsetProperty()
308 [ - + ]: 192 : {}
309 : :
310 : 14 : Any WrappedSegmentOffsetProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
311 : : {
312 : : // convert new double offset to former integer segment-offset
313 : 14 : double fOffset = 0;
314 : 14 : Any aResult( rInnerValue );
315 : :
316 [ + - ]: 14 : if( rInnerValue >>= fOffset )
317 [ + - ]: 14 : aResult <<= static_cast< sal_Int32 >( ::rtl::math::round( fOffset * 100.0 ));
318 : :
319 : 14 : return aResult;
320 : : }
321 : :
322 : 8 : Any WrappedSegmentOffsetProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
323 : : {
324 : : // convert former integer segment-offset to new double offset
325 : 8 : sal_Int32 nOffset = 0;
326 : 8 : Any aResult( rOuterValue );
327 : :
328 [ + - ]: 8 : if( rOuterValue >>= nOffset )
329 [ + - ]: 8 : aResult <<= (static_cast< double >( nOffset ) / 100.0);
330 : :
331 : 8 : return aResult;
332 : : }
333 : :
334 : : //----------------------------------------------------------------------------------------------------------------------
335 : :
336 : : class WrappedLineColorProperty : public WrappedSeriesAreaOrLineProperty
337 : : {
338 : : public:
339 : : WrappedLineColorProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
340 : : virtual ~WrappedLineColorProperty();
341 : :
342 : : virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
343 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
344 : :
345 : : virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
346 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
347 : :
348 : : virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
349 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
350 : :
351 : : protected:
352 : : DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
353 : : mutable Any m_aDefaultValue;
354 : : mutable Any m_aOuterValue;
355 : : };
356 : :
357 : 96 : WrappedLineColorProperty::WrappedLineColorProperty(
358 : : DataSeriesPointWrapper* pDataSeriesPointWrapper )
359 : : : WrappedSeriesAreaOrLineProperty("LineColor","BorderColor","Color", pDataSeriesPointWrapper )
360 : : , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
361 : : , m_aDefaultValue(uno::makeAny(sal_Int32( 0x0099ccff ))) // blue 8
362 [ + - ][ + - ]: 96 : , m_aOuterValue(m_aDefaultValue)
363 : : {
364 : 96 : }
365 : :
366 : 96 : WrappedLineColorProperty::~WrappedLineColorProperty()
367 : : {
368 [ - + ]: 192 : }
369 : :
370 : 18 : void WrappedLineColorProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
371 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
372 : : {
373 [ + - ][ - + ]: 18 : if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
[ - + ]
374 : 0 : m_aOuterValue = rOuterValue;
375 : : else
376 : 18 : WrappedSeriesAreaOrLineProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
377 : 18 : }
378 : :
379 : 0 : void WrappedLineColorProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
380 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
381 : : {
382 [ # # ][ # # ]: 0 : if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
[ # # ]
383 : 0 : m_aOuterValue = m_aDefaultValue;
384 : : else
385 : 0 : WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
386 : 0 : }
387 : :
388 : 0 : Any WrappedLineColorProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
389 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
390 : : {
391 [ # # ][ # # ]: 0 : if( m_pDataSeriesPointWrapper && !m_pDataSeriesPointWrapper->isSupportingAreaProperties() )
[ # # ]
392 : 0 : return m_aDefaultValue;
393 : : else
394 : 0 : return WrappedSeriesAreaOrLineProperty::getPropertyDefault( xInnerPropertyState );
395 : : }
396 : :
397 : : //----------------------------------------------------------------------------------------------------------------------
398 : :
399 : : class WrappedLineStyleProperty : public WrappedSeriesAreaOrLineProperty
400 : : {
401 : : public:
402 : : WrappedLineStyleProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
403 : : virtual ~WrappedLineStyleProperty();
404 : :
405 : : virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
406 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
407 : :
408 : : virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
409 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
410 : :
411 : : protected:
412 : : DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
413 : : mutable Any m_aDefaultValue;
414 : : mutable Any m_aOuterValue;
415 : : };
416 : :
417 : 96 : WrappedLineStyleProperty::WrappedLineStyleProperty(
418 : : DataSeriesPointWrapper* pDataSeriesPointWrapper )
419 : : : WrappedSeriesAreaOrLineProperty("LineStyle","BorderStyle", "LineStyle", pDataSeriesPointWrapper )
420 : : , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
421 : : , m_aDefaultValue(uno::makeAny(drawing::LineStyle_SOLID))
422 [ + - ][ + - ]: 96 : , m_aOuterValue(m_aDefaultValue)
423 : : {
424 : 96 : }
425 : :
426 : 96 : WrappedLineStyleProperty::~WrappedLineStyleProperty()
427 : : {
428 [ - + ]: 192 : }
429 : :
430 : 18 : void WrappedLineStyleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
431 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
432 : : {
433 : 18 : Any aNewValue(rOuterValue);
434 [ - + ][ - + ]: 18 : if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
[ + - ]
435 : : {
436 : 0 : m_aOuterValue = rOuterValue;
437 [ # # ]: 0 : aNewValue = uno::makeAny(drawing::LineStyle_NONE);
438 : : }
439 [ + - ]: 18 : WrappedSeriesAreaOrLineProperty::setPropertyValue( aNewValue, xInnerPropertySet );
440 : 18 : }
441 : :
442 : 0 : void WrappedLineStyleProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
443 : : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
444 : : {
445 [ # # ][ # # ]: 0 : if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
[ # # ]
446 : 0 : m_aOuterValue = m_aDefaultValue;
447 : : else
448 : 0 : WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
449 : 0 : }
450 : :
451 : : } // anonymous namespace
452 : :
453 : :
454 : : // --------------------------------------------------------------------------------
455 : :
456 : : namespace chart
457 : : {
458 : : namespace wrapper
459 : : {
460 : :
461 : 92 : DataSeriesPointWrapper::DataSeriesPointWrapper(
462 : : ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
463 : : : m_spChart2ModelContact( spChart2ModelContact )
464 : : , m_aEventListenerContainer( m_aMutex )
465 : : , m_eType( DATA_SERIES )
466 : : , m_nSeriesIndexInNewAPI( -1 )
467 : : , m_nPointIndex( -1 )
468 : : , m_bLinesAllowed(sal_True)
469 [ + - ][ + - ]: 92 : , m_xDataSeries(0)
[ + - ]
470 : : {
471 : : //need initialize call afterwards
472 : 92 : }
473 : :
474 : 92 : void SAL_CALL DataSeriesPointWrapper::initialize( const uno::Sequence< uno::Any >& aArguments )
475 : : throw ( uno::Exception, uno::RuntimeException)
476 : : {
477 : : OSL_PRECOND(aArguments.getLength() >= 1,"need at least 1 argument to initialize the DataSeriesPointWrapper: series reference + optional datapoint index");
478 : :
479 : 92 : m_nSeriesIndexInNewAPI = -1;//ignored in this case
480 : 92 : m_nPointIndex = -1;
481 [ + - ]: 92 : if( aArguments.getLength() >= 1 )
482 : : {
483 : 92 : aArguments[0] >>= m_xDataSeries;
484 [ - + ]: 92 : if( aArguments.getLength() >= 2 )
485 : 0 : aArguments[1] >>= m_nPointIndex;
486 : : }
487 : :
488 [ - + ]: 92 : if( !m_xDataSeries.is() )
489 : : throw uno::Exception(
490 [ # # ][ # # ]: 0 : "DataSeries index invalid", static_cast< ::cppu::OWeakObject * >( this ));
491 : :
492 : : //todo: check upper border of point index
493 : :
494 [ - + ]: 92 : if( m_nPointIndex >= 0 )
495 : 0 : m_eType = DATA_POINT;
496 : : else
497 : 92 : m_eType = DATA_SERIES;
498 : 92 : }
499 : :
500 : 86 : DataSeriesPointWrapper::DataSeriesPointWrapper( eType _eType
501 : : , sal_Int32 nSeriesIndexInNewAPI
502 : : , sal_Int32 nPointIndex //ignored for series
503 : : , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
504 : : : m_spChart2ModelContact( spChart2ModelContact )
505 : : , m_aEventListenerContainer( m_aMutex )
506 : : , m_eType( _eType )
507 : : , m_nSeriesIndexInNewAPI( nSeriesIndexInNewAPI )
508 : : , m_nPointIndex( (_eType == DATA_POINT) ? nPointIndex : -1 )
509 [ + - ][ + - ]: 86 : , m_xDataSeries(0)
[ + + ][ + - ]
510 : : {
511 : 86 : }
512 : :
513 [ + - ][ + - ]: 178 : DataSeriesPointWrapper::~DataSeriesPointWrapper()
514 : : {
515 [ - + ]: 356 : }
516 : :
517 : : // ____ XComponent ____
518 : 0 : void SAL_CALL DataSeriesPointWrapper::dispose()
519 : : throw (uno::RuntimeException)
520 : : {
521 [ # # ]: 0 : uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
522 [ # # ][ # # ]: 0 : m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
[ # # ]
523 : :
524 : 0 : m_xDataSeries.clear();
525 [ # # ]: 0 : clearWrappedPropertySet();
526 : 0 : }
527 : :
528 : 0 : void SAL_CALL DataSeriesPointWrapper::addEventListener(
529 : : const uno::Reference< lang::XEventListener >& xListener )
530 : : throw (uno::RuntimeException)
531 : : {
532 : 0 : m_aEventListenerContainer.addInterface( xListener );
533 : 0 : }
534 : :
535 : 0 : void SAL_CALL DataSeriesPointWrapper::removeEventListener(
536 : : const uno::Reference< lang::XEventListener >& aListener )
537 : : throw (uno::RuntimeException)
538 : : {
539 : 0 : m_aEventListenerContainer.removeInterface( aListener );
540 : 0 : }
541 : :
542 : : // ____ XEventListener ____
543 : 0 : void SAL_CALL DataSeriesPointWrapper::disposing( const lang::EventObject& /*Source*/ )
544 : : throw (uno::RuntimeException)
545 : : {
546 : 0 : }
547 : :
548 : : // ================================================================================
549 : :
550 : 498 : bool DataSeriesPointWrapper::isSupportingAreaProperties()
551 : : {
552 [ + - ]: 498 : Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
553 [ + - ]: 498 : Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
554 [ + - ]: 498 : Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
555 [ + - ]: 498 : sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
556 : :
557 [ + - ]: 498 : return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
558 : : }
559 : :
560 : 36 : bool DataSeriesPointWrapper::isLinesForbidden()
561 : : {
562 : 36 : return !m_bLinesAllowed;
563 : : }
564 : :
565 : 11118 : Reference< chart2::XDataSeries > DataSeriesPointWrapper::getDataSeries()
566 : : {
567 : 11118 : Reference< chart2::XDataSeries > xSeries( m_xDataSeries );
568 [ + + ]: 11118 : if( !xSeries.is() )
569 : : {
570 [ + - ]: 1568 : Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
571 : : ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
572 [ + - ]: 1568 : ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
573 : :
574 [ + - ][ + - ]: 1568 : if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) )
[ + - ]
575 [ + - ]: 1568 : xSeries = aSeriesList[m_nSeriesIndexInNewAPI];
576 : : }
577 : :
578 : 11118 : return xSeries;
579 : : }
580 : :
581 : 1560 : Reference< beans::XPropertySet > DataSeriesPointWrapper::getDataPointProperties()
582 : : {
583 : 1560 : Reference< beans::XPropertySet > xPointProp;
584 : :
585 [ + - ]: 1560 : Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
586 : :
587 : : // may throw an IllegalArgumentException
588 [ + - ]: 1560 : if( xSeries.is() )
589 [ + - ][ + - ]: 1560 : xPointProp = xSeries->getDataPointByIndex( m_nPointIndex );
[ + - ]
590 : :
591 : 1560 : return xPointProp;
592 : : }
593 : :
594 : : // ================================================================================
595 : :
596 : : //ReferenceSizePropertyProvider
597 : 80 : void DataSeriesPointWrapper::updateReferenceSize()
598 : : {
599 [ + - ][ + - ]: 80 : Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
600 [ + - ]: 80 : if( xProp.is() )
601 : : {
602 [ + - ][ + - ]: 80 : if( xProp->getPropertyValue("ReferencePageSize").hasValue() )
[ - + ]
603 [ # # ]: 0 : xProp->setPropertyValue("ReferencePageSize", uno::makeAny(
604 [ # # ][ # # ]: 0 : m_spChart2ModelContact->GetPageSize() ));
[ # # ]
605 : 80 : }
606 : 80 : }
607 : 268 : Any DataSeriesPointWrapper::getReferenceSize()
608 : : {
609 : 268 : Any aRet;
610 [ + - ][ + - ]: 268 : Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
611 [ + - ]: 268 : if( xProp.is() )
612 [ + - ][ + - ]: 268 : aRet = xProp->getPropertyValue("ReferencePageSize");
613 : 268 : return aRet;
614 : : }
615 : 0 : awt::Size DataSeriesPointWrapper::getCurrentSizeForReference()
616 : : {
617 : 0 : return m_spChart2ModelContact->GetPageSize();
618 : : }
619 : :
620 : : // ================================================================================
621 : :
622 : : // WrappedPropertySet
623 : :
624 : : //XPropertyState
625 : 7178 : beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
626 : : throw (beans::UnknownPropertyException, uno::RuntimeException)
627 : : {
628 : 7178 : beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
629 : :
630 [ + - ]: 7178 : if( m_eType == DATA_SERIES )
631 : 7178 : aState = WrappedPropertySet::getPropertyState( rPropertyName );
632 : : else
633 : : {
634 [ # # ]: 0 : if( rPropertyName == "FillColor")
635 : : {
636 [ # # ][ # # ]: 0 : Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
637 : 0 : sal_Bool bVaryColorsByPoint = sal_False;
638 [ # # ][ # # ]: 0 : if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ][ # # ]
639 : : && bVaryColorsByPoint )
640 [ # # ]: 0 : return beans::PropertyState_DIRECT_VALUE;
641 : : }
642 [ # # # # : 0 : else if( rPropertyName == "Lines"
# # ][ # # ]
643 : 0 : || rPropertyName == "SymbolType"
644 : 0 : || rPropertyName == "SymbolSize" )
645 [ # # ]: 0 : return WrappedPropertySet::getPropertyState( rPropertyName );
646 : :
647 [ # # ]: 0 : uno::Any aDefault( getPropertyDefault( rPropertyName ) );
648 [ # # ]: 0 : uno::Any aValue( getPropertyValue( rPropertyName ) );
649 [ # # ]: 0 : if( aDefault==aValue )
650 : 0 : aState = beans::PropertyState_DEFAULT_VALUE;
651 : : }
652 : 7178 : return aState;
653 : : }
654 : :
655 : 0 : void SAL_CALL DataSeriesPointWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
656 : : throw (beans::UnknownPropertyException, uno::RuntimeException)
657 : : {
658 [ # # ]: 0 : if( m_eType == DATA_SERIES )
659 : 0 : WrappedPropertySet::setPropertyToDefault( rPropertyName );
660 : : else
661 : : {
662 : : //for data points the default is given by the series
663 [ # # ]: 0 : setPropertyValue( rPropertyName, getPropertyDefault( rPropertyName ) );
664 : : }
665 : 0 : }
666 : 0 : Any SAL_CALL DataSeriesPointWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
667 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
668 : : {
669 : 0 : Any aRet;
670 : : try
671 : : {
672 [ # # ][ # # ]: 0 : sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
673 [ # # ]: 0 : if( nHandle > 0 )
674 : : {
675 : : //always take the series current value as default for points
676 [ # # ][ # # ]: 0 : Reference< beans::XPropertySet > xInnerPropertySet( getDataSeries(), uno::UNO_QUERY );
677 [ # # ]: 0 : if( xInnerPropertySet.is() )
678 : : {
679 [ # # ]: 0 : const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
680 [ # # ]: 0 : if( pWrappedProperty )
681 [ # # ]: 0 : aRet = pWrappedProperty->getPropertyValue(xInnerPropertySet);
682 : : else
683 [ # # ][ # # ]: 0 : aRet = xInnerPropertySet->getPropertyValue( rPropertyName );
684 : 0 : }
685 : : }
686 : : }
687 [ # # # # ]: 0 : catch( const beans::UnknownPropertyException& )
688 : : {
689 [ # # ]: 0 : aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
690 : : }
691 : 0 : return aRet;
692 : : }
693 : :
694 : 10616 : Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
695 : : {
696 [ + + ]: 10616 : if( m_eType == DATA_SERIES )
697 [ + - ]: 9056 : return Reference< beans::XPropertySet >( getDataSeries(), uno::UNO_QUERY );
698 : 10616 : return getDataPointProperties();
699 : : }
700 : :
701 : 96 : const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
702 : : {
703 [ + + ]: 96 : if( m_eType == DATA_SERIES )
704 : 94 : return *StaticSeriesWrapperPropertyArray::get();
705 : : else
706 : 96 : return *StaticPointWrapperPropertyArray::get();
707 : : }
708 : :
709 : 96 : const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties()
710 : : {
711 : 96 : ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
712 : :
713 [ + - ]: 96 : WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
714 : :
715 [ + + ]: 96 : if( m_eType == DATA_SERIES )
716 : : {
717 [ + - ][ + - ]: 94 : WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
[ + - ]
718 [ + - ][ + - ]: 94 : aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
[ + - ][ + - ]
[ + - ]
719 : :
720 [ + - ][ + - ]: 94 : WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
[ + - ][ + - ]
721 [ + - ]: 94 : aWrappedProperties.push_back( pWrappedNumberFormatProperty );
722 [ + - ][ + - ]: 94 : aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
[ + - ]
723 : : }
724 : :
725 [ + - ][ + - ]: 96 : WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
[ + - ]
726 [ + - ][ + - ]: 96 : WrappedDataCaptionProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
[ + - ]
727 [ + - ][ + - ]: 96 : WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
[ + - ]
728 : :
729 : : //add unnamed line properties (different inner names here)
730 : :
731 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillColor","Color") );
[ + - ]
732 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedLineStyleProperty( this ) );
[ + - ]
733 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedLineColorProperty( this ) );
[ + - ]
734 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineDashName","BorderDashName","LineDashName", this ) );
[ + - ]
735 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineTransparence","BorderTransparency","Transparency", this ) );
[ + - ]
736 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineWidth","BorderWidth","LineWidth", this ) );
[ + - ]
737 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillStyle","FillStyle" ) );
[ + - ]
738 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillTransparence","Transparency") );
[ + - ]
739 : :
740 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedIgnoreProperty("LineJoint", uno::makeAny( drawing::LineJoint_ROUND ) ) );
[ + - ][ + - ]
741 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillTransparenceGradientName","TransparencyGradientName") );
[ + - ]
742 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillGradientName","GradientName") );
[ + - ]
743 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillGradientStepCount","GradientStepCount") );
[ + - ]
744 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillHatchName","HatchName") );
[ + - ]
745 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapName","FillBitmapName") );
[ + - ]
746 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBackground","FillBackground") );
[ + - ]
747 : :
748 : : //bitmap properties
749 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapMode","FillBitmapMode") );
[ + - ]
750 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapSizeX","FillBitmapSizeX") );
[ + - ]
751 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapSizeY","FillBitmapSizeY") );
[ + - ]
752 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapLogicalSize","FillBitmapLogicalSize") );
[ + - ]
753 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapOffsetX","FillBitmapOffsetX") );
[ + - ]
754 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapOffsetY","FillBitmapOffsetY") );
[ + - ]
755 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapRectanglePoint","FillBitmapRectanglePoint") );
[ + - ]
756 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapPositionOffsetX","FillBitmapPositionOffsetX") );
[ + - ]
757 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("FillBitmapPositionOffsetY","FillBitmapPositionOffsetY") );
[ + - ]
758 : :
759 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("SolidType","Geometry3D") );
[ + - ]
760 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedSegmentOffsetProperty() );
[ + - ]
761 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedProperty("D3DPercentDiagonal","PercentDiagonal") );
[ + - ]
762 : :
763 [ + - ][ + - ]: 96 : aWrappedProperties.push_back( new WrappedTextRotationProperty() );
[ + - ]
764 : :
765 : 96 : return aWrappedProperties;
766 : : }
767 : :
768 : 978 : void SAL_CALL DataSeriesPointWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const Any& rValue )
769 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
770 : : {
771 [ - + ]: 978 : if(rPropertyName == "Lines")
772 : : {
773 [ # # ]: 0 : if( ! (rValue >>= m_bLinesAllowed) )
774 [ # # ][ # # ]: 0 : throw lang::IllegalArgumentException("Property Lines requires value of type sal_Bool", 0, 0 );
775 : : }
776 : :
777 : 978 : sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
778 [ + - ][ + - ]: 978 : static const sal_Int32 nErrorCategoryHandle = getInfoHelper().getHandleByName("ErrorCategory");
[ + - ][ # # ]
[ + + ]
779 [ - + ]: 978 : if( nErrorCategoryHandle == nHandle )
780 : : {
781 : 0 : ::com::sun::star::chart::ChartErrorCategory aNewValue = ::com::sun::star::chart::ChartErrorCategory_NONE;
782 [ # # ]: 0 : rValue >>= aNewValue;
783 : 0 : Any aLow, aHigh;
784 : 0 : bool bSetHighAndLowValues = false;
785 [ # # # # ]: 0 : switch(aNewValue)
786 : : {
787 : : case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
788 [ # # ]: 0 : aHigh = this->getPropertyValue("ConstantErrorHigh");
789 [ # # ]: 0 : aLow = this->getPropertyValue("ConstantErrorLow");
790 : 0 : bSetHighAndLowValues = true;
791 : 0 : break;
792 : : case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
793 [ # # ]: 0 : aHigh = aLow = this->getPropertyValue("PercentageError");
794 : 0 : bSetHighAndLowValues = true;
795 : 0 : break;
796 : : case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
797 [ # # ]: 0 : aHigh = aLow = this->getPropertyValue("ErrorMargin");
798 : 0 : bSetHighAndLowValues = true;
799 : 0 : break;
800 : : default:
801 : 0 : break;
802 : : }
803 : :
804 [ # # ]: 0 : WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
805 : :
806 [ # # ]: 0 : if(bSetHighAndLowValues)
807 : : {
808 [ # # # # ]: 0 : switch(aNewValue)
809 : : {
810 : : case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
811 [ # # ]: 0 : this->setPropertyValue("ConstantErrorHigh",aHigh);
812 [ # # ]: 0 : this->setPropertyValue("ConstantErrorLow",aLow);
813 : 0 : break;
814 : : case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
815 [ # # ]: 0 : this->setPropertyValue("PercentageError",aHigh);
816 : 0 : break;
817 : : case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
818 [ # # ]: 0 : this->setPropertyValue("ErrorMargin",aHigh);
819 : 0 : break;
820 : : default:
821 : 0 : break;
822 : : }
823 : 0 : }
824 : : }
825 : : else
826 : 978 : WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
827 : 978 : }
828 : :
829 : 1792 : Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const rtl::OUString& rPropertyName )
830 : : throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
831 : : {
832 [ + + ]: 1792 : if( m_eType == DATA_POINT )
833 : : {
834 [ + + ]: 756 : if( rPropertyName == "FillColor" )
835 : : {
836 [ + - ][ + - ]: 4 : Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
837 : 4 : sal_Bool bVaryColorsByPoint = sal_False;
838 [ + - ][ + - ]: 4 : if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint)
[ + - ][ - + ]
[ + - ][ + - ]
[ + - ][ - +
# # # # #
# ][ + - ]
839 : : && bVaryColorsByPoint )
840 : : {
841 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY );
842 [ # # ][ # # ]: 0 : if( xPointState.is() && xPointState->getPropertyState("Color") == beans::PropertyState_DEFAULT_VALUE )
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
843 : : {
844 [ # # ]: 0 : Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
845 [ # # ]: 0 : if( xDiagram.is() )
846 : : {
847 [ # # ][ # # ]: 0 : Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
848 [ # # ]: 0 : if( xColorScheme.is() )
849 [ # # ][ # # ]: 0 : return uno::makeAny( xColorScheme->getColorByIndex( m_nPointIndex ) );
[ # # ][ # # ]
850 [ # # ]: 0 : }
851 [ # # ]: 4 : }
852 [ + - ]: 4 : }
853 : : }
854 : : }
855 : 1792 : return WrappedPropertySet::getPropertyValue( rPropertyName );
856 : : }
857 : :
858 : : // ================================================================================
859 : :
860 : 4 : uno::Sequence< ::rtl::OUString > DataSeriesPointWrapper::getSupportedServiceNames_Static()
861 : : {
862 : 4 : uno::Sequence< ::rtl::OUString > aServices( 7 );
863 [ + - ]: 4 : aServices[ 0 ] = "com.sun.star.chart.ChartDataRowProperties";
864 [ + - ]: 4 : aServices[ 1 ] = "com.sun.star.chart.ChartDataPointProperties";
865 [ + - ]: 4 : aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributeSupplier";
866 [ + - ]: 4 : aServices[ 3 ] = "com.sun.star.beans.PropertySet";
867 [ + - ]: 4 : aServices[ 4 ] = "com.sun.star.drawing.FillProperties";
868 [ + - ]: 4 : aServices[ 5 ] = "com.sun.star.drawing.LineProperties";
869 [ + - ]: 4 : aServices[ 6 ] = "com.sun.star.style.CharacterProperties";
870 : :
871 : 4 : return aServices;
872 : : }
873 : :
874 : : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
875 [ + - ][ + - ]: 28 : APPHELPER_XSERVICEINFO_IMPL( DataSeriesPointWrapper, lcl_aServiceName );
[ + + ][ + - ]
[ + - ]
876 : :
877 : : } // namespace wrapper
878 [ + - ][ + - ]: 48 : } // namespace chart
879 : :
880 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|