summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtflistener.hxx
blob: f79a0d68926ede2ba735dd113a7022d286c80344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* -*- 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/.
 */

#ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX
#define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX

#include <rtfcontrolwords.hxx>

namespace writerfilter {
    namespace rtftok {
        enum RTFInternalState
        {
            INTERNAL_NORMAL,
            INTERNAL_BIN,
            INTERNAL_HEX
        };

        enum RTFErrors
        {
            ERROR_OK,
            ERROR_GROUP_UNDER,
            ERROR_GROUP_OVER,
            ERROR_EOF,
            ERROR_HEX_INVALID,
            ERROR_CHAR_OVER
        };

        /**
         * RTFTokenizer needs a class implementing this 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() { }
                // Dispatching of control words and characters.
                virtual int dispatchDestination(RTFKeyword nKeyword) = 0;
                virtual int dispatchFlag(RTFKeyword nKeyword) = 0;
                virtual int dispatchSymbol(RTFKeyword nKeyword) = 0;
                virtual int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) = 0;
                virtual int dispatchValue(RTFKeyword nKeyword, int nParam) = 0;
                virtual int resolveChars(char ch) = 0;

                // State handling.
                virtual int pushState() = 0;
                virtual int popState() = 0;

                virtual RTFDestinationState getDestinationState() = 0;
                virtual void setDestinationState(RTFDestinationState nDestinationState) = 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 rtftok
} // namespace writerfilter

#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFLISTENER_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */