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

« back to all changes in this revision

Viewing changes to kchart/shape/DataSet.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
 
/* This file is part of the KDE project
2
 
 
3
 
   Copyright 2007-2008 Johannes Simon <johannes.simon@gmail.com>
4
 
   Copyright (C) 2010 Carlos Licea    <carlos@kdab.com>
5
 
   Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
 
     Contact: Suresh Chande suresh.chande@nokia.com
7
 
 
8
 
   This library is free software; you can redistribute it and/or
9
 
   modify it under the terms of the GNU Library General Public
10
 
   License as published by the Free Software Foundation; either
11
 
   version 2 of the License, or (at your option) any later version.
12
 
 
13
 
   This library is distributed in the hope that it will be useful,
14
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
   Library General Public License for more details.
17
 
 
18
 
   You should have received a copy of the GNU Library General Public License
19
 
   along with this library; see the file COPYING.LIB.  If not, write to
20
 
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
 
 * Boston, MA 02110-1301, USA.
22
 
 */
23
 
 
24
 
 
25
 
#ifndef KCHART_DATASET_H
26
 
#define KCHART_DATASET_H
27
 
 
28
 
 
29
 
// Qt
30
 
#include <QPen>
31
 
 
32
 
//KDChart
33
 
#include <KDChartPieAttributes>
34
 
 
35
 
// KChart
36
 
#include "ChartShape.h"
37
 
#include "CellRegion.h"
38
 
 
39
 
class KoShapeLoadingContext;
40
 
 
41
 
