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_DATESCALING_HXX
24 #define _CHART2_DATESCALING_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 #include <tools/date.hxx>
32 
33 //.............................................................................
34 namespace chart
35 {
36 //.............................................................................
37 
38 //-----------------------------------------------------------------------------
39 /**
40 */
41 
42 class DateScaling :
43         public ::cppu::WeakImplHelper3 <
44         ::com::sun::star::chart2::XScaling,
45         ::com::sun::star::lang::XServiceName,
46         ::com::sun::star::lang::XServiceInfo
47         >
48 {
49 public:
50     DateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
51     virtual ~DateScaling();
52 
53     /// declare XServiceInfo methods
54     APPHELPER_XSERVICEINFO_DECL()
55 
56     // ____ XScaling ____
57     virtual double SAL_CALL doScaling( double value )
58         throw (::com::sun::star::uno::RuntimeException);
59 
60     virtual ::com::sun::star::uno::Reference<
61         ::com::sun::star::chart2::XScaling > SAL_CALL
62         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
63 
64     // ____ XServiceName ____
65     virtual ::rtl::OUString SAL_CALL getServiceName()
66         throw (::com::sun::star::uno::RuntimeException);
67 
68 private:
69     const Date m_aNullDate;
70     const sal_Int32 m_nTimeUnit;
71     const bool m_bShifted;
72 };
73 
74 class InverseDateScaling :
75         public ::cppu::WeakImplHelper3 <
76         ::com::sun::star::chart2::XScaling,
77         ::com::sun::star::lang::XServiceName,
78         ::com::sun::star::lang::XServiceInfo
79         >
80 {
81 public:
82     InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
83     virtual ~InverseDateScaling();
84 
85     /// declare XServiceInfo methods
86     APPHELPER_XSERVICEINFO_DECL()
87 
88     // ____ XScaling ____
89     virtual double SAL_CALL doScaling( double value )
90         throw (::com::sun::star::uno::RuntimeException);
91 
92     virtual ::com::sun::star::uno::Reference<
93         ::com::sun::star::chart2::XScaling > SAL_CALL
94         getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
95 
96     // ____ XServiceName ____
97     virtual ::rtl::OUString SAL_CALL getServiceName()
98         throw (::com::sun::star::uno::RuntimeException);
99 
100 private:
101     const Date m_aNullDate;
102     const sal_Int32 m_nTimeUnit;
103     const bool m_bShifted;
104 };
105 
106 //.............................................................................
107 } //namespace chart
108 //.............................................................................
109 #endif
110 
111