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

RtfFilter::filter: add code to dump input stream for copy&paste

This is especially useful when creating testcases for handling
copy&paste input.

Change-Id: I11be65484e7ac4dfac3d28576249143b7532a976
üst b0176f62
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include <rtftok/RTFDocument.hxx> #include <rtftok/RTFDocument.hxx>
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicator.hpp>
#ifdef DBG_COPYPASTE
#include <unotools/localfilehelper.hxx>
#include <tools/stream.hxx>
#include <unotools/ucbstreamhelper.hxx>
#endif
using namespace ::rtl; using namespace ::rtl;
using namespace ::cppu; using namespace ::cppu;
...@@ -82,6 +87,17 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri ...@@ -82,6 +87,17 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
aMediaDesc.addInputStream(); aMediaDesc.addInputStream();
aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream; aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream;
#ifdef DBG_COPYPASTE
OUString aOutStr;
if (utl::LocalFileHelper::ConvertPhysicalNameToURL("/tmp/stream.rtf", aOutStr))
{
SvStream* pOut = utl::UcbStreamHelper::CreateStream(aOutStr, STREAM_WRITE);
SvStream* pIn = utl::UcbStreamHelper::CreateStream(xInputStream);
*pOut << *pIn;
delete pOut;
}
#endif
uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(), uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(),
uno::Reference<frame::XFrame>()); uno::Reference<frame::XFrame>());
......
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