LibEngsas
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ESpreadsheet Class Reference

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). More...

#include <espreadsheet.h>

+ Inheritance diagram for ESpreadsheet:
+ Collaboration diagram for ESpreadsheet:

Public Types

enum  Header { HeaderNone = 0x0, HeaderVertical = 0x1, HeaderHorizontal = 0x2, HeaderAll = HeaderVertical | HeaderHorizontal }
 Used by setData(QAbstractItemModel*, QModelIndex, Header) to determine which header to add. More...

Public Member Functions

 ESpreadsheet (ESpreadsheetProvider *provider, QObject *parent=NULL)
QString name () const
virtual void setName (QString name)
ESpreadsheetProviderprovider () const
void setProvider (ESpreadsheetProvider *provider)
bool setData (QAbstractItemModel *model, ESpreadsheet::Headers header=ESpreadsheet::HeaderNone, QModelIndex root=QModelIndex())
 Adds the data of the childs of index root to this spreadsheet.
virtual bool setData (ESpreadsheetCell cell)=0
 Adds value to this spreadsheet at ESpreadsheetCell::row() and ESpreadsheetCell::column of cell.
bool setForeground (int row, int column, QBrush foreground)
 Sets the foreground of cell row and column to foreground.
bool setBackground (int row, int column, QBrush background)
 Sets the background of cell row and column to background.
bool setFont (int row, int column, QFont font)
 Sets the font of cell row and column to font.
bool setAlignment (int row, int column, Qt::AlignmentFlag alignment)
 Sets the alignment of cell row and column to alignment.
bool data (QAbstractItemModel *model, QModelIndex root=QModelIndex()) const
 Loads the data of this spreadsheet into model as childs of index root.
virtual ESpreadsheetCell data (int row, int column) const =0
 Returns the data of the cell row, column.
virtual int rowCount () const =0
 Returns the number of rows within this spreadsheet.
virtual int columnCount () const =0
 Returns the number of columns within this spreadsheet.
- Public Member Functions inherited from EObject
 EObject (QObject *parent=0)
virtual ~EObject ()
void connectByPass (QObject *object)

Protected Member Functions

 ESpreadsheet (QObject *parent=NULL)
 Constructs an ESpreadsheet without a provider.
- 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.

Private Attributes

QString myName
ESpreadsheetProvidermyProvider

Additional Inherited Members

- Public Slots inherited from EObject
virtual void reloadSettings ()
 Used to reload the settings.
- 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.
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.
void doReloadSettings ()
 Emitted to bring the reload request back to the farest child.
- Static Public Member Functions inherited from EObject
static void connectByPass (QObject *parent, QObject *child)
- 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 ()

Detailed Description

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).

ESpreadsheet can also deal with QAbstractItemModel. It provides the functions setData(QAbstractItemModel*, QModelIndex) and data(QAbstractItemModel*, QModelIndex) to write and read data from and into a QAbstractItemModel.

To append an spreadsheet to a file (and getting an pointer to an ESpreadsheet object back), use ESpreadsheetHandler::appendSpreadsheet().

To implement your own ESpreadsheet subclass within your ESpreadsheetProvider, implement setData(ESpreadsheetCell), data(int, int), rowCount() and columnCount(). May be you also want to overload setName().

See Also
ESpreadsheetCell
ESpreadsheetHandler
ESpreadsheetProvider

Member Enumeration Documentation

Used by setData(QAbstractItemModel*, QModelIndex, Header) to determine which header to add.

Enumerator:
HeaderNone 
HeaderVertical 
HeaderHorizontal 
HeaderAll 

Constructor & Destructor Documentation

ESpreadsheet::ESpreadsheet ( ESpreadsheetProvider provider,
QObject *  parent = NULL 
)

+ Here is the call graph for this function:

ESpreadsheet::ESpreadsheet ( QObject *  parent = NULL)
protected

Constructs an ESpreadsheet without a provider.

You should set a provider with setProvider() within the constructor of your subclass!

+ Here is the call graph for this function:

Member Function Documentation

virtual int ESpreadsheet::columnCount ( ) const
pure virtual

