[Libreoffice-commits] .: 2 commits - cui/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk svl/source uui/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 11 10:09:56 PDT 2012


 cui/source/options/optinet2.cxx                       |   41 +++-------
 cui/source/options/webconninfo.cxx                    |   52 ++++---------
 offapi/UnoApi_offapi.mk                               |    3 
 offapi/com/sun/star/task/PasswordContainer.idl        |   22 -----
 offapi/com/sun/star/task/XMasterPasswordHandling2.idl |    2 
 offapi/com/sun/star/task/XPasswordContainer2.idl      |   59 +++++++++++++++
 offapi/com/sun/star/task/XUrlContainer.idl            |    2 
 offapi/type_reference/types.rdb                       |binary
 svl/source/inc/passwordcontainer.hxx                  |   12 +--
 uui/source/iahndl-authentication.cxx                  |    4 -
 uui/source/passwordcontainer.cxx                      |   70 ++++--------------
 uui/source/passwordcontainer.hxx                      |   10 +-
 12 files changed, 125 insertions(+), 152 deletions(-)

New commits:
commit 8963c350986fc57cb0cf98387d7bd1c7bf6420a1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 11 19:09:24 2012 +0200

    Improvement on previous commit
    
    Change-Id: I10984b6ac4128ad46f512dade0f4e0084d0b9348

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 7202ce0..27e334b 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -93,9 +93,8 @@
 #include <comphelper/string.hxx>
 
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-#include "com/sun/star/task/XMasterPasswordHandling2.hpp"
 #include "com/sun/star/task/PasswordContainer.hpp"
-#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "com/sun/star/task/XPasswordContainer2.hpp"
 #include "securityoptions.hxx"
 #include "webconninfo.hxx"
 #include "certpath.hxx"
@@ -709,9 +708,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl)
 {
     try
     {
-        Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            UNO_QUERY_THROW );
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
         if ( maSavePasswordsCB.IsChecked() )
         {
@@ -765,11 +763,10 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl)
 {
     try
     {
-        Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            UNO_QUERY );
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
-        if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+        if ( xMasterPasswd->isPersistentStoringAllowed() )
             xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() );
     }
     catch (const Exception&)
@@ -782,9 +779,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl)
 {
     try
     {
-        Reference< task::XMasterPasswordHandling2 > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            UNO_QUERY_THROW );
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
         if ( maMasterPasswordCB.IsChecked() )
         {
@@ -827,11 +823,10 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
 {
     try
     {
-        Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            UNO_QUERY );
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
-        if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
+        if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
         {
             svx::WebConnectionInfoDialog aDlg( this );
             aDlg.Execute();
@@ -962,9 +957,8 @@ void SvxSecurityTabPage::InitControls()
     // initialize the password saving checkbox
     try
     {
-        Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            UNO_QUERY_THROW );
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
         if ( xMasterPasswd->isPersistentStoringAllowed() )
         {
@@ -972,8 +966,7 @@ void SvxSecurityTabPage::InitControls()
             maShowConnectionsPB.Enable( sal_True );
             maSavePasswordsCB.Check( sal_True );
 
-            Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY );
-            if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() )
+            if ( xMasterPasswd->isDefaultMasterPasswordUsed() )
                 maMasterPasswordCB.Check( sal_False );
             else
             {
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 198d1fc..0bfdd25 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -29,11 +29,9 @@
 #include <dialmgr.hxx>
 #include <cuires.hrc>
 #include <sal/macros.h>
-#include <com/sun/star/task/UrlRecord.hpp>
 #include <com/sun/star/task/PasswordContainer.hpp>
-#include <com/sun/star/task/XPasswordContainer.hpp>
-#include <com/sun/star/task/XMasterPasswordHandling.hpp>
-#include "com/sun/star/task/XUrlContainer.hpp"
+#include <com/sun/star/task/UrlRecord.hpp>
+#include <com/sun/star/task/XPasswordContainer2.hpp>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/docpasswordrequest.hxx>
 #include "webconninfo.hxx"
@@ -183,19 +181,17 @@ void WebConnectionInfoDialog::FillPasswordList()
 {
     try
     {
-        uno::Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            uno::UNO_QUERY );
+        uno::Reference< task::XPasswordContainer2 > xMasterPasswd(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
-        if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+        if ( xMasterPasswd->isPersistentStoringAllowed() )
         {
-            uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW );
             uno::Reference< task::XInteractionHandler > xInteractionHandler(
                 comphelper::getProcessServiceFactory()->createInstance(
                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ),
                 uno::UNO_QUERY_THROW );
 
-            uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler );
+            uno::Sequence< task::UrlRecord > aURLEntries = xMasterPasswd->getAllPersistent( xInteractionHandler );
             sal_Int32 nCount = 0;
             for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ )
             {
@@ -212,11 +208,8 @@ void WebConnectionInfoDialog::FillPasswordList()
             // remember pos of first url container entry.
             m_nPos = nCount;
 
-            uno::Reference< task::XUrlContainer > xUrlContainer(
-                xPasswdContainer, uno::UNO_QUERY_THROW );
-
             uno::Sequence< rtl::OUString > aUrls
-                = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+                = xMasterPasswd->getUrls( sal_True /* OnlyPersistent */ );
 
             for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
             {
@@ -243,9 +236,8 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl)
             ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 );
             ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
 
-            uno::Reference< task::XPasswordContainer > xPasswdContainer(
-                task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-                uno::UNO_QUERY_THROW );
+            uno::Reference< task::XPasswordContainer2 > xPasswdContainer(
+                task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
             sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
             if ( nPos < m_nPos )
@@ -254,9 +246,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl)
             }
             else
             {
-                uno::Reference< task::XUrlContainer > xUrlContainer(
-                    xPasswdContainer, uno::UNO_QUERY_THROW );
-                xUrlContainer->removeUrl( aURL );
+                xPasswdContainer->removeUrl( aURL );
             }
             m_aPasswordsLB.RemoveEntry( pEntry );
         }
@@ -272,19 +262,16 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemoveAllPasswordsHdl)
 {
     try
     {
-        uno::Reference< task::XPasswordContainer > xPasswdContainer(
-            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-            uno::UNO_QUERY_THROW );
+        uno::Reference< task::XPasswordContainer2 > xPasswdContainer(
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()));
 
         // should the master password be requested before?
         xPasswdContainer->removeAllPersistent();
 
-        uno::Reference< task::XUrlContainer > xUrlContainer(
-            xPasswdContainer, uno::UNO_QUERY_THROW );
         uno::Sequence< rtl::OUString > aUrls
-            = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+            = xPasswdContainer->getUrls( sal_True /* OnlyPersistent */ );
         for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
-            xUrlContainer->removeUrl( aUrls[ nURLIdx ] );
+            xPasswdContainer->removeUrl( aUrls[ nURLIdx ] );
 
         m_aPasswordsLB.Clear();
     }
@@ -322,9 +309,8 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl)
                 uno::Sequence< ::rtl::OUString > aPasswd( 1 );
                 aPasswd[0] = aNewPass;
 
-                uno::Reference< task::XPasswordContainer > xPasswdContainer(
-                    task::PasswordContainer::create(comphelper::getProcessComponentContext()),
-                    uno::UNO_QUERY_THROW );
+                uno::Reference< task::XPasswordContainer2 > xPasswdContainer(
+                    task::PasswordContainer::create(comphelper::getProcessComponentContext()));
                 xPasswdContainer->addPersistent(
                     aURL, aUserName, aPasswd, xInteractionHandler );
             }
diff --git a/offapi/com/sun/star/task/XMasterPasswordHandling2.idl b/offapi/com/sun/star/task/XMasterPasswordHandling2.idl
index 8842030..bb1c540 100644
--- a/offapi/com/sun/star/task/XMasterPasswordHandling2.idl
+++ b/offapi/com/sun/star/task/XMasterPasswordHandling2.idl
@@ -36,7 +36,7 @@ module com { module sun { module star { module task {
 
 /** allows to change the master password, or let it be requested and checked.
 */
-interface XMasterPasswordHandling2 : XMasterPasswordHandling
+published interface XMasterPasswordHandling2 : XMasterPasswordHandling
 {
     /** allows to let the default password be used
 
diff --git a/offapi/com/sun/star/task/XPasswordContainer2.idl b/offapi/com/sun/star/task/XPasswordContainer2.idl
index d22a28f..0c551d5 100644
--- a/offapi/com/sun/star/task/XPasswordContainer2.idl
+++ b/offapi/com/sun/star/task/XPasswordContainer2.idl
@@ -19,14 +19,16 @@
 #ifndef __com_sun_star_task_XPasswordContainer2_idl__
 #define __com_sun_star_task_XPasswordContainer2_idl__
 
+#include <com/sun/star/task/XMasterPasswordHandling2.idl>
 #include <com/sun/star/task/XPasswordContainer.idl>
-#include <com/sun/star/task/XMasterPasswordHandling.idl>
-
+#include <com/sun/star/task/XUrlContainer.idl>
 
 module com {  module sun {  module star {  module task {
 
 /**
   Provides a unified interface for the PasswordContainer service to implement.
+
+  @since LibreOffice 3.7
 */
 published interface XPasswordContainer2
 {
@@ -44,7 +46,9 @@ published interface XPasswordContainer2
         Use this interface to store\retrieve passwords.
         </p>
      */
-    [optional] interface com::sun::star::task::XMasterPasswordHandling;
+    interface com::sun::star::task::XMasterPasswordHandling2;
+
+    interface com::sun::star::task::XUrlContainer;
 };
 
 
diff --git a/offapi/com/sun/star/task/XUrlContainer.idl b/offapi/com/sun/star/task/XUrlContainer.idl
index d872f2b..46bcbec 100644
--- a/offapi/com/sun/star/task/XUrlContainer.idl
+++ b/offapi/com/sun/star/task/XUrlContainer.idl
@@ -40,7 +40,7 @@ module com { module sun { module star { module task {
 
     @since OOo 3.2
 */
-/*published*/ interface XUrlContainer : com::sun::star::uno::XInterface
+published interface XUrlContainer : com::sun::star::uno::XInterface
 {
     /** Add a URL to the container.
 
diff --git a/svl/source/inc/passwordcontainer.hxx b/svl/source/inc/passwordcontainer.hxx
index 43b8d78..6b69b3c 100644
--- a/svl/source/inc/passwordcontainer.hxx
+++ b/svl/source/inc/passwordcontainer.hxx
@@ -22,15 +22,13 @@
 #include <list>
 #include <vector>
 #include <map>
-#include <com/sun/star/task/XPasswordContainer.hpp>
-#include <com/sun/star/task/XUrlContainer.hpp>
+#include <com/sun/star/task/XPasswordContainer2.hpp>
 #include <com/sun/star/task/PasswordRequestMode.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/task/XMasterPasswordHandling2.hpp>
-#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/factory.hxx>
@@ -233,10 +231,8 @@ enum PasswordState {
     cancelled
 };
 
-class PasswordContainer : public ::cppu::WeakImplHelper5<
-        ::com::sun::star::task::XPasswordContainer,
-        ::com::sun::star::task::XMasterPasswordHandling2,
-        ::com::sun::star::task::XUrlContainer,
+class PasswordContainer : public ::cppu::WeakImplHelper3<
+        ::com::sun::star::task::XPasswordContainer2,
         ::com::sun::star::lang::XServiceInfo,
         ::com::sun::star::lang::XEventListener >
 {
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index bf54620..546d795 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -21,12 +21,9 @@
 #include "cppuhelper/factory.hxx"
 
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
-#include "com/sun/star/task/PasswordContainer.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/XMasterPasswordHandling.hpp"
-#include "com/sun/star/task/XPasswordContainer.hpp"
-#include "com/sun/star/task/XUrlContainer.hpp"
 #include "com/sun/star/ucb/AuthenticationRequest.hpp"
 #include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
 #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
@@ -113,22 +110,9 @@ namespace uui {
 
 //=========================================================================
 PasswordContainerHelper::PasswordContainerHelper(
-    uno::Reference< uno::XComponentContext > const & xContext )
-{
-    OSL_ENSURE(xContext.is(), "no service factory given!");
-    if (xContext.is())
-        try
-        {
-            m_xPasswordContainer
-                = uno::Reference< task::XPasswordContainer >(
-                      task::PasswordContainer::create(xContext),
-                      uno::UNO_QUERY);
-        }
-        catch (uno::Exception const &)
-        {}
-    OSL_ENSURE(m_xPasswordContainer.is(),
-               "unable to instanciate password container service");
-}
+    uno::Reference< uno::XComponentContext > const & xContext ):
+    m_xPasswordContainer(task::PasswordContainer::create(xContext))
+{}
 
 //=========================================================================
 bool PasswordContainerHelper::handleAuthenticationRequest(
@@ -153,20 +137,11 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
                 bDefaultUseSystemCredentials );
     }
 
-    uno::Reference< task::XPasswordContainer > xContainer(
-        m_xPasswordContainer );
-    uno::Reference< task::XUrlContainer > xUrlContainer(
-        m_xPasswordContainer, uno::UNO_QUERY );
-    OSL_ENSURE( xUrlContainer.is(), "Got no XUrlContainer!" );
-
-    if ( !xContainer.is() || !xUrlContainer.is() )
-        return false;
-
     if ( bCanUseSystemCredentials )
     {
         // Runtime / Persistent info avail for current auth request?
 
-        rtl::OUString aResult = xUrlContainer->findUrl(
+        rtl::OUString aResult = m_xPasswordContainer->findUrl(
             rURL.isEmpty() ? rRequest.ServerName : rURL );
         if ( !aResult.isEmpty() )
         {
@@ -183,7 +158,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
         }
     }
 
-    // xContainer works with userName passwdSequences pairs:
+    // m_xPasswordContainer works with userName passwdSequences pairs:
     if (rRequest.HasUserName && rRequest.HasPassword)
     {
         try
@@ -192,12 +167,12 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
             {
                 task::UrlRecord aRec;
                 if ( !rURL.isEmpty() )
-                    aRec = xContainer->find(rURL, xIH);
+                    aRec = m_xPasswordContainer->find(rURL, xIH);
 
                 if ( aRec.UserList.getLength() == 0 )
                 {
                     // compat: try server name.
-                    aRec = xContainer->find(rRequest.ServerName, xIH);
+                    aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH);
                 }
 
                 if ( fillContinuation( false,
@@ -215,13 +190,13 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
             {
                 task::UrlRecord aRec;
                 if ( !rURL.isEmpty() )
-                    aRec = xContainer->findForName(
+                    aRec = m_xPasswordContainer->findForName(
                         rURL, rRequest.UserName, xIH);
 
                 if ( aRec.UserList.getLength() == 0 )
                 {
                     // compat: try server name.
-                    aRec = xContainer->findForName(
+                    aRec = m_xPasswordContainer->findForName(
                         rRequest.ServerName, rRequest.UserName, xIH);
                 }
 
@@ -263,13 +238,10 @@ bool PasswordContainerHelper::addRecord(
 
             if ( bPersist )
             {
-                uno::Reference< task::XMasterPasswordHandling > xMPH(
-                    m_xPasswordContainer, uno::UNO_QUERY_THROW );
-
                 // If persistent storing of passwords is not yet
                 // allowed, enable it.
-                if ( !xMPH->isPersistentStoringAllowed() )
-                    xMPH->allowPersistentStoring( sal_True );
+                if ( !m_xPasswordContainer->isPersistentStoringAllowed() )
+                    m_xPasswordContainer->allowPersistentStoring( sal_True );
 
                 m_xPasswordContainer->addPersistent( rURL,
                                                      rUsername,
@@ -284,13 +256,7 @@ bool PasswordContainerHelper::addRecord(
         }
         else
         {
-            uno::Reference< task::XUrlContainer >
-                xContainer( m_xPasswordContainer, uno::UNO_QUERY );
-            OSL_ENSURE( xContainer.is(), "Got no XUrlContainer!" );
-            if ( !xContainer.is() )
-                return false;
-
-            xContainer->addUrl( rURL, bPersist );
+            m_xPasswordContainer->addUrl( rURL, bPersist );
         }
     }
     catch ( task::NoMasterException const & )
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index a755fc5..31434a3 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -25,7 +25,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/XPasswordContainer.hpp"
+#include "com/sun/star/task/XPasswordContainer2.hpp"
 
 namespace com {
     namespace sun {
@@ -133,7 +133,7 @@ public:
 
 private:
     com::sun::star::uno::Reference<
-        com::sun::star::task::XPasswordContainer > m_xPasswordContainer;
+        com::sun::star::task::XPasswordContainer2 > m_xPasswordContainer;
 };
 
 // ============================================================================
commit 77897f5994bd18c3b771e51abce5ee6be01322fc
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Sep 5 09:47:35 2012 +0200

    fdo#46808, Adapt task::PasswordContainer UNO service to new style
    
    Create a merged XPasswordContainer2 interface for this service to implement.
    Which is backwards-compatible, but does not require creating a new service.
    
    Change-Id: I245b566b43e4646f10914b0aee13b2a0b0e296ae

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 51ba595..7202ce0 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -94,6 +94,7 @@
 
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
 #include "com/sun/star/task/XMasterPasswordHandling2.hpp"
+#include "com/sun/star/task/PasswordContainer.hpp"
 #include "com/sun/star/task/XPasswordContainer.hpp"
 #include "securityoptions.hxx"
 #include "webconninfo.hxx"
@@ -709,8 +710,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl)
     try
     {
         Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             UNO_QUERY_THROW );
 
         if ( maSavePasswordsCB.IsChecked() )
@@ -766,8 +766,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl)
     try
     {
         Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             UNO_QUERY );
 
         if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
@@ -784,8 +783,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl)
     try
     {
         Reference< task::XMasterPasswordHandling2 > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             UNO_QUERY_THROW );
 
         if ( maMasterPasswordCB.IsChecked() )
@@ -830,8 +828,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
     try
     {
         Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             UNO_QUERY );
 
         if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
@@ -966,8 +963,7 @@ void SvxSecurityTabPage::InitControls()
     try
     {
         Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             UNO_QUERY_THROW );
 
         if ( xMasterPasswd->isPersistentStoringAllowed() )
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 0f43f19..198d1fc 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -30,6 +30,7 @@
 #include <cuires.hrc>
 #include <sal/macros.h>
 #include <com/sun/star/task/UrlRecord.hpp>
+#include <com/sun/star/task/PasswordContainer.hpp>
 #include <com/sun/star/task/XPasswordContainer.hpp>
 #include <com/sun/star/task/XMasterPasswordHandling.hpp>
 #include "com/sun/star/task/XUrlContainer.hpp"
@@ -183,8 +184,7 @@ void WebConnectionInfoDialog::FillPasswordList()
     try
     {
         uno::Reference< task::XMasterPasswordHandling > xMasterPasswd(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             uno::UNO_QUERY );
 
         if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
@@ -244,9 +244,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl)
             ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
 
             uno::Reference< task::XPasswordContainer > xPasswdContainer(
-                comphelper::getProcessServiceFactory()->createInstance(
-                    rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                        "com.sun.star.task.PasswordContainer" ) ) ),
+                task::PasswordContainer::create(comphelper::getProcessComponentContext()),
                 uno::UNO_QUERY_THROW );
 
             sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
@@ -275,9 +273,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemoveAllPasswordsHdl)
     try
     {
         uno::Reference< task::XPasswordContainer > xPasswdContainer(
-            comphelper::getProcessServiceFactory()->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                    "com.sun.star.task.PasswordContainer" ) ) ),
+            task::PasswordContainer::create(comphelper::getProcessComponentContext()),
             uno::UNO_QUERY_THROW );
 
         // should the master password be requested before?
@@ -327,9 +323,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl)
                 aPasswd[0] = aNewPass;
 
                 uno::Reference< task::XPasswordContainer > xPasswdContainer(
-                    comphelper::getProcessServiceFactory()->createInstance(
-                        rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                            "com.sun.star.task.PasswordContainer" ) ) ),
+                    task::PasswordContainer::create(comphelper::getProcessComponentContext()),
                     uno::UNO_QUERY_THROW );
                 xPasswdContainer->addPersistent(
                     aURL, aUserName, aPasswd, xInteractionHandler );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index db5f8cc..20eafe0 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -270,6 +270,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/task,\
 	InteractionRequestStringResolver \
 	JobExecutor \
 	OfficeRestartManager \
+	PasswordContainer \
 	PasswordContainerInteractionHandler \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/text,\
@@ -1216,7 +1217,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/task,\
 	AsyncJob \
 	InteractionHandler \
 	Job \
-	PasswordContainer \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text,\
 	AccessibleEndnoteView \
@@ -3616,6 +3616,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/task,\
 	XMasterPasswordHandling \
 	XMasterPasswordHandling2 \
 	XPasswordContainer \
+	XPasswordContainer2 \
 	XRestartManager \
 	XStatusIndicator \
 	XStatusIndicatorFactory \
diff --git a/offapi/com/sun/star/task/PasswordContainer.idl b/offapi/com/sun/star/task/PasswordContainer.idl
index 830feef..69f9b3b 100644
--- a/offapi/com/sun/star/task/PasswordContainer.idl
+++ b/offapi/com/sun/star/task/PasswordContainer.idl
@@ -30,8 +30,7 @@
 
 module com {  module sun {  module star {
     module task {
-        published interface XPasswordContainer;
-        published interface XMasterPasswordHandling;
+        published interface XPasswordContainer2;
     };
 }; }; };
 
@@ -57,24 +56,7 @@ module com {  module sun {  module star {  module task {
     non-persistent way explicitly.
     </p>
 */
-published service PasswordContainer
-{
-    /** handles passwords
-
-        <p>
-        Use this interface to store\retrieve passwords.
-        </p>
-     */
-    interface com::sun::star::task::XPasswordContainer;
-
-    /** handles passwords
-
-        <p>
-        Use this interface to store\retrieve passwords.
-        </p>
-     */
-    [optional] interface com::sun::star::task::XMasterPasswordHandling;
-};
+published service PasswordContainer : com::sun::star::task::XPasswordContainer2;
 
 }; }; }; };
 #endif
diff --git a/offapi/com/sun/star/task/XPasswordContainer2.idl b/offapi/com/sun/star/task/XPasswordContainer2.idl
new file mode 100644
index 0000000..d22a28f
--- /dev/null
+++ b/offapi/com/sun/star/task/XPasswordContainer2.idl
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_task_XPasswordContainer2_idl__
+#define __com_sun_star_task_XPasswordContainer2_idl__
+
+#include <com/sun/star/task/XPasswordContainer.idl>
+#include <com/sun/star/task/XMasterPasswordHandling.idl>
+
+
+module com {  module sun {  module star {  module task {
+
+/**
+  Provides a unified interface for the PasswordContainer service to implement.
+*/
+published interface XPasswordContainer2
+{
+    /** handles passwords
+
+        <p>
+        Use this interface to store\retrieve passwords.
+        </p>
+     */
+    interface com::sun::star::task::XPasswordContainer;
+
+    /** handles passwords
+
+        <p>
+        Use this interface to store\retrieve passwords.
+        </p>
+     */
+    [optional] interface com::sun::star::task::XMasterPasswordHandling;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index e6e1579..753f0bc 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 0a03af9..6e03e22 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "comphelper/componentcontext.hxx"
+
 #include "com/sun/star/task/DocumentPasswordRequest.hpp"
 #include "com/sun/star/task/DocumentPasswordRequest2.hpp"
 #include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
@@ -204,7 +206,7 @@ handleAuthenticationRequest_(
 
     //////////////////////////
     // First, try to obtain credentials from password container service.
-    uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory);
+    uui::PasswordContainerHelper aPwContainerHelper(comphelper::ComponentContext(xServiceFactory).getUNOContext());
     if (aPwContainerHelper.handleAuthenticationRequest(rRequest,
                                                        xSupplyAuthentication,
                                                        rURL,
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index eec9c10..bf54620 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -17,9 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "comphelper/componentcontext.hxx"
 #include "cppuhelper/factory.hxx"
 
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/task/PasswordContainer.hpp"
 #include "com/sun/star/task/NoMasterException.hpp"
 #include "com/sun/star/task/XInteractionHandler.hpp"
 #include "com/sun/star/task/XMasterPasswordHandling.hpp"
@@ -111,19 +113,15 @@ namespace uui {
 
 //=========================================================================
 PasswordContainerHelper::PasswordContainerHelper(
-    uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory )
+    uno::Reference< uno::XComponentContext > const & xContext )
 {
-    OSL_ENSURE(xServiceFactory.is(), "no service factory given!");
-    if (xServiceFactory.is())
+    OSL_ENSURE(xContext.is(), "no service factory given!");
+    if (xContext.is())
         try
         {
             m_xPasswordContainer
                 = uno::Reference< task::XPasswordContainer >(
-                      xServiceFactory->
-                          createInstance(
-                              rtl::OUString(
-                                  RTL_CONSTASCII_USTRINGPARAM(
-                                     "com.sun.star.task.PasswordContainer"))),
+                      task::PasswordContainer::create(xContext),
                       uno::UNO_QUERY);
         }
         catch (uno::Exception const &)
@@ -308,8 +306,8 @@ bool PasswordContainerHelper::addRecord(
 //=========================================================================
 
 PasswordContainerInteractionHandler::PasswordContainerInteractionHandler(
-    const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
-: m_aPwContainerHelper( xSMgr )
+    const uno::Reference< uno::XComponentContext >& xContext )
+: m_aPwContainerHelper( xContext )
 {
 }
 
@@ -452,7 +450,7 @@ PasswordContainerInteractionHandler_CreateInstance(
     throw( uno::Exception )
 {
     lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
-        new PasswordContainerInteractionHandler( rSMgr ) );
+        new PasswordContainerInteractionHandler( comphelper::ComponentContext(rSMgr).getUNOContext() ) );
     return uno::Reference< uno::XInterface >::query( pX );
 }
 
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index 61ee44b..a755fc5 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -49,8 +49,8 @@ class PasswordContainerHelper
 public:
     PasswordContainerHelper(
         com::sun::star::uno::Reference<
-            com::sun::star::lang::XMultiServiceFactory > const &
-                xServiceFactory );
+            com::sun::star::uno::XComponentContext > const &
+                xContext );
 
     // ------------------------------------------------------------------------
 
@@ -145,7 +145,7 @@ class PasswordContainerInteractionHandler :
 public:
     PasswordContainerInteractionHandler(
         const com::sun::star::uno::Reference<
-            com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+            com::sun::star::uno::XComponentContext >& xContext );
     virtual ~PasswordContainerInteractionHandler();
 
     // XServiceInfo


More information about the Libreoffice-commits mailing list