Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
20 : #define INCLUDED_CHART2_SOURCE_INC_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>
27 :
28 : namespace chart
29 : {
30 :
31 : /**
32 : */
33 :
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
39 : >
40 : {
41 : public:
42 : /// base is 10.0
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();
48 :
49 : /// establish methods for factory instatiation
50 6 : APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
51 : /// declare XServiceInfo methods
52 : APPHELPER_XSERVICEINFO_DECL()
53 :
54 : // ____ XScaling ____
55 : virtual double SAL_CALL doScaling( double value )
56 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : virtual ::com::sun::star::uno::Reference<
59 : ::com::sun::star::chart2::XScaling > SAL_CALL
60 : getInverseScaling() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 :
62 : // ____ XServiceName ____
63 : virtual OUString SAL_CALL getServiceName()
64 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 :
66 : private:
67 : const double m_fBase;
68 : const double m_fLogOfBase;
69 :
70 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
71 : };
72 :
73 : class ExponentialScaling :
74 : public ::cppu::WeakImplHelper3 <
75 : ::com::sun::star::chart2::XScaling,
76 : ::com::sun::star::lang::XServiceName,
77 : ::com::sun::star::lang::XServiceInfo
78 : >
79 : {
80 : public:
81 : /// base is 10.0
82 : explicit ExponentialScaling(
83 : const ::com::sun::star::uno::Reference<
84 : ::com::sun::star::uno::XComponentContext > & xContext );
85 : explicit ExponentialScaling( double fBase = 10.0 );
86 : virtual ~ExponentialScaling();
87 :
88 : /// establish methods for factory instatiation
89 2 : APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
90 : /// declare XServiceInfo methods
91 : APPHELPER_XSERVICEINFO_DECL()
92 :
93 : // ____ XScaling ____
94 : virtual double SAL_CALL
95 : doScaling( double value )
96 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 :
98 : virtual ::com::sun::star::uno::Reference<
99 : ::com::sun::star::chart2::XScaling > SAL_CALL
100 : getInverseScaling() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 :
102 : // ____ XServiceName ____
103 : virtual OUString SAL_CALL getServiceName()
104 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 :
106 : private:
107 : const double m_fBase;
108 :
109 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
110 : };
111 :
112 : class LinearScaling : public ::cppu::WeakImplHelper3 <
113 : ::com::sun::star::chart2::XScaling,
114 : ::com::sun::star::lang::XServiceName,
115 : ::com::sun::star::lang::XServiceInfo
116 : >
117 : {
118 : public:
119 : /// y(x) = x
120 : explicit LinearScaling(
121 : const ::com::sun::star::uno::Reference<
122 : ::com::sun::star::uno::XComponentContext > & xContext );
123 : /// y(x) = fSlope * x + fOffset
124 : LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
125 : virtual ~LinearScaling();
126 :
127 : /// establish methods for factory instatiation
128 362 : APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
129 : /// declare XServiceInfo methods
130 : APPHELPER_XSERVICEINFO_DECL()
131 :
132 : // ____ XScaling ____
133 : virtual double SAL_CALL doScaling( double value )
134 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : virtual ::com::sun::star::uno::Reference<
137 : ::com::sun::star::chart2::XScaling > SAL_CALL
138 : getInverseScaling() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : // ____ XServiceName ____
141 : virtual OUString SAL_CALL getServiceName()
142 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 :
144 : private:
145 : const double m_fSlope;
146 : const double m_fOffset;
147 :
148 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
149 : };
150 :
151 : class PowerScaling : public ::cppu::WeakImplHelper3 <
152 : ::com::sun::star::chart2::XScaling,
153 : ::com::sun::star::lang::XServiceName,
154 : ::com::sun::star::lang::XServiceInfo
155 : >
156 : {
157 : public:
158 : /// exponent 10.0
159 : explicit PowerScaling(
160 : const ::com::sun::star::uno::Reference<
161 : ::com::sun::star::uno::XComponentContext > & xContext );
162 : explicit PowerScaling( double fExponent = 10.0 );
163 : virtual ~PowerScaling();
164 :
165 : /// establish methods for factory instatiation
166 2 : APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
167 : /// declare XServiceInfo methods
168 : APPHELPER_XSERVICEINFO_DECL()
169 :
170 : // ____ XScaling ____
171 : virtual double SAL_CALL
172 : doScaling( double value )
173 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 :
175 : virtual ::com::sun::star::uno::Reference<
176 : ::com::sun::star::chart2::XScaling > SAL_CALL
177 : getInverseScaling() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 :
179 : // ____ XServiceName ____
180 : virtual OUString SAL_CALL getServiceName()
181 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 :
183 : private:
184 : const double m_fExponent;
185 :
186 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
187 : };
188 :
189 : } //namespace chart
190 : #endif
191 :
192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|