Line data Source code
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 "CartesianCoordinateSystem.hxx"
21 : #include "macros.hxx"
22 : #include "servicenames_coosystems.hxx"
23 : #include <cppuhelper/supportsservice.hxx>
24 :
25 : using namespace ::com::sun::star;
26 :
27 : using ::com::sun::star::uno::RuntimeException;
28 : using ::com::sun::star::uno::Reference;
29 : using ::com::sun::star::uno::Sequence;
30 :
31 : namespace
32 : {
33 :
34 : static const char lcl_aServiceNameCartesian2d[] = "com.sun.star.chart2.CartesianCoordinateSystem2d";
35 : static const char lcl_aServiceNameCartesian3d[] = "com.sun.star.chart2.CartesianCoordinateSystem3d";
36 :
37 : static const char lcl_aImplementationNameCartesian2d[] = "com.sun.star.comp.chart2.CartesianCoordinateSystem2d";
38 : static const char lcl_aImplementationNameCartesian3d[] = "com.sun.star.comp.chart2.CartesianCoordinateSystem3d";
39 :
40 : static const char CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME[] = "com.sun.star.chart2.CoordinateSystems.Cartesian";
41 :
42 : }
43 :
44 : namespace chart
45 : {
46 :
47 : // explicit
48 281 : CartesianCoordinateSystem::CartesianCoordinateSystem(
49 : const uno::Reference< uno::XComponentContext > & xContext,
50 : sal_Int32 nDimensionCount /* = 2 */,
51 : bool bSwapXAndYAxis /* = sal_False */ ) :
52 281 : BaseCoordinateSystem( xContext, nDimensionCount, bSwapXAndYAxis )
53 281 : {}
54 :
55 0 : CartesianCoordinateSystem::CartesianCoordinateSystem(
56 : const CartesianCoordinateSystem & rSource ) :
57 0 : BaseCoordinateSystem( rSource )
58 0 : {}
59 :
60 383 : CartesianCoordinateSystem::~CartesianCoordinateSystem()
61 383 : {}
62 :
63 : // ____ XCoordinateSystem ____
64 26 : OUString SAL_CALL CartesianCoordinateSystem::getCoordinateSystemType()
65 : throw (RuntimeException, std::exception)
66 : {
67 26 : return OUString(CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME);
68 : }
69 :
70 1014 : OUString SAL_CALL CartesianCoordinateSystem::getViewServiceName()
71 : throw (RuntimeException, std::exception)
72 : {
73 1014 : return OUString(CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME);
74 : }
75 :
76 : // ____ XCloneable ____
77 0 : uno::Reference< util::XCloneable > SAL_CALL CartesianCoordinateSystem::createClone()
78 : throw (RuntimeException, std::exception)
79 : {
80 0 : return Reference< util::XCloneable >( new CartesianCoordinateSystem( *this ));
81 : }
82 :
83 : // ____ XServiceInfo ____
84 0 : Sequence< OUString > CartesianCoordinateSystem::getSupportedServiceNames_Static()
85 : {
86 0 : Sequence< OUString > aServices( 1 );
87 0 : aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
88 0 : return aServices;
89 : }
90 :
91 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
92 0 : OUString SAL_CALL CartesianCoordinateSystem::getImplementationName()
93 : throw( css::uno::RuntimeException, std::exception )
94 : {
95 0 : return getImplementationName_Static();
96 : }
97 :
98 0 : OUString CartesianCoordinateSystem::getImplementationName_Static()
99 : {
100 0 : return OUString("com.sun.star.comp.chart.CartesianCoordinateSystem");
101 : }
102 :
103 0 : sal_Bool SAL_CALL CartesianCoordinateSystem::supportsService( const OUString& rServiceName )
104 : throw( css::uno::RuntimeException, std::exception )
105 : {
106 0 : return cppu::supportsService(this, rServiceName);
107 : }
108 :
109 0 : css::uno::Sequence< OUString > SAL_CALL CartesianCoordinateSystem::getSupportedServiceNames()
110 : throw( css::uno::RuntimeException, std::exception )
111 : {
112 0 : return getSupportedServiceNames_Static();
113 : }
114 :
115 : // ==== CartesianCoordinateSystem2d ====
116 :
117 120 : CartesianCoordinateSystem2d::CartesianCoordinateSystem2d(
118 : const uno::Reference< uno::XComponentContext > & xContext ) :
119 120 : CartesianCoordinateSystem( xContext, 2, false )
120 120 : {}
121 :
122 240 : CartesianCoordinateSystem2d::~CartesianCoordinateSystem2d()
123 240 : {}
124 :
125 : // ____ XServiceInfo ____
126 1 : Sequence< OUString > CartesianCoordinateSystem2d::getSupportedServiceNames_Static()
127 : {
128 1 : Sequence< OUString > aServices( 2 );
129 1 : aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
130 1 : aServices[ 1 ] = lcl_aServiceNameCartesian2d;
131 1 : return aServices;
132 : }
133 :
134 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
135 1 : OUString SAL_CALL CartesianCoordinateSystem2d::getImplementationName()
136 : throw( css::uno::RuntimeException, std::exception )
137 : {
138 1 : return getImplementationName_Static();
139 : }
140 :
141 1 : OUString CartesianCoordinateSystem2d::getImplementationName_Static()
142 : {
143 1 : return OUString(lcl_aImplementationNameCartesian2d);
144 : }
145 :
146 0 : sal_Bool SAL_CALL CartesianCoordinateSystem2d::supportsService( const OUString& rServiceName )
147 : throw( css::uno::RuntimeException, std::exception )
148 : {
149 0 : return cppu::supportsService(this, rServiceName);
150 : }
151 :
152 1 : css::uno::Sequence< OUString > SAL_CALL CartesianCoordinateSystem2d::getSupportedServiceNames()
153 : throw( css::uno::RuntimeException, std::exception )
154 : {
155 1 : return getSupportedServiceNames_Static();
156 : }
157 :
158 : // ==== CartesianCoordinateSystem3d ====
159 :
160 31 : CartesianCoordinateSystem3d::CartesianCoordinateSystem3d(
161 : const uno::Reference< uno::XComponentContext > & xContext ) :
162 31 : CartesianCoordinateSystem( xContext, 3, false )
163 31 : {}
164 :
165 62 : CartesianCoordinateSystem3d::~CartesianCoordinateSystem3d()
166 62 : {}
167 :
168 : // ____ XServiceInfo ____
169 1 : Sequence< OUString > CartesianCoordinateSystem3d::getSupportedServiceNames_Static()
170 : {
171 1 : Sequence< OUString > aServices( 2 );
172 1 : aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
173 1 : aServices[ 1 ] = lcl_aServiceNameCartesian3d;
174 1 : return aServices;
175 : }
176 :
177 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
178 1 : OUString SAL_CALL CartesianCoordinateSystem3d::getImplementationName()
179 : throw( css::uno::RuntimeException, std::exception )
180 : {
181 1 : return getImplementationName_Static();
182 : }
183 :
184 1 : OUString CartesianCoordinateSystem3d::getImplementationName_Static()
185 : {
186 1 : return OUString(lcl_aImplementationNameCartesian3d);
187 : }
188 :
189 0 : sal_Bool SAL_CALL CartesianCoordinateSystem3d::supportsService( const OUString& rServiceName )
190 : throw( css::uno::RuntimeException, std::exception )
191 : {
192 0 : return cppu::supportsService(this, rServiceName);
193 : }
194 :
195 1 : css::uno::Sequence< OUString > SAL_CALL CartesianCoordinateSystem3d::getSupportedServiceNames()
196 : throw( css::uno::RuntimeException, std::exception )
197 : {
198 1 : return getSupportedServiceNames_Static();
199 : }
200 :
201 : } // namespace chart
202 :
203 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
204 120 : com_sun_star_comp_chart2_CartesianCoordinateSystem2d_get_implementation(css::uno::XComponentContext *context,
205 : css::uno::Sequence<css::uno::Any> const &)
206 : {
207 120 : return cppu::acquire(new ::chart::CartesianCoordinateSystem2d(context));
208 : }
209 :
210 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
211 31 : com_sun_star_comp_chart2_CartesianCoordinateSystem3d_get_implementation(css::uno::XComponentContext *context,
212 : css::uno::Sequence<css::uno::Any> const &)
213 : {
214 31 : return cppu::acquire(new ::chart::CartesianCoordinateSystem3d(context));
215 : }
216 :
217 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|