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