namespace KChart {
42
 
 
43
 
class KDChartModel;
44
 
 
45
 
 
46
 
/**
47
 
 * @brief The DataSet class stores properties of a single data series.
48
 
 * 
49
 
 * A global chart type can be overridden by setting a specific type
50
 
 * on a data series.
51
 
 * 
52
 
 * To change properties of a single data point inside a data series,
53
 
 * use section's like for example \a brush( int section ) where the
54
 
 * section refers to the data-point number.
55
 
 */
56
 
 
57
 
class CHARTSHAPELIB_EXPORT DataSet
58
 
{
59
 
public:
60
 
    DataSet( ChartProxyModel *model );
61
 
    ~DataSet();
62
 
 
63
 
    // Getter methods
64
 
    QString       title() const;
65
 
    ChartType     chartType() const;
66
 
    ChartSubtype  chartSubType() const;
67
 
    Axis         *attachedAxis() const;
68
 
 
69
 
    ChartProxyModel   *model() const;
70
 
 
71
 
    bool showValues() const;
72
 
    bool showLabels() const;
73
 
 
74
 
    // Graphics properties for the visualization of this dataset.
75
 
    QPen   pen() const;
76
 
    QBrush brush() const;
77
 
    KDChart::PieAttributes pieAttributes() const;
78
 
    QPen   pen( int section ) const;
79
 
    QBrush brush( int section ) const;
80
 
    KDChart::PieAttributes pieAttributes( int section ) const;
81
 
    QColor color() const;
82
 
    int    number() const;
83
 
 
84
 
    bool showMeanValue() const;
85
 
    QPen meanValuePen() const;
86
 
 
87
 
    bool showLowerErrorIndicator() const;
88
 
    bool showUpperErrorIndicator() const;
89
 
    QPen errorIndicatorPen() const;
90
 
    ErrorCategory errorCategory() const;
91
 
    qreal errorPercentage() const;
92
 
    qreal errorMargin() const;
93
 
    qreal lowerErrorLimit() const;
94
 
    qreal upperErrorLimit() const;
95
 
 
96
 
    // Setter methods
97
 
    void setChartType( ChartType type );
98
 
    void setChartSubType( ChartSubtype type );
99
 
    void setAttachedAxis( Axis *axis );
100
 
 
101
 
    void setShowValues( bool showValues );
102
 
    void setShowLabels( bool showLabels );
103
 
 
104
 
    void setPen( const QPen &pen );
105
 
    void setBrush( const QBrush &brush );
106
 
    void setPen( int section, const QPen &pen );
107
 
    void setBrush( int section, const QBrush &brush );
108
 
    void setColor( const QColor &color );
109
 
    void setNumber( int num );
110
 
 
111
 
    void setPieExplodeFactor( int factor );
112
 
    void setPieExplodeFactor( int section, int factor );
113
 
 
114
 
    void setShowMeanValue( bool b );
115
 
    void setMeanValuePen( const QPen &pen );
116
 
 
117
 
    void setShowLowerErrorIndicator( bool b );
118
 
    void setShowUpperErrorIndicator( bool b );
119
 
    void setShowErrorIndicators( bool lower, bool upper );
120
 
    void setErrorIndicatorPen( const QPen &pen );
121
 
    void setErrorCategory( ErrorCategory category );
122
 
    void setErrorPercentage( qreal percentage );
123
 
    void setErrorMargin( qreal margin );
124
 
    void setLowerErrorLimit( qreal limit );
125
 
    void setUpperErrorLimit( qreal limit );
126
 
 
127
 
    QVariant xData( int index ) const;
128
 
    QVariant yData( int index ) const;
129
 
    QVariant customData( int index ) const;
130
 
    QVariant categoryData( int index ) const;
131
 
    QVariant labelData() const;
132
 
 
133
 
    CellRegion xDataRegion() const;
134
 
    CellRegion yDataRegion() const;
135
 
    CellRegion customDataRegion() const;
136
 
    CellRegion categoryDataRegion() const;
137
 
    CellRegion labelDataRegion() const;
138
 
    // TODO: Region for custom colors
139
 
 
140
 
    QString xDataRegionString() const;
141
 
    QString yDataRegionString() const;
142
 
    QString customDataRegionString() const;
143
 
    QString categoryDataRegionString() const;
144
 
    QString labelDataRegionString() const;
145
 
 
146
 
    void setXDataRegion( const CellRegion &region );
147
 
    void setYDataRegion( const CellRegion &region );
148
 
    void setCustomDataRegion( const CellRegion &region );
149
 
    void setCategoryDataRegion( const CellRegion &region );
150
 
    void setLabelDataRegion( const CellRegion &region );
151
 
 
152
 
    void setXDataRegionString( const QString &region );
153
 
    void setYDataRegionString( const QString &region );
154
 
    void setCustomDataRegionString( const QString &region );
155
 
    void setCategoryDataRegionString( const QString &region );
156
 
    void setLabelDataRegionString( const QString &region );
157
 
 
158
 
    int size() const;
159
 
    int dimension() const;
160
 
 
161
 
    void setKdDiagram( KDChart::AbstractDiagram *diagram );
162
 
    void setKdDataSetNumber( int number );
163
 
 
164
 
    KDChart::AbstractDiagram *kdDiagram() const;
165
 
    int kdDataSetNumber() const;
166
 
 
167
 
    // Called by the proxy model
168
 
    void yDataChanged( int start, int end ) const;
169
 
    void xDataChanged( int start, int end ) const;
170
 
    void customDataChanged( int start, int end ) const;
171
 
    void labelDataChanged() const;
172
 
    void categoryDataChanged( int start, int end ) const;
173
 
 
174
 
    void yDataChanged( const QRect &region ) const;
175
 
    void xDataChanged( const QRect &region ) const;
176
 
    void customDataChanged( const QRect &region ) const;
177
 
    void labelDataChanged( const QRect &region ) const;
178
 
    void categoryDataChanged( const QRect &region ) const;
179
 
 
180
 
    void setKdChartModel( KDChartModel *model );
181
 
    KDChartModel *kdChartModel() const;
182
 
    
183
 
    void blockSignals( bool block );
184
 
 
185
 
    bool loadOdf( const KoXmlElement &n,
186
 
                  KoShapeLoadingContext &context );
187
 
    /**
188
 
     * Saves a series to ODF. Creates a new chart:series element.
189
 
     */
190
 
    void saveOdf( KoShapeSavingContext &context ) const;
191
 
 
192
 
private:
193
 
    class Private;
194
 
    Private *const d;
195
 
};
196
 
 
197
 
} // Namespace KChart
198
 
 
199
 
#endif // KCHART_DATASET_H
200