fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / gio / gio_outputstream.cxx
blob1161bc2997818fa0f1e6cd2dbad31ac10a847042
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
21 #include <ucbhelper/cancelcommandexecution.hxx>
22 #include <string.h>
24 #include "gio_outputstream.hxx"
25 #include "gio_content.hxx"
27 using namespace com::sun::star;
29 namespace gio
32 OutputStream::OutputStream(GFileOutputStream *pStream) : Seekable(G_SEEKABLE(pStream)), mpStream(pStream)
34 if (!mpStream)
35 throw io::NotConnectedException();
38 OutputStream::~OutputStream()
40 closeOutput();
43 void SAL_CALL OutputStream::writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& rData )
44 throw( io::NotConnectedException, io::BufferSizeExceededException,
45 io::IOException, uno::RuntimeException, std::exception)
47 if (!mpStream)
48 throw io::NotConnectedException();
50 GError *pError=NULL;
51 if (!g_output_stream_write_all(G_OUTPUT_STREAM(mpStream), rData.getConstArray(), rData.getLength(), NULL, NULL, &pError))
52 convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
55 void SAL_CALL OutputStream::flush()
56 throw( io::NotConnectedException, io::BufferSizeExceededException,
57 io::IOException, uno::RuntimeException, std::exception )
59 if (!mpStream)
60 throw io::NotConnectedException();
62 GError *pError=NULL;
63 if (!g_output_stream_flush(G_OUTPUT_STREAM(mpStream), NULL, &pError))
64 convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
67 void SAL_CALL OutputStream::closeOutput()
68 throw( io::NotConnectedException, io::IOException,
69 uno::RuntimeException, std::exception )
71 if (mpStream)
72 g_output_stream_close(G_OUTPUT_STREAM(mpStream), NULL, NULL);
75 uno::Any OutputStream::queryInterface( const uno::Type &type ) throw( uno::RuntimeException, std::exception )
77 uno::Any aRet = ::cppu::queryInterface ( type,
78 static_cast< XOutputStream * >( this ) );
80 return aRet.hasValue() ? aRet : Seekable::queryInterface( type );
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */