odsstream
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 #pragma once
21 
22 #include <QIODevice>
23 #include <QString>
24 #include <QUrl>
25 
26 #include <quazip5/quazip.h>
27 #include "writer/structure/contentxml.h"
28 #include "calcwriterinterface.h"
29 #include "writer/structure/settingsxml.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(std::size_t) 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 };
Definition: calcwriterinterface.h:49
Definition: contentxml.h:35
Definition: odscolorscale.h:44
Definition: odsdocwriter.h:32
void writeSheet(const QString &sheetName) override
Definition: odsdocwriter.cpp:143
QString getOdsCellCoordinate() override
get the last written cell coordinate in ODS coordinate format get the coordinate of the last written ...
Definition: odsdocwriter.cpp:396
void writeEmptyCell() override
Definition: odsdocwriter.cpp:202
void writeCellPercentage(double value) override
Definition: odsdocwriter.cpp:274
void close() override
Definition: odsdocwriter.cpp:103
void setCellAnnotation(const QString &annotation) override
set annotation to write in the next cell
Definition: odsdocwriter.cpp:383
OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style) override
Definition: odsdocwriter.cpp:369
void writeCell(const char *) override
write a text cell
Definition: odsdocwriter.cpp:184
void writeLine() override
Definition: odsdocwriter.cpp:154
Definition: odstablecellstyleref.h:39
Definition: odstablecellstyle.h:34
Definition: odstablesettings.h:43
Definition: settingsxml.h:45