1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_SVTOOLS_SYSCREDS_HXX 29 #define INCLUDED_SVTOOLS_SYSCREDS_HXX 30 31 #include <set> 32 #include <memory> 33 #include "osl/mutex.hxx" 34 #include "rtl/ustring.hxx" 35 #include "com/sun/star/uno/Sequence.hxx" 36 #include "unotools/configitem.hxx" 37 38 class SysCredentialsConfig; 39 40 class SysCredentialsConfigItem : public utl::ConfigItem 41 { 42 public: 43 SysCredentialsConfigItem( SysCredentialsConfig * pOwner ); 44 //virtual ~SysCredentialsConfigItem(); 45 46 virtual void Notify( 47 const com::sun::star::uno::Sequence< rtl::OUString > & 48 seqPropertyNames ); 49 virtual void Commit(); 50 51 com::sun::star::uno::Sequence< rtl::OUString > 52 getSystemCredentialsURLs(); 53 54 void setSystemCredentialsURLs( 55 const com::sun::star::uno::Sequence< rtl::OUString > & 56 seqURLList ); 57 58 //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const; 59 60 private: 61 ::osl::Mutex m_aMutex; 62 bool m_bInited; 63 com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs; 64 SysCredentialsConfig * m_pOwner; 65 }; 66 67 typedef std::set< rtl::OUString > StringSet; 68 69 class SysCredentialsConfig 70 { 71 public: 72 SysCredentialsConfig(); 73 74 rtl::OUString find( rtl::OUString const & rURL ); 75 void add( rtl::OUString const & rURL, bool bPersistent ); 76 void remove( rtl::OUString const & rURL ); 77 com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent ); 78 79 void persistentConfigChanged(); 80 81 private: 82 void initCfg(); 83 void writeCfg(); 84 85 ::osl::Mutex m_aMutex; 86 StringSet m_aMemContainer; 87 StringSet m_aCfgContainer; 88 SysCredentialsConfigItem m_aConfigItem; 89 bool m_bCfgInited; 90 }; 91 92 #endif // INCLUDED_SVTOOLS_SYSCREDS_HXX 93