diff options
51 files changed, 10996 insertions, 10006 deletions
diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx index ad1e9d13fbfa..279fe123e5b5 100644 --- a/filter/source/msfilter/rtfutil.cxx +++ b/filter/source/msfilter/rtfutil.cxx @@ -16,17 +16,16 @@ namespace msfilter { namespace rtfutil { - OString OutHex(sal_uLong nHex, sal_uInt8 nLen) { sal_Char aNToABuf[] = "0000000000000000"; OSL_ENSURE(nLen < sizeof(aNToABuf), "nLen is too big"); if (nLen >= sizeof(aNToABuf)) - nLen = (sizeof(aNToABuf)-1); + nLen = (sizeof(aNToABuf) - 1); // Set pointer to the buffer end - sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1); + sal_Char* pStr = aNToABuf + (sizeof(aNToABuf) - 1); for (sal_uInt8 n = 0; n < nLen; ++n) { *(--pStr) = (sal_Char)(nHex & 0xf) + 48; @@ -48,7 +47,8 @@ OString OutHex(sal_uLong nHex, sal_uInt8 nLen) // However the "Mathematics" section has an example that shows the code point // U+1D44E being encoded as UTF-16 surrogate pair "\u-10187?\u-9138?", so // sal_Unicode actually works fine here. -OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pSuccess, bool bUnicode) +OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pSuccess, + bool bUnicode) { if (pSuccess) *pSuccess = true; @@ -57,76 +57,78 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS // 0x0b instead of \n, etc because of the replacements in SwWW8AttrIter::GetSnippet() switch (c) { - case 0x0b: - // hard line break - pStr = OOO_STRING_SVTOOLS_RTF_LINE; - break; - case '\t': - pStr = OOO_STRING_SVTOOLS_RTF_TAB; - break; - case '\\': - case '}': - case '{': - aBuf.append('\\'); - aBuf.append((sal_Char)c); - break; - case 0xa0: - // non-breaking space - pStr = "\\~"; - break; - case 0x1e: - // non-breaking hyphen - pStr = "\\_"; - break; - case 0x1f: - // optional hyphen - pStr = "\\-"; - break; - default: - if (c >= ' ' && c <= '~') + case 0x0b: + // hard line break + pStr = OOO_STRING_SVTOOLS_RTF_LINE; + break; + case '\t': + pStr = OOO_STRING_SVTOOLS_RTF_TAB; + break; + case '\\': + case '}': + case '{': + aBuf.append('\\'); aBuf.append((sal_Char)c); - else - { - OUString sBuf(&c, 1); - OString sConverted; - if (pSuccess) - *pSuccess &= sBuf.convertToString(&sConverted, eDestEnc, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR); + break; + case 0xa0: + // non-breaking space + pStr = "\\~"; + break; + case 0x1e: + // non-breaking hyphen + pStr = "\\_"; + break; + case 0x1f: + // optional hyphen + pStr = "\\-"; + break; + default: + if (c >= ' ' && c <= '~') + aBuf.append((sal_Char)c); else - sBuf.convertToString(&sConverted, eDestEnc, OUSTRING_TO_OSTRING_CVTFLAGS); - const sal_Int32 nLen = sConverted.getLength(); - - if (pUCMode && bUnicode) { - if (*pUCMode != nLen) + OUString sBuf(&c, 1); + OString sConverted; + if (pSuccess) + *pSuccess &= sBuf.convertToString(&sConverted, eDestEnc, + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR + | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR); + else + sBuf.convertToString(&sConverted, eDestEnc, OUSTRING_TO_OSTRING_CVTFLAGS); + const sal_Int32 nLen = sConverted.getLength(); + + if (pUCMode && bUnicode) { - aBuf.append("\\uc"); - aBuf.append((sal_Int32)nLen); - // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored. - aBuf.append(' '); - *pUCMode = nLen; + if (*pUCMode != nLen) + { + aBuf.append("\\uc"); + aBuf.append((sal_Int32)nLen); + // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored. + aBuf.append(' '); + *pUCMode = nLen; + } + aBuf.append("\\u"); + aBuf.append((sal_Int32)c); } - aBuf.append("\\u"); - aBuf.append((sal_Int32)c); - } - for (sal_Int32 nI = 0; nI < nLen; ++nI) - { - aBuf.append("\\'"); - aBuf.append(OutHex(sConverted[nI], 2)); + for (sal_Int32 nI = 0; nI < nLen; ++nI) + { + aBuf.append("\\'"); + aBuf.append(OutHex(sConverted[nI], 2)); + } } - } } if (pStr) { aBuf.append(pStr); switch (c) { - case 0xa0: - case 0x1e: - case 0x1f: - break; - default: - aBuf.append(' '); + case 0xa0: + case 0x1e: + case 0x1f: + break; + default: + aBuf.append(' '); } } return aBuf.makeStringAndClear(); @@ -143,7 +145,8 @@ OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc, bool bUnicode { aBuf.append(OOO_STRING_SVTOOLS_RTF_UC); aBuf.append((sal_Int32)1); - aBuf.append(" "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; + aBuf.append( + " "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; } return aBuf.makeStringAndClear(); } @@ -171,7 +174,7 @@ OString OutStringUpr(const sal_Char* pToken, const OUString& rStr, rtl_TextEncod aRet.append("{" OOO_STRING_SVTOOLS_RTF_UPR "{"); aRet.append(pToken); aRet.append(" "); - aRet.append(OutString(rStr, eDestEnc, /*bUnicode =*/ false)); + aRet.append(OutString(rStr, eDestEnc, /*bUnicode =*/false)); aRet.append("}{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_UD "{"); aRet.append(pToken); aRet.append(" "); diff --git a/include/filter/msfilter/rtfutil.hxx b/include/filter/msfilter/rtfutil.hxx index 515db949895f..599161670521 100644 --- a/include/filter/msfilter/rtfutil.hxx +++ b/include/filter/msfilter/rtfutil.hxx @@ -20,14 +20,16 @@ // RTF values are often multiplied by 2^16 #define RTF_MULTIPLIER 65536 -namespace msfilter { -namespace rtfutil { - +namespace msfilter +{ +namespace rtfutil +{ /// Outputs a single character in hex form. MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen); /// Handles correct unicode and legacy export of a single character. -MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc, bool* pSuccess, bool bUnicode = true); +MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, + bool* pSuccess, bool bUnicode = true); /** * Handles correct unicode and legacy export of a string. @@ -36,7 +38,8 @@ MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding * @param eDestEnc the legacy encoding to use * @param bUnicode if unicode output is wanted as well, or just legacy */ -MSFILTER_DLLPUBLIC OString OutString(const OUString &rStr, rtl_TextEncoding eDestEnc, bool bUnicode = true); +MSFILTER_DLLPUBLIC OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc, + bool bUnicode = true); /** * Handles correct unicode and legacy export of a string, when a @@ -47,8 +50,8 @@ MSFILTER_DLLPUBLIC OString OutString(const OUString &rStr, rtl_TextEncoding eDes * @param rStr the text to export * @param eDestEnc the legacy encoding to use */ -MSFILTER_DLLPUBLIC OString OutStringUpr(const sal_Char *pToken, const OUString &rStr, rtl_TextEncoding eDestEnc); - +MSFILTER_DLLPUBLIC OString OutStringUpr(const sal_Char* pToken, const OUString& rStr, + rtl_TextEncoding eDestEnc); } } diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 96abb04a37b7..216fb6a6de22 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -4810,7 +4810,6 @@ filter/source/msfilter/msocximex.cxx filter/source/msfilter/msoleexp.cxx filter/source/msfilter/mstoolbar.cxx filter/source/msfilter/msvbahelper.cxx -filter/source/msfilter/rtfutil.cxx filter/source/msfilter/services.cxx filter/source/msfilter/svdfppt.cxx filter/source/msfilter/svxmsbas2.cxx @@ -6488,7 +6487,6 @@ include/filter/msfilter/msocximex.hxx include/filter/msfilter/msoleexp.hxx include/filter/msfilter/mstoolbar.hxx include/filter/msfilter/msvbahelper.hxx -include/filter/msfilter/rtfutil.hxx include/filter/msfilter/svdfppt.hxx include/filter/msfilter/svxmsbas.hxx include/filter/msfilter/util.hxx @@ -13674,8 +13672,6 @@ starmath/source/parse.cxx starmath/source/rect.cxx starmath/source/register.cxx starmath/source/register.hxx -starmath/source/rtfexport.cxx -starmath/source/rtfexport.hxx starmath/source/smdetect.cxx starmath/source/smdetect.hxx starmath/source/smdll.cxx @@ -15254,10 +15250,6 @@ sw/qa/extras/ooxmlexport/ooxmlexport9.cxx sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx sw/qa/extras/ooxmlexport/ooxmlw14export.cxx sw/qa/extras/ooxmlimport/ooxmlimport.cxx -sw/qa/extras/rtfexport/rtfexport.cxx -sw/qa/extras/rtfexport/rtfexport2.cxx -sw/qa/extras/rtfexport/rtfexport3.cxx -sw/qa/extras/rtfimport/rtfimport.cxx sw/qa/extras/tiledrendering/tiledrendering.cxx sw/qa/extras/txtexport/txtexport.cxx sw/qa/extras/uiwriter/uiwriter.cxx @@ -15937,7 +15929,6 @@ sw/source/filter/inc/rtf.hxx sw/source/filter/inc/wrt_fn.hxx sw/source/filter/inc/wrtswtbl.hxx sw/source/filter/inc/wwstyles.hxx -sw/source/filter/rtf/swparrtf.cxx sw/source/filter/writer/writer.cxx sw/source/filter/writer/wrt_fn.cxx sw/source/filter/writer/wrtswtbl.cxx @@ -15966,16 +15957,6 @@ sw/source/filter/ww8/escher.hxx sw/source/filter/ww8/fields.cxx sw/source/filter/ww8/fields.hxx sw/source/filter/ww8/needed_cast.hxx -sw/source/filter/ww8/rtfattributeoutput.cxx -sw/source/filter/ww8/rtfattributeoutput.hxx -sw/source/filter/ww8/rtfexport.cxx -sw/source/filter/ww8/rtfexport.hxx -sw/source/filter/ww8/rtfexportfilter.cxx -sw/source/filter/ww8/rtfexportfilter.hxx -sw/source/filter/ww8/rtfsdrexport.cxx -sw/source/filter/ww8/rtfsdrexport.hxx -sw/source/filter/ww8/rtfstringbuffer.cxx -sw/source/filter/ww8/rtfstringbuffer.hxx sw/source/filter/ww8/sortedarray.hxx sw/source/filter/ww8/sprmids.hxx sw/source/filter/ww8/styles.cxx @@ -18787,9 +18768,7 @@ writerfilter/inc/ooxml/OOXMLDocument.hxx writerfilter/inc/ooxml/QNameToString.hxx writerfilter/inc/pch/precompiled_writerfilter.cxx writerfilter/inc/pch/precompiled_writerfilter.hxx -writerfilter/inc/rtftok/RTFDocument.hxx writerfilter/qa/cppunittests/misc/misc.cxx -writerfilter/qa/cppunittests/rtftok/testrtftok.cxx writerfilter/source/dmapper/BorderHandler.cxx writerfilter/source/dmapper/BorderHandler.hxx writerfilter/source/dmapper/CellColorHandler.cxx @@ -18893,35 +18872,6 @@ writerfilter/source/ooxml/OOXMLPropertySet.hxx writerfilter/source/ooxml/OOXMLStreamImpl.cxx writerfilter/source/ooxml/OOXMLStreamImpl.hxx writerfilter/source/ooxml/qnametostrcore.cxx -writerfilter/source/rtftok/rtfcharsets.cxx -writerfilter/source/rtftok/rtfcharsets.hxx -writerfilter/source/rtftok/rtfcontrolwords.cxx -writerfilter/source/rtftok/rtfcontrolwords.hxx -writerfilter/source/rtftok/rtfdispatchdestination.cxx -writerfilter/source/rtftok/rtfdispatchflag.cxx -writerfilter/source/rtftok/rtfdispatchsymbol.cxx -writerfilter/source/rtftok/rtfdispatchvalue.cxx -writerfilter/source/rtftok/rtfdocumentfactory.cxx -writerfilter/source/rtftok/rtfdocumentimpl.cxx -writerfilter/source/rtftok/rtfdocumentimpl.hxx -writerfilter/source/rtftok/rtffly.hxx -writerfilter/source/rtftok/rtflistener.hxx -writerfilter/source/rtftok/rtflookahead.cxx -writerfilter/source/rtftok/rtflookahead.hxx -writerfilter/source/rtftok/rtfreferenceproperties.cxx -writerfilter/source/rtftok/rtfreferenceproperties.hxx -writerfilter/source/rtftok/rtfreferencetable.cxx -writerfilter/source/rtftok/rtfreferencetable.hxx -writerfilter/source/rtftok/rtfsdrimport.cxx -writerfilter/source/rtftok/rtfsdrimport.hxx -writerfilter/source/rtftok/rtfskipdestination.cxx -writerfilter/source/rtftok/rtfskipdestination.hxx -writerfilter/source/rtftok/rtfsprm.cxx -writerfilter/source/rtftok/rtfsprm.hxx -writerfilter/source/rtftok/rtftokenizer.cxx -writerfilter/source/rtftok/rtftokenizer.hxx -writerfilter/source/rtftok/rtfvalue.cxx -writerfilter/source/rtftok/rtfvalue.hxx writerperfect/inc/DirectoryStream.hxx writerperfect/inc/DocumentHandler.hxx writerperfect/inc/DocumentHandlerFor.hxx diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx index 1022505b89e0..0d0fb4cae6c8 100644 --- a/starmath/source/rtfexport.cxx +++ b/starmath/source/rtfexport.cxx @@ -7,7 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - #include "rtfexport.hxx" #include <svtools/rtfkeywd.hxx> @@ -51,7 +50,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/) { m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MR " "); - if (pNode->GetToken().eType == TTEXT) // literal text + if (pNode->GetToken().eType == TTEXT) // literal text m_pBuffer->append(LO_STRING_SVTOOLS_RTF_MNOR " "); auto pTemp = static_cast<const SmTextNode*>(pNode); @@ -91,65 +90,65 @@ void SmRtfExport::HandleAttribute(const SmAttributNode* pNode, int nLevel) { switch (pNode->Attribute()->GetToken().eType) { - case TCHECK: - case TACUTE: - case TGRAVE: - case TBREVE: - case TCIRCLE: - case TVEC: - case TTILDE: - case THAT: - case TDOT: - case TDDOT: - case TDDDOT: - case TWIDETILDE: - case TWIDEHAT: - case TWIDEVEC: - case TBAR: - { - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MACC " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MACCPR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); - OUString aValue(pNode->Attribute()->GetToken().cMathChar); - m_pBuffer->append(msfilter::rtfutil::OutString(aValue, m_nEncoding)); - m_pBuffer->append("}"); // mchr - m_pBuffer->append("}"); // maccPr - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->Body(), nLevel + 1); - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // macc - break; - } - case TOVERLINE: - case TUNDERLINE: - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBAR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBARPR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MPOS " "); - m_pBuffer->append((pNode->Attribute()->GetToken().eType == TUNDERLINE) ? "bot" : "top"); - m_pBuffer->append("}"); // mpos - m_pBuffer->append("}"); // mbarPr - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->Body(), nLevel + 1); - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // mbar - break; - case TOVERSTRIKE: - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBORDERBOX " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBORDERBOXPR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDETOP " 1}"); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDEBOT " 1}"); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDELEFT " 1}"); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDERIGHT " 1}"); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSTRIKEH " 1}"); - m_pBuffer->append("}"); // mborderBoxPr - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->Body(), nLevel + 1); - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // mborderBox - break; - default: - HandleAllSubNodes(pNode, nLevel); - break; + case TCHECK: + case TACUTE: + case TGRAVE: + case TBREVE: + case TCIRCLE: + case TVEC: + case TTILDE: + case THAT: + case TDOT: + case TDDOT: + case TDDDOT: + case TWIDETILDE: + case TWIDEHAT: + case TWIDEVEC: + case TBAR: + { + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MACC " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MACCPR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); + OUString aValue(pNode->Attribute()->GetToken().cMathChar); + m_pBuffer->append(msfilter::rtfutil::OutString(aValue, m_nEncoding)); + m_pBuffer->append("}"); // mchr + m_pBuffer->append("}"); // maccPr + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->Body(), nLevel + 1); + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // macc + break; + } + case TOVERLINE: + case TUNDERLINE: + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBAR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBARPR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MPOS " "); + m_pBuffer->append((pNode->Attribute()->GetToken().eType == TUNDERLINE) ? "bot" : "top"); + m_pBuffer->append("}"); // mpos + m_pBuffer->append("}"); // mbarPr + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->Body(), nLevel + 1); + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // mbar + break; + case TOVERSTRIKE: + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBORDERBOX " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBORDERBOXPR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDETOP " 1}"); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDEBOT " 1}"); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDELEFT " 1}"); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MHIDERIGHT " 1}"); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSTRIKEH " 1}"); + m_pBuffer->append("}"); // mborderBoxPr + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->Body(), nLevel + 1); + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // mborderBox + break; + default: + HandleAllSubNodes(pNode, nLevel); + break; } } @@ -195,80 +194,86 @@ void SmRtfExport::HandleOperator(const SmOperNode* pNode, int nLevel) SAL_INFO("starmath.rtf", "Operator: " << int(pNode->GetToken().eType)); switch (pNode->GetToken().eType) { - case TINT: - case TINTD: - case TIINT: - case TIIINT: - case TLINT: - case TLLINT: - case TLLLINT: - case TPROD: - case TCOPROD: - case TSUM: - { - const SmSubSupNode* subsup = pNode->GetSubNode(0)->GetType() == SmNodeType::SubSup ? static_cast<const SmSubSupNode*>(pNode->GetSubNode(0)) : nullptr; - const SmNode* operation = subsup ? subsup->GetBody() : pNode->GetSubNode(0); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARY " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARYPR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); - m_pBuffer->append(mathSymbolToString(operation, m_nEncoding)); - m_pBuffer->append("}"); // mchr - if (!subsup || !subsup->GetSubSup(CSUB)) - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUBHIDE " 1}"); - if (!subsup || !subsup->GetSubSup(CSUP)) - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUPHIDE " 1}"); - m_pBuffer->append("}"); // mnaryPr - if (!subsup || !subsup->GetSubSup(CSUB)) - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUB " }"); - else - { - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUB " "); - HandleNode(subsup->GetSubSup(CSUB), nLevel + 1); - m_pBuffer->append("}"); // msub - } - if (!subsup || !subsup->GetSubSup(CSUP)) - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUP " }"); - else + case TINT: + case TINTD: + case TIINT: + case TIIINT: + case TLINT: + case TLLINT: + case TLLLINT: + case TPROD: + case TCOPROD: + case TSUM: { - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUP " "); - HandleNode(subsup->GetSubSup(CSUP), nLevel + 1); - m_pBuffer->append("}"); // msup - } - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->GetSubNode(1), nLevel + 1); // body - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // mnary - break; - } - case TLIM: - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MFUNC " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MFNAME " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMLOW " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->GetSymbol(), nLevel + 1); - m_pBuffer->append("}"); // me - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIM " "); - if (const SmSubSupNode* subsup = pNode->GetSubNode(0)->GetType() == SmNodeType::SubSup ? static_cast<const SmSubSupNode*>(pNode->GetSubNode(0)) : nullptr) - if (subsup->GetSubSup(CSUB)) + const SmSubSupNode* subsup + = pNode->GetSubNode(0)->GetType() == SmNodeType::SubSup + ? static_cast<const SmSubSupNode*>(pNode->GetSubNode(0)) + : nullptr; + const SmNode* operation = subsup ? subsup->GetBody() : pNode->GetSubNode(0); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARY " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MNARYPR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); + m_pBuffer->append(mathSymbolToString(operation, m_nEncoding)); + m_pBuffer->append("}"); // mchr + if (!subsup || !subsup->GetSubSup(CSUB)) + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUBHIDE " 1}"); + if (!subsup || !subsup->GetSubSup(CSUP)) + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUPHIDE " 1}"); + m_pBuffer->append("}"); // mnaryPr + if (!subsup || !subsup->GetSubSup(CSUB)) + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUB " }"); + else + { + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUB " "); HandleNode(subsup->GetSubSup(CSUB), nLevel + 1); - m_pBuffer->append("}"); // mlim - m_pBuffer->append("}"); // mlimLow - m_pBuffer->append("}"); // mfName - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->GetSubNode(1), nLevel + 1); // body - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // mfunc - break; - default: - SAL_INFO("starmath.rtf", "TODO: " << OSL_THIS_FUNC << " unhandled oper type"); - break; + m_pBuffer->append("}"); // msub + } + if (!subsup || !subsup->GetSubSup(CSUP)) + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUP " }"); + else + { + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSUP " "); + HandleNode(subsup->GetSubSup(CSUP), nLevel + 1); + m_pBuffer->append("}"); // msup + } + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->GetSubNode(1), nLevel + 1); // body + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // mnary + break; + } + case TLIM: + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MFUNC " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MFNAME " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMLOW " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->GetSymbol(), nLevel + 1); + m_pBuffer->append("}"); // me + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIM " "); + if (const SmSubSupNode* subsup + = pNode->GetSubNode(0)->GetType() == SmNodeType::SubSup + ? static_cast<const SmSubSupNode*>(pNode->GetSubNode(0)) + : nullptr) + if (subsup->GetSubSup(CSUB)) + HandleNode(subsup->GetSubSup(CSUB), nLevel + 1); + m_pBuffer->append("}"); // mlim + m_pBuffer->append("}"); // mlimLow + m_pBuffer->append("}"); // mfName + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->GetSubNode(1), nLevel + 1); // body + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // mfunc + break; + default: + SAL_INFO("starmath.rtf", "TODO: " << OSL_THIS_FUNC << " unhandled oper type"); + break; } } void SmRtfExport::HandleSubSupScriptInternal(const SmSubSupNode* pNode, int nLevel, int flags) { -// rtf supports only a certain combination of sub/super scripts, but LO can have any, -// so try to merge it using several tags if necessary + // rtf supports only a certain combination of sub/super scripts, but LO can have any, + // so try to merge it using several tags if necessary if (flags == 0) // none return; if ((flags & (1 << RSUP | 1 << RSUB)) == (1 << RSUP | 1 << RSUB)) @@ -402,7 +407,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MBEGCHR " "); m_pBuffer->append(mathSymbolToString(pNode->OpeningBrace(), m_nEncoding)); m_pBuffer->append("}"); // mbegChr - std::vector< const SmNode* > subnodes; + std::vector<const SmNode*> subnodes; if (pNode->Body()->GetType() == SmNodeType::Bracebody) { auto body = static_cast<const SmBracebodyNode*>(pNode->Body()); @@ -410,7 +415,8 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) for (int i = 0; i < body->GetNumSubNodes(); ++i) { const SmNode* subnode = body->GetSubNode(i); - if (subnode->GetType() == SmNodeType::Math || subnode->GetType() == SmNodeType::MathIdent) + if (subnode->GetType() == SmNodeType::Math + || subnode->GetType() == SmNodeType::MathIdent) { // do not write, but write what separator it is auto math = static_cast<const SmMathSymbolNode*>(subnode); @@ -446,38 +452,42 @@ void SmRtfExport::HandleVerticalBrace(const SmVerticalBraceNode* pNode, int nLev SAL_INFO("starmath.rtf", "Vertical: " << int(pNode->GetToken().eType)); switch (pNode->GetToken().eType) { - case TOVERBRACE: - case TUNDERBRACE: - { - bool top = (pNode->GetToken().eType == TOVERBRACE); - if (top) - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMUPP " "); - else - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMLOW " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHRPR " "); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); - m_pBuffer->append(mathSymbolToString(pNode->Brace(), m_nEncoding)); - m_pBuffer->append("}"); // mchr - // TODO not sure if pos and vertJc are correct - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MPOS " ").append(top ? "top" : "bot").append("}"); - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MVERTJC " ").append(top ? "bot" : "top").append("}"); - m_pBuffer->append("}"); // mgroupChrPr - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(pNode->Body(), nLevel + 1); - m_pBuffer->append("}"); // me - m_pBuffer->append("}"); // mgroupChr - m_pBuffer->append("}"); // me - m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIM " "); - HandleNode(pNode->Script(), nLevel + 1); - m_pBuffer->append("}"); // mlim - m_pBuffer->append("}"); // mlimUpp or mlimLow - break; - } - default: - SAL_INFO("starmath.rtf", "TODO: " << OSL_THIS_FUNC << " unhandled vertical brace type"); - break; + case TOVERBRACE: + case TUNDERBRACE: + { + bool top = (pNode->GetToken().eType == TOVERBRACE); + if (top) + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMUPP " "); + else + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIMLOW " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MGROUPCHRPR " "); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MCHR " "); + m_pBuffer->append(mathSymbolToString(pNode->Brace(), m_nEncoding)); + m_pBuffer->append("}"); // mchr + // TODO not sure if pos and vertJc are correct + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MPOS " ") + .append(top ? "top" : "bot") + .append("}"); + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MVERTJC " ") + .append(top ? "bot" : "top") + .append("}"); + m_pBuffer->append("}"); // mgroupChrPr + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); + HandleNode(pNode->Body(), nLevel + 1); + m_pBuffer->append("}"); // me + m_pBuffer->append("}"); // mgroupChr + m_pBuffer->append("}"); // me + m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MLIM " "); + HandleNode(pNode->Script(), nLevel + 1); + m_pBuffer->append("}"); // mlim + m_pBuffer->append("}"); // mlimUpp or mlimLow + break; + } + default: + SAL_INFO("starmath.rtf", "TODO: " << OSL_THIS_FUNC << " unhandled vertical brace type"); + break; } } diff --git a/starmath/source/rtfexport.hxx b/starmath/source/rtfexport.hxx index d45fcb49cfdc..3a1dd4feb995 100644 --- a/starmath/source/rtfexport.hxx +++ b/starmath/source/rtfexport.hxx @@ -22,6 +22,7 @@ class SmRtfExport : public SmWordExportBase public: explicit SmRtfExport(const SmNode* pIn); void ConvertFromStarMath(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding); + private: void HandleVerticalStack(const SmNode* pNode, int nLevel) override; void HandleText(const SmNode* pNode, int nLevel) override; @@ -39,7 +40,6 @@ private: rtl_TextEncoding m_nEncoding; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index ff6d400a41d6..576bfea43398 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -35,26 +35,24 @@ class Test : public SwModelTestBase { public: - Test() : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") {} + Test() + : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") + { + } bool mustTestImportOf(const char* filename) const override { // Don't test the first import of these, for some reason those tests fail - const char* aBlacklist[] = - { - "math-eqarray.rtf", - "math-escaping.rtf", - "math-lim.rtf", - "math-mso2007.rtf", - "math-nary.rtf", - "math-rad.rtf", - "math-vertical-stacks.rtf", - "math-runs.rtf", + const char* aBlacklist[] = { + "math-eqarray.rtf", "math-escaping.rtf", "math-lim.rtf", + "math-mso2007.rtf", "math-nary.rtf", "math-rad.rtf", + "math-vertical-stacks.rtf", "math-runs.rtf", }; std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist)); // If the testcase is stored in some other format, it's pointless to test. - return (OString(filename).endsWith(".rtf") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end()); + return (OString(filename).endsWith(".rtf") + && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end()); } bool CjkNumberedListTestHelper(sal_Int16& rValue) @@ -65,12 +63,13 @@ public: properties->getPropertyValue("NumberingIsNumber") >>= isNumber; if (!isNumber) return false; - uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - uno::Sequence< beans::PropertyValue > aPropertyValue; + uno::Reference<container::XIndexAccess> xLevels( + properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aPropertyValue; xLevels->getByIndex(0) >>= aPropertyValue; for (int j = 0; j < aPropertyValue.getLength(); ++j) { - beans::PropertyValue aProp= aPropertyValue[j]; + beans::PropertyValue aProp = aPropertyValue[j]; if (aProp.Name == "NumberingType") { rValue = aProp.Value.get<sal_Int16>(); @@ -78,7 +77,6 @@ public: } } return false; - } virtual void postLoad(const char* pFilename) override @@ -95,22 +93,22 @@ public: DECLARE_RTFEXPORT_TEST(testZoom, "zoom.rtf") { uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); - uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings()); sal_Int16 nValue = 0; xPropertySet->getPropertyValue("ZoomValue") >>= nValue; CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue); } -DECLARE_RTFEXPORT_TEST(testFdo38176, "fdo38176.rtf") -{ - CPPUNIT_ASSERT_EQUAL(9, getLength()); -} +DECLARE_RTFEXPORT_TEST(testFdo38176, "fdo38176.rtf") { CPPUNIT_ASSERT_EQUAL(9, getLength()); } DECLARE_RTFEXPORT_TEST(testFdo49683, "fdo49683.rtf") { - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties()); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties( + xDocumentPropertiesSupplier->getDocumentProperties()); uno::Sequence<OUString> aKeywords(xDocumentProperties->getKeywords()); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aKeywords.getLength()); CPPUNIT_ASSERT_EQUAL(OUString("one"), aKeywords[0]); @@ -120,8 +118,10 @@ DECLARE_RTFEXPORT_TEST(testFdo49683, "fdo49683.rtf") DECLARE_RTFEXPORT_TEST(testFdo44174, "fdo44174.rtf") { uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPropertySet(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); OUString aValue; xPropertySet->getPropertyValue("PageStyleName") >>= aValue; CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue); @@ -129,17 +129,21 @@ DECLARE_RTFEXPORT_TEST(testFdo44174, "fdo44174.rtf") DECLARE_RTFEXPORT_TEST(testFdo50087, "fdo50087.rtf") { - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties()); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties( + xDocumentPropertiesSupplier->getDocumentProperties()); CPPUNIT_ASSERT_EQUAL(OUString("Title"), xDocumentProperties->getTitle()); CPPUNIT_ASSERT_EQUAL(OUString("Subject"), xDocumentProperties->getSubject()); - CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), xDocumentProperties->getDescription()); + CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), + xDocumentProperties->getDescription()); } DECLARE_RTFEXPORT_TEST(testFdo50831, "fdo50831.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY); float fValue = 0; @@ -161,11 +165,13 @@ DECLARE_RTFEXPORT_TEST(testFdo48335, "fdo48335.odt") * xray oRun.TextPortionType 'was Text, should be SoftPageBreak */ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); for (int i = 0; i < 2; i++) xParaEnum->nextElement(); - uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); OUString aValue; @@ -178,20 +184,25 @@ DECLARE_RTFEXPORT_TEST(testFdo38244, "fdo38244.rtf") // See ooxmlexport's testFdo38244(). // Test comment range feature. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); - uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); xRunEnum->nextElement(); uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), + getProperty<OUString>(xPropertySet, "TextPortionType")); xRunEnum->nextElement(); xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), + getProperty<OUString>(xPropertySet, "TextPortionType")); // Test initials. uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials")); @@ -199,31 +210,41 @@ DECLARE_RTFEXPORT_TEST(testFdo38244, "fdo38244.rtf") DECLARE_RTFEXPORT_TEST(testCommentsNested, "comments-nested.odt") { - uno::Reference<beans::XPropertySet> xOuter(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xOuter( + getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 2), "TextField"), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content").trim()); - uno::Reference<beans::XPropertySet> xInner(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xInner( + getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 4), "TextField"), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content").trim()); } DECLARE_RTFEXPORT_TEST(testMathAccents, "math-accents.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde {a} underline {a}"); + OUString const aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} " + "widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde " + "{a} underline {a}"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } DECLARE_RTFEXPORT_TEST(testMathEqarray, "math-eqarray.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("y = left lbrace stack { 0, x < 0 # 1, x = 0 # {x} ^ {2} , x > 0 } right none"); + OUString const aExpected( + "y = left lbrace stack { 0, x < 0 # 1, x = 0 # {x} ^ {2} , x > 0 } right none"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } DECLARE_RTFEXPORT_TEST(testMathD, "math-d.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 right rdline left langle 6 right rangle left langle a mline b right rangle left ({x} over {y} right )"); + OUString const aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left " + "ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 " + "right rdline left langle 6 right rangle left langle a mline b right " + "rangle left ({x} over {y} right )"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } @@ -262,15 +283,19 @@ DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(2), 1)); - aExpected = OUString(u"{left (x + a right )} ^ {n} = sum from {k = 0} to {n} {left (stack { n # k } right ) {x} ^ {k} {a} ^ {n \u2212 k}}"); + aExpected = OUString(u"{left (x + a right )} ^ {n} = sum from {k = 0} to {n} {left (stack { n " + u"# k } right ) {x} ^ {k} {a} ^ {n \u2212 k}}"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(3), 1)); - aExpected = OUString(u"{left (1 + x right )} ^ {n} = 1 + {nx} over {1 !} + {n left (n \u2212 1 right ) {x} ^ {2}} over {2 !} + \u2026"); + aExpected = OUString(u"{left (1 + x right )} ^ {n} = 1 + {nx} over {1 !} + {n left (n \u2212 1 " + u"right ) {x} ^ {2}} over {2 !} + \u2026"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(4), 1)); - aExpected = OUString(u"f left (x right ) = {a} rsub {0} + sum from {n = 1} to {\u221E} {left ({a} rsub {n} cos {n\u03C0x} over {L} + {b} rsub {n} sin {n\u03C0x} over {L} right )}"); + aExpected = OUString(u"f left (x right ) = {a} rsub {0} + sum from {n = 1} to {\u221E} {left " + u"({a} rsub {n} cos {n\u03C0x} over {L} + {b} rsub {n} sin {n\u03C0x} " + u"over {L} right )}"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(5), 1)); @@ -282,15 +307,18 @@ DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(7), 1)); - aExpected = OUString(u"{e} ^ {x} = 1 + {x} over {1 !} + {{x} ^ {2}} over {2 !} + {{x} ^ {3}} over {3 !} + \u2026 , \u2212 \u221E < x < \u221E"); + aExpected = OUString(u"{e} ^ {x} = 1 + {x} over {1 !} + {{x} ^ {2}} over {2 !} + {{x} ^ {3}} " + u"over {3 !} + \u2026 , \u2212 \u221E < x < \u221E"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(8), 1)); - aExpected = OUString(u"sin \u03B1 \u00B1 sin \u03B2 = 2 sin {1} over {2} left (\u03B1 \u00B1 \u03B2 right ) cos {1} over {2} left (\u03B1 \u2213 \u03B2 right )"); + aExpected = OUString(u"sin \u03B1 \u00B1 sin \u03B2 = 2 sin {1} over {2} left (\u03B1 \u00B1 " + u"\u03B2 right ) cos {1} over {2} left (\u03B1 \u2213 \u03B2 right )"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(9), 1)); - aExpected = OUString(u"cos \u03B1 + cos \u03B2 = 2 cos {1} over {2} left (\u03B1 + \u03B2 right ) cos {1} over {2} left (\u03B1 \u2212 \u03B2 right )"); + aExpected = OUString(u"cos \u03B1 + cos \u03B2 = 2 cos {1} over {2} left (\u03B1 + \u03B2 " + u"right ) cos {1} over {2} left (\u03B1 \u2212 \u03B2 right )"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } @@ -337,7 +365,9 @@ DECLARE_RTFEXPORT_TEST(testMathSepchr, "math-sepchr.rtf") DECLARE_RTFEXPORT_TEST(testMathSubscripts, "math-subscripts.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} {x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub {2} rsup {1}"); + OUString const aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} " + "{x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub " + "{2} rsup {1}"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } @@ -346,36 +376,45 @@ DECLARE_RTFEXPORT_TEST(testMathVerticalstacks, "math-vertical-stacks.rtf") CPPUNIT_ASSERT_EQUAL(OUString("{a} over {b}"), getFormula(getRun(getParagraph(1), 1))); CPPUNIT_ASSERT_EQUAL(OUString("{a} / {b}"), getFormula(getRun(getParagraph(2), 1))); CPPUNIT_ASSERT_EQUAL(OUString("stack { a # b }"), getFormula(getRun(getParagraph(3), 1))); - CPPUNIT_ASSERT_EQUAL(OUString("stack { a # stack { b # c } }"), getFormula(getRun(getParagraph(4), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("stack { a # stack { b # c } }"), + getFormula(getRun(getParagraph(4), 1))); } DECLARE_RTFEXPORT_TEST(testTdf49073, "tdf49073.rtf") { // test case for Asisan phontic guide ( ruby text.) - sal_Unicode aRuby[3] = {0x304D,0x3082,0x3093}; + sal_Unicode aRuby[3] = { 0x304D, 0x3082, 0x3093 }; OUString sRuby = OUString(aRuby, SAL_N_ELEMENTS(aRuby)); - CPPUNIT_ASSERT_EQUAL(sRuby,getProperty<OUString>(getParagraph(1)->getStart(), "RubyText")); + CPPUNIT_ASSERT_EQUAL(sRuby, getProperty<OUString>(getParagraph(1)->getStart(), "RubyText")); OUString sStyle = getProperty<OUString>(getParagraph(1)->getStart(), "RubyCharStyleName"); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("CharacterStyles")->getByName(sStyle), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("CharacterStyles")->getByName(sStyle), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(5.f, getProperty<float>(xPropertySet, "CharHeight")); - CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_CENTER), getProperty<sal_Int16>(getParagraph(2)->getStart(),"RubyAdjust")); - CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_BLOCK), getProperty<sal_Int16>(getParagraph(3)->getStart(),"RubyAdjust")); - CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_INDENT_BLOCK), getProperty<sal_Int16>(getParagraph(4)->getStart(),"RubyAdjust")); - CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_LEFT), getProperty<sal_Int16>(getParagraph(5)->getStart(),"RubyAdjust")); - CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(6)->getStart(),"RubyAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_CENTER), + getProperty<sal_Int16>(getParagraph(2)->getStart(), "RubyAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_BLOCK), + getProperty<sal_Int16>(getParagraph(3)->getStart(), "RubyAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_INDENT_BLOCK), + getProperty<sal_Int16>(getParagraph(4)->getStart(), "RubyAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_LEFT), + getProperty<sal_Int16>(getParagraph(5)->getStart(), "RubyAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RubyAdjust_RIGHT), + getProperty<sal_Int16>(getParagraph(6)->getStart(), "RubyAdjust")); } DECLARE_RTFEXPORT_TEST(testMathRuns, "math-runs.rtf") { // was [](){}, i.e. first curly bracket had an incorrect position - CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), + getFormula(getRun(getParagraph(1), 1))); } DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt") { // font name is encoded with \fcharset of font OUString aExpected(u"\u5FAE\u8F6F\u96C5\u9ED1"); - CPPUNIT_ASSERT_EQUAL(aExpected, getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(aExpected, + getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); } DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt") @@ -390,7 +429,8 @@ DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt") * xray oCoordinates(1).Second.Value ' 102 */ - uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry"); + uno::Sequence<beans::PropertyValue> aProps + = getProperty<uno::Sequence<beans::PropertyValue>>(getShape(1), "CustomShapeGeometry"); uno::Sequence<beans::PropertyValue> aPathProps; for (int i = 0; i < aProps.getLength(); ++i) { @@ -417,16 +457,21 @@ DECLARE_RTFEXPORT_TEST(testFdo55939, "fdo55939.odt") uno::Reference<text::XTextRange> xParagraph(getParagraph(1)); getRun(xParagraph, 1, "Main text before footnote."); // Why the tab has to be removed here? - CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."), - getProperty< uno::Reference<text::XTextRange> >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", "")); - getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. + CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."), getProperty<uno::Reference<text::XTextRange>>( + getRun(xParagraph, 2), "Footnote") + ->getText() + ->getString() + .replaceAll("\t", "")); + getRun(xParagraph, 3, + " Text after the footnote."); // However, this leading space is intentional and OK. } DECLARE_RTFEXPORT_TEST(testTextFrames, "textframes.odt") { // The output was simply invalid, so let's check if all 3 frames were imported back. uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } @@ -434,15 +479,18 @@ DECLARE_RTFEXPORT_TEST(testFdo53604, "fdo53604.odt") { // Invalid output on empty footnote. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); } DECLARE_RTFEXPORT_TEST(testFdo52286, "fdo52286.odt") { // The problem was that font size wasn't reduced in sub/super script. - CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapementHeight")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(2), 2), "CharEscapementHeight")); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(1), 2), "CharEscapementHeight")); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(58), getProperty<sal_Int32>(getRun(getParagraph(2), 2), "CharEscapementHeight")); } DECLARE_RTFEXPORT_TEST(testFdo61507, "fdo61507.rtf") @@ -453,8 +501,10 @@ DECLARE_RTFEXPORT_TEST(testFdo61507, "fdo61507.rtf") * importer didn't cope with these new keywords. */ - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties()); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties( + xDocumentPropertiesSupplier->getDocumentProperties()); OUString aExpected = OUString(u"\u00C9\u00C1\u0150\u0170\u222D"); CPPUNIT_ASSERT_EQUAL(aExpected, xDocumentProperties->getTitle()); @@ -466,8 +516,10 @@ DECLARE_RTFEXPORT_TEST(testFdo30983, "fdo30983.rtf") { // These were 'page text area', not 'entire page', i.e. both the horizontal // and vertical positions were incorrect. - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "VertOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(getShape(1), "VertOrientRelation")); } DECLARE_RTFEXPORT_TEST(testPlaceholder, "placeholder.odt") @@ -475,7 +527,8 @@ DECLARE_RTFEXPORT_TEST(testPlaceholder, "placeholder.odt") // Only the field text was exported, make sure we still have a field with the correct Hint text. uno::Reference<text::XTextRange> xRun(getRun(getParagraph(1), 2)); CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(xRun, "TextPortionType")); - uno::Reference<beans::XPropertySet> xField = getProperty< uno::Reference<beans::XPropertySet> >(xRun, "TextField"); + uno::Reference<beans::XPropertySet> xField + = getProperty<uno::Reference<beans::XPropertySet>>(xRun, "TextField"); CPPUNIT_ASSERT_EQUAL(OUString("place holder"), getProperty<OUString>(xField, "Hint")); } @@ -483,15 +536,18 @@ DECLARE_RTFEXPORT_TEST(testMnor, "mnor.rtf") { // \mnor wasn't handled, leading to missing quotes around "divF" and so on. OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString aExpected(u"iiint from {V} to <?> {\"divF\"} dV = llint from {S} to <?> {\"F\" \u2219 \"n\" dS}"); + OUString aExpected( + u"iiint from {V} to <?> {\"divF\"} dV = llint from {S} to <?> {\"F\" \u2219 \"n\" dS}"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } DECLARE_RTFEXPORT_TEST(testI120928, "i120928.rtf") { // \listpicture and \levelpicture0 was ignored, leading to missing graphic bullet in numbering. - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -511,15 +567,20 @@ DECLARE_RTFEXPORT_TEST(testI120928, "i120928.rtf") DECLARE_RTFEXPORT_TEST(testBookmark, "bookmark.rtf") { uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextContent> xBookmark(xBookmarksSupplier->getBookmarks()->getByName("firstword"), uno::UNO_QUERY); + uno::Reference<text::XTextContent> xBookmark( + xBookmarksSupplier->getBookmarks()->getByName("firstword"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xBookmark->getAnchor()->getString()); } DECLARE_RTFEXPORT_TEST(testHyperlink, "hyperlink.rtf") { - CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getRun(getParagraph(1), 1, "Hello"), "HyperLinkURL")); - CPPUNIT_ASSERT_EQUAL(OUString("http://en.wikipedia.org/wiki/World"), getProperty<OUString>(getRun(getParagraph(1), 2, "world"), "HyperLinkURL")); - CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getRun(getParagraph(1), 3, "!"), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL( + OUString(), getProperty<OUString>(getRun(getParagraph(1), 1, "Hello"), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL( + OUString("http://en.wikipedia.org/wiki/World"), + getProperty<OUString>(getRun(getParagraph(1), 2, "world"), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL(OUString(), + getProperty<OUString>(getRun(getParagraph(1), 3, "!"), "HyperLinkURL")); } DECLARE_RTFEXPORT_TEST(testHyperlinkTdf100105, "hyperlink_empty.rtf") @@ -528,15 +589,18 @@ DECLARE_RTFEXPORT_TEST(testHyperlinkTdf100105, "hyperlink_empty.rtf") uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextCursor> xCursor(xTextDoc->getText()->createTextCursor()); xCursor->gotoStart(false); - CPPUNIT_ASSERT_EQUAL(OUString("http://example.net"), getProperty<OUString>(xCursor, "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL(OUString("http://example.net"), + getProperty<OUString>(xCursor, "HyperLinkURL")); // getRun doesn't provide a 0-length hyperlink - CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getRun(getParagraph(1), 1, "foobar"), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL( + OUString(), getProperty<OUString>(getRun(getParagraph(1), 1, "foobar"), "HyperLinkURL")); } DECLARE_RTFEXPORT_TEST(test78758, "fdo78758.rtf") { - CPPUNIT_ASSERT_EQUAL(OUString("#__RefHeading___Toc264438068"), - getProperty<OUString>(getRun(getParagraph(2), 1, "EE5E EeEEE5EE"), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL( + OUString("#__RefHeading___Toc264438068"), + getProperty<OUString>(getRun(getParagraph(2), 1, "EE5E EeEEE5EE"), "HyperLinkURL")); CPPUNIT_ASSERT_EQUAL(OUString("#__RefHeading___Toc264438068"), getProperty<OUString>(getRun(getParagraph(2), 2, "e"), "HyperLinkURL")); CPPUNIT_ASSERT_EQUAL(OUString("#__RefHeading___Toc264438068"), @@ -546,7 +610,8 @@ DECLARE_RTFEXPORT_TEST(test78758, "fdo78758.rtf") DECLARE_RTFEXPORT_TEST(testTextFrameBorders, "textframe-borders.rtf") { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty<sal_Int32>(xFrame, "BackColor")); @@ -563,18 +628,21 @@ DECLARE_RTFEXPORT_TEST(testTextFrameBorders, "textframe-borders.rtf") DECLARE_RTFEXPORT_TEST(testTextframeGradient, "textframe-gradient.rtf") { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, + getProperty<drawing::FillStyle>(xFrame, "FillStyle")); awt::Gradient aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient"); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aGradient.StartColor); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), aGradient.EndColor); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style); xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, + getProperty<drawing::FillStyle>(xFrame, "FillStyle")); aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient"); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aGradient.StartColor); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x666666), aGradient.EndColor); @@ -593,15 +661,21 @@ DECLARE_RTFEXPORT_TEST(testTextframeTable, "textframe-table.rtf") uno::Reference<text::XText> xText = xTextRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("First para."), getParagraphOfText(1, xText)->getString()); uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2, xText), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("A"), uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString()); - CPPUNIT_ASSERT_EQUAL(OUString("B"), uno::Reference<text::XTextRange>(xTable->getCellByName("B1"), uno::UNO_QUERY)->getString()); + CPPUNIT_ASSERT_EQUAL( + OUString("A"), + uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString()); + CPPUNIT_ASSERT_EQUAL( + OUString("B"), + uno::Reference<text::XTextRange>(xTable->getCellByName("B1"), uno::UNO_QUERY)->getString()); CPPUNIT_ASSERT_EQUAL(OUString("Last para."), getParagraphOfText(3, xText)->getString()); } DECLARE_RTFEXPORT_TEST(testFdo66682, "fdo66682.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -620,7 +694,8 @@ DECLARE_RTFEXPORT_TEST(testFdo66682, "fdo66682.rtf") DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") { // The problem was that \brdrsh was ignored. - table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat"); + table::ShadowFormat aShadow + = getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat"); CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(60)), aShadow.ShadowWidth); @@ -628,26 +703,30 @@ DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt") { - uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); // RTF has just one border attribute (chbrdr) for text border so all side has // the same border with the same padding // Border { - const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder"); - CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder); - CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder")); + const table::BorderLine2 aTopBorder + = getProperty<table::BorderLine2>(xRun, "CharTopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600, 0, 318, 0, 0, 318), aTopBorder); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, + getProperty<table::BorderLine2>(xRun, "CharLeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, + getProperty<table::BorderLine2>(xRun, "CharBottomBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, + getProperty<table::BorderLine2>(xRun, "CharRightBorder")); } // Padding (brsp) { - const sal_Int32 nTopPadding = getProperty<sal_Int32>(xRun,"CharTopBorderDistance"); + const sal_Int32 nTopPadding = getProperty<sal_Int32>(xRun, "CharTopBorderDistance"); // In the original ODT file the padding is 150, but the unit conversion round it down. CPPUNIT_ASSERT_EQUAL(sal_Int32(141), nTopPadding); - CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharLeftBorderDistance")); - CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharBottomBorderDistance")); - CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharRightBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun, "CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun, "CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun, "CharRightBorderDistance")); } // Shadow (brdrsh) @@ -657,7 +736,8 @@ DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt") location: any -> bottom-right width: any -> border width */ { - const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat"); + const table::ShadowFormat aShadow + = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat"); CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth); @@ -674,38 +754,46 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf") DECLARE_RTFEXPORT_TEST(testFdo68787, "fdo68787.rtf") { - uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); // This was 0, the 'lack of \chftnsep' <-> '0 line width' mapping was missing in the RTF tokenizer / exporter. - CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(25), + getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth")); } DECLARE_RTFEXPORT_TEST(testFdo74709, "fdo74709.rtf") { uno::Reference<table::XCell> xCell = getCell(getParagraphOrTable(1), "B1"); // This was 0, as top/bottom/left/right padding wasn't imported. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(360)), getProperty<sal_Int32>(xCell, "RightBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(360)), + getProperty<sal_Int32>(xCell, "RightBorderDistance")); } DECLARE_RTFEXPORT_TEST(testTdf84832, "tdf84832.docx") { uno::Reference<table::XCell> xCell = getCell(getParagraphOrTable(2), "A1"); // This was 0, as left padding wasn't exported. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(113)), getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(113)), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); } DECLARE_RTFEXPORT_TEST(testRelsize, "relsize.rtf") { uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(sal_Int16(40), getProperty<sal_Int16>(xShape, "RelativeWidth")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(xShape, "RelativeWidthRelation")); CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(xShape, "RelativeHeight")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, + getProperty<sal_Int16>(xShape, "RelativeHeightRelation")); } DECLARE_RTFEXPORT_TEST(testLineNumbering, "linenumbering.rtf") { - uno::Reference<text::XLineNumberingProperties> xLineNumberingProperties(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySet> xPropertySet = xLineNumberingProperties->getLineNumberingProperties(); + uno::Reference<text::XLineNumberingProperties> xLineNumberingProperties(mxComponent, + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet + = xLineNumberingProperties->getLineNumberingProperties(); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPropertySet, "IsOn")); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), getProperty<sal_Int32>(xPropertySet, "Interval")); } @@ -713,7 +801,8 @@ DECLARE_RTFEXPORT_TEST(testLineNumbering, "linenumbering.rtf") DECLARE_RTFEXPORT_TEST(testFdo77600, "fdo77600.rtf") { // This was 'Liberation Serif'. - CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 3), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Arial"), + getProperty<OUString>(getRun(getParagraph(1), 3), "CharFontName")); } DECLARE_RTFEXPORT_TEST(testFdo80167, "fdo80167.rtf") @@ -725,13 +814,15 @@ DECLARE_RTFEXPORT_TEST(testFdo80167, "fdo80167.rtf") DECLARE_RTFEXPORT_TEST(testFdo32613, "fdo32613.odt") { // This was AS_CHARACTER, RTF export did not support writing anchored pictures. - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } DECLARE_RTFEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf") { // The problem was that the wrap polygon was ignored during import. - drawing::PointSequenceSequence aSeqSeq = getProperty<drawing::PointSequenceSequence>(getShape(1), "ContourPolyPolygon"); + drawing::PointSequenceSequence aSeqSeq + = getProperty<drawing::PointSequenceSequence>(getShape(1), "ContourPolyPolygon"); // This was 0: the polygon list was empty. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength()); @@ -739,20 +830,24 @@ DECLARE_RTFEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength()); // The shape also didn't have negative top / left coordinates. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)), getProperty<sal_Int32>(getShape(1), "HoriOrientPosition")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)), getProperty<sal_Int32>(getShape(1), "VertOrientPosition")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)), + getProperty<sal_Int32>(getShape(1), "HoriOrientPosition")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)), + getProperty<sal_Int32>(getShape(1), "VertOrientPosition")); } DECLARE_RTFEXPORT_TEST(testTdf113408, "tdf113408.rtf") { // This was 0, left margin was not inherited from style properly. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), + getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt") { // Make sure we don't just crash on export, and additionally the shape should not be inline (as it's at-page anchored originally). - CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER != getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER + != getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt") @@ -763,18 +858,24 @@ DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt") DECLARE_RTFEXPORT_TEST(testEm, "em.rtf") { // Test all possible \acc* control words. - CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis")); - CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis")); - CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE, + getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE, + getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE, + getProperty<sal_Int16>(getRun(getParagraph(1), 3), "CharEmphasis")); // This was missing. - CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE, + getProperty<sal_Int16>(getRun(getParagraph(1), 4), "CharEmphasis")); // This one, too. - CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis")); + CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW, + getProperty<sal_Int16>(getRun(getParagraph(1), 5), "CharEmphasis")); } DECLARE_RTFEXPORT_TEST(testNumberingFont, "numbering-font.rtf") { - uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle( + getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY); // This was Liberation Serif, i.e. custom font of the numbering itself ("1.\t") was lost on import. CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(xStyle, "CharFontName")); } @@ -792,82 +893,83 @@ DECLARE_RTFEXPORT_TEST(testFdo82860, "fdo82860.odt") DECLARE_RTFEXPORT_TEST(testFdo82858, "fdo82858.docx") { // This was table::BorderLineStyle::SOLID, exporter failed to write explicit no line when line color was written. - CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::NONE, getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineStyle); + CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::NONE, + getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineStyle); } DECLARE_RTFEXPORT_TEST(testCjklist12, "cjklist12.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::AIU_HALFWIDTH_JA, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist13, "cjklist13.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::IROHA_HALFWIDTH_JA, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist16, "cjklist16.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_TRADITIONAL_JA, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist20, "cjklist20.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::AIU_FULLWIDTH_JA, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist21, "cjklist21.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::IROHA_FULLWIDTH_JA, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist24, "cjklist24.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::HANGUL_SYLLABLE_KO, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist25, "cjklist25.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::HANGUL_JAMO_KO, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist30, "cjklist30.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist31, "cjklist31.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist34, "cjklist34.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); } DECLARE_RTFEXPORT_TEST(testCjklist38, "cjklist38.rtf") { - sal_Int16 numFormat; + sal_Int16 numFormat; CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH, numFormat); } @@ -886,7 +988,8 @@ DECLARE_RTFEXPORT_TEST(testTdf104936, "tdf104936.rtf") DECLARE_RTFEXPORT_TEST(testTableRtl, "table-rtl.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // This was text::WritingMode2::LR_TB, i.e. direction of the table was ignored. CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode")); @@ -895,45 +998,61 @@ DECLARE_RTFEXPORT_TEST(testTableRtl, "table-rtl.rtf") DECLARE_RTFEXPORT_TEST(testNumOverrideStart, "num-override-start.rtf") { // The numbering on the second level was "3.1", not "1.3". - uno::Reference<container::XIndexAccess> xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); - CPPUNIT_ASSERT_EQUAL(sal_Int16(1), comphelper::SequenceAsHashMap(xRules->getByIndex(0))["StartWith"].get<sal_Int16>()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(3), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>()); + uno::Reference<container::XIndexAccess> xRules + = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); + CPPUNIT_ASSERT_EQUAL( + sal_Int16(1), + comphelper::SequenceAsHashMap(xRules->getByIndex(0))["StartWith"].get<sal_Int16>()); + CPPUNIT_ASSERT_EQUAL( + sal_Int16(3), + comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>()); } DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf") { // These were 176 (100 twips), as \sbauto and \sbbefore were ignored. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), + getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), + getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); } DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf") { // These were 494 (280 twips), as \htmautsp was ignored. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), + getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), + getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); } DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt") { // This was FillStyle_NONE, as background color was missing from the color table during export. - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), getProperty<sal_Int32>(getParagraph(1), "FillColor")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, + getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), + getProperty<sal_Int32>(getParagraph(1), "FillColor")); } DECLARE_RTFEXPORT_TEST(testMargmirror, "margmirror.rtf") { // \margmirror was not handled, this was PageStyleLayout_ALL. - uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_MIRRORED, getProperty<style::PageStyleLayout>(xPageStyle, "PageStyleLayout")); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_MIRRORED, + getProperty<style::PageStyleLayout>(xPageStyle, "PageStyleLayout")); } DECLARE_RTFEXPORT_TEST(testSautoupd, "sautoupd.rtf") { // \sautoupd was ignored during import and export. - uno::Reference<beans::XPropertySet> xHeading1(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xHeading1( + getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xHeading1, "IsAutoUpdate")); - uno::Reference<beans::XPropertySet> xHeading2(getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xHeading2( + getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xHeading2, "IsAutoUpdate")); } @@ -950,19 +1069,25 @@ DECLARE_RTFEXPORT_TEST(testHyphpar, "hyphpar.rtf") DECLARE_RTFEXPORT_TEST(testTdf108955, "tdf108955.rtf") { - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, + getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); // This was 0xffffff, i.e. non-white background was overwritten from the paragraph style. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffff99), getProperty<sal_Int32>(getParagraph(1), "FillColor")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffff99), + getProperty<sal_Int32>(getParagraph(1), "FillColor")); } DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); // This was 2, i.e. the second table had 3 cols, now 2 as expected. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), + getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators") + .getLength()); } DECLARE_RTFEXPORT_TEST(testTdf90421, "tdf90421.fodt") @@ -987,24 +1112,30 @@ DECLARE_RTFEXPORT_TEST(testTdf92521, "tdf92521.odt") DECLARE_RTFEXPORT_TEST(testTdf94043, "tdf94043.rtf") { - auto xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection"); - auto xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + auto xTextSection + = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(2), "TextSection"); + auto xTextColumns + = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); // This was 0, the separator line was not visible due to 0 width. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), + getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth")); } DECLARE_RTFEXPORT_TEST(testTdf94377, "tdf94377.rtf") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY); - auto xText = getProperty< uno::Reference<text::XText> >(xPropertySet, "TextRange"); + auto xText = getProperty<uno::Reference<text::XText>>(xPropertySet, "TextRange"); // This failed, as: // 1) multiple paragraphs were not exported, so the text was "Asdf10asdf12". // 2) direct formatting of runs were not exported, so this was 12 (the document default). - CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(getRun(getParagraphOfText(1, xText, "Asdf10"), 1), "CharHeight")); - CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getRun(getParagraphOfText(2, xText, "asdf12"), 1), "CharHeight")); + CPPUNIT_ASSERT_EQUAL( + 10.f, getProperty<float>(getRun(getParagraphOfText(1, xText, "Asdf10"), 1), "CharHeight")); + CPPUNIT_ASSERT_EQUAL( + 12.f, getProperty<float>(getRun(getParagraphOfText(2, xText, "asdf12"), 1), "CharHeight")); } DECLARE_RTFEXPORT_TEST(testTdf104079, "tdf104079.rtf") @@ -1019,41 +1150,58 @@ DECLARE_RTFEXPORT_TEST(testTdf104079, "tdf104079.rtf") bFound = true; // This was 0, 3rd paragraph of ToC lost its bottom paragraph margin. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), getProperty<sal_Int32>(xParagraph, "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), + getProperty<sal_Int32>(xParagraph, "ParaBottomMargin")); } } DECLARE_RTFEXPORT_TEST(testPageBackground, "page-background.rtf") { // The problem was that \background was ignored. - uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor")); } DECLARE_RTFEXPORT_TEST(testTdf96175, "tdf96175.rtf") { // The problem that a user defined property named "Company" was lost on export. - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY); - uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = xDocumentProperties->getUserDefinedProperties(); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties( + xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY); + uno::Reference<beans::XPropertyContainer> xUserDefinedProperties + = xDocumentProperties->getUserDefinedProperties(); // This resulted in a beans::UnknownPropertyException. - CPPUNIT_ASSERT_EQUAL(OUString("foobar"), getProperty<OUString>(xUserDefinedProperties, "Company")); + CPPUNIT_ASSERT_EQUAL(OUString("foobar"), + getProperty<OUString>(xUserDefinedProperties, "Company")); } DECLARE_RTFEXPORT_TEST(testRedline, "redline.rtf") { - CPPUNIT_ASSERT_EQUAL(OUString("Rebecca Lopez"), getProperty<OUString>(getRun(getParagraph(1), 2), "RedlineAuthor")); - CPPUNIT_ASSERT_EQUAL(OUString("Dorothy Jones"), getProperty<OUString>(getRun(getParagraph(2), 2), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OUString("Rebecca Lopez"), + getProperty<OUString>(getRun(getParagraph(1), 2), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OUString("Dorothy Jones"), + getProperty<OUString>(getRun(getParagraph(2), 2), "RedlineAuthor")); } DECLARE_RTFEXPORT_TEST(testCustomDocProps, "custom-doc-props.rtf") { // Custom document properties were not improved, this resulted in a beans::UnknownPropertyException. - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); - uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = xDocumentProperties->getUserDefinedProperties(); - CPPUNIT_ASSERT_EQUAL(OUString("2016-03-08T10:55:18,531376147"), getProperty<OUString>(xUserDefinedProperties, "urn:bails:IntellectualProperty:Authorization:StartValidity")); - CPPUNIT_ASSERT_EQUAL(OUString("None"), getProperty<OUString>(xUserDefinedProperties, "urn:bails:IntellectualProperty:Authorization:StopValidity")); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties + = xDocumentPropertiesSupplier->getDocumentProperties(); + uno::Reference<beans::XPropertyContainer> xUserDefinedProperties + = xDocumentProperties->getUserDefinedProperties(); + CPPUNIT_ASSERT_EQUAL( + OUString("2016-03-08T10:55:18,531376147"), + getProperty<OUString>(xUserDefinedProperties, + "urn:bails:IntellectualProperty:Authorization:StartValidity")); + CPPUNIT_ASSERT_EQUAL( + OUString("None"), + getProperty<OUString>(xUserDefinedProperties, + "urn:bails:IntellectualProperty:Authorization:StopValidity")); // Test roundtrip of numbers. This failed as getProperty() did not find "n". CPPUNIT_ASSERT_EQUAL(42.0, getProperty<double>(xUserDefinedProperties, "n")); // Test boolean "yes". @@ -1073,19 +1221,21 @@ DECLARE_RTFEXPORT_TEST(testCustomDocProps, "custom-doc-props.rtf") DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf") { - uno::Reference<container::XNameAccess> xPageStyles = getStyles("PageStyles"); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); xCursor->jumpToLastPage(); OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); // The second page's numbering type: this was style::NumberingType::ARABIC. - CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_UPPER_LETTER_N, getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); + CPPUNIT_ASSERT_EQUAL( + style::NumberingType::CHARS_UPPER_LETTER_N, + getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); // The second page's restart value: this was 0. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), + getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset")); } DECLARE_RTFEXPORT_TEST(testPgnlcltr, "pgnlcltr.rtf") @@ -1094,12 +1244,14 @@ DECLARE_RTFEXPORT_TEST(testPgnlcltr, "pgnlcltr.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); xCursor->jumpToLastPage(); OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); // The second page's numbering type: this was style::NumberingType::ARABIC. - CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_LOWER_LETTER_N, getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); + CPPUNIT_ASSERT_EQUAL( + style::NumberingType::CHARS_LOWER_LETTER_N, + getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); } DECLARE_RTFEXPORT_TEST(testPgnucrm, "pgnucrm.rtf") @@ -1108,12 +1260,14 @@ DECLARE_RTFEXPORT_TEST(testPgnucrm, "pgnucrm.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); xCursor->jumpToLastPage(); OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); // The second page's numbering type: this was style::NumberingType::ARABIC. - CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_UPPER, getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); + CPPUNIT_ASSERT_EQUAL( + style::NumberingType::ROMAN_UPPER, + getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); } DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf") @@ -1122,12 +1276,14 @@ DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); xCursor->jumpToLastPage(); OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); // The second page's numbering type: this was style::NumberingType::ARABIC. - CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_LOWER, getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); + CPPUNIT_ASSERT_EQUAL( + style::NumberingType::ROMAN_LOWER, + getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); } DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf") @@ -1136,18 +1292,21 @@ DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); xCursor->jumpToLastPage(); OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); // The second page's numbering type: this was style::NumberingType::ROMAN_LOWER. - CPPUNIT_ASSERT_EQUAL(style::NumberingType::ARABIC, getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); + CPPUNIT_ASSERT_EQUAL( + style::NumberingType::ARABIC, + getProperty<sal_Int16>(xPageStyles->getByName(pageStyleName), "NumberingType")); } DECLARE_RTFEXPORT_TEST(testTdf98806, "tdf98806.rtf") { uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextContent> xBookmark(xBookmarksSupplier->getBookmarks()->getByName("bookmark"), uno::UNO_QUERY); + uno::Reference<text::XTextContent> xBookmark( + xBookmarksSupplier->getBookmarks()->getByName("bookmark"), uno::UNO_QUERY); // This was empty, bookmark in table wasn't imported correctly. CPPUNIT_ASSERT_EQUAL(OUString("BBB"), xBookmark->getAnchor()->getString()); } @@ -1185,15 +1344,16 @@ DECLARE_RTFEXPORT_TEST(testTdf104228, "tdf104228.rtf") uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCell->getText()); // This was 2103, implicit 0 as direct formatting was ignored on the // paragraph (and the style had this larger value). - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); } - DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf") { uno::Reference<text::XTextRange> xPara(getParagraph(1)); uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), + uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; for (int i = 0; i < aProps.getLength(); ++i) @@ -1211,7 +1371,8 @@ DECLARE_RTFEXPORT_TEST(testTdf113550, "tdf113550.rtf") uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCell->getText()); // This was 2501, 0 as direct formatting was ignored on the paragraph (and // the style had this larger value). - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); } DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf") @@ -1219,7 +1380,8 @@ DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf") // Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule. uno::Reference<text::XTextRange> xPara(getParagraph(1)); uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), + uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; for (int i = 0; i < aProps.getLength(); ++i) @@ -1238,7 +1400,8 @@ DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf") DECLARE_RTFEXPORT_TEST(testHyperlinkTarget, "hyperlink-target.rtf") { // This was empty, hyperlink target was lost on import. - CPPUNIT_ASSERT_EQUAL(OUString("_blank"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkTarget")); + CPPUNIT_ASSERT_EQUAL(OUString("_blank"), + getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkTarget")); } DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx") @@ -1246,7 +1409,8 @@ DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx") // This failed, RTF export didn't write the \htmautsp compat flag, the // original bugdoc resulting in 2 pages instead of 1. uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xSettings( + xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); bool bAddParaTableSpacing = true; xSettings->getPropertyValue("AddParaTableSpacing") >>= bAddParaTableSpacing; CPPUNIT_ASSERT(!bAddParaTableSpacing); @@ -1255,10 +1419,12 @@ DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx") DECLARE_RTFEXPORT_TEST(testTdf104937, "tdf104937.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - auto aSeparators = getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators"); + auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators"); // First table's second row had 9 cells (so 8 separators). CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8), aSeparators.getLength()); // This was 3174, i.e. last cell was wider than expected, while others were @@ -1269,10 +1435,12 @@ DECLARE_RTFEXPORT_TEST(testTdf104937, "tdf104937.rtf") DECLARE_RTFEXPORT_TEST(testTdf112507, "tdf112507.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - auto aSeparators = getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators"); + auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators"); // First table's second row had 3 cells (so 2 separators). CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aSeparators.getLength()); // This was 3333, i.e. the B2 cell was too narrow and the text needed 2 lines. @@ -1282,8 +1450,10 @@ DECLARE_RTFEXPORT_TEST(testTdf112507, "tdf112507.rtf") DECLARE_RTFEXPORT_TEST(testTdf107480, "tdf107480.rtf") { // These were 176 (100 twips), as \htmautsp was parsed too late. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), + getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), + getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); } DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf") @@ -1312,13 +1482,15 @@ DECLARE_RTFEXPORT_TEST(testTdf109790, "tdf109790.rtf") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // Style information was reset, which caused character height to be 22. - CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight")); + CPPUNIT_ASSERT_EQUAL( + 10.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight")); } DECLARE_RTFEXPORT_TEST(testTdf112211, "tdf112211.rtf") { // This was 0, \fi in a list level definition was not imported. - auto xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); + auto xRules = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635), aRule["FirstLineIndent"].get<sal_Int32>()); } diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 35e5d461e15c..99a8ed9abd4a 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -55,7 +55,8 @@ class Test : public SwModelTestBase { public: - Test() : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") + Test() + : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") { } @@ -64,10 +65,8 @@ public: m_aSavedSettings = Application::GetSettings(); if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo72031.rtf") { - std::unique_ptr<Resetter> pResetter(new Resetter([this]() - { - Application::SetSettings(this->m_aSavedSettings); - })); + std::unique_ptr<Resetter> pResetter( + new Resetter([this]() { Application::SetSettings(this->m_aSavedSettings); })); AllSettings aSettings(m_aSavedSettings); aSettings.SetLanguageTag(LanguageTag("ru")); Application::SetSettings(aSettings); @@ -75,10 +74,8 @@ public: } else if (OString(filename) == "fdo44211.rtf") { - std::unique_ptr<Resetter> pResetter(new Resetter([this]() - { - Application::SetSettings(this->m_aSavedSettings); - })); + std::unique_ptr<Resetter> pResetter( + new Resetter([this]() { Application::SetSettings(this->m_aSavedSettings); })); AllSettings aSettings(m_aSavedSettings); aSettings.SetLanguageTag(LanguageTag("lt")); Application::SetSettings(aSettings); @@ -89,14 +86,19 @@ public: protected: /// Copy&paste helper. - void paste(const OUString& aFilename, uno::Reference<text::XTextRange> const& xTextRange = uno::Reference<text::XTextRange>()) + void paste(const OUString& aFilename, uno::Reference<text::XTextRange> const& xTextRange + = uno::Reference<text::XTextRange>()) { - uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + uno::Reference<document::XFilter> xFilter( + m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); xImporter->setTargetDocument(mxComponent); uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2); aDescriptor[0].Name = "InputStream"; - SvStream* pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc("/sw/qa/extras/rtfexport/data/") + aFilename, StreamMode::WRITE); + SvStream* pStream = utl::UcbStreamHelper::CreateStream( + m_directories.getURLFromSrc("/sw/qa/extras/rtfexport/data/") + aFilename, + StreamMode::WRITE); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); aDescriptor[0].Value <<= xStream; aDescriptor[1].Name = "InsertMode"; @@ -114,20 +116,24 @@ protected: DECLARE_RTFEXPORT_TEST(testFdo45553, "fdo45553.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); while (xParaEnum->hasMoreElements()) { - uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration(); while (xRangeEnum->hasMoreElements()) { uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY); OUString aStr = xRange->getString(); if (aStr == "space-before") - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)), getProperty<sal_Int32>(xRange, "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)), + getProperty<sal_Int32>(xRange, "ParaTopMargin")); else if (aStr == "space-after") - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)), getProperty<sal_Int32>(xRange, "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)), + getProperty<sal_Int32>(xRange, "ParaBottomMargin")); } } } @@ -139,8 +145,10 @@ DECLARE_RTFEXPORT_TEST(testN192129, "n192129.rtf") MapMode aMap(MapUnit::Map100thMM); aExpectedSize = Application::GetDefaultDevice()->PixelToLogic(aExpectedSize, aMap); - uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); + uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess( + xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY); awt::Size aActualSize(xShape->getSize()); if ((aExpectedSize.Width() - aActualSize.Width) / 2 != 0) @@ -153,28 +161,26 @@ DECLARE_RTFEXPORT_TEST(testN192129, "n192129.rtf") } } -DECLARE_RTFEXPORT_TEST(testFdo45543, "fdo45543.rtf") -{ - CPPUNIT_ASSERT_EQUAL(5, getLength()); -} +DECLARE_RTFEXPORT_TEST(testFdo45543, "fdo45543.rtf") { CPPUNIT_ASSERT_EQUAL(5, getLength()); } -DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf") -{ - CPPUNIT_ASSERT_EQUAL(3, getLength()); -} +DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf") { CPPUNIT_ASSERT_EQUAL(3, getLength()); } DECLARE_RTFEXPORT_TEST(testFdo45187, "fdo45187.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // There should be two shapes. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); // They should be anchored to different paragraphs. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xTextDocument->getText(), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xAnchor0 = uno::Reference<text::XTextContent>(xDraws->getByIndex(0), uno::UNO_QUERY)->getAnchor(); - uno::Reference<text::XTextRange> xAnchor1 = uno::Reference<text::XTextContent>(xDraws->getByIndex(1), uno::UNO_QUERY)->getAnchor(); + uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference<text::XTextRange> xAnchor0 + = uno::Reference<text::XTextContent>(xDraws->getByIndex(0), uno::UNO_QUERY)->getAnchor(); + uno::Reference<text::XTextRange> xAnchor1 + = uno::Reference<text::XTextContent>(xDraws->getByIndex(1), uno::UNO_QUERY)->getAnchor(); // Was 0 ("starts at the same position"), should be 1 ("starts before") CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1)); } @@ -182,7 +188,8 @@ DECLARE_RTFEXPORT_TEST(testFdo45187, "fdo45187.rtf") DECLARE_RTFEXPORT_TEST(testN750757, "n750757.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xParaEnum->nextElement(), "ParaContextMargin")); @@ -192,7 +199,8 @@ DECLARE_RTFEXPORT_TEST(testN750757, "n750757.rtf") DECLARE_RTFEXPORT_TEST(testFdo45563, "fdo45563.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); int i = 0; while (xParaEnum->hasMoreElements()) @@ -206,18 +214,23 @@ DECLARE_RTFEXPORT_TEST(testFdo45563, "fdo45563.rtf") DECLARE_RTFEXPORT_TEST(testFdo43965, "fdo43965.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); // First paragraph: the parameter of \up was ignored - uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty<sal_Int32>(xPropertySet, "CharEscapement")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), + getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight")); // Second paragraph: Word vs Writer border default problem - CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(26), + getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth); // Finally, make sure that we have two pages CPPUNIT_ASSERT_EQUAL(2, getPages()); @@ -226,10 +239,12 @@ DECLARE_RTFEXPORT_TEST(testFdo43965, "fdo43965.rtf") DECLARE_RTFEXPORT_TEST(testN751020, "n751020.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(200)), getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(200)), + getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin")); } DECLARE_RTFEXPORT_TEST(testFdo79384, "fdo79384.rtf") @@ -248,14 +263,17 @@ DECLARE_RTFEXPORT_TEST(testFdo47326, "fdo47326.rtf") DECLARE_RTFEXPORT_TEST(testFdo46955, "fdo46955.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); while (xParaEnum->hasMoreElements()) { - uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration(); while (xRangeEnum->hasMoreElements()) - CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap")); + CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, + getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap")); } } @@ -263,32 +281,35 @@ DECLARE_RTFEXPORT_TEST(testFdo81892, "fdo81892.rtf") { // table was not centered uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient")); + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, + getProperty<sal_Int16>(xTable, "HoriOrient")); // fdo#81893: paragraph with \page was not centered uno::Reference<text::XTextRange> xPara(getParagraph(2, "Performance")); - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL( + style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust"))); } DECLARE_RTFEXPORT_TEST(testFdo45394, "fdo45394.rtf") { - uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Standard"), "HeaderText"); + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Standard"), "HeaderText"); OUString aActual = xHeaderText->getString(); // Encoding in the header was wrong. OUString aExpected(u"\u041F\u041A \u0420\u0418\u041A"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } -DECLARE_RTFEXPORT_TEST(testFdo48104, "fdo48104.rtf") -{ - CPPUNIT_ASSERT_EQUAL(2, getPages()); -} +DECLARE_RTFEXPORT_TEST(testFdo48104, "fdo48104.rtf") { CPPUNIT_ASSERT_EQUAL(2, getPages()); } DECLARE_RTFEXPORT_TEST(testFdo47107, "fdo47107.rtf") { @@ -301,8 +322,10 @@ DECLARE_RTFEXPORT_TEST(testFdo47107, "fdo47107.rtf") DECLARE_RTFEXPORT_TEST(testFdo44176, "fdo44176.rtf") { uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles")); - uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName("Standard"), + uno::UNO_QUERY); sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0; xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop; xDefault->getPropertyValue("TopMargin") >>= nDefaultTop; @@ -313,10 +336,12 @@ DECLARE_RTFEXPORT_TEST(testFdo44176, "fdo44176.rtf") DECLARE_RTFEXPORT_TEST(testFdo39053, "fdo39053.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); int nAsCharacter = 0; for (int i = 0; i < xDraws->getCount(); ++i) - if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AS_CHARACTER) + if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") + == text::TextContentAnchorType_AS_CHARACTER) nAsCharacter++; // The image in binary format was ignored. CPPUNIT_ASSERT_EQUAL(1, nAsCharacter); @@ -325,7 +350,8 @@ DECLARE_RTFEXPORT_TEST(testFdo39053, "fdo39053.rtf") DECLARE_RTFEXPORT_TEST(testFdo48356, "fdo48356.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); int i = 0; while (xParaEnum->hasMoreElements()) @@ -349,16 +375,16 @@ DECLARE_RTFEXPORT_TEST(testFdo48023, "fdo48023.rtf") DECLARE_RTFEXPORT_TEST(testFdo48876, "fdo48876.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); - CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode); + CPPUNIT_ASSERT_EQUAL( + style::LineSpacingMode::MINIMUM, + getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode); } -DECLARE_RTFEXPORT_TEST(testFdo48193, "fdo48193.rtf") -{ - CPPUNIT_ASSERT_EQUAL(7, getLength()); -} +DECLARE_RTFEXPORT_TEST(testFdo48193, "fdo48193.rtf") { CPPUNIT_ASSERT_EQUAL(7, getLength()); } DECLARE_RTFEXPORT_TEST(testFdo44211, "fdo44211.rtf") { @@ -374,10 +400,12 @@ DECLARE_RTFEXPORT_TEST(testFdo48037, "fdo48037.rtf") lang::Locale aUSLocale, aFRLocale; aUSLocale.Language = "en"; aFRLocale.Language = "fr"; - sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale); + sal_Int32 nExpected + = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY); sal_Int32 nActual = 0; @@ -395,7 +423,8 @@ DECLARE_RTFEXPORT_TEST(testFdo47764, "fdo47764.rtf") DECLARE_RTFEXPORT_TEST(testFdo38786, "fdo38786.rtf") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); // \chpgn was ignored, so exception was thrown xFields->nextElement(); @@ -410,7 +439,8 @@ DECLARE_RTFEXPORT_TEST(testN757651, "n757651.rtf") DECLARE_RTFEXPORT_TEST(testFdo49501, "fdo49501.rtf") { - uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape")); sal_Int32 nExpected(convertTwipToMm100(567)); @@ -428,7 +458,8 @@ DECLARE_RTFEXPORT_TEST(testFdo49271, "fdo49271.rtf") DECLARE_RTFEXPORT_TEST(testFdo50539, "fdo50539.rtf") { // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black) - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), + getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor")); } DECLARE_RTFEXPORT_TEST(testFdo50665, "fdo50665.rtf") @@ -443,12 +474,15 @@ DECLARE_RTFEXPORT_TEST(testFdo49659, "fdo49659.rtf") { // Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); // The graphic was also empty - uno::Reference<beans::XPropertySet> xGraphic(getProperty< uno::Reference<beans::XPropertySet> >(getShape(1), "Graphic"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType")); + uno::Reference<beans::XPropertySet> xGraphic( + getProperty<uno::Reference<beans::XPropertySet>>(getShape(1), "Graphic"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, + getProperty<sal_Int8>(xGraphic, "GraphicType")); } DECLARE_RTFEXPORT_TEST(testFdo46966, "fdo46966.rtf") @@ -458,8 +492,10 @@ DECLARE_RTFEXPORT_TEST(testFdo46966, "fdo46966.rtf") * * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin */ - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(720)), getProperty<sal_Int32>(xPropertySet, "TopMargin")); + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(720)), + getProperty<sal_Int32>(xPropertySet, "TopMargin")); } DECLARE_RTFEXPORT_TEST(testFdo76633, "fdo76633.rtf") @@ -493,13 +529,15 @@ DECLARE_RTFEXPORT_TEST(testFdo48033, "fdo48033.rtf") * xray oRun.TextPortionType ' Frame, was Text */ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Frame"), + getProperty<OUString>(getRun(xPara, 1), "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testFdo53594, "fdo53594.rtf") @@ -516,18 +554,21 @@ DECLARE_RTFEXPORT_TEST(testFdo53594, "fdo53594.rtf") * xray oRun.TextPortionType ' Frame, was Text */ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Frame"), + getProperty<OUString>(getRun(xPara, 1), "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testFdo36089, "fdo36089.rtf") { - CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), + getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement")); } DECLARE_RTFEXPORT_TEST(testFdo48446, "fdo48446.rtf") @@ -563,7 +604,8 @@ DECLARE_RTFEXPORT_TEST(testFdo49655, "fdo49655.rtf") * xray ThisComponent.TextTables.Count 'was 0 */ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } @@ -575,14 +617,16 @@ DECLARE_RTFEXPORT_TEST(testFdo62805, "fdo62805.rtf") * The table was instead in a group (the '}' replace the \pard). */ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } DECLARE_RTFEXPORT_TEST(testFdo52475, "fdo52475.rtf") { // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO. - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), + getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor")); } DECLARE_RTFEXPORT_TEST(testFdo55493, "fdo55493.rtf") @@ -598,8 +642,10 @@ DECLARE_RTFEXPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf") // Once we have more copy&paste tests, makes sense to refactor this to some helper method. paste("copypaste-pagestyle-paste.rtf"); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590 + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), + getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590 } #if !defined(_WIN32) @@ -608,7 +654,8 @@ DECLARE_RTFEXPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf") { // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); paste("copypaste-footnote-paste.rtf", xTextRange); @@ -624,8 +671,10 @@ DECLARE_RTFEXPORT_TEST(testFdo63428, "hello.rtf") paste("fdo63428.rtf", xEnd); // Additionally, commented range was imported as a normal comment. - CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType")); - CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), + getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), + getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testFdo69384, "hello.rtf") @@ -671,16 +720,20 @@ DECLARE_RTFEXPORT_TEST(testShptxtPard, "shptxt-pard.rtf") DECLARE_RTFEXPORT_TEST(testDoDhgt, "do-dhgt.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); for (int i = 0; i < xDraws->getCount(); ++i) { sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor"); if (nFillColor == 0xc0504d) // red - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); else if (nFillColor == 0x9bbb59) // green - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); else if (nFillColor == 0x4f81bd) // blue - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); } } @@ -694,21 +747,25 @@ DECLARE_RTFEXPORT_TEST(testDplinehollow, "dplinehollow.rtf") DECLARE_RTFEXPORT_TEST(testLeftmarginDefault, "leftmargin-default.rtf") { // The default left/right margin was incorrect when the top margin was set to zero. - CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Standard"), "LeftMargin")); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(2540), + getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Standard"), "LeftMargin")); } DECLARE_RTFEXPORT_TEST(testDppolyline, "dppolyline.rtf") { // This was completely ignored, for now, just make sure we have all 4 lines. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount()); } DECLARE_RTFEXPORT_TEST(testFdo56512, "fdo56512.rtf") { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY); OUString aExpected(u"\u05E2\u05D5\u05E1\u05E7 \u05DE\u05D5\u05E8\u05E9\u05D4 "); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); @@ -728,8 +785,12 @@ DECLARE_RTFEXPORT_TEST(testFdo52989, "fdo52989.rtf") DECLARE_RTFEXPORT_TEST(testFdo54473, "fdo54473.rtf") { // The problem was that character styles were not imported due to a typo. - CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName")); - CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName")); + CPPUNIT_ASSERT_EQUAL( + OUString("Anot"), + getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName")); + CPPUNIT_ASSERT_EQUAL( + OUString("ForeignTxt"), + getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName")); } DECLARE_RTFEXPORT_TEST(testFdo49934, "fdo49934.rtf") @@ -741,13 +802,15 @@ DECLARE_RTFEXPORT_TEST(testFdo49934, "fdo49934.rtf") DECLARE_RTFEXPORT_TEST(testFdo57886, "fdo57886.rtf") { // Was 'int from <?> to <?> <?>'. - CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), + getFormula(getRun(getParagraph(1), 1))); } DECLARE_RTFEXPORT_TEST(testFdo58076, "fdo58076.rtf") { // An additional section was created, so the default page style didn't have the custom margins. - uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty<sal_Int32>(xStyle, "LeftMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty<sal_Int32>(xStyle, "RightMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "TopMargin")); @@ -758,7 +821,8 @@ DECLARE_RTFEXPORT_TEST(testFdo57678, "fdo57678.rtf") { // Paragraphs of the two tables were not converted to tables. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } @@ -766,7 +830,8 @@ DECLARE_RTFEXPORT_TEST(testFdo54612, "fdo54612.rtf") { // \dpptx without a \dppolycount caused a crash. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount()); } @@ -774,7 +839,8 @@ DECLARE_RTFEXPORT_TEST(testFdo58933, "fdo58933.rtf") { // The problem was that the table had an additional cell in its first line. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // This was 4. CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength()); @@ -783,12 +849,17 @@ DECLARE_RTFEXPORT_TEST(testFdo58933, "fdo58933.rtf") DECLARE_RTFEXPORT_TEST(testFdo44053, "fdo44053.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // The with of the table's A1 and A2 cell should equal. - CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position, - getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators")[0] + .Position, + getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators")[0] + .Position); } DECLARE_RTFEXPORT_TEST(testFdo48440, "fdo48440.rtf") @@ -819,7 +890,8 @@ DECLARE_RTFEXPORT_TEST(testFdo59419, "fdo59419.rtf") { // Junk to be ignored broke import of the table. uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); } @@ -836,15 +908,18 @@ DECLARE_RTFEXPORT_TEST(testHexCRLF, "hexcrlf.rtf") DECLARE_RTFEXPORT_TEST(testFdo58076_2, "fdo58076-2.rtf") { // Position of the picture wasn't correct. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(8345)), getProperty<sal_Int32>(getShape(1), "HoriOrientPosition")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(8345)), + getProperty<sal_Int32>(getShape(1), "HoriOrientPosition")); } DECLARE_RTFEXPORT_TEST(testFdo59638, "fdo59638.rtf") { // The problem was that w:lvlOverride inside w:num was ignores by dmapper. - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -900,14 +975,16 @@ DECLARE_RTFEXPORT_TEST(testFdo61909, "fdo61909.rtf") { uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1); // Was the Writer default font. - CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), + getProperty<OUString>(xTextRange, "CharFontName")); CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor")); } DECLARE_RTFEXPORT_TEST(testFdo62288, "fdo62288.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); @@ -920,9 +997,11 @@ DECLARE_RTFEXPORT_TEST(testFdo62288, "fdo62288.rtf") DECLARE_RTFEXPORT_TEST(testFdo37716, "fdo37716.rtf") { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); // \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL - CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround")); + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, + getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround")); } DECLARE_RTFEXPORT_TEST(testFdo51916, "fdo51916.rtf") @@ -932,19 +1011,25 @@ DECLARE_RTFEXPORT_TEST(testFdo51916, "fdo51916.rtf") DECLARE_RTFEXPORT_TEST(testFdo63023, "fdo63023.rtf") { - uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Standard"), "HeaderText"); + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Standard"), "HeaderText"); // Back color was black (0) in the header, due to missing color table in the substream. - CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFF99), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xHeaderText), 1), "CharBackColor")); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(0xFFFF99), + getProperty<sal_Int32>(getRun(getParagraphOfText(1, xHeaderText), 1), "CharBackColor")); } DECLARE_RTFEXPORT_TEST(testFdo42109, "fdo42109.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); // Make sure the page number is imported as a field in the B1 cell. - CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("TextField"), + getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), + "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testFdo62977, "fdo62977.rtf") @@ -973,8 +1058,11 @@ DECLARE_RTFEXPORT_TEST(testFdo62044, "fdo62044.rtf") uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("fdo62044-paste.rtf", xEnd); - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value. + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( + 10.f, getProperty<float>(xPropertySet, + "CharHeight")); // Was 18, i.e. reset back to original value. } DECLARE_RTFEXPORT_TEST(testFdo70578, "fdo70578.rtf") @@ -992,7 +1080,8 @@ DECLARE_RTFEXPORT_TEST(testN825305, "n825305.rtf") { // The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0. uno::Reference<beans::XPropertyState> xPropertyState(getShape(2), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getShape(2), "BackColorTransparency")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), + getProperty<sal_Int32>(getShape(2), "BackColorTransparency")); beans::PropertyState ePropertyState = xPropertyState->getPropertyState("BackColorTransparency"); // Was beans::PropertyState_DEFAULT_VALUE. CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState); @@ -1000,7 +1089,8 @@ DECLARE_RTFEXPORT_TEST(testN825305, "n825305.rtf") DECLARE_RTFEXPORT_TEST(testTdf106953, "tdf106953.rtf") { - auto xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); + auto xRules = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), aRule["IndentAt"].get<sal_Int32>()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aRule["FirstLineIndent"].get<sal_Int32>()); @@ -1008,13 +1098,15 @@ DECLARE_RTFEXPORT_TEST(testTdf106953, "tdf106953.rtf") DECLARE_RTFEXPORT_TEST(testTdf112208, "tdf112208_hangingIndent.rtf") { - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-2000), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-2000), + getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); CPPUNIT_ASSERT_EQUAL(1, getPages()); } DECLARE_RTFEXPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin")); // This was 353, i.e. bottom margin of the paragraph was 0.35cm instead of 0. @@ -1029,7 +1121,8 @@ DECLARE_RTFEXPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf") DECLARE_RTFEXPORT_TEST(testFdo66040, "fdo66040.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // This was 0 (no shapes were imported), we want two textframes. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); @@ -1037,7 +1130,9 @@ DECLARE_RTFEXPORT_TEST(testFdo66040, "fdo66040.rtf") uno::Reference<text::XTextRange> xTextRange(xDraws->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextRange->getText(); uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2, xText), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("A"), uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString()); + CPPUNIT_ASSERT_EQUAL( + OUString("A"), + uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString()); // Make sure the second shape has the correct position and size. uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(1), uno::UNO_QUERY); @@ -1058,12 +1153,15 @@ DECLARE_RTFEXPORT_TEST(testFdo77996, "fdo77996.rtf") CPPUNIT_ASSERT(!xParas->hasByName("0")); CPPUNIT_ASSERT(xParas->hasByName("extract2")); // some document properties were lost - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xProps(xDocumentPropertiesSupplier->getDocumentProperties()); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xProps( + xDocumentPropertiesSupplier->getDocumentProperties()); CPPUNIT_ASSERT_EQUAL(OUString("Aln Lin (Bei Jing)"), xProps->getAuthor()); OUString aTitle(u"\u53A6\u95E8\u94A8\u4E1A\u80A1\u4EFD\u6709\u9650\u516C\u53F8"); CPPUNIT_ASSERT_EQUAL(aTitle, xProps->getTitle()); - uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("jay"), getProperty<OUString>(xUDProps, "Operator")); // fdo#80486 also check that the ftnsep doesn't insert paragraph breaks @@ -1073,7 +1171,8 @@ DECLARE_RTFEXPORT_TEST(testFdo77996, "fdo77996.rtf") DECLARE_RTFEXPORT_TEST(testFdo47802, "fdo47802.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // Shape inside table was ignored. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } @@ -1087,31 +1186,40 @@ DECLARE_RTFEXPORT_TEST(testFdo39001, "fdo39001.rtf") DECLARE_RTFEXPORT_TEST(testFdo54900, "fdo54900.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // Paragraph was aligned to left, should be center. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>( + getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); } DECLARE_RTFEXPORT_TEST(testFdo64637, "fdo64637.rtf") { // The problem was that the custom "Company" property was added twice, the second invocation resulted in an exception. - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPropertySet(xDocumentPropertiesSupplier->getDocumentProperties()->getUserDefinedProperties(), uno::UNO_QUERY); + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( + mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + xDocumentPropertiesSupplier->getDocumentProperties()->getUserDefinedProperties(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty<OUString>(xPropertySet, "Company")); } DECLARE_RTFEXPORT_TEST(testN820504, "n820504.rtf") { // The shape was anchored at-page instead of at-character (that's incorrect as Word only supports at-character and as-character). - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } DECLARE_RTFEXPORT_TEST(testFdo67498, "fdo67498.rtf") { // Left margin of the default page style wasn't set (was 2000). - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(5954)), getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Standard"), "LeftMargin")); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(convertTwipToMm100(5954)), + getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Standard"), "LeftMargin")); } DECLARE_RTFEXPORT_TEST(testFdo44715, "fdo44715.rtf") @@ -1119,7 +1227,8 @@ DECLARE_RTFEXPORT_TEST(testFdo44715, "fdo44715.rtf") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // Style information wasn't reset, which caused character height to be 16. - CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(2, xCell->getText()), "CharHeight")); + CPPUNIT_ASSERT_EQUAL(12.f, + getProperty<float>(getParagraphOfText(2, xCell->getText()), "CharHeight")); } DECLARE_RTFEXPORT_TEST(testFdo68076, "fdo68076.rtf") @@ -1132,7 +1241,8 @@ DECLARE_RTFEXPORT_TEST(testFdo68076, "fdo68076.rtf") DECLARE_RTFEXPORT_TEST(testFdo70221, "fdo70221.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // The picture was imported twice. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } @@ -1142,11 +1252,12 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf") // The problem was that the empty paragraph at the end of the footnote got // lost during import. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); OUString const aExpected = "Footnote first line." SAL_NEWLINE_STRING; - OUString const aActual = xTextRange->getString(); + OUString const aActual = xTextRange->getString(); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } @@ -1154,7 +1265,8 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf") DECLARE_RTFEXPORT_TEST(testFdo94835, "fdo94835.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // The picture was imported twice. CPPUNIT_ASSERT_EQUAL(sal_Int32(19), xDraws->getCount()); } @@ -1162,7 +1274,8 @@ DECLARE_RTFEXPORT_TEST(testNestedTable, "rhbz1065629.rtf") { // nested table in second cell was missing uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); @@ -1181,28 +1294,22 @@ DECLARE_RTFEXPORT_TEST(testNestedTable, "rhbz1065629.rtf") xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); table::BorderLine2 fullPtSolid(1, 0, 35, 0, table::BorderLineStyle::SOLID, 35); - CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, getProperty<table::BorderLine2>(xCell, "BottomBorder")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xCell, "BackColor")); xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 halfPtSolid(/*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18); - CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + table::BorderLine2 halfPtSolid(/*0*/ 1, 0, 18, 0, table::BorderLineStyle::SOLID, 18); + CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff), getProperty<sal_Int32>(xCell, "BackColor")); xCell.set(xTable->getCellByName("B2"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff), getProperty<sal_Int32>(xCell, "BackColor")); @@ -1213,14 +1320,14 @@ DECLARE_RTFEXPORT_TEST(testNestedTable, "rhbz1065629.rtf") DECLARE_RTFEXPORT_TEST(testFooterPara, "footer-para.rtf") { // check that paragraph properties in footer are imported - uno::Reference<text::XText> xFooterText = - getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("First Page"), "FooterText"); - uno::Reference<text::XTextContent> xParagraph = - getParagraphOrTable(1, xFooterText); + uno::Reference<text::XText> xFooterText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("First Page"), "FooterText"); + uno::Reference<text::XTextContent> xParagraph = getParagraphOrTable(1, xFooterText); CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."), uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString()); - CPPUNIT_ASSERT_EQUAL((sal_Int16)style::ParagraphAdjust_CENTER, - getProperty</*style::ParagraphAdjust*/sal_Int16>(xParagraph, "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL( + (sal_Int16)style::ParagraphAdjust_CENTER, + getProperty</*style::ParagraphAdjust*/ sal_Int16>(xParagraph, "ParaAdjust")); } DECLARE_RTFEXPORT_TEST(testCp1000016, "hello.rtf") @@ -1241,67 +1348,56 @@ DECLARE_RTFEXPORT_TEST(testCp1000016, "hello.rtf") DECLARE_RTFEXPORT_TEST(testFdo65090, "fdo65090.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // The first row had 3 cells, instead of a horizontally merged one and a normal one (2 -> 1 separator). - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators") + .getLength()); } DECLARE_RTFEXPORT_TEST(testTableBorderDefaults, "fdo68779.rtf") { // table borders without \brdrw were not imported uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); table::BorderLine2 solid(1, 0, 26, 0, table::BorderLineStyle::SOLID, 26); - CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(solid, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(solid, getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(solid, getProperty<table::BorderLine2>(xCell, "TopBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(solid, getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(1), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); table::BorderLine2 dotted(1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26); - CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "RightBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(dotted, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(dotted, getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(dotted, getProperty<table::BorderLine2>(xCell, "TopBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(dotted, getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(2), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); table::BorderLine2 doubled(1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79); - CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "RightBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "TopBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(doubled, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(doubled, getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(doubled, getProperty<table::BorderLine2>(xCell, "TopBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(doubled, getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(3), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); table::BorderLine2 thinThickMG(1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53); - CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "RightBorder")); - CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, getProperty<table::BorderLine2>(xCell, "LeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, getProperty<table::BorderLine2>(xCell, "RightBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, getProperty<table::BorderLine2>(xCell, "BottomBorder")); } @@ -1317,14 +1413,29 @@ DECLARE_RTFEXPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf") DECLARE_RTFEXPORT_TEST(testLevelfollow, "levelfollow.rtf") { - uno::Reference<container::XIndexAccess> xNum1Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); - CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::LISTTAB), comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, tab - - uno::Reference<container::XIndexAccess> xNum2Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum2"), "NumberingRules"); - CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::SPACE), comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, space - - uno::Reference<container::XIndexAccess> xNum3Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum3"), "NumberingRules"); - CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::NOTHING), comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, nothing + uno::Reference<container::XIndexAccess> xNum1Levels + = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); + CPPUNIT_ASSERT_EQUAL( + sal_Int16(SvxNumberFormat::LISTTAB), + comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["LabelFollowedBy"] + .get<sal_Int16>()); // first level, tab + + uno::Reference<container::XIndexAccess> xNum2Levels + = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum2"), "NumberingRules"); + CPPUNIT_ASSERT_EQUAL( + sal_Int16(SvxNumberFormat::SPACE), + comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["LabelFollowedBy"] + .get<sal_Int16>()); // first level, space + + uno::Reference<container::XIndexAccess> xNum3Levels + = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum3"), "NumberingRules"); + CPPUNIT_ASSERT_EQUAL( + sal_Int16(SvxNumberFormat::NOTHING), + comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["LabelFollowedBy"] + .get<sal_Int16>()); // first level, nothing } DECLARE_RTFEXPORT_TEST(testCharColor, "char-color.rtf") @@ -1336,23 +1447,28 @@ DECLARE_RTFEXPORT_TEST(testCharColor, "char-color.rtf") DECLARE_RTFEXPORT_TEST(testFdo69289, "fdo69289.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); // There were only 2 cells (1 separators) in the table, should be 3 (2 separators). - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators") + .getLength()); } DECLARE_RTFEXPORT_TEST(testDptxbxRelation, "dptxbx-relation.rtf") { // This was FRAME, not PAGE_FRAME, even if dobxpage is in the document. - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); } DECLARE_RTFEXPORT_TEST(testDprectAnchor, "dprect-anchor.rtf") { // This was at-page, which is not something Word supports, so clearly an import error. - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } DECLARE_RTFEXPORT_TEST(testFdo76628, "fdo76628.rtf") @@ -1361,8 +1477,10 @@ DECLARE_RTFEXPORT_TEST(testFdo76628, "fdo76628.rtf") // Should be 'SAMPLE' in Russian, was garbage. getParagraph(1, aExpected); - uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Standard"), "HeaderText"); - OUString aExpectedHeader(u"\u041F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043E"); + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Standard"), "HeaderText"); + OUString aExpectedHeader( + u"\u041F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043E"); // Should be 'prepared' in Russian, was garbage. getParagraphOfText(1, xHeaderText, aExpectedHeader); } @@ -1370,19 +1488,24 @@ DECLARE_RTFEXPORT_TEST(testFdo76628, "fdo76628.rtf") DECLARE_RTFEXPORT_TEST(testFdo77267, "fdo77267.rtf") { // Paragraph was aligned to left, should be center. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL( + style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); } DECLARE_RTFEXPORT_TEST(testFdo75735, "fdo75735.rtf") { // Number of tabstops in the second paragraph should be 3, was 6. - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< uno::Sequence<style::TabStop> >(getParagraph(2), "ParaTabStops").getLength()); + CPPUNIT_ASSERT_EQUAL( + sal_Int32(3), + getProperty<uno::Sequence<style::TabStop>>(getParagraph(2), "ParaTabStops").getLength()); } DECLARE_RTFEXPORT_TEST(testFontOverride, "font-override.rtf") { // This was "Times New Roman". - CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Arial"), + getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); } DECLARE_RTFEXPORT_TEST(testFdo73241, "fdo73241.rtf") @@ -1394,7 +1517,8 @@ DECLARE_RTFEXPORT_TEST(testFdo73241, "fdo73241.rtf") DECLARE_RTFEXPORT_TEST(testFdo80905, "fdo80905.rtf") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); xFields->nextElement(); // The problem was that there was only one field in the document, but there should be true. @@ -1410,11 +1534,13 @@ DECLARE_RTFEXPORT_TEST(testFdo82106, "fdo82106.rtf") DECLARE_RTFEXPORT_TEST(testFdo74229, "fdo74229.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was 0, due to ignoring RTF_TRGAPH. - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), getProperty<sal_Int32>(xCell, "RightBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), + getProperty<sal_Int32>(xCell, "RightBorderDistance")); } DECLARE_RTFEXPORT_TEST(testFdo79959, "fdo79959.rtf") @@ -1426,24 +1552,29 @@ DECLARE_RTFEXPORT_TEST(testFdo79959, "fdo79959.rtf") DECLARE_RTFEXPORT_TEST(testFdo82078, "fdo82078.rtf") { // This was awt::FontWeight::BOLD, i.e. the second run was bold, when it should be normal. - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(getRun(getParagraph(1), 2), "CharWeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, + getProperty<float>(getRun(getParagraph(1), 2), "CharWeight")); } DECLARE_RTFEXPORT_TEST(testCsBold, "cs-bold.rtf") { // This was awt::FontWeight::NORMAL, i.e. the first run was bold, when it should be bold (applied character style without direct formatting). - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); } DECLARE_RTFEXPORT_TEST(testFdo84679, "fdo84679.rtf") { // The problem was that the paragraph in A1 had some bottom margin, but it should not. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was 282. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL( + static_cast<sal_Int32>(0), + getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin")); } DECLARE_RTFEXPORT_TEST(testFdo83464, "fdo83464.rtf") @@ -1452,36 +1583,45 @@ DECLARE_RTFEXPORT_TEST(testFdo83464, "fdo83464.rtf") uno::Reference<text::XTextRange> xFrameText(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xFrameText->getString()); // This was Times New Roman. - CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(getRun(getParagraphOfText(1, xFrameText->getText()), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL( + OUString("Verdana"), + getProperty<OUString>(getRun(getParagraphOfText(1, xFrameText->getText()), 1), + "CharFontName")); } DECLARE_RTFEXPORT_TEST(testFdo86761, "fdo86761.rtf") { // This was 26, even if the picture should have no border, due to fLine=0. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), + getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth); } DECLARE_RTFEXPORT_TEST(testFdo82859, "fdo82859.rtf") { // This was 0: "0xffffff" was converted to 0, i.e. the background was black instead of the default. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(getShape(1), "BackColor")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), + getProperty<sal_Int32>(getShape(1), "BackColor")); } DECLARE_RTFEXPORT_TEST(testFdo82076, "fdo82076.rtf") { // Footnote position was wrong: should be at the end of the B1 cell. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); // This resulted in container::NoSuchElementException: the footnote was at the start of the A1 cell. - CPPUNIT_ASSERT_EQUAL(OUString("Footnote"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 2), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Footnote"), + getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 2), + "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testFdo83204, "fdo83204.rtf") { // This was Standard, \sN was ignored after \bkmkstart and \pard. - CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty<OUString>(getParagraph(1), "ParaStyleName")); + CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty<OUString>(getParagraph(1), "ParaStyleName")); } DECLARE_RTFEXPORT_TEST(testFdo85889pc, "fdo85889-pc.rtf") @@ -1517,7 +1657,8 @@ DECLARE_RTFEXPORT_TEST(testFdo72031, "fdo72031.rtf") DECLARE_RTFEXPORT_TEST(testFdo86750, "fdo86750.rtf") { // This was 'HYPERLINK#anchor', the URL of the hyperlink had the field type as a prefix, leading to broken links. - CPPUNIT_ASSERT_EQUAL(OUString("#anchor"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); + CPPUNIT_ASSERT_EQUAL(OUString("#anchor"), + getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); } DECLARE_RTFEXPORT_TEST(testTdf88811, "tdf88811.rtf") @@ -1531,9 +1672,9 @@ DECLARE_RTFEXPORT_TEST(testTdf88811, "tdf88811.rtf") DECLARE_RTFEXPORT_TEST(testFdo49893_2, "fdo49893-2.rtf") { // Ensure that header text exists on each page (especially on second page) - CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[1]/header/txt/text()")); - CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[2]/header/txt/text()")); - CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), parseDump("/root/page[3]/header/txt/text()")); } DECLARE_RTFEXPORT_TEST(testFdo89496, "fdo89496.rtf") @@ -1558,14 +1699,16 @@ DECLARE_RTFEXPORT_TEST(mathtype, "mathtype.rtf") DECLARE_RTFEXPORT_TEST(testTdf86182, "tdf86182.rtf") { // Writing mode was the default, i.e. text::WritingMode2::CONTEXT. - CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>(getParagraph(1), "WritingMode")); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, + getProperty<sal_Int16>(getParagraph(1), "WritingMode")); } DECLARE_RTFEXPORT_TEST(testTdf91074, "tdf91074.rtf") { // The file failed to load, as the border color was imported using the LineColor UNO property. uno::Reference<drawing::XShape> xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_LIGHTRED), getProperty<table::BorderLine2>(xShape, "TopBorder").Color); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_LIGHTRED), + getProperty<table::BorderLine2>(xShape, "TopBorder").Color); } DECLARE_RTFEXPORT_TEST(testTdf90260Nopar, "hello.rtf") @@ -1580,13 +1723,15 @@ DECLARE_RTFEXPORT_TEST(testTdf90260Nopar, "hello.rtf") DECLARE_RTFEXPORT_TEST(testTdf86814, "tdf86814.rtf") { // This was awt::FontWeight::NORMAL, i.e. the first run wasn't bold, when it should be bold (applied paragraph style with direct formatting). - CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); } DECLARE_RTFEXPORT_TEST(testTdf108416, "tdf108416.rtf") { uno::Reference<container::XNameAccess> xCharacterStyles(getStyles("CharacterStyles")); - uno::Reference<beans::XPropertySet> xListLabel(xCharacterStyles->getByName("ListLabel 1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xListLabel(xCharacterStyles->getByName("ListLabel 1"), + uno::UNO_QUERY); // This was awt::FontWeight::BOLD, list numbering got an unexpected bold formatting. CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xListLabel, "CharWeight")); } @@ -1606,7 +1751,8 @@ DECLARE_RTFEXPORT_TEST(testTdf92061, "tdf92061.rtf") DECLARE_RTFEXPORT_TEST(testTdf92481, "tdf92481.rtf") { // This was 0, RTF_WIDOWCTRL was not imported. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int8>(2), getProperty<sal_Int8>(getParagraph(1), "ParaWidows")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int8>(2), + getProperty<sal_Int8>(getParagraph(1), "ParaWidows")); } DECLARE_RTFEXPORT_TEST(testTdf94456, "tdf94456.rtf") @@ -1614,33 +1760,41 @@ DECLARE_RTFEXPORT_TEST(testTdf94456, "tdf94456.rtf") // Paragraph left margin and first line indent wasn't imported correctly. // This was 1270. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(762), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(762), + getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); // This was -635. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-762), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-762), + getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); } DECLARE_RTFEXPORT_TEST(testTdf94435, "tdf94435.rtf") { // This was style::ParagraphAdjust_LEFT, \ltrpar undone the effect of \qc. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL( + style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); } DECLARE_RTFEXPORT_TEST(testTdf54584, "tdf54584.rtf") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumerationAccess> xFieldsAccess( + xTextFieldsSupplier->getTextFields()); uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); // \PAGE was ignored, so no fields were in document -> exception was thrown - CPPUNIT_ASSERT_NO_THROW_MESSAGE("No fields in document found: field \"\\PAGE\" was not properly read", - xFields->nextElement()); + CPPUNIT_ASSERT_NO_THROW_MESSAGE( + "No fields in document found: field \"\\PAGE\" was not properly read", + xFields->nextElement()); } DECLARE_RTFEXPORT_TEST(testTdf96308Deftab, "tdf96308-deftab.rtf") { uno::Reference<lang::XMultiServiceFactory> xTextFactory(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xDefaults(xTextFactory->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xDefaults( + xTextFactory->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY); // This was 1270 as \deftab was ignored on import. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(284)), getProperty<sal_Int32>(xDefaults, "TabStopDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(284)), + getProperty<sal_Int32>(xDefaults, "TabStopDistance")); } DECLARE_RTFEXPORT_TEST(testLandscape, "landscape.rtf") @@ -1655,8 +1809,8 @@ DECLARE_RTFEXPORT_TEST(testLandscape, "landscape.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); // check that the first page has landscape flag xCursor->jumpToFirstPage(); @@ -1680,12 +1834,15 @@ DECLARE_RTFEXPORT_TEST(testLandscape, "landscape.rtf") DECLARE_RTFEXPORT_TEST(testTdf97035, "tdf97035.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // First cell width of the second row should be 2299 uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators")[0] + .Position); } DECLARE_RTFEXPORT_TEST(testTdf87034, "tdf87034.rtf") @@ -1711,7 +1868,8 @@ DECLARE_RTFEXPORT_TEST(testClassificatonPasteLevels, "classification-confidentia DECLARE_RTFEXPORT_TEST(testTdf95707, "tdf95707.rtf") { // Graphic was replaced with a "Read-Error" placeholder. - CPPUNIT_ASSERT(getProperty<OUString>(getShape(1), "GraphicURL") != "vnd.sun.star.GraphicObject:0000000000000000000000000000000000000000"); + CPPUNIT_ASSERT(getProperty<OUString>(getShape(1), "GraphicURL") + != "vnd.sun.star.GraphicObject:0000000000000000000000000000000000000000"); } DECLARE_RTFEXPORT_TEST(testTdf96275, "tdf96275.rtf") @@ -1720,7 +1878,8 @@ DECLARE_RTFEXPORT_TEST(testTdf96275, "tdf96275.rtf") uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(3, xCell->getText()); // This was text: the shape's frame was part of the 1st paragraph instead of the 3rd one. - CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xParagraph, 1), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Frame"), + getProperty<OUString>(getRun(xParagraph, 1), "TextPortionType")); } DECLARE_RTFEXPORT_TEST(testTdf82073, "tdf82073.rtf") @@ -1736,11 +1895,13 @@ DECLARE_RTFEXPORT_TEST(testTdf74795, "tdf74795.rtf") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was 0, \trpaddl was ignored on import. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(635), getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(635), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); // Make sure that the scope of the default is only one row. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); } DECLARE_RTFEXPORT_TEST(testTdf77349, "tdf77349.rtf") @@ -1755,13 +1916,15 @@ DECLARE_RTFEXPORT_TEST(testTdf50821, "tdf50821.rtf") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was 0, \trpaddfl was mishandled on import. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(191), getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(191), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); } DECLARE_RTFEXPORT_TEST(testTdf100507, "tdf100507.rtf") { // This was 0: left margin of the first paragraph was lost on import. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6618), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6618), + getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } DECLARE_RTFEXPORT_TEST(testTdf44986, "tdf44986.rtf") @@ -1771,7 +1934,9 @@ DECLARE_RTFEXPORT_TEST(testTdf44986, "tdf44986.rtf") uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); // Check the first row of the table, it should have two cells (one separator). // This was 0: the first row had no separators, so it had only one cell, which was too wide. - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators") + .getLength()); } DECLARE_RTFEXPORT_TEST(testTdf90697, "tdf90697.rtf") @@ -1791,7 +1956,8 @@ DECLARE_RTFEXPORT_TEST(testTdf104317, "tdf104317.rtf") DECLARE_RTFEXPORT_TEST(testTdf104744, "tdf104744.rtf") { - auto xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); + auto xRules = getProperty<uno::Reference<container::XIndexAccess>>( + getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0)); // This was 0. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), aRule["IndentAt"].get<sal_Int32>()); @@ -1800,15 +1966,20 @@ DECLARE_RTFEXPORT_TEST(testTdf104744, "tdf104744.rtf") DECLARE_RTFEXPORT_TEST(testTdf105852, "tdf105852.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // All rows but last were merged -> there were only 2 rows CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xTableRows->getCount()); // The first row must have 4 cells. - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators") + .getLength()); // The third row must have 1 merged cell. - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(2), "TableColumnSeparators").getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(2), "TableColumnSeparators") + .getLength()); } DECLARE_RTFEXPORT_TEST(testTdf104287, "tdf104287.rtf") @@ -1822,12 +1993,14 @@ DECLARE_RTFEXPORT_TEST(testTdf104287, "tdf104287.rtf") DECLARE_RTFEXPORT_TEST(testTdf105729, "tdf105729.rtf") { // This was style::ParagraphAdjust_LEFT, \ltrpar undone the effect of \qc from style. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL( + style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); } DECLARE_RTFEXPORT_TEST(testTdf106694, "tdf106694.rtf") { - auto aTabs = getProperty< uno::Sequence<style::TabStop> >(getParagraph(1), "ParaTabStops"); + auto aTabs = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aTabs.getLength()); // This was 0, tab position was incorrect, looked like it was missing. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(14605), aTabs[0].Position); @@ -1836,7 +2009,8 @@ DECLARE_RTFEXPORT_TEST(testTdf106694, "tdf106694.rtf") DECLARE_RTFEXPORT_TEST(testTdf107116, "tdf107116.rtf") { // This was 0, upper border around text (and its distance) was missing. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(120)), getProperty<sal_Int32>(getParagraph(2), "TopBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(120)), + getProperty<sal_Int32>(getParagraph(2), "TopBorderDistance")); } DECLARE_RTFEXPORT_TEST(testTdf106950, "tdf106950.rtf") @@ -1845,10 +2019,11 @@ DECLARE_RTFEXPORT_TEST(testTdf106950, "tdf106950.rtf") // This was ParagraphAdjust_LEFT, trying to set CharShadingValue on a // paragraph style thrown an exception, and remaining properties were not // set. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL( + style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust"))); } - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index fbf63740f444..9c174450c95f 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -20,33 +20,44 @@ class Test : public SwModelTestBase { public: - Test() : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") {} + Test() + : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") + { + } }; DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt") { - CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), + getProperty<OUString>(getParagraph(2), "NumberingStyleName")); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XText> xFootnoteText; xFootnotes->getByIndex(0) >>= xFootnoteText; // This was green (0x00A800), the character property of the footnote character, not the footnote text - CPPUNIT_ASSERT_MESSAGE ("Footnote Text color",sal_Int32(0x000000) >= getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFootnoteText),1), "CharColor")); + CPPUNIT_ASSERT_MESSAGE( + "Footnote Text color", + sal_Int32(0x000000) >= getProperty<sal_Int32>( + getRun(getParagraphOfText(1, xFootnoteText), 1), "CharColor")); } DECLARE_RTFEXPORT_TEST(testTdf108949_footnote, "tdf108949_footnote.rtf") { - CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), + getProperty<OUString>(getParagraph(2), "NumberingStyleName")); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XFootnote> xFootnote; xFootnotes->getByIndex(0) >>= xFootnote; // The color of the footnote anchor was black (0x000000) - CPPUNIT_ASSERT_EQUAL_MESSAGE("Footnote Character color", sal_Int32(0xFF0000), getProperty< sal_Int32 >(xFootnote->getAnchor(), "CharColor") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Footnote Character color", sal_Int32(0xFF0000), + getProperty<sal_Int32>(xFootnote->getAnchor(), "CharColor")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index d3157b96c92b..fabf17d152e9 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -53,20 +53,26 @@ class Test : public SwModelTestBase { public: - Test() : SwModelTestBase("/sw/qa/extras/rtfimport/data/", "Rich Text Format") + Test() + : SwModelTestBase("/sw/qa/extras/rtfimport/data/", "Rich Text Format") { } protected: /// Copy&paste helper. - void paste(const OUString& aFilename, uno::Reference<text::XTextRange> const& xTextRange = uno::Reference<text::XTextRange>()) + void paste(const OUString& aFilename, uno::Reference<text::XTextRange> const& xTextRange + = uno::Reference<text::XTextRange>()) { - uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + uno::Reference<document::XFilter> xFilter( + m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); xImporter->setTargetDocument(mxComponent); uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2); aDescriptor[0].Name = "InputStream"; - SvStream* pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, StreamMode::WRITE); + SvStream* pStream = utl::UcbStreamHelper::CreateStream( + m_directories.getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, + StreamMode::WRITE); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); aDescriptor[0].Value <<= xStream; aDescriptor[1].Name = "InsertMode"; @@ -86,15 +92,18 @@ protected: DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf") { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY); // Negative ABSH should mean fixed size. CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xPropertySet, "SizeType")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(300)), getProperty<sal_Int32>(xPropertySet, "Height")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(300)), + getProperty<sal_Int32>(xPropertySet, "Height")); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); bool bFrameFound = false, bDrawFound = false; for (int i = 0; i < xDraws->getCount(); ++i) { @@ -110,15 +119,19 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf") if (i == 0) // Additionally, the frist frame should have double border at the bottom. - CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, getProperty<table::BorderLine2>(xPropertySet, "BottomBorder").LineStyle); + CPPUNIT_ASSERT_EQUAL( + table::BorderLineStyle::DOUBLE, + getProperty<table::BorderLine2>(xPropertySet, "BottomBorder").LineStyle); } else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape")) { // The older "drawing objects" syntax should be recognized. bDrawFound = true; xPropertySet.set(xServiceInfo, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "VertOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, + getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(xPropertySet, "VertOrientRelation")); } } CPPUNIT_ASSERT(bFrameFound); @@ -127,8 +140,10 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf") DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -146,8 +161,10 @@ DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf") DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(1) >>= aProps; // 2nd level @@ -168,17 +185,20 @@ DECLARE_RTFIMPORT_TEST(testTdf108951, "tdf108951.rtf") // re-order on export, but then this test would not pass anymore. // \ls2 was imported as WWNum1. - CPPUNIT_ASSERT_EQUAL(OUString("WWNum2"), getProperty<OUString>(getParagraph(1), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL(OUString("WWNum2"), + getProperty<OUString>(getParagraph(1), "NumberingStyleName")); } DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); int nAtCharacter = 0; for (int i = 0; i < xDraws->getCount(); ++i) { - if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AT_CHARACTER) + if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") + == text::TextContentAnchorType_AT_CHARACTER) nAtCharacter++; } // The image at the document start was ignored. @@ -186,14 +206,16 @@ DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf") // There should be 2 textboxes, not 4 uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf") { uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); // Encoding in the footnote was wrong. OUString aExpected(u"\u017Eivnost\u00ED\n"); @@ -202,7 +224,8 @@ DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf") DECLARE_RTFIMPORT_TEST(testFdo85812, "fdo85812.rtf") { - lang::Locale locale(getProperty<lang::Locale>(getRun(getParagraph(1), 1, "This "), "CharLocale")); + lang::Locale locale( + getProperty<lang::Locale>(getRun(getParagraph(1), 1, "This "), "CharLocale")); // the \lang inside the group was applied to CJK not Western CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); @@ -220,46 +243,54 @@ DECLARE_RTFIMPORT_TEST(testFdo85812, "fdo85812.rtf") locale = getProperty<lang::Locale>(getRun(getParagraph(4), 1, "CharGroup"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("ru"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("RU"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(4), 1, "CharGroup"), "CharLocaleComplex"); + locale + = getProperty<lang::Locale>(getRun(getParagraph(4), 1, "CharGroup"), "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("DZ"), locale.Country); locale = getProperty<lang::Locale>(getRun(getParagraph(4), 2, "AfterChar"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(4), 2, "AfterChar"), "CharLocaleComplex"); + locale + = getProperty<lang::Locale>(getRun(getParagraph(4), 2, "AfterChar"), "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("DZ"), locale.Country); locale = getProperty<lang::Locale>(getRun(getParagraph(5), 2, "AfterBookmark"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(5), 2, "AfterBookmark"), "CharLocaleComplex"); + locale = getProperty<lang::Locale>(getRun(getParagraph(5), 2, "AfterBookmark"), + "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("DZ"), locale.Country); // \ltrch \rtlch works differently - it is sticky across groups locale = getProperty<lang::Locale>(getRun(getParagraph(6), 1, "CharGroup"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(6), 1, "CharGroup"), "CharLocaleComplex"); + locale + = getProperty<lang::Locale>(getRun(getParagraph(6), 1, "CharGroup"), "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("DZ"), locale.Country); locale = getProperty<lang::Locale>(getRun(getParagraph(6), 2, "AfterChar"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(6), 2, "AfterChar"), "CharLocaleComplex"); + locale + = getProperty<lang::Locale>(getRun(getParagraph(6), 2, "AfterChar"), "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("EG"), locale.Country); locale = getProperty<lang::Locale>(getRun(getParagraph(7), 2, "AfterBookmark"), "CharLocale"); CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country); - locale = getProperty<lang::Locale>(getRun(getParagraph(7), 2, "AfterBookmark"), "CharLocaleComplex"); + locale = getProperty<lang::Locale>(getRun(getParagraph(7), 2, "AfterBookmark"), + "CharLocaleComplex"); CPPUNIT_ASSERT_EQUAL(OUString("ar"), locale.Language); CPPUNIT_ASSERT_EQUAL(OUString("EG"), locale.Country); } DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -278,17 +309,19 @@ DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf") DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf") { // inherited \fi should be reset - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), + getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent")); // but direct one not - CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-100)), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-100)), + getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); } DECLARE_OOXMLIMPORT_TEST(testTdf59699, "tdf59699.rtf") { // This resulted in a lang.IndexOutOfBoundsException: the referenced graphic data wasn't imported. uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY); - auto xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic"); + auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(xImage, "Graphic"); CPPUNIT_ASSERT(xGraphic.is()); } @@ -315,20 +348,28 @@ DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf") DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); for (int i = 0; i < xDraws->getCount(); ++i) { OUString aDescription = getProperty<OUString>(xDraws->getByIndex(i), "Description"); if (aDescription == "red") - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "green") - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "blue") - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), + getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "rect") { - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation")); + CPPUNIT_ASSERT_EQUAL( + text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL( + text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation")); } } } @@ -336,7 +377,8 @@ DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf") DECLARE_RTFIMPORT_TEST(testFdo52052, "fdo52052.rtf") { // Make sure the textframe containing the text "third" appears on the 3rd page. - CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("third"), + parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()")); } DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf") @@ -350,7 +392,8 @@ DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf") * msgbox oSegments(1).Count ' was 0x2000 | 10, should be 10 * msgbox oShape.Surround ' was 2, should be 1 */ - uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry"); + uno::Sequence<beans::PropertyValue> aProps + = getProperty<uno::Sequence<beans::PropertyValue>>(getShape(1), "CustomShapeGeometry"); uno::Sequence<beans::PropertyValue> aPathProps; for (int i = 0; i < aProps.getLength(); ++i) { @@ -366,7 +409,8 @@ DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf") rProp.Value >>= aSegments; } CPPUNIT_ASSERT_EQUAL(sal_Int16(10), aSegments[1].Count); - CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(getShape(1), "Surround")); + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, + getProperty<text::WrapTextMode>(getShape(1), "Surround")); } DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf") @@ -388,19 +432,23 @@ DECLARE_RTFIMPORT_TEST(testFdo48442, "fdo48442.rtf") { // The problem was that \pvmrg is the default in RTF, but not in Writer. uno::Reference<drawing::XShape> xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, + getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME } DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Negative left margin was ~missing, -191 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty<sal_Int32>(xTable, "LeftMargin")); // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width) uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators")[0] + .Position); } DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf") @@ -408,7 +456,8 @@ DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf") // There were two issues: the doc was of 2 pages and the picture was missing. CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // Two objects: a picture and a textframe. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); } @@ -416,10 +465,12 @@ DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf") DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf") { // Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text. - CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(getShape(1), "Surround")); + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, + getProperty<text::WrapTextMode>(getShape(1), "Surround")); uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); // Was 247, resulting in a table having width almost zero and height of 10+ pages. CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty<sal_Int32>(xTables->getByIndex(0), "Width")); } @@ -427,11 +478,14 @@ DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf") DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width) uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators")[0] + .Position); } DECLARE_RTFIMPORT_TEST(testTdf84684, "tdf84684.rtf") @@ -455,15 +509,18 @@ DECLARE_RTFIMPORT_TEST(testFdo81944, "fdo81944.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Segoe UI"), getProperty<OUString>(xStyle, "CharFontName")); CPPUNIT_ASSERT_EQUAL(9.0f, getProperty<float>(xStyle, "CharHeight")); // not sure if this should be set on Asian or Complex or both? - CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty<OUString>(xStyle, "CharFontNameComplex")); + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), + getProperty<OUString>(xStyle, "CharFontNameComplex")); CPPUNIT_ASSERT_EQUAL(11.0f, getProperty<float>(xStyle, "CharHeightComplex")); } DECLARE_RTFIMPORT_TEST(testSbkodd, "sbkodd.rtf") { uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), xCursor->getPage()); xCursor->jumpToNextPage(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), xCursor->getPage()); @@ -472,8 +529,10 @@ DECLARE_RTFIMPORT_TEST(testSbkodd, "sbkodd.rtf") DECLARE_RTFIMPORT_TEST(testSbkeven, "sbkeven.rtf") { uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), xCursor->getPage()); xCursor->jumpToNextPage(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), xCursor->getPage()); @@ -483,41 +542,47 @@ DECLARE_RTFIMPORT_TEST(testSbkeven, "sbkeven.rtf") DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf") { - CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "HoriOrient")); - CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "VertOrient")); + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, + getProperty<sal_Int16>(getShape(1), "HoriOrient")); + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, + getProperty<sal_Int16>(getShape(1), "VertOrient")); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "FrameIsAutomaticHeight")); } DECLARE_RTFIMPORT_TEST(testTdf96326, "tdf96326.rtf") { // Make sure this is not checked. - auto xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(1), 2), "Bookmark"); + auto xFormField + = getProperty<uno::Reference<text::XFormField>>(getRun(getParagraph(1), 2), "Bookmark"); uno::Reference<container::XNameContainer> xParameters = xFormField->getParameters(); // This was true, ffres=25 was interpreted as checked. CPPUNIT_ASSERT_EQUAL(false, bool(xParameters->hasElements())); // And this is checked. - xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(2), 2), "Bookmark"); + xFormField + = getProperty<uno::Reference<text::XFormField>>(getRun(getParagraph(2), 2), "Bookmark"); xParameters = xFormField->getParameters(); CPPUNIT_ASSERT_EQUAL(true, xParameters->getByName("Checkbox_Checked").get<bool>()); } DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf") { - uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry"); + uno::Sequence<beans::PropertyValue> aProps + = getProperty<uno::Sequence<beans::PropertyValue>>(getShape(1), "CustomShapeGeometry"); uno::Sequence<beans::PropertyValue> aPathProps; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "Path") - aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >(); + aPathProps = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); } uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates; for (int i = 0; i < aPathProps.getLength(); ++i) { const beans::PropertyValue& rProp = aPathProps[i]; if (rProp.Name == "Coordinates") - aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >(); + aCoordinates + = rProp.Value.get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>(); } // The first coordinate pair of this freeform shape was 286,0 instead of 0,286. CPPUNIT_ASSERT_EQUAL(sal_Int32(286), aCoordinates[0].Second.Value.get<sal_Int32>()); @@ -525,8 +590,10 @@ DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf") DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level awt::FontDescriptor aFont; @@ -545,7 +612,8 @@ DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf") DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // There should be a single groupshape with 2 children. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); uno::Reference<drawing::XShapes> xGroupshape(xDraws->getByIndex(0), uno::UNO_QUERY); @@ -555,7 +623,8 @@ DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf") DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), + uno::UNO_QUERY); // There should be a single groupshape with 2 children. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); uno::Reference<drawing::XShapes> xGroupshape(xDraws->getByIndex(0), uno::UNO_QUERY); @@ -566,7 +635,7 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf") { // Number of tabstops in the paragraph should be 2, was 3. uno::Sequence<style::TabStop> tabs( - getProperty< uno::Sequence<style::TabStop> >(getParagraph(1), "ParaTabStops")); + getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops")); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabs.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(5808), tabs[0].Position); CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[0].Alignment); @@ -579,39 +648,50 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf") DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Cell width of A2 was 554, should be 453/14846*10000 uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators")[0] + .Position); } DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xRows = xTable->getRows(); // The table only had 3 rows. CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xRows->getCount()); // This was 4999, i.e. the two cells of the row had equal widths instead of a larger and a smaller cell. - CPPUNIT_ASSERT_EQUAL(sal_Int16(5290), getProperty< uno::Sequence<text::TableColumnSeparator> >(xRows->getByIndex(2), "TableColumnSeparators")[0].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(5290), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xRows->getByIndex(2), "TableColumnSeparators")[0] + .Position); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY); // Paragraph was aligned to center, should be left. - CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, + static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>( + getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); } DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf") { // Vertical and horizontal orientation of the picture wasn't imported (was text::RelOrientation::FRAME). - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "VertOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, + getProperty<sal_Int16>(getShape(1), "VertOrientRelation")); } DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf") { // This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible. - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getShape(3), "FillStyle")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, + getProperty<drawing::FillStyle>(getShape(3), "FillStyle")); // This was a com.sun.star.drawing.CustomShape, which resulted in lack of word wrapping in the bugdoc. uno::Reference<beans::XPropertySet> xShapeProperties(getShape(1), uno::UNO_QUERY); @@ -633,16 +713,16 @@ DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt") paste("fdo68291-paste.rtf", xEnd); // This was "Standard", causing an unwanted page break on next paste. - CPPUNIT_ASSERT_EQUAL(uno::Any(), uno::Reference<beans::XPropertySet>(getParagraph(1), uno::UNO_QUERY)->getPropertyValue("PageDescName")); + CPPUNIT_ASSERT_EQUAL(uno::Any(), + uno::Reference<beans::XPropertySet>(getParagraph(1), uno::UNO_QUERY) + ->getPropertyValue("PageDescName")); } class testTdf105511 : public Test { protected: - virtual OUString getTestName() override - { - return OUString("testTdf105511"); - } + virtual OUString getTestName() override { return OUString("testTdf105511"); } + public: CPPUNIT_TEST_SUITE(testTdf105511); CPPUNIT_TEST(Import); @@ -650,7 +730,8 @@ public: void Import() { - struct DefaultLocale : public comphelper::ConfigurationProperty<DefaultLocale, rtl::OUString> + struct DefaultLocale + : public comphelper::ConfigurationProperty<DefaultLocale, rtl::OUString> { static OUString path() { @@ -679,7 +760,8 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(xParaSecond, "BreakType")); CPPUNIT_ASSERT_EQUAL(uno::Any(), - uno::Reference<beans::XPropertySet>(xParaSecond, uno::UNO_QUERY)->getPropertyValue("PageDescName")); + uno::Reference<beans::XPropertySet>(xParaSecond, uno::UNO_QUERY) + ->getPropertyValue("PageDescName")); // actually not sure how many paragraph there should be between // SECOND and THIRD - important is that the page break is on there uno::Reference<text::XTextRange> xParaNext = getParagraph(3); @@ -690,8 +772,8 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(xParaThird, "BreakType")); - CPPUNIT_ASSERT_EQUAL(uno::Any(), - uno::Reference<beans::XPropertySet>(xParaThird, uno::UNO_QUERY)->getPropertyValue("PageDescName")); + CPPUNIT_ASSERT_EQUAL(uno::Any(), uno::Reference<beans::XPropertySet>(xParaThird, uno::UNO_QUERY) + ->getPropertyValue("PageDescName")); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -706,43 +788,53 @@ DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf") DECLARE_RTFIMPORT_TEST(testFdo74823, "fdo74823.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Cell width of C2 was too large / column separator being 3749 too small (e.g. not set, around 3/7 of total width) uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(5391), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[2].Position); + CPPUNIT_ASSERT_EQUAL(sal_Int16(5391), getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators")[2] + .Position); } DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY); // Writer default styles weren't disabled, so the color was gray, not default (black). - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(xPropertySet, "CharColor")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), + getProperty<sal_Int32>(xPropertySet, "CharColor")); } DECLARE_RTFIMPORT_TEST(testColumnBreak, "column-break.rtf") { // Column break at the very start of the document was ignored. - CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); + CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, + getProperty<style::BreakType>(getParagraph(2), "BreakType")); } DECLARE_RTFIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.rtf") { uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), + uno::UNO_QUERY); // This was false, we ignored the relevant compat setting to make this non-last section unbalanced. - CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); + CPPUNIT_ASSERT_EQUAL(true, + getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); } DECLARE_RTFIMPORT_TEST(testOleInline, "ole-inline.rtf") { // Problem was that inline shape had at-page anchor. - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } DECLARE_RTFIMPORT_TEST(testFdo80742, "fdo80742.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); // This was 0, outline level was body text. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xPropertySet, "OutlineLevel")); } @@ -751,14 +843,16 @@ DECLARE_RTFIMPORT_TEST(testBehindDoc, "behind-doc.rtf") { // The problem was that "behind doc" didn't result in the shape being in the background, only in being wrapped as "through". uno::Reference<drawing::XShape> xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(xShape, "Surround")); + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, + getProperty<text::WrapTextMode>(xShape, "Surround")); // This was true. CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xShape, "Opaque")); } DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") { - uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); OUString aActual = xHeaderText->getString(); OUString const aExpected("First page header, section 2"); // This was 'Right page header, section 1'. @@ -768,11 +862,14 @@ DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") DECLARE_RTFIMPORT_TEST(testFdo44984, "fdo44984.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was Text, i.e. the checkbox field portion was missing. - CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStartEnd"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStartEnd"), + getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), + "TextPortionType")); } DECLARE_RTFIMPORT_TEST(testFdo82071, "fdo82071.rtf") @@ -789,37 +886,39 @@ DECLARE_RTFIMPORT_TEST(testFdo85179, "fdo85179.rtf") { // This was 0, border around the picture was ignored on import. // 360: EMU -> MM100 - CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800/360), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800 / 360), + getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth); } DECLARE_RTFIMPORT_TEST(testFdo82512, "fdo82512.rtf") { // This was style::BreakType_NONE, column break was before the 3rd paragraph, not before the 2nd one. - CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); + CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, + getProperty<style::BreakType>(getParagraph(2), "BreakType")); } DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf") { uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), + uno::UNO_QUERY); // This was false, last section was balanced, but it's unbalanced in Word. - CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); + CPPUNIT_ASSERT_EQUAL(true, + getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); } DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf") { // index mark was not imported uno::Reference<text::XDocumentIndexMark> xMark( - getProperty<uno::Reference<text::XDocumentIndexMark>>( - getRun(getParagraph(1), 1), - "DocumentIndexMark")); + getProperty<uno::Reference<text::XDocumentIndexMark>>(getRun(getParagraph(1), 1), + "DocumentIndexMark")); CPPUNIT_ASSERT(xMark.is()); CPPUNIT_ASSERT_EQUAL(OUString("Key the 1st"), getProperty<OUString>(xMark, "PrimaryKey")); // let's test toc entry too uno::Reference<text::XDocumentIndexMark> xTOCMark( - getProperty<uno::Reference<text::XDocumentIndexMark>>( - getRun(getParagraph(2), 1), - "DocumentIndexMark")); + getProperty<uno::Reference<text::XDocumentIndexMark>>(getRun(getParagraph(2), 1), + "DocumentIndexMark")); CPPUNIT_ASSERT(xTOCMark.is()); uno::Reference<lang::XServiceInfo> xTOCSI(xTOCMark, uno::UNO_QUERY); CPPUNIT_ASSERT(xTOCSI->supportsService("com.sun.star.text.ContentIndexMark")); @@ -829,9 +928,12 @@ DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf") DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, "cp950listleveltext1.rtf") { // suffix with Chinese only ( most common case generated by MSO2010 TC) - const sal_Unicode aExpectedSuffix[1] = { 0x3001 }; // This is a dot that is generally used as suffix of Chinese list number - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + const sal_Unicode aExpectedSuffix[1] + = { 0x3001 }; // This is a dot that is generally used as suffix of Chinese list number + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level @@ -844,7 +946,7 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext1, "cp950listleveltext1.rtf") aSuffix = rProp.Value.get<OUString>(); } // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). @@ -854,12 +956,14 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext2, "cp950listleveltext2.rtf") const sal_Unicode aExpectedPrefix[2] = { 0x524d, 0x7f6e }; const sal_Unicode aExpectedSuffix[3] = { 0x3001, 0x5f8c, 0x7f6e }; - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level - OUString aSuffix,aPrefix; + OUString aSuffix, aPrefix; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; @@ -870,11 +974,10 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext2, "cp950listleveltext2.rtf") aPrefix = rProp.Value.get<OUString>(); } // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } - // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ) DECLARE_RTFIMPORT_TEST(testCp950listleveltext3, "cp950listleveltext3.rtf") { @@ -882,12 +985,14 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext3, "cp950listleveltext3.rtf") const sal_Unicode aExpectedPrefix[4] = { 0x524d, 0x0061, 0x7f6e, 0x0062 }; const sal_Unicode aExpectedSuffix[6] = { 0x3001, 0x0063, 0x5f8c, 0x0064, 0x7f6e, 0x0065 }; - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level - OUString aSuffix,aPrefix; + OUString aSuffix, aPrefix; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; @@ -898,20 +1003,22 @@ DECLARE_RTFIMPORT_TEST(testCp950listleveltext3, "cp950listleveltext3.rtf") aPrefix = rProp.Value.get<OUString>(); } // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf") { const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 }; const sal_Unicode aExpectedSuffix[2] = { 0x0020, 0x7ae0 }; - uno::Reference< text::XChapterNumberingSupplier > xChapterNumberingSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference< container::XIndexAccess> xLevels(xChapterNumberingSupplier->getChapterNumberingRules()); + uno::Reference<text::XChapterNumberingSupplier> xChapterNumberingSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xChapterNumberingSupplier->getChapterNumberingRules()); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level - OUString aSuffix,aPrefix; + OUString aSuffix, aPrefix; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; @@ -921,15 +1028,16 @@ DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf") if (rProp.Name == "Prefix") aPrefix = rProp.Value.get<OUString>(); } - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); } DECLARE_RTFIMPORT_TEST(testTdf90046, "tdf90046.rtf") { // this was crashing on importing the footnote uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), + uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Ma"), xTextRange->getString()); } @@ -957,7 +1065,8 @@ DECLARE_RTFIMPORT_TEST(testFdo49893_3, "fdo49893-3.rtf") } // Correct wrapping for shape - CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(getShape(2), "Surround")); + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, + getProperty<text::WrapTextMode>(getShape(2), "Surround")); } DECLARE_RTFIMPORT_TEST(testWrapDistance, "wrap-distance.rtf") @@ -965,17 +1074,25 @@ DECLARE_RTFIMPORT_TEST(testWrapDistance, "wrap-distance.rtf") // Custom shape, handled directly in RTFSdrImport. uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShape->getShapeType()); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(xShape, "TopMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xShape, "BottomMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), getProperty<sal_Int32>(xShape, "LeftMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), getProperty<sal_Int32>(xShape, "RightMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), + getProperty<sal_Int32>(xShape, "TopMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), + getProperty<sal_Int32>(xShape, "BottomMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), + getProperty<sal_Int32>(xShape, "LeftMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), + getProperty<sal_Int32>(xShape, "RightMargin") / 1000); // Picture, handled in GraphicImport, shared with DOCX. xShape = getShape(2); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(xShape, "TopMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xShape, "BottomMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), getProperty<sal_Int32>(xShape, "LeftMargin") / 1000); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), getProperty<sal_Int32>(xShape, "RightMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), + getProperty<sal_Int32>(xShape, "TopMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), + getProperty<sal_Int32>(xShape, "BottomMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), + getProperty<sal_Int32>(xShape, "LeftMargin") / 1000); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), + getProperty<sal_Int32>(xShape, "RightMargin") / 1000); } DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf") @@ -990,10 +1107,13 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf") DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf") { uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), + uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextSection(xTextSections->getByIndex(0), uno::UNO_QUERY); // This was 0, but default should be 720 twips. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(xTextSection->getPropertyValue("TextColumns"), "AutomaticDistance")); + CPPUNIT_ASSERT_EQUAL( + static_cast<sal_Int32>(1270), + getProperty<sal_Int32>(xTextSection->getPropertyValue("TextColumns"), "AutomaticDistance")); } DECLARE_RTFIMPORT_TEST(testTdf59454, "tdf59454.rtf") @@ -1006,14 +1126,15 @@ DECLARE_RTFIMPORT_TEST(testTdf96308Tabpos, "tdf96308-tabpos.rtf") { // Get the tab stops of the second para in the B1 cell of the first table in the document. uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); xParaEnum->nextElement(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - auto aTabStops = getProperty< uno::Sequence<style::TabStop> >(xPara, "ParaTabStops"); + auto aTabStops = getProperty<uno::Sequence<style::TabStop>>(xPara, "ParaTabStops"); // This failed: tab stops were not deleted as direct formatting on the paragraph. CPPUNIT_ASSERT(!aTabStops.hasElements()); } @@ -1029,8 +1150,8 @@ DECLARE_RTFIMPORT_TEST(testLndscpsxn, "lndscpsxn.rtf") uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference<text::XPageCursor> xCursor( - xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), + uno::UNO_QUERY); // check that the first page has landscape flag xCursor->jumpToFirstPage(); @@ -1060,7 +1181,8 @@ DECLARE_RTFIMPORT_TEST(testLndscpsxn, "lndscpsxn.rtf") DECLARE_RTFIMPORT_TEST(testTdf99498, "tdf99498.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); // Table width was a tiny sub one char wide 145twips, it should now be a table wide // enough to see all the text in the first column without breaking into multiple lines @@ -1083,14 +1205,13 @@ DECLARE_RTFIMPORT_TEST(testClassificatonPaste, "hello.rtf") CPPUNIT_ASSERT_EQUAL(aOld, xText->getString()); } - #if !defined(MACOSX) && !defined(WNT) DECLARE_RTFIMPORT_TEST(testTdf90097, "tdf90097.rtf") { // Get the second child of the group shape. uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); - uno::Sequence< uno::Sequence<awt::Point> > aPolyPolySequence; + uno::Sequence<uno::Sequence<awt::Point>> aPolyPolySequence; xShape->getPropertyValue("PolyPolygon") >>= aPolyPolySequence; uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; // Vertical flip for the line shape was ignored, so Y coordinates were swapped. @@ -1112,28 +1233,34 @@ DECLARE_RTFIMPORT_TEST(testTdf91684, "tdf91684.rtf") DECLARE_RTFIMPORT_TEST(testFlip, "flip.rtf") { - comphelper::SequenceAsHashMap aMap = getProperty< uno::Sequence<beans::PropertyValue> >(getShapeByName("h-and-v"), "CustomShapeGeometry"); + comphelper::SequenceAsHashMap aMap = getProperty<uno::Sequence<beans::PropertyValue>>( + getShapeByName("h-and-v"), "CustomShapeGeometry"); // This resulted in a uno::RuntimeException, as MirroredX wasn't set at all, so could not extract void to boolean. CPPUNIT_ASSERT_EQUAL(true, aMap["MirroredX"].get<bool>()); CPPUNIT_ASSERT_EQUAL(true, aMap["MirroredY"].get<bool>()); - aMap = getProperty< uno::Sequence<beans::PropertyValue> >(getShapeByName("h-only"), "CustomShapeGeometry"); + aMap = getProperty<uno::Sequence<beans::PropertyValue>>(getShapeByName("h-only"), + "CustomShapeGeometry"); CPPUNIT_ASSERT_EQUAL(true, aMap["MirroredX"].get<bool>()); CPPUNIT_ASSERT(!aMap["MirroredY"].hasValue()); - aMap = getProperty< uno::Sequence<beans::PropertyValue> >(getShapeByName("v-only"), "CustomShapeGeometry"); + aMap = getProperty<uno::Sequence<beans::PropertyValue>>(getShapeByName("v-only"), + "CustomShapeGeometry"); CPPUNIT_ASSERT(!aMap["MirroredX"].hasValue()); CPPUNIT_ASSERT_EQUAL(true, aMap["MirroredY"].get<bool>()); - aMap = getProperty< uno::Sequence<beans::PropertyValue> >(getShapeByName("neither-h-nor-v"), "CustomShapeGeometry"); + aMap = getProperty<uno::Sequence<beans::PropertyValue>>(getShapeByName("neither-h-nor-v"), + "CustomShapeGeometry"); CPPUNIT_ASSERT(!aMap["MirroredX"].hasValue()); CPPUNIT_ASSERT(!aMap["MirroredY"].hasValue()); } DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf") { - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1sd level @@ -1152,7 +1279,8 @@ DECLARE_RTFIMPORT_TEST(testImportHeaderFooter, "tdf108055.rtf") // The RTF import sometimes added Header and Footer multiple Times // as well as added the Header to the document body. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); // Check if any Header or Footer text snuck into the TextBody @@ -1172,27 +1300,33 @@ DECLARE_RTFIMPORT_TEST(testImportHeaderFooter, "tdf108055.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Third Page"), value); //Check if Headers/Footers only contain what they should in this document - uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("First Page"), "HeaderText"); + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("First Page"), "HeaderText"); OUString aActual = xHeaderText->getString(); CPPUNIT_ASSERT_EQUAL(OUString("First Page Header"), aActual); - uno::Reference<text::XText> xHeaderTextLeft = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "HeaderTextLeft"); + uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "HeaderTextLeft"); aActual = xHeaderTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(OUString("Header even"), aActual); - uno::Reference<text::XText> xHeaderTextRight = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "HeaderTextRight"); + uno::Reference<text::XText> xHeaderTextRight = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "HeaderTextRight"); aActual = xHeaderTextRight->getString(); CPPUNIT_ASSERT_EQUAL(OUString("Header uneven"), aActual); - uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("First Page"), "FooterText"); + uno::Reference<text::XText> xFooterText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("First Page"), "FooterText"); aActual = xFooterText->getString(); CPPUNIT_ASSERT_EQUAL(OUString("First Page Footer"), aActual); - uno::Reference<text::XText> xFooterTextLeft = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "FooterTextLeft"); + uno::Reference<text::XText> xFooterTextLeft = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "FooterTextLeft"); aActual = xFooterTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(OUString("Footer even"), aActual); - uno::Reference<text::XText> xFooterTextRight = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "FooterTextRight"); + uno::Reference<text::XText> xFooterTextRight = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "FooterTextRight"); aActual = xFooterTextRight->getString(); CPPUNIT_ASSERT_EQUAL(OUString("Footer uneven"), aActual); } @@ -1203,7 +1337,8 @@ DECLARE_RTFIMPORT_TEST(testTdf108947, "tdf108947.rtf") CPPUNIT_ASSERT_EQUAL(2, getPages()); //Check if Headers/Footers contain what they should in this document - uno::Reference<text::XText> xHeaderTextRight = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "HeaderTextRight"); + uno::Reference<text::XText> xHeaderTextRight = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "HeaderTextRight"); OUString aActual = xHeaderTextRight->getString(); CPPUNIT_ASSERT_EQUAL(OUString(""), aActual); @@ -1212,7 +1347,8 @@ DECLARE_RTFIMPORT_TEST(testTdf108947, "tdf108947.rtf") OUString aExpected = SAL_NEWLINE_STRING; aExpected += SAL_NEWLINE_STRING; aExpected += "Header Page 2 ?"; - uno::Reference<text::XText> xHeaderTextLeft = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Default Style"), "HeaderTextLeft"); + uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Default Style"), "HeaderTextLeft"); aActual = xHeaderTextLeft->getString(); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); #endif diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 99fd13ab0a33..e56ec072faf0 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -40,10 +40,12 @@ using namespace ::com::sun::star; /// Glue class to call RtfImport as an internal filter, needed by copy&paste support. class SwRTFReader : public Reader { - ErrCode Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam, const OUString& rFileName) override; + ErrCode Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam, + const OUString& rFileName) override; }; -ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString& /*rFileName*/) +ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, + const OUString& /*rFileName*/) { if (!pStrm) return ERR_SWG_READ_ERROR; @@ -51,13 +53,14 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // We want to work in an empty paragraph. // Step 1: XTextRange will be updated when content is inserted, so we know // the end position. - const uno::Reference<text::XTextRange> xInsertPosition = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr); + const uno::Reference<text::XTextRange> xInsertPosition + = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr); std::shared_ptr<SwNodeIndex> pSttNdIdx(new SwNodeIndex(rDoc.GetNodes())); const SwPosition* pPos = rPam.GetPoint(); // Step 2: Split once and remember the node that has been split. rDoc.getIDocumentContentOperations().SplitNode(*pPos, false); - *pSttNdIdx = pPos->nNode.GetIndex()-1; + *pSttNdIdx = pPos->nNode.GetIndex() - 1; // Step 3: Split again. rDoc.getIDocumentContentOperations().SplitNode(*pPos, false); @@ -66,26 +69,28 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // Step 4: Insert all content into the new node rPam.Move(fnMoveBackward); - rDoc.SetTextFormatColl(rPam, rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false)); + rDoc.SetTextFormatColl( + rPam, rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false)); SwDocShell* pDocShell(rDoc.GetDocShell()); - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory()); - uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory( + comphelper::getProcessServiceFactory()); + uno::Reference<uno::XInterface> xInterface( + xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW); uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW); xImporter->setTargetDocument(xDstDoc); - const uno::Reference<text::XTextRange> xInsertTextRange = - SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr); + const uno::Reference<text::XTextRange> xInsertTextRange + = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr); uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( - { - { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(*pStrm))) }, - { "InsertMode", uno::Any(true) }, - { "TextInsertModeRange", uno::Any(xInsertTextRange) } - })); + { { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(*pStrm))) }, + { "InsertMode", uno::Any(true) }, + { "TextInsertModeRange", uno::Any(xInsertTextRange) } })); ErrCode ret = ERRCODE_NONE; try { @@ -107,7 +112,8 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // Revert the first split node. SwTextNode* pTextNode = pSttNdIdx->GetNode().GetTextNode(); SwNodeIndex aNxtIdx(*pSttNdIdx); - if (pTextNode && pTextNode->CanJoinNext(&aNxtIdx) && pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex()) + if (pTextNode && pTextNode->CanJoinNext(&aNxtIdx) + && pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex()) { // If the PaM points to the first new node, move the PaM to the // end of the previous node. @@ -135,7 +141,8 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // Revert the second split node. SwTextNode* pTextNode = pSttNdIdx2->GetNode().GetTextNode(); SwNodeIndex aPrevIdx(*pSttNdIdx2); - if (pTextNode && pTextNode->CanJoinPrev(&aPrevIdx) && pSttNdIdx2->GetIndex() - 1 == aPrevIdx.GetIndex()) + if (pTextNode && pTextNode->CanJoinPrev(&aPrevIdx) + && pSttNdIdx2->GetIndex() - 1 == aPrevIdx.GetIndex()) { // If the last new node isn't empty, convert the node's text // attributes into hints. Otherwise, set the new node's @@ -152,10 +159,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam return ret; } -extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF() -{ - return new SwRTFReader; -} +extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF() { return new SwRTFReader; } extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream) { @@ -164,8 +168,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream) SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL)); xDocSh->DoInitNew(); - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory()); - uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory( + comphelper::getProcessServiceFactory()); + uno::Reference<uno::XInterface> xInterface( + xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW); uno::Reference<lang::XComponent> xDstDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); @@ -173,9 +180,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream) uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( - { - { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(rStream))) } - })); + { { "InputStream", + uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(rStream))) } })); bool bRet = true; try { @@ -186,7 +192,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream) bRet = false; } return bRet; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 508b60e68d62..f8a7959ae161 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -87,7 +87,8 @@ using namespace ::com::sun::star; using namespace sw::util; -static OString OutTBLBorderLine(RtfExport const& rExport, const editeng::SvxBorderLine* pLine, const sal_Char* pStr) +static OString OutTBLBorderLine(RtfExport const& rExport, const editeng::SvxBorderLine* pLine, + const sal_Char* pStr) { OStringBuffer aRet; if (!pLine->isEmpty()) @@ -96,61 +97,62 @@ static OString OutTBLBorderLine(RtfExport const& rExport, const editeng::SvxBord // single line switch (pLine->GetBorderLineStyle()) { - case SvxBorderLineStyle::SOLID: - { - if (DEF_LINE_WIDTH_0 == pLine->GetWidth()) - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRHAIR); - else - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRS); - } - break; - case SvxBorderLineStyle::DOTTED: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDOT); - break; - case SvxBorderLineStyle::DASHED: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDASH); - break; - case SvxBorderLineStyle::DOUBLE: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDB); - break; - case SvxBorderLineStyle::THINTHICK_SMALLGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG); - break; - case SvxBorderLineStyle::THINTHICK_MEDIUMGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG); - break; - case SvxBorderLineStyle::THINTHICK_LARGEGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG); - break; - case SvxBorderLineStyle::THICKTHIN_SMALLGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG); - break; - case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG); - break; - case SvxBorderLineStyle::THICKTHIN_LARGEGAP: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG); - break; - case SvxBorderLineStyle::EMBOSSED: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDREMBOSS); - break; - case SvxBorderLineStyle::ENGRAVED: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE); - break; - case SvxBorderLineStyle::OUTSET: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDROUTSET); - break; - case SvxBorderLineStyle::INSET: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRINSET); - break; - case SvxBorderLineStyle::NONE: - default: - aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRNONE); + case SvxBorderLineStyle::SOLID: + { + if (DEF_LINE_WIDTH_0 == pLine->GetWidth()) + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRHAIR); + else + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRS); + } break; + case SvxBorderLineStyle::DOTTED: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDOT); + break; + case SvxBorderLineStyle::DASHED: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDASH); + break; + case SvxBorderLineStyle::DOUBLE: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDB); + break; + case SvxBorderLineStyle::THINTHICK_SMALLGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG); + break; + case SvxBorderLineStyle::THINTHICK_MEDIUMGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG); + break; + case SvxBorderLineStyle::THINTHICK_LARGEGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG); + break; + case SvxBorderLineStyle::THICKTHIN_SMALLGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG); + break; + case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG); + break; + case SvxBorderLineStyle::THICKTHIN_LARGEGAP: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG); + break; + case SvxBorderLineStyle::EMBOSSED: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDREMBOSS); + break; + case SvxBorderLineStyle::ENGRAVED: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE); + break; + case SvxBorderLineStyle::OUTSET: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDROUTSET); + break; + case SvxBorderLineStyle::INSET: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRINSET); + break; + case SvxBorderLineStyle::NONE: + default: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRNONE); + break; } - double const fConverted(::editeng::ConvertBorderWidthToWord(pLine->GetBorderLineStyle(), pLine->GetWidth())); - if (255 >= pLine->GetWidth()) // That value comes from RTF specs + double const fConverted( + ::editeng::ConvertBorderWidthToWord(pLine->GetBorderLineStyle(), pLine->GetWidth())); + if (255 >= pLine->GetWidth()) // That value comes from RTF specs { aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW).append(static_cast<sal_Int32>(fConverted)); } @@ -168,7 +170,8 @@ static OString OutTBLBorderLine(RtfExport const& rExport, const editeng::SvxBord } static OString OutBorderLine(RtfExport const& rExport, const editeng::SvxBorderLine* pLine, - const sal_Char* pStr, sal_uInt16 nDist, SvxShadowLocation eShadowLocation = SvxShadowLocation::NONE) + const sal_Char* pStr, sal_uInt16 nDist, + SvxShadowLocation eShadowLocation = SvxShadowLocation::NONE) { OStringBuffer aRet; aRet.append(OutTBLBorderLine(rExport, pLine, pStr)); @@ -205,18 +208,18 @@ void RtfAttributeOutput::RTLAndCJKState(bool bIsRTL, sal_uInt16 nScript) switch (nScript) { - case i18n::ScriptType::LATIN: - m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH); - break; - case i18n::ScriptType::ASIAN: - m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_DBCH); - break; - case i18n::ScriptType::COMPLEX: - /* noop */ - break; - default: - /* should not happen? */ - break; + case i18n::ScriptType::LATIN: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH); + break; + case i18n::ScriptType::ASIAN: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_DBCH); + break; + case i18n::ScriptType::COMPLEX: + /* noop */ + break; + default: + /* should not happen? */ + break; } } @@ -231,7 +234,8 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo // New cell/row? if (m_nTableDepth > 0 && !m_bTableCellOpen) { - ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner(pTextNodeInfo->getInnerForDepth(m_nTableDepth)); + ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( + pTextNodeInfo->getInnerForDepth(m_nTableDepth)); OSL_ENSURE(pDeepInner, "TableNodeInfoInner not found"); // Make sure we always start a row between ending one and starting a cell. // In case of subtables, we may not get the first cell. @@ -254,9 +258,11 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo if (nCurrentDepth > m_nTableDepth) { // Start all the tables that begin here - for (sal_uInt32 nDepth = m_nTableDepth + 1; nDepth <= pTextNodeInfo->getDepth(); ++nDepth) + for (sal_uInt32 nDepth = m_nTableDepth + 1; nDepth <= pTextNodeInfo->getDepth(); + ++nDepth) { - ww8::WW8TableNodeInfoInner::Pointer_t pInner(pTextNodeInfo->getInnerForDepth(nDepth)); + ww8::WW8TableNodeInfoInner::Pointer_t pInner( + pTextNodeInfo->getInnerForDepth(nDepth)); m_bLastTable = (nDepth == pTextNodeInfo->getDepth()); StartTable(); @@ -275,10 +281,13 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner) { bool bLastPara = false; - if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN || m_rExport.m_pDoc->IsClipBoard()) + if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN + || m_rExport.m_pDoc->IsClipBoard()) { // We're ending a paragraph that is the last paragraph of a footnote or endnote, or of clipboard. - bLastPara = m_rExport.m_nCurrentNodeIndex && m_rExport.m_nCurrentNodeIndex == m_rExport.m_pCurPam->End()->nNode.GetIndex(); + bLastPara + = m_rExport.m_nCurrentNodeIndex + && m_rExport.m_nCurrentNodeIndex == m_rExport.m_pCurPam->End()->nNode.GetIndex(); } FinishTableRowCell(pTextNodeInfoInner); @@ -313,7 +322,10 @@ void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTex void RtfAttributeOutput::EmptyParagraph() { - m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PAR).WriteChar(' '); + m_rExport.Strm() + .WriteCharPtr(SAL_NEWLINE_STRING) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PAR) + .WriteChar(' '); } void RtfAttributeOutput::SectionBreaks(const SwNode& rNode) @@ -333,14 +345,14 @@ void RtfAttributeOutput::SectionBreaks(const SwNode& rNode) if (aNextIndex.GetNode().IsTextNode()) { - const SwTextNode* pTextNode = static_cast< SwTextNode* >(&aNextIndex.GetNode()); + const SwTextNode* pTextNode = static_cast<SwTextNode*>(&aNextIndex.GetNode()); m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode); // Save the current page description for now, so later we will be able to access the previous one. m_pPrevPageDesc = pTextNode->FindPageDesc(); } else if (aNextIndex.GetNode().IsTableNode()) { - const SwTableNode* pTableNode = static_cast< SwTableNode* >(&aNextIndex.GetNode()); + const SwTableNode* pTableNode = static_cast<SwTableNode*>(&aNextIndex.GetNode()); const SwFrameFormat* pFormat = pTableNode->GetTable().GetFrameFormat(); m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode); } @@ -374,13 +386,17 @@ void RtfAttributeOutput::StartParagraphProperties() m_aSectionHeaders.append(aPar.makeStringAndClear()); } -void RtfAttributeOutput::EndParagraphProperties(const SfxItemSet& /*rParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/) +void RtfAttributeOutput::EndParagraphProperties( + const SfxItemSet& /*rParagraphMarkerProperties*/, const SwRedlineData* /*pRedlineData*/, + const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, + const SwRedlineData* /*pRedlineParagraphMarkerInserted*/) { m_aStyles.append(m_aStylesEnd.makeStringAndClear()); m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr()); } -void RtfAttributeOutput::StartRun(const SwRedlineData* pRedlineData, sal_Int32 /*nPos*/, bool bSingleEmptyRun) +void RtfAttributeOutput::StartRun(const SwRedlineData* pRedlineData, sal_Int32 /*nPos*/, + bool bSingleEmptyRun) { SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", bSingleEmptyRun: " << bSingleEmptyRun); @@ -421,22 +437,17 @@ void RtfAttributeOutput::RunText(const OUString& rText, rtl_TextEncoding /*eChar RawText(rText, m_rExport.m_eCurrentEncoding); } -OStringBuffer& RtfAttributeOutput::RunText() -{ - return m_aRunText.getLastBuffer(); -} +OStringBuffer& RtfAttributeOutput::RunText() { return m_aRunText.getLastBuffer(); } -OStringBuffer& RtfAttributeOutput::StylesEnd() -{ - return m_aStylesEnd; -} +OStringBuffer& RtfAttributeOutput::StylesEnd() { return m_aStylesEnd; } void RtfAttributeOutput::RawText(const OUString& rText, rtl_TextEncoding eCharSet) { m_aRunText->append(msfilter::rtfutil::OutString(rText, eCharSet)); } -void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, const SwFormatRuby& rRuby) +void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, + const SwFormatRuby& rRuby) { OUString aStr(FieldString(ww::eEQ)); aStr += "\\* jc"; @@ -444,28 +455,28 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, cons sal_Char cDirective = 0; switch (rRuby.GetAdjustment()) { - case css::text::RubyAdjust_LEFT: - nJC = 3; - cDirective = 'l'; - break; - case css::text::RubyAdjust_CENTER: - //defaults to 0 - break; - case css::text::RubyAdjust_RIGHT: - nJC = 4; - cDirective = 'r'; - break; - case css::text::RubyAdjust_BLOCK: - nJC = 1; - cDirective = 'd'; - break; - case css::text::RubyAdjust_INDENT_BLOCK: - nJC = 2; - cDirective = 'd'; - break; - default: - OSL_ENSURE(false,"Unhandled Ruby justication code"); - break; + case css::text::RubyAdjust_LEFT: + nJC = 3; + cDirective = 'l'; + break; + case css::text::RubyAdjust_CENTER: + //defaults to 0 + break; + case css::text::RubyAdjust_RIGHT: + nJC = 4; + cDirective = 'r'; + break; + case css::text::RubyAdjust_BLOCK: + nJC = 1; + cDirective = 'd'; + break; + case css::text::RubyAdjust_INDENT_BLOCK: + nJC = 2; + cDirective = 'd'; + break; + default: + OSL_ENSURE(false, "Unhandled Ruby justication code"); + break; } aStr += OUString::number(nJC); @@ -485,10 +496,12 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, cons long nHeight; if (pFormat) { - const auto& rFont = ItemGet<SvxFontItem>(*pFormat, GetWhichOfScript(RES_CHRATR_FONT,nRubyScript)); + const auto& rFont + = ItemGet<SvxFontItem>(*pFormat, GetWhichOfScript(RES_CHRATR_FONT, nRubyScript)); sFamilyName = rFont.GetFamilyName(); - const auto& rHeight = ItemGet<SvxFontHeightItem>(*pFormat, GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); + const auto& rHeight = ItemGet<SvxFontHeightItem>( + *pFormat, GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); nHeight = rHeight.GetHeight(); } else @@ -498,13 +511,15 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, cons const SfxItemPool* pPool = rNode.GetSwAttrSet().GetPool(); pPool = pPool ? pPool : &m_rExport.m_pDoc->GetAttrPool(); - const auto& rFont = DefaultItemGet<SvxFontItem>(*pPool, GetWhichOfScript(RES_CHRATR_FONT,nRubyScript)); + const auto& rFont + = DefaultItemGet<SvxFontItem>(*pPool, GetWhichOfScript(RES_CHRATR_FONT, nRubyScript)); sFamilyName = rFont.GetFamilyName(); - const auto& rHeight = DefaultItemGet<SvxFontHeightItem>(*pPool, GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); + const auto& rHeight = DefaultItemGet<SvxFontHeightItem>( + *pPool, GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); nHeight = rHeight.GetHeight(); } - nHeight = (nHeight + 5)/10; + nHeight = (nHeight + 5) / 10; aStr += " \\* \"Font:"; aStr += sFamilyName; @@ -518,19 +533,20 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, cons aStr += "(\\s\\up "; if (pRubyText) - nRubyScript = g_pBreakIt->GetBreakIter()->getScriptType(rNode.GetText(), - pRubyText->GetStart()); + nRubyScript + = g_pBreakIt->GetBreakIter()->getScriptType(rNode.GetText(), pRubyText->GetStart()); else nRubyScript = i18n::ScriptType::ASIAN; const SwAttrSet& rSet = rNode.GetSwAttrSet(); - auto& rHeightItem = static_cast<const SvxFontHeightItem&>(rSet.Get(GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript))); - nHeight = (rHeightItem.GetHeight() + 10)/20-1; + auto& rHeightItem = static_cast<const SvxFontHeightItem&>( + rSet.Get(GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript))); + nHeight = (rHeightItem.GetHeight() + 10) / 20 - 1; aStr += OUString::number(nHeight); aStr += "("; EndRun(&rNode, nPos); m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::Start | FieldFlags::CmdStart); - aStr = rRuby.GetText(); + aStr = rRuby.GetText(); aStr += ")"; aStr += ","; m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::NONE); @@ -613,21 +629,26 @@ void RtfAttributeOutput::Redline(const SwRedlineData* pRedline) { m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVISED); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVAUTH); - m_aRun->append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); + m_aRun->append( + (sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVDTTM); } else if (pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE) { m_aRun->append(OOO_STRING_SVTOOLS_RTF_DELETED); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVAUTHDEL); - m_aRun->append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); + m_aRun->append( + (sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVDTTMDEL); } m_aRun->append((sal_Int32)sw::ms::DateTime2DTTM(pRedline->GetTimeStamp())); m_aRun->append(' '); } -void RtfAttributeOutput::FormatDrop(const SwTextNode& /*rNode*/, const SwFormatDrop& /*rSwFormatDrop*/, sal_uInt16 /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t /*pTextNodeInfoInner*/) +void RtfAttributeOutput::FormatDrop(const SwTextNode& /*rNode*/, + const SwFormatDrop& /*rSwFormatDrop*/, sal_uInt16 /*nStyle*/, + ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, + ww8::WW8TableNodeInfoInner::Pointer_t /*pTextNodeInfoInner*/) { SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); } @@ -646,7 +667,8 @@ void RtfAttributeOutput::ParagraphStyle(sal_uInt16 nStyle) m_aSectionHeaders.append(aStyle.makeStringAndClear()); } -void RtfAttributeOutput::TableInfoCell(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) +void RtfAttributeOutput::TableInfoCell( + ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) { m_aStyles.append(OOO_STRING_SVTOOLS_RTF_INTBL); if (m_nTableDepth > 1) @@ -662,7 +684,8 @@ void RtfAttributeOutput::TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t /*pT /* noop */ } -void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableDefinition( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { InitTableHelper(pTableTextNodeInfoInner); @@ -677,20 +700,16 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p // Cell margins const SvxBoxItem& rBox = pFormat->GetBox(); - static const SvxBoxItemLine aBorders[] = - { - SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT - }; + static const SvxBoxItemLine aBorders[] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; - static const char* aRowPadNames[] = - { - OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR - }; + static const char* aRowPadNames[] + = { OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, + OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR }; - static const char* aRowPadUnits[] = - { - OOO_STRING_SVTOOLS_RTF_TRPADDFT, OOO_STRING_SVTOOLS_RTF_TRPADDFL, OOO_STRING_SVTOOLS_RTF_TRPADDFB, OOO_STRING_SVTOOLS_RTF_TRPADDFR - }; + static const char* aRowPadUnits[] + = { OOO_STRING_SVTOOLS_RTF_TRPADDFT, OOO_STRING_SVTOOLS_RTF_TRPADDFL, + OOO_STRING_SVTOOLS_RTF_TRPADDFB, OOO_STRING_SVTOOLS_RTF_TRPADDFR }; for (int i = 0; i < 4; ++i) { @@ -702,7 +721,7 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p // The cell-dependent properties const SwWriteTableRows& aRows = m_pTableWrt->GetRows(); - SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ]; + SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()]; SwTwips nSz = 0; Point aPt; SwRect aRect(pFormat->FindLayoutRect(false, &aPt)); @@ -712,12 +731,13 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p if (0 == nPageSize) { const SwNode* pNode = pTableTextNodeInfoInner->getNode(); - const SwFrameFormat* pFrameFormat = GetExport().m_pParentFrame ? &GetExport().m_pParentFrame->GetFrameFormat() : - GetExport().m_pDoc->GetPageDesc(0).GetPageFormatOfNode(*pNode, false); + const SwFrameFormat* pFrameFormat + = GetExport().m_pParentFrame + ? &GetExport().m_pParentFrame->GetFrameFormat() + : GetExport().m_pDoc->GetPageDesc(0).GetPageFormatOfNode(*pNode, false); const SvxLRSpaceItem& rLR = pFrameFormat->GetLRSpace(); - nPageSize = pFrameFormat->GetFrameSize().GetWidth() - - rLR.GetLeft() - rLR.GetRight(); + nPageSize = pFrameFormat->GetFrameSize().GetWidth() - rLR.GetLeft() - rLR.GetRight(); } SwTwips nTableSz = pFormat->GetFrameSize().GetWidth(); // Not using m_nTableDepth, which is not yet incremented here. @@ -725,7 +745,7 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p m_aCells[nCurrentDepth] = pRow->GetCells().size(); for (sal_uInt32 i = 0; i < m_aCells[nCurrentDepth]; i++) { - const SwWriteTableCell* const pCell = pRow->GetCells()[ i ].get(); + const SwWriteTableCell* const pCell = pRow->GetCells()[i].get(); const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat(); pTableTextNodeInfoInner->setCell(i); @@ -742,7 +762,8 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p } } -void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableDefaultBorders( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { /* * The function name is a bit misleading: given that we write borders @@ -752,31 +773,27 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer */ const SwWriteTableRows& aRows = m_pTableWrt->GetRows(); - SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ]; - const SwWriteTableCell* const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get(); + SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()]; + const SwWriteTableCell* const pCell + = pRow->GetCells()[pTableTextNodeInfoInner->getCell()].get(); const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat(); const SfxPoolItem* pItem; if (pCellFormat->GetAttrSet().HasItem(RES_BOX, &pItem)) { auto& rBox = static_cast<const SvxBoxItem&>(*pItem); - static const SvxBoxItemLine aBorders[] = - { - SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT - }; - static const char* aBorderNames[] = - { - OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR - }; + static const SvxBoxItemLine aBorders[] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; + static const char* aBorderNames[] + = { OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, + OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR }; //Yes left and top are swapped with eachother for cell padding! Because //that's what the thundering annoying rtf export/import word xp does. - static const char* aCellPadNames[] = - { - OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR - }; - static const char* aCellPadUnits[] = - { - OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR - }; + static const char* aCellPadNames[] + = { OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, + OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR }; + static const char* aCellPadUnits[] + = { OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, + OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR }; for (int i = 0; i < 4; ++i) { if (const editeng::SvxBorderLine* pLn = rBox.GetLine(aBorders[i])) @@ -792,11 +809,13 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer } } -void RtfAttributeOutput::TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableBackgrounds( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { const SwWriteTableRows& aRows = m_pTableWrt->GetRows(); - SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ]; - const SwWriteTableCell* const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get(); + SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()]; + const SwWriteTableCell* const pCell + = pRow->GetCells()[pTableTextNodeInfoInner->getCell()].get(); const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat(); const SfxPoolItem* pItem; if (pCellFormat->GetAttrSet().HasItem(RES_BACKGROUND, &pItem)) @@ -810,11 +829,13 @@ void RtfAttributeOutput::TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t } } -void RtfAttributeOutput::TableRowRedline(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) +void RtfAttributeOutput::TableRowRedline( + ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) { } -void RtfAttributeOutput::TableCellRedline(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) +void RtfAttributeOutput::TableCellRedline( + ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) { } @@ -831,14 +852,14 @@ void RtfAttributeOutput::TableHeight(ww8::WW8TableNodeInfoInner::Pointer_t pTabl switch (rLSz.GetHeightSizeType()) { - case ATT_FIX_SIZE: - nHeight = -rLSz.GetHeight(); - break; - case ATT_MIN_SIZE: - nHeight = rLSz.GetHeight(); - break; - default: - break; + case ATT_FIX_SIZE: + nHeight = -rLSz.GetHeight(); + break; + case ATT_MIN_SIZE: + nHeight = rLSz.GetHeight(); + break; + default: + break; } if (nHeight) @@ -849,7 +870,8 @@ void RtfAttributeOutput::TableHeight(ww8::WW8TableNodeInfoInner::Pointer_t pTabl } } -void RtfAttributeOutput::TableCanSplit(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableCanSplit( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { const SwTableBox* pTabBox = pTableTextNodeInfoInner->getTableBox(); const SwTableLine* pTabLine = pTabBox->GetUpper(); @@ -872,11 +894,13 @@ void RtfAttributeOutput::TableBidi(ww8::WW8TableNodeInfoInner::Pointer_t pTableT m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_RTLROW); } -void RtfAttributeOutput::TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableVerticalCell( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { const SwWriteTableRows& aRows = m_pTableWrt->GetRows(); - SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ]; - const SwWriteTableCell* const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get(); + SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()]; + const SwWriteTableCell* const pCell + = pRow->GetCells()[pTableTextNodeInfoInner->getCell()].get(); const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat(); const SfxPoolItem* pItem; @@ -890,15 +914,15 @@ void RtfAttributeOutput::TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t if (pCellFormat->GetAttrSet().HasItem(RES_VERT_ORIENT, &pItem)) switch (static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient()) { - case text::VertOrientation::CENTER: - m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALC); - break; - case text::VertOrientation::BOTTOM: - m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALB); - break; - default: - m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALT); - break; + case text::VertOrientation::CENTER: + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALC); + break; + case text::VertOrientation::BOTTOM: + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALB); + break; + default: + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALT); + break; } } @@ -910,7 +934,8 @@ void RtfAttributeOutput::TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_ FinishTableRowCell(pNodeInfoInner); } -void RtfAttributeOutput::TableOrientation(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) +void RtfAttributeOutput::TableOrientation( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { const SwTable* pTable = pTableTextNodeInfoInner->getTable(); SwFrameFormat* pFormat = pTable->GetFrameFormat(); @@ -918,41 +943,40 @@ void RtfAttributeOutput::TableOrientation(ww8::WW8TableNodeInfoInner::Pointer_t OStringBuffer aTableAdjust(OOO_STRING_SVTOOLS_RTF_TRQL); switch (pFormat->GetHoriOrient().GetHoriOrient()) { - case text::HoriOrientation::CENTER: - aTableAdjust.setLength(0); - aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQC); - break; - case text::HoriOrientation::RIGHT: - aTableAdjust.setLength(0); - aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQR); - break; - case text::HoriOrientation::NONE: - case text::HoriOrientation::LEFT_AND_WIDTH: - aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRLEFT); - aTableAdjust.append((sal_Int32)pFormat->GetLRSpace().GetLeft()); - break; - default: - break; + case text::HoriOrientation::CENTER: + aTableAdjust.setLength(0); + aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQC); + break; + case text::HoriOrientation::RIGHT: + aTableAdjust.setLength(0); + aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQR); + break; + case text::HoriOrientation::NONE: + case text::HoriOrientation::LEFT_AND_WIDTH: + aTableAdjust.append(OOO_STRING_SVTOOLS_RTF_TRLEFT); + aTableAdjust.append((sal_Int32)pFormat->GetLRSpace().GetLeft()); + break; + default: + break; } m_aRowDefs.append(aTableAdjust.makeStringAndClear()); } -void RtfAttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) +void RtfAttributeOutput::TableSpacing( + ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) { SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); } -void RtfAttributeOutput::TableRowEnd(sal_uInt32 /*nDepth*/) -{ - /* noop, see EndTableRow() */ -} +void RtfAttributeOutput::TableRowEnd(sal_uInt32 /*nDepth*/) { /* noop, see EndTableRow() */} /* * Our private table methods. */ -void RtfAttributeOutput::InitTableHelper(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) +void RtfAttributeOutput::InitTableHelper( + const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) { const SwTable* pTable = pTableTextNodeInfoInner->getTable(); if (m_pTableWrt && pTable == m_pTableWrt->GetTable()) @@ -971,7 +995,8 @@ void RtfAttributeOutput::InitTableHelper(const ww8::WW8TableNodeInfoInner::Point if (pLayout && pLayout->IsExportable()) m_pTableWrt = o3tl::make_unique<SwWriteTable>(pTable, pLayout); else - m_pTableWrt = o3tl::make_unique<SwWriteTable>(pTable, pTable->GetTabLines(), nPageSize, nTableSz, false); + m_pTableWrt = o3tl::make_unique<SwWriteTable>(pTable, pTable->GetTabLines(), nPageSize, + nTableSz, false); } void RtfAttributeOutput::StartTable() @@ -980,7 +1005,8 @@ void RtfAttributeOutput::StartTable() m_pTableWrt.reset(nullptr); } -void RtfAttributeOutput::StartTableRow(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) +void RtfAttributeOutput::StartTableRow( + const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) { sal_uInt32 nCurrentDepth = pTableTextNodeInfoInner->getDepth(); SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", (depth is " << nCurrentDepth << ")"); @@ -1000,12 +1026,10 @@ void RtfAttributeOutput::StartTableRow(const ww8::WW8TableNodeInfoInner::Pointer m_rExport.Strm().WriteCharPtr(m_aRowDefs.makeStringAndClear().getStr()); } -void RtfAttributeOutput::StartTableCell() -{ - m_bTableCellOpen = true; -} +void RtfAttributeOutput::StartTableCell() { m_bTableCellOpen = true; } -void RtfAttributeOutput::TableCellProperties(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) +void RtfAttributeOutput::TableCellProperties( + const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner) { TableDefaultBorders(pTableTextNodeInfoInner); TableBackgrounds(pTableTextNodeInfoInner); @@ -1044,7 +1068,8 @@ void RtfAttributeOutput::EndTableRow() if (m_nTableDepth > 1) { - m_aAfterRuns.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS); + m_aAfterRuns.append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS); if (!m_aRowDefs.isEmpty()) m_aAfterRuns.append(m_aRowDefs.makeStringAndClear()); else if (!m_aTables.empty()) @@ -1052,7 +1077,9 @@ void RtfAttributeOutput::EndTableRow() m_aAfterRuns.append(m_aTables.back()); m_aTables.pop_back(); } - m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_NESTROW "}" "{" OOO_STRING_SVTOOLS_RTF_NONESTTABLES OOO_STRING_SVTOOLS_RTF_PAR "}"); + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_NESTROW + "}" + "{" OOO_STRING_SVTOOLS_RTF_NONESTTABLES OOO_STRING_SVTOOLS_RTF_PAR "}"); } else { @@ -1108,7 +1135,10 @@ void RtfAttributeOutput::FinishTableRowCell(const ww8::WW8TableNodeInfoInner::Po void RtfAttributeOutput::StartStyles() { - m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLORTBL); + m_rExport.Strm() + .WriteCharPtr(SAL_NEWLINE_STRING) + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLORTBL); m_rExport.OutColorTable(); OSL_ENSURE(m_aStylesheet.getLength() == 0, "m_aStylesheet is not empty"); m_aStylesheet.append(SAL_NEWLINE_STRING); @@ -1123,13 +1153,10 @@ void RtfAttributeOutput::EndStyles(sal_uInt16 /*nNumberOfStyles*/) m_rExport.Strm().WriteChar('}'); } -void RtfAttributeOutput::DefaultStyle() -{ - /* noop, the default style is always 0 in RTF */ -} +void RtfAttributeOutput::DefaultStyle() { /* noop, the default style is always 0 in RTF */} -void RtfAttributeOutput::StartStyle(const OUString& rName, StyleType eType, - sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 /*nWwId*/, sal_uInt16 nId, +void RtfAttributeOutput::StartStyle(const OUString& rName, StyleType eType, sal_uInt16 nBase, + sal_uInt16 nNext, sal_uInt16 /*nWwId*/, sal_uInt16 nId, bool bAutoUpdate) { SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", rName = '" << rName << "'"); @@ -1174,10 +1201,7 @@ void RtfAttributeOutput::StartStyleProperties(bool /*bParProp*/, sal_uInt16 /*nS /* noop */ } -void RtfAttributeOutput::EndStyleProperties(bool /*bParProp*/) -{ - /* noop */ -} +void RtfAttributeOutput::EndStyleProperties(bool /*bParProp*/) { /* noop */} void RtfAttributeOutput::OutlineNumbering(sal_uInt8 nLvl) { @@ -1202,13 +1226,13 @@ void RtfAttributeOutput::SectionBreak(sal_uInt8 nC, const WW8_SepInfo* pSectionI { switch (nC) { - case msword::ColumnBreak: - m_nColBreakNeeded = true; - break; - case msword::PageBreak: - if (pSectionInfo) - m_rExport.SectionProperties(*pSectionInfo); - break; + case msword::ColumnBreak: + m_nColBreakNeeded = true; + break; + case msword::PageBreak: + if (pSectionInfo) + m_rExport.SectionProperties(*pSectionInfo); + break; } } @@ -1233,7 +1257,8 @@ void RtfAttributeOutput::SectionFormProtection(bool bProtected) m_aSectionBreaks.append((sal_Int32)!bProtected); } -void RtfAttributeOutput::SectionLineNumbering(sal_uLong /*nRestartNo*/, const SwLineNumberInfo& rLnNumInfo) +void RtfAttributeOutput::SectionLineNumbering(sal_uLong /*nRestartNo*/, + const SwLineNumberInfo& rLnNumInfo) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LINEMOD); m_rExport.OutLong(rLnNumInfo.GetCountBy()); @@ -1250,37 +1275,36 @@ void RtfAttributeOutput::SectionTitlePage() */ } -void RtfAttributeOutput::SectionPageBorders(const SwFrameFormat* pFormat, const SwFrameFormat* /*pFirstPageFormat*/) +void RtfAttributeOutput::SectionPageBorders(const SwFrameFormat* pFormat, + const SwFrameFormat* /*pFirstPageFormat*/) { const SvxBoxItem& rBox = pFormat->GetBox(); const editeng::SvxBorderLine* pLine = rBox.GetTop(); if (pLine) - m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, - OOO_STRING_SVTOOLS_RTF_PGBRDRT, + m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRT, rBox.GetDistance(SvxBoxItemLine::TOP))); pLine = rBox.GetBottom(); if (pLine) - m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, - OOO_STRING_SVTOOLS_RTF_PGBRDRB, + m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRB, rBox.GetDistance(SvxBoxItemLine::BOTTOM))); pLine = rBox.GetLeft(); if (pLine) - m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, - OOO_STRING_SVTOOLS_RTF_PGBRDRL, + m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRL, rBox.GetDistance(SvxBoxItemLine::LEFT))); pLine = rBox.GetRight(); if (pLine) - m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, - OOO_STRING_SVTOOLS_RTF_PGBRDRR, + m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRR, rBox.GetDistance(SvxBoxItemLine::RIGHT))); } void RtfAttributeOutput::SectionBiDi(bool bBiDi) { - m_rExport.Strm().WriteCharPtr(bBiDi ? OOO_STRING_SVTOOLS_RTF_RTLSECT : OOO_STRING_SVTOOLS_RTF_LTRSECT); + m_rExport.Strm().WriteCharPtr(bBiDi ? OOO_STRING_SVTOOLS_RTF_RTLSECT + : OOO_STRING_SVTOOLS_RTF_LTRSECT); } -void RtfAttributeOutput::SectionPageNumbering(sal_uInt16 nNumType, const ::boost::optional<sal_uInt16>& oPageRestartNumber) +void RtfAttributeOutput::SectionPageNumbering( + sal_uInt16 nNumType, const ::boost::optional<sal_uInt16>& oPageRestartNumber) { if (oPageRestartNumber) { @@ -1292,24 +1316,24 @@ void RtfAttributeOutput::SectionPageNumbering(sal_uInt16 nNumType, const ::boost const char* pStr = nullptr; switch (nNumType) { - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: - pStr = OOO_STRING_SVTOOLS_RTF_PGNUCLTR; - break; - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: - pStr = OOO_STRING_SVTOOLS_RTF_PGNLCLTR; - break; - case SVX_NUM_ROMAN_UPPER: - pStr = OOO_STRING_SVTOOLS_RTF_PGNUCRM; - break; - case SVX_NUM_ROMAN_LOWER: - pStr = OOO_STRING_SVTOOLS_RTF_PGNLCRM; - break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: + pStr = OOO_STRING_SVTOOLS_RTF_PGNUCLTR; + break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: + pStr = OOO_STRING_SVTOOLS_RTF_PGNLCLTR; + break; + case SVX_NUM_ROMAN_UPPER: + pStr = OOO_STRING_SVTOOLS_RTF_PGNUCRM; + break; + case SVX_NUM_ROMAN_LOWER: + pStr = OOO_STRING_SVTOOLS_RTF_PGNLCRM; + break; - case SVX_NUM_ARABIC: - pStr = OOO_STRING_SVTOOLS_RTF_PGNDEC; - break; + case SVX_NUM_ARABIC: + pStr = OOO_STRING_SVTOOLS_RTF_PGNDEC; + break; } if (pStr) m_aSectionBreaks.append(pStr); @@ -1326,21 +1350,21 @@ void RtfAttributeOutput::SectionType(sal_uInt8 nBreakCode) const char* sType = nullptr; switch (nBreakCode) { - case 1: - sType = OOO_STRING_SVTOOLS_RTF_SBKCOL; - break; - case 2: - sType = OOO_STRING_SVTOOLS_RTF_SBKPAGE; - break; - case 3: - sType = OOO_STRING_SVTOOLS_RTF_SBKEVEN; - break; - case 4: - sType = OOO_STRING_SVTOOLS_RTF_SBKODD; - break; - default: - sType = OOO_STRING_SVTOOLS_RTF_SBKNONE; - break; + case 1: + sType = OOO_STRING_SVTOOLS_RTF_SBKCOL; + break; + case 2: + sType = OOO_STRING_SVTOOLS_RTF_SBKPAGE; + break; + case 3: + sType = OOO_STRING_SVTOOLS_RTF_SBKEVEN; + break; + case 4: + sType = OOO_STRING_SVTOOLS_RTF_SBKODD; + break; + default: + sType = OOO_STRING_SVTOOLS_RTF_SBKNONE; + break; } m_aSectionBreaks.append(sType); if (!m_bBufferSectionBreaks) @@ -1359,7 +1383,10 @@ void RtfAttributeOutput::NumberingDefinition(sal_uInt16 nId, const SwNumRule& /* void RtfAttributeOutput::StartAbstractNumbering(sal_uInt16 nId) { - m_rExport.Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LIST).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID); + m_rExport.Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LIST) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID); m_rExport.OutULong(nId); m_nListId = nId; } @@ -1370,128 +1397,125 @@ void RtfAttributeOutput::EndAbstractNumbering() m_rExport.OutULong(m_nListId).WriteChar('}').WriteCharPtr(SAL_NEWLINE_STRING); } -void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, - sal_uInt16 nStart, - sal_uInt16 nNumberingType, - SvxAdjust eAdjust, - const sal_uInt8* pNumLvlPos, - sal_uInt8 nFollow, - const wwFont* pFont, - const SfxItemSet* pOutSet, - sal_Int16 nIndentAt, - sal_Int16 nFirstLineIndex, - sal_Int16 /*nListTabPos*/, - const OUString& rNumberingString, +void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, + sal_uInt16 nNumberingType, SvxAdjust eAdjust, + const sal_uInt8* pNumLvlPos, sal_uInt8 nFollow, + const wwFont* pFont, const SfxItemSet* pOutSet, + sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, + sal_Int16 /*nListTabPos*/, const OUString& rNumberingString, const SvxBrushItem* pBrush) { m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING); - if (nLevel > 8) // RTF knows only 9 levels - m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SOUTLVL); + if (nLevel > 8) // RTF knows only 9 levels + m_rExport.Strm() + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SOUTLVL); m_rExport.Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LISTLEVEL); sal_uInt16 nVal = 0; switch (nNumberingType) { - case SVX_NUM_ROMAN_UPPER: - nVal = 1; - break; - case SVX_NUM_ROMAN_LOWER: - nVal = 2; - break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: - nVal = 3; - break; - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: - nVal = 4; - break; - case SVX_NUM_FULL_WIDTH_ARABIC: - nVal=14; - break; - case SVX_NUM_CIRCLE_NUMBER: - nVal=18; - break; - case SVX_NUM_NUMBER_LOWER_ZH: - nVal=35; - if (pOutSet) - { - const SvxLanguageItem rlang = static_cast<const SvxLanguageItem&>(pOutSet->Get(RES_CHRATR_CJK_LANGUAGE)); - if (LANGUAGE_CHINESE_SIMPLIFIED == rlang.GetLanguage()) + case SVX_NUM_ROMAN_UPPER: + nVal = 1; + break; + case SVX_NUM_ROMAN_LOWER: + nVal = 2; + break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: + nVal = 3; + break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: + nVal = 4; + break; + case SVX_NUM_FULL_WIDTH_ARABIC: + nVal = 14; + break; + case SVX_NUM_CIRCLE_NUMBER: + nVal = 18; + break; + case SVX_NUM_NUMBER_LOWER_ZH: + nVal = 35; + if (pOutSet) { - nVal=39; + const SvxLanguageItem rlang + = static_cast<const SvxLanguageItem&>(pOutSet->Get(RES_CHRATR_CJK_LANGUAGE)); + if (LANGUAGE_CHINESE_SIMPLIFIED == rlang.GetLanguage()) + { + nVal = 39; + } } - } - break; - case SVX_NUM_NUMBER_UPPER_ZH: - nVal=38; - break; - case SVX_NUM_NUMBER_UPPER_ZH_TW: - nVal=34; - break; - case SVX_NUM_TIAN_GAN_ZH: - nVal=30; - break; - case SVX_NUM_DI_ZI_ZH: - nVal=31; - break; - case SVX_NUM_NUMBER_TRADITIONAL_JA: - nVal=16; - break; - case SVX_NUM_AIU_FULLWIDTH_JA: - nVal=20; - break; - case SVX_NUM_AIU_HALFWIDTH_JA: - nVal=12; - break; - case SVX_NUM_IROHA_FULLWIDTH_JA: - nVal=21; - break; - case SVX_NUM_IROHA_HALFWIDTH_JA: - nVal=13; - break; - case style::NumberingType::HANGUL_SYLLABLE_KO: - nVal = 24; - break;// ganada - case style::NumberingType::HANGUL_JAMO_KO: - nVal = 25; - break;// chosung - case style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO: - nVal = 24; - break; - case style::NumberingType::HANGUL_CIRCLED_JAMO_KO: - nVal = 25; - break; - case style::NumberingType::NUMBER_HANGUL_KO: - nVal = 41; - break; - case style::NumberingType::NUMBER_UPPER_KO: - nVal = 44; - break; + break; + case SVX_NUM_NUMBER_UPPER_ZH: + nVal = 38; + break; + case SVX_NUM_NUMBER_UPPER_ZH_TW: + nVal = 34; + break; + case SVX_NUM_TIAN_GAN_ZH: + nVal = 30; + break; + case SVX_NUM_DI_ZI_ZH: + nVal = 31; + break; + case SVX_NUM_NUMBER_TRADITIONAL_JA: + nVal = 16; + break; + case SVX_NUM_AIU_FULLWIDTH_JA: + nVal = 20; + break; + case SVX_NUM_AIU_HALFWIDTH_JA: + nVal = 12; + break; + case SVX_NUM_IROHA_FULLWIDTH_JA: + nVal = 21; + break; + case SVX_NUM_IROHA_HALFWIDTH_JA: + nVal = 13; + break; + case style::NumberingType::HANGUL_SYLLABLE_KO: + nVal = 24; + break; // ganada + case style::NumberingType::HANGUL_JAMO_KO: + nVal = 25; + break; // chosung + case style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO: + nVal = 24; + break; + case style::NumberingType::HANGUL_CIRCLED_JAMO_KO: + nVal = 25; + break; + case style::NumberingType::NUMBER_HANGUL_KO: + nVal = 41; + break; + case style::NumberingType::NUMBER_UPPER_KO: + nVal = 44; + break; - case SVX_NUM_BITMAP: - case SVX_NUM_CHAR_SPECIAL: - nVal = 23; - break; - case SVX_NUM_NUMBER_NONE: - nVal = 255; - break; + case SVX_NUM_BITMAP: + case SVX_NUM_CHAR_SPECIAL: + nVal = 23; + break; + case SVX_NUM_NUMBER_NONE: + nVal = 255; + break; } m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELNFC); m_rExport.OutULong(nVal); switch (eAdjust) { - case SvxAdjust::Center: - nVal = 1; - break; - case SvxAdjust::Right: - nVal = 2; - break; - default: - nVal = 0; - break; + case SvxAdjust::Center: + nVal = 1; + break; + case SvxAdjust::Right: + nVal = 2; + break; + default: + nVal = 0; + break; } m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELJC); m_rExport.OutULong(nVal); @@ -1516,8 +1540,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, // leveltext group m_rExport.Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELTEXT).WriteChar(' '); - if (SVX_NUM_CHAR_SPECIAL == nNumberingType || - SVX_NUM_BITMAP == nNumberingType) + if (SVX_NUM_CHAR_SPECIAL == nNumberingType || SVX_NUM_BITMAP == nNumberingType) { m_rExport.Strm().WriteCharPtr("\\'01"); sal_Unicode cChar = rNumberingString[0]; @@ -1527,17 +1550,22 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, } else { - m_rExport.Strm().WriteCharPtr("\\'").WriteCharPtr(msfilter::rtfutil::OutHex(rNumberingString.getLength(), 2).getStr()); - m_rExport.Strm().WriteCharPtr(msfilter::rtfutil::OutString(rNumberingString, m_rExport.m_eDefaultEncoding, /*bUnicode =*/ false).getStr()); + m_rExport.Strm().WriteCharPtr("\\'").WriteCharPtr( + msfilter::rtfutil::OutHex(rNumberingString.getLength(), 2).getStr()); + m_rExport.Strm().WriteCharPtr(msfilter::rtfutil::OutString(rNumberingString, + m_rExport.m_eDefaultEncoding, + /*bUnicode =*/false) + .getStr()); } m_rExport.Strm().WriteCharPtr(";}"); // write the levelnumbers m_rExport.Strm().WriteCharPtr("{").WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS); - for (sal_uInt8 i = 0; i <= nLevel && pNumLvlPos[ i ]; ++i) + for (sal_uInt8 i = 0; i <= nLevel && pNumLvlPos[i]; ++i) { - m_rExport.Strm().WriteCharPtr("\\'").WriteCharPtr(msfilter::rtfutil::OutHex(pNumLvlPos[ i ], 2).getStr()); + m_rExport.Strm().WriteCharPtr("\\'").WriteCharPtr( + msfilter::rtfutil::OutHex(pNumLvlPos[i], 2).getStr()); } m_rExport.Strm().WriteCharPtr(";}"); @@ -1548,7 +1576,8 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_F); m_rExport.OutULong(m_rExport.m_aFontHelper.GetId(*pFont)); } - m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF); + m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN, + m_rExport.m_bExportModeRTF); m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr()); } @@ -1561,7 +1590,8 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, m_rExport.Strm().WriteChar('}'); } -void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode) +void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType, + const OUString& rFieldCmd, FieldFlags nMode) { // If there are no field instructions, don't export it as a field. bool bHasInstructions = !rFieldCmd.isEmpty(); @@ -1570,12 +1600,15 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType if (bHasInstructions) { m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD); - m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " "); - m_aRunText->append(msfilter::rtfutil::OutString(rFieldCmd, m_rExport.m_eCurrentEncoding)); + m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST + " "); + m_aRunText->append( + msfilter::rtfutil::OutString(rFieldCmd, m_rExport.m_eCurrentEncoding)); m_aRunText->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); } if (pField) - m_aRunText->append(msfilter::rtfutil::OutString(pField->ExpandField(true), m_rExport.m_eDefaultEncoding)); + m_aRunText->append(msfilter::rtfutil::OutString(pField->ExpandField(true), + m_rExport.m_eDefaultEncoding)); if (bHasInstructions) m_aRunText->append("}}"); } @@ -1584,10 +1617,12 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType if (FieldFlags::Start & nMode) { m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD); - m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " "); + m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST + " "); } if (bHasInstructions) - m_aRunText->append(msfilter::rtfutil::OutString(rFieldCmd, m_rExport.m_eCurrentEncoding)); + m_aRunText->append( + msfilter::rtfutil::OutString(rFieldCmd, m_rExport.m_eCurrentEncoding)); if (FieldFlags::End & nMode) { m_aRunText->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); @@ -1596,7 +1631,8 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType } } -void RtfAttributeOutput::WriteBookmarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds) +void RtfAttributeOutput::WriteBookmarks_Impl(std::vector<OUString>& rStarts, + std::vector<OUString>& rEnds) { for (const auto& rStart : rStarts) { @@ -1615,7 +1651,8 @@ void RtfAttributeOutput::WriteBookmarks_Impl(std::vector< OUString >& rStarts, s rEnds.clear(); } -void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds) +void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector<OUString>& rStarts, + std::vector<OUString>& rEnds) { for (const auto& rStart : rStarts) { @@ -1657,15 +1694,18 @@ void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rSta rEnds.clear(); } -void RtfAttributeOutput::WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, bool bTitlepg) +void RtfAttributeOutput::WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, + const sal_Char* pStr, bool bTitlepg) { OStringBuffer aSectionBreaks = m_aSectionBreaks; m_aSectionBreaks.setLength(0); RtfStringBuffer aRun = m_aRun; m_aRun.clear(); - m_aSectionHeaders.append(bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY : OOO_STRING_SVTOOLS_RTF_FOOTERY); - m_aSectionHeaders.append((sal_Int32)m_rExport.m_pAktPageDesc->GetMaster().GetULSpace().GetUpper()); + m_aSectionHeaders.append(bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY + : OOO_STRING_SVTOOLS_RTF_FOOTERY); + m_aSectionHeaders.append( + (sal_Int32)m_rExport.m_pAktPageDesc->GetMaster().GetULSpace().GetUpper()); if (bTitlepg) m_aSectionHeaders.append(OOO_STRING_SVTOOLS_RTF_TITLEPG); m_aSectionHeaders.append('{'); @@ -1681,8 +1721,8 @@ void RtfAttributeOutput::WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bo namespace { - -void lcl_TextFrameShadow(std::vector< std::pair<OString, OString> >& rFlyProperties, const SwFrameFormat& rFrameFormat) +void lcl_TextFrameShadow(std::vector<std::pair<OString, OString>>& rFlyProperties, + const SwFrameFormat& rFrameFormat) { const SvxShadowItem& aShadowItem = rFrameFormat.GetShadow(); if (aShadowItem.GetLocation() == SvxShadowLocation::NONE) @@ -1692,7 +1732,8 @@ void lcl_TextFrameShadow(std::vector< std::pair<OString, OString> >& rFlyPropert const Color& rColor = aShadowItem.GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. - rFlyProperties.push_back(std::make_pair<OString, OString>("shadowColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + rFlyProperties.push_back(std::make_pair<OString, OString>( + "shadowColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); // Twips -> points -> EMUs -- hacky, the intermediate step hides rounding errors on roundtrip. OString aShadowWidth = OString::number(sal_Int32(aShadowItem.GetWidth() / 20) * 12700); @@ -1700,25 +1741,25 @@ void lcl_TextFrameShadow(std::vector< std::pair<OString, OString> >& rFlyPropert OString aOffsetY; switch (aShadowItem.GetLocation()) { - case SvxShadowLocation::TopLeft: - aOffsetX = "-" + aShadowWidth; - aOffsetY = "-" + aShadowWidth; - break; - case SvxShadowLocation::TopRight: - aOffsetX = aShadowWidth; - aOffsetY = "-" + aShadowWidth; - break; - case SvxShadowLocation::BottomLeft: - aOffsetX = "-" + aShadowWidth; - aOffsetY = aShadowWidth; - break; - case SvxShadowLocation::BottomRight: - aOffsetX = aShadowWidth; - aOffsetY = aShadowWidth; - break; - case SvxShadowLocation::NONE: - case SvxShadowLocation::End: - break; + case SvxShadowLocation::TopLeft: + aOffsetX = "-" + aShadowWidth; + aOffsetY = "-" + aShadowWidth; + break; + case SvxShadowLocation::TopRight: + aOffsetX = aShadowWidth; + aOffsetY = "-" + aShadowWidth; + break; + case SvxShadowLocation::BottomLeft: + aOffsetX = "-" + aShadowWidth; + aOffsetY = aShadowWidth; + break; + case SvxShadowLocation::BottomRight: + aOffsetX = aShadowWidth; + aOffsetY = aShadowWidth; + break; + case SvxShadowLocation::NONE: + case SvxShadowLocation::End: + break; } if (!aOffsetX.isEmpty()) rFlyProperties.emplace_back("shadowOffsetX", aOffsetX); @@ -1726,7 +1767,8 @@ void lcl_TextFrameShadow(std::vector< std::pair<OString, OString> >& rFlyPropert rFlyProperties.emplace_back("shadowOffsetY", aOffsetY); } -void lcl_TextFrameRelativeSize(std::vector< std::pair<OString, OString> >& rFlyProperties, const SwFrameFormat& rFrameFormat) +void lcl_TextFrameRelativeSize(std::vector<std::pair<OString, OString>>& rFlyProperties, + const SwFrameFormat& rFrameFormat) { const SwFormatFrameSize& rSize = rFrameFormat.GetFrameSize(); @@ -1734,39 +1776,40 @@ void lcl_TextFrameRelativeSize(std::vector< std::pair<OString, OString> >& rFlyP const sal_uInt8 nWidthPercent = rSize.GetWidthPercent(); if (nWidthPercent && nWidthPercent != SwFormatFrameSize::SYNCED) { - rFlyProperties.push_back(std::make_pair<OString, OString>("pctHoriz", OString::number(nWidthPercent * 10))); + rFlyProperties.push_back( + std::make_pair<OString, OString>("pctHoriz", OString::number(nWidthPercent * 10))); OString aRelation; switch (rSize.GetWidthPercentRelation()) { - case text::RelOrientation::PAGE_FRAME: - aRelation = "1"; // page - break; - default: - aRelation = "0"; // margin - break; + case text::RelOrientation::PAGE_FRAME: + aRelation = "1"; // page + break; + default: + aRelation = "0"; // margin + break; } rFlyProperties.emplace_back(std::make_pair("sizerelh", aRelation)); } const sal_uInt8 nHeightPercent = rSize.GetHeightPercent(); if (nHeightPercent && nHeightPercent != SwFormatFrameSize::SYNCED) { - rFlyProperties.push_back(std::make_pair<OString, OString>("pctVert", OString::number(nHeightPercent * 10))); + rFlyProperties.push_back( + std::make_pair<OString, OString>("pctVert", OString::number(nHeightPercent * 10))); OString aRelation; switch (rSize.GetHeightPercentRelation()) { - case text::RelOrientation::PAGE_FRAME: - aRelation = "1"; // page - break; - default: - aRelation = "0"; // margin - break; + case text::RelOrientation::PAGE_FRAME: + aRelation = "1"; // page + break; + default: + aRelation = "0"; // margin + break; } rFlyProperties.emplace_back(std::make_pair("sizerelv", aRelation)); } } - } void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox) @@ -1804,7 +1847,7 @@ void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox) const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); - sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0; + sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0; sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; m_rExport.SaveData(nStt, nEnd); m_rExport.m_pParentFrame = &rFrame; @@ -1826,7 +1869,7 @@ void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox) m_rExport.m_pParentFrame = nullptr; - m_rExport.Strm().WriteChar('}'); // shptxt + m_rExport.Strm().WriteChar('}'); // shptxt if (bTextBox) { @@ -1843,328 +1886,374 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi switch (rFrame.GetWriterType()) { - case ww8::Frame::eTextBox: - { - // If this is a TextBox of a shape, then ignore: it's handled in RtfSdrExport::StartShape(). - if (RtfSdrExport::isTextBox(rFrame.GetFrameFormat())) - break; + case ww8::Frame::eTextBox: + { + // If this is a TextBox of a shape, then ignore: it's handled in RtfSdrExport::StartShape(). + if (RtfSdrExport::isTextBox(rFrame.GetFrameFormat())) + break; - OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty"); - m_rExport.m_pParentFrame = &rFrame; + OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty"); + m_rExport.m_pParentFrame = &rFrame; - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP); - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); + m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP); + m_rExport.Strm().WriteCharPtr( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); - // Shape properties. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("shapeType", OString::number(ESCHER_ShpInst_TextBox))); + // Shape properties. + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "shapeType", OString::number(ESCHER_ShpInst_TextBox))); - // When a frame has some low height, but automatically expanded due - // to lots of contents, this size contains the real size. - const Size aSize = rFrame.GetSize(); - m_pFlyFrameSize = &aSize; + // When a frame has some low height, but automatically expanded due + // to lots of contents, this size contains the real size. + const Size aSize = rFrame.GetSize(); + m_pFlyFrameSize = &aSize; - m_rExport.m_bOutFlyFrameAttrs = m_rExport.m_bRTFFlySyntax = true; - m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); + m_rExport.m_bOutFlyFrameAttrs = m_rExport.m_bRTFFlySyntax = true; + m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); - // Write ZOrder. - if (const SdrObject* pObject = rFrame.GetFrameFormat().FindRealSdrObject()) - { - m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPZ); - m_rExport.OutULong(pObject->GetOrdNum()); - } + // Write ZOrder. + if (const SdrObject* pObject = rFrame.GetFrameFormat().FindRealSdrObject()) + { + m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPZ); + m_rExport.OutULong(pObject->GetOrdNum()); + } - m_rExport.Strm().WriteCharPtr(m_aRunText.makeStringAndClear().getStr()); - m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr()); - m_rExport.m_bOutFlyFrameAttrs = m_rExport.m_bRTFFlySyntax = false; - m_pFlyFrameSize = nullptr; + m_rExport.Strm().WriteCharPtr(m_aRunText.makeStringAndClear().getStr()); + m_rExport.Strm().WriteCharPtr(m_aStyles.makeStringAndClear().getStr()); + m_rExport.m_bOutFlyFrameAttrs = m_rExport.m_bRTFFlySyntax = false; + m_pFlyFrameSize = nullptr; - const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); - lcl_TextFrameShadow(m_aFlyProperties, rFrameFormat); - lcl_TextFrameRelativeSize(m_aFlyProperties, rFrameFormat); + const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); + lcl_TextFrameShadow(m_aFlyProperties, rFrameFormat); + lcl_TextFrameRelativeSize(m_aFlyProperties, rFrameFormat); - for (std::pair<OString,OString>& rPair : m_aFlyProperties) - { - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{"); - m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " "); - m_rExport.Strm().WriteCharPtr(rPair.first.getStr()); - m_rExport.Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " "); - m_rExport.Strm().WriteCharPtr(rPair.second.getStr()); - m_rExport.Strm().WriteCharPtr("}}"); - } - m_aFlyProperties.clear(); + for (std::pair<OString, OString>& rPair : m_aFlyProperties) + { + m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{"); + m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " "); + m_rExport.Strm().WriteCharPtr(rPair.first.getStr()); + m_rExport.Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " "); + m_rExport.Strm().WriteCharPtr(rPair.second.getStr()); + m_rExport.Strm().WriteCharPtr("}}"); + } + m_aFlyProperties.clear(); - writeTextFrame(rFrame); + writeTextFrame(rFrame); - m_rExport.Strm().WriteChar('}'); // shpinst - m_rExport.Strm().WriteChar('}'); // shp + m_rExport.Strm().WriteChar('}'); // shpinst + m_rExport.Strm().WriteChar('}'); // shp - m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING); - } - break; - case ww8::Frame::eGraphic: - if (!rFrame.IsInline()) - { - m_rExport.m_pParentFrame = &rFrame; - m_rExport.m_bRTFFlySyntax = true; - m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); - m_rExport.m_bRTFFlySyntax = false; - m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE); - m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); - m_aRunText->append('}'); - m_rExport.m_pParentFrame = nullptr; + m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING); } - - if (pGrfNode) - m_aRunText.append(dynamic_cast<const SwFlyFrameFormat*>(&rFrame.GetFrameFormat()), pGrfNode); break; - case ww8::Frame::eDrawing: - { - const SdrObject* pSdrObj = rFrame.GetFrameFormat().FindRealSdrObject(); - if (pSdrObj) + case ww8::Frame::eGraphic: + if (!rFrame.IsInline()) + { + m_rExport.m_pParentFrame = &rFrame; + m_rExport.m_bRTFFlySyntax = true; + m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); + m_rExport.m_bRTFFlySyntax = false; + m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE); + m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true); + m_aRunText->append('}'); + m_rExport.m_pParentFrame = nullptr; + } + + if (pGrfNode) + m_aRunText.append(dynamic_cast<const SwFlyFrameFormat*>(&rFrame.GetFrameFormat()), + pGrfNode); + break; + case ww8::Frame::eDrawing: { - bool bSwapInPage = false; - if (!pSdrObj->GetPage()) + const SdrObject* pSdrObj = rFrame.GetFrameFormat().FindRealSdrObject(); + if (pSdrObj) { - if (SwDrawModel* pModel = m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel()) + bool bSwapInPage = false; + if (!pSdrObj->GetPage()) { - if (SdrPage* pPage = pModel->GetPage(0)) + if (SwDrawModel* pModel + = m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel()) { - bSwapInPage = true; - const_cast< SdrObject* >(pSdrObj)->SetPage(pPage); + if (SdrPage* pPage = pModel->GetPage(0)) + { + bSwapInPage = true; + const_cast<SdrObject*>(pSdrObj)->SetPage(pPage); + } } } - } - m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{"); - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_IGNORE); - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLDINST); - m_aRunText->append(" SHAPE "); - m_aRunText->append("}" "{" OOO_STRING_SVTOOLS_RTF_FLDRSLT); + m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{"); + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLDINST); + m_aRunText->append(" SHAPE "); + m_aRunText->append("}" + "{" OOO_STRING_SVTOOLS_RTF_FLDRSLT); - m_rExport.SdrExporter().AddSdrObject(*pSdrObj); + m_rExport.SdrExporter().AddSdrObject(*pSdrObj); - m_aRunText->append('}'); - m_aRunText->append('}'); + m_aRunText->append('}'); + m_aRunText->append('}'); - if (bSwapInPage) - const_cast< SdrObject* >(pSdrObj)->SetPage(nullptr); + if (bSwapInPage) + const_cast<SdrObject*>(pSdrObj)->SetPage(nullptr); + } } - } - break; - case ww8::Frame::eFormControl: - { - const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); - const SdrObject* pObject = rFrameFormat.FindRealSdrObject(); + break; + case ww8::Frame::eFormControl: + { + const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); + const SdrObject* pObject = rFrameFormat.FindRealSdrObject(); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_FIELD); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_FIELD); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST); - if (pObject && pObject->GetObjInventor() == SdrInventor::FmForm) - { - if (auto pFormObj = dynamic_cast<const SdrUnoObj*>(pObject)) + if (pObject && pObject->GetObjInventor() == SdrInventor::FmForm) { - const uno::Reference<awt::XControlModel>& xControlModel = pFormObj->GetUnoControlModel(); - uno::Reference< lang::XServiceInfo > xInfo(xControlModel, uno::UNO_QUERY); - if (xInfo.is()) + if (auto pFormObj = dynamic_cast<const SdrUnoObj*>(pObject)) { - uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY); - uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo(); - OUString sName; - if (xInfo->supportsService("com.sun.star.form.component.CheckBox")) + const uno::Reference<awt::XControlModel>& xControlModel + = pFormObj->GetUnoControlModel(); + uno::Reference<lang::XServiceInfo> xInfo(xControlModel, uno::UNO_QUERY); + if (xInfo.is()) { - - m_aRun->append(OUStringToOString(FieldString(ww::eFORMCHECKBOX), m_rExport.m_eCurrentEncoding)); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox - // checkbox size in half points, this seems to be always 20 - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHPS "20"); - - OUString aStr; - sName = "Name"; - if (xPropSetInfo->hasPropertyByName(sName)) + uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropSetInfo + = xPropSet->getPropertySetInfo(); + OUString sName; + if (xInfo->supportsService("com.sun.star.form.component.CheckBox")) { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - } + m_aRun->append(OUStringToOString(FieldString(ww::eFORMCHECKBOX), + m_rExport.m_eCurrentEncoding)); + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD + "{"); + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox + // checkbox size in half points, this seems to be always 20 + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHPS "20"); + + OUString aStr; + sName = "Name"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME + " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sName = "HelpText"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sName = "HelpF1Text"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sal_Int16 nTemp = 0; + xPropSet->getPropertyValue("DefaultState") >>= nTemp; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); + m_aRun->append((sal_Int32)nTemp); + xPropSet->getPropertyValue("State") >>= nTemp; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES); + m_aRun->append((sal_Int32)nTemp); - sName = "HelpText"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - } + m_aRun->append("}}"); - sName = "HelpF1Text"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); + // field result is empty, ffres already contains the form result + m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); } - - sal_Int16 nTemp = 0; - xPropSet->getPropertyValue("DefaultState") >>= nTemp; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); - m_aRun->append((sal_Int32)nTemp); - xPropSet->getPropertyValue("State") >>= nTemp; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES); - m_aRun->append((sal_Int32)nTemp); - - m_aRun->append("}}"); - - // field result is empty, ffres already contains the form result - m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); - } - else if (xInfo->supportsService("com.sun.star.form.component.TextField")) - { - OStringBuffer aBuf; - OString aStr; - OUString aTmp; - const sal_Char* pStr; - - m_aRun->append(OUStringToOString(FieldString(ww::eFORMTEXT), m_rExport.m_eCurrentEncoding)); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD " "); - for (int i = 0; i < 8; i++) aBuf.append((sal_Char)0x00); - xPropSet->getPropertyValue("Name") >>= aTmp; - aStr = OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding); - aBuf.append((sal_Char)aStr.getLength()); - aBuf.append(aStr); - aBuf.append((sal_Char)0x00); - xPropSet->getPropertyValue("DefaultText") >>= aTmp; - aStr = OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding); - aBuf.append((sal_Char)aStr.getLength()); - aBuf.append(aStr); - for (int i = 0; i < 11; i++) aBuf.append((sal_Char)0x00); - aStr = aBuf.makeStringAndClear(); - pStr = aStr.getStr(); - for (int i = 0; i < aStr.getLength(); i++, pStr++) - m_aRun->append(msfilter::rtfutil::OutHex(*pStr, 2)); - m_aRun->append('}'); - m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); - xPropSet->getPropertyValue("Text") >>= aTmp; - m_aRun->append(OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); - sName = "HelpText"; - if (xPropSetInfo->hasPropertyByName(sName)) + else if (xInfo->supportsService("com.sun.star.form.component.TextField")) { - xPropSet->getPropertyValue(sName) >>= aTmp; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); - m_aRun->append(OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding)); + OStringBuffer aBuf; + OString aStr; + OUString aTmp; + const sal_Char* pStr; + + m_aRun->append(OUStringToOString(FieldString(ww::eFORMTEXT), + m_rExport.m_eCurrentEncoding)); + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD + " "); + for (int i = 0; i < 8; i++) + aBuf.append((sal_Char)0x00); + xPropSet->getPropertyValue("Name") >>= aTmp; + aStr = OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding); + aBuf.append((sal_Char)aStr.getLength()); + aBuf.append(aStr); + aBuf.append((sal_Char)0x00); + xPropSet->getPropertyValue("DefaultText") >>= aTmp; + aStr = OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding); + aBuf.append((sal_Char)aStr.getLength()); + aBuf.append(aStr); + for (int i = 0; i < 11; i++) + aBuf.append((sal_Char)0x00); + aStr = aBuf.makeStringAndClear(); + pStr = aStr.getStr(); + for (int i = 0; i < aStr.getLength(); i++, pStr++) + m_aRun->append(msfilter::rtfutil::OutHex(*pStr, 2)); m_aRun->append('}'); - } - - sName = "HelpF1Text"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aTmp; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + xPropSet->getPropertyValue("Text") >>= aTmp; m_aRun->append(OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding)); m_aRun->append('}'); + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD + "{"); + sName = "HelpText"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aTmp; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun->append( + OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sName = "HelpF1Text"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aTmp; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun->append( + OUStringToOString(aTmp, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + m_aRun->append("}"); } - m_aRun->append("}"); - } - else if (xInfo->supportsService("com.sun.star.form.component.ListBox")) - { - OUString aStr; - uno::Sequence<sal_Int16> aIntSeq; - uno::Sequence<OUString> aStrSeq; - - m_aRun->append(OUStringToOString(FieldString(ww::eFORMDROPDOWN), m_rExport.m_eCurrentEncoding)); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX); - - xPropSet->getPropertyValue("DefaultSelection") >>= aIntSeq; - if (aIntSeq.getLength()) - { - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); - // a dropdown list can have only one 'selected item by default' - m_aRun->append((sal_Int32)aIntSeq[0]); - } - - xPropSet->getPropertyValue("SelectedItems") >>= aIntSeq; - if (aIntSeq.getLength()) + else if (xInfo->supportsService("com.sun.star.form.component.ListBox")) { - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES); - // a dropdown list can have only one 'currently selected item' - m_aRun->append((sal_Int32)aIntSeq[0]); + OUString aStr; + uno::Sequence<sal_Int16> aIntSeq; + uno::Sequence<OUString> aStrSeq; + + m_aRun->append(OUStringToOString(FieldString(ww::eFORMDROPDOWN), + m_rExport.m_eCurrentEncoding)); + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD + "{"); + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX); + + xPropSet->getPropertyValue("DefaultSelection") >>= aIntSeq; + if (aIntSeq.getLength()) + { + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); + // a dropdown list can have only one 'selected item by default' + m_aRun->append((sal_Int32)aIntSeq[0]); + } + + xPropSet->getPropertyValue("SelectedItems") >>= aIntSeq; + if (aIntSeq.getLength()) + { + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES); + // a dropdown list can have only one 'currently selected item' + m_aRun->append((sal_Int32)aIntSeq[0]); + } + + sName = "Name"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME + " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sName = "HelpText"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + sName = "HelpF1Text"; + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE + OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun->append( + OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); + m_aRun->append('}'); + } + + xPropSet->getPropertyValue("StringItemList") >>= aStrSeq; + sal_uInt32 nListItems = aStrSeq.getLength(); + for (sal_uInt32 i = 0; i < nListItems; i++) + m_aRun + ->append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL + " ") + .append( + OUStringToOString(aStrSeq[i], m_rExport.m_eCurrentEncoding)) + .append('}'); + + m_aRun->append("}}"); + + // field result is empty, ffres already contains the form result + m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); } - - sName = "Name"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - } - - sName = "HelpText"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - } - - sName = "HelpF1Text"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); - m_aRun->append(OUStringToOString(aStr, m_rExport.m_eCurrentEncoding)); - m_aRun->append('}'); - } - - xPropSet->getPropertyValue("StringItemList") >>= aStrSeq; - sal_uInt32 nListItems = aStrSeq.getLength(); - for (sal_uInt32 i = 0; i < nListItems; i++) - m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL " ") - .append(OUStringToOString(aStrSeq[i], m_rExport.m_eCurrentEncoding)).append('}'); - - m_aRun->append("}}"); - - // field result is empty, ffres already contains the form result - m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + else + SAL_INFO("sw.rtf", OSL_THIS_FUNC << " unhandled form control: '" + << xInfo->getImplementationName() + << "'"); + m_aRun->append('}'); } - else - SAL_INFO("sw.rtf", OSL_THIS_FUNC << " unhandled form control: '" << xInfo->getImplementationName()<< "'"); - m_aRun->append('}'); } } - } - m_aRun->append('}'); - } - break; - case ww8::Frame::eOle: - { - const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); - const SdrObject* pSdrObj = rFrameFormat.FindRealSdrObject(); - if (pSdrObj) + m_aRun->append('}'); + } + break; + case ww8::Frame::eOle: { - SwNodeIndex aIdx(*rFrameFormat.GetContent().GetContentIdx(), 1); - SwOLENode& rOLENd = *aIdx.GetNode().GetOLENode(); - FlyFrameOLE(dynamic_cast<const SwFlyFrameFormat*>(&rFrameFormat), rOLENd, rFrame.GetLayoutSize()); + const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); + const SdrObject* pSdrObj = rFrameFormat.FindRealSdrObject(); + if (pSdrObj) + { + SwNodeIndex aIdx(*rFrameFormat.GetContent().GetContentIdx(), 1); + SwOLENode& rOLENd = *aIdx.GetNode().GetOLENode(); + FlyFrameOLE(dynamic_cast<const SwFlyFrameFormat*>(&rFrameFormat), rOLENd, + rFrame.GetLayoutSize()); + } } - } - break; - default: - SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unknown type (" << (int)rFrame.GetWriterType() << ")"); break; + default: + SAL_INFO("sw.rtf", + OSL_THIS_FUNC << ": unknown type (" << (int)rFrame.GetWriterType() << ")"); + break; } } @@ -2172,18 +2261,18 @@ void RtfAttributeOutput::CharCaseMap(const SvxCaseMapItem& rCaseMap) { switch (rCaseMap.GetValue()) { - case SvxCaseMap::SmallCaps: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); - break; - case SvxCaseMap::Uppercase: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); - break; - default: // Something that rtf does not support - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); - m_aStyles.append((sal_Int32)0); - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); - m_aStyles.append((sal_Int32)0); - break; + case SvxCaseMap::SmallCaps: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); + break; + case SvxCaseMap::Uppercase: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); + break; + default: // Something that rtf does not support + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); + m_aStyles.append((sal_Int32)0); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); + m_aStyles.append((sal_Int32)0); + break; } } @@ -2206,17 +2295,17 @@ void RtfAttributeOutput::CharCrossedOut(const SvxCrossedOutItem& rCrossedOut) { switch (rCrossedOut.GetStrikeout()) { - case STRIKEOUT_NONE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); - m_aStyles.append((sal_Int32)0); - break; - case STRIKEOUT_DOUBLE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKED); - m_aStyles.append((sal_Int32)1); - break; - default: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); - break; + case STRIKEOUT_NONE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); + m_aStyles.append((sal_Int32)0); + break; + case STRIKEOUT_DOUBLE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKED); + m_aStyles.append((sal_Int32)1); + break; + default: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); + break; } } @@ -2234,7 +2323,8 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEscapement) const char* pUpDn; - SwTwips nH = static_cast<const SvxFontHeightItem&>(m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); + SwTwips nH + = static_cast<const SvxFontHeightItem&>(m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); if (0 < rEscapement.GetEsc()) pUpDn = OOO_STRING_SVTOOLS_RTF_UP; @@ -2254,7 +2344,7 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEscapement) } else if (DFLT_ESC_AUTO_SUB == nEsc) { - nEsc = - 100 + rEscapement.GetProportionalHeight(); + nEsc = -100 + rEscapement.GetProportionalHeight(); ++nProp; } @@ -2295,7 +2385,8 @@ void RtfAttributeOutput::CharFont(const SvxFontItem& rFont) // FIXME: this may be a tad expensive... but the charset needs to be // consistent with what wwFont::WriteRtf() does sw::util::FontMapExport aTmp(rFont.GetFamilyName()); - sal_uInt8 nWindowsCharset = sw::ms::rtl_TextEncodingToWinCharsetRTF(aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet()); + sal_uInt8 nWindowsCharset = sw::ms::rtl_TextEncodingToWinCharsetRTF( + aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet()); m_rExport.m_eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(nWindowsCharset); if (m_rExport.m_eCurrentEncoding == RTL_TEXTENCODING_DONTKNOW) m_rExport.m_eCurrentEncoding = m_rExport.m_eDefaultEncoding; @@ -2305,18 +2396,18 @@ void RtfAttributeOutput::CharFontSize(const SvxFontHeightItem& rFontSize) { switch (rFontSize.Which()) { - case RES_CHRATR_FONTSIZE: - m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_FS); - m_aStylesEnd.append((sal_Int32)(rFontSize.GetHeight() / 10)); - break; - case RES_CHRATR_CJK_FONTSIZE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FS); - m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10)); - break; - case RES_CHRATR_CTL_FONTSIZE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AFS); - m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10)); - break; + case RES_CHRATR_FONTSIZE: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_FS); + m_aStylesEnd.append((sal_Int32)(rFontSize.GetHeight() / 10)); + break; + case RES_CHRATR_CJK_FONTSIZE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FS); + m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10)); + break; + case RES_CHRATR_CTL_FONTSIZE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AFS); + m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10)); + break; } } @@ -2333,18 +2424,18 @@ void RtfAttributeOutput::CharLanguage(const SvxLanguageItem& rLanguage) { switch (rLanguage.Which()) { - case RES_CHRATR_LANGUAGE: - m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LANG); - m_aStylesEnd.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); - break; - case RES_CHRATR_CJK_LANGUAGE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LANGFE); - m_aStyles.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); - break; - case RES_CHRATR_CTL_LANGUAGE: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ALANG); - m_aStyles.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); - break; + case RES_CHRATR_LANGUAGE: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LANG); + m_aStylesEnd.append((sal_Int32) static_cast<sal_uInt16>(rLanguage.GetLanguage())); + break; + case RES_CHRATR_CJK_LANGUAGE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LANGFE); + m_aStyles.append((sal_Int32) static_cast<sal_uInt16>(rLanguage.GetLanguage())); + break; + case RES_CHRATR_CTL_LANGUAGE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ALANG); + m_aStyles.append((sal_Int32) static_cast<sal_uInt16>(rLanguage.GetLanguage())); + break; } } @@ -2371,59 +2462,59 @@ void RtfAttributeOutput::CharUnderline(const SvxUnderlineItem& rUnderline) bWord = static_cast<const SvxWordLineModeItem*>(pItem)->GetValue(); switch (rUnderline.GetLineStyle()) { - case LINESTYLE_SINGLE: - pStr = bWord ? OOO_STRING_SVTOOLS_RTF_ULW : OOO_STRING_SVTOOLS_RTF_UL; - break; - case LINESTYLE_DOUBLE: - pStr = OOO_STRING_SVTOOLS_RTF_ULDB; - break; - case LINESTYLE_NONE: - pStr = OOO_STRING_SVTOOLS_RTF_ULNONE; - break; - case LINESTYLE_DOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_ULD; - break; - case LINESTYLE_DASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASH; - break; - case LINESTYLE_DASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASHD; - break; - case LINESTYLE_DASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASHDD; - break; - case LINESTYLE_BOLD: - pStr = OOO_STRING_SVTOOLS_RTF_ULTH; - break; - case LINESTYLE_WAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULWAVE; - break; - case LINESTYLE_BOLDDOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHD; - break; - case LINESTYLE_BOLDDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASH; - break; - case LINESTYLE_LONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULLDASH; - break; - case LINESTYLE_BOLDLONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHLDASH; - break; - case LINESTYLE_BOLDDASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHD; - break; - case LINESTYLE_BOLDDASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHDD; - break; - case LINESTYLE_BOLDWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULHWAVE; - break; - case LINESTYLE_DOUBLEWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULULDBWAVE; - break; - default: - break; + case LINESTYLE_SINGLE: + pStr = bWord ? OOO_STRING_SVTOOLS_RTF_ULW : OOO_STRING_SVTOOLS_RTF_UL; + break; + case LINESTYLE_DOUBLE: + pStr = OOO_STRING_SVTOOLS_RTF_ULDB; + break; + case LINESTYLE_NONE: + pStr = OOO_STRING_SVTOOLS_RTF_ULNONE; + break; + case LINESTYLE_DOTTED: + pStr = OOO_STRING_SVTOOLS_RTF_ULD; + break; + case LINESTYLE_DASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASH; + break; + case LINESTYLE_DASHDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHD; + break; + case LINESTYLE_DASHDOTDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHDD; + break; + case LINESTYLE_BOLD: + pStr = OOO_STRING_SVTOOLS_RTF_ULTH; + break; + case LINESTYLE_WAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULWAVE; + break; + case LINESTYLE_BOLDDOTTED: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHD; + break; + case LINESTYLE_BOLDDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASH; + break; + case LINESTYLE_LONGDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULLDASH; + break; + case LINESTYLE_BOLDLONGDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHLDASH; + break; + case LINESTYLE_BOLDDASHDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHD; + break; + case LINESTYLE_BOLDDASHDOTDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHDD; + break; + case LINESTYLE_BOLDWAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULHWAVE; + break; + case LINESTYLE_DOUBLEWAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULULDBWAVE; + break; + default: + break; } if (pStr) @@ -2526,13 +2617,9 @@ void RtfAttributeOutput::CharWeightCTL(const SvxWeightItem& rWeight) m_aStyles.append((sal_Int32)0); } -void RtfAttributeOutput::CharBidiRTL(const SfxPoolItem& /*rItem*/) -{ -} +void RtfAttributeOutput::CharBidiRTL(const SfxPoolItem& /*rItem*/) {} -void RtfAttributeOutput::CharIdctHint(const SfxPoolItem& /*rItem*/) -{ -} +void RtfAttributeOutput::CharIdctHint(const SfxPoolItem& /*rItem*/) {} void RtfAttributeOutput::CharRotate(const SvxCharRotateItem& rRotate) { @@ -2560,7 +2647,7 @@ void RtfAttributeOutput::CharTwoLines(const SvxTwoLinesItem& rTwoLines) if (rTwoLines.GetValue()) { sal_Unicode cStart = rTwoLines.GetStartBracket(); - sal_Unicode cEnd = rTwoLines.GetEndBracket(); + sal_Unicode cEnd = rTwoLines.GetEndBracket(); sal_uInt16 nType; if (!cStart && !cEnd) @@ -2571,7 +2658,7 @@ void RtfAttributeOutput::CharTwoLines(const SvxTwoLinesItem& rTwoLines) nType = 3; else if ('[' == cStart || ']' == cEnd) nType = 2; - else // all other kind of brackets + else // all other kind of brackets nType = 1; m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TWOINONE); @@ -2590,15 +2677,15 @@ void RtfAttributeOutput::CharRelief(const SvxCharReliefItem& rRelief) const sal_Char* pStr; switch (rRelief.GetValue()) { - case FontRelief::Embossed: - pStr = OOO_STRING_SVTOOLS_RTF_EMBO; - break; - case FontRelief::Engraved: - pStr = OOO_STRING_SVTOOLS_RTF_IMPR; - break; - default: - pStr = nullptr; - break; + case FontRelief::Embossed: + pStr = OOO_STRING_SVTOOLS_RTF_EMBO; + break; + case FontRelief::Engraved: + pStr = OOO_STRING_SVTOOLS_RTF_IMPR; + break; + default: + pStr = nullptr; + break; } if (pStr) @@ -2612,9 +2699,12 @@ void RtfAttributeOutput::CharHidden(const SvxCharHiddenItem& rHidden) m_aStyles.append((sal_Int32)0); } -void RtfAttributeOutput::CharBorder(const editeng::SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow) +void RtfAttributeOutput::CharBorder(const editeng::SvxBorderLine* pAllBorder, + const sal_uInt16 nDist, const bool bShadow) { - m_aStyles.append(OutBorderLine(m_rExport, pAllBorder, OOO_STRING_SVTOOLS_RTF_CHBRDR, nDist, bShadow ? SvxShadowLocation::BottomRight : SvxShadowLocation::NONE)); + m_aStyles.append( + OutBorderLine(m_rExport, pAllBorder, OOO_STRING_SVTOOLS_RTF_CHBRDR, nDist, + bShadow ? SvxShadowLocation::BottomRight : SvxShadowLocation::NONE)); } void RtfAttributeOutput::CharHighlight(const SvxBrushItem& rBrush) @@ -2658,7 +2748,8 @@ void RtfAttributeOutput::WriteTextFootnoteNumStr(const SwFormatFootnote& rFootno if (rFootnote.GetNumStr().isEmpty()) m_aRun->append(OOO_STRING_SVTOOLS_RTF_CHFTN); else - m_aRun->append(msfilter::rtfutil::OutString(rFootnote.GetNumStr(), m_rExport.m_eCurrentEncoding)); + m_aRun->append( + msfilter::rtfutil::OutString(rFootnote.GetNumStr(), m_rExport.m_eCurrentEncoding)); } void RtfAttributeOutput::TextFootnote_Impl(const SwFormatFootnote& rFootnote) @@ -2688,8 +2779,7 @@ void RtfAttributeOutput::TextFootnote_Impl(const SwFormatFootnote& rFootnote) bool bSingleEmptyRunOrig = m_bSingleEmptyRun; m_bSingleEmptyRun = false; m_bBufferSectionHeaders = true; - m_rExport.WriteSpecialText(pIndex->GetIndex() + 1, - pIndex->GetNode().EndOfSectionIndex(), + m_rExport.WriteSpecialText(pIndex->GetIndex() + 1, pIndex->GetNode().EndOfSectionIndex(), !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN); m_bBufferSectionHeaders = false; m_bInRun = bInRunOrig; @@ -2709,28 +2799,27 @@ void RtfAttributeOutput::ParaLineSpacing_Impl(short nSpace, short nMulti) m_aStyles.append((sal_Int32)nSpace); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SLMULT); m_aStyles.append((sal_Int32)nMulti); - } void RtfAttributeOutput::ParaAdjust(const SvxAdjustItem& rAdjust) { switch (rAdjust.GetAdjust()) { - case SvxAdjust::Left: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QL); - break; - case SvxAdjust::Right: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QR); - break; - case SvxAdjust::BlockLine: - case SvxAdjust::Block: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QJ); - break; - case SvxAdjust::Center: - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QC); - break; - default: - break; + case SvxAdjust::Left: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QL); + break; + case SvxAdjust::Right: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QR); + break; + case SvxAdjust::BlockLine: + case SvxAdjust::Block: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QJ); + break; + case SvxAdjust::Center: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QC); + break; + default: + break; } } @@ -2750,32 +2839,33 @@ void RtfAttributeOutput::ParaWidows(const SvxWidowsItem& rWidows) void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) { - long nOffset = static_cast<const SvxLRSpaceItem&>(m_rExport.GetItem(RES_LR_SPACE)).GetTextLeft(); + long nOffset + = static_cast<const SvxLRSpaceItem&>(m_rExport.GetItem(RES_LR_SPACE)).GetTextLeft(); for (sal_uInt16 n = 0; n < rTabStop.Count(); n++) { - const SvxTabStop& rTS = rTabStop[ n ]; + const SvxTabStop& rTS = rTabStop[n]; if (SvxTabAdjust::Default != rTS.GetAdjustment()) { const char* pFill = nullptr; switch (rTS.GetFill()) { - case cDfltFillChar: - break; - - case '.': - pFill = OOO_STRING_SVTOOLS_RTF_TLDOT; - break; - case '_': - pFill = OOO_STRING_SVTOOLS_RTF_TLUL; - break; - case '-': - pFill = OOO_STRING_SVTOOLS_RTF_TLTH; - break; - case '=': - pFill = OOO_STRING_SVTOOLS_RTF_TLEQ; - break; - default: - break; + case cDfltFillChar: + break; + + case '.': + pFill = OOO_STRING_SVTOOLS_RTF_TLDOT; + break; + case '_': + pFill = OOO_STRING_SVTOOLS_RTF_TLUL; + break; + case '-': + pFill = OOO_STRING_SVTOOLS_RTF_TLTH; + break; + case '=': + pFill = OOO_STRING_SVTOOLS_RTF_TLEQ; + break; + default: + break; } if (pFill) m_aStyles.append(pFill); @@ -2783,17 +2873,17 @@ void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) const sal_Char* pAdjStr = nullptr; switch (rTS.GetAdjustment()) { - case SvxTabAdjust::Right: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQR; - break; - case SvxTabAdjust::Decimal: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQDEC; - break; - case SvxTabAdjust::Center: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQC; - break; - default: - break; + case SvxTabAdjust::Right: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQR; + break; + case SvxTabAdjust::Decimal: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQDEC; + break; + case SvxTabAdjust::Center: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQC; + break; + default: + break; } if (pAdjStr) m_aStyles.append(pAdjStr); @@ -2814,7 +2904,8 @@ void RtfAttributeOutput::ParaHyphenZone(const SvxHyphenZoneItem& rHyphenZone) m_aStyles.append(sal_Int32(rHyphenZone.IsHyphen())); } -void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 nLvl, sal_Int32 nNumId) +void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 nLvl, + sal_Int32 nNumId) { if (USHRT_MAX == nNumId || 0 == nNumId || nullptr == pTextNd) return; @@ -2824,7 +2915,8 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n if (!pRule || !pTextNd->IsInList()) return; - SAL_WARN_IF(pTextNd->GetActualListLevel() < 0 || pTextNd->GetActualListLevel() >= MAXLEVEL, "sw.rtf", "text node does not have valid list level"); + SAL_WARN_IF(pTextNd->GetActualListLevel() < 0 || pTextNd->GetActualListLevel() >= MAXLEVEL, + "sw.rtf", "text node does not have valid list level"); const SwNumFormat* pFormat = pRule->GetNumFormat(nLvl); if (!pFormat) @@ -2849,7 +2941,8 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n { OUString sText; - if (SVX_NUM_CHAR_SPECIAL == pFormat->GetNumberingType() || SVX_NUM_BITMAP == pFormat->GetNumberingType()) + if (SVX_NUM_CHAR_SPECIAL == pFormat->GetNumberingType() + || SVX_NUM_BITMAP == pFormat->GetNumberingType()) sText = OUString(pFormat->GetBulletChar()); else sText = pTextNd->GetNumString(); @@ -2866,7 +2959,7 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB); m_aStyles.append('}'); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL); - if (nLvl > 8) // RTF knows only 9 levels + if (nLvl > 8) // RTF knows only 9 levels { m_aStyles.append((sal_Int32)8); m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SOUTLVL); @@ -2879,11 +2972,10 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n else m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB "}"); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LS); - m_aStyles.append((sal_Int32)m_rExport.GetId(*pRule)+1); + m_aStyles.append((sal_Int32)m_rExport.GetId(*pRule) + 1); m_aStyles.append(' '); } FormatLRSpace(aLR); - } void RtfAttributeOutput::ParaScriptSpace(const SfxBoolItem& rScriptSpace) @@ -2909,22 +3001,22 @@ void RtfAttributeOutput::ParaVerticalAlign(const SvxParaVertAlignItem& rAlign) const char* pStr; switch (rAlign.GetValue()) { - case SvxParaVertAlignItem::Align::Top: - pStr = OOO_STRING_SVTOOLS_RTF_FAHANG; - break; - case SvxParaVertAlignItem::Align::Bottom: - pStr = OOO_STRING_SVTOOLS_RTF_FAVAR; - break; - case SvxParaVertAlignItem::Align::Center: - pStr = OOO_STRING_SVTOOLS_RTF_FACENTER; - break; - case SvxParaVertAlignItem::Align::Baseline: - pStr = OOO_STRING_SVTOOLS_RTF_FAROMAN; - break; + case SvxParaVertAlignItem::Align::Top: + pStr = OOO_STRING_SVTOOLS_RTF_FAHANG; + break; + case SvxParaVertAlignItem::Align::Bottom: + pStr = OOO_STRING_SVTOOLS_RTF_FAVAR; + break; + case SvxParaVertAlignItem::Align::Center: + pStr = OOO_STRING_SVTOOLS_RTF_FACENTER; + break; + case SvxParaVertAlignItem::Align::Baseline: + pStr = OOO_STRING_SVTOOLS_RTF_FAROMAN; + break; - default: - pStr = OOO_STRING_SVTOOLS_RTF_FAAUTO; - break; + default: + pStr = OOO_STRING_SVTOOLS_RTF_FAAUTO; + break; } m_aStyles.append(pStr); } @@ -2974,22 +3066,24 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace) else { m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LI); - m_aStyles.append((sal_Int32) rLRSpace.GetTextLeft()); + m_aStyles.append((sal_Int32)rLRSpace.GetTextLeft()); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RI); - m_aStyles.append((sal_Int32) rLRSpace.GetRight()); + m_aStyles.append((sal_Int32)rLRSpace.GetRight()); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LIN); - m_aStyles.append((sal_Int32) rLRSpace.GetTextLeft()); + m_aStyles.append((sal_Int32)rLRSpace.GetTextLeft()); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RIN); - m_aStyles.append((sal_Int32) rLRSpace.GetRight()); + m_aStyles.append((sal_Int32)rLRSpace.GetRight()); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FI); - m_aStyles.append((sal_Int32) rLRSpace.GetTextFirstLineOfst()); + m_aStyles.append((sal_Int32)rLRSpace.GetTextFirstLineOfst()); } } else if (m_rExport.m_bRTFFlySyntax) { // Wrap: top and bottom spacing, convert from twips to EMUs. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxWrapDistLeft", OString::number(rLRSpace.GetLeft() * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxWrapDistRight", OString::number(rLRSpace.GetRight() * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dxWrapDistLeft", OString::number(rLRSpace.GetLeft() * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dxWrapDistRight", OString::number(rLRSpace.GetRight() * 635))); } } @@ -3071,8 +3165,10 @@ void RtfAttributeOutput::FormatULSpace(const SvxULSpaceItem& rULSpace) else if (m_rExport.m_bRTFFlySyntax) { // Wrap: top and bottom spacing, convert from twips to EMUs. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyWrapDistTop", OString::number(rULSpace.GetUpper() * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyWrapDistBottom", OString::number(rULSpace.GetLower() * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dyWrapDistTop", OString::number(rULSpace.GetUpper() * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dyWrapDistBottom", OString::number(rULSpace.GetLower() * 635))); } } @@ -3084,9 +3180,9 @@ void RtfAttributeOutput::FormatSurround(const SwFormatSurround& rSurround) bool bGold = css::text::WrapTextMode_DYNAMIC == eSurround; if (bGold) eSurround = css::text::WrapTextMode_PARALLEL; - RTFSurround aMC(bGold, static_cast< sal_uInt8 >(eSurround)); + RTFSurround aMC(bGold, static_cast<sal_uInt8>(eSurround)); m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYMAINCNT); - m_aRunText->append((sal_Int32) aMC.GetValue()); + m_aRunText->append((sal_Int32)aMC.GetValue()); } else if (m_rExport.m_bOutFlyFrameAttrs && m_rExport.m_bRTFFlySyntax) { @@ -3095,21 +3191,21 @@ void RtfAttributeOutput::FormatSurround(const SwFormatSurround& rSurround) boost::optional<sal_Int32> oWrk; switch (rSurround.GetValue()) { - case css::text::WrapTextMode_NONE: - nWr = 1; // top and bottom - break; - case css::text::WrapTextMode_THROUGH: - nWr = 3; // none - break; - case css::text::WrapTextMode_PARALLEL: - nWr = 2; // around - oWrk = 0; // both sides - break; - case css::text::WrapTextMode_DYNAMIC: - default: - nWr = 2; // around - oWrk = 3; // largest - break; + case css::text::WrapTextMode_NONE: + nWr = 1; // top and bottom + break; + case css::text::WrapTextMode_THROUGH: + nWr = 3; // none + break; + case css::text::WrapTextMode_PARALLEL: + nWr = 2; // around + oWrk = 0; // both sides + break; + case css::text::WrapTextMode_DYNAMIC: + default: + nWr = 2; // around + oWrk = 3; // largest + break; } if (rSurround.IsContour()) @@ -3131,31 +3227,38 @@ void RtfAttributeOutput::FormatVertOrientation(const SwFormatVertOrient& rFlyVer { switch (rFlyVert.GetRelationOrient()) { - case text::RelOrientation::PAGE_FRAME: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posrelv", OString::number(1))); - break; - default: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posrelv", OString::number(2))); - m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBYPARA).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE); - break; + case text::RelOrientation::PAGE_FRAME: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posrelv", OString::number(1))); + break; + default: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posrelv", OString::number(2))); + m_rExport.Strm() + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBYPARA) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE); + break; } switch (rFlyVert.GetVertOrient()) { - case text::VertOrientation::TOP: - case text::VertOrientation::LINE_TOP: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posv", OString::number(1))); - break; - case text::VertOrientation::BOTTOM: - case text::VertOrientation::LINE_BOTTOM: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posv", OString::number(3))); - break; - case text::VertOrientation::CENTER: - case text::VertOrientation::LINE_CENTER: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posv", OString::number(2))); - break; - default: - break; + case text::VertOrientation::TOP: + case text::VertOrientation::LINE_TOP: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posv", OString::number(1))); + break; + case text::VertOrientation::BOTTOM: + case text::VertOrientation::LINE_BOTTOM: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posv", OString::number(3))); + break; + case text::VertOrientation::CENTER: + case text::VertOrientation::LINE_CENTER: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posv", OString::number(2))); + break; + default: + break; } m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPTOP); @@ -3174,28 +3277,35 @@ void RtfAttributeOutput::FormatHorizOrientation(const SwFormatHoriOrient& rFlyHo { switch (rFlyHori.GetRelationOrient()) { - case text::RelOrientation::PAGE_FRAME: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posrelh", OString::number(1))); - break; - default: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posrelh", OString::number(2))); - m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE); - break; + case text::RelOrientation::PAGE_FRAME: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posrelh", OString::number(1))); + break; + default: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posrelh", OString::number(2))); + m_rExport.Strm() + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE); + break; } switch (rFlyHori.GetHoriOrient()) { - case text::HoriOrientation::LEFT: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posh", OString::number(1))); - break; - case text::HoriOrientation::CENTER: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posh", OString::number(2))); - break; - case text::HoriOrientation::RIGHT: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("posh", OString::number(3))); - break; - default: - break; + case text::HoriOrientation::LEFT: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posh", OString::number(1))); + break; + case text::HoriOrientation::CENTER: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posh", OString::number(2))); + break; + case text::HoriOrientation::RIGHT: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("posh", OString::number(3))); + break; + default: + break; } m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SHPLEFT); @@ -3217,16 +3327,16 @@ void RtfAttributeOutput::FormatAnchor(const SwFormatAnchor& rAnchor) m_aRunText->append(static_cast<sal_Int32>(eId)); switch (eId) { - case RndStdIds::FLY_AT_PAGE: - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYPAGE); - m_aRunText->append(static_cast<sal_Int32>(rAnchor.GetPageNum())); - break; - case RndStdIds::FLY_AT_PARA: - case RndStdIds::FLY_AS_CHAR: - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYCNTNT); - break; - default: - break; + case RndStdIds::FLY_AT_PAGE: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYPAGE); + m_aRunText->append(static_cast<sal_Int32>(rAnchor.GetPageNum())); + break; + case RndStdIds::FLY_AT_PARA: + case RndStdIds::FLY_AS_CHAR: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYCNTNT); + break; + default: + break; } } } @@ -3237,7 +3347,8 @@ void RtfAttributeOutput::FormatBackground(const SvxBrushItem& rBrush) { const Color& rColor = rBrush.GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("fillColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "fillColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); } else if (!rBrush.GetColor().GetTransparency()) { @@ -3255,72 +3366,81 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie { if (*m_oFillStyle == drawing::FillStyle_GRADIENT) { - m_aFlyProperties.push_back(std::make_pair<OString, OString>("fillType", OString::number(7))); // Shade using the fillAngle + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "fillType", OString::number(7))); // Shade using the fillAngle const XGradient& rGradient = rFillGradient.GetGradientValue(); const Color& rStartColor = rGradient.GetStartColor(); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("fillBackColor", OString::number(msfilter::util::BGRToRGB(rStartColor.GetColor())))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "fillBackColor", OString::number(msfilter::util::BGRToRGB(rStartColor.GetColor())))); const Color& rEndColor = rGradient.GetEndColor(); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("fillColor", OString::number(msfilter::util::BGRToRGB(rEndColor.GetColor())))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "fillColor", OString::number(msfilter::util::BGRToRGB(rEndColor.GetColor())))); switch (rGradient.GetGradientStyle()) { - case css::awt::GradientStyle_LINEAR: - break; - case css::awt::GradientStyle_AXIAL: - m_aFlyProperties.push_back(std::make_pair<OString, OString>("fillFocus", OString::number(50))); - break; - case css::awt::GradientStyle_RADIAL: - break; - case css::awt::GradientStyle_ELLIPTICAL: - break; - case css::awt::GradientStyle_SQUARE: - break; - case css::awt::GradientStyle_RECT: - break; - default: - break; + case css::awt::GradientStyle_LINEAR: + break; + case css::awt::GradientStyle_AXIAL: + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("fillFocus", OString::number(50))); + break; + case css::awt::GradientStyle_RADIAL: + break; + case css::awt::GradientStyle_ELLIPTICAL: + break; + case css::awt::GradientStyle_SQUARE: + break; + case css::awt::GradientStyle_RECT: + break; + default: + break; } } } void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) { - static const SvxBoxItemLine aBorders[] = - { - SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT - }; - static const sal_Char* aBorderNames[] = - { - OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR - }; + static const SvxBoxItemLine aBorders[] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; + static const sal_Char* aBorderNames[] + = { OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, + OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR }; sal_uInt16 const nDist = rBox.GetSmallestDistance(); if (m_rExport.m_bRTFFlySyntax) { // Borders: spacing to contents, convert from twips to EMUs. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextLeft", OString::number(rBox.GetDistance(SvxBoxItemLine::LEFT) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextTop", OString::number(rBox.GetDistance(SvxBoxItemLine::TOP) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextRight", OString::number(rBox.GetDistance(SvxBoxItemLine::RIGHT) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextBottom", OString::number(rBox.GetDistance(SvxBoxItemLine::BOTTOM) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dxTextLeft", OString::number(rBox.GetDistance(SvxBoxItemLine::LEFT) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dyTextTop", OString::number(rBox.GetDistance(SvxBoxItemLine::TOP) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dxTextRight", OString::number(rBox.GetDistance(SvxBoxItemLine::RIGHT) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "dyTextBottom", OString::number(rBox.GetDistance(SvxBoxItemLine::BOTTOM) * 635))); const editeng::SvxBorderLine* pLeft = rBox.GetLine(SvxBoxItemLine::LEFT); const editeng::SvxBorderLine* pRight = rBox.GetLine(SvxBoxItemLine::RIGHT); const editeng::SvxBorderLine* pTop = rBox.GetLine(SvxBoxItemLine::TOP); const editeng::SvxBorderLine* pBottom = rBox.GetLine(SvxBoxItemLine::BOTTOM); - if (pLeft && pRight && pTop && pBottom && *pLeft == *pRight && *pLeft == *pTop && *pLeft == *pBottom) + if (pLeft && pRight && pTop && pBottom && *pLeft == *pRight && *pLeft == *pTop + && *pLeft == *pBottom) { const Color& rColor = pTop->GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("lineColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>( + "lineColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); if (pTop->GetBorderLineStyle() != SvxBorderLineStyle::NONE) { - double const fConverted(editeng::ConvertBorderWidthToWord(pTop->GetBorderLineStyle(), pTop->GetWidth())); + double const fConverted(editeng::ConvertBorderWidthToWord( + pTop->GetBorderLineStyle(), pTop->GetWidth())); sal_Int32 nWidth = fConverted * 635; // Twips -> EMUs - m_aFlyProperties.push_back(std::make_pair<OString, OString>("lineWidth", OString::number(nWidth))); + m_aFlyProperties.push_back( + std::make_pair<OString, OString>("lineWidth", OString::number(nWidth))); } else // No border: no line. @@ -3330,16 +3450,14 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) return; } - if (rBox.GetTop() && rBox.GetBottom() && - rBox.GetLeft() && rBox.GetRight() && - *rBox.GetTop() == *rBox.GetBottom() && - *rBox.GetTop() == *rBox.GetLeft() && - *rBox.GetTop() == *rBox.GetRight() && - nDist == rBox.GetDistance(SvxBoxItemLine::TOP) && - nDist == rBox.GetDistance(SvxBoxItemLine::LEFT) && - nDist == rBox.GetDistance(SvxBoxItemLine::BOTTOM) && - nDist == rBox.GetDistance(SvxBoxItemLine::RIGHT)) - m_aSectionBreaks.append(OutBorderLine(m_rExport, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist)); + if (rBox.GetTop() && rBox.GetBottom() && rBox.GetLeft() && rBox.GetRight() + && *rBox.GetTop() == *rBox.GetBottom() && *rBox.GetTop() == *rBox.GetLeft() + && *rBox.GetTop() == *rBox.GetRight() && nDist == rBox.GetDistance(SvxBoxItemLine::TOP) + && nDist == rBox.GetDistance(SvxBoxItemLine::LEFT) + && nDist == rBox.GetDistance(SvxBoxItemLine::BOTTOM) + && nDist == rBox.GetDistance(SvxBoxItemLine::RIGHT)) + m_aSectionBreaks.append( + OutBorderLine(m_rExport, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist)); else { SvxShadowLocation eShadowLocation = SvxShadowLocation::NONE; @@ -3362,7 +3480,8 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) m_aStyles.append(m_aSectionBreaks.makeStringAndClear()); } -void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, SwTwips nPageSize) +void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, + SwTwips nPageSize) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLS); m_rExport.OutLong(nCols); @@ -3381,7 +3500,7 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& for (sal_uInt16 n = 0; n < nCols;) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLNO); - m_rExport.OutLong(n+1); + m_rExport.OutLong(n + 1); m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLW); m_rExport.OutLong(rCol.CalcPrtColWidth(n, nPageSize)); @@ -3389,8 +3508,7 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& if (++n != nCols) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLSR); - m_rExport.OutLong(rColumns[ n-1 ].GetRight() + - rColumns[ n ].GetLeft()); + m_rExport.OutLong(rColumns[n - 1].GetRight() + rColumns[n].GetLeft()); } } } @@ -3444,30 +3562,26 @@ void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) } } -void RtfAttributeOutput::CharGrabBag(const SfxGrabBagItem& /*rItem*/) -{ -} +void RtfAttributeOutput::CharGrabBag(const SfxGrabBagItem& /*rItem*/) {} -void RtfAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& /*rItem*/) -{ -} +void RtfAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& /*rItem*/) {} void RtfAttributeOutput::WriteExpand(const SwField* pField) { - OUString sCmd; // for optional Parameters + OUString sCmd; // for optional Parameters switch (pField->GetTyp()->Which()) { - //#i119803# Export user field and DB field for RTF filter - case SwFieldIds::Database: - sCmd = FieldString(ww::eMERGEFIELD); - SAL_FALLTHROUGH; - case SwFieldIds::User: - sCmd += pField->GetTyp()->GetName(); - m_rExport.OutputField(pField, ww::eNONE, sCmd); - break; - default: - m_rExport.OutputField(pField, ww::eUNKNOWN, sCmd); - break; + //#i119803# Export user field and DB field for RTF filter + case SwFieldIds::Database: + sCmd = FieldString(ww::eMERGEFIELD); + SAL_FALLTHROUGH; + case SwFieldIds::User: + sCmd += pField->GetTyp()->GetName(); + m_rExport.OutputField(pField, ww::eNONE, sCmd); + break; + default: + m_rExport.OutputField(pField, ww::eUNKNOWN, sCmd); + break; } } @@ -3481,7 +3595,8 @@ void RtfAttributeOutput::HiddenField(const SwField& /*rField*/) SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); } -void RtfAttributeOutput::SetField(const SwField& /*rField*/, ww::eField /*eType*/, const OUString& /*rCmd*/) +void RtfAttributeOutput::SetField(const SwField& /*rField*/, ww::eField /*eType*/, + const OUString& /*rCmd*/) { SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); } @@ -3532,44 +3647,43 @@ bool RtfAttributeOutput::DropdownField(const SwField* /*pField*/) bool RtfAttributeOutput::PlaceholderField(const SwField* pField) { - m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " MACROBUTTON None "); + m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST + " MACROBUTTON None "); RunText(pField->GetPar1()); m_aRunText->append("}}"); return false; // do not expand } RtfAttributeOutput::RtfAttributeOutput(RtfExport& rExport) - : m_rExport(rExport), - m_nStyleId(0), - m_nListId(0), - m_nNextAnnotationMarkId(0), - m_nCurrentAnnotationMarkId(-1), - m_bTableCellOpen(false), - m_nTableDepth(0), - m_bTableAfterCell(false), - m_nColBreakNeeded(false), - m_bBufferSectionBreaks(false), - m_bBufferSectionHeaders(false), - m_bLastTable(true), - m_bWroteCellInfo(false), - m_bTableRowEnded(false), - m_bSingleEmptyRun(false), - m_bInRun(false), - m_pFlyFrameSize(nullptr), - m_bParaBeforeAutoSpacing(false), - m_nParaBeforeSpacing(0), - m_bParaAfterAutoSpacing(false), - m_nParaAfterSpacing(0), - m_pPrevPageDesc(nullptr) + : m_rExport(rExport) + , m_nStyleId(0) + , m_nListId(0) + , m_nNextAnnotationMarkId(0) + , m_nCurrentAnnotationMarkId(-1) + , m_bTableCellOpen(false) + , m_nTableDepth(0) + , m_bTableAfterCell(false) + , m_nColBreakNeeded(false) + , m_bBufferSectionBreaks(false) + , m_bBufferSectionHeaders(false) + , m_bLastTable(true) + , m_bWroteCellInfo(false) + , m_bTableRowEnded(false) + , m_bSingleEmptyRun(false) + , m_bInRun(false) + , m_pFlyFrameSize(nullptr) + , m_bParaBeforeAutoSpacing(false) + , m_nParaBeforeSpacing(0) + , m_bParaAfterAutoSpacing(false) + , m_nParaAfterSpacing(0) + , m_pPrevPageDesc(nullptr) { } RtfAttributeOutput::~RtfAttributeOutput() = default; -MSWordExportBase& RtfAttributeOutput::GetExport() -{ - return m_rExport; -} +MSWordExportBase& RtfAttributeOutput::GetExport() { return m_rExport; } // These are used by wwFont::WriteRtf() @@ -3592,11 +3706,17 @@ void RtfAttributeOutput::EndFont() const /// Alternate name for the font. void RtfAttributeOutput::FontAlternateName(const OUString& rName) const { - m_rExport.Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FALT).WriteChar(' '); + m_rExport.Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FALT) + .WriteChar(' '); // write the font name hex-encoded, but without Unicode - Word at least // cannot read *both* Unicode and fallback as written by OutString - m_rExport.Strm().WriteCharPtr( - msfilter::rtfutil::OutString(rName, m_rExport.m_eCurrentEncoding, false).getStr()).WriteChar('}'); + m_rExport.Strm() + .WriteCharPtr( + msfilter::rtfutil::OutString(rName, m_rExport.m_eCurrentEncoding, false).getStr()) + .WriteChar('}'); } /// Font charset. @@ -3605,7 +3725,7 @@ void RtfAttributeOutput::FontCharset(sal_uInt8 nCharSet) const m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FCHARSET); m_rExport.OutULong(nCharSet); m_rExport.Strm().WriteChar(' '); - m_rExport.m_eCurrentEncoding =rtl_getTextEncodingFromWindowsCharset(nCharSet); + m_rExport.m_eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(nCharSet); } /// Font family. @@ -3616,23 +3736,23 @@ void RtfAttributeOutput::FontFamilyType(FontFamily eFamily, const wwFont& rFont) const char* pStr = OOO_STRING_SVTOOLS_RTF_FNIL; switch (eFamily) { - case FAMILY_ROMAN: - pStr = OOO_STRING_SVTOOLS_RTF_FROMAN; - break; - case FAMILY_SWISS: - pStr = OOO_STRING_SVTOOLS_RTF_FSWISS; - break; - case FAMILY_MODERN: - pStr = OOO_STRING_SVTOOLS_RTF_FMODERN; - break; - case FAMILY_SCRIPT: - pStr = OOO_STRING_SVTOOLS_RTF_FSCRIPT; - break; - case FAMILY_DECORATIVE: - pStr = OOO_STRING_SVTOOLS_RTF_FDECOR; - break; - default: - break; + case FAMILY_ROMAN: + pStr = OOO_STRING_SVTOOLS_RTF_FROMAN; + break; + case FAMILY_SWISS: + pStr = OOO_STRING_SVTOOLS_RTF_FSWISS; + break; + case FAMILY_MODERN: + pStr = OOO_STRING_SVTOOLS_RTF_FMODERN; + break; + case FAMILY_SCRIPT: + pStr = OOO_STRING_SVTOOLS_RTF_FSCRIPT; + break; + case FAMILY_DECORATIVE: + pStr = OOO_STRING_SVTOOLS_RTF_FDECOR; + break; + default: + break; } m_rExport.OutULong(m_rExport.m_aFontHelper.GetId(rFont)).WriteCharPtr(pStr); } @@ -3645,14 +3765,14 @@ void RtfAttributeOutput::FontPitchType(FontPitch ePitch) const sal_uInt16 nVal = 0; switch (ePitch) { - case PITCH_FIXED: - nVal = 1; - break; - case PITCH_VARIABLE: - nVal = 2; - break; - default: - break; + case PITCH_FIXED: + nVal = 1; + break; + case PITCH_VARIABLE: + nVal = 2; + break; + default: + break; } m_rExport.OutULong(nVal); } @@ -3662,7 +3782,8 @@ static bool IsEMF(const sal_uInt8* pGraphicAry, unsigned long nSize) if (pGraphicAry && (nSize > 0x2c)) { // check the magic number - if ((pGraphicAry[0x28] == 0x20) && (pGraphicAry[0x29] == 0x45) && (pGraphicAry[0x2a] == 0x4d) && (pGraphicAry[0x2b] == 0x46)) + if ((pGraphicAry[0x28] == 0x20) && (pGraphicAry[0x29] == 0x45) + && (pGraphicAry[0x2a] == 0x4d) && (pGraphicAry[0x2b] == 0x46)) { //emf detected return true; @@ -3675,7 +3796,8 @@ static bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, unsigned long& r { if (rpGraphicAry && (rSize > 0x22)) { - if ((rpGraphicAry[0] == 0xd7) && (rpGraphicAry[1] == 0xcd) && (rpGraphicAry[2] == 0xc6) && (rpGraphicAry[3] == 0x9a)) + if ((rpGraphicAry[0] == 0xd7) && (rpGraphicAry[1] == 0xcd) && (rpGraphicAry[2] == 0xc6) + && (rpGraphicAry[3] == 0x9a)) { // we have to get rid of the metafileheader rpGraphicAry += 22; @@ -3686,7 +3808,8 @@ static bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, unsigned long& r return false; } -OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream, sal_uInt32 nLimit) +OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream, + sal_uInt32 nLimit) { OStringBuffer aRet; @@ -3718,23 +3841,23 @@ OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, S return aRet.makeStringAndClear(); } -static void lcl_AppendSP(OStringBuffer& rBuffer, - const char cName[], - const OUString& rValue, +static void lcl_AppendSP(OStringBuffer& rBuffer, const char cName[], const OUString& rValue, const RtfExport& rExport) { - rBuffer.append("{" OOO_STRING_SVTOOLS_RTF_SP "{"); // "{\sp{" - rBuffer.append(OOO_STRING_SVTOOLS_RTF_SN " "); //" \sn " - rBuffer.append(cName); //"PropName" + rBuffer.append("{" OOO_STRING_SVTOOLS_RTF_SP "{"); // "{\sp{" + rBuffer.append(OOO_STRING_SVTOOLS_RTF_SN " "); //" \sn " + rBuffer.append(cName); //"PropName" rBuffer.append("}{" OOO_STRING_SVTOOLS_RTF_SV " "); -// "}{ \sv " + // "}{ \sv " rBuffer.append(msfilter::rtfutil::OutString(rValue, rExport.m_eCurrentEncoding)); rBuffer.append("}}"); } -static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& rOrig, const Size& rRendered, const Size& rMapped, - const SwCropGrf& rCr, const char* pBLIPType, const sal_uInt8* pGraphicAry, - unsigned long nSize, const RtfExport& rExport, SvStream* pStream = nullptr, bool bWritePicProp = true) +static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& rOrig, + const Size& rRendered, const Size& rMapped, const SwCropGrf& rCr, + const char* pBLIPType, const sal_uInt8* pGraphicAry, unsigned long nSize, + const RtfExport& rExport, SvStream* pStream = nullptr, + bool bWritePicProp = true) { OStringBuffer aRet; if (pBLIPType && nSize && pGraphicAry) @@ -3748,15 +3871,16 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r OUString sDescription = pFlyFrameFormat->GetObjDescription(); //write picture properties - wzDescription at first //looks like: "{\*\picprop{\sp{\sn PropertyName}{\sv PropertyValue}}}" - aRet.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP); //"{\*\picprop + aRet.append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP); //"{\*\picprop lcl_AppendSP(aRet, "wzDescription", sDescription, rExport); OUString sName = pFlyFrameFormat->GetObjTitle(); lcl_AppendSP(aRet, "wzName", sName, rExport); - aRet.append("}"); //"}" + aRet.append("}"); //"}" } - long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight()); - long nYCroppedSize = rOrig.Height()-(rCr.GetTop() + rCr.GetBottom()); + long nXCroppedSize = rOrig.Width() - (rCr.GetLeft() + rCr.GetRight()); + long nYCroppedSize = rOrig.Height() - (rCr.GetTop() + rCr.GetBottom()); /* Graphic with a zero height or width, typically copied from webpages, caused crashes. */ if (!nXCroppedSize) nXCroppedSize = 100; @@ -3810,7 +3934,8 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r return aRet.makeStringAndClear(); } -void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize) +void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFrameFormat, + SwOLENode& rOLENode, const Size& rSize) { m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); Size aSize(rOLENode.GetTwipSize()); @@ -3828,7 +3953,8 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram aStream.Seek(STREAM_SEEK_TO_END); sal_uInt32 nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); - m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport)); + m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, + pGraphicAry, nSize, m_rExport)); m_aRunText->append("}"); // shppict m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT); pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; @@ -3838,13 +3964,15 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram aWmfStream.Seek(STREAM_SEEK_TO_END); nSize = aWmfStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aWmfStream.GetData()); - m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport)); + m_aRunText->append(ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, + pGraphicAry, nSize, m_rExport)); m_aRunText->append("}"); // nonshppict } -bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize) +bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat, + SwOLENode& rOLENode, const Size& rSize) { - uno::Reference <embed::XEmbeddedObject> xObj(rOLENode.GetOLEObj().GetOleRef()); + uno::Reference<embed::XEmbeddedObject> xObj(rOLENode.GetOLEObj().GetOleRef()); sal_Int64 nAspect = rOLENode.GetAspect(); svt::EmbeddedObjectRef aObjRef(xObj, nAspect); SvGlobalName aObjName(aObjRef->getClassID()); @@ -3856,10 +3984,11 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat uno::Reference<util::XCloseable> xClosable(xObj->getComponent(), uno::UNO_QUERY); if (!xClosable.is()) return false; -// 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 pBase = dynamic_cast<oox::FormulaExportBase*>(dynamic_cast<SfxBaseModel*>(xClosable.get())); + // 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 pBase + = dynamic_cast<oox::FormulaExportBase*>(dynamic_cast<SfxBaseModel*>(xClosable.get())); assert(pBase != nullptr); OStringBuffer aBuf; if (pBase) @@ -3874,7 +4003,8 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat return true; } -void RtfAttributeOutput::FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize) +void RtfAttributeOutput::FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, + const Size& rSize) { if (FlyFrameOLEMath(pFlyFrameFormat, rOLENode, rSize)) return; @@ -3882,7 +4012,8 @@ void RtfAttributeOutput::FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, Sw FlyFrameOLEReplacement(pFlyFrameFormat, rOLENode, rSize); } -void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode) +void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat, + const SwGrfNode* pGrfNode) { SvMemoryStream aStream; const sal_uInt8* pGraphicAry = nullptr; @@ -3891,7 +4022,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat const Graphic& rGraphic(pGrfNode->GetGrf()); // If there is no graphic there is not much point in parsing it - if (rGraphic.GetType()==GraphicType::NONE) + if (rGraphic.GetType() == GraphicType::NONE) return; ConvertDataFormat aConvertDestinationFormat = ConvertDataFormat::WMF; @@ -3906,54 +4037,58 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat pGraphicAry = aGraphicLink.GetData(); switch (aGraphicLink.GetType()) { - // #i15508# trying to add BMP type for better exports, need to check if this works - // checked, does not work. Also need to reset pGraphicAry to NULL to force conversion - // to PNG, else the BMP array will be used. - // It may work using direct DIB data, but that needs to be checked eventually - // - // #i15508# before GfxLinkType::NativeBmp was added the graphic data - // (to be hold in pGraphicAry) was not available; thus for now to stay - // compatible, keep it that way by assigning NULL value to pGraphicAry - case GfxLinkType::NativeBmp: - // pBLIPType = OOO_STRING_SVTOOLS_RTF_WBITMAP; - pGraphicAry = nullptr; - break; + // #i15508# trying to add BMP type for better exports, need to check if this works + // checked, does not work. Also need to reset pGraphicAry to NULL to force conversion + // to PNG, else the BMP array will be used. + // It may work using direct DIB data, but that needs to be checked eventually + // + // #i15508# before GfxLinkType::NativeBmp was added the graphic data + // (to be hold in pGraphicAry) was not available; thus for now to stay + // compatible, keep it that way by assigning NULL value to pGraphicAry + case GfxLinkType::NativeBmp: + // pBLIPType = OOO_STRING_SVTOOLS_RTF_WBITMAP; + pGraphicAry = nullptr; + break; - case GfxLinkType::NativeJpg: - pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP; - break; - case GfxLinkType::NativePng: - pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; - break; - case GfxLinkType::NativeWmf: - pBLIPType = - IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; - break; - case GfxLinkType::NativeGif: - // GIF is not supported by RTF, but we override default conversion to WMF, PNG seems fits better here. - aConvertDestinationFormat = ConvertDataFormat::PNG; - pConvertDestinationBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; - break; - default: - break; + case GfxLinkType::NativeJpg: + pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP; + break; + case GfxLinkType::NativePng: + pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; + break; + case GfxLinkType::NativeWmf: + pBLIPType = IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP + : OOO_STRING_SVTOOLS_RTF_WMETAFILE; + break; + case GfxLinkType::NativeGif: + // GIF is not supported by RTF, but we override default conversion to WMF, PNG seems fits better here. + aConvertDestinationFormat = ConvertDataFormat::PNG; + pConvertDestinationBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; + break; + default: + break; } } GraphicType eGraphicType = rGraphic.GetType(); if (!pGraphicAry) { - if (ERRCODE_NONE == GraphicConverter::Export(aStream, rGraphic, - (eGraphicType == GraphicType::Bitmap) ? ConvertDataFormat::PNG : ConvertDataFormat::WMF)) + if (ERRCODE_NONE + == GraphicConverter::Export(aStream, rGraphic, + (eGraphicType == GraphicType::Bitmap) + ? ConvertDataFormat::PNG + : ConvertDataFormat::WMF)) { - pBLIPType = (eGraphicType == GraphicType::Bitmap) ? - OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; + pBLIPType = (eGraphicType == GraphicType::Bitmap) ? OOO_STRING_SVTOOLS_RTF_PNGBLIP + : OOO_STRING_SVTOOLS_RTF_WMETAFILE; aStream.Seek(STREAM_SEEK_TO_END); nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); } } - Size aMapped(eGraphicType == GraphicType::Bitmap ? rGraphic.GetSizePixel() : rGraphic.GetPrefSize()); + Size aMapped(eGraphicType == GraphicType::Bitmap ? rGraphic.GetSizePixel() + : rGraphic.GetPrefSize()); auto& rCr = static_cast<const SwCropGrf&>(pGrfNode->GetAttr(RES_GRFATR_CROPGRF)); @@ -3985,11 +4120,14 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat if (!pFrame || pFrame->IsInline()) { if (!bIsWMF) - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); + m_rExport.Strm().WriteCharPtr( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); } else { - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); + m_rExport.Strm().WriteCharPtr( + "{" OOO_STRING_SVTOOLS_RTF_SHP + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); m_pFlyFrameSize = &aRendered; m_rExport.m_pParentFrame = pFrame; m_rExport.m_bOutFlyFrameAttrs = m_rExport.m_bRTFFlySyntax = true; @@ -3998,24 +4136,37 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat m_rExport.m_pParentFrame = nullptr; m_pFlyFrameSize = nullptr; - std::vector< std::pair<OString, OString> > aFlyProperties; - aFlyProperties.push_back(std::make_pair<OString, OString>("shapeType", OString::number(ESCHER_ShpInst_PictureFrame))); - aFlyProperties.push_back(std::make_pair<OString, OString>("wzDescription", msfilter::rtfutil::OutString(pFlyFrameFormat->GetObjDescription(), m_rExport.m_eCurrentEncoding))); - aFlyProperties.push_back(std::make_pair<OString, OString>("wzName", msfilter::rtfutil::OutString(pFlyFrameFormat->GetObjTitle(), m_rExport.m_eCurrentEncoding))); + std::vector<std::pair<OString, OString>> aFlyProperties; + aFlyProperties.push_back(std::make_pair<OString, OString>( + "shapeType", OString::number(ESCHER_ShpInst_PictureFrame))); + aFlyProperties.push_back(std::make_pair<OString, OString>( + "wzDescription", msfilter::rtfutil::OutString(pFlyFrameFormat->GetObjDescription(), + m_rExport.m_eCurrentEncoding))); + aFlyProperties.push_back(std::make_pair<OString, OString>( + "wzName", msfilter::rtfutil::OutString(pFlyFrameFormat->GetObjTitle(), + m_rExport.m_eCurrentEncoding))); // If we have a wrap polygon, then handle that here. if (pFlyFrameFormat->GetSurround().IsContour()) { - if (const SwNoTextNode* pNd = sw::util::GetNoTextNodeFromSwFrameFormat(*pFlyFrameFormat)) + if (const SwNoTextNode* pNd + = sw::util::GetNoTextNodeFromSwFrameFormat(*pFlyFrameFormat)) { const tools::PolyPolygon* pPolyPoly = pNd->HasContour(); if (pPolyPoly && pPolyPoly->Count()) { - tools::Polygon aPoly = sw::util::CorrectWordWrapPolygonForExport(*pPolyPoly, pNd); + tools::Polygon aPoly + = sw::util::CorrectWordWrapPolygonForExport(*pPolyPoly, pNd); OStringBuffer aVerticies; for (sal_uInt16 i = 0; i < aPoly.GetSize(); ++i) - aVerticies.append(";(").append(aPoly[i].X()).append(",").append(aPoly[i].Y()).append(")"); - aFlyProperties.push_back(std::make_pair<OString, OString>("pWrapPolygonVertices", "8;" + OString::number(aPoly.GetSize()) + aVerticies.makeStringAndClear())); + aVerticies.append(";(") + .append(aPoly[i].X()) + .append(",") + .append(aPoly[i].Y()) + .append(")"); + aFlyProperties.push_back(std::make_pair<OString, OString>( + "pWrapPolygonVertices", + "8;" + OString::number(aPoly.GetSize()) + aVerticies.makeStringAndClear())); } } } @@ -4024,7 +4175,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat if (!pFlyFrameFormat->GetOpaque().GetValue()) aFlyProperties.push_back(std::make_pair<OString, OString>("fBehindDocument", "1")); - for (std::pair<OString,OString>& rPair : aFlyProperties) + for (std::pair<OString, OString>& rPair : aFlyProperties) { m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{"); m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " "); @@ -4033,12 +4184,15 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat m_rExport.Strm().WriteCharPtr(rPair.second.getStr()); m_rExport.Strm().WriteCharPtr("}}"); } - m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " "); + m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN + " pib" + "}{" OOO_STRING_SVTOOLS_RTF_SV " "); } bool bWritePicProp = !pFrame || pFrame->IsInline(); if (pBLIPType) - ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp); + ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, + m_rExport, &m_rExport.Strm(), bWritePicProp); else { aStream.Seek(0); @@ -4049,14 +4203,16 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); - ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp); + ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, + m_rExport, &m_rExport.Strm(), bWritePicProp); } if (!pFrame || pFrame->IsInline()) { if (!bIsWMF) { - m_rExport.Strm().WriteCharPtr("}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT); + m_rExport.Strm().WriteCharPtr("}" + "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT); aStream.Seek(0); if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE) @@ -4066,7 +4222,8 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); - ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm()); + ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, + nSize, m_rExport, &m_rExport.Strm()); m_rExport.Strm().WriteChar('}'); } @@ -4096,7 +4253,7 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic, sal_uInt32 nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); RtfAttributeOutput::WriteHex(pGraphicAry, nSize, &m_rExport.Strm()); - m_rExport.Strm().WriteCharPtr("}}"); // pict, shppict + m_rExport.Strm().WriteCharPtr("}}"); // pict, shppict } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 0d21d40b42b2..66393e9525f3 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -40,6 +40,7 @@ class SwFlyFrameFormat; class RtfAttributeOutput : public AttributeOutputBase { friend class RtfStringBufferValue; + public: /// Export the state of RTL/CJK. void RTLAndCJKState(bool bIsRTL, sal_uInt16 nScript) override; @@ -60,10 +61,14 @@ public: void StartParagraphProperties() override; /// Called after we end outputting the attributes. - void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) override; + void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties, + const SwRedlineData* pRedlineData, + const SwRedlineData* pRedlineParagraphMarkerDeleted, + const SwRedlineData* pRedlineParagraphMarkerInserted) override; /// Start of the text run. - void StartRun(const SwRedlineData* pRedlineData, sal_Int32 nPos, bool bSingleEmptyRun = false) override; + void StartRun(const SwRedlineData* pRedlineData, sal_Int32 nPos, + bool bSingleEmptyRun = false) override; /// End of the text run. void EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool bLastRun = false) override; @@ -79,10 +84,7 @@ public: // Access to (anyway) private buffers, used by the sdr exporter OStringBuffer& RunText(); - OStringBuffer& Styles() - { - return m_aStyles; - } + OStringBuffer& Styles() { return m_aStyles; } OStringBuffer& StylesEnd(); /// Output text (without markup). @@ -107,7 +109,9 @@ public: /// The common attribute that can be among the run properties. void Redline(const SwRedlineData* pRedline) override; - void FormatDrop(const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner) override; + void FormatDrop(const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 nStyle, + ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, + ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner) override; /// Output style. void ParagraphStyle(sal_uInt16 nStyle) override; @@ -115,7 +119,8 @@ public: void TableInfoCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; void TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; void TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; - void TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; + void + TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; void TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; void TableRowRedline(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; void TableCellRedline(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override; @@ -138,9 +143,8 @@ public: void DefaultStyle() override; /// Start of a style in the styles table. - void StartStyle(const OUString& rName, StyleType eType, - sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, - bool bAutoUpdate) override; + void StartStyle(const OUString& rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext, + sal_uInt16 nWwId, sal_uInt16 nId, bool bAutoUpdate) override; /// End of a style in the styles table. void EndStyle() override; @@ -178,14 +182,16 @@ public: void SectionTitlePage() override; /// Description of the page borders. - void SectionPageBorders(const SwFrameFormat* pFormat, const SwFrameFormat* pFirstPageFormat) override; + void SectionPageBorders(const SwFrameFormat* pFormat, + const SwFrameFormat* pFirstPageFormat) override; /// Columns populated from right/numbers on the right side? void SectionBiDi(bool bBiDi) override; /// The style of the page numbers. /// - void SectionPageNumbering(sal_uInt16 nNumType, const ::boost::optional<sal_uInt16>& oPageRestartNumber) override; + void SectionPageNumbering(sal_uInt16 nNumType, + const ::boost::optional<sal_uInt16>& oPageRestartNumber) override; /// The type of breaking. void SectionType(sal_uInt8 nBreakCode) override; @@ -200,25 +206,22 @@ public: void EndAbstractNumbering() override; /// All the numbering level information. - void NumberingLevel(sal_uInt8 nLevel, - sal_uInt16 nStart, - sal_uInt16 nNumberingType, - SvxAdjust eAdjust, - const sal_uInt8* pNumLvlPos, - sal_uInt8 nFollow, - const wwFont* pFont, - const SfxItemSet* pOutSet, - sal_Int16 nIndentAt, - sal_Int16 nFirstLineIndex, - sal_Int16 nListTabPos, - const OUString& rNumberingString, - const SvxBrushItem* pBrush) override;//For i120928,to export graphic of bullet - - void WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, FieldFlags nMode); - void WriteBookmarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds); - void WriteAnnotationMarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds); - void WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, bool bTitlepg); - void WriteBookmarkInActParagraph(const OUString& /*rName*/, sal_Int32 /*nFirstRunPos*/, sal_Int32 /*nLastRunPos*/) override {}; + void + NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 nNumberingType, + SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, sal_uInt8 nFollow, + const wwFont* pFont, const SfxItemSet* pOutSet, sal_Int16 nIndentAt, + sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, + const OUString& rNumberingString, + const SvxBrushItem* pBrush) override; //For i120928,to export graphic of bullet + + void WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd, + FieldFlags nMode); + void WriteBookmarks_Impl(std::vector<OUString>& rStarts, std::vector<OUString>& rEnds); + void WriteAnnotationMarks_Impl(std::vector<OUString>& rStarts, std::vector<OUString>& rEnds); + void WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, + bool bTitlepg); + void WriteBookmarkInActParagraph(const OUString& /*rName*/, sal_Int32 /*nFirstRunPos*/, + sal_Int32 /*nLastRunPos*/) override{}; protected: /// Output frames - the implementation. @@ -327,7 +330,8 @@ protected: void CharHidden(const SvxCharHiddenItem& rHidden) override; /// Sfx item RES_CHRATR_BOX - void CharBorder(const ::editeng::SvxBorderLine* pAllBorder, sal_uInt16 nDist, bool bShadow) override; + void CharBorder(const ::editeng::SvxBorderLine* pAllBorder, sal_uInt16 nDist, + bool bShadow) override; /// Sfx item RES_CHRATR_HIGHLIGHT void CharHighlight(const SvxBrushItem& rBrush) override; @@ -414,7 +418,8 @@ protected: void FormatBox(const SvxBoxItem& rBox) override; /// Sfx item RES_COL - void FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, SwTwips nPageSize) override; + void FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, + SwTwips nPageSize) override; /// Sfx item RES_KEEP void FormatKeep(const SvxFormatKeepItem& rItem) override; @@ -451,13 +456,15 @@ protected: RtfExport& m_rExport; private: - /// Output graphic fly frames. void FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode); - void FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize); - void FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize); + void FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, + const Size& rSize); + void FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, + const Size& rSize); /// Math export. - bool FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, const Size& rSize); + bool FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode, + const Size& rSize); /* * Table methods. @@ -566,7 +573,7 @@ private: * List of already started but not yet defined tables (need to be defined * after the nested tables). */ - std::vector< OString > m_aTables; + std::vector<OString> m_aTables; /* * If cell info is already output. */ @@ -576,7 +583,7 @@ private: bool m_bTableRowEnded; /// Number of cells from the table definition, by depth. - std::map<sal_uInt32,sal_uInt32> m_aCells; + std::map<sal_uInt32, sal_uInt32> m_aCells; /// If we're in a paragraph that has a single empty run only. bool m_bSingleEmptyRun; @@ -589,7 +596,7 @@ private: /// When exporting fly frames, this holds the real size of the frame. const Size* m_pFlyFrameSize; - std::vector< std::pair<OString, OString> > m_aFlyProperties; + std::vector<std::pair<OString, OString>> m_aFlyProperties; boost::optional<css::drawing::FillStyle> m_oFillStyle; @@ -638,7 +645,8 @@ public: void FontPitchType(FontPitch ePitch) const; /// Writes binary data as a hex dump. - static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = nullptr, sal_uInt32 nLimit = 64); + static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = nullptr, + sal_uInt32 nLimit = 64); void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize) override; diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 63044c1f8247..e4e51b6a23b4 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -54,22 +54,13 @@ using namespace ::com::sun::star; // the default text encoding for the export, if it doesn't fit unicode will // be used -#define DEF_ENCODING RTL_TEXTENCODING_ASCII_US +#define DEF_ENCODING RTL_TEXTENCODING_ASCII_US -AttributeOutputBase& RtfExport::AttrOutput() const -{ - return *m_pAttrOutput; -} +AttributeOutputBase& RtfExport::AttrOutput() const { return *m_pAttrOutput; } -MSWordSections& RtfExport::Sections() const -{ - return *m_pSections; -} +MSWordSections& RtfExport::Sections() const { return *m_pSections; } -RtfSdrExport& RtfExport::SdrExporter() const -{ - return *m_pSdrExport; -} +RtfSdrExport& RtfExport::SdrExporter() const { return *m_pSdrExport; } bool RtfExport::CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) { @@ -80,12 +71,12 @@ bool RtfExport::CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) // and one fontstyle (posture/weight) switch (nWhich) { - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_POSTURE: - case RES_CHRATR_WEIGHT: - return false; - default: - break; + case RES_CHRATR_FONTSIZE: + case RES_CHRATR_POSTURE: + case RES_CHRATR_WEIGHT: + return false; + default: + break; } } else if (nScript != i18n::ScriptType::COMPLEX) @@ -94,12 +85,12 @@ bool RtfExport::CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) // and one fontstyle (posture/weight) switch (nWhich) { - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CJK_POSTURE: - case RES_CHRATR_CJK_WEIGHT: - return false; - default: - break; + case RES_CHRATR_CJK_FONTSIZE: + case RES_CHRATR_CJK_POSTURE: + case RES_CHRATR_CJK_WEIGHT: + return false; + default: + break; } } return true; @@ -107,8 +98,8 @@ bool RtfExport::CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) void RtfExport::AppendBookmarks(const SwTextNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen) { - std::vector< OUString > aStarts; - std::vector< OUString > aEnds; + std::vector<OUString> aStarts; + std::vector<OUString> aEnds; IMarkVector aMarks; if (GetBookmarks(rNode, nAktPos, nAktPos + nLen, aMarks)) @@ -142,8 +133,8 @@ void RtfExport::AppendBookmark(const OUString& rName) void RtfExport::AppendAnnotationMarks(const SwTextNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen) { - std::vector< OUString > aStarts; - std::vector< OUString > aEnds; + std::vector<OUString> aStarts; + std::vector<OUString> aEnds; IMarkVector aMarks; if (GetAnnotationMarks(rNode, nAktPos, nAktPos + nLen, aMarks)) @@ -170,10 +161,7 @@ void RtfExport::ExportGrfBullet(const SwTextNode& /*rNd*/) // Noop, would be too late, see WriteNumbering() instead. } -void RtfExport::WriteChar(sal_Unicode /*c*/) -{ - /* WriteChar() has nothing to do for rtf. */ -} +void RtfExport::WriteChar(sal_Unicode /*c*/) { /* WriteChar() has nothing to do for rtf. */} static bool IsExportNumRule(const SwNumRule& rRule) { @@ -187,9 +175,8 @@ static bool IsExportNumRule(const SwNumRule& rRule) for (nLvl = 0; nLvl < nEnd; ++nLvl) { const SwNumFormat* pNFormat = &rRule.Get(nLvl); - if (SVX_NUM_NUMBER_NONE != pNFormat->GetNumberingType() || - !pNFormat->GetPrefix().isEmpty() || - (!pNFormat->GetSuffix().isEmpty() && pNFormat->GetSuffix() != ".")) + if (SVX_NUM_NUMBER_NONE != pNFormat->GetNumberingType() || !pNFormat->GetPrefix().isEmpty() + || (!pNFormat->GetSuffix().isEmpty() && pNFormat->GetSuffix() != ".")) break; } @@ -206,7 +193,7 @@ void RtfExport::BuildNumbering() for (auto n = rListTable.size(); n;) { - SwNumRule* pRule = rListTable[ --n ]; + SwNumRule* pRule = rListTable[--n]; if (!SwDoc::IsUsed(*pRule)) continue; @@ -222,11 +209,17 @@ void RtfExport::WriteNumbering() if (!m_pUsedNumTable) return; // no numbering is used - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LISTTABLE); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LISTTABLE); CollectGrfsOfBullets(); if (!m_vecBulletPic.empty()) - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(LO_STRING_SVTOOLS_RTF_LISTPICTURE); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(LO_STRING_SVTOOLS_RTF_LISTPICTURE); BulletDefinitions(); if (!m_vecBulletPic.empty()) Strm().WriteChar('}'); @@ -257,20 +250,26 @@ void RtfExport::WriteRevTab() } // Now write the table - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVTBL).WriteChar(' '); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVTBL) + .WriteChar(' '); for (std::size_t i = 0; i < m_aRedlineTable.size(); ++i) { const OUString* pAuthor = GetRedline(i); Strm().WriteChar('{'); if (pAuthor) - Strm().WriteCharPtr(msfilter::rtfutil::OutString(*pAuthor, m_eDefaultEncoding).getStr()); + Strm().WriteCharPtr( + msfilter::rtfutil::OutString(*pAuthor, m_eDefaultEncoding).getStr()); Strm().WriteCharPtr(";}"); } Strm().WriteChar('}').WriteCharPtr(SAL_NEWLINE_STRING); } -void RtfExport::WriteHeadersFooters(sal_uInt8 nHeadFootFlags, - const SwFrameFormat& rFormat, const SwFrameFormat& rLeftFormat, const SwFrameFormat& rFirstPageFormat, sal_uInt8 /*nBreakCode*/) +void RtfExport::WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat& rFormat, + const SwFrameFormat& rLeftFormat, + const SwFrameFormat& rFirstPageFormat, sal_uInt8 /*nBreakCode*/) { // headers if (nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN) @@ -293,7 +292,8 @@ void RtfExport::WriteHeadersFooters(sal_uInt8 nHeadFootFlags, WriteHeaderFooter(rFirstPageFormat, false, OOO_STRING_SVTOOLS_RTF_FOOTERF, true); } -void RtfExport::OutputField(const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, FieldFlags nMode) +void RtfExport::OutputField(const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, + FieldFlags nMode) { m_pAttrOutput->WriteField_Impl(pField, eFieldType, rFieldCmd, nMode); } @@ -308,10 +308,8 @@ void RtfExport::WriteHyperlinkData(const ::sw::mark::IFieldmark& /*rFieldmark*/) SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); } -void RtfExport::DoComboBox(const OUString& /*rName*/, - const OUString& /*rHelp*/, - const OUString& /*rToolTip*/, - const OUString& /*rSelected*/, +void RtfExport::DoComboBox(const OUString& /*rName*/, const OUString& /*rHelp*/, + const OUString& /*rToolTip*/, const OUString& /*rSelected*/, uno::Sequence<OUString>& /*rListItems*/) { // this is handled in RtfAttributeOutput::OutputFlyFrame_Impl @@ -323,23 +321,41 @@ void RtfExport::DoFormText(const SwInputField* pField) const OUString& rHelp = pField->GetHelp(); OUString sName = pField->GetPar2(); const OUString& rStatus = pField->GetToolTip(); - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST "{ FORMTEXT }"); - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD " {" OOO_STRING_SVTOOLS_RTF_FFTYPE "0"); + m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_FIELD + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST + "{ FORMTEXT }"); + m_pAttrOutput->RunText().append( + "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD + " {" OOO_STRING_SVTOOLS_RTF_FFTYPE "0"); if (!rHelp.isEmpty()) m_pAttrOutput->RunText().append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); if (!rStatus.isEmpty()) m_pAttrOutput->RunText().append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); - m_pAttrOutput->RunText().append(OOO_STRING_SVTOOLS_RTF_FFTYPETXT "0"); + m_pAttrOutput->RunText().append(OOO_STRING_SVTOOLS_RTF_FFTYPETXT "0"); if (!sName.isEmpty()) - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ").append(msfilter::rtfutil::OutString(sName, m_eDefaultEncoding)).append("}"); + m_pAttrOutput->RunText() + .append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ") + .append(msfilter::rtfutil::OutString(sName, m_eDefaultEncoding)) + .append("}"); if (!rHelp.isEmpty()) - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ").append(msfilter::rtfutil::OutString(rHelp, m_eDefaultEncoding)).append("}"); - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFDEFTEXT " ").append(msfilter::rtfutil::OutString(sResult, m_eDefaultEncoding)).append("}"); + m_pAttrOutput->RunText() + .append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ") + .append(msfilter::rtfutil::OutString(rHelp, m_eDefaultEncoding)) + .append("}"); + m_pAttrOutput->RunText() + .append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFDEFTEXT " ") + .append(msfilter::rtfutil::OutString(sResult, m_eDefaultEncoding)) + .append("}"); if (!rStatus.isEmpty()) - m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ").append(msfilter::rtfutil::OutString(rStatus, m_eDefaultEncoding)).append("}"); + m_pAttrOutput->RunText() + .append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ") + .append(msfilter::rtfutil::OutString(rStatus, m_eDefaultEncoding)) + .append("}"); m_pAttrOutput->RunText().append("}}}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); - m_pAttrOutput->RunText().append(msfilter::rtfutil::OutString(sResult, m_eDefaultEncoding)).append("}}"); + m_pAttrOutput->RunText() + .append(msfilter::rtfutil::OutString(sResult, m_eDefaultEncoding)) + .append("}}"); } sal_uLong RtfExport::ReplaceCr(sal_uInt8 /*nChar*/) @@ -352,7 +368,10 @@ sal_uLong RtfExport::ReplaceCr(sal_uInt8 /*nChar*/) void RtfExport::WriteFonts() { - Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FONTTBL); + Strm() + .WriteCharPtr(SAL_NEWLINE_STRING) + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FONTTBL); m_aFontHelper.WriteFontTable(*m_pAttrOutput); Strm().WriteChar('}'); } @@ -370,7 +389,10 @@ void RtfExport::WriteFootnoteSettings() // Request a separator only in case the width is larger than zero. bool bSeparator = double(rFootnoteInfo.GetWidth()) > 0; - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FTNSEP); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FTNSEP); if (bSeparator) Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_CHFTNSEP); Strm().WriteChar('}'); @@ -387,10 +409,11 @@ void RtfExport::WriteMainText() Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP); Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); - std::vector< std::pair<OString, OString> > aProperties; + std::vector<std::pair<OString, OString>> aProperties; aProperties.push_back(std::make_pair<OString, OString>("shapeType", "1")); - aProperties.push_back(std::make_pair<OString, OString>("fillColor", OString::number(msfilter::util::BGRToRGB(oBrush->GetColor().GetColor())))); - for (std::pair<OString,OString>& rPair : aProperties) + aProperties.push_back(std::make_pair<OString, OString>( + "fillColor", OString::number(msfilter::util::BGRToRGB(oBrush->GetColor().GetColor())))); + for (std::pair<OString, OString>& rPair : aProperties) { Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{"); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " "); @@ -405,15 +428,15 @@ void RtfExport::WriteMainText() } SwTableNode* pTableNode = m_pCurPam->GetNode().FindTableNode(); - if (m_pWriter && m_pWriter->bWriteOnlyFirstTable - && pTableNode != nullptr) + if (m_pWriter && m_pWriter->bWriteOnlyFirstTable && pTableNode != nullptr) { m_pCurPam->GetPoint()->nNode = *pTableNode; m_pCurPam->GetMark()->nNode = *(pTableNode->EndOfSectionNode()); } else { - m_pCurPam->GetPoint()->nNode = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + m_pCurPam->GetPoint()->nNode + = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); } WriteText(); @@ -423,26 +446,34 @@ void RtfExport::WriteMainText() void RtfExport::WriteInfo() { - OString aGenerator = OUStringToOString(utl::DocInfoHelper::GetGeneratorString(), RTL_TEXTENCODING_UTF8); - Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE LO_STRING_SVTOOLS_RTF_GENERATOR " ").WriteCharPtr(aGenerator.getStr()).WriteChar('}'); + OString aGenerator + = OUStringToOString(utl::DocInfoHelper::GetGeneratorString(), RTL_TEXTENCODING_UTF8); + Strm() + .WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE LO_STRING_SVTOOLS_RTF_GENERATOR " ") + .WriteCharPtr(aGenerator.getStr()) + .WriteChar('}'); Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_INFO); SwDocShell* pDocShell(m_pDoc->GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pDocShell->GetModel(), uno::UNO_QUERY); + uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pDocShell->GetModel(), + uno::UNO_QUERY); xDocProps.set(xDPS->getDocumentProperties()); } if (xDocProps.is()) { // Handle user-defined properties. - uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = xDocProps->getUserDefinedProperties(); + uno::Reference<beans::XPropertyContainer> xUserDefinedProperties + = xDocProps->getUserDefinedProperties(); if (xUserDefinedProperties.is()) { - uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY); - uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); + uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, + uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropertySetInfo + = xPropertySet->getPropertySetInfo(); // Do we have explicit markup in RTF for this property name? if (xPropertySetInfo->hasPropertyByName("Company")) { @@ -462,7 +493,7 @@ void RtfExport::WriteInfo() OutUnicode(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getAuthor()); OutDateTime(OOO_STRING_SVTOOLS_RTF_CREATIM, xDocProps->getCreationDate()); - OutUnicode(OOO_STRING_SVTOOLS_RTF_AUTHOR,xDocProps->getModifiedBy()); + OutUnicode(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getModifiedBy()); OutDateTime(OOO_STRING_SVTOOLS_RTF_REVTIM, xDocProps->getModificationDate()); OutDateTime(OOO_STRING_SVTOOLS_RTF_PRINTIM, xDocProps->getPrintDate()); @@ -486,13 +517,15 @@ void RtfExport::WriteUserPropValue(const OUString& rValue) void RtfExport::WriteUserProps() { - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_USERPROPS); + Strm().WriteChar('{').WriteCharPtr( + OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_USERPROPS); SwDocShell* pDocShell(m_pDoc->GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pDocShell->GetModel(), uno::UNO_QUERY); + uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pDocShell->GetModel(), + uno::UNO_QUERY); xDocProps.set(xDPS->getDocumentProperties()); } else @@ -505,11 +538,14 @@ void RtfExport::WriteUserProps() if (xDocProps.is()) { // Handle user-defined properties. - uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = xDocProps->getUserDefinedProperties(); + uno::Reference<beans::XPropertyContainer> xUserDefinedProperties + = xDocProps->getUserDefinedProperties(); if (xUserDefinedProperties.is()) { - uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY); - uno::Sequence<beans::Property> aProperties = xPropertySet->getPropertySetInfo()->getProperties(); + uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, + uno::UNO_QUERY); + uno::Sequence<beans::Property> aProperties + = xPropertySet->getPropertySetInfo()->getProperties(); for (const beans::Property& rProperty : aProperties) { @@ -519,7 +555,8 @@ void RtfExport::WriteUserProps() // Property name. Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_PROPNAME " "); - Strm().WriteCharPtr(msfilter::rtfutil::OutString(rProperty.Name, m_eDefaultEncoding).getStr()); + Strm().WriteCharPtr( + msfilter::rtfutil::OutString(rProperty.Name, m_eDefaultEncoding).getStr()); Strm().WriteChar('}'); // Property value. @@ -572,7 +609,6 @@ void RtfExport::WriteUserProps() } } } - } Strm().WriteChar('}'); @@ -587,12 +623,18 @@ void RtfExport::WritePageDescTable() Strm().WriteCharPtr(SAL_NEWLINE_STRING); m_bOutPageDescs = true; - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCTBL); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCTBL); for (std::size_t n = 0; n < nSize; ++n) { const SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(n); - Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSC); + Strm() + .WriteCharPtr(SAL_NEWLINE_STRING) + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSC); OutULong(n).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCUSE); OutULong((sal_uLong)rPageDesc.ReadUseOn()); @@ -605,7 +647,10 @@ void RtfExport::WritePageDescTable() break; Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNXT); OutULong(i).WriteChar(' '); - Strm().WriteCharPtr(msfilter::rtfutil::OutString(rPageDesc.GetName(), m_eDefaultEncoding).getStr()).WriteCharPtr(";}"); + Strm() + .WriteCharPtr( + msfilter::rtfutil::OutString(rPageDesc.GetName(), m_eDefaultEncoding).getStr()) + .WriteCharPtr(";}"); } Strm().WriteChar('}').WriteCharPtr(SAL_NEWLINE_STRING); m_bOutPageDescs = false; @@ -618,10 +663,14 @@ void RtfExport::WritePageDescTable() void RtfExport::ExportDocument_Impl() { // Make the header - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_RTF).WriteChar('1') - .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_RTF) + .WriteChar('1') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_DEFF); - OutULong(m_aFontHelper.GetId(static_cast<const SvxFontItem&>(m_pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT)))); + OutULong(m_aFontHelper.GetId( + static_cast<const SvxFontItem&>(m_pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT)))); // If this not exist, MS don't understand our ansi characters (0x80-0xff). Strm().WriteCharPtr("\\adeflang1025"); @@ -641,13 +690,17 @@ void RtfExport::ExportDocument_Impl() WriteInfo(); WriteUserProps(); // Default TabSize - Strm().WriteCharPtr(m_pAttrOutput->m_aTabStop.makeStringAndClear().getStr()).WriteCharPtr(SAL_NEWLINE_STRING); + Strm() + .WriteCharPtr(m_pAttrOutput->m_aTabStop.makeStringAndClear().getStr()) + .WriteCharPtr(SAL_NEWLINE_STRING); // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer. // Use the setting from the default style. - SwTextFormatColl* pTextFormatColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); + SwTextFormatColl* pTextFormatColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( + RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); const SfxPoolItem* pItem; - if (pTextFormatColl && pTextFormatColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem) == SfxItemState::SET) + if (pTextFormatColl + && pTextFormatColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem) == SfxItemState::SET) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_HYPHAUTO); OutULong(int(static_cast<const SvxHyphenZoneItem*>(pItem)->IsHyphen())); @@ -699,18 +752,17 @@ void RtfExport::ExportDocument_Impl() // Seeking the first SwFormatPageDesc. If no set, the default is valid const SwFormatPageDesc* pSttPgDsc = nullptr; { - const SwNode& rSttNd = *m_pDoc->GetNodes()[m_pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2]; + const SwNode& rSttNd + = *m_pDoc->GetNodes()[m_pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2]; const SfxItemSet* pSet = nullptr; if (rSttNd.IsContentNode()) pSet = &rSttNd.GetContentNode()->GetSwAttrSet(); else if (rSttNd.IsTableNode()) - pSet = &rSttNd.GetTableNode()->GetTable(). - GetFrameFormat()->GetAttrSet(); + pSet = &rSttNd.GetTableNode()->GetTable().GetFrameFormat()->GetAttrSet(); else if (rSttNd.IsSectionNode()) - pSet = &rSttNd.GetSectionNode()->GetSection(). - GetFormat()->GetAttrSet(); + pSet = &rSttNd.GetSectionNode()->GetSection().GetFormat()->GetAttrSet(); if (pSet) { @@ -720,13 +772,16 @@ void RtfExport::ExportDocument_Impl() pSttPgDsc = nullptr; else if (m_pDoc->FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) { - Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNO); + Strm() + .WriteChar('{') + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNO); OutULong(nPosInDoc).WriteChar('}'); } } } - const SwPageDesc& rPageDesc = pSttPgDsc ? *pSttPgDsc->GetPageDesc() - : m_pDoc->GetPageDesc(0); + const SwPageDesc& rPageDesc + = pSttPgDsc ? *pSttPgDsc->GetPageDesc() : m_pDoc->GetPageDesc(0); const SwFrameFormat& rFormatPage = rPageDesc.GetMaster(); { @@ -765,11 +820,13 @@ void RtfExport::ExportDocument_Impl() OutLong(rUL.GetLower()); } - Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SECTD).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SBKNONE); + Strm() + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SECTD) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SBKNONE); // All sections are unlocked by default Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED); OutLong(1); - OutPageDescription(rPageDesc, true); // Changed bCheckForFirstPage to true so headers + OutPageDescription(rPageDesc, true); // Changed bCheckForFirstPage to true so headers // following title page are correctly added - i13107 if (pSttPgDsc) { @@ -786,79 +843,80 @@ void RtfExport::ExportDocument_Impl() // write the footnotes and endnotes-out Info const SwFootnoteInfo& rFootnoteInfo = m_pDoc->GetFootnoteInfo(); - const char* pOut = FTNPOS_CHAPTER == rFootnoteInfo.ePos - ? OOO_STRING_SVTOOLS_RTF_ENDDOC - : OOO_STRING_SVTOOLS_RTF_FTNBJ; + const char* pOut = FTNPOS_CHAPTER == rFootnoteInfo.ePos ? OOO_STRING_SVTOOLS_RTF_ENDDOC + : OOO_STRING_SVTOOLS_RTF_FTNBJ; Strm().WriteCharPtr(pOut).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FTNSTART); OutLong(rFootnoteInfo.nFootnoteOffset + 1); switch (rFootnoteInfo.eNum) { - case FTNNUM_PAGE: - pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTPG; - break; - case FTNNUM_DOC: - pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTCONT; - break; - default: - pOut = OOO_STRING_SVTOOLS_RTF_FTNRESTART; - break; + case FTNNUM_PAGE: + pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTPG; + break; + case FTNNUM_DOC: + pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTCONT; + break; + default: + pOut = OOO_STRING_SVTOOLS_RTF_FTNRESTART; + break; } Strm().WriteCharPtr(pOut); switch (rFootnoteInfo.aFormat.GetNumberingType()) { - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNALC; - break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNAUC; - break; - case SVX_NUM_ROMAN_LOWER: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNRLC; - break; - case SVX_NUM_ROMAN_UPPER: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNRUC; - break; - case SVX_NUM_CHAR_SPECIAL: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNCHI; - break; - default: - pOut = OOO_STRING_SVTOOLS_RTF_FTNNAR; - break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNALC; + break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNAUC; + break; + case SVX_NUM_ROMAN_LOWER: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNRLC; + break; + case SVX_NUM_ROMAN_UPPER: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNRUC; + break; + case SVX_NUM_CHAR_SPECIAL: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNCHI; + break; + default: + pOut = OOO_STRING_SVTOOLS_RTF_FTNNAR; + break; } Strm().WriteCharPtr(pOut); const SwEndNoteInfo& rEndNoteInfo = m_pDoc->GetEndNoteInfo(); - Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AENDDOC).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT) - .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AFTNSTART); + Strm() + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AENDDOC) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT) + .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AFTNSTART); OutLong(rEndNoteInfo.nFootnoteOffset + 1); switch (rEndNoteInfo.aFormat.GetNumberingType()) { - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNALC; - break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAUC; - break; - case SVX_NUM_ROMAN_LOWER: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRLC; - break; - case SVX_NUM_ROMAN_UPPER: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRUC; - break; - case SVX_NUM_CHAR_SPECIAL: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNCHI; - break; - default: - pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAR; - break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNALC; + break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAUC; + break; + case SVX_NUM_ROMAN_LOWER: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRLC; + break; + case SVX_NUM_ROMAN_UPPER: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRUC; + break; + case SVX_NUM_CHAR_SPECIAL: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNCHI; + break; + default: + pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAR; + break; } Strm().WriteCharPtr(pOut); } @@ -876,8 +934,8 @@ void RtfExport::ExportDocument_Impl() Strm().WriteChar('}'); } -void RtfExport::PrepareNewPageDesc(const SfxItemSet* pSet, - const SwNode& rNd, const SwFormatPageDesc* pNewPgDescFormat, +void RtfExport::PrepareNewPageDesc(const SfxItemSet* pSet, const SwNode& rNd, + const SwFormatPageDesc* pNewPgDescFormat, const SwPageDesc* pNewPgDesc) { const SwSectionFormat* pFormat = GetSectionFormat(rNd); @@ -891,7 +949,8 @@ void RtfExport::PrepareNewPageDesc(const SfxItemSet* pSet, m_pSections->AppendSection(pNewPgDesc, rNd, pFormat, nLnNm); // Don't insert a page break, when we're changing page style just because the next page has to be a different one. - if (!m_pAttrOutput->m_pPrevPageDesc || m_pAttrOutput->m_pPrevPageDesc->GetFollow() != pNewPgDesc) + if (!m_pAttrOutput->m_pPrevPageDesc + || m_pAttrOutput->m_pPrevPageDesc->GetFollow() != pNewPgDesc) AttrOutput().SectionBreak(msword::PageBreak, m_pSections->CurrentSectionInfo()); } @@ -903,7 +962,8 @@ bool RtfExport::DisallowInheritingOutlineNumbering(const SwFormat& rFormat) { if (const SwFormat* pParent = rFormat.DerivedFrom()) { - if (static_cast<const SwTextFormatColl*>(pParent)->IsAssignedToListLevelOfOutlineStyle()) + if (static_cast<const SwTextFormatColl*>(pParent) + ->IsAssignedToListLevelOfOutlineStyle()) { // Level 9 disables the outline Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVEL).WriteInt32(9); @@ -933,9 +993,7 @@ void RtfExport::OutputOLENode(const SwOLENode& /*rOLENode*/) /* noop, see RtfAttributeOutput::FlyFrameOLE */ } -void RtfExport::OutputLinkedOLE(const OUString& /*rLinked*/) -{ -} +void RtfExport::OutputLinkedOLE(const OUString& /*rLinked*/) {} void RtfExport::OutputTextNode(SwTextNode& rNode) { @@ -945,22 +1003,25 @@ void RtfExport::OutputTextNode(SwTextNode& rNode) m_nCurrentNodeIndex = 0; } -void RtfExport::AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* pFormat, sal_uLong nLnNum) +void RtfExport::AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* pFormat, + sal_uLong nLnNum) { m_pSections->AppendSection(pPageDesc, pFormat, nLnNum); AttrOutput().SectionBreak(msword::PageBreak, m_pSections->CurrentSectionInfo()); } -RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, SwPaM* pCurrentPam, SwPaM* pOriginalPam, Writer* pWriter, bool bOutOutlineOnly) - : MSWordExportBase(pDocument, pCurrentPam, pOriginalPam), - m_pFilter(pFilter), - m_pWriter(pWriter), - m_pSections(nullptr), - m_bOutOutlineOnly(bOutOutlineOnly), - m_eDefaultEncoding(rtl_getTextEncodingFromWindowsCharset(sw::ms::rtl_TextEncodingToWinCharset(DEF_ENCODING))), - m_eCurrentEncoding(m_eDefaultEncoding), - m_bRTFFlySyntax(false), - m_nCurrentNodeIndex(0) +RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, SwPaM* pCurrentPam, + SwPaM* pOriginalPam, Writer* pWriter, bool bOutOutlineOnly) + : MSWordExportBase(pDocument, pCurrentPam, pOriginalPam) + , m_pFilter(pFilter) + , m_pWriter(pWriter) + , m_pSections(nullptr) + , m_bOutOutlineOnly(bOutOutlineOnly) + , m_eDefaultEncoding( + rtl_getTextEncodingFromWindowsCharset(sw::ms::rtl_TextEncodingToWinCharset(DEF_ENCODING))) + , m_eCurrentEncoding(m_eDefaultEncoding) + , m_bRTFFlySyntax(false) + , m_nCurrentNodeIndex(0) { m_bExportModeRTF = true; // the attribute output for the document @@ -986,10 +1047,7 @@ SvStream& RtfExport::Strm() return m_pWriter->Strm(); } -void RtfExport::setStream() -{ - m_pStream = o3tl::make_unique<SvMemoryStream>(); -} +void RtfExport::setStream() { m_pStream = o3tl::make_unique<SvMemoryStream>(); } OString RtfExport::getStream() { @@ -1001,20 +1059,11 @@ OString RtfExport::getStream() return aRet; } -void RtfExport::resetStream() -{ - m_pStream.reset(); -} +void RtfExport::resetStream() { m_pStream.reset(); } -SvStream& RtfExport::OutULong(sal_uLong nVal) -{ - return Writer::OutULong(Strm(), nVal); -} +SvStream& RtfExport::OutULong(sal_uLong nVal) { return Writer::OutULong(Strm(), nVal); } -SvStream& RtfExport::OutLong(long nVal) -{ - return Writer::OutLong(Strm(), nVal); -} +SvStream& RtfExport::OutLong(long nVal) { return Writer::OutLong(Strm(), nVal); } void RtfExport::OutUnicode(const sal_Char* pToken, const OUString& rContent, bool bUpr) { @@ -1023,11 +1072,13 @@ void RtfExport::OutUnicode(const sal_Char* pToken, const OUString& rContent, boo if (!bUpr) { Strm().WriteChar('{').WriteCharPtr(pToken).WriteChar(' '); - Strm().WriteCharPtr(msfilter::rtfutil::OutString(rContent, m_eCurrentEncoding).getStr()); + Strm().WriteCharPtr( + msfilter::rtfutil::OutString(rContent, m_eCurrentEncoding).getStr()); Strm().WriteChar('}'); } else - Strm().WriteCharPtr(msfilter::rtfutil::OutStringUpr(pToken, rContent, m_eCurrentEncoding).getStr()); + Strm().WriteCharPtr( + msfilter::rtfutil::OutStringUpr(pToken, rContent, m_eCurrentEncoding).getStr()); } } @@ -1046,7 +1097,9 @@ sal_uInt16 RtfExport::GetColor(const Color& rColor) const for (const auto& rEntry : m_aColTable) if (rEntry.second == rColor) { - SAL_INFO("sw.rtf", OSL_THIS_FUNC << " returning " << rEntry.first << " (" << rColor.GetRed() << "," << rColor.GetGreen() << "," << rColor.GetBlue() << ")"); + SAL_INFO("sw.rtf", OSL_THIS_FUNC << " returning " << rEntry.first << " (" + << rColor.GetRed() << "," << rColor.GetGreen() << "," + << rColor.GetBlue() << ")"); return rEntry.first; } OSL_FAIL("No such Color in m_aColTable!"); @@ -1075,7 +1128,7 @@ void RtfExport::InsColor(const Color& rCol) // reserve value "0" for COL_AUTO (if COL_AUTO wasn't inserted until now) n++; } - m_aColTable.insert(std::pair<sal_uInt16,Color>(n, rCol)); + m_aColTable.insert(std::pair<sal_uInt16, Color>(n, rCol)); } void RtfExport::InsColorLine(const SvxBoxItem& rBox) @@ -1121,12 +1174,15 @@ void RtfExport::OutColorTable() { auto pCol = static_cast<const SvxColorItem*>(GetDfltAttr(RES_CHRATR_COLOR)); InsColor(pCol->GetValue()); - if (nullptr != (pCol = static_cast<const SvxColorItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_COLOR)))) + if (nullptr + != (pCol + = static_cast<const SvxColorItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_COLOR)))) InsColor(pCol->GetValue()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_COLOR); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (nullptr != (pCol = static_cast<const SvxColorItem*>(rPool.GetItem2(RES_CHRATR_COLOR, n)))) + if (nullptr + != (pCol = static_cast<const SvxColorItem*>(rPool.GetItem2(RES_CHRATR_COLOR, n)))) InsColor(pCol->GetValue()); } @@ -1135,9 +1191,10 @@ void RtfExport::OutColorTable() nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (nullptr != (pUnder = static_cast<const SvxUnderlineItem*>(rPool.GetItem2(RES_CHRATR_UNDERLINE, n)))) + if (nullptr + != (pUnder = static_cast<const SvxUnderlineItem*>( + rPool.GetItem2(RES_CHRATR_UNDERLINE, n)))) InsColor(pUnder->GetColor()); - } auto pOver = static_cast<const SvxOverlineItem*>(GetDfltAttr(RES_CHRATR_OVERLINE)); @@ -1145,18 +1202,15 @@ void RtfExport::OutColorTable() nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (nullptr != (pOver = static_cast<const SvxOverlineItem*>(rPool.GetItem2(RES_CHRATR_OVERLINE, n)))) + if (nullptr + != (pOver + = static_cast<const SvxOverlineItem*>(rPool.GetItem2(RES_CHRATR_OVERLINE, n)))) InsColor(pOver->GetColor()); - } - } // background color - static const sal_uInt16 aBrushIds[] = - { - RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0 - }; + static const sal_uInt16 aBrushIds[] = { RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0 }; for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds) { @@ -1180,14 +1234,16 @@ void RtfExport::OutColorTable() { auto pShadow = static_cast<const SvxShadowItem*>(GetDfltAttr(RES_SHADOW)); InsColor(pShadow->GetColor()); - if (nullptr != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetPoolDefaultItem(RES_SHADOW)))) + if (nullptr + != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetPoolDefaultItem(RES_SHADOW)))) { InsColor(pShadow->GetColor()); } nMaxItem = rPool.GetItemCount2(RES_SHADOW); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (nullptr != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetItem2(RES_SHADOW, n)))) + if (nullptr + != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetItem2(RES_SHADOW, n)))) { InsColor(pShadow->GetColor()); } @@ -1209,12 +1265,15 @@ void RtfExport::OutColorTable() { const SvxBoxItem* pCharBox; - if (nullptr != (pCharBox = static_cast<const SvxBoxItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_BOX)))) + if (nullptr + != (pCharBox + = static_cast<const SvxBoxItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_BOX)))) InsColorLine(*pCharBox); nMaxItem = rPool.GetItemCount2(RES_CHRATR_BOX); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (nullptr != (pCharBox = static_cast<const SvxBoxItem*>(rPool.GetItem2(RES_CHRATR_BOX, n)))) + if (nullptr + != (pCharBox = static_cast<const SvxBoxItem*>(rPool.GetItem2(RES_CHRATR_BOX, n)))) InsColorLine(*pCharBox); } } @@ -1229,7 +1288,7 @@ void RtfExport::OutColorTable() for (std::size_t n = 0; n < m_aColTable.size(); ++n) { - const Color& rCol = m_aColTable[ n ]; + const Color& rCol = m_aColTable[n]; if (n || COL_AUTO != rCol.GetColor()) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_RED); @@ -1243,7 +1302,7 @@ void RtfExport::OutColorTable() void RtfExport::InsStyle(sal_uInt16 nId, const OString& rStyle) { - m_aStyTable.insert(std::pair<sal_uInt16,OString>(nId, rStyle)); + m_aStyTable.insert(std::pair<sal_uInt16, OString>(nId, rStyle)); } OString* RtfExport::GetStyle(sal_uInt16 nId) @@ -1261,7 +1320,7 @@ sal_uInt16 RtfExport::GetRedline(const OUString& rAuthor) return it->second; const sal_uInt16 nId = m_aRedlineTable.size(); - m_aRedlineTable.insert(std::pair<OUString,sal_uInt16>(rAuthor,nId)); + m_aRedlineTable.insert(std::pair<OUString, sal_uInt16>(rAuthor, nId)); return nId; } @@ -1279,8 +1338,8 @@ void RtfExport::OutPageDescription(const SwPageDesc& rPgDsc, bool bCheckForFirst const SwPageDesc* pSave = m_pAktPageDesc; m_pAktPageDesc = &rPgDsc; - if (bCheckForFirstPage && m_pAktPageDesc->GetFollow() && - m_pAktPageDesc->GetFollow() != m_pAktPageDesc) + if (bCheckForFirstPage && m_pAktPageDesc->GetFollow() + && m_pAktPageDesc->GetFollow() != m_pAktPageDesc) m_pAktPageDesc = m_pAktPageDesc->GetFollow(); if (m_pAktPageDesc->GetLandscape()) @@ -1293,11 +1352,11 @@ void RtfExport::OutPageDescription(const SwPageDesc& rPgDsc, bool bCheckForFirst // normal header / footer (without a style) const SfxPoolItem* pItem; - if (m_pAktPageDesc->GetLeft().GetAttrSet().GetItemState(RES_HEADER, false, - &pItem) == SfxItemState::SET) + if (m_pAktPageDesc->GetLeft().GetAttrSet().GetItemState(RES_HEADER, false, &pItem) + == SfxItemState::SET) WriteHeaderFooter(*pItem, true); - if (m_pAktPageDesc->GetLeft().GetAttrSet().GetItemState(RES_FOOTER, false, - &pItem) == SfxItemState::SET) + if (m_pAktPageDesc->GetLeft().GetAttrSet().GetItemState(RES_FOOTER, false, &pItem) + == SfxItemState::SET) WriteHeaderFooter(*pItem, false); // title page @@ -1305,11 +1364,11 @@ void RtfExport::OutPageDescription(const SwPageDesc& rPgDsc, bool bCheckForFirst { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_TITLEPG); m_pAktPageDesc = &rPgDsc; - if (m_pAktPageDesc->GetMaster().GetAttrSet().GetItemState(RES_HEADER, - false, &pItem) == SfxItemState::SET) + if (m_pAktPageDesc->GetMaster().GetAttrSet().GetItemState(RES_HEADER, false, &pItem) + == SfxItemState::SET) WriteHeaderFooter(*pItem, true); - if (m_pAktPageDesc->GetMaster().GetAttrSet().GetItemState(RES_FOOTER, - false, &pItem) == SfxItemState::SET) + if (m_pAktPageDesc->GetMaster().GetAttrSet().GetItemState(RES_FOOTER, false, &pItem) + == SfxItemState::SET) WriteHeaderFooter(*pItem, false); } @@ -1337,7 +1396,8 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader) SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); - const sal_Char* pStr = (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADER : OOO_STRING_SVTOOLS_RTF_FOOTER); + const sal_Char* pStr + = (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADER : OOO_STRING_SVTOOLS_RTF_FOOTER); /* is this a title page? */ if (m_pAktPageDesc->GetFollow() && m_pAktPageDesc->GetFollow() != m_pAktPageDesc) { @@ -1351,7 +1411,8 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader) SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end"); } -void RtfExport::WriteHeaderFooter(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, bool bTitlepg) +void RtfExport::WriteHeaderFooter(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, + bool bTitlepg) { SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); @@ -1387,7 +1448,8 @@ ErrCode SwRTFWriter::WriteStream() return ERRCODE_NONE; } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF(const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF(const OUString& rFltName, + const OUString& rBaseURL, WriterRef& xRet) { xRet = new SwRTFWriter(rFltName, rBaseURL); } diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 9aec3899d79d..50ba510f4a7d 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -58,25 +58,13 @@ public: /// Access to the Rtf Sdr exporter. RtfSdrExport& SdrExporter() const; - bool SupportsOneColumnBreak() const override - { - return false; - } + bool SupportsOneColumnBreak() const override { return false; } - bool FieldsQuoted() const override - { - return true; - } + bool FieldsQuoted() const override { return true; } - bool AddSectionBreaksForTOX() const override - { - return false; - } + bool AddSectionBreaksForTOX() const override { return false; } - bool PreferPageBreakBefore() const override - { - return true; - } + bool PreferPageBreakBefore() const override { return true; } /// Guess the script (asian/western). bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) override; @@ -90,7 +78,10 @@ public: //For i120928,add an interface to export graphic of bullet void ExportGrfBullet(const SwTextNode& rNd) override; - void WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/) override + void + WriteCR(ww8::WW8TableNodeInfoInner:: + Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/) + override { /* no-op for rtf, most probably should not even be in MSWordExportBase */ } @@ -103,31 +94,26 @@ public: void WriteRevTab(); /// Output the actual headers and footers. - void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, - const SwFrameFormat& rFormat, const SwFrameFormat& rLeftFormat, const SwFrameFormat& rFirstPageFormat, sal_uInt8 nBreakCode) override; + void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat& rFormat, + const SwFrameFormat& rLeftFormat, + const SwFrameFormat& rFirstPageFormat, sal_uInt8 nBreakCode) override; /// Write the field - void OutputField(const SwField* pField, ww::eField eFieldType, - const OUString& rFieldCmd, FieldFlags nMode = FieldFlags::All) override; + void OutputField(const SwField* pField, ww::eField eFieldType, const OUString& rFieldCmd, + FieldFlags nMode = FieldFlags::All) override; /// Write the data of the form field void WriteFormData(const ::sw::mark::IFieldmark& rFieldmark) override; void WriteHyperlinkData(const ::sw::mark::IFieldmark& rFieldmark) override; - void DoComboBox(const OUString& rName, - const OUString& rHelp, - const OUString& ToolTip, - const OUString& rSelected, - css::uno::Sequence<OUString>& rListItems) override; + void DoComboBox(const OUString& rName, const OUString& rHelp, const OUString& ToolTip, + const OUString& rSelected, css::uno::Sequence<OUString>& rListItems) override; void DoFormText(const SwInputField* pField) override; sal_uLong ReplaceCr(sal_uInt8 nChar) override; - ExportFormat GetExportFormat() const override - { - return ExportFormat::RTF; - } + ExportFormat GetExportFormat() const override { return ExportFormat::RTF; } protected: /// Format-dependent part of the actual export. @@ -136,8 +122,7 @@ protected: void SectionBreaksAndFrames(const SwTextNode& /*rNode*/) override {} /// Get ready for a new section. - void PrepareNewPageDesc(const SfxItemSet* pSet, - const SwNode& rNd, + void PrepareNewPageDesc(const SfxItemSet* pSet, const SwNode& rNd, const SwFormatPageDesc* pNewPgDescFormat, const SwPageDesc* pNewPgDesc) override; @@ -158,13 +143,13 @@ protected: void OutputLinkedOLE(const OUString& rLink) override; - void AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* pFormat, sal_uLong nLnNum) override; + void AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat* pFormat, + sal_uLong nLnNum) override; public: /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, - SwPaM* pCurrentPam, SwPaM* pOriginalPam, Writer* pWriter, - bool bOutOutlineOnly = false); + RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, SwPaM* pCurrentPam, SwPaM* pOriginalPam, + Writer* pWriter, bool bOutOutlineOnly = false); RtfExport(const RtfExport&) = delete; @@ -220,11 +205,12 @@ private: /// This is necessary to have the numbering table ready before the main text is being processed. void BuildNumbering(); void WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader); - void WriteHeaderFooter(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, bool bTitlepg = false); + void WriteHeaderFooter(const SwFrameFormat& rFormat, bool bHeader, const sal_Char* pStr, + bool bTitlepg = false); RtfColorTable m_aColTable; - std::map<sal_uInt16, OString> m_aStyTable; - std::map<OUString, sal_uInt16> m_aRedlineTable; + std::map<sal_uInt16, OString> m_aStyTable; + std::map<OUString, sal_uInt16> m_aRedlineTable; /// If set, then Strm() returns this tream, instead of m_pWriter's stream. std::unique_ptr<SvMemoryStream> m_pStream; }; diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index 3c0ecbe360de..61abb4a8a2f5 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -38,15 +38,16 @@ RtfExportFilter::RtfExportFilter(uno::Reference<uno::XComponentContext> xCtx) RtfExportFilter::~RtfExportFilter() = default; -sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescriptor) +sal_Bool RtfExportFilter::filter(const uno::Sequence<beans::PropertyValue>& aDescriptor) { utl::MediaDescriptor aMediaDesc = aDescriptor; - uno::Reference<io::XStream> xStream = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference< io::XStream >()); + uno::Reference<io::XStream> xStream = aMediaDesc.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference<io::XStream>()); SvStream* pStream = utl::UcbStreamHelper::CreateStream(xStream, true); m_aWriter.SetStream(pStream); // get SwDoc* - uno::Reference< uno::XInterface > xIfc(m_xSrcDoc, uno::UNO_QUERY); + uno::Reference<uno::XInterface> xIfc(m_xSrcDoc, uno::UNO_QUERY); auto pTextDoc = dynamic_cast<SwXTextDocument*>(xIfc.get()); if (!pTextDoc) { @@ -87,28 +88,24 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aD return true; } -void RtfExportFilter::cancel() -{ -} +void RtfExportFilter::cancel() {} -void RtfExportFilter::setSourceDocument(const uno::Reference< lang::XComponent >& xDoc) +void RtfExportFilter::setSourceDocument(const uno::Reference<lang::XComponent>& xDoc) { m_xSrcDoc = xDoc; } // UNO helpers -OUString RtfExport_getImplementationName() -{ - return OUString(IMPL_NAME_RTFEXPORT); -} +OUString RtfExport_getImplementationName() { return OUString(IMPL_NAME_RTFEXPORT); } -uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames() noexcept +uno::Sequence<OUString> SAL_CALL RtfExport_getSupportedServiceNames() noexcept { - return uno::Sequence< OUString > { "com.sun.star.document.ExportFilter" }; + return uno::Sequence<OUString>{ "com.sun.star.document.ExportFilter" }; } -uno::Reference< uno::XInterface > SAL_CALL RtfExport_createInstance(const uno::Reference< uno::XComponentContext >& xCtx) +uno::Reference<uno::XInterface> + SAL_CALL RtfExport_createInstance(const uno::Reference<uno::XComponentContext>& xCtx) { return static_cast<cppu::OWeakObject*>(new RtfExportFilter(xCtx)); } diff --git a/sw/source/filter/ww8/rtfexportfilter.hxx b/sw/source/filter/ww8/rtfexportfilter.hxx index 33ebfe26acf7..472c3c1d5a86 100644 --- a/sw/source/filter/ww8/rtfexportfilter.hxx +++ b/sw/source/filter/ww8/rtfexportfilter.hxx @@ -30,31 +30,28 @@ class RtfWriter : public Writer { protected: - ErrCode WriteStream() override - { - return ERRCODE_NONE; - } + ErrCode WriteStream() override { return ERRCODE_NONE; } }; /// The physical access to the RTF document (for writing). -class RtfExportFilter final : public cppu::WeakImplHelper - < - css::document::XFilter, - css::document::XExporter - > +class RtfExportFilter final + : public cppu::WeakImplHelper<css::document::XFilter, css::document::XExporter> { css::uno::Reference<css::uno::XComponentContext> m_xCtx; css::uno::Reference<css::lang::XComponent> m_xSrcDoc; + public: explicit RtfExportFilter(css::uno::Reference<css::uno::XComponentContext> xCtx); ~RtfExportFilter() override; // XFilter - sal_Bool SAL_CALL filter(const css::uno::Sequence<css::beans::PropertyValue>& aDescriptor) override; + sal_Bool SAL_CALL + filter(const css::uno::Sequence<css::beans::PropertyValue>& aDescriptor) override; void SAL_CALL cancel() override; // XExporter - void SAL_CALL setSourceDocument(const css::uno::Reference<css::lang::XComponent>& xDoc) override; + void SAL_CALL + setSourceDocument(const css::uno::Reference<css::lang::XComponent>& xDoc) override; RtfWriter m_aWriter; }; @@ -62,7 +59,8 @@ public: OUString RtfExport_getImplementationName(); css::uno::Sequence<OUString> SAL_CALL RtfExport_getSupportedServiceNames() noexcept; /// @throws css::uno::Exception -css::uno::Reference<css::uno::XInterface> SAL_CALL RtfExport_createInstance(const css::uno::Reference<css::uno::XComponentContext>& xCtx); +css::uno::Reference<css::uno::XInterface> + SAL_CALL RtfExport_createInstance(const css::uno::Reference<css::uno::XComponentContext>& xCtx); #define IMPL_NAME_RTFEXPORT "com.sun.star.comp.Writer.RtfExport" diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index b8ca0b47bcb7..1a898b0906ab 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -37,14 +37,14 @@ using namespace css; RtfSdrExport::RtfSdrExport(RtfExport& rExport) - : EscherEx(std::make_shared<EscherExGlobal>(), nullptr), - m_rExport(rExport), - m_rAttrOutput(static_cast<RtfAttributeOutput&>(m_rExport.AttrOutput())), - m_pSdrObject(nullptr), - m_nShapeType(ESCHER_ShpInst_Nil), - m_nShapeFlags(ShapeFlag::NONE), - m_aShapeStyle(200), - m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ]) + : EscherEx(std::make_shared<EscherExGlobal>(), nullptr) + , m_rExport(rExport) + , m_rAttrOutput(static_cast<RtfAttributeOutput&>(m_rExport.AttrOutput())) + , m_pSdrObject(nullptr) + , m_nShapeType(ESCHER_ShpInst_Nil) + , m_nShapeFlags(ShapeFlag::NONE) + , m_aShapeStyle(200) + , m_pShapeTypeWritten(new bool[ESCHER_ShpInst_COUNT]) { mnGroupLevel = 1; memset(m_pShapeTypeWritten.get(), 0, ESCHER_ShpInst_COUNT * sizeof(bool)); @@ -84,15 +84,13 @@ void RtfSdrExport::CloseContainer() EscherEx::CloseContainer(); } -sal_uInt32 RtfSdrExport::EnterGroup(const OUString& /*rShapeName*/, const tools::Rectangle* /*pRect*/) +sal_uInt32 RtfSdrExport::EnterGroup(const OUString& /*rShapeName*/, + const tools::Rectangle* /*pRect*/) { return GenerateShapeId(); } -void RtfSdrExport::LeaveGroup() -{ - /* noop */ -} +void RtfSdrExport::LeaveGroup() { /* noop */} void RtfSdrExport::AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 /*nShapeId*/) { @@ -107,7 +105,8 @@ inline sal_uInt16 impl_GetUInt16(const sal_uInt8*& pVal) return nRet; } -inline sal_Int32 impl_GetPointComponent(const sal_uInt8*& pVal, std::size_t& rVerticesPos, sal_uInt16 nPointSize) +inline sal_Int32 impl_GetPointComponent(const sal_uInt8*& pVal, std::size_t& rVerticesPos, + sal_uInt16 nPointSize) { sal_Int32 nRet = 0; if ((nPointSize == 0xfff0) || (nPointSize == 4)) @@ -150,254 +149,297 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const tools::Rectangl switch (nId) { - case ESCHER_Prop_WrapText: - { - int nWrapType = 0; - switch (rOpt.nPropValue) + case ESCHER_Prop_WrapText: { - case ESCHER_WrapSquare: - nWrapType = 2; + int nWrapType = 0; + switch (rOpt.nPropValue) + { + case ESCHER_WrapSquare: + nWrapType = 2; + break; + case ESCHER_WrapByPoints: + nWrapType = 4; + break; + case ESCHER_WrapNone: + nWrapType = 3; + break; + case ESCHER_WrapTopBottom: + nWrapType = 1; + break; + case ESCHER_WrapThrough: + nWrapType = 5; + break; + } + if (nWrapType) + m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType); + } + break; + case ESCHER_Prop_fillColor: + m_aShapeProps.insert( + std::pair<OString, OString>("fillColor", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_fillBackColor: + m_aShapeProps.insert( + std::pair<OString, OString>("fillBackColor", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_AnchorText: + m_aShapeProps.insert( + std::pair<OString, OString>("anchorText", OString::number(rOpt.nPropValue))); break; - case ESCHER_WrapByPoints: - nWrapType = 4; + case ESCHER_Prop_fNoFillHitTest: + if (rOpt.nPropValue) + m_aShapeProps.insert( + std::pair<OString, OString>("fNoFillHitTest", OString::number(1))); break; - case ESCHER_WrapNone: - nWrapType = 3; + case ESCHER_Prop_fNoLineDrawDash: + // for some reason the value is set to 0x90000 if lines are switched off + if (rOpt.nPropValue == 0x90000) + m_aShapeProps.insert(std::pair<OString, OString>("fLine", OString::number(0))); break; - case ESCHER_WrapTopBottom: - nWrapType = 1; + case ESCHER_Prop_lineColor: + m_aShapeProps.insert( + std::pair<OString, OString>("lineColor", OString::number(rOpt.nPropValue))); break; - case ESCHER_WrapThrough: - nWrapType = 5; + case ESCHER_Prop_lineBackColor: + m_aShapeProps.insert( + std::pair<OString, OString>("lineBackColor", OString::number(rOpt.nPropValue))); break; + case ESCHER_Prop_lineJoinStyle: + m_aShapeProps.insert( + std::pair<OString, OString>("lineJoinStyle", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_fshadowObscured: + if (rOpt.nPropValue) + m_aShapeProps.insert(std::pair<OString, OString>("fshadowObscured", "1")); + break; + case ESCHER_Prop_geoLeft: + case ESCHER_Prop_geoTop: + { + sal_uInt32 nLeft = 0, nTop = 0; + + if (nId == ESCHER_Prop_geoLeft) + { + nLeft = rOpt.nPropValue; + rProps.GetOpt(ESCHER_Prop_geoTop, nTop); + } + else + { + nTop = rOpt.nPropValue; + rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft); + } + + m_aShapeProps.insert( + std::pair<OString, OString>("geoLeft", OString::number(sal_Int32(nLeft)))); + m_aShapeProps.insert( + std::pair<OString, OString>("geoTop", OString::number(sal_Int32(nTop)))); } - if (nWrapType) - m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType); - } - break; - case ESCHER_Prop_fillColor: - m_aShapeProps.insert(std::pair<OString,OString>("fillColor", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fillBackColor: - m_aShapeProps.insert(std::pair<OString,OString>("fillBackColor", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_AnchorText: - m_aShapeProps.insert(std::pair<OString,OString>("anchorText", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fNoFillHitTest: - if (rOpt.nPropValue) - m_aShapeProps.insert(std::pair<OString,OString>("fNoFillHitTest", OString::number(1))); break; - case ESCHER_Prop_fNoLineDrawDash: - // for some reason the value is set to 0x90000 if lines are switched off - if (rOpt.nPropValue == 0x90000) - m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0))); - break; - case ESCHER_Prop_lineColor: - m_aShapeProps.insert(std::pair<OString,OString>("lineColor", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_lineBackColor: - m_aShapeProps.insert(std::pair<OString,OString>("lineBackColor", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_lineJoinStyle: - m_aShapeProps.insert(std::pair<OString,OString>("lineJoinStyle", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fshadowObscured: - if (rOpt.nPropValue) - m_aShapeProps.insert(std::pair<OString,OString>("fshadowObscured", "1")); - break; - case ESCHER_Prop_geoLeft: - case ESCHER_Prop_geoTop: - { - sal_uInt32 nLeft = 0, nTop = 0; - if (nId == ESCHER_Prop_geoLeft) + case ESCHER_Prop_geoRight: + case ESCHER_Prop_geoBottom: { - nLeft = rOpt.nPropValue; - rProps.GetOpt(ESCHER_Prop_geoTop, nTop); - } - else - { - nTop = rOpt.nPropValue; + sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0; rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft); - } - - m_aShapeProps.insert(std::pair<OString,OString>("geoLeft", - OString::number(sal_Int32(nLeft)))); - m_aShapeProps.insert(std::pair<OString,OString>("geoTop", - OString::number(sal_Int32(nTop)))); - } - break; + rProps.GetOpt(ESCHER_Prop_geoTop, nTop); - case ESCHER_Prop_geoRight: - case ESCHER_Prop_geoBottom: - { - sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0; - rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft); - rProps.GetOpt(ESCHER_Prop_geoTop, nTop); + if (nId == ESCHER_Prop_geoRight) + { + nRight = rOpt.nPropValue; + rProps.GetOpt(ESCHER_Prop_geoBottom, nBottom); + } + else + { + nBottom = rOpt.nPropValue; + rProps.GetOpt(ESCHER_Prop_geoRight, nRight); + } - if (nId == ESCHER_Prop_geoRight) - { - nRight = rOpt.nPropValue; - rProps.GetOpt(ESCHER_Prop_geoBottom, nBottom); + m_aShapeProps.insert(std::pair<OString, OString>( + "geoRight", OString::number(sal_Int32(nRight) - sal_Int32(nLeft)))); + m_aShapeProps.insert(std::pair<OString, OString>( + "geoBottom", OString::number(sal_Int32(nBottom) - sal_Int32(nTop)))); } - else + break; + case ESCHER_Prop_pVertices: + case ESCHER_Prop_pSegmentInfo: { - nBottom = rOpt.nPropValue; - rProps.GetOpt(ESCHER_Prop_geoRight, nRight); - } - - m_aShapeProps.insert(std::pair<OString,OString>("geoRight", - OString::number(sal_Int32(nRight) - sal_Int32(nLeft)))); - m_aShapeProps.insert(std::pair<OString,OString>("geoBottom", - OString::number(sal_Int32(nBottom) - sal_Int32(nTop)))); - } - break; - case ESCHER_Prop_pVertices: - case ESCHER_Prop_pSegmentInfo: - { - EscherPropSortStruct aVertices; - EscherPropSortStruct aSegments; + EscherPropSortStruct aVertices; + EscherPropSortStruct aSegments; - if (rProps.GetOpt(ESCHER_Prop_pVertices, aVertices) && - rProps.GetOpt(ESCHER_Prop_pSegmentInfo, aSegments) && - aVertices.nPropSize >= 6 && aSegments.nPropSize >= 6) - { - const sal_uInt8* pVerticesIt = aVertices.pBuf + 6; - std::size_t nVerticesPos = 6; - const sal_uInt8* pSegmentIt = aSegments.pBuf; + if (rProps.GetOpt(ESCHER_Prop_pVertices, aVertices) + && rProps.GetOpt(ESCHER_Prop_pSegmentInfo, aSegments) + && aVertices.nPropSize >= 6 && aSegments.nPropSize >= 6) + { + const sal_uInt8* pVerticesIt = aVertices.pBuf + 6; + std::size_t nVerticesPos = 6; + const sal_uInt8* pSegmentIt = aSegments.pBuf; - OStringBuffer aSegmentInfo(512); - OStringBuffer aVerticies(512); + OStringBuffer aSegmentInfo(512); + OStringBuffer aVerticies(512); - sal_uInt16 nPointSize = aVertices.pBuf[4] + (aVertices.pBuf[5] << 8); + sal_uInt16 nPointSize = aVertices.pBuf[4] + (aVertices.pBuf[5] << 8); - // number of segments - sal_uInt16 nSegments = impl_GetUInt16(pSegmentIt); - sal_Int32 nVertices = 0; - aSegmentInfo.append("2;").append((sal_Int32)nSegments); - pSegmentIt += 4; + // number of segments + sal_uInt16 nSegments = impl_GetUInt16(pSegmentIt); + sal_Int32 nVertices = 0; + aSegmentInfo.append("2;").append((sal_Int32)nSegments); + pSegmentIt += 4; - for (; nSegments; --nSegments) - { - sal_uInt16 nSeg = impl_GetUInt16(pSegmentIt); + for (; nSegments; --nSegments) + { + sal_uInt16 nSeg = impl_GetUInt16(pSegmentIt); - // The segment type is stored in the upper 3 bits - // and segment count is stored in the lower 13 - // bits. - unsigned char nSegmentType = (nSeg & 0xE000) >> 13; - unsigned short nSegmentCount = nSeg & 0x03FF; + // The segment type is stored in the upper 3 bits + // and segment count is stored in the lower 13 + // bits. + unsigned char nSegmentType = (nSeg & 0xE000) >> 13; + unsigned short nSegmentCount = nSeg & 0x03FF; - aSegmentInfo.append(';').append((sal_Int32)nSeg); - switch (nSegmentType) - { - case msopathLineTo: - for (unsigned short i = 0; i < nSegmentCount; ++i) + aSegmentInfo.append(';').append((sal_Int32)nSeg); + switch (nSegmentType) { - sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - aVerticies.append(";(").append(nX).append(",").append(nY).append(")"); - nVertices ++; - } - break; - case msopathMoveTo: - { - sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - aVerticies.append(";(").append(nX).append(",").append(nY).append(")"); - nVertices++; - break; - } - case msopathCurveTo: - for (unsigned short j = 0; j < nSegmentCount; ++j) - { - for (int i = 0; i < 3; i++) + case msopathLineTo: + for (unsigned short i = 0; i < nSegmentCount; ++i) + { + sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, + nPointSize); + sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, + nPointSize); + aVerticies.append(";(") + .append(nX) + .append(",") + .append(nY) + .append(")"); + nVertices++; + } + break; + case msopathMoveTo: + { + sal_Int32 nX + = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); + sal_Int32 nY + = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); + aVerticies.append(";(").append(nX).append(",").append(nY).append( + ")"); + nVertices++; + break; + } + case msopathCurveTo: + for (unsigned short j = 0; j < nSegmentCount; ++j) + { + for (int i = 0; i < 3; i++) + { + sal_Int32 nX = impl_GetPointComponent( + pVerticesIt, nVerticesPos, nPointSize); + sal_Int32 nY = impl_GetPointComponent( + pVerticesIt, nVerticesPos, nPointSize); + aVerticies.append(";(") + .append(nX) + .append(",") + .append(nY) + .append(")"); + nVertices++; + } + } + break; + case msopathEscape: { - sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nVerticesPos, nPointSize); - aVerticies.append(";(").append(nX).append(",").append(nY).append(")"); - nVertices ++; + // If the segment type is msopathEscape, the lower 13 bits are + // divided in a 5 bit escape code and 8 bit + // vertex count (not segment count!) + unsigned char nVertexCount = nSegmentCount & 0x00FF; + nVerticesPos += nVertexCount; + break; } + case msopathClientEscape: + case msopathClose: + case msopathEnd: + break; + default: + SAL_WARN("sw.rtf", "Totally b0rked"); + break; } - break; - case msopathEscape: - { - // If the segment type is msopathEscape, the lower 13 bits are - // divided in a 5 bit escape code and 8 bit - // vertex count (not segment count!) - unsigned char nVertexCount = nSegmentCount & 0x00FF; - nVerticesPos += nVertexCount; - break; } - case msopathClientEscape: - case msopathClose: - case msopathEnd: - break; - default: - SAL_WARN("sw.rtf", "Totally b0rked"); - break; - } - } - if (!aVerticies.isEmpty()) - { - // We know the number of vertices at the end only, so we have to prepend them here. - m_aShapeProps.insert(std::pair<OString,OString>("pVerticies", "8;" + OString::number(nVertices) + aVerticies.makeStringAndClear())); + if (!aVerticies.isEmpty()) + { + // We know the number of vertices at the end only, so we have to prepend them here. + m_aShapeProps.insert(std::pair<OString, OString>( + "pVerticies", + "8;" + OString::number(nVertices) + aVerticies.makeStringAndClear())); + } + if (!aSegmentInfo.isEmpty()) + m_aShapeProps.insert(std::pair<OString, OString>( + "pSegmentInfo", aSegmentInfo.makeStringAndClear())); } - if (!aSegmentInfo.isEmpty()) - m_aShapeProps.insert(std::pair<OString,OString>("pSegmentInfo", aSegmentInfo.makeStringAndClear())); + else + SAL_INFO( + "sw.rtf", + OSL_THIS_FUNC + << ": unhandled shape path, missing either pVertices or pSegmentInfo"); } - else - SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled shape path, missing either pVertices or pSegmentInfo"); - } - break; - case ESCHER_Prop_shapePath: - // noop, we use pSegmentInfo instead - break; - case ESCHER_Prop_fFillOK: - if (!rOpt.nPropValue) - m_aShapeProps.insert(std::pair<OString,OString>("fFillOK", "0")); break; - case ESCHER_Prop_dxTextLeft: - m_aShapeProps.insert(std::pair<OString,OString>("dxTextLeft", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_dyTextTop: - m_aShapeProps.insert(std::pair<OString,OString>("dyTextTop", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_dxTextRight: - m_aShapeProps.insert(std::pair<OString,OString>("dxTextRight", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_dyTextBottom: - m_aShapeProps.insert(std::pair<OString,OString>("dyTextBottom", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_FitTextToShape: - // Size text to fit shape size: not supported by RTF - break; - case ESCHER_Prop_adjustValue: - m_aShapeProps.insert(std::pair<OString,OString>("adjustValue", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_txflTextFlow: - m_aShapeProps.insert(std::pair<OString,OString>("txflTextFlow", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fillType: - m_aShapeProps.insert(std::pair<OString,OString>("fillType", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fillOpacity: - m_aShapeProps.insert(std::pair<OString,OString>("fillOpacity", OString::number(rOpt.nPropValue))); - break; - case ESCHER_Prop_fillBlip: - { - OStringBuffer aBuf; - aBuf.append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP).append(SAL_NEWLINE_STRING); - int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG - aBuf.append(RtfAttributeOutput::WriteHex(rOpt.pBuf + nHeaderSize, rOpt.nPropSize - nHeaderSize)); - aBuf.append('}'); - m_aShapeProps.insert(std::pair<OString,OString>("fillBlip", aBuf.makeStringAndClear())); - } - break; - default: - SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId << " (value: " << rOpt.nPropValue << ")"); + case ESCHER_Prop_shapePath: + // noop, we use pSegmentInfo instead + break; + case ESCHER_Prop_fFillOK: + if (!rOpt.nPropValue) + m_aShapeProps.insert(std::pair<OString, OString>("fFillOK", "0")); + break; + case ESCHER_Prop_dxTextLeft: + m_aShapeProps.insert( + std::pair<OString, OString>("dxTextLeft", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_dyTextTop: + m_aShapeProps.insert( + std::pair<OString, OString>("dyTextTop", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_dxTextRight: + m_aShapeProps.insert( + std::pair<OString, OString>("dxTextRight", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_dyTextBottom: + m_aShapeProps.insert( + std::pair<OString, OString>("dyTextBottom", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_FitTextToShape: + // Size text to fit shape size: not supported by RTF + break; + case ESCHER_Prop_adjustValue: + m_aShapeProps.insert( + std::pair<OString, OString>("adjustValue", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_txflTextFlow: + m_aShapeProps.insert( + std::pair<OString, OString>("txflTextFlow", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_fillType: + m_aShapeProps.insert( + std::pair<OString, OString>("fillType", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_fillOpacity: + m_aShapeProps.insert( + std::pair<OString, OString>("fillOpacity", OString::number(rOpt.nPropValue))); + break; + case ESCHER_Prop_fillBlip: + { + OStringBuffer aBuf; + aBuf.append('{') + .append(OOO_STRING_SVTOOLS_RTF_PICT) + .append(OOO_STRING_SVTOOLS_RTF_PNGBLIP) + .append(SAL_NEWLINE_STRING); + int nHeaderSize + = 25; // The first bytes are WW8-specific, we're only interested in the PNG + aBuf.append(RtfAttributeOutput::WriteHex(rOpt.pBuf + nHeaderSize, + rOpt.nPropSize - nHeaderSize)); + aBuf.append('}'); + m_aShapeProps.insert( + std::pair<OString, OString>("fillBlip", aBuf.makeStringAndClear())); + } break; + default: + SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId + << " (value: " << rOpt.nPropValue << ")"); + break; } } } @@ -405,13 +447,13 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const tools::Rectangl void RtfSdrExport::AddLineDimensions(const tools::Rectangle& rRectangle) { // We get the position relative to (the current?) character - m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3")); + m_aShapeProps.insert(std::pair<OString, OString>("posrelh", "3")); if (m_nShapeFlags & ShapeFlag::FlipV) - m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1")); + m_aShapeProps.insert(std::pair<OString, OString>("fFlipV", "1")); if (m_nShapeFlags & ShapeFlag::FlipH) - m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1")); + m_aShapeProps.insert(std::pair<OString, OString>("fFlipH", "1")); // the actual dimensions m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left()); @@ -420,10 +462,11 @@ void RtfSdrExport::AddLineDimensions(const tools::Rectangle& rRectangle) m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom()); } -void RtfSdrExport::AddRectangleDimensions(OStringBuffer& rBuffer, const tools::Rectangle& rRectangle) +void RtfSdrExport::AddRectangleDimensions(OStringBuffer& rBuffer, + const tools::Rectangle& rRectangle) { // We get the position relative to (the current?) character - m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3")); + m_aShapeProps.insert(std::pair<OString, OString>("posrelh", "3")); rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left()); rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPTOP).append(rRectangle.Top()); @@ -435,16 +478,24 @@ extern const char* pShapeTypes[]; static void lcl_AppendSP(OStringBuffer& rRunText, const char cName[], const OString& rValue) { - rRunText.append('{').append(OOO_STRING_SVTOOLS_RTF_SP) - .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}') - .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append(rValue).append('}') - .append('}'); + rRunText.append('{') + .append(OOO_STRING_SVTOOLS_RTF_SP) + .append('{') + .append(OOO_STRING_SVTOOLS_RTF_SN " ") + .append(cName) + .append('}') + .append('{') + .append(OOO_STRING_SVTOOLS_RTF_SV " ") + .append(rValue) + .append('}') + .append('}'); } void RtfSdrExport::impl_writeGraphic() { // Get the Graphic object from the Sdr one. - uno::Reference<drawing::XShape> xShape = GetXShapeForSdrObject(const_cast<SdrObject*>(m_pSdrObject)); + uno::Reference<drawing::XShape> xShape + = GetXShapeForSdrObject(const_cast<SdrObject*>(m_pSdrObject)); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); OUString sGraphicURL; try @@ -458,7 +509,9 @@ void RtfSdrExport::impl_writeGraphic() return; } OString aURLBS(OUStringToOString(sGraphicURL, RTL_TEXTENCODING_UTF8)); - Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH("vnd.sun.star.GraphicObject:"))).GetTransformedGraphic(); + Graphic aGraphic + = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH("vnd.sun.star.GraphicObject:"))) + .GetTransformedGraphic(); // Export it to a stream. SvMemoryStream aStream; @@ -473,10 +526,12 @@ void RtfSdrExport::impl_writeGraphic() RtfStringBuffer aBuf; aBuf->append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP); aBuf->append(OOO_STRING_SVTOOLS_RTF_PICW).append(sal_Int32(aMapped.Width())); - aBuf->append(OOO_STRING_SVTOOLS_RTF_PICH).append(sal_Int32(aMapped.Height())).append(SAL_NEWLINE_STRING); + aBuf->append(OOO_STRING_SVTOOLS_RTF_PICH) + .append(sal_Int32(aMapped.Height())) + .append(SAL_NEWLINE_STRING); aBuf->append(RtfAttributeOutput::WriteHex(pGraphicAry, nSize)); aBuf->append('}'); - m_aShapeProps.insert(std::pair<OString,OString>("pib", aBuf.makeStringAndClear())); + m_aShapeProps.insert(std::pair<OString, OString>("pib", aBuf.makeStringAndClear())); } sal_Int32 RtfSdrExport::StartShape() @@ -484,12 +539,15 @@ sal_Int32 RtfSdrExport::StartShape() if (m_nShapeType == ESCHER_ShpInst_Nil) return -1; - m_aShapeProps.insert(std::pair<OString,OString>("shapeType", OString::number(m_nShapeType))); + m_aShapeProps.insert(std::pair<OString, OString>("shapeType", OString::number(m_nShapeType))); if (ESCHER_ShpInst_PictureFrame == m_nShapeType) impl_writeGraphic(); m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHP); - m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_IGNORE).append(OOO_STRING_SVTOOLS_RTF_SHPINST); + m_rAttrOutput.RunText() + .append('{') + .append(OOO_STRING_SVTOOLS_RTF_IGNORE) + .append(OOO_STRING_SVTOOLS_RTF_SHPINST); m_rAttrOutput.RunText().append(m_aShapeStyle.makeStringAndClear()); // Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. @@ -504,14 +562,19 @@ sal_Int32 RtfSdrExport::StartShape() for (auto it = m_aShapeProps.rbegin(); it != m_aShapeProps.rend(); ++it) lcl_AppendSP(m_rAttrOutput.RunText(), (*it).first.getStr(), (*it).second); - lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", msfilter::rtfutil::OutString(m_pSdrObject->GetDescription(), m_rExport.m_eCurrentEncoding)); - lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", msfilter::rtfutil::OutString(m_pSdrObject->GetName(), m_rExport.m_eCurrentEncoding)); + lcl_AppendSP( + m_rAttrOutput.RunText(), "wzDescription", + msfilter::rtfutil::OutString(m_pSdrObject->GetDescription(), m_rExport.m_eCurrentEncoding)); + lcl_AppendSP( + m_rAttrOutput.RunText(), "wzName", + msfilter::rtfutil::OutString(m_pSdrObject->GetName(), m_rExport.m_eCurrentEncoding)); // now check if we have some text const SwFrameFormat* pShape = FindFrameFormat(m_pSdrObject); if (pShape) { - if (SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT)) + if (SwFrameFormat* pTextBox + = SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT)) { ww8::Frame* pFrame = nullptr; for (auto& rFrame : m_rExport.m_aFrames) @@ -562,28 +625,37 @@ sal_Int32 RtfSdrExport::StartShape() const SfxItemSet& rItemSet = rEditObj.GetParaAttribs(0); lcl_AppendSP(m_rAttrOutput.RunText(), "gtextUNICODE", - msfilter::rtfutil::OutString(rEditObj.GetText(0), m_rExport.m_eCurrentEncoding)); + msfilter::rtfutil::OutString(rEditObj.GetText(0), + m_rExport.m_eCurrentEncoding)); - auto pFontFamily = static_cast<const SvxFontItem*>(rItemSet.GetItem(SID_ATTR_CHAR_FONT)); + auto pFontFamily + = static_cast<const SvxFontItem*>(rItemSet.GetItem(SID_ATTR_CHAR_FONT)); if (pFontFamily) { lcl_AppendSP(m_rAttrOutput.RunText(), "gtextFont", - msfilter::rtfutil::OutString(pFontFamily->GetFamilyName(), m_rExport.m_eCurrentEncoding)); + msfilter::rtfutil::OutString(pFontFamily->GetFamilyName(), + m_rExport.m_eCurrentEncoding)); } - auto pFontHeight = static_cast<const SvxFontHeightItem*>(rItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT)); + auto pFontHeight = static_cast<const SvxFontHeightItem*>( + rItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT)); if (pFontHeight) { - long nFontHeight = TransformMetric(pFontHeight->GetHeight(), FUNIT_TWIP, FUNIT_POINT); - lcl_AppendSP(m_rAttrOutput.RunText(), "gtextSize", - msfilter::rtfutil::OutString(OUString::number(nFontHeight * RTF_MULTIPLIER), m_rExport.m_eCurrentEncoding)); + long nFontHeight + = TransformMetric(pFontHeight->GetHeight(), FUNIT_TWIP, FUNIT_POINT); + lcl_AppendSP( + m_rAttrOutput.RunText(), "gtextSize", + msfilter::rtfutil::OutString(OUString::number(nFontHeight * RTF_MULTIPLIER), + m_rExport.m_eCurrentEncoding)); } // RTF angle: 0-360 * 2^16 clockwise // LO angle: 0-360 * 100 counter-clockwise - sal_Int32 nRotation = -1 * pTextObj->GetGeoStat().nRotationAngle * RTF_MULTIPLIER / 100; + sal_Int32 nRotation + = -1 * pTextObj->GetGeoStat().nRotationAngle * RTF_MULTIPLIER / 100; lcl_AppendSP(m_rAttrOutput.RunText(), "rotation", - msfilter::rtfutil::OutString(OUString::number(nRotation), m_rExport.m_eCurrentEncoding)); + msfilter::rtfutil::OutString(OUString::number(nRotation), + m_rExport.m_eCurrentEncoding)); } } } @@ -640,8 +712,7 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj, TextTypes e nAktPos = nNextAttr; eChrSet = eNextChrSet; aAttrIter.NextPos(); - } - while (nAktPos < nEnd); + } while (nAktPos < nEnd); if (bShape || n + 1 < nPara) m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_PAR); } diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx index b8b84fdf3ede..894089e9ce39 100644 --- a/sw/source/filter/ww8/rtfsdrexport.hxx +++ b/sw/source/filter/ww8/rtfsdrexport.hxx @@ -52,7 +52,7 @@ class RtfSdrExport final : public EscherEx /// Remember style, the most important shape attribute ;-) OStringBuffer m_aShapeStyle; - std::map<OString,OString> m_aShapeProps; + std::map<OString, OString> m_aShapeProps; /// Remember which shape types we had already written. std::unique_ptr<bool[]> m_pShapeTypeWritten; @@ -76,13 +76,13 @@ private: /// /// Returns the element's tag number, -1 means we wrote nothing. using EscherEx::StartShape; - sal_Int32 StartShape(); + sal_Int32 StartShape(); /// End the shape. /// /// The parameter is just what we got from StartShape(). using EscherEx::EndShape; - void EndShape(sal_Int32 nShapeElement); + void EndShape(sal_Int32 nShapeElement); void Commit(EscherPropertyContainer& rProps, const tools::Rectangle& rRect) override; diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx b/sw/source/filter/ww8/rtfstringbuffer.cxx index cd6c3eb6c4c2..a84c5846da4a 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.cxx +++ b/sw/source/filter/ww8/rtfstringbuffer.cxx @@ -11,9 +11,10 @@ RtfStringBufferValue::RtfStringBufferValue() = default; -RtfStringBufferValue::RtfStringBufferValue(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode) - : m_pFlyFrameFormat(pFlyFrameFormat), - m_pGrfNode(pGrfNode) +RtfStringBufferValue::RtfStringBufferValue(const SwFlyFrameFormat* pFlyFrameFormat, + const SwGrfNode* pGrfNode) + : m_pFlyFrameFormat(pFlyFrameFormat) + , m_pGrfNode(pGrfNode) { } @@ -25,10 +26,7 @@ void RtfStringBufferValue::makeStringAndClear(RtfAttributeOutput* pAttributeOutp pAttributeOutput->FlyFrameGraphic(m_pFlyFrameFormat, m_pGrfNode); } -OString RtfStringBufferValue::makeStringAndClear() -{ - return m_aBuffer.makeStringAndClear(); -} +OString RtfStringBufferValue::makeStringAndClear() { return m_aBuffer.makeStringAndClear(); } bool RtfStringBufferValue::isGraphic() const { @@ -68,15 +66,9 @@ OStringBuffer& RtfStringBuffer::getLastBuffer() return m_aValues.back().m_aBuffer; } -OStringBuffer* RtfStringBuffer::operator->() -{ - return &getLastBuffer(); -} +OStringBuffer* RtfStringBuffer::operator->() { return &getLastBuffer(); } -void RtfStringBuffer::clear() -{ - m_aValues.clear(); -} +void RtfStringBuffer::clear() { m_aValues.clear(); } void RtfStringBuffer::append(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode) { diff --git a/sw/source/filter/ww8/rtfstringbuffer.hxx b/sw/source/filter/ww8/rtfstringbuffer.hxx index e8e5580569f2..71b3df3a5240 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.hxx +++ b/sw/source/filter/ww8/rtfstringbuffer.hxx @@ -55,6 +55,7 @@ public: void append(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode); /// Append all contained buffers and clear the argument. void appendAndClear(RtfStringBuffer& rBuf); + private: using Values_t = std::vector<RtfStringBufferValue>; Values_t m_aValues; 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; |