tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / model / template / BubbleChartType.cxx
blob76abecfe27efcebb9663437f2e12477f30d762f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "BubbleChartType.hxx"
21 #include <PropertyHelper.hxx>
22 #include <servicenames_charttypes.hxx>
23 #include <CartesianCoordinateSystem.hxx>
24 #include <Axis.hxx>
25 #include <AxisHelper.hxx>
26 #include <AxisIndexDefines.hxx>
27 #include <com/sun/star/chart2/AxisType.hpp>
28 #include <cppuhelper/supportsservice.hxx>
30 using namespace ::com::sun::star;
32 using ::com::sun::star::beans::Property;
33 using ::com::sun::star::uno::Sequence;
34 using ::com::sun::star::uno::Reference;
36 namespace
39 ::cppu::OPropertyArrayHelper& StaticBubbleChartTypeInfoHelper()
41 static ::cppu::OPropertyArrayHelper aPropHelper = []()
43 std::vector< css::beans::Property > aProperties;
44 std::sort( aProperties.begin(), aProperties.end(),
45 ::chart::PropertyNameLess() );
46 return comphelper::containerToSequence( aProperties );
47 }();
48 return aPropHelper;
51 } // anonymous namespace
53 namespace chart
56 BubbleChartType::BubbleChartType()
60 BubbleChartType::BubbleChartType( const BubbleChartType & rOther ) :
61 ChartType( rOther )
65 BubbleChartType::~BubbleChartType()
68 // ____ XCloneable ____
69 uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
71 return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
74 rtl::Reference< ChartType > BubbleChartType::cloneChartType() const
76 return new BubbleChartType( *this );
79 // ____ XChartType ____
80 rtl::Reference< ::chart::BaseCoordinateSystem >
81 BubbleChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
83 rtl::Reference< CartesianCoordinateSystem > xResult =
84 new CartesianCoordinateSystem( DimensionCount );
86 for( sal_Int32 i=0; i<DimensionCount; ++i )
88 rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
89 if( !xAxis.is() )
91 OSL_FAIL("a created coordinate system should have an axis for each dimension");
92 continue;
95 chart2::ScaleData aScaleData = xAxis->getScaleData();
96 aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
97 aScaleData.Scaling = AxisHelper::createLinearScaling();
99 if( i == 2 )
100 aScaleData.AxisType = chart2::AxisType::SERIES;
101 else
102 aScaleData.AxisType = chart2::AxisType::REALNUMBER;
104 xAxis->setScaleData( aScaleData );
107 return xResult;
110 OUString SAL_CALL BubbleChartType::getChartType()
112 return CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
115 uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
117 return { u"label"_ustr, u"values-x"_ustr, u"values-y"_ustr, u"values-size"_ustr };
120 uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedPropertyRoles()
122 return { u"FillColor"_ustr, u"BorderColor"_ustr };
125 OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
127 return u"values-size"_ustr;
130 // ____ OPropertySet ____
131 void BubbleChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
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;
141 // ____ OPropertySet ____
142 ::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
144 return StaticBubbleChartTypeInfoHelper();
147 // ____ XPropertySet ____
148 uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartType::getPropertySetInfo()
150 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
151 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeInfoHelper() ) );
152 return xPropertySetInfo;
155 OUString SAL_CALL BubbleChartType::getImplementationName()
157 return u"com.sun.star.comp.chart.BubbleChartType"_ustr;
160 sal_Bool SAL_CALL BubbleChartType::supportsService( const OUString& rServiceName )
162 return cppu::supportsService(this, rServiceName);
165 css::uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedServiceNames()
167 return {
168 CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE,
169 u"com.sun.star.chart2.ChartType"_ustr,
170 u"com.sun.star.beans.PropertySet"_ustr };
173 } // namespace chart
175 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
176 com_sun_star_comp_chart_BubbleChartType_get_implementation(css::uno::XComponentContext * /*context*/,
177 css::uno::Sequence<css::uno::Any> const &)
179 return cppu::acquire(new ::chart::BubbleChartType);
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */