LibEngsas
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ESpreadsheetHandler Class Reference

Class to read and write files containing spreadsheet.Use this class to read and write to spreadsheet files. It uses ESpreadsheetProvider, to handle specific formats (like csv, ods, xls, ...). Which provider it uses, is determined by the file suffix, given to loadFile() and saveFile(). Which suffixes are supported, can be listed with filters(). More...

#include <espreadsheethandler.h>

+ Inheritance diagram for ESpreadsheetHandler:
+ Collaboration diagram for ESpreadsheetHandler:

Public Member Functions

 ESpreadsheetHandler (QObject *parent=NULL)
 
 ~ESpreadsheetHandler ()
 
QStringList filters () const
 A list of supported file filters, combineable by ";;". More...
 
bool handles (QString fileSuffix) const
 Returns true, if a provider is able to handle files with suffix fileSuffix. More...
 
bool create (QString file)
 Creates a file containing the spreadsheets. More...
 
bool create (QFile *file)
 
bool load (QString file)
 Loads the file containing the spreadsheets. More...
 
bool load (QFile *file)
 
bool writeData ()
 Call this function after modifying the ESpreadsheet to write the data to the filesystem. More...
 
void close ()
 Closes the opened file. More...
 
ESpreadsheetappendSpreadsheet (QString name)
 
EngSaS::Spreadsheets spreadsheets () const
 
- Public Member Functions inherited from EObject
 EObject (QObject *parent=0)
 
virtual ~EObject ()
 
void connectByPass (QObject *object)
 

Static Public Member Functions

static QList
< ESpreadsheetProvider * > 
provider ()
 A list with all ESpreadsheetProvider. More...
 
static ESettingsModelItemsettings ()
 The settings page for the ESpreadsheetHandler module. More...
 
- Static Public Member Functions inherited from EObject
static void connectByPass (QObject *parent, QObject *child)
 

Private Member Functions

bool loadProvider (QString file)
 Tries to load a provider with help of the suffix from file. More...
 

Private Attributes

ESpreadsheetProvidercurrentProvider
 
QMultiMap< QString,
ESpreadsheetProvider * > 
mapFilterToProvider
 

Additional Inherited Members

- Public Slots inherited from EObject
virtual void reloadSettings ()
 Used to reload the settings. More...
 
- Signals inherited from EObject
void error (const QString &message)
 
void warning (const QString &message)
 
void information (const QString &message)
 
void reloadEnableActions ()
 Request reloading of enabled actions in EMainWindow. More...
 
void addMenu (QMenu *newMenu, const QString &parent, QString before=QString())
 
void addAction (QAction *newAction, const QString &parent, QString before=QString())
 
void addToolBar (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea)
 
void addNewDockWidget (QDockWidget *widget, const Qt::DockWidgetArea &area)
 
void setCentralWidget (QWidget *centralWidget)
 
void showSettings ()
 
void showHelp (const QString &page)
 
void showStatusWidget (QWidget *widget)
 
void reloadSettingsRequest ()
 Indicates, that a reload of the settings is needed. More...
 
void doReloadSettings ()
 Emitted to bring the reload request back to the farest child. More...
 
- Protected Slots inherited from EObject
virtual void errorByPass (const QString &message)
 
virtual void warningByPass (const QString &message)
 
virtual void informationByPass (const QString &message)
 
virtual void reloadEnableActionsByPass ()
 
virtual void addMenuByPass (QMenu *newMenu, const QString &parent, QString before=QString())
 
virtual void addActionByPass (QAction *newAction, const QString &parent, QString before=QString())
 
virtual void addToolBarByPass (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea)
 
virtual void addNewDockWidgetByPass (QDockWidget *widget, const Qt::DockWidgetArea &area)
 
virtual void setCentralWidgetByPass (QWidget *centralWidget)
 
virtual void showSettingsByPass ()
 
virtual void showHelpByPass (const QString &page)
 
virtual void showStatusWidgetByPass (QWidget *widget)
 
virtual void reloadSettingsRequestByPass ()
 
