summaryrefslogtreecommitdiff
path: root/sw/source/core/model/ModelTraverser.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-06-11 12:23:45 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-06-19 11:12:44 +0200
commit686c35a3c37674d08c1f8585a621143c959b3f29 (patch)
treed5add6b678d48c825d2a0a2cc3985b75cb8aae6d /sw/source/core/model/ModelTraverser.cxx
parente6cb7f9ab25bca32dc85aef8ff127e070cd109b6 (diff)
indexing: indexing paragraph text with the ModelTraverser
This adds the basic paragraph text export for indexing, which uses the new ModelTraverser, which is inspired by AccessibilityCheck (and in the future it will be changed to use the ModelTraverser too, when it matures). ModelTraverser implements traversing through the model and executes a handler for a element of a model (which can be various things). IndexingExport class implements indexing export that uses the ModelTraverser to write into the indexing xml document, that uses the tools::XmlWriter. Change-Id: I7a6a5de332534270fe894a881131e5eb5ea9d881 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117356 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/source/core/model/ModelTraverser.cxx')
-rw-r--r--sw/source/core/model/ModelTraverser.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sw/source/core/model/ModelTraverser.cxx b/sw/source/core/model/ModelTraverser.cxx
new file mode 100644
index 000000000000..f46e173eca9f
--- /dev/null
+++ b/sw/source/core/model/ModelTraverser.cxx
@@ -0,0 +1,39 @@
+/* -*- 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/.
+ *
+ */
+
+#include <ModelTraverser.hxx>
+#include <node.hxx>
+#include <ndarr.hxx>
+
+namespace sw
+{
+void ModelTraverser::traverse()
+{
+ if (m_pDoc == nullptr)
+ return;
+
+ auto const& pNodes = m_pDoc->GetNodes();
+ SwNode* pNode = nullptr;
+ for (sal_uLong n = 0; n < pNodes.Count(); ++n)
+ {
+ pNode = pNodes[n];
+ if (pNode)
+ {
+ for (auto& pNodeHandler : mpNodeHandler)
+ {
+ pNodeHandler->handleNode(pNode);
+ }
+ }
+ }
+}
+
+} // end sw namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */