summaryrefslogtreecommitdiffstats
path: root/writerfilter/source/rtftok/rtflistener.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/rtftok/rtflistener.hxx')
-rw-r--r--writerfilter/source/rtftok/rtflistener.hxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtflistener.hxx b/writerfilter/source/rtftok/rtflistener.hxx
new file mode 100644
index 000000000..150440afb
--- /dev/null
+++ b/writerfilter/source/rtftok/rtflistener.hxx
@@ -0,0 +1,69 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include "rtfcontrolwords.hxx"
+
+namespace writerfilter::rtftok
+{
+enum class RTFInternalState
+{
+ NORMAL,
+ BIN,
+ HEX
+};
+
+enum class RTFError
+{
+ OK,
+ GROUP_UNDER,
+ GROUP_OVER,
+ UNEXPECTED_EOF,
+ HEX_INVALID,
+ CHAR_OVER,
+ CLASSIFICATION
+};
+
+/**
+ * RTFTokenizer needs a class implementing this interface. While
+ * RTFTokenizer separates control words (and their arguments) from
+ * text, the class implementing this interface is expected to map the
+ * raw RTF tokens to dmapper tokens.
+ */
+class RTFListener
+{
+public:
+ virtual ~RTFListener() = default;
+ // Dispatching of control words and characters.
+ virtual RTFError dispatchDestination(RTFKeyword nKeyword) = 0;
+ virtual RTFError dispatchFlag(RTFKeyword nKeyword) = 0;
+ virtual RTFError dispatchSymbol(RTFKeyword nKeyword) = 0;
+ virtual RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) = 0;
+ virtual RTFError dispatchValue(RTFKeyword nKeyword, int nParam) = 0;
+ virtual RTFError resolveChars(char ch) = 0;
+
+ // State handling.
+ virtual RTFError pushState() = 0;
+ virtual RTFError popState() = 0;
+
+ virtual Destination getDestination() = 0;
+ virtual void setDestination(Destination eDestination) = 0;
+ virtual RTFInternalState getInternalState() = 0;
+ virtual void setInternalState(RTFInternalState nInternalState) = 0;
+ virtual bool getSkipUnknown() = 0;
+ virtual void setSkipUnknown(bool bSkipUnknown) = 0;
+
+ // Substream handling.
+ virtual void finishSubstream() = 0;
+ virtual bool isSubstream() const = 0;
+};
+} // namespace writerfilter::rtftok
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */