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