summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/test/outputwrap.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sdext/source/pdfimport/test/outputwrap.hxx')
-rw-r--r--sdext/source/pdfimport/test/outputwrap.hxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sdext/source/pdfimport/test/outputwrap.hxx b/sdext/source/pdfimport/test/outputwrap.hxx
index 015a3e288e88..aa4c541229df 100644
--- a/sdext/source/pdfimport/test/outputwrap.hxx
+++ b/sdext/source/pdfimport/test/outputwrap.hxx
@@ -25,6 +25,7 @@
#include <cppuhelper/compbase.hxx>
#include <com/sun/star/io/XOutputStream.hpp>
#include <osl/file.hxx>
+#include <rtl/strbuf.hxx>
namespace pdfi
{
@@ -59,6 +60,32 @@ typedef ::cppu::WeakComponentImplHelper<
maFile.close();
}
};
+
+ class OutputWrapString : private cppu::BaseMutex, public OutputWrapBase
+ {
+ OString& mrString;
+ OStringBuffer maBuffer;
+
+ public:
+
+ explicit OutputWrapString(OString& rString) : OutputWrapBase(m_aMutex), mrString(rString), maBuffer(rString)
+ {
+ }
+
+ virtual void SAL_CALL writeBytes(const css::uno::Sequence< ::sal_Int8 >& aData) throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) override
+ {
+ maBuffer.append(reinterpret_cast<const sal_Char *>(aData.getConstArray()), aData.getLength());
+ }
+
+ virtual void SAL_CALL flush() throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) override
+ {
+ }
+
+ virtual void SAL_CALL closeOutput() throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) override
+ {
+ mrString = maBuffer.makeStringAndClear();
+ }
+ };
}
#endif