diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-22 09:20:23 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-22 11:24:24 +0100 |
commit | fd6150915253e382a7e9f674fe23a72a9a801761 (patch) | |
tree | aa76c8e0cd09eaa2cafbf7897fe48eb42a0886ec /writerfilter | |
parent | 9ffa900cb4d0381587162e3deb9d910965b69d58 (diff) |
RTF filter: drop now redundant astyle.options
I (tried to) keep the RTF filter style consistent locally with astyle in
the past, but now that's redundant when we have an enforcing
clang-format mechanism in place. So drop the astyle config and switch to
clang-format in the RTF filter case.
To minimize backport pain, do this shortly before the libreoffice-6-0
branch-off.
Change-Id: I708dbeb0b5ad2afacc90029ee5abba9495f4601f
Diffstat (limited to 'writerfilter')
31 files changed, 7531 insertions, 7278 deletions
diff --git a/writerfilter/inc/rtftok/RTFDocument.hxx b/writerfilter/inc/rtftok/RTFDocument.hxx index 2ee3f5fbba41..f35d337413db 100644 --- a/writerfilter/inc/rtftok/RTFDocument.hxx +++ b/writerfilter/inc/rtftok/RTFDocument.hxx @@ -22,8 +22,7 @@ namespace writerfilter namespace rtftok { /// The RTFDocument opens and resolves the RTF document. -class RTFDocument - : public writerfilter::Reference<Stream> +class RTFDocument : public writerfilter::Reference<Stream> { public: /// Pointer to this stream. diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx index e380728b3c30..020086a1187e 100644 --- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx +++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx @@ -25,23 +25,20 @@ using namespace ::com::sun::star; * the expected bool value for given inputs. More fine-grained tests can be * found under sw/qa/extras/rtfimport/. */ -class RtfTest - : public test::FiltersTest - , public test::BootstrapFixture +class RtfTest : public test::FiltersTest, public test::BootstrapFixture { public: - virtual void setUp() override; - virtual bool load(const OUString&, - const OUString& rURL, const OUString&, - SfxFilterFlags, SotClipboardFormatId, unsigned int) override; + virtual bool load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags, + SotClipboardFormatId, unsigned int) override; void test(); CPPUNIT_TEST_SUITE(RtfTest); CPPUNIT_TEST(test); CPPUNIT_TEST_SUITE_END(); + private: uno::Reference<document::XFilter> m_xFilter; }; @@ -50,17 +47,15 @@ void RtfTest::setUp() { test::BootstrapFixture::setUp(); - m_xFilter.set(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + m_xFilter.set(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + uno::UNO_QUERY_THROW); } -bool RtfTest::load(const OUString&, - const OUString& rURL, const OUString&, - SfxFilterFlags, SotClipboardFormatId, unsigned int) +bool RtfTest::load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags, + SotClipboardFormatId, unsigned int) { - uno::Sequence< beans::PropertyValue > aDescriptor = - { - beans::PropertyValue("URL", sal_Int32(0), uno::makeAny(rURL), beans::PropertyState_DIRECT_VALUE) - }; + uno::Sequence<beans::PropertyValue> aDescriptor = { beans::PropertyValue( + "URL", sal_Int32(0), uno::makeAny(rURL), beans::PropertyState_DIRECT_VALUE) }; try { return m_xFilter->filter(aDescriptor); @@ -83,8 +78,7 @@ bool RtfTest::load(const OUString&, void RtfTest::test() { #ifndef DISABLE_CVE_TESTS - testDir(OUString(), - m_directories.getURLFromSrc("/writerfilter/qa/cppunittests/rtftok/data/")); + testDir(OUString(), m_directories.getURLFromSrc("/writerfilter/qa/cppunittests/rtftok/data/")); #endif } diff --git a/writerfilter/source/rtftok/README b/writerfilter/source/rtftok/README index 0a554bbd299c..4adbb7563b8b 100644 --- a/writerfilter/source/rtftok/README +++ b/writerfilter/source/rtftok/README @@ -10,14 +10,3 @@ grep M_TOKEN starmath/source/ooxmlimport.cxx |sed 's/.*\(M_TOKEN(\) /\1/;s/ ).*/ grep '[^_]M_TOKEN' writerfilter/source/rtftok/rtfdocumentimpl.cxx |sed 's/.*\(M_TOKEN(\)/\1/;s/).*/)/'|sort -u > ~/wf-export-list diff -u ~/math-import-list ~/wf-export-list |grep ^-M_TOKEN ---- - -== Coding style - -This directory uses mostly the same coding style like the rest of Fridrich's -libraries. Please run - ----- -astyle --options=astyle.options \*.cxx \*.hxx ----- - -before committing. diff --git a/writerfilter/source/rtftok/astyle.options b/writerfilter/source/rtftok/astyle.options deleted file mode 100644 index e62db1007c6b..000000000000 --- a/writerfilter/source/rtftok/astyle.options +++ /dev/null @@ -1,11 +0,0 @@ -# formatting options -style=allman -indent=spaces=4 -align-pointer=type -break-closing-brackets -pad-header -unpad-paren - -# processing options -recursive -suffix=none diff --git a/writerfilter/source/rtftok/rtfcharsets.cxx b/writerfilter/source/rtftok/rtfcharsets.cxx index 91cd16d26b96..5168a3627d2f 100644 --- a/writerfilter/source/rtftok/rtfcharsets.cxx +++ b/writerfilter/source/rtftok/rtfcharsets.cxx @@ -14,42 +14,40 @@ namespace writerfilter { namespace rtftok { - // See RTF spec v1.9.1, page 19 -RTFEncoding aRTFEncodings[] = -{ +RTFEncoding aRTFEncodings[] = { // charset codepage Windows / Mac name - {0, 1252}, // ANSI - {1, 0}, // Default - {2, 42}, // Symbol - {77, 10000}, // Mac Roman - {78, 10001}, // Mac Shift Jis - {79, 10003}, // Mac Hangul - {80, 10008}, // Mac GB2312 - {81, 10002}, // Mac Big5 - {83, 10005}, // Mac Herbrew - {84, 10004}, // Mac Arabic - {85, 10006}, // Mac Greek - {86, 10081}, // Mac Turkish - {87, 10021}, // Mac Thai - {88, 10029}, // Mac East Europe - {89, 10007}, // Mac Russian - {128, 932}, // Shift JIS - {129, 949}, // Hangul - {130, 1361}, // Johab - {134, 936}, // GB2312 - {136, 950}, // Big5 - {161, 1253}, // Greek - {162, 1254}, // Turkish - {163, 1258}, // Vietnamese - {177, 1255}, // Herbrew - {178, 1256}, // Arabic - {186, 1257}, // Baltic - {204, 1251}, // Russian - {222, 874}, // Thai - {238, 1250}, // Eastern European - {254, 437}, // PC 437 - {255, 850}, // OEM + { 0, 1252 }, // ANSI + { 1, 0 }, // Default + { 2, 42 }, // Symbol + { 77, 10000 }, // Mac Roman + { 78, 10001 }, // Mac Shift Jis + { 79, 10003 }, // Mac Hangul + { 80, 10008 }, // Mac GB2312 + { 81, 10002 }, // Mac Big5 + { 83, 10005 }, // Mac Herbrew + { 84, 10004 }, // Mac Arabic + { 85, 10006 }, // Mac Greek + { 86, 10081 }, // Mac Turkish + { 87, 10021 }, // Mac Thai + { 88, 10029 }, // Mac East Europe + { 89, 10007 }, // Mac Russian + { 128, 932 }, // Shift JIS + { 129, 949 }, // Hangul + { 130, 1361 }, // Johab + { 134, 936 }, // GB2312 + { 136, 950 }, // Big5 + { 161, 1253 }, // Greek + { 162, 1254 }, // Turkish + { 163, 1258 }, // Vietnamese + { 177, 1255 }, // Herbrew + { 178, 1256 }, // Arabic + { 186, 1257 }, // Baltic + { 204, 1251 }, // Russian + { 222, 874 }, // Thai + { 238, 1250 }, // Eastern European + { 254, 437 }, // PC 437 + { 255, 850 }, // OEM }; int nRTFEncodings = SAL_N_ELEMENTS(aRTFEncodings); diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx index d5d39d4c400c..26e1d4366f2b 100644 --- a/writerfilter/source/rtftok/rtfcontrolwords.cxx +++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx @@ -16,1835 +16,1833 @@ namespace writerfilter { namespace rtftok { - -RTFSymbol aRTFControlWords[] = -{ +RTFSymbol aRTFControlWords[] = { // sKeyword nControlType nIndex - {"'", CONTROL_SYMBOL, RTF_HEXCHAR}, - {"-", CONTROL_SYMBOL, RTF_OPTHYPH}, - {"*", CONTROL_SYMBOL, RTF_IGNORE}, - {":", CONTROL_SYMBOL, RTF_SUBENTRY}, - {"\\", CONTROL_SYMBOL, RTF_BACKSLASH}, - {"\n", CONTROL_SYMBOL, RTF_PAR}, - {"\r", CONTROL_SYMBOL, RTF_PAR}, - {"\r\n", CONTROL_SYMBOL, RTF_PAR}, - {"_", CONTROL_SYMBOL, RTF_NOBRKHYPH}, - {"{", CONTROL_SYMBOL, RTF_LBRACE}, - {"|", CONTROL_SYMBOL, RTF_FORMULA}, - {"}", CONTROL_SYMBOL, RTF_RBRACE}, - {"~", CONTROL_SYMBOL, RTF_NOBREAK}, - {"ab", CONTROL_TOGGLE, RTF_AB}, - {"absh", CONTROL_VALUE, RTF_ABSH}, - {"abslock", CONTROL_FLAG, RTF_ABSLOCK}, - {"absnoovrlp", CONTROL_TOGGLE, RTF_ABSNOOVRLP}, - {"absw", CONTROL_VALUE, RTF_ABSW}, - {"acaps", CONTROL_TOGGLE, RTF_ACAPS}, - {"acccircle", CONTROL_TOGGLE, RTF_ACCCIRCLE}, - {"acccomma", CONTROL_TOGGLE, RTF_ACCCOMMA}, - {"accdot", CONTROL_TOGGLE, RTF_ACCDOT}, - {"accnone", CONTROL_TOGGLE, RTF_ACCNONE}, - {"accunderdot", CONTROL_TOGGLE, RTF_ACCUNDERDOT}, - {"acf", CONTROL_VALUE, RTF_ACF}, - {"adeff", CONTROL_VALUE, RTF_ADEFF}, - {"additive", CONTROL_FLAG, RTF_ADDITIVE}, - {"adeflang", CONTROL_VALUE, RTF_ADEFLANG}, - {"adjustright", CONTROL_FLAG, RTF_ADJUSTRIGHT}, - {"adn", CONTROL_VALUE, RTF_ADN}, - {"aenddoc", CONTROL_FLAG, RTF_AENDDOC}, - {"aendnotes", CONTROL_FLAG, RTF_AENDNOTES}, - {"aexpnd", CONTROL_VALUE, RTF_AEXPND}, - {"af", CONTROL_VALUE, RTF_AF}, - {"afelev", CONTROL_FLAG, RTF_AFELEV}, - {"afs", CONTROL_VALUE, RTF_AFS}, - {"aftnbj", CONTROL_FLAG, RTF_AFTNBJ}, - {"aftncn", CONTROL_DESTINATION, RTF_AFTNCN}, - {"aftnnalc", CONTROL_FLAG, RTF_AFTNNALC}, - {"aftnnar", CONTROL_FLAG, RTF_AFTNNAR}, - {"aftnnauc", CONTROL_FLAG, RTF_AFTNNAUC}, - {"aftnnchi", CONTROL_FLAG, RTF_AFTNNCHI}, - {"aftnnchosung", CONTROL_FLAG, RTF_AFTNNCHOSUNG}, - {"aftnncnum", CONTROL_FLAG, RTF_AFTNNCNUM}, - {"aftnndbar", CONTROL_FLAG, RTF_AFTNNDBAR}, - {"aftnndbnum", CONTROL_FLAG, RTF_AFTNNDBNUM}, - {"aftnndbnumd", CONTROL_FLAG, RTF_AFTNNDBNUMD}, - {"aftnndbnumk", CONTROL_FLAG, RTF_AFTNNDBNUMK}, - {"aftnndbnumt", CONTROL_FLAG, RTF_AFTNNDBNUMT}, - {"aftnnganada", CONTROL_FLAG, RTF_AFTNNGANADA}, - {"aftnngbnum", CONTROL_FLAG, RTF_AFTNNGBNUM}, - {"aftnngbnumd", CONTROL_FLAG, RTF_AFTNNGBNUMD}, - {"aftnngbnumk", CONTROL_FLAG, RTF_AFTNNGBNUMK}, - {"aftnngbnuml", CONTROL_FLAG, RTF_AFTNNGBNUML}, - {"aftnnrlc", CONTROL_FLAG, RTF_AFTNNRLC}, - {"aftnnruc", CONTROL_FLAG, RTF_AFTNNRUC}, - {"aftnnzodiac", CONTROL_FLAG, RTF_AFTNNZODIAC}, - {"aftnnzodiacd", CONTROL_FLAG, RTF_AFTNNZODIACD}, - {"aftnnzodiacl", CONTROL_FLAG, RTF_AFTNNZODIACL}, - {"aftnrestart", CONTROL_FLAG, RTF_AFTNRESTART}, - {"aftnrstcont", CONTROL_FLAG, RTF_AFTNRSTCONT}, - {"aftnsep", CONTROL_DESTINATION, RTF_AFTNSEP}, - {"aftnsepc", CONTROL_DESTINATION, RTF_AFTNSEPC}, - {"aftnstart", CONTROL_VALUE, RTF_AFTNSTART}, - {"aftntj", CONTROL_FLAG, RTF_AFTNTJ}, - {"ai", CONTROL_TOGGLE, RTF_AI}, - {"alang", CONTROL_VALUE, RTF_ALANG}, - {"allowfieldendsel", CONTROL_FLAG, RTF_ALLOWFIELDENDSEL}, - {"allprot", CONTROL_FLAG, RTF_ALLPROT}, - {"alntblind", CONTROL_FLAG, RTF_ALNTBLIND}, - {"alt", CONTROL_FLAG, RTF_ALT}, - {"animtext", CONTROL_VALUE, RTF_ANIMTEXT}, - {"annotation", CONTROL_DESTINATION, RTF_ANNOTATION}, - {"annotprot", CONTROL_FLAG, RTF_ANNOTPROT}, - {"ansi", CONTROL_FLAG, RTF_ANSI}, - {"ansicpg", CONTROL_VALUE, RTF_ANSICPG}, - {"aoutl", CONTROL_TOGGLE, RTF_AOUTL}, - {"ApplyBrkRules", CONTROL_FLAG, RTF_APPLYBRKRULES}, - {"ascaps", CONTROL_TOGGLE, RTF_ASCAPS}, - {"ashad", CONTROL_TOGGLE, RTF_ASHAD}, - {"asianbrkrule", CONTROL_FLAG, RTF_ASIANBRKRULE}, - {"aspalpha", CONTROL_TOGGLE, RTF_ASPALPHA}, - {"aspnum", CONTROL_TOGGLE, RTF_ASPNUM}, - {"astrike", CONTROL_TOGGLE, RTF_ASTRIKE}, - {"atnauthor", CONTROL_DESTINATION, RTF_ATNAUTHOR}, - {"atndate", CONTROL_DESTINATION, RTF_ATNDATE}, - {"atnicn", CONTROL_DESTINATION, RTF_ATNICN}, - {"atnid", CONTROL_DESTINATION, RTF_ATNID}, - {"atnparent", CONTROL_DESTINATION, RTF_ATNPARENT}, - {"atnref", CONTROL_DESTINATION, RTF_ATNREF}, - {"atntime", CONTROL_DESTINATION, RTF_ATNTIME}, - {"atrfend", CONTROL_DESTINATION, RTF_ATRFEND}, - {"atrfstart", CONTROL_DESTINATION, RTF_ATRFSTART}, - {"aul", CONTROL_TOGGLE, RTF_AUL}, - {"auld", CONTROL_TOGGLE, RTF_AULD}, - {"auldb", CONTROL_TOGGLE, RTF_AULDB}, - {"aulnone", CONTROL_TOGGLE, RTF_AULNONE}, - {"aulw", CONTROL_TOGGLE, RTF_AULW}, - {"aup", CONTROL_VALUE, RTF_AUP}, - {"author", CONTROL_DESTINATION, RTF_AUTHOR}, - {"autofmtoverride", CONTROL_FLAG, RTF_AUTOFMTOVERRIDE}, - {"b", CONTROL_TOGGLE, RTF_B}, - {"background", CONTROL_DESTINATION, RTF_BACKGROUND}, - {"bdbfhdr", CONTROL_FLAG, RTF_BDBFHDR}, - {"bdrrlswsix", CONTROL_FLAG, RTF_BDRRLSWSIX}, - {"bgbdiag", CONTROL_FLAG, RTF_BGBDIAG}, - {"bgcross", CONTROL_FLAG, RTF_BGCROSS}, - {"bgdcross", CONTROL_FLAG, RTF_BGDCROSS}, - {"bgdkbdiag", CONTROL_FLAG, RTF_BGDKBDIAG}, - {"bgdkcross", CONTROL_FLAG, RTF_BGDKCROSS}, - {"bgdkdcross", CONTROL_FLAG, RTF_BGDKDCROSS}, - {"bgdkfdiag", CONTROL_FLAG, RTF_BGDKFDIAG}, - {"bgdkhoriz", CONTROL_FLAG, RTF_BGDKHORIZ}, - {"bgdkvert", CONTROL_FLAG, RTF_BGDKVERT}, - {"bgfdiag", CONTROL_FLAG, RTF_BGFDIAG}, - {"bghoriz", CONTROL_FLAG, RTF_BGHORIZ}, - {"bgvert", CONTROL_FLAG, RTF_BGVERT}, - {"bin", CONTROL_VALUE, RTF_BIN}, - {"binfsxn", CONTROL_VALUE, RTF_BINFSXN}, - {"binsxn", CONTROL_VALUE, RTF_BINSXN}, - {"bkmkcolf", CONTROL_VALUE, RTF_BKMKCOLF}, - {"bkmkcoll", CONTROL_VALUE, RTF_BKMKCOLL}, - {"bkmkend", CONTROL_DESTINATION, RTF_BKMKEND}, - {"bkmkpub", CONTROL_FLAG, RTF_BKMKPUB}, - {"bkmkstart", CONTROL_DESTINATION, RTF_BKMKSTART}, - {"bliptag", CONTROL_VALUE, RTF_BLIPTAG}, - {"blipuid", CONTROL_DESTINATION, RTF_BLIPUID}, - {"blipupi", CONTROL_VALUE, RTF_BLIPUPI}, - {"blue", CONTROL_VALUE, RTF_BLUE}, - {"bookfold", CONTROL_FLAG, RTF_BOOKFOLD}, - {"bookfoldrev", CONTROL_FLAG, RTF_BOOKFOLDREV}, - {"bookfoldsheets", CONTROL_VALUE, RTF_BOOKFOLDSHEETS}, - {"box", CONTROL_FLAG, RTF_BOX}, - {"brdrart", CONTROL_VALUE, RTF_BRDRART}, - {"brdrb", CONTROL_FLAG, RTF_BRDRB}, - {"brdrbar", CONTROL_FLAG, RTF_BRDRBAR}, - {"brdrbtw", CONTROL_FLAG, RTF_BRDRBTW}, - {"brdrcf", CONTROL_VALUE, RTF_BRDRCF}, - {"brdrdash", CONTROL_FLAG, RTF_BRDRDASH}, - {"brdrdashd", CONTROL_FLAG, RTF_BRDRDASHD}, - {"brdrdashdd", CONTROL_FLAG, RTF_BRDRDASHDD}, - {"brdrdashdot", CONTROL_FLAG, RTF_BRDRDASHDOT}, - {"brdrdashdotdot", CONTROL_FLAG, RTF_BRDRDASHDOTDOT}, - {"brdrdashdotstr", CONTROL_FLAG, RTF_BRDRDASHDOTSTR}, - {"brdrdashsm", CONTROL_FLAG, RTF_BRDRDASHSM}, - {"brdrdb", CONTROL_FLAG, RTF_BRDRDB}, - {"brdrdot", CONTROL_FLAG, RTF_BRDRDOT}, - {"brdremboss", CONTROL_FLAG, RTF_BRDREMBOSS}, - {"brdrengrave", CONTROL_FLAG, RTF_BRDRENGRAVE}, - {"brdrframe", CONTROL_FLAG, RTF_BRDRFRAME}, - {"brdrhair", CONTROL_FLAG, RTF_BRDRHAIR}, - {"brdrinset", CONTROL_FLAG, RTF_BRDRINSET}, - {"brdrl", CONTROL_FLAG, RTF_BRDRL}, - {"brdrnil", CONTROL_FLAG, RTF_BRDRNIL}, - {"brdrnone", CONTROL_FLAG, RTF_BRDRNONE}, - {"brdroutset", CONTROL_FLAG, RTF_BRDROUTSET}, - {"brdrr", CONTROL_FLAG, RTF_BRDRR}, - {"brdrs", CONTROL_FLAG, RTF_BRDRS}, - {"brdrsh", CONTROL_FLAG, RTF_BRDRSH}, - {"brdrt", CONTROL_FLAG, RTF_BRDRT}, - {"brdrtbl", CONTROL_FLAG, RTF_BRDRTBL}, - {"brdrth", CONTROL_FLAG, RTF_BRDRTH}, - {"brdrthtnlg", CONTROL_FLAG, RTF_BRDRTHTNLG}, - {"brdrthtnmg", CONTROL_FLAG, RTF_BRDRTHTNMG}, - {"brdrthtnsg", CONTROL_FLAG, RTF_BRDRTHTNSG}, - {"brdrtnthlg", CONTROL_FLAG, RTF_BRDRTNTHLG}, - {"brdrtnthmg", CONTROL_FLAG, RTF_BRDRTNTHMG}, - {"brdrtnthsg", CONTROL_FLAG, RTF_BRDRTNTHSG}, - {"brdrtnthtnlg", CONTROL_FLAG, RTF_BRDRTNTHTNLG}, - {"brdrtnthtnmg", CONTROL_FLAG, RTF_BRDRTNTHTNMG}, - {"brdrtnthtnsg", CONTROL_FLAG, RTF_BRDRTNTHTNSG}, - {"brdrtriple", CONTROL_FLAG, RTF_BRDRTRIPLE}, - {"brdrw", CONTROL_VALUE, RTF_BRDRW}, - {"brdrwavy", CONTROL_FLAG, RTF_BRDRWAVY}, - {"brdrwavydb", CONTROL_FLAG, RTF_BRDRWAVYDB}, - {"brkfrm", CONTROL_FLAG, RTF_BRKFRM}, - {"brsp", CONTROL_VALUE, RTF_BRSP}, - {"bullet", CONTROL_SYMBOL, RTF_BULLET}, - {"buptim", CONTROL_DESTINATION, RTF_BUPTIM}, - {"bxe", CONTROL_FLAG, RTF_BXE}, - {"caccentfive", CONTROL_FLAG, RTF_CACCENTFIVE}, - {"caccentfour", CONTROL_FLAG, RTF_CACCENTFOUR}, - {"caccentone", CONTROL_FLAG, RTF_CACCENTONE}, - {"caccentsix", CONTROL_FLAG, RTF_CACCENTSIX}, - {"caccentthree", CONTROL_FLAG, RTF_CACCENTTHREE}, - {"caccenttwo", CONTROL_FLAG, RTF_CACCENTTWO}, - {"cachedcolbal", CONTROL_FLAG, RTF_CACHEDCOLBAL}, - {"caps", CONTROL_TOGGLE, RTF_CAPS}, - {"category", CONTROL_DESTINATION, RTF_CATEGORY}, - {"cb", CONTROL_VALUE, RTF_CB}, - {"cbackgroundone", CONTROL_FLAG, RTF_CBACKGROUNDONE}, - {"cbackgroundtwo", CONTROL_FLAG, RTF_CBACKGROUNDTWO}, - {"cbpat", CONTROL_VALUE, RTF_CBPAT}, - {"cchs", CONTROL_VALUE, RTF_CCHS}, - {"cell", CONTROL_SYMBOL, RTF_CELL}, - {"cellx", CONTROL_VALUE, RTF_CELLX}, - {"cf", CONTROL_VALUE, RTF_CF}, - {"cfollowedhyperlink", CONTROL_FLAG, RTF_CFOLLOWEDHYPERLINK}, - {"cfpat", CONTROL_VALUE, RTF_CFPAT}, - {"cgrid", CONTROL_VALUE, RTF_CGRID}, - {"charrsid", CONTROL_VALUE, RTF_CHARRSID}, - {"charscalex", CONTROL_VALUE, RTF_CHARSCALEX}, - {"chatn", CONTROL_SYMBOL, RTF_CHATN}, - {"chbgbdiag", CONTROL_FLAG, RTF_CHBGBDIAG}, - {"chbgcross", CONTROL_FLAG, RTF_CHBGCROSS}, - {"chbgdcross", CONTROL_FLAG, RTF_CHBGDCROSS}, - {"chbgdkbdiag", CONTROL_FLAG, RTF_CHBGDKBDIAG}, - {"chbgdkcross", CONTROL_FLAG, RTF_CHBGDKCROSS}, - {"chbgdkdcross", CONTROL_FLAG, RTF_CHBGDKDCROSS}, - {"chbgdkfdiag", CONTROL_FLAG, RTF_CHBGDKFDIAG}, - {"chbgdkhoriz", CONTROL_FLAG, RTF_CHBGDKHORIZ}, - {"chbgdkvert", CONTROL_FLAG, RTF_CHBGDKVERT}, - {"chbgfdiag", CONTROL_FLAG, RTF_CHBGFDIAG}, - {"chbghoriz", CONTROL_FLAG, RTF_CHBGHORIZ}, - {"chbgvert", CONTROL_FLAG, RTF_CHBGVERT}, - {"chbrdr", CONTROL_FLAG, RTF_CHBRDR}, - {"chcbpat", CONTROL_VALUE, RTF_CHCBPAT}, - {"chcfpat", CONTROL_VALUE, RTF_CHCFPAT}, - {"chdate", CONTROL_SYMBOL, RTF_CHDATE}, - {"chdpa", CONTROL_SYMBOL, RTF_CHDPA}, - {"chdpl", CONTROL_SYMBOL, RTF_CHDPL}, - {"chftn", CONTROL_SYMBOL, RTF_CHFTN}, - {"chftnsep", CONTROL_SYMBOL, RTF_CHFTNSEP}, - {"chftnsepc", CONTROL_SYMBOL, RTF_CHFTNSEPC}, - {"chpgn", CONTROL_SYMBOL, RTF_CHPGN}, - {"chhres", CONTROL_VALUE, RTF_CHHRES}, - {"chshdng", CONTROL_VALUE, RTF_CHSHDNG}, - {"chtime", CONTROL_SYMBOL, RTF_CHTIME}, - {"chyperlink", CONTROL_FLAG, RTF_CHYPERLINK}, - {"clbgbdiag", CONTROL_FLAG, RTF_CLBGBDIAG}, - {"clbgcross", CONTROL_FLAG, RTF_CLBGCROSS}, - {"clbgdcross", CONTROL_FLAG, RTF_CLBGDCROSS}, - {"clbgdkbdiag", CONTROL_FLAG, RTF_CLBGDKBDIAG}, - {"clbgdkcross", CONTROL_FLAG, RTF_CLBGDKCROSS}, - {"clbgdkdcross", CONTROL_FLAG, RTF_CLBGDKDCROSS}, - {"clbgdkfdiag", CONTROL_FLAG, RTF_CLBGDKFDIAG}, - {"clbgdkhor", CONTROL_FLAG, RTF_CLBGDKHOR}, - {"clbgdkvert", CONTROL_FLAG, RTF_CLBGDKVERT}, - {"clbgfdiag", CONTROL_FLAG, RTF_CLBGFDIAG}, - {"clbghoriz", CONTROL_FLAG, RTF_CLBGHORIZ}, - {"clbgvert", CONTROL_FLAG, RTF_CLBGVERT}, - {"clbrdrb", CONTROL_FLAG, RTF_CLBRDRB}, - {"clbrdrl", CONTROL_FLAG, RTF_CLBRDRL}, - {"clbrdrr", CONTROL_FLAG, RTF_CLBRDRR}, - {"clbrdrt", CONTROL_FLAG, RTF_CLBRDRT}, - {"clcbpat", CONTROL_VALUE, RTF_CLCBPAT}, - {"clcbpatraw", CONTROL_VALUE, RTF_CLCBPATRAW}, - {"clcfpat", CONTROL_VALUE, RTF_CLCFPAT}, - {"clcfpatraw", CONTROL_VALUE, RTF_CLCFPATRAW}, - {"cldel", CONTROL_FLAG, RTF_CLDEL}, - {"cldelauth", CONTROL_VALUE, RTF_CLDELAUTH}, - {"cldeldttm", CONTROL_VALUE, RTF_CLDELDTTM}, - {"cldgll", CONTROL_FLAG, RTF_CLDGLL}, - {"cldglu", CONTROL_FLAG, RTF_CLDGLU}, - {"clFitText", CONTROL_FLAG, RTF_CLFITTEXT}, - {"clftsWidth", CONTROL_VALUE, RTF_CLFTSWIDTH}, - {"clhidemark", CONTROL_FLAG, RTF_CLHIDEMARK}, - {"clins", CONTROL_FLAG, RTF_CLINS}, - {"clinsauth", CONTROL_VALUE, RTF_CLINSAUTH}, - {"clinsdttm", CONTROL_VALUE, RTF_CLINSDTTM}, - {"clmgf", CONTROL_FLAG, RTF_CLMGF}, - {"clmrg", CONTROL_FLAG, RTF_CLMRG}, - {"clmrgd", CONTROL_FLAG, RTF_CLMRGD}, - {"clmrgdauth", CONTROL_VALUE, RTF_CLMRGDAUTH}, - {"clmrgddttm", CONTROL_VALUE, RTF_CLMRGDDTTM}, - {"clmrgdr", CONTROL_FLAG, RTF_CLMRGDR}, - {"clNoWrap", CONTROL_FLAG, RTF_CLNOWRAP}, - {"clpadb", CONTROL_VALUE, RTF_CLPADB}, - {"clpadfb", CONTROL_VALUE, RTF_CLPADFB}, - {"clpadfl", CONTROL_VALUE, RTF_CLPADFL}, - {"clpadfr", CONTROL_VALUE, RTF_CLPADFR}, - {"clpadft", CONTROL_VALUE, RTF_CLPADFT}, - {"clpadl", CONTROL_VALUE, RTF_CLPADL}, - {"clpadr", CONTROL_VALUE, RTF_CLPADR}, - {"clpadt", CONTROL_VALUE, RTF_CLPADT}, - {"clspb", CONTROL_VALUE, RTF_CLSPB}, - {"clspfb", CONTROL_VALUE, RTF_CLSPFB}, - {"clspfl", CONTROL_VALUE, RTF_CLSPFL}, - {"clspfr", CONTROL_VALUE, RTF_CLSPFR}, - {"clspft", CONTROL_VALUE, RTF_CLSPFT}, - {"clspl", CONTROL_VALUE, RTF_CLSPL}, - {"clspr", CONTROL_VALUE, RTF_CLSPR}, - {"clspt", CONTROL_VALUE, RTF_CLSPT}, - {"clshdng", CONTROL_VALUE, RTF_CLSHDNG}, - {"clshdngraw", CONTROL_VALUE, RTF_CLSHDNGRAW}, - {"clshdrawnil", CONTROL_FLAG, RTF_CLSHDRAWNIL}, - {"clsplit", CONTROL_FLAG, RTF_CLSPLIT}, - {"clsplitr", CONTROL_FLAG, RTF_CLSPLITR}, - {"cltxbtlr", CONTROL_FLAG, RTF_CLTXBTLR}, - {"cltxlrtb", CONTROL_FLAG, RTF_CLTXLRTB}, - {"cltxlrtbv", CONTROL_FLAG, RTF_CLTXLRTBV}, - {"cltxtbrl", CONTROL_FLAG, RTF_CLTXTBRL}, - {"cltxtbrlv", CONTROL_FLAG, RTF_CLTXTBRLV}, - {"clvertalb", CONTROL_FLAG, RTF_CLVERTALB}, - {"clvertalc", CONTROL_FLAG, RTF_CLVERTALC}, - {"clvertalt", CONTROL_FLAG, RTF_CLVERTALT}, - {"clvmgf", CONTROL_FLAG, RTF_CLVMGF}, - {"clvmrg", CONTROL_FLAG, RTF_CLVMRG}, - {"clwWidth", CONTROL_VALUE, RTF_CLWWIDTH}, - {"cmaindarkone", CONTROL_FLAG, RTF_CMAINDARKONE}, - {"cmaindarktwo", CONTROL_FLAG, RTF_CMAINDARKTWO}, - {"cmainlightone", CONTROL_FLAG, RTF_CMAINLIGHTONE}, - {"cmainlighttwo", CONTROL_FLAG, RTF_CMAINLIGHTTWO}, - {"collapsed", CONTROL_FLAG, RTF_COLLAPSED}, - {"colno", CONTROL_VALUE, RTF_COLNO}, - {"colorschememapping", CONTROL_DESTINATION, RTF_COLORSCHEMEMAPPING}, - {"colortbl", CONTROL_DESTINATION, RTF_COLORTBL}, - {"cols", CONTROL_VALUE, RTF_COLS}, - {"colsr", CONTROL_VALUE, RTF_COLSR}, - {"colsx", CONTROL_VALUE, RTF_COLSX}, - {"column", CONTROL_SYMBOL, RTF_COLUMN}, - {"colw", CONTROL_VALUE, RTF_COLW}, - {"comment", CONTROL_DESTINATION, RTF_COMMENT}, - {"company", CONTROL_DESTINATION, RTF_COMPANY}, - {"contextualspace", CONTROL_FLAG, RTF_CONTEXTUALSPACE}, - {"cpg", CONTROL_VALUE, RTF_CPG}, - {"crauth", CONTROL_VALUE, RTF_CRAUTH}, - {"crdate", CONTROL_VALUE, RTF_CRDATE}, - {"creatim", CONTROL_DESTINATION, RTF_CREATIM}, - {"cs", CONTROL_VALUE, RTF_CS}, - {"cshade", CONTROL_VALUE, RTF_CSHADE}, - {"ctextone", CONTROL_FLAG, RTF_CTEXTONE}, - {"ctexttwo", CONTROL_FLAG, RTF_CTEXTTWO}, - {"ctint", CONTROL_VALUE, RTF_CTINT}, - {"ctrl", CONTROL_FLAG, RTF_CTRL}, - {"cts", CONTROL_VALUE, RTF_CTS}, - {"cufi", CONTROL_VALUE, RTF_CUFI}, - {"culi", CONTROL_VALUE, RTF_CULI}, - {"curi", CONTROL_VALUE, RTF_CURI}, - {"cvmme", CONTROL_FLAG, RTF_CVMME}, - {"datafield", CONTROL_DESTINATION, RTF_DATAFIELD}, - {"datastore", CONTROL_DESTINATION, RTF_DATASTORE}, - {"date", CONTROL_FLAG, RTF_DATE}, - {"dbch", CONTROL_FLAG, RTF_DBCH}, - {"defchp", CONTROL_DESTINATION, RTF_DEFCHP}, - {"deff", CONTROL_VALUE, RTF_DEFF}, - {"defformat", CONTROL_FLAG, RTF_DEFFORMAT}, - {"deflang", CONTROL_VALUE, RTF_DEFLANG}, - {"deflangfe", CONTROL_VALUE, RTF_DEFLANGFE}, - {"defpap", CONTROL_DESTINATION, RTF_DEFPAP}, - {"defshp", CONTROL_FLAG, RTF_DEFSHP}, - {"deftab", CONTROL_VALUE, RTF_DEFTAB}, - {"deleted", CONTROL_TOGGLE, RTF_DELETED}, - {"delrsid", CONTROL_VALUE, RTF_DELRSID}, - {"dfrauth", CONTROL_VALUE, RTF_DFRAUTH}, - {"dfrdate", CONTROL_VALUE, RTF_DFRDATE}, - {"dfrmtxtx", CONTROL_VALUE, RTF_DFRMTXTX}, - {"dfrmtxty", CONTROL_VALUE, RTF_DFRMTXTY}, - {"dfrstart", CONTROL_VALUE, RTF_DFRSTART}, - {"dfrstop", CONTROL_VALUE, RTF_DFRSTOP}, - {"dfrxst", CONTROL_VALUE, RTF_DFRXST}, - {"dghorigin", CONTROL_VALUE, RTF_DGHORIGIN}, - {"dghshow", CONTROL_VALUE, RTF_DGHSHOW}, - {"dghspace", CONTROL_VALUE, RTF_DGHSPACE}, - {"dgmargin", CONTROL_FLAG, RTF_DGMARGIN}, - {"dgsnap", CONTROL_FLAG, RTF_DGSNAP}, - {"dgvorigin", CONTROL_VALUE, RTF_DGVORIGIN}, - {"dgvshow", CONTROL_VALUE, RTF_DGVSHOW}, - {"dgvspace", CONTROL_VALUE, RTF_DGVSPACE}, - {"dibitmap", CONTROL_VALUE, RTF_DIBITMAP}, - {"disabled", CONTROL_TOGGLE, RTF_DISABLED}, - {"dn", CONTROL_VALUE, RTF_DN}, - {"dntblnsbdb", CONTROL_FLAG, RTF_DNTBLNSBDB}, - {"do", CONTROL_DESTINATION, RTF_DO}, - {"dobxcolumn", CONTROL_FLAG, RTF_DOBXCOLUMN}, - {"dobxmargin", CONTROL_FLAG, RTF_DOBXMARGIN}, - {"dobxpage", CONTROL_FLAG, RTF_DOBXPAGE}, - {"dobymargin", CONTROL_FLAG, RTF_DOBYMARGIN}, - {"dobypage", CONTROL_FLAG, RTF_DOBYPAGE}, - {"dobypara", CONTROL_FLAG, RTF_DOBYPARA}, - {"doccomm", CONTROL_DESTINATION, RTF_DOCCOMM}, - {"doctemp", CONTROL_FLAG, RTF_DOCTEMP}, - {"doctype", CONTROL_VALUE, RTF_DOCTYPE}, - {"docvar", CONTROL_DESTINATION, RTF_DOCVAR}, - {"dodhgt", CONTROL_VALUE, RTF_DODHGT}, - {"dolock", CONTROL_FLAG, RTF_DOLOCK}, - {"donotembedlingdata", CONTROL_VALUE, RTF_DONOTEMBEDLINGDATA}, - {"donotembedsysfont", CONTROL_VALUE, RTF_DONOTEMBEDSYSFONT}, - {"donotshowcomments", CONTROL_FLAG, RTF_DONOTSHOWCOMMENTS}, - {"donotshowinsdel", CONTROL_FLAG, RTF_DONOTSHOWINSDEL}, - {"donotshowmarkup", CONTROL_FLAG, RTF_DONOTSHOWMARKUP}, - {"donotshowprops", CONTROL_FLAG, RTF_DONOTSHOWPROPS}, - {"dpaendhol", CONTROL_FLAG, RTF_DPAENDHOL}, - {"dpaendl", CONTROL_VALUE, RTF_DPAENDL}, - {"dpaendsol", CONTROL_FLAG, RTF_DPAENDSOL}, - {"dpaendw", CONTROL_VALUE, RTF_DPAENDW}, - {"dparc", CONTROL_FLAG, RTF_DPARC}, - {"dparcflipx", CONTROL_FLAG, RTF_DPARCFLIPX}, - {"dparcflipy", CONTROL_FLAG, RTF_DPARCFLIPY}, - {"dpastarthol", CONTROL_FLAG, RTF_DPASTARTHOL}, - {"dpastartl", CONTROL_VALUE, RTF_DPASTARTL}, - {"dpastartsol", CONTROL_FLAG, RTF_DPASTARTSOL}, - {"dpastartw", CONTROL_VALUE, RTF_DPASTARTW}, - {"dpcallout", CONTROL_FLAG, RTF_DPCALLOUT}, - {"dpcoa", CONTROL_VALUE, RTF_DPCOA}, - {"dpcoaccent", CONTROL_FLAG, RTF_DPCOACCENT}, - {"dpcobestfit", CONTROL_FLAG, RTF_DPCOBESTFIT}, - {"dpcoborder", CONTROL_FLAG, RTF_DPCOBORDER}, - {"dpcodabs", CONTROL_FLAG, RTF_DPCODABS}, - {"dpcodbottom", CONTROL_FLAG, RTF_DPCODBOTTOM}, - {"dpcodcenter", CONTROL_FLAG, RTF_DPCODCENTER}, - {"dpcodescent", CONTROL_VALUE, RTF_DPCODESCENT}, - {"dpcodtop", CONTROL_FLAG, RTF_DPCODTOP}, - {"dpcolength", CONTROL_VALUE, RTF_DPCOLENGTH}, - {"dpcominusx", CONTROL_FLAG, RTF_DPCOMINUSX}, - {"dpcominusy", CONTROL_FLAG, RTF_DPCOMINUSY}, - {"dpcooffset", CONTROL_VALUE, RTF_DPCOOFFSET}, - {"dpcosmarta", CONTROL_FLAG, RTF_DPCOSMARTA}, - {"dpcotdouble", CONTROL_FLAG, RTF_DPCOTDOUBLE}, - {"dpcotright", CONTROL_FLAG, RTF_DPCOTRIGHT}, - {"dpcotsingle", CONTROL_FLAG, RTF_DPCOTSINGLE}, - {"dpcottriple", CONTROL_FLAG, RTF_DPCOTTRIPLE}, - {"dpcount", CONTROL_VALUE, RTF_DPCOUNT}, - {"dpellipse", CONTROL_FLAG, RTF_DPELLIPSE}, - {"dpendgroup", CONTROL_FLAG, RTF_DPENDGROUP}, - {"dpfillbgcb", CONTROL_VALUE, RTF_DPFILLBGCB}, - {"dpfillbgcg", CONTROL_VALUE, RTF_DPFILLBGCG}, - {"dpfillbgcr", CONTROL_VALUE, RTF_DPFILLBGCR}, - {"dpfillbggray", CONTROL_VALUE, RTF_DPFILLBGGRAY}, - {"dpfillbgpal", CONTROL_FLAG, RTF_DPFILLBGPAL}, - {"dpfillfgcb", CONTROL_VALUE, RTF_DPFILLFGCB}, - {"dpfillfgcg", CONTROL_VALUE, RTF_DPFILLFGCG}, - {"dpfillfgcr", CONTROL_VALUE, RTF_DPFILLFGCR}, - {"dpfillfggray", CONTROL_VALUE, RTF_DPFILLFGGRAY}, - {"dpfillfgpal", CONTROL_FLAG, RTF_DPFILLFGPAL}, - {"dpfillpat", CONTROL_VALUE, RTF_DPFILLPAT}, - {"dpgroup", CONTROL_FLAG, RTF_DPGROUP}, - {"dpline", CONTROL_FLAG, RTF_DPLINE}, - {"dplinecob", CONTROL_VALUE, RTF_DPLINECOB}, - {"dplinecog", CONTROL_VALUE, RTF_DPLINECOG}, - {"dplinecor", CONTROL_VALUE, RTF_DPLINECOR}, - {"dplinedado", CONTROL_FLAG, RTF_DPLINEDADO}, - {"dplinedadodo", CONTROL_FLAG, RTF_DPLINEDADODO}, - {"dplinedash", CONTROL_FLAG, RTF_DPLINEDASH}, - {"dplinedot", CONTROL_FLAG, RTF_DPLINEDOT}, - {"dplinegray", CONTROL_VALUE, RTF_DPLINEGRAY}, - {"dplinehollow", CONTROL_FLAG, RTF_DPLINEHOLLOW}, - {"dplinepal", CONTROL_FLAG, RTF_DPLINEPAL}, - {"dplinesolid", CONTROL_FLAG, RTF_DPLINESOLID}, - {"dplinew", CONTROL_VALUE, RTF_DPLINEW}, - {"dppolycount", CONTROL_VALUE, RTF_DPPOLYCOUNT}, - {"dppolygon", CONTROL_FLAG, RTF_DPPOLYGON}, - {"dppolyline", CONTROL_FLAG, RTF_DPPOLYLINE}, - {"dpptx", CONTROL_VALUE, RTF_DPPTX}, - {"dppty", CONTROL_VALUE, RTF_DPPTY}, - {"dprect", CONTROL_FLAG, RTF_DPRECT}, - {"dproundr", CONTROL_FLAG, RTF_DPROUNDR}, - {"dpshadow", CONTROL_FLAG, RTF_DPSHADOW}, - {"dpshadx", CONTROL_VALUE, RTF_DPSHADX}, - {"dpshady", CONTROL_VALUE, RTF_DPSHADY}, - {"dptxbtlr", CONTROL_FLAG, RTF_DPTXBTLR}, - {"dptxbx", CONTROL_FLAG, RTF_DPTXBX}, - {"dptxbxmar", CONTROL_VALUE, RTF_DPTXBXMAR}, - {"dptxbxtext", CONTROL_DESTINATION, RTF_DPTXBXTEXT}, - {"dptxlrtb", CONTROL_FLAG, RTF_DPTXLRTB}, - {"dptxlrtbv", CONTROL_FLAG, RTF_DPTXLRTBV}, - {"dptxtbrl", CONTROL_FLAG, RTF_DPTXTBRL}, - {"dptxtbrlv", CONTROL_FLAG, RTF_DPTXTBRLV}, - {"dpx", CONTROL_VALUE, RTF_DPX}, - {"dpxsize", CONTROL_VALUE, RTF_DPXSIZE}, - {"dpy", CONTROL_VALUE, RTF_DPY}, - {"dpysize", CONTROL_VALUE, RTF_DPYSIZE}, - {"dropcapli", CONTROL_VALUE, RTF_DROPCAPLI}, - {"dropcapt", CONTROL_VALUE, RTF_DROPCAPT}, - {"ds", CONTROL_VALUE, RTF_DS}, - {"dxfrtext", CONTROL_VALUE, RTF_DXFRTEXT}, - {"dy", CONTROL_VALUE, RTF_DY}, - {"ebcend", CONTROL_DESTINATION, RTF_EBCEND}, - {"ebcstart", CONTROL_DESTINATION, RTF_EBCSTART}, - {"edmins", CONTROL_VALUE, RTF_EDMINS}, - {"embo", CONTROL_TOGGLE, RTF_EMBO}, - {"emdash", CONTROL_SYMBOL, RTF_EMDASH}, - {"emfblip", CONTROL_FLAG, RTF_EMFBLIP}, - {"emspace", CONTROL_SYMBOL, RTF_EMSPACE}, - {"endash", CONTROL_SYMBOL, RTF_ENDASH}, - {"enddoc", CONTROL_FLAG, RTF_ENDDOC}, - {"endnhere", CONTROL_FLAG, RTF_ENDNHERE}, - {"endnotes", CONTROL_FLAG, RTF_ENDNOTES}, - {"enforceprot", CONTROL_VALUE, RTF_ENFORCEPROT}, - {"enspace", CONTROL_SYMBOL, RTF_ENSPACE}, - {"expnd", CONTROL_VALUE, RTF_EXPND}, - {"expndtw", CONTROL_VALUE, RTF_EXPNDTW}, - {"expshrtn", CONTROL_FLAG, RTF_EXPSHRTN}, - {"f", CONTROL_VALUE, RTF_F}, - {"faauto", CONTROL_FLAG, RTF_FAAUTO}, - {"facenter", CONTROL_FLAG, RTF_FACENTER}, - {"facingp", CONTROL_TOGGLE, RTF_FACINGP}, - {"factoidname", CONTROL_DESTINATION, RTF_FACTOIDNAME}, - {"fafixed", CONTROL_FLAG, RTF_FAFIXED}, - {"fahang", CONTROL_FLAG, RTF_FAHANG}, - {"falt", CONTROL_DESTINATION, RTF_FALT}, - {"faroman", CONTROL_FLAG, RTF_FAROMAN}, - {"favar", CONTROL_FLAG, RTF_FAVAR}, - {"fbias", CONTROL_VALUE, RTF_FBIAS}, - {"fbidi", CONTROL_FLAG, RTF_FBIDI}, - {"fbidis", CONTROL_FLAG, RTF_FBIDIS}, - {"fbimajor", CONTROL_FLAG, RTF_FBIMAJOR}, - {"fbiminor", CONTROL_FLAG, RTF_FBIMINOR}, - {"fchars", CONTROL_DESTINATION, RTF_FCHARS}, - {"fcharset", CONTROL_VALUE, RTF_FCHARSET}, - {"fcs", CONTROL_VALUE, RTF_FCS}, - {"fdbmajor", CONTROL_FLAG, RTF_FDBMAJOR}, - {"fdbminor", CONTROL_FLAG, RTF_FDBMINOR}, - {"fdecor", CONTROL_FLAG, RTF_FDECOR}, - {"felnbrelev", CONTROL_FLAG, RTF_FELNBRELEV}, - {"fet", CONTROL_VALUE, RTF_FET}, - {"fetch", CONTROL_FLAG, RTF_FETCH}, - {"ffdefres", CONTROL_VALUE, RTF_FFDEFRES}, - {"ffdeftext", CONTROL_DESTINATION, RTF_FFDEFTEXT}, - {"ffentrymcr", CONTROL_DESTINATION, RTF_FFENTRYMCR}, - {"ffexitmcr", CONTROL_DESTINATION, RTF_FFEXITMCR}, - {"ffformat", CONTROL_DESTINATION, RTF_FFFORMAT}, - {"ffhaslistbox", CONTROL_VALUE, RTF_FFHASLISTBOX}, - {"ffhelptext", CONTROL_DESTINATION, RTF_FFHELPTEXT}, - {"ffhps", CONTROL_VALUE, RTF_FFHPS}, - {"ffl", CONTROL_DESTINATION, RTF_FFL}, - {"ffmaxlen", CONTROL_VALUE, RTF_FFMAXLEN}, - {"ffname", CONTROL_DESTINATION, RTF_FFNAME}, - {"ffownhelp", CONTROL_VALUE, RTF_FFOWNHELP}, - {"ffownstat", CONTROL_VALUE, RTF_FFOWNSTAT}, - {"ffprot", CONTROL_VALUE, RTF_FFPROT}, - {"ffrecalc", CONTROL_VALUE, RTF_FFRECALC}, - {"ffres", CONTROL_VALUE, RTF_FFRES}, - {"ffsize", CONTROL_VALUE, RTF_FFSIZE}, - {"ffstattext", CONTROL_DESTINATION, RTF_FFSTATTEXT}, - {"fftype", CONTROL_VALUE, RTF_FFTYPE}, - {"fftypetxt", CONTROL_VALUE, RTF_FFTYPETXT}, - {"fhimajor", CONTROL_FLAG, RTF_FHIMAJOR}, - {"fhiminor", CONTROL_FLAG, RTF_FHIMINOR}, - {"fi", CONTROL_VALUE, RTF_FI}, - {"fid", CONTROL_VALUE, RTF_FID}, - {"field", CONTROL_DESTINATION, RTF_FIELD}, - {"file", CONTROL_DESTINATION, RTF_FILE}, - {"filetbl", CONTROL_DESTINATION, RTF_FILETBL}, - {"fittext", CONTROL_VALUE, RTF_FITTEXT}, - {"fjgothic", CONTROL_FLAG, RTF_FJGOTHIC}, - {"fjminchou", CONTROL_FLAG, RTF_FJMINCHOU}, - {"fldalt", CONTROL_FLAG, RTF_FLDALT}, - {"flddirty", CONTROL_FLAG, RTF_FLDDIRTY}, - {"fldedit", CONTROL_FLAG, RTF_FLDEDIT}, - {"fldinst", CONTROL_DESTINATION, RTF_FLDINST}, - {"fldlock", CONTROL_FLAG, RTF_FLDLOCK}, - {"fldpriv", CONTROL_FLAG, RTF_FLDPRIV}, - {"fldrslt", CONTROL_DESTINATION, RTF_FLDRSLT}, - {"fldtype", CONTROL_DESTINATION, RTF_FLDTYPE}, - {"flomajor", CONTROL_FLAG, RTF_FLOMAJOR}, - {"flominor", CONTROL_FLAG, RTF_FLOMINOR}, - {"fmodern", CONTROL_FLAG, RTF_FMODERN}, - {"fn", CONTROL_VALUE, RTF_FN}, - {"fname", CONTROL_DESTINATION, RTF_FNAME}, - {"fnetwork", CONTROL_FLAG, RTF_FNETWORK}, - {"fnil", CONTROL_FLAG, RTF_FNIL}, - {"fnonfilesys", CONTROL_FLAG, RTF_FNONFILESYS}, - {"fontemb", CONTROL_DESTINATION, RTF_FONTEMB}, - {"fontfile", CONTROL_DESTINATION, RTF_FONTFILE}, - {"fonttbl", CONTROL_DESTINATION, RTF_FONTTBL}, - {"footer", CONTROL_DESTINATION, RTF_FOOTER}, - {"footerf", CONTROL_DESTINATION, RTF_FOOTERF}, - {"footerl", CONTROL_DESTINATION, RTF_FOOTERL}, - {"footerr", CONTROL_DESTINATION, RTF_FOOTERR}, - {"footery", CONTROL_VALUE, RTF_FOOTERY}, - {"footnote", CONTROL_DESTINATION, RTF_FOOTNOTE}, - {"forceupgrade", CONTROL_FLAG, RTF_FORCEUPGRADE}, - {"formdisp", CONTROL_FLAG, RTF_FORMDISP}, - {"formfield", CONTROL_DESTINATION, RTF_FORMFIELD}, - {"formprot", CONTROL_FLAG, RTF_FORMPROT}, - {"formshade", CONTROL_FLAG, RTF_FORMSHADE}, - {"fosnum", CONTROL_VALUE, RTF_FOSNUM}, - {"fprq", CONTROL_VALUE, RTF_FPRQ}, - {"fracwidth", CONTROL_FLAG, RTF_FRACWIDTH}, - {"frelative", CONTROL_VALUE, RTF_FRELATIVE}, - {"frmtxbtlr", CONTROL_FLAG, RTF_FRMTXBTLR}, - {"frmtxlrtb", CONTROL_FLAG, RTF_FRMTXLRTB}, - {"frmtxlrtbv", CONTROL_FLAG, RTF_FRMTXLRTBV}, - {"frmtxtbrl", CONTROL_FLAG, RTF_FRMTXTBRL}, - {"frmtxtbrlv", CONTROL_FLAG, RTF_FRMTXTBRLV}, - {"froman", CONTROL_FLAG, RTF_FROMAN}, - {"fromhtml", CONTROL_VALUE, RTF_FROMHTML}, - {"fromtext", CONTROL_FLAG, RTF_FROMTEXT}, - {"fs", CONTROL_VALUE, RTF_FS}, - {"fscript", CONTROL_FLAG, RTF_FSCRIPT}, - {"fswiss", CONTROL_FLAG, RTF_FSWISS}, - {"ftech", CONTROL_FLAG, RTF_FTECH}, - {"ftnalt", CONTROL_FLAG, RTF_FTNALT}, - {"ftnbj", CONTROL_FLAG, RTF_FTNBJ}, - {"ftncn", CONTROL_DESTINATION, RTF_FTNCN}, - {"ftnil", CONTROL_FLAG, RTF_FTNIL}, - {"ftnlytwnine", CONTROL_FLAG, RTF_FTNLYTWNINE}, - {"ftnnalc", CONTROL_FLAG, RTF_FTNNALC}, - {"ftnnar", CONTROL_FLAG, RTF_FTNNAR}, - {"ftnnauc", CONTROL_FLAG, RTF_FTNNAUC}, - {"ftnnchi", CONTROL_FLAG, RTF_FTNNCHI}, - {"ftnnchosung", CONTROL_FLAG, RTF_FTNNCHOSUNG}, - {"ftnncnum", CONTROL_FLAG, RTF_FTNNCNUM}, - {"ftnndbar", CONTROL_FLAG, RTF_FTNNDBAR}, - {"ftnndbnum", CONTROL_FLAG, RTF_FTNNDBNUM}, - {"ftnndbnumd", CONTROL_FLAG, RTF_FTNNDBNUMD}, - {"ftnndbnumk", CONTROL_FLAG, RTF_FTNNDBNUMK}, - {"ftnndbnumt", CONTROL_FLAG, RTF_FTNNDBNUMT}, - {"ftnnganada", CONTROL_FLAG, RTF_FTNNGANADA}, - {"ftnngbnum", CONTROL_FLAG, RTF_FTNNGBNUM}, - {"ftnngbnumd", CONTROL_FLAG, RTF_FTNNGBNUMD}, - {"ftnngbnumk", CONTROL_FLAG, RTF_FTNNGBNUMK}, - {"ftnngbnuml", CONTROL_FLAG, RTF_FTNNGBNUML}, - {"ftnnrlc", CONTROL_FLAG, RTF_FTNNRLC}, - {"ftnnruc", CONTROL_FLAG, RTF_FTNNRUC}, - {"ftnnzodiac", CONTROL_FLAG, RTF_FTNNZODIAC}, - {"ftnnzodiacd", CONTROL_FLAG, RTF_FTNNZODIACD}, - {"ftnnzodiacl", CONTROL_FLAG, RTF_FTNNZODIACL}, - {"ftnrestart", CONTROL_FLAG, RTF_FTNRESTART}, - {"ftnrstcont", CONTROL_FLAG, RTF_FTNRSTCONT}, - {"ftnrstpg", CONTROL_FLAG, RTF_FTNRSTPG}, - {"ftnsep", CONTROL_DESTINATION, RTF_FTNSEP}, - {"ftnsepc", CONTROL_DESTINATION, RTF_FTNSEPC}, - {"ftnstart", CONTROL_VALUE, RTF_FTNSTART}, - {"ftntj", CONTROL_FLAG, RTF_FTNTJ}, - {"fttruetype", CONTROL_FLAG, RTF_FTTRUETYPE}, - {"fvaliddos", CONTROL_FLAG, RTF_FVALIDDOS}, - {"fvalidhpfs", CONTROL_FLAG, RTF_FVALIDHPFS}, - {"fvalidmac", CONTROL_FLAG, RTF_FVALIDMAC}, - {"fvalidntfs", CONTROL_FLAG, RTF_FVALIDNTFS}, - {"g", CONTROL_DESTINATION, RTF_G}, - {"gcw", CONTROL_VALUE, RTF_GCW}, - {"generator", CONTROL_DESTINATION, RTF_GENERATOR}, - {"green", CONTROL_VALUE, RTF_GREEN}, - {"grfdocevents", CONTROL_VALUE, RTF_GRFDOCEVENTS}, - {"gridtbl", CONTROL_DESTINATION, RTF_GRIDTBL}, - {"gutter", CONTROL_VALUE, RTF_GUTTER}, - {"gutterprl", CONTROL_FLAG, RTF_GUTTERPRL}, - {"guttersxn", CONTROL_VALUE, RTF_GUTTERSXN}, - {"header", CONTROL_DESTINATION, RTF_HEADER}, - {"headerf", CONTROL_DESTINATION, RTF_HEADERF}, - {"headerl", CONTROL_DESTINATION, RTF_HEADERL}, - {"headerr", CONTROL_DESTINATION, RTF_HEADERR}, - {"headery", CONTROL_VALUE, RTF_HEADERY}, - {"hich", CONTROL_FLAG, RTF_HICH}, - {"highlight", CONTROL_VALUE, RTF_HIGHLIGHT}, - {"hl", CONTROL_DESTINATION, RTF_HL}, - {"hlfr", CONTROL_DESTINATION, RTF_HLFR}, - {"hlinkbase", CONTROL_DESTINATION, RTF_HLINKBASE}, - {"hlloc", CONTROL_DESTINATION, RTF_HLLOC}, - {"hlsrc", CONTROL_DESTINATION, RTF_HLSRC}, - {"horzdoc", CONTROL_FLAG, RTF_HORZDOC}, - {"horzsect", CONTROL_FLAG, RTF_HORZSECT}, - {"horzvert", CONTROL_VALUE, RTF_HORZVERT}, - {"hr", CONTROL_VALUE, RTF_HR}, - {"hres", CONTROL_VALUE, RTF_HRES}, - {"hrule", CONTROL_FLAG, RTF_HRULE}, - {"hsv", CONTROL_DESTINATION, RTF_HSV}, - {"htmautsp", CONTROL_FLAG, RTF_HTMAUTSP}, - {"htmlbase", CONTROL_FLAG, RTF_HTMLBASE}, - {"htmlrtf", CONTROL_TOGGLE, RTF_HTMLRTF}, - {"htmltag", CONTROL_DESTINATION, RTF_HTMLTAG}, - {"hwelev", CONTROL_FLAG, RTF_HWELEV}, - {"hyphauto", CONTROL_TOGGLE, RTF_HYPHAUTO}, - {"hyphcaps", CONTROL_TOGGLE, RTF_HYPHCAPS}, - {"hyphconsec", CONTROL_VALUE, RTF_HYPHCONSEC}, - {"hyphhotz", CONTROL_VALUE, RTF_HYPHHOTZ}, - {"hyphpar", CONTROL_TOGGLE, RTF_HYPHPAR}, - {"i", CONTROL_TOGGLE, RTF_I}, - {"id", CONTROL_VALUE, RTF_ID}, - {"ignoremixedcontent", CONTROL_VALUE, RTF_IGNOREMIXEDCONTENT}, - {"ilfomacatclnup", CONTROL_VALUE, RTF_ILFOMACATCLNUP}, - {"ilvl", CONTROL_VALUE, RTF_ILVL}, - {"impr", CONTROL_TOGGLE, RTF_IMPR}, - {"indmirror", CONTROL_FLAG, RTF_INDMIRROR}, - {"indrlsweleven", CONTROL_FLAG, RTF_INDRLSWELEVEN}, - {"info", CONTROL_DESTINATION, RTF_INFO}, - {"insrsid", CONTROL_VALUE, RTF_INSRSID}, - {"intbl", CONTROL_FLAG, RTF_INTBL}, - {"ipgp", CONTROL_VALUE, RTF_IPGP}, - {"irowband", CONTROL_VALUE, RTF_IROWBAND}, - {"irow", CONTROL_VALUE, RTF_IROW}, - {"itap", CONTROL_VALUE, RTF_ITAP}, - {"ixe", CONTROL_FLAG, RTF_IXE}, - {"jcompress", CONTROL_FLAG, RTF_JCOMPRESS}, - {"jexpand", CONTROL_FLAG, RTF_JEXPAND}, - {"jis", CONTROL_FLAG, RTF_JIS}, - {"jpegblip", CONTROL_FLAG, RTF_JPEGBLIP}, - {"jsksu", CONTROL_FLAG, RTF_JSKSU}, - {"keep", CONTROL_FLAG, RTF_KEEP}, - {"keepn", CONTROL_FLAG, RTF_KEEPN}, - {"kerning", CONTROL_VALUE, RTF_KERNING}, - {"keycode", CONTROL_DESTINATION, RTF_KEYCODE}, - {"keywords", CONTROL_DESTINATION, RTF_KEYWORDS}, - {"krnprsnet", CONTROL_FLAG, RTF_KRNPRSNET}, - {"ksulang", CONTROL_VALUE, RTF_KSULANG}, - {"jclisttab", CONTROL_FLAG, RTF_JCLISTTAB}, - {"landscape", CONTROL_FLAG, RTF_LANDSCAPE}, - {"lang", CONTROL_VALUE, RTF_LANG}, - {"langfe", CONTROL_VALUE, RTF_LANGFE}, - {"langfenp", CONTROL_VALUE, RTF_LANGFENP}, - {"langnp", CONTROL_VALUE, RTF_LANGNP}, - {"lastrow", CONTROL_FLAG, RTF_LASTROW}, - {"latentstyles", CONTROL_DESTINATION, RTF_LATENTSTYLES}, - {"lbr", CONTROL_VALUE, RTF_LBR}, - {"lchars", CONTROL_DESTINATION, RTF_LCHARS}, - {"ldblquote", CONTROL_SYMBOL, RTF_LDBLQUOTE}, - {"level", CONTROL_VALUE, RTF_LEVEL}, - {"levelfollow", CONTROL_VALUE, RTF_LEVELFOLLOW}, - {"levelindent", CONTROL_VALUE, RTF_LEVELINDENT}, - {"leveljc", CONTROL_VALUE, RTF_LEVELJC}, - {"leveljcn", CONTROL_VALUE, RTF_LEVELJCN}, - {"levellegal", CONTROL_VALUE, RTF_LEVELLEGAL}, - {"levelnfc", CONTROL_VALUE, RTF_LEVELNFC}, - {"levelnfcn", CONTROL_VALUE, RTF_LEVELNFCN}, - {"levelnorestart", CONTROL_VALUE, RTF_LEVELNORESTART}, - {"levelnumbers", CONTROL_DESTINATION, RTF_LEVELNUMBERS}, - {"levelold", CONTROL_VALUE, RTF_LEVELOLD}, - {"levelpicture", CONTROL_VALUE, RTF_LEVELPICTURE}, - {"levelpicturenosize", CONTROL_FLAG, RTF_LEVELPICTURENOSIZE}, - {"levelprev", CONTROL_VALUE, RTF_LEVELPREV}, - {"levelprevspace", CONTROL_VALUE, RTF_LEVELPREVSPACE}, - {"levelspace", CONTROL_VALUE, RTF_LEVELSPACE}, - {"levelstartat", CONTROL_VALUE, RTF_LEVELSTARTAT}, - {"leveltemplateid", CONTROL_VALUE, RTF_LEVELTEMPLATEID}, - {"leveltext", CONTROL_DESTINATION, RTF_LEVELTEXT}, - {"lfolevel", CONTROL_DESTINATION, RTF_LFOLEVEL}, - {"li", CONTROL_VALUE, RTF_LI}, - {"line", CONTROL_SYMBOL, RTF_LINE}, - {"linebetcol", CONTROL_FLAG, RTF_LINEBETCOL}, - {"linecont", CONTROL_FLAG, RTF_LINECONT}, - {"linemod", CONTROL_VALUE, RTF_LINEMOD}, - {"lineppage", CONTROL_FLAG, RTF_LINEPPAGE}, - {"linerestart", CONTROL_FLAG, RTF_LINERESTART}, - {"linestart", CONTROL_VALUE, RTF_LINESTART}, - {"linestarts", CONTROL_VALUE, RTF_LINESTARTS}, - {"linex", CONTROL_VALUE, RTF_LINEX}, - {"linkself", CONTROL_FLAG, RTF_LINKSELF}, - {"linkstyles", CONTROL_FLAG, RTF_LINKSTYLES}, - {"linkval", CONTROL_DESTINATION, RTF_LINKVAL}, - {"lin", CONTROL_VALUE, RTF_LIN}, - {"lisa", CONTROL_VALUE, RTF_LISA}, - {"lisb", CONTROL_VALUE, RTF_LISB}, - {"list", CONTROL_DESTINATION, RTF_LIST}, - {"listhybrid", CONTROL_FLAG, RTF_LISTHYBRID}, - {"listid", CONTROL_VALUE, RTF_LISTID}, - {"listlevel", CONTROL_DESTINATION, RTF_LISTLEVEL}, - {"listname", CONTROL_DESTINATION, RTF_LISTNAME}, - {"listoverride", CONTROL_DESTINATION, RTF_LISTOVERRIDE}, - {"listoverridecount", CONTROL_VALUE, RTF_LISTOVERRIDECOUNT}, - {"listoverrideformat", CONTROL_VALUE, RTF_LISTOVERRIDEFORMAT}, - {"listoverridestartat", CONTROL_FLAG, RTF_LISTOVERRIDESTARTAT}, - {"listoverridetable", CONTROL_DESTINATION, RTF_LISTOVERRIDETABLE}, - {"listpicture", CONTROL_DESTINATION, RTF_LISTPICTURE}, - {"listrestarthdn", CONTROL_VALUE, RTF_LISTRESTARTHDN}, - {"listsimple", CONTROL_VALUE, RTF_LISTSIMPLE}, - {"liststyleid", CONTROL_VALUE, RTF_LISTSTYLEID}, - {"liststylename", CONTROL_DESTINATION, RTF_LISTSTYLENAME}, - {"listtable", CONTROL_DESTINATION, RTF_LISTTABLE}, - {"listtemplateid", CONTROL_VALUE, RTF_LISTTEMPLATEID}, - {"listtext", CONTROL_DESTINATION, RTF_LISTTEXT}, - {"lnbrkrule", CONTROL_FLAG, RTF_LNBRKRULE}, - {"lndscpsxn", CONTROL_FLAG, RTF_LNDSCPSXN}, - {"lnongrid", CONTROL_FLAG, RTF_LNONGRID}, - {"loch", CONTROL_FLAG, RTF_LOCH}, - {"lquote", CONTROL_SYMBOL, RTF_LQUOTE}, - {"ls", CONTROL_VALUE, RTF_LS}, - {"lsdlocked", CONTROL_VALUE, RTF_LSDLOCKED}, - {"lsdlockeddef", CONTROL_VALUE, RTF_LSDLOCKEDDEF}, - {"lsdlockedexcept", CONTROL_DESTINATION, RTF_LSDLOCKEDEXCEPT}, - {"lsdpriority", CONTROL_VALUE, RTF_LSDPRIORITY}, - {"lsdprioritydef", CONTROL_VALUE, RTF_LSDPRIORITYDEF}, - {"lsdqformat", CONTROL_VALUE, RTF_LSDQFORMAT}, - {"lsdqformatdef", CONTROL_VALUE, RTF_LSDQFORMATDEF}, - {"lsdsemihidden", CONTROL_VALUE, RTF_LSDSEMIHIDDEN}, - {"lsdsemihiddendef", CONTROL_VALUE, RTF_LSDSEMIHIDDENDEF}, - {"lsdstimax", CONTROL_VALUE, RTF_LSDSTIMAX}, - {"lsdunhideused", CONTROL_VALUE, RTF_LSDUNHIDEUSED}, - {"lsdunhideuseddef", CONTROL_VALUE, RTF_LSDUNHIDEUSEDDEF}, - {"ltrch", CONTROL_FLAG, RTF_LTRCH}, - {"ltrdoc", CONTROL_FLAG, RTF_LTRDOC}, - {"ltrmark", CONTROL_SYMBOL, RTF_LTRMARK}, - {"ltrpar", CONTROL_FLAG, RTF_LTRPAR}, - {"ltrrow", CONTROL_FLAG, RTF_LTRROW}, - {"ltrsect", CONTROL_FLAG, RTF_LTRSECT}, - {"lvltentative", CONTROL_FLAG, RTF_LVLTENTATIVE}, - {"lytcalctblwd", CONTROL_FLAG, RTF_LYTCALCTBLWD}, - {"lytexcttp", CONTROL_FLAG, RTF_LYTEXCTTP}, - {"lytprtmet", CONTROL_FLAG, RTF_LYTPRTMET}, - {"lyttblrtgr", CONTROL_FLAG, RTF_LYTTBLRTGR}, - {"mac", CONTROL_FLAG, RTF_MAC}, - {"macc", CONTROL_DESTINATION, RTF_MACC}, - {"maccPr", CONTROL_DESTINATION, RTF_MACCPR}, - {"macpict", CONTROL_FLAG, RTF_MACPICT}, - {"mailmerge", CONTROL_DESTINATION, RTF_MAILMERGE}, - {"makebackup", CONTROL_FLAG, RTF_MAKEBACKUP}, - {"maln", CONTROL_DESTINATION, RTF_MALN}, - {"malnScr", CONTROL_DESTINATION, RTF_MALNSCR}, - {"manager", CONTROL_DESTINATION, RTF_MANAGER}, - {"margb", CONTROL_VALUE, RTF_MARGB}, - {"margbsxn", CONTROL_VALUE, RTF_MARGBSXN}, - {"margl", CONTROL_VALUE, RTF_MARGL}, - {"marglsxn", CONTROL_VALUE, RTF_MARGLSXN}, - {"margmirror", CONTROL_FLAG, RTF_MARGMIRROR}, - {"margmirsxn", CONTROL_FLAG, RTF_MARGMIRSXN}, - {"margPr", CONTROL_DESTINATION, RTF_MARGPR}, - {"margr", CONTROL_VALUE, RTF_MARGR}, - {"margrsxn", CONTROL_VALUE, RTF_MARGRSXN}, - {"margSz", CONTROL_VALUE, RTF_MARGSZ}, - {"margt", CONTROL_VALUE, RTF_MARGT}, - {"margtsxn", CONTROL_VALUE, RTF_MARGTSXN}, - {"mbar", CONTROL_DESTINATION, RTF_MBAR}, - {"mbarPr", CONTROL_DESTINATION, RTF_MBARPR}, - {"mbaseJc", CONTROL_DESTINATION, RTF_MBASEJC}, - {"mbegChr", CONTROL_DESTINATION, RTF_MBEGCHR}, - {"mborderBox", CONTROL_DESTINATION, RTF_MBORDERBOX}, - {"mborderBoxPr", CONTROL_DESTINATION, RTF_MBORDERBOXPR}, - {"mbox", CONTROL_DESTINATION, RTF_MBOX}, - {"mboxPr", CONTROL_DESTINATION, RTF_MBOXPR}, - {"mbrk", CONTROL_VALUE, RTF_MBRK}, - {"mbrkBin", CONTROL_VALUE, RTF_MBRKBIN}, - {"mbrkBinSub", CONTROL_VALUE, RTF_MBRKBINSUB}, - {"mcGp", CONTROL_VALUE, RTF_MCGP}, - {"mcGpRule", CONTROL_VALUE, RTF_MCGPRULE}, - {"mchr", CONTROL_DESTINATION, RTF_MCHR}, - {"mcount", CONTROL_DESTINATION, RTF_MCOUNT}, - {"mcSp", CONTROL_VALUE, RTF_MCSP}, - {"mctrlPr", CONTROL_DESTINATION, RTF_MCTRLPR}, - {"md", CONTROL_DESTINATION, RTF_MD}, - {"mdefJc", CONTROL_VALUE, RTF_MDEFJC}, - {"mdeg", CONTROL_DESTINATION, RTF_MDEG}, - {"mdegHide", CONTROL_DESTINATION, RTF_MDEGHIDE}, - {"mden", CONTROL_DESTINATION, RTF_MDEN}, - {"mdiff", CONTROL_DESTINATION, RTF_MDIFF}, - {"mdiffSty", CONTROL_VALUE, RTF_MDIFFSTY}, - {"mdispdef", CONTROL_VALUE, RTF_MDISPDEF}, - {"mdPr", CONTROL_DESTINATION, RTF_MDPR}, - {"me", CONTROL_DESTINATION, RTF_ME}, - {"mendChr", CONTROL_DESTINATION, RTF_MENDCHR}, - {"meqArr", CONTROL_DESTINATION, RTF_MEQARR}, - {"meqArrPr", CONTROL_DESTINATION, RTF_MEQARRPR}, - {"mf", CONTROL_DESTINATION, RTF_MF}, - {"mfName", CONTROL_DESTINATION, RTF_MFNAME}, - {"mfPr", CONTROL_DESTINATION, RTF_MFPR}, - {"mfunc", CONTROL_DESTINATION, RTF_MFUNC}, - {"mfuncPr", CONTROL_DESTINATION, RTF_MFUNCPR}, - {"mgroupChr", CONTROL_DESTINATION, RTF_MGROUPCHR}, - {"mgroupChrPr", CONTROL_DESTINATION, RTF_MGROUPCHRPR}, - {"mgrow", CONTROL_DESTINATION, RTF_MGROW}, - {"mhideBot", CONTROL_DESTINATION, RTF_MHIDEBOT}, - {"mhideLeft", CONTROL_DESTINATION, RTF_MHIDELEFT}, - {"mhideRight", CONTROL_DESTINATION, RTF_MHIDERIGHT}, - {"mhideTop", CONTROL_DESTINATION, RTF_MHIDETOP}, - {"mhtmltag", CONTROL_DESTINATION, RTF_MHTMLTAG}, - {"min", CONTROL_VALUE, RTF_MIN}, - {"minterSp", CONTROL_VALUE, RTF_MINTERSP}, - {"mintLim", CONTROL_VALUE, RTF_MINTLIM}, - {"mintraSp", CONTROL_VALUE, RTF_MINTRASP}, - {"mjc", CONTROL_VALUE, RTF_MJC}, - {"mlim", CONTROL_DESTINATION, RTF_MLIM}, - {"mlimloc", CONTROL_DESTINATION, RTF_MLIMLOC}, - {"mlimLoc", CONTROL_DESTINATION, RTF_MLIMLOC}, - {"mlimlow", CONTROL_DESTINATION, RTF_MLIMLOW}, - {"mlimLow", CONTROL_DESTINATION, RTF_MLIMLOW}, - {"mlimlowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR}, - {"mlimLowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR}, - {"mlimupp", CONTROL_DESTINATION, RTF_MLIMUPP}, - {"mlimUpp", CONTROL_DESTINATION, RTF_MLIMUPP}, - {"mlimuppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR}, - {"mlimUppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR}, - {"mlit", CONTROL_FLAG, RTF_MLIT}, - {"mlMargin", CONTROL_VALUE, RTF_MLMARGIN}, - {"mm", CONTROL_DESTINATION, RTF_MM}, - {"mmaddfieldname", CONTROL_DESTINATION, RTF_MMADDFIELDNAME}, - {"mmath", CONTROL_DESTINATION, RTF_MMATH}, - {"mmathFont", CONTROL_VALUE, RTF_MMATHFONT}, - {"mmathPict", CONTROL_DESTINATION, RTF_MMATHPICT}, - {"mmathPr", CONTROL_DESTINATION, RTF_MMATHPR}, - {"mmattach", CONTROL_FLAG, RTF_MMATTACH}, - {"mmaxdist", CONTROL_DESTINATION, RTF_MMAXDIST}, - {"mmblanklines", CONTROL_FLAG, RTF_MMBLANKLINES}, - {"mmc", CONTROL_DESTINATION, RTF_MMC}, - {"mmcJc", CONTROL_DESTINATION, RTF_MMCJC}, - {"mmconnectstr", CONTROL_DESTINATION, RTF_MMCONNECTSTR}, - {"mmconnectstrdata", CONTROL_DESTINATION, RTF_MMCONNECTSTRDATA}, - {"mmcPr", CONTROL_DESTINATION, RTF_MMCPR}, - {"mmcs", CONTROL_DESTINATION, RTF_MMCS}, - {"mmdatasource", CONTROL_DESTINATION, RTF_MMDATASOURCE}, - {"mmdatatypeaccess", CONTROL_FLAG, RTF_MMDATATYPEACCESS}, - {"mmdatatypeexcel", CONTROL_FLAG, RTF_MMDATATYPEEXCEL}, - {"mmdatatypefile", CONTROL_FLAG, RTF_MMDATATYPEFILE}, - {"mmdatatypeodbc", CONTROL_FLAG, RTF_MMDATATYPEODBC}, - {"mmdatatypeodso", CONTROL_FLAG, RTF_MMDATATYPEODSO}, - {"mmdatatypeqt", CONTROL_FLAG, RTF_MMDATATYPEQT}, - {"mmdefaultsql", CONTROL_FLAG, RTF_MMDEFAULTSQL}, - {"mmdestemail", CONTROL_FLAG, RTF_MMDESTEMAIL}, - {"mmdestfax", CONTROL_FLAG, RTF_MMDESTFAX}, - {"mmdestnewdoc", CONTROL_FLAG, RTF_MMDESTNEWDOC}, - {"mmdestprinter", CONTROL_FLAG, RTF_MMDESTPRINTER}, - {"mmerrors", CONTROL_VALUE, RTF_MMERRORS}, - {"mmfttypeaddress", CONTROL_FLAG, RTF_MMFTTYPEADDRESS}, - {"mmfttypebarcode", CONTROL_FLAG, RTF_MMFTTYPEBARCODE}, - {"mmfttypedbcolumn", CONTROL_FLAG, RTF_MMFTTYPEDBCOLUMN}, - {"mmfttypemapped", CONTROL_FLAG, RTF_MMFTTYPEMAPPED}, - {"mmfttypenull", CONTROL_FLAG, RTF_MMFTTYPENULL}, - {"mmfttypesalutation", CONTROL_FLAG, RTF_MMFTTYPESALUTATION}, - {"mmheadersource", CONTROL_DESTINATION, RTF_MMHEADERSOURCE}, - {"mmjdsotype", CONTROL_VALUE, RTF_MMJDSOTYPE}, - {"mmlinktoquery", CONTROL_FLAG, RTF_MMLINKTOQUERY}, - {"mmmailsubject", CONTROL_DESTINATION, RTF_MMMAILSUBJECT}, - {"mmmaintypecatalog", CONTROL_FLAG, RTF_MMMAINTYPECATALOG}, - {"mmmaintypeemail", CONTROL_FLAG, RTF_MMMAINTYPEEMAIL}, - {"mmmaintypeenvelopes", CONTROL_FLAG, RTF_MMMAINTYPEENVELOPES}, - {"mmmaintypefax", CONTROL_FLAG, RTF_MMMAINTYPEFAX}, - {"mmmaintypelabels", CONTROL_FLAG, RTF_MMMAINTYPELABELS}, - {"mmmaintypeletters", CONTROL_FLAG, RTF_MMMAINTYPELETTERS}, - {"mmodso", CONTROL_DESTINATION, RTF_MMODSO}, - {"mmodsoactive", CONTROL_VALUE, RTF_MMODSOACTIVE}, - {"mmodsocoldelim", CONTROL_VALUE, RTF_MMODSOCOLDELIM}, - {"mmodsocolumn", CONTROL_VALUE, RTF_MMODSOCOLUMN}, - {"mmodsodynaddr", CONTROL_VALUE, RTF_MMODSODYNADDR}, - {"mmodsofhdr", CONTROL_VALUE, RTF_MMODSOFHDR}, - {"mmodsofilter", CONTROL_DESTINATION, RTF_MMODSOFILTER}, - {"mmodsofldmpdata", CONTROL_DESTINATION, RTF_MMODSOFLDMPDATA}, - {"mmodsofmcolumn", CONTROL_VALUE, RTF_MMODSOFMCOLUMN}, - {"mmodsohash", CONTROL_VALUE, RTF_MMODSOHASH}, - {"mmodsolid", CONTROL_VALUE, RTF_MMODSOLID}, - {"mmodsomappedname", CONTROL_DESTINATION, RTF_MMODSOMAPPEDNAME}, - {"mmodsoname", CONTROL_DESTINATION, RTF_MMODSONAME}, - {"mmodsorecipdata", CONTROL_DESTINATION, RTF_MMODSORECIPDATA}, - {"mmodsosort", CONTROL_DESTINATION, RTF_MMODSOSORT}, - {"mmodsosrc", CONTROL_DESTINATION, RTF_MMODSOSRC}, - {"mmodsotable", CONTROL_DESTINATION, RTF_MMODSOTABLE}, - {"mmodsoudl", CONTROL_DESTINATION, RTF_MMODSOUDL}, - {"mmodsoudldata", CONTROL_DESTINATION, RTF_MMODSOUDLDATA}, - {"mmodsouniquetag", CONTROL_DESTINATION, RTF_MMODSOUNIQUETAG}, - {"mmPr", CONTROL_DESTINATION, RTF_MMPR}, - {"mmquery", CONTROL_DESTINATION, RTF_MMQUERY}, - {"mmr", CONTROL_DESTINATION, RTF_MMR}, - {"mmreccur", CONTROL_VALUE, RTF_MMRECCUR}, - {"mmshowdata", CONTROL_FLAG, RTF_MMSHOWDATA}, - {"mnary", CONTROL_DESTINATION, RTF_MNARY}, - {"mnaryLim", CONTROL_VALUE, RTF_MNARYLIM}, - {"mnaryPr", CONTROL_DESTINATION, RTF_MNARYPR}, - {"mnoBreak", CONTROL_DESTINATION, RTF_MNOBREAK}, - {"mnor", CONTROL_FLAG, RTF_MNOR}, - {"mnum", CONTROL_DESTINATION, RTF_MNUM}, - {"mo", CONTROL_VALUE, RTF_MO}, - {"mobjDist", CONTROL_DESTINATION, RTF_MOBJDIST}, - {"moMath", CONTROL_DESTINATION, RTF_MOMATH}, - {"moMathPara", CONTROL_DESTINATION, RTF_MOMATHPARA}, - {"moMathParaPr", CONTROL_DESTINATION, RTF_MOMATHPARAPR}, - {"mopEmu", CONTROL_DESTINATION, RTF_MOPEMU}, - {"mphant", CONTROL_DESTINATION, RTF_MPHANT}, - {"mphantPr", CONTROL_DESTINATION, RTF_MPHANTPR}, - {"mplcHide", CONTROL_DESTINATION, RTF_MPLCHIDE}, - {"mpos", CONTROL_DESTINATION, RTF_MPOS}, - {"mpostSp", CONTROL_VALUE, RTF_MPOSTSP}, - {"mpreSp", CONTROL_VALUE, RTF_MPRESP}, - {"mr", CONTROL_DESTINATION, RTF_MR}, - {"mrad", CONTROL_DESTINATION, RTF_MRAD}, - {"mradPr", CONTROL_DESTINATION, RTF_MRADPR}, - {"mrMargin", CONTROL_VALUE, RTF_MRMARGIN}, - {"mrPr", CONTROL_DESTINATION, RTF_MRPR}, - {"mrSp", CONTROL_VALUE, RTF_MRSP}, - {"mrSpRule", CONTROL_VALUE, RTF_MRSPRULE}, - {"mscr", CONTROL_VALUE, RTF_MSCR}, - {"msepChr", CONTROL_DESTINATION, RTF_MSEPCHR}, - {"mshow", CONTROL_DESTINATION, RTF_MSHOW}, - {"mshp", CONTROL_DESTINATION, RTF_MSHP}, - {"msmallFrac", CONTROL_VALUE, RTF_MSMALLFRAC}, - {"msmcap", CONTROL_FLAG, RTF_MSMCAP}, - {"msPre", CONTROL_DESTINATION, RTF_MSPRE}, - {"msPrePr", CONTROL_DESTINATION, RTF_MSPREPR}, - {"msSub", CONTROL_DESTINATION, RTF_MSSUB}, - {"msSubPr", CONTROL_DESTINATION, RTF_MSSUBPR}, - {"msSubSup", CONTROL_DESTINATION, RTF_MSSUBSUP}, - {"msSubSupPr", CONTROL_DESTINATION, RTF_MSSUBSUPPR}, - {"msSup", CONTROL_DESTINATION, RTF_MSSUP}, - {"msSupPr", CONTROL_DESTINATION, RTF_MSSUPPR}, - {"mstrikeBLTR", CONTROL_DESTINATION, RTF_MSTRIKEBLTR}, - {"mstrikeH", CONTROL_DESTINATION, RTF_MSTRIKEH}, - {"mstrikeTLBR", CONTROL_DESTINATION, RTF_MSTRIKETLBR}, - {"mstrikeV", CONTROL_DESTINATION, RTF_MSTRIKEV}, - {"msty", CONTROL_VALUE, RTF_MSTY}, - {"msub", CONTROL_DESTINATION, RTF_MSUB}, - {"msubHide", CONTROL_DESTINATION, RTF_MSUBHIDE}, - {"msup", CONTROL_DESTINATION, RTF_MSUP}, - {"msupHide", CONTROL_DESTINATION, RTF_MSUPHIDE}, - {"mtransp", CONTROL_DESTINATION, RTF_MTRANSP}, - {"mtype", CONTROL_DESTINATION, RTF_MTYPE}, - {"muser", CONTROL_FLAG, RTF_MUSER}, - {"mvauth", CONTROL_VALUE, RTF_MVAUTH}, - {"mvdate", CONTROL_VALUE, RTF_MVDATE}, - {"mvertJc", CONTROL_DESTINATION, RTF_MVERTJC}, - {"mvf", CONTROL_FLAG, RTF_MVF}, - {"mvfmf", CONTROL_DESTINATION, RTF_MVFMF}, - {"mvfml", CONTROL_DESTINATION, RTF_MVFML}, - {"mvt", CONTROL_FLAG, RTF_MVT}, - {"mvtof", CONTROL_DESTINATION, RTF_MVTOF}, - {"mvtol", CONTROL_DESTINATION, RTF_MVTOL}, - {"mwrapIndent", CONTROL_VALUE, RTF_MWRAPINDENT}, - {"mwrapRight", CONTROL_VALUE, RTF_MWRAPRIGHT}, - {"mzeroAsc", CONTROL_DESTINATION, RTF_MZEROASC}, - {"mzeroDesc", CONTROL_DESTINATION, RTF_MZERODESC}, - {"mzeroWid", CONTROL_DESTINATION, RTF_MZEROWID}, - {"nestcell", CONTROL_SYMBOL, RTF_NESTCELL}, - {"nestrow", CONTROL_SYMBOL, RTF_NESTROW}, - {"nesttableprops", CONTROL_DESTINATION, RTF_NESTTABLEPROPS}, - {"newtblstyruls", CONTROL_FLAG, RTF_NEWTBLSTYRULS}, - {"nextfile", CONTROL_DESTINATION, RTF_NEXTFILE}, - {"noafcnsttbl", CONTROL_FLAG, RTF_NOAFCNSTTBL}, - {"nobrkwrptbl", CONTROL_FLAG, RTF_NOBRKWRPTBL}, - {"nocolbal", CONTROL_FLAG, RTF_NOCOLBAL}, - {"nocompatoptions", CONTROL_FLAG, RTF_NOCOMPATOPTIONS}, - {"nocwrap", CONTROL_FLAG, RTF_NOCWRAP}, - {"nocxsptable", CONTROL_FLAG, RTF_NOCXSPTABLE}, - {"noextrasprl", CONTROL_FLAG, RTF_NOEXTRASPRL}, - {"nofchars", CONTROL_VALUE, RTF_NOFCHARS}, - {"nofcharsws", CONTROL_VALUE, RTF_NOFCHARSWS}, - {"nofeaturethrottle", CONTROL_FLAG, RTF_NOFEATURETHROTTLE}, - {"nofpages", CONTROL_VALUE, RTF_NOFPAGES}, - {"nofwords", CONTROL_VALUE, RTF_NOFWORDS}, - {"nogrowautofit", CONTROL_FLAG, RTF_NOGROWAUTOFIT}, - {"noindnmbrts", CONTROL_FLAG, RTF_NOINDNMBRTS}, - {"nojkernpunct", CONTROL_FLAG, RTF_NOJKERNPUNCT}, - {"nolead", CONTROL_FLAG, RTF_NOLEAD}, - {"noline", CONTROL_FLAG, RTF_NOLINE}, - {"nolnhtadjtbl", CONTROL_FLAG, RTF_NOLNHTADJTBL}, - {"nonesttables", CONTROL_DESTINATION, RTF_NONESTTABLES}, - {"nonshppict", CONTROL_FLAG, RTF_NONSHPPICT}, - {"nooverflow", CONTROL_FLAG, RTF_NOOVERFLOW}, - {"noproof", CONTROL_FLAG, RTF_NOPROOF}, - {"noqfpromote", CONTROL_FLAG, RTF_NOQFPROMOTE}, - {"nosectexpand", CONTROL_FLAG, RTF_NOSECTEXPAND}, - {"nosnaplinegrid", CONTROL_FLAG, RTF_NOSNAPLINEGRID}, - {"nospaceforul", CONTROL_FLAG, RTF_NOSPACEFORUL}, - {"nosupersub", CONTROL_FLAG, RTF_NOSUPERSUB}, - {"notabind", CONTROL_FLAG, RTF_NOTABIND}, - {"notbrkcnstfrctbl", CONTROL_FLAG, RTF_NOTBRKCNSTFRCTBL}, - {"notcvasp", CONTROL_FLAG, RTF_NOTCVASP}, - {"notvatxbx", CONTROL_FLAG, RTF_NOTVATXBX}, - {"nouicompat", CONTROL_FLAG, RTF_NOUICOMPAT}, - {"noultrlspc", CONTROL_FLAG, RTF_NOULTRLSPC}, - {"nowidctlpar", CONTROL_FLAG, RTF_NOWIDCTLPAR}, - {"nowrap", CONTROL_FLAG, RTF_NOWRAP}, - {"nowwrap", CONTROL_FLAG, RTF_NOWWRAP}, - {"noxlattoyen", CONTROL_FLAG, RTF_NOXLATTOYEN}, - {"objalias", CONTROL_DESTINATION, RTF_OBJALIAS}, - {"objalign", CONTROL_VALUE, RTF_OBJALIGN}, - {"objattph", CONTROL_FLAG, RTF_OBJATTPH}, - {"objautlink", CONTROL_FLAG, RTF_OBJAUTLINK}, - {"objclass", CONTROL_DESTINATION, RTF_OBJCLASS}, - {"objcropb", CONTROL_VALUE, RTF_OBJCROPB}, - {"objcropl", CONTROL_VALUE, RTF_OBJCROPL}, - {"objcropr", CONTROL_VALUE, RTF_OBJCROPR}, - {"objcropt", CONTROL_VALUE, RTF_OBJCROPT}, - {"objdata", CONTROL_DESTINATION, RTF_OBJDATA}, - {"object", CONTROL_DESTINATION, RTF_OBJECT}, - {"objemb", CONTROL_FLAG, RTF_OBJEMB}, - {"objh", CONTROL_VALUE, RTF_OBJH}, - {"objhtml", CONTROL_FLAG, RTF_OBJHTML}, - {"objicemb", CONTROL_FLAG, RTF_OBJICEMB}, - {"objlink", CONTROL_FLAG, RTF_OBJLINK}, - {"objlock", CONTROL_FLAG, RTF_OBJLOCK}, - {"objname", CONTROL_DESTINATION, RTF_OBJNAME}, - {"objocx", CONTROL_FLAG, RTF_OBJOCX}, - {"objpub", CONTROL_FLAG, RTF_OBJPUB}, - {"objscalex", CONTROL_VALUE, RTF_OBJSCALEX}, - {"objscaley", CONTROL_VALUE, RTF_OBJSCALEY}, - {"objsect", CONTROL_DESTINATION, RTF_OBJSECT}, - {"objsetsize", CONTROL_FLAG, RTF_OBJSETSIZE}, - {"objsub", CONTROL_FLAG, RTF_OBJSUB}, - {"objtime", CONTROL_DESTINATION, RTF_OBJTIME}, - {"objtransy", CONTROL_VALUE, RTF_OBJTRANSY}, - {"objupdate", CONTROL_FLAG, RTF_OBJUPDATE}, - {"objw", CONTROL_VALUE, RTF_OBJW}, - {"ogutter", CONTROL_VALUE, RTF_OGUTTER}, - {"oldas", CONTROL_FLAG, RTF_OLDAS}, - {"oldcprops", CONTROL_DESTINATION, RTF_OLDCPROPS}, - {"oldlinewrap", CONTROL_FLAG, RTF_OLDLINEWRAP}, - {"oldpprops", CONTROL_DESTINATION, RTF_OLDPPROPS}, - {"oldsprops", CONTROL_DESTINATION, RTF_OLDSPROPS}, - {"oldtprops", CONTROL_DESTINATION, RTF_OLDTPROPS}, - {"oleclsid", CONTROL_DESTINATION, RTF_OLECLSID}, - {"operator", CONTROL_DESTINATION, RTF_OPERATOR}, - {"otblrul", CONTROL_FLAG, RTF_OTBLRUL}, - {"outl", CONTROL_TOGGLE, RTF_OUTL}, - {"outlinelevel", CONTROL_VALUE, RTF_OUTLINELEVEL}, - {"overlay", CONTROL_FLAG, RTF_OVERLAY}, - {"page", CONTROL_SYMBOL, RTF_PAGE}, - {"pagebb", CONTROL_FLAG, RTF_PAGEBB}, - {"panose", CONTROL_DESTINATION, RTF_PANOSE}, - {"paperh", CONTROL_VALUE, RTF_PAPERH}, - {"paperw", CONTROL_VALUE, RTF_PAPERW}, - {"par", CONTROL_SYMBOL, RTF_PAR}, - {"pararsid", CONTROL_VALUE, RTF_PARARSID}, - {"pard", CONTROL_FLAG, RTF_PARD}, - {"password", CONTROL_DESTINATION, RTF_PASSWORD}, - {"passwordhash", CONTROL_DESTINATION, RTF_PASSWORDHASH}, - {"pc", CONTROL_FLAG, RTF_PC}, - {"pca", CONTROL_FLAG, RTF_PCA}, - {"pgbrdrb", CONTROL_FLAG, RTF_PGBRDRB}, - {"pgbrdrfoot", CONTROL_FLAG, RTF_PGBRDRFOOT}, - {"pgbrdrhead", CONTROL_FLAG, RTF_PGBRDRHEAD}, - {"pgbrdrl", CONTROL_FLAG, RTF_PGBRDRL}, - {"pgbrdropt", CONTROL_VALUE, RTF_PGBRDROPT}, - {"pgbrdrr", CONTROL_FLAG, RTF_PGBRDRR}, - {"pgbrdrsnap", CONTROL_FLAG, RTF_PGBRDRSNAP}, - {"pgbrdrt", CONTROL_FLAG, RTF_PGBRDRT}, - {"pghsxn", CONTROL_VALUE, RTF_PGHSXN}, - {"pgnbidia", CONTROL_FLAG, RTF_PGNBIDIA}, - {"pgnbidib", CONTROL_FLAG, RTF_PGNBIDIB}, - {"pgnchosung", CONTROL_FLAG, RTF_PGNCHOSUNG}, - {"pgncnum", CONTROL_FLAG, RTF_PGNCNUM}, - {"pgncont", CONTROL_FLAG, RTF_PGNCONT}, - {"pgndbnum", CONTROL_FLAG, RTF_PGNDBNUM}, - {"pgndbnumd", CONTROL_FLAG, RTF_PGNDBNUMD}, - {"pgndbnumk", CONTROL_FLAG, RTF_PGNDBNUMK}, - {"pgndbnumt", CONTROL_FLAG, RTF_PGNDBNUMT}, - {"pgndec", CONTROL_FLAG, RTF_PGNDEC}, - {"pgndecd", CONTROL_FLAG, RTF_PGNDECD}, - {"pgnganada", CONTROL_FLAG, RTF_PGNGANADA}, - {"pgngbnum", CONTROL_FLAG, RTF_PGNGBNUM}, - {"pgngbnumd", CONTROL_FLAG, RTF_PGNGBNUMD}, - {"pgngbnumk", CONTROL_FLAG, RTF_PGNGBNUMK}, - {"pgngbnuml", CONTROL_FLAG, RTF_PGNGBNUML}, - {"pgnhindia", CONTROL_FLAG, RTF_PGNHINDIA}, - {"pgnhindib", CONTROL_FLAG, RTF_PGNHINDIB}, - {"pgnhindic", CONTROL_FLAG, RTF_PGNHINDIC}, - {"pgnhindid", CONTROL_FLAG, RTF_PGNHINDID}, - {"pgnhn", CONTROL_VALUE, RTF_PGNHN}, - {"pgnhnsc", CONTROL_FLAG, RTF_PGNHNSC}, - {"pgnhnsh", CONTROL_FLAG, RTF_PGNHNSH}, - {"pgnhnsm", CONTROL_FLAG, RTF_PGNHNSM}, - {"pgnhnsn", CONTROL_FLAG, RTF_PGNHNSN}, - {"pgnhnsp", CONTROL_FLAG, RTF_PGNHNSP}, - {"pgnid", CONTROL_FLAG, RTF_PGNID}, - {"pgnlcltr", CONTROL_FLAG, RTF_PGNLCLTR}, - {"pgnlcrm", CONTROL_FLAG, RTF_PGNLCRM}, - {"pgnrestart", CONTROL_FLAG, RTF_PGNRESTART}, - {"pgnstart", CONTROL_VALUE, RTF_PGNSTART}, - {"pgnstarts", CONTROL_VALUE, RTF_PGNSTARTS}, - {"pgnthaia", CONTROL_FLAG, RTF_PGNTHAIA}, - {"pgnthaib", CONTROL_FLAG, RTF_PGNTHAIB}, - {"pgnthaic", CONTROL_FLAG, RTF_PGNTHAIC}, - {"pgnucltr", CONTROL_FLAG, RTF_PGNUCLTR}, - {"pgnucrm", CONTROL_FLAG, RTF_PGNUCRM}, - {"pgnvieta", CONTROL_FLAG, RTF_PGNVIETA}, - {"pgnx", CONTROL_VALUE, RTF_PGNX}, - {"pgny", CONTROL_VALUE, RTF_PGNY}, - {"pgnzodiac", CONTROL_FLAG, RTF_PGNZODIAC}, - {"pgnzodiacd", CONTROL_FLAG, RTF_PGNZODIACD}, - {"pgnzodiacl", CONTROL_FLAG, RTF_PGNZODIACL}, - {"pgp", CONTROL_DESTINATION, RTF_PGP}, - {"pgptbl", CONTROL_DESTINATION, RTF_PGPTBL}, - {"pgwsxn", CONTROL_VALUE, RTF_PGWSXN}, - {"phcol", CONTROL_FLAG, RTF_PHCOL}, - {"phmrg", CONTROL_FLAG, RTF_PHMRG}, - {"phpg", CONTROL_FLAG, RTF_PHPG}, - {"picbmp", CONTROL_FLAG, RTF_PICBMP}, - {"picbpp", CONTROL_VALUE, RTF_PICBPP}, - {"piccropb", CONTROL_VALUE, RTF_PICCROPB}, - {"piccropl", CONTROL_VALUE, RTF_PICCROPL}, - {"piccropr", CONTROL_VALUE, RTF_PICCROPR}, - {"piccropt", CONTROL_VALUE, RTF_PICCROPT}, - {"pich", CONTROL_VALUE, RTF_PICH}, - {"pichgoal", CONTROL_VALUE, RTF_PICHGOAL}, - {"pichGoal", CONTROL_VALUE, RTF_PICHGOAL}, - {"picprop", CONTROL_DESTINATION, RTF_PICPROP}, - {"picscaled", CONTROL_FLAG, RTF_PICSCALED}, - {"picscalex", CONTROL_VALUE, RTF_PICSCALEX}, - {"picscaley", CONTROL_VALUE, RTF_PICSCALEY}, - {"pict", CONTROL_DESTINATION, RTF_PICT}, - {"picw", CONTROL_VALUE, RTF_PICW}, - {"picwgoal", CONTROL_VALUE, RTF_PICWGOAL}, - {"picwGoal", CONTROL_VALUE, RTF_PICWGOAL}, - {"pindtabqc", CONTROL_FLAG, RTF_PINDTABQC}, - {"pindtabql", CONTROL_FLAG, RTF_PINDTABQL}, - {"pindtabqr", CONTROL_FLAG, RTF_PINDTABQR}, - {"plain", CONTROL_FLAG, RTF_PLAIN}, - {"pmartabqc", CONTROL_FLAG, RTF_PMARTABQC}, - {"pmartabql", CONTROL_FLAG, RTF_PMARTABQL}, - {"pmartabqr", CONTROL_FLAG, RTF_PMARTABQR}, - {"pmmetafile", CONTROL_VALUE, RTF_PMMETAFILE}, - {"pn", CONTROL_DESTINATION, RTF_PN}, - {"pnacross", CONTROL_FLAG, RTF_PNACROSS}, - {"pnaiu", CONTROL_FLAG, RTF_PNAIU}, - {"pnaiud", CONTROL_FLAG, RTF_PNAIUD}, - {"pnaiueo", CONTROL_FLAG, RTF_PNAIUEO}, - {"pnaiueod", CONTROL_FLAG, RTF_PNAIUEOD}, - {"pnb", CONTROL_TOGGLE, RTF_PNB}, - {"pnbidia", CONTROL_FLAG, RTF_PNBIDIA}, - {"pnbidib", CONTROL_FLAG, RTF_PNBIDIB}, - {"pncaps", CONTROL_TOGGLE, RTF_PNCAPS}, - {"pncard", CONTROL_FLAG, RTF_PNCARD}, - {"pncf", CONTROL_VALUE, RTF_PNCF}, - {"pnchosung", CONTROL_FLAG, RTF_PNCHOSUNG}, - {"pncnum", CONTROL_FLAG, RTF_PNCNUM}, - {"pndbnum", CONTROL_FLAG, RTF_PNDBNUM}, - {"pndbnumd", CONTROL_FLAG, RTF_PNDBNUMD}, - {"pndbnumk", CONTROL_FLAG, RTF_PNDBNUMK}, - {"pndbnuml", CONTROL_FLAG, RTF_PNDBNUML}, - {"pndbnumt", CONTROL_FLAG, RTF_PNDBNUMT}, - {"pndec", CONTROL_FLAG, RTF_PNDEC}, - {"pndecd", CONTROL_FLAG, RTF_PNDECD}, - {"pnf", CONTROL_VALUE, RTF_PNF}, - {"pnfs", CONTROL_VALUE, RTF_PNFS}, - {"pnganada", CONTROL_FLAG, RTF_PNGANADA}, - {"pngblip", CONTROL_FLAG, RTF_PNGBLIP}, - {"pngbnum", CONTROL_FLAG, RTF_PNGBNUM}, - {"pngbnumd", CONTROL_FLAG, RTF_PNGBNUMD}, - {"pngbnumk", CONTROL_FLAG, RTF_PNGBNUMK}, - {"pngbnuml", CONTROL_FLAG, RTF_PNGBNUML}, - {"pnhang", CONTROL_FLAG, RTF_PNHANG}, - {"pni", CONTROL_TOGGLE, RTF_PNI}, - {"pnindent", CONTROL_VALUE, RTF_PNINDENT}, - {"pniroha", CONTROL_FLAG, RTF_PNIROHA}, - {"pnirohad", CONTROL_FLAG, RTF_PNIROHAD}, - {"pnlcltr", CONTROL_FLAG, RTF_PNLCLTR}, - {"pnlcrm", CONTROL_FLAG, RTF_PNLCRM}, - {"pnlvl", CONTROL_VALUE, RTF_PNLVL}, - {"pnlvlblt", CONTROL_FLAG, RTF_PNLVLBLT}, - {"pnlvlbody", CONTROL_FLAG, RTF_PNLVLBODY}, - {"pnlvlcont", CONTROL_FLAG, RTF_PNLVLCONT}, - {"pnnumonce", CONTROL_FLAG, RTF_PNNUMONCE}, - {"pnord", CONTROL_FLAG, RTF_PNORD}, - {"pnordt", CONTROL_FLAG, RTF_PNORDT}, - {"pnprev", CONTROL_FLAG, RTF_PNPREV}, - {"pnqc", CONTROL_FLAG, RTF_PNQC}, - {"pnql", CONTROL_FLAG, RTF_PNQL}, - {"pnqr", CONTROL_FLAG, RTF_PNQR}, - {"pnrauth", CONTROL_VALUE, RTF_PNRAUTH}, - {"pnrdate", CONTROL_VALUE, RTF_PNRDATE}, - {"pnrestart", CONTROL_FLAG, RTF_PNRESTART}, - {"pnrnfc", CONTROL_VALUE, RTF_PNRNFC}, - {"pnrnot", CONTROL_FLAG, RTF_PNRNOT}, - {"pnrpnbr", CONTROL_VALUE, RTF_PNRPNBR}, - {"pnrrgb", CONTROL_VALUE, RTF_PNRRGB}, - {"pnrstart", CONTROL_VALUE, RTF_PNRSTART}, - {"pnrstop", CONTROL_VALUE, RTF_PNRSTOP}, - {"pnrxst", CONTROL_VALUE, RTF_PNRXST}, - {"pnscaps", CONTROL_TOGGLE, RTF_PNSCAPS}, - {"pnseclvl", CONTROL_DESTINATION, RTF_PNSECLVL}, - {"pnsp", CONTROL_VALUE, RTF_PNSP}, - {"pnstart", CONTROL_VALUE, RTF_PNSTART}, - {"pnstrike", CONTROL_TOGGLE, RTF_PNSTRIKE}, - {"pntext", CONTROL_DESTINATION, RTF_PNTEXT}, - {"pntxta", CONTROL_DESTINATION, RTF_PNTXTA}, - {"pntxtb", CONTROL_DESTINATION, RTF_PNTXTB}, - {"pnucltr", CONTROL_FLAG, RTF_PNUCLTR}, - {"pnucrm", CONTROL_FLAG, RTF_PNUCRM}, - {"pnul", CONTROL_TOGGLE, RTF_PNUL}, - {"pnuld", CONTROL_FLAG, RTF_PNULD}, - {"pnuldash", CONTROL_FLAG, RTF_PNULDASH}, - {"pnuldashd", CONTROL_FLAG, RTF_PNULDASHD}, - {"pnuldashdd", CONTROL_FLAG, RTF_PNULDASHDD}, - {"pnuldb", CONTROL_FLAG, RTF_PNULDB}, - {"pnulhair", CONTROL_FLAG, RTF_PNULHAIR}, - {"pnulnone", CONTROL_FLAG, RTF_PNULNONE}, - {"pnulth", CONTROL_FLAG, RTF_PNULTH}, - {"pnulw", CONTROL_FLAG, RTF_PNULW}, - {"pnulwave", CONTROL_FLAG, RTF_PNULWAVE}, - {"pnzodiac", CONTROL_FLAG, RTF_PNZODIAC}, - {"pnzodiacd", CONTROL_FLAG, RTF_PNZODIACD}, - {"pnzodiacl", CONTROL_FLAG, RTF_PNZODIACL}, - {"posnegx", CONTROL_VALUE, RTF_POSNEGX}, - {"posnegy", CONTROL_VALUE, RTF_POSNEGY}, - {"posx", CONTROL_VALUE, RTF_POSX}, - {"posxc", CONTROL_FLAG, RTF_POSXC}, - {"posxi", CONTROL_FLAG, RTF_POSXI}, - {"posxl", CONTROL_FLAG, RTF_POSXL}, - {"posxo", CONTROL_FLAG, RTF_POSXO}, - {"posxr", CONTROL_FLAG, RTF_POSXR}, - {"posy", CONTROL_VALUE, RTF_POSY}, - {"posyb", CONTROL_FLAG, RTF_POSYB}, - {"posyc", CONTROL_FLAG, RTF_POSYC}, - {"posyil", CONTROL_FLAG, RTF_POSYIL}, - {"posyin", CONTROL_FLAG, RTF_POSYIN}, - {"posyout", CONTROL_FLAG, RTF_POSYOUT}, - {"posyt", CONTROL_FLAG, RTF_POSYT}, - {"prauth", CONTROL_VALUE, RTF_PRAUTH}, - {"prcolbl", CONTROL_FLAG, RTF_PRCOLBL}, - {"prdate", CONTROL_VALUE, RTF_PRDATE}, - {"printdata", CONTROL_FLAG, RTF_PRINTDATA}, - {"printim", CONTROL_DESTINATION, RTF_PRINTIM}, - {"private", CONTROL_DESTINATION, RTF_PRIVATE}, - {"propname", CONTROL_DESTINATION, RTF_PROPNAME}, - {"proptype", CONTROL_VALUE, RTF_PROPTYPE}, - {"protect", CONTROL_TOGGLE, RTF_PROTECT}, - {"protend", CONTROL_DESTINATION, RTF_PROTEND}, - {"protlevel", CONTROL_VALUE, RTF_PROTLEVEL}, - {"protstart", CONTROL_DESTINATION, RTF_PROTSTART}, - {"protusertbl", CONTROL_DESTINATION, RTF_PROTUSERTBL}, - {"psover", CONTROL_FLAG, RTF_PSOVER}, - {"psz", CONTROL_VALUE, RTF_PSZ}, - {"ptabldot", CONTROL_FLAG, RTF_PTABLDOT}, - {"ptablmdot", CONTROL_FLAG, RTF_PTABLMDOT}, - {"ptablminus", CONTROL_FLAG, RTF_PTABLMINUS}, - {"ptablnone", CONTROL_FLAG, RTF_PTABLNONE}, - {"ptabluscore", CONTROL_FLAG, RTF_PTABLUSCORE}, - {"pubauto", CONTROL_FLAG, RTF_PUBAUTO}, - {"pvmrg", CONTROL_FLAG, RTF_PVMRG}, - {"pvpara", CONTROL_FLAG, RTF_PVPARA}, - {"pvpg", CONTROL_FLAG, RTF_PVPG}, - {"pwd", CONTROL_VALUE, RTF_PWD}, - {"pxe", CONTROL_DESTINATION, RTF_PXE}, - {"qc", CONTROL_FLAG, RTF_QC}, - {"qd", CONTROL_FLAG, RTF_QD}, - {"qj", CONTROL_FLAG, RTF_QJ}, - {"qk", CONTROL_VALUE, RTF_QK}, - {"ql", CONTROL_FLAG, RTF_QL}, - {"qmspace", CONTROL_SYMBOL, RTF_QMSPACE}, - {"qr", CONTROL_FLAG, RTF_QR}, - {"qt", CONTROL_FLAG, RTF_QT}, - {"rawclbgdkbdiag", CONTROL_FLAG, RTF_RAWCLBGDKBDIAG}, - {"rawclbgbdiag", CONTROL_FLAG, RTF_RAWCLBGBDIAG}, - {"rawclbgcross", CONTROL_FLAG, RTF_RAWCLBGCROSS}, - {"rawclbgdcross", CONTROL_FLAG, RTF_RAWCLBGDCROSS}, - {"rawclbgdkcross", CONTROL_FLAG, RTF_RAWCLBGDKCROSS}, - {"rawclbgdkdcross", CONTROL_FLAG, RTF_RAWCLBGDKDCROSS}, - {"rawclbgdkfdiag", CONTROL_FLAG, RTF_RAWCLBGDKFDIAG}, - {"rawclbgdkhor", CONTROL_FLAG, RTF_RAWCLBGDKHOR}, - {"rawclbgdkvert", CONTROL_FLAG, RTF_RAWCLBGDKVERT}, - {"rawclbgfdiag", CONTROL_FLAG, RTF_RAWCLBGFDIAG}, - {"rawclbghoriz", CONTROL_FLAG, RTF_RAWCLBGHORIZ}, - {"rawclbgvert", CONTROL_FLAG, RTF_RAWCLBGVERT}, - {"rdblquote", CONTROL_SYMBOL, RTF_RDBLQUOTE}, - {"readonlyrecommended", CONTROL_FLAG, RTF_READONLYRECOMMENDED}, - {"readprot", CONTROL_FLAG, RTF_READPROT}, - {"red", CONTROL_VALUE, RTF_RED}, - {"relyonvml", CONTROL_VALUE, RTF_RELYONVML}, - {"remdttm", CONTROL_FLAG, RTF_REMDTTM}, - {"rempersonalinfo", CONTROL_FLAG, RTF_REMPERSONALINFO}, - {"result", CONTROL_DESTINATION, RTF_RESULT}, - {"revauth", CONTROL_VALUE, RTF_REVAUTH}, - {"revauthdel", CONTROL_VALUE, RTF_REVAUTHDEL}, - {"revbar", CONTROL_VALUE, RTF_REVBAR}, - {"revdttm", CONTROL_VALUE, RTF_REVDTTM}, - {"revdttmdel", CONTROL_VALUE, RTF_REVDTTMDEL}, - {"revised", CONTROL_TOGGLE, RTF_REVISED}, - {"revisions", CONTROL_FLAG, RTF_REVISIONS}, - {"revprop", CONTROL_VALUE, RTF_REVPROP}, - {"revprot", CONTROL_FLAG, RTF_REVPROT}, - {"revtbl", CONTROL_DESTINATION, RTF_REVTBL}, - {"revtim", CONTROL_DESTINATION, RTF_REVTIM}, - {"ri", CONTROL_VALUE, RTF_RI}, - {"rin", CONTROL_VALUE, RTF_RIN}, - {"row", CONTROL_SYMBOL, RTF_ROW}, - {"rquote", CONTROL_SYMBOL, RTF_RQUOTE}, - {"rsid", CONTROL_VALUE, RTF_RSID}, - {"rsidroot", CONTROL_VALUE, RTF_RSIDROOT}, - {"rsidtbl", CONTROL_DESTINATION, RTF_RSIDTBL}, - {"rsltbmp", CONTROL_FLAG, RTF_RSLTBMP}, - {"rslthtml", CONTROL_FLAG, RTF_RSLTHTML}, - {"rsltmerge", CONTROL_FLAG, RTF_RSLTMERGE}, - {"rsltpict", CONTROL_FLAG, RTF_RSLTPICT}, - {"rsltrtf", CONTROL_FLAG, RTF_RSLTRTF}, - {"rslttxt", CONTROL_FLAG, RTF_RSLTTXT}, - {"rtf", CONTROL_DESTINATION, RTF_RTF}, - {"rtlch", CONTROL_FLAG, RTF_RTLCH}, - {"rtldoc", CONTROL_FLAG, RTF_RTLDOC}, - {"rtlgutter", CONTROL_FLAG, RTF_RTLGUTTER}, - {"rtlmark", CONTROL_SYMBOL, RTF_RTLMARK}, - {"rtlpar", CONTROL_FLAG, RTF_RTLPAR}, - {"rtlrow", CONTROL_FLAG, RTF_RTLROW}, - {"rtlsect", CONTROL_FLAG, RTF_RTLSECT}, - {"rxe", CONTROL_DESTINATION, RTF_RXE}, - {"s", CONTROL_VALUE, RTF_S}, - {"sa", CONTROL_VALUE, RTF_SA}, - {"saauto", CONTROL_TOGGLE, RTF_SAAUTO}, - {"saftnnalc", CONTROL_FLAG, RTF_SAFTNNALC}, - {"saftnnar", CONTROL_FLAG, RTF_SAFTNNAR}, - {"saftnnauc", CONTROL_FLAG, RTF_SAFTNNAUC}, - {"saftnnchi", CONTROL_FLAG, RTF_SAFTNNCHI}, - {"saftnnchosung", CONTROL_FLAG, RTF_SAFTNNCHOSUNG}, - {"saftnncnum", CONTROL_FLAG, RTF_SAFTNNCNUM}, - {"saftnndbar", CONTROL_FLAG, RTF_SAFTNNDBAR}, - {"saftnndbnum", CONTROL_FLAG, RTF_SAFTNNDBNUM}, - {"saftnndbnumd", CONTROL_FLAG, RTF_SAFTNNDBNUMD}, - {"saftnndbnumk", CONTROL_FLAG, RTF_SAFTNNDBNUMK}, - {"saftnndbnumt", CONTROL_FLAG, RTF_SAFTNNDBNUMT}, - {"saftnnganada", CONTROL_FLAG, RTF_SAFTNNGANADA}, - {"saftnngbnum", CONTROL_FLAG, RTF_SAFTNNGBNUM}, - {"saftnngbnumd", CONTROL_FLAG, RTF_SAFTNNGBNUMD}, - {"saftnngbnumk", CONTROL_FLAG, RTF_SAFTNNGBNUMK}, - {"saftnngbnuml", CONTROL_FLAG, RTF_SAFTNNGBNUML}, - {"saftnnrlc", CONTROL_FLAG, RTF_SAFTNNRLC}, - {"saftnnruc", CONTROL_FLAG, RTF_SAFTNNRUC}, - {"saftnnzodiac", CONTROL_FLAG, RTF_SAFTNNZODIAC}, - {"saftnnzodiacd", CONTROL_FLAG, RTF_SAFTNNZODIACD}, - {"saftnnzodiacl", CONTROL_FLAG, RTF_SAFTNNZODIACL}, - {"saftnrestart", CONTROL_FLAG, RTF_SAFTNRESTART}, - {"saftnrstcont", CONTROL_FLAG, RTF_SAFTNRSTCONT}, - {"saftnstart", CONTROL_VALUE, RTF_SAFTNSTART}, - {"sautoupd", CONTROL_FLAG, RTF_SAUTOUPD}, - {"saveinvalidxml", CONTROL_FLAG, RTF_SAVEINVALIDXML}, - {"saveprevpict", CONTROL_FLAG, RTF_SAVEPREVPICT}, - {"sb", CONTROL_VALUE, RTF_SB}, - {"sbasedon", CONTROL_VALUE, RTF_SBASEDON}, - {"sbauto", CONTROL_TOGGLE, RTF_SBAUTO}, - {"sbkcol", CONTROL_FLAG, RTF_SBKCOL}, - {"sbkeven", CONTROL_FLAG, RTF_SBKEVEN}, - {"sbknone", CONTROL_FLAG, RTF_SBKNONE}, - {"sbkodd", CONTROL_FLAG, RTF_SBKODD}, - {"sbkpage", CONTROL_FLAG, RTF_SBKPAGE}, - {"sbys", CONTROL_FLAG, RTF_SBYS}, - {"scaps", CONTROL_TOGGLE, RTF_SCAPS}, - {"scompose", CONTROL_FLAG, RTF_SCOMPOSE}, - {"sec", CONTROL_VALUE, RTF_SEC}, - {"sect", CONTROL_SYMBOL, RTF_SECT}, - {"sectd", CONTROL_FLAG, RTF_SECTD}, - {"sectdefaultcl", CONTROL_FLAG, RTF_SECTDEFAULTCL}, - {"sectexpand", CONTROL_VALUE, RTF_SECTEXPAND}, - {"sectlinegrid", CONTROL_VALUE, RTF_SECTLINEGRID}, - {"sectnum", CONTROL_SYMBOL, RTF_SECTNUM}, - {"sectrsid", CONTROL_VALUE, RTF_SECTRSID}, - {"sectspecifycl", CONTROL_FLAG, RTF_SECTSPECIFYCL}, - {"sectspecifygenN", CONTROL_FLAG, RTF_SECTSPECIFYGENN}, - {"sectspecifyl", CONTROL_FLAG, RTF_SECTSPECIFYL}, - {"sectunlocked", CONTROL_FLAG, RTF_SECTUNLOCKED}, - {"sftnbj", CONTROL_FLAG, RTF_SFTNBJ}, - {"sftnnalc", CONTROL_FLAG, RTF_SFTNNALC}, - {"sftnnar", CONTROL_FLAG, RTF_SFTNNAR}, - {"sftnnauc", CONTROL_FLAG, RTF_SFTNNAUC}, - {"sftnnchi", CONTROL_FLAG, RTF_SFTNNCHI}, - {"sftnnchosung", CONTROL_FLAG, RTF_SFTNNCHOSUNG}, - {"sftnncnum", CONTROL_FLAG, RTF_SFTNNCNUM}, - {"sftnndbar", CONTROL_FLAG, RTF_SFTNNDBAR}, - {"sftnndbnum", CONTROL_FLAG, RTF_SFTNNDBNUM}, - {"sftnndbnumd", CONTROL_FLAG, RTF_SFTNNDBNUMD}, - {"sftnndbnumk", CONTROL_FLAG, RTF_SFTNNDBNUMK}, - {"sftnndbnumt", CONTROL_FLAG, RTF_SFTNNDBNUMT}, - {"sftnnganada", CONTROL_FLAG, RTF_SFTNNGANADA}, - {"sftnngbnum", CONTROL_FLAG, RTF_SFTNNGBNUM}, - {"sftnngbnumd", CONTROL_FLAG, RTF_SFTNNGBNUMD}, - {"sftnngbnumk", CONTROL_FLAG, RTF_SFTNNGBNUMK}, - {"sftnngbnuml", CONTROL_FLAG, RTF_SFTNNGBNUML}, - {"sftnnrlc", CONTROL_FLAG, RTF_SFTNNRLC}, - {"sftnnruc", CONTROL_FLAG, RTF_SFTNNRUC}, - {"sftnnzodiac", CONTROL_FLAG, RTF_SFTNNZODIAC}, - {"sftnnzodiacd", CONTROL_FLAG, RTF_SFTNNZODIACD}, - {"sftnnzodiacl", CONTROL_FLAG, RTF_SFTNNZODIACL}, - {"sftnrestart", CONTROL_FLAG, RTF_SFTNRESTART}, - {"sftnrstcont", CONTROL_FLAG, RTF_SFTNRSTCONT}, - {"sftnrstpg", CONTROL_FLAG, RTF_SFTNRSTPG}, - {"sftnstart", CONTROL_VALUE, RTF_SFTNSTART}, - {"sftntj", CONTROL_FLAG, RTF_SFTNTJ}, - {"shad", CONTROL_TOGGLE, RTF_SHAD}, - {"shading", CONTROL_VALUE, RTF_SHADING}, - {"shidden", CONTROL_FLAG, RTF_SHIDDEN}, - {"shift", CONTROL_FLAG, RTF_SHIFT}, - {"showplaceholdtext", CONTROL_VALUE, RTF_SHOWPLACEHOLDTEXT}, - {"showxmlerrors", CONTROL_VALUE, RTF_SHOWXMLERRORS}, - {"shp", CONTROL_DESTINATION, RTF_SHP}, - {"shpbottom", CONTROL_VALUE, RTF_SHPBOTTOM}, - {"shpbxcolumn", CONTROL_FLAG, RTF_SHPBXCOLUMN}, - {"shpbxignore", CONTROL_FLAG, RTF_SHPBXIGNORE}, - {"shpbxmargin", CONTROL_FLAG, RTF_SHPBXMARGIN}, - {"shpbxpage", CONTROL_FLAG, RTF_SHPBXPAGE}, - {"shpbyignore", CONTROL_FLAG, RTF_SHPBYIGNORE}, - {"shpbymargin", CONTROL_FLAG, RTF_SHPBYMARGIN}, - {"shpbypage", CONTROL_FLAG, RTF_SHPBYPAGE}, - {"shpbypara", CONTROL_FLAG, RTF_SHPBYPARA}, - {"shpfblwtxt", CONTROL_VALUE, RTF_SHPFBLWTXT}, - {"shpfhdr", CONTROL_VALUE, RTF_SHPFHDR}, - {"shpgrp", CONTROL_DESTINATION, RTF_SHPGRP}, - {"shpinst", CONTROL_DESTINATION, RTF_SHPINST}, - {"shpleft", CONTROL_VALUE, RTF_SHPLEFT}, - {"shplid", CONTROL_VALUE, RTF_SHPLID}, - {"shplockanchor", CONTROL_FLAG, RTF_SHPLOCKANCHOR}, - {"shppict", CONTROL_DESTINATION, RTF_SHPPICT}, - {"shpright", CONTROL_VALUE, RTF_SHPRIGHT}, - {"shprslt", CONTROL_DESTINATION, RTF_SHPRSLT}, - {"shptop", CONTROL_VALUE, RTF_SHPTOP}, - {"shptxt", CONTROL_DESTINATION, RTF_SHPTXT}, - {"shpwrk", CONTROL_VALUE, RTF_SHPWRK}, - {"shpwr", CONTROL_VALUE, RTF_SHPWR}, - {"shpz", CONTROL_VALUE, RTF_SHPZ}, - {"sl", CONTROL_VALUE, RTF_SL}, - {"slink", CONTROL_VALUE, RTF_SLINK}, - {"slmult", CONTROL_VALUE, RTF_SLMULT}, - {"slocked", CONTROL_FLAG, RTF_SLOCKED}, - {"sn", CONTROL_DESTINATION, RTF_SN}, - {"snaptogridincell", CONTROL_FLAG, RTF_SNAPTOGRIDINCELL}, - {"snext", CONTROL_VALUE, RTF_SNEXT}, - {"softcol", CONTROL_FLAG, RTF_SOFTCOL}, - {"softlheight", CONTROL_VALUE, RTF_SOFTLHEIGHT}, - {"softline", CONTROL_FLAG, RTF_SOFTLINE}, - {"softpage", CONTROL_FLAG, RTF_SOFTPAGE}, - {"sp", CONTROL_DESTINATION, RTF_SP}, - {"spersonal", CONTROL_FLAG, RTF_SPERSONAL}, - {"spltpgpar", CONTROL_FLAG, RTF_SPLTPGPAR}, - {"splytwnine", CONTROL_FLAG, RTF_SPLYTWNINE}, - {"spriority", CONTROL_VALUE, RTF_SPRIORITY}, - {"sprsbsp", CONTROL_FLAG, RTF_SPRSBSP}, - {"sprslnsp", CONTROL_FLAG, RTF_SPRSLNSP}, - {"sprsspbf", CONTROL_FLAG, RTF_SPRSSPBF}, - {"sprstsm", CONTROL_FLAG, RTF_SPRSTSM}, - {"sprstsp", CONTROL_FLAG, RTF_SPRSTSP}, - {"spv", CONTROL_FLAG, RTF_SPV}, - {"sqformat", CONTROL_FLAG, RTF_SQFORMAT}, - {"srauth", CONTROL_VALUE, RTF_SRAUTH}, - {"srdate", CONTROL_VALUE, RTF_SRDATE}, - {"sreply", CONTROL_FLAG, RTF_SREPLY}, - {"ssemihidden", CONTROL_VALUE, RTF_SSEMIHIDDEN}, - {"staticval", CONTROL_DESTINATION, RTF_STATICVAL}, - {"stextflow", CONTROL_VALUE, RTF_STEXTFLOW}, - {"strike", CONTROL_TOGGLE, RTF_STRIKE}, - {"striked", CONTROL_TOGGLE, RTF_STRIKED}, - {"stshfbi", CONTROL_VALUE, RTF_STSHFBI}, - {"stshfdbch", CONTROL_VALUE, RTF_STSHFDBCH}, - {"stshfhich", CONTROL_VALUE, RTF_STSHFHICH}, - {"stshfloch", CONTROL_VALUE, RTF_STSHFLOCH}, - {"stylelock", CONTROL_FLAG, RTF_STYLELOCK}, - {"stylelockbackcomp", CONTROL_FLAG, RTF_STYLELOCKBACKCOMP}, - {"stylelockenforced", CONTROL_FLAG, RTF_STYLELOCKENFORCED}, - {"stylelockqfset", CONTROL_FLAG, RTF_STYLELOCKQFSET}, - {"stylelocktheme", CONTROL_FLAG, RTF_STYLELOCKTHEME}, - {"stylesheet", CONTROL_DESTINATION, RTF_STYLESHEET}, - {"stylesortmethod", CONTROL_VALUE, RTF_STYLESORTMETHOD}, - {"styrsid", CONTROL_VALUE, RTF_STYRSID}, - {"sub", CONTROL_FLAG, RTF_SUB}, - {"subdocument", CONTROL_VALUE, RTF_SUBDOCUMENT}, - {"subfontbysize", CONTROL_FLAG, RTF_SUBFONTBYSIZE}, - {"subject", CONTROL_DESTINATION, RTF_SUBJECT}, - {"sunhideused", CONTROL_VALUE, RTF_SUNHIDEUSED}, - {"super", CONTROL_FLAG, RTF_SUPER}, - {"sv", CONTROL_DESTINATION, RTF_SV}, - {"svb", CONTROL_DESTINATION, RTF_SVB}, - {"swpbdr", CONTROL_FLAG, RTF_SWPBDR}, - {"tab", CONTROL_SYMBOL, RTF_TAB}, - {"tabsnoovrlp", CONTROL_FLAG, RTF_TABSNOOVRLP}, - {"taprtl", CONTROL_FLAG, RTF_TAPRTL}, - {"tb", CONTROL_VALUE, RTF_TB}, - {"tblind", CONTROL_VALUE, RTF_TBLIND}, - {"tblindtype", CONTROL_VALUE, RTF_TBLINDTYPE}, - {"tbllkbestfit", CONTROL_FLAG, RTF_TBLLKBESTFIT}, - {"tbllkborder", CONTROL_FLAG, RTF_TBLLKBORDER}, - {"tbllkcolor", CONTROL_FLAG, RTF_TBLLKCOLOR}, - {"tbllkfont", CONTROL_FLAG, RTF_TBLLKFONT}, - {"tbllkhdrcols", CONTROL_FLAG, RTF_TBLLKHDRCOLS}, - {"tbllkhdrrows", CONTROL_FLAG, RTF_TBLLKHDRROWS}, - {"tbllklastcol", CONTROL_FLAG, RTF_TBLLKLASTCOL}, - {"tbllklastrow", CONTROL_FLAG, RTF_TBLLKLASTROW}, - {"tbllknocolband", CONTROL_FLAG, RTF_TBLLKNOCOLBAND}, - {"tbllknorowband", CONTROL_FLAG, RTF_TBLLKNOROWBAND}, - {"tbllkshading", CONTROL_FLAG, RTF_TBLLKSHADING}, - {"tblrsid", CONTROL_VALUE, RTF_TBLRSID}, - {"tc", CONTROL_DESTINATION, RTF_TC}, - {"tcelld", CONTROL_FLAG, RTF_TCELLD}, - {"tcf", CONTROL_VALUE, RTF_TCF}, - {"tcl", CONTROL_VALUE, RTF_TCL}, - {"tcn", CONTROL_FLAG, RTF_TCN}, - {"tdfrmtxtBottom", CONTROL_VALUE, RTF_TDFRMTXTBOTTOM}, - {"tdfrmtxtLeft", CONTROL_VALUE, RTF_TDFRMTXTLEFT}, - {"tdfrmtxtRight", CONTROL_VALUE, RTF_TDFRMTXTRIGHT}, - {"tdfrmtxtTop", CONTROL_VALUE, RTF_TDFRMTXTTOP}, - {"template", CONTROL_DESTINATION, RTF_TEMPLATE}, - {"themedata", CONTROL_DESTINATION, RTF_THEMEDATA}, - {"themelang", CONTROL_VALUE, RTF_THEMELANG}, - {"themelangcs", CONTROL_VALUE, RTF_THEMELANGCS}, - {"themelangfe", CONTROL_VALUE, RTF_THEMELANGFE}, - {"time", CONTROL_FLAG, RTF_TIME}, - {"title", CONTROL_DESTINATION, RTF_TITLE}, - {"titlepg", CONTROL_FLAG, RTF_TITLEPG}, - {"tldot", CONTROL_FLAG, RTF_TLDOT}, - {"tleq", CONTROL_FLAG, RTF_TLEQ}, - {"tlhyph", CONTROL_FLAG, RTF_TLHYPH}, - {"tlmdot", CONTROL_FLAG, RTF_TLMDOT}, - {"tlth", CONTROL_FLAG, RTF_TLTH}, - {"tlul", CONTROL_FLAG, RTF_TLUL}, - {"toplinepunct", CONTROL_FLAG, RTF_TOPLINEPUNCT}, - {"tphcol", CONTROL_FLAG, RTF_TPHCOL}, - {"tphmrg", CONTROL_FLAG, RTF_TPHMRG}, - {"tphpg", CONTROL_FLAG, RTF_TPHPG}, - {"tposnegx", CONTROL_VALUE, RTF_TPOSNEGX}, - {"tposnegy", CONTROL_VALUE, RTF_TPOSNEGY}, - {"tposxc", CONTROL_FLAG, RTF_TPOSXC}, - {"tposxi", CONTROL_FLAG, RTF_TPOSXI}, - {"tposxl", CONTROL_FLAG, RTF_TPOSXL}, - {"tposx", CONTROL_VALUE, RTF_TPOSX}, - {"tposxo", CONTROL_FLAG, RTF_TPOSXO}, - {"tposxr", CONTROL_FLAG, RTF_TPOSXR}, - {"tposy", CONTROL_VALUE, RTF_TPOSY}, - {"tposyb", CONTROL_FLAG, RTF_TPOSYB}, - {"tposyc", CONTROL_FLAG, RTF_TPOSYC}, - {"tposyil", CONTROL_FLAG, RTF_TPOSYIL}, - {"tposyin", CONTROL_FLAG, RTF_TPOSYIN}, - {"tposyout", CONTROL_FLAG, RTF_TPOSYOUT}, - {"tposyt", CONTROL_FLAG, RTF_TPOSYT}, - {"tpvmrg", CONTROL_FLAG, RTF_TPVMRG}, - {"tpvpara", CONTROL_FLAG, RTF_TPVPARA}, - {"tpvpg", CONTROL_FLAG, RTF_TPVPG}, - {"tqc", CONTROL_FLAG, RTF_TQC}, - {"tqdec", CONTROL_FLAG, RTF_TQDEC}, - {"tqr", CONTROL_FLAG, RTF_TQR}, - {"trackformatting", CONTROL_VALUE, RTF_TRACKFORMATTING}, - {"trackmoves", CONTROL_VALUE, RTF_TRACKMOVES}, - {"transmf", CONTROL_FLAG, RTF_TRANSMF}, - {"trauth", CONTROL_VALUE, RTF_TRAUTH}, - {"trautofit", CONTROL_TOGGLE, RTF_TRAUTOFIT}, - {"trbgbdiag", CONTROL_FLAG, RTF_TRBGBDIAG}, - {"trbgcross", CONTROL_FLAG, RTF_TRBGCROSS}, - {"trbgdcross", CONTROL_FLAG, RTF_TRBGDCROSS}, - {"trbgdkbdiag", CONTROL_FLAG, RTF_TRBGDKBDIAG}, - {"trbgdkcross", CONTROL_FLAG, RTF_TRBGDKCROSS}, - {"trbgdkdcross", CONTROL_FLAG, RTF_TRBGDKDCROSS}, - {"trbgdkfdiag", CONTROL_FLAG, RTF_TRBGDKFDIAG}, - {"trbgdkhor", CONTROL_FLAG, RTF_TRBGDKHOR}, - {"trbgdkvert", CONTROL_FLAG, RTF_TRBGDKVERT}, - {"trbgfdiag", CONTROL_FLAG, RTF_TRBGFDIAG}, - {"trbghoriz", CONTROL_FLAG, RTF_TRBGHORIZ}, - {"trbgvert", CONTROL_FLAG, RTF_TRBGVERT}, - {"trbrdrb", CONTROL_FLAG, RTF_TRBRDRB}, - {"trbrdrh", CONTROL_FLAG, RTF_TRBRDRH}, - {"trbrdrl", CONTROL_FLAG, RTF_TRBRDRL}, - {"trbrdrr", CONTROL_FLAG, RTF_TRBRDRR}, - {"trbrdrt", CONTROL_FLAG, RTF_TRBRDRT}, - {"trbrdrv", CONTROL_FLAG, RTF_TRBRDRV}, - {"trcbpat", CONTROL_VALUE, RTF_TRCBPAT}, - {"trcfpat", CONTROL_VALUE, RTF_TRCFPAT}, - {"trdate", CONTROL_VALUE, RTF_TRDATE}, - {"trftsWidthA", CONTROL_VALUE, RTF_TRFTSWIDTHA}, - {"trftsWidthB", CONTROL_VALUE, RTF_TRFTSWIDTHB}, - {"trftsWidth", CONTROL_VALUE, RTF_TRFTSWIDTH}, - {"trgaph", CONTROL_VALUE, RTF_TRGAPH}, - {"trhdr", CONTROL_FLAG, RTF_TRHDR}, - {"trkeep", CONTROL_FLAG, RTF_TRKEEP}, - {"trkeepfollow", CONTROL_FLAG, RTF_TRKEEPFOLLOW}, - {"trleft", CONTROL_VALUE, RTF_TRLEFT}, - {"trowd", CONTROL_FLAG, RTF_TROWD}, - {"trpaddb", CONTROL_VALUE, RTF_TRPADDB}, - {"trpaddfb", CONTROL_VALUE, RTF_TRPADDFB}, - {"trpaddfl", CONTROL_VALUE, RTF_TRPADDFL}, - {"trpaddfr", CONTROL_VALUE, RTF_TRPADDFR}, - {"trpaddft", CONTROL_VALUE, RTF_TRPADDFT}, - {"trpaddl", CONTROL_VALUE, RTF_TRPADDL}, - {"trpaddr", CONTROL_VALUE, RTF_TRPADDR}, - {"trpaddt", CONTROL_VALUE, RTF_TRPADDT}, - {"trpadob", CONTROL_VALUE, RTF_TRPADOB}, - {"trpadofb", CONTROL_VALUE, RTF_TRPADOFB}, - {"trpadofl", CONTROL_VALUE, RTF_TRPADOFL}, - {"trpadofr", CONTROL_VALUE, RTF_TRPADOFR}, - {"trpadoft", CONTROL_VALUE, RTF_TRPADOFT}, - {"trpadol", CONTROL_VALUE, RTF_TRPADOL}, - {"trpador", CONTROL_VALUE, RTF_TRPADOR}, - {"trpadot", CONTROL_VALUE, RTF_TRPADOT}, - {"trpat", CONTROL_VALUE, RTF_TRPAT}, - {"trqc", CONTROL_FLAG, RTF_TRQC}, - {"trql", CONTROL_FLAG, RTF_TRQL}, - {"trqr", CONTROL_FLAG, RTF_TRQR}, - {"trrh", CONTROL_VALUE, RTF_TRRH}, - {"trshdng", CONTROL_VALUE, RTF_TRSHDNG}, - {"trspdb", CONTROL_VALUE, RTF_TRSPDB}, - {"trspdfb", CONTROL_VALUE, RTF_TRSPDFB}, - {"trspdfl", CONTROL_VALUE, RTF_TRSPDFL}, - {"trspdfr", CONTROL_VALUE, RTF_TRSPDFR}, - {"trspdft", CONTROL_VALUE, RTF_TRSPDFT}, - {"trspdl", CONTROL_VALUE, RTF_TRSPDL}, - {"trspdr", CONTROL_VALUE, RTF_TRSPDR}, - {"trspdt", CONTROL_VALUE, RTF_TRSPDT}, - {"trspob", CONTROL_VALUE, RTF_TRSPOB}, - {"trspofb", CONTROL_VALUE, RTF_TRSPOFB}, - {"trspofl", CONTROL_VALUE, RTF_TRSPOFL}, - {"trspofr", CONTROL_VALUE, RTF_TRSPOFR}, - {"trspoft", CONTROL_VALUE, RTF_TRSPOFT}, - {"trspol", CONTROL_VALUE, RTF_TRSPOL}, - {"trspor", CONTROL_VALUE, RTF_TRSPOR}, - {"trspot", CONTROL_VALUE, RTF_TRSPOT}, - {"truncatefontheight", CONTROL_FLAG, RTF_TRUNCATEFONTHEIGHT}, - {"truncex", CONTROL_FLAG, RTF_TRUNCEX}, - {"trwWidthA", CONTROL_VALUE, RTF_TRWWIDTHA}, - {"trwWidthB", CONTROL_VALUE, RTF_TRWWIDTHB}, - {"trwWidth", CONTROL_VALUE, RTF_TRWWIDTH}, - {"ts", CONTROL_VALUE, RTF_TS}, - {"tsbgbdiag", CONTROL_FLAG, RTF_TSBGBDIAG}, - {"tsbgcross", CONTROL_FLAG, RTF_TSBGCROSS}, - {"tsbgdcross", CONTROL_FLAG, RTF_TSBGDCROSS}, - {"tsbgdkbdiag", CONTROL_FLAG, RTF_TSBGDKBDIAG}, - {"tsbgdkcross", CONTROL_FLAG, RTF_TSBGDKCROSS}, - {"tsbgdkdcross", CONTROL_FLAG, RTF_TSBGDKDCROSS}, - {"tsbgdkfdiag", CONTROL_FLAG, RTF_TSBGDKFDIAG}, - {"tsbgdkhor", CONTROL_FLAG, RTF_TSBGDKHOR}, - {"tsbgdkvert", CONTROL_FLAG, RTF_TSBGDKVERT}, - {"tsbgfdiag", CONTROL_FLAG, RTF_TSBGFDIAG}, - {"tsbghoriz", CONTROL_FLAG, RTF_TSBGHORIZ}, - {"tsbgvert", CONTROL_FLAG, RTF_TSBGVERT}, - {"tsbrdrb", CONTROL_FLAG, RTF_TSBRDRB}, - {"tsbrdrdgl", CONTROL_FLAG, RTF_TSBRDRDGL}, - {"tsbrdrdgr", CONTROL_FLAG, RTF_TSBRDRDGR}, - {"tsbrdrh", CONTROL_FLAG, RTF_TSBRDRH}, - {"tsbrdrl", CONTROL_FLAG, RTF_TSBRDRL}, - {"tsbrdrr", CONTROL_FLAG, RTF_TSBRDRR}, - {"tsbrdrt", CONTROL_FLAG, RTF_TSBRDRT}, - {"tsbrdrv", CONTROL_FLAG, RTF_TSBRDRV}, - {"tscbandhorzeven", CONTROL_FLAG, RTF_TSCBANDHORZEVEN}, - {"tscbandhorzodd", CONTROL_FLAG, RTF_TSCBANDHORZODD}, - {"tscbandsh", CONTROL_VALUE, RTF_TSCBANDSH}, - {"tscbandsv", CONTROL_VALUE, RTF_TSCBANDSV}, - {"tscbandverteven", CONTROL_FLAG, RTF_TSCBANDVERTEVEN}, - {"tscbandvertodd", CONTROL_FLAG, RTF_TSCBANDVERTODD}, - {"tscellcbpat", CONTROL_VALUE, RTF_TSCELLCBPAT}, - {"tscellcfpat", CONTROL_VALUE, RTF_TSCELLCFPAT}, - {"tscellpaddb", CONTROL_VALUE, RTF_TSCELLPADDB}, - {"tscellpaddfb", CONTROL_VALUE, RTF_TSCELLPADDFB}, - {"tscellpaddfl", CONTROL_VALUE, RTF_TSCELLPADDFL}, - {"tscellpaddfr", CONTROL_VALUE, RTF_TSCELLPADDFR}, - {"tscellpaddft", CONTROL_VALUE, RTF_TSCELLPADDFT}, - {"tscellpaddl", CONTROL_VALUE, RTF_TSCELLPADDL}, - {"tscellpaddr", CONTROL_VALUE, RTF_TSCELLPADDR}, - {"tscellpaddt", CONTROL_VALUE, RTF_TSCELLPADDT}, - {"tscellpct", CONTROL_VALUE, RTF_TSCELLPCT}, - {"tscellwidth", CONTROL_VALUE, RTF_TSCELLWIDTH}, - {"tscellwidthfts", CONTROL_VALUE, RTF_TSCELLWIDTHFTS}, - {"tscfirstcol", CONTROL_FLAG, RTF_TSCFIRSTCOL}, - {"tscfirstrow", CONTROL_FLAG, RTF_TSCFIRSTROW}, - {"tsclastcol", CONTROL_FLAG, RTF_TSCLASTCOL}, - {"tsclastrow", CONTROL_FLAG, RTF_TSCLASTROW}, - {"tscnecell", CONTROL_FLAG, RTF_TSCNECELL}, - {"tscnwcell", CONTROL_FLAG, RTF_TSCNWCELL}, - {"tscsecell", CONTROL_FLAG, RTF_TSCSECELL}, - {"tscswcell", CONTROL_FLAG, RTF_TSCSWCELL}, - {"tsd", CONTROL_FLAG, RTF_TSD}, - {"tsnowrap", CONTROL_FLAG, RTF_TSNOWRAP}, - {"tsrowd", CONTROL_FLAG, RTF_TSROWD}, - {"tsvertalb", CONTROL_FLAG, RTF_TSVERTALB}, - {"tsvertalc", CONTROL_FLAG, RTF_TSVERTALC}, - {"tsvertalt", CONTROL_FLAG, RTF_TSVERTALT}, - {"twoinone", CONTROL_VALUE, RTF_TWOINONE}, - {"twoonone", CONTROL_FLAG, RTF_TWOONONE}, - {"tx", CONTROL_VALUE, RTF_TX}, - {"txbxtwalways", CONTROL_FLAG, RTF_TXBXTWALWAYS}, - {"txbxtwfirst", CONTROL_FLAG, RTF_TXBXTWFIRST}, - {"txbxtwfirstlast", CONTROL_FLAG, RTF_TXBXTWFIRSTLAST}, - {"txbxtwlast", CONTROL_FLAG, RTF_TXBXTWLAST}, - {"txbxtwno", CONTROL_FLAG, RTF_TXBXTWNO}, - {"txe", CONTROL_DESTINATION, RTF_TXE}, - {"u", CONTROL_VALUE, RTF_U}, - {"uc", CONTROL_VALUE, RTF_UC}, - {"ud", CONTROL_DESTINATION, RTF_UD}, - {"ul", CONTROL_TOGGLE, RTF_UL}, - {"ulc", CONTROL_VALUE, RTF_ULC}, - {"uld", CONTROL_FLAG, RTF_ULD}, - {"uldash", CONTROL_TOGGLE, RTF_ULDASH}, - {"uldashd", CONTROL_TOGGLE, RTF_ULDASHD}, - {"uldashdd", CONTROL_TOGGLE, RTF_ULDASHDD}, - {"uldb", CONTROL_TOGGLE, RTF_ULDB}, - {"ulhair", CONTROL_TOGGLE, RTF_ULHAIR}, - {"ulhwave", CONTROL_TOGGLE, RTF_ULHWAVE}, - {"ulldash", CONTROL_TOGGLE, RTF_ULLDASH}, - {"ulnone", CONTROL_FLAG, RTF_ULNONE}, - {"ulth", CONTROL_TOGGLE, RTF_ULTH}, - {"ulthd", CONTROL_TOGGLE, RTF_ULTHD}, - {"ulthdash", CONTROL_TOGGLE, RTF_ULTHDASH}, - {"ulthdashd", CONTROL_TOGGLE, RTF_ULTHDASHD}, - {"ulthdashdd", CONTROL_TOGGLE, RTF_ULTHDASHDD}, - {"ulthldash", CONTROL_TOGGLE, RTF_ULTHLDASH}, - {"ululdbwave", CONTROL_TOGGLE, RTF_ULULDBWAVE}, - {"ulw", CONTROL_FLAG, RTF_ULW}, - {"ulwave", CONTROL_TOGGLE, RTF_ULWAVE}, - {"up", CONTROL_VALUE, RTF_UP}, - {"upr", CONTROL_DESTINATION, RTF_UPR}, - {"urtf", CONTROL_VALUE, RTF_URTF}, - {"useltbaln", CONTROL_FLAG, RTF_USELTBALN}, - {"usenormstyforlist", CONTROL_FLAG, RTF_USENORMSTYFORLIST}, - {"userprops", CONTROL_DESTINATION, RTF_USERPROPS}, - {"usexform", CONTROL_FLAG, RTF_USEXFORM}, - {"utinl", CONTROL_FLAG, RTF_UTINL}, - {"v", CONTROL_TOGGLE, RTF_V}, - {"validatexml", CONTROL_VALUE, RTF_VALIDATEXML}, - {"vern", CONTROL_VALUE, RTF_VERN}, - {"version", CONTROL_VALUE, RTF_VERSION}, - {"vertal", CONTROL_FLAG, RTF_VERTAL}, - {"vertalb", CONTROL_FLAG, RTF_VERTALB}, - {"vertalc", CONTROL_FLAG, RTF_VERTALC}, - {"vertalj", CONTROL_FLAG, RTF_VERTALJ}, - {"vertalt", CONTROL_FLAG, RTF_VERTALT}, - {"vertdoc", CONTROL_FLAG, RTF_VERTDOC}, - {"vertsect", CONTROL_FLAG, RTF_VERTSECT}, - {"viewbksp", CONTROL_VALUE, RTF_VIEWBKSP}, - {"viewkind", CONTROL_VALUE, RTF_VIEWKIND}, - {"viewnobound", CONTROL_FLAG, RTF_VIEWNOBOUND}, - {"viewscale", CONTROL_VALUE, RTF_VIEWSCALE}, - {"viewzk", CONTROL_VALUE, RTF_VIEWZK}, - {"wbitmap", CONTROL_VALUE, RTF_WBITMAP}, - {"wbmbitspixel", CONTROL_VALUE, RTF_WBMBITSPIXEL}, - {"wbmplanes", CONTROL_VALUE, RTF_WBMPLANES}, - {"wbmwidthbyte", CONTROL_VALUE, RTF_WBMWIDTHBYTE}, - {"webhidden", CONTROL_FLAG, RTF_WEBHIDDEN}, - {"wgrffmtfilter", CONTROL_DESTINATION, RTF_WGRFFMTFILTER}, - {"widctlpar", CONTROL_FLAG, RTF_WIDCTLPAR}, - {"widowctrl", CONTROL_FLAG, RTF_WIDOWCTRL}, - {"windowcaption", CONTROL_DESTINATION, RTF_WINDOWCAPTION}, - {"wmetafile", CONTROL_VALUE, RTF_WMETAFILE}, - {"wpeqn", CONTROL_FLAG, RTF_WPEQN}, - {"wpjst", CONTROL_FLAG, RTF_WPJST}, - {"wpsp", CONTROL_FLAG, RTF_WPSP}, - {"wraparound", CONTROL_FLAG, RTF_WRAPAROUND}, - {"wrapdefault", CONTROL_FLAG, RTF_WRAPDEFAULT}, - {"wrapthrough", CONTROL_FLAG, RTF_WRAPTHROUGH}, - {"wraptight", CONTROL_FLAG, RTF_WRAPTIGHT}, - {"wraptrsp", CONTROL_FLAG, RTF_WRAPTRSP}, - {"writereservation", CONTROL_DESTINATION, RTF_WRITERESERVATION}, - {"writereservhash", CONTROL_DESTINATION, RTF_WRITERESERVHASH}, - {"wrppunct", CONTROL_FLAG, RTF_WRPPUNCT}, - {"xe", CONTROL_DESTINATION, RTF_XE}, - {"xef", CONTROL_VALUE, RTF_XEF}, - {"xform", CONTROL_DESTINATION, RTF_XFORM}, - {"xmlattr", CONTROL_FLAG, RTF_XMLATTR}, - {"xmlattrname", CONTROL_DESTINATION, RTF_XMLATTRNAME}, - {"xmlattrns", CONTROL_VALUE, RTF_XMLATTRNS}, - {"xmlattrvalue", CONTROL_DESTINATION, RTF_XMLATTRVALUE}, - {"xmlclose", CONTROL_DESTINATION, RTF_XMLCLOSE}, - {"xmlname", CONTROL_DESTINATION, RTF_XMLNAME}, - {"xmlns", CONTROL_VALUE, RTF_XMLNS}, - {"xmlnstbl", CONTROL_DESTINATION, RTF_XMLNSTBL}, - {"xmlopen", CONTROL_DESTINATION, RTF_XMLOPEN}, - {"xmlsdttcell", CONTROL_FLAG, RTF_XMLSDTTCELL}, - {"xmlsdttpara", CONTROL_FLAG, RTF_XMLSDTTPARA}, - {"xmlsdttregular", CONTROL_FLAG, RTF_XMLSDTTREGULAR}, - {"xmlsdttrow", CONTROL_FLAG, RTF_XMLSDTTROW}, - {"xmlsdttunknown", CONTROL_FLAG, RTF_XMLSDTTUNKNOWN}, - {"yr", CONTROL_VALUE, RTF_YR}, - {"yts", CONTROL_VALUE, RTF_YTS}, - {"yxe", CONTROL_FLAG, RTF_YXE}, - {"zwbo", CONTROL_SYMBOL, RTF_ZWBO}, - {"zwj", CONTROL_SYMBOL, RTF_ZWJ}, - {"zwnbo", CONTROL_SYMBOL, RTF_ZWNBO}, - {"zwnj", CONTROL_SYMBOL, RTF_ZWNJ}, - {"flymaincnt", CONTROL_DESTINATION, RTF_FLYMAINCNT}, - {"flyvert", CONTROL_VALUE, RTF_FLYVERT}, - {"flyhorz", CONTROL_VALUE, RTF_FLYHORZ}, - {"flyanchor", CONTROL_VALUE, RTF_FLYANCHOR}, + { "'", CONTROL_SYMBOL, RTF_HEXCHAR }, + { "-", CONTROL_SYMBOL, RTF_OPTHYPH }, + { "*", CONTROL_SYMBOL, RTF_IGNORE }, + { ":", CONTROL_SYMBOL, RTF_SUBENTRY }, + { "\\", CONTROL_SYMBOL, RTF_BACKSLASH }, + { "\n", CONTROL_SYMBOL, RTF_PAR }, + { "\r", CONTROL_SYMBOL, RTF_PAR }, + { "\r\n", CONTROL_SYMBOL, RTF_PAR }, + { "_", CONTROL_SYMBOL, RTF_NOBRKHYPH }, + { "{", CONTROL_SYMBOL, RTF_LBRACE }, + { "|", CONTROL_SYMBOL, RTF_FORMULA }, + { "}", CONTROL_SYMBOL, RTF_RBRACE }, + { "~", CONTROL_SYMBOL, RTF_NOBREAK }, + { "ab", CONTROL_TOGGLE, RTF_AB }, + { "absh", CONTROL_VALUE, RTF_ABSH }, + { "abslock", CONTROL_FLAG, RTF_ABSLOCK }, + { "absnoovrlp", CONTROL_TOGGLE, RTF_ABSNOOVRLP }, + { "absw", CONTROL_VALUE, RTF_ABSW }, + { "acaps", CONTROL_TOGGLE, RTF_ACAPS }, + { "acccircle", CONTROL_TOGGLE, RTF_ACCCIRCLE }, + { "acccomma", CONTROL_TOGGLE, RTF_ACCCOMMA }, + { "accdot", CONTROL_TOGGLE, RTF_ACCDOT }, + { "accnone", CONTROL_TOGGLE, RTF_ACCNONE }, + { "accunderdot", CONTROL_TOGGLE, RTF_ACCUNDERDOT }, + { "acf", CONTROL_VALUE, RTF_ACF }, + { "adeff", CONTROL_VALUE, RTF_ADEFF }, + { "additive", CONTROL_FLAG, RTF_ADDITIVE }, + { "adeflang", CONTROL_VALUE, RTF_ADEFLANG }, + { "adjustright", CONTROL_FLAG, RTF_ADJUSTRIGHT }, + { "adn", CONTROL_VALUE, RTF_ADN }, + { "aenddoc", CONTROL_FLAG, RTF_AENDDOC }, + { "aendnotes", CONTROL_FLAG, RTF_AENDNOTES }, + { "aexpnd", CONTROL_VALUE, RTF_AEXPND }, + { "af", CONTROL_VALUE, RTF_AF }, + { "afelev", CONTROL_FLAG, RTF_AFELEV }, + { "afs", CONTROL_VALUE, RTF_AFS }, + { "aftnbj", CONTROL_FLAG, RTF_AFTNBJ }, + { "aftncn", CONTROL_DESTINATION, RTF_AFTNCN }, + { "aftnnalc", CONTROL_FLAG, RTF_AFTNNALC }, + { "aftnnar", CONTROL_FLAG, RTF_AFTNNAR }, + { "aftnnauc", CONTROL_FLAG, RTF_AFTNNAUC }, + { "aftnnchi", CONTROL_FLAG, RTF_AFTNNCHI }, + { "aftnnchosung", CONTROL_FLAG, RTF_AFTNNCHOSUNG }, + { "aftnncnum", CONTROL_FLAG, RTF_AFTNNCNUM }, + { "aftnndbar", CONTROL_FLAG, RTF_AFTNNDBAR }, + { "aftnndbnum", CONTROL_FLAG, RTF_AFTNNDBNUM }, + { "aftnndbnumd", CONTROL_FLAG, RTF_AFTNNDBNUMD }, + { "aftnndbnumk", CONTROL_FLAG, RTF_AFTNNDBNUMK }, + { "aftnndbnumt", CONTROL_FLAG, RTF_AFTNNDBNUMT }, + { "aftnnganada", CONTROL_FLAG, RTF_AFTNNGANADA }, + { "aftnngbnum", CONTROL_FLAG, RTF_AFTNNGBNUM }, + { "aftnngbnumd", CONTROL_FLAG, RTF_AFTNNGBNUMD }, + { "aftnngbnumk", CONTROL_FLAG, RTF_AFTNNGBNUMK }, + { "aftnngbnuml", CONTROL_FLAG, RTF_AFTNNGBNUML }, + { "aftnnrlc", CONTROL_FLAG, RTF_AFTNNRLC }, + { "aftnnruc", CONTROL_FLAG, RTF_AFTNNRUC }, + { "aftnnzodiac", CONTROL_FLAG, RTF_AFTNNZODIAC }, + { "aftnnzodiacd", CONTROL_FLAG, RTF_AFTNNZODIACD }, + { "aftnnzodiacl", CONTROL_FLAG, RTF_AFTNNZODIACL }, + { "aftnrestart", CONTROL_FLAG, RTF_AFTNRESTART }, + { "aftnrstcont", CONTROL_FLAG, RTF_AFTNRSTCONT }, + { "aftnsep", CONTROL_DESTINATION, RTF_AFTNSEP }, + { "aftnsepc", CONTROL_DESTINATION, RTF_AFTNSEPC }, + { "aftnstart", CONTROL_VALUE, RTF_AFTNSTART }, + { "aftntj", CONTROL_FLAG, RTF_AFTNTJ }, + { "ai", CONTROL_TOGGLE, RTF_AI }, + { "alang", CONTROL_VALUE, RTF_ALANG }, + { "allowfieldendsel", CONTROL_FLAG, RTF_ALLOWFIELDENDSEL }, + { "allprot", CONTROL_FLAG, RTF_ALLPROT }, + { "alntblind", CONTROL_FLAG, RTF_ALNTBLIND }, + { "alt", CONTROL_FLAG, RTF_ALT }, + { "animtext", CONTROL_VALUE, RTF_ANIMTEXT }, + { "annotation", CONTROL_DESTINATION, RTF_ANNOTATION }, + { "annotprot", CONTROL_FLAG, RTF_ANNOTPROT }, + { "ansi", CONTROL_FLAG, RTF_ANSI }, + { "ansicpg", CONTROL_VALUE, RTF_ANSICPG }, + { "aoutl", CONTROL_TOGGLE, RTF_AOUTL }, + { "ApplyBrkRules", CONTROL_FLAG, RTF_APPLYBRKRULES }, + { "ascaps", CONTROL_TOGGLE, RTF_ASCAPS }, + { "ashad", CONTROL_TOGGLE, RTF_ASHAD }, + { "asianbrkrule", CONTROL_FLAG, RTF_ASIANBRKRULE }, + { "aspalpha", CONTROL_TOGGLE, RTF_ASPALPHA }, + { "aspnum", CONTROL_TOGGLE, RTF_ASPNUM }, + { "astrike", CONTROL_TOGGLE, RTF_ASTRIKE }, + { "atnauthor", CONTROL_DESTINATION, RTF_ATNAUTHOR }, + { "atndate", CONTROL_DESTINATION, RTF_ATNDATE }, + { "atnicn", CONTROL_DESTINATION, RTF_ATNICN }, + { "atnid", CONTROL_DESTINATION, RTF_ATNID }, + { "atnparent", CONTROL_DESTINATION, RTF_ATNPARENT }, + { "atnref", CONTROL_DESTINATION, RTF_ATNREF }, + { "atntime", CONTROL_DESTINATION, RTF_ATNTIME }, + { "atrfend", CONTROL_DESTINATION, RTF_ATRFEND }, + { "atrfstart", CONTROL_DESTINATION, RTF_ATRFSTART }, + { "aul", CONTROL_TOGGLE, RTF_AUL }, + { "auld", CONTROL_TOGGLE, RTF_AULD }, + { "auldb", CONTROL_TOGGLE, RTF_AULDB }, + { "aulnone", CONTROL_TOGGLE, RTF_AULNONE }, + { "aulw", CONTROL_TOGGLE, RTF_AULW }, + { "aup", CONTROL_VALUE, RTF_AUP }, + { "author", CONTROL_DESTINATION, RTF_AUTHOR }, + { "autofmtoverride", CONTROL_FLAG, RTF_AUTOFMTOVERRIDE }, + { "b", CONTROL_TOGGLE, RTF_B }, + { "background", CONTROL_DESTINATION, RTF_BACKGROUND }, + { "bdbfhdr", CONTROL_FLAG, RTF_BDBFHDR }, + { "bdrrlswsix", CONTROL_FLAG, RTF_BDRRLSWSIX }, + { "bgbdiag", CONTROL_FLAG, RTF_BGBDIAG }, + { "bgcross", CONTROL_FLAG, RTF_BGCROSS }, + { "bgdcross", CONTROL_FLAG, RTF_BGDCROSS }, + { "bgdkbdiag", CONTROL_FLAG, RTF_BGDKBDIAG }, + { "bgdkcross", CONTROL_FLAG, RTF_BGDKCROSS }, + { "bgdkdcross", CONTROL_FLAG, RTF_BGDKDCROSS }, + { "bgdkfdiag", CONTROL_FLAG, RTF_BGDKFDIAG }, + { "bgdkhoriz", CONTROL_FLAG, RTF_BGDKHORIZ }, + { "bgdkvert", CONTROL_FLAG, RTF_BGDKVERT }, + { "bgfdiag", CONTROL_FLAG, RTF_BGFDIAG }, + { "bghoriz", CONTROL_FLAG, RTF_BGHORIZ }, + { "bgvert", CONTROL_FLAG, RTF_BGVERT }, + { "bin", CONTROL_VALUE, RTF_BIN }, + { "binfsxn", CONTROL_VALUE, RTF_BINFSXN }, + { "binsxn", CONTROL_VALUE, RTF_BINSXN }, + { "bkmkcolf", CONTROL_VALUE, RTF_BKMKCOLF }, + { "bkmkcoll", CONTROL_VALUE, RTF_BKMKCOLL }, + { "bkmkend", CONTROL_DESTINATION, RTF_BKMKEND }, + { "bkmkpub", CONTROL_FLAG, RTF_BKMKPUB }, + { "bkmkstart", CONTROL_DESTINATION, RTF_BKMKSTART }, + { "bliptag", CONTROL_VALUE, RTF_BLIPTAG }, + { "blipuid", CONTROL_DESTINATION, RTF_BLIPUID }, + { "blipupi", CONTROL_VALUE, RTF_BLIPUPI }, + { "blue", CONTROL_VALUE, RTF_BLUE }, + { "bookfold", CONTROL_FLAG, RTF_BOOKFOLD }, + { "bookfoldrev", CONTROL_FLAG, RTF_BOOKFOLDREV }, + { "bookfoldsheets", CONTROL_VALUE, RTF_BOOKFOLDSHEETS }, + { "box", CONTROL_FLAG, RTF_BOX }, + { "brdrart", CONTROL_VALUE, RTF_BRDRART }, + { "brdrb", CONTROL_FLAG, RTF_BRDRB }, + { "brdrbar", CONTROL_FLAG, RTF_BRDRBAR }, + { "brdrbtw", CONTROL_FLAG, RTF_BRDRBTW }, + { "brdrcf", CONTROL_VALUE, RTF_BRDRCF }, + { "brdrdash", CONTROL_FLAG, RTF_BRDRDASH }, + { "brdrdashd", CONTROL_FLAG, RTF_BRDRDASHD }, + { "brdrdashdd", CONTROL_FLAG, RTF_BRDRDASHDD }, + { "brdrdashdot", CONTROL_FLAG, RTF_BRDRDASHDOT }, + { "brdrdashdotdot", CONTROL_FLAG, RTF_BRDRDASHDOTDOT }, + { "brdrdashdotstr", CONTROL_FLAG, RTF_BRDRDASHDOTSTR }, + { "brdrdashsm", CONTROL_FLAG, RTF_BRDRDASHSM }, + { "brdrdb", CONTROL_FLAG, RTF_BRDRDB }, + { "brdrdot", CONTROL_FLAG, RTF_BRDRDOT }, + { "brdremboss", CONTROL_FLAG, RTF_BRDREMBOSS }, + { "brdrengrave", CONTROL_FLAG, RTF_BRDRENGRAVE }, + { "brdrframe", CONTROL_FLAG, RTF_BRDRFRAME }, + { "brdrhair", CONTROL_FLAG, RTF_BRDRHAIR }, + { "brdrinset", CONTROL_FLAG, RTF_BRDRINSET }, + { "brdrl", CONTROL_FLAG, RTF_BRDRL }, + { "brdrnil", CONTROL_FLAG, RTF_BRDRNIL }, + { "brdrnone", CONTROL_FLAG, RTF_BRDRNONE }, + { "brdroutset", CONTROL_FLAG, RTF_BRDROUTSET }, + { "brdrr", CONTROL_FLAG, RTF_BRDRR }, + { "brdrs", CONTROL_FLAG, RTF_BRDRS }, + { "brdrsh", CONTROL_FLAG, RTF_BRDRSH }, + { "brdrt", CONTROL_FLAG, RTF_BRDRT }, + { "brdrtbl", CONTROL_FLAG, RTF_BRDRTBL }, + { "brdrth", CONTROL_FLAG, RTF_BRDRTH }, + { "brdrthtnlg", CONTROL_FLAG, RTF_BRDRTHTNLG }, + { "brdrthtnmg", CONTROL_FLAG, RTF_BRDRTHTNMG }, + { "brdrthtnsg", CONTROL_FLAG, RTF_BRDRTHTNSG }, + { "brdrtnthlg", CONTROL_FLAG, RTF_BRDRTNTHLG }, + { "brdrtnthmg", CONTROL_FLAG, RTF_BRDRTNTHMG }, + { "brdrtnthsg", CONTROL_FLAG, RTF_BRDRTNTHSG }, + { "brdrtnthtnlg", CONTROL_FLAG, RTF_BRDRTNTHTNLG }, + { "brdrtnthtnmg", CONTROL_FLAG, RTF_BRDRTNTHTNMG }, + { "brdrtnthtnsg", CONTROL_FLAG, RTF_BRDRTNTHTNSG }, + { "brdrtriple", CONTROL_FLAG, RTF_BRDRTRIPLE }, + { "brdrw", CONTROL_VALUE, RTF_BRDRW }, + { "brdrwavy", CONTROL_FLAG, RTF_BRDRWAVY }, + { "brdrwavydb", CONTROL_FLAG, RTF_BRDRWAVYDB }, + { "brkfrm", CONTROL_FLAG, RTF_BRKFRM }, + { "brsp", CONTROL_VALUE, RTF_BRSP }, + { "bullet", CONTROL_SYMBOL, RTF_BULLET }, + { "buptim", CONTROL_DESTINATION, RTF_BUPTIM }, + { "bxe", CONTROL_FLAG, RTF_BXE }, + { "caccentfive", CONTROL_FLAG, RTF_CACCENTFIVE }, + { "caccentfour", CONTROL_FLAG, RTF_CACCENTFOUR }, + { "caccentone", CONTROL_FLAG, RTF_CACCENTONE }, + { "caccentsix", CONTROL_FLAG, RTF_CACCENTSIX }, + { "caccentthree", CONTROL_FLAG, RTF_CACCENTTHREE }, + { "caccenttwo", CONTROL_FLAG, RTF_CACCENTTWO }, + { "cachedcolbal", CONTROL_FLAG, RTF_CACHEDCOLBAL }, + { "caps", CONTROL_TOGGLE, RTF_CAPS }, + { "category", CONTROL_DESTINATION, RTF_CATEGORY }, + { "cb", CONTROL_VALUE, RTF_CB }, + { "cbackgroundone", CONTROL_FLAG, RTF_CBACKGROUNDONE }, + { "cbackgroundtwo", CONTROL_FLAG, RTF_CBACKGROUNDTWO }, + { "cbpat", CONTROL_VALUE, RTF_CBPAT }, + { "cchs", CONTROL_VALUE, RTF_CCHS }, + { "cell", CONTROL_SYMBOL, RTF_CELL }, + { "cellx", CONTROL_VALUE, RTF_CELLX }, + { "cf", CONTROL_VALUE, RTF_CF }, + { "cfollowedhyperlink", CONTROL_FLAG, RTF_CFOLLOWEDHYPERLINK }, + { "cfpat", CONTROL_VALUE, RTF_CFPAT }, + { "cgrid", CONTROL_VALUE, RTF_CGRID }, + { "charrsid", CONTROL_VALUE, RTF_CHARRSID }, + { "charscalex", CONTROL_VALUE, RTF_CHARSCALEX }, + { "chatn", CONTROL_SYMBOL, RTF_CHATN }, + { "chbgbdiag", CONTROL_FLAG, RTF_CHBGBDIAG }, + { "chbgcross", CONTROL_FLAG, RTF_CHBGCROSS }, + { "chbgdcross", CONTROL_FLAG, RTF_CHBGDCROSS }, + { "chbgdkbdiag", CONTROL_FLAG, RTF_CHBGDKBDIAG }, + { "chbgdkcross", CONTROL_FLAG, RTF_CHBGDKCROSS }, + { "chbgdkdcross", CONTROL_FLAG, RTF_CHBGDKDCROSS }, + { "chbgdkfdiag", CONTROL_FLAG, RTF_CHBGDKFDIAG }, + { "chbgdkhoriz", CONTROL_FLAG, RTF_CHBGDKHORIZ }, + { "chbgdkvert", CONTROL_FLAG, RTF_CHBGDKVERT }, + { "chbgfdiag", CONTROL_FLAG, RTF_CHBGFDIAG }, + { "chbghoriz", CONTROL_FLAG, RTF_CHBGHORIZ }, + { "chbgvert", CONTROL_FLAG, RTF_CHBGVERT }, + { "chbrdr", CONTROL_FLAG, RTF_CHBRDR }, + { "chcbpat", CONTROL_VALUE, RTF_CHCBPAT }, + { "chcfpat", CONTROL_VALUE, RTF_CHCFPAT }, + { "chdate", CONTROL_SYMBOL, RTF_CHDATE }, + { "chdpa", CONTROL_SYMBOL, RTF_CHDPA }, + { "chdpl", CONTROL_SYMBOL, RTF_CHDPL }, + { "chftn", CONTROL_SYMBOL, RTF_CHFTN }, + { "chftnsep", CONTROL_SYMBOL, RTF_CHFTNSEP }, + { "chftnsepc", CONTROL_SYMBOL, RTF_CHFTNSEPC }, + { "chpgn", CONTROL_SYMBOL, RTF_CHPGN }, + { "chhres", CONTROL_VALUE, RTF_CHHRES }, + { "chshdng", CONTROL_VALUE, RTF_CHSHDNG }, + { "chtime", CONTROL_SYMBOL, RTF_CHTIME }, + { "chyperlink", CONTROL_FLAG, RTF_CHYPERLINK }, + { "clbgbdiag", CONTROL_FLAG, RTF_CLBGBDIAG }, + { "clbgcross", CONTROL_FLAG, RTF_CLBGCROSS }, + { "clbgdcross", CONTROL_FLAG, RTF_CLBGDCROSS }, + { "clbgdkbdiag", CONTROL_FLAG, RTF_CLBGDKBDIAG }, + { "clbgdkcross", CONTROL_FLAG, RTF_CLBGDKCROSS }, + { "clbgdkdcross", CONTROL_FLAG, RTF_CLBGDKDCROSS }, + { "clbgdkfdiag", CONTROL_FLAG, RTF_CLBGDKFDIAG }, + { "clbgdkhor", CONTROL_FLAG, RTF_CLBGDKHOR }, + { "clbgdkvert", CONTROL_FLAG, RTF_CLBGDKVERT }, + { "clbgfdiag", CONTROL_FLAG, RTF_CLBGFDIAG }, + { "clbghoriz", CONTROL_FLAG, RTF_CLBGHORIZ }, + { "clbgvert", CONTROL_FLAG, RTF_CLBGVERT }, + { "clbrdrb", CONTROL_FLAG, RTF_CLBRDRB }, + { "clbrdrl", CONTROL_FLAG, RTF_CLBRDRL }, + { "clbrdrr", CONTROL_FLAG, RTF_CLBRDRR }, + { "clbrdrt", CONTROL_FLAG, RTF_CLBRDRT }, + { "clcbpat", CONTROL_VALUE, RTF_CLCBPAT }, + { "clcbpatraw", CONTROL_VALUE, RTF_CLCBPATRAW }, + { "clcfpat", CONTROL_VALUE, RTF_CLCFPAT }, + { "clcfpatraw", CONTROL_VALUE, RTF_CLCFPATRAW }, + { "cldel", CONTROL_FLAG, RTF_CLDEL }, + { "cldelauth", CONTROL_VALUE, RTF_CLDELAUTH }, + { "cldeldttm", CONTROL_VALUE, RTF_CLDELDTTM }, + { "cldgll", CONTROL_FLAG, RTF_CLDGLL }, + { "cldglu", CONTROL_FLAG, RTF_CLDGLU }, + { "clFitText", CONTROL_FLAG, RTF_CLFITTEXT }, + { "clftsWidth", CONTROL_VALUE, RTF_CLFTSWIDTH }, + { "clhidemark", CONTROL_FLAG, RTF_CLHIDEMARK }, + { "clins", CONTROL_FLAG, RTF_CLINS }, + { "clinsauth", CONTROL_VALUE, RTF_CLINSAUTH }, + { "clinsdttm", CONTROL_VALUE, RTF_CLINSDTTM }, + { "clmgf", CONTROL_FLAG, RTF_CLMGF }, + { "clmrg", CONTROL_FLAG, RTF_CLMRG }, + { "clmrgd", CONTROL_FLAG, RTF_CLMRGD }, + { "clmrgdauth", CONTROL_VALUE, RTF_CLMRGDAUTH }, + { "clmrgddttm", CONTROL_VALUE, RTF_CLMRGDDTTM }, + { "clmrgdr", CONTROL_FLAG, RTF_CLMRGDR }, + { "clNoWrap", CONTROL_FLAG, RTF_CLNOWRAP }, + { "clpadb", CONTROL_VALUE, RTF_CLPADB }, + { "clpadfb", CONTROL_VALUE, RTF_CLPADFB }, + { "clpadfl", CONTROL_VALUE, RTF_CLPADFL }, + { "clpadfr", CONTROL_VALUE, RTF_CLPADFR }, + { "clpadft", CONTROL_VALUE, RTF_CLPADFT }, + { "clpadl", CONTROL_VALUE, RTF_CLPADL }, + { "clpadr", CONTROL_VALUE, RTF_CLPADR }, + { "clpadt", CONTROL_VALUE, RTF_CLPADT }, + { "clspb", CONTROL_VALUE, RTF_CLSPB }, + { "clspfb", CONTROL_VALUE, RTF_CLSPFB }, + { "clspfl", CONTROL_VALUE, RTF_CLSPFL }, + { "clspfr", CONTROL_VALUE, RTF_CLSPFR }, + { "clspft", CONTROL_VALUE, RTF_CLSPFT }, + { "clspl", CONTROL_VALUE, RTF_CLSPL }, + { "clspr", CONTROL_VALUE, RTF_CLSPR }, + { "clspt", CONTROL_VALUE, RTF_CLSPT }, + { "clshdng", CONTROL_VALUE, RTF_CLSHDNG }, + { "clshdngraw", CONTROL_VALUE, RTF_CLSHDNGRAW }, + { "clshdrawnil", CONTROL_FLAG, RTF_CLSHDRAWNIL }, + { "clsplit", CONTROL_FLAG, RTF_CLSPLIT }, + { "clsplitr", CONTROL_FLAG, RTF_CLSPLITR }, + { "cltxbtlr", CONTROL_FLAG, RTF_CLTXBTLR }, + { "cltxlrtb", CONTROL_FLAG, RTF_CLTXLRTB }, + { "cltxlrtbv", CONTROL_FLAG, RTF_CLTXLRTBV }, + { "cltxtbrl", CONTROL_FLAG, RTF_CLTXTBRL }, + { "cltxtbrlv", CONTROL_FLAG, RTF_CLTXTBRLV }, + { "clvertalb", CONTROL_FLAG, RTF_CLVERTALB }, + { "clvertalc", CONTROL_FLAG, RTF_CLVERTALC }, + { "clvertalt", CONTROL_FLAG, RTF_CLVERTALT }, + { "clvmgf", CONTROL_FLAG, RTF_CLVMGF }, + { "clvmrg", CONTROL_FLAG, RTF_CLVMRG }, + { "clwWidth", CONTROL_VALUE, RTF_CLWWIDTH }, + { "cmaindarkone", CONTROL_FLAG, RTF_CMAINDARKONE }, + { "cmaindarktwo", CONTROL_FLAG, RTF_CMAINDARKTWO }, + { "cmainlightone", CONTROL_FLAG, RTF_CMAINLIGHTONE }, + { "cmainlighttwo", CONTROL_FLAG, RTF_CMAINLIGHTTWO }, + { "collapsed", CONTROL_FLAG, RTF_COLLAPSED }, + { "colno", CONTROL_VALUE, RTF_COLNO }, + { "colorschememapping", CONTROL_DESTINATION, RTF_COLORSCHEMEMAPPING }, + { "colortbl", CONTROL_DESTINATION, RTF_COLORTBL }, + { "cols", CONTROL_VALUE, RTF_COLS }, + { "colsr", CONTROL_VALUE, RTF_COLSR }, + { "colsx", CONTROL_VALUE, RTF_COLSX }, + { "column", CONTROL_SYMBOL, RTF_COLUMN }, + { "colw", CONTROL_VALUE, RTF_COLW }, + { "comment", CONTROL_DESTINATION, RTF_COMMENT }, + { "company", CONTROL_DESTINATION, RTF_COMPANY }, + { "contextualspace", CONTROL_FLAG, RTF_CONTEXTUALSPACE }, + { "cpg", CONTROL_VALUE, RTF_CPG }, + { "crauth", CONTROL_VALUE, RTF_CRAUTH }, + { "crdate", CONTROL_VALUE, RTF_CRDATE }, + { "creatim", CONTROL_DESTINATION, RTF_CREATIM }, + { "cs", CONTROL_VALUE, RTF_CS }, + { "cshade", CONTROL_VALUE, RTF_CSHADE }, + { "ctextone", CONTROL_FLAG, RTF_CTEXTONE }, + { "ctexttwo", CONTROL_FLAG, RTF_CTEXTTWO }, + { "ctint", CONTROL_VALUE, RTF_CTINT }, + { "ctrl", CONTROL_FLAG, RTF_CTRL }, + { "cts", CONTROL_VALUE, RTF_CTS }, + { "cufi", CONTROL_VALUE, RTF_CUFI }, + { "culi", CONTROL_VALUE, RTF_CULI }, + { "curi", CONTROL_VALUE, RTF_CURI }, + { "cvmme", CONTROL_FLAG, RTF_CVMME }, + { "datafield", CONTROL_DESTINATION, RTF_DATAFIELD }, + { "datastore", CONTROL_DESTINATION, RTF_DATASTORE }, + { "date", CONTROL_FLAG, RTF_DATE }, + { "dbch", CONTROL_FLAG, RTF_DBCH }, + { "defchp", CONTROL_DESTINATION, RTF_DEFCHP }, + { "deff", CONTROL_VALUE, RTF_DEFF }, + { "defformat", CONTROL_FLAG, RTF_DEFFORMAT }, + { "deflang", CONTROL_VALUE, RTF_DEFLANG }, + { "deflangfe", CONTROL_VALUE, RTF_DEFLANGFE }, + { "defpap", CONTROL_DESTINATION, RTF_DEFPAP }, + { "defshp", CONTROL_FLAG, RTF_DEFSHP }, + { "deftab", CONTROL_VALUE, RTF_DEFTAB }, + { "deleted", CONTROL_TOGGLE, RTF_DELETED }, + { "delrsid", CONTROL_VALUE, RTF_DELRSID }, + { "dfrauth", CONTROL_VALUE, RTF_DFRAUTH }, + { "dfrdate", CONTROL_VALUE, RTF_DFRDATE }, + { "dfrmtxtx", CONTROL_VALUE, RTF_DFRMTXTX }, + { "dfrmtxty", CONTROL_VALUE, RTF_DFRMTXTY }, + { "dfrstart", CONTROL_VALUE, RTF_DFRSTART }, + { "dfrstop", CONTROL_VALUE, RTF_DFRSTOP }, + { "dfrxst", CONTROL_VALUE, RTF_DFRXST }, + { "dghorigin", CONTROL_VALUE, RTF_DGHORIGIN }, + { "dghshow", CONTROL_VALUE, RTF_DGHSHOW }, + { "dghspace", CONTROL_VALUE, RTF_DGHSPACE }, + { "dgmargin", CONTROL_FLAG, RTF_DGMARGIN }, + { "dgsnap", CONTROL_FLAG, RTF_DGSNAP }, + { "dgvorigin", CONTROL_VALUE, RTF_DGVORIGIN }, + { "dgvshow", CONTROL_VALUE, RTF_DGVSHOW }, + { "dgvspace", CONTROL_VALUE, RTF_DGVSPACE }, + { "dibitmap", CONTROL_VALUE, RTF_DIBITMAP }, + { "disabled", CONTROL_TOGGLE, RTF_DISABLED }, + { "dn", CONTROL_VALUE, RTF_DN }, + { "dntblnsbdb", CONTROL_FLAG, RTF_DNTBLNSBDB }, + { "do", CONTROL_DESTINATION, RTF_DO }, + { "dobxcolumn", CONTROL_FLAG, RTF_DOBXCOLUMN }, + { "dobxmargin", CONTROL_FLAG, RTF_DOBXMARGIN }, + { "dobxpage", CONTROL_FLAG, RTF_DOBXPAGE }, + { "dobymargin", CONTROL_FLAG, RTF_DOBYMARGIN }, + { "dobypage", CONTROL_FLAG, RTF_DOBYPAGE }, + { "dobypara", CONTROL_FLAG, RTF_DOBYPARA }, + { "doccomm", CONTROL_DESTINATION, RTF_DOCCOMM }, + { "doctemp", CONTROL_FLAG, RTF_DOCTEMP }, + { "doctype", CONTROL_VALUE, RTF_DOCTYPE }, + { "docvar", CONTROL_DESTINATION, RTF_DOCVAR }, + { "dodhgt", CONTROL_VALUE, RTF_DODHGT }, + { "dolock", CONTROL_FLAG, RTF_DOLOCK }, + { "donotembedlingdata", CONTROL_VALUE, RTF_DONOTEMBEDLINGDATA }, + { "donotembedsysfont", CONTROL_VALUE, RTF_DONOTEMBEDSYSFONT }, + { "donotshowcomments", CONTROL_FLAG, RTF_DONOTSHOWCOMMENTS }, + { "donotshowinsdel", CONTROL_FLAG, RTF_DONOTSHOWINSDEL }, + { "donotshowmarkup", CONTROL_FLAG, RTF_DONOTSHOWMARKUP }, + { "donotshowprops", CONTROL_FLAG, RTF_DONOTSHOWPROPS }, + { "dpaendhol", CONTROL_FLAG, RTF_DPAENDHOL }, + { "dpaendl", CONTROL_VALUE, RTF_DPAENDL }, + { "dpaendsol", CONTROL_FLAG, RTF_DPAENDSOL }, + { "dpaendw", CONTROL_VALUE, RTF_DPAENDW }, + { "dparc", CONTROL_FLAG, RTF_DPARC }, + { "dparcflipx", CONTROL_FLAG, RTF_DPARCFLIPX }, + { "dparcflipy", CONTROL_FLAG, RTF_DPARCFLIPY }, + { "dpastarthol", CONTROL_FLAG, RTF_DPASTARTHOL }, + { "dpastartl", CONTROL_VALUE, RTF_DPASTARTL }, + { "dpastartsol", CONTROL_FLAG, RTF_DPASTARTSOL }, + { "dpastartw", CONTROL_VALUE, RTF_DPASTARTW }, + { "dpcallout", CONTROL_FLAG, RTF_DPCALLOUT }, + { "dpcoa", CONTROL_VALUE, RTF_DPCOA }, + { "dpcoaccent", CONTROL_FLAG, RTF_DPCOACCENT }, + { "dpcobestfit", CONTROL_FLAG, RTF_DPCOBESTFIT }, + { "dpcoborder", CONTROL_FLAG, RTF_DPCOBORDER }, + { "dpcodabs", CONTROL_FLAG, RTF_DPCODABS }, + { "dpcodbottom", CONTROL_FLAG, RTF_DPCODBOTTOM }, + { "dpcodcenter", CONTROL_FLAG, RTF_DPCODCENTER }, + { "dpcodescent", CONTROL_VALUE, RTF_DPCODESCENT }, + { "dpcodtop", CONTROL_FLAG, RTF_DPCODTOP }, + { "dpcolength", CONTROL_VALUE, RTF_DPCOLENGTH }, + { "dpcominusx", CONTROL_FLAG, RTF_DPCOMINUSX }, + { "dpcominusy", CONTROL_FLAG, RTF_DPCOMINUSY }, + { "dpcooffset", CONTROL_VALUE, RTF_DPCOOFFSET }, + { "dpcosmarta", CONTROL_FLAG, RTF_DPCOSMARTA }, + { "dpcotdouble", CONTROL_FLAG, RTF_DPCOTDOUBLE }, + { "dpcotright", CONTROL_FLAG, RTF_DPCOTRIGHT }, + { "dpcotsingle", CONTROL_FLAG, RTF_DPCOTSINGLE }, + { "dpcottriple", CONTROL_FLAG, RTF_DPCOTTRIPLE }, + { "dpcount", CONTROL_VALUE, RTF_DPCOUNT }, + { "dpellipse", CONTROL_FLAG, RTF_DPELLIPSE }, + { "dpendgroup", CONTROL_FLAG, RTF_DPENDGROUP }, + { "dpfillbgcb", CONTROL_VALUE, RTF_DPFILLBGCB }, + { "dpfillbgcg", CONTROL_VALUE, RTF_DPFILLBGCG }, + { "dpfillbgcr", CONTROL_VALUE, RTF_DPFILLBGCR }, + { "dpfillbggray", CONTROL_VALUE, RTF_DPFILLBGGRAY }, + { "dpfillbgpal", CONTROL_FLAG, RTF_DPFILLBGPAL }, + { "dpfillfgcb", CONTROL_VALUE, RTF_DPFILLFGCB }, + { "dpfillfgcg", CONTROL_VALUE, RTF_DPFILLFGCG }, + { "dpfillfgcr", CONTROL_VALUE, RTF_DPFILLFGCR }, + { "dpfillfggray", CONTROL_VALUE, RTF_DPFILLFGGRAY }, + { "dpfillfgpal", CONTROL_FLAG, RTF_DPFILLFGPAL }, + { "dpfillpat", CONTROL_VALUE, RTF_DPFILLPAT }, + { "dpgroup", CONTROL_FLAG, RTF_DPGROUP }, + { "dpline", CONTROL_FLAG, RTF_DPLINE }, + { "dplinecob", CONTROL_VALUE, RTF_DPLINECOB }, + { "dplinecog", CONTROL_VALUE, RTF_DPLINECOG }, + { "dplinecor", CONTROL_VALUE, RTF_DPLINECOR }, + { "dplinedado", CONTROL_FLAG, RTF_DPLINEDADO }, + { "dplinedadodo", CONTROL_FLAG, RTF_DPLINEDADODO }, + { "dplinedash", CONTROL_FLAG, RTF_DPLINEDASH }, + { "dplinedot", CONTROL_FLAG, RTF_DPLINEDOT }, + { "dplinegray", CONTROL_VALUE, RTF_DPLINEGRAY }, + { "dplinehollow", CONTROL_FLAG, RTF_DPLINEHOLLOW }, + { "dplinepal", CONTROL_FLAG, RTF_DPLINEPAL }, + { "dplinesolid", CONTROL_FLAG, RTF_DPLINESOLID }, + { "dplinew", CONTROL_VALUE, RTF_DPLINEW }, + { "dppolycount", CONTROL_VALUE, RTF_DPPOLYCOUNT }, + { "dppolygon", CONTROL_FLAG, RTF_DPPOLYGON }, + { "dppolyline", CONTROL_FLAG, RTF_DPPOLYLINE }, + { "dpptx", CONTROL_VALUE, RTF_DPPTX }, + { "dppty", CONTROL_VALUE, RTF_DPPTY }, + { "dprect", CONTROL_FLAG, RTF_DPRECT }, + { "dproundr", CONTROL_FLAG, RTF_DPROUNDR }, + { "dpshadow", CONTROL_FLAG, RTF_DPSHADOW }, + { "dpshadx", CONTROL_VALUE, RTF_DPSHADX }, + { "dpshady", CONTROL_VALUE, RTF_DPSHADY }, + { "dptxbtlr", CONTROL_FLAG, RTF_DPTXBTLR }, + { "dptxbx", CONTROL_FLAG, RTF_DPTXBX }, + { "dptxbxmar", CONTROL_VALUE, RTF_DPTXBXMAR }, + { "dptxbxtext", CONTROL_DESTINATION, RTF_DPTXBXTEXT }, + { "dptxlrtb", CONTROL_FLAG, RTF_DPTXLRTB }, + { "dptxlrtbv", CONTROL_FLAG, RTF_DPTXLRTBV }, + { "dptxtbrl", CONTROL_FLAG, RTF_DPTXTBRL }, + { "dptxtbrlv", CONTROL_FLAG, RTF_DPTXTBRLV }, + { "dpx", CONTROL_VALUE, RTF_DPX }, + { "dpxsize", CONTROL_VALUE, RTF_DPXSIZE }, + { "dpy", CONTROL_VALUE, RTF_DPY }, + { "dpysize", CONTROL_VALUE, RTF_DPYSIZE }, + { "dropcapli", CONTROL_VALUE, RTF_DROPCAPLI }, + { "dropcapt", CONTROL_VALUE, RTF_DROPCAPT }, + { "ds", CONTROL_VALUE, RTF_DS }, + { "dxfrtext", CONTROL_VALUE, RTF_DXFRTEXT }, + { "dy", CONTROL_VALUE, RTF_DY }, + { "ebcend", CONTROL_DESTINATION, RTF_EBCEND }, + { "ebcstart", CONTROL_DESTINATION, RTF_EBCSTART }, + { "edmins", CONTROL_VALUE, RTF_EDMINS }, + { "embo", CONTROL_TOGGLE, RTF_EMBO }, + { "emdash", CONTROL_SYMBOL, RTF_EMDASH }, + { "emfblip", CONTROL_FLAG, RTF_EMFBLIP }, + { "emspace", CONTROL_SYMBOL, RTF_EMSPACE }, + { "endash", CONTROL_SYMBOL, RTF_ENDASH }, + { "enddoc", CONTROL_FLAG, RTF_ENDDOC }, + { "endnhere", CONTROL_FLAG, RTF_ENDNHERE }, + { "endnotes", CONTROL_FLAG, RTF_ENDNOTES }, + { "enforceprot", CONTROL_VALUE, RTF_ENFORCEPROT }, + { "enspace", CONTROL_SYMBOL, RTF_ENSPACE }, + { "expnd", CONTROL_VALUE, RTF_EXPND }, + { "expndtw", CONTROL_VALUE, RTF_EXPNDTW }, + { "expshrtn", CONTROL_FLAG, RTF_EXPSHRTN }, + { "f", CONTROL_VALUE, RTF_F }, + { "faauto", CONTROL_FLAG, RTF_FAAUTO }, + { "facenter", CONTROL_FLAG, RTF_FACENTER }, + { "facingp", CONTROL_TOGGLE, RTF_FACINGP }, + { "factoidname", CONTROL_DESTINATION, RTF_FACTOIDNAME }, + { "fafixed", CONTROL_FLAG, RTF_FAFIXED }, + { "fahang", CONTROL_FLAG, RTF_FAHANG }, + { "falt", CONTROL_DESTINATION, RTF_FALT }, + { "faroman", CONTROL_FLAG, RTF_FAROMAN }, + { "favar", CONTROL_FLAG, RTF_FAVAR }, + { "fbias", CONTROL_VALUE, RTF_FBIAS }, + { "fbidi", CONTROL_FLAG, RTF_FBIDI }, + { "fbidis", CONTROL_FLAG, RTF_FBIDIS }, + { "fbimajor", CONTROL_FLAG, RTF_FBIMAJOR }, + { "fbiminor", CONTROL_FLAG, RTF_FBIMINOR }, + { "fchars", CONTROL_DESTINATION, RTF_FCHARS }, + { "fcharset", CONTROL_VALUE, RTF_FCHARSET }, + { "fcs", CONTROL_VALUE, RTF_FCS }, + { "fdbmajor", CONTROL_FLAG, RTF_FDBMAJOR }, + { "fdbminor", CONTROL_FLAG, RTF_FDBMINOR }, + { "fdecor", CONTROL_FLAG, RTF_FDECOR }, + { "felnbrelev", CONTROL_FLAG, RTF_FELNBRELEV }, + { "fet", CONTROL_VALUE, RTF_FET }, + { "fetch", CONTROL_FLAG, RTF_FETCH }, + { "ffdefres", CONTROL_VALUE, RTF_FFDEFRES }, + { "ffdeftext", CONTROL_DESTINATION, RTF_FFDEFTEXT }, + { "ffentrymcr", CONTROL_DESTINATION, RTF_FFENTRYMCR }, + { "ffexitmcr", CONTROL_DESTINATION, RTF_FFEXITMCR }, + { "ffformat", CONTROL_DESTINATION, RTF_FFFORMAT }, + { "ffhaslistbox", CONTROL_VALUE, RTF_FFHASLISTBOX }, + { "ffhelptext", CONTROL_DESTINATION, RTF_FFHELPTEXT }, + { "ffhps", CONTROL_VALUE, RTF_FFHPS }, + { "ffl", CONTROL_DESTINATION, RTF_FFL }, + { "ffmaxlen", CONTROL_VALUE, RTF_FFMAXLEN }, + { "ffname", CONTROL_DESTINATION, RTF_FFNAME }, + { "ffownhelp", CONTROL_VALUE, RTF_FFOWNHELP }, + { "ffownstat", CONTROL_VALUE, RTF_FFOWNSTAT }, + { "ffprot", CONTROL_VALUE, RTF_FFPROT }, + { "ffrecalc", CONTROL_VALUE, RTF_FFRECALC }, + { "ffres", CONTROL_VALUE, RTF_FFRES }, + { "ffsize", CONTROL_VALUE, RTF_FFSIZE }, + { "ffstattext", CONTROL_DESTINATION, RTF_FFSTATTEXT }, + { "fftype", CONTROL_VALUE, RTF_FFTYPE }, + { "fftypetxt", CONTROL_VALUE, RTF_FFTYPETXT }, + { "fhimajor", CONTROL_FLAG, RTF_FHIMAJOR }, + { "fhiminor", CONTROL_FLAG, RTF_FHIMINOR }, + { "fi", CONTROL_VALUE, RTF_FI }, + { "fid", CONTROL_VALUE, RTF_FID }, + { "field", CONTROL_DESTINATION, RTF_FIELD }, + { "file", CONTROL_DESTINATION, RTF_FILE }, + { "filetbl", CONTROL_DESTINATION, RTF_FILETBL }, + { "fittext", CONTROL_VALUE, RTF_FITTEXT }, + { "fjgothic", CONTROL_FLAG, RTF_FJGOTHIC }, + { "fjminchou", CONTROL_FLAG, RTF_FJMINCHOU }, + { "fldalt", CONTROL_FLAG, RTF_FLDALT }, + { "flddirty", CONTROL_FLAG, RTF_FLDDIRTY }, + { "fldedit", CONTROL_FLAG, RTF_FLDEDIT }, + { "fldinst", CONTROL_DESTINATION, RTF_FLDINST }, + { "fldlock", CONTROL_FLAG, RTF_FLDLOCK }, + { "fldpriv", CONTROL_FLAG, RTF_FLDPRIV }, + { "fldrslt", CONTROL_DESTINATION, RTF_FLDRSLT }, + { "fldtype", CONTROL_DESTINATION, RTF_FLDTYPE }, + { "flomajor", CONTROL_FLAG, RTF_FLOMAJOR }, + { "flominor", CONTROL_FLAG, RTF_FLOMINOR }, + { "fmodern", CONTROL_FLAG, RTF_FMODERN }, + { "fn", CONTROL_VALUE, RTF_FN }, + { "fname", CONTROL_DESTINATION, RTF_FNAME }, + { "fnetwork", CONTROL_FLAG, RTF_FNETWORK }, + { "fnil", CONTROL_FLAG, RTF_FNIL }, + { "fnonfilesys", CONTROL_FLAG, RTF_FNONFILESYS }, + { "fontemb", CONTROL_DESTINATION, RTF_FONTEMB }, + { "fontfile", CONTROL_DESTINATION, RTF_FONTFILE }, + { "fonttbl", CONTROL_DESTINATION, RTF_FONTTBL }, + { "footer", CONTROL_DESTINATION, RTF_FOOTER }, + { "footerf", CONTROL_DESTINATION, RTF_FOOTERF }, + { "footerl", CONTROL_DESTINATION, RTF_FOOTERL }, + { "footerr", CONTROL_DESTINATION, RTF_FOOTERR }, + { "footery", CONTROL_VALUE, RTF_FOOTERY }, + { "footnote", CONTROL_DESTINATION, RTF_FOOTNOTE }, + { "forceupgrade", CONTROL_FLAG, RTF_FORCEUPGRADE }, + { "formdisp", CONTROL_FLAG, RTF_FORMDISP }, + { "formfield", CONTROL_DESTINATION, RTF_FORMFIELD }, + { "formprot", CONTROL_FLAG, RTF_FORMPROT }, + { "formshade", CONTROL_FLAG, RTF_FORMSHADE }, + { "fosnum", CONTROL_VALUE, RTF_FOSNUM }, + { "fprq", CONTROL_VALUE, RTF_FPRQ }, + { "fracwidth", CONTROL_FLAG, RTF_FRACWIDTH }, + { "frelative", CONTROL_VALUE, RTF_FRELATIVE }, + { "frmtxbtlr", CONTROL_FLAG, RTF_FRMTXBTLR }, + { "frmtxlrtb", CONTROL_FLAG, RTF_FRMTXLRTB }, + { "frmtxlrtbv", CONTROL_FLAG, RTF_FRMTXLRTBV }, + { "frmtxtbrl", CONTROL_FLAG, RTF_FRMTXTBRL }, + { "frmtxtbrlv", CONTROL_FLAG, RTF_FRMTXTBRLV }, + { "froman", CONTROL_FLAG, RTF_FROMAN }, + { "fromhtml", CONTROL_VALUE, RTF_FROMHTML }, + { "fromtext", CONTROL_FLAG, RTF_FROMTEXT }, + { "fs", CONTROL_VALUE, RTF_FS }, + { "fscript", CONTROL_FLAG, RTF_FSCRIPT }, + { "fswiss", CONTROL_FLAG, RTF_FSWISS }, + { "ftech", CONTROL_FLAG, RTF_FTECH }, + { "ftnalt", CONTROL_FLAG, RTF_FTNALT }, + { "ftnbj", CONTROL_FLAG, RTF_FTNBJ }, + { "ftncn", CONTROL_DESTINATION, RTF_FTNCN }, + { "ftnil", CONTROL_FLAG, RTF_FTNIL }, + { "ftnlytwnine", CONTROL_FLAG, RTF_FTNLYTWNINE }, + { "ftnnalc", CONTROL_FLAG, RTF_FTNNALC }, + { "ftnnar", CONTROL_FLAG, RTF_FTNNAR }, + { "ftnnauc", CONTROL_FLAG, RTF_FTNNAUC }, + { "ftnnchi", CONTROL_FLAG, RTF_FTNNCHI }, + { "ftnnchosung", CONTROL_FLAG, RTF_FTNNCHOSUNG }, + { "ftnncnum", CONTROL_FLAG, RTF_FTNNCNUM }, + { "ftnndbar", CONTROL_FLAG, RTF_FTNNDBAR }, + { "ftnndbnum", CONTROL_FLAG, RTF_FTNNDBNUM }, + { "ftnndbnumd", CONTROL_FLAG, RTF_FTNNDBNUMD }, + { "ftnndbnumk", CONTROL_FLAG, RTF_FTNNDBNUMK }, + { "ftnndbnumt", CONTROL_FLAG, RTF_FTNNDBNUMT }, + { "ftnnganada", CONTROL_FLAG, RTF_FTNNGANADA }, + { "ftnngbnum", CONTROL_FLAG, RTF_FTNNGBNUM }, + { "ftnngbnumd", CONTROL_FLAG, RTF_FTNNGBNUMD }, + { "ftnngbnumk", CONTROL_FLAG, RTF_FTNNGBNUMK }, + { "ftnngbnuml", CONTROL_FLAG, RTF_FTNNGBNUML }, + { "ftnnrlc", CONTROL_FLAG, RTF_FTNNRLC }, + { "ftnnruc", CONTROL_FLAG, RTF_FTNNRUC }, + { "ftnnzodiac", CONTROL_FLAG, RTF_FTNNZODIAC }, + { "ftnnzodiacd", CONTROL_FLAG, RTF_FTNNZODIACD }, + { "ftnnzodiacl", CONTROL_FLAG, RTF_FTNNZODIACL }, + { "ftnrestart", CONTROL_FLAG, RTF_FTNRESTART }, + { "ftnrstcont", CONTROL_FLAG, RTF_FTNRSTCONT }, + { "ftnrstpg", CONTROL_FLAG, RTF_FTNRSTPG }, + { "ftnsep", CONTROL_DESTINATION, RTF_FTNSEP }, + { "ftnsepc", CONTROL_DESTINATION, RTF_FTNSEPC }, + { "ftnstart", CONTROL_VALUE, RTF_FTNSTART }, + { "ftntj", CONTROL_FLAG, RTF_FTNTJ }, + { "fttruetype", CONTROL_FLAG, RTF_FTTRUETYPE }, + { "fvaliddos", CONTROL_FLAG, RTF_FVALIDDOS }, + { "fvalidhpfs", CONTROL_FLAG, RTF_FVALIDHPFS }, + { "fvalidmac", CONTROL_FLAG, RTF_FVALIDMAC }, + { "fvalidntfs", CONTROL_FLAG, RTF_FVALIDNTFS }, + { "g", CONTROL_DESTINATION, RTF_G }, + { "gcw", CONTROL_VALUE, RTF_GCW }, + { "generator", CONTROL_DESTINATION, RTF_GENERATOR }, + { "green", CONTROL_VALUE, RTF_GREEN }, + { "grfdocevents", CONTROL_VALUE, RTF_GRFDOCEVENTS }, + { "gridtbl", CONTROL_DESTINATION, RTF_GRIDTBL }, + { "gutter", CONTROL_VALUE, RTF_GUTTER }, + { "gutterprl", CONTROL_FLAG, RTF_GUTTERPRL }, + { "guttersxn", CONTROL_VALUE, RTF_GUTTERSXN }, + { "header", CONTROL_DESTINATION, RTF_HEADER }, + { "headerf", CONTROL_DESTINATION, RTF_HEADERF }, + { "headerl", CONTROL_DESTINATION, RTF_HEADERL }, + { "headerr", CONTROL_DESTINATION, RTF_HEADERR }, + { "headery", CONTROL_VALUE, RTF_HEADERY }, + { "hich", CONTROL_FLAG, RTF_HICH }, + { "highlight", CONTROL_VALUE, RTF_HIGHLIGHT }, + { "hl", CONTROL_DESTINATION, RTF_HL }, + { "hlfr", CONTROL_DESTINATION, RTF_HLFR }, + { "hlinkbase", CONTROL_DESTINATION, RTF_HLINKBASE }, + { "hlloc", CONTROL_DESTINATION, RTF_HLLOC }, + { "hlsrc", CONTROL_DESTINATION, RTF_HLSRC }, + { "horzdoc", CONTROL_FLAG, RTF_HORZDOC }, + { "horzsect", CONTROL_FLAG, RTF_HORZSECT }, + { "horzvert", CONTROL_VALUE, RTF_HORZVERT }, + { "hr", CONTROL_VALUE, RTF_HR }, + { "hres", CONTROL_VALUE, RTF_HRES }, + { "hrule", CONTROL_FLAG, RTF_HRULE }, + { "hsv", CONTROL_DESTINATION, RTF_HSV }, + { "htmautsp", CONTROL_FLAG, RTF_HTMAUTSP }, + { "htmlbase", CONTROL_FLAG, RTF_HTMLBASE }, + { "htmlrtf", CONTROL_TOGGLE, RTF_HTMLRTF }, + { "htmltag", CONTROL_DESTINATION, RTF_HTMLTAG }, + { "hwelev", CONTROL_FLAG, RTF_HWELEV }, + { "hyphauto", CONTROL_TOGGLE, RTF_HYPHAUTO }, + { "hyphcaps", CONTROL_TOGGLE, RTF_HYPHCAPS }, + { "hyphconsec", CONTROL_VALUE, RTF_HYPHCONSEC }, + { "hyphhotz", CONTROL_VALUE, RTF_HYPHHOTZ }, + { "hyphpar", CONTROL_TOGGLE, RTF_HYPHPAR }, + { "i", CONTROL_TOGGLE, RTF_I }, + { "id", CONTROL_VALUE, RTF_ID }, + { "ignoremixedcontent", CONTROL_VALUE, RTF_IGNOREMIXEDCONTENT }, + { "ilfomacatclnup", CONTROL_VALUE, RTF_ILFOMACATCLNUP }, + { "ilvl", CONTROL_VALUE, RTF_ILVL }, + { "impr", CONTROL_TOGGLE, RTF_IMPR }, + { "indmirror", CONTROL_FLAG, RTF_INDMIRROR }, + { "indrlsweleven", CONTROL_FLAG, RTF_INDRLSWELEVEN }, + { "info", CONTROL_DESTINATION, RTF_INFO }, + { "insrsid", CONTROL_VALUE, RTF_INSRSID }, + { "intbl", CONTROL_FLAG, RTF_INTBL }, + { "ipgp", CONTROL_VALUE, RTF_IPGP }, + { "irowband", CONTROL_VALUE, RTF_IROWBAND }, + { "irow", CONTROL_VALUE, RTF_IROW }, + { "itap", CONTROL_VALUE, RTF_ITAP }, + { "ixe", CONTROL_FLAG, RTF_IXE }, + { "jcompress", CONTROL_FLAG, RTF_JCOMPRESS }, + { "jexpand", CONTROL_FLAG, RTF_JEXPAND }, + { "jis", CONTROL_FLAG, RTF_JIS }, + { "jpegblip", CONTROL_FLAG, RTF_JPEGBLIP }, + { "jsksu", CONTROL_FLAG, RTF_JSKSU }, + { "keep", CONTROL_FLAG, RTF_KEEP }, + { "keepn", CONTROL_FLAG, RTF_KEEPN }, + { "kerning", CONTROL_VALUE, RTF_KERNING }, + { "keycode", CONTROL_DESTINATION, RTF_KEYCODE }, + { "keywords", CONTROL_DESTINATION, RTF_KEYWORDS }, + { "krnprsnet", CONTROL_FLAG, RTF_KRNPRSNET }, + { "ksulang", CONTROL_VALUE, RTF_KSULANG }, + { "jclisttab", CONTROL_FLAG, RTF_JCLISTTAB }, + { "landscape", CONTROL_FLAG, RTF_LANDSCAPE }, + { "lang", CONTROL_VALUE, RTF_LANG }, + { "langfe", CONTROL_VALUE, RTF_LANGFE }, + { "langfenp", CONTROL_VALUE, RTF_LANGFENP }, + { "langnp", CONTROL_VALUE, RTF_LANGNP }, + { "lastrow", CONTROL_FLAG, RTF_LASTROW }, + { "latentstyles", CONTROL_DESTINATION, RTF_LATENTSTYLES }, + { "lbr", CONTROL_VALUE, RTF_LBR }, + { "lchars", CONTROL_DESTINATION, RTF_LCHARS }, + { "ldblquote", CONTROL_SYMBOL, RTF_LDBLQUOTE }, + { "level", CONTROL_VALUE, RTF_LEVEL }, + { "levelfollow", CONTROL_VALUE, RTF_LEVELFOLLOW }, + { "levelindent", CONTROL_VALUE, RTF_LEVELINDENT }, + { "leveljc", CONTROL_VALUE, RTF_LEVELJC }, + { "leveljcn", CONTROL_VALUE, RTF_LEVELJCN }, + { "levellegal", CONTROL_VALUE, RTF_LEVELLEGAL }, + { "levelnfc", CONTROL_VALUE, RTF_LEVELNFC }, + { "levelnfcn", CONTROL_VALUE, RTF_LEVELNFCN }, + { "levelnorestart", CONTROL_VALUE, RTF_LEVELNORESTART }, + { "levelnumbers", CONTROL_DESTINATION, RTF_LEVELNUMBERS }, + { "levelold", CONTROL_VALUE, RTF_LEVELOLD }, + { "levelpicture", CONTROL_VALUE, RTF_LEVELPICTURE }, + { "levelpicturenosize", CONTROL_FLAG, RTF_LEVELPICTURENOSIZE }, + { "levelprev", CONTROL_VALUE, RTF_LEVELPREV }, + { "levelprevspace", CONTROL_VALUE, RTF_LEVELPREVSPACE }, + { "levelspace", CONTROL_VALUE, RTF_LEVELSPACE }, + { "levelstartat", CONTROL_VALUE, RTF_LEVELSTARTAT }, + { "leveltemplateid", CONTROL_VALUE, RTF_LEVELTEMPLATEID }, + { "leveltext", CONTROL_DESTINATION, RTF_LEVELTEXT }, + { "lfolevel", CONTROL_DESTINATION, RTF_LFOLEVEL }, + { "li", CONTROL_VALUE, RTF_LI }, + { "line", CONTROL_SYMBOL, RTF_LINE }, + { "linebetcol", CONTROL_FLAG, RTF_LINEBETCOL }, + { "linecont", CONTROL_FLAG, RTF_LINECONT }, + { "linemod", CONTROL_VALUE, RTF_LINEMOD }, + { "lineppage", CONTROL_FLAG, RTF_LINEPPAGE }, + { "linerestart", CONTROL_FLAG, RTF_LINERESTART }, + { "linestart", CONTROL_VALUE, RTF_LINESTART }, + { "linestarts", CONTROL_VALUE, RTF_LINESTARTS }, + { "linex", CONTROL_VALUE, RTF_LINEX }, + { "linkself", CONTROL_FLAG, RTF_LINKSELF }, + { "linkstyles", CONTROL_FLAG, RTF_LINKSTYLES }, + { "linkval", CONTROL_DESTINATION, RTF_LINKVAL }, + { "lin", CONTROL_VALUE, RTF_LIN }, + { "lisa", CONTROL_VALUE, RTF_LISA }, + { "lisb", CONTROL_VALUE, RTF_LISB }, + { "list", CONTROL_DESTINATION, RTF_LIST }, + { "listhybrid", CONTROL_FLAG, RTF_LISTHYBRID }, + { "listid", CONTROL_VALUE, RTF_LISTID }, + { "listlevel", CONTROL_DESTINATION, RTF_LISTLEVEL }, + { "listname", CONTROL_DESTINATION, RTF_LISTNAME }, + { "listoverride", CONTROL_DESTINATION, RTF_LISTOVERRIDE }, + { "listoverridecount", CONTROL_VALUE, RTF_LISTOVERRIDECOUNT }, + { "listoverrideformat", CONTROL_VALUE, RTF_LISTOVERRIDEFORMAT }, + { "listoverridestartat", CONTROL_FLAG, RTF_LISTOVERRIDESTARTAT }, + { "listoverridetable", CONTROL_DESTINATION, RTF_LISTOVERRIDETABLE }, + { "listpicture", CONTROL_DESTINATION, RTF_LISTPICTURE }, + { "listrestarthdn", CONTROL_VALUE, RTF_LISTRESTARTHDN }, + { "listsimple", CONTROL_VALUE, RTF_LISTSIMPLE }, + { "liststyleid", CONTROL_VALUE, RTF_LISTSTYLEID }, + { "liststylename", CONTROL_DESTINATION, RTF_LISTSTYLENAME }, + { "listtable", CONTROL_DESTINATION, RTF_LISTTABLE }, + { "listtemplateid", CONTROL_VALUE, RTF_LISTTEMPLATEID }, + { "listtext", CONTROL_DESTINATION, RTF_LISTTEXT }, + { "lnbrkrule", CONTROL_FLAG, RTF_LNBRKRULE }, + { "lndscpsxn", CONTROL_FLAG, RTF_LNDSCPSXN }, + { "lnongrid", CONTROL_FLAG, RTF_LNONGRID }, + { "loch", CONTROL_FLAG, RTF_LOCH }, + { "lquote", CONTROL_SYMBOL, RTF_LQUOTE }, + { "ls", CONTROL_VALUE, RTF_LS }, + { "lsdlocked", CONTROL_VALUE, RTF_LSDLOCKED }, + { "lsdlockeddef", CONTROL_VALUE, RTF_LSDLOCKEDDEF }, + { "lsdlockedexcept", CONTROL_DESTINATION, RTF_LSDLOCKEDEXCEPT }, + { "lsdpriority", CONTROL_VALUE, RTF_LSDPRIORITY }, + { "lsdprioritydef", CONTROL_VALUE, RTF_LSDPRIORITYDEF }, + { "lsdqformat", CONTROL_VALUE, RTF_LSDQFORMAT }, + { "lsdqformatdef", CONTROL_VALUE, RTF_LSDQFORMATDEF }, + { "lsdsemihidden", CONTROL_VALUE, RTF_LSDSEMIHIDDEN }, + { "lsdsemihiddendef", CONTROL_VALUE, RTF_LSDSEMIHIDDENDEF }, + { "lsdstimax", CONTROL_VALUE, RTF_LSDSTIMAX }, + { "lsdunhideused", CONTROL_VALUE, RTF_LSDUNHIDEUSED }, + { "lsdunhideuseddef", CONTROL_VALUE, RTF_LSDUNHIDEUSEDDEF }, + { "ltrch", CONTROL_FLAG, RTF_LTRCH }, + { "ltrdoc", CONTROL_FLAG, RTF_LTRDOC }, + { "ltrmark", CONTROL_SYMBOL, RTF_LTRMARK }, + { "ltrpar", CONTROL_FLAG, RTF_LTRPAR }, + { "ltrrow", CONTROL_FLAG, RTF_LTRROW }, + { "ltrsect", CONTROL_FLAG, RTF_LTRSECT }, + { "lvltentative", CONTROL_FLAG, RTF_LVLTENTATIVE }, + { "lytcalctblwd", CONTROL_FLAG, RTF_LYTCALCTBLWD }, + { "lytexcttp", CONTROL_FLAG, RTF_LYTEXCTTP }, + { "lytprtmet", CONTROL_FLAG, RTF_LYTPRTMET }, + { "lyttblrtgr", CONTROL_FLAG, RTF_LYTTBLRTGR }, + { "mac", CONTROL_FLAG, RTF_MAC }, + { "macc", CONTROL_DESTINATION, RTF_MACC }, + { "maccPr", CONTROL_DESTINATION, RTF_MACCPR }, + { "macpict", CONTROL_FLAG, RTF_MACPICT }, + { "mailmerge", CONTROL_DESTINATION, RTF_MAILMERGE }, + { "makebackup", CONTROL_FLAG, RTF_MAKEBACKUP }, + { "maln", CONTROL_DESTINATION, RTF_MALN }, + { "malnScr", CONTROL_DESTINATION, RTF_MALNSCR }, + { "manager", CONTROL_DESTINATION, RTF_MANAGER }, + { "margb", CONTROL_VALUE, RTF_MARGB }, + { "margbsxn", CONTROL_VALUE, RTF_MARGBSXN }, + { "margl", CONTROL_VALUE, RTF_MARGL }, + { "marglsxn", CONTROL_VALUE, RTF_MARGLSXN }, + { "margmirror", CONTROL_FLAG, RTF_MARGMIRROR }, + { "margmirsxn", CONTROL_FLAG, RTF_MARGMIRSXN }, + { "margPr", CONTROL_DESTINATION, RTF_MARGPR }, + { "margr", CONTROL_VALUE, RTF_MARGR }, + { "margrsxn", CONTROL_VALUE, RTF_MARGRSXN }, + { "margSz", CONTROL_VALUE, RTF_MARGSZ }, + { "margt", CONTROL_VALUE, RTF_MARGT }, + { "margtsxn", CONTROL_VALUE, RTF_MARGTSXN }, + { "mbar", CONTROL_DESTINATION, RTF_MBAR }, + { "mbarPr", CONTROL_DESTINATION, RTF_MBARPR }, + { "mbaseJc", CONTROL_DESTINATION, RTF_MBASEJC }, + { "mbegChr", CONTROL_DESTINATION, RTF_MBEGCHR }, + { "mborderBox", CONTROL_DESTINATION, RTF_MBORDERBOX }, + { "mborderBoxPr", CONTROL_DESTINATION, RTF_MBORDERBOXPR }, + { "mbox", CONTROL_DESTINATION, RTF_MBOX }, + { "mboxPr", CONTROL_DESTINATION, RTF_MBOXPR }, + { "mbrk", CONTROL_VALUE, RTF_MBRK }, + { "mbrkBin", CONTROL_VALUE, RTF_MBRKBIN }, + { "mbrkBinSub", CONTROL_VALUE, RTF_MBRKBINSUB }, + { "mcGp", CONTROL_VALUE, RTF_MCGP }, + { "mcGpRule", CONTROL_VALUE, RTF_MCGPRULE }, + { "mchr", CONTROL_DESTINATION, RTF_MCHR }, + { "mcount", CONTROL_DESTINATION, RTF_MCOUNT }, + { "mcSp", CONTROL_VALUE, RTF_MCSP }, + { "mctrlPr", CONTROL_DESTINATION, RTF_MCTRLPR }, + { "md", CONTROL_DESTINATION, RTF_MD }, + { "mdefJc", CONTROL_VALUE, RTF_MDEFJC }, + { "mdeg", CONTROL_DESTINATION, RTF_MDEG }, + { "mdegHide", CONTROL_DESTINATION, RTF_MDEGHIDE }, + { "mden", CONTROL_DESTINATION, RTF_MDEN }, + { "mdiff", CONTROL_DESTINATION, RTF_MDIFF }, + { "mdiffSty", CONTROL_VALUE, RTF_MDIFFSTY }, + { "mdispdef", CONTROL_VALUE, RTF_MDISPDEF }, + { "mdPr", CONTROL_DESTINATION, RTF_MDPR }, + { "me", CONTROL_DESTINATION, RTF_ME }, + { "mendChr", CONTROL_DESTINATION, RTF_MENDCHR }, + { "meqArr", CONTROL_DESTINATION, RTF_MEQARR }, + { "meqArrPr", CONTROL_DESTINATION, RTF_MEQARRPR }, + { "mf", CONTROL_DESTINATION, RTF_MF }, + { "mfName", CONTROL_DESTINATION, RTF_MFNAME }, + { "mfPr", CONTROL_DESTINATION, RTF_MFPR }, + { "mfunc", CONTROL_DESTINATION, RTF_MFUNC }, + { "mfuncPr", CONTROL_DESTINATION, RTF_MFUNCPR }, + { "mgroupChr", CONTROL_DESTINATION, RTF_MGROUPCHR }, + { "mgroupChrPr", CONTROL_DESTINATION, RTF_MGROUPCHRPR }, + { "mgrow", CONTROL_DESTINATION, RTF_MGROW }, + { "mhideBot", CONTROL_DESTINATION, RTF_MHIDEBOT }, + { "mhideLeft", CONTROL_DESTINATION, RTF_MHIDELEFT }, + { "mhideRight", CONTROL_DESTINATION, RTF_MHIDERIGHT }, + { "mhideTop", CONTROL_DESTINATION, RTF_MHIDETOP }, + { "mhtmltag", CONTROL_DESTINATION, RTF_MHTMLTAG }, + { "min", CONTROL_VALUE, RTF_MIN }, + { "minterSp", CONTROL_VALUE, RTF_MINTERSP }, + { "mintLim", CONTROL_VALUE, RTF_MINTLIM }, + { "mintraSp", CONTROL_VALUE, RTF_MINTRASP }, + { "mjc", CONTROL_VALUE, RTF_MJC }, + { "mlim", CONTROL_DESTINATION, RTF_MLIM }, + { "mlimloc", CONTROL_DESTINATION, RTF_MLIMLOC }, + { "mlimLoc", CONTROL_DESTINATION, RTF_MLIMLOC }, + { "mlimlow", CONTROL_DESTINATION, RTF_MLIMLOW }, + { "mlimLow", CONTROL_DESTINATION, RTF_MLIMLOW }, + { "mlimlowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR }, + { "mlimLowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR }, + { "mlimupp", CONTROL_DESTINATION, RTF_MLIMUPP }, + { "mlimUpp", CONTROL_DESTINATION, RTF_MLIMUPP }, + { "mlimuppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR }, + { "mlimUppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR }, + { "mlit", CONTROL_FLAG, RTF_MLIT }, + { "mlMargin", CONTROL_VALUE, RTF_MLMARGIN }, + { "mm", CONTROL_DESTINATION, RTF_MM }, + { "mmaddfieldname", CONTROL_DESTINATION, RTF_MMADDFIELDNAME }, + { "mmath", CONTROL_DESTINATION, RTF_MMATH }, + { "mmathFont", CONTROL_VALUE, RTF_MMATHFONT }, + { "mmathPict", CONTROL_DESTINATION, RTF_MMATHPICT }, + { "mmathPr", CONTROL_DESTINATION, RTF_MMATHPR }, + { "mmattach", CONTROL_FLAG, RTF_MMATTACH }, + { "mmaxdist", CONTROL_DESTINATION, RTF_MMAXDIST }, + { "mmblanklines", CONTROL_FLAG, RTF_MMBLANKLINES }, + { "mmc", CONTROL_DESTINATION, RTF_MMC }, + { "mmcJc", CONTROL_DESTINATION, RTF_MMCJC }, + { "mmconnectstr", CONTROL_DESTINATION, RTF_MMCONNECTSTR }, + { "mmconnectstrdata", CONTROL_DESTINATION, RTF_MMCONNECTSTRDATA }, + { "mmcPr", CONTROL_DESTINATION, RTF_MMCPR }, + { "mmcs", CONTROL_DESTINATION, RTF_MMCS }, + { "mmdatasource", CONTROL_DESTINATION, RTF_MMDATASOURCE }, + { "mmdatatypeaccess", CONTROL_FLAG, RTF_MMDATATYPEACCESS }, + { "mmdatatypeexcel", CONTROL_FLAG, RTF_MMDATATYPEEXCEL }, + { "mmdatatypefile", CONTROL_FLAG, RTF_MMDATATYPEFILE }, + { "mmdatatypeodbc", CONTROL_FLAG, RTF_MMDATATYPEODBC }, + { "mmdatatypeodso", CONTROL_FLAG, RTF_MMDATATYPEODSO }, + { "mmdatatypeqt", CONTROL_FLAG, RTF_MMDATATYPEQT }, + { "mmdefaultsql", CONTROL_FLAG, RTF_MMDEFAULTSQL }, + { "mmdestemail", CONTROL_FLAG, RTF_MMDESTEMAIL }, + { "mmdestfax", CONTROL_FLAG, RTF_MMDESTFAX }, + { "mmdestnewdoc", CONTROL_FLAG, RTF_MMDESTNEWDOC }, + { "mmdestprinter", CONTROL_FLAG, RTF_MMDESTPRINTER }, + { "mmerrors", CONTROL_VALUE, RTF_MMERRORS }, + { "mmfttypeaddress", CONTROL_FLAG, RTF_MMFTTYPEADDRESS }, + { "mmfttypebarcode", CONTROL_FLAG, RTF_MMFTTYPEBARCODE }, + { "mmfttypedbcolumn", CONTROL_FLAG, RTF_MMFTTYPEDBCOLUMN }, + { "mmfttypemapped", CONTROL_FLAG, RTF_MMFTTYPEMAPPED }, + { "mmfttypenull", CONTROL_FLAG, RTF_MMFTTYPENULL }, + { "mmfttypesalutation", CONTROL_FLAG, RTF_MMFTTYPESALUTATION }, + { "mmheadersource", CONTROL_DESTINATION, RTF_MMHEADERSOURCE }, + { "mmjdsotype", CONTROL_VALUE, RTF_MMJDSOTYPE }, + { "mmlinktoquery", CONTROL_FLAG, RTF_MMLINKTOQUERY }, + { "mmmailsubject", CONTROL_DESTINATION, RTF_MMMAILSUBJECT }, + { "mmmaintypecatalog", CONTROL_FLAG, RTF_MMMAINTYPECATALOG }, + { "mmmaintypeemail", CONTROL_FLAG, RTF_MMMAINTYPEEMAIL }, + { "mmmaintypeenvelopes", CONTROL_FLAG, RTF_MMMAINTYPEENVELOPES }, + { "mmmaintypefax", CONTROL_FLAG, RTF_MMMAINTYPEFAX }, + { "mmmaintypelabels", CONTROL_FLAG, RTF_MMMAINTYPELABELS }, + { "mmmaintypeletters", CONTROL_FLAG, RTF_MMMAINTYPELETTERS }, + { "mmodso", CONTROL_DESTINATION, RTF_MMODSO }, + { "mmodsoactive", CONTROL_VALUE, RTF_MMODSOACTIVE }, + { "mmodsocoldelim", CONTROL_VALUE, RTF_MMODSOCOLDELIM }, + { "mmodsocolumn", CONTROL_VALUE, RTF_MMODSOCOLUMN }, + { "mmodsodynaddr", CONTROL_VALUE, RTF_MMODSODYNADDR }, + { "mmodsofhdr", CONTROL_VALUE, RTF_MMODSOFHDR }, + { "mmodsofilter", CONTROL_DESTINATION, RTF_MMODSOFILTER }, + { "mmodsofldmpdata", CONTROL_DESTINATION, RTF_MMODSOFLDMPDATA }, + { "mmodsofmcolumn", CONTROL_VALUE, RTF_MMODSOFMCOLUMN }, + { "mmodsohash", CONTROL_VALUE, RTF_MMODSOHASH }, + { "mmodsolid", CONTROL_VALUE, RTF_MMODSOLID }, + { "mmodsomappedname", CONTROL_DESTINATION, RTF_MMODSOMAPPEDNAME }, + { "mmodsoname", CONTROL_DESTINATION, RTF_MMODSONAME }, + { "mmodsorecipdata", CONTROL_DESTINATION, RTF_MMODSORECIPDATA }, + { "mmodsosort", CONTROL_DESTINATION, RTF_MMODSOSORT }, + { "mmodsosrc", CONTROL_DESTINATION, RTF_MMODSOSRC }, + { "mmodsotable", CONTROL_DESTINATION, RTF_MMODSOTABLE }, + { "mmodsoudl", CONTROL_DESTINATION, RTF_MMODSOUDL }, + { "mmodsoudldata", CONTROL_DESTINATION, RTF_MMODSOUDLDATA }, + { "mmodsouniquetag", CONTROL_DESTINATION, RTF_MMODSOUNIQUETAG }, + { "mmPr", CONTROL_DESTINATION, RTF_MMPR }, + { "mmquery", CONTROL_DESTINATION, RTF_MMQUERY }, + { "mmr", CONTROL_DESTINATION, RTF_MMR }, + { "mmreccur", CONTROL_VALUE, RTF_MMRECCUR }, + { "mmshowdata", CONTROL_FLAG, RTF_MMSHOWDATA }, + { "mnary", CONTROL_DESTINATION, RTF_MNARY }, + { "mnaryLim", CONTROL_VALUE, RTF_MNARYLIM }, + { "mnaryPr", CONTROL_DESTINATION, RTF_MNARYPR }, + { "mnoBreak", CONTROL_DESTINATION, RTF_MNOBREAK }, + { "mnor", CONTROL_FLAG, RTF_MNOR }, + { "mnum", CONTROL_DESTINATION, RTF_MNUM }, + { "mo", CONTROL_VALUE, RTF_MO }, + { "mobjDist", CONTROL_DESTINATION, RTF_MOBJDIST }, + { "moMath", CONTROL_DESTINATION, RTF_MOMATH }, + { "moMathPara", CONTROL_DESTINATION, RTF_MOMATHPARA }, + { "moMathParaPr", CONTROL_DESTINATION, RTF_MOMATHPARAPR }, + { "mopEmu", CONTROL_DESTINATION, RTF_MOPEMU }, + { "mphant", CONTROL_DESTINATION, RTF_MPHANT }, + { "mphantPr", CONTROL_DESTINATION, RTF_MPHANTPR }, + { "mplcHide", CONTROL_DESTINATION, RTF_MPLCHIDE }, + { "mpos", CONTROL_DESTINATION, RTF_MPOS }, + { "mpostSp", CONTROL_VALUE, RTF_MPOSTSP }, + { "mpreSp", CONTROL_VALUE, RTF_MPRESP }, + { "mr", CONTROL_DESTINATION, RTF_MR }, + { "mrad", CONTROL_DESTINATION, RTF_MRAD }, + { "mradPr", CONTROL_DESTINATION, RTF_MRADPR }, + { "mrMargin", CONTROL_VALUE, RTF_MRMARGIN }, + { "mrPr", CONTROL_DESTINATION, RTF_MRPR }, + { "mrSp", CONTROL_VALUE, RTF_MRSP }, + { "mrSpRule", CONTROL_VALUE, RTF_MRSPRULE }, + { "mscr", CONTROL_VALUE, RTF_MSCR }, + { "msepChr", CONTROL_DESTINATION, RTF_MSEPCHR }, + { "mshow", CONTROL_DESTINATION, RTF_MSHOW }, + { "mshp", CONTROL_DESTINATION, RTF_MSHP }, + { "msmallFrac", CONTROL_VALUE, RTF_MSMALLFRAC }, + { "msmcap", CONTROL_FLAG, RTF_MSMCAP }, + { "msPre", CONTROL_DESTINATION, RTF_MSPRE }, + { "msPrePr", CONTROL_DESTINATION, RTF_MSPREPR }, + { "msSub", CONTROL_DESTINATION, RTF_MSSUB }, + { "msSubPr", CONTROL_DESTINATION, RTF_MSSUBPR }, + { "msSubSup", CONTROL_DESTINATION, RTF_MSSUBSUP }, + { "msSubSupPr", CONTROL_DESTINATION, RTF_MSSUBSUPPR }, + { "msSup", CONTROL_DESTINATION, RTF_MSSUP }, + { "msSupPr", CONTROL_DESTINATION, RTF_MSSUPPR }, + { "mstrikeBLTR", CONTROL_DESTINATION, RTF_MSTRIKEBLTR }, + { "mstrikeH", CONTROL_DESTINATION, RTF_MSTRIKEH }, + { "mstrikeTLBR", CONTROL_DESTINATION, RTF_MSTRIKETLBR }, + { "mstrikeV", CONTROL_DESTINATION, RTF_MSTRIKEV }, + { "msty", CONTROL_VALUE, RTF_MSTY }, + { "msub", CONTROL_DESTINATION, RTF_MSUB }, + { "msubHide", CONTROL_DESTINATION, RTF_MSUBHIDE }, + { "msup", CONTROL_DESTINATION, RTF_MSUP }, + { "msupHide", CONTROL_DESTINATION, RTF_MSUPHIDE }, + { "mtransp", CONTROL_DESTINATION, RTF_MTRANSP }, + { "mtype", CONTROL_DESTINATION, RTF_MTYPE }, + { "muser", CONTROL_FLAG, RTF_MUSER }, + { "mvauth", CONTROL_VALUE, RTF_MVAUTH }, + { "mvdate", CONTROL_VALUE, RTF_MVDATE }, + { "mvertJc", CONTROL_DESTINATION, RTF_MVERTJC }, + { "mvf", CONTROL_FLAG, RTF_MVF }, + { "mvfmf", CONTROL_DESTINATION, RTF_MVFMF }, + { "mvfml", CONTROL_DESTINATION, RTF_MVFML }, + { "mvt", CONTROL_FLAG, RTF_MVT }, + { "mvtof", CONTROL_DESTINATION, RTF_MVTOF }, + { "mvtol", CONTROL_DESTINATION, RTF_MVTOL }, + { "mwrapIndent", CONTROL_VALUE, RTF_MWRAPINDENT }, + { "mwrapRight", CONTROL_VALUE, RTF_MWRAPRIGHT }, + { "mzeroAsc", CONTROL_DESTINATION, RTF_MZEROASC }, + { "mzeroDesc", CONTROL_DESTINATION, RTF_MZERODESC }, + { "mzeroWid", CONTROL_DESTINATION, RTF_MZEROWID }, + { "nestcell", CONTROL_SYMBOL, RTF_NESTCELL }, + { "nestrow", CONTROL_SYMBOL, RTF_NESTROW }, + { "nesttableprops", CONTROL_DESTINATION, RTF_NESTTABLEPROPS }, + { "newtblstyruls", CONTROL_FLAG, RTF_NEWTBLSTYRULS }, + { "nextfile", CONTROL_DESTINATION, RTF_NEXTFILE }, + { "noafcnsttbl", CONTROL_FLAG, RTF_NOAFCNSTTBL }, + { "nobrkwrptbl", CONTROL_FLAG, RTF_NOBRKWRPTBL }, + { "nocolbal", CONTROL_FLAG, RTF_NOCOLBAL }, + { "nocompatoptions", CONTROL_FLAG, RTF_NOCOMPATOPTIONS }, + { "nocwrap", CONTROL_FLAG, RTF_NOCWRAP }, + { "nocxsptable", CONTROL_FLAG, RTF_NOCXSPTABLE }, + { "noextrasprl", CONTROL_FLAG, RTF_NOEXTRASPRL }, + { "nofchars", CONTROL_VALUE, RTF_NOFCHARS }, + { "nofcharsws", CONTROL_VALUE, RTF_NOFCHARSWS }, + { "nofeaturethrottle", CONTROL_FLAG, RTF_NOFEATURETHROTTLE }, + { "nofpages", CONTROL_VALUE, RTF_NOFPAGES }, + { "nofwords", CONTROL_VALUE, RTF_NOFWORDS }, + { "nogrowautofit", CONTROL_FLAG, RTF_NOGROWAUTOFIT }, + { "noindnmbrts", CONTROL_FLAG, RTF_NOINDNMBRTS }, + { "nojkernpunct", CONTROL_FLAG, RTF_NOJKERNPUNCT }, + { "nolead", CONTROL_FLAG, RTF_NOLEAD }, + { "noline", CONTROL_FLAG, RTF_NOLINE }, + { "nolnhtadjtbl", CONTROL_FLAG, RTF_NOLNHTADJTBL }, + { "nonesttables", CONTROL_DESTINATION, RTF_NONESTTABLES }, + { "nonshppict", CONTROL_FLAG, RTF_NONSHPPICT }, + { "nooverflow", CONTROL_FLAG, RTF_NOOVERFLOW }, + { "noproof", CONTROL_FLAG, RTF_NOPROOF }, + { "noqfpromote", CONTROL_FLAG, RTF_NOQFPROMOTE }, + { "nosectexpand", CONTROL_FLAG, RTF_NOSECTEXPAND }, + { "nosnaplinegrid", CONTROL_FLAG, RTF_NOSNAPLINEGRID }, + { "nospaceforul", CONTROL_FLAG, RTF_NOSPACEFORUL }, + { "nosupersub", CONTROL_FLAG, RTF_NOSUPERSUB }, + { "notabind", CONTROL_FLAG, RTF_NOTABIND }, + { "notbrkcnstfrctbl", CONTROL_FLAG, RTF_NOTBRKCNSTFRCTBL }, + { "notcvasp", CONTROL_FLAG, RTF_NOTCVASP }, + { "notvatxbx", CONTROL_FLAG, RTF_NOTVATXBX }, + { "nouicompat", CONTROL_FLAG, RTF_NOUICOMPAT }, + { "noultrlspc", CONTROL_FLAG, RTF_NOULTRLSPC }, + { "nowidctlpar", CONTROL_FLAG, RTF_NOWIDCTLPAR }, + { "nowrap", CONTROL_FLAG, RTF_NOWRAP }, + { "nowwrap", CONTROL_FLAG, RTF_NOWWRAP }, + { "noxlattoyen", CONTROL_FLAG, RTF_NOXLATTOYEN }, + { "objalias", CONTROL_DESTINATION, RTF_OBJALIAS }, + { "objalign", CONTROL_VALUE, RTF_OBJALIGN }, + { "objattph", CONTROL_FLAG, RTF_OBJATTPH }, + { "objautlink", CONTROL_FLAG, RTF_OBJAUTLINK }, + { "objclass", CONTROL_DESTINATION, RTF_OBJCLASS }, + { "objcropb", CONTROL_VALUE, RTF_OBJCROPB }, + { "objcropl", CONTROL_VALUE, RTF_OBJCROPL }, + { "objcropr", CONTROL_VALUE, RTF_OBJCROPR }, + { "objcropt", CONTROL_VALUE, RTF_OBJCROPT }, + { "objdata", CONTROL_DESTINATION, RTF_OBJDATA }, + { "object", CONTROL_DESTINATION, RTF_OBJECT }, + { "objemb", CONTROL_FLAG, RTF_OBJEMB }, + { "objh", CONTROL_VALUE, RTF_OBJH }, + { "objhtml", CONTROL_FLAG, RTF_OBJHTML }, + { "objicemb", CONTROL_FLAG, RTF_OBJICEMB }, + { "objlink", CONTROL_FLAG, RTF_OBJLINK }, + { "objlock", CONTROL_FLAG, RTF_OBJLOCK }, + { "objname", CONTROL_DESTINATION, RTF_OBJNAME }, + { "objocx", CONTROL_FLAG, RTF_OBJOCX }, + { "objpub", CONTROL_FLAG, RTF_OBJPUB }, + { "objscalex", CONTROL_VALUE, RTF_OBJSCALEX }, + { "objscaley", CONTROL_VALUE, RTF_OBJSCALEY }, + { "objsect", CONTROL_DESTINATION, RTF_OBJSECT }, + { "objsetsize", CONTROL_FLAG, RTF_OBJSETSIZE }, + { "objsub", CONTROL_FLAG, RTF_OBJSUB }, + { "objtime", CONTROL_DESTINATION, RTF_OBJTIME }, + { "objtransy", CONTROL_VALUE, RTF_OBJTRANSY }, + { "objupdate", CONTROL_FLAG, RTF_OBJUPDATE }, + { "objw", CONTROL_VALUE, RTF_OBJW }, + { "ogutter", CONTROL_VALUE, RTF_OGUTTER }, + { "oldas", CONTROL_FLAG, RTF_OLDAS }, + { "oldcprops", CONTROL_DESTINATION, RTF_OLDCPROPS }, + { "oldlinewrap", CONTROL_FLAG, RTF_OLDLINEWRAP }, + { "oldpprops", CONTROL_DESTINATION, RTF_OLDPPROPS }, + { "oldsprops", CONTROL_DESTINATION, RTF_OLDSPROPS }, + { "oldtprops", CONTROL_DESTINATION, RTF_OLDTPROPS }, + { "oleclsid", CONTROL_DESTINATION, RTF_OLECLSID }, + { "operator", CONTROL_DESTINATION, RTF_OPERATOR }, + { "otblrul", CONTROL_FLAG, RTF_OTBLRUL }, + { "outl", CONTROL_TOGGLE, RTF_OUTL }, + { "outlinelevel", CONTROL_VALUE, RTF_OUTLINELEVEL }, + { "overlay", CONTROL_FLAG, RTF_OVERLAY }, + { "page", CONTROL_SYMBOL, RTF_PAGE }, + { "pagebb", CONTROL_FLAG, RTF_PAGEBB }, + { "panose", CONTROL_DESTINATION, RTF_PANOSE }, + { "paperh", CONTROL_VALUE, RTF_PAPERH }, + { "paperw", CONTROL_VALUE, RTF_PAPERW }, + { "par", CONTROL_SYMBOL, RTF_PAR }, + { "pararsid", CONTROL_VALUE, RTF_PARARSID }, + { "pard", CONTROL_FLAG, RTF_PARD }, + { "password", CONTROL_DESTINATION, RTF_PASSWORD }, + { "passwordhash", CONTROL_DESTINATION, RTF_PASSWORDHASH }, + { "pc", CONTROL_FLAG, RTF_PC }, + { "pca", CONTROL_FLAG, RTF_PCA }, + { "pgbrdrb", CONTROL_FLAG, RTF_PGBRDRB }, + { "pgbrdrfoot", CONTROL_FLAG, RTF_PGBRDRFOOT }, + { "pgbrdrhead", CONTROL_FLAG, RTF_PGBRDRHEAD }, + { "pgbrdrl", CONTROL_FLAG, RTF_PGBRDRL }, + { "pgbrdropt", CONTROL_VALUE, RTF_PGBRDROPT }, + { "pgbrdrr", CONTROL_FLAG, RTF_PGBRDRR }, + { "pgbrdrsnap", CONTROL_FLAG, RTF_PGBRDRSNAP }, + { "pgbrdrt", CONTROL_FLAG, RTF_PGBRDRT }, + { "pghsxn", CONTROL_VALUE, RTF_PGHSXN }, + { "pgnbidia", CONTROL_FLAG, RTF_PGNBIDIA }, + { "pgnbidib", CONTROL_FLAG, RTF_PGNBIDIB }, + { "pgnchosung", CONTROL_FLAG, RTF_PGNCHOSUNG }, + { "pgncnum", CONTROL_FLAG, RTF_PGNCNUM }, + { "pgncont", CONTROL_FLAG, RTF_PGNCONT }, + { "pgndbnum", CONTROL_FLAG, RTF_PGNDBNUM }, + { "pgndbnumd", CONTROL_FLAG, RTF_PGNDBNUMD }, + { "pgndbnumk", CONTROL_FLAG, RTF_PGNDBNUMK }, + { "pgndbnumt", CONTROL_FLAG, RTF_PGNDBNUMT }, + { "pgndec", CONTROL_FLAG, RTF_PGNDEC }, + { "pgndecd", CONTROL_FLAG, RTF_PGNDECD }, + { "pgnganada", CONTROL_FLAG, RTF_PGNGANADA }, + { "pgngbnum", CONTROL_FLAG, RTF_PGNGBNUM }, + { "pgngbnumd", CONTROL_FLAG, RTF_PGNGBNUMD }, + { "pgngbnumk", CONTROL_FLAG, RTF_PGNGBNUMK }, + { "pgngbnuml", CONTROL_FLAG, RTF_PGNGBNUML }, + { "pgnhindia", CONTROL_FLAG, RTF_PGNHINDIA }, + { "pgnhindib", CONTROL_FLAG, RTF_PGNHINDIB }, + { "pgnhindic", CONTROL_FLAG, RTF_PGNHINDIC }, + { "pgnhindid", CONTROL_FLAG, RTF_PGNHINDID }, + { "pgnhn", CONTROL_VALUE, RTF_PGNHN }, + { "pgnhnsc", CONTROL_FLAG, RTF_PGNHNSC }, + { "pgnhnsh", CONTROL_FLAG, RTF_PGNHNSH }, + { "pgnhnsm", CONTROL_FLAG, RTF_PGNHNSM }, + { "pgnhnsn", CONTROL_FLAG, RTF_PGNHNSN }, + { "pgnhnsp", CONTROL_FLAG, RTF_PGNHNSP }, + { "pgnid", CONTROL_FLAG, RTF_PGNID }, + { "pgnlcltr", CONTROL_FLAG, RTF_PGNLCLTR }, + { "pgnlcrm", CONTROL_FLAG, RTF_PGNLCRM }, + { "pgnrestart", CONTROL_FLAG, RTF_PGNRESTART }, + { "pgnstart", CONTROL_VALUE, RTF_PGNSTART }, + { "pgnstarts", CONTROL_VALUE, RTF_PGNSTARTS }, + { "pgnthaia", CONTROL_FLAG, RTF_PGNTHAIA }, + { "pgnthaib", CONTROL_FLAG, RTF_PGNTHAIB }, + { "pgnthaic", CONTROL_FLAG, RTF_PGNTHAIC }, + { "pgnucltr", CONTROL_FLAG, RTF_PGNUCLTR }, + { "pgnucrm", CONTROL_FLAG, RTF_PGNUCRM }, + { "pgnvieta", CONTROL_FLAG, RTF_PGNVIETA }, + { "pgnx", CONTROL_VALUE, RTF_PGNX }, + { "pgny", CONTROL_VALUE, RTF_PGNY }, + { "pgnzodiac", CONTROL_FLAG, RTF_PGNZODIAC }, + { "pgnzodiacd", CONTROL_FLAG, RTF_PGNZODIACD }, + { "pgnzodiacl", CONTROL_FLAG, RTF_PGNZODIACL }, + { "pgp", CONTROL_DESTINATION, RTF_PGP }, + { "pgptbl", CONTROL_DESTINATION, RTF_PGPTBL }, + { "pgwsxn", CONTROL_VALUE, RTF_PGWSXN }, + { "phcol", CONTROL_FLAG, RTF_PHCOL }, + { "phmrg", CONTROL_FLAG, RTF_PHMRG }, + { "phpg", CONTROL_FLAG, RTF_PHPG }, + { "picbmp", CONTROL_FLAG, RTF_PICBMP }, + { "picbpp", CONTROL_VALUE, RTF_PICBPP }, + { "piccropb", CONTROL_VALUE, RTF_PICCROPB }, + { "piccropl", CONTROL_VALUE, RTF_PICCROPL }, + { "piccropr", CONTROL_VALUE, RTF_PICCROPR }, + { "piccropt", CONTROL_VALUE, RTF_PICCROPT }, + { "pich", CONTROL_VALUE, RTF_PICH }, + { "pichgoal", CONTROL_VALUE, RTF_PICHGOAL }, + { "pichGoal", CONTROL_VALUE, RTF_PICHGOAL }, + { "picprop", CONTROL_DESTINATION, RTF_PICPROP }, + { "picscaled", CONTROL_FLAG, RTF_PICSCALED }, + { "picscalex", CONTROL_VALUE, RTF_PICSCALEX }, + { "picscaley", CONTROL_VALUE, RTF_PICSCALEY }, + { "pict", CONTROL_DESTINATION, RTF_PICT }, + { "picw", CONTROL_VALUE, RTF_PICW }, + { "picwgoal", CONTROL_VALUE, RTF_PICWGOAL }, + { "picwGoal", CONTROL_VALUE, RTF_PICWGOAL }, + { "pindtabqc", CONTROL_FLAG, RTF_PINDTABQC }, + { "pindtabql", CONTROL_FLAG, RTF_PINDTABQL }, + { "pindtabqr", CONTROL_FLAG, RTF_PINDTABQR }, + { "plain", CONTROL_FLAG, RTF_PLAIN }, + { "pmartabqc", CONTROL_FLAG, RTF_PMARTABQC }, + { "pmartabql", CONTROL_FLAG, RTF_PMARTABQL }, + { "pmartabqr", CONTROL_FLAG, RTF_PMARTABQR }, + { "pmmetafile", CONTROL_VALUE, RTF_PMMETAFILE }, + { "pn", CONTROL_DESTINATION, RTF_PN }, + { "pnacross", CONTROL_FLAG, RTF_PNACROSS }, + { "pnaiu", CONTROL_FLAG, RTF_PNAIU }, + { "pnaiud", CONTROL_FLAG, RTF_PNAIUD }, + { "pnaiueo", CONTROL_FLAG, RTF_PNAIUEO }, + { "pnaiueod", CONTROL_FLAG, RTF_PNAIUEOD }, + { "pnb", CONTROL_TOGGLE, RTF_PNB }, + { "pnbidia", CONTROL_FLAG, RTF_PNBIDIA }, + { "pnbidib", CONTROL_FLAG, RTF_PNBIDIB }, + { "pncaps", CONTROL_TOGGLE, RTF_PNCAPS }, + { "pncard", CONTROL_FLAG, RTF_PNCARD }, + { "pncf", CONTROL_VALUE, RTF_PNCF }, + { "pnchosung", CONTROL_FLAG, RTF_PNCHOSUNG }, + { "pncnum", CONTROL_FLAG, RTF_PNCNUM }, + { "pndbnum", CONTROL_FLAG, RTF_PNDBNUM }, + { "pndbnumd", CONTROL_FLAG, RTF_PNDBNUMD }, + { "pndbnumk", CONTROL_FLAG, RTF_PNDBNUMK }, + { "pndbnuml", CONTROL_FLAG, RTF_PNDBNUML }, + { "pndbnumt", CONTROL_FLAG, RTF_PNDBNUMT }, + { "pndec", CONTROL_FLAG, RTF_PNDEC }, + { "pndecd", CONTROL_FLAG, RTF_PNDECD }, + { "pnf", CONTROL_VALUE, RTF_PNF }, + { "pnfs", CONTROL_VALUE, RTF_PNFS }, + { "pnganada", CONTROL_FLAG, RTF_PNGANADA }, + { "pngblip", CONTROL_FLAG, RTF_PNGBLIP }, + { "pngbnum", CONTROL_FLAG, RTF_PNGBNUM }, + { "pngbnumd", CONTROL_FLAG, RTF_PNGBNUMD }, + { "pngbnumk", CONTROL_FLAG, RTF_PNGBNUMK }, + { "pngbnuml", CONTROL_FLAG, RTF_PNGBNUML }, + { "pnhang", CONTROL_FLAG, RTF_PNHANG }, + { "pni", CONTROL_TOGGLE, RTF_PNI }, + { "pnindent", CONTROL_VALUE, RTF_PNINDENT }, + { "pniroha", CONTROL_FLAG, RTF_PNIROHA }, + { "pnirohad", CONTROL_FLAG, RTF_PNIROHAD }, + { "pnlcltr", CONTROL_FLAG, RTF_PNLCLTR }, + { "pnlcrm", CONTROL_FLAG, RTF_PNLCRM }, + { "pnlvl", CONTROL_VALUE, RTF_PNLVL }, + { "pnlvlblt", CONTROL_FLAG, RTF_PNLVLBLT }, + { "pnlvlbody", CONTROL_FLAG, RTF_PNLVLBODY }, + { "pnlvlcont", CONTROL_FLAG, RTF_PNLVLCONT }, + { "pnnumonce", CONTROL_FLAG, RTF_PNNUMONCE }, + { "pnord", CONTROL_FLAG, RTF_PNORD }, + { "pnordt", CONTROL_FLAG, RTF_PNORDT }, + { "pnprev", CONTROL_FLAG, RTF_PNPREV }, + { "pnqc", CONTROL_FLAG, RTF_PNQC }, + { "pnql", CONTROL_FLAG, RTF_PNQL }, + { "pnqr", CONTROL_FLAG, RTF_PNQR }, + { "pnrauth", CONTROL_VALUE, RTF_PNRAUTH }, + { "pnrdate", CONTROL_VALUE, RTF_PNRDATE }, + { "pnrestart", CONTROL_FLAG, RTF_PNRESTART }, + { "pnrnfc", CONTROL_VALUE, RTF_PNRNFC }, + { "pnrnot", CONTROL_FLAG, RTF_PNRNOT }, + { "pnrpnbr", CONTROL_VALUE, RTF_PNRPNBR }, + { "pnrrgb", CONTROL_VALUE, RTF_PNRRGB }, + { "pnrstart", CONTROL_VALUE, RTF_PNRSTART }, + { "pnrstop", CONTROL_VALUE, RTF_PNRSTOP }, + { "pnrxst", CONTROL_VALUE, RTF_PNRXST }, + { "pnscaps", CONTROL_TOGGLE, RTF_PNSCAPS }, + { "pnseclvl", CONTROL_DESTINATION, RTF_PNSECLVL }, + { "pnsp", CONTROL_VALUE, RTF_PNSP }, + { "pnstart", CONTROL_VALUE, RTF_PNSTART }, + { "pnstrike", CONTROL_TOGGLE, RTF_PNSTRIKE }, + { "pntext", CONTROL_DESTINATION, RTF_PNTEXT }, + { "pntxta", CONTROL_DESTINATION, RTF_PNTXTA }, + { "pntxtb", CONTROL_DESTINATION, RTF_PNTXTB }, + { "pnucltr", CONTROL_FLAG, RTF_PNUCLTR }, + { "pnucrm", CONTROL_FLAG, RTF_PNUCRM }, + { "pnul", CONTROL_TOGGLE, RTF_PNUL }, + { "pnuld", CONTROL_FLAG, RTF_PNULD }, + { "pnuldash", CONTROL_FLAG, RTF_PNULDASH }, + { "pnuldashd", CONTROL_FLAG, RTF_PNULDASHD }, + { "pnuldashdd", CONTROL_FLAG, RTF_PNULDASHDD }, + { "pnuldb", CONTROL_FLAG, RTF_PNULDB }, + { "pnulhair", CONTROL_FLAG, RTF_PNULHAIR }, + { "pnulnone", CONTROL_FLAG, RTF_PNULNONE }, + { "pnulth", CONTROL_FLAG, RTF_PNULTH }, + { "pnulw", CONTROL_FLAG, RTF_PNULW }, + { "pnulwave", CONTROL_FLAG, RTF_PNULWAVE }, + { "pnzodiac", CONTROL_FLAG, RTF_PNZODIAC }, + { "pnzodiacd", CONTROL_FLAG, RTF_PNZODIACD }, + { "pnzodiacl", CONTROL_FLAG, RTF_PNZODIACL }, + { "posnegx", CONTROL_VALUE, RTF_POSNEGX }, + { "posnegy", CONTROL_VALUE, RTF_POSNEGY }, + { "posx", CONTROL_VALUE, RTF_POSX }, + { "posxc", CONTROL_FLAG, RTF_POSXC }, + { "posxi", CONTROL_FLAG, RTF_POSXI }, + { "posxl", CONTROL_FLAG, RTF_POSXL }, + { "posxo", CONTROL_FLAG, RTF_POSXO }, + { "posxr", CONTROL_FLAG, RTF_POSXR }, + { "posy", CONTROL_VALUE, RTF_POSY }, + { "posyb", CONTROL_FLAG, RTF_POSYB }, + { "posyc", CONTROL_FLAG, RTF_POSYC }, + { "posyil", CONTROL_FLAG, RTF_POSYIL }, + { "posyin", CONTROL_FLAG, RTF_POSYIN }, + { "posyout", CONTROL_FLAG, RTF_POSYOUT }, + { "posyt", CONTROL_FLAG, RTF_POSYT }, + { "prauth", CONTROL_VALUE, RTF_PRAUTH }, + { "prcolbl", CONTROL_FLAG, RTF_PRCOLBL }, + { "prdate", CONTROL_VALUE, RTF_PRDATE }, + { "printdata", CONTROL_FLAG, RTF_PRINTDATA }, + { "printim", CONTROL_DESTINATION, RTF_PRINTIM }, + { "private", CONTROL_DESTINATION, RTF_PRIVATE }, + { "propname", CONTROL_DESTINATION, RTF_PROPNAME }, + { "proptype", CONTROL_VALUE, RTF_PROPTYPE }, + { "protect", CONTROL_TOGGLE, RTF_PROTECT }, + { "protend", CONTROL_DESTINATION, RTF_PROTEND }, + { "protlevel", CONTROL_VALUE, RTF_PROTLEVEL }, + { "protstart", CONTROL_DESTINATION, RTF_PROTSTART }, + { "protusertbl", CONTROL_DESTINATION, RTF_PROTUSERTBL }, + { "psover", CONTROL_FLAG, RTF_PSOVER }, + { "psz", CONTROL_VALUE, RTF_PSZ }, + { "ptabldot", CONTROL_FLAG, RTF_PTABLDOT }, + { "ptablmdot", CONTROL_FLAG, RTF_PTABLMDOT }, + { "ptablminus", CONTROL_FLAG, RTF_PTABLMINUS }, + { "ptablnone", CONTROL_FLAG, RTF_PTABLNONE }, + { "ptabluscore", CONTROL_FLAG, RTF_PTABLUSCORE }, + { "pubauto", CONTROL_FLAG, RTF_PUBAUTO }, + { "pvmrg", CONTROL_FLAG, RTF_PVMRG }, + { "pvpara", CONTROL_FLAG, RTF_PVPARA }, + { "pvpg", CONTROL_FLAG, RTF_PVPG }, + { "pwd", CONTROL_VALUE, RTF_PWD }, + { "pxe", CONTROL_DESTINATION, RTF_PXE }, + { "qc", CONTROL_FLAG, RTF_QC }, + { "qd", CONTROL_FLAG, RTF_QD }, + { "qj", CONTROL_FLAG, RTF_QJ }, + { "qk", CONTROL_VALUE, RTF_QK }, + { "ql", CONTROL_FLAG, RTF_QL }, + { "qmspace", CONTROL_SYMBOL, RTF_QMSPACE }, + { "qr", CONTROL_FLAG, RTF_QR }, + { "qt", CONTROL_FLAG, RTF_QT }, + { "rawclbgdkbdiag", CONTROL_FLAG, RTF_RAWCLBGDKBDIAG }, + { "rawclbgbdiag", CONTROL_FLAG, RTF_RAWCLBGBDIAG }, + { "rawclbgcross", CONTROL_FLAG, RTF_RAWCLBGCROSS }, + { "rawclbgdcross", CONTROL_FLAG, RTF_RAWCLBGDCROSS }, + { "rawclbgdkcross", CONTROL_FLAG, RTF_RAWCLBGDKCROSS }, + { "rawclbgdkdcross", CONTROL_FLAG, RTF_RAWCLBGDKDCROSS }, + { "rawclbgdkfdiag", CONTROL_FLAG, RTF_RAWCLBGDKFDIAG }, + { "rawclbgdkhor", CONTROL_FLAG, RTF_RAWCLBGDKHOR }, + { "rawclbgdkvert", CONTROL_FLAG, RTF_RAWCLBGDKVERT }, + { "rawclbgfdiag", CONTROL_FLAG, RTF_RAWCLBGFDIAG }, + { "rawclbghoriz", CONTROL_FLAG, RTF_RAWCLBGHORIZ }, + { "rawclbgvert", CONTROL_FLAG, RTF_RAWCLBGVERT }, + { "rdblquote", CONTROL_SYMBOL, RTF_RDBLQUOTE }, + { "readonlyrecommended", CONTROL_FLAG, RTF_READONLYRECOMMENDED }, + { "readprot", CONTROL_FLAG, RTF_READPROT }, + { "red", CONTROL_VALUE, RTF_RED }, + { "relyonvml", CONTROL_VALUE, RTF_RELYONVML }, + { "remdttm", CONTROL_FLAG, RTF_REMDTTM }, + { "rempersonalinfo", CONTROL_FLAG, RTF_REMPERSONALINFO }, + { "result", CONTROL_DESTINATION, RTF_RESULT }, + { "revauth", CONTROL_VALUE, RTF_REVAUTH }, + { "revauthdel", CONTROL_VALUE, RTF_REVAUTHDEL }, + { "revbar", CONTROL_VALUE, RTF_REVBAR }, + { "revdttm", CONTROL_VALUE, RTF_REVDTTM }, + { "revdttmdel", CONTROL_VALUE, RTF_REVDTTMDEL }, + { "revised", CONTROL_TOGGLE, RTF_REVISED }, + { "revisions", CONTROL_FLAG, RTF_REVISIONS }, + { "revprop", CONTROL_VALUE, RTF_REVPROP }, + { "revprot", CONTROL_FLAG, RTF_REVPROT }, + { "revtbl", CONTROL_DESTINATION, RTF_REVTBL }, + { "revtim", CONTROL_DESTINATION, RTF_REVTIM }, + { "ri", CONTROL_VALUE, RTF_RI }, + { "rin", CONTROL_VALUE, RTF_RIN }, + { "row", CONTROL_SYMBOL, RTF_ROW }, + { "rquote", CONTROL_SYMBOL, RTF_RQUOTE }, + { "rsid", CONTROL_VALUE, RTF_RSID }, + { "rsidroot", CONTROL_VALUE, RTF_RSIDROOT }, + { "rsidtbl", CONTROL_DESTINATION, RTF_RSIDTBL }, + { "rsltbmp", CONTROL_FLAG, RTF_RSLTBMP }, + { "rslthtml", CONTROL_FLAG, RTF_RSLTHTML }, + { "rsltmerge", CONTROL_FLAG, RTF_RSLTMERGE }, + { "rsltpict", CONTROL_FLAG, RTF_RSLTPICT }, + { "rsltrtf", CONTROL_FLAG, RTF_RSLTRTF }, + { "rslttxt", CONTROL_FLAG, RTF_RSLTTXT }, + { "rtf", CONTROL_DESTINATION, RTF_RTF }, + { "rtlch", CONTROL_FLAG, RTF_RTLCH }, + { "rtldoc", CONTROL_FLAG, RTF_RTLDOC }, + { "rtlgutter", CONTROL_FLAG, RTF_RTLGUTTER }, + { "rtlmark", CONTROL_SYMBOL, RTF_RTLMARK }, + { "rtlpar", CONTROL_FLAG, RTF_RTLPAR }, + { "rtlrow", CONTROL_FLAG, RTF_RTLROW }, + { "rtlsect", CONTROL_FLAG, RTF_RTLSECT }, + { "rxe", CONTROL_DESTINATION, RTF_RXE }, + { "s", CONTROL_VALUE, RTF_S }, + { "sa", CONTROL_VALUE, RTF_SA }, + { "saauto", CONTROL_TOGGLE, RTF_SAAUTO }, + { "saftnnalc", CONTROL_FLAG, RTF_SAFTNNALC }, + { "saftnnar", CONTROL_FLAG, RTF_SAFTNNAR }, + { "saftnnauc", CONTROL_FLAG, RTF_SAFTNNAUC }, + { "saftnnchi", CONTROL_FLAG, RTF_SAFTNNCHI }, + { "saftnnchosung", CONTROL_FLAG, RTF_SAFTNNCHOSUNG }, + { "saftnncnum", CONTROL_FLAG, RTF_SAFTNNCNUM }, + { "saftnndbar", CONTROL_FLAG, RTF_SAFTNNDBAR }, + { "saftnndbnum", CONTROL_FLAG, RTF_SAFTNNDBNUM }, + { "saftnndbnumd", CONTROL_FLAG, RTF_SAFTNNDBNUMD }, + { "saftnndbnumk", CONTROL_FLAG, RTF_SAFTNNDBNUMK }, + { "saftnndbnumt", CONTROL_FLAG, RTF_SAFTNNDBNUMT }, + { "saftnnganada", CONTROL_FLAG, RTF_SAFTNNGANADA }, + { "saftnngbnum", CONTROL_FLAG, RTF_SAFTNNGBNUM }, + { "saftnngbnumd", CONTROL_FLAG, RTF_SAFTNNGBNUMD }, + { "saftnngbnumk", CONTROL_FLAG, RTF_SAFTNNGBNUMK }, + { "saftnngbnuml", CONTROL_FLAG, RTF_SAFTNNGBNUML }, + { "saftnnrlc", CONTROL_FLAG, RTF_SAFTNNRLC }, + { "saftnnruc", CONTROL_FLAG, RTF_SAFTNNRUC }, + { "saftnnzodiac", CONTROL_FLAG, RTF_SAFTNNZODIAC }, + { "saftnnzodiacd", CONTROL_FLAG, RTF_SAFTNNZODIACD }, + { "saftnnzodiacl", CONTROL_FLAG, RTF_SAFTNNZODIACL }, + { "saftnrestart", CONTROL_FLAG, RTF_SAFTNRESTART }, + { "saftnrstcont", CONTROL_FLAG, RTF_SAFTNRSTCONT }, + { "saftnstart", CONTROL_VALUE, RTF_SAFTNSTART }, + { "sautoupd", CONTROL_FLAG, RTF_SAUTOUPD }, + { "saveinvalidxml", CONTROL_FLAG, RTF_SAVEINVALIDXML }, + { "saveprevpict", CONTROL_FLAG, RTF_SAVEPREVPICT }, + { "sb", CONTROL_VALUE, RTF_SB }, + { "sbasedon", CONTROL_VALUE, RTF_SBASEDON }, + { "sbauto", CONTROL_TOGGLE, RTF_SBAUTO }, + { "sbkcol", CONTROL_FLAG, RTF_SBKCOL }, + { "sbkeven", CONTROL_FLAG, RTF_SBKEVEN }, + { "sbknone", CONTROL_FLAG, RTF_SBKNONE }, + { "sbkodd", CONTROL_FLAG, RTF_SBKODD }, + { "sbkpage", CONTROL_FLAG, RTF_SBKPAGE }, + { "sbys", CONTROL_FLAG, RTF_SBYS }, + { "scaps", CONTROL_TOGGLE, RTF_SCAPS }, + { "scompose", CONTROL_FLAG, RTF_SCOMPOSE }, + { "sec", CONTROL_VALUE, RTF_SEC }, + { "sect", CONTROL_SYMBOL, RTF_SECT }, + { "sectd", CONTROL_FLAG, RTF_SECTD }, + { "sectdefaultcl", CONTROL_FLAG, RTF_SECTDEFAULTCL }, + { "sectexpand", CONTROL_VALUE, RTF_SECTEXPAND }, + { "sectlinegrid", CONTROL_VALUE, RTF_SECTLINEGRID }, + { "sectnum", CONTROL_SYMBOL, RTF_SECTNUM }, + { "sectrsid", CONTROL_VALUE, RTF_SECTRSID }, + { "sectspecifycl", CONTROL_FLAG, RTF_SECTSPECIFYCL }, + { "sectspecifygenN", CONTROL_FLAG, RTF_SECTSPECIFYGENN }, + { "sectspecifyl", CONTROL_FLAG, RTF_SECTSPECIFYL }, + { "sectunlocked", CONTROL_FLAG, RTF_SECTUNLOCKED }, + { "sftnbj", CONTROL_FLAG, RTF_SFTNBJ }, + { "sftnnalc", CONTROL_FLAG, RTF_SFTNNALC }, + { "sftnnar", CONTROL_FLAG, RTF_SFTNNAR }, + { "sftnnauc", CONTROL_FLAG, RTF_SFTNNAUC }, + { "sftnnchi", CONTROL_FLAG, RTF_SFTNNCHI }, + { "sftnnchosung", CONTROL_FLAG, RTF_SFTNNCHOSUNG }, + { "sftnncnum", CONTROL_FLAG, RTF_SFTNNCNUM }, + { "sftnndbar", CONTROL_FLAG, RTF_SFTNNDBAR }, + { "sftnndbnum", CONTROL_FLAG, RTF_SFTNNDBNUM }, + { "sftnndbnumd", CONTROL_FLAG, RTF_SFTNNDBNUMD }, + { "sftnndbnumk", CONTROL_FLAG, RTF_SFTNNDBNUMK }, + { "sftnndbnumt", CONTROL_FLAG, RTF_SFTNNDBNUMT }, + { "sftnnganada", CONTROL_FLAG, RTF_SFTNNGANADA }, + { "sftnngbnum", CONTROL_FLAG, RTF_SFTNNGBNUM }, + { "sftnngbnumd", CONTROL_FLAG, RTF_SFTNNGBNUMD }, + { "sftnngbnumk", CONTROL_FLAG, RTF_SFTNNGBNUMK }, + { "sftnngbnuml", CONTROL_FLAG, RTF_SFTNNGBNUML }, + { "sftnnrlc", CONTROL_FLAG, RTF_SFTNNRLC }, + { "sftnnruc", CONTROL_FLAG, RTF_SFTNNRUC }, + { "sftnnzodiac", CONTROL_FLAG, RTF_SFTNNZODIAC }, + { "sftnnzodiacd", CONTROL_FLAG, RTF_SFTNNZODIACD }, + { "sftnnzodiacl", CONTROL_FLAG, RTF_SFTNNZODIACL }, + { "sftnrestart", CONTROL_FLAG, RTF_SFTNRESTART }, + { "sftnrstcont", CONTROL_FLAG, RTF_SFTNRSTCONT }, + { "sftnrstpg", CONTROL_FLAG, RTF_SFTNRSTPG }, + { "sftnstart", CONTROL_VALUE, RTF_SFTNSTART }, + { "sftntj", CONTROL_FLAG, RTF_SFTNTJ }, + { "shad", CONTROL_TOGGLE, RTF_SHAD }, + { "shading", CONTROL_VALUE, RTF_SHADING }, + { "shidden", CONTROL_FLAG, RTF_SHIDDEN }, + { "shift", CONTROL_FLAG, RTF_SHIFT }, + { "showplaceholdtext", CONTROL_VALUE, RTF_SHOWPLACEHOLDTEXT }, + { "showxmlerrors", CONTROL_VALUE, RTF_SHOWXMLERRORS }, + { "shp", CONTROL_DESTINATION, RTF_SHP }, + { "shpbottom", CONTROL_VALUE, RTF_SHPBOTTOM }, + { "shpbxcolumn", CONTROL_FLAG, RTF_SHPBXCOLUMN }, + { "shpbxignore", CONTROL_FLAG, RTF_SHPBXIGNORE }, + { "shpbxmargin", CONTROL_FLAG, RTF_SHPBXMARGIN }, + { "shpbxpage", CONTROL_FLAG, RTF_SHPBXPAGE }, + { "shpbyignore", CONTROL_FLAG, RTF_SHPBYIGNORE }, + { "shpbymargin", CONTROL_FLAG, RTF_SHPBYMARGIN }, + { "shpbypage", CONTROL_FLAG, RTF_SHPBYPAGE }, + { "shpbypara", CONTROL_FLAG, RTF_SHPBYPARA }, + { "shpfblwtxt", CONTROL_VALUE, RTF_SHPFBLWTXT }, + { "shpfhdr", CONTROL_VALUE, RTF_SHPFHDR }, + { "shpgrp", CONTROL_DESTINATION, RTF_SHPGRP }, + { "shpinst", CONTROL_DESTINATION, RTF_SHPINST }, + { "shpleft", CONTROL_VALUE, RTF_SHPLEFT }, + { "shplid", CONTROL_VALUE, RTF_SHPLID }, + { "shplockanchor", CONTROL_FLAG, RTF_SHPLOCKANCHOR }, + { "shppict", CONTROL_DESTINATION, RTF_SHPPICT }, + { "shpright", CONTROL_VALUE, RTF_SHPRIGHT }, + { "shprslt", CONTROL_DESTINATION, RTF_SHPRSLT }, + { "shptop", CONTROL_VALUE, RTF_SHPTOP }, + { "shptxt", CONTROL_DESTINATION, RTF_SHPTXT }, + { "shpwrk", CONTROL_VALUE, RTF_SHPWRK }, + { "shpwr", CONTROL_VALUE, RTF_SHPWR }, + { "shpz", CONTROL_VALUE, RTF_SHPZ }, + { "sl", CONTROL_VALUE, RTF_SL }, + { "slink", CONTROL_VALUE, RTF_SLINK }, + { "slmult", CONTROL_VALUE, RTF_SLMULT }, + { "slocked", CONTROL_FLAG, RTF_SLOCKED }, + { "sn", CONTROL_DESTINATION, RTF_SN }, + { "snaptogridincell", CONTROL_FLAG, RTF_SNAPTOGRIDINCELL }, + { "snext", CONTROL_VALUE, RTF_SNEXT }, + { "softcol", CONTROL_FLAG, RTF_SOFTCOL }, + { "softlheight", CONTROL_VALUE, RTF_SOFTLHEIGHT }, + { "softline", CONTROL_FLAG, RTF_SOFTLINE }, + { "softpage", CONTROL_FLAG, RTF_SOFTPAGE }, + { "sp", CONTROL_DESTINATION, RTF_SP }, + { "spersonal", CONTROL_FLAG, RTF_SPERSONAL }, + { "spltpgpar", CONTROL_FLAG, RTF_SPLTPGPAR }, + { "splytwnine", CONTROL_FLAG, RTF_SPLYTWNINE }, + { "spriority", CONTROL_VALUE, RTF_SPRIORITY }, + { "sprsbsp", CONTROL_FLAG, RTF_SPRSBSP }, + { "sprslnsp", CONTROL_FLAG, RTF_SPRSLNSP }, + { "sprsspbf", CONTROL_FLAG, RTF_SPRSSPBF }, + { "sprstsm", CONTROL_FLAG, RTF_SPRSTSM }, + { "sprstsp", CONTROL_FLAG, RTF_SPRSTSP }, + { "spv", CONTROL_FLAG, RTF_SPV }, + { "sqformat", CONTROL_FLAG, RTF_SQFORMAT }, + { "srauth", CONTROL_VALUE, RTF_SRAUTH }, + { "srdate", CONTROL_VALUE, RTF_SRDATE }, + { "sreply", CONTROL_FLAG, RTF_SREPLY }, + { "ssemihidden", CONTROL_VALUE, RTF_SSEMIHIDDEN }, + { "staticval", CONTROL_DESTINATION, RTF_STATICVAL }, + { "stextflow", CONTROL_VALUE, RTF_STEXTFLOW }, + { "strike", CONTROL_TOGGLE, RTF_STRIKE }, + { "striked", CONTROL_TOGGLE, RTF_STRIKED }, + { "stshfbi", CONTROL_VALUE, RTF_STSHFBI }, + { "stshfdbch", CONTROL_VALUE, RTF_STSHFDBCH }, + { "stshfhich", CONTROL_VALUE, RTF_STSHFHICH }, + { "stshfloch", CONTROL_VALUE, RTF_STSHFLOCH }, + { "stylelock", CONTROL_FLAG, RTF_STYLELOCK }, + { "stylelockbackcomp", CONTROL_FLAG, RTF_STYLELOCKBACKCOMP }, + { "stylelockenforced", CONTROL_FLAG, RTF_STYLELOCKENFORCED }, + { "stylelockqfset", CONTROL_FLAG, RTF_STYLELOCKQFSET }, + { "stylelocktheme", CONTROL_FLAG, RTF_STYLELOCKTHEME }, + { "stylesheet", CONTROL_DESTINATION, RTF_STYLESHEET }, + { "stylesortmethod", CONTROL_VALUE, RTF_STYLESORTMETHOD }, + { "styrsid", CONTROL_VALUE, RTF_STYRSID }, + { "sub", CONTROL_FLAG, RTF_SUB }, + { "subdocument", CONTROL_VALUE, RTF_SUBDOCUMENT }, + { "subfontbysize", CONTROL_FLAG, RTF_SUBFONTBYSIZE }, + { "subject", CONTROL_DESTINATION, RTF_SUBJECT }, + { "sunhideused", CONTROL_VALUE, RTF_SUNHIDEUSED }, + { "super", CONTROL_FLAG, RTF_SUPER }, + { "sv", CONTROL_DESTINATION, RTF_SV }, + { "svb", CONTROL_DESTINATION, RTF_SVB }, + { "swpbdr", CONTROL_FLAG, RTF_SWPBDR }, + { "tab", CONTROL_SYMBOL, RTF_TAB }, + { "tabsnoovrlp", CONTROL_FLAG, RTF_TABSNOOVRLP }, + { "taprtl", CONTROL_FLAG, RTF_TAPRTL }, + { "tb", CONTROL_VALUE, RTF_TB }, + { "tblind", CONTROL_VALUE, RTF_TBLIND }, + { "tblindtype", CONTROL_VALUE, RTF_TBLINDTYPE }, + { "tbllkbestfit", CONTROL_FLAG, RTF_TBLLKBESTFIT }, + { "tbllkborder", CONTROL_FLAG, RTF_TBLLKBORDER }, + { "tbllkcolor", CONTROL_FLAG, RTF_TBLLKCOLOR }, + { "tbllkfont", CONTROL_FLAG, RTF_TBLLKFONT }, + { "tbllkhdrcols", CONTROL_FLAG, RTF_TBLLKHDRCOLS }, + { "tbllkhdrrows", CONTROL_FLAG, RTF_TBLLKHDRROWS }, + { "tbllklastcol", CONTROL_FLAG, RTF_TBLLKLASTCOL }, + { "tbllklastrow", CONTROL_FLAG, RTF_TBLLKLASTROW }, + { "tbllknocolband", CONTROL_FLAG, RTF_TBLLKNOCOLBAND }, + { "tbllknorowband", CONTROL_FLAG, RTF_TBLLKNOROWBAND }, + { "tbllkshading", CONTROL_FLAG, RTF_TBLLKSHADING }, + { "tblrsid", CONTROL_VALUE, RTF_TBLRSID }, + { "tc", CONTROL_DESTINATION, RTF_TC }, + { "tcelld", CONTROL_FLAG, RTF_TCELLD }, + { "tcf", CONTROL_VALUE, RTF_TCF }, + { "tcl", CONTROL_VALUE, RTF_TCL }, + { "tcn", CONTROL_FLAG, RTF_TCN }, + { "tdfrmtxtBottom", CONTROL_VALUE, RTF_TDFRMTXTBOTTOM }, + { "tdfrmtxtLeft", CONTROL_VALUE, RTF_TDFRMTXTLEFT }, + { "tdfrmtxtRight", CONTROL_VALUE, RTF_TDFRMTXTRIGHT }, + { "tdfrmtxtTop", CONTROL_VALUE, RTF_TDFRMTXTTOP }, + { "template", CONTROL_DESTINATION, RTF_TEMPLATE }, + { "themedata", CONTROL_DESTINATION, RTF_THEMEDATA }, + { "themelang", CONTROL_VALUE, RTF_THEMELANG }, + { "themelangcs", CONTROL_VALUE, RTF_THEMELANGCS }, + { "themelangfe", CONTROL_VALUE, RTF_THEMELANGFE }, + { "time", CONTROL_FLAG, RTF_TIME }, + { "title", CONTROL_DESTINATION, RTF_TITLE }, + { "titlepg", CONTROL_FLAG, RTF_TITLEPG }, + { "tldot", CONTROL_FLAG, RTF_TLDOT }, + { "tleq", CONTROL_FLAG, RTF_TLEQ }, + { "tlhyph", CONTROL_FLAG, RTF_TLHYPH }, + { "tlmdot", CONTROL_FLAG, RTF_TLMDOT }, + { "tlth", CONTROL_FLAG, RTF_TLTH }, + { "tlul", CONTROL_FLAG, RTF_TLUL }, + { "toplinepunct", CONTROL_FLAG, RTF_TOPLINEPUNCT }, + { "tphcol", CONTROL_FLAG, RTF_TPHCOL }, + { "tphmrg", CONTROL_FLAG, RTF_TPHMRG }, + { "tphpg", CONTROL_FLAG, RTF_TPHPG }, + { "tposnegx", CONTROL_VALUE, RTF_TPOSNEGX }, + { "tposnegy", CONTROL_VALUE, RTF_TPOSNEGY }, + { "tposxc", CONTROL_FLAG, RTF_TPOSXC }, + { "tposxi", CONTROL_FLAG, RTF_TPOSXI }, + { "tposxl", CONTROL_FLAG, RTF_TPOSXL }, + { "tposx", CONTROL_VALUE, RTF_TPOSX }, + { "tposxo", CONTROL_FLAG, RTF_TPOSXO }, + { "tposxr", CONTROL_FLAG, RTF_TPOSXR }, + { "tposy", CONTROL_VALUE, RTF_TPOSY }, + { "tposyb", CONTROL_FLAG, RTF_TPOSYB }, + { "tposyc", CONTROL_FLAG, RTF_TPOSYC }, + { "tposyil", CONTROL_FLAG, RTF_TPOSYIL }, + { "tposyin", CONTROL_FLAG, RTF_TPOSYIN }, + { "tposyout", CONTROL_FLAG, RTF_TPOSYOUT }, + { "tposyt", CONTROL_FLAG, RTF_TPOSYT }, + { "tpvmrg", CONTROL_FLAG, RTF_TPVMRG }, + { "tpvpara", CONTROL_FLAG, RTF_TPVPARA }, + { "tpvpg", CONTROL_FLAG, RTF_TPVPG }, + { "tqc", CONTROL_FLAG, RTF_TQC }, + { "tqdec", CONTROL_FLAG, RTF_TQDEC }, + { "tqr", CONTROL_FLAG, RTF_TQR }, + { "trackformatting", CONTROL_VALUE, RTF_TRACKFORMATTING }, + { "trackmoves", CONTROL_VALUE, RTF_TRACKMOVES }, + { "transmf", CONTROL_FLAG, RTF_TRANSMF }, + { "trauth", CONTROL_VALUE, RTF_TRAUTH }, + { "trautofit", CONTROL_TOGGLE, RTF_TRAUTOFIT }, + { "trbgbdiag", CONTROL_FLAG, RTF_TRBGBDIAG }, + { "trbgcross", CONTROL_FLAG, RTF_TRBGCROSS }, + { "trbgdcross", CONTROL_FLAG, RTF_TRBGDCROSS }, + { "trbgdkbdiag", CONTROL_FLAG, RTF_TRBGDKBDIAG }, + { "trbgdkcross", CONTROL_FLAG, RTF_TRBGDKCROSS }, + { "trbgdkdcross", CONTROL_FLAG, RTF_TRBGDKDCROSS }, + { "trbgdkfdiag", CONTROL_FLAG, RTF_TRBGDKFDIAG }, + { "trbgdkhor", CONTROL_FLAG, RTF_TRBGDKHOR }, + { "trbgdkvert", CONTROL_FLAG, RTF_TRBGDKVERT }, + { "trbgfdiag", CONTROL_FLAG, RTF_TRBGFDIAG }, + { "trbghoriz", CONTROL_FLAG, RTF_TRBGHORIZ }, + { "trbgvert", CONTROL_FLAG, RTF_TRBGVERT }, + { "trbrdrb", CONTROL_FLAG, RTF_TRBRDRB }, + { "trbrdrh", CONTROL_FLAG, RTF_TRBRDRH }, + { "trbrdrl", CONTROL_FLAG, RTF_TRBRDRL }, + { "trbrdrr", CONTROL_FLAG, RTF_TRBRDRR }, + { "trbrdrt", CONTROL_FLAG, RTF_TRBRDRT }, + { "trbrdrv", CONTROL_FLAG, RTF_TRBRDRV }, + { "trcbpat", CONTROL_VALUE, RTF_TRCBPAT }, + { "trcfpat", CONTROL_VALUE, RTF_TRCFPAT }, + { "trdate", CONTROL_VALUE, RTF_TRDATE }, + { "trftsWidthA", CONTROL_VALUE, RTF_TRFTSWIDTHA }, + { "trftsWidthB", CONTROL_VALUE, RTF_TRFTSWIDTHB }, + { "trftsWidth", CONTROL_VALUE, RTF_TRFTSWIDTH }, + { "trgaph", CONTROL_VALUE, RTF_TRGAPH }, + { "trhdr", CONTROL_FLAG, RTF_TRHDR }, + { "trkeep", CONTROL_FLAG, RTF_TRKEEP }, + { "trkeepfollow", CONTROL_FLAG, RTF_TRKEEPFOLLOW }, + { "trleft", CONTROL_VALUE, RTF_TRLEFT }, + { "trowd", CONTROL_FLAG, RTF_TROWD }, + { "trpaddb", CONTROL_VALUE, RTF_TRPADDB }, + { "trpaddfb", CONTROL_VALUE, RTF_TRPADDFB }, + { "trpaddfl", CONTROL_VALUE, RTF_TRPADDFL }, + { "trpaddfr", CONTROL_VALUE, RTF_TRPADDFR }, + { "trpaddft", CONTROL_VALUE, RTF_TRPADDFT }, + { "trpaddl", CONTROL_VALUE, RTF_TRPADDL }, + { "trpaddr", CONTROL_VALUE, RTF_TRPADDR }, + { "trpaddt", CONTROL_VALUE, RTF_TRPADDT }, + { "trpadob", CONTROL_VALUE, RTF_TRPADOB }, + { "trpadofb", CONTROL_VALUE, RTF_TRPADOFB }, + { "trpadofl", CONTROL_VALUE, RTF_TRPADOFL }, + { "trpadofr", CONTROL_VALUE, RTF_TRPADOFR }, + { "trpadoft", CONTROL_VALUE, RTF_TRPADOFT }, + { "trpadol", CONTROL_VALUE, RTF_TRPADOL }, + { "trpador", CONTROL_VALUE, RTF_TRPADOR }, + { "trpadot", CONTROL_VALUE, RTF_TRPADOT }, + { "trpat", CONTROL_VALUE, RTF_TRPAT }, + { "trqc", CONTROL_FLAG, RTF_TRQC }, + { "trql", CONTROL_FLAG, RTF_TRQL }, + { "trqr", CONTROL_FLAG, RTF_TRQR }, + { "trrh", CONTROL_VALUE, RTF_TRRH }, + { "trshdng", CONTROL_VALUE, RTF_TRSHDNG }, + { "trspdb", CONTROL_VALUE, RTF_TRSPDB }, + { "trspdfb", CONTROL_VALUE, RTF_TRSPDFB }, + { "trspdfl", CONTROL_VALUE, RTF_TRSPDFL }, + { "trspdfr", CONTROL_VALUE, RTF_TRSPDFR }, + { "trspdft", CONTROL_VALUE, RTF_TRSPDFT }, + { "trspdl", CONTROL_VALUE, RTF_TRSPDL }, + { "trspdr", CONTROL_VALUE, RTF_TRSPDR }, + { "trspdt", CONTROL_VALUE, RTF_TRSPDT }, + { "trspob", CONTROL_VALUE, RTF_TRSPOB }, + { "trspofb", CONTROL_VALUE, RTF_TRSPOFB }, + { "trspofl", CONTROL_VALUE, RTF_TRSPOFL }, + { "trspofr", CONTROL_VALUE, RTF_TRSPOFR }, + { "trspoft", CONTROL_VALUE, RTF_TRSPOFT }, + { "trspol", CONTROL_VALUE, RTF_TRSPOL }, + { "trspor", CONTROL_VALUE, RTF_TRSPOR }, + { "trspot", CONTROL_VALUE, RTF_TRSPOT }, + { "truncatefontheight", CONTROL_FLAG, RTF_TRUNCATEFONTHEIGHT }, + { "truncex", CONTROL_FLAG, RTF_TRUNCEX }, + { "trwWidthA", CONTROL_VALUE, RTF_TRWWIDTHA }, + { "trwWidthB", CONTROL_VALUE, RTF_TRWWIDTHB }, + { "trwWidth", CONTROL_VALUE, RTF_TRWWIDTH }, + { "ts", CONTROL_VALUE, RTF_TS }, + { "tsbgbdiag", CONTROL_FLAG, RTF_TSBGBDIAG }, + { "tsbgcross", CONTROL_FLAG, RTF_TSBGCROSS }, + { "tsbgdcross", CONTROL_FLAG, RTF_TSBGDCROSS }, + { "tsbgdkbdiag", CONTROL_FLAG, RTF_TSBGDKBDIAG }, + { "tsbgdkcross", CONTROL_FLAG, RTF_TSBGDKCROSS }, + { "tsbgdkdcross", CONTROL_FLAG, RTF_TSBGDKDCROSS }, + { "tsbgdkfdiag", CONTROL_FLAG, RTF_TSBGDKFDIAG }, + { "tsbgdkhor", CONTROL_FLAG, RTF_TSBGDKHOR }, + { "tsbgdkvert", CONTROL_FLAG, RTF_TSBGDKVERT }, + { "tsbgfdiag", CONTROL_FLAG, RTF_TSBGFDIAG }, + { "tsbghoriz", CONTROL_FLAG, RTF_TSBGHORIZ }, + { "tsbgvert", CONTROL_FLAG, RTF_TSBGVERT }, + { "tsbrdrb", CONTROL_FLAG, RTF_TSBRDRB }, + { "tsbrdrdgl", CONTROL_FLAG, RTF_TSBRDRDGL }, + { "tsbrdrdgr", CONTROL_FLAG, RTF_TSBRDRDGR }, + { "tsbrdrh", CONTROL_FLAG, RTF_TSBRDRH }, + { "tsbrdrl", CONTROL_FLAG, RTF_TSBRDRL }, + { "tsbrdrr", CONTROL_FLAG, RTF_TSBRDRR }, + { "tsbrdrt", CONTROL_FLAG, RTF_TSBRDRT }, + { "tsbrdrv", CONTROL_FLAG, RTF_TSBRDRV }, + { "tscbandhorzeven", CONTROL_FLAG, RTF_TSCBANDHORZEVEN }, + { "tscbandhorzodd", CONTROL_FLAG, RTF_TSCBANDHORZODD }, + { "tscbandsh", CONTROL_VALUE, RTF_TSCBANDSH }, + { "tscbandsv", CONTROL_VALUE, RTF_TSCBANDSV }, + { "tscbandverteven", CONTROL_FLAG, RTF_TSCBANDVERTEVEN }, + { "tscbandvertodd", CONTROL_FLAG, RTF_TSCBANDVERTODD }, + { "tscellcbpat", CONTROL_VALUE, RTF_TSCELLCBPAT }, + { "tscellcfpat", CONTROL_VALUE, RTF_TSCELLCFPAT }, + { "tscellpaddb", CONTROL_VALUE, RTF_TSCELLPADDB }, + { "tscellpaddfb", CONTROL_VALUE, RTF_TSCELLPADDFB }, + { "tscellpaddfl", CONTROL_VALUE, RTF_TSCELLPADDFL }, + { "tscellpaddfr", CONTROL_VALUE, RTF_TSCELLPADDFR }, + { "tscellpaddft", CONTROL_VALUE, RTF_TSCELLPADDFT }, + { "tscellpaddl", CONTROL_VALUE, RTF_TSCELLPADDL }, + { "tscellpaddr", CONTROL_VALUE, RTF_TSCELLPADDR }, + { "tscellpaddt", CONTROL_VALUE, RTF_TSCELLPADDT }, + { "tscellpct", CONTROL_VALUE, RTF_TSCELLPCT }, + { "tscellwidth", CONTROL_VALUE, RTF_TSCELLWIDTH }, + { "tscellwidthfts", CONTROL_VALUE, RTF_TSCELLWIDTHFTS }, + { "tscfirstcol", CONTROL_FLAG, RTF_TSCFIRSTCOL }, + { "tscfirstrow", CONTROL_FLAG, RTF_TSCFIRSTROW }, + { "tsclastcol", CONTROL_FLAG, RTF_TSCLASTCOL }, + { "tsclastrow", CONTROL_FLAG, RTF_TSCLASTROW }, + { "tscnecell", CONTROL_FLAG, RTF_TSCNECELL }, + { "tscnwcell", CONTROL_FLAG, RTF_TSCNWCELL }, + { "tscsecell", CONTROL_FLAG, RTF_TSCSECELL }, + { "tscswcell", CONTROL_FLAG, RTF_TSCSWCELL }, + { "tsd", CONTROL_FLAG, RTF_TSD }, + { "tsnowrap", CONTROL_FLAG, RTF_TSNOWRAP }, + { "tsrowd", CONTROL_FLAG, RTF_TSROWD }, + { "tsvertalb", CONTROL_FLAG, RTF_TSVERTALB }, + { "tsvertalc", CONTROL_FLAG, RTF_TSVERTALC }, + { "tsvertalt", CONTROL_FLAG, RTF_TSVERTALT }, + { "twoinone", CONTROL_VALUE, RTF_TWOINONE }, + { "twoonone", CONTROL_FLAG, RTF_TWOONONE }, + { "tx", CONTROL_VALUE, RTF_TX }, + { "txbxtwalways", CONTROL_FLAG, RTF_TXBXTWALWAYS }, + { "txbxtwfirst", CONTROL_FLAG, RTF_TXBXTWFIRST }, + { "txbxtwfirstlast", CONTROL_FLAG, RTF_TXBXTWFIRSTLAST }, + { "txbxtwlast", CONTROL_FLAG, RTF_TXBXTWLAST }, + { "txbxtwno", CONTROL_FLAG, RTF_TXBXTWNO }, + { "txe", CONTROL_DESTINATION, RTF_TXE }, + { "u", CONTROL_VALUE, RTF_U }, + { "uc", CONTROL_VALUE, RTF_UC }, + { "ud", CONTROL_DESTINATION, RTF_UD }, + { "ul", CONTROL_TOGGLE, RTF_UL }, + { "ulc", CONTROL_VALUE, RTF_ULC }, + { "uld", CONTROL_FLAG, RTF_ULD }, + { "uldash", CONTROL_TOGGLE, RTF_ULDASH }, + { "uldashd", CONTROL_TOGGLE, RTF_ULDASHD }, + { "uldashdd", CONTROL_TOGGLE, RTF_ULDASHDD }, + { "uldb", CONTROL_TOGGLE, RTF_ULDB }, + { "ulhair", CONTROL_TOGGLE, RTF_ULHAIR }, + { "ulhwave", CONTROL_TOGGLE, RTF_ULHWAVE }, + { "ulldash", CONTROL_TOGGLE, RTF_ULLDASH }, + { "ulnone", CONTROL_FLAG, RTF_ULNONE }, + { "ulth", CONTROL_TOGGLE, RTF_ULTH }, + { "ulthd", CONTROL_TOGGLE, RTF_ULTHD }, + { "ulthdash", CONTROL_TOGGLE, RTF_ULTHDASH }, + { "ulthdashd", CONTROL_TOGGLE, RTF_ULTHDASHD }, + { "ulthdashdd", CONTROL_TOGGLE, RTF_ULTHDASHDD }, + { "ulthldash", CONTROL_TOGGLE, RTF_ULTHLDASH }, + { "ululdbwave", CONTROL_TOGGLE, RTF_ULULDBWAVE }, + { "ulw", CONTROL_FLAG, RTF_ULW }, + { "ulwave", CONTROL_TOGGLE, RTF_ULWAVE }, + { "up", CONTROL_VALUE, RTF_UP }, + { "upr", CONTROL_DESTINATION, RTF_UPR }, + { "urtf", CONTROL_VALUE, RTF_URTF }, + { "useltbaln", CONTROL_FLAG, RTF_USELTBALN }, + { "usenormstyforlist", CONTROL_FLAG, RTF_USENORMSTYFORLIST }, + { "userprops", CONTROL_DESTINATION, RTF_USERPROPS }, + { "usexform", CONTROL_FLAG, RTF_USEXFORM }, + { "utinl", CONTROL_FLAG, RTF_UTINL }, + { "v", CONTROL_TOGGLE, RTF_V }, + { "validatexml", CONTROL_VALUE, RTF_VALIDATEXML }, + { "vern", CONTROL_VALUE, RTF_VERN }, + { "version", CONTROL_VALUE, RTF_VERSION }, + { "vertal", CONTROL_FLAG, RTF_VERTAL }, + { "vertalb", CONTROL_FLAG, RTF_VERTALB }, + { "vertalc", CONTROL_FLAG, RTF_VERTALC }, + { "vertalj", CONTROL_FLAG, RTF_VERTALJ }, + { "vertalt", CONTROL_FLAG, RTF_VERTALT }, + { "vertdoc", CONTROL_FLAG, RTF_VERTDOC }, + { "vertsect", CONTROL_FLAG, RTF_VERTSECT }, + { "viewbksp", CONTROL_VALUE, RTF_VIEWBKSP }, + { "viewkind", CONTROL_VALUE, RTF_VIEWKIND }, + { "viewnobound", CONTROL_FLAG, RTF_VIEWNOBOUND }, + { "viewscale", CONTROL_VALUE, RTF_VIEWSCALE }, + { "viewzk", CONTROL_VALUE, RTF_VIEWZK }, + { "wbitmap", CONTROL_VALUE, RTF_WBITMAP }, + { "wbmbitspixel", CONTROL_VALUE, RTF_WBMBITSPIXEL }, + { "wbmplanes", CONTROL_VALUE, RTF_WBMPLANES }, + { "wbmwidthbyte", CONTROL_VALUE, RTF_WBMWIDTHBYTE }, + { "webhidden", CONTROL_FLAG, RTF_WEBHIDDEN }, + { "wgrffmtfilter", CONTROL_DESTINATION, RTF_WGRFFMTFILTER }, + { "widctlpar", CONTROL_FLAG, RTF_WIDCTLPAR }, + { "widowctrl", CONTROL_FLAG, RTF_WIDOWCTRL }, + { "windowcaption", CONTROL_DESTINATION, RTF_WINDOWCAPTION }, + { "wmetafile", CONTROL_VALUE, RTF_WMETAFILE }, + { "wpeqn", CONTROL_FLAG, RTF_WPEQN }, + { "wpjst", CONTROL_FLAG, RTF_WPJST }, + { "wpsp", CONTROL_FLAG, RTF_WPSP }, + { "wraparound", CONTROL_FLAG, RTF_WRAPAROUND }, + { "wrapdefault", CONTROL_FLAG, RTF_WRAPDEFAULT }, + { "wrapthrough", CONTROL_FLAG, RTF_WRAPTHROUGH }, + { "wraptight", CONTROL_FLAG, RTF_WRAPTIGHT }, + { "wraptrsp", CONTROL_FLAG, RTF_WRAPTRSP }, + { "writereservation", CONTROL_DESTINATION, RTF_WRITERESERVATION }, + { "writereservhash", CONTROL_DESTINATION, RTF_WRITERESERVHASH }, + { "wrppunct", CONTROL_FLAG, RTF_WRPPUNCT }, + { "xe", CONTROL_DESTINATION, RTF_XE }, + { "xef", CONTROL_VALUE, RTF_XEF }, + { "xform", CONTROL_DESTINATION, RTF_XFORM }, + { "xmlattr", CONTROL_FLAG, RTF_XMLATTR }, + { "xmlattrname", CONTROL_DESTINATION, RTF_XMLATTRNAME }, + { "xmlattrns", CONTROL_VALUE, RTF_XMLATTRNS }, + { "xmlattrvalue", CONTROL_DESTINATION, RTF_XMLATTRVALUE }, + { "xmlclose", CONTROL_DESTINATION, RTF_XMLCLOSE }, + { "xmlname", CONTROL_DESTINATION, RTF_XMLNAME }, + { "xmlns", CONTROL_VALUE, RTF_XMLNS }, + { "xmlnstbl", CONTROL_DESTINATION, RTF_XMLNSTBL }, + { "xmlopen", CONTROL_DESTINATION, RTF_XMLOPEN }, + { "xmlsdttcell", CONTROL_FLAG, RTF_XMLSDTTCELL }, + { "xmlsdttpara", CONTROL_FLAG, RTF_XMLSDTTPARA }, + { "xmlsdttregular", CONTROL_FLAG, RTF_XMLSDTTREGULAR }, + { "xmlsdttrow", CONTROL_FLAG, RTF_XMLSDTTROW }, + { "xmlsdttunknown", CONTROL_FLAG, RTF_XMLSDTTUNKNOWN }, + { "yr", CONTROL_VALUE, RTF_YR }, + { "yts", CONTROL_VALUE, RTF_YTS }, + { "yxe", CONTROL_FLAG, RTF_YXE }, + { "zwbo", CONTROL_SYMBOL, RTF_ZWBO }, + { "zwj", CONTROL_SYMBOL, RTF_ZWJ }, + { "zwnbo", CONTROL_SYMBOL, RTF_ZWNBO }, + { "zwnj", CONTROL_SYMBOL, RTF_ZWNJ }, + { "flymaincnt", CONTROL_DESTINATION, RTF_FLYMAINCNT }, + { "flyvert", CONTROL_VALUE, RTF_FLYVERT }, + { "flyhorz", CONTROL_VALUE, RTF_FLYHORZ }, + { "flyanchor", CONTROL_VALUE, RTF_FLYANCHOR }, }; int nRTFControlWords = SAL_N_ELEMENTS(aRTFControlWords); @@ -1853,54 +1851,53 @@ bool RTFSymbol::operator<(const RTFSymbol& rOther) const return std::strcmp(sKeyword, rOther.sKeyword) < 0; } -RTFMathSymbol aRTFMathControlWords[] = -{ +RTFMathSymbol aRTFMathControlWords[] = { // eKeyword nToken eDestination - {RTF_MOMATH, M_TOKEN(oMath), Destination::MOMATH}, - {RTF_MF, M_TOKEN(f), Destination::MF}, - {RTF_MFPR, M_TOKEN(fPr), Destination::MFPR}, - {RTF_MCTRLPR, M_TOKEN(ctrlPr), Destination::MCTRLPR}, - {RTF_MNUM, M_TOKEN(num), Destination::MNUM}, - {RTF_MDEN, M_TOKEN(den), Destination::MDEN}, - {RTF_MACC, M_TOKEN(acc), Destination::MACC}, - {RTF_MACCPR, M_TOKEN(accPr), Destination::MACCPR}, - {RTF_MBAR, M_TOKEN(bar), Destination::MBAR}, - {RTF_MBARPR, M_TOKEN(barPr), Destination::MBARPR}, - {RTF_ME, M_TOKEN(e), Destination::ME}, - {RTF_MD, M_TOKEN(d), Destination::MD}, - {RTF_MDPR, M_TOKEN(dPr), Destination::MDPR}, - {RTF_MFUNC, M_TOKEN(func), Destination::MFUNC}, - {RTF_MFUNCPR, M_TOKEN(funcPr), Destination::MFUNCPR}, - {RTF_MFNAME, M_TOKEN(fName), Destination::MFNAME}, - {RTF_MLIMLOW, M_TOKEN(limLow), Destination::MLIMLOW}, - {RTF_MLIMLOWPR, M_TOKEN(limLowPr), Destination::MLIMLOWPR}, - {RTF_MLIM, M_TOKEN(lim), Destination::MLIM}, - {RTF_MM, M_TOKEN(m), Destination::MM}, - {RTF_MMPR, M_TOKEN(mPr), Destination::MMPR}, - {RTF_MMR, M_TOKEN(mr), Destination::MMR}, - {RTF_MNARY, M_TOKEN(nary), Destination::MNARY}, - {RTF_MNARYPR, M_TOKEN(naryPr), Destination::MNARYPR}, - {RTF_MSUB, M_TOKEN(sub), Destination::MSUB}, - {RTF_MSUP, M_TOKEN(sup), Destination::MSUP}, - {RTF_MLIMUPP, M_TOKEN(limUpp), Destination::MLIMUPP}, - {RTF_MLIMUPPPR, M_TOKEN(limUppPr), Destination::MLIMUPPPR}, - {RTF_MGROUPCHR, M_TOKEN(groupChr), Destination::MGROUPCHR}, - {RTF_MGROUPCHRPR, M_TOKEN(groupChrPr), Destination::MGROUPCHRPR}, - {RTF_MBORDERBOX, M_TOKEN(borderBox), Destination::MBORDERBOX}, - {RTF_MBORDERBOXPR, M_TOKEN(borderBoxPr), Destination::MBORDERBOXPR}, - {RTF_MRAD, M_TOKEN(rad), Destination::MRAD}, - {RTF_MRADPR, M_TOKEN(radPr), Destination::MRADPR}, - {RTF_MDEG, M_TOKEN(deg), Destination::MDEG}, - {RTF_MSSUB, M_TOKEN(sSub), Destination::MSSUB}, - {RTF_MSSUBPR, M_TOKEN(sSubPr), Destination::MSSUBPR}, - {RTF_MSSUP, M_TOKEN(sSup), Destination::MSSUP}, - {RTF_MSSUPPR, M_TOKEN(sSupPr), Destination::MSSUPPR}, - {RTF_MSSUBSUP, M_TOKEN(sSubSup), Destination::MSSUBSUP}, - {RTF_MSSUBSUPPR, M_TOKEN(sSubSupPr), Destination::MSSUBSUPPR}, - {RTF_MSPRE, M_TOKEN(sPre), Destination::MSPRE}, - {RTF_MSPREPR, M_TOKEN(sPrePr), Destination::MSPREPR}, - {RTF_MBOX, M_TOKEN(box), Destination::MBOX}, - {RTF_MEQARR, M_TOKEN(eqArr), Destination::MEQARR}, + { RTF_MOMATH, M_TOKEN(oMath), Destination::MOMATH }, + { RTF_MF, M_TOKEN(f), Destination::MF }, + { RTF_MFPR, M_TOKEN(fPr), Destination::MFPR }, + { RTF_MCTRLPR, M_TOKEN(ctrlPr), Destination::MCTRLPR }, + { RTF_MNUM, M_TOKEN(num), Destination::MNUM }, + { RTF_MDEN, M_TOKEN(den), Destination::MDEN }, + { RTF_MACC, M_TOKEN(acc), Destination::MACC }, + { RTF_MACCPR, M_TOKEN(accPr), Destination::MACCPR }, + { RTF_MBAR, M_TOKEN(bar), Destination::MBAR }, + { RTF_MBARPR, M_TOKEN(barPr), Destination::MBARPR }, + { RTF_ME, M_TOKEN(e), Destination::ME }, + { RTF_MD, M_TOKEN(d), Destination::MD }, + { RTF_MDPR, M_TOKEN(dPr), Destination::MDPR }, + { RTF_MFUNC, M_TOKEN(func), Destination::MFUNC }, + { RTF_MFUNCPR, M_TOKEN(funcPr), Destination::MFUNCPR }, + { RTF_MFNAME, M_TOKEN(fName), Destination::MFNAME }, + { RTF_MLIMLOW, M_TOKEN(limLow), Destination::MLIMLOW }, + { RTF_MLIMLOWPR, M_TOKEN(limLowPr), Destination::MLIMLOWPR }, + { RTF_MLIM, M_TOKEN(lim), Destination::MLIM }, + { RTF_MM, M_TOKEN(m), Destination::MM }, + { RTF_MMPR, M_TOKEN(mPr), Destination::MMPR }, + { RTF_MMR, M_TOKEN(mr), Destination::MMR }, + { RTF_MNARY, M_TOKEN(nary), Destination::MNARY }, + { RTF_MNARYPR, M_TOKEN(naryPr), Destination::MNARYPR }, + { RTF_MSUB, M_TOKEN(sub), Destination::MSUB }, + { RTF_MSUP, M_TOKEN(sup), Destination::MSUP }, + { RTF_MLIMUPP, M_TOKEN(limUpp), Destination::MLIMUPP }, + { RTF_MLIMUPPPR, M_TOKEN(limUppPr), Destination::MLIMUPPPR }, + { RTF_MGROUPCHR, M_TOKEN(groupChr), Destination::MGROUPCHR }, + { RTF_MGROUPCHRPR, M_TOKEN(groupChrPr), Destination::MGROUPCHRPR }, + { RTF_MBORDERBOX, M_TOKEN(borderBox), Destination::MBORDERBOX }, + { RTF_MBORDERBOXPR, M_TOKEN(borderBoxPr), Destination::MBORDERBOXPR }, + { RTF_MRAD, M_TOKEN(rad), Destination::MRAD }, + { RTF_MRADPR, M_TOKEN(radPr), Destination::MRADPR }, + { RTF_MDEG, M_TOKEN(deg), Destination::MDEG }, + { RTF_MSSUB, M_TOKEN(sSub), Destination::MSSUB }, + { RTF_MSSUBPR, M_TOKEN(sSubPr), Destination::MSSUBPR }, + { RTF_MSSUP, M_TOKEN(sSup), Destination::MSSUP }, + { RTF_MSSUPPR, M_TOKEN(sSupPr), Destination::MSSUPPR }, + { RTF_MSSUBSUP, M_TOKEN(sSubSup), Destination::MSSUBSUP }, + { RTF_MSSUBSUPPR, M_TOKEN(sSubSupPr), Destination::MSSUBSUPPR }, + { RTF_MSPRE, M_TOKEN(sPre), Destination::MSPRE }, + { RTF_MSPREPR, M_TOKEN(sPrePr), Destination::MSPREPR }, + { RTF_MBOX, M_TOKEN(box), Destination::MBOX }, + { RTF_MEQARR, M_TOKEN(eqArr), Destination::MEQARR }, }; int nRTFMathControlWords = SAL_N_ELEMENTS(aRTFMathControlWords); diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx b/writerfilter/source/rtftok/rtfcontrolwords.hxx index 9d31151fa9c9..226359db7bd0 100644 --- a/writerfilter/source/rtftok/rtfcontrolwords.hxx +++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx @@ -14,7 +14,6 @@ namespace writerfilter { namespace rtftok { - /** * An RTF destination state is the last open destination control word. * diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index d6c1d1f5dc15..f844de1bf94c 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -31,11 +31,10 @@ namespace writerfilter { namespace rtftok { - RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) { setNeedSect(true); - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFSkipDestination aSkip(*this); // special case \upr: ignore everything except nested \ud if (Destination::UPR == m_aStates.top().eDestination && RTF_UD != nKeyword) @@ -46,597 +45,611 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) else switch (nKeyword) { - case RTF_RTF: - break; - case RTF_FONTTBL: - m_aStates.top().eDestination = Destination::FONTTABLE; - break; - case RTF_COLORTBL: - m_aStates.top().eDestination = Destination::COLORTABLE; - break; - case RTF_STYLESHEET: - m_aStates.top().eDestination = Destination::STYLESHEET; - break; - case RTF_FIELD: - m_aStates.top().eDestination = Destination::FIELD; - break; - case RTF_FLDINST: - { - // Look for the field type - sal_uInt64 const nPos = Strm().Tell(); - OStringBuffer aBuf; - char ch = 0; - bool bFoundCode = false; - bool bInKeyword = false; - while (!bFoundCode && ch != '}') - { - Strm().ReadChar(ch); - if ('\\' == ch) - bInKeyword = true; - if (!bInKeyword - && rtl::isAsciiAlphanumeric(static_cast<unsigned char>(ch))) - aBuf.append(ch); - else if (bInKeyword - && rtl::isAsciiWhiteSpace( - static_cast<unsigned char>(ch))) - bInKeyword = false; - if (!aBuf.isEmpty() - && !rtl::isAsciiAlphanumeric( - static_cast<unsigned char>(ch))) - bFoundCode = true; - } - - if (aBuf.toString() == "INCLUDEPICTURE") + case RTF_RTF: + break; + case RTF_FONTTBL: + m_aStates.top().eDestination = Destination::FONTTABLE; + break; + case RTF_COLORTBL: + m_aStates.top().eDestination = Destination::COLORTABLE; + break; + case RTF_STYLESHEET: + m_aStates.top().eDestination = Destination::STYLESHEET; + break; + case RTF_FIELD: + m_aStates.top().eDestination = Destination::FIELD; + break; + case RTF_FLDINST: { - // Extract the field argument of INCLUDEPICTURE: we handle that - // at a tokenizer level, as DOCX has no such field. - aBuf.append(ch); - while (true) + // Look for the field type + sal_uInt64 const nPos = Strm().Tell(); + OStringBuffer aBuf; + char ch = 0; + bool bFoundCode = false; + bool bInKeyword = false; + while (!bFoundCode && ch != '}') { Strm().ReadChar(ch); - if (ch == '}') - break; + if ('\\' == ch) + bInKeyword = true; + if (!bInKeyword && rtl::isAsciiAlphanumeric(static_cast<unsigned char>(ch))) + aBuf.append(ch); + else if (bInKeyword && rtl::isAsciiWhiteSpace(static_cast<unsigned char>(ch))) + bInKeyword = false; + if (!aBuf.isEmpty() + && !rtl::isAsciiAlphanumeric(static_cast<unsigned char>(ch))) + bFoundCode = true; + } + + if (aBuf.toString() == "INCLUDEPICTURE") + { + // Extract the field argument of INCLUDEPICTURE: we handle that + // at a tokenizer level, as DOCX has no such field. aBuf.append(ch); + while (true) + { + Strm().ReadChar(ch); + if (ch == '}') + break; + aBuf.append(ch); + } + OUString aFieldCommand + = OStringToOUString(aBuf.toString(), RTL_TEXTENCODING_UTF8); + std::tuple<OUString, std::vector<OUString>, std::vector<OUString>> aResult + = writerfilter::dmapper::splitFieldCommand(aFieldCommand); + m_aPicturePath + = std::get<1>(aResult).empty() ? OUString() : std::get<1>(aResult).front(); } - OUString aFieldCommand = OStringToOUString(aBuf.toString(), RTL_TEXTENCODING_UTF8); - std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > aResult = writerfilter::dmapper::splitFieldCommand(aFieldCommand); - m_aPicturePath = std::get<1>(aResult).empty() ? OUString() : std::get<1>(aResult).front(); - } - Strm().Seek(nPos); + Strm().Seek(nPos); - // Form data should be handled only for form fields if any - if (aBuf.toString().indexOf(OString("FORM")) != -1) - m_bFormField = true; + // Form data should be handled only for form fields if any + if (aBuf.toString().indexOf(OString("FORM")) != -1) + m_bFormField = true; - singleChar(cFieldStart); - m_aStates.top().eDestination = Destination::FIELDINSTRUCTION; - } - break; - case RTF_FLDRSLT: - m_aStates.top().eDestination = Destination::FIELDRESULT; - break; - case RTF_LISTTABLE: - m_aStates.top().eDestination = Destination::LISTTABLE; - break; - case RTF_LISTPICTURE: - m_aStates.top().eDestination = Destination::LISTPICTURE; - m_aStates.top().bInListpicture = true; - break; - case RTF_LIST: - m_aStates.top().eDestination = Destination::LISTENTRY; - break; - case RTF_LISTNAME: - m_aStates.top().eDestination = Destination::LISTNAME; - break; - case RTF_LFOLEVEL: - m_aStates.top().eDestination = Destination::LFOLEVEL; - m_aStates.top().aTableSprms.clear(); - break; - case RTF_LISTOVERRIDETABLE: - m_aStates.top().eDestination = Destination::LISTOVERRIDETABLE; - break; - case RTF_LISTOVERRIDE: - m_aStates.top().eDestination = Destination::LISTOVERRIDEENTRY; - break; - case RTF_LISTLEVEL: - m_aStates.top().eDestination = Destination::LISTLEVEL; - break; - case RTF_LEVELTEXT: - m_aStates.top().eDestination = Destination::LEVELTEXT; - break; - case RTF_LEVELNUMBERS: - m_aStates.top().eDestination = Destination::LEVELNUMBERS; - break; - case RTF_SHPPICT: - resetFrame(); - m_aStates.top().eDestination = Destination::SHPPICT; - break; - case RTF_PICT: - if (m_aStates.top().eDestination != Destination::SHAPEPROPERTYVALUE) - m_aStates.top().eDestination = Destination::PICT; // as character - else - m_aStates.top().eDestination = Destination::SHAPEPROPERTYVALUEPICT; // anchored inside a shape - break; - case RTF_PICPROP: - m_aStates.top().eDestination = Destination::PICPROP; - break; - case RTF_SP: - m_aStates.top().eDestination = Destination::SHAPEPROPERTY; - break; - case RTF_SN: - m_aStates.top().eDestination = Destination::SHAPEPROPERTYNAME; - break; - case RTF_SV: - m_aStates.top().eDestination = Destination::SHAPEPROPERTYVALUE; - break; - case RTF_SHP: - m_bNeedCrOrig = m_bNeedCr; - m_aStates.top().eDestination = Destination::SHAPE; - m_aStates.top().bInShape = true; - break; - case RTF_SHPINST: - m_aStates.top().eDestination = Destination::SHAPEINSTRUCTION; - break; - case RTF_NESTTABLEPROPS: - // do not set any properties of outer table at nested table! - m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = - m_aDefaultState.aTableCellAttributes; - m_aNestedTableCellsSprms.clear(); - m_aNestedTableCellsAttributes.clear(); - m_nNestedCells = 0; - m_aStates.top().eDestination = Destination::NESTEDTABLEPROPERTIES; + singleChar(cFieldStart); + m_aStates.top().eDestination = Destination::FIELDINSTRUCTION; + } break; - case RTF_HEADER: - case RTF_FOOTER: - case RTF_HEADERL: - case RTF_HEADERR: - case RTF_HEADERF: - case RTF_FOOTERL: - case RTF_FOOTERR: - case RTF_FOOTERF: - if (!m_pSuperstream) - { - Id nId = 0; - std::size_t nPos = m_nGroupStartPos - 1; - switch (nKeyword) + case RTF_FLDRSLT: + m_aStates.top().eDestination = Destination::FIELDRESULT; + break; + case RTF_LISTTABLE: + m_aStates.top().eDestination = Destination::LISTTABLE; + break; + case RTF_LISTPICTURE: + m_aStates.top().eDestination = Destination::LISTPICTURE; + m_aStates.top().bInListpicture = true; + break; + case RTF_LIST: + m_aStates.top().eDestination = Destination::LISTENTRY; + break; + case RTF_LISTNAME: + m_aStates.top().eDestination = Destination::LISTNAME; + break; + case RTF_LFOLEVEL: + m_aStates.top().eDestination = Destination::LFOLEVEL; + m_aStates.top().aTableSprms.clear(); + break; + case RTF_LISTOVERRIDETABLE: + m_aStates.top().eDestination = Destination::LISTOVERRIDETABLE; + break; + case RTF_LISTOVERRIDE: + m_aStates.top().eDestination = Destination::LISTOVERRIDEENTRY; + break; + case RTF_LISTLEVEL: + m_aStates.top().eDestination = Destination::LISTLEVEL; + break; + case RTF_LEVELTEXT: + m_aStates.top().eDestination = Destination::LEVELTEXT; + break; + case RTF_LEVELNUMBERS: + m_aStates.top().eDestination = Destination::LEVELNUMBERS; + break; + case RTF_SHPPICT: + resetFrame(); + m_aStates.top().eDestination = Destination::SHPPICT; + break; + case RTF_PICT: + if (m_aStates.top().eDestination != Destination::SHAPEPROPERTYVALUE) + m_aStates.top().eDestination = Destination::PICT; // as character + else + m_aStates.top().eDestination + = Destination::SHAPEPROPERTYVALUEPICT; // anchored inside a shape + break; + case RTF_PICPROP: + m_aStates.top().eDestination = Destination::PICPROP; + break; + case RTF_SP: + m_aStates.top().eDestination = Destination::SHAPEPROPERTY; + break; + case RTF_SN: + m_aStates.top().eDestination = Destination::SHAPEPROPERTYNAME; + break; + case RTF_SV: + m_aStates.top().eDestination = Destination::SHAPEPROPERTYVALUE; + break; + case RTF_SHP: + m_bNeedCrOrig = m_bNeedCr; + m_aStates.top().eDestination = Destination::SHAPE; + m_aStates.top().bInShape = true; + break; + case RTF_SHPINST: + m_aStates.top().eDestination = Destination::SHAPEINSTRUCTION; + break; + case RTF_NESTTABLEPROPS: + // do not set any properties of outer table at nested table! + m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; + m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + m_aNestedTableCellsSprms.clear(); + m_aNestedTableCellsAttributes.clear(); + m_nNestedCells = 0; + m_aStates.top().eDestination = Destination::NESTEDTABLEPROPERTIES; + break; + case RTF_HEADER: + case RTF_FOOTER: + case RTF_HEADERL: + case RTF_HEADERR: + case RTF_HEADERF: + case RTF_FOOTERL: + case RTF_FOOTERR: + case RTF_FOOTERF: + if (!m_pSuperstream) { - case RTF_HEADER: - if (!m_hasRHeader) + Id nId = 0; + std::size_t nPos = m_nGroupStartPos - 1; + switch (nKeyword) { - nId = NS_ooxml::LN_headerr; - m_hasRHeader = true; + case RTF_HEADER: + if (!m_hasRHeader) + { + nId = NS_ooxml::LN_headerr; + m_hasRHeader = true; + } + break; + case RTF_FOOTER: + if (!m_hasRFooter) + { + nId = NS_ooxml::LN_footerr; + m_hasRFooter = true; + } + break; + case RTF_HEADERL: + nId = NS_ooxml::LN_headerl; + break; + case RTF_HEADERR: + nId = NS_ooxml::LN_headerr; + break; + case RTF_HEADERF: + if (!m_hasFHeader) + { + nId = NS_ooxml::LN_headerf; + m_hasFHeader = true; + } + break; + case RTF_FOOTERL: + nId = NS_ooxml::LN_footerl; + break; + case RTF_FOOTERR: + nId = NS_ooxml::LN_footerr; + break; + case RTF_FOOTERF: + if (!m_hasFFooter) + { + nId = NS_ooxml::LN_footerf; + m_hasFFooter = true; + } + break; + default: + break; } - break; - case RTF_FOOTER: - if (!m_hasRFooter) + + if (nId != 0) + m_nHeaderFooterPositions.push(std::make_pair(nId, nPos)); + + m_aStates.top().eDestination = Destination::SKIP; + } + break; + case RTF_FOOTNOTE: + checkFirstRun(); + if (!m_pSuperstream) + { + Id nId = NS_ooxml::LN_footnote; + + // Check if this is an endnote. + OStringBuffer aBuf; + char ch; + sal_uInt64 const nCurrent = Strm().Tell(); + for (int i = 0; i < 7; ++i) { - nId = NS_ooxml::LN_footerr; - m_hasRFooter = true; + Strm().ReadChar(ch); + aBuf.append(ch); } - break; - case RTF_HEADERL: - nId = NS_ooxml::LN_headerl; - break; - case RTF_HEADERR: - nId = NS_ooxml::LN_headerr; - break; - case RTF_HEADERF: - if (!m_hasFHeader) + Strm().Seek(nCurrent); + OString aKeyword = aBuf.makeStringAndClear(); + if (aKeyword == "\\ftnalt") + nId = NS_ooxml::LN_endnote; + + if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) + m_aStates.top().pCurrentBuffer = nullptr; + bool bCustomMark = false; + OUString aCustomMark; + while (!m_aSuperBuffer.empty()) { - nId = NS_ooxml::LN_headerf; - m_hasFHeader = true; + Buf_t aTuple = m_aSuperBuffer.front(); + m_aSuperBuffer.pop_front(); + if (std::get<0>(aTuple) == BUFFER_UTEXT) + { + aCustomMark = std::get<1>(aTuple)->getString(); + bCustomMark = true; + } } - break; - case RTF_FOOTERL: - nId = NS_ooxml::LN_footerl; - break; - case RTF_FOOTERR: - nId = NS_ooxml::LN_footerr; - break; - case RTF_FOOTERF: - if (!m_hasFFooter) + m_aStates.top().eDestination = Destination::FOOTNOTE; + Mapper().startCharacterGroup(); + runProps(); + if (!m_aStates.top().pCurrentBuffer) + resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark); + else { - nId = NS_ooxml::LN_footerf; - m_hasFFooter = true; + RTFSprms aAttributes; + aAttributes.set(Id(0), std::make_shared<RTFValue>(m_nGroupStartPos - 1)); + aAttributes.set(Id(1), std::make_shared<RTFValue>(nId)); + aAttributes.set(Id(2), std::make_shared<RTFValue>(aCustomMark)); + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_RESOLVESUBSTREAM, std::make_shared<RTFValue>(aAttributes), + nullptr)); } - break; - default: - break; - } - - if (nId != 0) - m_nHeaderFooterPositions.push(std::make_pair(nId, nPos)); - - m_aStates.top().eDestination = Destination::SKIP; - - } - break; - case RTF_FOOTNOTE: - checkFirstRun(); - if (!m_pSuperstream) - { - Id nId = NS_ooxml::LN_footnote; - - // Check if this is an endnote. - OStringBuffer aBuf; - char ch; - sal_uInt64 const nCurrent = Strm().Tell(); - for (int i = 0; i < 7; ++i) - { - Strm().ReadChar(ch); - aBuf.append(ch); - } - Strm().Seek(nCurrent); - OString aKeyword = aBuf.makeStringAndClear(); - if (aKeyword == "\\ftnalt") - nId = NS_ooxml::LN_endnote; - - if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) - m_aStates.top().pCurrentBuffer = nullptr; - bool bCustomMark = false; - OUString aCustomMark; - while (!m_aSuperBuffer.empty()) - { - Buf_t aTuple = m_aSuperBuffer.front(); - m_aSuperBuffer.pop_front(); - if (std::get<0>(aTuple) == BUFFER_UTEXT) + if (bCustomMark) { - aCustomMark = std::get<1>(aTuple)->getString(); - bCustomMark = true; + m_aStates.top().aCharacterAttributes.clear(); + m_aStates.top().aCharacterSprms.clear(); + auto pValue = std::make_shared<RTFValue>(1); + m_aStates.top().aCharacterAttributes.set( + NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue); + text(aCustomMark); } + Mapper().endCharacterGroup(); + m_aStates.top().eDestination = Destination::SKIP; } - m_aStates.top().eDestination = Destination::FOOTNOTE; - Mapper().startCharacterGroup(); - runProps(); - if (!m_aStates.top().pCurrentBuffer) - resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark); - else + break; + case RTF_BKMKSTART: + m_aStates.top().eDestination = Destination::BOOKMARKSTART; + break; + case RTF_BKMKEND: + m_aStates.top().eDestination = Destination::BOOKMARKEND; + break; + case RTF_XE: + m_aStates.top().eDestination = Destination::INDEXENTRY; + break; + case RTF_TC: + case RTF_TCN: + m_aStates.top().eDestination = Destination::TOCENTRY; + break; + case RTF_REVTBL: + m_aStates.top().eDestination = Destination::REVISIONTABLE; + break; + case RTF_ANNOTATION: + if (!m_pSuperstream) { - RTFSprms aAttributes; - aAttributes.set(Id(0), std::make_shared<RTFValue>(m_nGroupStartPos - 1)); - aAttributes.set(Id(1), std::make_shared<RTFValue>(nId)); - aAttributes.set(Id(2), std::make_shared<RTFValue>(aCustomMark)); - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_RESOLVESUBSTREAM, std::make_shared<RTFValue>(aAttributes), nullptr)); + resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation); + m_aStates.top().eDestination = Destination::SKIP; } - if (bCustomMark) + else { - m_aStates.top().aCharacterAttributes.clear(); - m_aStates.top().aCharacterSprms.clear(); - auto pValue = std::make_shared<RTFValue>(1); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue); - text(aCustomMark); + // If there is an author set, emit it now. + if (!m_aAuthor.isEmpty() || !m_aAuthorInitials.isEmpty()) + { + RTFSprms aAttributes; + if (!m_aAuthor.isEmpty()) + { + auto pValue = std::make_shared<RTFValue>(m_aAuthor); + aAttributes.set(NS_ooxml::LN_CT_TrackChange_author, pValue); + } + if (!m_aAuthorInitials.isEmpty()) + { + auto pValue = std::make_shared<RTFValue>(m_aAuthorInitials); + aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue); + } + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes); + Mapper().props(pProperties); + } } - Mapper().endCharacterGroup(); - m_aStates.top().eDestination = Destination::SKIP; - } - break; - case RTF_BKMKSTART: - m_aStates.top().eDestination = Destination::BOOKMARKSTART; - break; - case RTF_BKMKEND: - m_aStates.top().eDestination = Destination::BOOKMARKEND; - break; - case RTF_XE: - m_aStates.top().eDestination = Destination::INDEXENTRY; - break; - case RTF_TC: - case RTF_TCN: - m_aStates.top().eDestination = Destination::TOCENTRY; - break; - case RTF_REVTBL: - m_aStates.top().eDestination = Destination::REVISIONTABLE; - break; - case RTF_ANNOTATION: - if (!m_pSuperstream) - { - resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation); - m_aStates.top().eDestination = Destination::SKIP; - } - else + break; + case RTF_SHPTXT: + case RTF_DPTXBXTEXT: { - // If there is an author set, emit it now. - if (!m_aAuthor.isEmpty() || !m_aAuthorInitials.isEmpty()) + bool bPictureFrame = false; + for (auto& rProperty : m_aStates.top().aShape.aProperties) { - RTFSprms aAttributes; - if (!m_aAuthor.isEmpty()) + if (rProperty.first == "shapeType" + && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame)) { - auto pValue = std::make_shared<RTFValue>(m_aAuthor); - aAttributes.set(NS_ooxml::LN_CT_TrackChange_author, pValue); + bPictureFrame = true; + break; } - if (!m_aAuthorInitials.isEmpty()) + } + if (bPictureFrame) + // Skip text on picture frames. + m_aStates.top().eDestination = Destination::SKIP; + else + { + m_aStates.top().eDestination = Destination::SHAPETEXT; + checkFirstRun(); + dispatchFlag(RTF_PARD); + m_bNeedPap = true; + if (nKeyword == RTF_SHPTXT) { - auto pValue = std::make_shared<RTFValue>(m_aAuthorInitials); - aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue); + if (!m_aStates.top().pCurrentBuffer) + m_pSdrImport->resolve(m_aStates.top().aShape, false, + RTFSdrImport::SHAPE); + else + { + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_STARTSHAPE, pValue, nullptr)); + } } - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes); - Mapper().props(pProperties); } } break; - case RTF_SHPTXT: - case RTF_DPTXBXTEXT: - { - bool bPictureFrame = false; - for (auto& rProperty : m_aStates.top().aShape.aProperties) + case RTF_FORMFIELD: + if (m_aStates.top().eDestination == Destination::FIELDINSTRUCTION) + m_aStates.top().eDestination = Destination::FORMFIELD; + break; + case RTF_FFNAME: + m_aStates.top().eDestination = Destination::FORMFIELDNAME; + break; + case RTF_FFL: + m_aStates.top().eDestination = Destination::FORMFIELDLIST; + break; + case RTF_DATAFIELD: + m_aStates.top().eDestination = Destination::DATAFIELD; + break; + case RTF_INFO: + m_aStates.top().eDestination = Destination::INFO; + break; + case RTF_CREATIM: + m_aStates.top().eDestination = Destination::CREATIONTIME; + break; + case RTF_REVTIM: + m_aStates.top().eDestination = Destination::REVISIONTIME; + break; + case RTF_PRINTIM: + m_aStates.top().eDestination = Destination::PRINTTIME; + break; + case RTF_AUTHOR: + m_aStates.top().eDestination = Destination::AUTHOR; + break; + case RTF_KEYWORDS: + m_aStates.top().eDestination = Destination::KEYWORDS; + break; + case RTF_OPERATOR: + m_aStates.top().eDestination = Destination::OPERATOR; + break; + case RTF_COMPANY: + m_aStates.top().eDestination = Destination::COMPANY; + break; + case RTF_COMMENT: + m_aStates.top().eDestination = Destination::COMMENT; + break; + case RTF_OBJECT: { - if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame)) + // beginning of an OLE Object + m_aStates.top().eDestination = Destination::OBJECT; + + // check if the object is in a special container (e.g. a table) + if (!m_aStates.top().pCurrentBuffer) { - bPictureFrame = true; - break; + // the object is in a table or another container. + // Don't try to treat it as an OLE object (fdo#53594). + // Use the \result (RTF_RESULT) element of the object instead, + // the result element contain picture representing the OLE Object. + m_bObject = true; } } - if (bPictureFrame) - // Skip text on picture frames. + break; + case RTF_OBJDATA: + // check if the object is in a special container (e.g. a table) + if (m_aStates.top().pCurrentBuffer) + { + // the object is in a table or another container. + // Use the \result (RTF_RESULT) element of the object instead, + // of the \objdata. + m_aStates.top().eDestination = Destination::SKIP; + } + else + { + m_aStates.top().eDestination = Destination::OBJDATA; + } + break; + case RTF_OBJCLASS: + m_aStates.top().eDestination = Destination::OBJCLASS; + break; + case RTF_RESULT: + m_aStates.top().eDestination = Destination::RESULT; + break; + case RTF_ATNDATE: + m_aStates.top().eDestination = Destination::ANNOTATIONDATE; + break; + case RTF_ATNAUTHOR: + m_aStates.top().eDestination = Destination::ANNOTATIONAUTHOR; + break; + case RTF_ATNREF: + m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCE; + break; + case RTF_FALT: + m_aStates.top().eDestination = Destination::FALT; + break; + case RTF_FLYMAINCNT: + m_aStates.top().eDestination = Destination::FLYMAINCONTENT; + break; + case RTF_LISTTEXT: + // Should be ignored by any reader that understands Word 97 through Word 2007 numbering. + case RTF_NONESTTABLES: + // This destination should be ignored by readers that support nested tables. + m_aStates.top().eDestination = Destination::SKIP; + break; + case RTF_DO: + m_aStates.top().eDestination = Destination::DRAWINGOBJECT; + break; + case RTF_PN: + m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING; + break; + case RTF_PNTEXT: + // This destination should be ignored by readers that support paragraph numbering. + m_aStates.top().eDestination = Destination::SKIP; + break; + case RTF_PNTXTA: + m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTAFTER; + break; + case RTF_PNTXTB: + m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTBEFORE; + break; + case RTF_TITLE: + m_aStates.top().eDestination = Destination::TITLE; + break; + case RTF_SUBJECT: + m_aStates.top().eDestination = Destination::SUBJECT; + break; + case RTF_DOCCOMM: + m_aStates.top().eDestination = Destination::DOCCOMM; + break; + case RTF_ATRFSTART: + m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCESTART; + break; + case RTF_ATRFEND: + m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCEEND; + break; + case RTF_ATNID: + m_aStates.top().eDestination = Destination::ATNID; + break; + case RTF_MMATH: + case RTF_MOMATHPARA: + // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented. + break; + case RTF_MR: + m_aStates.top().eDestination = Destination::MR; + break; + case RTF_MCHR: + m_aStates.top().eDestination = Destination::MCHR; + break; + case RTF_MPOS: + m_aStates.top().eDestination = Destination::MPOS; + break; + case RTF_MVERTJC: + m_aStates.top().eDestination = Destination::MVERTJC; + break; + case RTF_MSTRIKEH: + m_aStates.top().eDestination = Destination::MSTRIKEH; + break; + case RTF_MDEGHIDE: + m_aStates.top().eDestination = Destination::MDEGHIDE; + break; + case RTF_MTYPE: + m_aStates.top().eDestination = Destination::MTYPE; + break; + case RTF_MGROW: + m_aStates.top().eDestination = Destination::MGROW; + break; + case RTF_MHIDETOP: + case RTF_MHIDEBOT: + case RTF_MHIDELEFT: + case RTF_MHIDERIGHT: + // SmOoxmlImport::handleBorderBox will ignore these anyway, so silently ignore for now. m_aStates.top().eDestination = Destination::SKIP; - else + break; + case RTF_MSUBHIDE: + m_aStates.top().eDestination = Destination::MSUBHIDE; + break; + case RTF_MSUPHIDE: + m_aStates.top().eDestination = Destination::MSUPHIDE; + break; + case RTF_MBEGCHR: + m_aStates.top().eDestination = Destination::MBEGCHR; + break; + case RTF_MSEPCHR: + m_aStates.top().eDestination = Destination::MSEPCHR; + break; + case RTF_MENDCHR: + m_aStates.top().eDestination = Destination::MENDCHR; + break; + case RTF_UPR: + m_aStates.top().eDestination = Destination::UPR; + break; + case RTF_UD: + // Anything inside \ud is just normal Unicode content. + m_aStates.top().eDestination = Destination::NORMAL; + break; + case RTF_BACKGROUND: + m_aStates.top().eDestination = Destination::BACKGROUND; + m_aStates.top().bInBackground = true; + break; + case RTF_SHPGRP: { - m_aStates.top().eDestination = Destination::SHAPETEXT; - checkFirstRun(); - dispatchFlag(RTF_PARD); - m_bNeedPap = true; - if (nKeyword == RTF_SHPTXT) + RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart()); + if (!aLookahead.hasTable()) { - if (!m_aStates.top().pCurrentBuffer) - m_pSdrImport->resolve(m_aStates.top().aShape, false, RTFSdrImport::SHAPE); - else + uno::Reference<drawing::XShapes> xGroupShape( + m_xModelFactory->createInstance("com.sun.star.drawing.GroupShape"), + uno::UNO_QUERY); + uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, + uno::UNO_QUERY); + if (xDrawSupplier.is()) { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_STARTSHAPE, pValue, nullptr)); + uno::Reference<drawing::XShape> xShape(xGroupShape, uno::UNO_QUERY); + // set AnchorType before inserting + uno::Reference<beans::XPropertySet>(xShape, uno::UNO_QUERY) + ->setPropertyValue( + "AnchorType", + uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); + xDrawSupplier->getDrawPage()->add(xShape); } + m_pSdrImport->pushParent(xGroupShape); + m_aStates.top().bCreatedShapeGroup = true; } + m_aStates.top().eDestination = Destination::SHAPEGROUP; + m_aStates.top().bInShapeGroup = true; } - } - break; - case RTF_FORMFIELD: - if (m_aStates.top().eDestination == Destination::FIELDINSTRUCTION) - m_aStates.top().eDestination = Destination::FORMFIELD; - break; - case RTF_FFNAME: - m_aStates.top().eDestination = Destination::FORMFIELDNAME; - break; - case RTF_FFL: - m_aStates.top().eDestination = Destination::FORMFIELDLIST; - break; - case RTF_DATAFIELD: - m_aStates.top().eDestination = Destination::DATAFIELD; - break; - case RTF_INFO: - m_aStates.top().eDestination = Destination::INFO; - break; - case RTF_CREATIM: - m_aStates.top().eDestination = Destination::CREATIONTIME; - break; - case RTF_REVTIM: - m_aStates.top().eDestination = Destination::REVISIONTIME; - break; - case RTF_PRINTIM: - m_aStates.top().eDestination = Destination::PRINTTIME; break; - case RTF_AUTHOR: - m_aStates.top().eDestination = Destination::AUTHOR; - break; - case RTF_KEYWORDS: - m_aStates.top().eDestination = Destination::KEYWORDS; - break; - case RTF_OPERATOR: - m_aStates.top().eDestination = Destination::OPERATOR; - break; - case RTF_COMPANY: - m_aStates.top().eDestination = Destination::COMPANY; - break; - case RTF_COMMENT: - m_aStates.top().eDestination = Destination::COMMENT; - break; - case RTF_OBJECT: - { - // beginning of an OLE Object - m_aStates.top().eDestination = Destination::OBJECT; - - // check if the object is in a special container (e.g. a table) - if (!m_aStates.top().pCurrentBuffer) - { - // the object is in a table or another container. - // Don't try to treat it as an OLE object (fdo#53594). - // Use the \result (RTF_RESULT) element of the object instead, - // the result element contain picture representing the OLE Object. - m_bObject = true; - } - } - break; - case RTF_OBJDATA: - // check if the object is in a special container (e.g. a table) - if (m_aStates.top().pCurrentBuffer) - { - // the object is in a table or another container. - // Use the \result (RTF_RESULT) element of the object instead, - // of the \objdata. - m_aStates.top().eDestination = Destination::SKIP; - } - else + case RTF_FTNSEP: + m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR; + m_aStates.top().aCharacterAttributes.set( + NS_ooxml::LN_CT_FtnEdn_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); + break; + case RTF_USERPROPS: + // Container of all user-defined properties. + m_aStates.top().eDestination = Destination::USERPROPS; + if (m_xDocumentProperties.is()) + // Create a custom document properties to be able to process them later all at once. + m_xDocumentProperties = document::DocumentProperties::create(m_xContext); + break; + case RTF_PROPNAME: + m_aStates.top().eDestination = Destination::PROPNAME; + break; + case RTF_STATICVAL: + m_aStates.top().eDestination = Destination::STATICVAL; + break; + default: { - m_aStates.top().eDestination = Destination::OBJDATA; - } - break; - case RTF_OBJCLASS: - m_aStates.top().eDestination = Destination::OBJCLASS; - break; - case RTF_RESULT: - m_aStates.top().eDestination = Destination::RESULT; - break; - case RTF_ATNDATE: - m_aStates.top().eDestination = Destination::ANNOTATIONDATE; - break; - case RTF_ATNAUTHOR: - m_aStates.top().eDestination = Destination::ANNOTATIONAUTHOR; - break; - case RTF_ATNREF: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCE; - break; - case RTF_FALT: - m_aStates.top().eDestination = Destination::FALT; - break; - case RTF_FLYMAINCNT: - m_aStates.top().eDestination = Destination::FLYMAINCONTENT; - break; - case RTF_LISTTEXT: - // Should be ignored by any reader that understands Word 97 through Word 2007 numbering. - case RTF_NONESTTABLES: - // This destination should be ignored by readers that support nested tables. - m_aStates.top().eDestination = Destination::SKIP; - break; - case RTF_DO: - m_aStates.top().eDestination = Destination::DRAWINGOBJECT; - break; - case RTF_PN: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING; - break; - case RTF_PNTEXT: - // This destination should be ignored by readers that support paragraph numbering. - m_aStates.top().eDestination = Destination::SKIP; - break; - case RTF_PNTXTA: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTAFTER; - break; - case RTF_PNTXTB: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTBEFORE; - break; - case RTF_TITLE: - m_aStates.top().eDestination = Destination::TITLE; - break; - case RTF_SUBJECT: - m_aStates.top().eDestination = Destination::SUBJECT; - break; - case RTF_DOCCOMM: - m_aStates.top().eDestination = Destination::DOCCOMM; - break; - case RTF_ATRFSTART: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCESTART; - break; - case RTF_ATRFEND: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCEEND; - break; - case RTF_ATNID: - m_aStates.top().eDestination = Destination::ATNID; - break; - case RTF_MMATH: - case RTF_MOMATHPARA: - // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented. - break; - case RTF_MR: - m_aStates.top().eDestination = Destination::MR; - break; - case RTF_MCHR: - m_aStates.top().eDestination = Destination::MCHR; - break; - case RTF_MPOS: - m_aStates.top().eDestination = Destination::MPOS; - break; - case RTF_MVERTJC: - m_aStates.top().eDestination = Destination::MVERTJC; - break; - case RTF_MSTRIKEH: - m_aStates.top().eDestination = Destination::MSTRIKEH; - break; - case RTF_MDEGHIDE: - m_aStates.top().eDestination = Destination::MDEGHIDE; - break; - case RTF_MTYPE: - m_aStates.top().eDestination = Destination::MTYPE; - break; - case RTF_MGROW: - m_aStates.top().eDestination = Destination::MGROW; - break; - case RTF_MHIDETOP: - case RTF_MHIDEBOT: - case RTF_MHIDELEFT: - case RTF_MHIDERIGHT: - // SmOoxmlImport::handleBorderBox will ignore these anyway, so silently ignore for now. - m_aStates.top().eDestination = Destination::SKIP; - break; - case RTF_MSUBHIDE: - m_aStates.top().eDestination = Destination::MSUBHIDE; - break; - case RTF_MSUPHIDE: - m_aStates.top().eDestination = Destination::MSUPHIDE; - break; - case RTF_MBEGCHR: - m_aStates.top().eDestination = Destination::MBEGCHR; - break; - case RTF_MSEPCHR: - m_aStates.top().eDestination = Destination::MSEPCHR; - break; - case RTF_MENDCHR: - m_aStates.top().eDestination = Destination::MENDCHR; - break; - case RTF_UPR: - m_aStates.top().eDestination = Destination::UPR; - break; - case RTF_UD: - // Anything inside \ud is just normal Unicode content. - m_aStates.top().eDestination = Destination::NORMAL; - break; - case RTF_BACKGROUND: - m_aStates.top().eDestination = Destination::BACKGROUND; - m_aStates.top().bInBackground = true; - break; - case RTF_SHPGRP: - { - RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart()); - if (!aLookahead.hasTable()) - { - uno::Reference<drawing::XShapes> xGroupShape(m_xModelFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY); - uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); - if (xDrawSupplier.is()) + // Check if it's a math token. + RTFMathSymbol aSymbol; + aSymbol.eKeyword = nKeyword; + if (RTFTokenizer::lookupMathKeyword(aSymbol)) { - uno::Reference<drawing::XShape> xShape(xGroupShape, uno::UNO_QUERY); - // set AnchorType before inserting - uno::Reference<beans::XPropertySet>(xShape, uno::UNO_QUERY)->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); - xDrawSupplier->getDrawPage()->add(xShape); + m_aMathBuffer.appendOpeningTag(aSymbol.nToken); + m_aStates.top().eDestination = aSymbol.eDestination; + return RTFError::OK; } - m_pSdrImport->pushParent(xGroupShape); - m_aStates.top().bCreatedShapeGroup = true; + + SAL_INFO("writerfilter", + "TODO handle destination '" << keywordToString(nKeyword) << "'"); + // Make sure we skip destinations (even without \*) till we don't handle them + m_aStates.top().eDestination = Destination::SKIP; + aSkip.setParsed(false); } - m_aStates.top().eDestination = Destination::SHAPEGROUP; - m_aStates.top().bInShapeGroup = true; - } - break; - case RTF_FTNSEP: - m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR; - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdn_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); - break; - case RTF_USERPROPS: - // Container of all user-defined properties. - m_aStates.top().eDestination = Destination::USERPROPS; - if (m_xDocumentProperties.is()) - // Create a custom document properties to be able to process them later all at once. - m_xDocumentProperties = document::DocumentProperties::create(m_xContext); - break; - case RTF_PROPNAME: - m_aStates.top().eDestination = Destination::PROPNAME; - break; - case RTF_STATICVAL: - m_aStates.top().eDestination = Destination::STATICVAL; break; - default: - { - // Check if it's a math token. - RTFMathSymbol aSymbol; - aSymbol.eKeyword = nKeyword; - if (RTFTokenizer::lookupMathKeyword(aSymbol)) - { - m_aMathBuffer.appendOpeningTag(aSymbol.nToken); - m_aStates.top().eDestination = aSymbol.eDestination; - return RTFError::OK; - } - - SAL_INFO("writerfilter", "TODO handle destination '" << keywordToString(nKeyword) << "'"); - // Make sure we skip destinations (even without \*) till we don't handle them - m_aStates.top().eDestination = Destination::SKIP; - aSkip.setParsed(false); - } - break; } // new destination => use new destination text diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 5d683fee0dcc..38c5f0e5a2a3 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -26,11 +26,10 @@ namespace writerfilter { namespace rtftok { - RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { setNeedSect(true); - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFSkipDestination aSkip(*this); int nParam = -1; int nSprm = -1; @@ -38,14 +37,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Underline flags. switch (nKeyword) { - case RTF_ULD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dotted; - break; - case RTF_ULW: - nSprm = NS_ooxml::LN_Value_ST_Underline_words; - break; - default: - break; + case RTF_ULD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dotted; + break; + case RTF_ULW: + nSprm = NS_ooxml::LN_Value_ST_Underline_words; + break; + default: + break; } if (nSprm >= 0) { @@ -57,23 +56,23 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Indentation switch (nKeyword) { - case RTF_QC: - nParam = NS_ooxml::LN_Value_ST_Jc_center; - break; - case RTF_QJ: - nParam = NS_ooxml::LN_Value_ST_Jc_both; - break; - case RTF_QL: - nParam = NS_ooxml::LN_Value_ST_Jc_left; - break; - case RTF_QR: - nParam = NS_ooxml::LN_Value_ST_Jc_right; - break; - case RTF_QD: - nParam = NS_ooxml::LN_Value_ST_Jc_both; - break; - default: - break; + case RTF_QC: + nParam = NS_ooxml::LN_Value_ST_Jc_center; + break; + case RTF_QJ: + nParam = NS_ooxml::LN_Value_ST_Jc_both; + break; + case RTF_QL: + nParam = NS_ooxml::LN_Value_ST_Jc_left; + break; + case RTF_QR: + nParam = NS_ooxml::LN_Value_ST_Jc_right; + break; + case RTF_QD: + nParam = NS_ooxml::LN_Value_ST_Jc_both; + break; + default: + break; } if (nParam >= 0) { @@ -86,24 +85,24 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Font Alignment switch (nKeyword) { - case RTF_FAFIXED: - case RTF_FAAUTO: - nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_auto; - break; - case RTF_FAHANG: - nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_top; - break; - case RTF_FACENTER: - nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_center; - break; - case RTF_FAROMAN: - nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_baseline; - break; - case RTF_FAVAR: - nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_bottom; - break; - default: - break; + case RTF_FAFIXED: + case RTF_FAAUTO: + nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_auto; + break; + case RTF_FAHANG: + nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_top; + break; + case RTF_FACENTER: + nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_center; + break; + case RTF_FAROMAN: + nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_baseline; + break; + case RTF_FAVAR: + nParam = NS_ooxml::LN_Value_doc_ST_TextAlignment_bottom; + break; + default: + break; } if (nParam >= 0) { @@ -115,17 +114,17 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Tab kind. switch (nKeyword) { - case RTF_TQR: - nParam = NS_ooxml::LN_Value_ST_TabJc_right; - break; - case RTF_TQC: - nParam = NS_ooxml::LN_Value_ST_TabJc_center; - break; - case RTF_TQDEC: - nParam = NS_ooxml::LN_Value_ST_TabJc_decimal; - break; - default: - break; + case RTF_TQR: + nParam = NS_ooxml::LN_Value_ST_TabJc_right; + break; + case RTF_TQC: + nParam = NS_ooxml::LN_Value_ST_TabJc_center; + break; + case RTF_TQDEC: + nParam = NS_ooxml::LN_Value_ST_TabJc_decimal; + break; + default: + break; } if (nParam >= 0) { @@ -137,26 +136,26 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Tab lead. switch (nKeyword) { - case RTF_TLDOT: - nParam = NS_ooxml::LN_Value_ST_TabTlc_dot; - break; - case RTF_TLMDOT: - nParam = NS_ooxml::LN_Value_ST_TabTlc_middleDot; - break; - case RTF_TLHYPH: - nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; - break; - case RTF_TLUL: - nParam = NS_ooxml::LN_Value_ST_TabTlc_underscore; - break; - case RTF_TLTH: - nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; - break; // thick line is not supported by dmapper, this is just a hack - case RTF_TLEQ: - nParam = NS_ooxml::LN_Value_ST_TabTlc_none; - break; // equal sign isn't, either - default: - break; + case RTF_TLDOT: + nParam = NS_ooxml::LN_Value_ST_TabTlc_dot; + break; + case RTF_TLMDOT: + nParam = NS_ooxml::LN_Value_ST_TabTlc_middleDot; + break; + case RTF_TLHYPH: + nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; + break; + case RTF_TLUL: + nParam = NS_ooxml::LN_Value_ST_TabTlc_underscore; + break; + case RTF_TLTH: + nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; + break; // thick line is not supported by dmapper, this is just a hack + case RTF_TLEQ: + nParam = NS_ooxml::LN_Value_ST_TabTlc_none; + break; // equal sign isn't, either + default: + break; } if (nParam >= 0) { @@ -169,56 +168,56 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { switch (nKeyword) { - // brdrhair and brdrs are the same, brdrw will make a difference - // map to values in ooxml/model.xml resource ST_Border - case RTF_BRDRHAIR: - case RTF_BRDRS: - nParam = NS_ooxml::LN_Value_ST_Border_single; - break; - case RTF_BRDRDOT: - nParam = NS_ooxml::LN_Value_ST_Border_dotted; - break; - case RTF_BRDRDASH: - nParam = NS_ooxml::LN_Value_ST_Border_dashed; - break; - case RTF_BRDRDB: - nParam = NS_ooxml::LN_Value_ST_Border_double; - break; - case RTF_BRDRTNTHSG: - nParam = NS_ooxml::LN_Value_ST_Border_thinThickSmallGap; - break; - case RTF_BRDRTNTHMG: - nParam = NS_ooxml::LN_Value_ST_Border_thinThickMediumGap; - break; - case RTF_BRDRTNTHLG: - nParam = NS_ooxml::LN_Value_ST_Border_thinThickLargeGap; - break; - case RTF_BRDRTHTNSG: - nParam = NS_ooxml::LN_Value_ST_Border_thickThinSmallGap; - break; - case RTF_BRDRTHTNMG: - nParam = NS_ooxml::LN_Value_ST_Border_thickThinMediumGap; - break; - case RTF_BRDRTHTNLG: - nParam = NS_ooxml::LN_Value_ST_Border_thickThinLargeGap; - break; - case RTF_BRDREMBOSS: - nParam = NS_ooxml::LN_Value_ST_Border_threeDEmboss; - break; - case RTF_BRDRENGRAVE: - nParam = NS_ooxml::LN_Value_ST_Border_threeDEngrave; - break; - case RTF_BRDROUTSET: - nParam = NS_ooxml::LN_Value_ST_Border_outset; - break; - case RTF_BRDRINSET: - nParam = NS_ooxml::LN_Value_ST_Border_inset; - break; - case RTF_BRDRNONE: - nParam = NS_ooxml::LN_Value_ST_Border_none; - break; - default: - break; + // brdrhair and brdrs are the same, brdrw will make a difference + // map to values in ooxml/model.xml resource ST_Border + case RTF_BRDRHAIR: + case RTF_BRDRS: + nParam = NS_ooxml::LN_Value_ST_Border_single; + break; + case RTF_BRDRDOT: + nParam = NS_ooxml::LN_Value_ST_Border_dotted; + break; + case RTF_BRDRDASH: + nParam = NS_ooxml::LN_Value_ST_Border_dashed; + break; + case RTF_BRDRDB: + nParam = NS_ooxml::LN_Value_ST_Border_double; + break; + case RTF_BRDRTNTHSG: + nParam = NS_ooxml::LN_Value_ST_Border_thinThickSmallGap; + break; + case RTF_BRDRTNTHMG: + nParam = NS_ooxml::LN_Value_ST_Border_thinThickMediumGap; + break; + case RTF_BRDRTNTHLG: + nParam = NS_ooxml::LN_Value_ST_Border_thinThickLargeGap; + break; + case RTF_BRDRTHTNSG: + nParam = NS_ooxml::LN_Value_ST_Border_thickThinSmallGap; + break; + case RTF_BRDRTHTNMG: + nParam = NS_ooxml::LN_Value_ST_Border_thickThinMediumGap; + break; + case RTF_BRDRTHTNLG: + nParam = NS_ooxml::LN_Value_ST_Border_thickThinLargeGap; + break; + case RTF_BRDREMBOSS: + nParam = NS_ooxml::LN_Value_ST_Border_threeDEmboss; + break; + case RTF_BRDRENGRAVE: + nParam = NS_ooxml::LN_Value_ST_Border_threeDEngrave; + break; + case RTF_BRDROUTSET: + nParam = NS_ooxml::LN_Value_ST_Border_outset; + break; + case RTF_BRDRINSET: + nParam = NS_ooxml::LN_Value_ST_Border_inset; + break; + case RTF_BRDRNONE: + nParam = NS_ooxml::LN_Value_ST_Border_none; + break; + default: + break; } if (nParam >= 0) { @@ -231,23 +230,23 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Section breaks switch (nKeyword) { - case RTF_SBKNONE: - nParam = NS_ooxml::LN_Value_ST_SectionMark_continuous; - break; - case RTF_SBKCOL: - nParam = NS_ooxml::LN_Value_ST_SectionMark_nextColumn; - break; - case RTF_SBKPAGE: - nParam = NS_ooxml::LN_Value_ST_SectionMark_nextPage; - break; - case RTF_SBKEVEN: - nParam = NS_ooxml::LN_Value_ST_SectionMark_evenPage; - break; - case RTF_SBKODD: - nParam = NS_ooxml::LN_Value_ST_SectionMark_oddPage; - break; - default: - break; + case RTF_SBKNONE: + nParam = NS_ooxml::LN_Value_ST_SectionMark_continuous; + break; + case RTF_SBKCOL: + nParam = NS_ooxml::LN_Value_ST_SectionMark_nextColumn; + break; + case RTF_SBKPAGE: + nParam = NS_ooxml::LN_Value_ST_SectionMark_nextPage; + break; + case RTF_SBKEVEN: + nParam = NS_ooxml::LN_Value_ST_SectionMark_evenPage; + break; + case RTF_SBKODD: + nParam = NS_ooxml::LN_Value_ST_SectionMark_oddPage; + break; + default: + break; } if (nParam >= 0) { @@ -263,100 +262,103 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Footnote numbering switch (nKeyword) { - case RTF_FTNNAR: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; - break; - case RTF_FTNNALC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; - break; - case RTF_FTNNAUC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; - break; - case RTF_FTNNRLC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; - break; - case RTF_FTNNRUC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; - break; - case RTF_FTNNCHI: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; - break; - default: - break; + case RTF_FTNNAR: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; + break; + case RTF_FTNNALC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; + break; + case RTF_FTNNAUC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; + break; + case RTF_FTNNRLC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; + break; + case RTF_FTNNRUC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; + break; + case RTF_FTNNCHI: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; + break; + default: + break; } if (nParam >= 0) { auto pValue = std::make_shared<RTFValue>(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_CT_FtnProps_numFmt, pValue); + putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, + NS_ooxml::LN_CT_FtnProps_numFmt, pValue); return RTFError::OK; } // Footnote restart type switch (nKeyword) { - case RTF_FTNRSTPG: - nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachPage; - break; - case RTF_FTNRESTART: - nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachSect; - break; - case RTF_FTNRSTCONT: - nParam = NS_ooxml::LN_Value_ST_RestartNumber_continuous; - break; - default: - break; + case RTF_FTNRSTPG: + nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachPage; + break; + case RTF_FTNRESTART: + nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachSect; + break; + case RTF_FTNRSTCONT: + nParam = NS_ooxml::LN_Value_ST_RestartNumber_continuous; + break; + default: + break; } if (nParam >= 0) { auto pValue = std::make_shared<RTFValue>(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); + putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, + NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); return RTFError::OK; } // Endnote numbering switch (nKeyword) { - case RTF_AFTNNAR: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; - break; - case RTF_AFTNNALC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; - break; - case RTF_AFTNNAUC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; - break; - case RTF_AFTNNRLC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; - break; - case RTF_AFTNNRUC: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; - break; - case RTF_AFTNNCHI: - nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; - break; - default: - break; + case RTF_AFTNNAR: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; + break; + case RTF_AFTNNALC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; + break; + case RTF_AFTNNAUC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; + break; + case RTF_AFTNNRLC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; + break; + case RTF_AFTNNRUC: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; + break; + case RTF_AFTNNCHI: + nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; + break; + default: + break; } if (nParam >= 0) { auto pValue = std::make_shared<RTFValue>(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_CT_EdnProps_numFmt, pValue); + putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, + NS_ooxml::LN_CT_EdnProps_numFmt, pValue); return RTFError::OK; } switch (nKeyword) { - case RTF_TRQL: - nParam = NS_ooxml::LN_Value_ST_Jc_left; - break; - case RTF_TRQC: - nParam = NS_ooxml::LN_Value_ST_Jc_center; - break; - case RTF_TRQR: - nParam = NS_ooxml::LN_Value_ST_Jc_right; - break; - default: - break; + case RTF_TRQL: + nParam = NS_ooxml::LN_Value_ST_Jc_left; + break; + case RTF_TRQC: + nParam = NS_ooxml::LN_Value_ST_Jc_center; + break; + case RTF_TRQR: + nParam = NS_ooxml::LN_Value_ST_Jc_right; + break; + default: + break; } if (nParam >= 0) { @@ -368,23 +370,23 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Cell Text Flow switch (nKeyword) { - case RTF_CLTXLRTB: - nParam = NS_ooxml::LN_Value_ST_TextDirection_lrTb; - break; - case RTF_CLTXTBRL: - nParam = NS_ooxml::LN_Value_ST_TextDirection_tbRl; - break; - case RTF_CLTXBTLR: - nParam = NS_ooxml::LN_Value_ST_TextDirection_btLr; - break; - case RTF_CLTXLRTBV: - nParam = NS_ooxml::LN_Value_ST_TextDirection_lrTbV; - break; - case RTF_CLTXTBRLV: - nParam = NS_ooxml::LN_Value_ST_TextDirection_tbRlV; - break; - default: - break; + case RTF_CLTXLRTB: + nParam = NS_ooxml::LN_Value_ST_TextDirection_lrTb; + break; + case RTF_CLTXTBRL: + nParam = NS_ooxml::LN_Value_ST_TextDirection_tbRl; + break; + case RTF_CLTXBTLR: + nParam = NS_ooxml::LN_Value_ST_TextDirection_btLr; + break; + case RTF_CLTXLRTBV: + nParam = NS_ooxml::LN_Value_ST_TextDirection_lrTbV; + break; + case RTF_CLTXTBRLV: + nParam = NS_ooxml::LN_Value_ST_TextDirection_tbRlV; + break; + default: + break; } if (nParam >= 0) { @@ -395,25 +397,25 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Trivial paragraph flags switch (nKeyword) { - case RTF_KEEP: - if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back()) - nParam = NS_ooxml::LN_CT_PPrBase_keepLines; - break; - case RTF_KEEPN: - if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back()) - nParam = NS_ooxml::LN_CT_PPrBase_keepNext; - break; - case RTF_INTBL: - { - m_aStates.top().pCurrentBuffer = &m_aTableBufferStack.back(); - nParam = NS_ooxml::LN_inTbl; - } - break; - case RTF_PAGEBB: - nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore; - break; - default: + case RTF_KEEP: + if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back()) + nParam = NS_ooxml::LN_CT_PPrBase_keepLines; + break; + case RTF_KEEPN: + if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back()) + nParam = NS_ooxml::LN_CT_PPrBase_keepNext; + break; + case RTF_INTBL: + { + m_aStates.top().pCurrentBuffer = &m_aTableBufferStack.back(); + nParam = NS_ooxml::LN_inTbl; + } break; + case RTF_PAGEBB: + nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore; + break; + default: + break; } if (nParam >= 0) { @@ -425,667 +427,758 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) switch (nKeyword) { - case RTF_FNIL: - case RTF_FROMAN: - case RTF_FSWISS: - case RTF_FMODERN: - case RTF_FSCRIPT: - case RTF_FDECOR: - case RTF_FTECH: - case RTF_FBIDI: - // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper - break; - case RTF_ANSI: - m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; - break; - case RTF_MAC: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; - break; - case RTF_PC: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_437; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; - break; - case RTF_PCA: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_850; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; - break; - case RTF_PLAIN: - { - m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; - m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex)); - m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; - m_aStates.top().nCurrentCharacterStyleIndex = -1; - m_aStates.top().isRightToLeft = false; - m_aStates.top().eRunType = RTFParserState::RunType::LOCH; - } - break; - case RTF_PARD: - { - if (m_bHadPicture) - dispatchSymbol(RTF_PAR); - // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. - // It should not reset the paragraph style, either, so remember the old paragraph style. - RTFValue::Pointer_t pOldStyle = m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pStyle); - m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; - m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; - - if (m_nTopLevelCells == 0 && m_nNestedCells == 0) + case RTF_FNIL: + case RTF_FROMAN: + case RTF_FSWISS: + case RTF_FMODERN: + case RTF_FSCRIPT: + case RTF_FDECOR: + case RTF_FTECH: + case RTF_FBIDI: + // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper + break; + case RTF_ANSI: + m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; + break; + case RTF_MAC: + m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN; + m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + break; + case RTF_PC: + m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_437; + m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + break; + case RTF_PCA: + m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_850; + m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + break; + case RTF_PLAIN: { - // Reset that we're in a table. - m_aStates.top().pCurrentBuffer = nullptr; + m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; + m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex)); + m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; + m_aStates.top().nCurrentCharacterStyleIndex = -1; + m_aStates.top().isRightToLeft = false; + m_aStates.top().eRunType = RTFParserState::RunType::LOCH; } - else + break; + case RTF_PARD: { - // We are still in a table. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, std::make_shared<RTFValue>(1)); - if (m_bAfterCellBeforeRow && pOldStyle) - // And we still have the same paragraph style. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, pOldStyle); - // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, std::make_shared<RTFValue>()); - } - resetFrame(); + if (m_bHadPicture) + dispatchSymbol(RTF_PAR); + // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. + // It should not reset the paragraph style, either, so remember the old paragraph style. + RTFValue::Pointer_t pOldStyle + = m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pStyle); + m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; + m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; - // Reset currently selected paragraph style as well, unless we are in the special "after \cell, before \row" state. - // By default the style with index 0 is applied. - if (!m_bAfterCellBeforeRow) - { - OUString const aName = getStyleName(0); - // But only in case it's not a character style. - if (!aName.isEmpty() && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character) + if (m_nTopLevelCells == 0 && m_nNestedCells == 0) { - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, std::make_shared<RTFValue>(aName)); - m_aStates.top().nCurrentStyleIndex = 0; + // Reset that we're in a table. + m_aStates.top().pCurrentBuffer = nullptr; } else { - m_aStates.top().nCurrentStyleIndex = -1; + // We are still in a table. + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, + std::make_shared<RTFValue>(1)); + if (m_bAfterCellBeforeRow && pOldStyle) + // And we still have the same paragraph style. + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, pOldStyle); + // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering. + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, + std::make_shared<RTFValue>()); } + resetFrame(); + + // Reset currently selected paragraph style as well, unless we are in the special "after \cell, before \row" state. + // By default the style with index 0 is applied. + if (!m_bAfterCellBeforeRow) + { + OUString const aName = getStyleName(0); + // But only in case it's not a character style. + if (!aName.isEmpty() + && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character) + { + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, + std::make_shared<RTFValue>(aName)); + m_aStates.top().nCurrentStyleIndex = 0; + } + else + { + m_aStates.top().nCurrentStyleIndex = -1; + } + } + // Need to send paragraph properties again, if there will be any. + m_bNeedPap = true; + break; + } + case RTF_SECTD: + { + m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms; + m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes; } - // Need to send paragraph properties again, if there will be any. - m_bNeedPap = true; break; - } - case RTF_SECTD: - { - m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms; - m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes; - } - break; - case RTF_TROWD: - { - // Back these up, in case later we still need this info. - backupTableRowProperties(); - resetTableRowProperties(); - // In case the table definition is in the middle of the row - // (invalid), make sure table definition is emitted. - m_bNeedPap = true; - } - break; - case RTF_WIDCTLPAR: - case RTF_NOWIDCTLPAR: - { - auto pValue = std::make_shared<RTFValue>(int(nKeyword == RTF_WIDCTLPAR)); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue); - } - break; - case RTF_BOX: - { - RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(aAttributes); - for (int i = 0; i < 4; i++) - m_aStates.top().aParagraphSprms.set(getParagraphBorder(i), pValue); - m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; - } - break; - case RTF_LTRSECT: - case RTF_RTLSECT: - { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRSECT ? 0 : 1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, pValue); - } - break; - case RTF_LTRPAR: - case RTF_RTLPAR: - { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRPAR ? 0 : 1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_bidi, pValue); - } - break; - case RTF_LTRROW: - case RTF_RTLROW: - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblPrBase_bidiVisual, std::make_shared<RTFValue>(int(nKeyword == RTF_RTLROW))); + case RTF_TROWD: + { + // Back these up, in case later we still need this info. + backupTableRowProperties(); + resetTableRowProperties(); + // In case the table definition is in the middle of the row + // (invalid), make sure table definition is emitted. + m_bNeedPap = true; + } break; - case RTF_LTRCH: - // dmapper does not support this. - m_aStates.top().isRightToLeft = false; + case RTF_WIDCTLPAR: + case RTF_NOWIDCTLPAR: + { + auto pValue = std::make_shared<RTFValue>(int(nKeyword == RTF_WIDCTLPAR)); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue); + } break; - case RTF_RTLCH: - m_aStates.top().isRightToLeft = true; - if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255) - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + case RTF_BOX: + { + RTFSprms aAttributes; + auto pValue = std::make_shared<RTFValue>(aAttributes); + for (int i = 0; i < 4; i++) + m_aStates.top().aParagraphSprms.set(getParagraphBorder(i), pValue); + m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; + } break; - case RTF_ULNONE: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Underline_none); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); - } - break; - case RTF_NONSHPPICT: - case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group - m_aStates.top().eDestination = Destination::SKIP; + case RTF_LTRSECT: + case RTF_RTLSECT: + { + auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRSECT ? 0 : 1); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, + pValue); + } break; - case RTF_CLBRDRT: - case RTF_CLBRDRL: - case RTF_CLBRDRB: - case RTF_CLBRDRR: - { - RTFSprms aAttributes; - RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); - switch (nKeyword) + case RTF_LTRPAR: + case RTF_RTLPAR: { - case RTF_CLBRDRT: - nParam = NS_ooxml::LN_CT_TcBorders_top; - break; - case RTF_CLBRDRL: - nParam = NS_ooxml::LN_CT_TcBorders_left; - break; - case RTF_CLBRDRB: - nParam = NS_ooxml::LN_CT_TcBorders_bottom; + auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LTRPAR ? 0 : 1); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_bidi, pValue); + } + break; + case RTF_LTRROW: + case RTF_RTLROW: + m_aStates.top().aTableRowSprms.set( + NS_ooxml::LN_CT_TblPrBase_bidiVisual, + std::make_shared<RTFValue>(int(nKeyword == RTF_RTLROW))); break; - case RTF_CLBRDRR: - nParam = NS_ooxml::LN_CT_TcBorders_right; + case RTF_LTRCH: + // dmapper does not support this. + m_aStates.top().isRightToLeft = false; break; - default: + case RTF_RTLCH: + m_aStates.top().isRightToLeft = true; + if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255) + m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; break; + case RTF_ULNONE: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Underline_none); + m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); } - putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::CELL; - } - break; - case RTF_PGBRDRT: - case RTF_PGBRDRL: - case RTF_PGBRDRB: - case RTF_PGBRDRR: - { - RTFSprms aAttributes; - RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); - switch (nKeyword) + break; + case RTF_NONSHPPICT: + case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group + m_aStates.top().eDestination = Destination::SKIP; + break; + case RTF_CLBRDRT: + case RTF_CLBRDRL: + case RTF_CLBRDRB: + case RTF_CLBRDRR: { + RTFSprms aAttributes; + RTFSprms aSprms; + auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + switch (nKeyword) + { + case RTF_CLBRDRT: + nParam = NS_ooxml::LN_CT_TcBorders_top; + break; + case RTF_CLBRDRL: + nParam = NS_ooxml::LN_CT_TcBorders_left; + break; + case RTF_CLBRDRB: + nParam = NS_ooxml::LN_CT_TcBorders_bottom; + break; + case RTF_CLBRDRR: + nParam = NS_ooxml::LN_CT_TcBorders_right; + break; + default: + break; + } + putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, + nParam, pValue); + m_aStates.top().nBorderState = RTFBorderState::CELL; + } + break; case RTF_PGBRDRT: - nParam = NS_ooxml::LN_CT_PageBorders_top; - break; case RTF_PGBRDRL: - nParam = NS_ooxml::LN_CT_PageBorders_left; - break; case RTF_PGBRDRB: - nParam = NS_ooxml::LN_CT_PageBorders_bottom; - break; case RTF_PGBRDRR: - nParam = NS_ooxml::LN_CT_PageBorders_right; - break; - default: - break; - } - putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::PAGE; - } - break; - case RTF_BRDRT: - case RTF_BRDRL: - case RTF_BRDRB: - case RTF_BRDRR: - { - RTFSprms aAttributes; - RTFSprms aSprms; - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); - switch (nKeyword) { + RTFSprms aAttributes; + RTFSprms aSprms; + auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + switch (nKeyword) + { + case RTF_PGBRDRT: + nParam = NS_ooxml::LN_CT_PageBorders_top; + break; + case RTF_PGBRDRL: + nParam = NS_ooxml::LN_CT_PageBorders_left; + break; + case RTF_PGBRDRB: + nParam = NS_ooxml::LN_CT_PageBorders_bottom; + break; + case RTF_PGBRDRR: + nParam = NS_ooxml::LN_CT_PageBorders_right; + break; + default: + break; + } + putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, + nParam, pValue); + m_aStates.top().nBorderState = RTFBorderState::PAGE; + } + break; case RTF_BRDRT: - nParam = getParagraphBorder(0); - break; case RTF_BRDRL: - nParam = getParagraphBorder(1); - break; case RTF_BRDRB: - nParam = getParagraphBorder(2); - break; case RTF_BRDRR: - nParam = getParagraphBorder(3); - break; - default: - break; - } - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH; - } - break; - case RTF_CHBRDR: - { - RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(aAttributes); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue); - m_aStates.top().nBorderState = RTFBorderState::CHARACTER; - } - break; - case RTF_CLMGF: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); - m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); - } - break; - case RTF_CLMRG: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); - m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); - } - break; - case RTF_CLVMGF: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); - m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); - } - break; - case RTF_CLVMRG: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); - m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); - } - break; - case RTF_CLVERTALT: - case RTF_CLVERTALC: - case RTF_CLVERTALB: - { - switch (nKeyword) { - case RTF_CLVERTALT: - nParam = NS_ooxml::LN_Value_ST_VerticalJc_top; - break; - case RTF_CLVERTALC: - nParam = NS_ooxml::LN_Value_ST_VerticalJc_center; - break; - case RTF_CLVERTALB: - nParam = NS_ooxml::LN_Value_ST_VerticalJc_bottom; - break; - default: - break; + RTFSprms aAttributes; + RTFSprms aSprms; + auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + switch (nKeyword) + { + case RTF_BRDRT: + nParam = getParagraphBorder(0); + break; + case RTF_BRDRL: + nParam = getParagraphBorder(1); + break; + case RTF_BRDRB: + nParam = getParagraphBorder(2); + break; + case RTF_BRDRR: + nParam = getParagraphBorder(3); + break; + default: + break; + } + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, + pValue); + m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH; } - auto pValue = std::make_shared<RTFValue>(nParam); - m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue); - } - break; - case RTF_TRKEEP: - { - auto pValue = std::make_shared<RTFValue>(1); - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_cantSplit, pValue); - } - break; - case RTF_SECTUNLOCKED: - { - auto pValue = std::make_shared<RTFValue>(int(!nParam)); - m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue); - } - break; - case RTF_PGNBIDIA: - case RTF_PGNBIDIB: - // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment. - break; - case RTF_LOCH: - m_aStates.top().eRunType = RTFParserState::RunType::LOCH; break; - case RTF_HICH: - m_aStates.top().eRunType = RTFParserState::RunType::HICH; - break; - case RTF_DBCH: - m_aStates.top().eRunType = RTFParserState::RunType::DBCH; - break; - case RTF_TITLEPG: - { - auto pValue = std::make_shared<RTFValue>(1); - m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue); - } - break; - case RTF_SUPER: - { - if (!m_aStates.top().pCurrentBuffer) - m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; - - auto pValue = std::make_shared<RTFValue>("superscript"); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); - } - break; - case RTF_SUB: - { - auto pValue = std::make_shared<RTFValue>("subscript"); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); - } - break; - case RTF_NOSUPERSUB: - { - if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) + case RTF_CHBRDR: { - replayBuffer(m_aSuperBuffer, nullptr, nullptr); - m_aStates.top().pCurrentBuffer = nullptr; + RTFSprms aAttributes; + auto pValue = std::make_shared<RTFValue>(aAttributes); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue); + m_aStates.top().nBorderState = RTFBorderState::CHARACTER; } - m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign); - } - break; - case RTF_LINEPPAGE: - case RTF_LINECONT: - { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_LINEPPAGE ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_restart, pValue); - } - break; - case RTF_AENDDOC: - // Noop, this is the default in Writer. - break; - case RTF_AENDNOTES: - // Noop, Writer does not support having endnotes at the end of section. break; - case RTF_AFTNRSTCONT: - // Noop, this is the default in Writer. - break; - case RTF_AFTNRESTART: - // Noop, Writer does not support restarting endnotes at each section. - break; - case RTF_FTNBJ: - // Noop, this is the default in Writer. - break; - case RTF_ENDDOC: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_RestartNumber_eachSect); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); - } - break; - case RTF_NOLINE: - eraseNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance); - break; - case RTF_FORMSHADE: - // Noop, this is the default in Writer. - break; - case RTF_PNGBLIP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::PNG; + case RTF_CLMGF: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); + m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); + } break; - case RTF_JPEGBLIP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::JPEG; + case RTF_CLMRG: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); + m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue); + } break; - case RTF_POSYT: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_top); + case RTF_CLVMGF: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_restart); + m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); + } break; - case RTF_POSYB: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_bottom); + case RTF_CLVMRG: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_Merge_continue); + m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue); + } break; - case RTF_POSYC: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_center); + case RTF_CLVERTALT: + case RTF_CLVERTALC: + case RTF_CLVERTALB: + { + switch (nKeyword) + { + case RTF_CLVERTALT: + nParam = NS_ooxml::LN_Value_ST_VerticalJc_top; + break; + case RTF_CLVERTALC: + nParam = NS_ooxml::LN_Value_ST_VerticalJc_center; + break; + case RTF_CLVERTALB: + nParam = NS_ooxml::LN_Value_ST_VerticalJc_bottom; + break; + default: + break; + } + auto pValue = std::make_shared<RTFValue>(nParam); + m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue); + } break; - case RTF_POSYIN: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_inside); + case RTF_TRKEEP: + { + auto pValue = std::make_shared<RTFValue>(1); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_cantSplit, pValue); + } break; - case RTF_POSYOUT: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_outside); + case RTF_SECTUNLOCKED: + { + auto pValue = std::make_shared<RTFValue>(int(!nParam)); + m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue); + } break; - case RTF_POSYIL: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_doc_ST_YAlign_inline); + case RTF_PGNBIDIA: + case RTF_PGNBIDIB: + // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment. + break; + case RTF_LOCH: + m_aStates.top().eRunType = RTFParserState::RunType::LOCH; + break; + case RTF_HICH: + m_aStates.top().eRunType = RTFParserState::RunType::HICH; + break; + case RTF_DBCH: + m_aStates.top().eRunType = RTFParserState::RunType::DBCH; + break; + case RTF_TITLEPG: + { + auto pValue = std::make_shared<RTFValue>(1); + m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue); + } break; + case RTF_SUPER: + { + if (!m_aStates.top().pCurrentBuffer) + m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; - case RTF_PHMRG: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_doc_ST_HAnchor_margin); - break; - case RTF_PVMRG: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_doc_ST_VAnchor_margin); + auto pValue = std::make_shared<RTFValue>("superscript"); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); + } break; - case RTF_PHPG: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_doc_ST_HAnchor_page); + case RTF_SUB: + { + auto pValue = std::make_shared<RTFValue>("subscript"); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); + } break; - case RTF_PVPG: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_doc_ST_VAnchor_page); + case RTF_NOSUPERSUB: + { + if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) + { + replayBuffer(m_aSuperBuffer, nullptr, nullptr); + m_aStates.top().pCurrentBuffer = nullptr; + } + m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign); + } break; - case RTF_PHCOL: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_doc_ST_HAnchor_text); + case RTF_LINEPPAGE: + case RTF_LINECONT: + { + auto pValue = std::make_shared<RTFValue>( + nKeyword == RTF_LINEPPAGE ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage + : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, + NS_ooxml::LN_CT_LineNumber_restart, pValue); + } break; - case RTF_PVPARA: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_doc_ST_VAnchor_text); + case RTF_AENDDOC: + // Noop, this is the default in Writer. + break; + case RTF_AENDNOTES: + // Noop, Writer does not support having endnotes at the end of section. + break; + case RTF_AFTNRSTCONT: + // Noop, this is the default in Writer. + break; + case RTF_AFTNRESTART: + // Noop, Writer does not support restarting endnotes at each section. + break; + case RTF_FTNBJ: + // Noop, this is the default in Writer. + break; + case RTF_ENDDOC: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_RestartNumber_eachSect); + putNestedSprm(m_aDefaultState.aParagraphSprms, + NS_ooxml::LN_EG_SectPrContents_footnotePr, + NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); + } break; + case RTF_NOLINE: + eraseNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, + NS_ooxml::LN_CT_LineNumber_distance); + break; + case RTF_FORMSHADE: + // Noop, this is the default in Writer. + break; + case RTF_PNGBLIP: + m_aStates.top().aPicture.eStyle = RTFBmpStyle::PNG; + break; + case RTF_JPEGBLIP: + m_aStates.top().aPicture.eStyle = RTFBmpStyle::JPEG; + break; + case RTF_POSYT: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_top); + break; + case RTF_POSYB: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_bottom); + break; + case RTF_POSYC: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_center); + break; + case RTF_POSYIN: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_inside); + break; + case RTF_POSYOUT: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_outside); + break; + case RTF_POSYIL: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_Value_doc_ST_YAlign_inline); + break; - case RTF_POSXC: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_doc_ST_XAlign_center); - break; - case RTF_POSXI: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_doc_ST_XAlign_inside); - break; - case RTF_POSXO: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_doc_ST_XAlign_outside); - break; - case RTF_POSXL: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_doc_ST_XAlign_left); - break; - case RTF_POSXR: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_doc_ST_XAlign_right); - break; + case RTF_PHMRG: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, + NS_ooxml::LN_Value_doc_ST_HAnchor_margin); + break; + case RTF_PVMRG: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, + NS_ooxml::LN_Value_doc_ST_VAnchor_margin); + break; + case RTF_PHPG: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, + NS_ooxml::LN_Value_doc_ST_HAnchor_page); + break; + case RTF_PVPG: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, + NS_ooxml::LN_Value_doc_ST_VAnchor_page); + break; + case RTF_PHCOL: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, + NS_ooxml::LN_Value_doc_ST_HAnchor_text); + break; + case RTF_PVPARA: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, + NS_ooxml::LN_Value_doc_ST_VAnchor_text); + break; - case RTF_DPLINE: - case RTF_DPRECT: - case RTF_DPELLIPSE: - case RTF_DPTXBX: - case RTF_DPPOLYLINE: - case RTF_DPPOLYGON: - { - sal_Int32 nType = 0; - switch (nKeyword) - { - case RTF_DPLINE: - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY); + case RTF_POSXC: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, + NS_ooxml::LN_Value_doc_ST_XAlign_center); break; - case RTF_DPPOLYLINE: - // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info. - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"), uno::UNO_QUERY); + case RTF_POSXI: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, + NS_ooxml::LN_Value_doc_ST_XAlign_inside); break; - case RTF_DPPOLYGON: - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.PolyPolygonShape"), uno::UNO_QUERY); + case RTF_POSXO: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, + NS_ooxml::LN_Value_doc_ST_XAlign_outside); break; - case RTF_DPRECT: - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); + case RTF_POSXL: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, + NS_ooxml::LN_Value_doc_ST_XAlign_left); break; - case RTF_DPELLIPSE: - nType = ESCHER_ShpInst_Ellipse; + case RTF_POSXR: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, + NS_ooxml::LN_Value_doc_ST_XAlign_right); break; + + case RTF_DPLINE: + case RTF_DPRECT: + case RTF_DPELLIPSE: case RTF_DPTXBX: + case RTF_DPPOLYLINE: + case RTF_DPPOLYGON: { - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); - std::vector<beans::PropertyValue> aDefaults = RTFSdrImport::getTextFrameDefaults(false); - for (const auto& rDefault : aDefaults) + sal_Int32 nType = 0; + switch (nKeyword) + { + case RTF_DPLINE: + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), + uno::UNO_QUERY); + break; + case RTF_DPPOLYLINE: + // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info. + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"), + uno::UNO_QUERY); + break; + case RTF_DPPOLYGON: + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.drawing.PolyPolygonShape"), + uno::UNO_QUERY); + break; + case RTF_DPRECT: + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"), + uno::UNO_QUERY); + break; + case RTF_DPELLIPSE: + nType = ESCHER_ShpInst_Ellipse; + break; + case RTF_DPTXBX: + { + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.text.TextFrame"), + uno::UNO_QUERY); + std::vector<beans::PropertyValue> aDefaults + = RTFSdrImport::getTextFrameDefaults(false); + for (const auto& rDefault : aDefaults) + { + if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, + rDefault.Name)) + m_aStates.top().aDrawingObject.aPendingProperties.push_back(rDefault); + } + checkFirstRun(); + Mapper().startShape(m_aStates.top().aDrawingObject.xShape); + m_aStates.top().aDrawingObject.bHadShapeText = true; + } + break; + default: + break; + } + if (nType) + m_aStates.top().aDrawingObject.xShape.set( + getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"), + uno::UNO_QUERY); + uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); + if (xDrawSupplier.is()) + { + uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), + uno::UNO_QUERY); + if (xShapes.is() && nKeyword != RTF_DPTXBX) + xShapes->add(m_aStates.top().aDrawingObject.xShape); + } + if (nType) { - if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, rDefault.Name)) - m_aStates.top().aDrawingObject.aPendingProperties.push_back(rDefault); + uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter( + m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); + xDefaulter->createCustomShapeDefaults(OUString::number(nType)); } - checkFirstRun(); - Mapper().startShape(m_aStates.top().aDrawingObject.xShape); - m_aStates.top().aDrawingObject.bHadShapeText = true; + m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, + uno::UNO_QUERY); + std::vector<beans::PropertyValue>& rPendingProperties + = m_aStates.top().aDrawingObject.aPendingProperties; + for (auto& rPendingProperty : rPendingProperties) + m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue( + rPendingProperty.Name, rPendingProperty.Value); + m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, + m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true); } break; - default: - break; - } - if (nType) - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY); - uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); - if (xDrawSupplier.is()) + case RTF_DOBXMARGIN: + case RTF_DOBYMARGIN: { - uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY); - if (xShapes.is() && nKeyword != RTF_DPTXBX) - xShapes->add(m_aStates.top().aDrawingObject.xShape); + beans::PropertyValue aPropertyValue; + aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation") + : OUString("VertOrientRelation")); + aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA; + m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); } - if (nType) + break; + case RTF_DOBXPAGE: + case RTF_DOBYPAGE: { - uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); - xDefaulter->createCustomShapeDefaults(OUString::number(nType)); + beans::PropertyValue aPropertyValue; + aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation") + : OUString("VertOrientRelation")); + aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME; + m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); } - m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); - std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties; - for (auto& rPendingProperty : rPendingProperties) - m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(rPendingProperty.Name, rPendingProperty.Value); - m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true); - } - break; - case RTF_DOBXMARGIN: - case RTF_DOBYMARGIN: - { - beans::PropertyValue aPropertyValue; - aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation") : OUString("VertOrientRelation")); - aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA; - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - } - break; - case RTF_DOBXPAGE: - case RTF_DOBYPAGE: - { - beans::PropertyValue aPropertyValue; - aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation") : OUString("VertOrientRelation")); - aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME; - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - } - break; - case RTF_DOBYPARA: - { - beans::PropertyValue aPropertyValue; - aPropertyValue.Name = "VertOrientRelation"; - aPropertyValue.Value <<= text::RelOrientation::FRAME; - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - } - break; - case RTF_CONTEXTUALSPACE: - { - auto pValue = std::make_shared<RTFValue>(1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue); - } - break; - case RTF_LINKSTYLES: - { - auto pValue = std::make_shared<RTFValue>(1); - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_linkStyles, pValue); - } - break; - case RTF_PNLVLBODY: - { - auto pValue = std::make_shared<RTFValue>(2); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pValue); - } - break; - case RTF_PNDEC: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pValue); - } - break; - case RTF_PNLVLBLT: - { - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, std::make_shared<RTFValue>(1)); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_bullet)); - } - break; - case RTF_LANDSCAPE: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); - putNestedAttribute(m_aDefaultState.aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue); - SAL_FALLTHROUGH; // set the default + current value - } - case RTF_LNDSCPSXN: - { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue); - } - break; - case RTF_SHPBXPAGE: - m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME; - m_aStates.top().aShape.nHoriOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page; break; - case RTF_SHPBYPAGE: - m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; - m_aStates.top().aShape.nVertOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page; - break; - case RTF_DPLINEHOLLOW: - m_aStates.top().aDrawingObject.nFLine = 0; + case RTF_DOBYPARA: + { + beans::PropertyValue aPropertyValue; + aPropertyValue.Name = "VertOrientRelation"; + aPropertyValue.Value <<= text::RelOrientation::FRAME; + m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); + } break; - case RTF_DPROUNDR: - if (m_aStates.top().aDrawingObject.xPropertySet.is()) - // Seems this old syntax has no way to specify a custom radius, and this is the default - m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", uno::makeAny(sal_Int32(83))); + case RTF_CONTEXTUALSPACE: + { + auto pValue = std::make_shared<RTFValue>(1); + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue); + } break; - case RTF_NOWRAP: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_wrap, NS_ooxml::LN_Value_doc_ST_Wrap_notBeside); + case RTF_LINKSTYLES: + { + auto pValue = std::make_shared<RTFValue>(1); + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_linkStyles, pValue); + } break; - case RTF_MNOR: - m_bMathNor = true; + case RTF_PNLVLBODY: + { + auto pValue = std::make_shared<RTFValue>(2); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pValue); + } break; - case RTF_REVISIONS: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, std::make_shared<RTFValue>(1)); + case RTF_PNDEC: + { + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pValue); + } break; - case RTF_BRDRSH: - putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, std::make_shared<RTFValue>(1)); + case RTF_PNLVLBLT: + { + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, + std::make_shared<RTFValue>(1)); + m_aStates.top().aTableSprms.set( + NS_ooxml::LN_CT_Lvl_numFmt, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_bullet)); + } break; - case RTF_NOCOLBAL: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_noColumnBalance, std::make_shared<RTFValue>(1)); + case RTF_LANDSCAPE: + { + auto pValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_orient, pValue); + SAL_FALLTHROUGH; // set the default + current value + } + case RTF_LNDSCPSXN: + { + auto pValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_PageOrientation_landscape); + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_orient, pValue); + } break; - case RTF_MARGMIRROR: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_mirrorMargins, std::make_shared<RTFValue>(1)); + case RTF_SHPBXPAGE: + m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME; + m_aStates.top().aShape.nHoriOrientRelationToken + = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page; + break; + case RTF_SHPBYPAGE: + m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; + m_aStates.top().aShape.nVertOrientRelationToken + = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page; + break; + case RTF_DPLINEHOLLOW: + m_aStates.top().aDrawingObject.nFLine = 0; + break; + case RTF_DPROUNDR: + if (m_aStates.top().aDrawingObject.xPropertySet.is()) + // Seems this old syntax has no way to specify a custom radius, and this is the default + m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue( + "CornerRadius", uno::makeAny(sal_Int32(83))); + break; + case RTF_NOWRAP: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_notBeside); + break; + case RTF_MNOR: + m_bMathNor = true; + break; + case RTF_REVISIONS: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, + std::make_shared<RTFValue>(1)); + break; + case RTF_BRDRSH: + putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, + std::make_shared<RTFValue>(1)); + break; + case RTF_NOCOLBAL: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_noColumnBalance, + std::make_shared<RTFValue>(1)); + break; + case RTF_MARGMIRROR: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_mirrorMargins, + std::make_shared<RTFValue>(1)); + break; + case RTF_SAUTOUPD: + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_autoRedefine, + std::make_shared<RTFValue>(1)); + break; + case RTF_WIDOWCTRL: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_widowControl, + std::make_shared<RTFValue>(1)); + break; + case RTF_LINEBETCOL: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, + NS_ooxml::LN_CT_Columns_sep, std::make_shared<RTFValue>(1)); + break; + case RTF_PGNRESTART: + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_start, std::make_shared<RTFValue>(1)); + break; + case RTF_PGNUCLTR: + { + auto pIntValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } break; - case RTF_SAUTOUPD: - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_autoRedefine, std::make_shared<RTFValue>(1)); + case RTF_PGNLCLTR: + { + auto pIntValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } break; - case RTF_WIDOWCTRL: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_widowControl, std::make_shared<RTFValue>(1)); + case RTF_PGNUCRM: + { + auto pIntValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } break; - case RTF_LINEBETCOL: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_sep, std::make_shared<RTFValue>(1)); + case RTF_PGNLCRM: + { + auto pIntValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } break; - case RTF_PGNRESTART: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_start, std::make_shared<RTFValue>(1)); + case RTF_PGNDEC: + { + auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgNumType, + NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } break; - case RTF_PGNUCLTR: - { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); - } - break; - case RTF_PGNLCLTR: - { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); - } - break; - case RTF_PGNUCRM: - { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); - } - break; - case RTF_PGNLCRM: - { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); - } - break; - case RTF_PGNDEC: - { - auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal); - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); - } - break; - case RTF_HTMAUTSP: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing, std::make_shared<RTFValue>(0)); + case RTF_HTMAUTSP: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing, + std::make_shared<RTFValue>(0)); + break; + default: + { + SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'"); + aSkip.setParsed(false); + } break; - default: - { - SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'"); - aSkip.setParsed(false); - } - break; } return RTFError::OK; } diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index a6758e623f7d..8e76355ce945 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -23,14 +23,13 @@ namespace writerfilter { namespace rtftok { - RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) { setNeedSect(true); if (nKeyword != RTF_HEXCHAR) - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); else - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ false); + checkUnicode(/*bUnicode =*/true, /*bHex =*/false); RTFSkipDestination aSkip(*this); if (RTF_LINE == nKeyword) @@ -43,41 +42,41 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) sal_uInt8 cCh = 0; switch (nKeyword) { - case RTF_TAB: - cCh = '\t'; - break; - case RTF_BACKSLASH: - cCh = '\\'; - break; - case RTF_LBRACE: - cCh = '{'; - break; - case RTF_RBRACE: - cCh = '}'; - break; - case RTF_EMDASH: - cCh = 151; - break; - case RTF_ENDASH: - cCh = 150; - break; - case RTF_BULLET: - cCh = 149; - break; - case RTF_LQUOTE: - cCh = 145; - break; - case RTF_RQUOTE: - cCh = 146; - break; - case RTF_LDBLQUOTE: - cCh = 147; - break; - case RTF_RDBLQUOTE: - cCh = 148; - break; - default: - break; + case RTF_TAB: + cCh = '\t'; + break; + case RTF_BACKSLASH: + cCh = '\\'; + break; + case RTF_LBRACE: + cCh = '{'; + break; + case RTF_RBRACE: + cCh = '}'; + break; + case RTF_EMDASH: + cCh = 151; + break; + case RTF_ENDASH: + cCh = 150; + break; + case RTF_BULLET: + cCh = 149; + break; + case RTF_LQUOTE: + cCh = 145; + break; + case RTF_RQUOTE: + cCh = 146; + break; + case RTF_LDBLQUOTE: + cCh = 147; + break; + case RTF_RDBLQUOTE: + cCh = 148; + break; + default: + break; } if (cCh > 0) { @@ -88,339 +87,342 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) switch (nKeyword) { - case RTF_IGNORE: - { - m_bSkipUnknown = true; - aSkip.setReset(false); - return RTFError::OK; - } - break; - case RTF_PAR: - { - if (m_aStates.top().eDestination == Destination::FOOTNOTESEPARATOR) - break; // just ignore it - only thing we read in here is CHFTNSEP - checkFirstRun(); - bool bNeedPap = m_bNeedPap; - checkNeedPap(); - if (bNeedPap) - runProps(); - if (!m_aStates.top().pCurrentBuffer) - { - parBreak(); - // Not in table? Reset max width. - if (m_nCellxMax) - { - // Was in table, but not anymore -> tblEnd. - RTFSprms aAttributes; - RTFSprms aSprms; - aSprms.set(NS_ooxml::LN_tblEnd, std::make_shared<RTFValue>(1)); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); - Mapper().props(pProperties); - } - m_nCellxMax = 0; - } - else if (m_aStates.top().eDestination != Destination::SHAPETEXT) + case RTF_IGNORE: { - RTFValue::Pointer_t pValue; - m_aStates.top().pCurrentBuffer->push_back( - Buf_t(BUFFER_PAR, pValue, nullptr)); + m_bSkipUnknown = true; + aSkip.setReset(false); + return RTFError::OK; } - // but don't emit properties yet, since they may change till the first text token arrives - m_bNeedPap = true; - if (!m_aStates.top().aFrame.inFrame()) - m_bNeedPar = false; - m_bNeedFinalPar = false; - } - break; - case RTF_SECT: - { - m_bHadSect = true; - if (m_bIgnoreNextContSectBreak) - m_bIgnoreNextContSectBreak = false; - else + break; + case RTF_PAR: { - sectBreak(); - if (m_nResetBreakOnSectBreak != RTF_invalid) + if (m_aStates.top().eDestination == Destination::FOOTNOTESEPARATOR) + break; // just ignore it - only thing we read in here is CHFTNSEP + checkFirstRun(); + bool bNeedPap = m_bNeedPap; + checkNeedPap(); + if (bNeedPap) + runProps(); + if (!m_aStates.top().pCurrentBuffer) { - // this should run on _second_ \sect after \page - dispatchSymbol(m_nResetBreakOnSectBreak); // lazy reset - m_nResetBreakOnSectBreak = RTF_invalid; - m_bNeedSect = false; // dispatchSymbol set it + parBreak(); + // Not in table? Reset max width. + if (m_nCellxMax) + { + // Was in table, but not anymore -> tblEnd. + RTFSprms aAttributes; + RTFSprms aSprms; + aSprms.set(NS_ooxml::LN_tblEnd, std::make_shared<RTFValue>(1)); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + Mapper().props(pProperties); + } + m_nCellxMax = 0; } + else if (m_aStates.top().eDestination != Destination::SHAPETEXT) + { + RTFValue::Pointer_t pValue; + m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PAR, pValue, nullptr)); + } + // but don't emit properties yet, since they may change till the first text token arrives + m_bNeedPap = true; + if (!m_aStates.top().aFrame.inFrame()) + m_bNeedPar = false; + m_bNeedFinalPar = false; } - } - break; - case RTF_NOBREAK: - { - OUString aStr(SVT_HARD_SPACE); - text(aStr); - } - break; - case RTF_NOBRKHYPH: - { - OUString aStr(SVT_HARD_HYPHEN); - text(aStr); - } - break; - case RTF_OPTHYPH: - { - OUString aStr(SVT_SOFT_HYPHEN); - text(aStr); - } - break; - case RTF_HEXCHAR: - m_aStates.top().nInternalState = RTFInternalState::HEX; break; - case RTF_CELL: - case RTF_NESTCELL: - { - if (nKeyword == RTF_CELL) - m_bAfterCellBeforeRow = true; - - checkFirstRun(); - if (m_bNeedPap) + case RTF_SECT: { - // There were no runs in the cell, so we need to send paragraph and character properties here. - auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); - m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr)); - auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); - m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr)); - } - - RTFValue::Pointer_t pValue; - m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_CELLEND, pValue, nullptr)); - m_bNeedPap = true; - } - break; - case RTF_NESTROW: - { - std::shared_ptr<TableRowBuffer> const pBuffer( - new TableRowBuffer( - m_aTableBufferStack.back(), - m_aNestedTableCellsSprms, - m_aNestedTableCellsAttributes, - m_nNestedCells)); - prepareProperties(m_aStates.top(), - pBuffer->pParaProperties, - pBuffer->pFrameProperties, - pBuffer->pRowProperties, - m_nNestedCells, m_nNestedCurrentCellX); - - if (m_aTableBufferStack.size() == 1 || !m_aStates.top().pCurrentBuffer) - { - throw io::WrongFormatException( - "mismatch between \\itap and number of \\nestrow", nullptr); - } - assert(m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back()); - // note: there may be several states pointing to table buffer! - for (std::size_t i = 0; i < m_aStates.size(); ++i) - { - if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back()) + m_bHadSect = true; + if (m_bIgnoreNextContSectBreak) + m_bIgnoreNextContSectBreak = false; + else { - m_aStates[i].pCurrentBuffer = - &m_aTableBufferStack[m_aTableBufferStack.size()-2]; + sectBreak(); + if (m_nResetBreakOnSectBreak != RTF_invalid) + { + // this should run on _second_ \sect after \page + dispatchSymbol(m_nResetBreakOnSectBreak); // lazy reset + m_nResetBreakOnSectBreak = RTF_invalid; + m_bNeedSect = false; // dispatchSymbol set it + } } } - m_aTableBufferStack.pop_back(); - m_aTableBufferStack.back().emplace_back( - Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer)); - - m_aNestedTableCellsSprms.clear(); - m_aNestedTableCellsAttributes.clear(); - m_nNestedCells = 0; - m_bNeedPap = true; - } - break; - case RTF_ROW: - { - m_bAfterCellBeforeRow = false; - if (m_aStates.top().nTableRowWidthAfter > 0) + break; + case RTF_NOBREAK: { - // Add fake cellx / cell, RTF equivalent of - // OOXMLFastContextHandlerTextTableRow::handleGridAfter(). - auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter); - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); - dispatchSymbol(RTF_CELL); - - // Adjust total width, which is done in the \cellx handler for normal cells. - m_nTopLevelCurrentCellX += m_aStates.top().nTableRowWidthAfter; - - m_aStates.top().nTableRowWidthAfter = 0; + OUString aStr(SVT_HARD_SPACE); + text(aStr); } - - bool bRestored = false; - // Ending a row, but no cells defined? - // See if there was an invalid table row reset, so we can restore cell infos to help invalid documents. - if (!m_nTopLevelCurrentCellX && m_nBackupTopLevelCurrentCellX) + break; + case RTF_NOBRKHYPH: { - restoreTableRowProperties(); - bRestored = true; + OUString aStr(SVT_HARD_HYPHEN); + text(aStr); } - - // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic WW8TabDesc::CalcDefaults(): resize the last cell - const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames. - if ((m_nCellxMax - m_nTopLevelCurrentCellX) >= MINLAY) + break; + case RTF_OPTHYPH: { - auto pXValueLast = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblGridBase_gridCol, false); - const int nXValueLast = pXValueLast ? pXValueLast->getInt() : 0; - auto pXValue = std::make_shared<RTFValue>(nXValueLast + m_nCellxMax - m_nTopLevelCurrentCellX); - m_aStates.top().aTableRowSprms.eraseLast(NS_ooxml::LN_CT_TblGridBase_gridCol); - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); - m_nTopLevelCurrentCellX = m_nCellxMax; + OUString aStr(SVT_SOFT_HYPHEN); + text(aStr); } - - if (m_nTopLevelCells) + break; + case RTF_HEXCHAR: + m_aStates.top().nInternalState = RTFInternalState::HEX; + break; + case RTF_CELL: + case RTF_NESTCELL: { - // Make a backup before we start popping elements - m_aTableInheritingCellsSprms = m_aTopLevelTableCellsSprms; - m_aTableInheritingCellsAttributes = m_aTopLevelTableCellsAttributes; - m_nInheritingCells = m_nTopLevelCells; + if (nKeyword == RTF_CELL) + m_bAfterCellBeforeRow = true; + + checkFirstRun(); + if (m_bNeedPap) + { + // There were no runs in the cell, so we need to send paragraph and character properties here. + auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, + m_aStates.top().aParagraphSprms); + m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr)); + auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, + m_aStates.top().aCharacterSprms); + m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr)); + } + + RTFValue::Pointer_t pValue; + m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_CELLEND, pValue, nullptr)); + m_bNeedPap = true; } - else + break; + case RTF_NESTROW: { - // No table definition? Then inherit from the previous row - m_aTopLevelTableCellsSprms = m_aTableInheritingCellsSprms; - m_aTopLevelTableCellsAttributes = m_aTableInheritingCellsAttributes; - m_nTopLevelCells = m_nInheritingCells; - } + std::shared_ptr<TableRowBuffer> const pBuffer( + new TableRowBuffer(m_aTableBufferStack.back(), m_aNestedTableCellsSprms, + m_aNestedTableCellsAttributes, m_nNestedCells)); + prepareProperties(m_aStates.top(), pBuffer->pParaProperties, pBuffer->pFrameProperties, + pBuffer->pRowProperties, m_nNestedCells, m_nNestedCurrentCellX); - while (m_aTableBufferStack.size() > 1) - { - SAL_WARN("writerfilter.rtf", "dropping extra table buffer"); + if (m_aTableBufferStack.size() == 1 || !m_aStates.top().pCurrentBuffer) + { + throw io::WrongFormatException("mismatch between \\itap and number of \\nestrow", + nullptr); + } + assert(m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back()); // note: there may be several states pointing to table buffer! for (std::size_t i = 0; i < m_aStates.size(); ++i) { if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back()) { - m_aStates[i].pCurrentBuffer = - &m_aTableBufferStack.front(); + m_aStates[i].pCurrentBuffer + = &m_aTableBufferStack[m_aTableBufferStack.size() - 2]; } } m_aTableBufferStack.pop_back(); + m_aTableBufferStack.back().emplace_back( + Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer)); + + m_aNestedTableCellsSprms.clear(); + m_aNestedTableCellsAttributes.clear(); + m_nNestedCells = 0; + m_bNeedPap = true; } + break; + case RTF_ROW: + { + m_bAfterCellBeforeRow = false; + if (m_aStates.top().nTableRowWidthAfter > 0) + { + // Add fake cellx / cell, RTF equivalent of + // OOXMLFastContextHandlerTextTableRow::handleGridAfter(). + auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, + RTFOverwrite::NO_APPEND); + dispatchSymbol(RTF_CELL); - replayRowBuffer(m_aTableBufferStack.back(), - m_aTopLevelTableCellsSprms, m_aTopLevelTableCellsAttributes, - m_nTopLevelCells); + // Adjust total width, which is done in the \cellx handler for normal cells. + m_nTopLevelCurrentCellX += m_aStates.top().nTableRowWidthAfter; - // The scope of the table cell defaults is one row. - m_aDefaultState.aTableCellSprms.clear(); - m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + m_aStates.top().nTableRowWidthAfter = 0; + } - writerfilter::Reference<Properties>::Pointer_t paraProperties; - writerfilter::Reference<Properties>::Pointer_t frameProperties; - writerfilter::Reference<Properties>::Pointer_t rowProperties; - prepareProperties(m_aStates.top(), - paraProperties, frameProperties, rowProperties, - m_nTopLevelCells, m_nTopLevelCurrentCellX); - sendProperties(paraProperties, frameProperties, rowProperties); + bool bRestored = false; + // Ending a row, but no cells defined? + // See if there was an invalid table row reset, so we can restore cell infos to help invalid documents. + if (!m_nTopLevelCurrentCellX && m_nBackupTopLevelCurrentCellX) + { + restoreTableRowProperties(); + bRestored = true; + } - m_bNeedPap = true; - m_bNeedFinalPar = true; - m_aTableBufferStack.back().clear(); - m_nTopLevelCells = 0; + // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic WW8TabDesc::CalcDefaults(): resize the last cell + const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames. + if ((m_nCellxMax - m_nTopLevelCurrentCellX) >= MINLAY) + { + auto pXValueLast = m_aStates.top().aTableRowSprms.find( + NS_ooxml::LN_CT_TblGridBase_gridCol, false); + const int nXValueLast = pXValueLast ? pXValueLast->getInt() : 0; + auto pXValue = std::make_shared<RTFValue>(nXValueLast + m_nCellxMax + - m_nTopLevelCurrentCellX); + m_aStates.top().aTableRowSprms.eraseLast(NS_ooxml::LN_CT_TblGridBase_gridCol); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, + RTFOverwrite::NO_APPEND); + m_nTopLevelCurrentCellX = m_nCellxMax; + } - if (bRestored) - // We restored cell definitions, clear these now. - // This is necessary, as later cell definitions want to overwrite the restored ones. - resetTableRowProperties(); - } - break; - case RTF_COLUMN: - { - bool bColumns = false; // If we have multiple columns - RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols); - if (pCols) - { - RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num); - if (pNum.get() && pNum->getInt() > 1) - bColumns = true; + if (m_nTopLevelCells) + { + // Make a backup before we start popping elements + m_aTableInheritingCellsSprms = m_aTopLevelTableCellsSprms; + m_aTableInheritingCellsAttributes = m_aTopLevelTableCellsAttributes; + m_nInheritingCells = m_nTopLevelCells; + } + else + { + // No table definition? Then inherit from the previous row + m_aTopLevelTableCellsSprms = m_aTableInheritingCellsSprms; + m_aTopLevelTableCellsAttributes = m_aTableInheritingCellsAttributes; + m_nTopLevelCells = m_nInheritingCells; + } + + while (m_aTableBufferStack.size() > 1) + { + SAL_WARN("writerfilter.rtf", "dropping extra table buffer"); + // note: there may be several states pointing to table buffer! + for (std::size_t i = 0; i < m_aStates.size(); ++i) + { + if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back()) + { + m_aStates[i].pCurrentBuffer = &m_aTableBufferStack.front(); + } + } + m_aTableBufferStack.pop_back(); + } + + replayRowBuffer(m_aTableBufferStack.back(), m_aTopLevelTableCellsSprms, + m_aTopLevelTableCellsAttributes, m_nTopLevelCells); + + // The scope of the table cell defaults is one row. + m_aDefaultState.aTableCellSprms.clear(); + m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; + m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + + writerfilter::Reference<Properties>::Pointer_t paraProperties; + writerfilter::Reference<Properties>::Pointer_t frameProperties; + writerfilter::Reference<Properties>::Pointer_t rowProperties; + prepareProperties(m_aStates.top(), paraProperties, frameProperties, rowProperties, + m_nTopLevelCells, m_nTopLevelCurrentCellX); + sendProperties(paraProperties, frameProperties, rowProperties); + + m_bNeedPap = true; + m_bNeedFinalPar = true; + m_aTableBufferStack.back().clear(); + m_nTopLevelCells = 0; + + if (bRestored) + // We restored cell definitions, clear these now. + // This is necessary, as later cell definitions want to overwrite the restored ones. + resetTableRowProperties(); } - checkFirstRun(); - if (bColumns) + break; + case RTF_COLUMN: { - sal_uInt8 const sBreak[] = { 0xe }; - Mapper().startCharacterGroup(); - Mapper().text(sBreak, 1); - Mapper().endCharacterGroup(); + bool bColumns = false; // If we have multiple columns + RTFValue::Pointer_t pCols + = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols); + if (pCols) + { + RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num); + if (pNum.get() && pNum->getInt() > 1) + bColumns = true; + } + checkFirstRun(); + if (bColumns) + { + sal_uInt8 const sBreak[] = { 0xe }; + Mapper().startCharacterGroup(); + Mapper().text(sBreak, 1); + Mapper().endCharacterGroup(); + } + else + dispatchSymbol(RTF_PAGE); } - else - dispatchSymbol(RTF_PAGE); - } - break; - case RTF_CHFTN: - { - if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) - // Stop buffering, there will be no custom mark for this footnote or endnote. - m_aStates.top().pCurrentBuffer = nullptr; break; - } - case RTF_PAGE: - { - // Ignore page breaks inside tables. - if (m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back()) + case RTF_CHFTN: + { + if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) + // Stop buffering, there will be no custom mark for this footnote or endnote. + m_aStates.top().pCurrentBuffer = nullptr; break; + } + case RTF_PAGE: + { + // Ignore page breaks inside tables. + if (m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back()) + break; - // If we're inside a continuous section, we should send a section break, not a page one. - RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); - // Unless we're on a title page. - RTFValue::Pointer_t pTitlePg = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg); - if (((pBreak.get() && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous)) - || m_nResetBreakOnSectBreak == RTF_SBKNONE) + // If we're inside a continuous section, we should send a section break, not a page one. + RTFValue::Pointer_t pBreak + = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); + // Unless we're on a title page. + RTFValue::Pointer_t pTitlePg + = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg); + if (((pBreak.get() + && pBreak->getInt() + == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous)) + || m_nResetBreakOnSectBreak == RTF_SBKNONE) && !(pTitlePg.get() && pTitlePg->getInt())) - { - if (m_bWasInFrame) { - dispatchSymbol(RTF_PAR); - m_bWasInFrame = false; + if (m_bWasInFrame) + { + dispatchSymbol(RTF_PAR); + m_bWasInFrame = false; + } + sectBreak(); + // note: this will not affect the following section break + // but the one just pushed + dispatchFlag(RTF_SBKPAGE); + if (m_bNeedPar) + dispatchSymbol(RTF_PAR); + m_bIgnoreNextContSectBreak = true; + // arrange to clean up the synthetic RTF_SBKPAGE + m_nResetBreakOnSectBreak = RTF_SBKNONE; } - sectBreak(); - // note: this will not affect the following section break - // but the one just pushed - dispatchFlag(RTF_SBKPAGE); - if (m_bNeedPar) - dispatchSymbol(RTF_PAR); - m_bIgnoreNextContSectBreak = true; - // arrange to clean up the synthetic RTF_SBKPAGE - m_nResetBreakOnSectBreak = RTF_SBKNONE; - } - else - { - checkFirstRun(); - checkNeedPap(); - sal_uInt8 const sBreak[] = { 0xc }; - Mapper().text(sBreak, 1); - if (!m_bNeedPap) + else { - parBreak(); - m_bNeedPap = true; + checkFirstRun(); + checkNeedPap(); + sal_uInt8 const sBreak[] = { 0xc }; + Mapper().text(sBreak, 1); + if (!m_bNeedPap) + { + parBreak(); + m_bNeedPap = true; + } + m_bNeedCr = true; } - m_bNeedCr = true; } - } - break; - case RTF_CHPGN: - { - OUString aStr("PAGE"); - singleChar(cFieldStart); - text(aStr); - singleChar(cFieldSep, true); - singleChar(cFieldEnd); - } - break; - case RTF_CHFTNSEP: - { - static const sal_Unicode uFtnEdnSep = 0x3; - Mapper().utext(reinterpret_cast<const sal_uInt8*>(&uFtnEdnSep), 1); - } - break; - default: - { - SAL_INFO("writerfilter.rtf", "TODO handle symbol '" << keywordToString(nKeyword) << "'"); - aSkip.setParsed(false); - } - break; + break; + case RTF_CHPGN: + { + OUString aStr("PAGE"); + singleChar(cFieldStart); + text(aStr); + singleChar(cFieldSep, true); + singleChar(cFieldEnd); + } + break; + case RTF_CHFTNSEP: + { + static const sal_Unicode uFtnEdnSep = 0x3; + Mapper().utext(reinterpret_cast<const sal_uInt8*>(&uFtnEdnSep), 1); + } + break; + default: + { + SAL_INFO("writerfilter.rtf", + "TODO handle symbol '" << keywordToString(nKeyword) << "'"); + aSkip.setParsed(false); + } + break; } return RTFError::OK; } diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 4ad0f3226e4c..daaf9a44b969 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -33,7 +33,6 @@ using namespace com::sun::star; namespace { - OUString getLODefaultLanguage() { OUString result(::officecfg::Office::Linguistic::General::DefaultLocale::get()); @@ -41,123 +40,118 @@ OUString getLODefaultLanguage() result = ::officecfg::Setup::L10N::ooSetupSystemLocale::get(); return result; } - } namespace writerfilter { - int getNumberFormat(int nParam) { - static const int aMap[] = - { - NS_ooxml::LN_Value_ST_NumberFormat_decimal, - NS_ooxml::LN_Value_ST_NumberFormat_upperRoman, - NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman, - NS_ooxml::LN_Value_ST_NumberFormat_upperLetter, - NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter, - NS_ooxml::LN_Value_ST_NumberFormat_ordinal, - NS_ooxml::LN_Value_ST_NumberFormat_cardinalText, - NS_ooxml::LN_Value_ST_NumberFormat_ordinalText, - NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec. - NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec. - NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital, - NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting, - NS_ooxml::LN_Value_ST_NumberFormat_aiueo, - NS_ooxml::LN_Value_ST_NumberFormat_iroha, - NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth, - NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth, - NS_ooxml::LN_Value_ST_NumberFormat_japaneseLegal, - NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand, - NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese, - NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth2, - NS_ooxml::LN_Value_ST_NumberFormat_aiueoFullWidth, - NS_ooxml::LN_Value_ST_NumberFormat_irohaFullWidth, - NS_ooxml::LN_Value_ST_NumberFormat_decimalZero, - NS_ooxml::LN_Value_ST_NumberFormat_bullet, - NS_ooxml::LN_Value_ST_NumberFormat_ganada, - NS_ooxml::LN_Value_ST_NumberFormat_chosung, - NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop, - NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen, - NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese, - NS_ooxml::LN_Value_ST_NumberFormat_ideographEnclosedCircle, - NS_ooxml::LN_Value_ST_NumberFormat_ideographTraditional, - NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiac, - NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiacTraditional, - NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting, - NS_ooxml::LN_Value_ST_NumberFormat_ideographLegalTraditional, - NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCountingThousand, - NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseDigital, - NS_ooxml::LN_Value_ST_NumberFormat_chineseCounting, - NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified, - NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand, - NS_ooxml::LN_Value_ST_NumberFormat_decimal, - NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital, - NS_ooxml::LN_Value_ST_NumberFormat_koreanCounting, - NS_ooxml::LN_Value_ST_NumberFormat_koreanLegal, - NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital2, - NS_ooxml::LN_Value_ST_NumberFormat_hebrew1, - NS_ooxml::LN_Value_ST_NumberFormat_arabicAlpha, - NS_ooxml::LN_Value_ST_NumberFormat_hebrew2, - NS_ooxml::LN_Value_ST_NumberFormat_arabicAbjad - }; + static const int aMap[] + = { NS_ooxml::LN_Value_ST_NumberFormat_decimal, + NS_ooxml::LN_Value_ST_NumberFormat_upperRoman, + NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman, + NS_ooxml::LN_Value_ST_NumberFormat_upperLetter, + NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter, + NS_ooxml::LN_Value_ST_NumberFormat_ordinal, + NS_ooxml::LN_Value_ST_NumberFormat_cardinalText, + NS_ooxml::LN_Value_ST_NumberFormat_ordinalText, + NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec. + NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec. + NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital, + NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting, + NS_ooxml::LN_Value_ST_NumberFormat_aiueo, + NS_ooxml::LN_Value_ST_NumberFormat_iroha, + NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth, + NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth, + NS_ooxml::LN_Value_ST_NumberFormat_japaneseLegal, + NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand, + NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese, + NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth2, + NS_ooxml::LN_Value_ST_NumberFormat_aiueoFullWidth, + NS_ooxml::LN_Value_ST_NumberFormat_irohaFullWidth, + NS_ooxml::LN_Value_ST_NumberFormat_decimalZero, + NS_ooxml::LN_Value_ST_NumberFormat_bullet, + NS_ooxml::LN_Value_ST_NumberFormat_ganada, + NS_ooxml::LN_Value_ST_NumberFormat_chosung, + NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop, + NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen, + NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese, + NS_ooxml::LN_Value_ST_NumberFormat_ideographEnclosedCircle, + NS_ooxml::LN_Value_ST_NumberFormat_ideographTraditional, + NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiac, + NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiacTraditional, + NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting, + NS_ooxml::LN_Value_ST_NumberFormat_ideographLegalTraditional, + NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCountingThousand, + NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseDigital, + NS_ooxml::LN_Value_ST_NumberFormat_chineseCounting, + NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified, + NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand, + NS_ooxml::LN_Value_ST_NumberFormat_decimal, + NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital, + NS_ooxml::LN_Value_ST_NumberFormat_koreanCounting, + NS_ooxml::LN_Value_ST_NumberFormat_koreanLegal, + NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital2, + NS_ooxml::LN_Value_ST_NumberFormat_hebrew1, + NS_ooxml::LN_Value_ST_NumberFormat_arabicAlpha, + NS_ooxml::LN_Value_ST_NumberFormat_hebrew2, + NS_ooxml::LN_Value_ST_NumberFormat_arabicAbjad }; const int nLen = SAL_N_ELEMENTS(aMap); int nValue = 0; if (nParam >= 0 && nParam < nLen) nValue = aMap[nParam]; - else // 255 and the other cases. + else // 255 and the other cases. nValue = NS_ooxml::LN_Value_ST_NumberFormat_none; return nValue; } namespace rtftok { - RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { setNeedSect(true); - checkUnicode(/*bUnicode =*/ nKeyword != RTF_U, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/nKeyword != RTF_U, /*bHex =*/true); RTFSkipDestination aSkip(*this); int nSprm = 0; auto pIntValue = std::make_shared<RTFValue>(nParam); // Trivial table sprms. switch (nKeyword) { - case RTF_LEVELJC: - { - nSprm = NS_ooxml::LN_CT_Lvl_lvlJc; - int nValue = 0; - switch (nParam) + case RTF_LEVELJC: { - case 0: - nValue = NS_ooxml::LN_Value_ST_Jc_left; + nSprm = NS_ooxml::LN_CT_Lvl_lvlJc; + int nValue = 0; + switch (nParam) + { + case 0: + nValue = NS_ooxml::LN_Value_ST_Jc_left; + break; + case 1: + nValue = NS_ooxml::LN_Value_ST_Jc_center; + break; + case 2: + nValue = NS_ooxml::LN_Value_ST_Jc_right; + break; + } + pIntValue = std::make_shared<RTFValue>(nValue); break; - case 1: - nValue = NS_ooxml::LN_Value_ST_Jc_center; + } + case RTF_LEVELNFC: + nSprm = NS_ooxml::LN_CT_Lvl_numFmt; + pIntValue = std::make_shared<RTFValue>(getNumberFormat(nParam)); break; - case 2: - nValue = NS_ooxml::LN_Value_ST_Jc_right; + case RTF_LEVELSTARTAT: + nSprm = NS_ooxml::LN_CT_Lvl_start; + break; + case RTF_LEVELPICTURE: + nSprm = NS_ooxml::LN_CT_Lvl_lvlPicBulletId; + break; + case RTF_SBASEDON: + nSprm = NS_ooxml::LN_CT_Style_basedOn; + pIntValue = std::make_shared<RTFValue>(getStyleName(nParam)); + break; + default: break; - } - pIntValue = std::make_shared<RTFValue>(nValue); - break; - } - case RTF_LEVELNFC: - nSprm = NS_ooxml::LN_CT_Lvl_numFmt; - pIntValue = std::make_shared<RTFValue>(getNumberFormat(nParam)); - break; - case RTF_LEVELSTARTAT: - nSprm = NS_ooxml::LN_CT_Lvl_start; - break; - case RTF_LEVELPICTURE: - nSprm = NS_ooxml::LN_CT_Lvl_lvlPicBulletId; - break; - case RTF_SBASEDON: - nSprm = NS_ooxml::LN_CT_Style_basedOn; - pIntValue = std::make_shared<RTFValue>(getStyleName(nParam)); - break; - default: - break; } if (nSprm > 0) { @@ -167,22 +161,24 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Trivial character sprms. switch (nKeyword) { - case RTF_FS: - case RTF_AFS: - nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH) - ? NS_ooxml::LN_EG_RPrBase_szCs : NS_ooxml::LN_EG_RPrBase_sz; - break; - case RTF_EXPNDTW: - nSprm = NS_ooxml::LN_EG_RPrBase_spacing; - break; - case RTF_KERNING: - nSprm = NS_ooxml::LN_EG_RPrBase_kern; - break; - case RTF_CHARSCALEX: - nSprm = NS_ooxml::LN_EG_RPrBase_w; - break; - default: - break; + case RTF_FS: + case RTF_AFS: + nSprm = (m_aStates.top().isRightToLeft + || m_aStates.top().eRunType == RTFParserState::RunType::HICH) + ? NS_ooxml::LN_EG_RPrBase_szCs + : NS_ooxml::LN_EG_RPrBase_sz; + break; + case RTF_EXPNDTW: + nSprm = NS_ooxml::LN_EG_RPrBase_spacing; + break; + case RTF_KERNING: + nSprm = NS_ooxml::LN_EG_RPrBase_kern; + break; + case RTF_CHARSCALEX: + nSprm = NS_ooxml::LN_EG_RPrBase_w; + break; + default: + break; } if (nSprm > 0) { @@ -192,46 +188,49 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Trivial character attributes. switch (nKeyword) { - case RTF_LANG: - case RTF_ALANG: - if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH) - { - nSprm = NS_ooxml::LN_CT_Language_bidi; - } - else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH) - { + case RTF_LANG: + case RTF_ALANG: + if (m_aStates.top().isRightToLeft + || m_aStates.top().eRunType == RTFParserState::RunType::HICH) + { + nSprm = NS_ooxml::LN_CT_Language_bidi; + } + else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH) + { + nSprm = NS_ooxml::LN_CT_Language_eastAsia; + } + else + { + assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH); + nSprm = NS_ooxml::LN_CT_Language_val; + } + break; + case RTF_LANGFE: // this one is always CJK apparently nSprm = NS_ooxml::LN_CT_Language_eastAsia; - } - else - { - assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH); - nSprm = NS_ooxml::LN_CT_Language_val; - } - break; - case RTF_LANGFE: // this one is always CJK apparently - nSprm = NS_ooxml::LN_CT_Language_eastAsia; - break; - default: - break; + break; + default: + break; } if (nSprm > 0) { LanguageTag aTag((LanguageType(nParam))); auto pValue = std::make_shared<RTFValue>(aTag.getBcp47()); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, pValue); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, + pValue); // Language is a character property, but we should store it at a paragraph level as well for fields. if (nKeyword == RTF_LANG && m_bNeedPap) - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, pValue); + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, + pValue); return RTFError::OK; } // Trivial paragraph sprms. switch (nKeyword) { - case RTF_ITAP: - nSprm = NS_ooxml::LN_tblDepth; - break; - default: - break; + case RTF_ITAP: + nSprm = NS_ooxml::LN_tblDepth; + break; + default: + break; } if (nSprm > 0) { @@ -252,38 +251,38 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Info group. switch (nKeyword) { - case RTF_YR: - { - m_aStates.top().nYear = nParam; - nSprm = 1; - } - break; - case RTF_MO: - { - m_aStates.top().nMonth = nParam; - nSprm = 1; - } - break; - case RTF_DY: - { - m_aStates.top().nDay = nParam; - nSprm = 1; - } - break; - case RTF_HR: - { - m_aStates.top().nHour = nParam; - nSprm = 1; - } - break; - case RTF_MIN: - { - m_aStates.top().nMinute = nParam; - nSprm = 1; - } - break; - default: + case RTF_YR: + { + m_aStates.top().nYear = nParam; + nSprm = 1; + } + break; + case RTF_MO: + { + m_aStates.top().nMonth = nParam; + nSprm = 1; + } + break; + case RTF_DY: + { + m_aStates.top().nDay = nParam; + nSprm = 1; + } break; + case RTF_HR: + { + m_aStates.top().nHour = nParam; + nSprm = 1; + } + break; + case RTF_MIN: + { + m_aStates.top().nMinute = nParam; + nSprm = 1; + } + break; + default: + break; } if (nSprm > 0) return RTFError::OK; @@ -292,26 +291,26 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) Id nId = 0; switch (nKeyword) { - case RTF_ABSW: - nId = NS_ooxml::LN_CT_FramePr_w; - break; - case RTF_ABSH: - nId = NS_ooxml::LN_CT_FramePr_h; + case RTF_ABSW: + nId = NS_ooxml::LN_CT_FramePr_w; + break; + case RTF_ABSH: + nId = NS_ooxml::LN_CT_FramePr_h; + break; + case RTF_POSX: + { + nId = NS_ooxml::LN_CT_FramePr_x; + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0); + } break; - case RTF_POSX: - { - nId = NS_ooxml::LN_CT_FramePr_x; - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0); - } - break; - case RTF_POSY: - { - nId = NS_ooxml::LN_CT_FramePr_y; - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); - } - break; - default: + case RTF_POSY: + { + nId = NS_ooxml::LN_CT_FramePr_y; + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); + } break; + default: + break; } if (nId > 0) @@ -327,1160 +326,1254 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Then check for the more complex ones. switch (nKeyword) { - case RTF_F: - case RTF_AF: - if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH) - { - nSprm = NS_ooxml::LN_CT_Fonts_cs; - } - else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH) + case RTF_F: + case RTF_AF: + if (m_aStates.top().isRightToLeft + || m_aStates.top().eRunType == RTFParserState::RunType::HICH) + { + nSprm = NS_ooxml::LN_CT_Fonts_cs; + } + else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH) + { + nSprm = NS_ooxml::LN_CT_Fonts_eastAsia; + } + else + { + assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH); + nSprm = NS_ooxml::LN_CT_Fonts_ascii; + } + if (m_aStates.top().eDestination == Destination::FONTTABLE + || m_aStates.top().eDestination == Destination::FONTENTRY) + { + m_aFontIndexes.push_back(nParam); + m_nCurrentFontIndex = getFontIndex(nParam); + } + else if (m_aStates.top().eDestination == Destination::LISTLEVEL) + { + RTFSprms aFontAttributes; + aFontAttributes.set(nSprm, + std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)])); + RTFSprms aRunPropsSprms; + aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, + std::make_shared<RTFValue>(aFontAttributes)); + m_aStates.top().aTableSprms.set( + NS_ooxml::LN_CT_Lvl_rPr, std::make_shared<RTFValue>(RTFSprms(), aRunPropsSprms), + RTFOverwrite::NO_APPEND); + } + else + { + m_nCurrentFontIndex = getFontIndex(nParam); + auto pValue = std::make_shared<RTFValue>(getFontName(m_nCurrentFontIndex)); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, + nSprm, pValue); + if (nKeyword == RTF_F) + m_aStates.top().nCurrentEncoding = getEncoding(m_nCurrentFontIndex); + } + break; + case RTF_RED: + m_aStates.top().aCurrentColor.nRed = nParam; + break; + case RTF_GREEN: + m_aStates.top().aCurrentColor.nGreen = nParam; + break; + case RTF_BLUE: + m_aStates.top().aCurrentColor.nBlue = nParam; + break; + case RTF_FCHARSET: { - nSprm = NS_ooxml::LN_CT_Fonts_eastAsia; + // we always send text to the domain mapper in OUString, so no + // need to send encoding info + int i; + for (i = 0; i < nRTFEncodings; i++) + { + if (aRTFEncodings[i].charset == nParam) + break; + } + if (i == nRTFEncodings) + // not found + return RTFError::OK; + + m_nCurrentEncoding + = aRTFEncodings[i].codepage == 0 // Default (CP_ACP) + ? osl_getThreadTextEncoding() + : rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage); + m_aStates.top().nCurrentEncoding = m_nCurrentEncoding; } - else + break; + case RTF_ANSICPG: + case RTF_CPG: { - assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH); - nSprm = NS_ooxml::LN_CT_Fonts_ascii; + rtl_TextEncoding nEncoding + = (nParam == 0) + ? utl_getWinTextEncodingFromLangStr(getLODefaultLanguage().toUtf8().getStr()) + : rtl_getTextEncodingFromWindowsCodePage(nParam); + if (nKeyword == RTF_ANSICPG) + m_aDefaultState.nCurrentEncoding = nEncoding; + else + m_nCurrentEncoding = nEncoding; + m_aStates.top().nCurrentEncoding = nEncoding; } - if (m_aStates.top().eDestination == Destination::FONTTABLE || m_aStates.top().eDestination == Destination::FONTENTRY) + break; + case RTF_CF: { - m_aFontIndexes.push_back(nParam); - m_nCurrentFontIndex = getFontIndex(nParam); + RTFSprms aAttributes; + auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); + aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color, + std::make_shared<RTFValue>(aAttributes)); } - else if (m_aStates.top().eDestination == Destination::LISTLEVEL) + break; + case RTF_S: { - RTFSprms aFontAttributes; - aFontAttributes.set(nSprm, std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)])); - RTFSprms aRunPropsSprms; - aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, std::make_shared<RTFValue>(aFontAttributes)); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, std::make_shared<RTFValue>(RTFSprms(), aRunPropsSprms), RTFOverwrite::NO_APPEND); + m_aStates.top().nCurrentStyleIndex = nParam; + + if (m_aStates.top().eDestination == Destination::STYLESHEET + || m_aStates.top().eDestination == Destination::STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, + pValue); // paragraph style + } + else + { + OUString aName = getStyleName(nParam); + if (!aName.isEmpty()) + { + if (m_aStates.top().eDestination == Destination::LISTLEVEL) + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_pStyle, + std::make_shared<RTFValue>(aName)); + else + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, + std::make_shared<RTFValue>(aName)); + } + } } - else + break; + case RTF_CS: + m_aStates.top().nCurrentCharacterStyleIndex = nParam; + if (m_aStates.top().eDestination == Destination::STYLESHEET + || m_aStates.top().eDestination == Destination::STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_character); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, + pValue); // character style + } + else + { + OUString aName = getStyleName(nParam); + if (!aName.isEmpty()) + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, + std::make_shared<RTFValue>(aName)); + } + break; + case RTF_DS: + if (m_aStates.top().eDestination == Destination::STYLESHEET + || m_aStates.top().eDestination == Destination::STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + auto pValue = std::make_shared<RTFValue>(0); // TODO no value in enum StyleType? + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, + pValue); // section style + } + break; + case RTF_TS: + if (m_aStates.top().eDestination == Destination::STYLESHEET + || m_aStates.top().eDestination == Destination::STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now + auto pValue = std::make_shared<RTFValue>(0); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, + pValue); // table style + } + break; + case RTF_DEFF: + m_nDefaultFontIndex = nParam; + break; + case RTF_DEFLANG: + case RTF_ADEFLANG: { - m_nCurrentFontIndex = getFontIndex(nParam); - auto pValue = std::make_shared<RTFValue>(getFontName(m_nCurrentFontIndex)); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, nSprm, pValue); - if (nKeyword == RTF_F) - m_aStates.top().nCurrentEncoding = getEncoding(m_nCurrentFontIndex); + LanguageTag aTag((LanguageType(nParam))); + auto pValue = std::make_shared<RTFValue>(aTag.getBcp47()); + putNestedAttribute(m_aStates.top().aCharacterSprms, + (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang + : NS_ooxml::LN_CT_Language_bidi), + nSprm, pValue); } break; - case RTF_RED: - m_aStates.top().aCurrentColor.nRed = nParam; - break; - case RTF_GREEN: - m_aStates.top().aCurrentColor.nGreen = nParam; - break; - case RTF_BLUE: - m_aStates.top().aCurrentColor.nBlue = nParam; - break; - case RTF_FCHARSET: - { - // we always send text to the domain mapper in OUString, so no - // need to send encoding info - int i; - for (i = 0; i < nRTFEncodings; i++) + case RTF_CHCBPAT: { - if (aRTFEncodings[i].charset == nParam) - break; + auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd, + NS_ooxml::LN_CT_Shd_fill, pValue); } - if (i == nRTFEncodings) - // not found - return RTFError::OK; - - m_nCurrentEncoding = aRTFEncodings[i].codepage == 0 // Default (CP_ACP) - ? osl_getThreadTextEncoding() - : rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage); - m_aStates.top().nCurrentEncoding = m_nCurrentEncoding; - } - break; - case RTF_ANSICPG: - case RTF_CPG: - { - rtl_TextEncoding nEncoding = (nParam == 0) ? - utl_getWinTextEncodingFromLangStr(getLODefaultLanguage().toUtf8().getStr()) : - rtl_getTextEncodingFromWindowsCodePage(nParam); - if (nKeyword == RTF_ANSICPG) - m_aDefaultState.nCurrentEncoding = nEncoding; - else - m_nCurrentEncoding = nEncoding; - m_aStates.top().nCurrentEncoding = nEncoding; - } - break; - case RTF_CF: - { - RTFSprms aAttributes; - auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); - aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color, std::make_shared<RTFValue>(aAttributes)); - } - break; - case RTF_S: - { - m_aStates.top().nCurrentStyleIndex = nParam; - - if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) + break; + case RTF_CLCBPAT: + case RTF_CLCBPATRAW: { - m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // paragraph style + auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); + putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, + NS_ooxml::LN_CT_Shd_fill, pValue); } - else - { - OUString aName = getStyleName(nParam); - if (!aName.isEmpty()) + break; + case RTF_CBPAT: + if (nParam) { - if (m_aStates.top().eDestination == Destination::LISTLEVEL) - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_pStyle, std::make_shared<RTFValue>(aName)); - else - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, std::make_shared<RTFValue>(aName)); - + auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, + NS_ooxml::LN_CT_Shd_fill, pValue); } - } - } - break; - case RTF_CS: - m_aStates.top().nCurrentCharacterStyleIndex = nParam; - if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) - { - m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_character); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // character style - } - else + break; + case RTF_ULC: { - OUString aName = getStyleName(nParam); - if (!aName.isEmpty()) - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, std::make_shared<RTFValue>(aName)); + auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); + m_aStates.top().aCharacterSprms.set(0x6877, pValue); } break; - case RTF_DS: - if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) + case RTF_HIGHLIGHT: { - m_nCurrentStyleIndex = nParam; - auto pValue = std::make_shared<RTFValue>(0); // TODO no value in enum StyleType? - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // section style + auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue); } break; - case RTF_TS: - if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) + case RTF_UP: + case RTF_DN: { - m_nCurrentStyleIndex = nParam; - // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now - auto pValue = std::make_shared<RTFValue>(0); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // table style + auto pValue = std::make_shared<RTFValue>(nParam * (nKeyword == RTF_UP ? 1 : -1)); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_position, pValue); } break; - case RTF_DEFF: - m_nDefaultFontIndex = nParam; - break; - case RTF_DEFLANG: - case RTF_ADEFLANG: - { - LanguageTag aTag((LanguageType(nParam))); - auto pValue = std::make_shared<RTFValue>(aTag.getBcp47()); - putNestedAttribute(m_aStates.top().aCharacterSprms, (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang : NS_ooxml::LN_CT_Language_bidi), nSprm, pValue); - } - break; - case RTF_CHCBPAT: - { - auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); - } - break; - case RTF_CLCBPAT: - case RTF_CLCBPATRAW: - { - auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); - putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); - } - break; - case RTF_CBPAT: - if (nParam) + case RTF_HORZVERT: { - auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); + auto pValue = std::make_shared<RTFValue>(int(true)); + m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue); + if (nParam) + // rotate fits to a single line + m_aStates.top().aCharacterAttributes.set( + NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue); } break; - case RTF_ULC: - { - auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); - m_aStates.top().aCharacterSprms.set(0x6877, pValue); - } - break; - case RTF_HIGHLIGHT: - { - auto pValue = std::make_shared<RTFValue>(nParam ? getColorTable(nParam) : COL_AUTO); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue); - } - break; - case RTF_UP: - case RTF_DN: - { - auto pValue = std::make_shared<RTFValue>(nParam * (nKeyword == RTF_UP ? 1 : -1)); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_position, pValue); - } - break; - case RTF_HORZVERT: - { - auto pValue = std::make_shared<RTFValue>(int(true)); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue); - if (nParam) - // rotate fits to a single line - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue); - } - break; - case RTF_EXPND: - { - auto pValue = std::make_shared<RTFValue>(nParam/5); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_spacing, pValue); - } - break; - case RTF_TWOINONE: - { - auto pValue = std::make_shared<RTFValue>(int(true)); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, pValue); - nId = 0; - switch (nParam) + case RTF_EXPND: { - case 0: - nId = NS_ooxml::LN_Value_ST_CombineBrackets_none; - break; - case 1: - nId = NS_ooxml::LN_Value_ST_CombineBrackets_round; - break; - case 2: - nId = NS_ooxml::LN_Value_ST_CombineBrackets_square; - break; - case 3: - nId = NS_ooxml::LN_Value_ST_CombineBrackets_angle; - break; - case 4: - nId = NS_ooxml::LN_Value_ST_CombineBrackets_curly; - break; + auto pValue = std::make_shared<RTFValue>(nParam / 5); + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_spacing, pValue); } - if (nId > 0) - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, std::make_shared<RTFValue>(nId)); - } - break; - case RTF_SL: - { - // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'. - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast); - if (nParam < 0) + break; + case RTF_TWOINONE: { - pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact); - pIntValue = std::make_shared<RTFValue>(-nParam); + auto pValue = std::make_shared<RTFValue>(int(true)); + m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, + pValue); + nId = 0; + switch (nParam) + { + case 0: + nId = NS_ooxml::LN_Value_ST_CombineBrackets_none; + break; + case 1: + nId = NS_ooxml::LN_Value_ST_CombineBrackets_round; + break; + case 2: + nId = NS_ooxml::LN_Value_ST_CombineBrackets_square; + break; + case 3: + nId = NS_ooxml::LN_Value_ST_CombineBrackets_angle; + break; + case 4: + nId = NS_ooxml::LN_Value_ST_CombineBrackets_curly; + break; + } + if (nId > 0) + m_aStates.top().aCharacterAttributes.set( + NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, + std::make_shared<RTFValue>(nId)); } - m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); - m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue); - } - break; - case RTF_SLMULT: - if (nParam > 0) + break; + case RTF_SL: { - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto); + // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'. + auto pValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast); + if (nParam < 0) + { + pValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact); + pIntValue = std::make_shared<RTFValue>(-nParam); + } m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); + m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue); } break; - case RTF_BRDRW: - { - // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0 - if (nParam > 1) - nParam = nParam * 2 / 5; - auto pValue = std::make_shared<RTFValue>(nParam); - putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue); - } - break; - case RTF_BRDRCF: - { - auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); - putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue); - } - break; - case RTF_BRSP: - { - // dmapper expects it in points, we have it in twip - auto pValue = std::make_shared<RTFValue>(nParam / 20); - putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_space, pValue); - } - break; - case RTF_TX: - { - m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aTabAttributes); - if (m_aStates.top().eDestination == Destination::LISTLEVEL) - putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); - else - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); - m_aStates.top().aTabAttributes.clear(); - } - break; - case RTF_ILVL: - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIntValue); + case RTF_SLMULT: + if (nParam > 0) + { + auto pValue + = std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto); + m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); + } + break; + case RTF_BRDRW: + { + // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0 + if (nParam > 1) + nParam = nParam * 2 / 5; + auto pValue = std::make_shared<RTFValue>(nParam); + putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue); + } break; - case RTF_LISTTEMPLATEID: - // This one is not referenced anywhere, so it's pointless to store it at the moment. + case RTF_BRDRCF: + { + auto pValue = std::make_shared<RTFValue>(getColorTable(nParam)); + putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue); + } break; - case RTF_LISTID: - { - if (m_aStates.top().eDestination == Destination::LISTENTRY) - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIntValue); - else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue); - } - break; - case RTF_LS: - { - if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue); - else - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_numId, pIntValue); - } - break; - case RTF_UC: - if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) - m_aStates.top().nUc = nParam; + case RTF_BRSP: + { + // dmapper expects it in points, we have it in twip + auto pValue = std::make_shared<RTFValue>(nParam / 20); + putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_space, pValue); + } break; - case RTF_U: - // sal_Unicode is unsigned 16-bit, RTF may represent that as a - // signed SAL_MIN_INT16..SAL_MAX_INT16 or 0..SAL_MAX_UINT16. The - // static_cast() will do the right thing. - if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16)) + case RTF_TX: { - if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) - { - if (nParam != ';') - m_aStates.top().aLevelNumbers.push_back(sal_Int32(nParam)); - else - // ';' in \u form is not considered valid. - m_aStates.top().bLevelNumbersValid = false; - } + m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aTabAttributes); + if (m_aStates.top().eDestination == Destination::LISTLEVEL) + putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, + NS_ooxml::LN_CT_Tabs_tab, pValue); else - m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam)); - m_aStates.top().nCharsToSkip = m_aStates.top().nUc; + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, + NS_ooxml::LN_CT_Tabs_tab, pValue); + m_aStates.top().aTabAttributes.clear(); } break; - case RTF_LEVELFOLLOW: - { - OUString sValue; - switch (nParam) - { - case 0: - sValue = "tab"; - break; - case 1: - sValue = "space"; + case RTF_ILVL: + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + NS_ooxml::LN_CT_NumPr_ilvl, pIntValue); break; - case 2: - sValue = "nothing"; + case RTF_LISTTEMPLATEID: + // This one is not referenced anywhere, so it's pointless to store it at the moment. break; + case RTF_LISTID: + { + if (m_aStates.top().eDestination == Destination::LISTENTRY) + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, + pIntValue); + else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue); } - if (!sValue.isEmpty()) - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, std::make_shared<RTFValue>(sValue)); - } - break; - case RTF_FPRQ: - { - sal_Int32 nValue = 0; - switch (nParam) + break; + case RTF_LS: { - case 0: - nValue = NS_ooxml::LN_Value_ST_Pitch_default; - break; - case 1: - nValue = NS_ooxml::LN_Value_ST_Pitch_fixed; + if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue); + else + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + NS_ooxml::LN_CT_NumPr_numId, pIntValue); + } + break; + case RTF_UC: + if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) + m_aStates.top().nUc = nParam; break; - case 2: - nValue = NS_ooxml::LN_Value_ST_Pitch_variable; + case RTF_U: + // sal_Unicode is unsigned 16-bit, RTF may represent that as a + // signed SAL_MIN_INT16..SAL_MAX_INT16 or 0..SAL_MAX_UINT16. The + // static_cast() will do the right thing. + if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16)) + { + if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) + { + if (nParam != ';') + m_aStates.top().aLevelNumbers.push_back(sal_Int32(nParam)); + else + // ';' in \u form is not considered valid. + m_aStates.top().bLevelNumbersValid = false; + } + else + m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam)); + m_aStates.top().nCharsToSkip = m_aStates.top().nUc; + } break; - } - if (nValue) + case RTF_LEVELFOLLOW: { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_Pitch_val, std::make_shared<RTFValue>(nValue)); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_pitch, std::make_shared<RTFValue>(aAttributes)); + OUString sValue; + switch (nParam) + { + case 0: + sValue = "tab"; + break; + case 1: + sValue = "space"; + break; + case 2: + sValue = "nothing"; + break; + } + if (!sValue.isEmpty()) + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, + std::make_shared<RTFValue>(sValue)); } - } - break; - case RTF_LISTOVERRIDECOUNT: - // Ignore this for now, the exporter always emits it with a zero parameter. - break; - case RTF_PICSCALEX: - m_aStates.top().aPicture.nScaleX = nParam; - break; - case RTF_PICSCALEY: - m_aStates.top().aPicture.nScaleY = nParam; - break; - case RTF_PICW: - m_aStates.top().aPicture.nWidth = nParam; break; - case RTF_PICH: - m_aStates.top().aPicture.nHeight = nParam; - break; - case RTF_PICWGOAL: - m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam); - break; - case RTF_PICHGOAL: - m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam); - break; - case RTF_PICCROPL: - m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam); - break; - case RTF_PICCROPR: - m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam); - break; - case RTF_PICCROPT: - m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam); - break; - case RTF_PICCROPB: - m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam); - break; - case RTF_SHPWRK: - { - int nValue = 0; - switch (nParam) + case RTF_FPRQ: { - case 0: - nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides; + sal_Int32 nValue = 0; + switch (nParam) + { + case 0: + nValue = NS_ooxml::LN_Value_ST_Pitch_default; + break; + case 1: + nValue = NS_ooxml::LN_Value_ST_Pitch_fixed; + break; + case 2: + nValue = NS_ooxml::LN_Value_ST_Pitch_variable; + break; + } + if (nValue) + { + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_Pitch_val, std::make_shared<RTFValue>(nValue)); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_pitch, + std::make_shared<RTFValue>(aAttributes)); + } + } + break; + case RTF_LISTOVERRIDECOUNT: + // Ignore this for now, the exporter always emits it with a zero parameter. break; - case 1: - nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left; + case RTF_PICSCALEX: + m_aStates.top().aPicture.nScaleX = nParam; break; - case 2: - nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right; + case RTF_PICSCALEY: + m_aStates.top().aPicture.nScaleY = nParam; break; - case 3: - nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest; + case RTF_PICW: + m_aStates.top().aPicture.nWidth = nParam; break; - default: + case RTF_PICH: + m_aStates.top().aPicture.nHeight = nParam; break; - } - auto pValue = std::make_shared<RTFValue>(nValue); - RTFValue::Pointer_t pTight = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_WrapType_wrapTight); - if (pTight) - pTight->getAttributes().set(NS_ooxml::LN_CT_WrapTight_wrapText, pValue); - else - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, pValue); - } - break; - case RTF_SHPWR: - { - switch (nParam) - { - case 1: - m_aStates.top().aShape.nWrap = text::WrapTextMode_NONE; + case RTF_PICWGOAL: + m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam); break; - case 2: - m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL; + case RTF_PICHGOAL: + m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam); break; - case 3: - m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, std::make_shared<RTFValue>()); + case RTF_PICCROPL: + m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam); break; - case 4: - m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL; - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapTight, std::make_shared<RTFValue>()); + case RTF_PICCROPR: + m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam); break; - case 5: - m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; + case RTF_PICCROPT: + m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam); break; - } - } - break; - case RTF_CELLX: - { - int& rCurrentCellX((Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) ? m_nNestedCurrentCellX : m_nTopLevelCurrentCellX); - int nCellX = nParam - rCurrentCellX; - const int COL_DFLT_WIDTH = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells. - if (!nCellX) - nCellX = COL_DFLT_WIDTH; - - // If there is a negative left margin, then the first cellx is relative to that. - RTFValue::Pointer_t pTblInd = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd); - if (rCurrentCellX == 0 && pTblInd.get()) + case RTF_PICCROPB: + m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam); + break; + case RTF_SHPWRK: { - RTFValue::Pointer_t pWidth = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w); - if (pWidth.get() && pWidth->getInt() < 0) - nCellX = -1 * (pWidth->getInt() - nParam); + int nValue = 0; + switch (nParam) + { + case 0: + nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides; + break; + case 1: + nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left; + break; + case 2: + nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right; + break; + case 3: + nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest; + break; + default: + break; + } + auto pValue = std::make_shared<RTFValue>(nValue); + RTFValue::Pointer_t pTight + = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_WrapType_wrapTight); + if (pTight) + pTight->getAttributes().set(NS_ooxml::LN_CT_WrapTight_wrapText, pValue); + else + m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, + pValue); } - - rCurrentCellX = nParam; - auto pXValue = std::make_shared<RTFValue>(nCellX); - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); - if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) + break; + case RTF_SHPWR: { - m_nNestedCells++; - // Push cell properties. - m_aNestedTableCellsSprms.push_back( - m_aStates.top().aTableCellSprms); - m_aNestedTableCellsAttributes.push_back( - m_aStates.top().aTableCellAttributes); + switch (nParam) + { + case 1: + m_aStates.top().aShape.nWrap = text::WrapTextMode_NONE; + break; + case 2: + m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL; + break; + case 3: + m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, + std::make_shared<RTFValue>()); + break; + case 4: + m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL; + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapTight, + std::make_shared<RTFValue>()); + break; + case 5: + m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH; + break; + } } - else + break; + case RTF_CELLX: { - m_nTopLevelCells++; - // Push cell properties. - m_aTopLevelTableCellsSprms.push_back( - m_aStates.top().aTableCellSprms); - m_aTopLevelTableCellsAttributes.push_back( - m_aStates.top().aTableCellAttributes); - } + int& rCurrentCellX((Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) + ? m_nNestedCurrentCellX + : m_nTopLevelCurrentCellX); + int nCellX = nParam - rCurrentCellX; + const int COL_DFLT_WIDTH + = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells. + if (!nCellX) + nCellX = COL_DFLT_WIDTH; - m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; - // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token - dispatchFlag(RTF_INTBL); - if (!m_nCellxMax) - { - // Wasn't in table, but now is -> tblStart. - RTFSprms aAttributes; - RTFSprms aSprms; - aSprms.set(NS_ooxml::LN_tblStart, std::make_shared<RTFValue>(1)); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); - Mapper().props(pProperties); + // If there is a negative left margin, then the first cellx is relative to that. + RTFValue::Pointer_t pTblInd + = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd); + if (rCurrentCellX == 0 && pTblInd.get()) + { + RTFValue::Pointer_t pWidth + = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w); + if (pWidth.get() && pWidth->getInt() < 0) + nCellX = -1 * (pWidth->getInt() - nParam); + } + + rCurrentCellX = nParam; + auto pXValue = std::make_shared<RTFValue>(nCellX); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, + RTFOverwrite::NO_APPEND); + if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) + { + m_nNestedCells++; + // Push cell properties. + m_aNestedTableCellsSprms.push_back(m_aStates.top().aTableCellSprms); + m_aNestedTableCellsAttributes.push_back(m_aStates.top().aTableCellAttributes); + } + else + { + m_nTopLevelCells++; + // Push cell properties. + m_aTopLevelTableCellsSprms.push_back(m_aStates.top().aTableCellSprms); + m_aTopLevelTableCellsAttributes.push_back(m_aStates.top().aTableCellAttributes); + } + + m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; + m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token + dispatchFlag(RTF_INTBL); + if (!m_nCellxMax) + { + // Wasn't in table, but now is -> tblStart. + RTFSprms aAttributes; + RTFSprms aSprms; + aSprms.set(NS_ooxml::LN_tblStart, std::make_shared<RTFValue>(1)); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + Mapper().props(pProperties); + } + m_nCellxMax = std::max(m_nCellxMax, nParam); } - m_nCellxMax = std::max(m_nCellxMax, nParam); - } - break; - case RTF_TRRH: - { - OUString hRule("auto"); - if (nParam < 0) + break; + case RTF_TRRH: { - auto pAbsValue = std::make_shared<RTFValue>(-nParam); - pIntValue.swap(pAbsValue); + OUString hRule("auto"); + if (nParam < 0) + { + auto pAbsValue = std::make_shared<RTFValue>(-nParam); + pIntValue.swap(pAbsValue); - hRule = "exact"; - } - else if (nParam > 0) - hRule = "atLeast"; + hRule = "exact"; + } + else if (nParam > 0) + hRule = "atLeast"; - putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_val, pIntValue); + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, + NS_ooxml::LN_CT_Height_val, pIntValue); - auto pHRule = std::make_shared<RTFValue>(hRule); - putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_hRule, pHRule); - } - break; - case RTF_TRLEFT: - { - // the value is in twips - putNestedAttribute(m_aStates.top().aTableRowSprms, - NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_type, - std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - putNestedAttribute(m_aStates.top().aTableRowSprms, - NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_w, - std::make_shared<RTFValue>(nParam)); - } - break; - case RTF_COLS: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_num, pIntValue); - break; - case RTF_COLSX: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_space, pIntValue); - break; - case RTF_COLNO: - putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_col, pIntValue); - break; - case RTF_COLW: - case RTF_COLSR: - { - RTFSprms& rAttributes = getLastAttributes(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols); - rAttributes.set((nKeyword == RTF_COLW ? NS_ooxml::LN_CT_Column_w : NS_ooxml::LN_CT_Column_space), pIntValue); - } - break; - case RTF_PAPERH: - putNestedAttribute(m_aDefaultState.aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_PGHSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue); - break; - case RTF_PAPERW: - putNestedAttribute(m_aDefaultState.aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_PGWSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue); - break; - case RTF_MARGL: - putNestedAttribute(m_aDefaultState.aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_MARGLSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue); - break; - case RTF_MARGR: - putNestedAttribute(m_aDefaultState.aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_MARGRSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue); - break; - case RTF_MARGT: - putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_MARGTSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue); - break; - case RTF_MARGB: - putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue); - SAL_FALLTHROUGH; // set the default + current value - case RTF_MARGBSXN: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue); - break; - case RTF_HEADERY: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_header, pIntValue); - break; - case RTF_FOOTERY: - putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_footer, pIntValue); + auto pHRule = std::make_shared<RTFValue>(hRule); + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TrPrBase_trHeight, + NS_ooxml::LN_CT_Height_hRule, pHRule); + } break; - case RTF_DEFTAB: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue); + case RTF_TRLEFT: + { + // the value is in twips + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblInd, + NS_ooxml::LN_CT_TblWidth_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblInd, + NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + } break; - case RTF_LINEMOD: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_countBy, pIntValue); + case RTF_COLS: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, + NS_ooxml::LN_CT_Columns_num, pIntValue); + break; + case RTF_COLSX: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, + NS_ooxml::LN_CT_Columns_space, pIntValue); + break; + case RTF_COLNO: + putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, + NS_ooxml::LN_CT_Columns_col, pIntValue); + break; + case RTF_COLW: + case RTF_COLSR: + { + RTFSprms& rAttributes = getLastAttributes(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_cols); + rAttributes.set( + (nKeyword == RTF_COLW ? NS_ooxml::LN_CT_Column_w : NS_ooxml::LN_CT_Column_space), + pIntValue); + } break; - case RTF_LINEX: - if (nParam) + case RTF_PAPERH: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_h, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_PGHSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_h, pIntValue); + break; + case RTF_PAPERW: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_w, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_PGWSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, + NS_ooxml::LN_CT_PageSz_w, pIntValue); + break; + case RTF_MARGL: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_left, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_MARGLSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_left, pIntValue); + break; + case RTF_MARGR: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_right, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_MARGRSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_right, pIntValue); + break; + case RTF_MARGT: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_top, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_MARGTSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_top, pIntValue); + break; + case RTF_MARGB: + putNestedAttribute(m_aDefaultState.aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_bottom, pIntValue); + SAL_FALLTHROUGH; // set the default + current value + case RTF_MARGBSXN: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_bottom, pIntValue); + break; + case RTF_HEADERY: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_header, pIntValue); + break; + case RTF_FOOTERY: + putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgMar, + NS_ooxml::LN_CT_PageMar_footer, pIntValue); + break; + case RTF_DEFTAB: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue); + break; + case RTF_LINEMOD: putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance, pIntValue); - break; - case RTF_LINESTARTS: - putNestedAttribute(m_aStates.top().aSectionSprms, - NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_start, pIntValue); - break; - case RTF_REVAUTH: - case RTF_REVAUTHDEL: - { - auto pValue = std::make_shared<RTFValue>(m_aAuthors[nParam]); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_author, pValue); - } - break; - case RTF_REVDTTM: - case RTF_REVDTTMDEL: - { - OUString aStr(OStringToOUString(DTTM22OString(nParam), m_aStates.top().nCurrentEncoding)); - auto pValue = std::make_shared<RTFValue>(aStr); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue); - } - break; - case RTF_SHPLEFT: - m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam); - break; - case RTF_SHPTOP: - m_aStates.top().aShape.nTop = convertTwipToMm100(nParam); - break; - case RTF_SHPRIGHT: - m_aStates.top().aShape.nRight = convertTwipToMm100(nParam); - break; - case RTF_SHPBOTTOM: - m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam); - break; - case RTF_SHPZ: - m_aStates.top().aShape.oZ.reset(nParam); - break; - case RTF_FFTYPE: - switch (nParam) - { - case 0: - m_nFormFieldType = RTFFormFieldType::TEXT; + NS_ooxml::LN_EG_SectPrContents_lnNumType, + NS_ooxml::LN_CT_LineNumber_countBy, pIntValue); break; - case 1: - m_nFormFieldType = RTFFormFieldType::CHECKBOX; + case RTF_LINEX: + if (nParam) + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, + NS_ooxml::LN_CT_LineNumber_distance, pIntValue); break; - case 2: - m_nFormFieldType = RTFFormFieldType::LIST; - break; - default: - m_nFormFieldType = RTFFormFieldType::NONE; + case RTF_LINESTARTS: + putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, + NS_ooxml::LN_CT_LineNumber_start, pIntValue); break; + case RTF_REVAUTH: + case RTF_REVAUTHDEL: + { + auto pValue = std::make_shared<RTFValue>(m_aAuthors[nParam]); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, + NS_ooxml::LN_CT_TrackChange_author, pValue); } break; - case RTF_FFDEFRES: - if (m_nFormFieldType == RTFFormFieldType::CHECKBOX) - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_default, pIntValue); - else if (m_nFormFieldType == RTFFormFieldType::LIST) - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_default, pIntValue); - break; - case RTF_FFRES: - // 25 means undefined, see [MS-DOC] 2.9.79, FFDataBits. - if (m_nFormFieldType == RTFFormFieldType::CHECKBOX && nParam != 25) - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_checked, pIntValue); - else if (m_nFormFieldType == RTFFormFieldType::LIST) - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_result, pIntValue); - break; - case RTF_EDMINS: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setEditingDuration(nParam); - break; - case RTF_NOFPAGES: - case RTF_NOFWORDS: - case RTF_NOFCHARS: - case RTF_NOFCHARSWS: - if (m_xDocumentProperties.is()) + case RTF_REVDTTM: + case RTF_REVDTTMDEL: { - comphelper::SequenceAsHashMap aSeq = m_xDocumentProperties->getDocumentStatistics(); - OUString aName; - switch (nKeyword) - { - case RTF_NOFPAGES: - aName = "PageCount"; - nParam = 99; - break; - case RTF_NOFWORDS: - aName = "WordCount"; - break; - case RTF_NOFCHARS: - aName = "CharacterCount"; - break; - case RTF_NOFCHARSWS: - aName = "NonWhitespaceCharacterCount"; - break; - default: - break; - } - if (!aName.isEmpty()) - { - aSeq[aName] <<= sal_Int32(nParam); - m_xDocumentProperties->setDocumentStatistics(aSeq.getAsConstNamedValueList()); - } + OUString aStr( + OStringToOUString(DTTM22OString(nParam), m_aStates.top().nCurrentEncoding)); + auto pValue = std::make_shared<RTFValue>(aStr); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, + NS_ooxml::LN_CT_TrackChange_date, pValue); } break; - case RTF_VERSION: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setEditingCycles(nParam); - break; - case RTF_VERN: - // Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers. - break; - case RTF_FTNSTART: - putNestedSprm(m_aDefaultState.aParagraphSprms, - NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); - break; - case RTF_AFTNSTART: - putNestedSprm(m_aDefaultState.aParagraphSprms, - NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); - break; - case RTF_DFRMTXTX: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam); - break; - case RTF_DFRMTXTY: - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam); - break; - case RTF_DXFRTEXT: - { - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam); - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam); - } - break; - case RTF_FLYVERT: - { - RTFVertOrient aVertOrient(nParam); - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign()); - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, aVertOrient.GetAnchor()); - } - break; - case RTF_FLYHORZ: - { - RTFHoriOrient aHoriOrient(nParam); - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign()); - m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, aHoriOrient.GetAnchor()); - } - break; - case RTF_FLYANCHOR: - m_aStates.top().aFrame.m_nAnchorType = nParam; - break; - case RTF_WMETAFILE: - m_aStates.top().aPicture.eWMetafile = nParam; - break; - case RTF_SB: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before, pIntValue); - break; - case RTF_SA: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue); - break; - case RTF_DPX: - m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam); - break; - case RTF_DPY: - m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam); - break; - case RTF_DPXSIZE: - m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam); - break; - case RTF_DPYSIZE: - m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam); - break; - case RTF_PNSTART: - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue); - break; - case RTF_PNF: - { - auto pValue = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)]); - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, pValue); - putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_ooxml::LN_EG_RPrBase_rFonts, std::make_shared<RTFValue>(aAttributes)); - } - break; - case RTF_VIEWSCALE: - m_aSettingsTableAttributes.set(NS_ooxml::LN_CT_Zoom_percent, pIntValue); - break; - case RTF_BIN: - { - m_aStates.top().nInternalState = RTFInternalState::BIN; - m_aStates.top().nBinaryToRead = nParam; - } - break; - case RTF_DPLINECOR: - m_aStates.top().aDrawingObject.nLineColorR = nParam; - m_aStates.top().aDrawingObject.bHasLineColor = true; - break; - case RTF_DPLINECOG: - m_aStates.top().aDrawingObject.nLineColorG = nParam; - m_aStates.top().aDrawingObject.bHasLineColor = true; - break; - case RTF_DPLINECOB: - m_aStates.top().aDrawingObject.nLineColorB = nParam; - m_aStates.top().aDrawingObject.bHasLineColor = true; - break; - case RTF_DPFILLBGCR: - m_aStates.top().aDrawingObject.nFillColorR = nParam; - m_aStates.top().aDrawingObject.bHasFillColor = true; - break; - case RTF_DPFILLBGCG: - m_aStates.top().aDrawingObject.nFillColorG = nParam; - m_aStates.top().aDrawingObject.bHasFillColor = true; - break; - case RTF_DPFILLBGCB: - m_aStates.top().aDrawingObject.nFillColorB = nParam; - m_aStates.top().aDrawingObject.bHasFillColor = true; - break; - case RTF_CLSHDNG: - { - int nValue = -1; - switch (nParam) - { - case 500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct5; + case RTF_SHPLEFT: + m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam); break; - case 1000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct10; + case RTF_SHPTOP: + m_aStates.top().aShape.nTop = convertTwipToMm100(nParam); break; - case 1200: - nValue = NS_ooxml::LN_Value_ST_Shd_pct12; + case RTF_SHPRIGHT: + m_aStates.top().aShape.nRight = convertTwipToMm100(nParam); break; - case 1500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct15; + case RTF_SHPBOTTOM: + m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam); break; - case 2000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct20; + case RTF_SHPZ: + m_aStates.top().aShape.oZ.reset(nParam); break; - case 2500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct25; - break; - case 3000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct30; + case RTF_FFTYPE: + switch (nParam) + { + case 0: + m_nFormFieldType = RTFFormFieldType::TEXT; + break; + case 1: + m_nFormFieldType = RTFFormFieldType::CHECKBOX; + break; + case 2: + m_nFormFieldType = RTFFormFieldType::LIST; + break; + default: + m_nFormFieldType = RTFFormFieldType::NONE; + break; + } break; - case 3500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct35; + case RTF_FFDEFRES: + if (m_nFormFieldType == RTFFormFieldType::CHECKBOX) + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_default, pIntValue); + else if (m_nFormFieldType == RTFFormFieldType::LIST) + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_default, pIntValue); + break; + case RTF_FFRES: + // 25 means undefined, see [MS-DOC] 2.9.79, FFDataBits. + if (m_nFormFieldType == RTFFormFieldType::CHECKBOX && nParam != 25) + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_checked, pIntValue); + else if (m_nFormFieldType == RTFFormFieldType::LIST) + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_result, pIntValue); + break; + case RTF_EDMINS: + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setEditingDuration(nParam); + break; + case RTF_NOFPAGES: + case RTF_NOFWORDS: + case RTF_NOFCHARS: + case RTF_NOFCHARSWS: + if (m_xDocumentProperties.is()) + { + comphelper::SequenceAsHashMap aSeq = m_xDocumentProperties->getDocumentStatistics(); + OUString aName; + switch (nKeyword) + { + case RTF_NOFPAGES: + aName = "PageCount"; + nParam = 99; + break; + case RTF_NOFWORDS: + aName = "WordCount"; + break; + case RTF_NOFCHARS: + aName = "CharacterCount"; + break; + case RTF_NOFCHARSWS: + aName = "NonWhitespaceCharacterCount"; + break; + default: + break; + } + if (!aName.isEmpty()) + { + aSeq[aName] <<= sal_Int32(nParam); + m_xDocumentProperties->setDocumentStatistics(aSeq.getAsConstNamedValueList()); + } + } break; - case 3700: - nValue = NS_ooxml::LN_Value_ST_Shd_pct37; + case RTF_VERSION: + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setEditingCycles(nParam); break; - case 4000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct40; + case RTF_VERN: + // Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers. break; - case 4500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct45; + case RTF_FTNSTART: + putNestedSprm(m_aDefaultState.aParagraphSprms, + NS_ooxml::LN_EG_SectPrContents_footnotePr, + NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); break; - case 5000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct50; + case RTF_AFTNSTART: + putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, + NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); break; - case 5500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct55; + case RTF_DFRMTXTX: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam); break; - case 6000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct60; + case RTF_DFRMTXTY: + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam); break; - case 6200: - nValue = NS_ooxml::LN_Value_ST_Shd_pct62; + case RTF_DXFRTEXT: + { + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam); + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam); + } + break; + case RTF_FLYVERT: + { + RTFVertOrient aVertOrient(nParam); + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign()); + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, + aVertOrient.GetAnchor()); + } + break; + case RTF_FLYHORZ: + { + RTFHoriOrient aHoriOrient(nParam); + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign()); + m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, + aHoriOrient.GetAnchor()); + } + break; + case RTF_FLYANCHOR: + m_aStates.top().aFrame.m_nAnchorType = nParam; break; - case 6500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct65; + case RTF_WMETAFILE: + m_aStates.top().aPicture.eWMetafile = nParam; break; - case 7000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct70; + case RTF_SB: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + NS_ooxml::LN_CT_Spacing_before, pIntValue); break; - case 7500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct75; + case RTF_SA: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + NS_ooxml::LN_CT_Spacing_after, pIntValue); break; - case 8000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct80; + case RTF_DPX: + m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam); break; - case 8500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct85; + case RTF_DPY: + m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam); break; - case 8700: - nValue = NS_ooxml::LN_Value_ST_Shd_pct87; + case RTF_DPXSIZE: + m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam); break; - case 9000: - nValue = NS_ooxml::LN_Value_ST_Shd_pct90; + case RTF_DPYSIZE: + m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam); break; - case 9500: - nValue = NS_ooxml::LN_Value_ST_Shd_pct95; + case RTF_PNSTART: + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue); break; - default: + case RTF_PNF: + { + auto pValue = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(nParam)]); + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, pValue); + putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, + NS_ooxml::LN_EG_RPrBase_rFonts, std::make_shared<RTFValue>(aAttributes)); + } + break; + case RTF_VIEWSCALE: + m_aSettingsTableAttributes.set(NS_ooxml::LN_CT_Zoom_percent, pIntValue); break; + case RTF_BIN: + { + m_aStates.top().nInternalState = RTFInternalState::BIN; + m_aStates.top().nBinaryToRead = nParam; } - if (nValue != -1) - putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_val, std::make_shared<RTFValue>(nValue)); - } - break; - case RTF_DODHGT: - m_aStates.top().aDrawingObject.nDhgt = nParam; break; - case RTF_DPPOLYCOUNT: - if (nParam >= 0) + case RTF_DPLINECOR: + m_aStates.top().aDrawingObject.nLineColorR = nParam; + m_aStates.top().aDrawingObject.bHasLineColor = true; + break; + case RTF_DPLINECOG: + m_aStates.top().aDrawingObject.nLineColorG = nParam; + m_aStates.top().aDrawingObject.bHasLineColor = true; + break; + case RTF_DPLINECOB: + m_aStates.top().aDrawingObject.nLineColorB = nParam; + m_aStates.top().aDrawingObject.bHasLineColor = true; + break; + case RTF_DPFILLBGCR: + m_aStates.top().aDrawingObject.nFillColorR = nParam; + m_aStates.top().aDrawingObject.bHasFillColor = true; + break; + case RTF_DPFILLBGCG: + m_aStates.top().aDrawingObject.nFillColorG = nParam; + m_aStates.top().aDrawingObject.bHasFillColor = true; + break; + case RTF_DPFILLBGCB: + m_aStates.top().aDrawingObject.nFillColorB = nParam; + m_aStates.top().aDrawingObject.bHasFillColor = true; + break; + case RTF_CLSHDNG: { - m_aStates.top().aDrawingObject.nPolyLineCount = nParam; + int nValue = -1; + switch (nParam) + { + case 500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct5; + break; + case 1000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct10; + break; + case 1200: + nValue = NS_ooxml::LN_Value_ST_Shd_pct12; + break; + case 1500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct15; + break; + case 2000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct20; + break; + case 2500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct25; + break; + case 3000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct30; + break; + case 3500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct35; + break; + case 3700: + nValue = NS_ooxml::LN_Value_ST_Shd_pct37; + break; + case 4000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct40; + break; + case 4500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct45; + break; + case 5000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct50; + break; + case 5500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct55; + break; + case 6000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct60; + break; + case 6200: + nValue = NS_ooxml::LN_Value_ST_Shd_pct62; + break; + case 6500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct65; + break; + case 7000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct70; + break; + case 7500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct75; + break; + case 8000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct80; + break; + case 8500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct85; + break; + case 8700: + nValue = NS_ooxml::LN_Value_ST_Shd_pct87; + break; + case 9000: + nValue = NS_ooxml::LN_Value_ST_Shd_pct90; + break; + case 9500: + nValue = NS_ooxml::LN_Value_ST_Shd_pct95; + break; + default: + break; + } + if (nValue != -1) + putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, + NS_ooxml::LN_CT_Shd_val, std::make_shared<RTFValue>(nValue)); } break; - case RTF_DPPTX: - { - RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject; + case RTF_DODHGT: + m_aStates.top().aDrawingObject.nDhgt = nParam; + break; + case RTF_DPPOLYCOUNT: + if (nParam >= 0) + { + m_aStates.top().aDrawingObject.nPolyLineCount = nParam; + } + break; + case RTF_DPPTX: + { + RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject; - if (rDrawingObject.aPolyLinePoints.empty()) - dispatchValue(RTF_DPPOLYCOUNT, 2); + if (rDrawingObject.aPolyLinePoints.empty()) + dispatchValue(RTF_DPPOLYCOUNT, 2); - rDrawingObject.aPolyLinePoints.emplace_back(awt::Point(convertTwipToMm100(nParam), 0)); - } - break; - case RTF_DPPTY: - { - RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject; - if (!rDrawingObject.aPolyLinePoints.empty()) + rDrawingObject.aPolyLinePoints.emplace_back(awt::Point(convertTwipToMm100(nParam), 0)); + } + break; + case RTF_DPPTY: { - rDrawingObject.aPolyLinePoints.back().Y = convertTwipToMm100(nParam); - rDrawingObject.nPolyLineCount--; - if (rDrawingObject.nPolyLineCount == 0 && rDrawingObject.xPropertySet.is()) + RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject; + if (!rDrawingObject.aPolyLinePoints.empty()) { - uno::Sequence< uno::Sequence<awt::Point> >aPointSequenceSequence = + rDrawingObject.aPolyLinePoints.back().Y = convertTwipToMm100(nParam); + rDrawingObject.nPolyLineCount--; + if (rDrawingObject.nPolyLineCount == 0 && rDrawingObject.xPropertySet.is()) { - comphelper::containerToSequence(rDrawingObject.aPolyLinePoints) - }; - rDrawingObject.xPropertySet->setPropertyValue("PolyPolygon", uno::Any(aPointSequenceSequence)); + uno::Sequence<uno::Sequence<awt::Point>> aPointSequenceSequence + = { comphelper::containerToSequence(rDrawingObject.aPolyLinePoints) }; + rDrawingObject.xPropertySet->setPropertyValue("PolyPolygon", + uno::Any(aPointSequenceSequence)); + } } } - } - break; - case RTF_SHPFBLWTXT: - // Shape is below text -> send it to the background. - m_aStates.top().aShape.bInBackground = nParam; break; - case RTF_CLPADB: - case RTF_CLPADL: - case RTF_CLPADR: - case RTF_CLPADT: - { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); - // Top and left is swapped, that's what Word does. - switch (nKeyword) - { - case RTF_CLPADB: - nSprm = NS_ooxml::LN_CT_TcMar_bottom; + case RTF_SHPFBLWTXT: + // Shape is below text -> send it to the background. + m_aStates.top().aShape.bInBackground = nParam; break; + case RTF_CLPADB: case RTF_CLPADL: - nSprm = NS_ooxml::LN_CT_TcMar_top; - break; case RTF_CLPADR: - nSprm = NS_ooxml::LN_CT_TcMar_right; - break; case RTF_CLPADT: - nSprm = NS_ooxml::LN_CT_TcMar_left; - break; - default: - break; - } - putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); - } - break; - case RTF_TRPADDFB: - case RTF_TRPADDFL: - case RTF_TRPADDFR: - case RTF_TRPADDFT: - { - RTFSprms aAttributes; - switch (nParam) { - case 3: - aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - break; + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + // Top and left is swapped, that's what Word does. + switch (nKeyword) + { + case RTF_CLPADB: + nSprm = NS_ooxml::LN_CT_TcMar_bottom; + break; + case RTF_CLPADL: + nSprm = NS_ooxml::LN_CT_TcMar_top; + break; + case RTF_CLPADR: + nSprm = NS_ooxml::LN_CT_TcMar_right; + break; + case RTF_CLPADT: + nSprm = NS_ooxml::LN_CT_TcMar_left; + break; + default: + break; + } + putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, + std::make_shared<RTFValue>(aAttributes)); } - switch (nKeyword) - { + break; case RTF_TRPADDFB: - nSprm = NS_ooxml::LN_CT_TcMar_bottom; - break; case RTF_TRPADDFL: - nSprm = NS_ooxml::LN_CT_TcMar_left; - break; case RTF_TRPADDFR: - nSprm = NS_ooxml::LN_CT_TcMar_right; - break; case RTF_TRPADDFT: - nSprm = NS_ooxml::LN_CT_TcMar_top; - break; - default: - break; - } - putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); - putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); - } - break; - case RTF_TRPADDB: - case RTF_TRPADDL: - case RTF_TRPADDR: - case RTF_TRPADDT: - { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); - switch (nKeyword) { + RTFSprms aAttributes; + switch (nParam) + { + case 3: + aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + break; + } + switch (nKeyword) + { + case RTF_TRPADDFB: + nSprm = NS_ooxml::LN_CT_TcMar_bottom; + break; + case RTF_TRPADDFL: + nSprm = NS_ooxml::LN_CT_TcMar_left; + break; + case RTF_TRPADDFR: + nSprm = NS_ooxml::LN_CT_TcMar_right; + break; + case RTF_TRPADDFT: + nSprm = NS_ooxml::LN_CT_TcMar_top; + break; + default: + break; + } + putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, + nSprm, std::make_shared<RTFValue>(aAttributes)); + putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, + nSprm, std::make_shared<RTFValue>(aAttributes)); + } + break; case RTF_TRPADDB: - nSprm = NS_ooxml::LN_CT_TcMar_bottom; - break; case RTF_TRPADDL: - nSprm = NS_ooxml::LN_CT_TcMar_left; - break; case RTF_TRPADDR: - nSprm = NS_ooxml::LN_CT_TcMar_right; - break; case RTF_TRPADDT: - nSprm = NS_ooxml::LN_CT_TcMar_top; - break; - default: - break; - } - putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); - putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); - } - break; - case RTF_FI: - { - if (m_aStates.top().eDestination == Destination::LISTLEVEL) { - if (m_aStates.top().bLevelNumbersValid) - putNestedAttribute(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue); + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam)); + switch (nKeyword) + { + case RTF_TRPADDB: + nSprm = NS_ooxml::LN_CT_TcMar_bottom; + break; + case RTF_TRPADDL: + nSprm = NS_ooxml::LN_CT_TcMar_left; + break; + case RTF_TRPADDR: + nSprm = NS_ooxml::LN_CT_TcMar_right; + break; + case RTF_TRPADDT: + nSprm = NS_ooxml::LN_CT_TcMar_top; + break; + default: + break; + } + putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, + std::make_shared<RTFValue>(aAttributes)); + putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, + std::make_shared<RTFValue>(aAttributes)); } - else - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue); - break; - } - case RTF_LI: - { - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_left, pIntValue); - // It turns out \li should reset the \fi inherited from the stylesheet. - // So set the direct formatting to zero, if we don't have such direct formatting yet. - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, std::make_shared<RTFValue>(0), - RTFOverwrite::NO_IGNORE); - } - break; - case RTF_RI: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_right, pIntValue); - break; - case RTF_LIN: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_start, pIntValue); break; - case RTF_RIN: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_end, pIntValue); - break; - case RTF_OUTLINELEVEL: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_outlineLvl, pIntValue); - break; - case RTF_TRGAPH: - // Half of the space between the cells of a table row: default left/right table cell margin. - if (nParam > 0) + case RTF_FI: { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); - aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue); - putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_left, std::make_shared<RTFValue>(aAttributes)); - putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, std::make_shared<RTFValue>(aAttributes)); + if (m_aStates.top().eDestination == Destination::LISTLEVEL) + { + if (m_aStates.top().bLevelNumbersValid) + putNestedAttribute(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_firstLine, pIntValue); + } + else + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_firstLine, pIntValue); + break; } - break; - case RTF_TRFTSWIDTH: - putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pIntValue); - break; - case RTF_TRWWIDTH: - putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pIntValue); - break; - case RTF_PROPTYPE: - { - switch (nParam) + case RTF_LI: { - case 3: - m_aStates.top().aPropType = cppu::UnoType<sal_Int32>::get(); + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_left, pIntValue); + // It turns out \li should reset the \fi inherited from the stylesheet. + // So set the direct formatting to zero, if we don't have such direct formatting yet. + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_firstLine, std::make_shared<RTFValue>(0), + RTFOverwrite::NO_IGNORE); + } + break; + case RTF_RI: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_right, pIntValue); + break; + case RTF_LIN: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_start, pIntValue); break; - case 5: - m_aStates.top().aPropType = cppu::UnoType<double>::get(); + case RTF_RIN: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + NS_ooxml::LN_CT_Ind_end, pIntValue); break; - case 11: - m_aStates.top().aPropType = cppu::UnoType<bool>::get(); + case RTF_OUTLINELEVEL: + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_outlineLvl, pIntValue); + break; + case RTF_TRGAPH: + // Half of the space between the cells of a table row: default left/right table cell margin. + if (nParam > 0) + { + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue); + putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, + NS_ooxml::LN_CT_TblCellMar_left, + std::make_shared<RTFValue>(aAttributes)); + putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, + NS_ooxml::LN_CT_TblCellMar_right, + std::make_shared<RTFValue>(aAttributes)); + } break; - case 30: - m_aStates.top().aPropType = cppu::UnoType<OUString>::get(); + case RTF_TRFTSWIDTH: + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, + NS_ooxml::LN_CT_TblWidth_type, pIntValue); break; - case 64: - m_aStates.top().aPropType = cppu::UnoType<util::DateTime>::get(); + case RTF_TRWWIDTH: + putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, + NS_ooxml::LN_CT_TblWidth_w, pIntValue); break; + case RTF_PROPTYPE: + { + switch (nParam) + { + case 3: + m_aStates.top().aPropType = cppu::UnoType<sal_Int32>::get(); + break; + case 5: + m_aStates.top().aPropType = cppu::UnoType<double>::get(); + break; + case 11: + m_aStates.top().aPropType = cppu::UnoType<bool>::get(); + break; + case 30: + m_aStates.top().aPropType = cppu::UnoType<OUString>::get(); + break; + case 64: + m_aStates.top().aPropType = cppu::UnoType<util::DateTime>::get(); + break; + } } - } - break; - case RTF_DIBITMAP: - m_aStates.top().aPicture.eStyle = RTFBmpStyle::DIBITMAP; - break; - case RTF_TRWWIDTHA: - m_aStates.top().nTableRowWidthAfter = nParam; break; - case RTF_ANIMTEXT: - { - nId = 0; - switch (nParam) + case RTF_DIBITMAP: + m_aStates.top().aPicture.eStyle = RTFBmpStyle::DIBITMAP; + break; + case RTF_TRWWIDTHA: + m_aStates.top().nTableRowWidthAfter = nParam; + break; + case RTF_ANIMTEXT: { - case 0: - nId = NS_ooxml::LN_Value_ST_TextEffect_none; + nId = 0; + switch (nParam) + { + case 0: + nId = NS_ooxml::LN_Value_ST_TextEffect_none; + break; + case 2: + nId = NS_ooxml::LN_Value_ST_TextEffect_blinkBackground; + break; + } + + if (nId > 0) + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_effect, + std::make_shared<RTFValue>(nId)); break; - case 2: - nId = NS_ooxml::LN_Value_ST_TextEffect_blinkBackground; + } + case RTF_VIEWBKSP: + { + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_displayBackgroundShape, pIntValue); + // Send this token immediately, if it only appears before the first + // run, it will be too late, we ignored the background shape already by then. + outputSettingsTable(); break; } - - if (nId > 0) - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_effect, std::make_shared<RTFValue>(nId)); - break; - } - case RTF_VIEWBKSP: - { - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_displayBackgroundShape, pIntValue); - // Send this token immediately, if it only appears before the first - // run, it will be too late, we ignored the background shape already by then. - outputSettingsTable(); + default: + { + SAL_INFO("writerfilter", "TODO handle value '" << keywordToString(nKeyword) << "'"); + aSkip.setParsed(false); + } break; } - default: - { - SAL_INFO("writerfilter", "TODO handle value '" << keywordToString(nKeyword) << "'"); - aSkip.setParsed(false); - } - break; - } return RTFError::OK; } diff --git a/writerfilter/source/rtftok/rtfdocumentfactory.cxx b/writerfilter/source/rtftok/rtfdocumentfactory.cxx index 08dbdcbafe0e..ad5e503a3276 100644 --- a/writerfilter/source/rtftok/rtfdocumentfactory.cxx +++ b/writerfilter/source/rtftok/rtfdocumentfactory.cxx @@ -13,15 +13,16 @@ namespace writerfilter { namespace rtftok { - -RTFDocument::Pointer_t RTFDocumentFactory::createDocument(css::uno::Reference< css::uno::XComponentContext > const& xContext, - css::uno::Reference< css::io::XInputStream > const& xInputStream, - css::uno::Reference< css::lang::XComponent > const& xDstDoc, - css::uno::Reference< css::frame::XFrame > const& xFrame, - css::uno::Reference< css::task::XStatusIndicator > const& xStatusIndicator, - const utl::MediaDescriptor& rMediaDescriptor) +RTFDocument::Pointer_t RTFDocumentFactory::createDocument( + css::uno::Reference<css::uno::XComponentContext> const& xContext, + css::uno::Reference<css::io::XInputStream> const& xInputStream, + css::uno::Reference<css::lang::XComponent> const& xDstDoc, + css::uno::Reference<css::frame::XFrame> const& xFrame, + css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator, + const utl::MediaDescriptor& rMediaDescriptor) { - return std::make_shared<RTFDocumentImpl>(xContext, xInputStream, xDstDoc, xFrame, xStatusIndicator, rMediaDescriptor); + return std::make_shared<RTFDocumentImpl>(xContext, xInputStream, xDstDoc, xFrame, + xStatusIndicator, rMediaDescriptor); } } // namespace rtftok diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 7a44e3607043..e88f85afd17e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -79,18 +79,16 @@ namespace writerfilter { namespace rtftok { - Id getParagraphBorder(sal_uInt32 nIndex) { - static const Id aBorderIds[] = - { - NS_ooxml::LN_CT_PBdr_top, NS_ooxml::LN_CT_PBdr_left, NS_ooxml::LN_CT_PBdr_bottom, NS_ooxml::LN_CT_PBdr_right - }; + static const Id aBorderIds[] = { NS_ooxml::LN_CT_PBdr_top, NS_ooxml::LN_CT_PBdr_left, + NS_ooxml::LN_CT_PBdr_bottom, NS_ooxml::LN_CT_PBdr_right }; return aBorderIds[nIndex]; } -void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Pointer_t& pValue, RTFOverwrite eOverwrite, bool bAttribute) +void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Pointer_t& pValue, + RTFOverwrite eOverwrite, bool bAttribute) { RTFValue::Pointer_t pParent = rSprms.find(nParent, /*bFirst=*/true, /*bForWrite=*/true); if (!pParent.get()) @@ -159,7 +157,8 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa } else if (aStates.top().nBorderState == RTFBorderState::CHARACTER) { - RTFValue::Pointer_t pPointer = aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_RPrBase_bdr); + RTFValue::Pointer_t pPointer + = aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_RPrBase_bdr); if (pPointer) { RTFSprms& rAttributes = pPointer->getAttributes(); @@ -168,11 +167,14 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa } // Attributes of the last border type else if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH) - pAttributes = &getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); + pAttributes + = &getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); else if (aStates.top().nBorderState == RTFBorderState::CELL) - pAttributes = &getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders); + pAttributes + = &getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders); else if (aStates.top().nBorderState == RTFBorderState::PAGE) - pAttributes = &getLastAttributes(aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders); + pAttributes = &getLastAttributes(aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgBorders); if (pAttributes) pAttributes->set(nId, pValue); } @@ -208,12 +210,12 @@ const char* keywordToString(RTFKeyword nKeyword) static util::DateTime lcl_getDateTime(RTFParserState const& aState) { - return {0 /*100sec*/, 0 /*sec*/, aState.nMinute, aState.nHour, - aState.nDay, aState.nMonth, aState.nYear, false - }; + return { 0 /*100sec*/, 0 /*sec*/, aState.nMinute, aState.nHour, + aState.nDay, aState.nMonth, aState.nYear, false }; } -static void lcl_DestinationToMath(OUStringBuffer* pDestinationText, oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor) +static void lcl_DestinationToMath(OUStringBuffer* pDestinationText, + oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor) { if (!pDestinationText) return; @@ -242,62 +244,64 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x uno::Reference<frame::XFrame> const& xFrame, uno::Reference<task::XStatusIndicator> const& xStatusIndicator, const utl::MediaDescriptor& rMediaDescriptor) - : m_xContext(xContext), - m_xInputStream(xInputStream), - m_xDstDoc(xDstDoc), - m_xFrame(xFrame), - m_xStatusIndicator(xStatusIndicator), - m_pMapperStream(nullptr), - m_aDefaultState(this), - m_bSkipUnknown(false), - m_bFirstRun(true), - m_bNeedPap(true), - m_bNeedCr(false), - m_bNeedCrOrig(false), - m_bNeedPar(true), - m_bNeedFinalPar(false), - m_nNestedCells(0), - m_nTopLevelCells(0), - m_nInheritingCells(0), - m_nNestedCurrentCellX(0), - m_nTopLevelCurrentCellX(0), - m_nBackupTopLevelCurrentCellX(0), - m_aTableBufferStack(1), // create top-level buffer already - m_pSuperstream(nullptr), - m_nStreamType(0), - m_nGroupStartPos(0), - m_nFormFieldType(RTFFormFieldType::NONE), - m_bObject(false), - m_nCurrentFontIndex(0), - m_nCurrentEncoding(-1), - m_nDefaultFontIndex(-1), - m_nCurrentStyleIndex(0), - m_bFormField(false), - m_bMathNor(false), - m_bIgnoreNextContSectBreak(false), - m_nResetBreakOnSectBreak(RTF_invalid), - m_bNeedSect(false), // done by checkFirstRun - m_bWasInFrame(false), - m_bHadPicture(false), - m_bHadSect(false), - m_nCellxMax(0), - m_nListPictureId(0), - m_bIsNewDoc(!rMediaDescriptor.getUnpackedValueOrDefault("InsertMode", false)), - m_rMediaDescriptor(rMediaDescriptor), - m_hasRHeader(false), - m_hasFHeader(false), - m_hasRFooter(false), - m_hasFFooter(false), - m_bAfterCellBeforeRow(false) + : m_xContext(xContext) + , m_xInputStream(xInputStream) + , m_xDstDoc(xDstDoc) + , m_xFrame(xFrame) + , m_xStatusIndicator(xStatusIndicator) + , m_pMapperStream(nullptr) + , m_aDefaultState(this) + , m_bSkipUnknown(false) + , m_bFirstRun(true) + , m_bNeedPap(true) + , m_bNeedCr(false) + , m_bNeedCrOrig(false) + , m_bNeedPar(true) + , m_bNeedFinalPar(false) + , m_nNestedCells(0) + , m_nTopLevelCells(0) + , m_nInheritingCells(0) + , m_nNestedCurrentCellX(0) + , m_nTopLevelCurrentCellX(0) + , m_nBackupTopLevelCurrentCellX(0) + , m_aTableBufferStack(1) // create top-level buffer already + , m_pSuperstream(nullptr) + , m_nStreamType(0) + , m_nGroupStartPos(0) + , m_nFormFieldType(RTFFormFieldType::NONE) + , m_bObject(false) + , m_nCurrentFontIndex(0) + , m_nCurrentEncoding(-1) + , m_nDefaultFontIndex(-1) + , m_nCurrentStyleIndex(0) + , m_bFormField(false) + , m_bMathNor(false) + , m_bIgnoreNextContSectBreak(false) + , m_nResetBreakOnSectBreak(RTF_invalid) + , m_bNeedSect(false) // done by checkFirstRun + , m_bWasInFrame(false) + , m_bHadPicture(false) + , m_bHadSect(false) + , m_nCellxMax(0) + , m_nListPictureId(0) + , m_bIsNewDoc(!rMediaDescriptor.getUnpackedValueOrDefault("InsertMode", false)) + , m_rMediaDescriptor(rMediaDescriptor) + , m_hasRHeader(false) + , m_hasFHeader(false) + , m_hasRFooter(false) + , m_hasFFooter(false) + , m_bAfterCellBeforeRow(false) { OSL_ASSERT(xInputStream.is()); m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, true)); m_xModelFactory.set(m_xDstDoc, uno::UNO_QUERY); - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(m_xDstDoc, uno::UNO_QUERY); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + m_xDstDoc, uno::UNO_QUERY); if (xDocumentPropertiesSupplier.is()) - m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY); + m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), + uno::UNO_QUERY); m_pGraphicHelper.reset(new oox::GraphicHelper(m_xContext, xFrame, oox::StorageRef())); @@ -307,26 +311,16 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x RTFDocumentImpl::~RTFDocumentImpl() = default; -SvStream& RTFDocumentImpl::Strm() -{ - return *m_pInStream; -} - +SvStream& RTFDocumentImpl::Strm() { return *m_pInStream; } void RTFDocumentImpl::setSuperstream(RTFDocumentImpl* pSuperstream) { m_pSuperstream = pSuperstream; } -bool RTFDocumentImpl::isSubstream() const -{ - return m_pSuperstream != nullptr; -} +bool RTFDocumentImpl::isSubstream() const { return m_pSuperstream != nullptr; } -void RTFDocumentImpl::finishSubstream() -{ - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); -} +void RTFDocumentImpl::finishSubstream() { checkUnicode(/*bUnicode =*/true, /*bHex =*/true); } void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId) { @@ -336,7 +330,8 @@ void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId, OUString const& { sal_uInt64 const nCurrent = Strm().Tell(); // Seek to header position, parse, then seek back. - auto pImpl = std::make_shared<RTFDocumentImpl>(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, m_xStatusIndicator, m_rMediaDescriptor); + auto pImpl = std::make_shared<RTFDocumentImpl>(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, + m_xStatusIndicator, m_rMediaDescriptor); pImpl->setSuperstream(this); pImpl->m_nStreamType = nId; pImpl->m_aIgnoreFirst = rIgnoreFirst; @@ -360,10 +355,12 @@ void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId, OUString const& void RTFDocumentImpl::outputSettingsTable() { - writerfilter::Reference<Properties>::Pointer_t pProp = std::make_shared<RTFReferenceProperties>(m_aSettingsTableAttributes, m_aSettingsTableSprms); + writerfilter::Reference<Properties>::Pointer_t pProp = std::make_shared<RTFReferenceProperties>( + m_aSettingsTableAttributes, m_aSettingsTableSprms); RTFReferenceTable::Entries_t aSettingsTableEntries; aSettingsTableEntries.insert(std::make_pair(0, pProp)); - writerfilter::Reference<Table>::Pointer_t pTable = std::make_shared<RTFReferenceTable>(aSettingsTableEntries); + writerfilter::Reference<Table>::Pointer_t pTable + = std::make_shared<RTFReferenceTable>(aSettingsTableEntries); Mapper().table(NS_ooxml::LN_settings_settings, pTable); } @@ -378,18 +375,19 @@ void RTFDocumentImpl::checkFirstRun() setNeedSect(true); // first call that succeeds // set the requested default font, if there are none - RTFValue::Pointer_t pFont = lcl_getNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); - RTFValue::Pointer_t pCurrentFont = lcl_getNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); + RTFValue::Pointer_t pFont + = lcl_getNestedAttribute(m_aDefaultState.aCharacterSprms, + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); + RTFValue::Pointer_t pCurrentFont + = lcl_getNestedAttribute(m_aStates.top().aCharacterSprms, + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); if (pFont && !pCurrentFont) - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pFont); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, + NS_ooxml::LN_CT_Fonts_ascii, pFont); } } - -void RTFDocumentImpl::setNeedPar(bool bNeedPar) -{ - m_bNeedPar = bNeedPar; -} +void RTFDocumentImpl::setNeedPar(bool bNeedPar) { m_bNeedPar = bNeedPar; } void RTFDocumentImpl::setNeedSect(bool bNeedSect) { @@ -412,7 +410,8 @@ void RTFDocumentImpl::setNeedSect(bool bNeedSect) } /// Copy rProps to rStyleAttributes and rStyleSprms, but in case of nested sprms, copy their children as toplevel sprms/attributes. -static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttributes, RTFSprms& rStyleSprms) +static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttributes, + RTFSprms& rStyleSprms) { for (auto& rSprm : rProps.getSprms()) { @@ -437,7 +436,8 @@ static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttr rStyleAttributes.set(rAttribute.first, rAttribute.second); } -writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms& rSprms, Id nStyleType) +writerfilter::Reference<Properties>::Pointer_t +RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms& rSprms, Id nStyleType) { int nStyle = 0; if (!m_aStates.empty()) @@ -465,7 +465,8 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RT if (itChar != m_aStyleTableEntries.end()) { // Found active character style, then update aStyleSprms/Attributes. - RTFReferenceProperties& rCharProps = *static_cast<RTFReferenceProperties*>(itChar->second.get()); + RTFReferenceProperties& rCharProps + = *static_cast<RTFReferenceProperties*>(itChar->second.get()); if (!nStyleType || nStyleType == NS_ooxml::LN_Value_ST_StyleType_character) lcl_copyFlatten(rCharProps, aStyleAttributes, aStyleSprms); } @@ -475,7 +476,8 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RT RTFSprms const attributes(rAttributes.cloneAndDeduplicate(aStyleAttributes)); return std::make_shared<RTFReferenceProperties>(attributes, sprms); } - writerfilter::Reference<Properties>::Pointer_t pRet = std::make_shared<RTFReferenceProperties>(rAttributes, rSprms); + writerfilter::Reference<Properties>::Pointer_t pRet + = std::make_shared<RTFReferenceProperties>(rAttributes, rSprms); return pRet; } @@ -491,12 +493,15 @@ void RTFDocumentImpl::checkNeedPap() if (!m_aStates.top().pCurrentBuffer) { writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties( - getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms, NS_ooxml::LN_Value_ST_StyleType_paragraph) - ); + getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms, + NS_ooxml::LN_Value_ST_StyleType_paragraph)); // Writer will ignore a page break before a text frame, so guard it with empty paragraphs - bool hasBreakBeforeFrame = m_aStates.top().aFrame.hasProperties() && - m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore).get(); + bool hasBreakBeforeFrame + = m_aStates.top().aFrame.hasProperties() + && m_aStates.top() + .aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore) + .get(); if (hasBreakBeforeFrame) { dispatchSymbol(RTF_PAR); @@ -515,9 +520,9 @@ void RTFDocumentImpl::checkNeedPap() } else { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); - m_aStates.top().pCurrentBuffer->push_back( - Buf_t(BUFFER_PROPS, pValue, nullptr)); + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, + m_aStates.top().aParagraphSprms); + m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pValue, nullptr)); } } } @@ -526,18 +531,22 @@ void RTFDocumentImpl::runProps() { if (!m_aStates.top().pCurrentBuffer) { - Reference<Properties>::Pointer_t const pProperties = getProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms, NS_ooxml::LN_Value_ST_StyleType_character); + Reference<Properties>::Pointer_t const pProperties + = getProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms, + NS_ooxml::LN_Value_ST_StyleType_character); Mapper().props(pProperties); } else { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, + m_aStates.top().aCharacterSprms); m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pValue, nullptr)); } // Delete the sprm, so the trackchange range will be started only once. // OTOH set a boolean flag, so we'll know we need to end the range later. - RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange); + RTFValue::Pointer_t pTrackchange + = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange); if (pTrackchange) { m_aStates.top().bStartedTrackchange = true; @@ -577,10 +586,15 @@ void RTFDocumentImpl::parBreak() void RTFDocumentImpl::sectBreak(bool bFinal) { - SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": final? " << bFinal << ", needed? " << m_bNeedSect); + SAL_INFO("writerfilter.rtf", + OSL_THIS_FUNC << ": final? " << bFinal << ", needed? " << m_bNeedSect); bool bNeedSect = m_bNeedSect; - RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); - bool bContinuous = pBreak.get() && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous); + RTFValue::Pointer_t pBreak + = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); + bool bContinuous + = pBreak.get() + && pBreak->getInt() + == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous); // If there is no paragraph in this section, then insert a dummy one, as required by Writer, // unless this is the end of the doc, we had nothing since the last section break and this is not a continuous one. // Also, when pasting, it's fine to not have any paragraph inside the document at all. @@ -610,11 +624,13 @@ void RTFDocumentImpl::sectBreak(bool bFinal) } // Section properties are a paragraph sprm. - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aSectionAttributes, m_aStates.top().aSectionSprms); + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aSectionAttributes, + m_aStates.top().aSectionSprms); RTFSprms aAttributes; RTFSprms aSprms; aSprms.set(NS_ooxml::LN_CT_PPr_sectPr, pValue); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); if (bFinal && !m_pSuperstream) // This is the end of the document, not just the end of e.g. a header. @@ -662,7 +678,8 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex) // We have a default encoding. return m_aDefaultState.nCurrentEncoding; // Guess based on locale. - return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale()); + return msfilter::util::getBestTextEncodingFromLocale( + Application::GetSettings().GetLanguageTag().getLocale()); } return m_pSuperstream->getEncoding(nFontIndex); @@ -679,7 +696,8 @@ OUString RTFDocumentImpl::getFontName(int nIndex) int RTFDocumentImpl::getFontIndex(int nIndex) { if (!m_pSuperstream) - return std::find(m_aFontIndexes.begin(), m_aFontIndexes.end(), nIndex) - m_aFontIndexes.begin(); + return std::find(m_aFontIndexes.begin(), m_aFontIndexes.end(), nIndex) + - m_aFontIndexes.begin(); return m_pSuperstream->getFontIndex(nIndex); } @@ -718,10 +736,7 @@ RTFParserState& RTFDocumentImpl::getDefaultState() return m_pSuperstream->getDefaultState(); } -oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper() -{ - return *m_pGraphicHelper; -} +oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper() { return *m_pGraphicHelper; } bool RTFDocumentImpl::isStyleSheetImport() { @@ -736,30 +751,31 @@ void RTFDocumentImpl::resolve(Stream& rMapper) m_pMapperStream = &rMapper; switch (m_pTokenizer->resolveParse()) { - case RTFError::OK: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: finished without errors"); - break; - case RTFError::GROUP_UNDER: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unmatched '}'"); - break; - case RTFError::GROUP_OVER: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unmatched '{'"); - throw io::WrongFormatException(m_pTokenizer->getPosition()); - break; - case RTFError::UNEXPECTED_EOF: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unexpected end of file"); - throw io::WrongFormatException(m_pTokenizer->getPosition()); - break; - case RTFError::HEX_INVALID: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: invalid hex char"); - throw io::WrongFormatException(m_pTokenizer->getPosition()); - break; - case RTFError::CHAR_OVER: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: characters after last '}'"); - break; - case RTFError::CLASSIFICATION: - SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: classification prevented paste"); - break; + case RTFError::OK: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: finished without errors"); + break; + case RTFError::GROUP_UNDER: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unmatched '}'"); + break; + case RTFError::GROUP_OVER: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unmatched '{'"); + throw io::WrongFormatException(m_pTokenizer->getPosition()); + break; + case RTFError::UNEXPECTED_EOF: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: unexpected end of file"); + throw io::WrongFormatException(m_pTokenizer->getPosition()); + break; + case RTFError::HEX_INVALID: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: invalid hex char"); + throw io::WrongFormatException(m_pTokenizer->getPosition()); + break; + case RTFError::CHAR_OVER: + SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolve: characters after last '}'"); + break; + case RTFError::CLASSIFICATION: + SAL_INFO("writerfilter.rtf", + "RTFDocumentImpl::resolve: classification prevented paste"); + break; } } @@ -773,7 +789,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS int b = 0, count = 2; // Feed the destination text to a stream. - OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); + OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US); for (int i = 0; i < aStr.getLength(); ++i) { char ch = aStr[i]; @@ -827,7 +844,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS aExtHeader.xExt = m_aStates.top().aPicture.nWidth; aExtHeader.yExt = m_aStates.top().aPicture.nHeight; WmfExternal* pExtHeader = &aExtHeader; - uno::Reference<lang::XServiceInfo> xServiceInfo(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); + uno::Reference<lang::XServiceInfo> xServiceInfo(m_aStates.top().aDrawingObject.xShape, + uno::UNO_QUERY); if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame")) pExtHeader = nullptr; OUString aGraphicUrl = m_pGraphicHelper->importGraphicObject(xInputStream, pExtHeader); @@ -840,7 +858,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS const char aURLBegin[] = "vnd.sun.star.GraphicObject:"; if (aURLBS.startsWith(aURLBegin)) { - Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic(); + Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))) + .GetTransformedGraphic(); Size aSize(aGraphic.GetPrefSize()); MapMode aMap(MapUnit::Map100thMM); if (aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel) @@ -863,14 +882,16 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // a \pict inside the \shptxt of a \shp of shapeType 202 "TextBox" // and in that case xShape is the text frame; we actually need a // new GraphicObject then (example: fdo37691-1.rtf) - SAL_INFO("writerfilter.rtf", "cannot set graphic on existing shape, creating a new GraphicObjectShape"); + SAL_INFO("writerfilter.rtf", + "cannot set graphic on existing shape, creating a new GraphicObjectShape"); xShape.clear(); } } if (!xShape.is()) { if (m_xModelFactory.is()) - xShape.set(m_xModelFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); + xShape.set(m_xModelFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), + uno::UNO_QUERY); uno::Reference<drawing::XDrawPageSupplier> const xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); if (xDrawSupplier.is()) { @@ -890,18 +911,23 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS beans::PropertyValues aMediaProperties(1); aMediaProperties[0].Name = "URL"; aMediaProperties[0].Value <<= aGraphicUrl; - uno::Reference<graphic::XGraphicProvider> xGraphicProvider(graphic::GraphicProvider::create(m_xContext)); - uno::Reference<graphic::XGraphic> xGraphic = xGraphicProvider->queryGraphic(aMediaProperties); + uno::Reference<graphic::XGraphicProvider> xGraphicProvider( + graphic::GraphicProvider::create(m_xContext)); + uno::Reference<graphic::XGraphic> xGraphic + = xGraphicProvider->queryGraphic(aMediaProperties); xPropertySet->setPropertyValue("Graphic", uno::Any(xGraphic)); // Set the object size awt::Size aSize; - aSize.Width = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth : m_aStates.top().aPicture.nWidth); - aSize.Height = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight : m_aStates.top().aPicture.nHeight); + aSize.Width = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth + : m_aStates.top().aPicture.nWidth); + aSize.Height = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight + : m_aStates.top().aPicture.nHeight); xShape->setSize(aSize); // Replacement graphic is inline by default, see oox::vml::SimpleShape::implConvertAndInsert(). - xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AS_CHARACTER)); + xPropertySet->setPropertyValue("AnchorType", + uno::makeAny(text::TextContentAnchorType_AS_CHARACTER)); auto pShapeValue = std::make_shared<RTFValue>(xShape); m_aObjectAttributes.set(NS_ooxml::LN_shape, pShapeValue); @@ -941,12 +967,18 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // extent sprm RTFSprms aExtentAttributes; int nXExt, nYExt; - nXExt = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth : m_aStates.top().aPicture.nWidth); - nYExt = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight : m_aStates.top().aPicture.nHeight); + nXExt = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth + : m_aStates.top().aPicture.nWidth); + nYExt = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight + : m_aStates.top().aPicture.nHeight); if (m_aStates.top().aPicture.nScaleX != 100) - nXExt = (((long)m_aStates.top().aPicture.nScaleX) * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) / 100L; + nXExt = (((long)m_aStates.top().aPicture.nScaleX) + * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) + / 100L; if (m_aStates.top().aPicture.nScaleY != 100) - nYExt = (((long)m_aStates.top().aPicture.nScaleY) * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) / 100L; + nYExt = (((long)m_aStates.top().aPicture.nScaleY) + * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) + / 100L; if (m_aStates.top().bInShape) { // Picture in shape: it looks like pib picture, so we will stretch the picture to shape size (tdf#49893) @@ -961,7 +993,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS // docpr sprm RTFSprms aDocprAttributes; for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) - if (rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr) + if (rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_name + || rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr) aDocprAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second); auto pDocprValue = std::make_shared<RTFValue>(aDocprAttributes); if (bInline) @@ -983,7 +1016,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS { // wrap sprm RTFSprms aAnchorWrapAttributes; - m_aStates.top().aShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_behindDoc, std::make_shared<RTFValue>((m_aStates.top().aShape.bInBackground) ? 1 : 0)); + m_aStates.top().aShape.aAnchorAttributes.set( + NS_ooxml::LN_CT_Anchor_behindDoc, + std::make_shared<RTFValue>((m_aStates.top().aShape.bInBackground) ? 1 : 0)); RTFSprms aAnchorSprms; for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) { @@ -993,13 +1028,18 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS sal_Int32 nWrap = -1; for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms) { - if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight) + if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone + || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight) { nWrap = rCharacterSprm.first; // If there is a wrap polygon prepared by RTFSdrImport, pick it up here. - if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight && !m_aStates.top().aShape.aWrapPolygonSprms.empty()) - rCharacterSprm.second->getSprms().set(NS_ooxml::LN_CT_WrapTight_wrapPolygon, std::make_shared<RTFValue>(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms)); + if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight + && !m_aStates.top().aShape.aWrapPolygonSprms.empty()) + rCharacterSprm.second->getSprms().set( + NS_ooxml::LN_CT_WrapTight_wrapPolygon, + std::make_shared<RTFValue>(RTFSprms(), + m_aStates.top().aShape.aWrapPolygonSprms)); aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second); } @@ -1013,32 +1053,44 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS RTFSprms aPoshAttributes; RTFSprms aPoshSprms; if (m_aStates.top().aShape.nHoriOrientRelationToken > 0) - aPoshAttributes.set(NS_ooxml::LN_CT_PosH_relativeFrom, std::make_shared<RTFValue>(m_aStates.top().aShape.nHoriOrientRelationToken)); + aPoshAttributes.set( + NS_ooxml::LN_CT_PosH_relativeFrom, + std::make_shared<RTFValue>(m_aStates.top().aShape.nHoriOrientRelationToken)); if (m_aStates.top().aShape.nLeft != 0) { - Mapper().positionOffset(OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nLeft)), /*bVertical=*/false); + Mapper().positionOffset( + OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nLeft)), + /*bVertical=*/false); aPoshSprms.set(NS_ooxml::LN_CT_PosH_posOffset, std::make_shared<RTFValue>()); } - aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, std::make_shared<RTFValue>(aPoshAttributes, aPoshSprms)); + aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, + std::make_shared<RTFValue>(aPoshAttributes, aPoshSprms)); RTFSprms aPosvAttributes; RTFSprms aPosvSprms; if (m_aStates.top().aShape.nVertOrientRelationToken > 0) - aPosvAttributes.set(NS_ooxml::LN_CT_PosV_relativeFrom, std::make_shared<RTFValue>(m_aStates.top().aShape.nVertOrientRelationToken)); + aPosvAttributes.set( + NS_ooxml::LN_CT_PosV_relativeFrom, + std::make_shared<RTFValue>(m_aStates.top().aShape.nVertOrientRelationToken)); if (m_aStates.top().aShape.nTop != 0) { - Mapper().positionOffset(OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nTop)), /*bVertical=*/true); + Mapper().positionOffset( + OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nTop)), + /*bVertical=*/true); aPosvSprms.set(NS_ooxml::LN_CT_PosV_posOffset, std::make_shared<RTFValue>()); } - aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, std::make_shared<RTFValue>(aPosvAttributes, aPosvSprms)); + aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, + std::make_shared<RTFValue>(aPosvAttributes, aPosvSprms)); aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue); aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue); // anchor sprm - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape.aAnchorAttributes, aAnchorSprms); + auto pValue + = std::make_shared<RTFValue>(m_aStates.top().aShape.aAnchorAttributes, aAnchorSprms); aSprms.set(NS_ooxml::LN_anchor_anchor, pValue); } - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms); checkFirstRun(); if (!m_aStates.top().pCurrentBuffer) @@ -1069,13 +1121,14 @@ RTFError RTFDocumentImpl::resolveChars(char ch) return RTFError::OK; } - OStringBuffer aBuf; bool bUnicodeChecked = false; bool bSkipped = false; - while (!Strm().IsEof() && (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != '{' && ch != '}' && ch != '\\'))) + while (!Strm().IsEof() + && (m_aStates.top().nInternalState == RTFInternalState::HEX + || (ch != '{' && ch != '}' && ch != '\\'))) { if (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != 0x0d && ch != 0x0a)) { @@ -1083,7 +1136,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) { if (!bUnicodeChecked) { - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ false); + checkUnicode(/*bUnicode =*/true, /*bHex =*/false); bUnicodeChecked = true; } aBuf.append(ch); @@ -1110,7 +1163,8 @@ RTFError RTFDocumentImpl::resolveChars(char ch) { // fdo#79384: Word will reject Shift-JIS following \loch // but apparently OOo could read and (worse) write such documents - SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::RunType::DBCH, "writerfilter.rtf", "invalid Shift-JIS without DBCH"); + SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::RunType::DBCH, + "writerfilter.rtf", "invalid Shift-JIS without DBCH"); assert(bUnicodeChecked); aBuf.append(ch); } @@ -1128,17 +1182,17 @@ RTFError RTFDocumentImpl::resolveChars(char ch) if (m_aStates.top().nInternalState != RTFInternalState::HEX && !Strm().IsEof()) Strm().SeekRel(-1); - if (m_aStates.top().nInternalState == RTFInternalState::HEX && m_aStates.top().eDestination != Destination::LEVELNUMBERS) + if (m_aStates.top().nInternalState == RTFInternalState::HEX + && m_aStates.top().eDestination != Destination::LEVELNUMBERS) { if (!bSkipped) { // note: apparently \'0d\'0a is interpreted as 2 breaks, not 1 - if ((ch == '\r' || ch == '\n') - && m_aStates.top().eDestination != Destination::DOCCOMM - && m_aStates.top().eDestination != Destination::LEVELNUMBERS - && m_aStates.top().eDestination != Destination::LEVELTEXT) + if ((ch == '\r' || ch == '\n') && m_aStates.top().eDestination != Destination::DOCCOMM + && m_aStates.top().eDestination != Destination::LEVELNUMBERS + && m_aStates.top().eDestination != Destination::LEVELTEXT) { - checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/false, /*bHex =*/true); dispatchSymbol(RTF_PAR); } else @@ -1165,7 +1219,8 @@ RTFError RTFDocumentImpl::resolveChars(char ch) if (m_aStates.top().eDestination == Destination::COLORTABLE) { // we hit a ';' at the end of each color entry - sal_uInt32 color = (m_aStates.top().aCurrentColor.nRed << 16) | (m_aStates.top().aCurrentColor.nGreen << 8) + sal_uInt32 color = (m_aStates.top().aCurrentColor.nRed << 16) + | (m_aStates.top().aCurrentColor.nGreen << 8) | m_aStates.top().aCurrentColor.nBlue; m_aColorTable.push_back(color); // set components back to zero @@ -1174,17 +1229,11 @@ RTFError RTFDocumentImpl::resolveChars(char ch) else if (!aStr.isEmpty()) m_aHexBuffer.append(aStr); - checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/false, /*bHex =*/true); return RTFError::OK; } -bool RTFFrame::inFrame() -{ - return m_nW > 0 - || m_nH > 0 - || m_nX > 0 - || m_nY > 0; -} +bool RTFFrame::inFrame() { return m_nW > 0 || m_nH > 0 || m_nX > 0 || m_nY > 0; } void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) { @@ -1222,136 +1271,143 @@ void RTFDocumentImpl::text(OUString& rString) bool bRet = true; switch (m_aStates.top().eDestination) { - // Note: in fonttbl there may or may not be groups; in stylesheet - // and revtbl groups are mandatory - case Destination::FONTTABLE: - case Destination::FONTENTRY: - case Destination::STYLEENTRY: - case Destination::LISTNAME: - case Destination::REVISIONENTRY: - { - // ; is the end of the entry - bool bEnd = false; - if (rString.endsWith(";")) - { - rString = rString.copy(0, rString.getLength() - 1); - bEnd = true; - } - m_aStates.top().appendDestinationText(rString); - if (bEnd) - { - // always clear, necessary in case of group-less fonttable - OUString const aName = m_aStates.top().pDestinationText->makeStringAndClear(); - switch (m_aStates.top().eDestination) - { - case Destination::FONTTABLE: - case Destination::FONTENTRY: + // Note: in fonttbl there may or may not be groups; in stylesheet + // and revtbl groups are mandatory + case Destination::FONTTABLE: + case Destination::FONTENTRY: + case Destination::STYLEENTRY: + case Destination::LISTNAME: + case Destination::REVISIONENTRY: + { + // ; is the end of the entry + bool bEnd = false; + if (rString.endsWith(";")) { - m_aFontNames[m_nCurrentFontIndex] = aName; - if (m_nCurrentEncoding >= 0) - { - m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding; - m_nCurrentEncoding = -1; - } - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, std::make_shared<RTFValue>(aName)); - - writerfilter::Reference<Properties>::Pointer_t const pProp( - new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms) - ); - - //See fdo#47347 initial invalid font entry properties are inserted first, - //so when we attempt to insert the correct ones, there's already an - //entry in the map for them, so the new ones aren't inserted. - auto lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex); - if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first))) - lb->second = pProp; - else - m_aFontTableEntries.insert(lb, std::make_pair(m_nCurrentFontIndex, pProp)); + rString = rString.copy(0, rString.getLength() - 1); + bEnd = true; } - break; - case Destination::STYLEENTRY: + m_aStates.top().appendDestinationText(rString); + if (bEnd) { - RTFValue::Pointer_t pType = m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type); - if (pType) + // always clear, necessary in case of group-less fonttable + OUString const aName = m_aStates.top().pDestinationText->makeStringAndClear(); + switch (m_aStates.top().eDestination) { - // Word strips whitespace around style names. - m_aStyleNames[m_nCurrentStyleIndex] = aName.trim(); - m_aStyleTypes[m_nCurrentStyleIndex] = pType->getInt(); - auto pValue = std::make_shared<RTFValue>(aName.trim()); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue); - - writerfilter::Reference<Properties>::Pointer_t const pProp(createStyleProperties()); - m_aStyleTableEntries.insert(std::make_pair(m_nCurrentStyleIndex, pProp)); + case Destination::FONTTABLE: + case Destination::FONTENTRY: + { + m_aFontNames[m_nCurrentFontIndex] = aName; + if (m_nCurrentEncoding >= 0) + { + m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding; + m_nCurrentEncoding = -1; + } + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, + std::make_shared<RTFValue>(aName)); + + writerfilter::Reference<Properties>::Pointer_t const pProp( + new RTFReferenceProperties(m_aStates.top().aTableAttributes, + m_aStates.top().aTableSprms)); + + //See fdo#47347 initial invalid font entry properties are inserted first, + //so when we attempt to insert the correct ones, there's already an + //entry in the map for them, so the new ones aren't inserted. + auto lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex); + if (lb != m_aFontTableEntries.end() + && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first))) + lb->second = pProp; + else + m_aFontTableEntries.insert(lb, + std::make_pair(m_nCurrentFontIndex, pProp)); + } + break; + case Destination::STYLEENTRY: + { + RTFValue::Pointer_t pType + = m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type); + if (pType) + { + // Word strips whitespace around style names. + m_aStyleNames[m_nCurrentStyleIndex] = aName.trim(); + m_aStyleTypes[m_nCurrentStyleIndex] = pType->getInt(); + auto pValue = std::make_shared<RTFValue>(aName.trim()); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, + pValue); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue); + + writerfilter::Reference<Properties>::Pointer_t const pProp( + createStyleProperties()); + m_aStyleTableEntries.insert( + std::make_pair(m_nCurrentStyleIndex, pProp)); + } + else + SAL_INFO("writerfilter.rtf", "no RTF style type defined, ignoring"); + break; + } + case Destination::LISTNAME: + // TODO: what can be done with a list name? + break; + case Destination::REVISIONENTRY: + m_aAuthors[m_aAuthors.size()] = aName; + break; + default: + break; } - else - SAL_INFO("writerfilter.rtf", "no RTF style type defined, ignoring"); - break; + resetAttributes(); + resetSprms(); } - case Destination::LISTNAME: - // TODO: what can be done with a list name? - break; - case Destination::REVISIONENTRY: - m_aAuthors[m_aAuthors.size()] = aName; - break; - default: - break; - } - resetAttributes(); - resetSprms(); } - } - break; - case Destination::LEVELTEXT: - case Destination::SHAPEPROPERTYNAME: - case Destination::SHAPEPROPERTYVALUE: - case Destination::BOOKMARKEND: - case Destination::PICT: - case Destination::SHAPEPROPERTYVALUEPICT: - case Destination::FORMFIELDNAME: - case Destination::FORMFIELDLIST: - case Destination::DATAFIELD: - case Destination::AUTHOR: - case Destination::KEYWORDS: - case Destination::OPERATOR: - case Destination::COMPANY: - case Destination::COMMENT: - case Destination::OBJDATA: - case Destination::OBJCLASS: - case Destination::ANNOTATIONDATE: - case Destination::ANNOTATIONAUTHOR: - case Destination::ANNOTATIONREFERENCE: - case Destination::FALT: - case Destination::PARAGRAPHNUMBERING_TEXTAFTER: - case Destination::PARAGRAPHNUMBERING_TEXTBEFORE: - case Destination::TITLE: - case Destination::SUBJECT: - case Destination::DOCCOMM: - case Destination::ATNID: - case Destination::ANNOTATIONREFERENCESTART: - case Destination::ANNOTATIONREFERENCEEND: - case Destination::MR: - case Destination::MCHR: - case Destination::MPOS: - case Destination::MVERTJC: - case Destination::MSTRIKEH: - case Destination::MDEGHIDE: - case Destination::MBEGCHR: - case Destination::MSEPCHR: - case Destination::MENDCHR: - case Destination::MSUBHIDE: - case Destination::MSUPHIDE: - case Destination::MTYPE: - case Destination::MGROW: - case Destination::INDEXENTRY: - case Destination::TOCENTRY: - case Destination::PROPNAME: - case Destination::STATICVAL: - m_aStates.top().appendDestinationText(rString); - break; - default: - bRet = false; break; + case Destination::LEVELTEXT: + case Destination::SHAPEPROPERTYNAME: + case Destination::SHAPEPROPERTYVALUE: + case Destination::BOOKMARKEND: + case Destination::PICT: + case Destination::SHAPEPROPERTYVALUEPICT: + case Destination::FORMFIELDNAME: + case Destination::FORMFIELDLIST: + case Destination::DATAFIELD: + case Destination::AUTHOR: + case Destination::KEYWORDS: + case Destination::OPERATOR: + case Destination::COMPANY: + case Destination::COMMENT: + case Destination::OBJDATA: + case Destination::OBJCLASS: + case Destination::ANNOTATIONDATE: + case Destination::ANNOTATIONAUTHOR: + case Destination::ANNOTATIONREFERENCE: + case Destination::FALT: + case Destination::PARAGRAPHNUMBERING_TEXTAFTER: + case Destination::PARAGRAPHNUMBERING_TEXTBEFORE: + case Destination::TITLE: + case Destination::SUBJECT: + case Destination::DOCCOMM: + case Destination::ATNID: + case Destination::ANNOTATIONREFERENCESTART: + case Destination::ANNOTATIONREFERENCEEND: + case Destination::MR: + case Destination::MCHR: + case Destination::MPOS: + case Destination::MVERTJC: + case Destination::MSTRIKEH: + case Destination::MDEGHIDE: + case Destination::MBEGCHR: + case Destination::MSEPCHR: + case Destination::MENDCHR: + case Destination::MSUBHIDE: + case Destination::MSUPHIDE: + case Destination::MTYPE: + case Destination::MGROW: + case Destination::INDEXENTRY: + case Destination::TOCENTRY: + case Destination::PROPNAME: + case Destination::STATICVAL: + m_aStates.top().appendDestinationText(rString); + break; + default: + bRet = false; + break; } if (bRet) return; @@ -1363,10 +1419,11 @@ void RTFDocumentImpl::text(OUString& rString) } // Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.) - if (m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() && - m_nTopLevelCells == 0) + if (m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() + && m_nTopLevelCells == 0) { - m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_UTEXT, std::make_shared<RTFValue>(rString), nullptr)); + m_aTableBufferStack.back().emplace_back( + Buf_t(BUFFER_UTEXT, std::make_shared<RTFValue>(rString), nullptr)); return; } @@ -1391,8 +1448,8 @@ void RTFDocumentImpl::text(OUString& rString) } if (m_aStates.top().eDestination == Destination::NORMAL - || m_aStates.top().eDestination == Destination::FIELDRESULT - || m_aStates.top().eDestination == Destination::SHAPETEXT) + || m_aStates.top().eDestination == Destination::FIELDRESULT + || m_aStates.top().eDestination == Destination::SHAPETEXT) runProps(); if (!pCurrentBuffer) @@ -1415,45 +1472,54 @@ void RTFDocumentImpl::text(OUString& rString) } void RTFDocumentImpl::prepareProperties( - RTFParserState& rState, - writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties, + RTFParserState& rState, writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties, writerfilter::Reference<Properties>::Pointer_t& o_rpFrameProperties, - writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties, - int const nCells, int const nCurrentCellX) + writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties, int const nCells, + int const nCurrentCellX) { - o_rpParagraphProperties = getProperties(rState.aParagraphAttributes, rState.aParagraphSprms, NS_ooxml::LN_Value_ST_StyleType_paragraph); + o_rpParagraphProperties = getProperties(rState.aParagraphAttributes, rState.aParagraphSprms, + NS_ooxml::LN_Value_ST_StyleType_paragraph); if (rState.aFrame.hasProperties()) { - o_rpFrameProperties = std::make_shared<RTFReferenceProperties>(RTFSprms(), rState.aFrame.getSprms()); + o_rpFrameProperties + = std::make_shared<RTFReferenceProperties>(RTFSprms(), rState.aFrame.getSprms()); } // Table width. - RTFValue::Pointer_t const pTableWidthProps = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblW); + RTFValue::Pointer_t const pTableWidthProps + = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblW); if (!pTableWidthProps.get()) { auto pUnitValue = std::make_shared<RTFValue>(3); - putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pUnitValue); + putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, + NS_ooxml::LN_CT_TblWidth_type, pUnitValue); auto pWValue = std::make_shared<RTFValue>(nCurrentCellX); - putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue); + putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, + NS_ooxml::LN_CT_TblWidth_w, pWValue); } auto pRowValue = std::make_shared<RTFValue>(1); if (nCells > 0) rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, pRowValue); - RTFValue::Pointer_t const pCellMar = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar); + RTFValue::Pointer_t const pCellMar + = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar); if (!pCellMar.get()) { // If no cell margins are defined, the default left/right margin is 0 in Word, but not in Writer. RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); + aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, + std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa)); aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(0)); - putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_left, std::make_shared<RTFValue>(aAttributes)); - putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, std::make_shared<RTFValue>(aAttributes)); + putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, + NS_ooxml::LN_CT_TblCellMar_left, std::make_shared<RTFValue>(aAttributes)); + putNestedSprm(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, + NS_ooxml::LN_CT_TblCellMar_right, std::make_shared<RTFValue>(aAttributes)); } - o_rpTableRowProperties = std::make_shared<RTFReferenceProperties>(rState.aTableRowAttributes, rState.aTableRowSprms); + o_rpTableRowProperties = std::make_shared<RTFReferenceProperties>(rState.aTableRowAttributes, + rState.aTableRowSprms); } void RTFDocumentImpl::sendProperties( @@ -1473,11 +1539,8 @@ void RTFDocumentImpl::sendProperties( tableBreak(); } -void RTFDocumentImpl::replayRowBuffer( - RTFBuffer_t& rBuffer, - ::std::deque<RTFSprms>& rCellsSrpms, - ::std::deque<RTFSprms>& rCellsAttributes, - int const nCells) +void RTFDocumentImpl::replayRowBuffer(RTFBuffer_t& rBuffer, ::std::deque<RTFSprms>& rCellsSrpms, + ::std::deque<RTFSprms>& rCellsAttributes, int const nCells) { for (int i = 0; i < nCells; ++i) { @@ -1487,15 +1550,14 @@ void RTFDocumentImpl::replayRowBuffer( } for (Buf_t& i : rBuffer) { - SAL_WARN_IF(BUFFER_CELLEND == std::get<0>(i), - "writerfilter.rtf", "dropping table cell!"); + SAL_WARN_IF(BUFFER_CELLEND == std::get<0>(i), "writerfilter.rtf", "dropping table cell!"); } assert(rCellsSrpms.empty()); assert(rCellsAttributes.empty()); } -void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, - RTFSprms* const pSprms, RTFSprms const* const pAttributes) +void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, + RTFSprms const* const pAttributes) { while (!rBuffer.empty()) { @@ -1504,20 +1566,19 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, if (std::get<0>(aTuple) == BUFFER_PROPS) { // Construct properties via getProperties() and not directly, to take care of deduplication. - writerfilter::Reference<Properties>::Pointer_t const pProp( - getProperties(std::get<1>(aTuple)->getAttributes(), std::get<1>(aTuple)->getSprms(), 0) - ); + writerfilter::Reference<Properties>::Pointer_t const pProp(getProperties( + std::get<1>(aTuple)->getAttributes(), std::get<1>(aTuple)->getSprms(), 0)); Mapper().props(pProp); } else if (std::get<0>(aTuple) == BUFFER_NESTROW) { TableRowBuffer& rRowBuffer(*std::get<2>(aTuple)); - replayRowBuffer(rRowBuffer.buffer, rRowBuffer.cellsSprms, - rRowBuffer.cellsAttributes, rRowBuffer.nCells); + replayRowBuffer(rRowBuffer.buffer, rRowBuffer.cellsSprms, rRowBuffer.cellsAttributes, + rRowBuffer.nCells); - sendProperties(rRowBuffer.pParaProperties, - rRowBuffer.pFrameProperties, rRowBuffer.pRowProperties); + sendProperties(rRowBuffer.pParaProperties, rRowBuffer.pFrameProperties, + rRowBuffer.pRowProperties); } else if (std::get<0>(aTuple) == BUFFER_CELLEND) { @@ -1540,7 +1601,8 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, else if (std::get<0>(aTuple) == BUFFER_UTEXT) { OUString const aString(std::get<1>(aTuple)->getString()); - Mapper().utext(reinterpret_cast<sal_uInt8 const*>(aString.getStr()), aString.getLength()); + Mapper().utext(reinterpret_cast<sal_uInt8 const*>(aString.getStr()), + aString.getLength()); } else if (std::get<0>(aTuple) == BUFFER_ENDRUN) Mapper().endCharacterGroup(); @@ -1572,7 +1634,6 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, else assert(false); } - } bool findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName) @@ -1605,7 +1666,8 @@ void RTFDocumentImpl::restoreTableRowProperties() void RTFDocumentImpl::resetTableRowProperties() { m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms; - m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, std::make_shared<RTFValue>(-1), RTFOverwrite::NO_APPEND); + m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, + std::make_shared<RTFValue>(-1), RTFOverwrite::NO_APPEND); m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes; if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) m_nNestedCurrentCellX = 0; @@ -1616,7 +1678,7 @@ void RTFDocumentImpl::resetTableRowProperties() RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) { setNeedSect(true); - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFSkipDestination aSkip(*this); int nSprm = -1; auto pBoolValue = std::make_shared<RTFValue>(int(!bParam || nParam != 0)); @@ -1624,57 +1686,58 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n // Underline toggles. switch (nKeyword) { - case RTF_UL: - nSprm = NS_ooxml::LN_Value_ST_Underline_single; - break; - case RTF_ULDASH: - nSprm = NS_ooxml::LN_Value_ST_Underline_dash; - break; - case RTF_ULDASHD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dotDash; - break; - case RTF_ULDASHDD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dotDotDash; - break; - case RTF_ULDB: - nSprm = NS_ooxml::LN_Value_ST_Underline_double; - break; - case RTF_ULHWAVE: - nSprm = NS_ooxml::LN_Value_ST_Underline_wavyHeavy; - break; - case RTF_ULLDASH: - nSprm = NS_ooxml::LN_Value_ST_Underline_dashLong; - break; - case RTF_ULTH: - nSprm = NS_ooxml::LN_Value_ST_Underline_thick; - break; - case RTF_ULTHD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dottedHeavy; - break; - case RTF_ULTHDASH: - nSprm = NS_ooxml::LN_Value_ST_Underline_dashedHeavy; - break; - case RTF_ULTHDASHD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotHeavy; - break; - case RTF_ULTHDASHDD: - nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotDotHeavy; - break; - case RTF_ULTHLDASH: - nSprm = NS_ooxml::LN_Value_ST_Underline_dashLongHeavy; - break; - case RTF_ULULDBWAVE: - nSprm = NS_ooxml::LN_Value_ST_Underline_wavyDouble; - break; - case RTF_ULWAVE: - nSprm = NS_ooxml::LN_Value_ST_Underline_wave; - break; - default: - break; + case RTF_UL: + nSprm = NS_ooxml::LN_Value_ST_Underline_single; + break; + case RTF_ULDASH: + nSprm = NS_ooxml::LN_Value_ST_Underline_dash; + break; + case RTF_ULDASHD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dotDash; + break; + case RTF_ULDASHDD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dotDotDash; + break; + case RTF_ULDB: + nSprm = NS_ooxml::LN_Value_ST_Underline_double; + break; + case RTF_ULHWAVE: + nSprm = NS_ooxml::LN_Value_ST_Underline_wavyHeavy; + break; + case RTF_ULLDASH: + nSprm = NS_ooxml::LN_Value_ST_Underline_dashLong; + break; + case RTF_ULTH: + nSprm = NS_ooxml::LN_Value_ST_Underline_thick; + break; + case RTF_ULTHD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dottedHeavy; + break; + case RTF_ULTHDASH: + nSprm = NS_ooxml::LN_Value_ST_Underline_dashedHeavy; + break; + case RTF_ULTHDASHD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotHeavy; + break; + case RTF_ULTHDASHDD: + nSprm = NS_ooxml::LN_Value_ST_Underline_dashDotDotHeavy; + break; + case RTF_ULTHLDASH: + nSprm = NS_ooxml::LN_Value_ST_Underline_dashLongHeavy; + break; + case RTF_ULULDBWAVE: + nSprm = NS_ooxml::LN_Value_ST_Underline_wavyDouble; + break; + case RTF_ULWAVE: + nSprm = NS_ooxml::LN_Value_ST_Underline_wave; + break; + default: + break; } if (nSprm >= 0) { - auto pValue = std::make_shared<RTFValue>((!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none); + auto pValue = std::make_shared<RTFValue>( + (!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none); m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); return RTFError::OK; } @@ -1682,23 +1745,23 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n // Accent characters (over dot / over comma). switch (nKeyword) { - case RTF_ACCNONE: - nSprm = NS_ooxml::LN_Value_ST_Em_none; - break; - case RTF_ACCDOT: - nSprm = NS_ooxml::LN_Value_ST_Em_dot; - break; - case RTF_ACCCOMMA: - nSprm = NS_ooxml::LN_Value_ST_Em_comma; - break; - case RTF_ACCCIRCLE: - nSprm = NS_ooxml::LN_Value_ST_Em_circle; - break; - case RTF_ACCUNDERDOT: - nSprm = NS_ooxml::LN_Value_ST_Em_underDot; - break; - default: - break; + case RTF_ACCNONE: + nSprm = NS_ooxml::LN_Value_ST_Em_none; + break; + case RTF_ACCDOT: + nSprm = NS_ooxml::LN_Value_ST_Em_dot; + break; + case RTF_ACCCOMMA: + nSprm = NS_ooxml::LN_Value_ST_Em_comma; + break; + case RTF_ACCCIRCLE: + nSprm = NS_ooxml::LN_Value_ST_Em_circle; + break; + case RTF_ACCUNDERDOT: + nSprm = NS_ooxml::LN_Value_ST_Em_underDot; + break; + default: + break; } if (nSprm >= 0) { @@ -1710,42 +1773,46 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n // Trivial character sprms. switch (nKeyword) { - case RTF_B: - case RTF_AB: - nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH) - ? NS_ooxml::LN_EG_RPrBase_bCs : NS_ooxml::LN_EG_RPrBase_b; - break; - case RTF_I: - case RTF_AI: - nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH) - ? NS_ooxml::LN_EG_RPrBase_iCs : NS_ooxml::LN_EG_RPrBase_i; - break; - case RTF_OUTL: - nSprm = NS_ooxml::LN_EG_RPrBase_outline; - break; - case RTF_SHAD: - nSprm = NS_ooxml::LN_EG_RPrBase_shadow; - break; - case RTF_V: - nSprm = NS_ooxml::LN_EG_RPrBase_vanish; - break; - case RTF_STRIKE: - nSprm = NS_ooxml::LN_EG_RPrBase_strike; - break; - case RTF_STRIKED: - nSprm = NS_ooxml::LN_EG_RPrBase_dstrike; - break; - case RTF_SCAPS: - nSprm = NS_ooxml::LN_EG_RPrBase_smallCaps; - break; - case RTF_IMPR: - nSprm = NS_ooxml::LN_EG_RPrBase_imprint; - break; - case RTF_CAPS: - nSprm = NS_ooxml::LN_EG_RPrBase_caps; - break; - default: - break; + case RTF_B: + case RTF_AB: + nSprm = (m_aStates.top().isRightToLeft + || m_aStates.top().eRunType == RTFParserState::RunType::HICH) + ? NS_ooxml::LN_EG_RPrBase_bCs + : NS_ooxml::LN_EG_RPrBase_b; + break; + case RTF_I: + case RTF_AI: + nSprm = (m_aStates.top().isRightToLeft + || m_aStates.top().eRunType == RTFParserState::RunType::HICH) + ? NS_ooxml::LN_EG_RPrBase_iCs + : NS_ooxml::LN_EG_RPrBase_i; + break; + case RTF_OUTL: + nSprm = NS_ooxml::LN_EG_RPrBase_outline; + break; + case RTF_SHAD: + nSprm = NS_ooxml::LN_EG_RPrBase_shadow; + break; + case RTF_V: + nSprm = NS_ooxml::LN_EG_RPrBase_vanish; + break; + case RTF_STRIKE: + nSprm = NS_ooxml::LN_EG_RPrBase_strike; + break; + case RTF_STRIKED: + nSprm = NS_ooxml::LN_EG_RPrBase_dstrike; + break; + case RTF_SCAPS: + nSprm = NS_ooxml::LN_EG_RPrBase_smallCaps; + break; + case RTF_IMPR: + nSprm = NS_ooxml::LN_EG_RPrBase_imprint; + break; + case RTF_CAPS: + nSprm = NS_ooxml::LN_EG_RPrBase_caps; + break; + default: + break; } if (nSprm >= 0) { @@ -1755,37 +1822,44 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n switch (nKeyword) { - case RTF_ASPALPHA: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, pBoolValue); - break; - case RTF_DELETED: - case RTF_REVISED: - { - auto pValue = std::make_shared<RTFValue>(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue); - } - break; - case RTF_SBAUTO: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_beforeAutospacing, pBoolValue); - break; - case RTF_SAAUTO: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_afterAutospacing, pBoolValue); - break; - case RTF_FACINGP: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, pBoolValue); - break; - case RTF_HYPHAUTO: - m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, pBoolValue); + case RTF_ASPALPHA: + m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, pBoolValue); + break; + case RTF_DELETED: + case RTF_REVISED: + { + auto pValue + = std::make_shared<RTFValue>(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins); + putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, + NS_ooxml::LN_token, pValue); + } break; - case RTF_HYPHPAR: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, std::make_shared<RTFValue>(int(bParam && nParam == 0))); + case RTF_SBAUTO: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + NS_ooxml::LN_CT_Spacing_beforeAutospacing, pBoolValue); + break; + case RTF_SAAUTO: + putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + NS_ooxml::LN_CT_Spacing_afterAutospacing, pBoolValue); + break; + case RTF_FACINGP: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, pBoolValue); + break; + case RTF_HYPHAUTO: + m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, pBoolValue); + break; + case RTF_HYPHPAR: + m_aStates.top().aParagraphSprms.set( + NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, + std::make_shared<RTFValue>(int(bParam && nParam == 0))); + break; + default: + { + SAL_INFO("writerfilter.rtf", + "TODO handle toggle '" << keywordToString(nKeyword) << "'"); + aSkip.setParsed(false); + } break; - default: - { - SAL_INFO("writerfilter.rtf", "TODO handle toggle '" << keywordToString(nKeyword) << "'"); - aSkip.setParsed(false); - } - break; } return RTFError::OK; } @@ -1794,7 +1868,7 @@ RTFError RTFDocumentImpl::pushState() { //SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << " before push: " << m_pTokenizer->getGroup()); - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); m_nGroupStartPos = Strm().Tell(); if (m_aStates.empty()) @@ -1814,48 +1888,48 @@ RTFError RTFDocumentImpl::pushState() switch (m_aStates.top().eDestination) { - case Destination::FONTTABLE: - // this is a "faked" destination for the font entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; - m_aStates.top().eDestination = Destination::FONTENTRY; - break; - case Destination::STYLESHEET: - // this is a "faked" destination for the style sheet entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; - m_aStates.top().eDestination = Destination::STYLEENTRY; - { - // the *default* is \s0 i.e. paragraph style default - // this will be overwritten by \sN \csN \dsN \tsN - m_nCurrentStyleIndex = 0; - auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); - } - break; - case Destination::FIELDRESULT: - case Destination::SHAPETEXT: - case Destination::FORMFIELD: - case Destination::FIELDINSTRUCTION: - case Destination::PICT: - m_aStates.top().eDestination = Destination::NORMAL; - break; - case Destination::MNUM: - case Destination::MDEN: - case Destination::ME: - case Destination::MFNAME: - case Destination::MLIM: - case Destination::MSUB: - case Destination::MSUP: - case Destination::MDEG: - case Destination::MOMATH: - m_aStates.top().eDestination = Destination::MR; - break; - case Destination::REVISIONTABLE: - // this is a "faked" destination for the revision table entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; - m_aStates.top().eDestination = Destination::REVISIONENTRY; - break; - default: - break; + case Destination::FONTTABLE: + // this is a "faked" destination for the font entry + m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().eDestination = Destination::FONTENTRY; + break; + case Destination::STYLESHEET: + // this is a "faked" destination for the style sheet entry + m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().eDestination = Destination::STYLEENTRY; + { + // the *default* is \s0 i.e. paragraph style default + // this will be overwritten by \sN \csN \dsN \tsN + m_nCurrentStyleIndex = 0; + auto pValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_StyleType_paragraph); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); + } + break; + case Destination::FIELDRESULT: + case Destination::SHAPETEXT: + case Destination::FORMFIELD: + case Destination::FIELDINSTRUCTION: + case Destination::PICT: + m_aStates.top().eDestination = Destination::NORMAL; + break; + case Destination::MNUM: + case Destination::MDEN: + case Destination::ME: + case Destination::MFNAME: + case Destination::MLIM: + case Destination::MSUB: + case Destination::MSUP: + case Destination::MDEG: + case Destination::MOMATH: + m_aStates.top().eDestination = Destination::MR; + break; + case Destination::REVISIONTABLE: + // this is a "faked" destination for the revision table entry + m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().eDestination = Destination::REVISIONENTRY; + break; + default: + break; } // If this is true, then ooxml:endtrackchange will be generated. Make sure @@ -1866,11 +1940,12 @@ RTFError RTFDocumentImpl::pushState() return RTFError::OK; } -writerfilter::Reference<Properties>::Pointer_t -RTFDocumentImpl::createStyleProperties() +writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::createStyleProperties() { - RTFValue::Pointer_t pParaProps = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); - RTFValue::Pointer_t pCharProps = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); + RTFValue::Pointer_t pParaProps = std::make_shared<RTFValue>( + m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); + RTFValue::Pointer_t pCharProps = std::make_shared<RTFValue>( + m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); // resetSprms will clean up this modification m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_pPr, pParaProps); @@ -1895,12 +1970,12 @@ void RTFDocumentImpl::resetAttributes() m_aStates.top().aParagraphAttributes.clear(); } -static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) +static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, + const OUString& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), [&](const beans::Property& rProperty) - { - return rProperty.Name == rName; - }) != rProperties.end(); + return std::find_if(rProperties.begin(), rProperties.end(), + [&](const beans::Property& rProperty) { return rProperty.Name == rName; }) + != rProperties.end(); } RTFError RTFDocumentImpl::popState() @@ -1908,7 +1983,7 @@ RTFError RTFDocumentImpl::popState() //SAL_INFO("writerfilter", OSL_THIS_FUNC << " before pop: m_pTokenizer->getGroup() " << m_pTokenizer->getGroup() << // ", dest state: " << m_aStates.top().eDestination); - checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true); + checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFParserState aState(m_aStates.top()); m_bWasInFrame = aState.aFrame.inFrame(); @@ -1917,885 +1992,966 @@ RTFError RTFDocumentImpl::popState() { switch (m_nStreamType) { - case NS_ooxml::LN_headerl: - case NS_ooxml::LN_headerr: - case NS_ooxml::LN_headerf: - case NS_ooxml::LN_footerl: - case NS_ooxml::LN_footerr: - case NS_ooxml::LN_footerf: - dispatchSymbol(RTF_PAR); - break; + case NS_ooxml::LN_headerl: + case NS_ooxml::LN_headerr: + case NS_ooxml::LN_headerf: + case NS_ooxml::LN_footerl: + case NS_ooxml::LN_footerr: + case NS_ooxml::LN_footerf: + dispatchSymbol(RTF_PAR); + break; } } switch (aState.eDestination) { - case Destination::FONTTABLE: - { - writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aFontTableEntries)); - Mapper().table(NS_ooxml::LN_FONTTABLE, pTable); - if (m_nDefaultFontIndex >= 0) + case Destination::FONTTABLE: { - auto pValue = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); - putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pValue); + writerfilter::Reference<Table>::Pointer_t const pTable( + new RTFReferenceTable(m_aFontTableEntries)); + Mapper().table(NS_ooxml::LN_FONTTABLE, pTable); + if (m_nDefaultFontIndex >= 0) + { + auto pValue + = std::make_shared<RTFValue>(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); + putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, + NS_ooxml::LN_CT_Fonts_ascii, pValue); + } } - } - break; - case Destination::STYLESHEET: - { - writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStyleTableEntries)); - Mapper().table(NS_ooxml::LN_STYLESHEET, pTable); - } - break; - case Destination::LISTOVERRIDETABLE: - { - RTFSprms aListTableAttributes; - writerfilter::Reference<Properties>::Pointer_t pProp = std::make_shared<RTFReferenceProperties>(aListTableAttributes, m_aListTableSprms); - RTFReferenceTable::Entries_t aListTableEntries; - aListTableEntries.insert(std::make_pair(0, pProp)); - writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries)); - Mapper().table(NS_ooxml::LN_NUMBERING, pTable); - } - break; - case Destination::LISTENTRY: - for (auto& rListLevelEntry : aState.aListLevelEntries) - aState.aTableSprms.set(rListLevelEntry.first, rListLevelEntry.second, RTFOverwrite::NO_APPEND); break; - case Destination::FIELDINSTRUCTION: - { - auto pValue = std::make_shared<RTFValue>(m_aFormfieldAttributes, m_aFormfieldSprms); - RTFSprms aFFAttributes; - RTFSprms aFFSprms; - aFFSprms.set(NS_ooxml::LN_ffdata, pValue); - if (!m_aStates.top().pCurrentBuffer) + case Destination::STYLESHEET: { - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aFFAttributes, aFFSprms); - Mapper().props(pProperties); + writerfilter::Reference<Table>::Pointer_t const pTable( + new RTFReferenceTable(m_aStyleTableEntries)); + Mapper().table(NS_ooxml::LN_STYLESHEET, pTable); } - else + break; + case Destination::LISTOVERRIDETABLE: { - auto pFFValue = std::make_shared<RTFValue>(aFFAttributes, aFFSprms); - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pFFValue, nullptr)); + RTFSprms aListTableAttributes; + writerfilter::Reference<Properties>::Pointer_t pProp + = std::make_shared<RTFReferenceProperties>(aListTableAttributes, m_aListTableSprms); + RTFReferenceTable::Entries_t aListTableEntries; + aListTableEntries.insert(std::make_pair(0, pProp)); + writerfilter::Reference<Table>::Pointer_t const pTable( + new RTFReferenceTable(aListTableEntries)); + Mapper().table(NS_ooxml::LN_NUMBERING, pTable); } - m_aFormfieldAttributes.clear(); - m_aFormfieldSprms.clear(); - singleChar(cFieldSep); - } - break; - case Destination::FIELDRESULT: - singleChar(cFieldEnd); - - if (!m_aPicturePath.isEmpty()) + break; + case Destination::LISTENTRY: + for (auto& rListLevelEntry : aState.aListLevelEntries) + aState.aTableSprms.set(rListLevelEntry.first, rListLevelEntry.second, + RTFOverwrite::NO_APPEND); + break; + case Destination::FIELDINSTRUCTION: { - // Read the picture into m_aStates.top().aDestinationText. - pushState(); - dispatchDestination(RTF_PICT); - if (m_aPicturePath.endsWith(".png")) - dispatchFlag(RTF_PNGBLIP); - OUString aFileURL = m_rMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), OUString()); - OUString aPictureURL; - try + auto pValue = std::make_shared<RTFValue>(m_aFormfieldAttributes, m_aFormfieldSprms); + RTFSprms aFFAttributes; + RTFSprms aFFSprms; + aFFSprms.set(NS_ooxml::LN_ffdata, pValue); + if (!m_aStates.top().pCurrentBuffer) { - aPictureURL = rtl::Uri::convertRelToAbs(aFileURL, m_aPicturePath); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aFFAttributes, aFFSprms); + Mapper().props(pProperties); } - catch (const rtl::MalformedUriException& rException) + else { - SAL_WARN("writerfilter.rtf", "rtl::Uri::convertRelToAbs() failed: " << rException.getMessage()); + auto pFFValue = std::make_shared<RTFValue>(aFFAttributes, aFFSprms); + m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, pFFValue, nullptr)); } + m_aFormfieldAttributes.clear(); + m_aFormfieldSprms.clear(); + singleChar(cFieldSep); + } + break; + case Destination::FIELDRESULT: + singleChar(cFieldEnd); - if (!aPictureURL.isEmpty()) + if (!m_aPicturePath.isEmpty()) { - SvFileStream aStream(aPictureURL, StreamMode::READ); - if (aStream.IsOpen()) + // Read the picture into m_aStates.top().aDestinationText. + pushState(); + dispatchDestination(RTF_PICT); + if (m_aPicturePath.endsWith(".png")) + dispatchFlag(RTF_PNGBLIP); + OUString aFileURL = m_rMediaDescriptor.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_URL(), OUString()); + OUString aPictureURL; + try { - OUStringBuffer aBuf; - while (aStream.good()) + aPictureURL = rtl::Uri::convertRelToAbs(aFileURL, m_aPicturePath); + } + catch (const rtl::MalformedUriException& rException) + { + SAL_WARN("writerfilter.rtf", + "rtl::Uri::convertRelToAbs() failed: " << rException.getMessage()); + } + + if (!aPictureURL.isEmpty()) + { + SvFileStream aStream(aPictureURL, StreamMode::READ); + if (aStream.IsOpen()) { - unsigned char ch = 0; - aStream.ReadUChar(ch); - if (ch < 16) - aBuf.append("0"); - aBuf.append(OUString::number(ch, 16)); + OUStringBuffer aBuf; + while (aStream.good()) + { + unsigned char ch = 0; + aStream.ReadUChar(ch); + if (ch < 16) + aBuf.append("0"); + aBuf.append(OUString::number(ch, 16)); + } + m_aStates.top().aDestinationText = aBuf; } - m_aStates.top().aDestinationText = aBuf; } + popState(); + m_aPicturePath.clear(); } - popState(); - m_aPicturePath.clear(); - } - break; - case Destination::LEVELTEXT: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + break; + case Destination::LEVELTEXT: + { + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - // The first character is the length of the string (the rest should be ignored). - sal_Int32 nLength(aStr.toChar()); - OUString aValue; - if (nLength < aStr.getLength()) - aValue = aStr.copy(1, nLength); - else - aValue = aStr; - auto pValue = std::make_shared<RTFValue>(aValue, true); - aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); - } - break; - case Destination::LEVELNUMBERS: - { - bool bNestedLevelNumbers = false; - if (m_aStates.size() > 1) - // Current destination is levelnumbers and parent destination is levelnumbers as well. - bNestedLevelNumbers = m_aStates[m_aStates.size() - 2].eDestination == Destination::LEVELNUMBERS; - if (!bNestedLevelNumbers && aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)) + // The first character is the length of the string (the rest should be ignored). + sal_Int32 nLength(aStr.toChar()); + OUString aValue; + if (nLength < aStr.getLength()) + aValue = aStr.copy(1, nLength); + else + aValue = aStr; + auto pValue = std::make_shared<RTFValue>(aValue, true); + aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); + } + break; + case Destination::LEVELNUMBERS: { - RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); - RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val); - if (pValue && aState.bLevelNumbersValid) + bool bNestedLevelNumbers = false; + if (m_aStates.size() > 1) + // Current destination is levelnumbers and parent destination is levelnumbers as well. + bNestedLevelNumbers + = m_aStates[m_aStates.size() - 2].eDestination == Destination::LEVELNUMBERS; + if (!bNestedLevelNumbers && aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)) { - OUString aOrig = pValue->getString(); - - OUStringBuffer aBuf; - sal_Int32 nReplaces = 1; - for (int i = 0; i < aOrig.getLength(); i++) + RTFSprms& rAttributes + = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); + RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val); + if (pValue && aState.bLevelNumbersValid) { - if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), i+1) - != aState.aLevelNumbers.end()) + OUString aOrig = pValue->getString(); + + OUStringBuffer aBuf; + sal_Int32 nReplaces = 1; + for (int i = 0; i < aOrig.getLength(); i++) { - aBuf.append('%'); - // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2. - aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 - aState.aLevelNumbers.size())); + if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), + i + 1) + != aState.aLevelNumbers.end()) + { + aBuf.append('%'); + // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2. + aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 + - aState.aLevelNumbers.size())); + } + else + aBuf.append(aOrig.copy(i, 1)); } - else - aBuf.append(aOrig.copy(i, 1)); - } - pValue->setString(aBuf.makeStringAndClear()); + pValue->setString(aBuf.makeStringAndClear()); + } + else if (pValue) + // Have a value, but levelnumbers is not valid -> ignore it. + pValue->setString(OUString()); } - else if (pValue) - // Have a value, but levelnumbers is not valid -> ignore it. - pValue->setString(OUString()); + break; } - break; - } - case Destination::SHAPEPROPERTYNAME: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - aState.aShape.aProperties.emplace_back(m_aStates.top().pDestinationText->makeStringAndClear(), OUString()); - break; - case Destination::SHAPEPROPERTYVALUE: - if (!aState.aShape.aProperties.empty()) - { - aState.aShape.aProperties.back().second = m_aStates.top().pDestinationText->makeStringAndClear(); - if (m_aStates.top().bHadShapeText) - m_pSdrImport->append(aState.aShape.aProperties.back().first, aState.aShape.aProperties.back().second); - else if (aState.bInShapeGroup && !aState.bInShape && aState.aShape.aProperties.back().first == "rotation") + case Destination::SHAPEPROPERTYNAME: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + aState.aShape.aProperties.emplace_back( + m_aStates.top().pDestinationText->makeStringAndClear(), OUString()); + break; + case Destination::SHAPEPROPERTYVALUE: + if (!aState.aShape.aProperties.empty()) + { + aState.aShape.aProperties.back().second + = m_aStates.top().pDestinationText->makeStringAndClear(); + if (m_aStates.top().bHadShapeText) + m_pSdrImport->append(aState.aShape.aProperties.back().first, + aState.aShape.aProperties.back().second); + else if (aState.bInShapeGroup && !aState.bInShape + && aState.aShape.aProperties.back().first == "rotation") + { + // Rotation should be applied on the groupshape itself, not on each shape. + aState.aShape.aGroupProperties.push_back(aState.aShape.aProperties.back()); + aState.aShape.aProperties.pop_back(); + } + } + break; + case Destination::PICPROP: + case Destination::SHAPEINSTRUCTION: + if (m_aStates.size() > 1 + && m_aStates[m_aStates.size() - 2].eDestination == Destination::SHAPEINSTRUCTION) + { + // Do not resolve shape if shape instruction destination is inside other shape instruction + } + else if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText + && !(aState.bInShapeGroup && !aState.bInShape)) + { + // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. + RTFSdrImport::ShapeOrPict eType + = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE + : RTFSdrImport::PICT; + if (!m_aStates.top().pCurrentBuffer || eType != RTFSdrImport::SHAPE) + m_pSdrImport->resolve(m_aStates.top().aShape, true, eType); + else + { + // Shape inside table: buffer the import to have correct anchor position. + // Also buffer the RTFPicture of the state stack as it contains + // the shape size. + auto pPictureValue = std::make_shared<RTFValue>(m_aStates.top().aPicture); + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_PICTURE, pPictureValue, nullptr)); + auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_RESOLVESHAPE, pValue, nullptr)); + } + } + else if (aState.bInShapeGroup && !aState.bInShape) { - // Rotation should be applied on the groupshape itself, not on each shape. - aState.aShape.aGroupProperties.push_back(aState.aShape.aProperties.back()); - aState.aShape.aProperties.pop_back(); + // End of a groupshape, as we're in shapegroup, but not in a real shape. + for (auto& rGroupProperty : aState.aShape.aGroupProperties) + m_pSdrImport->appendGroupProperty(rGroupProperty.first, rGroupProperty.second); + aState.aShape.aGroupProperties.clear(); } + break; + case Destination::BOOKMARKSTART: + { + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + int nPos = m_aBookmarks.size(); + m_aBookmarks[aStr] = nPos; + if (!m_aStates.top().pCurrentBuffer) + Mapper().props(std::make_shared<RTFReferenceProperties>( + lcl_getBookmarkProperties(nPos, aStr))); + else + m_aStates.top().pCurrentBuffer->push_back(Buf_t( + BUFFER_PROPS, std::make_shared<RTFValue>(lcl_getBookmarkProperties(nPos, aStr)), + nullptr)); } break; - case Destination::PICPROP: - case Destination::SHAPEINSTRUCTION: - if (m_aStates.size() > 1 && m_aStates[m_aStates.size() - 2].eDestination == Destination::SHAPEINSTRUCTION) + case Destination::BOOKMARKEND: { - // Do not resolve shape if shape instruction destination is inside other shape instruction + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + if (!m_aStates.top().pCurrentBuffer) + Mapper().props(std::make_shared<RTFReferenceProperties>( + lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr))); + else + m_aStates.top().pCurrentBuffer->push_back(Buf_t( + BUFFER_PROPS, + std::make_shared<RTFValue>(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)), + nullptr)); } - else if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape)) + break; + case Destination::INDEXENTRY: + case Destination::TOCENTRY: { - // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. - RTFSdrImport::ShapeOrPict eType = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE : RTFSdrImport::PICT; - if (!m_aStates.top().pCurrentBuffer || eType != RTFSdrImport::SHAPE) - m_pSdrImport->resolve(m_aStates.top().aShape, true, eType); - else - { - // Shape inside table: buffer the import to have correct anchor position. - // Also buffer the RTFPicture of the state stack as it contains - // the shape size. - auto pPictureValue = std::make_shared<RTFValue>(m_aStates.top().aPicture); - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PICTURE, pPictureValue, nullptr)); - auto pValue = std::make_shared<RTFValue>(m_aStates.top().aShape); - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_RESOLVESHAPE, pValue, nullptr)); - } + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString str(m_aStates.top().pDestinationText->makeStringAndClear()); + // dmapper expects this as a field, so let's fake something... + OUString const field((Destination::INDEXENTRY == aState.eDestination) + ? OUStringLiteral("XE") + : OUStringLiteral("TC")); + str = field + " \"" + str.replaceAll("\"", "\\\"") + "\""; + singleChar(cFieldStart); + Mapper().utext(reinterpret_cast<sal_uInt8 const*>(str.getStr()), str.getLength()); + singleChar(cFieldSep); + // no result + singleChar(cFieldEnd); } - else if (aState.bInShapeGroup && !aState.bInShape) + break; + case Destination::FORMFIELDNAME: { - // End of a groupshape, as we're in shapegroup, but not in a real shape. - for (auto& rGroupProperty : aState.aShape.aGroupProperties) - m_pSdrImport->appendGroupProperty(rGroupProperty.first, rGroupProperty.second); - aState.aShape.aGroupProperties.clear(); + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + auto pValue = std::make_shared<RTFValue>( + m_aStates.top().pDestinationText->makeStringAndClear()); + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue); } break; - case Destination::BOOKMARKSTART: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - int nPos = m_aBookmarks.size(); - m_aBookmarks[aStr] = nPos; - if (!m_aStates.top().pCurrentBuffer) - Mapper().props(std::make_shared<RTFReferenceProperties>(lcl_getBookmarkProperties(nPos, aStr))); - else - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, std::make_shared<RTFValue>(lcl_getBookmarkProperties(nPos, aStr)), nullptr)); - } - break; - case Destination::BOOKMARKEND: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - if (!m_aStates.top().pCurrentBuffer) - Mapper().props(std::make_shared<RTFReferenceProperties>(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr))); - else - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, std::make_shared<RTFValue>(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)), nullptr)); - } - break; - case Destination::INDEXENTRY: - case Destination::TOCENTRY: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString str(m_aStates.top().pDestinationText->makeStringAndClear()); - // dmapper expects this as a field, so let's fake something... - OUString const field( - (Destination::INDEXENTRY == aState.eDestination) ? OUStringLiteral("XE") : OUStringLiteral("TC")); - str = field + " \"" + str.replaceAll("\"", "\\\"") + "\""; - singleChar(cFieldStart); - Mapper().utext(reinterpret_cast<sal_uInt8 const*>(str.getStr()), str.getLength()); - singleChar(cFieldSep); - // no result - singleChar(cFieldEnd); - } - break; - case Destination::FORMFIELDNAME: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - auto pValue = std::make_shared<RTFValue>(m_aStates.top().pDestinationText->makeStringAndClear()); - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue); - } - break; - case Destination::FORMFIELDLIST: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - auto pValue = std::make_shared<RTFValue>(m_aStates.top().pDestinationText->makeStringAndClear()); - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue); - } - break; - case Destination::DATAFIELD: - { - if (m_bFormField) + case Destination::FORMFIELDLIST: { if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group - OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), aState.nCurrentEncoding); - // decode hex dump - OStringBuffer aBuf; - int b = 0, count = 2; - for (int i = 0; i < aStr.getLength(); ++i) + auto pValue = std::make_shared<RTFValue>( + m_aStates.top().pDestinationText->makeStringAndClear()); + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue); + } + break; + case Destination::DATAFIELD: + { + if (m_bFormField) { - char ch = aStr[i]; - if (ch != 0x0d && ch != 0x0a) + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OString aStr + = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), + aState.nCurrentEncoding); + // decode hex dump + OStringBuffer aBuf; + int b = 0, count = 2; + for (int i = 0; i < aStr.getLength(); ++i) { - b = b << 4; - sal_Int8 parsed = RTFTokenizer::asHex(ch); - if (parsed == -1) - return RTFError::HEX_INVALID; - b += parsed; - count--; - if (!count) + char ch = aStr[i]; + if (ch != 0x0d && ch != 0x0a) { - aBuf.append((char)b); - count = 2; - b = 0; + b = b << 4; + sal_Int8 parsed = RTFTokenizer::asHex(ch); + if (parsed == -1) + return RTFError::HEX_INVALID; + b += parsed; + count--; + if (!count) + { + aBuf.append((char)b); + count = 2; + b = 0; + } } } - } - aStr = aBuf.makeStringAndClear(); - - // ignore the first bytes - if (aStr.getLength() > 8) - aStr = aStr.copy(8); - // extract name - sal_Int32 nLength = aStr.toChar(); - if (!aStr.isEmpty()) - aStr = aStr.copy(1); - nLength = std::min(nLength, aStr.getLength()); - OString aName = aStr.copy(0, nLength); - if (aStr.getLength() > nLength) - aStr = aStr.copy(nLength+1); // zero-terminated string - else - aStr.clear(); - // extract default text - nLength = aStr.toChar(); - if (!aStr.isEmpty()) - aStr = aStr.copy(1); - auto pNValue = std::make_shared<RTFValue>(OStringToOUString(aName, aState.nCurrentEncoding)); - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue); - if (nLength > 0) - { - OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength())); - auto pDValue = std::make_shared<RTFValue>(OStringToOUString(aDefaultText, aState.nCurrentEncoding)); - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); - } + aStr = aBuf.makeStringAndClear(); + + // ignore the first bytes + if (aStr.getLength() > 8) + aStr = aStr.copy(8); + // extract name + sal_Int32 nLength = aStr.toChar(); + if (!aStr.isEmpty()) + aStr = aStr.copy(1); + nLength = std::min(nLength, aStr.getLength()); + OString aName = aStr.copy(0, nLength); + if (aStr.getLength() > nLength) + aStr = aStr.copy(nLength + 1); // zero-terminated string + else + aStr.clear(); + // extract default text + nLength = aStr.toChar(); + if (!aStr.isEmpty()) + aStr = aStr.copy(1); + auto pNValue + = std::make_shared<RTFValue>(OStringToOUString(aName, aState.nCurrentEncoding)); + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue); + if (nLength > 0) + { + OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength())); + auto pDValue = std::make_shared<RTFValue>( + OStringToOUString(aDefaultText, aState.nCurrentEncoding)); + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); + } - m_bFormField = false; + m_bFormField = false; + } } - } - break; - case Destination::CREATIONTIME: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setCreationDate(lcl_getDateTime(aState)); - break; - case Destination::REVISIONTIME: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setModificationDate(lcl_getDateTime(aState)); break; - case Destination::PRINTTIME: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState)); - break; - case Destination::AUTHOR: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setAuthor(m_aStates.top().pDestinationText->makeStringAndClear()); - break; - case Destination::KEYWORDS: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().pDestinationText->makeStringAndClear())); - break; - case Destination::COMMENT: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setGenerator(m_aStates.top().pDestinationText->makeStringAndClear()); - break; - case Destination::SUBJECT: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setSubject(m_aStates.top().pDestinationText->makeStringAndClear()); + case Destination::CREATIONTIME: + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setCreationDate(lcl_getDateTime(aState)); + break; + case Destination::REVISIONTIME: + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setModificationDate(lcl_getDateTime(aState)); + break; + case Destination::PRINTTIME: + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState)); + break; + case Destination::AUTHOR: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setAuthor( + m_aStates.top().pDestinationText->makeStringAndClear()); + break; + case Destination::KEYWORDS: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated( + m_aStates.top().pDestinationText->makeStringAndClear())); + break; + case Destination::COMMENT: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setGenerator( + m_aStates.top().pDestinationText->makeStringAndClear()); + break; + case Destination::SUBJECT: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setSubject( + m_aStates.top().pDestinationText->makeStringAndClear()); + break; + case Destination::TITLE: + { + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setTitle(aState.pDestinationText->makeStringAndClear()); + } break; - case Destination::TITLE: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setTitle(aState.pDestinationText->makeStringAndClear()); - } - break; - case Destination::DOCCOMM: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setDescription(m_aStates.top().pDestinationText->makeStringAndClear()); - break; - case Destination::OPERATOR: - case Destination::COMPANY: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator") : OUString("Company"); - uno::Any aValue = uno::makeAny(m_aStates.top().pDestinationText->makeStringAndClear()); - if (m_xDocumentProperties.is()) + case Destination::DOCCOMM: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) + m_xDocumentProperties->setDescription( + m_aStates.top().pDestinationText->makeStringAndClear()); + break; + case Destination::OPERATOR: + case Destination::COMPANY: { - uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties(); - uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY); - uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); - if (xPropertySetInfo->hasPropertyByName(aName)) - xPropertySet->setPropertyValue(aName, aValue); - else - xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE, aValue); + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator") + : OUString("Company"); + uno::Any aValue = uno::makeAny(m_aStates.top().pDestinationText->makeStringAndClear()); + if (m_xDocumentProperties.is()) + { + uno::Reference<beans::XPropertyContainer> xUserDefinedProperties + = m_xDocumentProperties->getUserDefinedProperties(); + uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, + uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropertySetInfo + = xPropertySet->getPropertySetInfo(); + if (xPropertySetInfo->hasPropertyByName(aName)) + xPropertySet->setPropertyValue(aName, aValue); + else + xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE, + aValue); + } } - } - break; - case Destination::OBJDATA: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - - RTFError eError = handleEmbeddedObject(); - if (eError != RTFError::OK) - return eError; - } - break; - case Destination::OBJCLASS: - { - auto pValue = std::make_shared<RTFValue>(m_aStates.top().pDestinationText->makeStringAndClear()); - m_aOLEAttributes.set(NS_ooxml::LN_CT_OLEObject_ProgID, pValue); break; - } - case Destination::OBJECT: - { - if (!m_bObject) + case Destination::OBJDATA: { - // if the object is in a special container we will use the \result - // element instead of the \objdata - // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination) - break; - } + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group - RTFSprms aObjectSprms; - auto pOLEValue = std::make_shared<RTFValue>(m_aOLEAttributes); - aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pOLEValue); - - RTFSprms aObjAttributes; - RTFSprms aObjSprms; - auto pValue = std::make_shared<RTFValue>(m_aObjectAttributes, aObjectSprms); - aObjSprms.set(NS_ooxml::LN_object, pValue); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aObjAttributes, aObjSprms); - uno::Reference<drawing::XShape> xShape; - RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape); - OSL_ASSERT(pShape.get()); - if (pShape) - pShape->getAny() >>= xShape; - if (xShape.is()) - { - Mapper().startShape(xShape); - Mapper().props(pProperties); - Mapper().endShape(); + RTFError eError = handleEmbeddedObject(); + if (eError != RTFError::OK) + return eError; } - m_aObjectAttributes.clear(); - m_aOLEAttributes.clear(); - m_bObject = false; - } - break; - case Destination::ANNOTATIONDATE: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr(OStringToOUString(DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()), - aState.nCurrentEncoding)); - auto pValue = std::make_shared<RTFValue>(aStr); - RTFSprms aAnnAttributes; - aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAnnAttributes); - Mapper().props(pProperties); - } - break; - case Destination::ANNOTATIONAUTHOR: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - m_aAuthor = m_aStates.top().pDestinationText->makeStringAndClear(); - break; - case Destination::ATNID: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - m_aAuthorInitials = m_aStates.top().pDestinationText->makeStringAndClear(); break; - case Destination::ANNOTATIONREFERENCESTART: - case Destination::ANNOTATIONREFERENCEEND: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - auto pValue = std::make_shared<RTFValue>(aStr.toInt32()); - RTFSprms aAttributes; - if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART) - aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); - else - aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes); - Mapper().props(pProperties); - } - break; - case Destination::ANNOTATIONREFERENCE: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); - RTFSprms aAnnAttributes; - aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, std::make_shared<RTFValue>(aStr.toInt32())); - Mapper().props(std::make_shared<RTFReferenceProperties>(aAnnAttributes)); - } - break; - case Destination::FALT: - { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear()); - auto pValue = std::make_shared<RTFValue>(aStr); - aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue); - } - break; - case Destination::DRAWINGOBJECT: - if (m_aStates.top().aDrawingObject.xShape.is()) + case Destination::OBJCLASS: { - RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject; - uno::Reference<drawing::XShape> xShape(rDrawing.xShape); - uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.xPropertySet); - - uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY); - bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame"); - - // The default is certainly not inline, but then what Word supports is just at-character. - xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); - - if (bTextFrame) - { - xPropertySet->setPropertyValue("HoriOrientPosition", uno::makeAny(rDrawing.nLeft)); - xPropertySet->setPropertyValue("VertOrientPosition", uno::makeAny(rDrawing.nTop)); - } - else - { - xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop)); - } - xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom)); - - if (rDrawing.bHasLineColor) + auto pValue = std::make_shared<RTFValue>( + m_aStates.top().pDestinationText->makeStringAndClear()); + m_aOLEAttributes.set(NS_ooxml::LN_CT_OLEObject_ProgID, pValue); + break; + } + case Destination::OBJECT: + { + if (!m_bObject) { - uno::Any aLineColor = uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB)); - uno::Any aLineWidth; - RTFSdrImport::resolveLineColorAndWidth(bTextFrame, xPropertySet, aLineColor, aLineWidth); + // if the object is in a special container we will use the \result + // element instead of the \objdata + // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination) + break; } - if (rDrawing.bHasFillColor) - xPropertySet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR<<16) + (rDrawing.nFillColorG<<8) + rDrawing.nFillColorB))); - else if (!bTextFrame) - // If there is no fill, the Word default is 100% transparency. - xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100))); - - RTFSdrImport::resolveFLine(xPropertySet, rDrawing.nFLine); - if (!m_aStates.top().aDrawingObject.bHadShapeText) + RTFSprms aObjectSprms; + auto pOLEValue = std::make_shared<RTFValue>(m_aOLEAttributes); + aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pOLEValue); + + RTFSprms aObjAttributes; + RTFSprms aObjSprms; + auto pValue = std::make_shared<RTFValue>(m_aObjectAttributes, aObjectSprms); + aObjSprms.set(NS_ooxml::LN_object, pValue); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aObjAttributes, aObjSprms); + uno::Reference<drawing::XShape> xShape; + RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape); + OSL_ASSERT(pShape.get()); + if (pShape) + pShape->getAny() >>= xShape; + if (xShape.is()) { Mapper().startShape(xShape); + Mapper().props(pProperties); + Mapper().endShape(); } - Mapper().endShape(); + m_aObjectAttributes.clear(); + m_aOLEAttributes.clear(); + m_bObject = false; } break; - case Destination::PICT: - // fdo#79319 ignore picture data if it's really a shape - if (!m_pSdrImport->isFakePict()) + case Destination::ANNOTATIONDATE: { - resolvePict(true, m_pSdrImport->getCurrentShape()); + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr(OStringToOUString( + DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()), + aState.nCurrentEncoding)); + auto pValue = std::make_shared<RTFValue>(aStr); + RTFSprms aAnnAttributes; + aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAnnAttributes); + Mapper().props(pProperties); } - m_bNeedFinalPar = true; break; - case Destination::SHAPE: - m_bNeedFinalPar = true; - m_bNeedCr = m_bNeedCrOrig; - if (aState.aFrame.inFrame()) + case Destination::ANNOTATIONAUTHOR: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + m_aAuthor = m_aStates.top().pDestinationText->makeStringAndClear(); + break; + case Destination::ATNID: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + m_aAuthorInitials = m_aStates.top().pDestinationText->makeStringAndClear(); + break; + case Destination::ANNOTATIONREFERENCESTART: + case Destination::ANNOTATIONREFERENCEEND: { - // parBreak() modifies m_aStates.top() so we can't apply resetFrame() directly on aState - resetFrame(); - parBreak(); - // Save this state for later use, so we only reset frame status only for the first shape inside a frame. - aState = m_aStates.top(); - m_bNeedPap = true; + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + auto pValue = std::make_shared<RTFValue>(aStr.toInt32()); + RTFSprms aAttributes; + if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART) + aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); + else + aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aAttributes); + Mapper().props(pProperties); } break; - case Destination::MOMATH: - { - m_aMathBuffer.appendClosingTag(M_TOKEN(oMath)); - - SvGlobalName aGlobalName(SO3_SM_CLASSID); - comphelper::EmbeddedObjectContainer aContainer; - OUString aName; - uno::Reference<embed::XEmbeddedObject> xObject = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName); - uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY_THROW); - // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, - // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated - // to RTLD_GLOBAL, so most probably a gcc bug. - auto& rImport = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*xComponent.get())); - rImport.readFormulaOoxml(m_aMathBuffer); - auto pValue = std::make_shared<RTFValue>(xObject); - RTFSprms aMathAttributes; - aMathAttributes.set(NS_ooxml::LN_starmath, pValue); - writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aMathAttributes); - Mapper().props(pProperties); - m_aMathBuffer = oox::formulaimport::XmlStreamBuilder(); - } - break; - case Destination::MR: - lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); - break; - case Destination::MF: - m_aMathBuffer.appendClosingTag(M_TOKEN(f)); - break; - case Destination::MFPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(fPr)); - break; - case Destination::MCTRLPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(ctrlPr)); - break; - case Destination::MNUM: - m_aMathBuffer.appendClosingTag(M_TOKEN(num)); - break; - case Destination::MDEN: - m_aMathBuffer.appendClosingTag(M_TOKEN(den)); + case Destination::ANNOTATIONREFERENCE: + { + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + RTFSprms aAnnAttributes; + aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, + std::make_shared<RTFValue>(aStr.toInt32())); + Mapper().props(std::make_shared<RTFReferenceProperties>(aAnnAttributes)); + } break; - case Destination::MACC: - m_aMathBuffer.appendClosingTag(M_TOKEN(acc)); + case Destination::FALT: + { + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue = std::make_shared<RTFValue>(aStr); + aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue); + } break; - case Destination::MACCPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(accPr)); + case Destination::DRAWINGOBJECT: + if (m_aStates.top().aDrawingObject.xShape.is()) + { + RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject; + uno::Reference<drawing::XShape> xShape(rDrawing.xShape); + uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.xPropertySet); + + uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY); + bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame"); + + // The default is certainly not inline, but then what Word supports is just at-character. + xPropertySet->setPropertyValue( + "AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); + + if (bTextFrame) + { + xPropertySet->setPropertyValue("HoriOrientPosition", + uno::makeAny(rDrawing.nLeft)); + xPropertySet->setPropertyValue("VertOrientPosition", + uno::makeAny(rDrawing.nTop)); + } + else + { + xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop)); + } + xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom)); + + if (rDrawing.bHasLineColor) + { + uno::Any aLineColor = uno::makeAny(sal_uInt32((rDrawing.nLineColorR << 16) + + (rDrawing.nLineColorG << 8) + + rDrawing.nLineColorB)); + uno::Any aLineWidth; + RTFSdrImport::resolveLineColorAndWidth(bTextFrame, xPropertySet, aLineColor, + aLineWidth); + } + if (rDrawing.bHasFillColor) + xPropertySet->setPropertyValue( + "FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR << 16) + + (rDrawing.nFillColorG << 8) + + rDrawing.nFillColorB))); + else if (!bTextFrame) + // If there is no fill, the Word default is 100% transparency. + xPropertySet->setPropertyValue("FillTransparence", + uno::makeAny(sal_Int32(100))); + + RTFSdrImport::resolveFLine(xPropertySet, rDrawing.nFLine); + + if (!m_aStates.top().aDrawingObject.bHadShapeText) + { + Mapper().startShape(xShape); + } + Mapper().endShape(); + } + break; + case Destination::PICT: + // fdo#79319 ignore picture data if it's really a shape + if (!m_pSdrImport->isFakePict()) + { + resolvePict(true, m_pSdrImport->getCurrentShape()); + } + m_bNeedFinalPar = true; + break; + case Destination::SHAPE: + m_bNeedFinalPar = true; + m_bNeedCr = m_bNeedCrOrig; + if (aState.aFrame.inFrame()) + { + // parBreak() modifies m_aStates.top() so we can't apply resetFrame() directly on aState + resetFrame(); + parBreak(); + // Save this state for later use, so we only reset frame status only for the first shape inside a frame. + aState = m_aStates.top(); + m_bNeedPap = true; + } + break; + case Destination::MOMATH: + { + m_aMathBuffer.appendClosingTag(M_TOKEN(oMath)); + + SvGlobalName aGlobalName(SO3_SM_CLASSID); + comphelper::EmbeddedObjectContainer aContainer; + OUString aName; + uno::Reference<embed::XEmbeddedObject> xObject + = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName); + uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), + uno::UNO_QUERY_THROW); + // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, + // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated + // to RTLD_GLOBAL, so most probably a gcc bug. + auto& rImport = dynamic_cast<oox::FormulaImportBase&>( + dynamic_cast<SfxBaseModel&>(*xComponent.get())); + rImport.readFormulaOoxml(m_aMathBuffer); + auto pValue = std::make_shared<RTFValue>(xObject); + RTFSprms aMathAttributes; + aMathAttributes.set(NS_ooxml::LN_starmath, pValue); + writerfilter::Reference<Properties>::Pointer_t pProperties + = std::make_shared<RTFReferenceProperties>(aMathAttributes); + Mapper().props(pProperties); + m_aMathBuffer = oox::formulaimport::XmlStreamBuilder(); + } break; - case Destination::MCHR: - case Destination::MPOS: - case Destination::MVERTJC: - case Destination::MSTRIKEH: - case Destination::MDEGHIDE: - case Destination::MBEGCHR: - case Destination::MSEPCHR: - case Destination::MENDCHR: - case Destination::MSUBHIDE: - case Destination::MSUPHIDE: - case Destination::MTYPE: - case Destination::MGROW: - { - sal_Int32 nMathToken = 0; - switch (aState.eDestination) - { - case Destination::MCHR: - nMathToken = M_TOKEN(chr); + case Destination::MR: + lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); break; - case Destination::MPOS: - nMathToken = M_TOKEN(pos); + case Destination::MF: + m_aMathBuffer.appendClosingTag(M_TOKEN(f)); break; - case Destination::MVERTJC: - nMathToken = M_TOKEN(vertJc); + case Destination::MFPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(fPr)); break; - case Destination::MSTRIKEH: - nMathToken = M_TOKEN(strikeH); + case Destination::MCTRLPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(ctrlPr)); break; - case Destination::MDEGHIDE: - nMathToken = M_TOKEN(degHide); + case Destination::MNUM: + m_aMathBuffer.appendClosingTag(M_TOKEN(num)); break; - case Destination::MBEGCHR: - nMathToken = M_TOKEN(begChr); + case Destination::MDEN: + m_aMathBuffer.appendClosingTag(M_TOKEN(den)); break; - case Destination::MSEPCHR: - nMathToken = M_TOKEN(sepChr); + case Destination::MACC: + m_aMathBuffer.appendClosingTag(M_TOKEN(acc)); break; - case Destination::MENDCHR: - nMathToken = M_TOKEN(endChr); + case Destination::MACCPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(accPr)); break; + case Destination::MCHR: + case Destination::MPOS: + case Destination::MVERTJC: + case Destination::MSTRIKEH: + case Destination::MDEGHIDE: + case Destination::MBEGCHR: + case Destination::MSEPCHR: + case Destination::MENDCHR: case Destination::MSUBHIDE: - nMathToken = M_TOKEN(subHide); - break; case Destination::MSUPHIDE: - nMathToken = M_TOKEN(supHide); - break; case Destination::MTYPE: - nMathToken = M_TOKEN(type); - break; case Destination::MGROW: - nMathToken = M_TOKEN(grow); - break; - default: - break; - } - - oox::formulaimport::XmlStream::AttributeList aAttribs; - aAttribs[M_TOKEN(val)] = m_aStates.top().pDestinationText->makeStringAndClear(); - m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs); - m_aMathBuffer.appendClosingTag(nMathToken); - } - break; - case Destination::ME: - m_aMathBuffer.appendClosingTag(M_TOKEN(e)); - break; - case Destination::MBAR: - m_aMathBuffer.appendClosingTag(M_TOKEN(bar)); - break; - case Destination::MBARPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(barPr)); - break; - case Destination::MD: - m_aMathBuffer.appendClosingTag(M_TOKEN(d)); - break; - case Destination::MDPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(dPr)); - break; - case Destination::MFUNC: - m_aMathBuffer.appendClosingTag(M_TOKEN(func)); - break; - case Destination::MFUNCPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(funcPr)); - break; - case Destination::MFNAME: - m_aMathBuffer.appendClosingTag(M_TOKEN(fName)); - break; - case Destination::MLIMLOW: - m_aMathBuffer.appendClosingTag(M_TOKEN(limLow)); - break; - case Destination::MLIMLOWPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr)); - break; - case Destination::MLIM: - m_aMathBuffer.appendClosingTag(M_TOKEN(lim)); - break; - case Destination::MM: - m_aMathBuffer.appendClosingTag(M_TOKEN(m)); - break; - case Destination::MMPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(mPr)); - break; - case Destination::MMR: - m_aMathBuffer.appendClosingTag(M_TOKEN(mr)); - break; - case Destination::MNARY: - m_aMathBuffer.appendClosingTag(M_TOKEN(nary)); - break; - case Destination::MNARYPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(naryPr)); - break; - case Destination::MSUB: - m_aMathBuffer.appendClosingTag(M_TOKEN(sub)); - break; - case Destination::MSUP: - m_aMathBuffer.appendClosingTag(M_TOKEN(sup)); - break; - case Destination::MLIMUPP: - m_aMathBuffer.appendClosingTag(M_TOKEN(limUpp)); - break; - case Destination::MLIMUPPPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(limUppPr)); - break; - case Destination::MGROUPCHR: - m_aMathBuffer.appendClosingTag(M_TOKEN(groupChr)); - break; - case Destination::MGROUPCHRPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(groupChrPr)); - break; - case Destination::MBORDERBOX: - m_aMathBuffer.appendClosingTag(M_TOKEN(borderBox)); - break; - case Destination::MBORDERBOXPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(borderBoxPr)); - break; - case Destination::MRAD: - m_aMathBuffer.appendClosingTag(M_TOKEN(rad)); - break; - case Destination::MRADPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(radPr)); - break; - case Destination::MDEG: - m_aMathBuffer.appendClosingTag(M_TOKEN(deg)); - break; - case Destination::MSSUB: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSub)); - break; - case Destination::MSSUBPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSubPr)); - break; - case Destination::MSSUP: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSup)); - break; - case Destination::MSSUPPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSupPr)); - break; - case Destination::MSSUBSUP: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSup)); - break; - case Destination::MSSUBSUPPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSupPr)); - break; - case Destination::MSPRE: - m_aMathBuffer.appendClosingTag(M_TOKEN(sPre)); - break; - case Destination::MSPREPR: - m_aMathBuffer.appendClosingTag(M_TOKEN(sPrePr)); - break; - case Destination::MBOX: - m_aMathBuffer.appendClosingTag(M_TOKEN(box)); - break; - case Destination::MEQARR: - m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr)); - break; - case Destination::SHAPEGROUP: - if (aState.bCreatedShapeGroup) - m_pSdrImport->popParent(); - break; - case Destination::PROPNAME: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - aState.aPropName = m_aStates.top().pDestinationText->makeStringAndClear(); - break; - case Destination::STATICVAL: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) - break; // not for nested group - if (m_xDocumentProperties.is()) { - // Find out what is the key, value type and value we want to set. - uno::Reference<beans::XPropertyContainer> xPropertyContainer = m_xDocumentProperties->getUserDefinedProperties(); - const OUString& rKey = m_aStates.top().aPropName; - OUString aStaticVal = m_aStates.top().pDestinationText->makeStringAndClear(); - uno::Any aAny; - if (m_aStates.top().aPropType == cppu::UnoType<OUString>::get()) - aAny <<= aStaticVal; - else if (m_aStates.top().aPropType == cppu::UnoType<sal_Int32>::get()) - aAny <<= aStaticVal.toInt32(); - else if (m_aStates.top().aPropType == cppu::UnoType<bool>::get()) - aAny <<= aStaticVal.toBoolean(); - else if (m_aStates.top().aPropType == cppu::UnoType<util::DateTime>::get()) - aAny <<= getDateTimeFromUserProp(aStaticVal); - else if (m_aStates.top().aPropType == cppu::UnoType<double>::get()) - aAny <<= aStaticVal.toDouble(); - - xPropertyContainer->addProperty(rKey, beans::PropertyAttribute::REMOVABLE, aAny); + sal_Int32 nMathToken = 0; + switch (aState.eDestination) + { + case Destination::MCHR: + nMathToken = M_TOKEN(chr); + break; + case Destination::MPOS: + nMathToken = M_TOKEN(pos); + break; + case Destination::MVERTJC: + nMathToken = M_TOKEN(vertJc); + break; + case Destination::MSTRIKEH: + nMathToken = M_TOKEN(strikeH); + break; + case Destination::MDEGHIDE: + nMathToken = M_TOKEN(degHide); + break; + case Destination::MBEGCHR: + nMathToken = M_TOKEN(begChr); + break; + case Destination::MSEPCHR: + nMathToken = M_TOKEN(sepChr); + break; + case Destination::MENDCHR: + nMathToken = M_TOKEN(endChr); + break; + case Destination::MSUBHIDE: + nMathToken = M_TOKEN(subHide); + break; + case Destination::MSUPHIDE: + nMathToken = M_TOKEN(supHide); + break; + case Destination::MTYPE: + nMathToken = M_TOKEN(type); + break; + case Destination::MGROW: + nMathToken = M_TOKEN(grow); + break; + default: + break; + } + + oox::formulaimport::XmlStream::AttributeList aAttribs; + aAttribs[M_TOKEN(val)] = m_aStates.top().pDestinationText->makeStringAndClear(); + m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs); + m_aMathBuffer.appendClosingTag(nMathToken); } break; - case Destination::USERPROPS: - { - // These are the imported properties. - uno::Reference<document::XDocumentProperties> xDocumentProperties = m_xDocumentProperties; - - // These are the real document properties. - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(m_xDstDoc, uno::UNO_QUERY); - if (xDocumentPropertiesSupplier.is()) - m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY); - - if (m_xDocumentProperties.is()) - { - if (!m_bIsNewDoc) + case Destination::ME: + m_aMathBuffer.appendClosingTag(M_TOKEN(e)); + break; + case Destination::MBAR: + m_aMathBuffer.appendClosingTag(M_TOKEN(bar)); + break; + case Destination::MBARPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(barPr)); + break; + case Destination::MD: + m_aMathBuffer.appendClosingTag(M_TOKEN(d)); + break; + case Destination::MDPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(dPr)); + break; + case Destination::MFUNC: + m_aMathBuffer.appendClosingTag(M_TOKEN(func)); + break; + case Destination::MFUNCPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(funcPr)); + break; + case Destination::MFNAME: + m_aMathBuffer.appendClosingTag(M_TOKEN(fName)); + break; + case Destination::MLIMLOW: + m_aMathBuffer.appendClosingTag(M_TOKEN(limLow)); + break; + case Destination::MLIMLOWPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr)); + break; + case Destination::MLIM: + m_aMathBuffer.appendClosingTag(M_TOKEN(lim)); + break; + case Destination::MM: + m_aMathBuffer.appendClosingTag(M_TOKEN(m)); + break; + case Destination::MMPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(mPr)); + break; + case Destination::MMR: + m_aMathBuffer.appendClosingTag(M_TOKEN(mr)); + break; + case Destination::MNARY: + m_aMathBuffer.appendClosingTag(M_TOKEN(nary)); + break; + case Destination::MNARYPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(naryPr)); + break; + case Destination::MSUB: + m_aMathBuffer.appendClosingTag(M_TOKEN(sub)); + break; + case Destination::MSUP: + m_aMathBuffer.appendClosingTag(M_TOKEN(sup)); + break; + case Destination::MLIMUPP: + m_aMathBuffer.appendClosingTag(M_TOKEN(limUpp)); + break; + case Destination::MLIMUPPPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(limUppPr)); + break; + case Destination::MGROUPCHR: + m_aMathBuffer.appendClosingTag(M_TOKEN(groupChr)); + break; + case Destination::MGROUPCHRPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(groupChrPr)); + break; + case Destination::MBORDERBOX: + m_aMathBuffer.appendClosingTag(M_TOKEN(borderBox)); + break; + case Destination::MBORDERBOXPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(borderBoxPr)); + break; + case Destination::MRAD: + m_aMathBuffer.appendClosingTag(M_TOKEN(rad)); + break; + case Destination::MRADPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(radPr)); + break; + case Destination::MDEG: + m_aMathBuffer.appendClosingTag(M_TOKEN(deg)); + break; + case Destination::MSSUB: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSub)); + break; + case Destination::MSSUBPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSubPr)); + break; + case Destination::MSSUP: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSup)); + break; + case Destination::MSSUPPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSupPr)); + break; + case Destination::MSSUBSUP: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSup)); + break; + case Destination::MSSUBSUPPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSupPr)); + break; + case Destination::MSPRE: + m_aMathBuffer.appendClosingTag(M_TOKEN(sPre)); + break; + case Destination::MSPREPR: + m_aMathBuffer.appendClosingTag(M_TOKEN(sPrePr)); + break; + case Destination::MBOX: + m_aMathBuffer.appendClosingTag(M_TOKEN(box)); + break; + case Destination::MEQARR: + m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr)); + break; + case Destination::SHAPEGROUP: + if (aState.bCreatedShapeGroup) + m_pSdrImport->popParent(); + break; + case Destination::PROPNAME: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + aState.aPropName = m_aStates.top().pDestinationText->makeStringAndClear(); + break; + case Destination::STATICVAL: + if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + break; // not for nested group + if (m_xDocumentProperties.is()) { - // Check classification. - if (!SfxClassificationHelper::ShowPasteInfo(SfxClassificationHelper::CheckPaste(xDocumentProperties, m_xDocumentProperties))) - return RTFError::CLASSIFICATION; + // Find out what is the key, value type and value we want to set. + uno::Reference<beans::XPropertyContainer> xPropertyContainer + = m_xDocumentProperties->getUserDefinedProperties(); + const OUString& rKey = m_aStates.top().aPropName; + OUString aStaticVal = m_aStates.top().pDestinationText->makeStringAndClear(); + uno::Any aAny; + if (m_aStates.top().aPropType == cppu::UnoType<OUString>::get()) + aAny <<= aStaticVal; + else if (m_aStates.top().aPropType == cppu::UnoType<sal_Int32>::get()) + aAny <<= aStaticVal.toInt32(); + else if (m_aStates.top().aPropType == cppu::UnoType<bool>::get()) + aAny <<= aStaticVal.toBoolean(); + else if (m_aStates.top().aPropType == cppu::UnoType<util::DateTime>::get()) + aAny <<= getDateTimeFromUserProp(aStaticVal); + else if (m_aStates.top().aPropType == cppu::UnoType<double>::get()) + aAny <<= aStaticVal.toDouble(); + + xPropertyContainer->addProperty(rKey, beans::PropertyAttribute::REMOVABLE, aAny); } + break; + case Destination::USERPROPS: + { + // These are the imported properties. + uno::Reference<document::XDocumentProperties> xDocumentProperties + = m_xDocumentProperties; - uno::Reference<beans::XPropertyContainer> xClipboardPropertyContainer = xDocumentProperties->getUserDefinedProperties(); - uno::Reference<beans::XPropertyContainer> xDocumentPropertyContainer = m_xDocumentProperties->getUserDefinedProperties(); - uno::Reference<beans::XPropertySet> xClipboardPropertySet(xClipboardPropertyContainer, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xDocumentPropertySet(xDocumentPropertyContainer, uno::UNO_QUERY); - uno::Sequence<beans::Property> aClipboardProperties = xClipboardPropertySet->getPropertySetInfo()->getProperties(); - uno::Sequence<beans::Property> aDocumentProperties = xDocumentPropertySet->getPropertySetInfo()->getProperties(); + // These are the real document properties. + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + m_xDstDoc, uno::UNO_QUERY); + if (xDocumentPropertiesSupplier.is()) + m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(), + uno::UNO_QUERY); - for (const beans::Property& rProperty : aClipboardProperties) + if (m_xDocumentProperties.is()) { - const OUString& rKey = rProperty.Name; - uno::Any aValue = xClipboardPropertySet->getPropertyValue(rKey); + if (!m_bIsNewDoc) + { + // Check classification. + if (!SfxClassificationHelper::ShowPasteInfo(SfxClassificationHelper::CheckPaste( + xDocumentProperties, m_xDocumentProperties))) + return RTFError::CLASSIFICATION; + } - try + uno::Reference<beans::XPropertyContainer> xClipboardPropertyContainer + = xDocumentProperties->getUserDefinedProperties(); + uno::Reference<beans::XPropertyContainer> xDocumentPropertyContainer + = m_xDocumentProperties->getUserDefinedProperties(); + uno::Reference<beans::XPropertySet> xClipboardPropertySet( + xClipboardPropertyContainer, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xDocumentPropertySet(xDocumentPropertyContainer, + uno::UNO_QUERY); + uno::Sequence<beans::Property> aClipboardProperties + = xClipboardPropertySet->getPropertySetInfo()->getProperties(); + uno::Sequence<beans::Property> aDocumentProperties + = xDocumentPropertySet->getPropertySetInfo()->getProperties(); + + for (const beans::Property& rProperty : aClipboardProperties) { - if (lcl_containsProperty(aDocumentProperties, rKey)) + const OUString& rKey = rProperty.Name; + uno::Any aValue = xClipboardPropertySet->getPropertyValue(rKey); + + try { - // When pasting, don't update existing properties. - if (!m_bIsNewDoc) - xDocumentPropertySet->setPropertyValue(rKey, aValue); + if (lcl_containsProperty(aDocumentProperties, rKey)) + { + // When pasting, don't update existing properties. + if (!m_bIsNewDoc) + xDocumentPropertySet->setPropertyValue(rKey, aValue); + } + else + xDocumentPropertyContainer->addProperty( + rKey, beans::PropertyAttribute::REMOVABLE, aValue); + } + catch (const uno::Exception& rException) + { + SAL_WARN("writerfilter.rtf", + "failed to set property " << rKey << ": " << rException); } - else - xDocumentPropertyContainer->addProperty(rKey, beans::PropertyAttribute::REMOVABLE, aValue); - } - catch (const uno::Exception& rException) - { - SAL_WARN("writerfilter.rtf", "failed to set property " << rKey << ": " << rException); } } } - } - break; - default: break; + default: + break; } // See if we need to end a track change @@ -2807,7 +2963,8 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.top().pCurrentBuffer) Mapper().props(std::make_shared<RTFReferenceProperties>(RTFSprms(), aTCSprms)); else - m_aStates.top().pCurrentBuffer->push_back(Buf_t(BUFFER_PROPS, std::make_shared<RTFValue>(RTFSprms(), aTCSprms), nullptr)); + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_PROPS, std::make_shared<RTFValue>(RTFSprms(), aTCSprms), nullptr)); } // This is the end of the doc, see if we need to close the last section. @@ -2815,7 +2972,9 @@ RTFError RTFDocumentImpl::popState() { // \par means an empty paragraph at the end of footnotes/endnotes, but // not in case of other substreams, like headers. - if (m_bNeedCr && !(m_nStreamType == NS_ooxml::LN_footnote || m_nStreamType == NS_ooxml::LN_endnote) && m_bIsNewDoc) + if (m_bNeedCr + && !(m_nStreamType == NS_ooxml::LN_footnote || m_nStreamType == NS_ooxml::LN_endnote) + && m_bIsNewDoc) dispatchSymbol(RTF_PAR); if (m_bNeedSect) // may be set by dispatchSymbol above! sectBreak(true); @@ -2828,257 +2987,285 @@ RTFError RTFDocumentImpl::popState() // list table switch (aState.eDestination) { - case Destination::LISTENTRY: - { - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); - m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, RTFOverwrite::NO_APPEND); - } - break; - case Destination::PARAGRAPHNUMBERING: - { - RTFValue::Pointer_t pIdValue = aState.aTableAttributes.find(NS_ooxml::LN_CT_AbstractNum_nsid); - if (pIdValue.get() && !m_aStates.empty()) - { - // Abstract numbering - RTFSprms aLeveltextAttributes; - OUString aTextValue; - RTFValue::Pointer_t pTextBefore = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val); - if (pTextBefore) - aTextValue += pTextBefore->getString(); - aTextValue += "%1"; - RTFValue::Pointer_t pTextAfter = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelSuffix_val); - if (pTextAfter) - aTextValue += pTextAfter->getString(); - auto pTextValue = std::make_shared<RTFValue>(aTextValue); - aLeveltextAttributes.set(NS_ooxml::LN_CT_LevelText_val, pTextValue); - - RTFSprms aLevelAttributes; - RTFSprms aLevelSprms; - auto pIlvlValue = std::make_shared<RTFValue>(0); - aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue); - - RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt); - if (pFmtValue) - aLevelSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pFmtValue); - - RTFValue::Pointer_t pStartatValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_start); - if (pStartatValue) - aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue); - - auto pLeveltextValue = std::make_shared<RTFValue>(aLeveltextAttributes); - aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue); - RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr); - if (pRunProps) - aLevelSprms.set(NS_ooxml::LN_CT_Lvl_rPr, pRunProps); - - RTFSprms aAbstractAttributes; - RTFSprms aAbstractSprms; - aAbstractAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIdValue); - auto pLevelValue = std::make_shared<RTFValue>(aLevelAttributes, aLevelSprms); - aAbstractSprms.set(NS_ooxml::LN_CT_AbstractNum_lvl, pLevelValue, RTFOverwrite::NO_APPEND); - - RTFSprms aListTableSprms; - auto pAbstractValue = std::make_shared<RTFValue>(aAbstractAttributes, aAbstractSprms); - // It's important that Numbering_abstractNum and Numbering_num never overwrites previous values. - aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pAbstractValue, RTFOverwrite::NO_APPEND); - - // Numbering - RTFSprms aNumberingAttributes; - RTFSprms aNumberingSprms; - aNumberingAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIdValue); - aNumberingSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIdValue); - auto pNumberingValue = std::make_shared<RTFValue>(aNumberingAttributes, aNumberingSprms); - aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pNumberingValue, RTFOverwrite::NO_APPEND); - - // Table - RTFSprms aListTableAttributes; - writerfilter::Reference<Properties>::Pointer_t pProp = std::make_shared<RTFReferenceProperties>(aListTableAttributes, aListTableSprms); - - RTFReferenceTable::Entries_t aListTableEntries; - aListTableEntries.insert(std::make_pair(0, pProp)); - writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries)); - Mapper().table(NS_ooxml::LN_NUMBERING, pTable); - - // Use it - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIlvlValue); - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_numId, pIdValue); - } - } - break; - case Destination::PARAGRAPHNUMBERING_TEXTAFTER: - if (!m_aStates.empty()) - { - // FIXME: don't use pDestinationText, points to popped state - auto pValue = std::make_shared<RTFValue>(aState.aDestinationText.makeStringAndClear(), true); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); - } - break; - case Destination::PARAGRAPHNUMBERING_TEXTBEFORE: - if (!m_aStates.empty()) - { - // FIXME: don't use pDestinationText, points to popped state - auto pValue = std::make_shared<RTFValue>(aState.aDestinationText.makeStringAndClear(), true); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); - } - break; - case Destination::LISTNAME: - break; - case Destination::LISTLEVEL: - if (!m_aStates.empty()) + case Destination::LISTENTRY: { - auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); - aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); - if (m_aStates.top().eDestination != Destination::LFOLEVEL) - m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, RTFOverwrite::NO_APPEND); - else - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); + m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, + RTFOverwrite::NO_APPEND); } break; - case Destination::LFOLEVEL: - if (!m_aStates.empty()) + case Destination::PARAGRAPHNUMBERING: { - auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); - aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); - - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue, RTFOverwrite::NO_APPEND); + RTFValue::Pointer_t pIdValue + = aState.aTableAttributes.find(NS_ooxml::LN_CT_AbstractNum_nsid); + if (pIdValue.get() && !m_aStates.empty()) + { + // Abstract numbering + RTFSprms aLeveltextAttributes; + OUString aTextValue; + RTFValue::Pointer_t pTextBefore + = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val); + if (pTextBefore) + aTextValue += pTextBefore->getString(); + aTextValue += "%1"; + RTFValue::Pointer_t pTextAfter + = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelSuffix_val); + if (pTextAfter) + aTextValue += pTextAfter->getString(); + auto pTextValue = std::make_shared<RTFValue>(aTextValue); + aLeveltextAttributes.set(NS_ooxml::LN_CT_LevelText_val, pTextValue); + + RTFSprms aLevelAttributes; + RTFSprms aLevelSprms; + auto pIlvlValue = std::make_shared<RTFValue>(0); + aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue); + + RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt); + if (pFmtValue) + aLevelSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pFmtValue); + + RTFValue::Pointer_t pStartatValue + = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_start); + if (pStartatValue) + aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue); + + auto pLeveltextValue = std::make_shared<RTFValue>(aLeveltextAttributes); + aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue); + RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr); + if (pRunProps) + aLevelSprms.set(NS_ooxml::LN_CT_Lvl_rPr, pRunProps); + + RTFSprms aAbstractAttributes; + RTFSprms aAbstractSprms; + aAbstractAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIdValue); + auto pLevelValue = std::make_shared<RTFValue>(aLevelAttributes, aLevelSprms); + aAbstractSprms.set(NS_ooxml::LN_CT_AbstractNum_lvl, pLevelValue, + RTFOverwrite::NO_APPEND); + + RTFSprms aListTableSprms; + auto pAbstractValue + = std::make_shared<RTFValue>(aAbstractAttributes, aAbstractSprms); + // It's important that Numbering_abstractNum and Numbering_num never overwrites previous values. + aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pAbstractValue, + RTFOverwrite::NO_APPEND); + + // Numbering + RTFSprms aNumberingAttributes; + RTFSprms aNumberingSprms; + aNumberingAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIdValue); + aNumberingSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIdValue); + auto pNumberingValue + = std::make_shared<RTFValue>(aNumberingAttributes, aNumberingSprms); + aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pNumberingValue, + RTFOverwrite::NO_APPEND); + + // Table + RTFSprms aListTableAttributes; + writerfilter::Reference<Properties>::Pointer_t pProp + = std::make_shared<RTFReferenceProperties>(aListTableAttributes, + aListTableSprms); + + RTFReferenceTable::Entries_t aListTableEntries; + aListTableEntries.insert(std::make_pair(0, pProp)); + writerfilter::Reference<Table>::Pointer_t const pTable( + new RTFReferenceTable(aListTableEntries)); + Mapper().table(NS_ooxml::LN_NUMBERING, pTable); + + // Use it + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + NS_ooxml::LN_CT_NumPr_ilvl, pIlvlValue); + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + NS_ooxml::LN_CT_NumPr_numId, pIdValue); + } } break; - // list override table - case Destination::LISTOVERRIDEENTRY: - if (!m_aStates.empty()) - { - if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + case Destination::PARAGRAPHNUMBERING_TEXTAFTER: + if (!m_aStates.empty()) { - // copy properties upwards so upper popState inserts it - m_aStates.top().aTableAttributes = aState.aTableAttributes; - m_aStates.top().aTableSprms = aState.aTableSprms; + // FIXME: don't use pDestinationText, points to popped state + auto pValue = std::make_shared<RTFValue>( + aState.aDestinationText.makeStringAndClear(), true); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); } - else + break; + case Destination::PARAGRAPHNUMBERING_TEXTBEFORE: + if (!m_aStates.empty()) { - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); - m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, RTFOverwrite::NO_APPEND); + // FIXME: don't use pDestinationText, points to popped state + auto pValue = std::make_shared<RTFValue>( + aState.aDestinationText.makeStringAndClear(), true); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); } - } - break; - case Destination::LEVELTEXT: - if (!m_aStates.empty()) - { - auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); - } - break; - case Destination::LEVELNUMBERS: - if (!m_aStates.empty()) - { - m_aStates.top().aTableSprms = aState.aTableSprms; - if (m_aStates.top().eDestination == Destination::LEVELNUMBERS || m_aStates.top().eDestination == Destination::LISTLEVEL) - // Parent state is level number or list level, current state is - // level numbers: mark parent as invalid as well if necessary. - m_aStates.top().bLevelNumbersValid = aState.bLevelNumbersValid; - } - break; - case Destination::FIELDINSTRUCTION: - if (!m_aStates.empty()) - m_aStates.top().eFieldStatus = RTFFieldStatus::INSTRUCTION; - break; - case Destination::FIELDRESULT: - if (!m_aStates.empty()) - m_aStates.top().eFieldStatus = RTFFieldStatus::RESULT; - break; - case Destination::FIELD: - if (aState.eFieldStatus == RTFFieldStatus::INSTRUCTION) - singleChar(cFieldEnd); - break; - case Destination::SHAPEPROPERTYVALUEPICT: - if (!m_aStates.empty()) - { - m_aStates.top().aPicture = aState.aPicture; - // both \sp and \sv are destinations, copy the text up-ward for later - m_aStates.top().aDestinationText = aState.aDestinationText; - } - break; - case Destination::FALT: - if (!m_aStates.empty()) - m_aStates.top().aTableSprms = aState.aTableSprms; - break; - case Destination::SHAPEPROPERTYNAME: - case Destination::SHAPEPROPERTYVALUE: - case Destination::SHAPEPROPERTY: - if (!m_aStates.empty()) - { - m_aStates.top().aShape = aState.aShape; - m_aStates.top().aPicture = aState.aPicture; - m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; - } - break; - case Destination::SHAPEINSTRUCTION: - if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::SHAPEINSTRUCTION) - { - // Shape instruction inside other shape instruction: just copy new shape settings: - // it will be resolved on end of topmost shape instruction destination - m_aStates.top().aShape = aState.aShape; - m_aStates.top().aPicture = aState.aPicture; - m_aStates.top().aCharacterSprms = aState.aCharacterSprms; - m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; - } - break; - case Destination::FLYMAINCONTENT: - case Destination::SHPPICT: - case Destination::SHAPE: - if (!m_aStates.empty()) - { - m_aStates.top().aFrame = aState.aFrame; - if (aState.eDestination == Destination::SHPPICT && m_aStates.top().eDestination == Destination::LISTPICTURE) + break; + case Destination::LISTNAME: + break; + case Destination::LISTLEVEL: + if (!m_aStates.empty()) { - RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, std::make_shared<RTFValue>(m_nListPictureId++)); - RTFSprms aSprms; - // Dummy value, real picture is already sent to dmapper. - aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, std::make_shared<RTFValue>(0)); - auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); - m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, RTFOverwrite::NO_APPEND); + auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); + aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); + + auto pValue + = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + if (m_aStates.top().eDestination != Destination::LFOLEVEL) + m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, + RTFOverwrite::NO_APPEND); + else + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); } - } - break; - case Destination::SHAPETEXT: - if (!m_aStates.empty()) - { - // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject. - if (m_aStates.top().eDestination != Destination::SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText) + break; + case Destination::LFOLEVEL: + if (!m_aStates.empty()) + { + auto pInnerValue = std::make_shared<RTFValue>(m_aStates.top().nListLevelNum++); + aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); + + auto pValue + = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue, + RTFOverwrite::NO_APPEND); + } + break; + // list override table + case Destination::LISTOVERRIDEENTRY: + if (!m_aStates.empty()) { - m_aStates.top().bHadShapeText = true; - if (!m_aStates.top().pCurrentBuffer) - m_pSdrImport->close(); + if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + { + // copy properties upwards so upper popState inserts it + m_aStates.top().aTableAttributes = aState.aTableAttributes; + m_aStates.top().aTableSprms = aState.aTableSprms; + } else - m_aStates.top().pCurrentBuffer->push_back( - Buf_t(BUFFER_ENDSHAPE, nullptr, nullptr)); + { + auto pValue + = std::make_shared<RTFValue>(aState.aTableAttributes, aState.aTableSprms); + m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, + RTFOverwrite::NO_APPEND); + } + } + break; + case Destination::LEVELTEXT: + if (!m_aStates.empty()) + { + auto pValue = std::make_shared<RTFValue>(aState.aTableAttributes); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); + } + break; + case Destination::LEVELNUMBERS: + if (!m_aStates.empty()) + { + m_aStates.top().aTableSprms = aState.aTableSprms; + if (m_aStates.top().eDestination == Destination::LEVELNUMBERS + || m_aStates.top().eDestination == Destination::LISTLEVEL) + // Parent state is level number or list level, current state is + // level numbers: mark parent as invalid as well if necessary. + m_aStates.top().bLevelNumbersValid = aState.bLevelNumbersValid; + } + break; + case Destination::FIELDINSTRUCTION: + if (!m_aStates.empty()) + m_aStates.top().eFieldStatus = RTFFieldStatus::INSTRUCTION; + break; + case Destination::FIELDRESULT: + if (!m_aStates.empty()) + m_aStates.top().eFieldStatus = RTFFieldStatus::RESULT; + break; + case Destination::FIELD: + if (aState.eFieldStatus == RTFFieldStatus::INSTRUCTION) + singleChar(cFieldEnd); + break; + case Destination::SHAPEPROPERTYVALUEPICT: + if (!m_aStates.empty()) + { + m_aStates.top().aPicture = aState.aPicture; + // both \sp and \sv are destinations, copy the text up-ward for later + m_aStates.top().aDestinationText = aState.aDestinationText; + } + break; + case Destination::FALT: + if (!m_aStates.empty()) + m_aStates.top().aTableSprms = aState.aTableSprms; + break; + case Destination::SHAPEPROPERTYNAME: + case Destination::SHAPEPROPERTYVALUE: + case Destination::SHAPEPROPERTY: + if (!m_aStates.empty()) + { + m_aStates.top().aShape = aState.aShape; + m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; + } + break; + case Destination::SHAPEINSTRUCTION: + if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::SHAPEINSTRUCTION) + { + // Shape instruction inside other shape instruction: just copy new shape settings: + // it will be resolved on end of topmost shape instruction destination + m_aStates.top().aShape = aState.aShape; + m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().aCharacterSprms = aState.aCharacterSprms; + m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; + } + break; + case Destination::FLYMAINCONTENT: + case Destination::SHPPICT: + case Destination::SHAPE: + if (!m_aStates.empty()) + { + m_aStates.top().aFrame = aState.aFrame; + if (aState.eDestination == Destination::SHPPICT + && m_aStates.top().eDestination == Destination::LISTPICTURE) + { + RTFSprms aAttributes; + aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, + std::make_shared<RTFValue>(m_nListPictureId++)); + RTFSprms aSprms; + // Dummy value, real picture is already sent to dmapper. + aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, std::make_shared<RTFValue>(0)); + auto pValue = std::make_shared<RTFValue>(aAttributes, aSprms); + m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, + RTFOverwrite::NO_APPEND); + } } + break; + case Destination::SHAPETEXT: + if (!m_aStates.empty()) + { + // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject. + if (m_aStates.top().eDestination != Destination::SHAPETEXT + && !m_aStates.top().aDrawingObject.bHadShapeText) + { + m_aStates.top().bHadShapeText = true; + if (!m_aStates.top().pCurrentBuffer) + m_pSdrImport->close(); + else + m_aStates.top().pCurrentBuffer->push_back( + Buf_t(BUFFER_ENDSHAPE, nullptr, nullptr)); + } - // It's allowed to declare these inside the shape text, and they - // are expected to have an effect for the whole shape. - if (aState.aDrawingObject.nLeft) - m_aStates.top().aDrawingObject.nLeft = aState.aDrawingObject.nLeft; - if (aState.aDrawingObject.nTop) - m_aStates.top().aDrawingObject.nTop = aState.aDrawingObject.nTop; - if (aState.aDrawingObject.nRight) - m_aStates.top().aDrawingObject.nRight = aState.aDrawingObject.nRight; - if (aState.aDrawingObject.nBottom) - m_aStates.top().aDrawingObject.nBottom = aState.aDrawingObject.nBottom; + // It's allowed to declare these inside the shape text, and they + // are expected to have an effect for the whole shape. + if (aState.aDrawingObject.nLeft) + m_aStates.top().aDrawingObject.nLeft = aState.aDrawingObject.nLeft; + if (aState.aDrawingObject.nTop) + m_aStates.top().aDrawingObject.nTop = aState.aDrawingObject.nTop; + if (aState.aDrawingObject.nRight) + m_aStates.top().aDrawingObject.nRight = aState.aDrawingObject.nRight; + if (aState.aDrawingObject.nBottom) + m_aStates.top().aDrawingObject.nBottom = aState.aDrawingObject.nBottom; + } + break; + case Destination::PROPNAME: + if (m_aStates.top().eDestination == Destination::USERPROPS) + m_aStates.top().aPropName = aState.aPropName; + break; + default: + { + if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::PICT) + m_aStates.top().aPicture = aState.aPicture; } break; - case Destination::PROPNAME: - if (m_aStates.top().eDestination == Destination::USERPROPS) - m_aStates.top().aPropName = aState.aPropName; - break; - default: - { - if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::PICT) - m_aStates.top().aPicture = aState.aPicture; - } - break; } if (aState.pCurrentBuffer == &m_aSuperBuffer) @@ -3089,7 +3276,8 @@ RTFError RTFDocumentImpl::popState() replayBuffer(m_aSuperBuffer, nullptr, nullptr); } - if (!m_aStates.empty() && m_aStates.top().nTableRowWidthAfter > 0 && aState.nTableRowWidthAfter == 0) + if (!m_aStates.empty() && m_aStates.top().nTableRowWidthAfter > 0 + && aState.nTableRowWidthAfter == 0) // An RTF_ROW in the inner group already parsed nTableRowWidthAfter, // don't do it again in the outer state later. m_aStates.top().nTableRowWidthAfter = 0; @@ -3103,7 +3291,8 @@ RTFError RTFDocumentImpl::handleEmbeddedObject() int b = 0, count = 2; // Feed the destination text to a stream. - OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); + OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US); for (int i = 0; i < aStr.getLength(); ++i) { char ch = aStr[i]; @@ -3131,15 +3320,15 @@ RTFError RTFDocumentImpl::handleEmbeddedObject() { aStream.Seek(0); sal_uInt32 nData; - aStream.ReadUInt32(nData); // OLEVersion - aStream.ReadUInt32(nData); // FormatID - aStream.ReadUInt32(nData); // ClassName + aStream.ReadUInt32(nData); // OLEVersion + aStream.ReadUInt32(nData); // FormatID + aStream.ReadUInt32(nData); // ClassName aStream.SeekRel(nData); - aStream.ReadUInt32(nData); // TopicName + aStream.ReadUInt32(nData); // TopicName aStream.SeekRel(nData); - aStream.ReadUInt32(nData); // ItemName + aStream.ReadUInt32(nData); // ItemName aStream.SeekRel(nData); - aStream.ReadUInt32(nData); // NativeDataSize + aStream.ReadUInt32(nData); // NativeDataSize if (nData) { @@ -3148,32 +3337,24 @@ RTFError RTFDocumentImpl::handleEmbeddedObject() } } - uno::Reference<io::XInputStream> xInputStream(new utl::OSeekableInputStreamWrapper(pStream.release(), /*_bOwner=*/true)); + uno::Reference<io::XInputStream> xInputStream( + new utl::OSeekableInputStreamWrapper(pStream.release(), /*_bOwner=*/true)); auto pStreamValue = std::make_shared<RTFValue>(xInputStream); m_aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue); return RTFError::OK; } -bool RTFDocumentImpl::isInBackground() -{ - return m_aStates.top().bInBackground; -} +bool RTFDocumentImpl::isInBackground() { return m_aStates.top().bInBackground; } -RTFInternalState RTFDocumentImpl::getInternalState() -{ - return m_aStates.top().nInternalState; -} +RTFInternalState RTFDocumentImpl::getInternalState() { return m_aStates.top().nInternalState; } void RTFDocumentImpl::setInternalState(RTFInternalState nInternalState) { m_aStates.top().nInternalState = nInternalState; } -Destination RTFDocumentImpl::getDestination() -{ - return m_aStates.top().eDestination; -} +Destination RTFDocumentImpl::getDestination() { return m_aStates.top().eDestination; } void RTFDocumentImpl::setDestination(Destination eDestination) { @@ -3188,15 +3369,9 @@ void RTFDocumentImpl::setDestinationText(OUString const& rString) m_aStates.top().aDestinationText.append(rString); } -bool RTFDocumentImpl::getSkipUnknown() -{ - return m_bSkipUnknown; -} +bool RTFDocumentImpl::getSkipUnknown() { return m_bSkipUnknown; } -void RTFDocumentImpl::setSkipUnknown(bool bSkipUnknown) -{ - m_bSkipUnknown = bSkipUnknown; -} +void RTFDocumentImpl::setSkipUnknown(bool bSkipUnknown) { m_bSkipUnknown = bSkipUnknown; } void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) { @@ -3208,7 +3383,8 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) if (bHex && !m_aHexBuffer.isEmpty()) { rtl_TextEncoding nEncoding = m_aStates.top().nCurrentEncoding; - if (m_aStates.top().eDestination == Destination::FONTENTRY && m_aStates.top().nCurrentEncoding == RTL_TEXTENCODING_SYMBOL) + if (m_aStates.top().eDestination == Destination::FONTENTRY + && m_aStates.top().nCurrentEncoding == RTL_TEXTENCODING_SYMBOL) nEncoding = RTL_TEXTENCODING_MS_1252; OUString aString = OStringToOUString(m_aHexBuffer.makeStringAndClear(), nEncoding); text(aString); @@ -3216,44 +3392,41 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) } RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl) - : m_pDocumentImpl(pDocumentImpl), - nInternalState(RTFInternalState::NORMAL), - eDestination(Destination::NORMAL), - eFieldStatus(RTFFieldStatus::NONE), - nBorderState(RTFBorderState::NONE), - nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)), - nUc(1), - nCharsToSkip(0), - nBinaryToRead(0), - nListLevelNum(0), - bLevelNumbersValid(true), - aFrame(this), - eRunType(RunType::LOCH), - isRightToLeft(false), - nYear(0), - nMonth(0), - nDay(0), - nHour(0), - nMinute(0), - pDestinationText(nullptr), - nCurrentStyleIndex(-1), - nCurrentCharacterStyleIndex(-1), - pCurrentBuffer(nullptr), - bInListpicture(false), - bInBackground(false), - bHadShapeText(false), - bInShapeGroup(false), - bInShape(false), - bCreatedShapeGroup(false), - bStartedTrackchange(false), - nTableRowWidthAfter(0) -{ -} - -void RTFDocumentImpl::resetFrame() -{ - m_aStates.top().aFrame = RTFFrame(&m_aStates.top()); -} + : m_pDocumentImpl(pDocumentImpl) + , nInternalState(RTFInternalState::NORMAL) + , eDestination(Destination::NORMAL) + , eFieldStatus(RTFFieldStatus::NONE) + , nBorderState(RTFBorderState::NONE) + , nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)) + , nUc(1) + , nCharsToSkip(0) + , nBinaryToRead(0) + , nListLevelNum(0) + , bLevelNumbersValid(true) + , aFrame(this) + , eRunType(RunType::LOCH) + , isRightToLeft(false) + , nYear(0) + , nMonth(0) + , nDay(0) + , nHour(0) + , nMinute(0) + , pDestinationText(nullptr) + , nCurrentStyleIndex(-1) + , nCurrentCharacterStyleIndex(-1) + , pCurrentBuffer(nullptr) + , bInListpicture(false) + , bInBackground(false) + , bHadShapeText(false) + , bInShapeGroup(false) + , bInShape(false) + , bCreatedShapeGroup(false) + , bStartedTrackchange(false) + , nTableRowWidthAfter(0) +{ +} + +void RTFDocumentImpl::resetFrame() { m_aStates.top().aFrame = RTFFrame(&m_aStates.top()); } RTFColorTableEntry::RTFColorTableEntry() = default; @@ -3264,19 +3437,19 @@ RTFShape::RTFShape() = default; RTFDrawingObject::RTFDrawingObject() = default; RTFFrame::RTFFrame(RTFParserState* pParserState) - : m_pDocumentImpl(pParserState->m_pDocumentImpl), - m_nX(0), - m_nY(0), - m_nW(0), - m_nH(0), - m_nHoriPadding(0), - m_nVertPadding(0), - m_nHoriAlign(0), - m_nHoriAnchor(0), - m_nVertAlign(0), - m_nVertAnchor(0), - m_nHRule(NS_ooxml::LN_Value_doc_ST_HeightRule_auto), - m_nAnchorType(0) + : m_pDocumentImpl(pParserState->m_pDocumentImpl) + , m_nX(0) + , m_nY(0) + , m_nW(0) + , m_nH(0) + , m_nHoriPadding(0) + , m_nVertPadding(0) + , m_nHoriAlign(0) + , m_nHoriAnchor(0) + , m_nVertAlign(0) + , m_nVertAnchor(0) + , m_nHRule(NS_ooxml::LN_Value_doc_ST_HeightRule_auto) + , m_nAnchorType(0) { } @@ -3289,41 +3462,41 @@ void RTFFrame::setSprm(Id nId, Id nValue) } switch (nId) { - case NS_ooxml::LN_CT_FramePr_w: - m_nW = nValue; - break; - case NS_ooxml::LN_CT_FramePr_h: - m_nH = nValue; - break; - case NS_ooxml::LN_CT_FramePr_x: - m_nX = nValue; - break; - case NS_ooxml::LN_CT_FramePr_y: - m_nY = nValue; - break; - case NS_ooxml::LN_CT_FramePr_hSpace: - m_nHoriPadding = nValue; - break; - case NS_ooxml::LN_CT_FramePr_vSpace: - m_nVertPadding = nValue; - break; - case NS_ooxml::LN_CT_FramePr_xAlign: - m_nHoriAlign = nValue; - break; - case NS_ooxml::LN_CT_FramePr_hAnchor: - m_nHoriAnchor = nValue; - break; - case NS_ooxml::LN_CT_FramePr_yAlign: - m_nVertAlign = nValue; - break; - case NS_ooxml::LN_CT_FramePr_vAnchor: - m_nVertAnchor = nValue; - break; - case NS_ooxml::LN_CT_FramePr_wrap: - m_oWrap = nValue; - break; - default: - break; + case NS_ooxml::LN_CT_FramePr_w: + m_nW = nValue; + break; + case NS_ooxml::LN_CT_FramePr_h: + m_nH = nValue; + break; + case NS_ooxml::LN_CT_FramePr_x: + m_nX = nValue; + break; + case NS_ooxml::LN_CT_FramePr_y: + m_nY = nValue; + break; + case NS_ooxml::LN_CT_FramePr_hSpace: + m_nHoriPadding = nValue; + break; + case NS_ooxml::LN_CT_FramePr_vSpace: + m_nVertPadding = nValue; + break; + case NS_ooxml::LN_CT_FramePr_xAlign: + m_nHoriAlign = nValue; + break; + case NS_ooxml::LN_CT_FramePr_hAnchor: + m_nHoriAnchor = nValue; + break; + case NS_ooxml::LN_CT_FramePr_yAlign: + m_nVertAlign = nValue; + break; + case NS_ooxml::LN_CT_FramePr_vAnchor: + m_nVertAnchor = nValue; + break; + case NS_ooxml::LN_CT_FramePr_wrap: + m_oWrap = nValue; + break; + default: + break; } } @@ -3331,23 +3504,15 @@ RTFSprms RTFFrame::getSprms() { RTFSprms sprms; - static const Id pNames[] = - { - NS_ooxml::LN_CT_FramePr_x, - NS_ooxml::LN_CT_FramePr_y, - NS_ooxml::LN_CT_FramePr_hRule, // Make sure nHRule is processed before nH - NS_ooxml::LN_CT_FramePr_h, - NS_ooxml::LN_CT_FramePr_w, - NS_ooxml::LN_CT_FramePr_hSpace, - NS_ooxml::LN_CT_FramePr_vSpace, - NS_ooxml::LN_CT_FramePr_hAnchor, - NS_ooxml::LN_CT_FramePr_vAnchor, - NS_ooxml::LN_CT_FramePr_xAlign, - NS_ooxml::LN_CT_FramePr_yAlign, - NS_ooxml::LN_CT_FramePr_wrap, - NS_ooxml::LN_CT_FramePr_dropCap, - NS_ooxml::LN_CT_FramePr_lines - }; + static const Id pNames[] + = { NS_ooxml::LN_CT_FramePr_x, NS_ooxml::LN_CT_FramePr_y, + NS_ooxml::LN_CT_FramePr_hRule, // Make sure nHRule is processed before nH + NS_ooxml::LN_CT_FramePr_h, NS_ooxml::LN_CT_FramePr_w, + NS_ooxml::LN_CT_FramePr_hSpace, NS_ooxml::LN_CT_FramePr_vSpace, + NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_CT_FramePr_vAnchor, + NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_CT_FramePr_yAlign, + NS_ooxml::LN_CT_FramePr_wrap, NS_ooxml::LN_CT_FramePr_dropCap, + NS_ooxml::LN_CT_FramePr_lines }; for (Id nId : pNames) { @@ -3355,70 +3520,71 @@ RTFSprms RTFFrame::getSprms() switch (nId) { - case NS_ooxml::LN_CT_FramePr_x: - if (m_nX != 0) - pValue = std::make_shared<RTFValue>(m_nX); - break; - case NS_ooxml::LN_CT_FramePr_y: - if (m_nY != 0) - pValue = std::make_shared<RTFValue>(m_nY); - break; - case NS_ooxml::LN_CT_FramePr_h: - if (m_nH != 0) + case NS_ooxml::LN_CT_FramePr_x: + if (m_nX != 0) + pValue = std::make_shared<RTFValue>(m_nX); + break; + case NS_ooxml::LN_CT_FramePr_y: + if (m_nY != 0) + pValue = std::make_shared<RTFValue>(m_nY); + break; + case NS_ooxml::LN_CT_FramePr_h: + if (m_nH != 0) + { + if (m_nHRule == NS_ooxml::LN_Value_doc_ST_HeightRule_exact) + pValue = std::make_shared<RTFValue>( + -m_nH); // The negative value just sets nHRule + else + pValue = std::make_shared<RTFValue>(m_nH); + } + break; + case NS_ooxml::LN_CT_FramePr_w: + if (m_nW != 0) + pValue = std::make_shared<RTFValue>(m_nW); + break; + case NS_ooxml::LN_CT_FramePr_hSpace: + if (m_nHoriPadding != 0) + pValue = std::make_shared<RTFValue>(m_nHoriPadding); + break; + case NS_ooxml::LN_CT_FramePr_vSpace: + if (m_nVertPadding != 0) + pValue = std::make_shared<RTFValue>(m_nVertPadding); + break; + case NS_ooxml::LN_CT_FramePr_hAnchor: { - if (m_nHRule == NS_ooxml::LN_Value_doc_ST_HeightRule_exact) - pValue = std::make_shared<RTFValue>(-m_nH); // The negative value just sets nHRule - else - pValue = std::make_shared<RTFValue>(m_nH); + if (m_nHoriAnchor == 0) + m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin; + pValue = std::make_shared<RTFValue>(m_nHoriAnchor); } break; - case NS_ooxml::LN_CT_FramePr_w: - if (m_nW != 0) - pValue = std::make_shared<RTFValue>(m_nW); - break; - case NS_ooxml::LN_CT_FramePr_hSpace: - if (m_nHoriPadding != 0) - pValue = std::make_shared<RTFValue>(m_nHoriPadding); - break; - case NS_ooxml::LN_CT_FramePr_vSpace: - if (m_nVertPadding != 0) - pValue = std::make_shared<RTFValue>(m_nVertPadding); - break; - case NS_ooxml::LN_CT_FramePr_hAnchor: - { - if (m_nHoriAnchor == 0) - m_nHoriAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin; - pValue = std::make_shared<RTFValue>(m_nHoriAnchor); - } - break; - case NS_ooxml::LN_CT_FramePr_vAnchor: - { - if (m_nVertAnchor == 0) - m_nVertAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin; - pValue = std::make_shared<RTFValue>(m_nVertAnchor); - } - break; - case NS_ooxml::LN_CT_FramePr_xAlign: - pValue = std::make_shared<RTFValue>(m_nHoriAlign); - break; - case NS_ooxml::LN_CT_FramePr_yAlign: - pValue = std::make_shared<RTFValue>(m_nVertAlign); - break; - case NS_ooxml::LN_CT_FramePr_hRule: - { - if (m_nH < 0) - m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_exact; - else if (m_nH > 0) - m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast; - pValue = std::make_shared<RTFValue>(m_nHRule); - } - break; - case NS_ooxml::LN_CT_FramePr_wrap: - if (m_oWrap) - pValue = std::make_shared<RTFValue>(*m_oWrap); + case NS_ooxml::LN_CT_FramePr_vAnchor: + { + if (m_nVertAnchor == 0) + m_nVertAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin; + pValue = std::make_shared<RTFValue>(m_nVertAnchor); + } break; - default: + case NS_ooxml::LN_CT_FramePr_xAlign: + pValue = std::make_shared<RTFValue>(m_nHoriAlign); + break; + case NS_ooxml::LN_CT_FramePr_yAlign: + pValue = std::make_shared<RTFValue>(m_nVertAlign); + break; + case NS_ooxml::LN_CT_FramePr_hRule: + { + if (m_nH < 0) + m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_exact; + else if (m_nH > 0) + m_nHRule = NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast; + pValue = std::make_shared<RTFValue>(m_nHRule); + } break; + case NS_ooxml::LN_CT_FramePr_wrap: + if (m_oWrap) + pValue = std::make_shared<RTFValue>(*m_oWrap); + break; + default: + break; } if (pValue) @@ -3432,10 +3598,9 @@ RTFSprms RTFFrame::getSprms() bool RTFFrame::hasProperties() { - return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 || - m_nHoriPadding != 0 || m_nVertPadding != 0 || - m_nHoriAlign != 0 || m_nHoriAnchor != 0 || m_nVertAlign != 0 || m_nVertAnchor != 0 || - m_nAnchorType != 0; + return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 || m_nHoriPadding != 0 + || m_nVertPadding != 0 || m_nHoriAlign != 0 || m_nHoriAnchor != 0 || m_nVertAlign != 0 + || m_nVertAnchor != 0 || m_nAnchorType != 0; } } // namespace rtftok diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 25f031c59e12..5988e03d6c63 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -96,7 +96,7 @@ enum class RTFFieldStatus }; /// A buffer storing dmapper calls. -using Buf_t = std::tuple< RTFBufferTypes, RTFValue::Pointer_t, std::shared_ptr<TableRowBuffer> >; +using Buf_t = std::tuple<RTFBufferTypes, RTFValue::Pointer_t, std::shared_ptr<TableRowBuffer>>; using RTFBuffer_t = std::deque<Buf_t>; /// holds one nested table row @@ -110,14 +110,14 @@ struct TableRowBuffer writerfilter::Reference<Properties>::Pointer_t pFrameProperties; writerfilter::Reference<Properties>::Pointer_t pRowProperties; - TableRowBuffer(RTFBuffer_t aBuffer, - std::deque<RTFSprms> aSprms, - std::deque<RTFSprms> aAttributes, - int const i_nCells) + TableRowBuffer(RTFBuffer_t aBuffer, std::deque<RTFSprms> aSprms, + std::deque<RTFSprms> aAttributes, int const i_nCells) : buffer(std::move(aBuffer)) - , cellsSprms(std::move(aSprms)), cellsAttributes(std::move(aAttributes)) + , cellsSprms(std::move(aSprms)) + , cellsAttributes(std::move(aAttributes)) , nCells(i_nCells) - {} + { + } }; /// An entry in the color table. @@ -135,8 +135,9 @@ class RTFShape { public: RTFShape(); - std::vector< std::pair<OUString, OUString> > aProperties; ///< Properties of a single shape. - std::vector< std::pair<OUString, OUString> > aGroupProperties; ///< Properties applied on the groupshape. + std::vector<std::pair<OUString, OUString>> aProperties; ///< Properties of a single shape. + std::vector<std::pair<OUString, OUString>> + aGroupProperties; ///< Properties applied on the groupshape. sal_Int32 nLeft = 0; sal_Int32 nTop = 0; sal_Int32 nRight = 0; @@ -207,6 +208,7 @@ private: sal_Int32 m_nHoriAlign, m_nHoriAnchor, m_nVertAlign, m_nVertAnchor; Id m_nHRule; boost::optional<Id> m_oWrap; + public: explicit RTFFrame(RTFParserState* pParserState); sal_Int16 m_nAnchorType; @@ -279,7 +281,12 @@ public: RTFFrame aFrame; /// Maps to OOXML's ascii, cs or eastAsia. - enum class RunType { LOCH, HICH, DBCH }; + enum class RunType + { + LOCH, + HICH, + DBCH + }; RunType eRunType; /// ltrch or rtlch bool isRightToLeft; @@ -336,6 +343,7 @@ struct RTFStack { private: std::deque<RTFParserState> m_Impl; + public: RTFParserState& top() { @@ -349,41 +357,27 @@ public: throw std::out_of_range("empty rtf state stack"); return m_Impl.pop_back(); } - void push(RTFParserState const& rState) - { - return m_Impl.push_back(rState); - } - bool empty() const - { - return m_Impl.empty(); - } - size_t size() const - { - return m_Impl.size(); - } - const RTFParserState& operator[](size_t nIndex) const - { - return m_Impl[nIndex]; - } - RTFParserState& operator[](size_t nIndex) - { - return m_Impl[nIndex]; - } + void push(RTFParserState const& rState) { return m_Impl.push_back(rState); } + bool empty() const { return m_Impl.empty(); } + size_t size() const { return m_Impl.size(); } + const RTFParserState& operator[](size_t nIndex) const { return m_Impl[nIndex]; } + RTFParserState& operator[](size_t nIndex) { return m_Impl[nIndex]; } }; void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pValue); void putNestedSprm(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Pointer_t& pValue); Id getParagraphBorder(sal_uInt32 nIndex); -void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Pointer_t& pValue, RTFOverwrite eOverwrite = RTFOverwrite::YES, bool bAttribute = true); +void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Pointer_t& pValue, + RTFOverwrite eOverwrite = RTFOverwrite::YES, bool bAttribute = true); bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId); /// Checks if rName is contained at least once in rProperties as a key. -bool findPropertyName(const std::vector<css::beans::PropertyValue>& rProperties, const OUString& rName); +bool findPropertyName(const std::vector<css::beans::PropertyValue>& rProperties, + const OUString& rName); RTFSprms& getLastAttributes(RTFSprms& rSprms, Id nId); OString DTTM22OString(long nDTTM); /// Implementation of the RTFDocument interface. -class RTFDocumentImpl - : public RTFDocument, public RTFListener +class RTFDocumentImpl : public RTFDocument, public RTFListener { public: using Pointer_t = std::shared_ptr<RTFDocumentImpl>; @@ -416,10 +410,7 @@ public: void finishSubstream() override; bool isSubstream() const override; - Stream& Mapper() - { - return *m_pMapperStream; - } + Stream& Mapper() { return *m_pMapperStream; } void setSuperstream(RTFDocumentImpl* pSuperstream); const css::uno::Reference<css::lang::XMultiServiceFactory>& getModelFactory() { @@ -435,10 +426,7 @@ public: /// Send NS_ooxml::LN_settings_settings to dmapper. void outputSettingsTable(); /// If the initial paragraph is started. - bool getFirstRun() - { - return m_bFirstRun; - } + bool getFirstRun() { return m_bFirstRun; } /// If we need to add a dummy paragraph before a section break. void setNeedPar(bool bNeedPar); /// Return the dmapper index of an RTF index for fonts. @@ -476,27 +464,22 @@ private: void runBreak(); void parBreak(); void tableBreak(); - writerfilter::Reference<Properties>::Pointer_t getProperties(RTFSprms& rAttributes, RTFSprms& rSprms, Id nStyleType); + writerfilter::Reference<Properties>::Pointer_t getProperties(RTFSprms& rAttributes, + RTFSprms& rSprms, Id nStyleType); void checkNeedPap(); void sectBreak(bool bFinal = false); - void prepareProperties( - RTFParserState& rState, - writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties, - writerfilter::Reference<Properties>::Pointer_t& o_rpFrameProperties, - writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties, - int nCells, int nCurrentCellX); + void prepareProperties(RTFParserState& rState, + writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties, + writerfilter::Reference<Properties>::Pointer_t& o_rpFrameProperties, + writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties, + int nCells, int nCurrentCellX); /// Send the passed properties to dmapper. - void sendProperties( - writerfilter::Reference<Properties>::Pointer_t const& pParagraphProperties, - writerfilter::Reference<Properties>::Pointer_t const& pFrameProperties, - writerfilter::Reference<Properties>::Pointer_t const& pTableRowProperties); - void replayRowBuffer(RTFBuffer_t& rBuffer, - ::std::deque<RTFSprms>& rCellsSrpms, - ::std::deque<RTFSprms>& rCellsAttributes, - int nCells); - void replayBuffer(RTFBuffer_t& rBuffer, - RTFSprms* pSprms, - RTFSprms const* pAttributes); + void sendProperties(writerfilter::Reference<Properties>::Pointer_t const& pParagraphProperties, + writerfilter::Reference<Properties>::Pointer_t const& pFrameProperties, + writerfilter::Reference<Properties>::Pointer_t const& pTableRowProperties); + void replayRowBuffer(RTFBuffer_t& rBuffer, ::std::deque<RTFSprms>& rCellsSrpms, + ::std::deque<RTFSprms>& rCellsAttributes, int nCells); + void replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* pSprms, RTFSprms const* pAttributes); /// If we have some unicode or hex characters to send. void checkUnicode(bool bUnicode, bool bHex); /// If we need a final section break at the end of the document. @@ -581,7 +564,7 @@ private: /// Buffered table cells, till cell definitions are not reached. /// for nested table, one buffer per table level - std::deque< RTFBuffer_t > m_aTableBufferStack; + std::deque<RTFBuffer_t> m_aTableBufferStack; /// Buffered superscript, till footnote is reached (or not). RTFBuffer_t m_aSuperBuffer; @@ -589,7 +572,7 @@ private: RTFDocumentImpl* m_pSuperstream; /// Type of the stream: header, footer, footnote, etc. Id m_nStreamType; - std::queue< std::pair<Id, std::size_t> > m_nHeaderFooterPositions; + std::queue<std::pair<Id, std::size_t>> m_nHeaderFooterPositions; std::size_t m_nGroupStartPos; /// Ignore the first occurrence of this text. OUString m_aIgnoreFirst; diff --git a/writerfilter/source/rtftok/rtffly.hxx b/writerfilter/source/rtftok/rtffly.hxx index 8da0ffd9d9a1..2482305f25fe 100644 --- a/writerfilter/source/rtftok/rtffly.hxx +++ b/writerfilter/source/rtftok/rtffly.hxx @@ -27,30 +27,24 @@ public: { } - sal_uInt16 GetOrient() const - { - return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); - } + sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); } - sal_uInt16 GetRelation() const - { - return OSL_HINIBBLE(OSL_LOBYTE(m_nVal)); - } + sal_uInt16 GetRelation() const { return OSL_HINIBBLE(OSL_LOBYTE(m_nVal)); } sal_Int32 GetAlign() const { sal_Int32 nAlign = 0; switch (GetOrient()) { - case css::text::VertOrientation::CENTER: - nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_center; - break; - case css::text::VertOrientation::TOP: - nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_top; - break; - case css::text::VertOrientation::BOTTOM: - nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_bottom; - break; + case css::text::VertOrientation::CENTER: + nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_center; + break; + case css::text::VertOrientation::TOP: + nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_top; + break; + case css::text::VertOrientation::BOTTOM: + nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_bottom; + break; } return nAlign; @@ -61,15 +55,15 @@ public: sal_Int32 nAnchor = 0; switch (GetRelation()) { - case css::text::RelOrientation::FRAME: - nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_text; - break; - case css::text::RelOrientation::PAGE_FRAME: - nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_page; - break; - case css::text::RelOrientation::PAGE_PRINT_AREA: - nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin; - break; + case css::text::RelOrientation::FRAME: + nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_text; + break; + case css::text::RelOrientation::PAGE_FRAME: + nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_page; + break; + case css::text::RelOrientation::PAGE_PRINT_AREA: + nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin; + break; } return nAnchor; @@ -88,36 +82,30 @@ public: { } - sal_uInt16 GetOrient() const - { - return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); - } + sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); } - sal_uInt16 GetRelation() const - { - return OSL_LONIBBLE(OSL_HIBYTE(m_nVal)); - } + sal_uInt16 GetRelation() const { return OSL_LONIBBLE(OSL_HIBYTE(m_nVal)); } sal_Int32 GetAlign() const { sal_Int32 nAlign = 0; switch (GetOrient()) { - case css::text::HoriOrientation::CENTER: - nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_center; - break; - case css::text::HoriOrientation::RIGHT: - nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_right; - break; - case css::text::HoriOrientation::LEFT: - nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_left; - break; - case css::text::HoriOrientation::INSIDE: - nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_inside; - break; - case css::text::HoriOrientation::OUTSIDE: - nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_outside; - break; + case css::text::HoriOrientation::CENTER: + nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_center; + break; + case css::text::HoriOrientation::RIGHT: + nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_right; + break; + case css::text::HoriOrientation::LEFT: + nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_left; + break; + case css::text::HoriOrientation::INSIDE: + nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_inside; + break; + case css::text::HoriOrientation::OUTSIDE: + nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_outside; + break; } return nAlign; @@ -128,15 +116,15 @@ public: sal_Int32 nAnchor = 0; switch (GetRelation()) { - case css::text::RelOrientation::FRAME: - nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text; - break; - case css::text::RelOrientation::PAGE_FRAME: - nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_page; - break; - case css::text::RelOrientation::PAGE_PRINT_AREA: - nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin; - break; + case css::text::RelOrientation::FRAME: + nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text; + break; + case css::text::RelOrientation::PAGE_FRAME: + nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_page; + break; + case css::text::RelOrientation::PAGE_PRINT_AREA: + nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin; + break; } return nAnchor; diff --git a/writerfilter/source/rtftok/rtflookahead.cxx b/writerfilter/source/rtftok/rtflookahead.cxx index b01ed864eeec..2861f362e0a3 100644 --- a/writerfilter/source/rtftok/rtflookahead.cxx +++ b/writerfilter/source/rtftok/rtflookahead.cxx @@ -16,10 +16,9 @@ namespace writerfilter { namespace rtftok { - RTFLookahead::RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart) - : m_rStream(rStream), - m_bHasTable(false) + : m_rStream(rStream) + , m_bHasTable(false) { sal_uInt64 const nPos = m_rStream.Tell(); m_rStream.Seek(nGroupStart); @@ -31,10 +30,7 @@ RTFLookahead::RTFLookahead(SvStream& rStream, sal_uInt64 nGroupStart) RTFLookahead::~RTFLookahead() = default; -RTFError RTFLookahead::dispatchDestination(RTFKeyword /*nKeyword*/) -{ - return RTFError::OK; -} +RTFError RTFLookahead::dispatchDestination(RTFKeyword /*nKeyword*/) { return RTFError::OK; } RTFError RTFLookahead::dispatchFlag(RTFKeyword nKeyword) { @@ -43,10 +39,7 @@ RTFError RTFLookahead::dispatchFlag(RTFKeyword nKeyword) return RTFError::OK; } -RTFError RTFLookahead::dispatchSymbol(RTFKeyword /*nKeyword*/) -{ - return RTFError::OK; -} +RTFError RTFLookahead::dispatchSymbol(RTFKeyword /*nKeyword*/) { return RTFError::OK; } RTFError RTFLookahead::dispatchToggle(RTFKeyword /*nKeyword*/, bool /*bParam*/, int /*nParam*/) { @@ -79,42 +72,21 @@ RTFError RTFLookahead::popState() return RTFError::OK; } -Destination RTFLookahead::getDestination() -{ - return Destination::NORMAL; -} - -void RTFLookahead::setDestination(Destination /*eDestination*/) -{ -} +Destination RTFLookahead::getDestination() { return Destination::NORMAL; } -RTFInternalState RTFLookahead::getInternalState() -{ - return RTFInternalState::NORMAL; -} +void RTFLookahead::setDestination(Destination /*eDestination*/) {} -void RTFLookahead::setInternalState(RTFInternalState /*nInternalState*/) -{ -} +RTFInternalState RTFLookahead::getInternalState() { return RTFInternalState::NORMAL; } -bool RTFLookahead::getSkipUnknown() -{ - return false; -} +void RTFLookahead::setInternalState(RTFInternalState /*nInternalState*/) {} -void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/) -{ -} +bool RTFLookahead::getSkipUnknown() { return false; } -void RTFLookahead::finishSubstream() -{ -} +void RTFLookahead::setSkipUnknown(bool /*bSkipUnknown*/) {} -bool RTFLookahead::isSubstream() const -{ - return false; -} +void RTFLookahead::finishSubstream() {} +bool RTFLookahead::isSubstream() const { return false; } } // namespace rtftok } // namespace writerfilter diff --git a/writerfilter/source/rtftok/rtflookahead.hxx b/writerfilter/source/rtftok/rtflookahead.hxx index 32f3a29d8423..ebde306a7b94 100644 --- a/writerfilter/source/rtftok/rtflookahead.hxx +++ b/writerfilter/source/rtftok/rtflookahead.hxx @@ -45,10 +45,8 @@ public: void setSkipUnknown(bool bSkipUnknown) override; void finishSubstream() override; bool isSubstream() const override; - bool hasTable() - { - return m_bHasTable; - } + bool hasTable() { return m_bHasTable; } + private: std::shared_ptr<RTFTokenizer> m_pTokenizer; SvStream& m_rStream; diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.cxx b/writerfilter/source/rtftok/rtfreferenceproperties.cxx index deb72586dbda..fed8d2263990 100644 --- a/writerfilter/source/rtftok/rtfreferenceproperties.cxx +++ b/writerfilter/source/rtftok/rtfreferenceproperties.cxx @@ -13,10 +13,9 @@ namespace writerfilter { namespace rtftok { - RTFReferenceProperties::RTFReferenceProperties(const RTFSprms& rAttributes, const RTFSprms& rSprms) - : m_aAttributes(rAttributes), - m_aSprms(rSprms) + : m_aAttributes(rAttributes) + , m_aSprms(rSprms) { } diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.hxx b/writerfilter/source/rtftok/rtfreferenceproperties.hxx index 75cd4febad11..e10976619708 100644 --- a/writerfilter/source/rtftok/rtfreferenceproperties.hxx +++ b/writerfilter/source/rtftok/rtfreferenceproperties.hxx @@ -17,22 +17,16 @@ namespace writerfilter namespace rtftok { /// Sends RTFSprm instances to DomainMapper. -class RTFReferenceProperties - : public writerfilter::Reference<Properties> +class RTFReferenceProperties : public writerfilter::Reference<Properties> { public: RTFReferenceProperties(const RTFSprms& rAttributes, const RTFSprms& rSprms); explicit RTFReferenceProperties(const RTFSprms& rAttributes); virtual ~RTFReferenceProperties(); void resolve(Properties& rHandler) override; - RTFSprms& getAttributes() - { - return m_aAttributes; - } - RTFSprms& getSprms() - { - return m_aSprms; - } + RTFSprms& getAttributes() { return m_aAttributes; } + RTFSprms& getSprms() { return m_aSprms; } + private: RTFSprms m_aAttributes; RTFSprms m_aSprms; diff --git a/writerfilter/source/rtftok/rtfreferencetable.cxx b/writerfilter/source/rtftok/rtfreferencetable.cxx index 8013e44e2c72..48785b0559c1 100644 --- a/writerfilter/source/rtftok/rtfreferencetable.cxx +++ b/writerfilter/source/rtftok/rtfreferencetable.cxx @@ -13,7 +13,6 @@ namespace writerfilter { namespace rtftok { - RTFReferenceTable::RTFReferenceTable(Entries_t aEntries) : m_aEntries(std::move(aEntries)) { diff --git a/writerfilter/source/rtftok/rtfreferencetable.hxx b/writerfilter/source/rtftok/rtfreferencetable.hxx index cd0cdc337de2..a21ed18fb76a 100644 --- a/writerfilter/source/rtftok/rtfreferencetable.hxx +++ b/writerfilter/source/rtftok/rtfreferencetable.hxx @@ -18,8 +18,7 @@ namespace writerfilter namespace rtftok { /// Sends tables (e.g. font table) to the domain mapper. -class RTFReferenceTable - : public writerfilter::Reference<Table> +class RTFReferenceTable : public writerfilter::Reference<Table> { public: using Entries_t = std::map<int, writerfilter::Reference<Properties>::Pointer_t>; @@ -27,6 +26,7 @@ public: explicit RTFReferenceTable(Entries_t aEntries); virtual ~RTFReferenceTable(); void resolve(Table& rHandler) override; + private: Entries_t m_aEntries; }; diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 73bc640e8b00..5605f5cfb27d 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -46,12 +46,10 @@ using namespace com::sun::star; - namespace writerfilter { namespace rtftok { - RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument, uno::Reference<lang::XComponent> const& xDstDoc) : m_rImport(rDocument) @@ -73,7 +71,8 @@ RTFSdrImport::~RTFSdrImport() m_aParents.pop(); } -void RTFSdrImport::createShape(const OUString& rService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet) +void RTFSdrImport::createShape(const OUString& rService, uno::Reference<drawing::XShape>& xShape, + uno::Reference<beans::XPropertySet>& xPropertySet) { if (m_rImport.getModelFactory().is()) xShape.set(m_rImport.getModelFactory()->createInstance(rService), uno::UNO_QUERY); @@ -141,12 +140,15 @@ void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> const& xPrope if (!m_aGraphicZOrderHelpers.empty()) { writerfilter::dmapper::GraphicZOrderHelper& rHelper = m_aGraphicZOrderHelpers.top(); - xPropertySet->setPropertyValue("ZOrder", uno::makeAny(rHelper.findZOrder(nZOrder, bOldStyle))); + xPropertySet->setPropertyValue("ZOrder", + uno::makeAny(rHelper.findZOrder(nZOrder, bOldStyle))); rHelper.addItem(xPropertySet, nZOrder); } } -void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, const uno::Reference<beans::XPropertySet>& xPropertySet, uno::Any const& rLineColor, uno::Any const& rLineWidth) +void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, + const uno::Reference<beans::XPropertySet>& xPropertySet, + uno::Any const& rLineColor, uno::Any const& rLineWidth) { if (!bTextFrame) { @@ -155,18 +157,19 @@ void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, const uno::Referenc } else { - static const char* aBorders[] = - { - "TopBorder", "LeftBorder", "BottomBorder", "RightBorder" - }; + static const char* aBorders[] + = { "TopBorder", "LeftBorder", "BottomBorder", "RightBorder" }; for (const char* pBorder : aBorders) { - table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(OUString::createFromAscii(pBorder)).get<table::BorderLine2>(); + table::BorderLine2 aBorderLine + = xPropertySet->getPropertyValue(OUString::createFromAscii(pBorder)) + .get<table::BorderLine2>(); if (rLineColor.hasValue()) aBorderLine.Color = rLineColor.get<sal_Int32>(); if (rLineWidth.hasValue()) aBorderLine.LineWidth = rLineWidth.get<sal_Int32>(); - xPropertySet->setPropertyValue(OUString::createFromAscii(pBorder), uno::makeAny(aBorderLine)); + xPropertySet->setPropertyValue(OUString::createFromAscii(pBorder), + uno::makeAny(aBorderLine)); } } } @@ -180,7 +183,8 @@ void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> const& xProp xPropertySet->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_SOLID)); } -void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, const OUString& aKey, const OUString& aValue) +void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, + const OUString& aKey, const OUString& aValue) { uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); sal_Int16 nHoriOrient = 0; @@ -192,40 +196,40 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, { switch (aValue.toInt32()) { - case 1: - nHoriOrient = text::HoriOrientation::LEFT; - break; - case 2: - nHoriOrient = text::HoriOrientation::CENTER; - break; - case 3: - nHoriOrient = text::HoriOrientation::RIGHT; - break; - case 4: - nHoriOrient = text::HoriOrientation::INSIDE; - break; - case 5: - nHoriOrient = text::HoriOrientation::OUTSIDE; - break; - default: - break; + case 1: + nHoriOrient = text::HoriOrientation::LEFT; + break; + case 2: + nHoriOrient = text::HoriOrientation::CENTER; + break; + case 3: + nHoriOrient = text::HoriOrientation::RIGHT; + break; + case 4: + nHoriOrient = text::HoriOrientation::INSIDE; + break; + case 5: + nHoriOrient = text::HoriOrientation::OUTSIDE; + break; + default: + break; } } else if (aKey == "posv") { switch (aValue.toInt32()) { - case 1: - nVertOrient = text::VertOrientation::TOP; - break; - case 2: - nVertOrient = text::VertOrientation::CENTER; - break; - case 3: - nVertOrient = text::VertOrientation::BOTTOM; - break; - default: - break; + case 1: + nVertOrient = text::VertOrientation::TOP; + break; + case 2: + nVertOrient = text::VertOrientation::CENTER; + break; + case 3: + nVertOrient = text::VertOrientation::BOTTOM; + break; + default: + break; } } else if (aKey == "fFitShapeToText") @@ -236,10 +240,12 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, { // See DffPropertyReader::Fix16ToAngle(): in RTF, positive rotation angles are clockwise, we have them as counter-clockwise. // Additionally, RTF type is 0..360*2^16, our is 0..360*100. - sal_Int32 nRotation = aValue.toInt32()*100/RTF_MULTIPLIER; + sal_Int32 nRotation = aValue.toInt32() * 100 / RTF_MULTIPLIER; uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY); if (!xServiceInfo->supportsService("com.sun.star.text.TextFrame")) - xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(static_cast<long>(nRotation) * -1)))); + xPropertySet->setPropertyValue( + "RotateAngle", + uno::makeAny(sal_Int32(NormAngle360(static_cast<long>(nRotation) * -1)))); } if (nHoriOrient != 0 && xPropertySet.is()) @@ -248,8 +254,10 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient)); if (!boost::logic::indeterminate(obFitShapeToText) && xPropertySet.is()) { - xPropertySet->setPropertyValue("SizeType", uno::makeAny(obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX)); - xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(static_cast<bool>(obFitShapeToText))); + xPropertySet->setPropertyValue( + "SizeType", uno::makeAny(obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX)); + xPropertySet->setPropertyValue("FrameIsAutomaticHeight", + uno::makeAny(static_cast<bool>(obFitShapeToText))); } if (!bFilled && xPropertySet.is()) { @@ -261,9 +269,9 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, } int RTFSdrImport::initShape(uno::Reference<drawing::XShape>& o_xShape, - uno::Reference<beans::XPropertySet>& o_xPropSet, - bool& o_rIsCustomShape, - RTFShape const& rShape, bool const bClose, ShapeOrPict const shapeOrPict) + uno::Reference<beans::XPropertySet>& o_xPropSet, bool& o_rIsCustomShape, + RTFShape const& rShape, bool const bClose, + ShapeOrPict const shapeOrPict) { assert(!o_xShape.is()); assert(!o_xPropSet.is()); @@ -272,10 +280,9 @@ int RTFSdrImport::initShape(uno::Reference<drawing::XShape>& o_xShape, // first, find the shape type int nType = -1; - auto iter = std::find_if(rShape.aProperties.begin(), rShape.aProperties.end(), [](std::pair<OUString, OUString> aProperty) - { - return aProperty.first == "shapeType"; - }); + auto iter = std::find_if( + rShape.aProperties.begin(), rShape.aProperties.end(), + [](std::pair<OUString, OUString> aProperty) { return aProperty.first == "shapeType"; }); if (iter == rShape.aProperties.end()) { @@ -302,36 +309,38 @@ int RTFSdrImport::initShape(uno::Reference<drawing::XShape>& o_xShape, switch (nType) { - case ESCHER_ShpInst_PictureFrame: - createShape("com.sun.star.drawing.GraphicObjectShape", o_xShape, o_xPropSet); - m_bTextGraphicObject = true; - break; - case ESCHER_ShpInst_Line: - createShape("com.sun.star.drawing.LineShape", o_xShape, o_xPropSet); - break; - case ESCHER_ShpInst_Rectangle: - case ESCHER_ShpInst_TextBox: - // If we're inside a groupshape, can't use text frames. - if (!bClose && m_aParents.size() == 1) - { - createShape("com.sun.star.text.TextFrame", o_xShape, o_xPropSet); - m_bTextFrame = true; - std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true); - for (beans::PropertyValue& i : aDefaults) - o_xPropSet->setPropertyValue(i.Name, i.Value); + case ESCHER_ShpInst_PictureFrame: + createShape("com.sun.star.drawing.GraphicObjectShape", o_xShape, o_xPropSet); + m_bTextGraphicObject = true; + break; + case ESCHER_ShpInst_Line: + createShape("com.sun.star.drawing.LineShape", o_xShape, o_xPropSet); + break; + case ESCHER_ShpInst_Rectangle: + case ESCHER_ShpInst_TextBox: + // If we're inside a groupshape, can't use text frames. + if (!bClose && m_aParents.size() == 1) + { + createShape("com.sun.star.text.TextFrame", o_xShape, o_xPropSet); + m_bTextFrame = true; + std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true); + for (beans::PropertyValue& i : aDefaults) + o_xPropSet->setPropertyValue(i.Name, i.Value); + break; + } + SAL_FALLTHROUGH; + default: + createShape("com.sun.star.drawing.CustomShape", o_xShape, o_xPropSet); + o_rIsCustomShape = true; break; - } - SAL_FALLTHROUGH; - default: - createShape("com.sun.star.drawing.CustomShape", o_xShape, o_xPropSet); - o_rIsCustomShape = true; - break; } // Defaults if (o_xPropSet.is() && !m_bTextFrame) { - o_xPropSet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32(0xffffff))); // White in Word, kind of blue in Writer. + o_xPropSet->setPropertyValue( + "FillColor", + uno::makeAny(sal_uInt32(0xffffff))); // White in Word, kind of blue in Writer. } return nType; @@ -403,7 +412,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "gtextSize") { // RTF size is multiplied by 2^16 - nFontSize = (float) rProperty.second.toUInt32() / RTF_MULTIPLIER; + nFontSize = (float)rProperty.second.toUInt32() / RTF_MULTIPLIER; } else if (rProperty.first == "pib") { @@ -419,11 +428,14 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap xPropertySet->setPropertyValue("FillColor", aAny); // fillType will decide, possible it'll be the start color of a gradient. - aFillModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(aAny.get<sal_Int32>()))); + aFillModel.moColor.set( + "#" + OUString::fromUtf8(msfilter::util::ConvertColor(aAny.get<sal_Int32>()))); } else if (rProperty.first == "fillBackColor") // fillType will decide, possible it'll be the end color of a gradient. - aFillModel.moColor2.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(rProperty.second.toInt32())))); + aFillModel.moColor2.set("#" + + OUString::fromUtf8(msfilter::util::ConvertColor( + msfilter::util::BGRToRGB(rProperty.second.toInt32())))); else if (rProperty.first == "lineColor") aLineColor <<= msfilter::util::BGRToRGB(rProperty.second.toInt32()); else if (rProperty.first == "lineBackColor") @@ -437,11 +449,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap resolveFLine(xPropertySet, rProperty.second.toInt32()); else if (rProperty.first == "fillOpacity" && xPropertySet.is()) { - int opacity = 100 - (rProperty.second.toInt32())*100/RTF_MULTIPLIER; + int opacity = 100 - (rProperty.second.toInt32()) * 100 / RTF_MULTIPLIER; xPropertySet->setPropertyValue("FillTransparence", uno::Any(sal_uInt32(opacity))); } else if (rProperty.first == "lineWidth") - aLineWidth <<= rProperty.second.toInt32()/360; + aLineWidth <<= rProperty.second.toInt32() / 360; else if (rProperty.first == "pVerticies") { std::vector<drawing::EnhancedCustomShapeParameterPair> aCoordinates; @@ -469,15 +481,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap oX.reset(aPoint.toInt32()); else oY.reset(aPoint.toInt32()); - } - while (nI >= 0); + } while (nI >= 0); drawing::EnhancedCustomShapeParameterPair aPair; aPair.First.Value <<= *oX; aPair.Second.Value <<= *oY; aCoordinates.push_back(aPair); } - } - while (nCharIndex >= 0); + } while (nCharIndex >= 0); aPropertyValue.Name = "Coordinates"; aPropertyValue.Value <<= comphelper::containerToSequence(aCoordinates); aPath.push_back(aPropertyValue); @@ -507,45 +517,45 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap drawing::EnhancedCustomShapeSegment aSegment; switch (nSeg) { - case 0x0001: // lineto - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; - aSegment.Count = sal_Int32(1); - aSegments.push_back(aSegment); - break; - case 0x4000: // moveto - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO; - aSegment.Count = sal_Int32(1); - aSegments.push_back(aSegment); - break; - case 0x2000: // curveto - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO; - aSegment.Count = nPoints; - aSegments.push_back(aSegment); - break; - case 0xb300: // arcto - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO; - aSegment.Count = sal_Int32(0); - aSegments.push_back(aSegment); - break; - case 0xac00: - case 0xaa00: // nofill - case 0xab00: // nostroke - case 0x6001: // close - break; - case 0x8000: // end - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; - aSegment.Count = sal_Int32(0); - aSegments.push_back(aSegment); - break; - default: // given number of lineto elements - aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; - aSegment.Count = nSeg; - aSegments.push_back(aSegment); - break; + case 0x0001: // lineto + aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; + aSegment.Count = sal_Int32(1); + aSegments.push_back(aSegment); + break; + case 0x4000: // moveto + aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO; + aSegment.Count = sal_Int32(1); + aSegments.push_back(aSegment); + break; + case 0x2000: // curveto + aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO; + aSegment.Count = nPoints; + aSegments.push_back(aSegment); + break; + case 0xb300: // arcto + aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO; + aSegment.Count = sal_Int32(0); + aSegments.push_back(aSegment); + break; + case 0xac00: + case 0xaa00: // nofill + case 0xab00: // nostroke + case 0x6001: // close + break; + case 0x8000: // end + aSegment.Command + = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; + aSegment.Count = sal_Int32(0); + aSegments.push_back(aSegment); + break; + default: // given number of lineto elements + aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; + aSegment.Count = nSeg; + aSegments.push_back(aSegment); + break; } } - } - while (nCharIndex >= 0); + } while (nCharIndex >= 0); aPropertyValue.Name = "Segments"; aPropertyValue.Value <<= comphelper::containerToSequence(aSegments); aPath.push_back(aPropertyValue); @@ -568,61 +578,78 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "dxTextLeft") { if (xPropertySet.is()) - xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("LeftBorderDistance", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dyTextTop") { if (xPropertySet.is()) - xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("TopBorderDistance", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dxTextRight") { if (xPropertySet.is()) - xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("RightBorderDistance", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dyTextBottom") { if (xPropertySet.is()) - xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("BottomBorderDistance", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dxWrapDistLeft") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distL, std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set( + NS_ooxml::LN_CT_Anchor_distL, + std::make_shared<RTFValue>(rProperty.second.toInt32())); else if (xPropertySet.is()) - xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("LeftMargin", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dyWrapDistTop") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distT, std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set( + NS_ooxml::LN_CT_Anchor_distT, + std::make_shared<RTFValue>(rProperty.second.toInt32())); else if (xPropertySet.is()) - xPropertySet->setPropertyValue("TopMargin", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("TopMargin", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dxWrapDistRight") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distR, std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set( + NS_ooxml::LN_CT_Anchor_distR, + std::make_shared<RTFValue>(rProperty.second.toInt32())); else if (xPropertySet.is()) - xPropertySet->setPropertyValue("RightMargin", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("RightMargin", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "dyWrapDistBottom") { if (m_bTextGraphicObject) - rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distB, std::make_shared<RTFValue>(rProperty.second.toInt32())); + rShape.aAnchorAttributes.set( + NS_ooxml::LN_CT_Anchor_distB, + std::make_shared<RTFValue>(rProperty.second.toInt32())); else if (xPropertySet.is()) - xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(rProperty.second.toInt32() / 360)); + xPropertySet->setPropertyValue("BottomMargin", + uno::makeAny(rProperty.second.toInt32() / 360)); } else if (rProperty.first == "fillType") { switch (rProperty.second.toInt32()) { - case 7: // Shade using the fillAngle - aFillModel.moType.set(oox::XML_gradient); - break; - default: - SAL_INFO("writerfilter", "TODO handle fillType value '" << rProperty.second << "'"); - break; + case 7: // Shade using the fillAngle + aFillModel.moType.set(oox::XML_gradient); + break; + default: + SAL_INFO("writerfilter", + "TODO handle fillType value '" << rProperty.second << "'"); + break; } } else if (rProperty.first == "fillFocus") @@ -633,32 +660,36 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap aShadowModel.mbHasShadow = true; } else if (rProperty.first == "shadowColor") - aShadowModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(rProperty.second.toInt32())))); + aShadowModel.moColor.set("#" + + OUString::fromUtf8(msfilter::util::ConvertColor( + msfilter::util::BGRToRGB(rProperty.second.toInt32())))); else if (rProperty.first == "shadowOffsetX") // EMUs to points aShadowModel.moOffset.set(OUString::number(rProperty.second.toDouble() / 12700) + "pt"); - else if (rProperty.first == "posh" || rProperty.first == "posv" || rProperty.first == "fFitShapeToText" || rProperty.first == "fFilled" || rProperty.first == "rotation") + else if (rProperty.first == "posh" || rProperty.first == "posv" + || rProperty.first == "fFitShapeToText" || rProperty.first == "fFilled" + || rProperty.first == "rotation") applyProperty(xShape, rProperty.first, rProperty.second); else if (rProperty.first == "posrelh") { switch (rProperty.second.toInt32()) { - case 1: - rShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME; - break; - default: - break; + case 1: + rShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME; + break; + default: + break; } } else if (rProperty.first == "posrelv") { switch (rProperty.second.toInt32()) { - case 1: - rShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; - break; - default: - break; + case 1: + rShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; + break; + default: + break; } } else if (rProperty.first == "groupLeft") @@ -682,7 +713,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "pctHoriz" || rProperty.first == "pctVert") { sal_Int16 nPercentage = rtl::math::round(rProperty.second.toDouble() / 10); - boost::optional<sal_Int16>& rPercentage = rProperty.first == "pctHoriz" ? oRelativeWidth : oRelativeHeight; + boost::optional<sal_Int16>& rPercentage + = rProperty.first == "pctHoriz" ? oRelativeWidth : oRelativeHeight; if (nPercentage) rPercentage = nPercentage; } @@ -692,15 +724,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap { switch (rProperty.second.toInt32()) { - case 0: // margin - nRelativeWidthRelation = text::RelOrientation::FRAME; - break; - case 1: // page - nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; - break; - default: - SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelh value: " << rProperty.second); - break; + case 0: // margin + nRelativeWidthRelation = text::RelOrientation::FRAME; + break; + case 1: // page + nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; + break; + default: + SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelh value: " + << rProperty.second); + break; } } } @@ -710,15 +743,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap { switch (rProperty.second.toInt32()) { - case 0: // margin - nRelativeHeightRelation = text::RelOrientation::FRAME; - break; - case 1: // page - nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; - break; - default: - SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelv value: " << rProperty.second); - break; + case 0: // margin + nRelativeHeightRelation = text::RelOrientation::FRAME; + break; + case 1: // page + nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; + break; + default: + SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelv value: " + << rProperty.second); + break; } } } @@ -760,15 +794,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int16 nHoriOrient = text::HoriOrientation::NONE; switch (rProperty.second.toInt32()) { - case 0: - nHoriOrient = text::HoriOrientation::LEFT; - break; - case 1: - nHoriOrient = text::HoriOrientation::CENTER; - break; - case 2: - nHoriOrient = text::HoriOrientation::RIGHT; - break; + case 0: + nHoriOrient = text::HoriOrientation::LEFT; + break; + case 1: + nHoriOrient = text::HoriOrientation::CENTER; + break; + case 2: + nHoriOrient = text::HoriOrientation::RIGHT; + break; } if (xPropertySet.is() && text::HoriOrientation::NONE != nHoriOrient) { @@ -802,15 +836,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap oX.reset(aPoint.toInt32()); else oY.reset(aPoint.toInt32()); - } - while (nI >= 0); + } while (nI >= 0); RTFSprms aPathAttributes; aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, std::make_shared<RTFValue>(*oX)); aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, std::make_shared<RTFValue>(*oY)); - aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, std::make_shared<RTFValue>(aPathAttributes), RTFOverwrite::NO_APPEND); + aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, + std::make_shared<RTFValue>(aPathAttributes), + RTFOverwrite::NO_APPEND); } - } - while (nCharIndex >= 0); + } while (nCharIndex >= 0); rShape.aWrapPolygonSprms = aPolygonSprms; } else if (rProperty.first == "fRelFlipV") @@ -820,7 +854,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap else if (rProperty.first == "fFlipV") obFlipV = rProperty.second.toInt32() == 1; else - SAL_INFO("writerfilter", "TODO handle shape property '" << rProperty.first << "':'" << rProperty.second << "'"); + SAL_INFO("writerfilter", "TODO handle shape property '" << rProperty.first << "':'" + << rProperty.second << "'"); } if (xPropertySet.is()) @@ -890,26 +925,28 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap aGeometry.push_back(aPropertyValue); } if (!aGeometry.empty() && xPropertySet.is() && !m_bTextFrame) - xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(comphelper::containerToSequence(aGeometry))); + xPropertySet->setPropertyValue("CustomShapeGeometry", + uno::Any(comphelper::containerToSequence(aGeometry))); if (!aShapeText.isEmpty()) { - auto aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >(); - auto aGeomPropVec = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aGeomPropSeq); - uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( - { - {"TextPath", uno::makeAny(true)}, + auto aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + auto aGeomPropVec + = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq); + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ + { "TextPath", uno::makeAny(true) }, })); - auto it = std::find_if(aGeomPropVec.begin(), aGeomPropVec.end(), [](const beans::PropertyValue& rValue) - { - return rValue.Name == "TextPath"; - }); + auto it = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [](const beans::PropertyValue& rValue) { return rValue.Name == "TextPath"; }); if (it == aGeomPropVec.end()) aGeomPropVec.push_back(comphelper::makePropertyValue("TextPath", aPropertyValues)); else it->Value <<= aPropertyValues; - xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(comphelper::containerToSequence(aGeomPropVec))); + xPropertySet->setPropertyValue("CustomShapeGeometry", + uno::makeAny(comphelper::containerToSequence(aGeomPropVec))); xPropertySet->setPropertyValue("TextAutoGrowHeight", uno::makeAny(false)); xPropertySet->setPropertyValue("TextAutoGrowWidth", uno::makeAny(false)); } @@ -919,8 +956,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap if (nType == ESCHER_ShpInst_Line) { // Line shape inside group shape: get the polygon sequence and transform it. - uno::Sequence< uno::Sequence<awt::Point> > aPolyPolySequence; - if ((xPropertySet->getPropertyValue("PolyPolygon") >>= aPolyPolySequence) && aPolyPolySequence.hasElements()) + uno::Sequence<uno::Sequence<awt::Point>> aPolyPolySequence; + if ((xPropertySet->getPropertyValue("PolyPolygon") >>= aPolyPolySequence) + && aPolyPolySequence.hasElements()) { uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; basegfx::B2DPolygon aPoly; @@ -935,7 +973,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) { basegfx::B2DPoint aPoint(aPoly.getB2DPoint(i)); - rPolygon[i] = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY()))); + rPolygon[i] + = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), + static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY()))); } xPropertySet->setPropertyValue("PolyPolygon", uno::makeAny(aPolyPolySequence)); } @@ -948,8 +988,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int32 nLeft = rShape.nLeft; sal_Int32 nTop = rShape.nTop; - bool bInShapeGroup = oGroupLeft && oGroupTop && oGroupRight && oGroupBottom - && oRelLeft && oRelTop && oRelRight && oRelBottom; + bool bInShapeGroup = oGroupLeft && oGroupTop && oGroupRight && oGroupBottom && oRelLeft + && oRelTop && oRelRight && oRelBottom; awt::Size aSize; if (bInShapeGroup) { @@ -958,10 +998,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int32 nShapeHeight = rShape.nBottom - rShape.nTop; sal_Int32 nCoordSysWidth = *oGroupRight - *oGroupLeft; sal_Int32 nCoordSysHeight = *oGroupBottom - *oGroupTop; - double fWidthRatio = static_cast< double >(nShapeWidth) / nCoordSysWidth; - double fHeightRatio = static_cast< double >(nShapeHeight) / nCoordSysHeight; - nLeft = static_cast< sal_Int32 >(rShape.nLeft + fWidthRatio * (*oRelLeft - *oGroupLeft)); - nTop = static_cast< sal_Int32 >(rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop)); + double fWidthRatio = static_cast<double>(nShapeWidth) / nCoordSysWidth; + double fHeightRatio = static_cast<double>(nShapeHeight) / nCoordSysHeight; + nLeft = static_cast<sal_Int32>(rShape.nLeft + fWidthRatio * (*oRelLeft - *oGroupLeft)); + nTop = static_cast<sal_Int32>(rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop)); // See lclGetAbsRect() in the VML import. aSize.Width = std::lround(fWidthRatio * (*oRelRight - *oRelLeft)); @@ -987,21 +1027,27 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap if (nType != ESCHER_ShpInst_Line) { // This has to be set after position and size is set, otherwise flip will affect the position. - comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry")); + comphelper::SequenceAsHashMap aCustomShapeGeometry( + xPropertySet->getPropertyValue("CustomShapeGeometry")); if (obFlipH == true) aCustomShapeGeometry["MirroredX"] <<= true; if (obFlipV == true) aCustomShapeGeometry["MirroredY"] <<= true; - xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList())); + xPropertySet->setPropertyValue( + "CustomShapeGeometry", + uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList())); } } if (rShape.nHoriOrientRelation != 0) - xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation)); + xPropertySet->setPropertyValue("HoriOrientRelation", + uno::makeAny(rShape.nHoriOrientRelation)); if (rShape.nVertOrientRelation != 0) - xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation)); + xPropertySet->setPropertyValue("VertOrientRelation", + uno::makeAny(rShape.nVertOrientRelation)); if (rShape.nWrap != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE) - xPropertySet->setPropertyValue("Surround", uno::makeAny(text::WrapTextMode(rShape.nWrap))); + xPropertySet->setPropertyValue("Surround", + uno::makeAny(text::WrapTextMode(rShape.nWrap))); oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory()); if (aFillModel.moType.has()) { @@ -1018,24 +1064,29 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap // Sets the ShadowFormat UNO property. oox::PropertySet(xShape).setProperties(aPropMap); } - xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); + xPropertySet->setPropertyValue("AnchorType", + uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); xPropertySet->setPropertyValue("Opaque", uno::makeAny(bOpaque)); if (oRelativeWidth) { xPropertySet->setPropertyValue("RelativeWidth", uno::makeAny(*oRelativeWidth)); - xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(nRelativeWidthRelation)); + xPropertySet->setPropertyValue("RelativeWidthRelation", + uno::makeAny(nRelativeWidthRelation)); } if (oRelativeHeight) { xPropertySet->setPropertyValue("RelativeHeight", uno::makeAny(*oRelativeHeight)); - xPropertySet->setPropertyValue("RelativeHeightRelation", uno::makeAny(nRelativeHeightRelation)); + xPropertySet->setPropertyValue("RelativeHeightRelation", + uno::makeAny(nRelativeHeightRelation)); } } if (m_rImport.isInBackground()) { RTFSprms aAttributes; - aAttributes.set(NS_ooxml::LN_CT_Background_color, std::make_shared<RTFValue>(xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())); + aAttributes.set(NS_ooxml::LN_CT_Background_color, + std::make_shared<RTFValue>( + xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())); m_rImport.Mapper().props(std::make_shared<RTFReferenceProperties>(aAttributes)); uno::Reference<lang::XComponent> xComponent(xShape, uno::UNO_QUERY); @@ -1052,10 +1103,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap m_xShape = xShape; } -void RTFSdrImport::close() -{ - m_rImport.Mapper().endShape(); -} +void RTFSdrImport::close() { m_rImport.Mapper().endShape(); } void RTFSdrImport::append(const OUString& aKey, const OUString& aValue) { diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 948a4a6837da..83d025b918d2 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -25,19 +25,29 @@ namespace rtftok class RTFSdrImport final { public: - RTFSdrImport(RTFDocumentImpl& rDocument, css::uno::Reference<css::lang::XComponent> const& xDstDoc); + RTFSdrImport(RTFDocumentImpl& rDocument, + css::uno::Reference<css::lang::XComponent> const& xDstDoc); ~RTFSdrImport(); - enum ShapeOrPict { SHAPE, PICT }; + enum ShapeOrPict + { + SHAPE, + PICT + }; void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict); void close(); void append(const OUString& aKey, const OUString& aValue); /// Append property on the current parent. void appendGroupProperty(const OUString& aKey, const OUString& aValue); - void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle); + void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, + sal_Int32 nZOrder, bool bOldStyle); /// Set line color and line width on the shape, using the relevant API depending on if the shape is a text frame or not. - static void resolveLineColorAndWidth(bool bTextFrame, const css::uno::Reference<css::beans::XPropertySet>& xPropertySet, css::uno::Any const& rLineColor, css::uno::Any const& rLineWidth); - static void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nFLine); + static void + resolveLineColorAndWidth(bool bTextFrame, + const css::uno::Reference<css::beans::XPropertySet>& xPropertySet, + css::uno::Any const& rLineColor, css::uno::Any const& rLineWidth); + static void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, + sal_Int32 nFLine); /** * These are the default in Word, but not in Writer. * @@ -48,24 +58,20 @@ public: void pushParent(css::uno::Reference<css::drawing::XShapes> const& xParent); /// Pop the current group shape from the parent stack. void popParent(); - css::uno::Reference<css::drawing::XShape> const& getCurrentShape() - { - return m_xShape; - } - bool isFakePict() - { - return m_bFakePict; - } + css::uno::Reference<css::drawing::XShape> const& getCurrentShape() { return m_xShape; } + bool isFakePict() { return m_bFakePict; } + private: - void createShape(const OUString& rService, css::uno::Reference<css::drawing::XShape>& xShape, css::uno::Reference<css::beans::XPropertySet>& xPropertySet); - void applyProperty(css::uno::Reference<css::drawing::XShape> const& xShape, const OUString& aKey, const OUString& aValue); + void createShape(const OUString& rService, css::uno::Reference<css::drawing::XShape>& xShape, + css::uno::Reference<css::beans::XPropertySet>& xPropertySet); + void applyProperty(css::uno::Reference<css::drawing::XShape> const& xShape, + const OUString& aKey, const OUString& aValue); int initShape(css::uno::Reference<css::drawing::XShape>& o_xShape, - css::uno::Reference<css::beans::XPropertySet>& o_xPropSet, - bool& o_rIsCustomShape, + css::uno::Reference<css::beans::XPropertySet>& o_xPropSet, bool& o_rIsCustomShape, RTFShape const& rShape, bool bClose, ShapeOrPict shapeOrPict); RTFDocumentImpl& m_rImport; - std::stack< css::uno::Reference<css::drawing::XShapes> > m_aParents; + std::stack<css::uno::Reference<css::drawing::XShapes>> m_aParents; css::uno::Reference<css::drawing::XShape> m_xShape; /// If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle). bool m_bTextFrame; diff --git a/writerfilter/source/rtftok/rtfskipdestination.cxx b/writerfilter/source/rtftok/rtfskipdestination.cxx index 490d44fba25e..00ab0a51b0e8 100644 --- a/writerfilter/source/rtftok/rtfskipdestination.cxx +++ b/writerfilter/source/rtftok/rtfskipdestination.cxx @@ -15,11 +15,10 @@ namespace writerfilter { namespace rtftok { - RTFSkipDestination::RTFSkipDestination(RTFListener& rImport) - : m_rImport(rImport), - m_bParsed(true), - m_bReset(true) + : m_rImport(rImport) + , m_bParsed(true) + , m_bReset(true) { } @@ -36,15 +35,9 @@ RTFSkipDestination::~RTFSkipDestination() } } -void RTFSkipDestination::setParsed(bool bParsed) -{ - m_bParsed = bParsed; -} +void RTFSkipDestination::setParsed(bool bParsed) { m_bParsed = bParsed; } -void RTFSkipDestination::setReset(bool bReset) -{ - m_bReset = bReset; -} +void RTFSkipDestination::setReset(bool bReset) { m_bReset = bReset; } } // namespace rtftok } // namespace writerfilter diff --git a/writerfilter/source/rtftok/rtfskipdestination.hxx b/writerfilter/source/rtftok/rtfskipdestination.hxx index 7e59a3380f94..b779b1cbcc53 100644 --- a/writerfilter/source/rtftok/rtfskipdestination.hxx +++ b/writerfilter/source/rtftok/rtfskipdestination.hxx @@ -24,6 +24,7 @@ public: ~RTFSkipDestination(); void setParsed(bool bParsed); void setReset(bool bReset); + private: RTFListener& m_rImport; bool m_bParsed; diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index ba1a633c5abf..113feecf5f53 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -16,22 +16,15 @@ namespace writerfilter { namespace rtftok { - RTFSprm::RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue) - : m_nKeyword(nKeyword), - m_pValue(pValue) + : m_nKeyword(nKeyword) + , m_pValue(pValue) { } -sal_uInt32 RTFSprm::getId() const -{ - return m_nKeyword; -} +sal_uInt32 RTFSprm::getId() const { return m_nKeyword; } -Value::Pointer_t RTFSprm::getValue() -{ - return Value::Pointer_t(m_pValue->Clone()); -} +Value::Pointer_t RTFSprm::getValue() { return Value::Pointer_t(m_pValue->Clone()); } writerfilter::Reference<Properties>::Pointer_t RTFSprm::getProps() { @@ -39,10 +32,7 @@ writerfilter::Reference<Properties>::Pointer_t RTFSprm::getProps() } #ifdef DEBUG_WRITERFILTER -std::string RTFSprm::getName() const -{ - return "RTFSprm"; -} +std::string RTFSprm::getName() const { return "RTFSprm"; } #endif #ifdef DEBUG_WRITERFILTER @@ -139,15 +129,15 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id) { switch (id) { - case NS_ooxml::LN_CT_Spacing_before: - case NS_ooxml::LN_CT_Spacing_after: - case NS_ooxml::LN_EG_RPrBase_b: - case NS_ooxml::LN_CT_Ind_left: - case NS_ooxml::LN_CT_Ind_right: - return std::make_shared<RTFValue>(0); - - default: - return RTFValue::Pointer_t(); + case NS_ooxml::LN_CT_Spacing_before: + case NS_ooxml::LN_CT_Spacing_after: + case NS_ooxml::LN_EG_RPrBase_b: + case NS_ooxml::LN_CT_Ind_left: + case NS_ooxml::LN_CT_Ind_right: + return std::make_shared<RTFValue>(0); + + default: + return RTFValue::Pointer_t(); } } @@ -156,19 +146,19 @@ static bool isSPRMDeduplicateBlacklist(Id nId) { switch (nId) { - // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper, - // deduplication is explicitly not wanted for these tokens. - case NS_ooxml::LN_CT_TabStop_val: - case NS_ooxml::LN_CT_TabStop_leader: - case NS_ooxml::LN_CT_TabStop_pos: - // \htmautsp arrives after the style table, so only the non-style value is - // correct, keep these. - case NS_ooxml::LN_CT_Spacing_beforeAutospacing: - case NS_ooxml::LN_CT_Spacing_afterAutospacing: - return true; - - default: - return false; + // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper, + // deduplication is explicitly not wanted for these tokens. + case NS_ooxml::LN_CT_TabStop_val: + case NS_ooxml::LN_CT_TabStop_leader: + case NS_ooxml::LN_CT_TabStop_pos: + // \htmautsp arrives after the style table, so only the non-style value is + // correct, keep these. + case NS_ooxml::LN_CT_Spacing_beforeAutospacing: + case NS_ooxml::LN_CT_Spacing_afterAutospacing: + return true; + + default: + return false; } } @@ -177,21 +167,21 @@ static bool isSPRMChildrenExpected(Id nId) { switch (nId) { - case NS_ooxml::LN_CT_PBdr_top: - case NS_ooxml::LN_CT_PBdr_left: - case NS_ooxml::LN_CT_PBdr_bottom: - case NS_ooxml::LN_CT_PBdr_right: - // Expected children are NS_ooxml::LN_CT_Border_*. - SAL_FALLTHROUGH; - case NS_ooxml::LN_CT_PrBase_shd: - // Expected children are NS_ooxml::LN_CT_Shd_*. - SAL_FALLTHROUGH; - case NS_ooxml::LN_CT_PPrBase_ind: - // Expected children are NS_ooxml::LN_CT_Ind_*. - return true; - - default: - return false; + case NS_ooxml::LN_CT_PBdr_top: + case NS_ooxml::LN_CT_PBdr_left: + case NS_ooxml::LN_CT_PBdr_bottom: + case NS_ooxml::LN_CT_PBdr_right: + // Expected children are NS_ooxml::LN_CT_Border_*. + SAL_FALLTHROUGH; + case NS_ooxml::LN_CT_PrBase_shd: + // Expected children are NS_ooxml::LN_CT_Shd_*. + SAL_FALLTHROUGH; + case NS_ooxml::LN_CT_PPrBase_ind: + // Expected children are NS_ooxml::LN_CT_Ind_*. + return true; + + default: + return false; } } @@ -209,10 +199,12 @@ static void cloneAndDeduplicateSprm(std::pair<Id, RTFValue::Pointer_t> const& rS else if (!rSprm.second->getSprms().empty() || !rSprm.second->getAttributes().empty()) { RTFSprms const sprms(pValue->getSprms().cloneAndDeduplicate(rSprm.second->getSprms())); - RTFSprms const attributes(pValue->getAttributes().cloneAndDeduplicate(rSprm.second->getAttributes())); + RTFSprms const attributes( + pValue->getAttributes().cloneAndDeduplicate(rSprm.second->getAttributes())); // Don't copy the sprm in case we expect it to have children but it doesn't have some. if (!isSPRMChildrenExpected(rSprm.first) || !sprms.empty() || !attributes.empty()) - ret.set(rSprm.first, RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms))); + ret.set(rSprm.first, + RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms))); } } else @@ -226,7 +218,8 @@ static void cloneAndDeduplicateSprm(std::pair<Id, RTFValue::Pointer_t> const& rS else if (!rSprm.second->getSprms().empty() || !rSprm.second->getAttributes().empty()) { RTFSprms const sprms(RTFSprms().cloneAndDeduplicate(rSprm.second->getSprms())); - RTFSprms const attributes(RTFSprms().cloneAndDeduplicate(rSprm.second->getAttributes())); + RTFSprms const attributes( + RTFSprms().cloneAndDeduplicate(rSprm.second->getAttributes())); if (!sprms.empty() || !attributes.empty()) { ret.set(rSprm.first, std::make_shared<RTFValue>(attributes, sprms)); @@ -273,7 +266,8 @@ void RTFSprms::ensureCopyBeforeWrite() { boost::intrusive_ptr<RTFSprmsImpl> pClone(new RTFSprmsImpl); for (auto& rSprm : *m_pSprms) - pClone->push_back(std::make_pair(rSprm.first, RTFValue::Pointer_t(rSprm.second->Clone()))); + pClone->push_back( + std::make_pair(rSprm.first, RTFValue::Pointer_t(rSprm.second->Clone()))); m_pSprms = pClone; } } @@ -285,10 +279,7 @@ RTFSprms::RTFSprms() RTFSprms::~RTFSprms() = default; -RTFSprms::RTFSprms(const RTFSprms& rSprms) -{ - *this = rSprms; -} +RTFSprms::RTFSprms(const RTFSprms& rSprms) { *this = rSprms; } void RTFSprms::clear() { diff --git a/writerfilter/source/rtftok/rtfsprm.hxx b/writerfilter/source/rtftok/rtfsprm.hxx index 0b2b88e6d15f..04367ea28921 100644 --- a/writerfilter/source/rtftok/rtfsprm.hxx +++ b/writerfilter/source/rtftok/rtfsprm.hxx @@ -21,8 +21,7 @@ namespace writerfilter { namespace rtftok { - -using RTFSprmsImplBase = std::vector< std::pair<Id, RTFValue::Pointer_t> >; +using RTFSprmsImplBase = std::vector<std::pair<Id, RTFValue::Pointer_t>>; /// The payload of RTFSprms which is only copied on write. class RTFSprmsImpl : public RTFSprmsImplBase @@ -31,10 +30,7 @@ public: sal_Int32 m_nRefCount = 0; }; -inline void intrusive_ptr_add_ref(RTFSprmsImpl* p) -{ - ++(p->m_nRefCount); -} +inline void intrusive_ptr_add_ref(RTFSprmsImpl* p) { ++(p->m_nRefCount); } inline void intrusive_ptr_release(RTFSprmsImpl* p) { if (!--(p->m_nRefCount)) @@ -68,36 +64,21 @@ public: /// Also insert default values to override attributes of style /// (yes, really; that's what Word does). RTFSprms cloneAndDeduplicate(RTFSprms& rReference) const; - std::size_t size() const - { - return m_pSprms->size(); - } - bool empty() const - { - return m_pSprms->empty(); - } - Entry_t& back() - { - return m_pSprms->back(); - } - Iterator_t begin() - { - return m_pSprms->begin(); - } - Iterator_t end() - { - return m_pSprms->end(); - } + std::size_t size() const { return m_pSprms->size(); } + bool empty() const { return m_pSprms->empty(); } + Entry_t& back() { return m_pSprms->back(); } + Iterator_t begin() { return m_pSprms->begin(); } + Iterator_t end() { return m_pSprms->end(); } void clear(); bool equals(RTFValue& rOther); + private: void ensureCopyBeforeWrite(); boost::intrusive_ptr<RTFSprmsImpl> m_pSprms; }; /// RTF keyword with a parameter -class RTFSprm - : public Sprm +class RTFSprm : public Sprm { public: RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue); diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index 85ef23c609cf..31ab72129694 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -24,31 +24,33 @@ namespace writerfilter { namespace rtftok { - std::vector<RTFSymbol> RTFTokenizer::s_aRTFControlWords; bool RTFTokenizer::s_bControlWordsSorted; std::vector<RTFMathSymbol> RTFTokenizer::s_aRTFMathControlWords; bool RTFTokenizer::s_bMathControlWordsSorted; -RTFTokenizer::RTFTokenizer(RTFListener& rImport, SvStream* pInStream, uno::Reference<task::XStatusIndicator> const& xStatusIndicator) - : m_rImport(rImport), - m_pInStream(pInStream), - m_xStatusIndicator(xStatusIndicator), - m_nGroup(0), - m_nLineNumber(0), - m_nLineStartPos(0), - m_nGroupStart(0) +RTFTokenizer::RTFTokenizer(RTFListener& rImport, SvStream* pInStream, + uno::Reference<task::XStatusIndicator> const& xStatusIndicator) + : m_rImport(rImport) + , m_pInStream(pInStream) + , m_xStatusIndicator(xStatusIndicator) + , m_nGroup(0) + , m_nLineNumber(0) + , m_nLineStartPos(0) + , m_nGroupStart(0) { if (!RTFTokenizer::s_bControlWordsSorted) { RTFTokenizer::s_bControlWordsSorted = true; - s_aRTFControlWords = std::vector<RTFSymbol>(aRTFControlWords, aRTFControlWords + nRTFControlWords); + s_aRTFControlWords + = std::vector<RTFSymbol>(aRTFControlWords, aRTFControlWords + nRTFControlWords); std::sort(s_aRTFControlWords.begin(), s_aRTFControlWords.end()); } if (!RTFTokenizer::s_bMathControlWordsSorted) { RTFTokenizer::s_bMathControlWordsSorted = true; - s_aRTFMathControlWords = std::vector<RTFMathSymbol>(aRTFMathControlWords, aRTFMathControlWords + nRTFMathControlWords); + s_aRTFMathControlWords = std::vector<RTFMathSymbol>( + aRTFMathControlWords, aRTFMathControlWords + nRTFMathControlWords); std::sort(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end()); } } @@ -97,63 +99,63 @@ RTFError RTFTokenizer::resolveParse() { switch (ch) { - case '{': - m_nGroupStart = Strm().Tell() - 1; - ret = m_rImport.pushState(); - if (ret != RTFError::OK) - return ret; - break; - case '}': - ret = m_rImport.popState(); - if (ret != RTFError::OK) - return ret; - if (m_nGroup == 0) - { - if (m_rImport.isSubstream()) - m_rImport.finishSubstream(); - return RTFError::OK; - } - break; - case '\\': - ret = resolveKeyword(); - if (ret != RTFError::OK) - return ret; - break; - case 0x0d: - break; // ignore this - case 0x0a: - m_nLineNumber++; - m_nLineStartPos = nCurrentPos; - break; - default: - if (m_nGroup == 0) - return RTFError::CHAR_OVER; - if (m_rImport.getInternalState() == RTFInternalState::NORMAL) - { - ret = m_rImport.resolveChars(ch); + case '{': + m_nGroupStart = Strm().Tell() - 1; + ret = m_rImport.pushState(); if (ret != RTFError::OK) return ret; - } - else - { - SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": hex internal state"); - b = b << 4; - sal_Int8 parsed = asHex(ch); - if (parsed == -1) - return RTFError::HEX_INVALID; - b += parsed; - count--; - if (!count) + break; + case '}': + ret = m_rImport.popState(); + if (ret != RTFError::OK) + return ret; + if (m_nGroup == 0) + { + if (m_rImport.isSubstream()) + m_rImport.finishSubstream(); + return RTFError::OK; + } + break; + case '\\': + ret = resolveKeyword(); + if (ret != RTFError::OK) + return ret; + break; + case 0x0d: + break; // ignore this + case 0x0a: + m_nLineNumber++; + m_nLineStartPos = nCurrentPos; + break; + default: + if (m_nGroup == 0) + return RTFError::CHAR_OVER; + if (m_rImport.getInternalState() == RTFInternalState::NORMAL) { - ret = m_rImport.resolveChars(b); + ret = m_rImport.resolveChars(ch); if (ret != RTFError::OK) return ret; - count = 2; - b = 0; - m_rImport.setInternalState(RTFInternalState::NORMAL); } - } - break; + else + { + SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": hex internal state"); + b = b << 4; + sal_Int8 parsed = asHex(ch); + if (parsed == -1) + return RTFError::HEX_INVALID; + b += parsed; + count--; + if (!count) + { + ret = m_rImport.resolveChars(b); + if (ret != RTFError::OK) + return ret; + count = 2; + b = 0; + m_rImport.setInternalState(RTFInternalState::NORMAL); + } + } + break; } } } @@ -183,15 +185,9 @@ int RTFTokenizer::asHex(char ch) return ret; } -void RTFTokenizer::pushGroup() -{ - m_nGroup++; -} +void RTFTokenizer::pushGroup() { m_nGroup++; } -void RTFTokenizer::popGroup() -{ - m_nGroup--; -} +void RTFTokenizer::popGroup() { m_nGroup--; } RTFError RTFTokenizer::resolveKeyword() { @@ -264,7 +260,8 @@ RTFError RTFTokenizer::resolveKeyword() bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol) { - auto low = std::lower_bound(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end(), rSymbol); + auto low + = std::lower_bound(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end(), rSymbol); int i = low - s_aRTFMathControlWords.begin(); if (low == s_aRTFMathControlWords.end() || rSymbol < *low) return false; @@ -282,8 +279,9 @@ RTFError RTFTokenizer::dispatchKeyword(OString const& rKeyword, bool bParam, int Strm().SeekRel(nParam); return RTFError::OK; } - SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": keyword '\\" << rKeyword << - "' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'"); + SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": keyword '\\" << rKeyword << "' with param? " + << (bParam ? 1 : 0) << " param val: '" + << (bParam ? nParam : 0) << "'"); RTFSymbol aSymbol; aSymbol.sKeyword = rKeyword.getStr(); auto low = std::lower_bound(s_aRTFControlWords.begin(), s_aRTFControlWords.end(), aSymbol); @@ -299,38 +297,38 @@ RTFError RTFTokenizer::dispatchKeyword(OString const& rKeyword, bool bParam, int RTFError ret; switch (s_aRTFControlWords[i].nControlType) { - case CONTROL_FLAG: - // flags ignore any parameter by definition - ret = m_rImport.dispatchFlag(s_aRTFControlWords[i].nIndex); - if (ret != RTFError::OK) - return ret; - break; - case CONTROL_DESTINATION: - // same for destinations - ret = m_rImport.dispatchDestination(s_aRTFControlWords[i].nIndex); - if (ret != RTFError::OK) - return ret; - break; - case CONTROL_SYMBOL: - // and symbols - ret = m_rImport.dispatchSymbol(s_aRTFControlWords[i].nIndex); - if (ret != RTFError::OK) - return ret; - break; - case CONTROL_TOGGLE: - ret = m_rImport.dispatchToggle(s_aRTFControlWords[i].nIndex, bParam, nParam); - if (ret != RTFError::OK) - return ret; - break; - case CONTROL_VALUE: - // Values require a parameter by definition, but Word doesn't respect this for \dibitmap. - if (bParam || s_aRTFControlWords[i].nIndex == RTF_DIBITMAP) - { - ret = m_rImport.dispatchValue(s_aRTFControlWords[i].nIndex, nParam); + case CONTROL_FLAG: + // flags ignore any parameter by definition + ret = m_rImport.dispatchFlag(s_aRTFControlWords[i].nIndex); if (ret != RTFError::OK) return ret; - } - break; + break; + case CONTROL_DESTINATION: + // same for destinations + ret = m_rImport.dispatchDestination(s_aRTFControlWords[i].nIndex); + if (ret != RTFError::OK) + return ret; + break; + case CONTROL_SYMBOL: + // and symbols + ret = m_rImport.dispatchSymbol(s_aRTFControlWords[i].nIndex); + if (ret != RTFError::OK) + return ret; + break; + case CONTROL_TOGGLE: + ret = m_rImport.dispatchToggle(s_aRTFControlWords[i].nIndex, bParam, nParam); + if (ret != RTFError::OK) + return ret; + break; + case CONTROL_VALUE: + // Values require a parameter by definition, but Word doesn't respect this for \dibitmap. + if (bParam || s_aRTFControlWords[i].nIndex == RTF_DIBITMAP) + { + ret = m_rImport.dispatchValue(s_aRTFControlWords[i].nIndex, nParam); + if (ret != RTFError::OK) + return ret; + } + break; } return RTFError::OK; @@ -345,7 +343,6 @@ OUString RTFTokenizer::getPosition() return aRet.makeStringAndClear(); } - } // namespace rtftok } // namespace writerfilter diff --git a/writerfilter/source/rtftok/rtftokenizer.hxx b/writerfilter/source/rtftok/rtftokenizer.hxx index c2a32e3e874e..c13ca6c2d282 100644 --- a/writerfilter/source/rtftok/rtftokenizer.hxx +++ b/writerfilter/source/rtftok/rtftokenizer.hxx @@ -27,32 +27,25 @@ namespace rtftok class RTFTokenizer final { public: - RTFTokenizer(RTFListener& rImport, SvStream* pInStream, css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator); + RTFTokenizer(RTFListener& rImport, SvStream* pInStream, + css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator); ~RTFTokenizer(); RTFError resolveParse(); static int asHex(char ch); /// Number of states on the stack. - int getGroup() const - { - return m_nGroup; - } + int getGroup() const { return m_nGroup; } /// To be invoked by the pushState() callback to signal when the importer enters a group. void pushGroup(); /// To be invoked by the popState() callback to signal when the importer leaves a group. void popGroup(); OUString getPosition(); - std::size_t getGroupStart() - { - return m_nGroupStart; - } + std::size_t getGroupStart() { return m_nGroupStart; } /// To look up additional properties of a math symbol. static bool lookupMathKeyword(RTFMathSymbol& rSymbol); + private: - SvStream& Strm() - { - return *m_pInStream; - } + SvStream& Strm() { return *m_pInStream; } RTFError resolveKeyword(); RTFError dispatchKeyword(OString const& rKeyword, bool bParam, int nParam); diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx index e2430128db2c..4b4366c31b61 100644 --- a/writerfilter/source/rtftok/rtfvalue.cxx +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -16,121 +16,112 @@ namespace writerfilter { namespace rtftok { - - -RTFValue::RTFValue(int nValue, OUString sValue, - RTFSprms rAttributes, RTFSprms rSprms, - uno::Reference<drawing::XShape> xShape, - uno::Reference<io::XInputStream> xStream, - uno::Reference<embed::XEmbeddedObject> xObject, - bool bForceString, - const RTFShape& aShape, - const RTFPicture& rPicture) - : m_nValue(nValue), - m_sValue(std::move(sValue)), - m_pAttributes(std::make_shared<RTFSprms>(rAttributes)), - m_pSprms(std::make_shared<RTFSprms>(rSprms)), - m_xShape(std::move(xShape)), - m_xStream(std::move(xStream)), - m_xObject(std::move(xObject)), - m_bForceString(bForceString), - m_pShape(std::make_shared<RTFShape>(aShape)), - m_pPicture(std::make_shared<RTFPicture>(rPicture)) +RTFValue::RTFValue(int nValue, OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, + uno::Reference<drawing::XShape> xShape, uno::Reference<io::XInputStream> xStream, + uno::Reference<embed::XEmbeddedObject> xObject, bool bForceString, + const RTFShape& aShape, const RTFPicture& rPicture) + : m_nValue(nValue) + , m_sValue(std::move(sValue)) + , m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) + , m_pSprms(std::make_shared<RTFSprms>(rSprms)) + , m_xShape(std::move(xShape)) + , m_xStream(std::move(xStream)) + , m_xObject(std::move(xObject)) + , m_bForceString(bForceString) + , m_pShape(std::make_shared<RTFShape>(aShape)) + , m_pPicture(std::make_shared<RTFPicture>(rPicture)) { } RTFValue::RTFValue() - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(int nValue) - : m_nValue(nValue), - m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_nValue(nValue) + , m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_pPicture(std::make_shared<RTFPicture>()) { m_pShape.reset(new RTFShape()); } RTFValue::RTFValue(OUString sValue, bool bForce) - : m_sValue(std::move(sValue)), - m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_bForceString(bForce), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_sValue(std::move(sValue)) + , m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_bForceString(bForce) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(RTFSprms rAttributes) - : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)), - m_pSprms(std::make_shared<RTFSprms>()), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms) - : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)), - m_pSprms(std::make_shared<RTFSprms>(rSprms)), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>(rAttributes)) + , m_pSprms(std::make_shared<RTFSprms>(rSprms)) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(uno::Reference<drawing::XShape> xShape) - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_xShape(std::move(xShape)), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_xShape(std::move(xShape)) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(uno::Reference<io::XInputStream> xStream) - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_xStream(std::move(xStream)), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_xStream(std::move(xStream)) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> xObject) - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_xObject(std::move(xObject)), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_xObject(std::move(xObject)) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(const RTFShape& aShape) - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_pShape(std::make_shared<RTFShape>(aShape)), - m_pPicture(std::make_shared<RTFPicture>()) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_pShape(std::make_shared<RTFShape>(aShape)) + , m_pPicture(std::make_shared<RTFPicture>()) { } RTFValue::RTFValue(const RTFPicture& rPicture) - : m_pAttributes(std::make_shared<RTFSprms>()), - m_pSprms(std::make_shared<RTFSprms>()), - m_pShape(std::make_shared<RTFShape>()), - m_pPicture(std::make_shared<RTFPicture>(rPicture)) + : m_pAttributes(std::make_shared<RTFSprms>()) + , m_pSprms(std::make_shared<RTFSprms>()) + , m_pShape(std::make_shared<RTFShape>()) + , m_pPicture(std::make_shared<RTFPicture>(rPicture)) { } RTFValue::~RTFValue() = default; -int RTFValue::getInt() const -{ - return m_nValue; -} +int RTFValue::getInt() const { return m_nValue; } OUString RTFValue::getString() const { @@ -140,10 +131,7 @@ OUString RTFValue::getString() const return OUString::number(m_nValue); } -void RTFValue::setString(const OUString& sValue) -{ - m_sValue = sValue; -} +void RTFValue::setString(const OUString& sValue) { m_sValue = sValue; } uno::Any RTFValue::getAny() const { @@ -161,15 +149,9 @@ uno::Any RTFValue::getAny() const return ret; } -RTFShape& RTFValue::getShape() const -{ - return *m_pShape; -} +RTFShape& RTFValue::getShape() const { return *m_pShape; } -RTFPicture& RTFValue::getPicture() const -{ - return *m_pPicture; -} +RTFPicture& RTFValue::getPicture() const { return *m_pPicture; } writerfilter::Reference<Properties>::Pointer_t RTFValue::getProperties() { @@ -193,12 +175,14 @@ std::string RTFValue::toString() const RTFValue* RTFValue::Clone() { - return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, m_xObject, m_bForceString, *m_pShape, *m_pPicture); + return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, + m_xObject, m_bForceString, *m_pShape, *m_pPicture); } RTFValue* RTFValue::CloneWithSprms(RTFSprms const& rAttributes, RTFSprms const& rSprms) { - return new RTFValue(m_nValue, m_sValue, rAttributes, rSprms, m_xShape, m_xStream, m_xObject, m_bForceString, *m_pShape, *m_pPicture); + return new RTFValue(m_nValue, m_sValue, rAttributes, rSprms, m_xShape, m_xStream, m_xObject, + m_bForceString, *m_pShape, *m_pPicture); } bool RTFValue::equals(RTFValue& rOther) @@ -218,15 +202,9 @@ bool RTFValue::equals(RTFValue& rOther) return true; } -RTFSprms& RTFValue::getAttributes() -{ - return *m_pAttributes; -} +RTFSprms& RTFValue::getAttributes() { return *m_pAttributes; } -RTFSprms& RTFValue::getSprms() -{ - return *m_pSprms; -} +RTFSprms& RTFValue::getSprms() { return *m_pSprms; } } // namespace rtftok } // namespace writerfilter diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx index b195f64e1d7b..97eaa6d8f96b 100644 --- a/writerfilter/source/rtftok/rtfvalue.hxx +++ b/writerfilter/source/rtftok/rtfvalue.hxx @@ -22,16 +22,15 @@ class RTFSprms; class RTFShape; class RTFPicture; /// Value of an RTF keyword -class RTFValue - : public Value +class RTFValue : public Value { public: using Pointer_t = std::shared_ptr<RTFValue>; RTFValue(int nValue, OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, css::uno::Reference<css::drawing::XShape> xShape, css::uno::Reference<css::io::XInputStream> xStream, - css::uno::Reference<css::embed::XEmbeddedObject> xObject, - bool bForceString, const RTFShape& aShape, const RTFPicture& rPicture); + css::uno::Reference<css::embed::XEmbeddedObject> xObject, bool bForceString, + const RTFShape& aShape, const RTFPicture& rPicture); RTFValue(); explicit RTFValue(int nValue); RTFValue(OUString sValue, bool bForce = false); @@ -60,6 +59,7 @@ public: RTFPicture& getPicture() const; bool equals(RTFValue& rOther); RTFValue& operator=(RTFValue const& rOther) = delete; + private: int m_nValue = 0; OUString m_sValue; |