diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-09-06 10:02:33 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-09-06 10:02:33 +0200 |
commit | 4e690b6439201fd2280081d42455d9daae70666d (patch) | |
tree | 72ff531f823418d2f1540a233d4259affaa579eb /comphelper/source | |
parent | 600c6460a6ffa169ad0cc9bed4b77c545cc50f52 (diff) |
cws tl82: #i114160# SimplePasswordRequest and respective dialog
Diffstat (limited to 'comphelper/source')
-rwxr-xr-x[-rw-r--r--] | comphelper/source/misc/docpasswordrequest.cxx | 67 | ||||
-rwxr-xr-x[-rw-r--r--] | comphelper/source/misc/makefile.mk | 0 |
2 files changed, 66 insertions, 1 deletions
diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 17cdb0ae2d92..15c2e09ba0f3 100644..100755 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -31,6 +31,7 @@ #include "comphelper/docpasswordrequest.hxx" #include <com/sun/star/task/DocumentMSPasswordRequest2.hpp> #include <com/sun/star/task/DocumentPasswordRequest2.hpp> +#include <com/sun/star/task/PasswordRequest.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionPassword2.hpp> @@ -44,6 +45,7 @@ using ::com::sun::star::uno::XInterface; using ::com::sun::star::task::InteractionClassification_QUERY; using ::com::sun::star::task::DocumentMSPasswordRequest2; using ::com::sun::star::task::DocumentPasswordRequest2; +using ::com::sun::star::task::PasswordRequest; using ::com::sun::star::task::PasswordRequestMode; using ::com::sun::star::task::XInteractionAbort; using ::com::sun::star::task::XInteractionContinuation; @@ -98,11 +100,74 @@ private: // ============================================================================ +SimplePasswordRequest::SimplePasswordRequest( PasswordRequestMode eMode ) +: mpAbort( NULL ) +, mpPassword( NULL ) +{ + PasswordRequest aRequest( OUString(), Reference< XInterface >(), + InteractionClassification_QUERY, eMode ); + maRequest <<= aRequest; + + maContinuations.realloc( 2 ); + maContinuations[ 0 ].set( mpAbort = new AbortContinuation ); + maContinuations[ 1 ].set( mpPassword = new PasswordContinuation ); +} + +SimplePasswordRequest::~SimplePasswordRequest() +{ +} + +/*uno::*/Any SAL_CALL SimplePasswordRequest::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL SimplePasswordRequest::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL SimplePasswordRequest::release( ) throw () +{ + OWeakObject::release(); +} + +sal_Bool SimplePasswordRequest::isAbort() const +{ + return mpAbort->isSelected(); +} + +sal_Bool SimplePasswordRequest::isPassword() const +{ + return mpPassword->isSelected(); +} + +OUString SimplePasswordRequest::getPassword() const +{ + return mpPassword->getPassword(); +} + +Any SAL_CALL SimplePasswordRequest::getRequest() throw( RuntimeException ) +{ + return maRequest; +} + +Sequence< Reference< XInteractionContinuation > > SAL_CALL SimplePasswordRequest::getContinuations() throw( RuntimeException ) +{ + return maContinuations; +} + +// ============================================================================ + DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType, PasswordRequestMode eMode, const OUString& rDocumentName, sal_Bool bPasswordToModify ) : mpAbort( NULL ) , mpPassword( NULL ) -, mbPasswordToModify( bPasswordToModify ) { switch( eType ) { diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index cecba554b332..cecba554b332 100644..100755 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk |