FormulaCursor Class Reference
The selection. More...
#include <formulacursor.h>
Collaboration diagram for FormulaCursor:

Public Member Functions | |
FormulaCursor (FormulaElement *element) | |
FormulaCursor & | operator= (const FormulaCursor &) |
int | 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, bool smallCursor) |
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) |
BasicElement * | replaceByMainChildContent (Direction=beforeCursor) |
BasicElement * | removeEnclosingElement (Direction=beforeCursor) |
bool | elementIsSenseless () |
int | getSelectionStart () const |
int | getSelectionEnd () const |
void | setTo (BasicElement *element, int cursor, int mark=-1) |
void | setPos (int pos) |
void | setMark (int mark) |
BasicElement * | getElement () |
const BasicElement * | getElement () const |
void | normalize (Direction direction=beforeCursor) |
SequenceElement * | normal () |
const SequenceElement * | normal () const |
IndexElement * | getActiveIndexElement () |
RootElement * | getActiveRootElement () |
SymbolElement * | getActiveSymbolElement () |
NameSequence * | getActiveNameSequence () |
TextElement * | getActiveTextElement () |
MatrixElement * | getActiveMatrixElement () |
void | selectActiveElement () |
void | copy (QDomDocument &doc) |
bool | buildElementsFromDom (QDomElement root, QPtrList< BasicElement > &list) |
CursorData * | getCursorData () |
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... |
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.
Constructor & Destructor Documentation
|
Creates a cursor and puts is at the beginning of the formula.
Definition at line 37 of file formulacursor.cc. References SequenceElement::goInside(). |
Member Function Documentation
|
Tells whether the cursor has changed since last cleaning.
Definition at line 74 of file formulacursor.h. |
|
Resets the cursor's change flag. The widget calls this if it has drawn the cursor. Definition at line 80 of file formulacursor.h. |
|
Returns wether we are in selection mode.
Definition at line 85 of file formulacursor.h. Referenced by MultilineElement::moveDown(), SequenceElement::moveEnd(), SequenceElement::moveLeft(), SequenceElement::moveRight(), MultilineElement::moveRight(), and MultilineElement::moveUp(). |
|
Returns wether there actually is a selection.
Definition at line 90 of file formulacursor.h. Referenced by SequenceElement::buildCommand(), copy(), Container::cut(), SequenceElement::drawCursor(), getActiveIndexElement(), getActiveMatrixElement(), getActiveNameSequence(), getActiveRootElement(), getActiveSymbolElement(), SequenceElement::remove(), replaceSelectionWith(), and selectActiveElement(). |
|
Sets the selection mode.
Definition at line 95 of file formulacursor.h. Referenced by SequenceElement::buildCommand(), elementWillVanish(), formulaLoaded(), SequenceElement::goInside(), SequenceElement::normalize(), SequenceElement::remove(), replaceByMainChildContent(), selectActiveElement(), and setTo(). |
|
Calculates the size of the cursor. Needs to be called before the cursor can be drawn. Definition at line 72 of file formulacursor.cc. References SequenceElement::calcCursorSize(). |
|
Draws the cursor at its current position. The cursor will always be drawn in xor mode. Definition at line 82 of file formulacursor.cc. References SequenceElement::drawCursor(). Referenced by FormulaElement::draw(). |
|
Definition at line 183 of file formulacursor.cc. References getElement(). |
|
Definition at line 188 of file formulacursor.cc. References getElement(), and normal(). |
|
Sets the cursor in linear mode. This means you can visit every element just by moving left and right. Definition at line 134 of file formulacursor.h. |
|
Moves the cursor inside the element. Selection is turned off. Definition at line 273 of file formulacursor.cc. References BasicElement::goInside(). |
|
Inserts the child at the current position. Ignores the selection. Definition at line 296 of file formulacursor.cc. Referenced by replaceByMainChildContent(), and replaceSelectionWith(). |
|
Inserts the listed children at the current position. Ignores the selection. The list will be emptied. Definition at line 303 of file formulacursor.cc. References getElement(), BasicElement::insert(), and isReadOnly(). |
|
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 317 of file formulacursor.cc. References SequenceElement::countChildren(), BasicElement::getParent(), isReadOnly(), normal(), SequenceElement::remove(), BasicElement::remove(), and BasicElement::selectChild(). Referenced by replaceByMainChildContent(). |
|
Replaces the current selection with the supplied element. The replaced elements become the new element's main child's content. Definition at line 345 of file formulacursor.cc. References getElement(), SequenceElement::goInside(), insert(), isReadOnly(), and isSelection(). |
|
Replaces the element the cursor points to with its main child's content.
Definition at line 382 of file formulacursor.cc. References SequenceElement::countChildren(), getElement(), BasicElement::getMainChild(), BasicElement::getParent(), insert(), isReadOnly(), remove(), SequenceElement::selectAllChildren(), and setSelection(). Referenced by removeEnclosingElement(). |
|
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 411 of file formulacursor.cc. References getElement(), BasicElement::getMainChild(), isReadOnly(), replaceByMainChildContent(), and BasicElement::selectChild(). |
|
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 429 of file formulacursor.cc. References getElement(), and BasicElement::isSenseless(). |
|
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. References setSelection(). Referenced by SequenceElement::goInside(), SequenceElement::insert(), MultilineElement::moveDown(), SequenceElement::moveEnd(), SequenceElement::moveLeft(), SequenceElement::moveRight(), MultilineElement::moveUp(), NameSequence::moveWordLeft(), SequenceElement::moveWordLeft(), NameSequence::moveWordRight(), SequenceElement::moveWordRight(), SequenceElement::remove(), RootElement::remove(), FractionElement::remove(), RootElement::selectChild(), MultilineElement::selectChild(), MatrixElement::selectChild(), FractionElement::selectChild(), and SingleContentElement::selectChild(). |
|
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 231 of file formulacursor.h. Referenced by elementIsSenseless(), elementWillVanish(), getActiveIndexElement(), getActiveNameSequence(), getActiveRootElement(), getActiveSymbolElement(), insert(), isEnd(), isHome(), SequenceElement::moveEnd(), MultilineElement::normalize(), normalize(), removeEnclosingElement(), replaceByMainChildContent(), and replaceSelectionWith(). |
|
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 285 of file formulacursor.cc. References getElement(), and BasicElement::normalize(). |
|
Returns the sequence the cursor is in if we are normal. If not returns 0. Definition at line 718 of file formulacursor.cc. Referenced by SequenceElement::buildCommand(), buildElementsFromDom(), copy(), getActiveMatrixElement(), isEnd(), isReadOnly(), NameSequence::isValidSelection(), and remove(). |
|
Returns the IndexElement the cursor is on or 0 if there is non.
Definition at line 492 of file formulacursor.cc. References getElement(), and isSelection(). |
|
Returns the RootElement the cursor is on or 0 if there is non.
Definition at line 510 of file formulacursor.cc. References getElement(), and isSelection(). |
|
Returns the SymbolElement the cursor is on or 0 if there is non.
Definition at line 528 of file formulacursor.cc. References getElement(), and isSelection(). |
|
Definition at line 545 of file formulacursor.cc. References getElement(), and isSelection(). |
|
Definition at line 561 of file formulacursor.cc. Referenced by SequenceElement::buildCommand(). |
|
Definition at line 567 of file formulacursor.cc. References isSelection(), and normal(). |
|
Selects the element the cursor points to (stands after) if there is such an element and if there is no selection.
Definition at line 464 of file formulacursor.cc. References isSelection(), and setSelection(). Referenced by SequenceElement::buildCommand(). |
|
Stores the currently selected elements inside a dom.
Definition at line 638 of file formulacursor.cc. References BasicElement::formula(), SequenceElement::getChildrenDom(), isSelection(), and normal(). Referenced by Container::copy(). |
|
Inserts the elements that could be read from the dom into the list. Returns true on success. Definition at line 660 of file formulacursor.cc. References SequenceElement::buildChildrenFromDom(), isReadOnly(), and normal(). Referenced by Container::paste(). |
|
Creates a new CursorData object that describes the cursor. It's up to the caller to delete this object. Definition at line 678 of file formulacursor.cc. |
|
Sets the cursor to where the CursorData points to. No checking is done so you better make sure the point exists. Definition at line 703 of file formulacursor.cc. References FormulaCursor::CursorData::current, FormulaCursor::CursorData::cursorPos, FormulaCursor::CursorData::linearMovement, FormulaCursor::CursorData::markPos, FormulaCursor::CursorData::readOnly, and FormulaCursor::CursorData::selectionFlag. |
|
The element is going to leave the formula with and all its children.
Definition at line 586 of file formulacursor.cc. References BasicElement::childWillVanish(), getElement(), BasicElement::getParent(), and setSelection(). |
|
A new formula has been loaded. Our current element has to change. Definition at line 610 of file formulacursor.cc. References SequenceElement::goInside(), and setSelection(). |
|
Definition at line 349 of file formulacursor.h. Referenced by SequenceElement::drawCursor(). |
|
Definition at line 354 of file formulacursor.h. Referenced by SequenceElement::drawCursor(). |
|
Definition at line 620 of file formulacursor.cc. References normal(), and SequenceElement::readOnly(). Referenced by SequenceElement::buildCommand(), buildElementsFromDom(), insert(), remove(), removeEnclosingElement(), replaceByMainChildContent(), and replaceSelectionWith(). |
|
Puts the widget in read only mode.
Definition at line 365 of file formulacursor.h. |
The documentation for this class was generated from the following files: