1
/* This file is part of the KDE project
3
Copyright 2007 Johannes Simon <johannes.simon@gmail.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef KCHART_PROXYMODEL_H
22
#define KCHART_PROXYMODEL_H
26
#include "ChartShape.h"
27
#include "CellRegion.h"
37
#include <QAbstractProxyModel>
42
class CHARTSHAPELIB_EXPORT ChartProxyModel : public QAbstractProxyModel
51
virtual void setSourceModel( QAbstractItemModel *sourceModel );
52
virtual void setSourceModel( QAbstractItemModel *sourceModel,
53
const QVector<QRect> &selection );
55
void setSelection( const QVector<QRect> &selection );
57
void setAutomaticDataSetCreation( bool enable );
58
bool automaticDataSetCreation() const;
60
QList<DataSet*> createDataSetsFromRegion( QList<DataSet*> dataSetsToRecycle );
63
* Load series from ODF
65
bool loadOdf( const KoXmlElement &element, KoShapeLoadingContext &context );
66
void saveOdf( KoShapeSavingContext &context ) const;
68
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
69
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
71
virtual void dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight );
73
virtual QMap<int, QVariant> itemData( const QModelIndex &index ) const;
75
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
76
virtual QModelIndex parent( const QModelIndex &index ) const;
78
virtual QModelIndex mapFromSource( const QModelIndex &sourceIndex ) const;
79
virtual QModelIndex mapToSource( const QModelIndex &proxyIndex ) const;
81
Qt::Orientation mapFromSource( Qt::Orientation orientation ) const;
82
Qt::Orientation mapToSource( Qt::Orientation orientation ) const;
84
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
85
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
87
// The following methods are specific to the chart
88
void setFirstRowIsLabel( bool b );
89
void setFirstColumnIsLabel( bool b );
90
void setDataDirection( Qt::Orientation orientation );
91
void setDataDimensions( int dimensions );
93
void slotRowsInserted( const QModelIndex &parent, int start, int end );
94
void slotRowsRemoved( const QModelIndex &parent, int start, int end );
95
void slotColumnsInserted( const QModelIndex &parent, int start, int end );
96
void slotColumnsRemoved( const QModelIndex &parent, int start, int end );
98
bool firstRowIsLabel() const;
99
bool firstColumnIsLabel() const;
100
Qt::Orientation dataDirection();
102
QString categoryDataRegion() const;
103
void setCategoryDataRegion(const QString& region);
105
QList<DataSet*> dataSets() const;
107
void invalidateDataSets();
109
* Discards old and creates new data sets from the current region selection
110
* if and only if automaticDataSetCreation() returns true.
112
void rebuildDataMap();
118
void slotModelReset();
121
#if QT_VERSION < 0x040600
122
//! @todo Remove once we drop support for Qt < 4.6
123
//! For compatability with Qt < 4.6
124
void beginResetModel();
125
void endResetModel();
131
} // namespace KChart
133
#endif // KCHART_PROXYMODEL_H