summaryrefslogtreecommitdiff
path: root/sw/source/filter/rtf
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-22 09:20:23 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-11-22 11:24:24 +0100
commitfd6150915253e382a7e9f674fe23a72a9a801761 (patch)
treeaa76c8e0cd09eaa2cafbf7897fe48eb42a0886ec /sw/source/filter/rtf
parent9ffa900cb4d0381587162e3deb9d910965b69d58 (diff)
RTF filter: drop now redundant astyle.options
I (tried to) keep the RTF filter style consistent locally with astyle in the past, but now that's redundant when we have an enforcing clang-format mechanism in place. So drop the astyle config and switch to clang-format in the RTF filter case. To minimize backport pain, do this shortly before the libreoffice-6-0 branch-off. Change-Id: I708dbeb0b5ad2afacc90029ee5abba9495f4601f
Diffstat (limited to 'sw/source/filter/rtf')
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx57
1 files changed, 31 insertions, 26 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 99fd13ab0a33..e56ec072faf0 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -40,10 +40,12 @@ using namespace ::com::sun::star;
/// Glue class to call RtfImport as an internal filter, needed by copy&paste support.
class SwRTFReader : public Reader
{
- ErrCode Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam, const OUString& rFileName) override;
+ ErrCode Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam,
+ const OUString& rFileName) override;
};
-ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString& /*rFileName*/)
+ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam,
+ const OUString& /*rFileName*/)
{
if (!pStrm)
return ERR_SWG_READ_ERROR;
@@ -51,13 +53,14 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
// We want to work in an empty paragraph.
// Step 1: XTextRange will be updated when content is inserted, so we know
// the end position.
- const uno::Reference<text::XTextRange> xInsertPosition = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
+ const uno::Reference<text::XTextRange> xInsertPosition
+ = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
std::shared_ptr<SwNodeIndex> pSttNdIdx(new SwNodeIndex(rDoc.GetNodes()));
const SwPosition* pPos = rPam.GetPoint();
// Step 2: Split once and remember the node that has been split.
rDoc.getIDocumentContentOperations().SplitNode(*pPos, false);
- *pSttNdIdx = pPos->nNode.GetIndex()-1;
+ *pSttNdIdx = pPos->nNode.GetIndex() - 1;
// Step 3: Split again.
rDoc.getIDocumentContentOperations().SplitNode(*pPos, false);
@@ -66,26 +69,28 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
// Step 4: Insert all content into the new node
rPam.Move(fnMoveBackward);
- rDoc.SetTextFormatColl(rPam, rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false));
+ rDoc.SetTextFormatColl(
+ rPam, rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false));
SwDocShell* pDocShell(rDoc.GetDocShell());
- uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
- uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(
+ comphelper::getProcessServiceFactory());
+ uno::Reference<uno::XInterface> xInterface(
+ xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"),
+ uno::UNO_QUERY_THROW);
uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW);
xImporter->setTargetDocument(xDstDoc);
- const uno::Reference<text::XTextRange> xInsertTextRange =
- SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
+ const uno::Reference<text::XTextRange> xInsertTextRange
+ = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence(
- {
- { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(*pStrm))) },
- { "InsertMode", uno::Any(true) },
- { "TextInsertModeRange", uno::Any(xInsertTextRange) }
- }));
+ { { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(*pStrm))) },
+ { "InsertMode", uno::Any(true) },
+ { "TextInsertModeRange", uno::Any(xInsertTextRange) } }));
ErrCode ret = ERRCODE_NONE;
try
{
@@ -107,7 +112,8 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
// Revert the first split node.
SwTextNode* pTextNode = pSttNdIdx->GetNode().GetTextNode();
SwNodeIndex aNxtIdx(*pSttNdIdx);
- if (pTextNode && pTextNode->CanJoinNext(&aNxtIdx) && pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex())
+ if (pTextNode && pTextNode->CanJoinNext(&aNxtIdx)
+ && pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex())
{
// If the PaM points to the first new node, move the PaM to the
// end of the previous node.
@@ -135,7 +141,8 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
// Revert the second split node.
SwTextNode* pTextNode = pSttNdIdx2->GetNode().GetTextNode();
SwNodeIndex aPrevIdx(*pSttNdIdx2);
- if (pTextNode && pTextNode->CanJoinPrev(&aPrevIdx) && pSttNdIdx2->GetIndex() - 1 == aPrevIdx.GetIndex())
+ if (pTextNode && pTextNode->CanJoinPrev(&aPrevIdx)
+ && pSttNdIdx2->GetIndex() - 1 == aPrevIdx.GetIndex())
{
// If the last new node isn't empty, convert the node's text
// attributes into hints. Otherwise, set the new node's
@@ -152,10 +159,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
return ret;
}
-extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF()
-{
- return new SwRTFReader;
-}
+extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF() { return new SwRTFReader; }
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream)
{
@@ -164,8 +168,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream)
SfxObjectShellLock xDocSh(new SwDocShell(SfxObjectCreateMode::INTERNAL));
xDocSh->DoInitNew();
- uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
- uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(
+ comphelper::getProcessServiceFactory());
+ uno::Reference<uno::XInterface> xInterface(
+ xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"),
+ uno::UNO_QUERY_THROW);
uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
uno::Reference<lang::XComponent> xDstDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW);
@@ -173,9 +180,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream)
uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence(
- {
- { "InputStream", uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(rStream))) }
- }));
+ { { "InputStream",
+ uno::Any(uno::Reference<io::XStream>(new utl::OStreamWrapper(rStream))) } }));
bool bRet = true;
try
{
@@ -186,7 +192,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream& rStream)
bRet = false;
}
return bRet;
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */