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 : #include <rtflookahead.hxx>
11 : #include <tools/stream.hxx>
12 :
13 : using namespace com::sun::star;
14 :
15 : namespace writerfilter
16 : {
17 : namespace rtftok
18 : {
19 :
20 8 : RTFLookahead::RTFLookahead(SvStream& rStream, sal_Size nGroupStart)
21 : : m_rStream(rStream),
22 8 : m_bHasTable(false)
23 : {
24 8 : sal_Size nPos = m_rStream.Tell();
25 8 : m_rStream.Seek(nGroupStart);
26 8 : uno::Reference<task::XStatusIndicator> xStatusIndicator;
27 8 : m_pTokenizer.reset(new RTFTokenizer(*this, &m_rStream, xStatusIndicator));
28 8 : m_pTokenizer->resolveParse();
29 8 : m_rStream.Seek(nPos);
30 8 : }
31 :
32 8 : RTFLookahead::~RTFLookahead()
33 : {
34 8 : }
35 :
36 483 : RTFError RTFLookahead::dispatchDestination(RTFKeyword /*nKeyword*/)
37 : {
38 483 : return RTFError::OK;
39 : }
40 :
41 256 : RTFError RTFLookahead::dispatchFlag(RTFKeyword nKeyword)
42 : {
43 256 : if (nKeyword == RTF_INTBL)
44 6 : m_bHasTable = true;
45 256 : return RTFError::OK;
46 : }
47 :
48 41 : RTFError RTFLookahead::dispatchSymbol(RTFKeyword /*nKeyword*/)
49 : {
50 41 : return RTFError::OK;
51 : }
52 :
53 1 : RTFError RTFLookahead::dispatchToggle(RTFKeyword /*nKeyword*/, bool /*bParam*/, int /*nParam*/)
54 : {
55 1 : return RTFError::OK;
56 : }
57 :
58 246 : RTFError RTFLookahead::dispatchValue(RTFKeyword /*nKeyword*/, int /*nParam*/)
59 : {
60 246 : return RTFError::OK;
61 : }
62 :
63 296 : RTFError RTFLookahead::resolveChars(char ch)
64 : {
65 4685 : while (!m_rStream.IsEof() && (ch != '{' && ch != '}' && ch != '\\'))
66 4093 : m_rStream.ReadChar(ch);
67 296 : if (!m_rStream.IsEof())
68 296 : m_rStream.SeekRel(-1);
69 296 : return RTFError::OK;
70 : }
71 :
72 491 : RTFError RTFLookahead::pushState()
73 : {
74 491 : m_pTokenizer->pushGroup();
75 491 : return RTFError::OK;
76 : }
77 :
78 491 : RTFError RTFLookahead::popState()
79 : {
80 491 : m_pTokenizer->popGroup();
81 491 : return RTFError::OK;
82 : }
83 :
84 1029 : Destination RTFLookahead::getDestination()
85 : {
86 1029 : return Destination::NORMAL;
87 : }
88 :
89 0 : void RTFLookahead::setDestination(Destination /*eDestination*/)
90 : {
91 0 : }
92 :
93 3181 : RTFInternalState RTFLookahead::getInternalState()
94 : {
95 3181 : return RTFInternalState::NORMAL;
96 : }
97 :
98 0 : void RTFLookahead::setInternalState(RTFInternalState /*nInternalState*/)
99 : {
100 0 : }
101 :
102 0 : bool RTFLookahead::getSkipUnknown()
103 : {
104 0 : return false;
105 : }
106 :
107 0 : void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/)
108 : {
109 0 : }
110 :
111 0 : void RTFLookahead::finishSubstream()
112 : {
113 0 : }
114 :
115 8 : bool RTFLookahead::isSubstream() const
116 : {
117 8 : return false;
118 : }
119 :
120 :
121 : } // namespace rtftok
122 : } // namespace writerfilter
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|