lib

#include <kformulacontainer.h>

Inheritance diagram for Container:
FormulaDocument

Public Types

enum  ViewActions {
  EXIT_LEFT , EXIT_RIGHT , EXIT_ABOVE , EXIT_BELOW ,
  INSERT_FORMULA , REMOVE_FORMULA
}

Signals

void cursorMoved (FormulaCursor *cursor)
void leaveFormula (Container *formula, FormulaCursor *cursor, int cmd)
void formulaChanged (int width, int height)
void formulaChanged (double width, double height)
void statusMsg (const TQString &msg)
void errorMsg (const TQString &)
void elementWillVanish (BasicElement *element)
void formulaLoaded (FormulaElement *)
void baseSizeChanged (int)

Public Member Functions

 Container (Document *doc, int pos, bool registerMe=true)
void initialize ()
FormulaCursor * createCursor ()
void elementRemoval (BasicElement *child)
void changed ()
void cursorHasMoved (FormulaCursor *)
void moveOutLeft (FormulaCursor *)
void moveOutRight (FormulaCursor *)
void moveOutAbove (FormulaCursor *)
void moveOutBelow (FormulaCursor *)
void tell (const TQString &msg)
void removeFormula (FormulaCursor *)
void registerFormula (int pos=-1)
void unregisterFormula ()
void baseSizeChanged (int size, bool owned)
void draw (TQPainter &painter, const TQRect &r, const TQColorGroup &cg, bool edit=false)
void draw (TQPainter &painter, const TQRect &r, bool edit=false)
void save (TQDomElement &root)
void saveMathML (TQTextStream &stream, bool oasisFormat=false)
bool loadMathML (const TQDomDocument &doc, bool oasisFormat=false)
bool loadMathML (const TQDomElement &doc, bool oasisFormat=false)
bool load (const TQDomElement &fe)
TQString texString ()
TQString formulaString ()
void print (KPrinter &printer)
TQImage drawImage (int width, int height)
FormulaCursor * activeCursor ()
const FormulaCursor * activeCursor () const
void setActiveCursor (FormulaCursor *cursor)
TQRect boundingRect () const
TQRect coveredRect ()
double width () const
double height () const
double baseline () const
void moveTo (int x, int y)
virtual double getDocumentX () const
virtual double getDocumentY () const
virtual void setDocumentPosition (double, double)
virtual void startEvaluation ()
void testDirty ()
virtual void recalc ()
bool isEmpty ()
virtual Document * document () const
virtual const SymbolTable & getSymbolTable () const
int fontSize () const
void setFontSize (int pointSize, bool forPrint=false)
void setFontSizeDirect (int pointSize)
void updateMatrixActions ()
void input (TQKeyEvent *event)
void performRequest (Request *request)
void paste ()
void paste (const TQDomDocument &document, TQString desc)
void copy ()
void cut ()
Public Member Functions inherited from FormulaDocument
virtual void insertFormula (FormulaCursor *)

Protected Member Functions

KoCommandHistory * getHistory () const
FormulaElement * rootElement () const
virtual FormulaElement * createMainSequence ()
void emitErrorMsg (const TQString &)

Friends

class MimeSource
class TestFormulaCursor
class TestFormulaElement
class TestIndexElement
class TestCommands

Detailed Description

The document.

Actually only one part of the whole. Provides everything to edit the formula.

Definition at line 90 of file kformulacontainer.h.

Member Enumeration Documentation

◆ ViewActions

enum Container::ViewActions

Definition at line 101 of file kformulacontainer.h.

Constructor & Destructor Documentation

◆ Container()

Container::Container ( Document * doc,
int pos,
bool registerMe = true )

Constructs a new formula and register it with the document.

Parameters
docthe document we belong to.
posthe formulas position inside its document.
registerMewhether the formula is to be registered with the document.

Definition at line 110 of file kformulacontainer.cpp.

◆ ~Container()

Container::~Container ( )

Definition at line 119 of file kformulacontainer.cpp.

Member Function Documentation

◆ activeCursor() [1/2]

