comparison src/xlsx/xlsxworkbook.h @ 1:93d3106bb9a4

Add qt xlsx library
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 22 Mar 2016 10:38:08 +0100
parents
children
comparison
equal deleted inserted replaced
0:49cd5cc0b072 1:93d3106bb9a4
1 /****************************************************************************
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
3 ** All right reserved.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining
6 ** a copy of this software and associated documentation files (the
7 ** "Software"), to deal in the Software without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Software, and to
10 ** permit persons to whom the Software is furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be
14 ** included in all copies or substantial portions of the Software.
15 **
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 **
24 ****************************************************************************/
25 #ifndef XLSXWORKBOOK_H
26 #define XLSXWORKBOOK_H
27
28 #include "xlsxglobal.h"
29 #include "xlsxabstractooxmlfile.h"
30 #include "xlsxabstractsheet.h"
31 #include <QList>
32 #include <QImage>
33 #include <QSharedPointer>
34
35 class QIODevice;
36
37 QT_BEGIN_NAMESPACE_XLSX
38
39 class SharedStrings;
40 class Styles;
41 class Drawing;
42 class Document;
43 class Theme;
44 class Relationships;
45 class DocumentPrivate;
46 class MediaFile;
47 class Chart;
48 class Chartsheet;
49 class Worksheet;
50
51 class WorkbookPrivate;
52 class Q_XLSX_EXPORT Workbook : public AbstractOOXmlFile
53 {
54 Q_DECLARE_PRIVATE(Workbook)
55 public:
56 ~Workbook();
57
58 int sheetCount() const;
59 AbstractSheet *sheet(int index) const;
60
61 AbstractSheet *addSheet(const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
62 AbstractSheet *insertSheet(int index, const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
63 bool renameSheet(int index, const QString &name);
64 bool deleteSheet(int index);
65 bool copySheet(int index, const QString &newName=QString());
66 bool moveSheet(int srcIndex, int distIndex);
67
68 AbstractSheet *activeSheet() const;
69 bool setActiveSheet(int index);
70
71 // void addChart();
72 bool defineName(const QString &name, const QString &formula, const QString &comment=QString(), const QString &scope=QString());
73 bool isDate1904() const;
74 void setDate1904(bool date1904);
75 bool isStringsToNumbersEnabled() const;
76 void setStringsToNumbersEnabled(bool enable=true);
77 bool isStringsToHyperlinksEnabled() const;
78 void setStringsToHyperlinksEnabled(bool enable=true);
79 bool isHtmlToRichStringEnabled() const;
80 void setHtmlToRichStringEnabled(bool enable=true);
81 QString defaultDateFormat() const;
82 void setDefaultDateFormat(const QString &format);
83
84 //internal used member
85 void addMediaFile(QSharedPointer<MediaFile> media, bool force=false);
86 QList<QSharedPointer<MediaFile> > mediaFiles() const;
87 void addChartFile(QSharedPointer<Chart> chartFile);
88 QList<QSharedPointer<Chart> > chartFiles() const;
89
90 private:
91 friend class Worksheet;
92 friend class Chartsheet;
93 friend class WorksheetPrivate;
94 friend class Document;
95 friend class DocumentPrivate;
96
97 Workbook(Workbook::CreateFlag flag);
98
99 void saveToXmlFile(QIODevice *device) const;
100 bool loadFromXmlFile(QIODevice *device);
101
102 SharedStrings *sharedStrings() const;
103 Styles *styles();
104 Theme *theme();
105 QList<QImage> images();
106 QList<Drawing *> drawings();
107 QList<QSharedPointer<AbstractSheet> > getSheetsByTypes(AbstractSheet::SheetType type) const;
108 QStringList worksheetNames() const;
109 AbstractSheet *addSheet(const QString &name, int sheetId, AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
110 };
111
112 QT_END_NAMESPACE_XLSX
113
114 #endif // XLSXWORKBOOK_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)