merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / inc / Scaling.hxx
blob29fd8e2fb2e0b6ff831fa666bfedba8e4b8a03fe
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _CHART2_SCALING_HXX
28 #define _CHART2_SCALING_HXX
29 #include "ServiceMacros.hxx"
30 #include <com/sun/star/chart2/XScaling.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XServiceName.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <cppuhelper/implbase3.hxx>
36 //.............................................................................
37 namespace chart
39 //.............................................................................
41 //-----------------------------------------------------------------------------
42 /**
45 class LogarithmicScaling :
46 public ::cppu::WeakImplHelper3 <
47 ::com::sun::star::chart2::XScaling,
48 ::com::sun::star::lang::XServiceName,
49 ::com::sun::star::lang::XServiceInfo
52 public:
53 /// base is 10.0
54 explicit LogarithmicScaling(
55 const ::com::sun::star::uno::Reference<
56 ::com::sun::star::uno::XComponentContext > & xContext );
57 LogarithmicScaling( double fBase = 10.0 );
58 virtual ~LogarithmicScaling();
60 /// establish methods for factory instatiation
61 APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
62 /// declare XServiceInfo methods
63 APPHELPER_XSERVICEINFO_DECL()
65 // ____ XScaling ____
66 virtual double SAL_CALL doScaling( double value )
67 throw (::com::sun::star::uno::RuntimeException);
69 virtual ::com::sun::star::uno::Reference<
70 ::com::sun::star::chart2::XScaling > SAL_CALL
71 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
73 // ____ XServiceName ____
74 virtual ::rtl::OUString SAL_CALL getServiceName()
75 throw (::com::sun::star::uno::RuntimeException);
77 private:
78 const double m_fBase;
79 const double m_fLogOfBase;
81 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
84 // ----------------------------------------
86 class ExponentialScaling :
87 public ::cppu::WeakImplHelper3 <
88 ::com::sun::star::chart2::XScaling,
89 ::com::sun::star::lang::XServiceName,
90 ::com::sun::star::lang::XServiceInfo
93 public:
94 /// base is 10.0
95 explicit ExponentialScaling(
96 const ::com::sun::star::uno::Reference<
97 ::com::sun::star::uno::XComponentContext > & xContext );
98 explicit ExponentialScaling( double fBase = 10.0 );
99 virtual ~ExponentialScaling();
101 /// establish methods for factory instatiation
102 APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
103 /// declare XServiceInfo methods
104 APPHELPER_XSERVICEINFO_DECL()
106 // ____ XScaling ____
107 virtual double SAL_CALL
108 doScaling( double value )
109 throw (::com::sun::star::uno::RuntimeException);
111 virtual ::com::sun::star::uno::Reference<
112 ::com::sun::star::chart2::XScaling > SAL_CALL
113 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
115 // ____ XServiceName ____
116 virtual ::rtl::OUString SAL_CALL getServiceName()
117 throw (::com::sun::star::uno::RuntimeException);
119 private:
120 const double m_fBase;
122 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
125 // ----------------------------------------
127 class LinearScaling : public ::cppu::WeakImplHelper3 <
128 ::com::sun::star::chart2::XScaling,
129 ::com::sun::star::lang::XServiceName,
130 ::com::sun::star::lang::XServiceInfo
133 public:
134 /// y(x) = x
135 explicit LinearScaling(
136 const ::com::sun::star::uno::Reference<
137 ::com::sun::star::uno::XComponentContext > & xContext );
138 /// y(x) = fSlope * x + fOffset
139 LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
140 virtual ~LinearScaling();
142 /// establish methods for factory instatiation
143 APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
144 /// declare XServiceInfo methods
145 APPHELPER_XSERVICEINFO_DECL()
147 // ____ XScaling ____
148 virtual double SAL_CALL doScaling( double value )
149 throw (::com::sun::star::uno::RuntimeException);
151 virtual ::com::sun::star::uno::Reference<
152 ::com::sun::star::chart2::XScaling > SAL_CALL
153 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
155 // ____ XServiceName ____
156 virtual ::rtl::OUString SAL_CALL getServiceName()
157 throw (::com::sun::star::uno::RuntimeException);
159 private:
160 const double m_fSlope;
161 const double m_fOffset;
163 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
166 // ----------------------------------------
168 class PowerScaling : public ::cppu::WeakImplHelper3 <
169 ::com::sun::star::chart2::XScaling,
170 ::com::sun::star::lang::XServiceName,
171 ::com::sun::star::lang::XServiceInfo
174 public:
175 /// exponent 10.0
176 explicit PowerScaling(
177 const ::com::sun::star::uno::Reference<
178 ::com::sun::star::uno::XComponentContext > & xContext );
179 explicit PowerScaling( double fExponent = 10.0 );
180 virtual ~PowerScaling();
182 /// establish methods for factory instatiation
183 APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
184 /// declare XServiceInfo methods
185 APPHELPER_XSERVICEINFO_DECL()
187 // ____ XScaling ____
188 virtual double SAL_CALL
189 doScaling( double value )
190 throw (::com::sun::star::uno::RuntimeException);
192 virtual ::com::sun::star::uno::Reference<
193 ::com::sun::star::chart2::XScaling > SAL_CALL
194 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
196 // ____ XServiceName ____
197 virtual ::rtl::OUString SAL_CALL getServiceName()
198 throw (::com::sun::star::uno::RuntimeException);
200 private:
201 const double m_fExponent;
203 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
206 //.............................................................................
207 } //namespace chart
208 //.............................................................................
209 #endif