From 1fc4af8695ae0ffb7590198e0d3791a19084a99b Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Wed, 8 Jun 2016 16:31:30 +0900 Subject: Pass it by const ref Change-Id: I0c2b48a503e2501210af690f02858dade994a733 Reviewed-on: https://gerrit.libreoffice.org/26048 Tested-by: Jenkins Reviewed-by: Takeshi Abe --- starmath/source/cursor.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'starmath/source/cursor.cxx') diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index dab3dc497974..bae47789bd31 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(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(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 -- cgit