LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/chartapiwrapper - DataSeriesPointWrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 354 0.6 %
Date: 2012-12-27 Functions: 2 58 3.4 %
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 "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           1 : 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           0 : 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           0 :                   ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
      93             :                   beans::PropertyAttribute::BOUND
      94           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      95             : 
      96             :     rOutProperties.push_back(
      97             :         Property( "SegmentOffset",
      98             :                   PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
      99           0 :                   ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
     100             :                   beans::PropertyAttribute::BOUND
     101           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     102             : 
     103             :     rOutProperties.push_back(
     104             :         Property( "D3DPercentDiagonal",
     105             :                   PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
     106           0 :                   ::getCppuType( reinterpret_cast< sal_Int16 * >(0)),
     107             :                   beans::PropertyAttribute::BOUND
     108           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     109             : 
     110             :     rOutProperties.push_back(
     111             :         Property( "LabelSeparator",
     112             :                   PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
     113           0 :                   ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
     114             :                   beans::PropertyAttribute::BOUND
     115           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     116             : 
     117             :     rOutProperties.push_back(
     118             :         Property( "NumberFormat",
     119             :                   PROP_SERIES_NUMBERFORMAT,
     120           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     121             :                   beans::PropertyAttribute::BOUND
     122           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     123             : 
     124             :     rOutProperties.push_back(
     125             :         Property( "PercentageNumberFormat",
     126             :                   PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
     127           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     128             :                   beans::PropertyAttribute::BOUND
     129           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     130             : 
     131             :     rOutProperties.push_back(
     132             :         Property( "LabelPlacement",
     133             :                   PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
     134           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     135             :                   beans::PropertyAttribute::BOUND
     136           0 :                   | beans::PropertyAttribute::MAYBEVOID ));
     137             : 
     138             :     rOutProperties.push_back(
     139             :         Property( "TextRotation",
     140             :                   PROP_SERIES_DATAPOINT_TEXT_ROTATION,
     141           0 :                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
     142             :                   beans::PropertyAttribute::BOUND
     143           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     144           0 : }
     145             : 
     146           0 : void lcl_AddPropertiesToVector_SeriesOnly(
     147             :     ::std::vector< Property > & rOutProperties )
     148             : {
     149             :     rOutProperties.push_back(
     150             :         Property( "Axis",
     151             :                   PROP_SERIES_ATTACHED_AXIS,
     152           0 :                   ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
     153             :                   beans::PropertyAttribute::BOUND
     154           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     155             : 
     156             :     rOutProperties.push_back(
     157             :         Property( "LinkNumberFormatToSource",
     158             :                   PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
     159           0 :                   ::getBooleanCppuType(),
     160             :                   beans::PropertyAttribute::BOUND
     161           0 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     162           0 : }
     163             : 
     164           0 : uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
     165             : {
     166           0 :     ::std::vector< ::com::sun::star::beans::Property > aProperties;
     167             : 
     168           0 :     lcl_AddPropertiesToVector_PointProperties( aProperties );
     169           0 :     if( _eType == DataSeriesPointWrapper::DATA_SERIES )
     170             :     {
     171           0 :         lcl_AddPropertiesToVector_SeriesOnly( aProperties );
     172           0 :         WrappedStatisticProperties::addProperties( aProperties );
     173             :     }
     174           0 :     WrappedSymbolProperties::addProperties( aProperties ); //for series and  points
     175           0 :     WrappedDataCaptionProperties::addProperties( aProperties ); //for series and  points
     176             : 
     177           0 :     ::chart::FillProperties::AddPropertiesToVector( aProperties );
     178           0 :     ::chart::LineProperties::AddPropertiesToVector( aProperties );
     179           0 :     ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
     180           0 :     ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
     181           0 :     ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
     182             : 
     183           0 :     ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() );
     184             : 
     185           0 :     return ::chart::ContainerHelper::ContainerToSequence( aProperties );
     186             : }
     187             : 
     188             : struct StaticSeriesWrapperPropertyArray_Initializer
     189             : {
     190           0 :     Sequence< Property >* operator()()
     191             :     {
     192           0 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
     193           0 :         return &aPropSeq;
     194             :     }
     195             : };
     196             : 
     197             : struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
     198             : {
     199             : };
     200             : 
     201             : struct StaticPointWrapperPropertyArray_Initializer
     202             : {
     203           0 :     Sequence< Property >* operator()()
     204             :     {
     205           0 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
     206           0 :         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           0 : WrappedAttachedAxisProperty::WrappedAttachedAxisProperty(
     238             :                 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     239             :                 : WrappedProperty("Axis",rtl::OUString())
     240           0 :             , m_spChart2ModelContact( spChart2ModelContact )
     241             : {
     242           0 : }
     243             : 
     244           0 : WrappedAttachedAxisProperty::~WrappedAttachedAxisProperty()
     245             : {
     246           0 : }
     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           0 : Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
     257             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     258             : {
     259           0 :     Any aRet;
     260             : 
     261           0 :     uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
     262           0 :     bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
     263           0 :     if( bAttachedToMainAxis )
     264           0 :         aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
     265             :     else
     266           0 :         aRet <<= ::com::sun::star::chart::ChartAxisAssign::SECONDARY_Y;
     267           0 :     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           0 : WrappedSegmentOffsetProperty::WrappedSegmentOffsetProperty() :
     304           0 :         WrappedProperty("SegmentOffset","Offset")
     305           0 : {}
     306             : 
     307           0 : WrappedSegmentOffsetProperty::~WrappedSegmentOffsetProperty()
     308           0 : {}
     309             : 
     310           0 : Any WrappedSegmentOffsetProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
     311             : {
     312             :     // convert new double offset to former integer segment-offset
     313           0 :     double fOffset = 0;
     314           0 :     Any aResult( rInnerValue );
     315             : 
     316           0 :     if( rInnerValue >>= fOffset )
     317           0 :         aResult <<= static_cast< sal_Int32 >( ::rtl::math::round( fOffset * 100.0 ));
     318             : 
     319           0 :     return aResult;
     320             : }
     321             : 
     322           0 : Any WrappedSegmentOffsetProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
     323             : {
     324             :     // convert former integer segment-offset to new double offset
     325           0 :     sal_Int32 nOffset = 0;
     326           0 :     Any aResult( rOuterValue );
     327             : 
     328           0 :     if( rOuterValue >>= nOffset )
     329           0 :         aResult <<= (static_cast< double >( nOffset ) / 100.0);
     330             : 
     331           0 :     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           0 : 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           0 :                 , m_aOuterValue(m_aDefaultValue)
     363             : {
     364           0 : }
     365             : 
     366           0 : WrappedLineColorProperty::~WrappedLineColorProperty()
     367             : {
     368           0 : }
     369             : 
     370           0 : 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           0 :     if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
     374           0 :         m_aOuterValue = rOuterValue;
     375             :     else
     376           0 :         WrappedSeriesAreaOrLineProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
     377           0 : }
     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           0 : WrappedLineStyleProperty::WrappedLineStyleProperty(
     418             :                 DataSeriesPointWrapper* pDataSeriesPointWrapper )
     419             :                 : WrappedSeriesAreaOrLineProperty("LineStyle","BorderStyle", "LineStyle", pDataSeriesPointWrapper )
     420             :                 , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
     421             :                 , m_aDefaultValue(uno::makeAny(drawing::LineStyle_SOLID))
     422           0 :                 , m_aOuterValue(m_aDefaultValue)
     423             : {
     424           0 : }
     425             : 
     426           0 : WrappedLineStyleProperty::~WrappedLineStyleProperty()
     427             : {
     428           0 : }
     429             : 
     430           0 : 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           0 :     Any aNewValue(rOuterValue);
     434           0 :     if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
     435             :     {
     436           0 :         m_aOuterValue = rOuterValue;
     437           0 :         aNewValue = uno::makeAny(drawing::LineStyle_NONE);
     438             :     }
     439           0 :     WrappedSeriesAreaOrLineProperty::setPropertyValue( aNewValue, xInnerPropertySet );
     440           0 : }
     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           0 : 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           0 :         , m_xDataSeries(0)
     470             : {
     471             :     //need initialize call afterwards
     472           0 : }
     473             : 
     474           0 : 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           0 :     m_nSeriesIndexInNewAPI = -1;//ignored in this case
     480           0 :     m_nPointIndex = -1;
     481           0 :     if( aArguments.getLength() >= 1 )
     482             :     {
     483           0 :         aArguments[0] >>= m_xDataSeries;
     484           0 :         if( aArguments.getLength() >= 2 )
     485           0 :             aArguments[1] >>= m_nPointIndex;
     486             :     }
     487             : 
     488           0 :     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           0 :     if( m_nPointIndex >= 0 )
     495           0 :         m_eType = DATA_POINT;
     496             :     else
     497           0 :         m_eType = DATA_SERIES;
     498           0 : }
     499             : 
     500           0 : 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           0 :         , m_xDataSeries(0)
     510             : {
     511           0 : }
     512             : 
     513           0 : DataSeriesPointWrapper::~DataSeriesPointWrapper()
     514             : {
     515           0 : }
     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           0 : bool DataSeriesPointWrapper::isSupportingAreaProperties()
     551             : {
     552           0 :     Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
     553           0 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     554           0 :     Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
     555           0 :     sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
     556             : 
     557           0 :     return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
     558             : }
     559             : 
     560           0 : bool DataSeriesPointWrapper::isLinesForbidden()
     561             : {
     562           0 :     return !m_bLinesAllowed;
     563             : }
     564             : 
     565           0 : Reference< chart2::XDataSeries > DataSeriesPointWrapper::getDataSeries()
     566             : {
     567           0 :     Reference< chart2::XDataSeries > xSeries( m_xDataSeries );
     568           0 :     if( !xSeries.is() )
     569             :     {
     570           0 :         Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     571             :         ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
     572           0 :             ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
     573             : 
     574           0 :         if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) )
     575           0 :             xSeries = aSeriesList[m_nSeriesIndexInNewAPI];
     576             :     }
     577             : 
     578           0 :     return xSeries;
     579             : }
     580             : 
     581           0 : Reference< beans::XPropertySet > DataSeriesPointWrapper::getDataPointProperties()
     582             : {
     583           0 :     Reference< beans::XPropertySet > xPointProp;
     584             : 
     585           0 :     Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
     586             : 
     587             :     // may throw an IllegalArgumentException
     588           0 :     if( xSeries.is() )
     589           0 :         xPointProp = xSeries->getDataPointByIndex( m_nPointIndex );
     590             : 
     591           0 :     return xPointProp;
     592             : }
     593             : 
     594             : // ================================================================================
     595             : 
     596             : //ReferenceSizePropertyProvider
     597           0 : void DataSeriesPointWrapper::updateReferenceSize()
     598             : {
     599           0 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
     600           0 :     if( xProp.is() )
     601             :     {
     602           0 :         if( xProp->getPropertyValue("ReferencePageSize").hasValue() )
     603           0 :             xProp->setPropertyValue("ReferencePageSize", uno::makeAny(
     604           0 :                 m_spChart2ModelContact->GetPageSize() ));
     605           0 :     }
     606           0 : }
     607           0 : Any DataSeriesPointWrapper::getReferenceSize()
     608             : {
     609           0 :     Any aRet;
     610           0 :     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
     611           0 :     if( xProp.is() )
     612           0 :         aRet = xProp->getPropertyValue("ReferencePageSize");
     613           0 :     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           0 : beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
     626             :                                     throw (beans::UnknownPropertyException, uno::RuntimeException)
     627             : {
     628           0 :     beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
     629             : 
     630           0 :     if( m_eType == DATA_SERIES )
     631           0 :         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           0 :     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           0 : Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
     695             : {
     696           0 :     if( m_eType == DATA_SERIES )
     697           0 :         return Reference< beans::XPropertySet >( getDataSeries(), uno::UNO_QUERY );
     698           0 :     return getDataPointProperties();
     699             : }
     700             : 
     701           0 : const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
     702             : {
     703           0 :     if( m_eType == DATA_SERIES )
     704           0 :         return *StaticSeriesWrapperPropertyArray::get();
     705             :     else
     706           0 :         return *StaticPointWrapperPropertyArray::get();
     707             : }
     708             : 
     709           0 : const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties()
     710             : {
     711           0 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     712             : 
     713           0 :     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     714             : 
     715           0 :     if( m_eType == DATA_SERIES )
     716             :     {
     717           0 :         WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
     718           0 :         aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
     719             : 
     720           0 :         WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
     721           0 :         aWrappedProperties.push_back( pWrappedNumberFormatProperty );
     722           0 :         aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
     723             :     }
     724             : 
     725           0 :     WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
     726           0 :     WrappedDataCaptionProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
     727           0 :     WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
     728             : 
     729             :     //add unnamed line properties (different inner names here)
     730             : 
     731           0 :     aWrappedProperties.push_back( new WrappedProperty("FillColor","Color") );
     732           0 :     aWrappedProperties.push_back( new WrappedLineStyleProperty( this ) );
     733           0 :     aWrappedProperties.push_back( new WrappedLineColorProperty( this ) );
     734           0 :     aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineDashName","BorderDashName","LineDashName", this ) );
     735           0 :     aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineTransparence","BorderTransparency","Transparency", this ) );
     736           0 :     aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty("LineWidth","BorderWidth","LineWidth", this ) );
     737           0 :     aWrappedProperties.push_back( new WrappedProperty("FillStyle","FillStyle" ) );
     738           0 :     aWrappedProperties.push_back( new WrappedProperty("FillTransparence","Transparency") );
     739             : 
     740           0 :     aWrappedProperties.push_back( new WrappedIgnoreProperty("LineJoint", uno::makeAny( drawing::LineJoint_ROUND ) ) );
     741           0 :     aWrappedProperties.push_back( new WrappedProperty("FillTransparenceGradientName","TransparencyGradientName") );
     742           0 :     aWrappedProperties.push_back( new WrappedProperty("FillGradientName","GradientName") );
     743           0 :     aWrappedProperties.push_back( new WrappedProperty("FillGradientStepCount","GradientStepCount") );
     744           0 :     aWrappedProperties.push_back( new WrappedProperty("FillHatchName","HatchName") );
     745           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapName","FillBitmapName") );
     746           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBackground","FillBackground") );
     747             : 
     748             :     //bitmap properties
     749           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapMode","FillBitmapMode") );
     750           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapSizeX","FillBitmapSizeX") );
     751           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapSizeY","FillBitmapSizeY") );
     752           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapLogicalSize","FillBitmapLogicalSize") );
     753           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapOffsetX","FillBitmapOffsetX") );
     754           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapOffsetY","FillBitmapOffsetY") );
     755           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapRectanglePoint","FillBitmapRectanglePoint") );
     756           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapPositionOffsetX","FillBitmapPositionOffsetX") );
     757           0 :     aWrappedProperties.push_back( new WrappedProperty("FillBitmapPositionOffsetY","FillBitmapPositionOffsetY") );
     758             : 
     759           0 :     aWrappedProperties.push_back( new WrappedProperty("SolidType","Geometry3D") );
     760           0 :     aWrappedProperties.push_back( new WrappedSegmentOffsetProperty() );
     761           0 :     aWrappedProperties.push_back( new WrappedProperty("D3DPercentDiagonal","PercentDiagonal") );
     762             : 
     763           0 :     aWrappedProperties.push_back( new WrappedTextRotationProperty() );
     764             : 
     765           0 :     return aWrappedProperties;
     766             : }
     767             : 
     768           0 : 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           0 :     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           0 :     sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
     778           0 :     static const sal_Int32 nErrorCategoryHandle = getInfoHelper().getHandleByName("ErrorCategory");
     779           0 :     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           0 :         WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
     827           0 : }
     828             : 
     829           0 : Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const rtl::OUString& rPropertyName )
     830             :                 throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     831             : {
     832           0 :     if( m_eType == DATA_POINT )
     833             :     {
     834           0 :         if( rPropertyName == "FillColor" )
     835             :         {
     836           0 :             Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
     837           0 :             sal_Bool bVaryColorsByPoint = sal_False;
     838           0 :             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           0 :                 }
     852           0 :             }
     853             :         }
     854             :     }
     855           0 :     return WrappedPropertySet::getPropertyValue( rPropertyName );
     856             : }
     857             : 
     858             : // ================================================================================
     859             : 
     860           0 : uno::Sequence< ::rtl::OUString > DataSeriesPointWrapper::getSupportedServiceNames_Static()
     861             : {
     862           0 :     uno::Sequence< ::rtl::OUString > aServices( 7 );
     863           0 :     aServices[ 0 ] = "com.sun.star.chart.ChartDataRowProperties";
     864           0 :     aServices[ 1 ] = "com.sun.star.chart.ChartDataPointProperties";
     865           0 :     aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
     866           0 :     aServices[ 3 ] =  "com.sun.star.beans.PropertySet";
     867           0 :     aServices[ 4 ] = "com.sun.star.drawing.FillProperties";
     868           0 :     aServices[ 5 ] = "com.sun.star.drawing.LineProperties";
     869           0 :     aServices[ 6 ] = "com.sun.star.style.CharacterProperties";
     870             : 
     871           0 :     return aServices;
     872             : }
     873             : 
     874             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     875           0 : APPHELPER_XSERVICEINFO_IMPL( DataSeriesPointWrapper, lcl_aServiceName );
     876             : 
     877             : } //  namespace wrapper
     878           3 : } //  namespace chart
     879             : 
     880             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10