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 <quazip5/quazip.h>
28 #include "writer/structure/contentxml.h"
29 #include "calcwriterinterface.h"
30 #include "writer/structure/settingsxml.h"
31 
33 {
34  public:
35  OdsDocWriter(const QString &filename);
36  OdsDocWriter(QIODevice *device);
37  virtual ~OdsDocWriter();
38 
39  void close() override;
40 
41  void writeSheet(const QString &sheetName) override;
42  void writeLine() override;
43  void writeCell(const char *) override;
44  void writeCell(const QString &) override;
45  void writeEmptyCell() override;
46  void writeCell(int) override;
47  void writeCell(float) override;
48  void writeCell(double) override;
49  void writeCellPercentage(double value) override;
50  void writeCell(bool) override;
51  void writeCell(const QDate &) override;
52  void writeCell(const QDateTime &) override;
53  void writeCell(const QUrl &, const QString &) override;
55  getTableCellStyleRef(const OdsTableCellStyle &style) override;
56  void setTableCellStyleRef(OdsTableCellStyleRef style_ref) override;
57  void setCellAnnotation(const QString &annotation) override;
58  void addColorScale(const OdsColorScale &ods_color_scale) override;
59  QString getOdsCellCoordinate() override;
60 
61  void setCurrentOdsTableSettings(const OdsTableSettings &settings) override;
62 
63  private:
64  void openDevice(QIODevice *device);
65  void clearAnnotation();
66 
67  private:
68  ContentXml *_p_content;
69  QuaZip *_p_quaZip;
70  QIODevice *_p_device = nullptr;
71  bool _p_device_delete = false;
72  QString _next_annotation;
73  SettingsXml _settings_xml;
74 };
75 
76 #endif // ODSDOCWRITER_H
OdsDocWriter
Definition: odsdocwriter.h:32
OdsDocWriter::writeCellPercentage
void writeCellPercentage(double value) override
Definition: odsdocwriter.cpp:259
ContentXml
Definition: contentxml.h:35
OdsTableCellStyle
Definition: odstablecellstyle.h:33
OdsDocWriter::getTableCellStyleRef
OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style) override
Definition: odsdocwriter.cpp:354
OdsColorScale
Definition: odscolorscale.h:43
OdsDocWriter::writeEmptyCell
void writeEmptyCell() override
Definition: odsdocwriter.cpp:202
OdsDocWriter::setCellAnnotation
void setCellAnnotation(const QString &annotation) override
set annotation to write in the next cell
Definition: odsdocwriter.cpp:368
OdsDocWriter::writeCell
void writeCell(const char *) override
write a text cell
Definition: odsdocwriter.cpp:184
OdsDocWriter::writeLine
void writeLine() override
Definition: odsdocwriter.cpp:154
CalcWriterInterface
Definition: calcwriterinterface.h:49
OdsDocWriter::writeSheet
void writeSheet(const QString &sheetName) override
Definition: odsdocwriter.cpp:143
OdsDocWriter::getOdsCellCoordinate
QString getOdsCellCoordinate() override
get the last written cell coordinate in ODS coordinate format get the coordinate of the last written ...
Definition: odsdocwriter.cpp:381
OdsDocWriter::close
void close() override
Definition: odsdocwriter.cpp:103
OdsDocWriter::setCurrentOdsTableSettings
void setCurrentOdsTableSettings(const OdsTableSettings &settings) override
set ODS table settings of the current sheet (table)
Definition: odsdocwriter.cpp:387
OdsTableSettings
Definition: odstablesettings.h:42
SettingsXml
Definition: settingsxml.h:45
OdsTableCellStyleRefInternal
Definition: odstablecellstyleref.h:38
OdsDocWriter::addColorScale
void addColorScale(const OdsColorScale &ods_color_scale) override
apply solor scale conditional format on a cell range
Definition: odsdocwriter.cpp:374
OdsDocWriter::setTableCellStyleRef
void setTableCellStyleRef(OdsTableCellStyleRef style_ref) override
Definition: odsdocwriter.cpp:361