fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / data / edittextiterator.cxx
blobe563f04ae5626f9e638202fe3e6374a96d411b8f
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 */
10 #include "edittextiterator.hxx"
11 #include "document.hxx"
12 #include "table.hxx"
13 #include "column.hxx"
15 namespace sc {
17 EditTextIterator::EditTextIterator( const ScDocument& rDoc, SCTAB nTab ) :
18 mrTable(*rDoc.maTabs.at(nTab)),
19 mpCol(&mrTable.aCol[0]),
20 mpColEnd(mpCol + static_cast<size_t>(MAXCOLCOUNT)),
21 mpCells(&mpCol->maCells),
22 maPos(mpCells->position(0)),
23 miEnd(mpCells->end())
27 const EditTextObject* EditTextIterator::seek()
29 while (maPos.first->type != sc::element_type_edittext)
31 incBlock();
32 if (maPos.first == miEnd)
34 // Move to the next column.
35 ++mpCol;
36 if (mpCol == mpColEnd)
37 // No more columns.
38 return NULL;
40 mpCells = &mpCol->maCells;
41 maPos = mpCells->position(0);
42 miEnd = mpCells->end();
46 // We are on the right block type.
47 return sc::edittext_block::at(*maPos.first->data, maPos.second);
50 void EditTextIterator::incPos()
52 if (maPos.second + 1 < maPos.first->size)
53 // Increment within the block.
54 ++maPos.second;
55 else
56 incBlock();
59 void EditTextIterator::incBlock()
61 ++maPos.first;
62 maPos.second = 0;
65 const EditTextObject* EditTextIterator::first()
67 mpCol = &mrTable.aCol[0];
68 mpColEnd = mpCol + static_cast<size_t>(MAXCOLCOUNT);
69 mpCells = &mpCol->maCells;
70 maPos = mpCells->position(0);
71 miEnd = mpCells->end();
72 return seek();
75 const EditTextObject* EditTextIterator::next()
77 if (maPos.first == miEnd)
78 return NULL;
80 incPos();
81 return seek();
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */