summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sb@openoffice.org>2001-08-07 12:34:19 +0000
committerStephan Bergmann <sb@openoffice.org>2001-08-07 12:34:19 +0000
commit7522ed8d4282de62dbc1ca45a83187ef33fb8b85 (patch)
treedd0dbc85dae54e16cb6ec9105c8710df1fecfcd4
parentddd18f483a2efa192fbfe93ad59d354c50e036a9 (diff)
#86767# Adapted to modified InteractiveAugmentedIOException; cleaned up.
-rw-r--r--uui/source/iahndl.cxx2051
-rw-r--r--uui/source/iahndl.hxx149
2 files changed, 1189 insertions, 1011 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index d58e289b9476..657e17e681f8 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: iahndl.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mav $ $Date: 2001-06-26 14:27:15 $
+ * last change: $Author: sb $ $Date: 2001-08-07 13:34:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,956 +59,1250 @@
*
************************************************************************/
+#ifndef UUI_IAHNDL_HXX
+#include "iahndl.hxx"
+#endif
+
+#ifndef UUI_COOKIEDG_HXX
+#include "cookiedg.hxx"
+#endif
+#ifndef UUI_IDS_HRC
+#include "ids.hrc"
+#endif
+#ifndef UUI_LOGINDLG_HXX
+#include "logindlg.hxx"
+#endif
+#ifndef UUI_PASSWORDDLG_HXX
+#include "passworddlg.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include "com/sun/star/beans/PropertyValue.hpp"
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#endif
#ifndef _COM_SUN_STAR_TASK_CLASSIFIEDINTERACTIONREQUEST_HPP_
-#include <com/sun/star/task/ClassifiedInteractionRequest.hpp>
+#include "com/sun/star/task/ClassifiedInteractionRequest.hpp"
+#endif
+#ifndef _COM_SUN_STAR_TASK_NOMASTEREXCEPTION_HPP_
+#include "com/sun/star/task/NoMasterException.hpp"
+#endif
+#ifndef _COM_SUN_STAR_TASK_PASSWORDREQUEST_HPP_
+#include "com/sun/star/task/PasswordRequest.hpp"
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP_
-#include <com/sun/star/task/XInteractionAbort.hpp>
+#include "com/sun/star/task/XInteractionAbort.hpp"
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONAPPROVE_HPP_
-#include <com/sun/star/task/XInteractionApprove.hpp>
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONCONTINUATION_HPP_
+#include "com/sun/star/task/XInteractionContinuation.hpp"
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONDISAPPROVE_HPP_
-#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONRETRY_HPP_
-#include <com/sun/star/task/XInteractionRetry.hpp>
+#include "com/sun/star/task/XInteractionRetry.hpp"
#endif
-#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_
-#include <com/sun/star/ucb/AuthenticationRequest.hpp>
+#ifndef _COM_SUN_STAR_TASK_XPASSWORDCONTAINER_HPP_
+#include "com/sun/star/task/XPasswordContainer.hpp"
#endif
-#ifndef _COM_SUN_STAR_TASK_PASSWORDREQUEST_HPP_
-#include <com/sun/star/task/PasswordRequest.hpp>
-#endif
-#ifndef _COM_SUN_STAR_TASK_NOMASTEREXCEPTION_HPP_
-#include <com/sun/star/task/NoMasterException.hpp>
+#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_
+#include "com/sun/star/ucb/AuthenticationRequest.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_HANDLECOOKIESREQUEST_HPP_
-#include <com/sun/star/ucb/HandleCookiesRequest.hpp>
+#include "com/sun/star/ucb/HandleCookiesRequest.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFERURLEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
+#include "com/sun/star/ucb/InteractiveBadTransferURLException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVECHAOSEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveCHAOSException.hpp>
+#include "com/sun/star/ucb/InteractiveCHAOSException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVEFILEIOEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveFileIOException.hpp>
+#include "com/sun/star/ucb/InteractiveFileIOException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKCONNECTEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkConnectException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKGENERALEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkGeneralException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKOFFLINEEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkOffLineException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkOffLineException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKREADEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkReadException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkReadException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKRESOLVENAMEEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKWRITEEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp>
+#include "com/sun/star/ucb/InteractiveNetworkWriteException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_INTERACTIVEWRONGMEDIUMEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveWrongMediumException.hpp>
+#include "com/sun/star/ucb/InteractiveWrongMediumException.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_XINTERACTIONCOOKIEHANDLING_HPP_
-#include <com/sun/star/ucb/XInteractionCookieHandling.hpp>
+#include "com/sun/star/ucb/XInteractionCookieHandling.hpp"
#endif
#ifndef _COM_SUN_STAR_UCB_XINTERACTIONSUPPLYAUTHENTICATION_HPP_
-#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp>
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
+#endif
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include "com/sun/star/uno/Any.hxx"
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include "com/sun/star/uno/Sequence.hxx"
+#endif
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include "com/sun/star/uno/XInterface.hpp"
#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
+#ifndef _OSL_DIAGNOSE_H_
+#include "osl/diagnose.h"
+#endif
+#ifndef _RTL_DIGEST_H
+#include "rtl/digest.h"
+#endif
+#ifndef _RTL_STRING_H_
+#include "rtl/string.h"
+#endif
+#ifndef _RTL_TEXTENC_H
+#include "rtl/textenc.h"
+#endif
+#ifndef _RTL_USTRBUF_HXX_
+#include "rtl/ustrbuf.hxx"
+#endif
+#ifndef _RTL_USTRING_H_
+#include "rtl/ustring.h"
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include "rtl/ustring.hxx"
+#endif
+#ifndef _SAL_TYPES_H_
+#include "sal/types.h"
#endif
#ifndef _EHDL_HXX
-#include <svtools/ehdl.hxx>
+#include "svtools/ehdl.hxx"
#endif
#ifndef SVTOOLS_HTTPCOOK_HXX
-#include <svtools/httpcook.hxx>
+#include "svtools/httpcook.hxx"
#endif
#ifndef _LOGINERR_HXX
-#include <svtools/loginerr.hxx>
+#include "svtools/loginerr.hxx"
#endif
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include "svtools/svtools.hrc"
#endif
#ifndef _EINF_HXX
-#include <tools/errinf.hxx>
+#include "tools/errinf.hxx"
+#endif
+#ifndef _LIST_HXX
+#include "tools/list.hxx"
+#endif
+#ifndef _SOLAR_H
+#include "tools/solar.h"
#endif
#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
+#include "vcl/msgbox.hxx"
#endif
#ifndef _SV_SVAPP_HXX
-#include <vcl/svapp.hxx>
+#include "vcl/svapp.hxx"
#endif
#ifndef _SV_WRKWIN_HXX
-#include <vcl/wrkwin.hxx>
+#include "vcl/wrkwin.hxx"
#endif
#ifndef _VOS_MUTEX_HXX_
-#include <vos/mutex.hxx>
-#endif
-#ifndef _RTL_DIGEST_H
-#include <rtl/digest.h>
+#include "vos/mutex.hxx"
#endif
-#ifndef UUI_COOKIEDG_HXX
-#include <cookiedg.hxx>
+#ifndef INCLUDED_MEMORY
+#include <memory>
+#define INCLUDED_MEMORY
#endif
-#ifndef UUI_IAHNDL_HXX
-#include <iahndl.hxx>
+#ifndef INCLUDED_NEW
+#include <new>
+#define INCLUDED_NEW
#endif
-#ifndef UUI_IDS_HRC
-#include <ids.hrc>
-#endif
-#ifndef UUI_LOGINDLG_HXX
-#include <logindlg.hxx>
-#endif
-#ifndef UUI_PASSWORDDLG_HXX
-#include <passworddlg.hxx>
-#endif
-
-using namespace com::sun::star;
-namespace unnamed_uui_iahndl {} using namespace unnamed_uui_iahndl;
- // unnamed namespaces don't work well yet...
+using namespace com::sun;
-//============================================================================
-namespace unnamed_uui_iahndl {
+namespace {
-class SimpleErrorContext: public ErrorContext
+class CookieList: public List
{
- UniString m_aContext;
-
public:
- SimpleErrorContext(UniString const & rTheContext): m_aContext(rTheContext)
- {}
-
- virtual BOOL GetString(ULONG, UniString & rCtxStr);
+ ~CookieList() SAL_THROW(());
};
-//============================================================================
-USHORT executeErrorDialog(ULONG nID, USHORT nMask);
+CookieList::~CookieList() SAL_THROW(())
+{
+ while (Count() != 0)
+ delete static_cast< CntHTTPCookie * >(Remove(Count() - 1));
+}
-//============================================================================
-void executeLoginDialog(LoginErrorInfo & rInfo, rtl::OUString const & rRealm);
+class SimpleErrorContext: public ErrorContext
+{
+public:
+ SimpleErrorContext(UniString const & rTheContext) SAL_THROW(()):
+ m_aContext(rTheContext) {}
-//============================================================================
-void executePasswordDialog( LoginErrorInfo & rInfo, task::PasswordRequestMode nMode );
+ virtual BOOL GetString(ULONG, UniString & rCtxStr);
-//============================================================================
-void executeCookieDialog(CntHTTPCookieRequest & rRequest);
+private:
+ UniString m_aContext;
+};
+BOOL SimpleErrorContext::GetString(ULONG, UniString & rCtxStr)
+{
+ rCtxStr = m_aContext;
+ return true;
}
-//============================================================================
-//
-// UUIInteractionHandler
-//
-//============================================================================
+class SimpleErrorContextPtr
+{
+public:
+ SimpleErrorContextPtr() SAL_THROW(()): m_pContext(0) {}
-// static
-sal_Char const UUIInteractionHandler::m_aImplementationName[]
- = "com.sun.star.comp.uui.UUIInteractionHandler";
+ ~SimpleErrorContextPtr() SAL_THROW(());
+ inline void set(SimpleErrorContext * pContext) SAL_THROW(())
+ { m_pContext = pContext; }
-//============================================================================
+private:
+ SimpleErrorContext * m_pContext;
+};
-UUIInteractionHandler::UUIInteractionHandler(
- uno::Reference< lang::XMultiServiceFactory > const & aServiceManager )
+SimpleErrorContextPtr::~SimpleErrorContextPtr() SAL_THROW(())
{
- mPContainer = uno::Reference< task::XPasswordContainer >( aServiceManager->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.PasswordContainer" ))),
- uno::UNO_QUERY );
+ if (m_pContext)
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ delete m_pContext;
+ }
}
-
-//============================================================================
-// virtual
-uno::Any SAL_CALL UUIInteractionHandler::queryInterface(uno::Type const &
- rType)
- throw (uno::RuntimeException)
+void
+getAuthenticationContinuations(
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations,
+ star::uno::Reference< star::task::XInteractionAbort > * pAbort,
+ star::uno::Reference< star::task::XInteractionRetry > * pRetry,
+ star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > *
+ pSupplyAuthentication)
+ SAL_THROW((star::uno::RuntimeException))
{
- uno::Any
- aRet(cppu::queryInterface(rType,
- static_cast< lang::XServiceInfo * >(this),
- static_cast< lang::XTypeProvider * >(this),
- static_cast< task::XInteractionHandler * >(
- this)));
- return aRet.hasValue() ? aRet : OWeakObject::queryInterface(rType);
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (pAbort && !pAbort->is())
+ {
+ *pAbort = star::uno::Reference< star::task::XInteractionAbort >(
+ rContinuations[i], star::uno::UNO_QUERY);
+ if (pAbort->is())
+ continue;
+ }
+ if (pRetry && !pRetry->is())
+ {
+ *pRetry = star::uno::Reference< star::task::XInteractionRetry >(
+ rContinuations[i], star::uno::UNO_QUERY);
+ if (pRetry->is())
+ continue;
+ }
+ if (pSupplyAuthentication && !pSupplyAuthentication->is())
+ {
+ *pSupplyAuthentication
+ = star::uno::Reference<
+ star::ucb::XInteractionSupplyAuthentication >(
+ rContinuations[i], star::uno::UNO_QUERY);
+ if (pSupplyAuthentication->is())
+ continue;
+ }
+ }
}
-//============================================================================
-// virtual
-void SAL_CALL UUIInteractionHandler::acquire() throw (uno::RuntimeException)
+bool getArgument(star::uno::Sequence< star::uno::Any > const & rArguments,
+ rtl::OUString const & rKey,
+ rtl::OUString * pValue)
+ SAL_THROW(())
{
- OWeakObject::acquire();
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ star::beans::PropertyValue aProperty;
+ if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
+ {
+ rtl::OUString aValue;
+ if (aProperty.Value >>= aValue)
+ {
+ if (pValue)
+ *pValue = aValue;
+ return true;
+ }
+ }
+ }
+ return false;
}
-//============================================================================
-// virtual
-void SAL_CALL UUIInteractionHandler::release() throw (uno::RuntimeException)
+bool getResourceNameArgument(star::uno::Sequence< star::uno::Any > const &
+ rArguments,
+ rtl::OUString * pValue)
+ SAL_THROW(())
{
- OWeakObject::release();
+ if (!getArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")),
+ pValue))
+ return false;
+ // Use the resource name only for file URLs, to avoid confusion:
+ if (pValue
+ && pValue->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "file:")))
+ getArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceName")),
+ pValue);
+ return true;
}
-//============================================================================
-// virtual
-rtl::OUString SAL_CALL UUIInteractionHandler::getImplementationName()
- throw (uno::RuntimeException)
-{
- return rtl::OUString::createFromAscii(m_aImplementationName);
}
-//============================================================================
-// virtual
-sal_Bool SAL_CALL UUIInteractionHandler::supportsService(rtl::OUString const &
- rServiceName)
- throw (uno::RuntimeException)
+USHORT UUIInteractionHandler::executeErrorDialog(ULONG nID, USHORT nMask)
+ SAL_THROW((star::uno::RuntimeException))
{
- uno::Sequence< rtl::OUString > aNames(getSupportedServiceNames_static());
- for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
- if (aNames[i] == rServiceName)
- return true;
- return false;
-}
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
-//============================================================================
-// virtual
-uno::Sequence< rtl::OUString > SAL_CALL
-UUIInteractionHandler::getSupportedServiceNames()
- throw (uno::RuntimeException)
-{
- return getSupportedServiceNames_static();
+ std::auto_ptr< ResMgr >
+ xManager1(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(ofa)));
+ std::auto_ptr< SfxErrorHandler >
+ xHandler1(new SfxErrorHandler(RID_ERRHDL,
+ ERRCODE_AREA_TOOLS,
+ ERRCODE_AREA_LIB1 - 1,
+ xManager1.get()));
+ std::auto_ptr< ResMgr >
+ xManager2(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(cnt)));
+ std::auto_ptr< SfxErrorHandler >
+ xHandler2(new SfxErrorHandler(RID_CHAOS_START + 12,
+ ERRCODE_AREA_CHAOS,
+ ERRCODE_AREA_CHAOS_END,
+ xManager2.get()));
+ // cf. chaos/source/inc/cntrids.hrc, where
+ // #define RID_CHAOS_ERRHDL (RID_CHAOS_START + 12)
+ std::auto_ptr< ResMgr >
+ xManager3(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< SfxErrorHandler >
+ xHandler3(new SfxErrorHandler(RID_UUI_ERRHDL,
+ ERRCODE_AREA_UUI,
+ ERRCODE_AREA_UUI_END,
+ xManager3.get()));
+
+ // Needed because within ErrorHandler::HandleError() ResIds are
+ // created without a ResMgr---they require a default ResMgr:
+ ResMgr * pDefaultManager = Resource::GetResManager();
+ Resource::SetResManager(xManager1.get());
+ USHORT nButton = ErrorHandler::HandleError(nID, nMask);
+ Resource::SetResManager(pDefaultManager);
+ return nButton;
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ *this);
+ }
}
-//============================================================================
-// virtual
-uno::Sequence< uno::Type > SAL_CALL UUIInteractionHandler::getTypes()
- throw (uno::RuntimeException)
+void UUIInteractionHandler::executeLoginDialog(LoginErrorInfo & rInfo,
+ rtl::OUString const & rRealm)
+ SAL_THROW((star::uno::RuntimeException))
{
- static cppu::OTypeCollection * pCollection = 0;
- if (!pCollection)
+ try
{
- osl::Guard< osl::Mutex > aGuard(osl::Mutex::getGlobalMutex());
- if (!pCollection)
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT)
+ != 0;
+ bool bSavePassword = rInfo.GetIsPersistentPassword()
+ || rInfo.GetIsSavePassword();
+
+ sal_uInt16 nFlags = 0;
+ if (rInfo.GetPath().Len() == 0)
+ nFlags |= LF_NO_PATH;
+ if (rInfo.GetErrorText().Len() == 0)
+ nFlags |= LF_NO_ERRORTEXT;
+ if (!bAccount)
+ nFlags |= LF_NO_ACCOUNT;
+ if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
+ nFlags |= LF_USERNAME_READONLY;
+
+ if (!bSavePassword)
+ nFlags |= LF_NO_SAVEPASSWORD;
+
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< LoginDialog >
+ xDialog(new LoginDialog(0,
+ nFlags,
+ rInfo.GetServer(),
+ rRealm,
+ xManager.get()));
+ if (rInfo.GetErrorText().Len() != 0)
+ xDialog->SetErrorText(rInfo.GetErrorText());
+ xDialog->SetName(rInfo.GetUserName());
+ if (bAccount)
+ xDialog->ClearAccount();
+ else
+ xDialog->ClearPassword();
+ xDialog->SetPassword(rInfo.GetPassword());
+
+ if (bSavePassword)
{
- static cppu::OTypeCollection
- aTheCollection(
- getCppuType(
- static_cast< uno::Reference< lang::XServiceInfo >
- const * >(
- 0)),
- getCppuType(
- static_cast< uno::Reference< lang::XTypeProvider >
- const * >(
- 0)),
- getCppuType(
- static_cast<
- uno::Reference< task::XInteractionHandler >
- const * >(
- 0)));
- pCollection = &aTheCollection;
+ xDialog->
+ SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ?
+ RID_SAVE_PASSWORD :
+ RID_KEEP_PASSWORD,
+ xManager.get()));
+ xDialog->SetSavePassword(rInfo.GetIsSavePassword());
}
+
+ 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());
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ *this);
}
- return pCollection->getTypes();
}
-//============================================================================
-// virtual
-uno::Sequence< sal_Int8 > SAL_CALL
-UUIInteractionHandler::getImplementationId() throw (uno::RuntimeException)
+void
+UUIInteractionHandler::executePasswordDialog(LoginErrorInfo & rInfo,
+ star::task::PasswordRequestMode
+ nMode)
+ SAL_THROW((star::uno::RuntimeException))
{
- static cppu::OImplementationId * pID = 0;
- if (!pID)
+ rtl::OString aMaster;
+ try
{
- osl::Guard< osl::Mutex > aGuard(osl::Mutex::getGlobalMutex());
- if (!pID)
- {
- static cppu::OImplementationId aTheID(false);
- pID = &aTheID;
- }
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< MasterPasswordDialog >
+ xDialog(new MasterPasswordDialog(0, nMode, xManager.get()));
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ aMaster = rtl::OUStringToOString(xDialog->GetMasterPassword(),
+ RTL_TEXTENCODING_UTF8);
}
- return pID->getImplementationId();
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ *this);
+ }
+
+ sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5];
+ rtl_digest_PBKDF2(aKey,
+ RTL_DIGEST_LENGTH_MD5,
+ reinterpret_cast< sal_uInt8 const * >(aMaster.getStr()),
+ aMaster.getLength(),
+ reinterpret_cast< sal_uInt8 const * >(
+ "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
+ 32,
+ 1000);
+
+ rtl::OUStringBuffer aBuffer;
+ for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
+ {
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] >> 4)));
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] & 15)));
+ }
+ rInfo.SetPassword(aBuffer.makeStringAndClear());
}
-//============================================================================
-// virtual
-void SAL_CALL
-UUIInteractionHandler::handle(
- uno::Reference< task::XInteractionRequest > const & rRequest)
- throw (uno::RuntimeException)
+void
+UUIInteractionHandler::executeCookieDialog(CntHTTPCookieRequest & rRequest)
+ SAL_THROW((star::uno::RuntimeException))
{
- if (!rRequest.is())
- return;
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
- uno::Any aTheRequest(rRequest->getRequest());
- uno::Sequence< uno::Reference< task::XInteractionContinuation > >
- aContinuations(rRequest->getContinuations());
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< CookiesDialog >
+ xDialog(new CookiesDialog(0, &rRequest, xManager.get()));
+ xDialog->Execute();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ *this);
+ }
+}
- ucb::AuthenticationRequest aAuthenticationRequest;
- if (aTheRequest >>= aAuthenticationRequest)
+void
+UUIInteractionHandler::handleAuthenticationRequest(
+ star::ucb::AuthenticationRequest const & rRequest,
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ star::uno::Reference< star::task::XInteractionRetry > xRetry;
+ star::uno::Reference< star::ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ getAuthenticationContinuations(
+ rContinuations, &xAbort, &xRetry, &xSupplyAuthentication);
+ bool bRemember;
+ bool bRememberPersistent;
+ if (xSupplyAuthentication.is())
{
- uno::Reference< task::XInteractionAbort > xAbort;
- uno::Reference< task::XInteractionRetry > xRetry;
- uno::Reference< ucb::XInteractionSupplyAuthentication >
- xSupplyAuthentication;
- for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
- {
- if (!xAbort.is())
- {
- xAbort = uno::Reference< task::XInteractionAbort >(
- aContinuations[i], uno::UNO_QUERY);
- if (xAbort.is())
- continue;
- }
- if (!xRetry.is())
+ star::ucb::RememberAuthentication eDefault;
+ star::uno::Sequence< star::ucb::RememberAuthentication >
+ aModes(xSupplyAuthentication->getRememberPasswordModes(eDefault));
+ bRemember = eDefault != star::ucb::RememberAuthentication_NO;
+ bRememberPersistent = false;
+ for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
+ if (aModes[i] == star::ucb::RememberAuthentication_PERSISTENT)
{
- xRetry = uno::Reference< task::XInteractionRetry >(
- aContinuations[i], uno::UNO_QUERY);
- if (xRetry.is())
- continue;
- }
- if (!xSupplyAuthentication.is())
- {
- xSupplyAuthentication
- = uno::Reference< ucb::XInteractionSupplyAuthentication >(
- aContinuations[i], uno::UNO_QUERY);
- if (xSupplyAuthentication.is())
- continue;
+ bRememberPersistent = true;
+ break;
}
- }
- bool bRemember;
- bool bRememberPersistent;
- if (xSupplyAuthentication.is())
- {
- ucb::RememberAuthentication eDefault;
- uno::Sequence< ucb::RememberAuthentication >
- aModes(xSupplyAuthentication->
- getRememberPasswordModes(eDefault));
- bRemember = eDefault != ucb::RememberAuthentication_NO;
- bRememberPersistent = false;
- for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
- if (aModes[i] == ucb::RememberAuthentication_PERSISTENT)
- {
- bRememberPersistent = true;
- break;
- }
- }
- else
- {
- bRemember = false;
- bRememberPersistent = false;
- }
+ }
+ else
+ {
+ bRemember = false;
+ bRememberPersistent = false;
+ }
- // mPContainer works with userName passwdSequences pairs
- if( mPContainer.is() && aAuthenticationRequest.HasUserName && aAuthenticationRequest.HasPassword )
+ // m_xContainer works with userName passwdSequences pairs:
+ if (m_xContainer.is() && rRequest.HasUserName && rRequest.HasPassword)
+ try
{
- if (!aAuthenticationRequest.UserName.getLength())
+ if (rRequest.UserName.getLength() == 0)
{
- try {
- task::UrlRecord aRec = mPContainer->find( aAuthenticationRequest.ServerName,
- uno::Reference< task::XInteractionHandler >( this ));
-
- if( aRec.UserList.getLength() )
- {
- xSupplyAuthentication->setUserName( aRec.UserList[0].UserName.getStr() );
- OSL_ENSURE( aRec.UserList[0].Passwords.getLength(), "Empty password list!\n" );
- xSupplyAuthentication->setPassword( aRec.UserList[0].Passwords[0].getStr() );
- if( aRec.UserList[0].Passwords.getLength() > 1 )
- {
- if ( aAuthenticationRequest.HasRealm )
- xSupplyAuthentication->setRealm( aRec.UserList[0].Passwords[1].getStr() );
- else
- xSupplyAuthentication->setAccount( aRec.UserList[0].Passwords[1].getStr() );
- }
- xSupplyAuthentication->select();
-
- return;
- }
- }
- catch( task::NoMasterException& )
- {
- // user did not enter master password
- }
- catch( uno::RuntimeException& )
+ star::task::UrlRecord
+ aRec(m_xContainer->find(rRequest.ServerName, this));
+ if (aRec.UserList.getLength() != 0)
{
- // something wrong happend
- OSL_ENSURE( sal_False, "PasswordContainer problem\n" );
+ xSupplyAuthentication->
+ setUserName(aRec.UserList[0].UserName.getStr());
+ 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)
+ xSupplyAuthentication->
+ setRealm(aRec.UserList[0].Passwords[1].
+ getStr());
+ else
+ xSupplyAuthentication->
+ setAccount(aRec.UserList[0].Passwords[1].
+ getStr());
+ xSupplyAuthentication->select();
+ return;
}
}
else
{
- try {
- task::UrlRecord aRec = mPContainer->findForName( aAuthenticationRequest.ServerName,
- aAuthenticationRequest.UserName,
- uno::Reference< task::XInteractionHandler >( this ));
-
- if( aRec.UserList.getLength() )
+ star::task::UrlRecord
+ aRec(m_xContainer->findForName(rRequest.ServerName,
+ rRequest.UserName,
+ this));
+ 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])
{
- OSL_ENSURE( aRec.UserList[0].Passwords.getLength(), "Empty password list!\n" );
- if ( !aAuthenticationRequest.HasPassword || !aAuthenticationRequest.Password.equals( aRec.UserList[0].Passwords[0] ))
- {
- xSupplyAuthentication->setUserName( aRec.UserList[0].UserName.getStr() );
- xSupplyAuthentication->setPassword( aRec.UserList[0].Passwords[0].getStr() );
- if( aRec.UserList[0].Passwords.getLength() > 1 )
- {
- if ( aAuthenticationRequest.HasRealm )
- xSupplyAuthentication->setRealm( aRec.UserList[0].Passwords[1].getStr() );
- else
- xSupplyAuthentication->setAccount( aRec.UserList[0].Passwords[1].getStr() );
- }
- xSupplyAuthentication->select();
- return;
- }
+ xSupplyAuthentication->
+ setUserName(aRec.UserList[0].UserName.getStr());
+ xSupplyAuthentication->
+ setPassword(aRec.UserList[0].Passwords[0].
+ getStr());
+ if (aRec.UserList[0].Passwords.getLength() > 1)
+ if (rRequest.HasRealm)
+ xSupplyAuthentication->
+ setRealm(aRec.UserList[0].Passwords[1].
+ getStr());
+ else
+ xSupplyAuthentication->
+ setAccount(aRec.UserList[0].Passwords[1].
+ getStr());
+ xSupplyAuthentication->select();
+ return;
}
}
- catch( task::NoMasterException& )
- {
- // user did not enter master password
- }
- catch( uno::RuntimeException& )
- {
- // something wrong happend
- OSL_ENSURE( sal_False, "PasswordContainer problem\n" );
- }
}
}
-
- LoginErrorInfo aInfo;
- aInfo.SetTitle(aAuthenticationRequest.ServerName);
- aInfo.SetServer(aAuthenticationRequest.ServerName);
- if (aAuthenticationRequest.HasAccount)
- aInfo.SetAccount(aAuthenticationRequest.Account);
- if (aAuthenticationRequest.HasUserName)
- aInfo.SetUserName(aAuthenticationRequest.UserName);
- if (aAuthenticationRequest.HasPassword)
- aInfo.SetPassword(aAuthenticationRequest.Password);
- aInfo.SetErrorText(aAuthenticationRequest.Diagnostic);
- aInfo.SetPersistentPassword(bRememberPersistent);
- aInfo.SetSavePassword(bRemember);
- aInfo.SetModifyAccount(aAuthenticationRequest.HasAccount
- && xSupplyAuthentication.is()
- && xSupplyAuthentication->canSetAccount());
- aInfo.SetModifyUserName(aAuthenticationRequest.HasUserName
- && xSupplyAuthentication.is()
- && xSupplyAuthentication->canSetUserName());
- executeLoginDialog(aInfo,
- aAuthenticationRequest.HasRealm ?
- aAuthenticationRequest.Realm :
- rtl::OUString());
- switch (aInfo.GetResult())
+ catch (star::task::NoMasterException const &)
+ {} // user did not enter master password
+
+ LoginErrorInfo aInfo;
+ aInfo.SetTitle(rRequest.ServerName);
+ aInfo.SetServer(rRequest.ServerName);
+ if (rRequest.HasAccount)
+ aInfo.SetAccount(rRequest.Account);
+ if (rRequest.HasUserName)
+ aInfo.SetUserName(rRequest.UserName);
+ if (rRequest.HasPassword)
+ aInfo.SetPassword(rRequest.Password);
+ aInfo.SetErrorText(rRequest.Diagnostic);
+ aInfo.SetPersistentPassword(bRememberPersistent);
+ aInfo.SetSavePassword(bRemember);
+ aInfo.SetModifyAccount(rRequest.HasAccount
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetAccount());
+ aInfo.SetModifyUserName(rRequest.HasUserName
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetUserName());
+ executeLoginDialog(aInfo,
+ rRequest.HasRealm ? rRequest.Realm : rtl::OUString());
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
{
- case ERRCODE_BUTTON_OK:
- if (xSupplyAuthentication.is())
- {
- xSupplyAuthentication->setUserName(aInfo.GetUserName());
- xSupplyAuthentication->setPassword(aInfo.GetPassword());
- xSupplyAuthentication->
- setRememberPassword(
- aInfo.GetIsSavePassword() ?
- bRememberPersistent ?
- ucb::RememberAuthentication_PERSISTENT :
- ucb::RememberAuthentication_SESSION :
- ucb::RememberAuthentication_NO);
- if (aAuthenticationRequest.HasRealm)
- xSupplyAuthentication->setRealm(aInfo.GetAccount());
+ xSupplyAuthentication->setUserName(aInfo.GetUserName());
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+ xSupplyAuthentication->
+ setRememberPassword(
+ aInfo.GetIsSavePassword() ?
+ bRememberPersistent ?
+ star::ucb::RememberAuthentication_PERSISTENT :
+ star::ucb::RememberAuthentication_SESSION :
+ star::ucb::RememberAuthentication_NO);
+ if (rRequest.HasRealm)
+ xSupplyAuthentication->setRealm(aInfo.GetAccount());
+ else
+ xSupplyAuthentication->setAccount(aInfo.GetAccount());
+ xSupplyAuthentication->select();
+ }
+ // Empty user name can not be valid:
+ if (m_xContainer.is() && aInfo.GetUserName().Len() != 0)
+ {
+ 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())
+ if (bRememberPersistent)
+ m_xContainer->addPersistent(rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ this);
else
- xSupplyAuthentication->setAccount(aInfo.GetAccount());
- xSupplyAuthentication->select();
- }
- // empty user name can not be valid
- if ( mPContainer.is() && aInfo.GetUserName().Len() )
- {
- uno::Sequence< rtl::OUString > aPassList(1);
- aPassList[0] = aInfo.GetPassword();
- if( aInfo.GetAccount().Len() )
- {
- aPassList.realloc(2);
- aPassList[1] = aInfo.GetAccount();
- }
+ m_xContainer->add(rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ this);
+ }
+ catch (star::task::NoMasterException const &)
+ {} // user did not enter master password
+ }
+ break;
- try {
- if( aInfo.GetIsSavePassword() )
- if( bRememberPersistent )
- mPContainer->addPersistent( aAuthenticationRequest.ServerName, aInfo.GetUserName(), aPassList,
- uno::Reference< task::XInteractionHandler >( this ));
- else
- mPContainer->add( aAuthenticationRequest.ServerName, aInfo.GetUserName(), aPassList,
- uno::Reference< task::XInteractionHandler >( this ));
- }
- catch( task::NoMasterException& )
- {
- // user did not enter master password
- }
- catch( uno::RuntimeException& )
- {
- // something wrong happend
- OSL_ENSURE( sal_False, "PasswordContainer problem\n" );
- }
- }
- break;
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
- break;
-
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
- return;
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
}
+}
- task::PasswordRequest aPasswordRequest;
- if (aTheRequest >>= aPasswordRequest)
+void
+UUIInteractionHandler::handlePasswordRequest(
+ star::task::PasswordRequest const & rRequest,
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ star::uno::Reference< star::task::XInteractionRetry > xRetry;
+ star::uno::Reference< star::ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ getAuthenticationContinuations(
+ rContinuations, &xAbort, &xRetry, &xSupplyAuthentication);
+ LoginErrorInfo aInfo;
+ executePasswordDialog(aInfo, rRequest.Mode);
+ switch (aInfo.GetResult())
{
- uno::Reference< task::XInteractionAbort > xAbort;
- uno::Reference< task::XInteractionRetry > xRetry;
- uno::Reference< ucb::XInteractionSupplyAuthentication >
- xSupplyAuthentication;
- for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
{
- if (!xAbort.is())
- {
- xAbort = uno::Reference< task::XInteractionAbort >(
- aContinuations[i], uno::UNO_QUERY);
- if (xAbort.is())
- continue;
- }
- if (!xRetry.is())
- {
- xRetry = uno::Reference< task::XInteractionRetry >(
- aContinuations[i], uno::UNO_QUERY);
- if (xRetry.is())
- continue;
- }
- if (!xSupplyAuthentication.is())
- {
- xSupplyAuthentication
- = uno::Reference< ucb::XInteractionSupplyAuthentication >(
- aContinuations[i], uno::UNO_QUERY);
- if (xSupplyAuthentication.is())
- continue;
- }
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+ xSupplyAuthentication->select();
}
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
- LoginErrorInfo aInfo;
- executePasswordDialog(aInfo, aPasswordRequest.Mode );
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
- switch (aInfo.GetResult())
+void
+UUIInteractionHandler::handleCookiesRequest(
+ star::ucb::HandleCookiesRequest const & rRequest,
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((star::uno::RuntimeException))
+{
+ CookieList aCookies;
+ {for (sal_Int32 i = 0; i < rRequest.Cookies.getLength(); ++i)
+ try
{
- case ERRCODE_BUTTON_OK:
- if (xSupplyAuthentication.is())
- {
- xSupplyAuthentication->setPassword(aInfo.GetPassword());
- xSupplyAuthentication->select();
- }
+ std::auto_ptr< CntHTTPCookie > xCookie(new CntHTTPCookie);
+ xCookie->m_aName = UniString(rRequest.Cookies[i].Name);
+ xCookie->m_aValue = UniString(rRequest.Cookies[i].Value);
+ xCookie->m_aDomain = UniString(rRequest.Cookies[i].Domain);
+ xCookie->m_aPath = UniString(rRequest.Cookies[i].Path);
+ xCookie->m_aExpires
+ = DateTime(Date(rRequest.Cookies[i].Expires.Day,
+ rRequest.Cookies[i].Expires.Month,
+ rRequest.Cookies[i].Expires.Year),
+ Time(rRequest.Cookies[i].Expires.Hours,
+ rRequest.Cookies[i].Expires.Minutes,
+ rRequest.Cookies[i].Expires.Seconds,
+ rRequest.Cookies[i].Expires.
+ HundredthSeconds));
+ xCookie->m_nFlags
+ = rRequest.Cookies[i].Secure ? CNTHTTP_COOKIE_FLAG_SECURE : 0;
+ switch (rRequest.Cookies[i].Policy)
+ {
+ case star::ucb::CookiePolicy_CONFIRM:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
break;
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
+ case star::ucb::CookiePolicy_ACCEPT:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_ACCEPTED;
break;
- default:
- if (xAbort.is())
- xAbort->select();
+ case star::ucb::CookiePolicy_IGNORE:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_BANNED;
break;
+ }
+ aCookies.Insert(xCookie.get(), LIST_APPEND);
+ xCookie.release();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "out of memory")),
+ *this);
}
-
- return;
}
-
- ucb::HandleCookiesRequest aCookiesRequest;
- if (aTheRequest >>= aCookiesRequest)
+ CntHTTPCookieRequest
+ aRequest(rRequest.URL,
+ aCookies,
+ rRequest.Request == star::ucb::CookieRequest_RECEIVE ?
+ CNTHTTP_COOKIE_REQUEST_RECV :
+ CNTHTTP_COOKIE_REQUEST_SEND);
+ executeCookieDialog(aRequest);
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
{
- List aCookies;
- {for (sal_Int32 i = 0; i < aCookiesRequest.Cookies.getLength(); ++i)
+ star::uno::Reference< star::ucb::XInteractionCookieHandling >
+ xCookieHandling(rContinuations[i], star::uno::UNO_QUERY);
+ if (xCookieHandling.is())
{
- CntHTTPCookie * pCookie = new CntHTTPCookie;
- pCookie->m_aName = UniString(aCookiesRequest.Cookies[i].Name);
- pCookie->m_aValue = UniString(aCookiesRequest.Cookies[i].Value);
- pCookie->m_aDomain = UniString(aCookiesRequest.Cookies[i].Domain);
- pCookie->m_aPath = UniString(aCookiesRequest.Cookies[i].Path);
- pCookie->m_aExpires
- = DateTime(Date(aCookiesRequest.Cookies[i].Expires.Day,
- aCookiesRequest.Cookies[i].Expires.Month,
- aCookiesRequest.Cookies[i].Expires.Year),
- Time(aCookiesRequest.Cookies[i].Expires.Hours,
- aCookiesRequest.Cookies[i].Expires.Minutes,
- aCookiesRequest.Cookies[i].Expires.Seconds,
- aCookiesRequest.Cookies[i].Expires.
- HundredthSeconds));
- pCookie->m_nFlags = aCookiesRequest.Cookies[i].Secure ?
- CNTHTTP_COOKIE_FLAG_SECURE : 0;
- switch (aCookiesRequest.Cookies[i].Policy)
+ switch (aRequest.m_nRet)
{
- case ucb::CookiePolicy_CONFIRM:
- pCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
- break;
+ case CNTHTTP_COOKIE_POLICY_INTERACTIVE:
+ xCookieHandling->
+ setGeneralPolicy(star::ucb::CookiePolicy_CONFIRM);
+ break;
- case ucb::CookiePolicy_ACCEPT:
- pCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_ACCEPTED;
- break;
+ case CNTHTTP_COOKIE_POLICY_ACCEPTED:
+ xCookieHandling->
+ setGeneralPolicy(star::ucb::CookiePolicy_ACCEPT);
+ break;
- case ucb::CookiePolicy_IGNORE:
- pCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_BANNED;
- break;
+ case CNTHTTP_COOKIE_POLICY_BANNED:
+ xCookieHandling->
+ setGeneralPolicy(star::ucb::CookiePolicy_IGNORE);
+ break;
}
- aCookies.Insert(pCookie, LIST_APPEND);
- }}
- CntHTTPCookieRequest aRequest(aCookiesRequest.URL,
- aCookies,
- aCookiesRequest.Request
- == ucb::CookieRequest_RECEIVE ?
- CNTHTTP_COOKIE_REQUEST_RECV :
- CNTHTTP_COOKIE_REQUEST_SEND);
- executeCookieDialog(aRequest);
- for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
- {
- uno::Reference< ucb::XInteractionCookieHandling >
- xCookieHandling(aContinuations[i], uno::UNO_QUERY);
- if (xCookieHandling.is())
- {
- switch (aRequest.m_nRet)
- {
- case CNTHTTP_COOKIE_POLICY_INTERACTIVE:
- xCookieHandling->
- setGeneralPolicy(ucb::CookiePolicy_CONFIRM);
- break;
-
+ for (sal_Int32 j = 0; j < rRequest.Cookies.getLength(); ++j)
+ if (rRequest.Cookies[j].Policy
+ == star::ucb::CookiePolicy_CONFIRM)
+ switch (static_cast< CntHTTPCookie * >(aCookies.
+ GetObject(j))->
+ m_nPolicy)
+ {
case CNTHTTP_COOKIE_POLICY_ACCEPTED:
xCookieHandling->
- setGeneralPolicy(ucb::CookiePolicy_ACCEPT);
+ setSpecificPolicy(rRequest.Cookies[j], true);
break;
case CNTHTTP_COOKIE_POLICY_BANNED:
xCookieHandling->
- setGeneralPolicy(ucb::CookiePolicy_IGNORE);
+ setSpecificPolicy(rRequest.Cookies[j], false);
break;
- }
- for (sal_Int32 j = 0; j < aCookiesRequest.Cookies.getLength();
- ++j)
- if (aCookiesRequest.Cookies[j].Policy
- == ucb::CookiePolicy_CONFIRM)
- switch (static_cast< CntHTTPCookie * >(
- aCookies.GetObject(j))->
- m_nPolicy)
- {
- case CNTHTTP_COOKIE_POLICY_ACCEPTED:
- xCookieHandling->
- setSpecificPolicy(aCookiesRequest.
- Cookies[j],
- true);
- break;
-
- case CNTHTTP_COOKIE_POLICY_BANNED:
- xCookieHandling->
- setSpecificPolicy(aCookiesRequest.
- Cookies[j],
- false);
- break;
- }
- xCookieHandling->select();
- break;
- }
+ }
+ xCookieHandling->select();
+ break;
}
- while (aCookies.Count() != 0)
- delete static_cast< CntHTTPCookie * >(
- aCookies.Remove(aCookies.Count() - 1));
+ }
+}
+
+sal_Char const UUIInteractionHandler::m_aImplementationName[]
+ = "com.sun.star.comp.uui.UUIInteractionHandler";
+
+UUIInteractionHandler::UUIInteractionHandler(
+ star::uno::Reference< star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((star::uno::Exception))
+{
+ if (rServiceFactory.is())
+ m_xContainer
+ = star::uno::Reference< star::task::XPasswordContainer >(
+ rServiceFactory->
+ createInstance(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer"))),
+ star::uno::UNO_QUERY);
+}
+
+UUIInteractionHandler::~UUIInteractionHandler()
+{}
+
+rtl::OUString SAL_CALL UUIInteractionHandler::getImplementationName()
+ throw (star::uno::RuntimeException)
+{
+ return rtl::OUString::createFromAscii(m_aImplementationName);
+}
+
+sal_Bool SAL_CALL
+UUIInteractionHandler::supportsService(rtl::OUString const & rServiceName)
+ throw (star::uno::RuntimeException)
+{
+ star::uno::Sequence< rtl::OUString >
+ aNames(getSupportedServiceNames_static());
+ for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
+ if (aNames[i] == rServiceName)
+ return true;
+ return false;
+}
+
+star::uno::Sequence< rtl::OUString > SAL_CALL
+UUIInteractionHandler::getSupportedServiceNames()
+ throw (star::uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+void SAL_CALL
+UUIInteractionHandler::handle(
+ star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
+ throw (star::uno::RuntimeException)
+{
+ if (!rRequest.is())
+ return;
+
+ star::uno::Any aTheRequest(rRequest->getRequest());
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > >
+ aContinuations(rRequest->getContinuations());
+
+ star::ucb::AuthenticationRequest aAuthenticationRequest;
+ if (aTheRequest >>= aAuthenticationRequest)
+ {
+ handleAuthenticationRequest(aAuthenticationRequest, aContinuations);
+ return;
+ }
+
+ star::task::PasswordRequest aPasswordRequest;
+ if (aTheRequest >>= aPasswordRequest)
+ {
+ handlePasswordRequest(aPasswordRequest, aContinuations);
+ return;
+ }
+
+ star::ucb::HandleCookiesRequest aCookiesRequest;
+ if (aTheRequest >>= aCookiesRequest)
+ {
+ handleCookiesRequest(aCookiesRequest, aContinuations);
return;
}
- task::InteractionClassification eClassification
- = task::InteractionClassification_ERROR;
- task::ClassifiedInteractionRequest aClassifiedInteractionRequest;
+ star::task::InteractionClassification eClassification
+ = star::task::InteractionClassification_ERROR;
+ star::task::ClassifiedInteractionRequest aClassifiedInteractionRequest;
if (aTheRequest >>= aClassifiedInteractionRequest)
eClassification = aClassifiedInteractionRequest.Classification;
enum Execute { EXECUTE_NO, EXECUTE_YES, EXECUTE_IGNORE_RESULT };
- sal_uInt32 nErrorID = ERRCODE_NONE;
+ ULONG nErrorID = ERRCODE_NONE;
sal_uInt16 nErrorFlags = USHRT_MAX;
- SimpleErrorContext * pContext = 0;
+ SimpleErrorContextPtr xContext;
Execute eExecute = EXECUTE_YES;
USHORT nButton = ERRCODE_BUTTON_CANCEL;
- ucb::InteractiveIOException aIOException;
- ucb::InteractiveNetworkException aNetworkException;
- ucb::InteractiveCHAOSException aCHAOSException;
- ucb::InteractiveBadTransferURLException aTransferException;
- ucb::InteractiveWrongMediumException aWrongMediumException;
- if (aTheRequest >>= aIOException)
+ star::ucb::InteractiveIOException aIOException;
+ star::ucb::InteractiveNetworkException aNetworkException;
+ star::ucb::InteractiveCHAOSException aCHAOSException;
+ star::ucb::InteractiveBadTransferURLException aTransferException;
+ star::ucb::InteractiveWrongMediumException aWrongMediumException;
+ try
{
- // Due to the implementation of ErrorHandler::HandleError, IO errors
- // only display an OK button, and that button is (per definition)
- // mapped to the XInteractionAbort continuation. So, if that
- // continuation is missing, do not handle the request:
- bool bAbort = false;
- for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
- if (uno::Reference< task::XInteractionAbort >::query(
- aContinuations[i]).
- is())
- {
- bAbort = true;
- break;
- }
- if (!bAbort)
- return;
-
- nErrorFlags = ERRCODE_BUTTON_OK;
- switch (eClassification)
+ if (aTheRequest >>= aIOException)
{
- case task::InteractionClassification_ERROR:
+ // Due to the implementation of ErrorHandler::HandleError, IO
+ // errors only display an OK button, and that button is (per
+ // definition) mapped to the XInteractionAbort continuation. So,
+ // if that continuation is missing, do not handle the request:
+ bool bAbort = false;
+ for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ if (star::uno::Reference< star::task::XInteractionAbort >::
+ query(
+ aContinuations[i]).
+ is())
+ {
+ bAbort = true;
+ break;
+ }
+ if (!bAbort)
+ return;
+
+ nErrorFlags = ERRCODE_BUTTON_OK;
+ switch (eClassification)
+ {
+ case star::task::InteractionClassification_ERROR:
nErrorFlags |= ERRCODE_MSG_ERROR;
break;
- case task::InteractionClassification_WARNING:
+ case star::task::InteractionClassification_WARNING:
nErrorFlags |= ERRCODE_MSG_WARNING;
break;
- case task::InteractionClassification_INFO:
+ case star::task::InteractionClassification_INFO:
nErrorFlags |= ERRCODE_MSG_INFO;
break;
- case task::InteractionClassification_QUERY:
+ case star::task::InteractionClassification_QUERY:
nErrorFlags |= ERRCODE_MSG_QUERY;
break;
- }
+ }
- eExecute = EXECUTE_IGNORE_RESULT;
+ eExecute = EXECUTE_IGNORE_RESULT;
+
+ static ULONG const aID[star::ucb::IOErrorCode_WRONG_VERSION + 1]
+ [2]
+ = { { ERRCODE_IO_ABORT, ERRCODE_UUI_IO_ABORT }, // ABORT
+ { ERRCODE_IO_ACCESSDENIED, ERRCODE_UUI_IO_ACCESSDENIED },
+ // ACCESS_DENIED
+ { ERRCODE_IO_ALREADYEXISTS,
+ ERRCODE_UUI_IO_ALREADYEXISTS }, // ALREADY_EXISTING
+ { ERRCODE_IO_BADCRC, ERRCODE_UUI_IO_BADCRC }, // BAD_CRC
+ { ERRCODE_IO_CANTCREATE, ERRCODE_UUI_IO_CANTCREATE },
+ // CANT_CREATE
+ { ERRCODE_IO_CANTREAD, ERRCODE_UUI_IO_CANTREAD },
+ // CANT_READ
+ { ERRCODE_IO_CANTSEEK, ERRCODE_UUI_IO_CANTSEEK },
+ // CANT_SEEK
+ { ERRCODE_IO_CANTTELL, ERRCODE_UUI_IO_CANTTELL },
+ // CANT_TELL
+ { ERRCODE_IO_CANTWRITE, ERRCODE_UUI_IO_CANTWRITE },
+ // CANT_WRITE
+ { ERRCODE_IO_CURRENTDIR, ERRCODE_UUI_IO_CURRENTDIR },
+ // CURRENT_DIRECTORY
+ { ERRCODE_IO_DEVICENOTREADY,
+ ERRCODE_UUI_IO_DEVICENOTREADY }, // DEVICE_NOT_READY
+ { ERRCODE_IO_NOTSAMEDEVICE,
+ ERRCODE_UUI_IO_NOTSAMEDEVICE }, // DIFFERENT_DEVICES
+ { ERRCODE_IO_GENERAL, ERRCODE_UUI_IO_GENERAL }, // GENERAL
+ { ERRCODE_IO_INVALIDACCESS,
+ ERRCODE_UUI_IO_INVALIDACCESS }, // INVALID_ACCESS
+ { ERRCODE_IO_INVALIDCHAR, ERRCODE_UUI_IO_INVALIDCHAR },
+ // INVALID_CHARACTER
+ { ERRCODE_IO_INVALIDDEVICE,
+ ERRCODE_UUI_IO_INVALIDDEVICE }, // INVALID_DEVICE
+ { ERRCODE_IO_INVALIDLENGTH,
+ ERRCODE_UUI_IO_INVALIDLENGTH }, // INVALID_LENGTH
+ { ERRCODE_IO_INVALIDPARAMETER,
+ ERRCODE_UUI_IO_INVALIDPARAMETER }, // INVALID_PARAMETER
+ { ERRCODE_IO_ISWILDCARD, ERRCODE_UUI_IO_ISWILDCARD },
+ // IS_WILDCARD
+ { ERRCODE_IO_LOCKVIOLATION,
+ ERRCODE_UUI_IO_LOCKVIOLATION }, // LOCKING_VIOLATION
+ { ERRCODE_IO_MISPLACEDCHAR,
+ ERRCODE_UUI_IO_MISPLACEDCHAR }, // MISPLACED_CHARACTER
+ { ERRCODE_IO_NAMETOOLONG, ERRCODE_UUI_IO_NAMETOOLONG },
+ // NAME_TOO_LONG
+ { ERRCODE_IO_NOTEXISTS, ERRCODE_UUI_IO_NOTEXISTS },
+ // NOT_EXISTING
+ { ERRCODE_IO_NOTEXISTSPATH,
+ ERRCODE_UUI_IO_NOTEXISTSPATH }, // NOT_EXISTING_PATH
+ { ERRCODE_IO_NOTSUPPORTED, ERRCODE_UUI_IO_NOTSUPPORTED },
+ // NOT_SUPPORTED
+ { ERRCODE_IO_NOTADIRECTORY,
+ ERRCODE_UUI_IO_NOTADIRECTORY }, // NO_DIRECTORY
+ { ERRCODE_IO_NOTAFILE, ERRCODE_UUI_IO_NOTAFILE },
+ // NO_FILE
+ { ERRCODE_IO_OUTOFSPACE, ERRCODE_UUI_IO_OUTOFSPACE },
+ // OUT_OF_DISK_SPACE
+ { ERRCODE_IO_TOOMANYOPENFILES,
+ ERRCODE_UUI_IO_TOOMANYOPENFILES },
+ // OUT_OF_FILE_HANDLES
+ { ERRCODE_IO_OUTOFMEMORY, ERRCODE_UUI_IO_OUTOFMEMORY },
+ // OUT_OF_MEMORY
+ { ERRCODE_IO_PENDING, ERRCODE_UUI_IO_PENDING }, // PENDING
+ { ERRCODE_IO_RECURSIVE, ERRCODE_UUI_IO_RECURSIVE },
+ // RECURSIVE
+ { ERRCODE_IO_UNKNOWN, ERRCODE_UUI_IO_UNKNOWN }, // UNKNOWN
+ { ERRCODE_IO_WRITEPROTECTED,
+ ERRCODE_UUI_IO_WRITEPROTECTED }, // WRITE_PROTECTED
+ { ERRCODE_IO_WRONGFORMAT, ERRCODE_UUI_IO_WRONGFORMAT },
+ // WRONG_FORMAT
+ { ERRCODE_IO_WRONGVERSION,
+ ERRCODE_UUI_IO_WRONGVERSION } }; // WRONG_VERSION
+
+ star::ucb::InteractiveFileIOException aFileIOException;
+ if (aTheRequest >>= aFileIOException)
+ {
+ nErrorID = aID[aIOException.Code][0];
- ucb::InteractiveAugmentedIOException aAugmentedIOException;
- if (aTheRequest >>= aAugmentedIOException)
- {
- static sal_uInt32 const aID[ucb::IOErrorCode_WRONG_VERSION + 1]
- = { ERRCODE_UUI_IO_ABORT, // ABORT
- ERRCODE_UUI_IO_ACCESSDENIED, // ACCESS_DENIED
- ERRCODE_UUI_IO_ALREADYEXISTS, // ALREADY_EXISTING
- ERRCODE_UUI_IO_BADCRC, // BAD_CRC
- ERRCODE_UUI_IO_CANTCREATE, // CANT_CREATE
- ERRCODE_UUI_IO_CANTREAD, // CANT_READ
- ERRCODE_UUI_IO_CANTSEEK, // CANT_SEEK
- ERRCODE_UUI_IO_CANTTELL, // CANT_TELL
- ERRCODE_UUI_IO_CANTWRITE, // CANT_WRITE
- ERRCODE_UUI_IO_CURRENTDIR, // CURRENT_DIRECTORY
- ERRCODE_UUI_IO_DEVICENOTREADY, // DEVICE_NOT_READY
- ERRCODE_UUI_IO_NOTSAMEDEVICE, // DIFFERENT_DEVICES
- ERRCODE_UUI_IO_GENERAL, // GENERAL
- ERRCODE_UUI_IO_INVALIDACCESS, // INVALID_ACCESS
- ERRCODE_UUI_IO_INVALIDCHAR, // INVALID_CHARACTER
- ERRCODE_UUI_IO_INVALIDDEVICE, // INVALID_DEVICE
- ERRCODE_UUI_IO_INVALIDLENGTH, // INVALID_LENGTH
- ERRCODE_UUI_IO_INVALIDPARAMETER, // INVALID_PARAMETER
- ERRCODE_UUI_IO_ISWILDCARD, // IS_WILDCARD
- ERRCODE_UUI_IO_LOCKVIOLATION, // LOCKING_VIOLATION
- ERRCODE_UUI_IO_MISPLACEDCHAR, // MISPLACED_CHARACTER
- ERRCODE_UUI_IO_NAMETOOLONG, // NAME_TOO_LONG
- ERRCODE_UUI_IO_NOTEXISTS, // NOT_EXISTING
- ERRCODE_UUI_IO_NOTEXISTSPATH, // NOT_EXISTING_PATH
- ERRCODE_UUI_IO_NOTSUPPORTED, // NOT_SUPPORTED
- ERRCODE_UUI_IO_NOTADIRECTORY, // NO_DIRECTORY
- ERRCODE_UUI_IO_NOTAFILE, // NO_FILE
- ERRCODE_UUI_IO_OUTOFSPACE, // OUT_OF_DISK_SPACE
- ERRCODE_UUI_IO_TOOMANYOPENFILES, // OUT_OF_FILE_HANDLES
- ERRCODE_UUI_IO_OUTOFMEMORY, // OUT_OF_MEMORY
- ERRCODE_UUI_IO_PENDING, // PENDING
- ERRCODE_UUI_IO_RECURSIVE, // RECURSIVE
- ERRCODE_UUI_IO_UNKNOWN, // UNKNOWN
- ERRCODE_UUI_IO_WRITEPROTECTED, // WRITE_PROTECTED
- ERRCODE_UUI_IO_WRONGFORMAT, // WRONG_FORMAT
- ERRCODE_UUI_IO_WRONGVERSION }; // WRONG_VERSION
-
- switch ( aAugmentedIOException.Code )
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(
+ uui)));
+ UniString aTheContext(ResId(STR_ERROR_FILEIO,
+ xManager.get()));
+ aTheContext.SearchAndReplaceAscii("($URL1)",
+ aFileIOException.FileName);
+ xContext.set(new SimpleErrorContext(aTheContext));
+ }
+ else
{
- case ucb::IOErrorCode_CANT_CREATE:
- case ucb::IOErrorCode_DIFFERENT_DEVICES:
+ star::uno::Sequence< star::uno::Any > aArguments;
+ star::ucb::InteractiveAugmentedIOException
+ aAugmentedIOException;
+ if (aTheRequest >>= aAugmentedIOException)
+ aArguments = aAugmentedIOException.Arguments;
+
+ //TODO! remove this backwards compatibility?
+ bool bArgUri = false;
+ bool bArgFolder = false;
+ bool bArgVolumes = false;
+ rtl::OUString aArgUri;
+ rtl::OUString aArgFolder;
+ rtl::OUString aArgVolume;
+ rtl::OUString aArgOtherVolume;
+ switch (aIOException.Code)
{
- if ( aAugmentedIOException.Arguments.getLength() < 2 )
+ case star::ucb::IOErrorCode_CANT_CREATE:
+ if (aArguments.getLength() == 2
+ && (aArguments[0] >>= aArgUri)
+ && (aArguments[1] >>= aArgFolder))
{
- OSL_ENSURE( sal_False,
- "UUIInteractionHandler::handle - "
- "Too few arguments!" );
- return;
+ bArgUri = true;
+ bArgFolder = true;
+ aArguments.realloc(0);
}
+ break;
- rtl::OUString aArg1;
- if ( !( aAugmentedIOException.Arguments[ 0 ] >>= aArg1 ) )
+ case star::ucb::IOErrorCode_DIFFERENT_DEVICES:
+ if (aArguments.getLength() == 2
+ && (aArguments[0] >>= aArgVolume)
+ && (aArguments[1] >>= aArgOtherVolume))
{
- OSL_ENSURE( sal_False,
- "UUIInteractionHandler::handle - "
- "First argument must be a string!" );
- return;
+ bArgVolumes = true;
+ aArguments.realloc(0);
}
+ break;
- rtl::OUString aArg2;
- if ( !( aAugmentedIOException.Arguments[ 0 ] >>= aArg2 ) )
+ default:
+ if (aArguments.getLength() == 1
+ && (aArguments[0] >>= aArgUri))
{
- OSL_ENSURE( sal_False,
- "UUIInteractionHandler::handle - "
- "Second argument must be a string!" );
- return;
+ bArgUri = true;
+ aArguments.realloc(0);
}
-
- nErrorID = *new TwoStringErrorInfo(
- aID[ aAugmentedIOException.Code ],
- aArg1,
- aArg2 );
break;
}
- default:
+ switch (aIOException.Code)
{
- if ( aAugmentedIOException.Arguments.getLength() < 1 )
- {
- OSL_ENSURE( sal_False,
- "UUIInteractionHandler::handle - "
- "Too few arguments!" );
- return;
- }
+ case star::ucb::IOErrorCode_CANT_CREATE:
+ nErrorID
+ = (bArgUri
+ || getResourceNameArgument(aArguments,
+ &aArgUri))
+ && (bArgFolder
+ || getArgument(aArguments,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Folder")),
+ &aArgFolder)) ?
+ *new TwoStringErrorInfo(
+ aID[aIOException.Code][1],
+ aArgUri,
+ aArgFolder) :
+ aID[aIOException.Code][0];
+ break;
+
+ case star::ucb::IOErrorCode_DIFFERENT_DEVICES:
+ nErrorID
+ = bArgVolumes
+ || getArgument(aArguments,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Volume")),
+ &aArgVolume)
+ && getArgument(
+ aArguments,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "OtherVolume")),
+ &aArgOtherVolume) ?
+ *new TwoStringErrorInfo(
+ aID[aIOException.Code][1],
+ aArgVolume,
+ aArgOtherVolume) :
+ aID[aIOException.Code][0];
+ break;
- rtl::OUString aArg;
- if ( !( aAugmentedIOException.Arguments[ 0 ] >>= aArg ) )
+ case star::ucb::IOErrorCode_NOT_EXISTING:
+ if (bArgUri
+ || getResourceNameArgument(aArguments, &aArgUri))
{
- OSL_ENSURE( sal_False,
- "UUIInteractionHandler::handle - "
- "First argument must be a string!" );
- return;
+ rtl::OUString aResourceType;
+ getArgument(aArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceType")),
+ &aResourceType);
+ nErrorID
+ = *new StringErrorInfo(
+ aResourceType.
+ equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "volume")) ?
+ ERRCODE_UUI_IO_NOTEXISTS_VOLUME :
+ aResourceType.
+ equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "folder")) ?
+ ERRCODE_UUI_IO_NOTEXISTS_FOLDER :
+ ERRCODE_UUI_IO_NOTEXISTS,
+ aArgUri);
}
+ else
+ nErrorID = aID[aIOException.Code][0];
+ break;
- nErrorID = *new StringErrorInfo(
- aID[ aAugmentedIOException.Code ],
- aArg );
+ default:
+ nErrorID
+ = bArgUri
+ || getResourceNameArgument(aArguments, &aArgUri) ?
+ *new StringErrorInfo(aID[aIOException.Code][1],
+ aArgUri) :
+ aID[aIOException.Code][0];
break;
}
}
}
- else
+ else if (aTheRequest >>= aNetworkException)
{
- static sal_uInt32 const aID[ucb::IOErrorCode_WRONG_VERSION + 1]
- = { ERRCODE_IO_ABORT, // ABORT
- ERRCODE_IO_ACCESSDENIED, // ACCESS_DENIED
- ERRCODE_IO_ALREADYEXISTS, // ALREADY_EXISTING
- ERRCODE_IO_BADCRC, // BAD_CRC
- ERRCODE_IO_CANTCREATE, // CANT_CREATE
- ERRCODE_IO_CANTREAD, // CANT_READ
- ERRCODE_IO_CANTSEEK, // CANT_SEEK
- ERRCODE_IO_CANTTELL, // CANT_TELL
- ERRCODE_IO_CANTWRITE, // CANT_WRITE
- ERRCODE_IO_CURRENTDIR, // CURRENT_DIRECTORY
- ERRCODE_IO_DEVICENOTREADY, // DEVICE_NOT_READY
- ERRCODE_IO_NOTSAMEDEVICE, // DIFFERENT_DEVICES
- ERRCODE_IO_GENERAL, // GENERAL
- ERRCODE_IO_INVALIDACCESS, // INVALID_ACCESS
- ERRCODE_IO_INVALIDCHAR, // INVALID_CHARACTER
- ERRCODE_IO_INVALIDDEVICE, // INVALID_DEVICE
- ERRCODE_IO_INVALIDLENGTH, // INVALID_LENGTH
- ERRCODE_IO_INVALIDPARAMETER, // INVALID_PARAMETER
- ERRCODE_IO_ISWILDCARD, // IS_WILDCARD
- ERRCODE_IO_LOCKVIOLATION, // LOCKING_VIOLATION
- ERRCODE_IO_MISPLACEDCHAR, // MISPLACED_CHARACTER
- ERRCODE_IO_NAMETOOLONG, // NAME_TOO_LONG
- ERRCODE_IO_NOTEXISTS, // NOT_EXISTING
- ERRCODE_IO_NOTEXISTSPATH, // NOT_EXISTING_PATH
- ERRCODE_IO_NOTSUPPORTED, // NOT_SUPPORTED
- ERRCODE_IO_NOTADIRECTORY, // NO_DIRECTORY
- ERRCODE_IO_NOTAFILE, // NO_FILE
- ERRCODE_IO_OUTOFSPACE, // OUT_OF_DISK_SPACE
- ERRCODE_IO_TOOMANYOPENFILES, // OUT_OF_FILE_HANDLES
- ERRCODE_IO_OUTOFMEMORY, // OUT_OF_MEMORY
- ERRCODE_IO_PENDING, // PENDING
- ERRCODE_IO_RECURSIVE, // RECURSIVE
- ERRCODE_IO_UNKNOWN, // UNKNOWN
- ERRCODE_IO_WRITEPROTECTED, // WRITE_PROTECTED
- ERRCODE_IO_WRONGFORMAT, // WRONG_FORMAT
- ERRCODE_IO_WRONGVERSION }; // WRONG_VERSION
- nErrorID = aID[aIOException.Code];
-
- ucb::InteractiveFileIOException aFileIOException;
- if (aTheRequest >>= aFileIOException)
+ star::ucb::InteractiveNetworkOffLineException aOffLineException;
+ star::ucb::InteractiveNetworkResolveNameException
+ aResolveNameException;
+ star::ucb::InteractiveNetworkConnectException aConnectException;
+ star::ucb::InteractiveNetworkReadException aReadException;
+ star::ucb::InteractiveNetworkWriteException aWriteException;
+ nErrorID
+ = (aTheRequest >>= aOffLineException) ?
+ ERRCODE_INET_OFFLINE :
+ (aTheRequest >>= aResolveNameException) ?
+ *new StringErrorInfo(ERRCODE_INET_NAME_RESOLVE,
+ aResolveNameException.Server) :
+ (aTheRequest >>= aConnectException) ?
+ *new StringErrorInfo(ERRCODE_INET_CONNECT,
+ aConnectException.Server) :
+ (aTheRequest >>= aReadException) ?
+ *new StringErrorInfo(ERRCODE_INET_READ,
+ aReadException.Diagnostic) :
+ (aTheRequest >>= aWriteException) ?
+ *new StringErrorInfo(ERRCODE_INET_WRITE,
+ aWriteException.Diagnostic) :
+ ERRCODE_INET_GENERAL;
+ }
+ else if (aTheRequest >>= aCHAOSException)
+ nErrorID
+ = aCHAOSException.Arguments.getLength() >= 2 ?
+ *new TwoStringErrorInfo(aCHAOSException.ID,
+ aCHAOSException.Arguments[0],
+ aCHAOSException.Arguments[1]) :
+ aCHAOSException.Arguments.getLength() == 1 ?
+ *new StringErrorInfo(aCHAOSException.ID,
+ aCHAOSException.Arguments[0]) :
+ aCHAOSException.ID;
+ else if (aTheRequest >>= aTransferException)
+ eExecute = EXECUTE_NO;
+ else if (aTheRequest >>= aWrongMediumException)
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ UniString aText;
{
- vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(
+ uui)));
+ aText = ResId(STR_ERROR_WRONGMEDIUM, xManager.get());
+ }
- ResMgr * pManager
- = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- UniString aTheContext(ResId(STR_ERROR_FILEIO, pManager));
- delete pManager;
+ sal_Int32 nMedium;
+ aWrongMediumException.Medium >>= nMedium;
+ aText.SearchAndReplaceAscii("$$",
+ UniString::CreateFromInt32(nMedium
+ + 1));
- aTheContext.SearchAndReplaceAscii("($URL1)",
- aFileIOException.FileName);
- pContext = new SimpleErrorContext(aTheContext);
- }
+ ErrorBox aErrorBox(0, WB_OK_CANCEL, aText);
+ nButton = aErrorBox.Execute();
+ eExecute = EXECUTE_NO;
}
}
- else if (aTheRequest >>= aNetworkException)
+ catch (std::bad_alloc const &)
{
- ucb::InteractiveNetworkOffLineException aOffLineException;
- ucb::InteractiveNetworkResolveNameException aResolveNameException;
- ucb::InteractiveNetworkConnectException aConnectException;
- ucb::InteractiveNetworkReadException aReadException;
- ucb::InteractiveNetworkWriteException aWriteException;
- nErrorID = (aTheRequest >>= aOffLineException) ?
- ERRCODE_INET_OFFLINE :
- (aTheRequest >>= aResolveNameException) ?
- *new StringErrorInfo(ERRCODE_INET_NAME_RESOLVE,
- aResolveNameException.Server) :
- (aTheRequest >>= aConnectException) ?
- *new StringErrorInfo(ERRCODE_INET_CONNECT,
- aConnectException.Server) :
- (aTheRequest >>= aReadException) ?
- *new StringErrorInfo(ERRCODE_INET_READ,
- aReadException.Diagnostic) :
- (aTheRequest >>= aWriteException) ?
- *new StringErrorInfo(ERRCODE_INET_WRITE,
- aWriteException.Diagnostic) :
- ERRCODE_INET_GENERAL;
- }
- else if (aTheRequest >>= aCHAOSException)
- nErrorID
- = aCHAOSException.Arguments.getLength() >= 2 ?
- *new TwoStringErrorInfo(aCHAOSException.ID,
- aCHAOSException.Arguments[0],
- aCHAOSException.Arguments[1]) :
- aCHAOSException.Arguments.getLength() == 1 ?
- *new StringErrorInfo(aCHAOSException.ID,
- aCHAOSException.Arguments[0]) :
- aCHAOSException.ID;
- else if (aTheRequest >>= aTransferException)
- {
- DBG_ERROR("UUIInteractionHandler::handle():"
- " Can't handle TransferException");
- eExecute = EXECUTE_NO;
- }
- else if (aTheRequest >>= aWrongMediumException)
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- ResMgr * pManager
- = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- UniString aText(ResId(STR_ERROR_WRONGMEDIUM, pManager));
- delete pManager;
-
- sal_Int32 nMedium;
- aWrongMediumException.Medium >>= nMedium;
- aText.SearchAndReplaceAscii("$$",
- UniString::CreateFromInt32(nMedium + 1));
-
- ErrorBox aErrorBox(0, WB_OK_CANCEL, aText);
- nButton = aErrorBox.Execute();
- eExecute = EXECUTE_NO;
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ *this);
}
if (eExecute != EXECUTE_NO)
@@ -1018,75 +1312,67 @@ UUIInteractionHandler::handle(
nButton = nResult;
}
- if (pContext)
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
- delete pContext;
- }
-
switch (nButton)
{
- case ERRCODE_BUTTON_OK:
- case ERRCODE_BUTTON_YES:
- {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ case ERRCODE_BUTTON_OK:
+ case ERRCODE_BUTTON_YES:
+ {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ {
+ star::uno::Reference< star::task::XInteractionApprove >
+ xApprove(aContinuations[i], star::uno::UNO_QUERY);
+ if (xApprove.is())
{
- uno::Reference< task::XInteractionApprove >
- xApprove(aContinuations[i], uno::UNO_QUERY);
- if (xApprove.is())
- {
- xApprove->select();
- break;
- }
- }}
- break;
+ xApprove->select();
+ break;
+ }
+ }}
+ break;
- case ERRCODE_BUTTON_CANCEL:
- {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ case ERRCODE_BUTTON_CANCEL:
+ {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ {
+ star::uno::Reference< star::task::XInteractionAbort >
+ xAbort(aContinuations[i], star::uno::UNO_QUERY);
+ if (xAbort.is())
{
- uno::Reference< task::XInteractionAbort >
- xAbort(aContinuations[i], uno::UNO_QUERY);
- if (xAbort.is())
- {
- xAbort->select();
- break;
- }
- }}
- break;
+ xAbort->select();
+ break;
+ }
+ }}
+ break;
- case ERRCODE_BUTTON_RETRY:
- {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ case ERRCODE_BUTTON_RETRY:
+ {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ {
+ star::uno::Reference< star::task::XInteractionRetry >
+ xRetry(aContinuations[i], star::uno::UNO_QUERY);
+ if (xRetry.is())
{
- uno::Reference< task::XInteractionRetry >
- xRetry(aContinuations[i], uno::UNO_QUERY);
- if (xRetry.is())
- {
- xRetry->select();
- break;
- }
- }}
- break;
+ xRetry->select();
+ break;
+ }
+ }}
+ break;
- case ERRCODE_BUTTON_NO:
- {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ case ERRCODE_BUTTON_NO:
+ {for (sal_Int32 i = 0; i < aContinuations.getLength(); ++i)
+ {
+ star::uno::Reference< star::task::XInteractionDisapprove >
+ xDisapprove(aContinuations[i], star::uno::UNO_QUERY);
+ if (xDisapprove.is())
{
- uno::Reference< task::XInteractionDisapprove >
- xDisapprove(aContinuations[i], uno::UNO_QUERY);
- if (xDisapprove.is())
- {
- xDisapprove->select();
- break;
- }
- }}
- break;
+ xDisapprove->select();
+ break;
+ }
+ }}
+ break;
}
}
-//============================================================================
-// static
-uno::Sequence< rtl::OUString >
+star::uno::Sequence< rtl::OUString >
UUIInteractionHandler::getSupportedServiceNames_static()
{
- uno::Sequence< rtl::OUString > aNames(2);
+ star::uno::Sequence< rtl::OUString > aNames(2);
aNames[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.task.InteractionHandler"));
aNames[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
@@ -1095,189 +1381,20 @@ UUIInteractionHandler::getSupportedServiceNames_static()
return aNames;
}
-//============================================================================
-// static
-uno::Reference< uno::XInterface > SAL_CALL
+star::uno::Reference< star::uno::XInterface > SAL_CALL
UUIInteractionHandler::createInstance(
- uno::Reference< lang::XMultiServiceFactory > const & aServiceManager )
-{
- return static_cast< uno::XWeak * >(static_cast< cppu::OWeakObject * >(
- new UUIInteractionHandler(aServiceManager)));
-}
-
-//============================================================================
-//
-// SimpleErrorContext
-//
-//============================================================================
-
-// virtual
-BOOL SimpleErrorContext::GetString(ULONG, UniString & rCtxStr)
-{
- rCtxStr = m_aContext;
- return true;
-}
-
-//============================================================================
-//
-// executeErrorDialog
-//
-//============================================================================
-
-namespace unnamed_uui_iahndl {
-
-USHORT executeErrorDialog(ULONG nID, USHORT nMask)
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- ResMgr * pManager1 = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(ofa));
- SfxErrorHandler * pHandler1
- = new SfxErrorHandler(RID_ERRHDL, ERRCODE_AREA_TOOLS,
- ERRCODE_AREA_LIB1 - 1, pManager1);
- ResMgr * pManager2 = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(cnt));
- SfxErrorHandler * pHandler2
- = new SfxErrorHandler(RID_CHAOS_START + 12, ERRCODE_AREA_CHAOS,
- ERRCODE_AREA_CHAOS_END, pManager2);
- // cf. chaos/source/inc/cntrids.hrc, where
- // #define RID_CHAOS_ERRHDL (RID_CHAOS_START + 12)
- ResMgr * pManager3 = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- SfxErrorHandler * pHandler3
- = new SfxErrorHandler(RID_UUI_ERRHDL, ERRCODE_AREA_UUI,
- ERRCODE_AREA_UUI_END, pManager3);
-
- // Needed because within ErrorHandler::HandleError() ResIds are created
- // without a ResMgr---they require a default ResMgr:
- ResMgr * pDefaultManager = Resource::GetResManager();
- Resource::SetResManager(pManager1);
-
- USHORT nButton = ErrorHandler::HandleError(nID, nMask);
-
- Resource::SetResManager(pDefaultManager);
-
- delete pHandler3;
- delete pManager3;
- delete pHandler2;
- delete pManager2;
- delete pHandler1;
- delete pManager1;
- return nButton;
-}
-
-//============================================================================
-//
-// executeLoginDialog
-//
-//============================================================================
-
-void executeLoginDialog(LoginErrorInfo & rInfo, rtl::OUString const & rRealm)
+ star::uno::Reference< star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((star::uno::Exception))
{
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
- bool bSavePassword
- = rInfo.GetIsPersistentPassword() || rInfo.GetIsSavePassword();
-
- sal_uInt16 nFlags = 0;
- if (rInfo.GetPath().Len() == 0)
- nFlags |= LF_NO_PATH;
- if (rInfo.GetErrorText().Len() == 0)
- nFlags |= LF_NO_ERRORTEXT;
- if (!bAccount)
- nFlags |= LF_NO_ACCOUNT;
- if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
- nFlags |= LF_USERNAME_READONLY;
-
- if (!bSavePassword)
- nFlags |= LF_NO_SAVEPASSWORD;
-
- ResMgr * pManager = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- LoginDialog * pDialog = new LoginDialog(0, nFlags, rInfo.GetServer(),
- rRealm, pManager);
- if (rInfo.GetErrorText().Len() != 0)
- pDialog->SetErrorText(rInfo.GetErrorText());
- pDialog->SetName(rInfo.GetUserName());
- if (bAccount)
- pDialog->ClearAccount();
- else
- pDialog->ClearPassword();
- pDialog->SetPassword(rInfo.GetPassword());
-
- if (bSavePassword)
+ try
{
- pDialog->SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ?
- RID_SAVE_PASSWORD :
- RID_KEEP_PASSWORD,
- pManager));
- pDialog->SetSavePassword(rInfo.GetIsSavePassword());
+ return *new UUIInteractionHandler(rServiceFactory);
}
-
- rInfo.SetResult(pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetUserName(pDialog->GetName());
- rInfo.SetPassword(pDialog->GetPassword());
- rInfo.SetAccount(pDialog->GetAccount());
- rInfo.SetSavePassword(pDialog->IsSavePassword());
- delete pDialog;
- delete pManager;
-}
-
-//============================================================================
-//
-// executePasswordDialog
-//
-//============================================================================
-
-void executePasswordDialog( LoginErrorInfo & rInfo, task::PasswordRequestMode nMode )
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- ResMgr * pManager = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- MasterPasswordDialog * pDialog = new MasterPasswordDialog(0, nMode, pManager);
-
- rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL );
-
- unsigned char aKey[ RTL_DIGEST_LENGTH_MD5 ];
-
+ catch (std::bad_alloc const &)
{
- ::rtl::OString aMaster = ::rtl::OUStringToOString( pDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8 );
-
- delete pDialog;
- delete pManager;
-
- rtl_digest_PBKDF2 ( aKey, RTL_DIGEST_LENGTH_MD5,
- (const unsigned char*)aMaster.getStr(), aMaster.getLength(),
- (const unsigned char*)"3B5509ABA6BC42D9A3A1F3DAD49E56A51", 32,
- 1000 );
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ 0);
}
-
- char strKey[ RTL_DIGEST_LENGTH_MD5*2 + 1 ];
-
- for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- {
- strKey[ind*2] = ( ((sal_uInt8)aKey[ind]) >> 4 ) + 'a';
- strKey[ind*2+1] = ( ((sal_uInt8)aKey[ind]) & 0x0f ) + 'a';
- }
- strKey[ RTL_DIGEST_LENGTH_MD5*2 ] = '\0';
-
- rInfo.SetPassword( ::rtl::OUString::createFromAscii( strKey ) );
-
-}
-
-//============================================================================
-//
-// executeCookieDialog
-//
-//============================================================================
-
-void executeCookieDialog(CntHTTPCookieRequest & rRequest)
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- ResMgr * pManager = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui));
- CookiesDialog * pDialog = new CookiesDialog(0, &rRequest, pManager);
- pDialog->Execute();
- delete pDialog;
- delete pManager;
-}
-
}
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 8d56696f0002..c256b5522547 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: iahndl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mav $ $Date: 2001-05-14 15:42:51 $
+ * last change: $Author: sb $ $Date: 2001-08-07 13:34:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,49 +62,67 @@
#ifndef UUI_IAHNDL_HXX
#define UUI_IAHNDL_HXX
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
-#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "com/sun/star/lang/XServiceInfo.hpp"
#endif
-#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
-#include <com/sun/star/lang/XTypeProvider.hpp>
+#ifndef _COM_SUN_STAR_TASK_PASSWORDREQUESTMODE_HPP_
+#include "com/sun/star/task/PasswordRequestMode.hpp"
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
-#include <com/sun/star/task/XInteractionHandler.hpp>
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#endif
+#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
+#include "com/sun/star/uno/Exception.hpp"
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include "com/sun/star/uno/Reference.hxx"
+#endif
+#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
+#include "com/sun/star/uno/RuntimeException.hpp"
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include "com/sun/star/uno/Sequence.hxx"
#endif
-#ifndef _COM_SUN_STAR_TASK_XPASSWORDCONTAINER_HPP_
-#include <com/sun/star/task/XPasswordContainer.hpp>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include "cppuhelper/implbase2.hxx"
#endif
-#ifndef _CPPUHELPER_WEAK_HXX_
-#include <cppuhelper/weak.hxx>
+#ifndef _SAL_TYPES_H_
+#include "sal/types.h"
#endif
+#ifndef _SOLAR_H
+#include "tools/solar.h"
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMulitServiceFactory; }
+ namespace task {
+ class PasswordRequest;
+ class XInteractionContinuation;
+ class XPasswordContainer;
+ }
+ namespace ucb {
+ class AuthenticationRequest;
+ class HandleCookiesRequest;
+ }
+ namespace uno { class XInterface; }
+} } }
+namespace rtl { class OUString; }
+struct CntHTTPCookieRequest;
+class LoginErrorInfo;
-//============================================================================
class UUIInteractionHandler:
- public cppu::OWeakObject,
- public com::sun::star::lang::XServiceInfo,
- public com::sun::star::lang::XTypeProvider,
- public com::sun::star::task::XInteractionHandler
+ public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
+ com::sun::star::task::XInteractionHandler >
{
- ::com::sun::star::uno::Reference< ::com::sun::star::task::XPasswordContainer > mPContainer;
-
public:
static sal_Char const m_aImplementationName[];
- UUIInteractionHandler( com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const & );
+ UUIInteractionHandler(com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >
+ const & rServiceFactory)
+ SAL_THROW((com::sun::star::uno::Exception));
- virtual com::sun::star::uno::Any SAL_CALL
- queryInterface(com::sun::star::uno::Type const & rType)
- throw (com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL acquire()
- throw (com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL release()
- throw (com::sun::star::uno::RuntimeException);
+ virtual ~UUIInteractionHandler() SAL_THROW(());
virtual rtl::OUString SAL_CALL getImplementationName()
throw (com::sun::star::uno::RuntimeException);
@@ -114,14 +132,8 @@ public:
throw (com::sun::star::uno::RuntimeException);
virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
- getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
-
- virtual
- com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
- getTypes() throw (com::sun::star::uno::RuntimeException);
-
- virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
- getImplementationId() throw (com::sun::star::uno::RuntimeException);
+ getSupportedServiceNames()
+ throw (com::sun::star::uno::RuntimeException);
virtual void SAL_CALL
handle(com::sun::star::uno::Reference<
@@ -133,12 +145,61 @@ public:
getSupportedServiceNames_static();
static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-#if SUPD >= 590
SAL_CALL
-#endif // SUPD 590
- createInstance(com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &);
+ createInstance(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer >
+ m_xContainer;
+
+ UUIInteractionHandler(UUIInteractionHandler &); // not implemented
+ void operator =(UUIInteractionHandler); // not implemented
+
+ USHORT executeErrorDialog(ULONG nID, USHORT nMask)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void executeLoginDialog(LoginErrorInfo & rInfo,
+ rtl::OUString const & rRealm)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ executePasswordDialog(LoginErrorInfo & rInfo,
+ com::sun::star::task::PasswordRequestMode nMode)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void executeCookieDialog(CntHTTPCookieRequest & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleAuthenticationRequest(
+ com::sun::star::ucb::AuthenticationRequest const & rRequest,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handlePasswordRequest(
+ com::sun::star::task::PasswordRequest const & rRequest,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ void
+ handleCookiesRequest(
+ com::sun::star::ucb::HandleCookiesRequest const & rRequest,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
};
#endif // UUI_IAHNDL_HXX
-