Kaydet (Commit) 4970e292 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Stephan Bergmann

fdo#46808, convert comphelper::ConfigurationHelper to XComponentContext

Convert the helper methods to take an XComponentContext parameter,
instead of XMultiServiceFactory

Change-Id: Id662d674c6d3c4ddfd35be5fc2e802b73bc6de90
üst 4cc5ccef
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/io/XSeekable.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
...@@ -35,7 +35,7 @@ class COMPHELPER_DLLPUBLIC OSeekableInputWrapper : public ::cppu::WeakImplHelper ...@@ -35,7 +35,7 @@ class COMPHELPER_DLLPUBLIC OSeekableInputWrapper : public ::cppu::WeakImplHelper
{ {
::osl::Mutex m_aMutex; ::osl::Mutex m_aMutex;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOriginalStream; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOriginalStream;
...@@ -48,13 +48,13 @@ private: ...@@ -48,13 +48,13 @@ private:
public: public:
OSeekableInputWrapper( OSeekableInputWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~OSeekableInputWrapper(); virtual ~OSeekableInputWrapper();
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > CheckSeekableCanWrap( static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > CheckSeekableCanWrap(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
// XInputStream // XInputStream
virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
......
...@@ -55,11 +55,11 @@ void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& xIn, ...@@ -55,11 +55,11 @@ void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& xIn,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
OSeekableInputWrapper::OSeekableInputWrapper( OSeekableInputWrapper::OSeekableInputWrapper(
const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< io::XInputStream >& xInStream,
const uno::Reference< lang::XMultiServiceFactory >& xFactory ) const uno::Reference< uno::XComponentContext >& rxContext )
: m_xFactory( xFactory ) : m_xContext( rxContext )
, m_xOriginalStream( xInStream ) , m_xOriginalStream( xInStream )
{ {
if ( !m_xFactory.is() ) if ( !m_xContext.is() )
throw uno::RuntimeException(); throw uno::RuntimeException();
} }
...@@ -71,7 +71,7 @@ OSeekableInputWrapper::~OSeekableInputWrapper() ...@@ -71,7 +71,7 @@ OSeekableInputWrapper::~OSeekableInputWrapper()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
uno::Reference< io::XInputStream > OSeekableInputWrapper::CheckSeekableCanWrap( uno::Reference< io::XInputStream > OSeekableInputWrapper::CheckSeekableCanWrap(
const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< io::XInputStream >& xInStream,
const uno::Reference< lang::XMultiServiceFactory >& xFactory ) const uno::Reference< uno::XComponentContext >& rxContext )
{ {
// check that the stream is seekable and just wrap it if it is not // check that the stream is seekable and just wrap it if it is not
uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY ); uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY );
...@@ -80,7 +80,7 @@ uno::Reference< io::XInputStream > OSeekableInputWrapper::CheckSeekableCanWrap( ...@@ -80,7 +80,7 @@ uno::Reference< io::XInputStream > OSeekableInputWrapper::CheckSeekableCanWrap(
uno::Reference< io::XInputStream > xNewStream( uno::Reference< io::XInputStream > xNewStream(
static_cast< io::XInputStream* >( static_cast< io::XInputStream* >(
new OSeekableInputWrapper( xInStream, xFactory ) ) ); new OSeekableInputWrapper( xInStream, rxContext ) ) );
return xNewStream; return xNewStream;
} }
...@@ -89,11 +89,11 @@ void OSeekableInputWrapper::PrepareCopy_Impl() ...@@ -89,11 +89,11 @@ void OSeekableInputWrapper::PrepareCopy_Impl()
{ {
if ( !m_xCopyInput.is() ) if ( !m_xCopyInput.is() )
{ {
if ( !m_xFactory.is() ) if ( !m_xContext.is() )
throw uno::RuntimeException(); throw uno::RuntimeException();
uno::Reference< io::XOutputStream > xTempOut( uno::Reference< io::XOutputStream > xTempOut(
io::TempFile::create(comphelper::getComponentContext(m_xFactory)), io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
copyInputToOutput_Impl( m_xOriginalStream, xTempOut ); copyInputToOutput_Impl( m_xOriginalStream, xTempOut );
......
...@@ -730,7 +730,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) ...@@ -730,7 +730,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
if ( m_xContentStream.is() ) if ( m_xContentStream.is() )
{ {
// the stream must be seekable, if it is not it will be wrapped // the stream must be seekable, if it is not it will be wrapped
m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xFactory ); m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, comphelper::getComponentContext( m_xFactory ) );
m_xContentSeek = uno::Reference < XSeekable > ( m_xContentStream, UNO_QUERY ); m_xContentSeek = uno::Reference < XSeekable > ( m_xContentStream, UNO_QUERY );
if ( ! m_xContentSeek.is() ) if ( ! m_xContentSeek.is() )
throw com::sun::star::uno::Exception (OSL_LOG_PREFIX "The package component _requires_ an XSeekable interface!", throw com::sun::star::uno::Exception (OSL_LOG_PREFIX "The package component _requires_ an XSeekable interface!",
......
...@@ -144,7 +144,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream() ...@@ -144,7 +144,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream()
// The only exception is a nonseekable stream that is provided only for storing, if such a stream // The only exception is a nonseekable stream that is provided only for storing, if such a stream
// is accessed before commit it MUST be wrapped. // is accessed before commit it MUST be wrapped.
// Wrap the stream in case it is not seekable // Wrap the stream in case it is not seekable
xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xFactory ); xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, comphelper::getComponentContext( m_xFactory ) );
uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY ); uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() ) if ( !xSeek.is() )
throw RuntimeException( OSL_LOG_PREFIX "The stream must support XSeekable!", throw RuntimeException( OSL_LOG_PREFIX "The stream must support XSeekable!",
...@@ -625,7 +625,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt ...@@ -625,7 +625,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt
RuntimeException ) RuntimeException )
{ {
// wrap the stream in case it is not seekable // wrap the stream in case it is not seekable
uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory ); uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, comphelper::getComponentContext( m_xFactory ) );
uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY ); uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
if ( !xSeek.is() ) if ( !xSeek.is() )
throw RuntimeException(OSL_LOG_PREFIX "The stream must support XSeekable!", throw RuntimeException(OSL_LOG_PREFIX "The stream must support XSeekable!",
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "com/sun/star/ucb/XWebDAVCommandEnvironment.hpp" #include "com/sun/star/ucb/XWebDAVCommandEnvironment.hpp"
#include "ucbhelper/simpleauthenticationrequest.hxx" #include "ucbhelper/simpleauthenticationrequest.hxx"
#include "comphelper/processfactory.hxx"
#include "comphelper/seekableinput.hxx" #include "comphelper/seekableinput.hxx"
#include "DAVAuthListenerImpl.hxx" #include "DAVAuthListenerImpl.hxx"
...@@ -597,7 +598,7 @@ void DAVResourceAccess::PUT( ...@@ -597,7 +598,7 @@ void DAVResourceAccess::PUT(
// Make stream seekable, if it not. Needed, if request must be retried. // Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rStream, m_xSMgr ); rStream, comphelper::getComponentContext(m_xSMgr) );
int errorCount = 0; int errorCount = 0;
bool bRetry = false; bool bRetry = false;
...@@ -646,7 +647,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST( ...@@ -646,7 +647,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried. // Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rInputStream, m_xSMgr ); rInputStream, comphelper::getComponentContext(m_xSMgr) );
uno::Reference< io::XInputStream > xStream; uno::Reference< io::XInputStream > xStream;
int errorCount = 0; int errorCount = 0;
...@@ -710,7 +711,7 @@ void DAVResourceAccess::POST( ...@@ -710,7 +711,7 @@ void DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried. // Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rInputStream, m_xSMgr ); rInputStream, comphelper::getComponentContext(m_xSMgr) );
int errorCount = 0; int errorCount = 0;
bool bRetry = false; bool bRetry = false;
......
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