- Main Page
- Classes
- Files
- Related Pages
- Examples

- Class List
- Class Hierarchy
- Class Members

# IAEX::CellDocument Class Reference

Main widget for the cell workspace. More...

Inheritance diagram for IAEX::CellDocument:

List of all members.

## Public Slots
void | toggleMainTreeView ()
| Toggles the main workspace treeview.
void | setEditable (bool editable)
void | updateScrollArea ()
| Update the scrollarea so the correct area is displayed.
void | setChanged (bool changed)
| set the change variable
void | hoverOverUrl (const QUrl &link)
void | mouseClickedOnCell (Cell *clickedCell)
void | mouseClickedOnCellOutput (Cell *clickedCell)
| set focus on output part in inputcell
void | linkClicked (const QUrl *url)
| open a new document
virtual void | cursorMoveAfter (Cell *aCell, const bool open)
## Public Member Functions
| CellDocument (Application *a, const QString filenamem, int readmode=READMODE_NORMAL)
| Constructor, initialize a CellGroup as maincontent.
virtual | ~CellDocument ()
| The class destructor.
virtual void | open (const QString &filename, int readmode=READMODE_NORMAL)
| Open an file and parse the content.
virtual void | close ()
virtual void | cursorStepUp ()
virtual void | cursorStepDown ()
virtual void | cursorAddCell ()
virtual void | cursorUngroupCell ()
| Ungroup all selected groupcells.
virtual void | cursorSplitCell ()
| Split current cell.
virtual void | cursorDeleteCell ()
virtual void | cursorCutCell ()
virtual void | cursorCopyCell ()
virtual void | cursorPasteCell ()
virtual void | cursorChangeStyle (CellStyle style)
| Change the style of the selected cell/cells.
virtual void | textcursorCutText ()
| Cut text.
virtual void | textcursorCopyText ()
| Copy text.
virtual void | textcursorPasteText ()
| Paste text.
virtual void | textcursorChangeFontFamily (QString family)
| Change the font family on the selected text, if no text selected the current font family will be changed.
virtual void | textcursorChangeFontFace (int face)
| Change the font weight on the selected text, if no text selected the current font weight will be changed.
virtual void | textcursorChangeFontSize (int size)
| Change the font size on the selected text, if no text selected the current font size will be changed.
virtual void | textcursorChangeFontStretch (int stretch)
| Change the font stretch on the selected text, if no text selected the current font stretch will be changed.
virtual void | textcursorChangeFontColor (QColor color)
| Change the font color on the selected text, if no text selected the current font color will be changed.
virtual void | textcursorChangeTextAlignment (int alignment)
| Change the text alignment on the text inside the cell.
virtual void | textcursorChangeVerticalAlignment (int alignment)
| Change the vertical alignment on the selected text, if no text selected the current vertical alignment will be changed.
virtual void | textcursorChangeMargin (int margin)
| Change the margin of the cell.
virtual void | textcursorChangePadding (int padding)
| Change the padding of the cell.
virtual void | textcursorChangeBorder (int border)
| Change the border of the cell.
virtual void | textcursorInsertImage (QString filepath, QSize size)
| Insert a image into the selected cell.
virtual QString | addImage (QImage *image)
| Add image to the document.
virtual QImage * | getImage (QString name)
| Returns the image with the specified name.
virtual void | textcursorInsertLink (QString filepath)
| Insert a link to the selected text.
virtual bool | hasChanged () const
bool | isOpen () const
bool | isSaved () const
Factory * | cellFactory ()
void | executeCommand (Command *cmd)
void | runVisitor (Visitor &v)
| Runs a visitor on the cellstructure.
## Protected Member Functions
void | setWorkspace (Cell *newWorkspace)
| Attach a CellGroup to be the main workspace for cells.
bool | eventFilter (QObject *o, QEvent *e)

## Detailed Description

Main widget for the cell workspace.

Author:
  Ingemar Axelsson and Anders Fernström

