2010-10-12 15:59:00 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-07-17 12:30:48 +01:00
/*
* This file is part of the LibreOffice project .
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at http : //mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice :
*
* Licensed to the Apache Software Foundation ( ASF ) under one or more
* contributor license agreements . See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership . The ASF licenses this file to you under the Apache
* License , Version 2.0 ( the " License " ) ; you may not use this file
* except in compliance with the License . You may obtain a copy of
* the License at http : //www.apache.org/licenses/LICENSE-2.0 .
*/
2006-09-17 11:55:49 +00:00
2003-12-18 12:50:56 +00:00
# include "DataSeriesPointWrapper.hxx"
# include "macros.hxx"
2003-12-19 14:07:03 +00:00
# include "RegressionCurveHelper.hxx"
2007-05-22 16:17:29 +00:00
# include "Chart2ModelContact.hxx"
# include "ChartTypeHelper.hxx"
# include "DiagramHelper.hxx"
# include "ContainerHelper.hxx"
# include "ChartModelHelper.hxx"
2013-04-21 02:49:04 +02:00
# include "LinePropertiesHelper.hxx"
2007-05-22 16:17:29 +00:00
# include "FillProperties.hxx"
# include "CharacterProperties.hxx"
# include "UserDefinedProperties.hxx"
# include "WrappedCharacterHeightProperty.hxx"
# include "WrappedProperty.hxx"
# include "WrappedIgnoreProperty.hxx"
# include "WrappedStatisticProperties.hxx"
# include "WrappedSymbolProperties.hxx"
# include "WrappedDataCaptionProperties.hxx"
# include "WrappedSeriesAreaOrLineProperty.hxx"
2008-10-01 07:35:04 +00:00
# include "WrappedScaleTextProperties.hxx"
2009-07-02 19:17:43 +00:00
# include "WrappedNumberFormatProperty.hxx"
2009-06-04 09:41:18 +00:00
# include "WrappedTextRotationProperty.hxx"
2014-06-17 11:41:06 -04:00
# include <unonames.hxx>
2007-05-22 16:17:29 +00:00
# include <rtl/ustrbuf.hxx>
# include <rtl/math.hxx>
# include <algorithm>
# include <comphelper/InlineContainer.hxx>
2014-12-09 08:30:11 +02:00
# include <cppuhelper/supportsservice.hxx>
2003-12-18 12:50:56 +00:00
# include <com/sun/star/beans/PropertyAttribute.hpp>
# include <com/sun/star/chart/ChartAxisAssign.hpp>
2003-12-19 14:07:03 +00:00
# include <com/sun/star/chart/ChartErrorCategory.hpp>
2007-05-22 16:17:29 +00:00
# include <com/sun/star/chart/XChartDocument.hpp>
# include <com/sun/star/drawing/FillStyle.hpp>
# include <com/sun/star/drawing/LineJoint.hpp>
# include <com/sun/star/drawing/LineStyle.hpp>
2003-12-18 12:50:56 +00:00
using namespace : : com : : sun : : star ;
2007-05-22 16:17:29 +00:00
using namespace : : chart : : wrapper ;
using : : com : : sun : : star : : uno : : Reference ;
using : : com : : sun : : star : : uno : : Sequence ;
2003-12-18 12:50:56 +00:00
using : : com : : sun : : star : : beans : : Property ;
2007-05-22 16:17:29 +00:00
using : : com : : sun : : star : : uno : : Any ;
2003-12-18 12:50:56 +00:00
using : : osl : : MutexGuard ;
namespace
{
2014-11-03 14:03:54 +02:00
static const char lcl_aServiceName [ ] = " com.sun.star.comp.chart.DataSeries " ;
2003-12-18 12:50:56 +00:00
enum
{
2007-05-22 16:17:29 +00:00
//data point properties
PROP_SERIES_DATAPOINT_SOLIDTYPE ,
PROP_SERIES_DATAPOINT_SEGMENT_OFFSET ,
PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL ,
2007-10-22 15:42:13 +00:00
PROP_SERIES_DATAPOINT_LABEL_SEPARATOR ,
PROP_SERIES_NUMBERFORMAT ,
2009-07-02 19:17:43 +00:00
PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE ,
2007-10-22 15:42:13 +00:00
PROP_SERIES_PERCENTAGE_NUMBERFORMAT ,
2007-11-23 10:45:10 +00:00
PROP_SERIES_DATAPOINT_LABEL_PLACEMENT ,
2007-05-22 16:17:29 +00:00
//other series properties
2009-06-04 09:41:18 +00:00
PROP_SERIES_ATTACHED_AXIS ,
2014-07-26 14:44:38 -04:00
PROP_SERIES_DATAPOINT_TEXT_ROTATION ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_STYLE ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_COLOR ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_TRANS
2003-12-18 12:50:56 +00:00
} ;
2007-05-22 16:17:29 +00:00
void lcl_AddPropertiesToVector_PointProperties (
2003-12-18 12:50:56 +00:00
: : std : : vector < Property > & rOutProperties )
{
2007-05-22 16:17:29 +00:00
//service chart::Chart3DBarProperties
2003-12-18 12:50:56 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " SolidType " ,
2007-05-22 16:17:29 +00:00
PROP_SERIES_DATAPOINT_SOLIDTYPE ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2003-12-18 12:50:56 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " SegmentOffset " ,
2007-05-22 16:17:29 +00:00
PROP_SERIES_DATAPOINT_SEGMENT_OFFSET ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2003-12-18 12:50:56 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
2003-12-19 14:07:03 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " D3DPercentDiagonal " ,
2007-05-22 16:17:29 +00:00
PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int16 > : : get ( ) ,
2003-12-19 14:07:03 +00:00
beans : : PropertyAttribute : : BOUND
2007-05-22 16:17:29 +00:00
| beans : : PropertyAttribute : : MAYBEVOID ) ) ;
2007-10-22 15:42:13 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " LabelSeparator " ,
2007-10-22 15:42:13 +00:00
PROP_SERIES_DATAPOINT_LABEL_SEPARATOR ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < OUString > : : get ( ) ,
2007-10-22 15:42:13 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
rOutProperties . push_back (
2014-06-17 11:41:06 -04:00
Property ( CHART_UNONAME_NUMFMT ,
2007-10-22 15:42:13 +00:00
PROP_SERIES_NUMBERFORMAT ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2007-10-22 15:42:13 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEVOID ) ) ;
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " PercentageNumberFormat " ,
2007-10-22 15:42:13 +00:00
PROP_SERIES_PERCENTAGE_NUMBERFORMAT ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2007-10-22 15:42:13 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEVOID ) ) ;
2007-11-23 10:45:10 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " LabelPlacement " ,
2007-11-23 10:45:10 +00:00
PROP_SERIES_DATAPOINT_LABEL_PLACEMENT ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2007-11-23 10:45:10 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEVOID ) ) ;
2009-06-04 09:41:18 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " TextRotation " ,
2009-06-04 09:41:18 +00:00
PROP_SERIES_DATAPOINT_TEXT_ROTATION ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2009-06-04 09:41:18 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
2014-07-26 14:44:38 -04:00
rOutProperties . push_back (
Property ( CHART_UNONAME_LABEL_BORDER_STYLE ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_STYLE ,
cppu : : UnoType < drawing : : LineStyle > : : get ( ) ,
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
rOutProperties . push_back (
Property ( CHART_UNONAME_LABEL_BORDER_WIDTH ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH ,
cppu : : UnoType < sal_Int32 > : : get ( ) ,
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
rOutProperties . push_back (
Property ( CHART_UNONAME_LABEL_BORDER_COLOR ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_COLOR ,
cppu : : UnoType < sal_Int32 > : : get ( ) ,
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEVOID // "maybe auto"
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
rOutProperties . push_back (
Property ( CHART_UNONAME_LABEL_BORDER_TRANS ,
PROP_SERIES_DATAPOINT_LABEL_BORDER_TRANS ,
cppu : : UnoType < sal_Int16 > : : get ( ) ,
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
void lcl_AddPropertiesToVector_SeriesOnly (
: : std : : vector < Property > & rOutProperties )
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
rOutProperties . push_back (
2012-04-08 10:47:56 -04:30
Property ( " Axis " ,
2007-05-22 16:17:29 +00:00
PROP_SERIES_ATTACHED_AXIS ,
2014-05-18 00:35:50 +02:00
cppu : : UnoType < sal_Int32 > : : get ( ) ,
2007-05-22 16:17:29 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
2009-07-02 19:17:43 +00:00
rOutProperties . push_back (
2014-06-17 11:41:06 -04:00
Property ( CHART_UNONAME_LINK_TO_SRC_NUMFMT ,
2009-07-02 19:17:43 +00:00
PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE ,
2015-04-01 08:35:38 +02:00
cppu : : UnoType < bool > : : get ( ) ,
2009-07-02 19:17:43 +00:00
beans : : PropertyAttribute : : BOUND
| beans : : PropertyAttribute : : MAYBEDEFAULT ) ) ;
2003-12-18 12:50:56 +00:00
}
2010-10-05 11:10:54 +02:00
uno : : Sequence < Property > lcl_GetPropertySequence ( DataSeriesPointWrapper : : eType _eType )
2003-12-18 12:50:56 +00:00
{
2010-10-05 11:10:54 +02:00
: : std : : vector < : : com : : sun : : star : : beans : : Property > aProperties ;
2003-12-18 12:50:56 +00:00
2010-10-05 11:10:54 +02:00
lcl_AddPropertiesToVector_PointProperties ( aProperties ) ;
if ( _eType = = DataSeriesPointWrapper : : DATA_SERIES )
2003-12-18 12:50:56 +00:00
{
2010-10-05 11:10:54 +02:00
lcl_AddPropertiesToVector_SeriesOnly ( aProperties ) ;
WrappedStatisticProperties : : addProperties ( aProperties ) ;
}
WrappedSymbolProperties : : addProperties ( aProperties ) ; //for series and points
WrappedDataCaptionProperties : : addProperties ( aProperties ) ; //for series and points
2007-05-22 16:17:29 +00:00
2010-10-05 11:10:54 +02:00
: : chart : : FillProperties : : AddPropertiesToVector ( aProperties ) ;
2013-04-21 02:49:04 +02:00
: : chart : : LinePropertiesHelper : : AddPropertiesToVector ( aProperties ) ;
2010-10-05 11:10:54 +02:00
: : chart : : CharacterProperties : : AddPropertiesToVector ( aProperties ) ;
: : chart : : UserDefinedProperties : : AddPropertiesToVector ( aProperties ) ;
: : chart : : wrapper : : WrappedScaleTextProperties : : addProperties ( aProperties ) ;
2007-05-22 16:17:29 +00:00
2010-10-05 11:10:54 +02:00
: : std : : sort ( aProperties . begin ( ) , aProperties . end ( ) , : : chart : : PropertyNameLess ( ) ) ;
2003-12-18 12:50:56 +00:00
2010-10-05 11:10:54 +02:00
return : : chart : : ContainerHelper : : ContainerToSequence ( aProperties ) ;
}
2003-12-18 12:50:56 +00:00
2010-10-05 11:10:54 +02:00
struct StaticSeriesWrapperPropertyArray_Initializer
{
Sequence < Property > * operator ( ) ( )
{
static Sequence < Property > aPropSeq ( lcl_GetPropertySequence ( DataSeriesPointWrapper : : DATA_SERIES ) ) ;
return & aPropSeq ;
2003-12-18 12:50:56 +00:00
}
2010-10-05 11:10:54 +02:00
} ;
2003-12-18 12:50:56 +00:00
2010-10-05 11:10:54 +02:00
struct StaticSeriesWrapperPropertyArray : public rtl : : StaticAggregate < Sequence < Property > , StaticSeriesWrapperPropertyArray_Initializer >
{
} ;
struct StaticPointWrapperPropertyArray_Initializer
{
Sequence < Property > * operator ( ) ( )
{
static Sequence < Property > aPropSeq ( lcl_GetPropertySequence ( DataSeriesPointWrapper : : DATA_POINT ) ) ;
return & aPropSeq ;
}
} ;
struct StaticPointWrapperPropertyArray : public rtl : : StaticAggregate < Sequence < Property > , StaticPointWrapperPropertyArray_Initializer >
{
} ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
//PROP_SERIES_ATTACHED_AXIS
class WrappedAttachedAxisProperty : public : : chart : : WrappedProperty
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
public :
WrappedAttachedAxisProperty ( : : boost : : shared_ptr < Chart2ModelContact > spChart2ModelContact ) ;
virtual ~ WrappedAttachedAxisProperty ( ) ;
virtual void setPropertyValue ( const Any & rOuterValue , const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertySet > & xInnerPropertySet ) const
2014-03-27 18:12:18 +01:00
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 ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
virtual Any getPropertyValue ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertySet > & xInnerPropertySet ) const
2014-03-27 18:12:18 +01:00
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : lang : : WrappedTargetException , : : com : : sun : : star : : uno : : RuntimeException ) SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
virtual Any getPropertyDefault ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertyState > & xInnerPropertyState ) const
2014-03-27 18:12:18 +01:00
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : lang : : WrappedTargetException , : : com : : sun : : star : : uno : : RuntimeException ) SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
protected :
: : boost : : shared_ptr < Chart2ModelContact > m_spChart2ModelContact ;
} ;
WrappedAttachedAxisProperty : : WrappedAttachedAxisProperty (
: : boost : : shared_ptr < Chart2ModelContact > spChart2ModelContact )
2013-01-05 13:01:09 -02:00
: WrappedProperty ( " Axis " , OUString ( ) )
2007-05-22 16:17:29 +00:00
, m_spChart2ModelContact ( spChart2ModelContact )
{
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
WrappedAttachedAxisProperty : : ~ WrappedAttachedAxisProperty ( )
{
}
2007-07-25 07:26:45 +00:00
Any WrappedAttachedAxisProperty : : getPropertyDefault ( const Reference < beans : : XPropertyState > & /*xInnerPropertyState*/ ) const
2007-05-22 16:17:29 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
Any aRet ;
aRet < < = : : com : : sun : : star : : chart : : ChartAxisAssign : : PRIMARY_Y ;
return aRet ;
}
Any WrappedAttachedAxisProperty : : getPropertyValue ( const Reference < beans : : XPropertySet > & xInnerPropertySet ) const
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
Any aRet ;
uno : : Reference < chart2 : : XDataSeries > xDataSeries ( xInnerPropertySet , uno : : UNO_QUERY ) ;
bool bAttachedToMainAxis = : : chart : : DiagramHelper : : isSeriesAttachedToMainAxis ( xDataSeries ) ;
if ( bAttachedToMainAxis )
aRet < < = : : com : : sun : : star : : chart : : ChartAxisAssign : : PRIMARY_Y ;
else
aRet < < = : : com : : sun : : star : : chart : : ChartAxisAssign : : SECONDARY_Y ;
return aRet ;
}
void WrappedAttachedAxisProperty : : setPropertyValue ( const Any & rOuterValue , const Reference < beans : : XPropertySet > & xInnerPropertySet ) const
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException )
{
uno : : Reference < chart2 : : XDataSeries > xDataSeries ( xInnerPropertySet , uno : : UNO_QUERY ) ;
sal_Int32 nChartAxisAssign = : : com : : sun : : star : : chart : : ChartAxisAssign : : PRIMARY_Y ;
if ( ! ( rOuterValue > > = nChartAxisAssign ) )
2012-04-08 10:47:56 -04:30
throw lang : : IllegalArgumentException ( " Property Axis requires value of type sal_Int32 " , 0 , 0 ) ;
2007-05-22 16:17:29 +00:00
bool bNewAttachedToMainAxis = nChartAxisAssign = = : : com : : sun : : star : : chart : : ChartAxisAssign : : PRIMARY_Y ;
bool bOldAttachedToMainAxis = : : chart : : DiagramHelper : : isSeriesAttachedToMainAxis ( xDataSeries ) ;
if ( bNewAttachedToMainAxis ! = bOldAttachedToMainAxis )
{
Reference < chart2 : : XDiagram > xDiagram ( m_spChart2ModelContact - > getChart2Diagram ( ) ) ;
if ( xDiagram . is ( ) )
2010-03-09 17:58:27 +01:00
: : chart : : DiagramHelper : : attachSeriesToAxis ( bNewAttachedToMainAxis , xDataSeries , xDiagram , m_spChart2ModelContact - > m_xContext , false ) ;
2007-05-22 16:17:29 +00:00
}
}
class WrappedSegmentOffsetProperty : public : : chart : : WrappedProperty
{
public :
WrappedSegmentOffsetProperty ( ) ;
virtual ~ WrappedSegmentOffsetProperty ( ) ;
protected :
2014-03-27 18:12:18 +01:00
virtual Any convertInnerToOuterValue ( const Any & rInnerValue ) const SAL_OVERRIDE ;
virtual Any convertOuterToInnerValue ( const Any & rOuterValue ) const SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
} ;
WrappedSegmentOffsetProperty : : WrappedSegmentOffsetProperty ( ) :
2012-04-08 10:47:56 -04:30
WrappedProperty ( " SegmentOffset " , " Offset " )
2007-05-22 16:17:29 +00:00
{ }
WrappedSegmentOffsetProperty : : ~ WrappedSegmentOffsetProperty ( )
{ }
Any WrappedSegmentOffsetProperty : : convertInnerToOuterValue ( const Any & rInnerValue ) const
{
// convert new double offset to former integer segment-offset
2007-08-03 11:31:55 +00:00
double fOffset = 0 ;
2007-05-22 16:17:29 +00:00
Any aResult ( rInnerValue ) ;
if ( rInnerValue > > = fOffset )
aResult < < = static_cast < sal_Int32 > ( : : rtl : : math : : round ( fOffset * 100.0 ) ) ;
return aResult ;
}
Any WrappedSegmentOffsetProperty : : convertOuterToInnerValue ( const Any & rOuterValue ) const
{
// convert former integer segment-offset to new double offset
2007-08-03 11:31:55 +00:00
sal_Int32 nOffset = 0 ;
2007-05-22 16:17:29 +00:00
Any aResult ( rOuterValue ) ;
if ( rOuterValue > > = nOffset )
aResult < < = ( static_cast < double > ( nOffset ) / 100.0 ) ;
return aResult ;
}
class WrappedLineColorProperty : public WrappedSeriesAreaOrLineProperty
{
public :
WrappedLineColorProperty ( DataSeriesPointWrapper * pDataSeriesPointWrapper ) ;
virtual ~ WrappedLineColorProperty ( ) ;
virtual void setPropertyValue ( const Any & rOuterValue , const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertySet > & xInnerPropertySet ) const
2014-03-27 18:12:18 +01:00
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 ;
2007-05-22 16:17:29 +00:00
virtual void setPropertyToDefault ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertyState > & xInnerPropertyState ) const
2014-03-27 18:12:18 +01:00
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : uno : : RuntimeException ) SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
virtual : : com : : sun : : star : : uno : : Any getPropertyDefault ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertyState > & xInnerPropertyState ) const
2014-03-27 18:12:18 +01:00
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : lang : : WrappedTargetException , : : com : : sun : : star : : uno : : RuntimeException ) SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
protected :
DataSeriesPointWrapper * m_pDataSeriesPointWrapper ;
mutable Any m_aDefaultValue ;
mutable Any m_aOuterValue ;
} ;
WrappedLineColorProperty : : WrappedLineColorProperty (
DataSeriesPointWrapper * pDataSeriesPointWrapper )
2012-04-08 10:47:56 -04:30
: WrappedSeriesAreaOrLineProperty ( " LineColor " , " BorderColor " , " Color " , pDataSeriesPointWrapper )
2007-05-22 16:17:29 +00:00
, m_pDataSeriesPointWrapper ( pDataSeriesPointWrapper )
, m_aDefaultValue ( uno : : makeAny ( sal_Int32 ( 0x0099ccff ) ) ) // blue 8
, m_aOuterValue ( m_aDefaultValue )
{
}
WrappedLineColorProperty : : ~ WrappedLineColorProperty ( )
{
}
void WrappedLineColorProperty : : setPropertyValue ( const Any & rOuterValue , const Reference < beans : : XPropertySet > & xInnerPropertySet ) const
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException )
{
if ( m_pDataSeriesPointWrapper & & m_pDataSeriesPointWrapper - > isLinesForbidden ( ) )
m_aOuterValue = rOuterValue ;
else
WrappedSeriesAreaOrLineProperty : : setPropertyValue ( rOuterValue , xInnerPropertySet ) ;
}
void WrappedLineColorProperty : : setPropertyToDefault ( const Reference < beans : : XPropertyState > & xInnerPropertyState ) const
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : uno : : RuntimeException )
{
if ( m_pDataSeriesPointWrapper & & m_pDataSeriesPointWrapper - > isLinesForbidden ( ) )
m_aOuterValue = m_aDefaultValue ;
else
WrappedSeriesAreaOrLineProperty : : setPropertyToDefault ( xInnerPropertyState ) ;
}
Any WrappedLineColorProperty : : getPropertyDefault ( const Reference < beans : : XPropertyState > & xInnerPropertyState ) const
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
if ( m_pDataSeriesPointWrapper & & ! m_pDataSeriesPointWrapper - > isSupportingAreaProperties ( ) )
return m_aDefaultValue ;
else
return WrappedSeriesAreaOrLineProperty : : getPropertyDefault ( xInnerPropertyState ) ;
}
class WrappedLineStyleProperty : public WrappedSeriesAreaOrLineProperty
{
public :
WrappedLineStyleProperty ( DataSeriesPointWrapper * pDataSeriesPointWrapper ) ;
virtual ~ WrappedLineStyleProperty ( ) ;
virtual void setPropertyValue ( const Any & rOuterValue , const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertySet > & xInnerPropertySet ) const
2014-03-27 18:12:18 +01:00
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 ;
2007-05-22 16:17:29 +00:00
virtual void setPropertyToDefault ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : beans : : XPropertyState > & xInnerPropertyState ) const
2014-03-27 18:12:18 +01:00
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : uno : : RuntimeException ) SAL_OVERRIDE ;
2007-05-22 16:17:29 +00:00
protected :
DataSeriesPointWrapper * m_pDataSeriesPointWrapper ;
mutable Any m_aDefaultValue ;
mutable Any m_aOuterValue ;
} ;
WrappedLineStyleProperty : : WrappedLineStyleProperty (
DataSeriesPointWrapper * pDataSeriesPointWrapper )
2012-04-08 10:47:56 -04:30
: WrappedSeriesAreaOrLineProperty ( " LineStyle " , " BorderStyle " , " LineStyle " , pDataSeriesPointWrapper )
2007-05-22 16:17:29 +00:00
, m_pDataSeriesPointWrapper ( pDataSeriesPointWrapper )
, m_aDefaultValue ( uno : : makeAny ( drawing : : LineStyle_SOLID ) )
, m_aOuterValue ( m_aDefaultValue )
{
}
WrappedLineStyleProperty : : ~ WrappedLineStyleProperty ( )
{
}
void WrappedLineStyleProperty : : setPropertyValue ( const Any & rOuterValue , const Reference < beans : : XPropertySet > & xInnerPropertySet ) const
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException )
{
Any aNewValue ( rOuterValue ) ;
if ( m_pDataSeriesPointWrapper & & m_pDataSeriesPointWrapper - > isLinesForbidden ( ) )
{
m_aOuterValue = rOuterValue ;
aNewValue = uno : : makeAny ( drawing : : LineStyle_NONE ) ;
}
WrappedSeriesAreaOrLineProperty : : setPropertyValue ( aNewValue , xInnerPropertySet ) ;
}
void WrappedLineStyleProperty : : setPropertyToDefault ( const Reference < beans : : XPropertyState > & xInnerPropertyState ) const
throw ( : : com : : sun : : star : : beans : : UnknownPropertyException , : : com : : sun : : star : : uno : : RuntimeException )
{
if ( m_pDataSeriesPointWrapper & & m_pDataSeriesPointWrapper - > isLinesForbidden ( ) )
m_aOuterValue = m_aDefaultValue ;
else
WrappedSeriesAreaOrLineProperty : : setPropertyToDefault ( xInnerPropertyState ) ;
}
2003-12-18 12:50:56 +00:00
} // anonymous namespace
namespace chart
{
namespace wrapper
{
DataSeriesPointWrapper : : DataSeriesPointWrapper (
2007-05-22 16:17:29 +00:00
: : boost : : shared_ptr < Chart2ModelContact > spChart2ModelContact )
: m_spChart2ModelContact ( spChart2ModelContact )
, m_aEventListenerContainer ( m_aMutex )
, m_eType ( DATA_SERIES )
, m_nSeriesIndexInNewAPI ( - 1 )
, m_nPointIndex ( - 1 )
2014-04-15 15:17:13 +02:00
, m_bLinesAllowed ( true )
2007-05-22 16:17:29 +00:00
, m_xDataSeries ( 0 )
{
//need initialize call afterwards
}
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
void SAL_CALL DataSeriesPointWrapper : : initialize ( const uno : : Sequence < uno : : Any > & aArguments )
2014-02-25 21:31:58 +01:00
throw ( uno : : Exception , uno : : RuntimeException , std : : exception )
2007-05-22 16:17:29 +00:00
{
2011-05-21 10:11:48 +02:00
OSL_PRECOND ( aArguments . getLength ( ) > = 1 , " need at least 1 argument to initialize the DataSeriesPointWrapper: series reference + optional datapoint index " ) ;
2007-05-22 16:17:29 +00:00
m_nSeriesIndexInNewAPI = - 1 ; //ignored in this case
m_nPointIndex = - 1 ;
if ( aArguments . getLength ( ) > = 1 )
{
aArguments [ 0 ] > > = m_xDataSeries ;
if ( aArguments . getLength ( ) > = 2 )
aArguments [ 1 ] > > = m_nPointIndex ;
}
if ( ! m_xDataSeries . is ( ) )
throw uno : : Exception (
2012-04-08 10:47:56 -04:30
" DataSeries index invalid " , static_cast < : : cppu : : OWeakObject * > ( this ) ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
//todo: check upper border of point index
if ( m_nPointIndex > = 0 )
m_eType = DATA_POINT ;
else
m_eType = DATA_SERIES ;
}
2014-01-31 23:41:52 -06:00
DataSeriesPointWrapper : : DataSeriesPointWrapper ( eType _eType ,
sal_Int32 nSeriesIndexInNewAPI ,
sal_Int32 nPointIndex , //ignored for series
: : boost : : shared_ptr < Chart2ModelContact > spChart2ModelContact )
: m_spChart2ModelContact ( spChart2ModelContact )
, m_aEventListenerContainer ( m_aMutex )
, m_eType ( _eType )
, m_nSeriesIndexInNewAPI ( nSeriesIndexInNewAPI )
, m_nPointIndex ( ( _eType = = DATA_POINT ) ? nPointIndex : - 1 )
2014-04-15 15:17:13 +02:00
, m_bLinesAllowed ( false )
2014-01-31 23:41:52 -06:00
, m_xDataSeries ( 0 )
2007-05-22 16:17:29 +00:00
{
}
DataSeriesPointWrapper : : ~ DataSeriesPointWrapper ( )
2003-12-18 12:50:56 +00:00
{
}
// ____ XComponent ____
void SAL_CALL DataSeriesPointWrapper : : dispose ( )
2014-02-25 21:31:58 +01:00
throw ( uno : : RuntimeException , std : : exception )
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
uno : : Reference < uno : : XInterface > xSource ( static_cast < : : cppu : : OWeakObject * > ( this ) ) ;
m_aEventListenerContainer . disposeAndClear ( lang : : EventObject ( xSource ) ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
m_xDataSeries . clear ( ) ;
clearWrappedPropertySet ( ) ;
2003-12-18 12:50:56 +00:00
}
void SAL_CALL DataSeriesPointWrapper : : addEventListener (
const uno : : Reference < lang : : XEventListener > & xListener )
2014-02-25 21:31:58 +01:00
throw ( uno : : RuntimeException , std : : exception )
2003-12-18 12:50:56 +00:00
{
m_aEventListenerContainer . addInterface ( xListener ) ;
}
void SAL_CALL DataSeriesPointWrapper : : removeEventListener (
const uno : : Reference < lang : : XEventListener > & aListener )
2014-02-25 21:31:58 +01:00
throw ( uno : : RuntimeException , std : : exception )
2003-12-18 12:50:56 +00:00
{
m_aEventListenerContainer . removeInterface ( aListener ) ;
}
// ____ XEventListener ____
2007-07-25 07:26:45 +00:00
void SAL_CALL DataSeriesPointWrapper : : disposing ( const lang : : EventObject & /*Source*/ )
2014-02-25 21:31:58 +01:00
throw ( uno : : RuntimeException , std : : exception )
2003-12-18 12:50:56 +00:00
{
}
2007-05-22 16:17:29 +00:00
bool DataSeriesPointWrapper : : isSupportingAreaProperties ( )
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
Reference < chart2 : : XDataSeries > xSeries ( this - > getDataSeries ( ) ) ;
Reference < chart2 : : XDiagram > xDiagram ( m_spChart2ModelContact - > getChart2Diagram ( ) ) ;
Reference < chart2 : : XChartType > xChartType ( DiagramHelper : : getChartTypeOfSeries ( xDiagram , xSeries ) ) ;
sal_Int32 nDimensionCount = DiagramHelper : : getDimension ( xDiagram ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
return ChartTypeHelper : : isSupportingAreaProperties ( xChartType , nDimensionCount ) ;
}
Reference < chart2 : : XDataSeries > DataSeriesPointWrapper : : getDataSeries ( )
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
Reference < chart2 : : XDataSeries > xSeries ( m_xDataSeries ) ;
if ( ! xSeries . is ( ) )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
Reference < chart2 : : XDiagram > xDiagram ( m_spChart2ModelContact - > getChart2Diagram ( ) ) ;
: : std : : vector < uno : : Reference < chart2 : : XDataSeries > > aSeriesList (
: : chart : : DiagramHelper : : getDataSeriesFromDiagram ( xDiagram ) ) ;
2003-12-19 14:07:03 +00:00
2007-05-22 16:17:29 +00:00
if ( m_nSeriesIndexInNewAPI > = 0 & & m_nSeriesIndexInNewAPI < static_cast < sal_Int32 > ( aSeriesList . size ( ) ) )
xSeries = aSeriesList [ m_nSeriesIndexInNewAPI ] ;
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
return xSeries ;
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
Reference < beans : : XPropertySet > DataSeriesPointWrapper : : getDataPointProperties ( )
2003-12-18 12:50:56 +00:00
{
2007-05-22 16:17:29 +00:00
Reference < beans : : XPropertySet > xPointProp ;
2003-12-19 14:07:03 +00:00
2007-05-22 16:17:29 +00:00
Reference < chart2 : : XDataSeries > xSeries ( this - > getDataSeries ( ) ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
// may throw an IllegalArgumentException
if ( xSeries . is ( ) )
xPointProp = xSeries - > getDataPointByIndex ( m_nPointIndex ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
return xPointProp ;
}
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
//ReferenceSizePropertyProvider
2008-10-01 07:35:04 +00:00
void DataSeriesPointWrapper : : updateReferenceSize ( )
2007-05-22 16:17:29 +00:00
{
Reference < beans : : XPropertySet > xProp ( this - > getInnerPropertySet ( ) , uno : : UNO_QUERY ) ;
if ( xProp . is ( ) )
2008-10-01 07:35:04 +00:00
{
2012-04-08 10:47:56 -04:30
if ( xProp - > getPropertyValue ( " ReferencePageSize " ) . hasValue ( ) )
xProp - > setPropertyValue ( " ReferencePageSize " , uno : : makeAny (
2008-10-01 07:35:04 +00:00
m_spChart2ModelContact - > GetPageSize ( ) ) ) ;
}
2007-05-22 16:17:29 +00:00
}
Any DataSeriesPointWrapper : : getReferenceSize ( )
{
Any aRet ;
Reference < beans : : XPropertySet > xProp ( this - > getInnerPropertySet ( ) , uno : : UNO_QUERY ) ;
if ( xProp . is ( ) )
2012-04-08 10:47:56 -04:30
aRet = xProp - > getPropertyValue ( " ReferencePageSize " ) ;
2007-05-22 16:17:29 +00:00
return aRet ;
2003-12-19 14:07:03 +00:00
}
2007-05-22 16:17:29 +00:00
awt : : Size DataSeriesPointWrapper : : getCurrentSizeForReference ( )
{
2008-10-01 07:35:04 +00:00
return m_spChart2ModelContact - > GetPageSize ( ) ;
2007-05-22 16:17:29 +00:00
}
// WrappedPropertySet
2003-12-19 14:07:03 +00:00
2007-05-22 16:17:29 +00:00
//XPropertyState
2013-01-05 13:01:09 -02:00
beans : : PropertyState SAL_CALL DataSeriesPointWrapper : : getPropertyState ( const OUString & rPropertyName )
2014-02-25 21:31:58 +01:00
throw ( beans : : UnknownPropertyException , uno : : RuntimeException , std : : exception )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
beans : : PropertyState aState ( beans : : PropertyState_DIRECT_VALUE ) ;
2003-12-19 14:07:03 +00:00
2007-05-22 16:17:29 +00:00
if ( m_eType = = DATA_SERIES )
aState = WrappedPropertySet : : getPropertyState ( rPropertyName ) ;
else
2003-12-19 14:07:03 +00:00
{
2012-04-08 10:47:56 -04:30
if ( rPropertyName = = " FillColor " )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
Reference < beans : : XPropertySet > xSeriesProp ( getDataSeries ( ) , uno : : UNO_QUERY ) ;
2014-04-15 15:17:13 +02:00
bool bVaryColorsByPoint = false ;
2012-04-08 10:47:56 -04:30
if ( xSeriesProp . is ( ) & & ( xSeriesProp - > getPropertyValue ( " VaryColorsByPoint " ) > > = bVaryColorsByPoint )
2007-05-22 16:17:29 +00:00
& & bVaryColorsByPoint )
return beans : : PropertyState_DIRECT_VALUE ;
2003-12-19 14:07:03 +00:00
}
2012-04-08 10:47:56 -04:30
else if ( rPropertyName = = " Lines "
| | rPropertyName = = " SymbolType "
| | rPropertyName = = " SymbolSize " )
2007-08-17 11:11:25 +00:00
return WrappedPropertySet : : getPropertyState ( rPropertyName ) ;
2007-05-22 16:17:29 +00:00
uno : : Any aDefault ( getPropertyDefault ( rPropertyName ) ) ;
uno : : Any aValue ( getPropertyValue ( rPropertyName ) ) ;
if ( aDefault = = aValue )
aState = beans : : PropertyState_DEFAULT_VALUE ;
2003-12-19 14:07:03 +00:00
}
2007-05-22 16:17:29 +00:00
return aState ;
}
2013-01-05 13:01:09 -02:00
void SAL_CALL DataSeriesPointWrapper : : setPropertyToDefault ( const OUString & rPropertyName )
2014-02-25 21:31:58 +01:00
throw ( beans : : UnknownPropertyException , uno : : RuntimeException , std : : exception )
2007-05-22 16:17:29 +00:00
{
if ( m_eType = = DATA_SERIES )
WrappedPropertySet : : setPropertyToDefault ( rPropertyName ) ;
2003-12-19 14:07:03 +00:00
else
{
2007-05-22 16:17:29 +00:00
//for data points the default is given by the series
setPropertyValue ( rPropertyName , getPropertyDefault ( rPropertyName ) ) ;
2003-12-19 14:07:03 +00:00
}
}
2013-01-05 13:01:09 -02:00
Any SAL_CALL DataSeriesPointWrapper : : getPropertyDefault ( const OUString & rPropertyName )
2014-02-25 21:31:58 +01:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException , std : : exception )
2007-05-22 16:17:29 +00:00
{
Any aRet ;
try
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
sal_Int32 nHandle = getInfoHelper ( ) . getHandleByName ( rPropertyName ) ;
if ( nHandle > 0 )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
//always take the series current value as default for points
Reference < beans : : XPropertySet > xInnerPropertySet ( getDataSeries ( ) , uno : : UNO_QUERY ) ;
if ( xInnerPropertySet . is ( ) )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
const WrappedProperty * pWrappedProperty = getWrappedProperty ( rPropertyName ) ;
if ( pWrappedProperty )
aRet = pWrappedProperty - > getPropertyValue ( xInnerPropertySet ) ;
else
aRet = xInnerPropertySet - > getPropertyValue ( rPropertyName ) ;
2003-12-19 14:07:03 +00:00
}
}
}
2011-11-29 02:06:57 +09:00
catch ( const beans : : UnknownPropertyException & )
2003-12-19 14:07:03 +00:00
{
2007-05-22 16:17:29 +00:00
aRet = WrappedPropertySet : : getPropertyDefault ( rPropertyName ) ;
2003-12-19 14:07:03 +00:00
}
2007-05-22 16:17:29 +00:00
return aRet ;
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
Reference < beans : : XPropertySet > DataSeriesPointWrapper : : getInnerPropertySet ( )
{
if ( m_eType = = DATA_SERIES )
return Reference < beans : : XPropertySet > ( getDataSeries ( ) , uno : : UNO_QUERY ) ;
return getDataPointProperties ( ) ;
}
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
const Sequence < beans : : Property > & DataSeriesPointWrapper : : getPropertySequence ( )
2003-12-18 12:50:56 +00:00
{
2010-10-05 11:10:54 +02:00
if ( m_eType = = DATA_SERIES )
return * StaticSeriesWrapperPropertyArray : : get ( ) ;
else
return * StaticPointWrapperPropertyArray : : get ( ) ;
2007-05-22 16:17:29 +00:00
}
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
const std : : vector < WrappedProperty * > DataSeriesPointWrapper : : createWrappedProperties ( )
{
: : std : : vector < : : chart : : WrappedProperty * > aWrappedProperties ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
WrappedCharacterHeightProperty : : addWrappedProperties ( aWrappedProperties , this ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
if ( m_eType = = DATA_SERIES )
{
2008-03-06 15:15:42 +00:00
WrappedStatisticProperties : : addWrappedPropertiesForSeries ( aWrappedProperties , m_spChart2ModelContact ) ;
2007-05-22 16:17:29 +00:00
aWrappedProperties . push_back ( new WrappedAttachedAxisProperty ( m_spChart2ModelContact ) ) ;
2009-07-02 19:17:43 +00:00
2014-06-13 11:12:50 -04:00
aWrappedProperties . push_back ( new WrappedNumberFormatProperty ( m_spChart2ModelContact ) ) ;
aWrappedProperties . push_back ( new WrappedLinkNumberFormatProperty ( m_spChart2ModelContact ) ) ;
2007-05-22 16:17:29 +00:00
}
2003-12-18 12:50:56 +00:00
2008-03-06 15:15:42 +00:00
WrappedSymbolProperties : : addWrappedPropertiesForSeries ( aWrappedProperties , m_spChart2ModelContact ) ;
WrappedDataCaptionProperties : : addWrappedPropertiesForSeries ( aWrappedProperties , m_spChart2ModelContact ) ;
2008-10-01 07:35:04 +00:00
WrappedScaleTextProperties : : addWrappedProperties ( aWrappedProperties , m_spChart2ModelContact ) ;
2007-05-22 16:17:29 +00:00
//add unnamed line properties (different inner names here)
2012-04-08 10:47:56 -04:30
aWrappedProperties . push_back ( new WrappedProperty ( " FillColor " , " Color " ) ) ;
2007-05-22 16:17:29 +00:00
aWrappedProperties . push_back ( new WrappedLineStyleProperty ( this ) ) ;
aWrappedProperties . push_back ( new WrappedLineColorProperty ( this ) ) ;
2012-04-08 10:47:56 -04:30
aWrappedProperties . push_back ( new WrappedSeriesAreaOrLineProperty ( " LineDashName " , " BorderDashName " , " LineDashName " , this ) ) ;
aWrappedProperties . push_back ( new WrappedSeriesAreaOrLineProperty ( " LineTransparence " , " BorderTransparency " , " Transparency " , this ) ) ;
aWrappedProperties . push_back ( new WrappedSeriesAreaOrLineProperty ( " LineWidth " , " BorderWidth " , " LineWidth " , this ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillStyle " , " FillStyle " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillTransparence " , " Transparency " ) ) ;
aWrappedProperties . push_back ( new WrappedIgnoreProperty ( " LineJoint " , uno : : makeAny ( drawing : : LineJoint_ROUND ) ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillTransparenceGradientName " , " TransparencyGradientName " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillGradientName " , " GradientName " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillGradientStepCount " , " GradientStepCount " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillHatchName " , " HatchName " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapName " , " FillBitmapName " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBackground " , " FillBackground " ) ) ;
2007-05-22 16:17:29 +00:00
//bitmap properties
2012-04-08 10:47:56 -04:30
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapMode " , " FillBitmapMode " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapSizeX " , " FillBitmapSizeX " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapSizeY " , " FillBitmapSizeY " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapLogicalSize " , " FillBitmapLogicalSize " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapOffsetX " , " FillBitmapOffsetX " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapOffsetY " , " FillBitmapOffsetY " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapRectanglePoint " , " FillBitmapRectanglePoint " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapPositionOffsetX " , " FillBitmapPositionOffsetX " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " FillBitmapPositionOffsetY " , " FillBitmapPositionOffsetY " ) ) ;
aWrappedProperties . push_back ( new WrappedProperty ( " SolidType " , " Geometry3D " ) ) ;
2007-05-22 16:17:29 +00:00
aWrappedProperties . push_back ( new WrappedSegmentOffsetProperty ( ) ) ;
2012-04-08 10:47:56 -04:30
aWrappedProperties . push_back ( new WrappedProperty ( " D3DPercentDiagonal " , " PercentDiagonal " ) ) ;
2007-05-22 16:17:29 +00:00
2009-06-04 09:41:18 +00:00
aWrappedProperties . push_back ( new WrappedTextRotationProperty ( ) ) ;
2007-05-22 16:17:29 +00:00
return aWrappedProperties ;
2003-12-18 12:50:56 +00:00
}
2013-01-05 13:01:09 -02:00
void SAL_CALL DataSeriesPointWrapper : : setPropertyValue ( const OUString & rPropertyName , const Any & rValue )
2014-02-25 21:31:58 +01:00
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException , std : : exception )
2003-12-18 12:50:56 +00:00
{
2012-04-08 10:47:56 -04:30
if ( rPropertyName = = " Lines " )
2007-08-17 11:11:25 +00:00
{
if ( ! ( rValue > > = m_bLinesAllowed ) )
2012-04-08 10:47:56 -04:30
throw lang : : IllegalArgumentException ( " Property Lines requires value of type sal_Bool " , 0 , 0 ) ;
2007-08-17 11:11:25 +00:00
}
2007-05-22 16:17:29 +00:00
sal_Int32 nHandle = getInfoHelper ( ) . getHandleByName ( rPropertyName ) ;
2012-04-08 10:47:56 -04:30
static const sal_Int32 nErrorCategoryHandle = getInfoHelper ( ) . getHandleByName ( " ErrorCategory " ) ;
2007-05-22 16:17:29 +00:00
if ( nErrorCategoryHandle = = nHandle )
{
: : com : : sun : : star : : chart : : ChartErrorCategory aNewValue = : : com : : sun : : star : : chart : : ChartErrorCategory_NONE ;
rValue > > = aNewValue ;
Any aLow , aHigh ;
bool bSetHighAndLowValues = false ;
switch ( aNewValue )
{
case : : com : : sun : : star : : chart : : ChartErrorCategory_CONSTANT_VALUE :
2012-04-08 10:47:56 -04:30
aHigh = this - > getPropertyValue ( " ConstantErrorHigh " ) ;
aLow = this - > getPropertyValue ( " ConstantErrorLow " ) ;
2007-05-22 16:17:29 +00:00
bSetHighAndLowValues = true ;
break ;
case : : com : : sun : : star : : chart : : ChartErrorCategory_PERCENT :
2012-04-08 10:47:56 -04:30
aHigh = aLow = this - > getPropertyValue ( " PercentageError " ) ;
2007-05-22 16:17:29 +00:00
bSetHighAndLowValues = true ;
break ;
case : : com : : sun : : star : : chart : : ChartErrorCategory_ERROR_MARGIN :
2012-04-08 10:47:56 -04:30
aHigh = aLow = this - > getPropertyValue ( " ErrorMargin " ) ;
2007-05-22 16:17:29 +00:00
bSetHighAndLowValues = true ;
break ;
default :
break ;
}
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
WrappedPropertySet : : setPropertyValue ( rPropertyName , rValue ) ;
2003-12-18 12:50:56 +00:00
2007-05-22 16:17:29 +00:00
if ( bSetHighAndLowValues )
{
switch ( aNewValue )
{
case : : com : : sun : : star : : chart : : ChartErrorCategory_CONSTANT_VALUE :
2012-04-08 10:47:56 -04:30
this - > setPropertyValue ( " ConstantErrorHigh " , aHigh ) ;
this - > setPropertyValue ( " ConstantErrorLow " , aLow ) ;
2007-05-22 16:17:29 +00:00
break ;
case : : com : : sun : : star : : chart : : ChartErrorCategory_PERCENT :
2012-04-08 10:47:56 -04:30
this - > setPropertyValue ( " PercentageError " , aHigh ) ;
2007-05-22 16:17:29 +00:00
break ;
case : : com : : sun : : star : : chart : : ChartErrorCategory_ERROR_MARGIN :
2012-04-08 10:47:56 -04:30
this - > setPropertyValue ( " ErrorMargin " , aHigh ) ;
2007-05-22 16:17:29 +00:00
break ;
default :
break ;
}
}
}
else
WrappedPropertySet : : setPropertyValue ( rPropertyName , rValue ) ;
}
2003-12-18 12:50:56 +00:00
2013-01-05 13:01:09 -02:00
Any SAL_CALL DataSeriesPointWrapper : : getPropertyValue ( const OUString & rPropertyName )
2014-02-25 21:31:58 +01:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException , std : : exception )
2007-05-22 16:17:29 +00:00
{
if ( m_eType = = DATA_POINT )
2003-12-18 12:50:56 +00:00
{
2012-04-08 10:47:56 -04:30
if ( rPropertyName = = " FillColor " )
2007-05-22 16:17:29 +00:00
{
Reference < beans : : XPropertySet > xSeriesProp ( getDataSeries ( ) , uno : : UNO_QUERY ) ;
2014-04-15 15:17:13 +02:00
bool bVaryColorsByPoint = false ;
2012-04-08 10:47:56 -04:30
if ( xSeriesProp . is ( ) & & ( xSeriesProp - > getPropertyValue ( " VaryColorsByPoint " ) > > = bVaryColorsByPoint )
2007-05-22 16:17:29 +00:00
& & bVaryColorsByPoint )
{
uno : : Reference < beans : : XPropertyState > xPointState ( DataSeriesPointWrapper : : getDataPointProperties ( ) , uno : : UNO_QUERY ) ;
2012-04-08 10:47:56 -04:30
if ( xPointState . is ( ) & & xPointState - > getPropertyState ( " Color " ) = = beans : : PropertyState_DEFAULT_VALUE )
2007-05-22 16:17:29 +00:00
{
Reference < chart2 : : XDiagram > xDiagram ( m_spChart2ModelContact - > getChart2Diagram ( ) ) ;
if ( xDiagram . is ( ) )
{
Reference < chart2 : : XColorScheme > xColorScheme ( xDiagram - > getDefaultColorScheme ( ) ) ;
if ( xColorScheme . is ( ) )
return uno : : makeAny ( xColorScheme - > getColorByIndex ( m_nPointIndex ) ) ;
}
}
}
}
2003-12-18 12:50:56 +00:00
}
2007-05-22 16:17:29 +00:00
return WrappedPropertySet : : getPropertyValue ( rPropertyName ) ;
2003-12-18 12:50:56 +00:00
}
2013-01-05 13:01:09 -02:00
uno : : Sequence < OUString > DataSeriesPointWrapper : : getSupportedServiceNames_Static ( )
2003-12-18 12:50:56 +00:00
{
2013-01-05 13:01:09 -02:00
uno : : Sequence < OUString > aServices ( 7 ) ;
2012-04-08 10:47:56 -04:30
aServices [ 0 ] = " com.sun.star.chart.ChartDataRowProperties " ;
aServices [ 1 ] = " com.sun.star.chart.ChartDataPointProperties " ;
2012-11-29 20:48:11 +01:00
aServices [ 2 ] = " com.sun.star.xml.UserDefinedAttributesSupplier " ;
2012-04-08 10:47:56 -04:30
aServices [ 3 ] = " com.sun.star.beans.PropertySet " ;
aServices [ 4 ] = " com.sun.star.drawing.FillProperties " ;
aServices [ 5 ] = " com.sun.star.drawing.LineProperties " ;
aServices [ 6 ] = " com.sun.star.style.CharacterProperties " ;
2003-12-18 12:50:56 +00:00
return aServices ;
}
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
2014-12-09 08:30:11 +02:00
OUString SAL_CALL DataSeriesPointWrapper : : getImplementationName ( )
throw ( css : : uno : : RuntimeException , std : : exception )
{
return getImplementationName_Static ( ) ;
}
OUString DataSeriesPointWrapper : : getImplementationName_Static ( )
{
return OUString ( lcl_aServiceName ) ;
}
sal_Bool SAL_CALL DataSeriesPointWrapper : : supportsService ( const OUString & rServiceName )
throw ( css : : uno : : RuntimeException , std : : exception )
{
return cppu : : supportsService ( this , rServiceName ) ;
}
css : : uno : : Sequence < OUString > SAL_CALL DataSeriesPointWrapper : : getSupportedServiceNames ( )
throw ( css : : uno : : RuntimeException , std : : exception )
{
return getSupportedServiceNames_Static ( ) ;
}
2003-12-18 12:50:56 +00:00
} // namespace wrapper
} // namespace chart
2010-10-12 15:59:00 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */