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_EXPLICITSCALEVALUES_HXX
24 #define _CHART2_EXPLICITSCALEVALUES_HXX
25 
26 #include "chartviewdllapi.hxx"
27 #include <com/sun/star/chart/TimeInterval.hpp>
28 #include <com/sun/star/chart/TimeUnit.hpp>
29 #include <com/sun/star/chart2/AxisOrientation.hpp>
30 #include <com/sun/star/chart2/AxisType.hpp>
31 #include <com/sun/star/chart2/XScaling.hpp>
32 #include <tools/date.hxx>
33 #include <vector>
34 //.............................................................................
35 namespace chart
36 {
37 //.............................................................................
38 
39 //-----------------------------------------------------------------------------
40 /** This structure contains the explicit values for a scale like Minimum and Maximum.
41     See also ::com::sun::star::chart2::ScaleData.
42 */
43 
44 struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData
45 {
46     ExplicitScaleData();
47 
48     double Minimum;
49     double Maximum;
50     double Origin;
51 
52     ::com::sun::star::chart2::AxisOrientation     Orientation;
53 
54     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > Scaling;
55 
56     sal_Int32   AxisType;//see ::com::sun::star::chart2::AxisType
57     bool        ShiftedCategoryPosition;
58     sal_Int32   TimeResolution; //constant of type <type>::com::sun::star::chart::TimeUnit</type>
59     Date        NullDate;
60 };
61 
62 struct OOO_DLLPUBLIC_CHARTVIEW ExplicitSubIncrement
63 {
64     ExplicitSubIncrement();
65 
66     /** Numbers of intervals between two superior ticks.  For an axis
67         this usually means, that <code>IntervalCount - 1</code>
68         sub-tick-marks are displayed between two superior ticks.
69 
70      */
71     sal_Int32 IntervalCount;
72 
73     /** If <TRUE/>, the distance between two sub-tick-marks on the
74         screen is always the same.  If <FALSE/>, the distances may
75         differ depending on the <type>XScaling</type>.
76      */
77     bool PostEquidistant;
78 };
79 
80 /** describes how tickmarks are positioned on the scale of an axis.
81 */
82 struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
83 {
84     ExplicitIncrementData();
85 
86     /** the following two members are only for date-time axis
87     */
88     ::com::sun::star::chart::TimeInterval   MajorTimeInterval;
89     ::com::sun::star::chart::TimeInterval   MinorTimeInterval;
90 
91     /** the other members are for *not* date-time axis
92     */
93 
94     /** <member>Distance</member> describes the distance between two
95     neighboring main tickmarks on a <type>Scale</type> of an axis.
96     All neighboring main tickmarks have the same constant distance.
97 
98     <p>If the Scale has a <type>XScaling</type> the <member>Distance</member>
99     may be measured in two different ways - that is - before or after the
100     scaling is applied.</p>
101 
102     <p>On a logarithmic scale for example the distance between two main
103     tickmarks is typically measured after the scaling is applied:
104     Distance = log(tick2)-log(tick1)
105     ( log(1000)-log(100)==log(100)-log(10)==log(10)-log(1)==1==Distance ).
106     The resulting tickmarks will always look equidistant on the screen.
107     The other possibility is to have a Distance = tick2-tick1 measured constant
108     before a scaling is applied, which may lead to non equidistant tickmarks
109     on the screen.</p>
110 
111     <p><member>PostEquidistant</member> rules wether the <member>Distance</member>
112     is meant to be a value before or after scaling.</p>
113     */
114 	double		Distance;
115 
116     /**
117     <member>PostEquidistant</member> rules wether the member <member>Distance</member>
118     describes a distance before or after the scaling is applied.
119 
120     <p>If <member>PostEquidistant</member> equals <TRUE/> <member>Distance</member>
121     is given in values after <type>XScaling</type> is applied, thus resulting
122     main tickmarks will always look equidistant on the screen.
123     If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member>
124     is given in values before <type>XScaling</type> is applied.</p>
125     */
126 	bool		PostEquidistant;
127 
128     /** The <member>BaseValue</member> gives a starting point on the scale
129     to which all further main tickmarks are relatively positioned.
130 
131     <p>The <member>BaseValue</member> is always a value on the scale before
132     a possible scaling is applied. If the given value is not valid in the
133     associated scaling the minimum of the scaling is assumed,
134     if there is no minimum any other obvious value will be assumed.</p>
135 
136     <p>E.g.: assume a scale from 0 to 6 with identical scaling.
137     Further assume this Increment to have Distance==2 and PostEquidistant==false.
138     Setting BaseValue=0 would lead to main tickmarks 0; 2; 4; 6;
139     Setting BaseValue=1,3 would lead to main tickmarks 1,3; 3,3; 5,3;
140     Setting BaseValue=-0,7 would also lead to main tickmarks 1,3; 3,3; 5,3;
141     And setting BaseValue to 2, -2, 4, -4 etc. in this example
142     leads to the same result as BaseValue=0.</p>
143     */
144 	double		BaseValue;
145 
146     /** <member>SubIncrements</member> describes the positioning of further
147     sub tickmarks on the scale of an axis.
148 
149     <p>The first SubIncrement in this sequence determines how the
150     distance between two neighboring main tickmarks is divided for positioning
151     of further sub tickmarks. Every following SubIncrement determines the
152     positions of subsequent tickmarks in relation to their parent tickmarks
153     iven by the preceding SubIncrement.</p>
154     */
155     ::std::vector< ExplicitSubIncrement > SubIncrements;
156 };
157 
158 //.............................................................................
159 } //namespace chart
160 //.............................................................................
161 #endif
162