FormulaCursor * Container::activeCursor ( )
Returns
the cursor to be used for editing.

Definition at line 230 of file kformulacontainer.cpp.

◆ activeCursor() [2/2]

const FormulaCursor * Container::activeCursor ( ) const

Definition at line 235 of file kformulacontainer.cpp.

◆ baseline()

double Container::baseline ( ) const
Returns
the distance between the upper bound and the formulas base line.

Definition at line 446 of file kformulacontainer.cpp.

◆ baseSizeChanged() [1/2]

void Container::baseSizeChanged ( int size,
bool owned )
virtual

The base size changed.

If not owned it uses the default one now.

Reimplemented from FormulaDocument.

Definition at line 219 of file kformulacontainer.cpp.

◆ baseSizeChanged [2/2]

void Container::baseSizeChanged ( int )
signal

We've got a new base size.

◆ boundingRect()

TQRect Container::boundingRect ( ) const
Returns
the formula's size.

Definition at line 408 of file kformulacontainer.cpp.

◆ changed()

void Container::changed ( )
virtual

Gets called when ever something changes and we need to recalc.

Gets called whenever something changes and we need to recalc.

Reimplemented from FormulaDocument.

Definition at line 167 of file kformulacontainer.cpp.

◆ copy()

void Container::copy ( )

Copy the current selection to the clipboard.

Definition at line 370 of file kformulacontainer.cpp.

◆ coveredRect()

TQRect Container::coveredRect ( )
Returns
the formula's size including its active cursor.

Definition at line 417 of file kformulacontainer.cpp.

◆ createCursor()

FormulaCursor * Container::createCursor ( )

Returns a new cursor.

It points to the beginning of the formula. The cursor gets no messages if the formula changes so use this with care!

Definition at line 142 of file kformulacontainer.cpp.

◆ createMainSequence()

FormulaElement * Container::createMainSequence ( )
protectedvirtual

Factory method.

Definition at line 136 of file kformulacontainer.cpp.

◆ cursorHasMoved()

void Container::cursorHasMoved ( FormulaCursor * )
virtual

Gets called when a request has the side effect of moving the cursor.

In the end any operation that moves the cursor should call this.

Reimplemented from FormulaDocument.

Definition at line 172 of file kformulacontainer.cpp.

◆ cursorMoved

void Container::cursorMoved ( FormulaCursor * cursor)
signal

The cursor has been moved but the formula hasn't been changed.

The view that owns the cursor needs to know this.

◆ cut()

void Container::cut ( )

Copy and remove.

Definition at line 382 of file kformulacontainer.cpp.

◆ document()

Document * Container::document ( ) const
virtual
Returns
the document this formula belongs to.

Definition at line 108 of file kformulacontainer.cpp.

◆ draw() [1/2]

void Container::draw ( TQPainter & painter,
const TQRect & r,
bool edit = false )

Draws the whole thing.

Definition at line 302 of file kformulacontainer.cpp.

◆ draw() [2/2]

void Container::draw ( TQPainter & painter,
const TQRect & r,
const TQColorGroup & cg,
bool edit = false )

Draws the whole thing.

Definition at line 295 of file kformulacontainer.cpp.

◆ drawImage()

TQImage Container::drawImage ( int width,
int height )
Returns
an image that looks like out formula.

Definition at line 598 of file kformulacontainer.cpp.

◆ elementRemoval()

void Container::elementRemoval ( BasicElement * child)
virtual

Gets called just before the child is removed from the element tree.

Reimplemented from FormulaDocument.

Definition at line 158 of file kformulacontainer.cpp.

◆ elementWillVanish

void Container::elementWillVanish ( BasicElement * element)
signal

The element is going to leave the formula with and all its children.

◆ emitErrorMsg()

void Container::emitErrorMsg ( const TQString & msg)
protected

Definition at line 395 of file kformulacontainer.cpp.

◆ errorMsg

void Container::errorMsg ( const TQString & )
signal

A message that describes an error.

Meant for a message box. (?)

◆ fontSize()

int Container::fontSize ( ) const