Returns the number of columns within this spreadsheet.

Note
This function should be implemented by the plugin providing an ESpreadsheetProvider.

Implemented in ExcelSheet, and ESpreadsheetCsv.

+ Here is the caller graph for this function:

bool ESpreadsheet::data ( QAbstractItemModel *  model,
QModelIndex  root = QModelIndex() 
) const

Loads the data of this spreadsheet into model as childs of index root.

Internally it uses data(int row, int column);

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual ESpreadsheetCell ESpreadsheet::data ( int  row,
int  column 
) const
pure virtual

Returns the data of the cell row, column.

Note
This function should be implemented by the plugin providing an ESpreadsheetProvider.

Implemented in ExcelSheet, and ESpreadsheetCsv.

QString ESpreadsheet::name ( ) const

+ Here is the caller graph for this function:

ESpreadsheetProvider * ESpreadsheet::provider ( ) const

+ Here is the caller graph for this function:

virtual int ESpreadsheet::rowCount ( ) const
pure virtual

Returns the number of rows within this spreadsheet.

Note
This function should be implemented by the plugin providing an ESpreadsheetProvider.

Implemented in ExcelSheet, and ESpreadsheetCsv.

+ Here is the caller graph for this function:

bool ESpreadsheet::setAlignment ( int  row,
int  column,
Qt::AlignmentFlag  alignment 
)

Sets the alignment of cell row and column to alignment.

See Also
setData(ESpreadsheetCell)
setData(QAbstractItemModel*, QModelIndex)
setForeground()
setBackground()
setFont()

+ Here is the call graph for this function:

bool ESpreadsheet::setBackground ( int  row,
int  column,
QBrush  background 
)

Sets the background of cell row and column to background.

See Also
setData(ESpreadsheetCell)
setData(QAbstractItemModel*, QModelIndex)
setForeground()
setFont()
setAlignment()

+ Here is the call graph for this function:

bool ESpreadsheet::setData ( QAbstractItemModel *  model,
ESpreadsheet::Headers  header = ESpreadsheet::HeaderNone,
QModelIndex  root = QModelIndex() 
)

Adds the data of the childs of index root to this spreadsheet.

To also add the header of the model to the spreadsheet, set header appropriatly.

Internally it calls setData(QVariant, QFont, Qt::AlignmentFlag, QBrush, QBrush).

See Also
setData(ESpreadsheetCell)
setForeground()
setBackground()
setFont()
setAlignment()
data(int, int)
data(QAbstractItemModel*, QModelIndex)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool ESpreadsheet::setData ( ESpreadsheetCell  cell)
pure virtual

Adds value to this spreadsheet at ESpreadsheetCell::row() and ESpreadsheetCell::column of cell.

To manipulate the text font, provide font, alignment and foreground. To specifiy a background color, set background.

See Also
setData(QAbstractItemModel*, QModelIndex)
setForeground()
setBackground()
setFont()
setAlignment()
data(int, int)
data(QAbstractItemModel*, QModelIndex)
Note
This function should be implemented by the plugin providing an ESpreadsheetProvider.

Implemented in ExcelSheet, and ESpreadsheetCsv.

bool ESpreadsheet::setFont ( int  row,
int  column,
QFont  font 
)

Sets the font of cell row and column to font.

See Also
setData(ESpreadsheetCell)
setData(QAbstractItemModel*, QModelIndex)
setForeground()
setBackground()
setAlignment()

+ Here is the call graph for this function:

bool ESpreadsheet::setForeground ( int  row,
int  column,
QBrush  foreground 
)

Sets the foreground of cell row and column to foreground.

See Also
setData(ESpreadsheetCell)
setData(QAbstractItemModel*, QModelIndex)
setBackground()
setFont()
setAlignment()

+ Here is the call graph for this function:

void ESpreadsheet::setName ( QString  name)
virtual

Reimplemented in ExcelSheet.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ESpreadsheet::setProvider ( ESpreadsheetProvider provider)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

QString ESpreadsheet::myName
private
ESpreadsheetProvider* ESpreadsheet::myProvider
private

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