LibreOffice Module starmath (master) 1
|
#include <cursor.hxx>
Public Member Functions | |
SmCursor (SmNode *tree, SmDocShell *pShell) | |
const SmCaretPos & | GetPosition () const |
Get position. More... | |
bool | HasSelection () const |
True, if the cursor has a selection. More... | |
void | Move (OutputDevice *pDev, SmMovementDirection direction, bool bMoveAnchor=true) |
Move the position of this cursor. More... | |
void | MoveTo (OutputDevice *pDev, const Point &pos, bool bMoveAnchor) |
Move to the caret position closest to a given point. More... | |
void | Delete () |
Delete the current selection or do nothing. More... | |
void | DeletePrev (OutputDevice *pDev) |
Delete selection, previous element or merge lines. More... | |
void | InsertText (const OUString &aString) |
Insert text at the current position. More... | |
void | InsertElement (SmFormulaElement element) |
Insert an element into the formula. More... | |
void | InsertCommandText (const OUString &aCommandText) |
Insert command text translated into line entries at position. More... | |
void | InsertSpecial (std::u16string_view aString) |
Insert a special node created from aString. More... | |
void | InsertSubSup (SmSubSup eSubSup) |
Create sub-/super script. More... | |
bool | InsertRow () |
Insert a new row or newline. More... | |
void | InsertFraction () |
Insert a fraction, use selection as numerator. More... | |
void | InsertBrackets (SmBracketType eBracketType) |
Create brackets around current selection, or new SmPlaceNode. More... | |
void | Copy () |
Copy the current selection. More... | |
void | Cut () |
Cut the current selection. More... | |
void | Paste () |
Paste the clipboard. More... | |
bool | HasComplexSelection () |
Returns true if more than one node is selected. More... | |
void | Draw (OutputDevice &pDev, Point Offset, bool isCaretVisible) |
Draw the caret. More... | |
tools::Rectangle | GetCaretRectangle (OutputDevice &rOutDev) const |
tools::Rectangle | GetSelectionRectangle (OutputDevice &rOutDev) const |
bool | IsAtTailOfBracket (SmBracketType eBracketType) const |
Static Public Member Functions | |
static SmNode * | FindTopMostNodeInLine (SmNode *pSNode, bool MoveUpIfSelected=false) |
Finds the topmost node in a visual line. More... | |
Private Member Functions | |
SmNode * | FindSelectedNode (SmNode *pNode) |
Returns a node that is selected, if any could be found. More... | |
int | CountSelectedNodes (SmNode *pNode) |
Count number of selected nodes, excluding line composition nodes. More... | |
void | BuildGraph () |
Build pGraph over caret positions. More... | |
void | InsertNodes (std::unique_ptr< SmNodeList > pNewNodes) |
Insert new nodes in the tree after position. More... | |
bool | SetCaretPosition (SmCaretPos pos) |
tries to set position to a specific SmCaretPos More... | |
void | AnnotateSelection () const |
Set selected on nodes of the tree. More... | |
void | BeginEdit () |
Begin edit section where the tree will be modified. More... | |
void | EndEdit () |
End edit section where the tree will be modified. More... | |
void | FinishEdit (std::unique_ptr< SmNodeList > pLineList, SmStructureNode *pParent, int nParentIndex, SmCaretPos PosAfterEdit, SmNode *pStartLine=nullptr) |
Finish editing. More... | |
void | RequestRepaint () |
Request the formula is repainted. More... | |
Static Private Member Functions | |
static bool | IsLineCompositionNode (SmNode const *pNode) |
Is this one of the nodes used to compose a line. More... | |
static void | LineToList (SmStructureNode *pLine, SmNodeList &rList) |
Convert a visual line to a list. More... | |
static void | NodeToList (SmNode *&rpNode, SmNodeList &rList) |
Auxiliary function for calling LineToList on a node. More... | |
static void | CloneLineToClipboard (SmStructureNode *pLine, SmClipboard *pClipboard) |
Clone a visual line to a clipboard. More... | |
static std::unique_ptr< SmNodeList > | CloneList (SmClipboard &rClipboard) |
Clone list of nodes in a clipboard (creates a deep clone) More... | |
static SmNodeList::iterator | FindPositionInLineList (SmNodeList *pLineList, const SmCaretPos &rCaretPos) |
Find an iterator pointing to the node in pLineList following rCaretPos. More... | |
static SmCaretPos | PatchLineList (SmNodeList *pLineList, SmNodeList::iterator aIter) |
Patch a line list after modification, merge SmTextNode, remove SmPlaceNode etc. More... | |
static SmNodeList::iterator | TakeSelectedNodesFromList (SmNodeList *pLineList, SmNodeList *pSelectedNodes=nullptr) |
Take selected nodes from a list. More... | |
static SmNode * | CreateBracket (SmBracketType eBracketType, bool bIsLeft) |
Create an instance of SmMathSymbolNode usable for brackets. More... | |
Private Attributes | |
SmCaretPosGraphEntry * | mpAnchor |
SmCaretPosGraphEntry * | mpPosition |
SmNode * | mpTree |
Formula tree. More... | |
SmDocShell * | mpDocShell |
Owner of the formula tree. More... | |
std::unique_ptr< SmCaretPosGraph > | mpGraph |
Graph over caret position in the current tree. More... | |
SmClipboard | maClipboard |
Clipboard holder. More... | |
int | mnEditSections |
The number of times BeginEdit have been called Used to allow nesting of BeginEdit() and EndEdit() sections. More... | |
bool | mbIsEnabledSetModifiedSmDocShell |
Holds data for BeginEdit() and EndEdit() More... | |
Friends | |
class | SmDocShell |
Formula cursor.
This class is used to represent a cursor in a formula, which can be used to manipulate a formula programmatically.
Definition at line 68 of file cursor.hxx.
|
inline |
Definition at line 71 of file cursor.hxx.
References BuildGraph().
|
private |
Set selected on nodes of the tree.
Definition at line 168 of file cursor.cxx.
References SmCaretPosGraphEntry::CaretPos, mpAnchor, mpPosition, and mpTree.
Referenced by Copy(), Delete(), DeletePrev(), FinishEdit(), GetSelectionRectangle(), HasComplexSelection(), InsertBrackets(), InsertFraction(), InsertRow(), and InsertSubSup().
|
private |
Begin edit section where the tree will be modified.
Definition at line 1293 of file cursor.cxx.
References SfxObjectShell::EnableSetModified(), SfxObjectShell::IsEnableSetModified(), mbIsEnabledSetModifiedSmDocShell, mnEditSections, and mpDocShell.
Referenced by Delete(), DeletePrev(), InsertBrackets(), InsertCommandText(), InsertElement(), InsertFraction(), InsertNodes(), InsertRow(), InsertSpecial(), InsertSubSup(), InsertText(), and Paste().
|
private |
Build pGraph over caret positions.
Definition at line 113 of file cursor.cxx.
References SmCaretPosGraphEntry::CaretPos, SmCaretPos::IsValid(), mpAnchor, mpGraph, mpPosition, and mpTree.
Referenced by DeletePrev(), FinishEdit(), and SmCursor().
|
staticprivate |
Clone a visual line to a clipboard.
... but the selected part only. Doesn't clone SmErrorNodes, which are ignored as they are context dependent metadata.
Definition at line 1169 of file cursor.cxx.
References SmCloningVisitor::Clone(), CloneLineToClipboard(), Error, SmTextNode::GetFontDesc(), SmNode::GetScaleMode(), SmTextNode::GetSelectionEnd(), SmTextNode::GetSelectionStart(), SmTextNode::GetText(), IsLineCompositionNode(), length, start, and Text.
Referenced by CloneLineToClipboard(), and Copy().
|
staticprivate |
Clone list of nodes in a clipboard (creates a deep clone)
Definition at line 1097 of file cursor.cxx.
References SmCloningVisitor::Clone().
Referenced by Paste().
void SmCursor::Copy | ( | ) |
Copy the current selection.
Definition at line 1050 of file cursor.cxx.
References AnnotateSelection(), SmCloningVisitor::Clone(), CloneLineToClipboard(), FindSelectedNode(), FindTopMostNodeInLine(), SmTextNode::GetFontDesc(), SmNode::GetScaleMode(), SmTextNode::GetSelectionEnd(), SmTextNode::GetSelectionStart(), SmTextNode::GetText(), SmNode::GetToken(), SmNode::GetType(), HasSelection(), IsLineCompositionNode(), length, maClipboard, mpTree, start, and Text.
Referenced by Cut(), and SmGraphicWidget::KeyInput().
Count number of selected nodes, excluding line composition nodes.
Note this function doesn't count line composition nodes and it does count all subnodes as well as the owner nodes.
Used by SmCursor::HasComplexSelection()
Definition at line 1207 of file cursor.cxx.
References CountSelectedNodes(), SmNode::GetNumSubNodes(), IsLineCompositionNode(), and nCount.
Referenced by CountSelectedNodes(), and HasComplexSelection().
|
staticprivate |
Create an instance of SmMathSymbolNode usable for brackets.
Definition at line 665 of file cursor.cxx.
References Curly, Height, LBrace, MS_LBRACE, MS_LBRACKET, MS_LPARENT, MS_RBRACE, MS_RBRACKET, MS_RPARENT, RBrace, Round, SmNode::SetScaleMode(), Square, TLBRACE, TLBRACKET, TLPARENT, TRBRACE, TRBRACKET, and TRPARENT.
Referenced by FinishEdit(), and InsertBrackets().
|
inline |
Cut the current selection.
Definition at line 163 of file cursor.hxx.
References Copy(), and Delete().
Referenced by SmGraphicWidget::KeyInput().
void SmCursor::Delete | ( | ) |
Delete the current selection or do nothing.
Definition at line 266 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), FindSelectedNode(), FindTopMostNodeInLine(), FinishEdit(), SmNode::GetParent(), HasSelection(), SmStructureNode::IndexOfSubNode(), mpTree, NodeToList(), PatchLineList(), and TakeSelectedNodesFromList().
Referenced by Cut(), DeletePrev(), InsertCommandText(), InsertElement(), InsertSpecial(), InsertText(), SmGraphicWidget::KeyInput(), and Paste().
void SmCursor::DeletePrev | ( | OutputDevice * | pDev | ) |
Delete selection, previous element or merge lines.
This method implements the behaviour of backspace.
Definition at line 188 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), BuildGraph(), SmCaretPosGraphEntry::CaretPos, Delete(), EndEdit(), FindTopMostNodeInLine(), SmStructureNode::GetNumSubNodes(), SmNode::GetParent(), SmStructureNode::GetSubNode(), SmNode::GetType(), HasComplexSelection(), HasSelection(), i, SmStructureNode::IndexOfSubNode(), Move(), MoveLeft, mpAnchor, mpPosition, SmCaretPos::nIndex, NodeToList(), SmNodeListParser::Parse(), PatchLineList(), SmCaretPos::pSelectedNode, SetCaretPosition(), SmStructureNode::SetSubNode(), SmStructureNode::SetSubNodes(), and Table.
Referenced by SmGraphicWidget::KeyInput().
void SmCursor::Draw | ( | OutputDevice & | pDev, |
Point | Offset, | ||
bool | isCaretVisible | ||
) |
Draw the caret.
Definition at line 173 of file cursor.cxx.
References GetPosition(), and Offset.
Referenced by SmGraphicWidget::Paint().
|
private |
End edit section where the tree will be modified.
Definition at line 1301 of file cursor.cxx.
References EE_PARA_ALL, EE_TEXTPOS_ALL, SfxObjectShell::EnableSetModified(), SfxObjectShell::GetCreateMode(), SmDocShell::GetEditEngine(), SmDocShell::maText, mbIsEnabledSetModifiedSmDocShell, mnEditSections, SmDocShell::mnModifyCount, mpDocShell, mpTree, SmDocShell::OnDocumentPrinterChanged(), EditEngine::QuickFormatDoc(), EditEngine::QuickInsertText(), RequestRepaint(), SmDocShell::SetFormulaArranged(), and SmDocShell::SetModified().
Referenced by DeletePrev(), FinishEdit(), InsertCommandText(), InsertElement(), InsertSpecial(), InsertText(), and Paste().
|
staticprivate |
Find an iterator pointing to the node in pLineList following rCaretPos.
If rCaretPos.pSelectedNode cannot be found it is assumed that it's in front of pLineList, thus not an element in pLineList. In this case this method returns an iterator to the first element in pLineList.
If the current position is inside an SmTextNode, this node will be split in two, for this reason you should beaware that iterators to elements in pLineList may be invalidated, and that you should call PatchLineList() with this iterator if no action is taken.
Definition at line 354 of file cursor.cxx.
References SmTextNode::ChangeText(), SmTextNode::GetFontDesc(), SmTextNode::GetText(), SmNode::GetToken(), SmCaretPos::nIndex, SmCaretPos::pSelectedNode, and Text.
Referenced by InsertBrackets(), InsertFraction(), InsertNodes(), InsertRow(), and InsertSubSup().
Returns a node that is selected, if any could be found.
Definition at line 1128 of file cursor.cxx.
References FindSelectedNode(), and SmNode::GetNumSubNodes().
Referenced by Copy(), Delete(), FindSelectedNode(), InsertBrackets(), InsertFraction(), InsertRow(), and InsertSubSup().
Finds the topmost node in a visual line.
If MoveUpIfSelected is true, this will move up to the parent line if the parent of the current line is selected.
Definition at line 1109 of file cursor.cxx.
References SmNode::GetParent(), IsLineCompositionNode(), and SmNode::IsSelected().
Referenced by Copy(), SmCaretLinesVisitor::DefaultVisit(), Delete(), DeletePrev(), InsertBrackets(), InsertFraction(), InsertNodes(), InsertRow(), InsertSubSup(), and SmCaretLinesVisitor::Visit().
|
private |
Finish editing.
Finishes editing by parsing pLineList and inserting back into pParent at nParentIndex. This method also rebuilds the graph, annotates the selection, sets caret position and Calls EndEdit.
pLineList | List the constitutes the edited line. |
pParent | Parent to which the line should be inserted. |
nParentIndex | Index in parent where the line should be inserted. |
PosAfterEdit | Caret position to look for after rebuilding graph. |
pStartLine | Line to take first position in, if PosAfterEdit cannot be found, leave it NULL for pLineList. |
Definition at line 1230 of file cursor.cxx.
References AnnotateSelection(), BuildGraph(), CreateBracket(), EndEdit(), SmDocShell::GetFormat(), SmNode::GetType(), Height, mpAnchor, mpDocShell, mpPosition, NONE, parser, Round, SetCaretPosition(), SmStructureNode::SetSubNode(), SubSup, and TLEFT.
Referenced by Delete(), InsertBrackets(), InsertFraction(), InsertNodes(), InsertRow(), and InsertSubSup().
tools::Rectangle SmCursor::GetCaretRectangle | ( | OutputDevice & | rOutDev | ) | const |
Definition at line 177 of file cursor.cxx.
References SmCaretRectanglesVisitor::getCaret(), and GetPosition().
Referenced by SmViewShell::getLOKPayload().
|
inline |
Get position.
Definition at line 84 of file cursor.hxx.
References SmCaretPosGraphEntry::CaretPos, and mpPosition.
Referenced by Draw(), GetCaretRectangle(), and IsAtTailOfBracket().
tools::Rectangle SmCursor::GetSelectionRectangle | ( | OutputDevice & | rOutDev | ) | const |
Definition at line 182 of file cursor.cxx.
References AnnotateSelection(), SmSelectionRectanglesVisitor::GetSelection(), and mpTree.
Referenced by SmViewShell::getLOKPayload().
bool SmCursor::HasComplexSelection | ( | ) |
Returns true if more than one node is selected.
This method is used for implementing backspace and delete. If one of these causes a complex selection, e.g. a node with subnodes or similar, this should not be deleted immediately.
Definition at line 1222 of file cursor.cxx.
References AnnotateSelection(), CountSelectedNodes(), HasSelection(), and mpTree.
Referenced by DeletePrev(), and SmGraphicWidget::KeyInput().
|
inline |
True, if the cursor has a selection.
Definition at line 87 of file cursor.hxx.
References mpAnchor, and mpPosition.
Referenced by Copy(), Delete(), DeletePrev(), HasComplexSelection(), InsertBrackets(), InsertFraction(), InsertRow(), InsertSubSup(), and SmGraphicWidget::KeyInput().
void SmCursor::InsertBrackets | ( | SmBracketType | eBracketType | ) |
Create brackets around current selection, or new SmPlaceNode.
Definition at line 601 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), SmCaretPosGraphEntry::CaretPos, CreateBracket(), FindPositionInLineList(), FindSelectedNode(), FindTopMostNodeInLine(), FinishEdit(), SmDocShell::GetFormat(), SmNode::GetParent(), HasSelection(), Height, SmStructureNode::IndexOfSubNode(), SmCaretPos::IsValid(), mpDocShell, mpPosition, mpTree, NodeToList(), NONE, PatchLineList(), SmNode::Prepare(), SmCaretPos::pSelectedNode, SmNode::SetScaleMode(), SmStructureNode::SetSubNodes(), TakeSelectedNodesFromList(), and TLEFT.
void SmCursor::InsertCommandText | ( | const OUString & | aCommandText | ) |
Insert command text translated into line entries at position.
Note: This method uses the parser to translate a command text into a tree, then it copies line entries from this tree into the current tree. Will not work for commands such as newline or ##, if position is in a matrix. This will work for stuff like "A intersection B". But stuff spanning multiple lines or dependent on the context which position is placed in will not work!
Definition at line 1027 of file cursor.cxx.
References BeginEdit(), Delete(), EndEdit(), SmDocShell::GetFormat(), SmDocShell::GetParser(), InsertNodes(), mpDocShell, NodeToList(), and AbstractSmParser::ParseExpression().
Referenced by SmViewShell::Execute().
void SmCursor::InsertElement | ( | SmFormulaElement | element | ) |
Insert an element into the formula.
Definition at line 898 of file cursor.cxx.
References SmToken::aText, BeginEdit(), Blank, BlankElement, CDotElement, Delete(), EndEdit(), EqualElement, SmToken::eType, FactorialElement, SmDocShell::GetFormat(), GreaterThanElement, SmBlankNode::IncreaseBy(), InsertNodes(), LessThanElement, MinusElement, mpDocShell, MS_ASSIGN, MS_CDOT, MS_FACT, MS_GT, MS_LT, MS_MINUS, MS_PERCENT, MS_PLUS, SmToken::nGroup, SmToken::nLevel, NONE, PercentElement, PlusElement, SmNode::Prepare(), Product, Relation, SmToken::setChar(), Sum, TASSIGN, TBLANK, TCDOT, TFACT, TGT, TLT, TMINUS, TPLUS, TTEXT, and UnOper.
void SmCursor::InsertFraction | ( | ) |
Insert a fraction, use selection as numerator.
Definition at line 818 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), SmCaretPosGraphEntry::CaretPos, FindPositionInLineList(), FindSelectedNode(), FindTopMostNodeInLine(), FinishEdit(), SmNode::GetParent(), SmStructureNode::GetSubNode(), HasSelection(), SmStructureNode::IndexOfSubNode(), mpPosition, mpTree, NodeToList(), PatchLineList(), Product, SmCaretPos::pSelectedNode, SmStructureNode::SetSubNodes(), TakeSelectedNodesFromList(), and TOVER.
|
private |
Insert new nodes in the tree after position.
Definition at line 307 of file cursor.cxx.
References BeginEdit(), SmCaretPosGraphEntry::CaretPos, FindPositionInLineList(), FindTopMostNodeInLine(), FinishEdit(), SmNode::GetParent(), SmStructureNode::IndexOfSubNode(), mpPosition, NodeToList(), PatchLineList(), and pos.
Referenced by InsertCommandText(), InsertElement(), InsertSpecial(), InsertText(), and Paste().
bool SmCursor::InsertRow | ( | ) |
Insert a new row or newline.
Inserts a new row if position is in a matrix or stack command. Otherwise a newline is inserted if we're in a toplevel line.
Definition at line 697 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), SmCaretPosGraphEntry::CaretPos, SmToken::eType, FindPositionInLineList(), FindSelectedNode(), FindTopMostNodeInLine(), FinishEdit(), SmMatrixNode::GetNumCols(), SmMatrixNode::GetNumRows(), SmStructureNode::GetNumSubNodes(), SmNode::GetParent(), SmStructureNode::GetSubNode(), SmNode::GetToken(), SmNode::GetType(), HasSelection(), i, SmStructureNode::IndexOfSubNode(), Line, Matrix, mpPosition, mpTree, NodeToList(), PatchLineList(), SmCaretPos::pSelectedNode, SmMatrixNode::SetRowCol(), SmStructureNode::SetSubNode(), SmNode::SetToken(), Table, TakeSelectedNodesFromList(), TBINOM, TNEWLINE, and TSTACK.
Referenced by SmGraphicWidget::KeyInput().
void SmCursor::InsertSpecial | ( | std::u16string_view | aString | ) |
Insert a special node created from aString.
Used for handling insert request from the "catalog" dialog. The provided string should be formatted as the desired command: phi Note: this method ONLY supports commands defined in Math.xcu
For more complex expressions use InsertCommandText, this method doesn't use SmParser, this means that it's faster, but not as strong.
Definition at line 1000 of file cursor.cxx.
References SmToken::aText, BeginEdit(), SmToken::cMathChar, Delete(), EndEdit(), SmToken::eType, SmDocShell::GetFormat(), InsertNodes(), mpDocShell, SmToken::nGroup, SmToken::nLevel, NONE, SmSpecialNode::Prepare(), comphelper::string::strip(), TSPECIAL, and u.
Referenced by SmViewShell::Execute().
void SmCursor::InsertSubSup | ( | SmSubSup | eSubSup | ) |
Create sub-/super script.
If there's a selection, it will be move into the appropriate sub-/super scription of the node in front of it. If there's no node in front of position (or the selection), a sub-/super scription of a new SmPlaceNode will be made.
If there's is an existing subscription of the node, the caret will be moved into it, and any selection will replace it.
Definition at line 498 of file cursor.cxx.
References AnnotateSelection(), BeginEdit(), SmCaretPosGraphEntry::CaretPos, FindPositionInLineList(), FindSelectedNode(), FindTopMostNodeInLine(), FinishEdit(), SmDocShell::GetFormat(), SmNode::GetParent(), SmCaretPos::GetPosAfter(), SmSubSupNode::GetSubSup(), SmNode::GetType(), HasSelection(), SmStructureNode::IndexOfSubNode(), mpDocShell, mpPosition, mpTree, SmToken::nGroup, NodeToList(), SmNodeListParser::Parse(), PatchLineList(), Power, SmNode::Prepare(), SmCaretPos::pSelectedNode, SmSubSupNode::SetBody(), SmSubSupNode::SetSubSup(), size, SubSup, and TakeSelectedNodesFromList().
void SmCursor::InsertText | ( | const OUString & | aString | ) |
Insert text at the current position.
Definition at line 873 of file cursor.cxx.
References SmTextNode::AdjustFontDesc(), SmToken::aText, BeginEdit(), SmToken::cMathChar, Delete(), EndEdit(), SmToken::eType, FNT_VARIABLE, SmDocShell::GetFormat(), InsertNodes(), mpDocShell, SmToken::nGroup, SmToken::nLevel, NONE, SmTextNode::Prepare(), SmTextNode::SetText(), TIDENT, and u.
bool SmCursor::IsAtTailOfBracket | ( | SmBracketType | eBracketType | ) | const |
Definition at line 1348 of file cursor.cxx.
References Brace, Bracebody, SmBraceNode::ClosingBrace(), Curly, SmToken::eType, SmStructureNode::GetNumSubNodes(), SmNode::GetParent(), GetPosition(), SmTextNode::GetText(), SmNode::GetToken(), SmNode::GetType(), index, SmStructureNode::IndexOfSubNode(), pos, Round, Square, Text, TRBRACE, TRBRACKET, and TRPARENT.
|
staticprivate |
Is this one of the nodes used to compose a line.
These are SmExpression, SmBinHorNode, SmUnHorNode etc.
Definition at line 1193 of file cursor.cxx.
References Align, BinHor, Expression, Font, SmNode::GetType(), Line, and UnHor.
Referenced by CloneLineToClipboard(), Copy(), CountSelectedNodes(), FindTopMostNodeInLine(), and NodeToList().
|
staticprivate |
Convert a visual line to a list.
Note this method will delete all the nodes that will no longer be needed. that includes pLine! This method also deletes SmErrorNode's as they're just meta info in the line.
Definition at line 1144 of file cursor.cxx.
References Align, BinHor, SmStructureNode::ClearSubNodes(), Error, Expression, Font, Line, LineToList(), and UnHor.
Referenced by LineToList(), and NodeToList().
void SmCursor::Move | ( | OutputDevice * | pDev, |
SmMovementDirection | direction, | ||
bool | bMoveAnchor = true |
||
) |
Move the position of this cursor.
Definition at line 20 of file cursor.cxx.
References SmCaretPosGraphEntry::CaretPos, SmCaretLine::GetHeight(), SmCaretPos2LineVisitor::GetResult(), SmCaretLine::GetTop(), HORIZONTICAL_DISTANCE_FACTOR, SmCaretPosGraphEntry::Left, MoveDown, MoveLeft, MoveRight, MoveUp, mpAnchor, mpGraph, mpPosition, RequestRepaint(), SmCaretPosGraphEntry::Right, and SmCaretLine::SquaredDistanceX().
Referenced by DeletePrev(), and SmGraphicWidget::KeyInput().
void SmCursor::MoveTo | ( | OutputDevice * | pDev, |
const Point & | pos, | ||
bool | bMoveAnchor | ||
) |
Move to the caret position closest to a given point.
Definition at line 83 of file cursor.cxx.
References SmCaretPos2LineVisitor::GetResult(), mpAnchor, mpGraph, mpPosition, pos, RequestRepaint(), SmCaretLine::SquaredDistanceX(), and SmCaretLine::SquaredDistanceY().
Referenced by SmGraphicWidget::MouseButtonDown(), and SmGraphicWidget::MouseMove().
|
inlinestaticprivate |
Auxiliary function for calling LineToList on a node.
This method sets pNode = NULL and remove it from its parent. (Assuming it has a parent, and is a child of it).
Definition at line 238 of file cursor.hxx.
References SmNode::GetParent(), index, SmStructureNode::IndexOfSubNode(), IsLineCompositionNode(), LineToList(), and SmStructureNode::SetSubNode().
Referenced by Delete(), DeletePrev(), InsertBrackets(), InsertCommandText(), InsertFraction(), InsertNodes(), InsertRow(), and InsertSubSup().
void SmCursor::Paste | ( | ) |
Paste the clipboard.
Definition at line 1087 of file cursor.cxx.
References BeginEdit(), CloneList(), Delete(), EndEdit(), InsertNodes(), and maClipboard.
Referenced by SmGraphicWidget::KeyInput().
|
staticprivate |
Patch a line list after modification, merge SmTextNode, remove SmPlaceNode etc.
pLineList | The line list to patch |
aIter | Iterator pointing to the element that needs to be patched with its previous. |
When the list is patched text nodes before and after aIter will be merged. If there's an, in the context, inappropriate SmPlaceNode before or after aIter it will also be removed.
Definition at line 388 of file cursor.cxx.
References SmTextNode::ChangeText(), SmToken::eType, SmCaretPos::GetPosAfter(), SmTextNode::GetText(), SmNode::GetToken(), SmNode::GetType(), SmNodeListParser::IsOperator(), Place, Text, and TNUMBER.
Referenced by Delete(), DeletePrev(), InsertBrackets(), InsertFraction(), InsertNodes(), InsertRow(), and InsertSubSup().
|
private |
Request the formula is repainted.
Definition at line 1333 of file cursor.cxx.
References SfxObjectShell::GetCreateMode(), comphelper::LibreOfficeKit::isActive(), mpDocShell, SmDocShell::Repaint(), and SmGetActiveView().
|
private |
tries to set position to a specific SmCaretPos
Definition at line 155 of file cursor.cxx.
References mpAnchor, mpGraph, mpPosition, and pos.
Referenced by DeletePrev(), and FinishEdit().
|
staticprivate |
Take selected nodes from a list.
Puts the selected nodes into pSelectedNodes, or if pSelectedNodes is NULL deletes the selected nodes. Note: If there's a selection inside an SmTextNode this node will be split, and it will not be merged when the selection have been taken. Use PatchLineList on the iterator returns to fix this.
Definition at line 441 of file cursor.cxx.
References SmTextNode::ChangeText(), SmTextNode::GetFontDesc(), SmTextNode::GetSelectionEnd(), SmTextNode::GetSelectionStart(), SmTextNode::GetText(), SmNode::GetToken(), and Text.
Referenced by Delete(), InsertBrackets(), InsertFraction(), InsertRow(), and InsertSubSup().
|
friend |
Definition at line 195 of file cursor.hxx.
|
private |
|
private |
Holds data for BeginEdit() and EndEdit()
Definition at line 332 of file cursor.hxx.
Referenced by BeginEdit(), and EndEdit().
|
private |
The number of times BeginEdit have been called Used to allow nesting of BeginEdit() and EndEdit() sections.
Definition at line 330 of file cursor.hxx.
Referenced by BeginEdit(), and EndEdit().
|
private |
Definition at line 197 of file cursor.hxx.
Referenced by AnnotateSelection(), BuildGraph(), DeletePrev(), FinishEdit(), HasSelection(), Move(), MoveTo(), and SetCaretPosition().
|
private |
Owner of the formula tree.
Definition at line 201 of file cursor.hxx.
Referenced by BeginEdit(), EndEdit(), FinishEdit(), InsertBrackets(), InsertCommandText(), InsertElement(), InsertSpecial(), InsertSubSup(), InsertText(), and RequestRepaint().
|
private |
Graph over caret position in the current tree.
Definition at line 203 of file cursor.hxx.
Referenced by BuildGraph(), Move(), MoveTo(), and SetCaretPosition().
|
private |
Definition at line 197 of file cursor.hxx.
Referenced by AnnotateSelection(), BuildGraph(), DeletePrev(), FinishEdit(), GetPosition(), HasSelection(), InsertBrackets(), InsertFraction(), InsertNodes(), InsertRow(), InsertSubSup(), Move(), MoveTo(), and SetCaretPosition().
|
private |
Formula tree.
Definition at line 199 of file cursor.hxx.
Referenced by AnnotateSelection(), BuildGraph(), Copy(), Delete(), EndEdit(), SmDocShell::GetFormulaTree(), GetSelectionRectangle(), HasComplexSelection(), InsertBrackets(), InsertFraction(), InsertRow(), InsertSubSup(), and SmDocShell::SetFormulaTree().