Definition at line 460 of file kformulacontainer.cpp.

◆ formulaChanged

void Container::formulaChanged ( int width,
int height )
signal

The formula has changed and needs to be redrawn.

◆ formulaLoaded

void Container::formulaLoaded ( FormulaElement * )
signal

Tells the cursors that we have just loaded a new formula.

◆ formulaString()

TQString Container::formulaString ( )

Definition at line 635 of file kformulacontainer.cpp.

◆ getDocumentX()

virtual double Container::getDocumentX ( ) const
inlinevirtual

KWord uses a transformed painter to draw formulas, so every formula has the internal position (0,0).

But we might need to sort our formulas according to their position inside the document. (This is only needed for math formulas.)

Definition at line 271 of file kformulacontainer.h.

◆ getDocumentY()

virtual double Container::getDocumentY ( ) const
inlinevirtual

Definition at line 272 of file kformulacontainer.h.

◆ getHistory()

KoCommandHistory * Container::getHistory ( ) const
protected

Definition at line 148 of file kformulacontainer.cpp.

◆ getSymbolTable()

const SymbolTable & Container::getSymbolTable ( ) const
virtual

Implements FormulaDocument.

Definition at line 289 of file kformulacontainer.cpp.

◆ height()

double Container::height ( ) const

Definition at line 440 of file kformulacontainer.cpp.

◆ initialize()

void Container::initialize ( )

Needs to be called before anything else can be done with a newly created formula!

This is required to allow polymorphic formulas. (The virtual method problem.)

Definition at line 127 of file kformulacontainer.cpp.

◆ input()

void Container::input ( TQKeyEvent * event)

General input.

Definition at line 318 of file kformulacontainer.cpp.

◆ isEmpty()

bool Container::isEmpty ( )
Returns
true if there is no element.

Definition at line 283 of file kformulacontainer.cpp.

◆ leaveFormula

void Container::leaveFormula ( Container * formula,
FormulaCursor * cursor,
int cmd )
signal

The cursor wants to leave this formula.

◆ load()

bool Container::load ( const TQDomElement & fe)

Loads a formula from the document.

Definition at line 503 of file kformulacontainer.cpp.

◆ loadMathML() [1/2]

bool Container::loadMathML ( const TQDomDocument & doc,
bool oasisFormat = false )

Load function.

Load the formula from the specified file containing MathML .

Definition at line 537 of file kformulacontainer.cpp.

◆ loadMathML() [2/2]

bool Container::loadMathML ( const TQDomElement & doc,
bool oasisFormat = false )

Load function.

Load the formula from the specified file containing MathML .

Definition at line 560 of file kformulacontainer.cpp.

◆ moveOutAbove()

void Container::moveOutAbove ( FormulaCursor * cursor)
virtual

Reimplemented from FormulaDocument.

Definition at line 187 of file kformulacontainer.cpp.

◆ moveOutBelow()

void Container::moveOutBelow ( FormulaCursor * cursor)
virtual

Reimplemented from FormulaDocument.

Definition at line 192 of file kformulacontainer.cpp.

◆ moveOutLeft()

void Container::moveOutLeft ( FormulaCursor * cursor)
virtual

Inside the formula occurred an event that must be handled outside.

Reimplemented from FormulaDocument.

Definition at line 177 of file kformulacontainer.cpp.

◆ moveOutRight()

void Container::moveOutRight ( FormulaCursor * cursor)
virtual

Reimplemented from FormulaDocument.

Definition at line 182 of file kformulacontainer.cpp.

◆ moveTo()

void Container::moveTo ( int x,
int y )

Moves the formula to a new location.

This location will be the upper left corner of the rectangle that is drawn by the painter.

Definition at line 453 of file kformulacontainer.cpp.

◆ paste() [1/2]

void Container::paste ( )

Insert data from the clipboard.

Definition at line 338 of file kformulacontainer.cpp.

◆ paste() [2/2]

void Container::paste ( const TQDomDocument & document,
TQString desc )

Insert data from the document.

Definition at line 352 of file kformulacontainer.cpp.

