Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef __MNSProfileDiscover_h___
21 : : #define __MNSProfileDiscover_h___
22 : :
23 : : #ifndef MINIMAL_PROFILEDISCOVER
24 : : #include "mozilla_profile_discover.h"
25 : : #endif
26 : :
27 : : #include <sal/types.h>
28 : : #include <osl/diagnose.h>
29 : : #include <osl/conditn.hxx>
30 : : #include <com/sun/star/mozilla/MozillaProductType.hpp>
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 : : #ifdef MINIMAL_PROFILEDISCOVER
56 : : const ::rtl::OUString &aProfilePath
57 : : #else
58 : : nsILocalFile * aProfilePath
59 : : #endif
60 : : );
61 : : MozillaProductType getProductType() { return product;}
62 : 0 : ::rtl::OUString getProfileName(){ return profileName;}
63 : : ::rtl::OUString getProfilePath() ;
64 : : #ifndef MINIMAL_PROFILEDISCOVER
65 : : nsILocalFile *getProfileLocal(){ return profilePath;}
66 : : #endif
67 : : protected:
68 : : MozillaProductType product;
69 : : ::rtl::OUString profileName;
70 : : #ifdef MINIMAL_PROFILEDISCOVER
71 : : ::rtl::OUString profilePath;
72 : : #else
73 : : nsCOMPtr<nsILocalFile> profilePath;
74 : : #endif
75 : : };
76 : :
77 : 0 : class ProductStruct
78 : : {
79 : : public:
80 : : void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;}
81 : :
82 : : ::rtl::OUString mCurrentProfileName;
83 : :
84 : : ProfileList mProfileList;
85 : : };
86 : :
87 : : //Used to query profiles information
88 : : class ProfileAccess
89 : : {
90 : : public:
91 : :
92 : : virtual ~ProfileAccess();
93 : : ProfileAccess();
94 : : ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
95 : : ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
96 : : ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
97 : : ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
98 : : ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
99 : : ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
100 : : protected:
101 : : ProductStruct m_ProductProfileList[4];
102 : : sal_Int32 LoadProductsInfo();
103 : : sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
104 : : #ifndef MINIMAL_PROFILEDISCOVER
105 : : //used by isProfileLocked
106 : : nsresult isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist);
107 : : nsresult isLockExist(nsILocalFile* aFile);
108 : : #endif
109 : : };
110 : :
111 : : }
112 : : }
113 : :
114 : : #endif // __MNSProfileDiscover_h___
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|