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 RTFInternalState
20 : {
21 : INTERNAL_NORMAL,
22 : INTERNAL_BIN,
23 : INTERNAL_HEX
24 : };
25 :
26 : enum RTFErrors
27 : {
28 : ERROR_OK,
29 : ERROR_GROUP_UNDER,
30 : ERROR_GROUP_OVER,
31 : ERROR_EOF,
32 : ERROR_HEX_INVALID,
33 : ERROR_CHAR_OVER
34 : };
35 :
36 : /**
37 : * RTFTokenizer needs a class implementing this 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 828 : class RTFListener
43 : {
44 : public:
45 828 : virtual ~RTFListener() { }
46 : // Dispatching of control words and characters.
47 : virtual int dispatchDestination(RTFKeyword nKeyword) = 0;
48 : virtual int dispatchFlag(RTFKeyword nKeyword) = 0;
49 : virtual int dispatchSymbol(RTFKeyword nKeyword) = 0;
50 : virtual int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) = 0;
51 : virtual int dispatchValue(RTFKeyword nKeyword, int nParam) = 0;
52 : virtual int resolveChars(char ch) = 0;
53 :
54 : // State handling.
55 : virtual int pushState() = 0;
56 : virtual int popState() = 0;
57 :
58 : virtual RTFDestinationState getDestinationState() = 0;
59 : virtual void setDestinationState(RTFDestinationState nDestinationState) = 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: */
|