- Protected Member Functions inherited from EObject
void addManagedDockWidget (QDockWidget *widget, const Qt::DockWidgetArea &area, QString actionLabel=QString(), QString actionParent=QString())
 Adds an dock widget via addNewDockWidget() and adds widget to the list of managed dock widgets. More...
 

Detailed Description

Class to read and write files containing spreadsheet.

Use this class to read and write to spreadsheet files. It uses ESpreadsheetProvider, to handle specific formats (like csv, ods, xls, ...). Which provider it uses, is determined by the file suffix, given to loadFile() and saveFile(). Which suffixes are supported, can be listed with filters().

To read a spreadsheet file, use loadFile(QString) or loadFile(QFile) to load the file. Afterwards you can call spreadsheets() to get a list of spreadsheet within the loaded file. Each spreadsheet is represented by one ESpreadsheet object. Use those objects to read and or modify the data within a spreadsheet.

To create a new spreadsheet file, call createFile(QString) or createFile(QFile). Than you can add new spreadsheets to the file by calling appendSpreadsheet(). Than modify the ESpreadsheet object to add data to the spreadsheet.

If you want to handle a new file type, you must implement a new ESpreadsheetProvider.

Constructor & Destructor Documentation

ESpreadsheetHandler::ESpreadsheetHandler ( QObject *  parent = NULL)

+ Here is the call graph for this function:

ESpreadsheetHandler::~ESpreadsheetHandler ( )

+ Here is the call graph for this function:

Member Function Documentation

ESpreadsheet * ESpreadsheetHandler::appendSpreadsheet ( QString  name)

+ Here is the call graph for this function:

void ESpreadsheetHandler::close ( )

Closes the opened file.

To save changed data before closing the file, call writeData().

See Also
load(Qstring)
load(QFile*)
create(QString)
create(QFile*)
close()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ESpreadsheetHandler::create ( QString  file)

Creates a file containing the spreadsheets.

It uses a provider, which supports the current file suffix.

See Also
create(QFile*)
load(QString)
load(QFile*)
writeData()
close()
bool ESpreadsheetHandler::create ( QFile *  file)

+ Here is the call graph for this function:

QStringList ESpreadsheetHandler::filters ( ) const

A list of supported file filters, combineable by ";;".

+ Here is the caller graph for this function:

bool ESpreadsheetHandler::handles ( QString  fileSuffix) const

Returns true, if a provider is able to handle files with suffix fileSuffix.

+ Here is the call graph for this function:

bool ESpreadsheetHandler::load ( QString  file)

Loads the file containing the spreadsheets.

See Also
create(QString)
create(QFile*)
load(QFile*)
writeData()
close()
bool ESpreadsheetHandler::load ( QFile *  file)

+ Here is the call graph for this function:

bool ESpreadsheetHandler::loadProvider ( QString  file)
private

Tries to load a provider with help of the suffix from file.

It sets ESpreadsheetHandler::provider to NULL, therefore if it returns false, ESpreadsheetHandler::provider is also NULL.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QList< ESpreadsheetProvider * > ESpreadsheetHandler::provider ( )
static

A list with all ESpreadsheetProvider.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ESettingsModelItem * ESpreadsheetHandler::settings ( )
static

The settings page for the ESpreadsheetHandler module.

Does also contain the page for the available ESpreadsheetProvider.

+ Here is the call graph for this function:

EngSaS::Spreadsheets ESpreadsheetHandler::spreadsheets ( ) const

+ Here is the call graph for this function:

bool ESpreadsheetHandler::writeData ( )

Call this function after modifying the ESpreadsheet to write the data to the filesystem.

See Also
load(Qstring)
load(QFile*)
create(QString)
create(QFile*)
close()

+ Here is the call graph for this function:

Member Data Documentation

ESpreadsheetProvider* ESpreadsheetHandler::currentProvider
private
QMultiMap<QString, ESpreadsheetProvider* > ESpreadsheetHandler::mapFilterToProvider
private

The documentation for this class was generated from the following files: