1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <edittextiterator.hxx>
11 #include <document.hxx>
17 EditTextIterator::EditTextIterator( const ScDocument
& rDoc
, SCTAB nTab
) :
18 mrTable(*rDoc
.maTabs
.at(nTab
)),
26 void EditTextIterator::init()
29 if (mnCol
>= mrTable
.aCol
.size())
34 mpCells
= &mrTable
.aCol
[mnCol
].maCells
;
35 maPos
= mpCells
->position(0);
36 miEnd
= mpCells
->end();
40 const EditTextObject
* EditTextIterator::seek()
42 while (maPos
.first
->type
!= sc::element_type_edittext
)
45 if (maPos
.first
== miEnd
)
47 // Move to the next column.
49 if (mnCol
>= mrTable
.aCol
.size())
53 mpCells
= &mrTable
.aCol
[mnCol
].maCells
;
54 maPos
= mpCells
->position(0);
55 miEnd
= mpCells
->end();
59 // We are on the right block type.
60 return sc::edittext_block::at(*maPos
.first
->data
, maPos
.second
);
63 void EditTextIterator::incBlock()
69 const EditTextObject
* EditTextIterator::first()
77 const EditTextObject
* EditTextIterator::next()
82 if (maPos
.first
== miEnd
)
85 // increment position by one
86 if (maPos
.second
+ 1 < maPos
.first
->size
)
87 // Increment within the block.
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */