1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _CHART2_EXPLICITSCALEVALUES_HXX
28*cdf0e10cSrcweir #define _CHART2_EXPLICITSCALEVALUES_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "chartviewdllapi.hxx"
31*cdf0e10cSrcweir #include <com/sun/star/chart/TimeInterval.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/chart/TimeUnit.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/chart2/AxisOrientation.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/chart2/AxisType.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/chart2/XScaling.hpp>
36*cdf0e10cSrcweir #include <tools/date.hxx>
37*cdf0e10cSrcweir #include <vector>
38*cdf0e10cSrcweir //.............................................................................
39*cdf0e10cSrcweir namespace chart
40*cdf0e10cSrcweir {
41*cdf0e10cSrcweir //.............................................................................
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //-----------------------------------------------------------------------------
44*cdf0e10cSrcweir /** This structure contains the explicit values for a scale like Minimum and Maximum.
45*cdf0e10cSrcweir     See also ::com::sun::star::chart2::ScaleData.
46*cdf0e10cSrcweir */
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir     ExplicitScaleData();
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir     double Minimum;
53*cdf0e10cSrcweir     double Maximum;
54*cdf0e10cSrcweir     double Origin;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     ::com::sun::star::chart2::AxisOrientation     Orientation;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > Scaling;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir     sal_Int32   AxisType;//see ::com::sun::star::chart2::AxisType
61*cdf0e10cSrcweir     bool        ShiftedCategoryPosition;
62*cdf0e10cSrcweir     sal_Int32   TimeResolution; //constant of type <type>::com::sun::star::chart::TimeUnit</type>
63*cdf0e10cSrcweir     Date        NullDate;
64*cdf0e10cSrcweir };
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir struct OOO_DLLPUBLIC_CHARTVIEW ExplicitSubIncrement
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir     ExplicitSubIncrement();
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     /** Numbers of intervals between two superior ticks.  For an axis
71*cdf0e10cSrcweir         this usually means, that <code>IntervalCount - 1</code>
72*cdf0e10cSrcweir         sub-tick-marks are displayed between two superior ticks.
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir      */
75*cdf0e10cSrcweir     sal_Int32 IntervalCount;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     /** If <TRUE/>, the distance between two sub-tick-marks on the
78*cdf0e10cSrcweir         screen is always the same.  If <FALSE/>, the distances may
79*cdf0e10cSrcweir         differ depending on the <type>XScaling</type>.
80*cdf0e10cSrcweir      */
81*cdf0e10cSrcweir     bool PostEquidistant;
82*cdf0e10cSrcweir };
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir /** describes how tickmarks are positioned on the scale of an axis.
85*cdf0e10cSrcweir */
86*cdf0e10cSrcweir struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir     ExplicitIncrementData();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     /** the following two members are only for date-time axis
91*cdf0e10cSrcweir     */
92*cdf0e10cSrcweir     ::com::sun::star::chart::TimeInterval   MajorTimeInterval;
93*cdf0e10cSrcweir     ::com::sun::star::chart::TimeInterval   MinorTimeInterval;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     /** the other members are for *not* date-time axis
96*cdf0e10cSrcweir     */
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     /** <member>Distance</member> describes the distance between two
99*cdf0e10cSrcweir     neighboring main tickmarks on a <type>Scale</type> of an axis.
100*cdf0e10cSrcweir     All neighboring main tickmarks have the same constant distance.
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     <p>If the Scale has a <type>XScaling</type> the <member>Distance</member>
103*cdf0e10cSrcweir     may be measured in two different ways - that is - before or after the
104*cdf0e10cSrcweir     scaling is applied.</p>
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     <p>On a logarithmic scale for example the distance between two main
107*cdf0e10cSrcweir     tickmarks is typically measured after the scaling is applied:
108*cdf0e10cSrcweir     Distance = log(tick2)-log(tick1)
109*cdf0e10cSrcweir     ( log(1000)-log(100)==log(100)-log(10)==log(10)-log(1)==1==Distance ).
110*cdf0e10cSrcweir     The resulting tickmarks will always look equidistant on the screen.
111*cdf0e10cSrcweir     The other possibility is to have a Distance = tick2-tick1 measured constant
112*cdf0e10cSrcweir     before a scaling is applied, which may lead to non equidistant tickmarks
113*cdf0e10cSrcweir     on the screen.</p>
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     <p><member>PostEquidistant</member> rules wether the <member>Distance</member>
116*cdf0e10cSrcweir     is meant to be a value before or after scaling.</p>
117*cdf0e10cSrcweir     */
118*cdf0e10cSrcweir 	double		Distance;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     /**
121*cdf0e10cSrcweir     <member>PostEquidistant</member> rules wether the member <member>Distance</member>
122*cdf0e10cSrcweir     describes a distance before or after the scaling is applied.
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     <p>If <member>PostEquidistant</member> equals <TRUE/> <member>Distance</member>
125*cdf0e10cSrcweir     is given in values after <type>XScaling</type> is applied, thus resulting
126*cdf0e10cSrcweir     main tickmarks will always look equidistant on the screen.
127*cdf0e10cSrcweir     If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member>
128*cdf0e10cSrcweir     is given in values before <type>XScaling</type> is applied.</p>
129*cdf0e10cSrcweir     */
130*cdf0e10cSrcweir 	bool		PostEquidistant;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     /** The <member>BaseValue</member> gives a starting point on the scale
133*cdf0e10cSrcweir     to which all further main tickmarks are relatively positioned.
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     <p>The <member>BaseValue</member> is always a value on the scale before
136*cdf0e10cSrcweir     a possible scaling is applied. If the given value is not valid in the
137*cdf0e10cSrcweir     associated scaling the minimum of the scaling is assumed,
138*cdf0e10cSrcweir     if there is no minimum any other obvious value will be assumed.</p>
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     <p>E.g.: assume a scale from 0 to 6 with identical scaling.
141*cdf0e10cSrcweir     Further assume this Increment to have Distance==2 and PostEquidistant==false.
142*cdf0e10cSrcweir     Setting BaseValue=0 would lead to main tickmarks 0; 2; 4; 6;
143*cdf0e10cSrcweir     Setting BaseValue=1,3 would lead to main tickmarks 1,3; 3,3; 5,3;
144*cdf0e10cSrcweir     Setting BaseValue=-0,7 would also lead to main tickmarks 1,3; 3,3; 5,3;
145*cdf0e10cSrcweir     And setting BaseValue to 2, -2, 4, -4 etc. in this example
146*cdf0e10cSrcweir     leads to the same result as BaseValue=0.</p>
147*cdf0e10cSrcweir     */
148*cdf0e10cSrcweir 	double		BaseValue;
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     /** <member>SubIncrements</member> describes the positioning of further
151*cdf0e10cSrcweir     sub tickmarks on the scale of an axis.
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     <p>The first SubIncrement in this sequence determines how the
154*cdf0e10cSrcweir     distance between two neighboring main tickmarks is divided for positioning
155*cdf0e10cSrcweir     of further sub tickmarks. Every following SubIncrement determines the
156*cdf0e10cSrcweir     positions of subsequent tickmarks in relation to their parent tickmarks
157*cdf0e10cSrcweir     iven by the preceding SubIncrement.</p>
158*cdf0e10cSrcweir     */
159*cdf0e10cSrcweir     ::std::vector< ExplicitSubIncrement > SubIncrements;
160*cdf0e10cSrcweir };
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir //.............................................................................
163*cdf0e10cSrcweir } //namespace chart
164*cdf0e10cSrcweir //.............................................................................
165*cdf0e10cSrcweir #endif
166