summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-20 17:23:12 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-08-20 22:57:13 -0400
commit6c4bedffb98a33b202692b225fc250b858ff9f65 (patch)
tree3d1d30ff0c7dd352d2c39737a4ce38f7e93176c5 /sc/inc
parent9ca5e3da5ca5f68ced1917cf38773fd1060bede4 (diff)
Add edit text iterator that iterates through only edit text cells.
Change-Id: I898d7a2d3f0ea472daddb9dd32f772a5d7268773
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/edittextiterator.hxx61
-rw-r--r--sc/inc/table.hxx1
4 files changed, 66 insertions, 0 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 49cc24aa8f38..4322c247ff81 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -51,6 +51,7 @@ namespace sc {
struct RefUpdateInsertTabContext;
struct RefUpdateDeleteTabContext;
struct RefUpdateMoveTabContext;
+ class EditTextIterator;
}
class Fraction;
@@ -132,6 +133,7 @@ friend class ScColumnTextWidthIterator;
friend class ScDocumentImport;
friend class sc::SingleColumnSpanSet;
friend class sc::ColumnSpanSet;
+friend class sc::EditTextIterator;
ScColumn(const ScColumn&); // disabled
ScColumn& operator= (const ScColumn&); // disabled
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c74c6c8349d3..ab84d4c10b06 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -56,6 +56,7 @@ namespace sc {
class ColumnSpanSet;
struct ColumnBlockPosition;
struct RefUpdateContext;
+ class EditTextIterator;
}
class SvxFontItem;
@@ -231,6 +232,7 @@ friend class ScTable;
friend struct ScRefCellValue;
friend class ScDocumentImport;
friend class sc::ColumnSpanSet;
+friend class sc::EditTextIterator;
typedef ::std::vector<ScTable*> TableContainer;
private:
diff --git a/sc/inc/edittextiterator.hxx b/sc/inc/edittextiterator.hxx
new file mode 100644
index 000000000000..f160b63f58c3
--- /dev/null
+++ b/sc/inc/edittextiterator.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_EDITTEXTITERATOR_HXX
+#define SC_EDITTEXTITERATOR_HXX
+
+#include "address.hxx"
+#include "mtvelements.hxx"
+
+class ScColumn;
+class ScTable;
+class ScDocument;
+class EditTextObject;
+
+namespace sc {
+
+/**
+ * Iterate through all edit text cells in a given sheet. The caller must
+ * check the validity of the sheet index passed to its constructor.
+ *
+ * It iterates from top to bottom, and then left to right order.
+ */
+class EditTextIterator
+{
+ const ScTable& mrTable;
+ const ScColumn* mpCol;
+ const ScColumn* mpColEnd;
+ const CellStoreType* mpCells;
+ CellStoreType::const_position_type maPos;
+ CellStoreType::const_iterator miEnd;
+
+ /**
+ * Move to the next edit text cell position if the current position is not
+ * an edit text.
+ */
+ const EditTextObject* seek();
+
+ /**
+ * Increment current position by one.
+ */
+ void incPos();
+ void incBlock();
+
+public:
+ EditTextIterator( const ScDocument& rDoc, SCTAB nTab );
+
+ const EditTextObject* first();
+ const EditTextObject* next();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 06e8151ddda8..99c506bec405 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -210,6 +210,7 @@ friend class ScAttrRectIterator;
friend class ScColumnTextWidthIterator;
friend class ScDocumentImport;
friend class sc::ColumnSpanSet;
+friend class sc::EditTextIterator;
public:
ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,