xref: /trunk/main/chart2/source/view/axes/DateScaling.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
59     virtual ::com::sun::star::uno::Reference<
60         ::com::sun::star::chart2::XScaling > SAL_CALL
61         getInverseScaling();
62 
63     // ____ XServiceName ____
64     virtual ::rtl::OUString SAL_CALL getServiceName();
65 
66 private:
67     const Date m_aNullDate;
68     const sal_Int32 m_nTimeUnit;
69     const bool m_bShifted;
70 };
71 
72 class InverseDateScaling :
73         public ::cppu::WeakImplHelper3 <
74         ::com::sun::star::chart2::XScaling,
75         ::com::sun::star::lang::XServiceName,
76         ::com::sun::star::lang::XServiceInfo
77         >
78 {
79 public:
80     InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
81     virtual ~InverseDateScaling();
82 
83     /// declare XServiceInfo methods
84     APPHELPER_XSERVICEINFO_DECL()
85 
86     // ____ XScaling ____
87     virtual double SAL_CALL doScaling( double value );
88 
89     virtual ::com::sun::star::uno::Reference<
90         ::com::sun::star::chart2::XScaling > SAL_CALL
91         getInverseScaling();
92 
93     // ____ XServiceName ____
94     virtual ::rtl::OUString SAL_CALL getServiceName();
95 
96 private:
97     const Date m_aNullDate;
98     const sal_Int32 m_nTimeUnit;
99     const bool m_bShifted;
100 };
101 
102 //.............................................................................
103 } //namespace chart
104 //.............................................................................
105 #endif
106