1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
12 namespace writerfilter::rtftok
15 * An RTF destination state is the last open destination control word.
17 * Note that this is not a 1:1 mapping between destination control
18 * words, e.g. RTF_PICT gets mapped to Destination::PICT or
19 * Destination::SHAPEPROPERTYVALUEPICT.
21 enum class Destination
50 SHAPEPROPERTYVALUEPICT
,
51 NESTEDTABLEPROPERTIES
,
82 PARAGRAPHNUMBERING_TEXTBEFORE
,
83 PARAGRAPHNUMBERING_TEXTAFTER
,
88 ANNOTATIONREFERENCESTART
,
89 ANNOTATIONREFERENCEEND
,
162 enum class RTFKeyword
1058 MMMAINTYPEENVELOPES
,
1472 READONLYRECOMMENDED
,
1979 const char* keywordToString(RTFKeyword nKeyword
);
1981 /// Types of an RTF Control Word
1982 enum class RTFControlType
1984 FLAG
, // eg \sbknone takes no parameter
1985 DESTINATION
, // eg \fonttbl, if ignored, the whole group should be skipped
1987 TOGGLE
, // eg \b (between on and off)
1988 VALUE
// eg \fs (requires parameter)
1991 /// Represents an RTF Control Word
1994 const char* m_sKeyword
;
1995 RTFControlType m_eControlType
;
1996 RTFKeyword m_nIndex
;
1998 int m_nDefValue
; ///< Most of the control words default to 0.
2001 RTFSymbol(const char* sKeyword
, RTFControlType nControlType
, RTFKeyword nIndex
, int nDefValue
)
2002 : m_sKeyword(sKeyword
)
2003 , m_eControlType(nControlType
)
2005 , m_nDefValue(nDefValue
)
2009 const char* GetKeyword() const { return m_sKeyword
; }
2011 RTFControlType
GetControlType() const { return m_eControlType
; }
2013 RTFKeyword
GetIndex() const { return m_nIndex
; }
2015 int GetDefValue() const { return m_nDefValue
; }
2018 extern RTFSymbol
const aRTFControlWords
[];
2019 extern const int nRTFControlWords
;
2021 /// Represents an RTF Math Control Word
2024 RTFKeyword m_eKeyword
;
2025 int m_nToken
; ///< This is the OOXML token equivalent.
2026 Destination m_eDestination
;
2029 RTFMathSymbol(RTFKeyword eKeyword
, int nToken
= 0,
2030 Destination eDestination
= Destination::NORMAL
)
2031 : m_eKeyword(eKeyword
)
2033 , m_eDestination(eDestination
)
2037 int GetToken() const { return m_nToken
; }
2039 Destination
GetDestination() const { return m_eDestination
; }
2041 bool operator<(const RTFMathSymbol
& rOther
) const;
2044 extern RTFMathSymbol
const aRTFMathControlWords
[];
2045 extern const int nRTFMathControlWords
;
2047 } // namespace writerfilter::rtftok
2049 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */