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