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"
15 namespace com::sun::star::task
17 class XStatusIndicator
;
20 using namespace com::sun::star
;
22 namespace writerfilter::rtftok
24 RTFLookahead::RTFLookahead(SvStream
& rStream
, sal_uInt64 nGroupStart
)
27 , m_bHasColumns(false)
29 sal_uInt64
const nPos
= m_rStream
.Tell();
30 m_rStream
.Seek(nGroupStart
);
31 uno::Reference
<task::XStatusIndicator
> xStatusIndicator
;
32 m_pTokenizer
= new RTFTokenizer(*this, &m_rStream
, xStatusIndicator
);
33 m_pTokenizer
->resolveParse();
37 RTFLookahead::~RTFLookahead() = default;
39 RTFError
RTFLookahead::dispatchDestination(RTFKeyword
/*nKeyword*/) { return RTFError::OK
; }
41 RTFError
RTFLookahead::dispatchFlag(RTFKeyword nKeyword
)
43 if (nKeyword
== RTFKeyword::INTBL
)
48 RTFError
RTFLookahead::dispatchSymbol(RTFKeyword
/*nKeyword*/) { return RTFError::OK
; }
50 RTFError
RTFLookahead::dispatchToggle(RTFKeyword
/*nKeyword*/, bool /*bParam*/, int /*nParam*/)
55 RTFError
RTFLookahead::dispatchValue(RTFKeyword nKeyword
, int nParam
)
57 if (nKeyword
== RTFKeyword::COLS
&& nParam
>= 2)
62 RTFError
RTFLookahead::resolveChars(char ch
)
64 while (!m_rStream
.eof() && (ch
!= '{' && ch
!= '}' && ch
!= '\\'))
65 m_rStream
.ReadChar(ch
);
67 m_rStream
.SeekRel(-1);
71 RTFError
RTFLookahead::pushState()
73 m_pTokenizer
->pushGroup();
77 RTFError
RTFLookahead::popState()
79 m_pTokenizer
->popGroup();
83 Destination
RTFLookahead::getDestination() { return Destination::NORMAL
; }
85 void RTFLookahead::setDestination(Destination
/*eDestination*/) {}
87 RTFInternalState
RTFLookahead::getInternalState() { return RTFInternalState::NORMAL
; }
89 void RTFLookahead::setInternalState(RTFInternalState
/*nInternalState*/) {}
91 bool RTFLookahead::getSkipUnknown() { return false; }
93 void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/) {}
95 void RTFLookahead::finishSubstream() {}
97 bool RTFLookahead::isSubstream() const { return false; }
99 } // namespace writerfilter::rtftok
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */