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 _RTFLISTENER_HXX_
11 : #define _RTFLISTENER_HXX_
12 :
13 : #include <rtfcontrolwords.hxx>
14 :
15 : namespace writerfilter {
16 : namespace rtftok {
17 : enum RTFInternalState
18 : {
19 : INTERNAL_NORMAL,
20 : INTERNAL_BIN,
21 : INTERNAL_HEX
22 : };
23 :
24 : enum RTFErrors
25 : {
26 : ERROR_OK,
27 : ERROR_GROUP_UNDER,
28 : ERROR_GROUP_OVER,
29 : ERROR_EOF,
30 : ERROR_HEX_INVALID,
31 : ERROR_CHAR_OVER
32 : };
33 :
34 : /**
35 : * RTFTokenizer needs a class implementing this this interface. While
36 : * RTFTokenizer separates control words (and their arguments) from
37 : * text, the class implementing this interface is expected to map the
38 : * raw RTF tokens to dmapper tokens.
39 : */
40 0 : class RTFListener
41 : {
42 : public:
43 0 : virtual ~RTFListener() { }
44 : // Dispatching of control words and characters.
45 : virtual int dispatchDestination(RTFKeyword nKeyword) = 0;
46 : virtual int dispatchFlag(RTFKeyword nKeyword) = 0;
47 : virtual int dispatchSymbol(RTFKeyword nKeyword) = 0;
48 : virtual int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) = 0;
49 : virtual int dispatchValue(RTFKeyword nKeyword, int nParam) = 0;
50 : virtual int resolveChars(char ch) = 0;
51 :
52 : // State handling.
53 : virtual int pushState() = 0;
54 : virtual int popState() = 0;
55 :
56 : virtual RTFDestinationState getDestinationState() = 0;
57 : virtual void setDestinationState(RTFDestinationState nDestinationState) = 0;
58 : virtual RTFInternalState getInternalState() = 0;
59 : virtual void setInternalState(RTFInternalState nInternalState) = 0;
60 : virtual bool getSkipUnknown() = 0;
61 : virtual void setSkipUnknown(bool bSkipUnknown) = 0;
62 :
63 : // Substream handling.
64 : virtual void finishSubstream() = 0;
65 : virtual bool isSubstream() const = 0;
66 : };
67 : } // namespace rtftok
68 : } // namespace writerfilter
69 :
70 : #endif // _RTFLISTENER_HXX_
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|