fdo#46808, Adapt io::Pipe UNO service to new style
Create a merged XPipe interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I682633c6252aab503eb2469c9bd2ba771f10bc4b
This commit is contained in:
committed by
Stephan Bergmann
parent
9b07288138
commit
278379697d
@@ -42,6 +42,7 @@
|
||||
#include <tools/diagnose_ex.h>
|
||||
|
||||
#include <sot/storage.hxx>
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
|
||||
@@ -55,6 +56,7 @@
|
||||
#include <com/sun/star/ucb/NameClash.hpp>
|
||||
#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
|
||||
#include <unotools/pathoptions.hxx>
|
||||
#include <comphelper/componentcontext.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
#include <com/sun/star/util/VetoException.hpp>
|
||||
@@ -1356,8 +1358,7 @@ void LibPage::ExportAsPackage( const String& aLibName )
|
||||
// write into pipe:
|
||||
Reference<packages::manifest::XManifestWriter> xManifestWriter( xMSF->createInstance
|
||||
( DEFINE_CONST_UNICODE("com.sun.star.packages.manifest.ManifestWriter") ), UNO_QUERY );
|
||||
Reference<io::XOutputStream> xPipe( xMSF->createInstance
|
||||
( DEFINE_CONST_UNICODE("com.sun.star.io.Pipe") ), UNO_QUERY );
|
||||
Reference<io::XOutputStream> xPipe( io::Pipe::create(comphelper::ComponentContext(xMSF).getUNOContext()), UNO_QUERY );
|
||||
xManifestWriter->writeManifestSequence(
|
||||
xPipe, Sequence< Sequence<beans::PropertyValue> >(
|
||||
&manifest[ 0 ], manifest.size() ) );
|
||||
|
@@ -84,9 +84,7 @@ void mygetchar()
|
||||
|
||||
void testPipe( const Reference < XMultiServiceFactory > & rSmgr )
|
||||
{
|
||||
Reference < XOutputStream > rOut(
|
||||
rSmgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" )) ),
|
||||
UNO_QUERY );
|
||||
Reference < XOutputStream > rOut( Pipe::create(comphelper::ComponentContext(rSmgr).getUNOContext()), UNO_QUERY_THROW );
|
||||
|
||||
OSL_ASSERT( rOut.is() );
|
||||
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include "com/sun/star/graphic/XGraphic.hpp"
|
||||
#include "com/sun/star/graphic/GraphicProvider.hpp"
|
||||
#include "com/sun/star/graphic/XGraphicProvider.hpp"
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include "com/sun/star/io/XOutputStream.hpp"
|
||||
#include "com/sun/star/io/XInputStream.hpp"
|
||||
#include "com/sun/star/task/InteractionClassification.hpp"
|
||||
@@ -1182,9 +1183,7 @@ void BackendImpl::PackageImpl::exportTo(
|
||||
xContext->getServiceManager()->createInstanceWithContext(
|
||||
OUSTR("com.sun.star.packages.manifest.ManifestWriter"),
|
||||
xContext ), UNO_QUERY_THROW );
|
||||
Reference<io::XOutputStream> xPipe(
|
||||
xContext->getServiceManager()->createInstanceWithContext(
|
||||
OUSTR("com.sun.star.io.Pipe"), xContext ), UNO_QUERY_THROW );
|
||||
Reference<io::XOutputStream> xPipe( io::Pipe::create(xContext), UNO_QUERY_THROW );
|
||||
xManifestWriter->writeManifestSequence(
|
||||
xPipe, comphelper::containerToSequence(manifest) );
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/io/XActiveDataControl.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||
#include <com/sun/star/xml/sax/XParser.hpp>
|
||||
@@ -199,12 +200,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r
|
||||
break;
|
||||
}
|
||||
|
||||
uno::Reference< XInterface > xPipe( xServiceFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ) );
|
||||
if( !xPipe.is() )
|
||||
{
|
||||
OSL_FAIL( "XMLReader::Read: com.sun.star.io.Pipe service missing" );
|
||||
break;
|
||||
}
|
||||
uno::Reference< XInterface > xPipe( Pipe::create(comphelper::ComponentContext(xServiceFactory).getUNOContext()), UNO_QUERY );
|
||||
|
||||
// connect pipe's output stream to the data source
|
||||
xSource->setOutputStream( uno::Reference< io::XOutputStream >::query( xPipe ) );
|
||||
|
@@ -62,6 +62,7 @@
|
||||
|
||||
#include <com/sun/star/util/XMacroExpander.hpp>
|
||||
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||
@@ -342,11 +343,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
|
||||
tsink->setInputStream(xInputStream);
|
||||
|
||||
// create pipe
|
||||
css::uno::Reference<XOutputStream>
|
||||
pipeout(
|
||||
m_rServiceFactory->createInstance(
|
||||
OUString(
|
||||
"com.sun.star.io.Pipe" )),
|
||||
css::uno::Reference<XOutputStream> pipeout(
|
||||
Pipe::create(comphelper::ComponentContext(m_rServiceFactory).getUNOContext()),
|
||||
UNO_QUERY);
|
||||
css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
|
||||
|
||||
@@ -498,11 +496,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
|
||||
m_tcontrol->addListener(css::uno::Reference<XStreamListener> (this));
|
||||
|
||||
// create pipe
|
||||
css::uno::Reference<XOutputStream>
|
||||
pipeout(
|
||||
m_rServiceFactory->createInstance(
|
||||
OUString(
|
||||
"com.sun.star.io.Pipe" )),
|
||||
css::uno::Reference<XOutputStream> pipeout(
|
||||
Pipe::create(comphelper::ComponentContext(m_rServiceFactory).getUNOContext()),
|
||||
UNO_QUERY);
|
||||
css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "serialization_app_xml.hxx"
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/xml/dom/XNode.hpp>
|
||||
#include <com/sun/star/xml/dom/XDocument.hpp>
|
||||
#include <com/sun/star/xml/dom/XNodeList.hpp>
|
||||
@@ -42,8 +43,7 @@
|
||||
|
||||
CSerializationAppXML::CSerializationAppXML()
|
||||
: m_aFactory(comphelper::getProcessServiceFactory())
|
||||
, m_aPipe(CSS::uno::Reference< CSS::io::XOutputStream > (m_aFactory->createInstance(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ), CSS::uno::UNO_QUERY))
|
||||
, m_aPipe(CSS::io::Pipe::create(comphelper::getProcessComponentContext()), CSS::uno::UNO_QUERY_THROW)
|
||||
{
|
||||
OSL_ENSURE(m_aPipe.is(), "cannot create Pipe");
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
************************************************************************/
|
||||
|
||||
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/xml/xpath/XPathObjectType.hpp>
|
||||
#include <com/sun/star/xml/dom/XNode.hpp>
|
||||
#include <com/sun/star/xml/dom/XText.hpp>
|
||||
@@ -49,8 +50,7 @@ using namespace CSS::xml::dom;
|
||||
|
||||
CSerializationURLEncoded::CSerializationURLEncoded()
|
||||
: m_aFactory(comphelper::getProcessServiceFactory())
|
||||
, m_aPipe(Reference< XOutputStream > (m_aFactory->createInstance(
|
||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ), UNO_QUERY))
|
||||
, m_aPipe(Pipe::create(comphelper::getProcessComponentContext()), UNO_QUERY_THROW)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,9 @@
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <rtl/string.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <comphelper/componentcontext.hxx>
|
||||
#include <ucbhelper/content.hxx>
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
|
||||
using namespace CSS::uno;
|
||||
using namespace CSS::ucb;
|
||||
@@ -97,8 +99,7 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const CSS::uno::Reference<
|
||||
}
|
||||
OUString aQueryURL = OStringToOUString(aUTF8QueryURL.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
|
||||
ucbhelper::Content aContent(aQueryURL, aEnvironment);
|
||||
CSS::uno::Reference< XOutputStream > aPipe(m_aFactory->createInstance(
|
||||
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe"))), UNO_QUERY_THROW);
|
||||
CSS::uno::Reference< XOutputStream > aPipe( CSS::io::Pipe::create(comphelper::ComponentContext(m_aFactory).getUNOContext()), UNO_QUERY_THROW );
|
||||
aContent.openStream(aPipe);
|
||||
// get reply
|
||||
try {
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
// streams
|
||||
#include <com/sun/star/io/XPipe.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/io/XConnectable.hpp>
|
||||
@@ -27,7 +28,7 @@
|
||||
|
||||
#include <cppuhelper/factory.hxx>
|
||||
|
||||
#include <cppuhelper/implbase4.hxx> // OWeakObject
|
||||
#include <cppuhelper/implbase3.hxx> // OWeakObject
|
||||
|
||||
#include <osl/conditn.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
@@ -52,7 +53,7 @@ using namespace ::com::sun::star::lang;
|
||||
namespace io_stm{
|
||||
|
||||
class OPipeImpl :
|
||||
public WeakImplHelper4< XInputStream , XOutputStream , XConnectable , XServiceInfo >
|
||||
public WeakImplHelper3< XPipe , XConnectable , XServiceInfo >
|
||||
{
|
||||
public:
|
||||
OPipeImpl( );
|
||||
|
Binary file not shown.
@@ -33,6 +33,7 @@
|
||||
|
||||
*************************************************************************/
|
||||
#include <osl/diagnose.h>
|
||||
#include <comphelper/componentcontext.hxx>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#include <rtl/ustring.h>
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/container/XChild.hpp>
|
||||
#include <com/sun/star/beans/XPropertySetInfo.hpp>
|
||||
#include <com/sun/star/io/Pipe.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSink.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/io/XSeekable.hpp>
|
||||
@@ -966,29 +968,23 @@ uno::Reference< io::XInputStream > getInputStream(
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< io::XOutputStream > xOutputStream(
|
||||
rContext.xSMgr->createInstance(
|
||||
rtl::OUString("com.sun.star.io.Pipe") ),
|
||||
uno::UNO_QUERY );
|
||||
uno::Reference< io::XOutputStream > xOutputStream( io::Pipe::create(comphelper::ComponentContext(rContext.xSMgr).getUNOContext()), uno::UNO_QUERY_THROW );
|
||||
|
||||
if ( xOutputStream.is() )
|
||||
{
|
||||
ucb::OpenCommandArgument2 aArg;
|
||||
aArg.Mode = ucb::OpenMode::DOCUMENT;
|
||||
aArg.Priority = 0; // unused
|
||||
aArg.Sink = xOutputStream;
|
||||
aArg.Properties = uno::Sequence< beans::Property >( 0 );
|
||||
ucb::OpenCommandArgument2 aArg;
|
||||
aArg.Mode = ucb::OpenMode::DOCUMENT;
|
||||
aArg.Priority = 0; // unused
|
||||
aArg.Sink = xOutputStream;
|
||||
aArg.Properties = uno::Sequence< beans::Property >( 0 );
|
||||
|
||||
ucb::Command aOpenCommand(
|
||||
rtl::OUString("open"),
|
||||
-1,
|
||||
uno::makeAny( aArg ) );
|
||||
ucb::Command aOpenCommand(
|
||||
rtl::OUString("open"),
|
||||
-1,
|
||||
uno::makeAny( aArg ) );
|
||||
|
||||
xCommandProcessorS->execute( aOpenCommand, 0, rContext.xEnv );
|
||||
xCommandProcessorS->execute( aOpenCommand, 0, rContext.xEnv );
|
||||
|
||||
xInputStream = uno::Reference< io::XInputStream >(
|
||||
xOutputStream, uno::UNO_QUERY );
|
||||
}
|
||||
xInputStream = uno::Reference< io::XInputStream >(
|
||||
xOutputStream, uno::UNO_QUERY );
|
||||
}
|
||||
catch ( uno::RuntimeException const & )
|
||||
{
|
||||
|
@@ -77,7 +77,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/io,\
|
||||
MarkableOutputStream \
|
||||
ObjectInputStream \
|
||||
ObjectOutputStream \
|
||||
Pipe \
|
||||
Pump \
|
||||
TextInputStream \
|
||||
TextOutputStream \
|
||||
@@ -139,6 +138,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/container,
|
||||
EnumerableMap \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/io,\
|
||||
Pipe \
|
||||
SequenceInputStream \
|
||||
SequenceOutputStream \
|
||||
TempFile \
|
||||
@@ -326,6 +326,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/io,\
|
||||
XObjectInputStream \
|
||||
XObjectOutputStream \
|
||||
XOutputStream \
|
||||
XPipe \
|
||||
XPersist \
|
||||
XPersistObject \
|
||||
XSeekable \
|
||||
|
@@ -19,11 +19,7 @@
|
||||
#ifndef __com_sun_star_io_Pipe_idl__
|
||||
#define __com_sun_star_io_Pipe_idl__
|
||||
|
||||
#include <com/sun/star/io/XOutputStream.idl>
|
||||
|
||||
#include <com/sun/star/io/XInputStream.idl>
|
||||
|
||||
|
||||
#include <com/sun/star/io/XPipe.idl>
|
||||
|
||||
module com { module sun { module star { module io {
|
||||
|
||||
@@ -38,15 +34,7 @@ module com { module sun { module star { module io {
|
||||
<p> With the pipe-service, an outputstream can be converted into an
|
||||
input stream at the cost of an additional buffer.
|
||||
*/
|
||||
published service Pipe
|
||||
{
|
||||
// DocMerge: empty anyway
|
||||
interface com::sun::star::io::XOutputStream;
|
||||
|
||||
// DocMerge: empty anyway
|
||||
interface com::sun::star::io::XInputStream;
|
||||
|
||||
};
|
||||
published service Pipe : XPipe;
|
||||
|
||||
|
||||
}; }; }; };
|
||||
|
56
udkapi/com/sun/star/io/XPipe.idl
Normal file
56
udkapi/com/sun/star/io/XPipe.idl
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
#ifndef __com_sun_star_io_XPipe_idl__
|
||||
#define __com_sun_star_io_XPipe_idl__
|
||||
|
||||
#include <com/sun/star/io/XOutputStream.idl>
|
||||
|
||||
#include <com/sun/star/io/XInputStream.idl>
|
||||
|
||||
|
||||
|
||||
module com { module sun { module star { module io {
|
||||
|
||||
|
||||
// DocMerge from xml: service com::sun::star::io::Pipe
|
||||
/** the implementation of an output stream and an input stream.
|
||||
<p>
|
||||
All data written through the outputstream is buffered until it is
|
||||
read again from the input stream. Often two different threads access
|
||||
input and outputstream.
|
||||
|
||||
<p> With the pipe-service, an outputstream can be converted into an
|
||||
input stream at the cost of an additional buffer.
|
||||
*/
|
||||
published interface XPipe
|
||||
{
|
||||
// DocMerge: empty anyway
|
||||
interface com::sun::star::io::XOutputStream;
|
||||
|
||||
// DocMerge: empty anyway
|
||||
interface com::sun::star::io::XInputStream;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}; }; }; };
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
Reference in New Issue
Block a user