libodsstream
odsdocwriter.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 ODSDOCWRITER_H
21 #define ODSDOCWRITER_H
22 
23 #include <QIODevice>
24 #include <QString>
25 #include <QUrl>
26 
27 #include <quazip/quazip.h>
28 #include "structure/contentxml.h"
29 #include "calcwriterinterface.h"
30 
32 {
33 public:
34  OdsDocWriter(const QString & filename);
35  OdsDocWriter(QIODevice * device);
36  virtual ~OdsDocWriter();
37 
38  void close() override;
39 
40  void writeSheet(const QString & sheetName) override;
41  void writeLine() override;
42  void writeCell(const char *) override;
43  void writeCell(const QString &) override;
44  void writeEmptyCell() override;
45  void writeCell(int) override;
46  void writeCell(float) override;
47  void writeCell(double)override;
48  void writeCellPercentage(double value) override;
49  void writeCell(bool) override;
50  void writeCell(const QDate &) override;
51  void writeCell(const QDateTime &) override;
52  void writeCell(const QUrl &, const QString &) override;
54  void setTableCellStyleRef(OdsTableCellStyleRef style_ref) override;
55  void setCellAnnotation(const QString & annotation) override;
56 
57 private:
58  void openDevice(QIODevice* device);
59  void clearAnnotation();
60 private:
61  ContentXml * _p_content;
62  QuaZip * _p_quaZip;
63  QIODevice * _p_device = nullptr;
64  bool _p_device_delete = false;
65  QString _next_annotation;
66 
67 };
68 
69 #endif // ODSDOCWRITER_H
Definition: odstablecellstyleref.h:31
void writeEmptyCell() override
Definition: odsdocwriter.cpp:173
void writeCell(const char *) override
write a text cell
Definition: odsdocwriter.cpp:157
Definition: odstablecellstyle.h:26
void writeLine() override
Definition: odsdocwriter.cpp:133
void setTableCellStyleRef(OdsTableCellStyleRef style_ref) override
Definition: odsdocwriter.cpp:312
void writeSheet(const QString &sheetName) override
Definition: odsdocwriter.cpp:124
void close() override
Definition: odsdocwriter.cpp:93
Definition: contentxml.h:35
OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style) override
Definition: odsdocwriter.cpp:307
void setCellAnnotation(const QString &annotation) override
set annotation to write in the next cell
Definition: odsdocwriter.cpp:317
Definition: odsdocwriter.h:31
Definition: calcwriterinterface.h:29
void writeCellPercentage(double value) override
Definition: odsdocwriter.cpp:222