#87187# - Initial Revision.

This commit is contained in:
Kai Sommerfeld 2001-05-28 09:48:20 +00:00
parent 69504f06c3
commit ed6fdc332e
3 changed files with 1236 additions and 0 deletions

View file

@ -0,0 +1,946 @@
/*************************************************************************
*
* $RCSfile: interactionrequest.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: kso $ $Date: 2001-05-28 10:48:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
/**************************************************************************
TODO
**************************************************************************
*************************************************************************/
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#ifndef _UCBHELPER_INTERATIONREQUEST_HXX
#include <ucbhelper/interactionrequest.hxx>
#endif
using namespace com::sun::star;
using namespace ucbhelper;
//=========================================================================
//=========================================================================
//
// InteractionRequest Implementation.
//
//=========================================================================
//=========================================================================
namespace ucbhelper
{
struct InteractionRequest_Impl
{
vos::ORef< InteractionContinuation > m_xSelection;
com::sun::star::uno::Any m_aRequest;
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::task::XInteractionContinuation > > m_aContinuations;
InteractionRequest_Impl() {}
InteractionRequest_Impl( const uno::Any & rRequest )
: m_aRequest( rRequest ) {}
};
}
//=========================================================================
InteractionRequest::InteractionRequest()
: m_pImpl( new InteractionRequest_Impl )
{
}
//=========================================================================
InteractionRequest::InteractionRequest( const uno::Any & rRequest )
: m_pImpl( new InteractionRequest_Impl( rRequest ) )
{
}
//=========================================================================
// virtual
InteractionRequest::~InteractionRequest()
{
delete m_pImpl;
}
//=========================================================================
void InteractionRequest::setRequest( const uno::Any & rRequest )
{
m_pImpl->m_aRequest = rRequest;
}
//=========================================================================
void InteractionRequest::setContinuations(
const uno::Sequence< uno::Reference<
task::XInteractionContinuation > > & rContinuations )
{
m_pImpl->m_aContinuations = rContinuations;
}
//=========================================================================
vos::ORef< InteractionContinuation > InteractionRequest::getSelection() const
{
return m_pImpl->m_xSelection;
}
//=========================================================================
void InteractionRequest::setSelection(
const vos::ORef< InteractionContinuation > & rxSelection )
{
m_pImpl->m_xSelection = rxSelection;
}
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionRequest::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionRequest::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionRequest::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionRequest * >( this ) );
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL InteractionRequest::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionRequest::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference< task::XInteractionRequest > * >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionRequest methods.
//
//=========================================================================
// virtual
uno::Any SAL_CALL InteractionRequest::getRequest()
throw( uno::RuntimeException )
{
return m_pImpl->m_aRequest;
}
//=========================================================================
// virtual
uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL
InteractionRequest::getContinuations()
throw( uno::RuntimeException )
{
return m_pImpl->m_aContinuations;
}
//=========================================================================
//=========================================================================
//
// InteractionContinuation Implementation.
//
//=========================================================================
//=========================================================================
namespace ucbhelper
{
struct InteractionContinuation_Impl
{
InteractionRequest * m_pRequest;
InteractionContinuation_Impl( InteractionRequest * pRequest )
: m_pRequest( pRequest ) {}
};
}
//=========================================================================
InteractionContinuation::InteractionContinuation(
InteractionRequest * pRequest )
: m_pImpl( new InteractionContinuation_Impl( pRequest ) )
{
}
//=========================================================================
// virtual
InteractionContinuation::~InteractionContinuation()
{
delete m_pImpl;
}
//=========================================================================
void InteractionContinuation::recordSelection()
{
m_pImpl->m_pRequest->setSelection( this );
}
//=========================================================================
//=========================================================================
//
// InteractionAbort Implementation.
//
//=========================================================================
//=========================================================================
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionAbort::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionAbort::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionAbort::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
static_cast< task::XInteractionAbort * >( this ) );
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL InteractionAbort::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionAbort::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference< task::XInteractionAbort > * >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionContinuation methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionAbort::select()
throw( uno::RuntimeException )
{
recordSelection();
}
//=========================================================================
//=========================================================================
//
// InteractionRetry Implementation.
//
//=========================================================================
//=========================================================================
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionRetry::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionRetry::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionRetry::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
static_cast< task::XInteractionRetry * >( this ) );
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL InteractionRetry::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionRetry::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference< task::XInteractionRetry > * >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionContinuation methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionRetry::select()
throw( uno::RuntimeException )
{
recordSelection();
}
//=========================================================================
//=========================================================================
//
// InteractionApprove Implementation.
//
//=========================================================================
//=========================================================================
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionApprove::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionApprove::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionApprove::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
static_cast< task::XInteractionApprove * >( this ) );
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL InteractionApprove::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionApprove::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference< task::XInteractionApprove > * >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionContinuation methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionApprove::select()
throw( uno::RuntimeException )
{
recordSelection();
}
//=========================================================================
//=========================================================================
//
// InteractionDisapprove Implementation.
//
//=========================================================================
//=========================================================================
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionDisapprove::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionDisapprove::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionDisapprove::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
static_cast< task::XInteractionDisapprove * >( this ) );
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL InteractionDisapprove::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionDisapprove::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference< task::XInteractionDisapprove > * >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionContinuation methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionDisapprove::select()
throw( uno::RuntimeException )
{
recordSelection();
}
//=========================================================================
//=========================================================================
//
// InteractionSupplyAuthentication Implementation.
//
//=========================================================================
//=========================================================================
//=========================================================================
//
// XInterface methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionSupplyAuthentication::acquire()
throw( uno::RuntimeException )
{
OWeakObject::acquire();
}
//=========================================================================
// virtual
void SAL_CALL InteractionSupplyAuthentication::release()
throw( uno::RuntimeException )
{
OWeakObject::release();
}
//=========================================================================
// virtual
uno::Any SAL_CALL
InteractionSupplyAuthentication::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
static_cast<
com::sun::star::ucb::XInteractionSupplyAuthentication * >
( this ) );
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================
// virtual
uno::Sequence< sal_Int8 > SAL_CALL
InteractionSupplyAuthentication::getImplementationId()
throw( uno::RuntimeException )
{
static cppu::OImplementationId* pId = NULL;
if ( !pId )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//=========================================================================
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
throw( uno::RuntimeException )
{
static cppu::OTypeCollection* pCollection = 0;
if ( !pCollection )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType( static_cast<
uno::Reference < lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference<
com::sun::star::ucb::XInteractionSupplyAuthentication >
* >( 0 ) ) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
//=========================================================================
//
// XInteractionContinuation methods.
//
//=========================================================================
// virtual
void SAL_CALL InteractionSupplyAuthentication::select()
throw( uno::RuntimeException )
{
recordSelection();
}
//=========================================================================
//
// XInteractionSupplyAuthentication methods.
//
//=========================================================================
// virtual
sal_Bool SAL_CALL
InteractionSupplyAuthentication::canSetRealm()
throw( uno::RuntimeException )
{
return m_bCanSetRealm;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setRealm( const rtl::OUString& Realm )
throw( uno::RuntimeException )
{
OSL_ENSURE( m_bCanSetPassword,
"InteractionSupplyAuthentication::setRealm - Not supported!" );
if ( m_bCanSetRealm )
m_aRealm = Realm;
}
//=========================================================================
// virtual
sal_Bool SAL_CALL
InteractionSupplyAuthentication::canSetUserName()
throw( uno::RuntimeException )
{
return m_bCanSetUserName;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setUserName( const rtl::OUString& UserName )
throw( uno::RuntimeException )
{
OSL_ENSURE( m_bCanSetUserName,
"InteractionSupplyAuthentication::setUserName - Not supported!" );
if ( m_bCanSetUserName )
m_aUserName = UserName;
}
//=========================================================================
// virtual
sal_Bool SAL_CALL
InteractionSupplyAuthentication::canSetPassword()
throw( uno::RuntimeException )
{
return m_bCanSetPassword;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setPassword( const rtl::OUString& Password )
throw( uno::RuntimeException )
{
OSL_ENSURE( m_bCanSetPassword,
"InteractionSupplyAuthentication::setPassword - Not supported!" );
if ( m_bCanSetPassword )
m_aPassword = Password;
}
//=========================================================================
// virtual
uno::Sequence< com::sun::star::ucb::RememberAuthentication > SAL_CALL
InteractionSupplyAuthentication::getRememberPasswordModes(
com::sun::star::ucb::RememberAuthentication& Default )
throw( uno::RuntimeException )
{
Default = m_eDefaultRememberPasswordMode;
return m_aRememberPasswordModes;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setRememberPassword(
com::sun::star::ucb::RememberAuthentication Remember )
throw( uno::RuntimeException )
{
m_eRememberPasswordMode = Remember;
}
//=========================================================================
// virtual
sal_Bool SAL_CALL
InteractionSupplyAuthentication::canSetAccount()
throw( uno::RuntimeException )
{
return m_bCanSetAccount;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setAccount( const rtl::OUString& Account )
throw( uno::RuntimeException )
{
OSL_ENSURE( m_bCanSetAccount,
"InteractionSupplyAuthentication::setAccount - Not supported!" );
if ( m_bCanSetAccount )
m_aAccount = Account;
}
//=========================================================================
// virtual
uno::Sequence< com::sun::star::ucb::RememberAuthentication > SAL_CALL
InteractionSupplyAuthentication::getRememberAccountModes(
com::sun::star::ucb::RememberAuthentication& Default )
throw( uno::RuntimeException )
{
Default = m_eDefaultRememberAccountMode;
return m_aRememberAccountModes;
}
//=========================================================================
// virtual
void SAL_CALL
InteractionSupplyAuthentication::setRememberAccount(
com::sun::star::ucb::RememberAuthentication Remember )
throw( uno::RuntimeException )
{
m_eRememberAccountMode = Remember;
}

View file

@ -0,0 +1,126 @@
/*************************************************************************
*
* $RCSfile: simpleauthenticationrequest.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: kso $ $Date: 2001-05-28 10:48:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_
#include <com/sun/star/ucb/AuthenticationRequest.hpp>
#endif
#ifndef _UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
#include <ucbhelper/simpleauthenticationrequest.hxx>
#endif
using namespace com::sun::star;
using namespace ucbhelper;
//=========================================================================
SimpleAuthenticationRequest::SimpleAuthenticationRequest(
const rtl::OUString & rServerName,
const rtl::OUString & rRealm,
const rtl::OUString & rUserName,
const rtl::OUString & rPassword,
const rtl::OUString & rAccount )
{
// Fill request...
ucb::AuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
aRequest.Classification = task::InteractionClassification_ERROR;
aRequest.ServerName = rServerName;
// aRequest.Diagnostic = // OUString
aRequest.HasRealm = ( rRealm.getLength() > 0 );
if ( aRequest.HasRealm )
aRequest.Realm = rRealm;
aRequest.HasUserName = sal_True;
aRequest.UserName = rUserName;
aRequest.HasPassword = sal_True;
aRequest.Password = rPassword;
aRequest.HasAccount = ( rAccount.getLength() > 0 );
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
setRequest( uno::makeAny( aRequest ) );
// Fill continuations...
uno::Sequence< ucb::RememberAuthentication > aRememberModes( 1 );
aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
m_xAuthSupplier
= new InteractionSupplyAuthentication(
this,
sal_False, // bCanSetRealm
sal_True, // bCanSetUserName
sal_True, // bCanSetPassword
aRequest.HasAccount, // bCanSetAccount
aRememberModes, // rRememberPasswordModes
ucb::RememberAuthentication_NO, // eDefaultRememberPasswordMode
aRememberModes, // rRememberAccountModes
ucb::RememberAuthentication_NO // eDefaultRememberAccountMode
);
uno::Sequence<
uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
aContinuations[ 0 ] = new InteractionAbort( this );
aContinuations[ 1 ] = new InteractionRetry( this );
aContinuations[ 2 ] = m_xAuthSupplier.getBodyPtr();
setContinuations( aContinuations );
}

View file

@ -0,0 +1,164 @@
/*************************************************************************
*
* $RCSfile: simpleinteractionrequest.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: kso $ $Date: 2001-05-28 10:48:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
#include <ucbhelper/simpleinteractionrequest.hxx>
#endif
using namespace com::sun::star;
using namespace ucbhelper;
//=========================================================================
SimpleInteractionRequest::SimpleInteractionRequest(
const uno::Any & rRequest,
const sal_Int32 nContinuations )
: InteractionRequest( rRequest )
{
// Set continuations.
OSL_ENSURE( nContinuations != CONTINUATION_UNKNOWN,
"SimpleInteractionRequest - No continuation!" );
sal_Int32 nLength = 0;
uno::Reference< task::XInteractionContinuation > xAbort;
uno::Reference< task::XInteractionContinuation > xRetry;
uno::Reference< task::XInteractionContinuation > xApprove;
uno::Reference< task::XInteractionContinuation > xDisapprove;
if ( nContinuations & CONTINUATION_ABORT )
{
++nLength;
xAbort = new InteractionAbort( this );
}
if ( nContinuations & CONTINUATION_RETRY )
{
++nLength;
xRetry = new InteractionRetry( this );
}
if ( nContinuations & CONTINUATION_APPROVE )
{
++nLength;
xApprove = new InteractionApprove( this );
}
if ( nContinuations & CONTINUATION_DISAPPROVE )
{
++nLength;
xDisapprove = new InteractionDisapprove( this );
}
OSL_ENSURE( nLength > 0,
"SimpleInteractionRequest - No continuation!" );
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
aContinuations( nLength );
if ( xAbort.is() )
aContinuations[ nLength++ ] = xAbort;
if ( xRetry.is() )
aContinuations[ nLength++ ] = xRetry;
if ( xApprove.is() )
aContinuations[ nLength++ ] = xApprove;
if ( xDisapprove.is() )
aContinuations[ nLength++ ] = xDisapprove;
setContinuations( aContinuations );
}
//=========================================================================
const sal_Int32 SimpleInteractionRequest::getResponse() const
{
vos::ORef< InteractionContinuation > xSelection = getSelection();
if ( xSelection.isValid() )
{
InteractionContinuation * pSelection = xSelection.getBodyPtr();
uno::Reference< task::XInteractionAbort > xAbort(
pSelection, uno::UNO_QUERY );
if ( xAbort.is() )
return CONTINUATION_ABORT;
uno::Reference< task::XInteractionRetry > xRetry(
pSelection, uno::UNO_QUERY );
if ( xRetry.is() )
return CONTINUATION_RETRY;
uno::Reference< task::XInteractionApprove > xApprove(
pSelection, uno::UNO_QUERY );
if ( xApprove.is() )
return CONTINUATION_APPROVE;
uno::Reference< task::XInteractionDisapprove > xDisapprove(
pSelection, uno::UNO_QUERY );
if ( xDisapprove.is() )
return CONTINUATION_DISAPPROVE;
OSL_ENSURE( sal_False,
"SimpleInteractionRequest::getResponse - Unknown continuation!" );
}
return CONTINUATION_UNKNOWN;
}