Scribus
Open source desktop publishing at your fingertips
csvim.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef CSVIM_H
8 #define CSVIM_H
9 
10 #include "pluginapi.h"
11 #include "csvdia.h"
12 #include <QByteArray>
13 #include <QFile>
14 #include <QFileInfo>
15 #include <QString>
16 #include <QStringList>
17 #include <QTextCodec>
18 
19 class gtParagraphStyle;
20 class gtWriter;
21 
22 extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer);
23 
24 extern "C" PLUGIN_API QString FileFormatName();
25 
26 extern "C" PLUGIN_API QStringList FileExtensions();
27 
28 class CsvIm
29 {
30 public:
31  CsvIm(const QString& fname, const QString& enc, gtWriter *w, const QString& fdelim = ",",
32  const QString& vdelim = "\"", bool header = false, bool usevdelim = true);
33  ~CsvIm();
34  void setFieldDelimiter(const QString& fdelim);
35  void setValueDelimiter(const QString& vdelim);
36  void write();
37 private:
38  QString fieldDelimiter;
39  QString valueDelimiter;
40  bool hasHeader;
41  bool useVDelim;
42  QString filename;
43  QString encoding;
44  gtWriter *writer;
45  QString header;
46  QString data;
47  int rowNumber;
48  int colIndex;
49  int colCount;
50  gtParagraphStyle *pstyleData;
51  gtParagraphStyle *pstyleHeader;
52  void loadFile();
53  void parseLine(const QString& line, bool isHeader);
54  QString toUnicode(const QByteArray& rawText);
55  void setupPStyles();
56  void setupTabulators();
57 };
58 
59 #endif // CSVIM_H
Definition: gtwriter.h:38
Definition: csvim.h:28
Definition: gtparagraphstyle.h:51