lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / rtftok / rtflookahead.cxx
blobd60057d52bb1e1fb2df47a75c6ce4950bafde3d3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include "rtflookahead.hxx"
11 #include <com/sun/star/uno/Reference.hxx>
12 #include <tools/stream.hxx>
13 #include "rtftokenizer.hxx"
15 namespace com
17 namespace sun
19 namespace star
21 namespace task
23 class XStatusIndicator;
29 using namespace com::sun::star;
31 namespace writerfilter
33 namespace rtftok
35 RTFLookahead::RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart)
36 : m_rStream(rStream)
37 , m_bHasTable(false)
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();
45 m_rStream.Seek(nPos);
48 RTFLookahead::~RTFLookahead() = default;
50 RTFError RTFLookahead::dispatchDestination(RTFKeyword /*nKeyword*/) { return RTFError::OK; }
52 RTFError RTFLookahead::dispatchFlag(RTFKeyword nKeyword)
54 if (nKeyword == RTF_INTBL)
55 m_bHasTable = true;
56 return RTFError::OK;
59 RTFError RTFLookahead::dispatchSymbol(RTFKeyword /*nKeyword*/) { return RTFError::OK; }
61 RTFError RTFLookahead::dispatchToggle(RTFKeyword /*nKeyword*/, bool /*bParam*/, int /*nParam*/)
63 return RTFError::OK;
66 RTFError RTFLookahead::dispatchValue(RTFKeyword nKeyword, int nParam)
68 if (nKeyword == RTF_COLS && nParam >= 2)
69 m_bHasColumns = true;
70 return RTFError::OK;
73 RTFError RTFLookahead::resolveChars(char ch)
75 while (!m_rStream.eof() && (ch != '{' && ch != '}' && ch != '\\'))
76 m_rStream.ReadChar(ch);
77 if (!m_rStream.eof())
78 m_rStream.SeekRel(-1);
79 return RTFError::OK;
82 RTFError RTFLookahead::pushState()
84 m_pTokenizer->pushGroup();
85 return RTFError::OK;
88 RTFError RTFLookahead::popState()
90 m_pTokenizer->popGroup();
91 return RTFError::OK;
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: */