update dev300-m58
[ooovba.git] / chart2 / source / inc / Scaling.hxx
blob71d125a99752ba15f1e033cbc1e840453e80d573
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Scaling.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART2_SCALING_HXX
31 #define _CHART2_SCALING_HXX
32 #include "ServiceMacros.hxx"
33 #include <com/sun/star/chart2/XScaling.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/XServiceName.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <cppuhelper/implbase3.hxx>
39 //.............................................................................
40 namespace chart
42 //.............................................................................
44 //-----------------------------------------------------------------------------
45 /**
48 class LogarithmicScaling :
49 public ::cppu::WeakImplHelper3 <
50 ::com::sun::star::chart2::XScaling,
51 ::com::sun::star::lang::XServiceName,
52 ::com::sun::star::lang::XServiceInfo
55 public:
56 /// base is 10.0
57 explicit LogarithmicScaling(
58 const ::com::sun::star::uno::Reference<
59 ::com::sun::star::uno::XComponentContext > & xContext );
60 LogarithmicScaling( double fBase = 10.0 );
61 virtual ~LogarithmicScaling();
63 /// establish methods for factory instatiation
64 APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
65 /// declare XServiceInfo methods
66 APPHELPER_XSERVICEINFO_DECL()
68 // ____ XScaling ____
69 virtual double SAL_CALL doScaling( double value )
70 throw (::com::sun::star::uno::RuntimeException);
72 virtual ::com::sun::star::uno::Reference<
73 ::com::sun::star::chart2::XScaling > SAL_CALL
74 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
76 // ____ XServiceName ____
77 virtual ::rtl::OUString SAL_CALL getServiceName()
78 throw (::com::sun::star::uno::RuntimeException);
80 private:
81 const double m_fBase;
82 const double m_fLogOfBase;
84 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
87 // ----------------------------------------
89 class ExponentialScaling :
90 public ::cppu::WeakImplHelper3 <
91 ::com::sun::star::chart2::XScaling,
92 ::com::sun::star::lang::XServiceName,
93 ::com::sun::star::lang::XServiceInfo
96 public:
97 /// base is 10.0
98 explicit ExponentialScaling(
99 const ::com::sun::star::uno::Reference<
100 ::com::sun::star::uno::XComponentContext > & xContext );
101 explicit ExponentialScaling( double fBase = 10.0 );
102 virtual ~ExponentialScaling();
104 /// establish methods for factory instatiation
105 APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
106 /// declare XServiceInfo methods
107 APPHELPER_XSERVICEINFO_DECL()
109 // ____ XScaling ____
110 virtual double SAL_CALL
111 doScaling( double value )
112 throw (::com::sun::star::uno::RuntimeException);
114 virtual ::com::sun::star::uno::Reference<
115 ::com::sun::star::chart2::XScaling > SAL_CALL
116 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
118 // ____ XServiceName ____
119 virtual ::rtl::OUString SAL_CALL getServiceName()
120 throw (::com::sun::star::uno::RuntimeException);
122 private:
123 const double m_fBase;
125 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
128 // ----------------------------------------
130 class LinearScaling : public ::cppu::WeakImplHelper3 <
131 ::com::sun::star::chart2::XScaling,
132 ::com::sun::star::lang::XServiceName,
133 ::com::sun::star::lang::XServiceInfo
136 public:
137 /// y(x) = x
138 explicit LinearScaling(
139 const ::com::sun::star::uno::Reference<
140 ::com::sun::star::uno::XComponentContext > & xContext );
141 /// y(x) = fSlope * x + fOffset
142 LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
143 virtual ~LinearScaling();
145 /// establish methods for factory instatiation
146 APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
147 /// declare XServiceInfo methods
148 APPHELPER_XSERVICEINFO_DECL()
150 // ____ XScaling ____
151 virtual double SAL_CALL doScaling( double value )
152 throw (::com::sun::star::uno::RuntimeException);
154 virtual ::com::sun::star::uno::Reference<
155 ::com::sun::star::chart2::XScaling > SAL_CALL
156 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
158 // ____ XServiceName ____
159 virtual ::rtl::OUString SAL_CALL getServiceName()
160 throw (::com::sun::star::uno::RuntimeException);
162 private:
163 const double m_fSlope;
164 const double m_fOffset;
166 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
169 // ----------------------------------------
171 class PowerScaling : public ::cppu::WeakImplHelper3 <
172 ::com::sun::star::chart2::XScaling,
173 ::com::sun::star::lang::XServiceName,
174 ::com::sun::star::lang::XServiceInfo
177 public:
178 /// exponent 10.0
179 explicit PowerScaling(
180 const ::com::sun::star::uno::Reference<
181 ::com::sun::star::uno::XComponentContext > & xContext );
182 explicit PowerScaling( double fExponent = 10.0 );
183 virtual ~PowerScaling();
185 /// establish methods for factory instatiation
186 APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
187 /// declare XServiceInfo methods
188 APPHELPER_XSERVICEINFO_DECL()
190 // ____ XScaling ____
191 virtual double SAL_CALL
192 doScaling( double value )
193 throw (::com::sun::star::uno::RuntimeException);
195 virtual ::com::sun::star::uno::Reference<
196 ::com::sun::star::chart2::XScaling > SAL_CALL
197 getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
199 // ____ XServiceName ____
200 virtual ::rtl::OUString SAL_CALL getServiceName()
201 throw (::com::sun::star::uno::RuntimeException);
203 private:
204 const double m_fExponent;
206 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
209 //.............................................................................
210 } //namespace chart
211 //.............................................................................
212 #endif