libodsstream
contentxml.h
1 /*
2  libodsstream is a library to read and write ODS documents as streams
3  Copyright (C) 2013 Olivier Langella <Olivier.Langella@moulon.inra.fr>
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program 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
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef CONTENTXML_H
21 #define CONTENTXML_H
22 
23 #include <quazip/quazip.h>
24 #include <quazip/quazipfile.h>
25 #include <QXmlStreamWriter>
26 #include <QUrl>
27 #include <QDate>
28 #include <QDateTime>
29 #include "../odstablecellstyle.h"
30 #include "../odstablecellstyleref.h"
31 
32 
33 
34 
36 {
37 public :
38  ContentXml(QuaZip * p_quaZip);
39  virtual ~ContentXml();
40  void writeSheet(const QString & sheetName);
41  void writeCell(double value, const QString & annotation);
42  void writeCell(int value, const QString & annotation);
43  void writeCell(const QString & value, const QString & annotation);
44  void writeCell(const QDate &, const QString & annotation);
45  void writeCell(const QDateTime &, const QString & annotation);
46  void writeCell(const QUrl &, const QString &, const QString & annotation);
47  void writeCell(bool value, const QString & annotation);
48  void writeCellPercentage(double value, const QString & annotation);
49  void writeEmptyCell(const QString & annotation);
50  void writeLine();
51  void close();
52 
53  OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle & style);
54  void setTableCellStyleRef(OdsTableCellStyleRef style_ref);
55 private:
56  void writeCellFloat(const QString & value, const QString & representation, const QString & annotation);
57  void writeSheet();
58 
59  void WriteHeader();
60  void writeFontFaceDecls();
61  void writeAutomaticStyles();
62  void startSpreadsheet();
63  void writeAnnotation(const QString & annotation);
64 
65  QuaZipFile _outFile;
66 
67  static QString _xsdNamespaceURI;
68  static QString _xsiNamespaceURI;
69 
70 
71  QuaZip * _p_quaZip;
72  QXmlStreamWriter * _p_writer;
73 
74  bool _tableStarted;
75 
76  bool _tableRowStarted;
77  bool _automatic_styles_writed = false;
78  bool _spreadsheet_started =false;
79  std::vector< OdsTableCellStyle > _style2write;
80  std::vector< OdsTableCellStyleRef > _style_ref_list;
81  OdsTableCellStyleRefInternal * _current_style_ref=nullptr;
82 
83 
84 };
85 
86 #endif // CONTENTXML_H
Definition: odstablecellstyleref.h:31
Definition: odstablecellstyle.h:26
Definition: contentxml.h:35