◆ performRequest()

void Container::performRequest ( Request * request)

Definition at line 329 of file kformulacontainer.cpp.

◆ print()

void Container::print ( KPrinter & printer)

Prints the formula.

Definition at line 585 of file kformulacontainer.cpp.

◆ recalc()

void Container::recalc ( )
virtual

Recalc the formula.

Definition at line 270 of file kformulacontainer.cpp.

◆ registerFormula()

void Container::registerFormula ( int pos = -1)

Register and unregister this formula with its document.

Definition at line 208 of file kformulacontainer.cpp.

◆ removeFormula()

void Container::removeFormula ( FormulaCursor * cursor)
virtual

Reimplemented from FormulaDocument.

Definition at line 202 of file kformulacontainer.cpp.

◆ rootElement()

FormulaElement * Container::rootElement ( ) const
protected
Returns
the root of our element tree. That's the formula's structure.

Definition at line 107 of file kformulacontainer.cpp.

◆ save()

void Container::save ( TQDomElement & root)

Saves the data into the document.

Definition at line 493 of file kformulacontainer.cpp.

◆ saveMathML()

void Container::saveMathML ( TQTextStream & stream,
bool oasisFormat = false )

Save formula as MathML.

Definition at line 527 of file kformulacontainer.cpp.

◆ setActiveCursor()

void Container::setActiveCursor ( FormulaCursor * cursor)

Sets the cursor that is to be used for any editing.

Tells the formula that a view got the focus and might want to edit the formula.

The active cursor might 0. In this case you must not request any change from the formula.

Definition at line 245 of file kformulacontainer.cpp.

◆ setDocumentPosition()

virtual void Container::setDocumentPosition ( double ,
double  )
inlinevirtual

Definition at line 273 of file kformulacontainer.h.

◆ setFontSize()

void Container::setFontSize ( int pointSize,
bool forPrint = false )

Sets the base font size of this formula.

Definition at line 471 of file kformulacontainer.cpp.

◆ setFontSizeDirect()

void Container::setFontSizeDirect ( int pointSize)

Definition at line 478 of file kformulacontainer.cpp.

◆ startEvaluation()

virtual void Container::startEvaluation ( )
inlinevirtual

Start the documents evaluation at this formula.

This must be the formula that changed. The formulas above it won't be affected by this change.

This has no meaning in not evaluating formulas.

Definition at line 282 of file kformulacontainer.h.

◆ statusMsg

void Container::statusMsg ( const TQString & msg)
signal

A message that might be a useful hint.

Meant for the statusbar.

◆ tell()

void Container::tell ( const TQString & msg)
virtual

Reimplemented from FormulaDocument.

Definition at line 197 of file kformulacontainer.cpp.

◆ testDirty()

void Container::testDirty ( )

Recalcs the formula and emits the .

*Changed signals if needed.

Definition at line 263 of file kformulacontainer.cpp.

◆ texString()

TQString Container::texString ( )
Returns
Tex string for the formula

Definition at line 630 of file kformulacontainer.cpp.

◆ unregisterFormula()

void Container::unregisterFormula ( )

Definition at line 213 of file kformulacontainer.cpp.

◆ updateMatrixActions()

void Container::updateMatrixActions ( )

If the cursor is in a matrix, the matrix actions will be enabled, otherwise disabled.

Definition at line 484 of file kformulacontainer.cpp.

◆ width()

double Container::width ( ) const

Definition at line 434 of file kformulacontainer.cpp.

◆ MimeSource

friend class MimeSource
friend

Definition at line 91 of file kformulacontainer.h.

◆ TestCommands

friend class TestCommands
friend

Definition at line 435 of file kformulacontainer.h.

◆ TestFormulaCursor

friend class TestFormulaCursor
friend

Definition at line 432 of file kformulacontainer.h.

◆ TestFormulaElement

friend class TestFormulaElement
friend

Definition at line 433 of file kformulacontainer.h.

◆ TestIndexElement

friend class TestIndexElement
friend

Definition at line 434 of file kformulacontainer.h.


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