d6cd3b671e
2006/04/05 11:13:12 bm 1.3.12.1: make Scalings available via factory
230 lines
7.5 KiB
C++
230 lines
7.5 KiB
C++
/*************************************************************************
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: Scaling.hxx,v $
|
|
*
|
|
* $Revision: 1.4 $
|
|
*
|
|
* last change: $Author: vg $ $Date: 2007-05-22 18:22:38 $
|
|
*
|
|
* The Contents of this file are made available subject to
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
|
*
|
|
*
|
|
* GNU Lesser General Public License Version 2.1
|
|
* =============================================
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
* MA 02111-1307 USA
|
|
*
|
|
************************************************************************/
|
|
#ifndef _CHART2_SCALING_HXX
|
|
#define _CHART2_SCALING_HXX
|
|
#include "ServiceMacros.hxx"
|
|
|
|
#ifndef _COM_SUN_STAR_CHART2_XSCALING_HPP_
|
|
#include <com/sun/star/chart2/XScaling.hpp>
|
|
#endif
|
|
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
#endif
|
|
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
|
|
#include <com/sun/star/lang/XServiceName.hpp>
|
|
#endif
|
|
#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
|
#endif
|
|
|
|
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
|
|
#include <cppuhelper/implbase3.hxx>
|
|
#endif
|
|
|
|
//.............................................................................
|
|
namespace chart
|
|
{
|
|
//.............................................................................
|
|
|
|
//-----------------------------------------------------------------------------
|
|
/**
|
|
*/
|
|
|
|
class LogarithmicScaling : public ::cppu::WeakImplHelper3 <
|
|
::com::sun::star::chart2::XScaling,
|
|
::com::sun::star::lang::XServiceName,
|
|
::com::sun::star::lang::XServiceInfo
|
|
>
|
|
{
|
|
public:
|
|
/// base is 10.0
|
|
explicit LogarithmicScaling(
|
|
const ::com::sun::star::uno::Reference<
|
|
::com::sun::star::uno::XComponentContext > & xContext );
|
|
LogarithmicScaling( double fBase = 10.0 );
|
|
virtual ~LogarithmicScaling();
|
|
|
|
/// establish methods for factory instatiation
|
|
APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
|
|
/// declare XServiceInfo methods
|
|
APPHELPER_XSERVICEINFO_DECL()
|
|
|
|
// ____ XScaling ____
|
|
virtual double SAL_CALL
|
|
doScaling( double value )
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Reference<
|
|
::com::sun::star::chart2::XScaling > SAL_CALL
|
|
getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
// ____ XServiceName ____
|
|
virtual ::rtl::OUString SAL_CALL getServiceName()
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
private:
|
|
const double m_fBase;
|
|
const double m_fLogOfBase;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
|
|
};
|
|
|
|
// ----------------------------------------
|
|
|
|
class ExponentialScaling : public ::cppu::WeakImplHelper3 <
|
|
::com::sun::star::chart2::XScaling,
|
|
::com::sun::star::lang::XServiceName,
|
|
::com::sun::star::lang::XServiceInfo
|
|
>
|
|
{
|
|
public:
|
|
/// base is 10.0
|
|
explicit ExponentialScaling(
|
|
const ::com::sun::star::uno::Reference<
|
|
::com::sun::star::uno::XComponentContext > & xContext );
|
|
explicit ExponentialScaling( double fBase = 10.0 );
|
|
virtual ~ExponentialScaling();
|
|
|
|
/// establish methods for factory instatiation
|
|
APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
|
|
/// declare XServiceInfo methods
|
|
APPHELPER_XSERVICEINFO_DECL()
|
|
|
|
// ____ XScaling ____
|
|
virtual double SAL_CALL
|
|
doScaling( double value )
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Reference<
|
|
::com::sun::star::chart2::XScaling > SAL_CALL
|
|
getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
// ____ XServiceName ____
|
|
virtual ::rtl::OUString SAL_CALL getServiceName()
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
private:
|
|
const double m_fBase;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
|
|
};
|
|
|
|
// ----------------------------------------
|
|
|
|
class LinearScaling : public ::cppu::WeakImplHelper3 <
|
|
::com::sun::star::chart2::XScaling,
|
|
::com::sun::star::lang::XServiceName,
|
|
::com::sun::star::lang::XServiceInfo
|
|
>
|
|
{
|
|
public:
|
|
/// y(x) = x
|
|
explicit LinearScaling(
|
|
const ::com::sun::star::uno::Reference<
|
|
::com::sun::star::uno::XComponentContext > & xContext );
|
|
/// y(x) = fSlope * x + fOffset
|
|
LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
|
|
virtual ~LinearScaling();
|
|
|
|
/// establish methods for factory instatiation
|
|
APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
|
|
/// declare XServiceInfo methods
|
|
APPHELPER_XSERVICEINFO_DECL()
|
|
|
|
// ____ XScaling ____
|
|
virtual double SAL_CALL
|
|
doScaling( double value )
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Reference<
|
|
::com::sun::star::chart2::XScaling > SAL_CALL
|
|
getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
// ____ XServiceName ____
|
|
virtual ::rtl::OUString SAL_CALL getServiceName()
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
private:
|
|
const double m_fSlope;
|
|
const double m_fOffset;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
|
|
};
|
|
|
|
// ----------------------------------------
|
|
|
|
class PowerScaling : public ::cppu::WeakImplHelper3 <
|
|
::com::sun::star::chart2::XScaling,
|
|
::com::sun::star::lang::XServiceName,
|
|
::com::sun::star::lang::XServiceInfo
|
|
>
|
|
{
|
|
public:
|
|
/// exponent 10.0
|
|
explicit PowerScaling(
|
|
const ::com::sun::star::uno::Reference<
|
|
::com::sun::star::uno::XComponentContext > & xContext );
|
|
explicit PowerScaling( double fExponent = 10.0 );
|
|
virtual ~PowerScaling();
|
|
|
|
/// establish methods for factory instatiation
|
|
APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
|
|
/// declare XServiceInfo methods
|
|
APPHELPER_XSERVICEINFO_DECL()
|
|
|
|
// ____ XScaling ____
|
|
virtual double SAL_CALL
|
|
doScaling( double value )
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Reference<
|
|
::com::sun::star::chart2::XScaling > SAL_CALL
|
|
getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
// ____ XServiceName ____
|
|
virtual ::rtl::OUString SAL_CALL getServiceName()
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
private:
|
|
const double m_fExponent;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
|
|
};
|
|
|
|
//.............................................................................
|
|
} //namespace chart
|
|
//.............................................................................
|
|
#endif
|
|
|