1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef __MNSProfileDiscover_h___
23 #define __MNSProfileDiscover_h___
24 
25 #include <sal/types.h>
26 #include <osl/diagnose.h>
27 #include <osl/conditn.hxx>
28 #ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_
29 #include <com/sun/star/mozilla/MozillaProductType.hpp>
30 #endif
31 #include <com/sun/star/uno/RuntimeException.hpp>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include <rtl/ustring.hxx>
34 
35 #include <vector>
36 #include <map>
37 
38 using namespace com::sun::star::mozilla;
39 namespace connectivity
40 {
41     namespace mozab
42     {
43         class ProfileStruct;
44     }
45 }
46 typedef ::std::map < ::rtl::OUString, ::connectivity::mozab::ProfileStruct* > ProfileList;
47 namespace connectivity
48 {
49     namespace mozab
50     {
51         class ProfileStruct
52         {
53         public:
54             ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
55                           const ::rtl::OUString &aProfilePath );
getProductType()56             MozillaProductType getProductType() { return product;}
getProfileName()57             ::rtl::OUString getProfileName(){ return profileName;}
58             ::rtl::OUString getProfilePath() ;
59         protected:
60             MozillaProductType product;
61             ::rtl::OUString profileName;
62             ::rtl::OUString profilePath;
63         };
64 
65         class ProductStruct
66         {
67         public:
setCurrentProfile(::rtl::OUString aProfileName)68             void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;}
69 
70             ::rtl::OUString mCurrentProfileName;
71 
72             ProfileList mProfileList;
73         };
74 
75         //Used to query profiles information
76         class ProfileAccess
77         {
78         public:
79 
80             virtual    ~ProfileAccess();
81             ProfileAccess();
82             ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
83             ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
84             ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
85             ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
86             ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
87             ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
88         protected:
89             ProductStruct m_ProductProfileList[4];
90             sal_Int32 LoadProductsInfo();
91             sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
92         };
93 
94     }
95 }
96 
97 #endif // __MNSProfileDiscover_h___
98 
99