1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include "rtflookahead.hxx"
11 #include <com/sun/star/uno/Reference.hxx>
12 #include <tools/stream.hxx>
13 #include "rtftokenizer.hxx"
23 class XStatusIndicator
;
29 using namespace com::sun::star
;
31 namespace writerfilter
35 RTFLookahead::RTFLookahead(SvStream
& rStream
, sal_uInt64 nGroupStart
)
38 , m_bHasColumns(false)
40 sal_uInt64
const nPos
= m_rStream
.Tell();
41 m_rStream
.Seek(nGroupStart
);
42 uno::Reference
<task::XStatusIndicator
> xStatusIndicator
;
43 m_pTokenizer
= new RTFTokenizer(*this, &m_rStream
, xStatusIndicator
);
44 m_pTokenizer
->resolveParse();
48 RTFLookahead::~RTFLookahead() = default;
50 RTFError
RTFLookahead::dispatchDestination(RTFKeyword
/*nKeyword*/) { return RTFError::OK
; }
52 RTFError
RTFLookahead::dispatchFlag(RTFKeyword nKeyword
)
54 if (nKeyword
== RTF_INTBL
)
59 RTFError
RTFLookahead::dispatchSymbol(RTFKeyword
/*nKeyword*/) { return RTFError::OK
; }
61 RTFError
RTFLookahead::dispatchToggle(RTFKeyword
/*nKeyword*/, bool /*bParam*/, int /*nParam*/)
66 RTFError
RTFLookahead::dispatchValue(RTFKeyword nKeyword
, int nParam
)
68 if (nKeyword
== RTF_COLS
&& nParam
>= 2)
73 RTFError
RTFLookahead::resolveChars(char ch
)
75 while (!m_rStream
.eof() && (ch
!= '{' && ch
!= '}' && ch
!= '\\'))
76 m_rStream
.ReadChar(ch
);
78 m_rStream
.SeekRel(-1);
82 RTFError
RTFLookahead::pushState()
84 m_pTokenizer
->pushGroup();
88 RTFError
RTFLookahead::popState()
90 m_pTokenizer
->popGroup();
94 Destination
RTFLookahead::getDestination() { return Destination::NORMAL
; }
96 void RTFLookahead::setDestination(Destination
/*eDestination*/) {}
98 RTFInternalState
RTFLookahead::getInternalState() { return RTFInternalState::NORMAL
; }
100 void RTFLookahead::setInternalState(RTFInternalState
/*nInternalState*/) {}
102 bool RTFLookahead::getSkipUnknown() { return false; }
104 void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/) {}
106 void RTFLookahead::finishSubstream() {}
108 bool RTFLookahead::isSubstream() const { return false; }
110 } // namespace rtftok
111 } // namespace writerfilter
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */