xref: /AOO41X/main/chart2/source/inc/Scaling.hxx (revision de7b3f825c374d9f7270d1282e9d92876f197200)
1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CHART2_SCALING_HXX
24cdf0e10cSrcweir #define _CHART2_SCALING_HXX
25cdf0e10cSrcweir #include "ServiceMacros.hxx"
26cdf0e10cSrcweir #include <com/sun/star/chart2/XScaling.hpp>
27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
29cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
30cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //.............................................................................
33cdf0e10cSrcweir namespace chart
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //.............................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //-----------------------------------------------------------------------------
38cdf0e10cSrcweir /**
39cdf0e10cSrcweir */
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class LogarithmicScaling :
42cdf0e10cSrcweir         public ::cppu::WeakImplHelper3 <
43cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling,
44cdf0e10cSrcweir         ::com::sun::star::lang::XServiceName,
45cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
46cdf0e10cSrcweir         >
47cdf0e10cSrcweir {
48cdf0e10cSrcweir public:
49cdf0e10cSrcweir     /// base is 10.0
50cdf0e10cSrcweir     explicit LogarithmicScaling(
51cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
52cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
53cdf0e10cSrcweir     LogarithmicScaling( double fBase = 10.0 );
54cdf0e10cSrcweir     virtual ~LogarithmicScaling();
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     /// establish methods for factory instatiation
57cdf0e10cSrcweir 	APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
58cdf0e10cSrcweir     /// declare XServiceInfo methods
59cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     // ____ XScaling ____
62cdf0e10cSrcweir     virtual double SAL_CALL doScaling( double value )
63cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
66cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling > SAL_CALL
67cdf0e10cSrcweir         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     // ____ XServiceName ____
70cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getServiceName()
71cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir     const double m_fBase;
75cdf0e10cSrcweir     const double m_fLogOfBase;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >      m_xContext;
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // ----------------------------------------
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class ExponentialScaling :
83cdf0e10cSrcweir         public ::cppu::WeakImplHelper3 <
84cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling,
85cdf0e10cSrcweir         ::com::sun::star::lang::XServiceName,
86cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
87cdf0e10cSrcweir         >
88cdf0e10cSrcweir {
89cdf0e10cSrcweir public:
90cdf0e10cSrcweir     /// base is 10.0
91cdf0e10cSrcweir     explicit ExponentialScaling(
92cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
93cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
94cdf0e10cSrcweir     explicit ExponentialScaling( double fBase = 10.0 );
95cdf0e10cSrcweir     virtual ~ExponentialScaling();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     /// establish methods for factory instatiation
98cdf0e10cSrcweir 	APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
99cdf0e10cSrcweir     /// declare XServiceInfo methods
100cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     // ____ XScaling ____
103cdf0e10cSrcweir         virtual double SAL_CALL
104cdf0e10cSrcweir     doScaling( double value )
105cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference<
108cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling > SAL_CALL
109cdf0e10cSrcweir     getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     // ____ XServiceName ____
112cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getServiceName()
113cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir private:
116cdf0e10cSrcweir     const double m_fBase;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >      m_xContext;
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir // ----------------------------------------
122cdf0e10cSrcweir 
123cdf0e10cSrcweir class LinearScaling : public ::cppu::WeakImplHelper3 <
124cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling,
125cdf0e10cSrcweir         ::com::sun::star::lang::XServiceName,
126cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
127cdf0e10cSrcweir         >
128cdf0e10cSrcweir {
129cdf0e10cSrcweir public:
130cdf0e10cSrcweir     /// y(x) = x
131cdf0e10cSrcweir     explicit LinearScaling(
132cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
133cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
134cdf0e10cSrcweir     /// y(x) = fSlope * x + fOffset
135cdf0e10cSrcweir     LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
136cdf0e10cSrcweir     virtual ~LinearScaling();
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     /// establish methods for factory instatiation
139cdf0e10cSrcweir 	APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
140cdf0e10cSrcweir     /// declare XServiceInfo methods
141cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // ____ XScaling ____
144cdf0e10cSrcweir     virtual double SAL_CALL doScaling( double value )
145cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
148cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling > SAL_CALL
149cdf0e10cSrcweir         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     // ____ XServiceName ____
152cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getServiceName()
153cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir private:
156cdf0e10cSrcweir     const double m_fSlope;
157cdf0e10cSrcweir     const double m_fOffset;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >      m_xContext;
160cdf0e10cSrcweir };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir // ----------------------------------------
163cdf0e10cSrcweir 
164cdf0e10cSrcweir class PowerScaling : public ::cppu::WeakImplHelper3 <
165cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling,
166cdf0e10cSrcweir         ::com::sun::star::lang::XServiceName,
167cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
168cdf0e10cSrcweir         >
169cdf0e10cSrcweir {
170cdf0e10cSrcweir public:
171cdf0e10cSrcweir     /// exponent 10.0
172cdf0e10cSrcweir     explicit PowerScaling(
173cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
174cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
175cdf0e10cSrcweir     explicit PowerScaling( double fExponent = 10.0 );
176cdf0e10cSrcweir     virtual ~PowerScaling();
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     /// establish methods for factory instatiation
179cdf0e10cSrcweir 	APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
180cdf0e10cSrcweir     /// declare XServiceInfo methods
181cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     // ____ XScaling ____
184cdf0e10cSrcweir         virtual double SAL_CALL
185cdf0e10cSrcweir     doScaling( double value )
186cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference<
189cdf0e10cSrcweir         ::com::sun::star::chart2::XScaling > SAL_CALL
190cdf0e10cSrcweir     getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
191cdf0e10cSrcweir 
192cdf0e10cSrcweir     // ____ XServiceName ____
193cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getServiceName()
194cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
195cdf0e10cSrcweir 
196cdf0e10cSrcweir private:
197cdf0e10cSrcweir     const double m_fExponent;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >      m_xContext;
200cdf0e10cSrcweir };
201cdf0e10cSrcweir 
202cdf0e10cSrcweir //.............................................................................
203cdf0e10cSrcweir } //namespace chart
204cdf0e10cSrcweir //.............................................................................
205cdf0e10cSrcweir #endif
206cdf0e10cSrcweir 
207