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