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