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 .
19 #ifndef INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
22 #include <com/sun/star/chart2/XScaling.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/lang/XServiceName.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <cppuhelper/implbase3.hxx>
34 class LogarithmicScaling
:
35 public ::cppu::WeakImplHelper3
<
36 ::com::sun::star::chart2::XScaling
,
37 ::com::sun::star::lang::XServiceName
,
38 ::com::sun::star::lang::XServiceInfo
43 explicit LogarithmicScaling(
44 const ::com::sun::star::uno::Reference
<
45 ::com::sun::star::uno::XComponentContext
> & xContext
);
46 LogarithmicScaling( double fBase
= 10.0 );
47 virtual ~LogarithmicScaling();
49 /// establish methods for factory instatiation
50 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
create( css::uno::Reference
< css::uno::XComponentContext
> const & xContext
)
51 throw(css::uno::Exception
)
53 return (::cppu::OWeakObject
*)new LogarithmicScaling( xContext
);
55 /// declare XServiceInfo methods
56 virtual OUString SAL_CALL
getImplementationName()
57 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
58 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
59 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
61 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
63 static OUString
getImplementationName_Static();
64 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
67 virtual double SAL_CALL
doScaling( double value
)
68 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 virtual ::com::sun::star::uno::Reference
<
71 ::com::sun::star::chart2::XScaling
> SAL_CALL
72 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 // ____ XServiceName ____
75 virtual OUString SAL_CALL
getServiceName()
76 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 const double m_fLogOfBase
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
85 class ExponentialScaling
:
86 public ::cppu::WeakImplHelper3
<
87 ::com::sun::star::chart2::XScaling
,
88 ::com::sun::star::lang::XServiceName
,
89 ::com::sun::star::lang::XServiceInfo
94 explicit ExponentialScaling(
95 const ::com::sun::star::uno::Reference
<
96 ::com::sun::star::uno::XComponentContext
> & xContext
);
97 explicit ExponentialScaling( double fBase
= 10.0 );
98 virtual ~ExponentialScaling();
100 /// establish methods for factory instatiation
101 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
create( css::uno::Reference
< css::uno::XComponentContext
> const & xContext
)
102 throw(css::uno::Exception
)
104 return (::cppu::OWeakObject
*)new ExponentialScaling( xContext
);
106 /// declare XServiceInfo methods
107 virtual OUString SAL_CALL
getImplementationName()
108 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
110 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
112 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
114 static OUString
getImplementationName_Static();
115 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
117 // ____ XScaling ____
118 virtual double SAL_CALL
119 doScaling( double value
)
120 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual ::com::sun::star::uno::Reference
<
123 ::com::sun::star::chart2::XScaling
> SAL_CALL
124 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 // ____ XServiceName ____
127 virtual OUString SAL_CALL
getServiceName()
128 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 const double m_fBase
;
133 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
136 class LinearScaling
: public ::cppu::WeakImplHelper3
<
137 ::com::sun::star::chart2::XScaling
,
138 ::com::sun::star::lang::XServiceName
,
139 ::com::sun::star::lang::XServiceInfo
144 explicit LinearScaling(
145 const ::com::sun::star::uno::Reference
<
146 ::com::sun::star::uno::XComponentContext
> & xContext
);
147 /// y(x) = fSlope * x + fOffset
148 LinearScaling( double fSlope
= 1.0, double fOffset
= 0.0 );
149 virtual ~LinearScaling();
151 /// establish methods for factory instatiation
152 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
create( css::uno::Reference
< css::uno::XComponentContext
> const & xContext
)
153 throw(css::uno::Exception
)
155 return (::cppu::OWeakObject
*)new LinearScaling( xContext
);
157 /// declare XServiceInfo methods
158 virtual OUString SAL_CALL
getImplementationName()
159 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
160 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
161 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
163 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
165 static OUString
getImplementationName_Static();
166 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
168 // ____ XScaling ____
169 virtual double SAL_CALL
doScaling( double value
)
170 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
172 virtual ::com::sun::star::uno::Reference
<
173 ::com::sun::star::chart2::XScaling
> SAL_CALL
174 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
176 // ____ XServiceName ____
177 virtual OUString SAL_CALL
getServiceName()
178 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
181 const double m_fSlope
;
182 const double m_fOffset
;
184 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
187 class PowerScaling
: public ::cppu::WeakImplHelper3
<
188 ::com::sun::star::chart2::XScaling
,
189 ::com::sun::star::lang::XServiceName
,
190 ::com::sun::star::lang::XServiceInfo
195 explicit PowerScaling(
196 const ::com::sun::star::uno::Reference
<
197 ::com::sun::star::uno::XComponentContext
> & xContext
);
198 explicit PowerScaling( double fExponent
= 10.0 );
199 virtual ~PowerScaling();
201 /// establish methods for factory instatiation
202 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
create( css::uno::Reference
< css::uno::XComponentContext
> const & xContext
)
203 throw(css::uno::Exception
)
205 return (::cppu::OWeakObject
*)new PowerScaling( xContext
);
207 /// declare XServiceInfo methods
208 virtual OUString SAL_CALL
getImplementationName()
209 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
210 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
211 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
212 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
213 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
215 static OUString
getImplementationName_Static();
216 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
218 // ____ XScaling ____
219 virtual double SAL_CALL
220 doScaling( double value
)
221 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
223 virtual ::com::sun::star::uno::Reference
<
224 ::com::sun::star::chart2::XScaling
> SAL_CALL
225 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
227 // ____ XServiceName ____
228 virtual OUString SAL_CALL
getServiceName()
229 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
232 const double m_fExponent
;
234 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */