~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to plugins/chartshape/kdchart/src/KDChartDataValueAttributes.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.  All rights reserved.
 
3
**
 
4
** This file is part of the KD Chart library.
 
5
**
 
6
** Licensees holding valid commercial KD Chart licenses may use this file in
 
7
** accordance with the KD Chart Commercial License Agreement provided with
 
8
** the Software.
 
9
**
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 and version 3 as published by the
 
13
** Free Software Foundation and appearing in the file LICENSE.GPL included.
 
14
**
 
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
17
**
 
18
** Contact info@kdab.com if any conditions of this licensing are not
 
19
** clear to you.
 
20
**
 
21
**********************************************************************/
 
22
 
 
23
#ifndef KDCHARTDATAVALUEATTRIBUTES_H
 
24
#define KDCHARTDATAVALUEATTRIBUTES_H
 
25
 
 
26
#include <Qt>
 
27
#include <QMetaType>
 
28
#include "KDChartGlobal.h"
 
29
#include "KDChartEnums.h"
 
30
#include "KDChartRelativePosition.h"
 
31
 
 
32
/** \file KDChartDataValueAttributes.h
 
33
 *  \brief Declaring the class KDChart::DataValueAttributes.
 
34
 *
 
35
 *
 
36
 */
 
37
 
 
38
 
 
39
namespace KDChart {
 
40
 
 
41
  class TextAttributes;
 
42
  class BackgroundAttributes;
 
43
  class FrameAttributes;
 
44
  class MarkerAttributes;
 
45
 
 
46
  /**
 
47
   * \class DataValueAttributes KDChartDataValueAttributes.h KDChartDataValueAttributes
 
48
   * \brief Diagram attributes dealing with data value labels.
 
49
   *
 
50
   * The DataValueAttributes group all properties that can be set
 
51
   * wrt data value labels and if and how they are displayed. This
 
52
   * includes things like the text attributes (font, color), what
 
53
   * markers are used, howmany decimal digits are displayed, etc.
 
54
   */
 
55
class KDCHART_EXPORT DataValueAttributes
 
56
{
 
57
public:
 
58
  DataValueAttributes();
 
59
  DataValueAttributes( const DataValueAttributes& );
 
60
  DataValueAttributes &operator= ( const DataValueAttributes& );
 
61
  bool operator==( const DataValueAttributes& ) const;
 
62
  inline bool operator!=( const DataValueAttributes& other ) const { return !operator==(other); }
 
63
 
 
64
  ~DataValueAttributes();
 
65
 
 
66
  static const DataValueAttributes& defaultAttributes();
 
67
  static const QVariant& defaultAttributesAsVariant();
 
68
 
 
69
  /** Set whether data value labels should be displayed.
 
70
   * \param visible Whether data value labels should be displayed.
 
71
   */
 
72
  void setVisible( bool visible );
 
73
 
 
74
  /**
 
75
   * @return Whether data value labels should be displayed.
 
76
   */
 
77
  bool isVisible() const;
 
78
 
 
79
  /**
 
80
   * Set the text attributes to use for the data value labels.
 
81
   * \param a The text attributes to set.
 
82
   * \see TextAttributes
 
83
   */
 
84
  void setTextAttributes( const TextAttributes &a );
 
85
 
 
86
  /**
 
87
   * \return The text attributes used for painting data value labels.
 
88
   */
 
89
  TextAttributes textAttributes() const;
 
90
 
 
91
  /**
 
92
   * Set the frame attributes to use for the data value labels area.
 
93
   * \param a The frame attributes to set.
 
94
   * \see FrameAttributes
 
95
   */
 
96
  void setFrameAttributes( const FrameAttributes &a );
 
97
 
 
98
  /**
 
99
   * \return The frame attributes used for painting the data
 
100
   * value labels area.
 
101
   * \see FrameAttributes
 
102
   */
 
103
  FrameAttributes frameAttributes() const;
 
104
 
 
105
  /**
 
106
   * Set the background attributes to use for the data value labels area.
 
107
   * \param a The background attributes to set.
 
108
   * \see BackgroundAttributes
 
109
   */
 
110
  void setBackgroundAttributes( const BackgroundAttributes &a );
 
111
 
 
112
  /**
 
113
   * \return The background attributes used for painting the data
 
114
   * value labels area.
 
115
   * \see BackgroundAttributes
 
116
   */
 
117
  BackgroundAttributes backgroundAttributes() const;
 
118
 
 
119
  /**
 
120
   * Set the marker attributes to use for the data values. This includes
 
121
   * the marker type.
 
122
   * \param a The marker attributes to set.
 
123
   * \see MarkerAttributes
 
124
   */
 
125
  void setMarkerAttributes( const MarkerAttributes &a );
 
126
 
 
127
  /**
 
128
   * \return The marker attributes used for decorating the data
 
129
   * values.
 
130
   * \see MarkerAttributes
 
131
   */
 
132
  MarkerAttributes markerAttributes() const;
 
133
 
 
134
  /**
 
135
   * Specify whether to use percentages instead of actual data point values when no
 
136
   * specific label is set. In a bar or cartesian diagram, this means that the value
 
137
   * will be shown in % in relation to the sum of all values in the same category, in
 
138
   * a polar diagram in relation to the sum of all values in a data set.
 
139
   *
 
140
   * When this is turned on, the value will \b not automatically have the '%' postfix.
 
141
   * \param enable Whether to enable percentage values
 
142
   */
 
143
  void setUsePercentage( bool enable );
 
144
 
 
145
  /**
 
146
   * \return Whether to use percentage values
 
147
   * \see setUsePercentage
 
148
   */
 
149
  bool usePercentage() const;
 
150
 
 
151
  /**
 
152
   * Set how  many decimal digits to display when rendering the data value
 
153
   * labels. If there are no decimal digits it will not be displayed.
 
154
   * \param digits The number of decimal digits to use.
 
155
   */
 
156
  void setDecimalDigits( int digits );
 
157
 
 
158
  /**
 
159
   * \return The number of decimal digits displayed.
 
160
   */
 
161
  int decimalDigits() const;
 
162
 
 
163
  /**
 
164
   * \brief Prepend a prefix string to the data value label
 
165
   * \sa prefix
 
166
   */
 
167
  void setPrefix( const QString prefix );
 
168
 
 
169
 /**
 
170
   * \brief Returns the string used as a prefix to the data value text.
 
171
   * \sa setPrefix
 
172
   */
 
173
  QString prefix() const;
 
174
 
 
175
  /**
 
176
   * \brief Append a suffix string to the data value label
 
177
   * \sa suffix
 
178
   */
 
179
  void setSuffix( const QString suffix );
 
180
 
 
181
 /**
 
182
   * \brief Returns the string used as a suffix to the data value text.
 
183
   * \sa setSuffix
 
184
   */
 
185
  QString suffix() const;
 
186
 
 
187
 /**
 
188
   * \brief display a string label instead of the original data value label
 
189
   * Supports HTML code.
 
190
   * \sa dataLabel
 
191
   */
 
192
  void setDataLabel( const QString label );
 
193
 
 
194
 /**
 
195
   * \brief Returns the string displayed instead of the data value label
 
196
   * \sa setDataLabel
 
197
   */
 
198
  QString dataLabel() const;
 
199
 
 
200
 /**
 
201
   * \return Whether data values not different from their predecessors are drawn.
 
202
  */
 
203
  bool showRepetitiveDataLabels() const;
 
204
 
 
205
 /**
 
206
   *
 
207
   * Set whether data value labels not different from their predecessors should be drawn.
 
208
   * \param showRepetitiveDataLabels Whether data value not different from their predecessors are drawn.
 
209
  */
 
210
  void setShowRepetitiveDataLabels( bool showRepetitiveDataLabels );
 
211
 
 
212
 /**
 
213
   * \return Whether data value texts overlapping other data value texts of the same diagram are drawn.
 
214
  */
 
215
  bool showOverlappingDataLabels() const;
 
216
 
 
217
 /**
 
218
   *
 
219
   * Set whether data value texts overlapping other data value texts of the same diagram should be drawn.
 
220
   * \param showOverlappingDataLabels Whether data texts overlapping other data value texts of the same diagram are drawn.
 
221
  */
 
222
  void setShowOverlappingDataLabels( bool showOverlappingDataLabels );
 
223
 
 
224
  /**
 
225
    * \cond PLANNED_FOR_FUTURE
 
226
    *
 
227
    * These method are planned for future versions of KD Chart,
 
228
    * so they are not part of the documented API yet.
 
229
    *
 
230
    */
 
231
  void setPowerOfTenDivisor( int powerOfTenDivisor );
 
232
  int powerOfTenDivisor() const;
 
233
   /**
 
234
   * \endcond
 
235
   */
 
236
 
 
237
 
 
238
  /**
 
239
   * \cond PLANNED_FOR_FUTURE
 
240
   *
 
241
   * These method are planned for future versions of KD Chart,
 
242
   * so they are not part of the documented API yet.
 
243
   */
 
244
  void setShowInfinite( bool infinite );
 
245
  bool showInfinite() const;
 
246
  /**
 
247
   * \endcond
 
248
   */
 
249
 
 
250
   /**
 
251
   * \brief Defines the relative positioning of the data value labels for negative values.
 
252
    *
 
253
    * The position is specified in relation to the respective data value point, or in
 
254
    * releation to the respective data representation area, that's one area segment in
 
255
    * a LineDiagram showing areas, or one bar in a BarDiagram, one pie slice ...
 
256
    *
 
257
   * \sa negativePosition
 
258
   */
 
259
  void setNegativePosition( const RelativePosition& relPosition );
 
260
 
 
261
   /**
 
262
   * \brief Return the relative positioning of the data value labels
 
263
   * \sa setNegativePosition
 
264
   */
 
265
  const RelativePosition negativePosition() const;
 
266
 
 
267
  /**
 
268
   * \brief Defines the relative position of the data value labels for positive values.
 
269
   *
 
270
   * The position is specified in relation to the respective data value point, or in
 
271
   * releation to the respective data representation area, that's one area segment in
 
272
   * a LineDiagram showing areas, or one bar in a BarDiagram, one pie slice ...
 
273
   *
 
274
   * \sa positivePosition
 
275
   */
 
276
  void setPositivePosition( const RelativePosition& relPosition );
 
277
 
 
278
   /**
 
279
   * \brief Return the relative positioning of the data value labels
 
280
   * \sa setPositivePosition
 
281
   */
 
282
  const RelativePosition positivePosition() const;
 
283
 
 
284
  const RelativePosition position( bool positive ) const
 
285
  {
 
286
    return positive ? positivePosition() : negativePosition();
 
287
  }
 
288
 
 
289
private:
 
290
  KDCHART_DECLARE_PRIVATE_BASE_VALUE( DataValueAttributes )
 
291
 
 
292
}; // End of class DataValueAttributes
 
293
 
 
294
}
 
295
 
 
296
#if !defined(QT_NO_DEBUG_STREAM)
 
297
KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::DataValueAttributes& );
 
298
#endif /* QT_NO_DEBUG_STREAM */
 
299
 
 
300
Q_DECLARE_METATYPE( KDChart::DataValueAttributes )
 
301
Q_DECLARE_TYPEINFO( KDChart::DataValueAttributes, Q_MOVABLE_TYPE );
 
302
KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::DataValueAttributes )
 
303
 
 
304
#endif // KDCHARTDATAVALUEATTRIBUTES_H