Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / inc / columniterator.hxx
blob260c13e03551403f36d0de09f5014aaa001e2139
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 #pragma once
12 #include <stddef.h>
13 #include "address.hxx"
14 #include <mdds/multi_type_vector/types.hpp>
15 #include "mtvelements.hxx"
16 #include <sal/types.h>
17 #include "types.hxx"
18 class ScColumn;
19 class ScDocument;
20 struct ScRefCellValue;
22 class ScColumnTextWidthIterator
24 const size_t mnEnd;
25 size_t mnCurPos;
26 sc::CellTextAttrStoreType::iterator miBlockCur;
27 sc::CellTextAttrStoreType::iterator miBlockEnd;
28 sc::celltextattr_block::iterator miDataCur;
29 sc::celltextattr_block::iterator miDataEnd;
31 public:
32 ScColumnTextWidthIterator(const ScColumnTextWidthIterator&) = delete;
33 const ScColumnTextWidthIterator& operator=(const ScColumnTextWidthIterator&) = delete;
34 ScColumnTextWidthIterator(const ScDocument& rDoc, ScColumn& rCol, SCROW nStartRow,
35 SCROW nEndRow);
37 /**
38 * @param rDoc document instance.
39 * @param rStartPos position of the first cell from which to start
40 * iteration. Note that the caller must ensure that this
41 * position is valid; the constructor does not check its
42 * validity.
43 * @param nEndRow end row position.
45 ScColumnTextWidthIterator(const ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow);
47 void next();
48 bool hasCell() const;
49 SCROW getPos() const;
50 sal_uInt16 getValue() const;
51 void setValue(sal_uInt16 nVal);
53 private:
54 void init(const ScDocument& rDoc, SCROW nStartRow, SCROW nEndRow);
55 void getDataIterators(size_t nOffsetInBlock);
56 void checkEndRow();
59 namespace sc
61 /**
62 * This iterator lets you iterate over cells over specified range in a
63 * single column. It does not modify the state of the cells, and therefore
64 * is thread safe.
66 class ColumnIterator
68 CellStoreType::const_position_type maPos;
69 CellStoreType::const_position_type maPosEnd;
70 bool mbComplete;
72 public:
73 ColumnIterator(const CellStoreType& rCells, SCROW nRow1, SCROW nRow2);
75 void next();
77 SCROW getRow() const;
79 bool hasCell() const;
81 mdds::mtv::element_t getType() const;
83 ScRefCellValue getCell() const;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */