1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: NetChartType.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "NetChartType.hxx"
34 #include "PropertyHelper.hxx"
36 #include "PolarCoordinateSystem.hxx"
37 #include "servicenames_charttypes.hxx"
38 #include "ContainerHelper.hxx"
39 #include "AxisIndexDefines.hxx"
40 #include "AxisHelper.hxx"
42 #include <com/sun/star/beans/PropertyAttribute.hpp>
43 #include <com/sun/star/chart2/AxisType.hpp>
45 using namespace ::com::sun::star
;
46 using namespace ::com::sun::star::chart2
;
48 using ::rtl::OUString
;
49 using ::com::sun::star::beans::Property
;
50 using ::com::sun::star::uno::Sequence
;
51 using ::com::sun::star::uno::Reference
;
52 using ::com::sun::star::uno::Any
;
53 using ::osl::MutexGuard
;
58 NetChartType_Base::NetChartType_Base(
59 const uno::Reference
< uno::XComponentContext
> & xContext
) :
63 NetChartType_Base::NetChartType_Base( const NetChartType_Base
& rOther
) :
68 NetChartType_Base::~NetChartType_Base()
71 Reference
< XCoordinateSystem
> SAL_CALL
72 NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount
)
73 throw (lang::IllegalArgumentException
,
74 uno::RuntimeException
)
76 if( DimensionCount
!= 2 )
77 throw lang::IllegalArgumentException(
78 C2U( "NetChart must be two-dimensional" ),
79 static_cast< ::cppu::OWeakObject
* >( this ), 0 );
81 Reference
< XCoordinateSystem
> xResult(
82 new PolarCoordinateSystem(
83 GetComponentContext(), DimensionCount
, /* bSwapXAndYAxis */ sal_False
));
85 Reference
< XAxis
> xAxis( xResult
->getAxisByDimension( 0, MAIN_AXIS_INDEX
) );
88 ScaleData aScaleData
= xAxis
->getScaleData();
89 aScaleData
.Scaling
= AxisHelper::createLinearScaling();
90 aScaleData
.AxisType
= AxisType::CATEGORY
;
91 aScaleData
.Orientation
= AxisOrientation_MATHEMATICAL
;
92 xAxis
->setScaleData( aScaleData
);
95 xAxis
= xResult
->getAxisByDimension( 1, MAIN_AXIS_INDEX
);
98 ScaleData aScaleData
= xAxis
->getScaleData();
99 aScaleData
.Orientation
= AxisOrientation_MATHEMATICAL
;
100 aScaleData
.AxisType
= AxisType::REALNUMBER
;
101 xAxis
->setScaleData( aScaleData
);
107 // ____ OPropertySet ____
108 uno::Any
NetChartType_Base::GetDefaultValue( sal_Int32
/*nHandle*/ ) const
109 throw(beans::UnknownPropertyException
)
114 // ____ OPropertySet ____
115 ::cppu::IPropertyArrayHelper
& SAL_CALL
NetChartType_Base::getInfoHelper()
117 uno::Sequence
< beans::Property
> aProps
;
118 static ::cppu::OPropertyArrayHelper
aArrayHelper(aProps
);
122 // ____ XPropertySet ____
123 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
124 NetChartType_Base::getPropertySetInfo()
125 throw (uno::RuntimeException
)
127 static uno::Reference
< beans::XPropertySetInfo
> xInfo
;
130 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
133 xInfo
= ::cppu::OPropertySetHelper::createPropertySetInfo(
141 //-----------------------------------------------------------------------------
143 NetChartType::NetChartType(
144 const uno::Reference
< uno::XComponentContext
> & xContext
) :
145 NetChartType_Base( xContext
)
148 NetChartType::NetChartType( const NetChartType
& rOther
) :
149 NetChartType_Base( rOther
)
153 NetChartType::~NetChartType()
156 // ____ XCloneable ____
157 uno::Reference
< util::XCloneable
> SAL_CALL
NetChartType::createClone()
158 throw (uno::RuntimeException
)
160 return uno::Reference
< util::XCloneable
>( new NetChartType( *this ));
163 // ____ XChartType ____
164 ::rtl::OUString SAL_CALL
NetChartType::getChartType()
165 throw (uno::RuntimeException
)
167 return CHART2_SERVICE_NAME_CHARTTYPE_NET
;
170 uno::Sequence
< ::rtl::OUString
> NetChartType::getSupportedServiceNames_Static()
172 uno::Sequence
< ::rtl::OUString
> aServices( 3 );
173 aServices
[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_NET
;
174 aServices
[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
175 aServices
[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
179 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
180 APPHELPER_XSERVICEINFO_IMPL( NetChartType
,
181 C2U( "com.sun.star.comp.chart.NetChartType" ));