diff options
author | Daisuke Nishino <niboshi000@gmail.com> | 2011-11-15 19:42:35 +0900 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-11-16 14:54:21 +0000 |
commit | 20dde3737f250ab48b80a28c9c03d348e486dd8b (patch) | |
tree | 03324ac0aac8af25f8b98019d45415698c28979d /starmath/inc | |
parent | 1b6d2c7f465cb1249e33d9e873f11756be634a3a (diff) |
Move cursor to the right of brace when the closing brace is typed.
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/caret.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/cursor.hxx | 5 | ||||
-rw-r--r-- | starmath/inc/node.hxx | 7 |
3 files changed, 10 insertions, 4 deletions
diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx index cec8bd722482..76e25279fb55 100644 --- a/starmath/inc/caret.hxx +++ b/starmath/inc/caret.hxx @@ -50,7 +50,7 @@ struct SmCaretPos{ //TODO: Consider forgetting about the todo above... As it's really unpleasent. int Index; /** True, if this is a valid caret position */ - bool IsValid() { return pSelectedNode != NULL; } + bool IsValid() const { return pSelectedNode != NULL; } bool operator!=(SmCaretPos pos) const { return pos.pSelectedNode != pSelectedNode || Index != pos.Index; } diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 6b6e7168a59c..dcfea886736d 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -118,7 +118,7 @@ public: SmCaretPos GetAnchor(){ return anchor->CaretPos; } /** Get position */ - SmCaretPos GetPosition() { return position->CaretPos; } + SmCaretPos GetPosition() const { return position->CaretPos; } /** True, if the cursor has a selection */ bool HasSelection() { return anchor != position; } @@ -236,6 +236,9 @@ public: /** Draw the caret */ void Draw(OutputDevice& pDev, Point Offset, bool isCaretVisible); + bool IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBraceNode = NULL) const; + void MoveAfterBracket(SmBraceNode* pBraceNode, bool bMoveAnchor = true); + private: friend class SmDocShell; diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 07aca32eaa29..1ecde44b406e 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -119,13 +119,13 @@ public: virtual SmNode * GetSubNode(sal_uInt16 nIndex); const SmNode * GetSubNode(sal_uInt16 nIndex) const { - return ((SmNode *) this)->GetSubNode(nIndex); + return const_cast<SmNode *>(this)->GetSubNode(nIndex); } virtual SmNode * GetLeftMost(); const SmNode * GetLeftMost() const { - return ((SmNode *) this)->GetLeftMost(); + return const_cast<SmNode *>(this)->GetLeftMost(); } sal_uInt16 & Flags() { return nFlags; } @@ -149,6 +149,8 @@ public: virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void PrepareAttributes(); + sal_uInt16 FindIndex() const; + #if OSL_DEBUG_LEVEL void ToggleDebug() const; #endif @@ -206,6 +208,7 @@ public: /** Get the parent node of this node */ SmStructureNode* GetParent(){ return aParentNode; } + const SmStructureNode* GetParent() const { return aParentNode; } /** Set the parent node */ void SetParent(SmStructureNode* parent){ aParentNode = parent; |