~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kchart/kdchart/src/KDChartTextAttributes.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
 
/* -*- Mode: C++ -*-
2
 
   KDChart - a multi-platform charting engine
3
 
   */
4
 
 
5
 
/****************************************************************************
6
 
 ** Copyright (C) 2005-2007 Klarävdalens Datakonsult AB.  All rights reserved.
7
 
 **
8
 
 ** This file is part of the KD Chart library.
9
 
 **
10
 
 ** This file may be used under the terms of the GNU General Public
11
 
 ** License versions 2.0 or 3.0 as published by the Free Software
12
 
 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
13
 
 ** included in the packaging of this file.  Alternatively you may (at
14
 
 ** your option) use any later version of the GNU General Public
15
 
 ** License if such license has been publicly approved by
16
 
 ** Klarälvdalens Datakonsult AB (or its successors, if any).
17
 
 ** 
18
 
 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
19
 
 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
20
 
 ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
21
 
 ** not expressly granted herein.
22
 
 ** 
23
 
 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24
 
 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25
 
 **
26
 
 **********************************************************************/
27
 
 
28
 
#ifndef KDCHARTTEXTATTRIBUTES_H
29
 
#define KDCHARTTEXTATTRIBUTES_H
30
 
 
31
 
#include <QDebug>
32
 
#include <QMetaType>
33
 
#include "KDChartGlobal.h"
34
 
#include "KDChartMeasure.h"
35
 
 
36
 
class QPen;
37
 
class QFont;
38
 
 
39
 
namespace KDChart {
40
 
 
41
 
    /**
42
 
     * \brief A set of text attributes.
43
 
     *
44
 
     * TextAttributes encapsulates settings that have to do with
45
 
     * text. This includes font, fontsize, color, whether the text
46
 
     * is rotated, etc
47
 
     */
48
 
class KDCHART_EXPORT TextAttributes
49
 
{
50
 
public:
51
 
  TextAttributes();
52
 
  TextAttributes( const TextAttributes& );
53
 
  TextAttributes &operator= ( const TextAttributes& );
54
 
  bool operator==( const TextAttributes& ) const;
55
 
  inline bool operator!=( const TextAttributes& other ) const
56
 
  { return !operator==(other); }
57
 
 
58
 
  ~TextAttributes();
59
 
 
60
 
  /**
61
 
   * Set whether the text is to be rendered at all.
62
 
   * \param visible Whether the text is visible.
63
 
   */
64
 
  void setVisible( bool visible );
65
 
 
66
 
  /**
67
 
   * \return Whether the text is visible.
68
 
   */
69
 
  bool isVisible() const;
70
 
 
71
 
  /**
72
 
   * Set the font to be used for rendering the text.
73
 
   *
74
 
   * \note All of the font's attributes will be used - except of its size!
75
 
   * To specify the size please use setFontSize (or setMinimalFontSize, resp.)
76
 
   *
77
 
   * \param font The font to use.
78
 
   *
79
 
   * \sa setFontSize, setMinimalFontSize
80
 
   */
81
 
  void setFont( const QFont& font );
82
 
 
83
 
  /**
84
 
   * \return The font that is used for rendering text.
85
 
   */
86
 
  QFont font() const;
87
 
 
88
 
  /**
89
 
   * Set the size of the font used for rendering text.
90
 
   * \param measure The measure to use.
91
 
   * \see Measure
92
 
   */
93
 
  void setFontSize( const Measure & measure );
94
 
 
95
 
  /**
96
 
   * \return The measure used for the font size.
97
 
   */
98
 
  Measure fontSize() const;
99
 
 
100
 
  /**
101
 
   * Set the minimal size of the font used for rendering text.
102
 
   * \param measure The measure to use.
103
 
   * \see Measure
104
 
   */
105
 
  void setMinimalFontSize( const Measure & measure );
106
 
 
107
 
  /**
108
 
   * \return The measure used for the minimal font size.
109
 
   */
110
 
  Measure minimalFontSize() const;
111
 
 
112
 
  /**
113
 
   * \brief Returns the font size that is used at drawing time.
114
 
   *
115
 
   * This method is called at drawing time. It returns the
116
 
   * font size as it is used for rendering text, taking into account
117
 
   * any measures that were set via setFontSize and/or setMinimalFontSize.
118
 
   */
119
 
#if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
120
 
  const qreal calculatedFontSize(
121
 
#else
122
 
  qreal calculatedFontSize(
123
 
#endif
124
 
        const QObject*                   autoReferenceArea,
125
 
        KDChartEnums::MeasureOrientation autoReferenceOrientation ) const;
126
 
 
127
 
  /**
128
 
   * \brief Returns the font in the size that is used at drawing time.
129
 
   *
130
 
   * This method is called at drawing time. It returns the
131
 
   * font as it is used for rendering text, taking into account
132
 
   * any measures that were set via setFontSize and/or setMinimalFontSize.
133
 
   */
134
 
  const QFont calculatedFont(
135
 
        const QObject*                   autoReferenceArea,
136
 
        KDChartEnums::MeasureOrientation autoReferenceOrientation ) const;
137
 
 
138
 
  /**
139
 
   * \return Whether the text has an absolute font size set.
140
 
   */
141
 
  bool hasAbsoluteFontSize() const;
142
 
 
143
 
  /**
144
 
   * Set whether the text should be automatically rotated as
145
 
   * needed when space is constraint.
146
 
   * \param autoRotate Whether text should be automatically rotated.
147
 
   */
148
 
  void setAutoRotate( bool autoRotate );
149
 
 
150
 
  /**
151
 
   * \return Whether text is automatically rotated when space is
152
 
   * constrained.
153
 
   */
154
 
  bool autoRotate() const;
155
 
 
156
 
  /**
157
 
   * Set whether the text should automatically be shrunk, if
158
 
   * space is constraint.
159
 
   * \param autoShrink Whether text should be auto-shrunk.
160
 
   */
161
 
  void setAutoShrink( bool autoShrink );
162
 
 
163
 
  /**
164
 
   * \return Whether text is automatically shrunk if space is
165
 
   * constraint.
166
 
   */
167
 
  bool autoShrink() const;
168
 
 
169
 
  /**
170
 
   * Set the rotation angle to use for the text.
171
 
   *
172
 
   * \note For axis titles the rotation angle can be set to one of the
173
 
   * following angles: 0, 90, 180, 270
174
 
   * Any other values specified will be replaced by the next smaller
175
 
   * one of the allowed values, so no matter what you set the rotation
176
 
   * will always be one of these four values.
177
 
   *
178
 
   * \param rotation The rotation angle.
179
 
   */
180
 
  void setRotation( int rotation );
181
 
 
182
 
  /**
183
 
   * \return The rotation angle used for rendering the text.
184
 
   */
185
 
  int rotation() const;
186
 
 
187
 
  /**
188
 
   * Set the pen to use for rendering the text.
189
 
   * \param pen The pen to use.
190
 
   */
191
 
  void setPen( const QPen& pen );
192
 
 
193
 
  /**
194
 
   * \return The pen used for rendering the text.
195
 
   */
196
 
  QPen pen() const;
197
 
 
198
 
  // FIXME KDChartEnums::TextLayoutPolicy?
199
 
 
200
 
private:
201
 
  KDCHART_DECLARE_PRIVATE_BASE_VALUE( TextAttributes )
202
 
 
203
 
}; // End of class TextAttributes
204
 
 
205
 
}
206
 
 
207
 
#if !defined(QT_NO_DEBUG_STREAM)
208
 
KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::TextAttributes& );
209
 
#endif /* QT_NO_DEBUG_STREAM */
210
 
 
211
 
KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::TextAttributes )
212
 
Q_DECLARE_METATYPE( KDChart::TextAttributes )
213
 
Q_DECLARE_TYPEINFO( KDChart::TextAttributes, Q_MOVABLE_TYPE );
214
 
 
215
 
#endif // KDCHARTTEXTATTRIBUTES_H