summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-10-13 17:41:05 +0200
committerAndras Timar <atimar@suse.com>2012-10-13 17:41:05 +0200
commite5ce011c3f32f53ef073aec5485450b2588b656a (patch)
tree8a838a53bcdd70cc3d4cdbca0ebe07504790952e /uui
parentc6b26144c93aa5222e4260c5b0ef45ce5bdc18d2 (diff)
parente74fc93e4aba7887e6a278cc44c4bc0962471065 (diff)
Merge branch 'master' into feature/killsdf
Conflicts: Makefile.top Module_tail_build.mk RepositoryExternal.mk RepositoryFixes.mk accessibility/source/standard/vclxaccessibletoolbox.cxx basic/source/uno/dlgcont.cxx connectivity/Library_ado.mk cross_tail_build/prj/build.lst desktop/source/offacc/acceptor.cxx filter/Library_PptImporter.mk filter/source/t602/filterenv.cxx i18npool/Library_textconv_dict.mk ooo.lst.in saxon/ExternalProject_saxon.mk saxon/build.xml sc/sdi/scalc.sdi sc/source/filter/xml/xmlstyli.cxx sc/source/ui/condformat/condformatdlg.cxx sc/source/ui/condformat/condformatmgr.cxx sc/source/ui/view/cellsh1.cxx sdext/source/pdfimport/misc/pwdinteract.cxx shell/qa/zip/makefile.mk shell/qa/zip/testimpl/makefile.mk solenv/gbuild/CppunitTest.mk solenv/gbuild/gbuild.mk solenv/gbuild/platform/android.mk solenv/gbuild/platform/com_GCC_defs.mk solenv/gbuild/platform/macosx.mk soltools/Executable_adjustvisibility.mk soltools/Executable_checkdll.mk soltools/Executable_cpp.mk soltools/Executable_javadep.mk soltools/Executable_makedepend.mk sw/qa/extras/rtfimport/rtfimport.cxx tail_build/prj/build.lst tomcat/ExternalProject_tomcat.mk ucb/source/ucp/webdav/webdavcontent.cxx xml2cmp/Executable_xml2cmp.mk
Diffstat (limited to 'uui')
-rw-r--r--uui/source/iahndl-authentication.cxx2
-rw-r--r--uui/source/iahndl-errorhandler.cxx2
-rw-r--r--uui/source/iahndl.cxx61
-rw-r--r--uui/source/iahndl.hxx12
-rw-r--r--uui/source/interactionhandler.cxx18
-rw-r--r--uui/source/passwordcontainer.cxx41
-rw-r--r--uui/source/passwordcontainer.hxx15
7 files changed, 79 insertions, 72 deletions
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index bf09e7e3e1d1..31d26b27a679 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -186,7 +186,7 @@ void getRememberModes(
void
handleAuthenticationRequest_(
Window * pParent,
- uno::Reference< task::XInteractionHandler > const & xIH,
+ uno::Reference< task::XInteractionHandler2 > const & xIH,
uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
ucb::AuthenticationRequest const & rRequest,
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
index 10ae5276d243..ae4f2bc80743 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -258,7 +258,7 @@ UUIInteractionHelper::handleErrorHandlerRequest(
ErrorContext * pContext = ErrorContext::GetContext();
if (pContext)
{
- UniString aContextString;
+ OUString aContextString;
if (pContext->GetString(nErrorCode, aContextString))
aContext = aContextString;
}
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 127f7d42737c..60e49e41878a 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -34,6 +34,7 @@
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include "com/sun/star/task/ErrorCodeRequest.hpp"
#include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
+#include "com/sun/star/task/InteractionHandler.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
#include "com/sun/star/task/XInteractionAskLater.hpp"
@@ -72,6 +73,7 @@
#include "vcl/svapp.hxx"
#include "unotools/configmgr.hxx"
#include "toolkit/helper/vclunohelper.hxx"
+#include "comphelper/processfactory.hxx"
#include "comphelper/namedvaluecollection.hxx"
#include "typelib/typedescription.hxx"
#include "unotools/confignode.hxx"
@@ -99,6 +101,7 @@ using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::lang::XInitialization;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::task::InteractionHandler;
using ::com::sun::star::task::XInteractionHandler2;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Any;
@@ -129,10 +132,12 @@ public:
UUIInteractionHelper::UUIInteractionHelper(
uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
- uno::Sequence< uno::Any > const & rArguments)
+ uno::Reference< awt::XWindow > const & rxWindowParam,
+ const OUString & rContextParam)
SAL_THROW(()):
m_xServiceFactory(rServiceFactory),
- m_aProperties(rArguments)
+ m_xWindowParam(rxWindowParam),
+ m_aContextParam(rContextParam)
{
}
@@ -1092,59 +1097,23 @@ uno::Reference< awt::XWindow>
UUIInteractionHelper::getParentXWindow() const
SAL_THROW(())
{
- osl::MutexGuard aGuard(m_aPropertyMutex);
- ::comphelper::NamedValueCollection aProperties( m_aProperties );
- if ( aProperties.has( "Parent" ) )
- {
- uno::Reference< awt::XWindow > xWindow;
- OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow );
- return xWindow;
- }
- return 0;
+ return m_xWindowParam;
}
rtl::OUString
UUIInteractionHelper::getContextProperty()
SAL_THROW(())
{
- osl::MutexGuard aGuard(m_aPropertyMutex);
- for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
- {
- beans::PropertyValue aProperty;
- if ((m_aProperties[i] >>= aProperty) && aProperty.Name == "Context" )
- {
- rtl::OUString aContext;
- aProperty.Value >>= aContext;
- return aContext;
- }
- }
- return rtl::OUString();
+ return m_aContextParam;
}
-uno::Reference< task::XInteractionHandler >
+uno::Reference< task::XInteractionHandler2 >
UUIInteractionHelper::getInteractionHandler()
SAL_THROW((uno::RuntimeException))
{
- uno::Reference< task::XInteractionHandler > xIH;
- try
- {
- xIH.set(m_xServiceFactory->createInstanceWithArguments(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.task.InteractionHandler")),
- m_aProperties),
- uno::UNO_QUERY);
- }
- catch (uno::Exception const &)
- {}
-
- if (!xIH.is())
- throw uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "unable to instanciate Interaction Handler service")),
- uno::Reference< uno::XInterface >());
- return xIH;
+ return InteractionHandler::createWithParentAndContext(
+ comphelper::getComponentContext(m_xServiceFactory), m_xWindowParam,
+ m_aContextParam);
}
namespace {
@@ -1274,7 +1243,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
if (bHasErrorString)
{
- String aErrorString;
+ OUString aErrorString;
ErrorHandler::GetErrorString(nErrorCode, aErrorString);
rErrorString = aErrorString;
}
@@ -1295,7 +1264,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
|| nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
{
// the security warning box needs a special title
- String aErrorString;
+ OUString aErrorString;
ErrorHandler::GetErrorString( nErrorCode, aErrorString );
boost::scoped_ptr< ResMgr > xManager(
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 358bdd5d58ae..eee766753f92 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -52,7 +52,7 @@ namespace com { namespace sun { namespace star {
namespace task {
class FutureDocumentVersionProductUpdateRequest;
class XInteractionContinuation;
- class XInteractionHandler;
+ class XInteractionHandler2;
class XInteractionRequest;
}
namespace ucb {
@@ -88,7 +88,8 @@ class UUIInteractionHelper
private:
mutable osl::Mutex m_aPropertyMutex;
::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
- ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties;
+ ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xWindowParam;
+ const OUString m_aContextParam;
StringHashMap m_aTypedCustomHandlers;
UUIInteractionHelper(UUIInteractionHelper &); // not implemented
void operator =(UUIInteractionHelper); // not implemented
@@ -97,8 +98,9 @@ public:
UUIInteractionHelper(
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory,
- com::sun::star::uno::Sequence<
- com::sun::star::uno::Any > const & rArguments)
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow > const & rxWindow,
+ const OUString & rContextParam)
SAL_THROW(());
UUIInteractionHelper(
com::sun::star::uno::Reference<
@@ -159,7 +161,7 @@ private:
getContextProperty()
SAL_THROW(());
- com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler2 >
getInteractionHandler()
SAL_THROW((com::sun::star::uno::RuntimeException));
diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx
index 4054a3825f2c..821b03e632a8 100644
--- a/uui/source/interactionhandler.cxx
+++ b/uui/source/interactionhandler.cxx
@@ -19,6 +19,8 @@
#include "iahndl.hxx"
#include "interactionhandler.hxx"
+#include "comphelper/namedvaluecollection.hxx"
+#include "com/sun/star/awt/XWindow.hpp"
using namespace com::sun::star;
@@ -67,7 +69,21 @@ UUIInteractionHandler::initialize(
throw (uno::Exception)
{
delete m_pImpl;
- m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments);
+
+ uno::Reference< awt::XWindow > xWindow;
+ rtl::OUString aContext;
+ ::comphelper::NamedValueCollection aProperties( rArguments );
+ if ( aProperties.has( "Parent" ) )
+ {
+ OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow );
+ }
+ if ( aProperties.has( "Context" ) )
+ {
+ OSL_VERIFY( aProperties.get( "Context" ) >>= aContext );
+ }
+
+
+ m_pImpl = new UUIInteractionHelper(m_xServiceFactory, xWindow, aContext);
}
void SAL_CALL
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index 5a688c622197..0005fe976668 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -23,7 +23,7 @@
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/task/NoMasterException.hpp"
#include "com/sun/star/task/PasswordContainer.hpp"
-#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XInteractionHandler2.hpp"
#include "com/sun/star/ucb/AuthenticationRequest.hpp"
#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
@@ -120,9 +120,11 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
uno::Reference< ucb::XInteractionSupplyAuthentication > const &
xSupplyAuthentication,
rtl::OUString const & rURL,
- uno::Reference< task::XInteractionHandler > const & xIH )
+ uno::Reference< task::XInteractionHandler2 > const & xIH )
SAL_THROW((uno::RuntimeException))
{
+ uno::Reference< task::XInteractionHandler > xIH1(xIH, uno::UNO_QUERY);
+
// Is continuation even a XInteractionSupplyAuthentication2, which
// is derived from XInteractionSupplyAuthentication?
uno::Reference< ucb::XInteractionSupplyAuthentication2 >
@@ -167,12 +169,12 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
{
task::UrlRecord aRec;
if ( !rURL.isEmpty() )
- aRec = m_xPasswordContainer->find(rURL, xIH);
+ aRec = m_xPasswordContainer->find(rURL, xIH1);
if ( aRec.UserList.getLength() == 0 )
{
// compat: try server name.
- aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH);
+ aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH1);
}
if ( fillContinuation( false,
@@ -191,13 +193,13 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
task::UrlRecord aRec;
if ( !rURL.isEmpty() )
aRec = m_xPasswordContainer->findForName(
- rURL, rRequest.UserName, xIH);
+ rURL, rRequest.UserName, xIH1);
if ( aRec.UserList.getLength() == 0 )
{
// compat: try server name.
aRec = m_xPasswordContainer->findForName(
- rRequest.ServerName, rRequest.UserName, xIH);
+ rRequest.ServerName, rRequest.UserName, xIH1);
}
if ( fillContinuation( false,
@@ -223,10 +225,12 @@ bool PasswordContainerHelper::addRecord(
rtl::OUString const & rURL,
rtl::OUString const & rUsername,
uno::Sequence< rtl::OUString > const & rPasswords,
- uno::Reference< task::XInteractionHandler > const & xIH,
+ uno::Reference< task::XInteractionHandler2 > const & xIH,
bool bPersist )
SAL_THROW((uno::RuntimeException))
{
+ uno::Reference< task::XInteractionHandler > xIH1(xIH, uno::UNO_QUERY);
+
try
{
if ( !rUsername.isEmpty() )
@@ -246,13 +250,13 @@ bool PasswordContainerHelper::addRecord(
m_xPasswordContainer->addPersistent( rURL,
rUsername,
rPasswords,
- xIH );
+ xIH1 );
}
else
m_xPasswordContainer->add( rURL,
rUsername,
rPasswords,
- xIH );
+ xIH1 );
}
else
{
@@ -346,7 +350,7 @@ PasswordContainerInteractionHandler::getSupportedServiceNames_Static()
//=========================================================================
//
-// XInteractionHandler methods.
+// XInteractionHandler2 methods.
//
//=========================================================================
@@ -356,14 +360,23 @@ PasswordContainerInteractionHandler::handle(
const uno::Reference< task::XInteractionRequest >& rRequest )
throw ( uno::RuntimeException )
{
+ handleInteractionRequest( rRequest );
+}
+
+// virtual
+sal_Bool SAL_CALL
+PasswordContainerInteractionHandler::handleInteractionRequest(
+ const uno::Reference< task::XInteractionRequest >& rRequest )
+ throw ( uno::RuntimeException )
+{
if ( !rRequest.is() )
- return;
+ return false;
uno::Any aAnyRequest( rRequest->getRequest() );
ucb::AuthenticationRequest aAuthenticationRequest;
if ( !( aAnyRequest >>= aAuthenticationRequest ) )
- return;
+ return false;
rtl::OUString aURL;
ucb::URLAuthenticationRequest aURLAuthenticationRequest;
@@ -386,7 +399,7 @@ PasswordContainerInteractionHandler::handle(
}
if ( !xSupplyAuthentication.is() )
- return;
+ return false;
// Try to obtain credentials from password container.
if ( m_aPwContainerHelper.
@@ -401,7 +414,9 @@ PasswordContainerInteractionHandler::handle(
{
// successfully handled
xSupplyAuthentication->select();
+ return true;
}
+ return false;
}
//=========================================================================
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index 31434a3f0da1..af9fdb16dd9b 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -24,7 +24,7 @@
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
-#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XInteractionHandler2.hpp"
#include "com/sun/star/task/XPasswordContainer2.hpp"
namespace com {
@@ -90,7 +90,7 @@ public:
xSupplyAuthentication,
rtl::OUString const & rURL,
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionHandler > const & xIH )
+ com::sun::star::task::XInteractionHandler2 > const & xIH )
SAL_THROW( (com::sun::star::uno::RuntimeException) );
/** This member function adds credentials for the given URL to the password
@@ -125,7 +125,7 @@ public:
com::sun::star::uno::Sequence< rtl::OUString > const &
rPasswords,
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionHandler > const & xIH,
+ com::sun::star::task::XInteractionHandler2 > const & xIH,
bool bPersist )
SAL_THROW( (com::sun::star::uno::RuntimeException) );
@@ -140,7 +140,7 @@ private:
class PasswordContainerInteractionHandler :
public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
- com::sun::star::task::XInteractionHandler >
+ com::sun::star::task::XInteractionHandler2 >
{
public:
PasswordContainerInteractionHandler(
@@ -160,12 +160,17 @@ public:
getSupportedServiceNames()
throw ( com::sun::star::uno::RuntimeException );
- // XInteractionHandler
+ // XInteractionHandler2
virtual void SAL_CALL
handle( const ::com::sun::star::uno::Reference<
::com::sun::star::task::XInteractionRequest >& Request )
throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ handleInteractionRequest( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionRequest >& Request )
+ throw (::com::sun::star::uno::RuntimeException);
+
// Non-UNO interfaces
static rtl::OUString
getImplementationName_Static();