diff options
Diffstat (limited to 'uui/source/iahndl.cxx')
-rw-r--r-- | uui/source/iahndl.cxx | 449 |
1 files changed, 329 insertions, 120 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 62de20f87a74..996fd24e531d 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -68,6 +68,8 @@ #include "com/sun/star/task/ErrorCodeRequest.hpp" #include "com/sun/star/task/MasterPasswordRequest.hpp" #include "com/sun/star/task/NoMasterException.hpp" +#include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp" +#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionDisapprove.hpp" @@ -75,8 +77,10 @@ #include "com/sun/star/task/XInteractionRequest.hpp" #include "com/sun/star/task/XInteractionRetry.hpp" #include "com/sun/star/task/XPasswordContainer.hpp" +#include "com/sun/star/task/XUrlContainer.hpp" #include "com/sun/star/task/XInteractionAskLater.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" +#include "com/sun/star/ucb/URLAuthenticationRequest.hpp" #include "com/sun/star/ucb/CertificateValidationRequest.hpp" #include "com/sun/star/ucb/HandleCookiesRequest.hpp" #include "com/sun/star/ucb/InteractiveAppException.hpp" @@ -97,22 +101,24 @@ #include "com/sun/star/ucb/XInteractionCookieHandling.hpp" #include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" +#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp" #include "com/sun/star/ucb/XInteractionSupplyName.hpp" #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp" #include <com/sun/star/security/CertificateValidity.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include "vos/mutex.hxx" #include "tools/rcid.h" #include "vcl/svapp.hxx" #include "svtools/svtools.hrc" -#include "svtools/loginerr.hxx" #include "svtools/httpcook.hxx" #include "svtools/sfxecode.hxx" #include "toolkit/helper/vclunohelper.hxx" #include "comphelper/sequenceashashmap.hxx" +#include "comphelper/documentconstants.hxx" #include "unotools/configmgr.hxx" #include "ids.hrc" @@ -131,6 +137,8 @@ #include "filechanged.hxx" #include "trylater.hxx" #include "lockfailed.hxx" +#include "loginerr.hxx" + #include <comphelper/processfactory.hxx> #include <svtools/zforlist.hxx> using namespace com::sun; @@ -198,6 +206,8 @@ getContinuations( star::uno::Reference< star::task::XInteractionAbort > * pAbort, star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > * pSupplyAuthentication, + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > * + pSupplyAuthentication2, star::uno::Reference< star::task::XInteractionPassword > * pPassword, star::uno::Reference< star::ucb::XInteractionSupplyName > * pSupplyName, @@ -244,7 +254,16 @@ getContinuations( star::ucb::XInteractionSupplyAuthentication >( rContinuations[i], star::uno::UNO_QUERY); if (pSupplyAuthentication->is()) + { + // is it even a supplyauthentication2, which is derived from + // supplyauthentication? + if (pSupplyAuthentication2 && !pSupplyAuthentication2->is()) + *pSupplyAuthentication2 + = star::uno::Reference< + star::ucb::XInteractionSupplyAuthentication2 >( + rContinuations[i], star::uno::UNO_QUERY); continue; + } } if (pPassword && !pPassword->is()) { @@ -438,10 +457,12 @@ public: star::uno::Reference< star::task::XInteractionRequest > const & rRequest) : osl::Condition(), - m_rRequest(rRequest) + m_rRequest(rRequest), + bHandled( false ) { } star::uno::Reference< star::task::XInteractionRequest > m_rRequest; + bool bHandled; star::beans::Optional< rtl::OUString > m_aResult; }; @@ -450,13 +471,13 @@ long UUIInteractionHelper::handlerequest( { HandleData* pHND = (HandleData*) pHandleData; UUIInteractionHelper* pUUI = (UUIInteractionHelper*) pInteractionHelper; - pUUI->handle_impl(pHND->m_rRequest); + pHND->bHandled = pUUI->handle_impl(pHND->m_rRequest); pHND->set(); return 0; } -void +bool UUIInteractionHelper::handleRequest( star::uno::Reference< star::task::XInteractionRequest > const & rRequest) throw (star::uno::RuntimeException) @@ -477,9 +498,10 @@ UUIInteractionHelper::handleRequest( ULONG locks = Application::ReleaseSolarMutex(); aHD.wait(); Application::AcquireSolarMutex(locks); + return aHD.bHandled; } else - handle_impl(rRequest); + return handle_impl(rRequest); } long UUIInteractionHelper::getstringfromrequest( @@ -604,7 +626,7 @@ bool UUIInteractionHelper::handleMessageboxRequests( star::task::XInteractionDisapprove > xDisapprove; getContinuations( rRequest->getContinuations(), - &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0); + &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0, 0); if( xApprove.is() && xDisapprove.is() ) { @@ -1091,11 +1113,21 @@ bool UUIInteractionHelper::handleDialogRequests( { star::uno::Any aAnyRequest(rRequest->getRequest()); + star::ucb::URLAuthenticationRequest aURLAuthenticationRequest; + if (aAnyRequest >>= aURLAuthenticationRequest) + { + handleAuthenticationRequest(aURLAuthenticationRequest, + rRequest->getContinuations(), + aURLAuthenticationRequest.URL); + return true; + } + star::ucb::AuthenticationRequest aAuthenticationRequest; if (aAnyRequest >>= aAuthenticationRequest) { handleAuthenticationRequest(aAuthenticationRequest, - rRequest->getContinuations()); + rRequest->getContinuations(), + rtl::OUString()); return true; } @@ -1252,7 +1284,23 @@ bool UUIInteractionHelper::handleErrorHandlerRequests( if (aAnyRequest >>= aMacroConfirmRequest) { handleMacroConfirmRequest( - aMacroConfirmRequest, + aMacroConfirmRequest.DocumentURL, + aMacroConfirmRequest.DocumentStorage, + ODFVER_012_TEXT, + aMacroConfirmRequest.DocumentSignatureInformation, + rRequest->getContinuations() + ); + return true; + } + + star::task::DocumentMacroConfirmationRequest2 aMacroConfirmRequest2; + if (aAnyRequest >>= aMacroConfirmRequest2) + { + handleMacroConfirmRequest( + aMacroConfirmRequest2.DocumentURL, + aMacroConfirmRequest2.DocumentZipStorage, + aMacroConfirmRequest2.DocumentVersion, + aMacroConfirmRequest2.DocumentSignatureInformation, rRequest->getContinuations() ); return true; @@ -1282,7 +1330,7 @@ bool UUIInteractionHelper::handleErrorHandlerRequests( return false; } -void +bool UUIInteractionHelper::handle_impl( star::uno::Reference< star::task::XInteractionRequest > const & rRequest) throw (star::uno::RuntimeException) @@ -1290,7 +1338,7 @@ UUIInteractionHelper::handle_impl( try { if (!rRequest.is()) - return; + return false; //////////////////////////////////////////////////////////// // Display Messagebox @@ -1323,14 +1371,34 @@ UUIInteractionHelper::handle_impl( Reference< uno::XInterface > xIfc = m_xServiceFactory->createInstance(aIt->ServiceName); - Reference< com::sun::star::task::XInteractionHandler2 > xInteractionHandler = - Reference< com::sun::star::task::XInteractionHandler2 >( xIfc, UNO_QUERY ); - OSL_ENSURE( xInteractionHandler.is(), "Custom Interactionhandler does not implement mandatory interface XInteractionHandler2!" ); + Reference< com::sun::star::lang::XInitialization > xInitialization = + Reference< com::sun::star::lang::XInitialization >( xIfc, UNO_QUERY ); + + OSL_ENSURE( xInitialization.is(), "Custom Interactionhandler does not implement mandatory interface XInitialization!" ); + if (xInitialization.is()) + { + uno::Sequence< uno::Any > propertyValues(1);
+ beans::PropertyValue aProperty;
+
+ aProperty.Name = rtl::OUString::createFromAscii( "Parent" );
+ aProperty.Value <<= getParentXWindow(); + propertyValues[ 0 ] <<= aProperty; + + xInitialization->initialize(propertyValues); + } + + Reference< task::XInteractionHandler2 > + xInteractionHandler( xIfc, UNO_QUERY ); + + OSL_ENSURE( xInteractionHandler.is(), + "Custom Interactionhandler does not implement " + "mandatory interface XInteractionHandler2!" ); if (xInteractionHandler.is()) if (xInteractionHandler->handleInteractionRequest(rRequest)) - break; + return true; } + return false; } } } @@ -1341,6 +1409,7 @@ UUIInteractionHelper::handle_impl( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")), star::uno::Reference< star::uno::XInterface >()); } + return true; } void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList &rdataList) @@ -1452,6 +1521,15 @@ void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) { + star::uno::Reference< star::awt::XWindow > xWindow = getParentXWindow(); + if ( xWindow.is() ) + return VCLUnoHelper::GetWindow(xWindow); + + return 0; +} + +star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::getParentXWindow() SAL_THROW(()) +{ osl::MutexGuard aGuard(m_aPropertyMutex); for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i) { @@ -1462,7 +1540,7 @@ Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) { star::uno::Reference< star::awt::XWindow > xWindow; aProperty.Value >>= xWindow; - return VCLUnoHelper::GetWindow(xWindow); + return xWindow; } } return 0; @@ -1488,7 +1566,8 @@ rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(()) bool UUIInteractionHelper::initPasswordContainer( - star::uno::Reference< star::task::XPasswordContainer > * pContainer) + star::uno::Reference< star::task::XPasswordContainer > * pContainer, + star::uno::Reference< star::task::XUrlContainer > * pUrlContainer) const SAL_THROW(()) { OSL_ENSURE(pContainer, "specification violation"); @@ -1503,11 +1582,17 @@ UUIInteractionHelper::initPasswordContainer( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.PasswordContainer"))), star::uno::UNO_QUERY); + + if ( pContainer->is() ) + { + *pUrlContainer = star::uno::Reference< star::task::XUrlContainer >( *pContainer, UNO_QUERY ); + OSL_ENSURE( pUrlContainer->is(), "Got no XUrlContainer!" ); + } } catch (star::uno::Exception const &) {} OSL_ENSURE(pContainer->is(), "unexpected situation"); - return pContainer->is(); + return pContainer->is() && pUrlContainer->is(); } @@ -1686,6 +1771,7 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, != 0; bool bSavePassword = rInfo.GetIsPersistentPassword() || rInfo.GetIsSavePassword(); + bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); sal_uInt16 nFlags = 0; if (rInfo.GetPath().Len() == 0) @@ -1700,6 +1786,9 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, if (!bSavePassword) nFlags |= LF_NO_SAVEPASSWORD; + if (!bCanUseSysCreds) + nFlags |= LF_NO_USESYSCREDS; + std::auto_ptr< ResMgr > xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); UniString aRealm(rRealm); // Forte compiler needs it spelled out... @@ -1728,12 +1817,18 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, xDialog->SetSavePassword(rInfo.GetIsSavePassword()); } + if ( bCanUseSysCreds ) + xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); rInfo.SetUserName(xDialog->GetName()); rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetAccount(xDialog->GetAccount()); rInfo.SetSavePassword(xDialog->IsSavePassword()); + + if ( bCanUseSysCreds ) + rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() ); } catch (std::bad_alloc const &) { @@ -2095,12 +2190,87 @@ UUIInteractionHelper::getInteractionHandler() const return xIH; } +namespace +{ +bool fillContinuation( + bool bUseSystemCredentials, + const star::ucb::AuthenticationRequest & rRequest, + const star::task::UrlRecord & aRec, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > & + xSupplyAuthentication, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > & + xSupplyAuthentication2, + bool bCanUseSystemCredentials, + bool bCheckForEqualPasswords ) +{ + if ( bUseSystemCredentials ) + { + // "use system creds" record found. + // Wants client that we use it? + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + { + xSupplyAuthentication2->setUseSystemCredentials( sal_True ); + return true; + } + return false; + } + else if (aRec.UserList.getLength() != 0) + { + if (aRec.UserList[0].Passwords.getLength() == 0) + { + // Password sequence can be empty, for instance if master + // password was not given (e.g. master pw dialog canceled) + // pw container does not throw NoMasterException in this case. + // bug??? + return false; + } + + // "user/pass" record found. + if (!bCheckForEqualPasswords || !rRequest.HasPassword + || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt? + { + if (xSupplyAuthentication->canSetUserName()) + xSupplyAuthentication-> + setUserName(aRec.UserList[0].UserName.getStr()); + + if (xSupplyAuthentication->canSetPassword()) + xSupplyAuthentication-> + setPassword(aRec.UserList[0].Passwords[0].getStr()); + if (aRec.UserList[0].Passwords.getLength() > 1) + { + if (rRequest.HasRealm) + { + if (xSupplyAuthentication->canSetRealm()) + xSupplyAuthentication-> + setRealm(aRec.UserList[0].Passwords[1]. + getStr()); + } + else if (xSupplyAuthentication->canSetAccount()) + xSupplyAuthentication-> + setAccount(aRec.UserList[0].Passwords[1]. + getStr()); + } + + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( sal_False ); + + return true; + } + } + return false; +} + +} + void UUIInteractionHelper::handleAuthenticationRequest( star::ucb::AuthenticationRequest const & rRequest, star::uno::Sequence< star::uno::Reference< star::task::XInteractionContinuation > > const & - rContinuations) + rContinuations, + const rtl::OUString & rURL) SAL_THROW((star::uno::RuntimeException)) { star::uno::Reference< star::task::XInteractionHandler > xIH; @@ -2109,9 +2279,12 @@ UUIInteractionHelper::handleAuthenticationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > xSupplyAuthentication; + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > + xSupplyAuthentication2; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0 ); + 0, 0, &xRetry, &xAbort, + &xSupplyAuthentication, &xSupplyAuthentication2, 0, 0, 0 ); bool bRemember; bool bRememberPersistent; if (xSupplyAuthentication.is()) @@ -2134,90 +2307,103 @@ UUIInteractionHelper::handleAuthenticationRequest( bRememberPersistent = false; } + sal_Bool bCanUseSystemCredentials; + sal_Bool bDefaultUseSystemCredentials; + if (xSupplyAuthentication2.is()) + { + bCanUseSystemCredentials + = xSupplyAuthentication2->canUseSystemCredentials( + bDefaultUseSystemCredentials ); + } + else + { + bCanUseSystemCredentials = sal_False; + bDefaultUseSystemCredentials = sal_False; + } + com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > xContainer; + com::sun::star::uno::Reference< com::sun::star::task::XUrlContainer > + xUrlContainer; + + if ( bCanUseSystemCredentials && initPasswordContainer( &xContainer, &xUrlContainer ) ) + { + // Runtime / Persistent info avail for current auth request? + + rtl::OUString aResult = xUrlContainer->findUrl( + rURL.getLength() ? rURL : rRequest.ServerName ); + if ( aResult.getLength() > 0 ) + { + if ( fillContinuation( true, + rRequest, + star::task::UrlRecord(), + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) + { + xSupplyAuthentication->select(); + return; + } + } + } // xContainer works with userName passwdSequences pairs: if (rRequest.HasUserName && rRequest.HasPassword - && initPasswordContainer(&xContainer)) + && initPasswordContainer(&xContainer, &xUrlContainer)) { xIH = getInteractionHandler(); try { if (rRequest.UserName.getLength() == 0) { - star::task::UrlRecord - aRec(xContainer->find(rRequest.ServerName, xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->find(rURL, xIH); + + if ( aRec.UserList.getLength() == 0 ) + { + // compat: try server name. + aRec = xContainer->find(rRequest.ServerName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName(aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - xSupplyAuthentication-> - setPassword( - aRec.UserList[0].Passwords[0].getStr()); - } - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } xSupplyAuthentication->select(); return; } } else { - star::task::UrlRecord - aRec(xContainer->findForName(rRequest.ServerName, - rRequest.UserName, - xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->findForName( + rURL, rRequest.UserName, xIH); + + if ( aRec.UserList.getLength() == 0 ) { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - if (!rRequest.HasPassword - || rRequest.Password != aRec.UserList[0].Passwords[0]) - { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName( - aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - xSupplyAuthentication-> - setPassword(aRec.UserList[0].Passwords[0]. - getStr()); - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } - xSupplyAuthentication->select(); - return; - } + // compat: try server name. + aRec = xContainer->findForName( + rRequest.ServerName, rRequest.UserName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + true ) ) + { + xSupplyAuthentication->select(); + return; } } } @@ -2237,6 +2423,8 @@ UUIInteractionHelper::handleAuthenticationRequest( aInfo.SetErrorText(rRequest.Diagnostic); aInfo.SetPersistentPassword(bRememberPersistent); aInfo.SetSavePassword(bRemember); + aInfo.SetCanUseSystemCredentials( bCanUseSystemCredentials ); + aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials ); aInfo.SetModifyAccount(rRequest.HasAccount && xSupplyAuthentication.is() && xSupplyAuthentication->canSetAccount()); @@ -2269,34 +2457,51 @@ UUIInteractionHelper::handleAuthenticationRequest( else if (xSupplyAuthentication->canSetAccount()) xSupplyAuthentication->setAccount(aInfo.GetAccount()); + if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( + aInfo.GetIsUseSystemCredentials() ); + xSupplyAuthentication->select(); } - // Empty user name can not be valid: - if (aInfo.GetUserName().Len() != 0 - && initPasswordContainer(&xContainer)) + + if ( aInfo.GetIsUseSystemCredentials() ) + { + if (aInfo.GetIsSavePassword()) + { + if ( initPasswordContainer(&xContainer, &xUrlContainer) ) + xUrlContainer->addUrl( + rURL.getLength() ? rURL : rRequest.ServerName, + bRememberPersistent ); + } + } + else if (aInfo.GetUserName().Len() != 0 // Empty user name can not be valid: + && initPasswordContainer(&xContainer, &xUrlContainer)) { - star::uno::Sequence< rtl::OUString > - aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); - aPassList[0] = aInfo.GetPassword(); - if (aInfo.GetAccount().Len() != 0) - aPassList[1] = aInfo.GetAccount(); try { if (aInfo.GetIsSavePassword()) { + star::uno::Sequence< rtl::OUString > + aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); + aPassList[0] = aInfo.GetPassword(); + if (aInfo.GetAccount().Len() != 0) + aPassList[1] = aInfo.GetAccount(); + if (!xIH.is()) xIH = getInteractionHandler(); if (bRememberPersistent) - xContainer->addPersistent(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->addPersistent( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); else - xContainer->add(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->add( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); } } catch (star::task::NoMasterException const &) @@ -2351,7 +2556,7 @@ UUIInteractionHelper::handleCertificateValidationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); sal_Int32 failures = rRequest.CertificateValidity; @@ -2478,7 +2683,7 @@ UUIInteractionHelper::handleNameClashResolveRequest( xReplaceExistingData; getContinuations( rContinuations, - 0, 0, 0, &xAbort, 0, 0, &xSupplyName, &xReplaceExistingData); + 0, 0, 0, &xAbort, 0, 0, 0, &xSupplyName, &xReplaceExistingData); OSL_ENSURE( xAbort.is(), "NameClashResolveRequest must contain Abort continuation" ); @@ -2539,7 +2744,7 @@ UUIInteractionHelper::handleMasterPasswordRequest( xSupplyAuthentication; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0); + 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0, 0); LoginErrorInfo aInfo; // in case of master password a hash code is returned @@ -2582,7 +2787,7 @@ UUIInteractionHelper::handlePasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executePasswordDialog(aInfo, nMode, aDocumentName); @@ -2623,7 +2828,7 @@ UUIInteractionHelper::handleMSPasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executeMSPasswordDialog(aInfo, nMode, aDocumentName); @@ -3039,13 +3244,13 @@ UUIInteractionHelper::handleGenericErrorRequest( ErrCode nError = (ErrCode)nErrorCode; sal_Bool bWarning = !ERRCODE_TOERROR(nError); - if ( nError == ERRCODE_SFX_BROKENSIGNATURE ) + if ( nError == ERRCODE_SFX_BROKENSIGNATURE + || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION ) { - // the broken signature warning needs a special title + // the security warning need a special title String aErrorString; ErrorHandler::GetErrorString( nErrorCode, aErrorString ); - std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) ); ::rtl::OUString aTitle; @@ -3059,7 +3264,8 @@ UUIInteractionHelper::handleGenericErrorRequest( } catch( star::uno::Exception& ) {} - ::rtl::OUString aErrTitle = String( ResId( STR_WARNING_BROKENSIGNATURE_TITLE, *xManager.get() ) ); + ::rtl::OUString aErrTitle = String( ResId( nError == ERRCODE_SFX_BROKENSIGNATURE ? STR_WARNING_BROKENSIGNATURE_TITLE : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE, *xManager.get() ) ); + if ( aTitle.getLength() && aErrTitle.getLength() ) aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) ); aTitle += aErrTitle; @@ -3095,7 +3301,10 @@ namespace void UUIInteractionHelper::handleMacroConfirmRequest( - const star::task::DocumentMacroConfirmationRequest& _rRequest, + const ::rtl::OUString& aDocumentURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xZipStorage, + const ::rtl::OUString& aDocumentVersion, + const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > aSignInfo, star::uno::Sequence< star::uno::Reference< star::task::XInteractionContinuation > > const & rContinuations ) @@ -3109,17 +3318,17 @@ UUIInteractionHelper::handleMacroConfirmRequest( std::auto_ptr< ResMgr > pResMgr( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) ); if ( pResMgr.get() ) { - bool bShowSignatures = _rRequest.DocumentSignatureInformation.getLength() > 0; + bool bShowSignatures = aSignInfo.getLength() > 0; MacroWarning aWarning( getParentProperty(), bShowSignatures, *pResMgr.get() ); - aWarning.SetDocumentURL( _rRequest.DocumentURL ); - if ( _rRequest.DocumentSignatureInformation.getLength() > 1 ) + aWarning.SetDocumentURL( aDocumentURL ); + if ( aSignInfo.getLength() > 1 ) { - aWarning.SetStorage( _rRequest.DocumentStorage, _rRequest.DocumentSignatureInformation ); + aWarning.SetStorage( xZipStorage, aDocumentVersion, aSignInfo ); } - else if ( _rRequest.DocumentSignatureInformation.getLength() == 1 ) + else if ( aSignInfo.getLength() == 1 ) { - aWarning.SetCertificate( _rRequest.DocumentSignatureInformation[ 0 ].Signer ); + aWarning.SetCertificate( aSignInfo[ 0 ].Signer ); } bApprove = aWarning.Execute() == RET_OK; @@ -3380,7 +3589,7 @@ UUIInteractionHelper::handleErrorRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( rContinuations, - &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0); + &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0, 0); // The following mapping uses the bit mask // Approve = 8, @@ -3498,7 +3707,7 @@ UUIInteractionHelper::handleBrokenPackageRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); ErrCode nErrorCode; if( xApprove.is() && xDisapprove.is() ) @@ -3603,7 +3812,7 @@ UUIInteractionHelper::handleLockedDocumentRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() ) return; @@ -3681,7 +3890,7 @@ UUIInteractionHelper::handleChangedByOthersRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; @@ -3721,7 +3930,7 @@ UUIInteractionHelper::handleLockFileIgnoreRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; |