diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-03-29 18:33:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-03-29 20:08:41 +0200 |
commit | f04f48e1517509930ba34bf7bd5b412508b7b7a2 (patch) | |
tree | b29e9f49bf0339892e65d43463821e091a4ba607 /sw/qa/extras/rtfimport/rtfimport.cxx | |
parent | ed7ad72ade8a72df2a01018f9d6a7daa328383b9 (diff) |
Clean up copy/paste (of a function called "paste")
Change-Id: Iea48bb3304e2688b440c5c396ed340ffffa11568
Reviewed-on: https://gerrit.libreoffice.org/52121
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/qa/extras/rtfimport/rtfimport.cxx')
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a99ba78d5aa9..ee9b1711f165 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -12,8 +12,6 @@ #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontUnderline.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -44,7 +42,6 @@ #include <rtl/ustring.hxx> #include <vcl/settings.hxx> #include <unotools/ucbstreamhelper.hxx> -#include <unotools/streamwrap.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/configuration.hxx> @@ -57,32 +54,6 @@ public: } protected: - /// Copy&paste helper. - void paste(const OUString& aFilename, uno::Reference<text::XTextRange> const& xTextRange - = uno::Reference<text::XTextRange>()) - { - uno::Reference<document::XFilter> xFilter( - m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), - uno::UNO_QUERY_THROW); - uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); - xImporter->setTargetDocument(mxComponent); - uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2); - aDescriptor[0].Name = "InputStream"; - SvStream* pStream = utl::UcbStreamHelper::CreateStream( - m_directories.getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, - StreamMode::STD_READ); - CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, pStream->GetError()); - uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); - aDescriptor[0].Value <<= xStream; - aDescriptor[1].Name = "InsertMode"; - aDescriptor[1].Value <<= true; - if (xTextRange.is()) - { - aDescriptor[2].Name = "TextInsertModeRange"; - aDescriptor[2].Value <<= xTextRange; - } - CPPUNIT_ASSERT(xFilter->filter(aDescriptor)); - } AllSettings m_aSavedSettings; }; @@ -744,7 +715,7 @@ DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt") uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("fdo68291-paste.rtf", xEnd); + paste("rtfimport/data/fdo68291-paste.rtf", xEnd); // This was "Standard", causing an unwanted page break on next paste. CPPUNIT_ASSERT_EQUAL(uno::Any(), @@ -1133,7 +1104,7 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf") uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); - paste("tdf90260-par.rtf", xEnd); + paste("rtfimport/data/tdf90260-par.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); } @@ -1229,12 +1200,12 @@ DECLARE_RTFIMPORT_TEST(testClassificatonPaste, "hello.rtf") uno::Reference<text::XTextRange> xEnd = xText->getEnd(); // Not classified source, not classified destination: OK. - paste("classification-no.rtf", xEnd); + paste("rtfimport/data/classification-no.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(OUString("classification-no"), getParagraph(2)->getString()); // Classified source, not classified destination: nothing should happen. OUString aOld = xText->getString(); - paste("classification-yes.rtf", xEnd); + paste("rtfimport/data/classification-yes.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(aOld, xText->getString()); } |