20#include <rtl/ustring.hxx>
23#include <com/sun/star/task/InteractionHandler.hpp>
24#include <com/sun/star/ucb/ContentCreationException.hpp>
25#include <com/sun/star/ucb/CommandAbortedException.hpp>
26#include <com/sun/star/ucb/InsertCommandArgument.hpp>
27#include <com/sun/star/beans/PropertyValue.hpp>
47 const Reference < XInteractionHandler >& xInteractionHandler,
48 bool bEnsureFileExists )
50 std::unique_ptr<SvStream> pStream;
54 bool bTruncate = bool(
eOpenMode & StreamMode::TRUNC );
61 rFileName, Reference < XCommandEnvironment >(),
66 catch (
const CommandAbortedException& )
70 catch (
const ContentCreationException& )
78 if ( bEnsureFileExists || bTruncate )
87 rFileName, Reference < XCommandEnvironment >(),
89 InsertCommandArgument aInsertArg;
90 aInsertArg.Data = xInput;
92 aInsertArg.ReplaceExisting =
false;
94 aCmdArg <<= aInsertArg;
99 catch (
const CommandAbortedException& )
103 catch (
const ContentCreationException& )
116 rFileName, Reference < XCommandEnvironment >(),
120 if ( xLockBytes.
is() )
123 pStream->SetBufferSize( 4096 );
124 pStream->SetError( xLockBytes->GetError() );
127 catch (
const CommandAbortedException& )
130 catch (
const ContentCreationException& )
144 Reference< XInteractionHandler > xIH(
152 bool bFileExists, css::uno::Reference<css::awt::XWindow> xParentWin)
156 Reference< XInteractionHandler > xIH(
165 std::unique_ptr<SvStream> pStream;
167 if ( xLockBytes.
is() )
170 pStream->SetBufferSize( 4096 );
171 pStream->SetError( xLockBytes->GetError() );
179 std::unique_ptr<SvStream> pStream;
180 if (
xStream->getOutputStream().is() )
183 if ( xLockBytes.is() )
185 pStream.reset(
new SvStream( xLockBytes.get() ) );
186 pStream->SetBufferSize( 4096 );
187 pStream->SetError( xLockBytes->GetError() );
198 std::unique_ptr<SvStream> pStream;
200 if ( xLockBytes.is() )
203 xLockBytes->setDontClose();
205 pStream.reset(
new SvStream( xLockBytes.get() ) );
206 pStream->SetBufferSize( 4096 );
207 pStream->SetError( xLockBytes->GetError() );
215 std::unique_ptr<SvStream> pStream;
216 if (
xStream->getOutputStream().is() )
219 if ( xLockBytes.is() )
222 xLockBytes->setDontClose();
224 pStream.reset(
new SvStream( xLockBytes.get() ) );
225 pStream->SetBufferSize( 4096 );
226 pStream->SetError( xLockBytes->GetError() );
css::uno::Any executeCommand(const OUString &rCommandName, const css::uno::Any &rCommandArgument)
css::uno::Reference< css::ucb::XContent > get() const
static UcbLockBytesRef CreateInputLockBytes(const css::uno::Reference< css::io::XInputStream > &xContent)
static UcbLockBytesRef CreateLockBytes(const css::uno::Reference< css::ucb::XContent > &xContent, const css::uno::Sequence< css::beans::PropertyValue > &rProps, StreamMode eMode, const css::uno::Reference< css::task::XInteractionHandler > &xInter)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
Reference< XComponentContext > getProcessComponentContext()
tools::SvRef< UcbLockBytes > UcbLockBytesRef
static std::unique_ptr< SvStream > lcl_CreateStream(const OUString &rFileName, StreamMode eOpenMode, const Reference< XInteractionHandler > &xInteractionHandler, bool bEnsureFileExists)
ElementOpenMode eOpenMode