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

« back to all changes in this revision

Viewing changes to kchart/shape/ChartProxyModel.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 Johannes Simon <johannes.simon@gmail.com>
4
 
 
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.
9
 
 
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.
14
 
 
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.
19
 
*/
20
 
 
21
 
#ifndef KCHART_PROXYMODEL_H
22
 
#define KCHART_PROXYMODEL_H
23
 
 
24
 
 
25
 
// KChart
26
 
#include "ChartShape.h"
27
 
#include "CellRegion.h"
28
 
 
29
 
 
30
 
namespace KoChart
31
 
{
32
 
    class ChartModel;
33
 
}
34
 
 
35
 
 
36
 
// Qt
37
 
#include <QAbstractProxyModel>
38
 
 
39
 
 
40
 
namespace KChart {
41
 
 
42
 
class CHARTSHAPELIB_EXPORT ChartProxyModel : public QAbstractProxyModel
43
 
{
44
 
    Q_OBJECT
45
 
 
46
 
public:
47
 
    ChartProxyModel();
48
 
    ~ChartProxyModel();
49
 
 
50
 
public slots:
51
 
    virtual void setSourceModel( QAbstractItemModel *sourceModel );
52
 
    virtual void setSourceModel( QAbstractItemModel *sourceModel,
53
 
                                 const QVector<QRect> &selection );
54
 
 
55
 
    void setSelection( const QVector<QRect> &selection );
56
 
    
57
 
    void setAutomaticDataSetCreation( bool enable );
58
 
    bool automaticDataSetCreation() const;
59
 
 
60
 
    QList<DataSet*> createDataSetsFromRegion( QList<DataSet*> dataSetsToRecycle );
61
 
 
62
 
    /**
63
 
    * Load series from ODF
64
 
    */
65
 
    bool loadOdf( const KoXmlElement &element, KoShapeLoadingContext &context );
66
 
    void saveOdf( KoShapeSavingContext &context ) const;
67
 
 
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;
70
 
 
71
 
    virtual void dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight );
72
 
 
73
 
    virtual QMap<int, QVariant> itemData( const QModelIndex &index ) const;
74
 
 
75
 
    virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
76
 
    virtual QModelIndex parent( const QModelIndex &index ) const;
77
 
 
78
 
    virtual QModelIndex mapFromSource( const QModelIndex &sourceIndex ) const;
79
 
    virtual QModelIndex mapToSource( const QModelIndex &proxyIndex ) const;
80
 
 
81
 
    Qt::Orientation mapFromSource( Qt::Orientation orientation ) const;
82
 
    Qt::Orientation mapToSource( Qt::Orientation orientation ) const;
83
 
 
84
 
    virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
85
 
    virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
86
 
 
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 );
92
 
    
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 );
97
 
 
98
 
    bool firstRowIsLabel() const;
99
 
    bool firstColumnIsLabel() const;
100
 
    Qt::Orientation dataDirection();
101
 
    
102
 
    QString categoryDataRegion() const;
103
 
    void setCategoryDataRegion(const QString& region);
104
 
 
105
 
    QList<DataSet*> dataSets() const;
106
 
 
107
 
    void invalidateDataSets();
108
 
    /**
109
 
     * Discards old and creates new data sets from the current region selection
110
 
     * if and only if automaticDataSetCreation() returns true.
111
 
     */
112
 
    void rebuildDataMap();
113
 
 
114
 
signals:
115
 
    void dataChanged();
116
 
 
117
 
protected slots:
118
 
    void slotModelReset();
119
 
 
120
 
private:
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();
126
 
#endif
127
 
    class Private;
128
 
    Private *const d;
129
 
};
130
 
 
131
 
} // namespace KChart
132
 
 
133
 
#endif // KCHART_PROXYMODEL_H