1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CHART2_DATESCALING_HXX
28 #define _CHART2_DATESCALING_HXX
29 #include "ServiceMacros.hxx"
30 #include <com/sun/star/chart2/XScaling.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XServiceName.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <cppuhelper/implbase3.hxx>
35 #include <tools/date.hxx>
36 
37 //.............................................................................
38 namespace chart
39 {
40 //.............................................................................
41 
42 //-----------------------------------------------------------------------------
43 /**
44 */
45 
46 class DateScaling :
47         public ::cppu::WeakImplHelper3 <
48         ::com::sun::star::chart2::XScaling,
49         ::com::sun::star::lang::XServiceName,
50         ::com::sun::star::lang::XServiceInfo
51         >
52 {
53 public:
54     DateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
55     virtual ~DateScaling();
56 
57     /// declare XServiceInfo methods
58     APPHELPER_XSERVICEINFO_DECL()
59 
60     // ____ XScaling ____
61     virtual double SAL_CALL doScaling( double value )
62         throw (::com::sun::star::uno::RuntimeException);
63 
64     virtual ::com::sun::star::uno::Reference<
65         ::com::sun::star::chart2::XScaling > SAL_CALL
66         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
67 
68     // ____ XServiceName ____
69     virtual ::rtl::OUString SAL_CALL getServiceName()
70         throw (::com::sun::star::uno::RuntimeException);
71 
72 private:
73     const Date m_aNullDate;
74     const sal_Int32 m_nTimeUnit;
75     const bool m_bShifted;
76 };
77 
78 class InverseDateScaling :
79         public ::cppu::WeakImplHelper3 <
80         ::com::sun::star::chart2::XScaling,
81         ::com::sun::star::lang::XServiceName,
82         ::com::sun::star::lang::XServiceInfo
83         >
84 {
85 public:
86     InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
87     virtual ~InverseDateScaling();
88 
89     /// declare XServiceInfo methods
90     APPHELPER_XSERVICEINFO_DECL()
91 
92     // ____ XScaling ____
93     virtual double SAL_CALL doScaling( double value )
94         throw (::com::sun::star::uno::RuntimeException);
95 
96     virtual ::com::sun::star::uno::Reference<
97         ::com::sun::star::chart2::XScaling > SAL_CALL
98         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
99 
100     // ____ XServiceName ____
101     virtual ::rtl::OUString SAL_CALL getServiceName()
102         throw (::com::sun::star::uno::RuntimeException);
103 
104 private:
105     const Date m_aNullDate;
106     const sal_Int32 m_nTimeUnit;
107     const bool m_bShifted;
108 };
109 
110 //.............................................................................
111 } //namespace chart
112 //.............................................................................
113 #endif
114 
115