lib

FormulaCursor Class Reference

#include <formulacursor.h>

List of all members.


Detailed Description

The selection.

This might be a position selection or an area. Each view will need one FormulaCursor.

The Container always uses the cursor to operate on the element tree.

Note that it is up to the elements to actually move the cursor. (The cursor has no chance to know how.)

Definition at line 50 of file formulacursor.h.


Public Member Functions

 FormulaCursor (FormulaElement *element)
FormulaCursoroperator= (const FormulaCursor &)
uint getPos () const
int getMark () const
bool hasChanged () const
void clearChangedFlag ()
bool isSelectionMode () const
bool isSelection () const
void setSelection (bool selection)
void calcCursorSize (const ContextStyle &context, bool smallCursor)
void draw (QPainter &, const ContextStyle &context, StyleAttributes &style, bool smallCursor, bool activeCursor)
void moveLeft (int flag=NormalMovement)
void moveRight (int flag=NormalMovement)
void moveUp (int flag=NormalMovement)
void moveDown (int flag=NormalMovement)
void moveHome (int flag=NormalMovement)
void moveEnd (int flag=NormalMovement)
bool isHome () const
bool isEnd () const
bool getLinearMovement () const
void setLinearMovement (bool linear)
void goInsideElement (BasicElement *element)
void mousePress (const LuPixelPoint &, int flags)
void mouseMove (const LuPixelPoint &, int flags)
void mouseRelease (const LuPixelPoint &, int flags)
void insert (BasicElement *, Direction=beforeCursor)
void insert (QPtrList< BasicElement > &, Direction=beforeCursor)
void remove (QPtrList< BasicElement > &, Direction=beforeCursor)
void replaceSelectionWith (BasicElement *, Direction=beforeCursor)
BasicElementreplaceByMainChildContent (Direction=beforeCursor)
BasicElementremoveEnclosingElement (Direction=beforeCursor)
bool elementIsSenseless ()
int getSelectionStart () const
int getSelectionEnd () const
void setTo (BasicElement *element, uint cursor, int mark=-1)
void setPos (uint pos)
void setMark (int mark)
BasicElementgetElement ()
const BasicElementgetElement () const
void normalize (Direction direction=beforeCursor)
SequenceElementnormal ()
const SequenceElementnormal () const
IndexElementgetActiveIndexElement ()
RootElementgetActiveRootElement ()
SymbolElementgetActiveSymbolElement ()
NameSequencegetActiveNameSequence ()
TextElementgetActiveTextElement ()
MatrixElementgetActiveMatrixElement ()
void selectActiveElement ()
void copy (QDomDocument &doc)
bool buildElementsFromDom (QDomElement root, QPtrList< BasicElement > &list)
bool buildElementsFromMathMLDom (QDomElement root, QPtrList< BasicElement > &list)
CursorDatagetCursorData ()
void setCursorData (CursorData *data)
void elementWillVanish (BasicElement *element)
void formulaLoaded (FormulaElement *rootElement)
const LuPixelPoint & getCursorPoint () const
const LuPixelRect & getCursorSize () const
void addCursorSize (const LuPixelRect &rect)
bool isReadOnly () const
void setReadOnly (bool ro)

Friends

class SequenceElement

Classes

class  CursorData
 A black box that is supposed to contain everything which is needed to describe a cursor. More...

Constructor & Destructor Documentation

KFORMULA_NAMESPACE_BEGIN FormulaCursor::FormulaCursor ( FormulaElement element  ) 

Creates a cursor and puts is at the beginning of the formula.

Parameters:
element the formula the cursor point to. This must not be 0.

Definition at line 37 of file formulacursor.cc.


Member Function Documentation

bool FormulaCursor::hasChanged (  )  const [inline]

Tells whether the cursor has changed since last cleaning.

Definition at line 74 of file formulacursor.h.

void FormulaCursor::clearChangedFlag (  )  [inline]

Resets the cursor's change flag.

The widget calls this if it has drawn the cursor.

Definition at line 80 of file formulacursor.h.

