LibEngsas
espreadsheetprovidercsv.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef ESPREADSHEETPROVIDERCSV_H
22 #define ESPREADSHEETPROVIDERCSV_H
23 
24 #include <espreadsheetprovider.h>
25 
26 class ESpreadsheetCsv;
27 
28 #include <QDir>
29 #if QT_VERSION >= 0x050000
30 #include <QtPlugin>
31 #endif
32 
33 class QTextCodec;
34 
42 {
43  Q_OBJECT
44  Q_INTERFACES ( ESpreadsheetProvider )
45 #if QT_VERSION >= 0x050000
46  Q_PLUGIN_METADATA(IID LibEngsasESpreadsheetProviderIID FILE "espreadsheetprovidercsv.json")
47 #endif
48  Q_PROPERTY(QString name READ name)
49  Q_PROPERTY(QString description READ description)
50  public:
51  ESpreadsheetProviderCsv(QObject *parent = NULL);
52 
53  QString name() const;
54  QString description() const;
55  QString providerId() const;
56  static QString staticProviderId();
58 
59  QStringList filters() const;
60  bool sheetsSupported() const;
61  bool create(QFile *file);
62  bool load(QFile *file);
63  bool writeData();
64  void close();
65  ESpreadsheet* appendSpreadsheet(QString name);
66  EngSaS::Spreadsheets spreadsheets();
67 
68  private:
72  bool loadSettings();
73  void setSpreadsheet(ESpreadsheetCsv *sheet);
74 
75  QFile *file;
78  QTextCodec* encoding;
79 };
80 
81 #endif // ESPREADSHEETPROVIDERCSV_H
QList< ESpreadsheet * > Spreadsheets
A type to replace QList<ESpreadsheet*> with a shorter name.
Definition: eglobal.h:172
QString providerId() const
Definition: espreadsheetprovidercsv.cpp:53
bool load(QFile *file)
Definition: espreadsheetprovidercsv.cpp:93
QStringList filters() const
Definition: espreadsheetprovidercsv.cpp:70
ESpreadsheet * appendSpreadsheet(QString name)
Definition: espreadsheetprovidercsv.cpp:119
A spreadsheet, within a spreadsheet file.A spreadsheet consists of cells of type ESpreadsheetCell, which are ordered in rows and columns. An object of this type can be used to manipulate the hold data (see e. g. setData(ESpreadsheetCell)). To retrieve the cell content use data(int, int).
Definition: espreadsheet.h:58
bool writeData()
Definition: espreadsheetprovidercsv.cpp:106
bool sheetsSupported() const
Return true, if (more than one) sheet is supported.
Definition: espreadsheetprovidercsv.cpp:75
bool create(QFile *file)
Definition: espreadsheetprovidercsv.cpp:80
The base class of the all widgets used to display settings at the ESettingsDialog.
Definition: esettingswidget.h:31
EngSaS::Spreadsheets spreadsheets()
Definition: espreadsheetprovidercsv.cpp:132
QString description() const
QFile * file
Definition: espreadsheetprovidercsv.h:75
static QString staticProviderId()
Definition: espreadsheetprovidercsv.cpp:58
void setSpreadsheet(ESpreadsheetCsv *sheet)
Definition: espreadsheetprovidercsv.cpp:154
QString separator
Definition: espreadsheetprovidercsv.h:76
QString textmarker
Definition: espreadsheetprovidercsv.h:76
QTextCodec * encoding
Definition: espreadsheetprovidercsv.h:78
Definition: espreadsheetcsv.h:28
ESpreadsheetCsv * spreadsheet
Definition: espreadsheetprovidercsv.h:77
void close()
Closes the opened file and deletes the spreadsheets.
Definition: espreadsheetprovidercsv.cpp:113
ESettingsWidget * settingsWidget() const
Definition: espreadsheetprovidercsv.cpp:64
QString name() const
Handles CSV im- and export.
Definition: espreadsheetprovidercsv.h:41
bool loadSettings()
Shows the ESpreadsheetProviderCsvSettingsDialog loads the settings. Returns true on accepted and fals...
Definition: espreadsheetprovidercsv.cpp:143
Interface to implement spreadsheet providers (e. g. to create excel files or ods, ...
Definition: espreadsheetprovider.h:38