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 _CHART2_SCALING_HXX
20 #define _CHART2_SCALING_HXX
21 #include "ServiceMacros.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>
28 //.............................................................................
31 //.............................................................................
33 //-----------------------------------------------------------------------------
37 class LogarithmicScaling
:
38 public ::cppu::WeakImplHelper3
<
39 ::com::sun::star::chart2::XScaling
,
40 ::com::sun::star::lang::XServiceName
,
41 ::com::sun::star::lang::XServiceInfo
46 explicit LogarithmicScaling(
47 const ::com::sun::star::uno::Reference
<
48 ::com::sun::star::uno::XComponentContext
> & xContext
);
49 LogarithmicScaling( double fBase
= 10.0 );
50 virtual ~LogarithmicScaling();
52 /// establish methods for factory instatiation
53 APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling
)
54 /// declare XServiceInfo methods
55 APPHELPER_XSERVICEINFO_DECL()
58 virtual double SAL_CALL
doScaling( double value
)
59 throw (::com::sun::star::uno::RuntimeException
);
61 virtual ::com::sun::star::uno::Reference
<
62 ::com::sun::star::chart2::XScaling
> SAL_CALL
63 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
);
65 // ____ XServiceName ____
66 virtual OUString SAL_CALL
getServiceName()
67 throw (::com::sun::star::uno::RuntimeException
);
71 const double m_fLogOfBase
;
73 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
76 // ----------------------------------------
78 class ExponentialScaling
:
79 public ::cppu::WeakImplHelper3
<
80 ::com::sun::star::chart2::XScaling
,
81 ::com::sun::star::lang::XServiceName
,
82 ::com::sun::star::lang::XServiceInfo
87 explicit ExponentialScaling(
88 const ::com::sun::star::uno::Reference
<
89 ::com::sun::star::uno::XComponentContext
> & xContext
);
90 explicit ExponentialScaling( double fBase
= 10.0 );
91 virtual ~ExponentialScaling();
93 /// establish methods for factory instatiation
94 APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling
)
95 /// declare XServiceInfo methods
96 APPHELPER_XSERVICEINFO_DECL()
99 virtual double SAL_CALL
100 doScaling( double value
)
101 throw (::com::sun::star::uno::RuntimeException
);
103 virtual ::com::sun::star::uno::Reference
<
104 ::com::sun::star::chart2::XScaling
> SAL_CALL
105 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
);
107 // ____ XServiceName ____
108 virtual OUString SAL_CALL
getServiceName()
109 throw (::com::sun::star::uno::RuntimeException
);
112 const double m_fBase
;
114 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
117 // ----------------------------------------
119 class LinearScaling
: public ::cppu::WeakImplHelper3
<
120 ::com::sun::star::chart2::XScaling
,
121 ::com::sun::star::lang::XServiceName
,
122 ::com::sun::star::lang::XServiceInfo
127 explicit LinearScaling(
128 const ::com::sun::star::uno::Reference
<
129 ::com::sun::star::uno::XComponentContext
> & xContext
);
130 /// y(x) = fSlope * x + fOffset
131 LinearScaling( double fSlope
= 1.0, double fOffset
= 0.0 );
132 virtual ~LinearScaling();
134 /// establish methods for factory instatiation
135 APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling
)
136 /// declare XServiceInfo methods
137 APPHELPER_XSERVICEINFO_DECL()
139 // ____ XScaling ____
140 virtual double SAL_CALL
doScaling( double value
)
141 throw (::com::sun::star::uno::RuntimeException
);
143 virtual ::com::sun::star::uno::Reference
<
144 ::com::sun::star::chart2::XScaling
> SAL_CALL
145 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
);
147 // ____ XServiceName ____
148 virtual OUString SAL_CALL
getServiceName()
149 throw (::com::sun::star::uno::RuntimeException
);
152 const double m_fSlope
;
153 const double m_fOffset
;
155 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
158 // ----------------------------------------
160 class PowerScaling
: public ::cppu::WeakImplHelper3
<
161 ::com::sun::star::chart2::XScaling
,
162 ::com::sun::star::lang::XServiceName
,
163 ::com::sun::star::lang::XServiceInfo
168 explicit PowerScaling(
169 const ::com::sun::star::uno::Reference
<
170 ::com::sun::star::uno::XComponentContext
> & xContext
);
171 explicit PowerScaling( double fExponent
= 10.0 );
172 virtual ~PowerScaling();
174 /// establish methods for factory instatiation
175 APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling
)
176 /// declare XServiceInfo methods
177 APPHELPER_XSERVICEINFO_DECL()
179 // ____ XScaling ____
180 virtual double SAL_CALL
181 doScaling( double value
)
182 throw (::com::sun::star::uno::RuntimeException
);
184 virtual ::com::sun::star::uno::Reference
<
185 ::com::sun::star::chart2::XScaling
> SAL_CALL
186 getInverseScaling() throw (::com::sun::star::uno::RuntimeException
);
188 // ____ XServiceName ____
189 virtual OUString SAL_CALL
getServiceName()
190 throw (::com::sun::star::uno::RuntimeException
);
193 const double m_fExponent
;
195 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
198 //.............................................................................
200 //.............................................................................
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */