Kaydet (Commit) fd615091 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 9ffa900c
......@@ -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(" ");
......
......@@ -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);
}
}
......
......@@ -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
......
This diff is collapsed.
......@@ -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: */
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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();
......
......@@ -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: */
......@@ -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;
};
......
......@@ -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));
}
......
......@@ -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"
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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.
......
......@@ -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
}
......
......@@ -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.
# formatting options
style=allman
indent=spaces=4
align-pointer=type
break-closing-brackets
pad-header
unpad-paren
# processing options
recursive
suffix=none
......@@ -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);
......
......@@ -14,7 +14,6 @@ namespace writerfilter
{
namespace rtftok
{
/**
* An RTF destination state is the last open destination control word.
*
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
{
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment