LibreOffice Module writerfilter (master) 1
rtflookahead.cxx
Go to the documentation of this file.
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 <com/sun/star/uno/Reference.hxx>
12#include <tools/stream.hxx>
13#include "rtftokenizer.hxx"
14
16{
17class XStatusIndicator;
18}
19
20using namespace com::sun::star;
21
23{
24RTFLookahead::RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart)
25 : m_rStream(rStream)
26 , m_bHasTable(false)
27 , m_bHasColumns(false)
28{
29 sal_uInt64 const nPos = m_rStream.Tell();
30 m_rStream.Seek(nGroupStart);
32 m_pTokenizer = new RTFTokenizer(*this, &m_rStream, xStatusIndicator);
33 m_pTokenizer->resolveParse();
35}
36
38
40
42{
43 if (nKeyword == RTFKeyword::INTBL)
44 m_bHasTable = true;
45 return RTFError::OK;
46}
47
49
50RTFError RTFLookahead::dispatchToggle(RTFKeyword /*nKeyword*/, bool /*bParam*/, int /*nParam*/)
51{
52 return RTFError::OK;
53}
54
56{
57 if (nKeyword == RTFKeyword::COLS && nParam >= 2)
58 m_bHasColumns = true;
59 return RTFError::OK;
60}
61
63{
64 while (!m_rStream.eof() && (ch != '{' && ch != '}' && ch != '\\'))
66 if (!m_rStream.eof())
68 return RTFError::OK;
69}
70
72{
73 m_pTokenizer->pushGroup();
74 return RTFError::OK;
75}
76
78{
79 m_pTokenizer->popGroup();
80 return RTFError::OK;
81}
82
84
86
88
90
91bool RTFLookahead::getSkipUnknown() { return false; }
92
93void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/) {}
94
96
97bool RTFLookahead::isSubstream() const { return false; }
98
99} // namespace writerfilter::rtftok
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 Tell() const
bool eof() const
SvStream & ReadChar(char &rChar)
sal_uInt64 Seek(sal_uInt64 nPos)
sal_uInt64 SeekRel(sal_Int64 nPos)
RTFError dispatchDestination(RTFKeyword nKeyword) override
bool isSubstream() const override
void setSkipUnknown(bool bSkipUnknown) override
void setInternalState(RTFInternalState nInternalState) override
RTFError resolveChars(char ch) override
tools::SvRef< RTFTokenizer > m_pTokenizer
RTFLookahead(SvStream &rStream, sal_uInt64 nGroupStart)
Destination getDestination() override
RTFError dispatchFlag(RTFKeyword nKeyword) override
void setDestination(Destination eDestination) override
RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) override
RTFInternalState getInternalState() override
RTFError dispatchValue(RTFKeyword nKeyword, int nParam) override
RTFError dispatchSymbol(RTFKeyword nKeyword) override
RTF tokenizer that separates control words from text.
sal_uInt16 nPos
Destination
An RTF destination state is the last open destination control word.