libodsstream
Library for mass spectrometry
Loading...
Searching...
No Matches
contentxml.h
Go to the documentation of this file.
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 <quazip.h>
23#include <quazipfile.h>
24#include <QXmlStreamWriter>
25#include <QUrl>
26#include <QDate>
27#include <QDateTime>
28#include "../options/odstablecellstyle.h"
29#include "../options/odstablecellstyleref.h"
30#include "../options/odscolorscale.h"
31#include "settingsxml.h"
32
33
35{
36 public:
37 ContentXml(QuaZip *p_quaZip, SettingsXml *p_settings_xml);
38 virtual ~ContentXml();
39 void writeSheet(const QString &sheetName);
40 void writeCell(double value, const QString &annotation);
41 void writeCell(std::size_t 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
55 void addColorScale(const OdsColorScale &ods_color_scale);
56 QString getCellCoordinate();
57
58 private:
59 void writeCellFloat(const QString &value,
60 const QString &representation,
61 const QString &annotation);
62 void writeSheet();
63 void writeEndTable();
64 std::vector<OdsColorScale>
65 getOdsColorScaleListBySheetName(const QString &sheet_name);
66
67 void WriteHeader();
68 void writeFontFaceDecls();
70 void startSpreadsheet();
71 void writeAnnotation(const QString &annotation);
72
73 QuaZipFile _outFile;
74
75 static QString _xsdNamespaceURI;
76 static QString _xsiNamespaceURI;
77
78
79 QuaZip *_p_quaZip;
80 QXmlStreamWriter *_p_writer;
81
83
87 std::vector<OdsTableCellStyle> _style2write;
88 std::vector<OdsTableCellStyleRef> _style_ref_list;
90
91 std::vector<OdsColorScale> _color_scale_list;
93
94
95 unsigned int _row_pos = 0;
96 unsigned int _col_pos = 0;
98};
void writeLine()
static QString _xsdNamespaceURI
Definition contentxml.h:75
SettingsXml * _p_settings_xml
Definition contentxml.h:97
void WriteHeader()
QXmlStreamWriter * _p_writer
Definition contentxml.h:80
std::vector< OdsColorScale > getOdsColorScaleListBySheetName(const QString &sheet_name)
void writeCell(double value, const QString &annotation)
void writeCellPercentage(double value, const QString &annotation)
QuaZip * _p_quaZip
Definition contentxml.h:79
OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style)
void writeEmptyCell(const QString &annotation)
OdsTableCellStyleRefInternal * _current_style_ref
Definition contentxml.h:89
void startSpreadsheet()
bool _automatic_styles_writed
Definition contentxml.h:85
void writeAutomaticStyles()
unsigned int _row_pos
Definition contentxml.h:95
virtual ~ContentXml()
std::vector< OdsTableCellStyle > _style2write
Definition contentxml.h:87
bool _tableStarted
Definition contentxml.h:82
std::vector< OdsColorScale > _color_scale_list
Definition contentxml.h:91
std::vector< OdsTableCellStyleRef > _style_ref_list
Definition contentxml.h:88
void writeAnnotation(const QString &annotation)
void addColorScale(const OdsColorScale &ods_color_scale)
void writeCellFloat(const QString &value, const QString &representation, const QString &annotation)
static QString _xsiNamespaceURI
Definition contentxml.h:76
bool _spreadsheet_started
Definition contentxml.h:86
unsigned int _col_pos
Definition contentxml.h:96
void setTableCellStyleRef(OdsTableCellStyleRef style_ref)
bool _tableRowStarted
Definition contentxml.h:84
QString getCellCoordinate()
void writeEndTable()
QuaZipFile _outFile
Definition contentxml.h:73
void writeFontFaceDecls()
QString _current_sheet_name
Definition contentxml.h:92
void writeSheet()