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