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