update dev300-m58
[ooovba.git] / connectivity / source / drivers / mozab / bootstrap / MNSProfileDiscover.hxx
blob8ae8b1caabb2d777047107a0afae9240d14a1301
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MNSProfileDiscover.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __MNSProfileDiscover_h___
32 #define __MNSProfileDiscover_h___
34 #ifndef MINIMAL_PROFILEDISCOVER
35 #include "mozilla_profile_discover.h"
36 #endif
38 #include <sal/types.h>
39 #include <osl/diagnose.h>
40 #include <osl/conditn.hxx>
41 #ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_
42 #include <com/sun/star/mozilla/MozillaProductType.hpp>
43 #endif
44 #include <com/sun/star/uno/RuntimeException.hpp>
45 #include <com/sun/star/uno/Sequence.hxx>
46 #include <rtl/ustring.hxx>
48 #include <vector>
49 #include <map>
51 #ifdef XP_OS2
52 #define INCL_DOSERRORS
53 #define INCL_DOSFILEMGR
54 #include <os2.h>
55 #endif
57 using namespace com::sun::star::mozilla;
58 namespace connectivity
60 namespace mozab
62 class ProfileStruct;
65 typedef ::std::map < ::rtl::OUString, ::connectivity::mozab::ProfileStruct* > ProfileList;
66 namespace connectivity
68 namespace mozab
70 class ProfileStruct
72 public:
73 ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
74 #ifdef MINIMAL_PROFILEDISCOVER
75 const ::rtl::OUString &aProfilePath
76 #else
77 nsILocalFile * aProfilePath
78 #endif
80 MozillaProductType getProductType() { return product;}
81 ::rtl::OUString getProfileName(){ return profileName;}
82 ::rtl::OUString getProfilePath() ;
83 #ifndef MINIMAL_PROFILEDISCOVER
84 nsILocalFile *getProfileLocal(){ return profilePath;}
85 #endif
86 protected:
87 MozillaProductType product;
88 ::rtl::OUString profileName;
89 #ifdef MINIMAL_PROFILEDISCOVER
90 ::rtl::OUString profilePath;
91 #else
92 nsCOMPtr<nsILocalFile> profilePath;
93 #endif
96 class ProductStruct
98 public:
99 void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;}
101 ::rtl::OUString mCurrentProfileName;
103 ProfileList mProfileList;
106 //Used to query profiles information
107 class ProfileAccess
109 public:
111 virtual ~ProfileAccess();
112 ProfileAccess();
113 ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
114 ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
115 ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
116 ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
117 ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
118 ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
119 protected:
120 ProductStruct m_ProductProfileList[4];
121 sal_Int32 LoadProductsInfo();
122 #ifndef MINIMAL_PROFILEDISCOVER
123 nsresult LoadMozillaProfiles();
124 #endif
125 sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
126 #ifndef MINIMAL_PROFILEDISCOVER
127 //used by isProfileLocked
128 nsresult isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist);
129 nsresult isLockExist(nsILocalFile* aFile);
130 #endif
136 #endif // __MNSProfileDiscover_h___