Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / Scaling.hxx
blob7314ce84ebbc8fb9a535af1bf500cee7787f42fd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_SCALING_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 <cppuhelper/implbase.hxx>
27 namespace chart
30 class LogarithmicScaling :
31 public ::cppu::WeakImplHelper<
32 css::chart2::XScaling,
33 css::lang::XServiceName,
34 css::lang::XServiceInfo
37 public:
38 /// base is 10.0
39 explicit LogarithmicScaling();
40 LogarithmicScaling( double fBase );
41 virtual ~LogarithmicScaling() override;
43 /// declare XServiceInfo methods
44 virtual OUString SAL_CALL getImplementationName() override;
45 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
46 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
48 // ____ XScaling ____
49 virtual double SAL_CALL doScaling( double value ) override;
51 virtual css::uno::Reference<
52 css::chart2::XScaling > SAL_CALL
53 getInverseScaling() override;
55 // ____ XServiceName ____
56 virtual OUString SAL_CALL getServiceName() override;
58 private:
59 const double m_fBase;
60 const double m_fLogOfBase;
63 class ExponentialScaling :
64 public ::cppu::WeakImplHelper<
65 css::chart2::XScaling,
66 css::lang::XServiceName,
67 css::lang::XServiceInfo
70 public:
71 /// base is 10.0
72 explicit ExponentialScaling();
73 explicit ExponentialScaling( double fBase );
74 virtual ~ExponentialScaling() override;
76 /// declare XServiceInfo methods
77 virtual OUString SAL_CALL getImplementationName() override;
78 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
81 // ____ XScaling ____
82 virtual double SAL_CALL
83 doScaling( double value ) override;
85 virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL
86 getInverseScaling() override;
88 // ____ XServiceName ____
89 virtual OUString SAL_CALL getServiceName() override;
91 private:
92 const double m_fBase;
95 class LinearScaling : public ::cppu::WeakImplHelper<
96 css::chart2::XScaling,
97 css::lang::XServiceName,
98 css::lang::XServiceInfo
101 public:
102 /// y(x) = x
103 explicit LinearScaling();
104 /// y(x) = fSlope * x + fOffset
105 LinearScaling( double fSlope, double fOffset );
106 virtual ~LinearScaling() override;
108 /// declare XServiceInfo methods
109 virtual OUString SAL_CALL getImplementationName() override;
110 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
111 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
113 // ____ XScaling ____
114 virtual double SAL_CALL doScaling( double value ) override;
116 virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL
117 getInverseScaling() override;
119 // ____ XServiceName ____
120 virtual OUString SAL_CALL getServiceName() override;
122 private:
123 const double m_fSlope;
124 const double m_fOffset;
127 class PowerScaling : public ::cppu::WeakImplHelper<
128 css::chart2::XScaling,
129 css::lang::XServiceName,
130 css::lang::XServiceInfo
133 public:
134 /// exponent 10.0
135 explicit PowerScaling();
136 explicit PowerScaling( double fExponent );
137 virtual ~PowerScaling() override;
139 /// declare XServiceInfo methods
140 virtual OUString SAL_CALL getImplementationName() override;
141 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
142 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
144 // ____ XScaling ____
145 virtual double SAL_CALL
146 doScaling( double value ) override;
148 virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL
149 getInverseScaling() override;
151 // ____ XServiceName ____
152 virtual OUString SAL_CALL getServiceName() override;
154 private:
155 const double m_fExponent;
158 } //namespace chart
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */