diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-28 13:50:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-03 15:55:04 +0200 |
commit | 278379697d82e4b4a3204e82fcdababebe2340f3 (patch) | |
tree | ee847794cdd14bbb11e11c5d2269213cdb2719aa | |
parent | 9b07288138228af56e58f50dc6ba50865b52fdfb (diff) |
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
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 5 | ||||
-rw-r--r-- | bridges/test/testoffice.cxx | 4 | ||||
-rw-r--r-- | desktop/source/deployment/registry/package/dp_package.cxx | 5 | ||||
-rw-r--r-- | editeng/source/xml/xmltxtimp.cxx | 8 | ||||
-rw-r--r-- | filter/source/xsltfilter/XSLTFilter.cxx | 15 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_app_xml.cxx | 4 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.cxx | 4 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_get.cxx | 5 | ||||
-rw-r--r-- | io/source/stm/opipe.cxx | 5 | ||||
-rw-r--r-- | offapi/type_reference/types.rdb | bin | 7653888 -> 7653888 bytes | |||
-rw-r--r-- | ucb/source/core/ucbcmds.cxx | 36 | ||||
-rw-r--r-- | udkapi/UnoApi_udkapi.mk | 3 | ||||
-rw-r--r-- | udkapi/com/sun/star/io/Pipe.idl | 16 | ||||
-rw-r--r-- | udkapi/com/sun/star/io/XPipe.idl | 56 |
14 files changed, 99 insertions, 67 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 5a7df8fc59a5..70de47c58117 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -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() ) ); diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx index e7b7352cb0a3..e5b3df5a3632 100644 --- a/bridges/test/testoffice.cxx +++ b/bridges/test/testoffice.cxx @@ -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() ); diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 3a520ebf738c..ea4e345b22cd 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -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) ); diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index 91d3224f174b..2604ab818b0a 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -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 ) ); diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 6acc1168ef70..4ebabc7846c4 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -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); diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx index 95df07905e7c..6b9e2fb266c7 100644 --- a/forms/source/xforms/submission/serialization_app_xml.cxx +++ b/forms/source/xforms/submission/serialization_app_xml.cxx @@ -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"); } diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index c7866f501bcc..8ba1be433991 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -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) { } diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx index 5dc9194bec66..ed515834bfab 100644 --- a/forms/source/xforms/submission/submission_get.cxx +++ b/forms/source/xforms/submission/submission_get.cxx @@ -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 { diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx index 32c3c53396f5..9c04fe4c3163 100644 --- a/io/source/stm/opipe.cxx +++ b/io/source/stm/opipe.cxx @@ -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( ); diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 29e48ad90610..a248de797398 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index 221a4299fdea..56f6d915a63d 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -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::Command aOpenCommand( - rtl::OUString("open"), - -1, - uno::makeAny( aArg ) ); + 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 ) ); - 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 & ) { diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk index 2c3e1786d0cf..6d1b84ab8882 100644 --- a/udkapi/UnoApi_udkapi.mk +++ b/udkapi/UnoApi_udkapi.mk @@ -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 \ diff --git a/udkapi/com/sun/star/io/Pipe.idl b/udkapi/com/sun/star/io/Pipe.idl index 7a506db02dff..5ecdc361a3c2 100644 --- a/udkapi/com/sun/star/io/Pipe.idl +++ b/udkapi/com/sun/star/io/Pipe.idl @@ -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; }; }; }; }; diff --git a/udkapi/com/sun/star/io/XPipe.idl b/udkapi/com/sun/star/io/XPipe.idl new file mode 100644 index 000000000000..f33a97704761 --- /dev/null +++ b/udkapi/com/sun/star/io/XPipe.idl @@ -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: */ |