File: SheetAdaptor.h

package info (click to toggle)
calligra 1%3A3.2.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 260,432 kB
  • sloc: cpp: 650,911; xml: 27,662; python: 6,044; perl: 2,724; yacc: 1,817; ansic: 1,325; sh: 1,277; lex: 1,107; ruby: 1,010; javascript: 495; makefile: 24
file content (195 lines) | stat: -rw-r--r-- 8,105 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/* This file is part of the KDE project

   Copyright 2006 Fredrik Edemar <f_edemar@linux.se>
   Copyright 2000, 2003 Laurent Montel <montel@kde.org>
   Copyright 2002-2003 Joseph Wenninger <jowenn@kde.org>
   Copyright 2002 Philipp Mueller <philipp.mueller@gmx.de>
   Copyright 2002 Ariya Hidayat <ariya@kde.org>
   Copyright 2002 John Dailey <dailey@vt.edu>
   Copyright 1999 Torben Weis <weis@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef CALLIGRA_SHEETS_SHEET_ADAPTOR
#define CALLIGRA_SHEETS_SHEET_ADAPTOR

#ifndef QT_NO_DBUS
#include <QDBusAbstractAdaptor>
#include <QString>

#include "sheets_common_export.h"

namespace Calligra
{
namespace Sheets
{
class Damage;
class Sheet;

class CALLIGRA_SHEETS_COMMON_EXPORT SheetAdaptor : public QDBusAbstractAdaptor
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "org.kde.calligra.spreadsheet.sheet")
public:
    explicit SheetAdaptor(Sheet*);
    ~SheetAdaptor() override;

public Q_SLOTS: // METHODS

    /** Return the cellname for x,y (where x is the row and y is the column). For
    example for x=5 and y=2 the string "B5" got returned. */
    virtual QString cellName(int x, int y);
    /** Return the x,y-point for the cellname. */
    virtual QPoint cellLocation(const QString& cellname);
    /** Return the row-number for the cellname. For example for the cellname "B5"
    the integer 5 got returned. */
    virtual int cellRow(const QString& cellname);
    /** Return the column-number for the cellname. For example for the cellname "B5"
    the integer 2 got returned. */
    virtual int cellColumn(const QString& cellname);

    /** Return the text for the row x and for the column y. */
    virtual QString text(int x, int y);
    /** Return the text for a cellname. */
    virtual QString text(const QString& cellname);
    /** Set the text of the cell with row x and column y. If the parse argument is
    true, the passed text got parsed (e.g. a text like "123" will be recognised
    as numeric value. */
    virtual bool setText(int x, int y, const QString& text, bool parse = true);
    /** Set the text of the cell defined with cellname. */
    virtual bool setText(const QString& cellname, const QString& text, bool parse = true);

    /** Return the value the cell at row x and column y has. The returned value is
    a variant and could be e.g. a number, a bool or a text depending on the format
    and the content the cell has. */
    virtual QVariant value(int x, int y);
    /** Return the value for the cell defined with cellname. */
    virtual QVariant value(const QString& cellname);
    /** Set the value in the cell at row x and column y. */
    virtual bool setValue(int x, int y, const QVariant& value);
    /** Set the value in the cell defined with cellname. */
    virtual bool setValue(const QString& cellname, const QVariant& value);

    /** Return the name of the sheet. */
    virtual QString sheetName() const;
    /** Set the name of the sheet. */
    virtual bool setSheetName(const QString & name);

    //virtual QString column( int _col );
    //virtual QString row( int _row );

    /** Return the position the last column on this sheet has. */
    virtual int lastColumn() const;
    /** Return the position the last row on this sheet has. */
    virtual int lastRow() const;

    /** Inserts nbCol number of new columns at the position col. All columns which
    are >= col are moved to the right. */
    virtual void insertColumn(int col, int nbCol = 1);
    /** Inserts nbRow number of new rows at the position row. All rows which
    are >= row are moved down. */
    virtual void insertRow(int row, int nbRow = 1);
    /** Remove nbCol number of columns from the position col. */
    virtual void removeColumn(int col, int nbCol = 1);
    /** Remove nbRow number of columns from the position row. */
    virtual void removeRow(int row, int nbRow = 1);

    /** Returns true if the sheet is hidden else false is returned. */
    virtual bool isHidden() const;
    /** Hide the sheet if the argument hidden is true or show it if hidden is false. */
    virtual void setHidden(bool hidden);

    //virtual bool showGrid() const;
    //virtual bool showFormula() const;
    //virtual bool lcMode() const;
    //virtual bool autoCalc() const;
    //virtual bool showColumnNumber() const;
    //virtual bool hideZero() const;
    //virtual bool firstLetterUpper() const;
    //virtual void setShowPageOutline( bool b );

    /** Return the height the paper of the printer has. */
    virtual float paperHeight() const;
    /** Set the height the paper of the printer has. */
    virtual void setPrinterHeight(float height);
    /** Return the width the paper of the printer has. */
    virtual float paperWidth() const;
    /** Set the width the paper of the printer has. */
    virtual void setPaperWidth(float width);
    /** Return the left border the paper of the printer has. */
    virtual float paperLeftBorder() const;
    /** Return the right border the paper of the printer has. */
    virtual float paperRightBorder() const;
    /** Return the top border the paper of the printer has. */
    virtual float paperTopBorder() const;
    /** Return the bottom border the paper of the printer has. */
    virtual float paperBottomBorder() const;
    /** Return the name of the paper format (like "A4" or "Letter"). */
    virtual QString paperFormat() const;
    /** Return the name of the paper orientation (like "Portrait" or "Landscape"). */
    virtual QString paperOrientation() const;
    /** Set the left, top, right and bottom border as well as the page format and
    orientation the paper of the printer has. */
    virtual void setPaperLayout(float leftBorder, float topBorder, float rightBorder, float bottomBoder, const QString& format, const QString& orientation);

    //QString printHeadLeft() const;
    //QString printHeadMid() const;
    //QString printHeadRight() const;
    //QString printFootLeft() const;
    //QString printFootMid() const;
    //QString printFootRight() const;
    //void setPrintHeaderLeft(const QString & text);
    //void setPrintHeaderMiddle(const QString & text);
    //void setPrintHeaderRight(const QString & text);
    //void setPrintFooterLeft(const QString & text);
    //void setPrintFooterMiddle(const QString & text);
    //void setPrintFooterRight(const QString & text);

    //NOTE: don't publish "QByteArray password()" cause that may introduce insecure situations...
    /** Return true if passwd is the correct password. */
    virtual bool checkPassword(const QByteArray& passwd) const;
    /** Return true if the sheet/document is protected. */
    virtual bool isProtected() const;
    /** Protect the document with the password passwd. */
    virtual void setProtected(const QByteArray& passwd);

Q_SIGNALS:

    /** This signal got emitted if the name of the sheet changed. */
    void nameChanged();
    /** This signal got emitted if the sheet got shown. */
    void showChanged();
    /** This signal got emitted if the sheet got hidden. */
    void hideChanged();

private Q_SLOTS:
    /**
     * \ingroup Damages
     * Handles changes of the sheet name and visibility.
     */
    void handleDamages(const QList<Damage*>& damages);

private:
    Sheet* m_sheet;
    QByteArray ident;
};

} // namespace Sheets
} // namespace Calligra
#endif

#endif // CALLIGRA_SHEETS_SHEET_ADAPTOR