summaryrefslogtreecommitdiff
path: root/chart2/source/model/template/PieChartType.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/model/template/PieChartType.cxx')
-rw-r--r--chart2/source/model/template/PieChartType.cxx139
1 files changed, 58 insertions, 81 deletions
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index eb7c10a5e834..a835f6357f6c 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -20,12 +20,14 @@
#include "PieChartType.hxx"
#include <PropertyHelper.hxx>
#include <PolarCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <AxisIndexDefines.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
using namespace ::com::sun::star;
@@ -36,85 +38,54 @@ using ::com::sun::star::uno::Reference;
namespace
{
-enum
+::chart::tPropertyValueMap& StaticPieChartTypeDefaults()
{
- PROP_PIECHARTTYPE_USE_RINGS,
- PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
-};
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_USE_RINGS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_SUBTYPE, chart2::PieChartSubType_NONE );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::cppu::OPropertyArrayHelper& StaticPieChartTypeInfoHelper()
{
- rOutProperties.emplace_back( "UseRings",
- PROP_PIECHARTTYPE_USE_RINGS,
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { "UseRings",
+ ::chart::PROP_PIECHARTTYPE_USE_RINGS,
cppu::UnoType<bool>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "3DRelativeHeight",
- PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "3DRelativeHeight",
+ ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
cppu::UnoType<sal_Int32>::get(),
- beans::PropertyAttribute::MAYBEVOID );
+ beans::PropertyAttribute::MAYBEVOID },
+ { "SubPieType",
+ ::chart::PROP_PIECHARTTYPE_SUBTYPE,
+ cppu::UnoType<chart2::PieChartSubType>::get(),
+ beans::PropertyAttribute::MAYBEDEFAULT }
+ };
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }());
+ return aPropHelper;
}
-struct StaticPieChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS, false );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
- }
-};
-
-struct StaticPieChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticPieChartTypeInfoHelper_Initializer
+uno::Reference< beans::XPropertySetInfo >& StaticPieChartTypeInfo()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticPieChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticPieChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticPieChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeInfo_Initializer >
-{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo( StaticPieChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -139,21 +110,26 @@ uno::Reference< util::XCloneable > SAL_CALL PieChartType::createClone()
return uno::Reference< util::XCloneable >( new PieChartType( *this ));
}
+rtl::Reference< ChartType > PieChartType::cloneChartType() const
+{
+ return new PieChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL PieChartType::getChartType()
{
return CHART2_SERVICE_NAME_CHARTTYPE_PIE;
}
-Reference< chart2::XCoordinateSystem > SAL_CALL
- PieChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+rtl::Reference< ::chart::BaseCoordinateSystem >
+ PieChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
{
- Reference< chart2::XCoordinateSystem > xResult(
- new PolarCoordinateSystem( DimensionCount ));
+ rtl::Reference< PolarCoordinateSystem > xResult =
+ new PolarCoordinateSystem( DimensionCount );
for( sal_Int32 i=0; i<DimensionCount; ++i )
{
- Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
if( !xAxis.is() )
{
OSL_FAIL("a created coordinate system should have an axis for each dimension");
@@ -186,25 +162,26 @@ uno::Sequence< OUString > PieChartType::getSupportedPropertyRoles()
}
// ____ OPropertySet ____
-uno::Any PieChartType::GetDefaultValue( sal_Int32 nHandle ) const
+void PieChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticPieChartTypeDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticPieChartTypeDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL PieChartType::getInfoHelper()
{
- return *StaticPieChartTypeInfoHelper::get();
+ return StaticPieChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartType::getPropertySetInfo()
{
- return *StaticPieChartTypeInfo::get();
+ return StaticPieChartTypeInfo();
}
OUString SAL_CALL PieChartType::getImplementationName()