LibreOffice Module chart2 (master) 1
BubbleChartType.cxx
Go to the documentation of this file.
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 "BubbleChartType.hxx"
21#include <PropertyHelper.hxx>
24#include <Axis.hxx>
25#include <AxisHelper.hxx>
26#include <AxisIndexDefines.hxx>
27#include <com/sun/star/chart2/AxisType.hpp>
29
30using namespace ::com::sun::star;
31
32using ::com::sun::star::beans::Property;
33using ::com::sun::star::uno::Sequence;
34using ::com::sun::star::uno::Reference;
35
36namespace
37{
38
39::cppu::OPropertyArrayHelper& StaticBubbleChartTypeInfoHelper()
40{
41 static ::cppu::OPropertyArrayHelper aPropHelper = []()
42 {
43 std::vector< css::beans::Property > aProperties;
44 std::sort( aProperties.begin(), aProperties.end(),
46 return comphelper::containerToSequence( aProperties );
47 }();
48 return aPropHelper;
49};
50
51} // anonymous namespace
52
53namespace chart
54{
55
57{
58}
59
61 ChartType( rOther )
62{
63}
64
66{}
67
68// ____ XCloneable ____
70{
72}
73
75{
76 return new BubbleChartType( *this );
77}
78
79// ____ XChartType ____
81 BubbleChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
82{
84 new CartesianCoordinateSystem( DimensionCount );
85
86 for( sal_Int32 i=0; i<DimensionCount; ++i )
87 {
88 rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
89 if( !xAxis.is() )
90 {
91 OSL_FAIL("a created coordinate system should have an axis for each dimension");
92 continue;
93 }
94
95 chart2::ScaleData aScaleData = xAxis->getScaleData();
96 aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
97 aScaleData.Scaling = AxisHelper::createLinearScaling();
98
99 if( i == 2 )
100 aScaleData.AxisType = chart2::AxisType::SERIES;
101 else
102 aScaleData.AxisType = chart2::AxisType::REALNUMBER;
103
104 xAxis->setScaleData( aScaleData );
105 }
106
107 return xResult;
108}
109
111{
113}
114
116{
117 return { "label", "values-x", "values-y", "values-size" };
118}
119
121{
122 return { "FillColor", "BorderColor" };
123}
124
126{
127 return "values-size";
128}
129
130// ____ OPropertySet ____
131void BubbleChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
132{
133 static ::chart::tPropertyValueMap aStaticDefaults;
134 tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
135 if( aFound == aStaticDefaults.end() )
136 rAny.clear();
137 else
138 rAny = (*aFound).second;
139}
140
141// ____ OPropertySet ____
143{
144 return StaticBubbleChartTypeInfoHelper();
145}
146
147// ____ XPropertySet ____
149{
150 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
151 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeInfoHelper() ) );
152 return xPropertySetInfo;
153}
154
156{
157 return "com.sun.star.comp.chart.BubbleChartType";
158}
159
160sal_Bool SAL_CALL BubbleChartType::supportsService( const OUString& rServiceName )
161{
162 return cppu::supportsService(this, rServiceName);
163}
164
165css::uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedServiceNames()
166{
167 return {
169 "com.sun.star.chart2.ChartType",
170 "com.sun.star.beans.PropertySet" };
171}
172
173} // namespace chart
174
175extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
176com_sun_star_comp_chart_BubbleChartType_get_implementation(css::uno::XComponentContext * /*context*/,
177 css::uno::Sequence<css::uno::Any> const &)
178{
179 return cppu::acquire(new ::chart::BubbleChartType);
180}
181
182/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart_BubbleChartType_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
PropertiesInfo aProperties
static css::uno::Reference< css::chart2::XScaling > createLinearScaling()
Definition: AxisHelper.cxx:65
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual rtl::Reference< ChartType > cloneChartType() const override
virtual OUString SAL_CALL getChartType() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedPropertyRoles() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedMandatoryRoles() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
implement this method to provide default values for all properties supporting defaults.
virtual ~BubbleChartType() override
virtual rtl::Reference< ::chart::BaseCoordinateSystem > createCoordinateSystem2(sal_Int32 DimensionCount) override
virtual OUString SAL_CALL getImplementationName() override
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
const sal_Int32 MAIN_AXIS_INDEX
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
sal_Int32 nHandle
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
unsigned char sal_Bool