1*39a19a47SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*39a19a47SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*39a19a47SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*39a19a47SAndrew Rist * distributed with this work for additional information 6*39a19a47SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*39a19a47SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*39a19a47SAndrew Rist * "License"); you may not use this file except in compliance 9*39a19a47SAndrew Rist * with the License. You may obtain a copy of the License at 10*39a19a47SAndrew Rist * 11*39a19a47SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*39a19a47SAndrew Rist * 13*39a19a47SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*39a19a47SAndrew Rist * software distributed under the License is distributed on an 15*39a19a47SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*39a19a47SAndrew Rist * KIND, either express or implied. See the License for the 17*39a19a47SAndrew Rist * specific language governing permissions and limitations 18*39a19a47SAndrew Rist * under the License. 19*39a19a47SAndrew Rist * 20*39a19a47SAndrew Rist *************************************************************/ 21*39a19a47SAndrew Rist 22*39a19a47SAndrew Rist 23cdf0e10cSrcweir #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 24cdf0e10cSrcweir #define INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <list> 27cdf0e10cSrcweir #include <vector> 28cdf0e10cSrcweir #include <map> 29cdf0e10cSrcweir #include <com/sun/star/task/XPasswordContainer.hpp> 30cdf0e10cSrcweir #include <com/sun/star/task/XUrlContainer.hpp> 31cdf0e10cSrcweir #include <com/sun/star/task/PasswordRequestMode.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 36cdf0e10cSrcweir #include <com/sun/star/task/XMasterPasswordHandling2.hpp> 37cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 38cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 39cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx> 40cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <tools/stream.hxx> 43cdf0e10cSrcweir #include <unotools/configitem.hxx> 44cdf0e10cSrcweir #include <ucbhelper/interactionrequest.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <rtl/ref.hxx> 47cdf0e10cSrcweir #include <osl/mutex.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "syscreds.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir #define MEMORY_RECORD 0 52cdf0e10cSrcweir #define PERSISTENT_RECORD 1 53cdf0e10cSrcweir 54cdf0e10cSrcweir //---------------------------------------------------------------------------------- 55cdf0e10cSrcweir 56cdf0e10cSrcweir class NamePassRecord 57cdf0e10cSrcweir { 58cdf0e10cSrcweir ::rtl::OUString m_aName; 59cdf0e10cSrcweir 60cdf0e10cSrcweir // there are two lists of passwords, memory passwords and persistent passwords 61cdf0e10cSrcweir sal_Bool m_bHasMemPass; 62cdf0e10cSrcweir ::std::vector< ::rtl::OUString > m_aMemPass; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // persistent passwords are encrypted in one string 65cdf0e10cSrcweir sal_Bool m_bHasPersPass; 66cdf0e10cSrcweir ::rtl::OUString m_aPersPass; 67cdf0e10cSrcweir 68cdf0e10cSrcweir void InitArrays( sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, 69cdf0e10cSrcweir sal_Bool bHasPersistentList, const ::rtl::OUString& aPersistentList ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir m_bHasMemPass = bHasMemoryList; 72cdf0e10cSrcweir if ( bHasMemoryList ) 73cdf0e10cSrcweir m_aMemPass = aMemoryList; 74cdf0e10cSrcweir 75cdf0e10cSrcweir m_bHasPersPass = bHasPersistentList; 76cdf0e10cSrcweir if ( bHasPersistentList ) 77cdf0e10cSrcweir m_aPersPass = aPersistentList; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir 82cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName ) 83cdf0e10cSrcweir : m_aName( aName ) 84cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 85cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, const ::std::vector< ::rtl::OUString >& aMemoryList ) 90cdf0e10cSrcweir : m_aName( aName ) 91cdf0e10cSrcweir , m_bHasMemPass( sal_True ) 92cdf0e10cSrcweir , m_aMemPass( aMemoryList ) 93cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, const ::rtl::OUString& aPersistentList ) 98cdf0e10cSrcweir : m_aName( aName ) 99cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 100cdf0e10cSrcweir , m_bHasPersPass( sal_True ) 101cdf0e10cSrcweir , m_aPersPass( aPersistentList ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, 106cdf0e10cSrcweir sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, 107cdf0e10cSrcweir sal_Bool bHasPersistentList, const ::rtl::OUString aPersistentList ) 108cdf0e10cSrcweir : m_aName( aName ) 109cdf0e10cSrcweir , m_bHasMemPass( bHasMemoryList ) 110cdf0e10cSrcweir , m_bHasPersPass( bHasPersistentList ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir InitArrays( bHasMemoryList, aMemoryList, bHasPersistentList, aPersistentList ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir NamePassRecord( const NamePassRecord& aRecord ) 116cdf0e10cSrcweir : m_aName( aRecord.m_aName ) 117cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 118cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir NamePassRecord& operator=( const NamePassRecord& aRecord ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir m_aName = aRecord.m_aName; 126cdf0e10cSrcweir 127cdf0e10cSrcweir m_aMemPass.clear(); 128cdf0e10cSrcweir m_aPersPass = ::rtl::OUString(); 129cdf0e10cSrcweir InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir return *this; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir ::rtl::OUString GetUserName() const 135cdf0e10cSrcweir { 136cdf0e10cSrcweir return m_aName; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir sal_Bool HasPasswords( sal_Int8 nStatus ) const 140cdf0e10cSrcweir { 141cdf0e10cSrcweir if ( nStatus == MEMORY_RECORD ) 142cdf0e10cSrcweir return m_bHasMemPass; 143cdf0e10cSrcweir if ( nStatus == PERSISTENT_RECORD ) 144cdf0e10cSrcweir return m_bHasPersPass; 145cdf0e10cSrcweir 146cdf0e10cSrcweir return sal_False; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir ::std::vector< ::rtl::OUString > GetMemPasswords() const 150cdf0e10cSrcweir { 151cdf0e10cSrcweir if ( m_bHasMemPass ) 152cdf0e10cSrcweir return m_aMemPass; 153cdf0e10cSrcweir 154cdf0e10cSrcweir return ::std::vector< ::rtl::OUString >(); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir ::rtl::OUString GetPersPasswords() const 158cdf0e10cSrcweir { 159cdf0e10cSrcweir if ( m_bHasPersPass ) 160cdf0e10cSrcweir return m_aPersPass; 161cdf0e10cSrcweir 162cdf0e10cSrcweir return ::rtl::OUString(); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir void SetMemPasswords( const ::std::vector< ::rtl::OUString >& aMemList ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir m_aMemPass = aMemList; 168cdf0e10cSrcweir m_bHasMemPass = sal_True; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir void SetPersPasswords( const ::rtl::OUString& aPersList ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir m_aPersPass = aPersList; 174cdf0e10cSrcweir m_bHasPersPass = sal_True; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir void RemovePasswords( sal_Int8 nStatus ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir if ( nStatus == MEMORY_RECORD ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir m_bHasMemPass = sal_False; 182cdf0e10cSrcweir m_aMemPass.clear(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir else if ( nStatus == PERSISTENT_RECORD ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir m_bHasPersPass = sal_False; 187cdf0e10cSrcweir m_aPersPass = ::rtl::OUString(); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir }; 192cdf0e10cSrcweir 193cdf0e10cSrcweir //---------------------------------------------------------------------------------- 194cdf0e10cSrcweir 195cdf0e10cSrcweir typedef ::std::pair< const ::rtl::OUString, ::std::list< NamePassRecord > > PairUrlRecord; 196cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, ::std::list< NamePassRecord > > PassMap; 197cdf0e10cSrcweir 198cdf0e10cSrcweir //---------------------------------------------------------------------------------- 199cdf0e10cSrcweir 200cdf0e10cSrcweir class PasswordContainer; 201cdf0e10cSrcweir 202cdf0e10cSrcweir class StorageItem : public ::utl::ConfigItem { 203cdf0e10cSrcweir PasswordContainer* mainCont; 204cdf0e10cSrcweir sal_Bool hasEncoded; 205cdf0e10cSrcweir ::rtl::OUString mEncoded; 206cdf0e10cSrcweir public: 207cdf0e10cSrcweir StorageItem( PasswordContainer* point, const ::rtl::OUString& path ) : 208cdf0e10cSrcweir ConfigItem( path, CONFIG_MODE_IMMEDIATE_UPDATE ), 209cdf0e10cSrcweir mainCont( point ), 210cdf0e10cSrcweir hasEncoded( sal_False ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aNode( 1 ); 213cdf0e10cSrcweir *aNode.getArray() = path; 214cdf0e10cSrcweir *aNode.getArray() += ::rtl::OUString::createFromAscii( "/Store" ); 215cdf0e10cSrcweir EnableNotification( aNode ); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir PassMap getInfo(); 219cdf0e10cSrcweir void update( const ::rtl::OUString& url, const NamePassRecord& rec ); 220cdf0e10cSrcweir void remove( const ::rtl::OUString& url, const ::rtl::OUString& rec ); 221cdf0e10cSrcweir void clear(); 222cdf0e10cSrcweir 223cdf0e10cSrcweir sal_Bool getEncodedMP( ::rtl::OUString& aResult ); 224cdf0e10cSrcweir void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False ); 225cdf0e10cSrcweir void setUseStorage( sal_Bool bUse ); 226cdf0e10cSrcweir sal_Bool useStorage(); 227cdf0e10cSrcweir 228cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ); 229cdf0e10cSrcweir virtual void Commit(); 230cdf0e10cSrcweir }; 231cdf0e10cSrcweir 232cdf0e10cSrcweir //---------------------------------------------------------------------------------- 233cdf0e10cSrcweir 234cdf0e10cSrcweir enum PasswordState { 235cdf0e10cSrcweir no_password, 236cdf0e10cSrcweir entered, 237cdf0e10cSrcweir cancelled 238cdf0e10cSrcweir }; 239cdf0e10cSrcweir 240cdf0e10cSrcweir class PasswordContainer : public ::cppu::WeakImplHelper5< 241cdf0e10cSrcweir ::com::sun::star::task::XPasswordContainer, 242cdf0e10cSrcweir ::com::sun::star::task::XMasterPasswordHandling2, 243cdf0e10cSrcweir ::com::sun::star::task::XUrlContainer, 244cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 245cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > 246cdf0e10cSrcweir { 247cdf0e10cSrcweir private: 248cdf0e10cSrcweir PassMap m_aContainer; 249cdf0e10cSrcweir StorageItem* m_pStorageFile; 250cdf0e10cSrcweir ::osl::Mutex mMutex; 251cdf0e10cSrcweir ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty 252cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; 253cdf0e10cSrcweir SysCredentialsConfig mUrlContainer; 254cdf0e10cSrcweir 255cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( 256cdf0e10cSrcweir const ::std::list< NamePassRecord >& original, 257cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 258cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 259cdf0e10cSrcweir 260cdf0e10cSrcweir ::com::sun::star::task::UserRecord CopyToUserRecord( 261cdf0e10cSrcweir const NamePassRecord& aRecord, 262cdf0e10cSrcweir sal_Bool& io_bTryToDecode, 263cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ); 264cdf0e10cSrcweir 265cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > FindUsr( 266cdf0e10cSrcweir const ::std::list< NamePassRecord >& userlist, 267cdf0e10cSrcweir const ::rtl::OUString& name, 268cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 269cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 270cdf0e10cSrcweir bool createUrlRecord( 271cdf0e10cSrcweir const PassMap::iterator & rIter, 272cdf0e10cSrcweir bool bName, 273cdf0e10cSrcweir const ::rtl::OUString & aName, 274cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, 275cdf0e10cSrcweir ::com::sun::star::task::UrlRecord & rRec ) 276cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 277cdf0e10cSrcweir 278cdf0e10cSrcweir ::com::sun::star::task::UrlRecord find( 279cdf0e10cSrcweir const ::rtl::OUString& aURL, 280cdf0e10cSrcweir const ::rtl::OUString& aName, 281cdf0e10cSrcweir bool bName, // only needed to support empty user names 282cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); 283cdf0e10cSrcweir 284cdf0e10cSrcweir ::rtl::OUString GetDefaultMasterPassword(); 285cdf0e10cSrcweir 286cdf0e10cSrcweir ::rtl::OUString RequestPasswordFromUser( 287cdf0e10cSrcweir ::com::sun::star::task::PasswordRequestMode aRMode, 288cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 289cdf0e10cSrcweir 290cdf0e10cSrcweir ::rtl::OUString GetMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 291cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 292cdf0e10cSrcweir 293cdf0e10cSrcweir void UpdateVector( const ::rtl::OUString& url, ::std::list< NamePassRecord >& toUpdate, NamePassRecord& rec, sal_Bool writeFile ) 294cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 295cdf0e10cSrcweir 296cdf0e10cSrcweir void PrivateAdd( const ::rtl::OUString& aUrl, 297cdf0e10cSrcweir const ::rtl::OUString& aUserName, 298cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 299cdf0e10cSrcweir char aMode, 300cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 301cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 302cdf0e10cSrcweir 303cdf0e10cSrcweir ::std::vector< ::rtl::OUString > DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPassword ) 304cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 305cdf0e10cSrcweir 306cdf0e10cSrcweir ::rtl::OUString EncodePasswords( ::std::vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPassword ) 307cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 308cdf0e10cSrcweir 309cdf0e10cSrcweir public: 310cdf0e10cSrcweir PasswordContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); 311cdf0e10cSrcweir ~PasswordContainer(); 312cdf0e10cSrcweir 313cdf0e10cSrcweir virtual void SAL_CALL add( const ::rtl::OUString& aUrl, 314cdf0e10cSrcweir const ::rtl::OUString& aUserName, 315cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 316cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 317cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 318cdf0e10cSrcweir 319cdf0e10cSrcweir virtual void SAL_CALL addPersistent( const ::rtl::OUString& aUrl, 320cdf0e10cSrcweir const ::rtl::OUString& aUserName, 321cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 322cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 323cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 324cdf0e10cSrcweir 325cdf0e10cSrcweir virtual ::com::sun::star::task::UrlRecord SAL_CALL 326cdf0e10cSrcweir find( const ::rtl::OUString& aUrl, 327cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 328cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 329cdf0e10cSrcweir 330cdf0e10cSrcweir virtual ::com::sun::star::task::UrlRecord SAL_CALL 331cdf0e10cSrcweir findForName( const ::rtl::OUString& aUrl, 332cdf0e10cSrcweir const ::rtl::OUString& aUserName, 333cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 334cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 335cdf0e10cSrcweir 336cdf0e10cSrcweir virtual void SAL_CALL remove( const ::rtl::OUString& aUrl, 337cdf0e10cSrcweir const ::rtl::OUString& aUserName ) 338cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 339cdf0e10cSrcweir 340cdf0e10cSrcweir virtual void SAL_CALL removePersistent( const ::rtl::OUString& aUrl, 341cdf0e10cSrcweir const ::rtl::OUString& aUserName ) 342cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 343cdf0e10cSrcweir 344cdf0e10cSrcweir virtual void SAL_CALL removeAllPersistent() throw(::com::sun::star::uno::RuntimeException); 345cdf0e10cSrcweir 346cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::task::UrlRecord > SAL_CALL 347cdf0e10cSrcweir getAllPersistent( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); 348cdf0e10cSrcweir 349cdf0e10cSrcweir 350cdf0e10cSrcweir // provide factory 351cdf0e10cSrcweir static ::rtl::OUString SAL_CALL impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 352cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 353cdf0e10cSrcweir impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 354cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL 355cdf0e10cSrcweir impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException); 356cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 357cdf0e10cSrcweir impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException ); 358cdf0e10cSrcweir 359cdf0e10cSrcweir // XServiceInfo 360cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 361cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 362cdf0e10cSrcweir 363cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 364cdf0e10cSrcweir getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 365cdf0e10cSrcweir 366cdf0e10cSrcweir // XEventListener 367cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 368cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 369cdf0e10cSrcweir 370cdf0e10cSrcweir // XMasterPasswordHandling 371cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL authorizateWithMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) 372cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 373cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL changeMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 374cdf0e10cSrcweir virtual void SAL_CALL removeMasterPassword() throw (::com::sun::star::uno::RuntimeException); 375cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasMasterPassword( ) throw (::com::sun::star::uno::RuntimeException); 376cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException); 377cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException); 378cdf0e10cSrcweir 379cdf0e10cSrcweir // XMasterPasswordHandling2 380cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 381cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); 382cdf0e10cSrcweir 383cdf0e10cSrcweir // XUrlContainer 384cdf0e10cSrcweir virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); 385cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); 386cdf0e10cSrcweir virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); 387cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); 388cdf0e10cSrcweir 389cdf0e10cSrcweir void Notify(); 390cdf0e10cSrcweir }; 391cdf0e10cSrcweir 392cdf0e10cSrcweir //---------------------------------------------------------------------------------- 393cdf0e10cSrcweir 394cdf0e10cSrcweir class MasterPasswordRequest_Impl : public ucbhelper::InteractionRequest 395cdf0e10cSrcweir { 396cdf0e10cSrcweir ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; 397cdf0e10cSrcweir 398cdf0e10cSrcweir public: 399cdf0e10cSrcweir MasterPasswordRequest_Impl( ::com::sun::star::task::PasswordRequestMode Mode ); 400cdf0e10cSrcweir 401cdf0e10cSrcweir const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & 402cdf0e10cSrcweir getAuthenticationSupplier() const { return m_xAuthSupplier; } 403cdf0e10cSrcweir 404cdf0e10cSrcweir }; 405cdf0e10cSrcweir 406cdf0e10cSrcweir //---------------------------------------------------------------------------------- 407cdf0e10cSrcweir 408cdf0e10cSrcweir class RW_SvMemoryStream : public SvMemoryStream { 409cdf0e10cSrcweir public: 410cdf0e10cSrcweir RW_SvMemoryStream( void* Buf, sal_uLong Size, StreamMode eMode ): 411cdf0e10cSrcweir SvMemoryStream( Buf, Size, eMode){} 412cdf0e10cSrcweir 413cdf0e10cSrcweir RW_SvMemoryStream( sal_uLong InitSize=512, sal_uLong Resize=64 ): 414cdf0e10cSrcweir SvMemoryStream( InitSize, Resize ){} 415cdf0e10cSrcweir 416cdf0e10cSrcweir sal_uLong getActualSize(){ return nEndOfData; } 417cdf0e10cSrcweir }; 418cdf0e10cSrcweir 419cdf0e10cSrcweir 420cdf0e10cSrcweir 421cdf0e10cSrcweir #endif // #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 422cdf0e10cSrcweir 423