14#include <svx/strings.hrc>
15#include <rtl/strbuf.hxx>
16#include <rtl/character.hxx>
19#include <com/sun/star/io/BufferSizeExceededException.hpp>
20#include <com/sun/star/task/XStatusIndicator.hpp>
35 , m_pInStream(pInStream)
36 , m_xStatusIndicator(xStatusIndicator)
62 SAL_INFO(
"writerfilter.rtf", __func__);
68 std::size_t nPercentSize = 0;
69 sal_uInt64 nLastPos = 0;
73 OUString sDocLoad(
SvxResId(RID_SVXSTR_DOC_LOAD));
75 sal_uInt64
const nCurrentPos =
Strm().
Tell();
78 nPercentSize = nEndPos / 100;
80 nLastPos = nCurrentPos;
88 sal_uInt64
const nCurrentPos =
Strm().
Tell();
91 nLastPos = nCurrentPos;
146 SAL_INFO(
"writerfilter.rtf", __func__ <<
": hex internal state");
148 if (rtl::isAsciiDigit(
static_cast<unsigned char>(
ch))
149 || (
ch >=
'a' &&
ch <=
'f') || (
ch >=
'A' &&
ch <=
'F'))
192 if (!rtl::isAsciiAlpha(
static_cast<unsigned char>(
ch)))
198 OStringBuffer
aBuf(32);
199 while (rtl::isAsciiAlpha(
static_cast<unsigned char>(
ch)))
202 if (
aBuf.getLength() > 32)
205 throw io::BufferSizeExceededException();
225 if (rtl::isAsciiDigit(
static_cast<unsigned char>(
ch)))
227 OStringBuffer aParameter;
231 while (rtl::isAsciiDigit(
static_cast<unsigned char>(
ch)))
233 aParameter.append(
ch);
247 OString aKeyword =
aBuf.makeStringAndClear();
267 if (rKeyword ==
"bin" && nParam > 0)
271 SAL_INFO(
"writerfilter.rtf", __func__ <<
": keyword '\\" << rKeyword <<
"' with param? "
272 << (bParam ? 1 : 0) <<
" param val: '"
273 << (bParam ? nParam : 0) <<
"'");
277 SAL_INFO(
"writerfilter.rtf", __func__ <<
": unknown keyword '\\" << rKeyword <<
"'");
284 RTFSymbol const& rSymbol = findIt->second;
const SvXMLImport & m_rImport
SvStream & ReadChar(char &rChar)
sal_uInt64 SeekRel(sal_Int64 nPos)
sal_uInt64 remainingSize()
RTFTokenizer needs a class implementing this interface.
virtual RTFError resolveChars(char ch)=0
virtual RTFInternalState getInternalState()=0
virtual bool isSubstream() const =0
virtual RTFError pushState()=0
virtual RTFError dispatchSymbol(RTFKeyword nKeyword)=0
virtual Destination getDestination()=0
virtual void finishSubstream()=0
virtual RTFError popState()=0
virtual RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam)=0
virtual RTFError dispatchValue(RTFKeyword nKeyword, int nParam)=0
virtual RTFError dispatchDestination(RTFKeyword nKeyword)=0
virtual RTFError dispatchFlag(RTFKeyword nKeyword)=0
virtual void setInternalState(RTFInternalState nInternalState)=0
Represents an RTF Math Control Word.
Skips a destination after a not parsed control word if it was prefixed with *.
void setParsed(bool bParsed)
Represents an RTF Control Word.
RTFControlType GetControlType() const
RTFKeyword GetIndex() const
std::size_t m_nGroupStart
void pushGroup()
To be invoked by the pushState() callback to signal when the importer enters a group.
RTFError resolveKeyword()
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.
static bool s_bMathControlWordsSorted
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)
std::size_t m_nLineStartPos
static std::unordered_map< OString, RTFSymbol > s_aRTFControlWords
static bool s_bControlWordsInitialised
css::uno::Reference< css::task::XStatusIndicator > const & m_xStatusIndicator
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
#define SAL_INFO(area, stream)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
RTFMathSymbol const aRTFMathControlWords[]
const int nRTFMathControlWords
RTFSymbol const aRTFControlWords[]
const int nRTFControlWords