Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / rtftok / rtflookahead.hxx
blob9ec213f624c37b01475b2aaa4f25621635233fcf
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 #pragma once
12 #include <sal/types.h>
13 #include <tools/ref.hxx>
14 #include "rtflistener.hxx"
16 class SvStream;
18 namespace writerfilter::rtftok
20 class RTFTokenizer;
21 /**
22 * This acts like an importer, but used for looking ahead, e.g. to
23 * determine if the current group contains a table, etc.
25 class RTFLookahead : public RTFListener
27 public:
28 RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart);
29 ~RTFLookahead() override;
30 RTFError dispatchDestination(RTFKeyword nKeyword) override;
31 RTFError dispatchFlag(RTFKeyword nKeyword) override;
32 RTFError dispatchSymbol(RTFKeyword nKeyword) override;
33 RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) override;
34 RTFError dispatchValue(RTFKeyword nKeyword, int nParam) override;
35 RTFError resolveChars(char ch) override;
36 RTFError pushState() override;
37 RTFError popState() override;
38 Destination getDestination() override;
39 void setDestination(Destination eDestination) override;
40 RTFInternalState getInternalState() override;
41 void setInternalState(RTFInternalState nInternalState) override;
42 bool getSkipUnknown() override;
43 void setSkipUnknown(bool bSkipUnknown) override;
44 void finishSubstream() override;
45 bool isSubstream() const override;
46 bool hasTable() const { return m_bHasTable; }
47 bool hasColumns() const { return m_bHasColumns; }
49 private:
50 tools::SvRef<RTFTokenizer> m_pTokenizer;
51 SvStream& m_rStream;
52 bool m_bHasTable;
53 bool m_bHasColumns;
55 } // namespace writerfilter::rtftok
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */