fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / starmath / source / caret.cxx
blob524ae9efa24029ab36513fff56f7cf4d7e528c64
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9 #include "caret.hxx"
11 /////////////////////////////// SmCaretPosGraph ////////////////////////////////
13 SmCaretPosGraphEntry* SmCaretPosGraphIterator::Next(){
14 if(nOffset >= pGraph->nOffset){
15 if(pGraph->pNext){
16 pGraph = pGraph->pNext;
17 nOffset = 0;
18 pEntry = Next();
19 }else
20 pEntry = NULL;
21 }else
22 pEntry = pGraph->Graph + nOffset++;
23 return pEntry;
26 SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){
27 if(nOffset >= SmCaretPosGraphSize){
28 if(!pNext)
29 pNext = new SmCaretPosGraph();
30 return pNext->Add(entry);
31 }else{
32 //Set Left and Right to point to the entry itself if they are NULL
33 entry.Left = entry.Left ? entry.Left : Graph + nOffset;
34 entry.Right = entry.Right ? entry.Right : Graph + nOffset;
35 //Save the entry
36 Graph[nOffset] = entry;
37 return Graph + nOffset++;
41 SmCaretPosGraph::~SmCaretPosGraph(){
42 if(pNext)
43 delete pNext;
44 pNext = NULL;
47 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */