[Libreoffice-commits] core.git: starmath/inc starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Fri Jun 10 03:35:16 UTC 2016
starmath/inc/cursor.hxx | 7 ++++---
starmath/source/cursor.cxx | 19 ++++++++++++-------
2 files changed, 16 insertions(+), 10 deletions(-)
New commits:
commit 1fc4af8695ae0ffb7590198e0d3791a19084a99b
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Wed Jun 8 16:31:30 2016 +0900
Pass it by const ref
Change-Id: I0c2b48a503e2501210af690f02858dade994a733
Reviewed-on: https://gerrit.libreoffice.org/26048
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 9554fc7..cd36b4e 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -306,9 +306,9 @@ private:
/** Clone list of nodes in a clipboard (creates a deep clone) */
static SmNodeList* CloneList(SmClipboard &rClipboard);
- /** Find an iterator pointing to the node in pLineList following aCaretPos
+ /** Find an iterator pointing to the node in pLineList following rCaretPos
*
- * If aCaretPos::pSelectedNode cannot be found it is assumed that it's in front of pLineList,
+ * 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.
*
@@ -316,7 +316,8 @@ private:
* 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.
*/
- static SmNodeList::iterator FindPositionInLineList(SmNodeList* pLineList, SmCaretPos aCaretPos);
+ static SmNodeList::iterator FindPositionInLineList(SmNodeList* pLineList,
+ const SmCaretPos& rCaretPos);
/** Patch a line list after modification, merge SmTextNode, remove SmPlaceNode etc.
*
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index dab3dc4..bae4778 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -340,17 +340,22 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
FinishEdit(pLineList, pLineParent, nParentIndex, PosAfterInsert);
}
-SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList, SmCaretPos aCaretPos) {
+SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList,
+ const SmCaretPos& rCaretPos)
+{
//Find iterator for position
SmNodeList::iterator it;
for(it = pLineList->begin(); it != pLineList->end(); ++it){
- if(*it == aCaretPos.pSelectedNode){
- if((*it)->GetType() == NTEXT){
+ if(*it == rCaretPos.pSelectedNode)
+ {
+ if((*it)->GetType() == NTEXT)
+ {
//Split textnode if needed
- if(aCaretPos.Index > 0){
- SmTextNode* pText = static_cast<SmTextNode*>(aCaretPos.pSelectedNode);
- OUString str1 = pText->GetText().copy(0, aCaretPos.Index);
- OUString str2 = pText->GetText().copy(aCaretPos.Index);
+ if(rCaretPos.Index > 0)
+ {
+ SmTextNode* pText = static_cast<SmTextNode*>(rCaretPos.pSelectedNode);
+ OUString str1 = pText->GetText().copy(0, rCaretPos.Index);
+ OUString str2 = pText->GetText().copy(rCaretPos.Index);
pText->ChangeText(str1);
++it;
//Insert str2 as new text node
More information about the Libreoffice-commits
mailing list