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