LibreOffice Module writerfilter (master) 1
rtftokenizer.hxx
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#pragma once
11
12#include "rtflistener.hxx"
13
14#include <vector>
15#include <unordered_map>
16
17#include <com/sun/star/uno/Reference.h>
18
19#include <rtl/ustring.hxx>
20#include <tools/ref.hxx>
21
23{
24class XStatusIndicator;
25}
26class SvStream;
27
29{
31class RTFTokenizer final : public virtual SvRefBase
32{
33public:
34 RTFTokenizer(RTFListener& rImport, SvStream* pInStream,
35 css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator);
36 ~RTFTokenizer() override;
37
40 int getGroup() const { return m_nGroup; }
42 void pushGroup();
44 void popGroup();
45 OUString getPosition();
46 std::size_t getGroupStart() const { return m_nGroupStart; }
48 static bool lookupMathKeyword(RTFMathSymbol& rSymbol);
49
50private:
51 SvStream& Strm() { return *m_pInStream; }
53 RTFError dispatchKeyword(OString const& rKeyword, bool bParam, int nParam);
54
57 css::uno::Reference<css::task::XStatusIndicator> const& m_xStatusIndicator;
58 // This is the same as aRTFControlWords, but mapped by token name for fast lookup
59 static std::unordered_map<OString, RTFSymbol> s_aRTFControlWords;
61 // This is the same as aRTFMathControlWords, but sorted
62 static std::vector<RTFMathSymbol> s_aRTFMathControlWords;
66 sal_Int32 m_nLineNumber;
67 std::size_t m_nLineStartPos;
68 std::size_t m_nGroupStart;
69};
70} // namespace writerfilter::rtftok
71
72/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RTFTokenizer needs a class implementing this interface.
Definition: rtflistener.hxx:41
Represents an RTF Math Control Word.
RTF tokenizer that separates control words from text.
void pushGroup()
To be invoked by the pushState() callback to signal when the importer enters a group.
int getGroup() const
Number of states on the stack.
int m_nGroup
Same as the size of the importer's states, except that this can be negative for invalid input.
static std::vector< RTFMathSymbol > s_aRTFMathControlWords
RTFTokenizer(RTFListener &rImport, SvStream *pInStream, css::uno::Reference< css::task::XStatusIndicator > const &xStatusIndicator)
static bool lookupMathKeyword(RTFMathSymbol &rSymbol)
To look up additional properties of a math symbol.
void popGroup()
To be invoked by the popState() callback to signal when the importer leaves a group.
RTFError dispatchKeyword(OString const &rKeyword, bool bParam, int nParam)
static std::unordered_map< OString, RTFSymbol > s_aRTFControlWords
css::uno::Reference< css::task::XStatusIndicator > const & m_xStatusIndicator