bool FormulaCursor::isSelectionMode (  )  const [inline]

Returns wether we are in selection mode.

Definition at line 85 of file formulacursor.h.

bool FormulaCursor::isSelection (  )  const [inline]

Returns wether there actually is a selection.

Definition at line 90 of file formulacursor.h.

void FormulaCursor::setSelection ( bool  selection  )  [inline]

Sets the selection mode.

Definition at line 95 of file formulacursor.h.

void FormulaCursor::calcCursorSize ( const ContextStyle context,
bool  smallCursor 
)

Calculates the size of the cursor.

Needs to be called before the cursor can be drawn.

Definition at line 72 of file formulacursor.cc.

void FormulaCursor::draw ( QPainter &  painter,
const ContextStyle context,
StyleAttributes &  style,
bool  smallCursor,
bool  activeCursor 
)

Draws the cursor at its current position.

The cursor will always be drawn in xor mode.

Definition at line 82 of file formulacursor.cc.

bool FormulaCursor::isHome (  )  const

Returns:
whether the cursor is at the first position.

Definition at line 184 of file formulacursor.cc.

bool FormulaCursor::isEnd (  )  const

Returns:
whether the cursor is at the last position.

Definition at line 189 of file formulacursor.cc.

void FormulaCursor::setLinearMovement ( bool  linear  )  [inline]

Sets the cursor in linear mode.

This means you can visit every element just by moving left and right.

Definition at line 135 of file formulacursor.h.

void FormulaCursor::goInsideElement ( BasicElement element  ) 

Moves the cursor inside the element.

Selection is turned off.

Definition at line 274 of file formulacursor.cc.

void FormulaCursor::insert ( BasicElement child,
Direction  direction = beforeCursor 
)

Inserts the child at the current position.

Ignores the selection.

Definition at line 297 of file formulacursor.cc.

void FormulaCursor::insert ( QPtrList< BasicElement > &  children,
Direction  direction = beforeCursor 
)

Inserts the listed children at the current position.

Ignores the selection. The list will be emptied.

Definition at line 304 of file formulacursor.cc.

void FormulaCursor::remove ( QPtrList< BasicElement > &  children,
Direction  direction = beforeCursor 
)

Removes the current selected children and returns them.

The cursor needs to be normal (that is be inside a SequenceElement) for this to have any effect.

Definition at line 318 of file formulacursor.cc.

void FormulaCursor::replaceSelectionWith ( BasicElement element,
Direction  direction = beforeCursor 
)

Replaces the current selection with the supplied element.

The replaced elements become the new element's main child's content.

Definition at line 346 of file formulacursor.cc.

BasicElement * FormulaCursor::replaceByMainChildContent ( Direction  direction = beforeCursor  ) 

Replaces the element the cursor points to with its main child's content.

Definition at line 383 of file formulacursor.cc.

BasicElement * FormulaCursor::removeEnclosingElement ( Direction  direction = beforeCursor  ) 

Trys to find the element we are the main child of and replace it with our content.

This is simply another form of replaceByMainChildContent. You use this one if the cursor is normalized and inside the main child.

Definition at line 412 of file formulacursor.cc.

bool FormulaCursor::elementIsSenseless (  ) 

Returns wether the element the cursor points to should be replaced.

Elements are senseless as soon as they only contain a main child.

Definition at line 430 of file formulacursor.cc.

void FormulaCursor::setTo ( BasicElement element,
uint  cursor,
int  mark = -1 
)

Sets the cursor to a new position.

This gets called from the element that wants to own the cursor. It is a mistake to call this if you aren't an element.

If you provide a mark >= 0 the selection gets turned on. If there is a selection and you don't provide a mark the current mark won't change.

Definition at line 45 of file formulacursor.cc.

BasicElement* FormulaCursor::getElement (  )  [inline]

The element we are in.

In most cases this is a SequenceElement. There is no way to place a cursor outside a SequenceElement by normal movement. But in special cases (e.g. if you remove an index from an IndexElement) the cursor can be placed to odd places. This is the reason why you have to normalize the cursor after each removal.

Definition at line 232 of file formulacursor.h.

void FormulaCursor::normalize ( Direction  direction = beforeCursor  ) 

Moves the cursor to a normal position.

That is somewhere inside a SequenceElement. You need to call this after each removal because the cursor might point to some non existing place.

Definition at line 286 of file formulacursor.cc.

SequenceElement * FormulaCursor::normal (  ) 

Returns the sequence the cursor is in if we are normal.

If not returns 0.

Definition at line 736 of file formulacursor.cc.

IndexElement * FormulaCursor::getActiveIndexElement (  ) 

Returns the IndexElement the cursor is on or 0 if there is non.

Definition at line 493 of file formulacursor.cc.

RootElement * FormulaCursor::getActiveRootElement (  ) 

Returns the RootElement the cursor is on or 0 if there is non.

Definition at line 511 of file formulacursor.cc.

SymbolElement * FormulaCursor::getActiveSymbolElement (  ) 

Returns the SymbolElement the cursor is on or 0 if there is non.

Returns:
the SymbolElement the cursor is on or 0 if there is non.

Definition at line 529 of file formulacursor.cc.

NameSequence * FormulaCursor::getActiveNameSequence (  ) 

Returns:
the NameSequence the cursor is on or 0 if there is non.

Definition at line 546 of file formulacursor.cc.

TextElement * FormulaCursor::getActiveTextElement (  ) 

Returns:
the TextElement the cursor is on or 0.

Definition at line 562 of file formulacursor.cc.

MatrixElement * FormulaCursor::getActiveMatrixElement (  ) 

Returns:
the MatrixElement the cursor is on or 0.

Definition at line 568 of file formulacursor.cc.

void FormulaCursor::selectActiveElement (  ) 

Selects the element the cursor points to (stands after) if there is such an element and if there is no selection.

Definition at line 465 of file formulacursor.cc.

void FormulaCursor::copy ( QDomDocument &  doc  ) 

Stores the currently selected elements inside a dom.

Definition at line 639 of file formulacursor.cc.

bool FormulaCursor::buildElementsFromDom ( QDomElement  root,
QPtrList< BasicElement > &  list 
)

Inserts the elements that could be read from the dom into the list.

Returns true on success.

Definition at line 662 of file formulacursor.cc.

bool FormulaCursor::buildElementsFromMathMLDom ( QDomElement  root,
QPtrList< BasicElement > &  list 
)

Inserts the elements that could be read from the MathML dom into the list.

Returns true on success.

Definition at line 679 of file formulacursor.cc.

FormulaCursor::CursorData * FormulaCursor::getCursorData (  ) 

Creates a new CursorData object that describes the cursor.

It's up to the caller to delete this object.

Definition at line 696 of file formulacursor.cc.

void FormulaCursor::setCursorData ( FormulaCursor::CursorData data  ) 

Sets the cursor to where the CursorData points to.

No checking is done so you better make sure the point exists.

Definition at line 721 of file formulacursor.cc.

void FormulaCursor::elementWillVanish ( BasicElement element  ) 

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

Definition at line 587 of file formulacursor.cc.

void FormulaCursor::formulaLoaded ( FormulaElement rootElement  ) 

A new formula has been loaded.

Our current element has to change.

Definition at line 611 of file formulacursor.cc.

const LuPixelPoint& FormulaCursor::getCursorPoint (  )  const [inline]

Returns:
the point inside the formula widget where the cursor is.

Definition at line 356 of file formulacursor.h.

const LuPixelRect& FormulaCursor::getCursorSize (  )  const [inline]

Returns:
the area the cursor is currently on.

Definition at line 361 of file formulacursor.h.

bool FormulaCursor::isReadOnly (  )  const

Returns:
whether we are allowed to alter the document.

Definition at line 621 of file formulacursor.cc.

void FormulaCursor::setReadOnly ( bool  ro  )  [inline]

Puts the widget in read only mode.

Definition at line 372 of file formulacursor.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys