filter/source/msfilter/rtfutil.cxx | 129 include/filter/msfilter/rtfutil.hxx | 17 solenv/clang-format/blacklist | 50 starmath/source/rtfexport.cxx | 334 - starmath/source/rtfexport.hxx | 2 sw/qa/extras/rtfexport/rtfexport.cxx | 586 +- sw/qa/extras/rtfexport/rtfexport2.cxx | 687 ++- sw/qa/extras/rtfexport/rtfexport3.cxx | 25 sw/qa/extras/rtfimport/rtfimport.cxx | 454 +- sw/source/filter/rtf/swparrtf.cxx | 57 sw/source/filter/ww8/rtfattributeoutput.cxx | 2533 ++++++------ sw/source/filter/ww8/rtfattributeoutput.hxx | 92 sw/source/filter/ww8/rtfexport.cxx | 502 +- sw/source/filter/ww8/rtfexport.hxx | 64 sw/source/filter/ww8/rtfexportfilter.cxx | 25 sw/source/filter/ww8/rtfexportfilter.hxx | 22 sw/source/filter/ww8/rtfsdrexport.cxx | 589 +- sw/source/filter/ww8/rtfsdrexport.hxx | 6 sw/source/filter/ww8/rtfstringbuffer.cxx | 22 sw/source/filter/ww8/rtfstringbuffer.hxx | 1 writerfilter/inc/rtftok/RTFDocument.hxx | 3 writerfilter/qa/cppunittests/rtftok/testrtftok.cxx | 28 writerfilter/source/rtftok/README | 11 writerfilter/source/rtftok/astyle.options | 11 writerfilter/source/rtftok/rtfcharsets.cxx | 66 writerfilter/source/rtftok/rtfcontrolwords.cxx | 3747 ++++++++---------- writerfilter/source/rtftok/rtfcontrolwords.hxx | 1 writerfilter/source/rtftok/rtfdispatchdestination.cxx | 1097 ++--- writerfilter/source/rtftok/rtfdispatchflag.cxx | 1739 ++++---- writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 650 +-- writerfilter/source/rtftok/rtfdispatchvalue.cxx | 2457 ++++++----- writerfilter/source/rtftok/rtfdocumentfactory.cxx | 17 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3621 +++++++++-------- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 107 writerfilter/source/rtftok/rtffly.hxx | 104 writerfilter/source/rtftok/rtflookahead.cxx | 52 writerfilter/source/rtftok/rtflookahead.hxx | 6 writerfilter/source/rtftok/rtfreferenceproperties.cxx | 5 writerfilter/source/rtftok/rtfreferenceproperties.hxx | 14 writerfilter/source/rtftok/rtfreferencetable.cxx | 1 writerfilter/source/rtftok/rtfreferencetable.hxx | 4 writerfilter/source/rtftok/rtfsdrimport.cxx | 484 +- writerfilter/source/rtftok/rtfsdrimport.hxx | 42 writerfilter/source/rtftok/rtfskipdestination.cxx | 17 writerfilter/source/rtftok/rtfskipdestination.hxx | 1 writerfilter/source/rtftok/rtfsprm.cxx | 111 writerfilter/source/rtftok/rtfsprm.hxx | 37 writerfilter/source/rtftok/rtftokenizer.cxx | 205 writerfilter/source/rtftok/rtftokenizer.hxx | 19 writerfilter/source/rtftok/rtfvalue.cxx | 160 writerfilter/source/rtftok/rtfvalue.hxx | 8 51 files changed, 11006 insertions(+), 10016 deletions(-)
New commits: commit fd6150915253e382a7e9f674fe23a72a9a801761 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Nov 22 09:20:23 2017 +0100 RTF filter: drop now redundant astyle.options I (tried to) keep the RTF filter style consistent locally with astyle in the past, but now that's redundant when we have an enforcing clang-format mechanism in place. So drop the astyle config and switch to clang-format in the RTF filter case. To minimize backport pain, do this shortly before the libreoffice-6-0 branch-off. Change-Id: I708dbeb0b5ad2afacc90029ee5abba9495f4601f 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); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits