1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "CartesianCoordinateSystem.hxx"
22 #include "servicenames_coosystems.hxx"
23 #include <cppuhelper/supportsservice.hxx>
25 using namespace ::com::sun::star
;
27 using ::com::sun::star::uno::RuntimeException
;
28 using ::com::sun::star::uno::Reference
;
29 using ::com::sun::star::uno::Sequence
;
34 static const char lcl_aServiceNameCartesian2d
[] = "com.sun.star.chart2.CartesianCoordinateSystem2d";
35 static const char lcl_aServiceNameCartesian3d
[] = "com.sun.star.chart2.CartesianCoordinateSystem3d";
37 static const char lcl_aImplementationNameCartesian2d
[] = "com.sun.star.comp.chart2.CartesianCoordinateSystem2d";
38 static const char lcl_aImplementationNameCartesian3d
[] = "com.sun.star.comp.chart2.CartesianCoordinateSystem3d";
40 static const char CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME
[] = "com.sun.star.chart2.CoordinateSystems.Cartesian";
48 CartesianCoordinateSystem::CartesianCoordinateSystem(
49 const uno::Reference
< uno::XComponentContext
> & xContext
,
50 sal_Int32 nDimensionCount
/* = 2 */,
51 bool bSwapXAndYAxis
/* = sal_False */ ) :
52 BaseCoordinateSystem( xContext
, nDimensionCount
, bSwapXAndYAxis
)
55 CartesianCoordinateSystem::CartesianCoordinateSystem(
56 const CartesianCoordinateSystem
& rSource
) :
57 BaseCoordinateSystem( rSource
)
60 CartesianCoordinateSystem::~CartesianCoordinateSystem()
63 // ____ XCoordinateSystem ____
64 OUString SAL_CALL
CartesianCoordinateSystem::getCoordinateSystemType()
65 throw (RuntimeException
, std::exception
)
67 return OUString(CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME
);
70 OUString SAL_CALL
CartesianCoordinateSystem::getViewServiceName()
71 throw (RuntimeException
, std::exception
)
73 return OUString(CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME
);
76 // ____ XCloneable ____
77 uno::Reference
< util::XCloneable
> SAL_CALL
CartesianCoordinateSystem::createClone()
78 throw (RuntimeException
, std::exception
)
80 return Reference
< util::XCloneable
>( new CartesianCoordinateSystem( *this ));
83 // ____ XServiceInfo ____
84 Sequence
< OUString
> CartesianCoordinateSystem::getSupportedServiceNames_Static()
86 Sequence
< OUString
> aServices( 1 );
87 aServices
[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME
;
91 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
92 OUString SAL_CALL
CartesianCoordinateSystem::getImplementationName()
93 throw( css::uno::RuntimeException
, std::exception
)
95 return getImplementationName_Static();
98 OUString
CartesianCoordinateSystem::getImplementationName_Static()
100 return OUString("com.sun.star.comp.chart.CartesianCoordinateSystem");
103 sal_Bool SAL_CALL
CartesianCoordinateSystem::supportsService( const OUString
& rServiceName
)
104 throw( css::uno::RuntimeException
, std::exception
)
106 return cppu::supportsService(this, rServiceName
);
109 css::uno::Sequence
< OUString
> SAL_CALL
CartesianCoordinateSystem::getSupportedServiceNames()
110 throw( css::uno::RuntimeException
, std::exception
)
112 return getSupportedServiceNames_Static();
115 // ==== CartesianCoordinateSystem2d ====
117 CartesianCoordinateSystem2d::CartesianCoordinateSystem2d(
118 const uno::Reference
< uno::XComponentContext
> & xContext
) :
119 CartesianCoordinateSystem( xContext
, 2, false )
122 CartesianCoordinateSystem2d::~CartesianCoordinateSystem2d()
125 // ____ XServiceInfo ____
126 Sequence
< OUString
> CartesianCoordinateSystem2d::getSupportedServiceNames_Static()
128 Sequence
< OUString
> aServices( 2 );
129 aServices
[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME
;
130 aServices
[ 1 ] = lcl_aServiceNameCartesian2d
;
134 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
135 OUString SAL_CALL
CartesianCoordinateSystem2d::getImplementationName()
136 throw( css::uno::RuntimeException
, std::exception
)
138 return getImplementationName_Static();
141 OUString
CartesianCoordinateSystem2d::getImplementationName_Static()
143 return OUString(lcl_aImplementationNameCartesian2d
);
146 sal_Bool SAL_CALL
CartesianCoordinateSystem2d::supportsService( const OUString
& rServiceName
)
147 throw( css::uno::RuntimeException
, std::exception
)
149 return cppu::supportsService(this, rServiceName
);
152 css::uno::Sequence
< OUString
> SAL_CALL
CartesianCoordinateSystem2d::getSupportedServiceNames()
153 throw( css::uno::RuntimeException
, std::exception
)
155 return getSupportedServiceNames_Static();
158 // ==== CartesianCoordinateSystem3d ====
160 CartesianCoordinateSystem3d::CartesianCoordinateSystem3d(
161 const uno::Reference
< uno::XComponentContext
> & xContext
) :
162 CartesianCoordinateSystem( xContext
, 3, false )
165 CartesianCoordinateSystem3d::~CartesianCoordinateSystem3d()
168 // ____ XServiceInfo ____
169 Sequence
< OUString
> CartesianCoordinateSystem3d::getSupportedServiceNames_Static()
171 Sequence
< OUString
> aServices( 2 );
172 aServices
[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME
;
173 aServices
[ 1 ] = lcl_aServiceNameCartesian3d
;
177 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
178 OUString SAL_CALL
CartesianCoordinateSystem3d::getImplementationName()
179 throw( css::uno::RuntimeException
, std::exception
)
181 return getImplementationName_Static();
184 OUString
CartesianCoordinateSystem3d::getImplementationName_Static()
186 return OUString(lcl_aImplementationNameCartesian3d
);
189 sal_Bool SAL_CALL
CartesianCoordinateSystem3d::supportsService( const OUString
& rServiceName
)
190 throw( css::uno::RuntimeException
, std::exception
)
192 return cppu::supportsService(this, rServiceName
);
195 css::uno::Sequence
< OUString
> SAL_CALL
CartesianCoordinateSystem3d::getSupportedServiceNames()
196 throw( css::uno::RuntimeException
, std::exception
)
198 return getSupportedServiceNames_Static();
203 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
* SAL_CALL
204 com_sun_star_comp_chart2_CartesianCoordinateSystem2d_get_implementation(css::uno::XComponentContext
*context
,
205 css::uno::Sequence
<css::uno::Any
> const &)
207 return cppu::acquire(new ::chart::CartesianCoordinateSystem2d(context
));
210 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
* SAL_CALL
211 com_sun_star_comp_chart2_CartesianCoordinateSystem3d_get_implementation(css::uno::XComponentContext
*context
,
212 css::uno::Sequence
<css::uno::Any
> const &)
214 return cppu::acquire(new ::chart::CartesianCoordinateSystem3d(context
));
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */