libodsstream
Library for mass spectrometry
Loading...
Searching...
No Matches
calcwriterinterface.h
Go to the documentation of this file.
1/**
2 * \file odsstream/odsdochandlerinterface.h
3 * \date 10/03/2015
4 * \author Olivier Langella
5 * \brief interface to use as a wildcard to writer in either TSV, ODS
6 * TSVdirectory writers any kind of writer can be created in your program :
7 * OdsDocWriter, TsvDirectoryWriter, TsvOutputStream
8 * All of them implements this interface :
9 * it allows to use the same code to write in these different formats.
10 */
11
12/*******************************************************************************
13 * Copyright (c) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>.
14 *
15 * This file is part of the libodsstream library.
16 *
17 * libodsstream is a library to read and write ODS documents as streams
18 * Copyright (C) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>
19 *
20 * This program is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU Lesser General Public License as published
22 *by the Free Software Foundation, either version 3 of the License, or (at your
23 *option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 *
33 * Contributors:
34 * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
35 *implementation
36 ******************************************************************************/
37
38#pragma once
39
40
41#include <QDate>
42#include <QUrl>
47
49{
50 public:
51 virtual ~CalcWriterInterface();
52 virtual void close() = 0;
53
54 /**
55 * \brief open a new sheet
56 *
57 * \param sheetName the sheet name
58 */
59 virtual void writeSheet(const QString &sheetName) = 0;
60
61 /**
62 * \brief open a new line
63 */
64 virtual void writeLine() = 0;
65 /**
66 * \brief write a text cell
67 * \param cell_text cell text
68 */
69 virtual void writeCell(const char *cell_text) = 0;
70 /**
71 * \brief write a text cell
72 * \param cell_text cell text
73 */
74 virtual void writeCell(const QString &cell_text) = 0;
75 /**
76 * \brief write an empty cell
77 */
78 virtual void writeEmptyCell() = 0;
79 /**
80 * \brief write an unsigned integer in a cell
81 * \param number integer to write
82 */
83 virtual void writeCell(std::size_t number) = 0;
84 /**
85 * \brief write an integer in a cell
86 * \param number integer to write
87 */
88 virtual void writeCell(int number) = 0;
89 /**
90 * \brief write a float in a cell
91 * \param number float to write
92 */
93 virtual void writeCell(float number) = 0;
94 /**
95 * \brief write a double in a cell
96 * \param number double to write
97 */
98 virtual void writeCell(double number) = 0;
99
100 /**
101 * \brief write a double as a percentage
102 * \param number double to write must be a ratio (0.5 == 50%)
103 */
104 virtual void writeCellPercentage(double value) = 0;
105 /**
106 * \brief write a boolean in a cell
107 * \param true_or_false boolean to write
108 */
109 virtual void writeCell(bool true_or_false) = 0;
110 /**
111 * \brief write a date in a cell
112 * \param date date to write
113 */
114 virtual void writeCell(const QDate &date) = 0;
115 /**
116 * \brief write a timestamp in a cell
117 * \param datetime timestamp to write
118 */
119 virtual void writeCell(const QDateTime &datetime) = 0;
120 /**
121 * \brief write a text cell with an URL link
122 * \param url_link URL link
123 * \param text text to write
124 */
125 virtual void writeCell(const QUrl &url_link, const QString &text) = 0;
126
127
128 /**
129 * build table cell style reference with a style definition
130 *
131 * \param style OdsTableCellStyle
132 * \return OdsTableCellStyleRef pointer on a style reference
133 */
135 getTableCellStyleRef([[maybe_unused]] const OdsTableCellStyle &style);
136 /**
137 * set the cell table style. This is applied to in the stream to following
138 * cells. This ends by using an other style reference or by using
139 * setTableCellStyleRef function
140 *
141 * \param style_ref OdsTableCellStyleRef
142 */
143 virtual void
144 setTableCellStyleRef([[maybe_unused]] OdsTableCellStyleRef style_ref);
145
146 /**
147 * clear cell style definition in the stream. the default style will be
148 * applied.
149 *
150 */
152
153 /**
154 * \brief set annotation to write in the next cell
155 * \param annotation any comment on this cell
156 */
157 virtual void setCellAnnotation(const QString &annotation) = 0;
158
159 /** \brief apply solor scale conditional format on a cell range
160 *
161 */
162 virtual void
163 addColorScale([[maybe_unused]] const OdsColorScale &ods_color_scale);
164
165 /** @brief get the last written cell coordinate in ODS coordinate format
166 * get the coordinate of the last written cell or an empty string if the
167 * writer is not an OdsDocWriter
168 *
169 * @return QString with ODS cell coordinate of the form : "classeur.A5"
170 */
171 virtual QString getOdsCellCoordinate();
172
173 /** @brief set ODS table settings of the current sheet (table)
174 */
175 virtual void
176 setCurrentOdsTableSettings([[maybe_unused]] const OdsTableSettings &settings);
177
178 /**
179 * \brief write a cell for a given QVariant
180 * \param QVariant variable to write
181 */
182 virtual void writeCellVariant(const QVariant &var);
183};
virtual void writeEmptyCell()=0
write an empty cell
virtual void writeCell(const char *cell_text)=0
write a text cell
virtual void close()=0
virtual void writeCellVariant(const QVariant &var)
write a cell for a given QVariant
virtual void setCellAnnotation(const QString &annotation)=0
set annotation to write in the next cell
virtual void writeCell(bool true_or_false)=0
write a boolean in a cell
virtual void writeCell(const QString &cell_text)=0
write a text cell
virtual void setTableCellStyleRef(OdsTableCellStyleRef style_ref)
virtual void addColorScale(const OdsColorScale &ods_color_scale)
apply solor scale conditional format on a cell range
virtual void writeCell(std::size_t number)=0
write an unsigned integer in a cell
virtual QString getOdsCellCoordinate()
get the last written cell coordinate in ODS coordinate format get the coordinate of the last written ...
virtual void writeCell(float number)=0
write a float in a cell
virtual void writeCellPercentage(double value)=0
write a double as a percentage
virtual void writeCell(double number)=0
write a double in a cell
virtual OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style)
virtual void writeCell(const QDate &date)=0
write a date in a cell
virtual void writeCell(const QDateTime &datetime)=0
write a timestamp in a cell
virtual void writeCell(const QUrl &url_link, const QString &text)=0
write a text cell with an URL link
virtual void writeSheet(const QString &sheetName)=0
open a new sheet
virtual void setCurrentOdsTableSettings(const OdsTableSettings &settings)
set ODS table settings of the current sheet (table)
virtual void writeCell(int number)=0
write an integer in a cell
virtual void writeLine()=0
open a new line
structure to apply a color scale in ODS sheets
handler for ODS cell style
internal reference on handler for ODS cell style
store table settings