This class represents the mainwidget for the application. It has functionality to open files and create cells from them. It also knows which cells that are selected.

CellDocument acts like a mediator between the application and all cells. It knows how to do stuff with cells.

The CellDocument does not have any menu. So to use menus for doing stuff with the application look at the slots that exists in this class.

For more information about how to use this widget in an application look at the documentation for every signal and slot in this class.

Todo:
  Implement an interface for applications. Also sort the includes in a better way. So developers does not have to include a lot of strange headerfiles. Just one headerfile should be enough.(Ingemar Axelsson)

Todo:
  Implement functionality for dragging cells around.(Ingemar Axelsson)

Todo:
  Make it possible to change celltype. From textcell to inputcell for example. Inputcell should only be a decorator of a textcell.(Ingemar Axelsson)

Bug:
  When opening a second file, some connections is missing.

Bug:
  Closing a document does not work correctly.

## Constructor & Destructor Documentation

IAEX::CellDocument::CellDocument | ( | Application * | a,
|  | const QString | filename,
|  | int | readmode = `READMODE_NORMAL`
| ) |

| Constructor, initialize a CellGroup as maincontent. Author: Ingemar Axelsson (and Anders Fernström) Date: 2005-11-28 (update) 2005-11-28 AF, added connection between 'cursorChanged()' and 'updateScrollArea()' Todo: Remove the dependency of QFrame from document.(Ingemar Axelsson)

IAEX::CellDocument::~CellDocument | ( |  | ) | `[virtual]`

| The class destructor. Author: Ingemar Axelsson

## Member Function Documentation

QString IAEX::CellDocument::addImage | ( | QImage * | image | ) | `[virtual]`

  | Add image to the document. Author: Anders Fernström Date: 2005-11-18 2006-02-13 (update) The function first check for an availible name for the image, then saves the image temporary to the harddirve and returns the name of the file. 2005-12-12 AF, Added 'file:///(path)/' to very image name 2006-02-13 AF, All images are added in the sub dir 'OMNotebook_tempfiles'. Parameters:
  | image | A pointer to the images that should be added
Returns: the filename of the saved image Implements IAEX::Document.

Factory * IAEX::CellDocument::cellFactory | ( |  | ) | `[virtual]`

| Todo: Check if factory is instantiated. (Ingemar Axelsson) Implements IAEX::Document.

void IAEX::CellDocument::close | ( |  | ) | `[virtual]`

| Hmmm check this later. Implements IAEX::Document.

void IAEX::CellDocument::cursorAddCell | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson and Anders Fernström Date: 2005-10-03 (update) 2005-10-03 AF, addad the try-catch expression Implements IAEX::Document.

void IAEX::CellDocument::cursorChangeStyle | ( | CellStyle | style | ) | `[virtual]`

| Change the style of the selected cell/cells. Author: Ingemar Axelsson and Anders Fernström Date: 2005-10-28 (update) Implements IAEX::Document.

void IAEX::CellDocument::cursorCopyCell | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorCutCell | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Bug: Notice that it does not work on selected cells. Implements IAEX::Document.

void IAEX::CellDocument::cursorDeleteCell | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorMoveAfter | ( | Cell * | aCell,
|  | const bool | open
| ) | `[virtual, slot]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorPasteCell | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorSplitCell | ( |  | ) | `[virtual]`

| Split current cell. Author: Anders Fernström Date: 2006-04-26 Implements IAEX::Document.

void IAEX::CellDocument::cursorStepDown | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorStepUp | ( |  | ) | `[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

void IAEX::CellDocument::cursorUngroupCell | ( |  | ) | `[virtual]`

| Ungroup all selected groupcells. Author: Anders Fernström Date: 2006-04-26 Implements IAEX::Document.

bool IAEX::CellDocument::eventFilter | ( | QObject * | o,
|  | QEvent * | e
| ) | `[protected]`

| Problem with the eventfilter. Should be listening to the mainwidget of the cell also. Not only to the workspace.

void IAEX::CellDocument::executeCommand | ( | Command * | cmd | ) | `[virtual]`

| Todo: Save all commands. Also implement undo. Where should the undo be set? Global in application or local in document? Or should different commands be stored in different places.(Ingemar Axelsson) Todo: implement a commandCenter interface that takes care of this. A problem with this conversion is the commands dependency for the document reference.(Ingemar Axelsson) Implements IAEX::Document.

QImage * IAEX::CellDocument::getImage | ( | QString | name | ) | `[virtual]`

  | Returns the image with the specified name. Author: Anders Fernström Date: 2005-11-20 2005-12-12 (update) 2005-12-12 AF, remove 'file:///' from name Parameters:
  | name | Name of the image
Returns: a pointer to the image Implements IAEX::Document.

bool IAEX::CellDocument::hasChanged | ( |  | ) | const`[virtual]`

| Author: Ingemar Axelsson and Anders Fernström Implements IAEX::Document.

void IAEX::CellDocument::hoverOverUrl | ( | const QUrl & | link | ) | `[virtual, slot]`

| Author: Anders Fernström Date: 2006-02-10 Implements IAEX::Document.

bool IAEX::CellDocument::isOpen | ( |  | ) | const`[virtual]`

| Author: Ingemar Axelsson Implements IAEX::Document.

bool IAEX::CellDocument::isSaved | ( |  | ) | const`[virtual]`

| Author: Anders Fernström Implements IAEX::Document.

void IAEX::CellDocument::linkClicked | ( | const QUrl * | link | ) | `[slot]`

| open a new document Author: Anders Fernström and Ingemar Axelsson Date: 2006-02-10 (update) 2005-12-05 AF, check if filename exists, otherwise use work dir 2006-02-10 AF, check if link path and fragment exists

void IAEX::CellDocument::mouseClickedOnCell | ( | Cell * | clickedCell | ) | `[slot]`

| Author: Ingemar Axelsson

void IAEX::CellDocument::mouseClickedOnCellOutput | ( | Cell * | clickedCell | ) | `[slot]`

| set focus on output part in inputcell Author: Anders Fernström Date: 2006-02-03

void IAEX::CellDocument::open | ( | const QString & | filename,
|  | int | readmode = `READMODE_NORMAL`
| ) | `[virtual]`

| Open an file and parse the content. Author: Ingemar Axelsson and Anders Fernström Date: 2005-12-01 (update) 2005-09-22 AF, Added open_ variable 2005-10-02 AF, Added saved_ variable 2005-12-01 AF, Added try-catch Implements IAEX::Document.

void IAEX::CellDocument::runVisitor | ( | Visitor & | v | ) | `[virtual]`

  | Runs a visitor on the cellstructure. Traverses the tree in preorder. For more usage information See also: visitor. Parameters:
  | v | Visitor to run on the treestructure.
Implements IAEX::Document.

void IAEX::CellDocument::setChanged | ( | bool | changed | ) | `[virtual, slot]`

| set the change variable Author: Anders Fernström Date: 2006-01-17 Implements IAEX::Document.

void IAEX::CellDocument::setEditable | ( | bool | editable | ) | `[slot]`

| Todo: Check if ever used. It does seem to be deprecated.(Ingemar Axelsson)

void IAEX::CellDocument::setWorkspace | ( | Cell * | newWorkspace | ) | `[protected]`

  | Attach a CellGroup to be the main workspace for cells. Author: Ingemar Axelsson and Anders Fernström Date: 2005-11-01 (update) Connects a cellgroup to the scrollview. Does some reparent stuff also so all subcells will be drawn. This must be done every time this member is changed. 2005-11-01 AF, replaced the old Q3ScrollView with the new QScrollArea and needed to change/update some thing in this function; Parameters:
  | newWorkspace | A pointer to the CellGroup that will be seen as the main cellworkspace in the application.
Todo: The old workspace must be deleted!(Ingemar Axelsson)

void IAEX::CellDocument::textcursorChangeBorder | ( | int | border | ) | `[virtual]`

  | Change the border of the cell. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | border | The new border
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeFontColor | ( | QColor | color | ) | `[virtual]`

  | Change the font color on the selected text, if no text selected the current font color will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | color | The new font color
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeFontFace | ( | int | face | ) | `[virtual]`

  | Change the font weight on the selected text, if no text selected the current font weight will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | weight | The new font weight
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeFontFamily | ( | QString | family | ) | `[virtual]`

  | Change the font family on the selected text, if no text selected the current font family will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | family | The new font family
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeFontSize | ( | int | size | ) | `[virtual]`

  | Change the font size on the selected text, if no text selected the current font size will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | size | The new font size
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeFontStretch | ( | int | stretch | ) | `[virtual]`

  | Change the font stretch on the selected text, if no text selected the current font stretch will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | stretch | The new font stretch
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeMargin | ( | int | margin | ) | `[virtual]`

  | Change the margin of the cell. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | margin | The new maring
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangePadding | ( | int | padding | ) | `[virtual]`

  | Change the padding of the cell. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | padding | The new padding
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeTextAlignment | ( | int | alignment | ) | `[virtual]`

  | Change the text alignment on the text inside the cell. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | alignment | The new text alignment
Implements IAEX::Document.

void IAEX::CellDocument::textcursorChangeVerticalAlignment | ( | int | alignment | ) | `[virtual]`

  | Change the vertical alignment on the selected text, if no text selected the current vertical alignment will be changed. Author: Anders Fernström Date: 2005-11-03 Parameters:
  | color | The new vertical alignment
Implements IAEX::Document.

void IAEX::CellDocument::textcursorCopyText | ( |  | ) | `[virtual]`

| Copy text. Author: Anders Fernström Date: 2006-02-07 Implements IAEX::Document.

void IAEX::CellDocument::textcursorCutText | ( |  | ) | `[virtual]`

| Cut text. Author: Anders Fernström Date: 2006-02-07 Implements IAEX::Document.

void IAEX::CellDocument::textcursorInsertImage | ( | QString | filepath,
|  | QSize | size
| ) | `[virtual]`

  | Insert a image into the selected cell. Author: Anders Fernström Date: 2005-11-18 Parameters:
  | filepath | The path to the image
Implements IAEX::Document.

void IAEX::CellDocument::textcursorInsertLink | ( | QString | filepath | ) | `[virtual]`

  | Insert a link to the selected text. Author: Anders Fernström Date: 2005-12-05 Parameters:
  | filepath | The linkpath to another docuement
Implements IAEX::Document.

void IAEX::CellDocument::textcursorPasteText | ( |  | ) | `[virtual]`

| Paste text. Author: Anders Fernström Date: 2006-02-07 Implements IAEX::Document.

void IAEX::CellDocument::toggleMainTreeView | ( |  | ) | `[slot]`

| Toggles the main workspace treeview. Shows or hides the outermost treeview. This is just used for testing. Should not be used by anyone else. Deprecated:

void IAEX::CellDocument::updateScrollArea | ( |  | ) | `[virtual, slot]`

| Update the scrollarea so the correct area is displayed. Author: Anders Fernström Date: 2005-11-29 2006-03-03 (update) 2005-12-08 AF, remade function becuase the earlier version hade some large bugs. Didn't calculate cells position correct, becuase qt:s layout system reset position to 0 in every groupcell and layout are probobly not set correctly. 2006-03-03 AF, ignore move if the cursor it at the end of the document Implements IAEX::Document.

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

- C:/OpenModelica/OMNotebookQT4 v2/OMNotebookQT4/celldocument.h
- C:/OpenModelica/OMNotebookQT4 v2/OMNotebookQT4/celldocument.cpp
- C:/OpenModelica/OMNotebookQT4 v2/OMNotebookQT4/moc_celldocument.cpp