LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - DataSeriesPointWrapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 284 385 73.8 %
Date: 2015-06-13 12:38:46 Functions: 43 55 78.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11