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