Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX
11 : #define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX
12 :
13 : #include <rtfcontrolwords.hxx>
14 :
15 : namespace writerfilter
16 : {
17 : namespace rtftok
18 : {
19 : enum class RTFInternalState
20 : {
21 : NORMAL,
22 : BIN,
23 : HEX
24 : };
25 :
26 : enum class RTFError
27 : {
28 : OK,
29 : GROUP_UNDER,
30 : GROUP_OVER,
31 : UNEXPECTED_EOF,
32 : HEX_INVALID,
33 : CHAR_OVER
34 : };
35 :
36 : /**
37 : * RTFTokenizer needs a class implementing this interface. While
38 : * RTFTokenizer separates control words (and their arguments) from
39 : * text, the class implementing this interface is expected to map the
40 : * raw RTF tokens to dmapper tokens.
41 : */
42 512 : class RTFListener
43 : {
44 : public:
45 512 : virtual ~RTFListener() { }
46 : // Dispatching of control words and characters.
47 : virtual RTFError dispatchDestination(RTFKeyword nKeyword) = 0;
48 : virtual RTFError dispatchFlag(RTFKeyword nKeyword) = 0;
49 : virtual RTFError dispatchSymbol(RTFKeyword nKeyword) = 0;
50 : virtual RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) = 0;
51 : virtual RTFError dispatchValue(RTFKeyword nKeyword, int nParam) = 0;
52 : virtual RTFError resolveChars(char ch) = 0;
53 :
54 : // State handling.
55 : virtual RTFError pushState() = 0;
56 : virtual RTFError popState() = 0;
57 :
58 : virtual Destination getDestination() = 0;
59 : virtual void setDestination(Destination eDestination) = 0;
60 : virtual RTFInternalState getInternalState() = 0;
61 : virtual void setInternalState(RTFInternalState nInternalState) = 0;
62 : virtual bool getSkipUnknown() = 0;
63 : virtual void setSkipUnknown(bool bSkipUnknown) = 0;
64 :
65 : // Substream handling.
66 : virtual void finishSubstream() = 0;
67 : virtual bool isSubstream() const = 0;
68 : };
69 : } // namespace rtftok
70 : } // namespace writerfilter
71 :
72 : #endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|