LibreOffice Module chart2 (master) 1
NetChartType.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 "NetChartType.hxx"
23#include <AxisIndexDefines.hxx>
24#include <AxisHelper.hxx>
25#include <Axis.hxx>
26
28#include <com/sun/star/chart2/AxisType.hpp>
29
30using namespace ::com::sun::star;
31using namespace ::com::sun::star::chart2;
32
33using ::com::sun::star::beans::Property;
34using ::com::sun::star::uno::Sequence;
35using ::com::sun::star::uno::Reference;
36
37namespace chart
38{
39
41{}
42
44 ChartType( rOther )
45{
46}
47
49{}
50
53{
54 if( DimensionCount != 2 )
55 throw lang::IllegalArgumentException(
56 "NetChart must be two-dimensional",
57 static_cast< ::cppu::OWeakObject* >( this ), 0 );
58
60 new PolarCoordinateSystem( DimensionCount );
61
62 rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( 0, MAIN_AXIS_INDEX );
63 if( xAxis.is() )
64 {
65 ScaleData aScaleData = xAxis->getScaleData();
66 aScaleData.Scaling = AxisHelper::createLinearScaling();
67 aScaleData.AxisType = AxisType::CATEGORY;
68 aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
69 xAxis->setScaleData( aScaleData );
70 }
71
72 xAxis = xResult->getAxisByDimension2( 1, MAIN_AXIS_INDEX );
73 if( xAxis.is() )
74 {
75 ScaleData aScaleData = xAxis->getScaleData();
76 aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
77 aScaleData.AxisType = AxisType::REALNUMBER;
78 xAxis->setScaleData( aScaleData );
79 }
80
81 return xResult;
82}
83
84// ____ OPropertySet ____
85void NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/, uno::Any& rAny ) const
86{
87 rAny.clear();
88}
89
90namespace
91{
92
93::cppu::OPropertyArrayHelper& StaticNetChartTypeInfoHelper()
94{
95 static ::cppu::OPropertyArrayHelper aPropHelper(Sequence< beans::Property >{});
96 return aPropHelper;
97}
98
99uno::Reference< beans::XPropertySetInfo >& StaticNetChartTypeInfo()
100{
101 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
102 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticNetChartTypeInfoHelper() ) );
103 return xPropertySetInfo;
104}
105
106}
107
108// ____ OPropertySet ____
110{
111 return StaticNetChartTypeInfoHelper();
112}
113
114// ____ XPropertySet ____
116{
117 return StaticNetChartTypeInfo();
118}
119
121{}
122
124 NetChartType_Base( rOther )
125{
126}
127
129{}
130
131// ____ XCloneable ____
133{
135}
136
138{
139 return new NetChartType( *this );
140}
141
142// ____ XChartType ____
143OUString SAL_CALL NetChartType::getChartType()
144{
146}
147
149{
150 return "com.sun.star.comp.chart.NetChartType";
151}
152
153sal_Bool SAL_CALL NetChartType::supportsService( const OUString& rServiceName )
154{
155 return cppu::supportsService(this, rServiceName);
156}
157
158css::uno::Sequence< OUString > SAL_CALL NetChartType::getSupportedServiceNames()
159{
160 return {
162 "com.sun.star.chart2.ChartType",
163 "com.sun.star.beans.PropertySet" };
164}
165
166} // namespace chart
167
168extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
169com_sun_star_comp_chart_NetChartType_get_implementation(css::uno::XComponentContext * /*context*/,
170 css::uno::Sequence<css::uno::Any> const &)
171{
172 return cppu::acquire(new ::chart::NetChartType);
173}
174
175/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart_NetChartType_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
static css::uno::Reference< css::chart2::XScaling > createLinearScaling()
Definition: AxisHelper.cxx:65
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 ~NetChartType_Base() override
virtual rtl::Reference< ::chart::BaseCoordinateSystem > createCoordinateSystem2(sal_Int32 DimensionCount) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual ~NetChartType() override
virtual rtl::Reference< ChartType > cloneChartType() const override
virtual OUString SAL_CALL getImplementationName() override
virtual OUString SAL_CALL getChartType() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
const sal_Int32 MAIN_AXIS_INDEX
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_NET
unsigned char sal_Bool