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 
23 #ifndef INCLUDED_unotools_PATHOPTIONS_HXX
24 #define INCLUDED_unotools_PATHOPTIONS_HXX
25 
26 #include "unotools/unotoolsdllapi.h"
27 #include <tools/string.hxx>
28 #include <com/sun/star/lang/Locale.hpp>
29 #include <unotools/options.hxx>
30 
31 #define SVT_SEARCHPATH_DELIMITER      ';'
32 
33 // class SvtPathOptions --------------------------------------------------
34 
35 class SvtPathOptions_Impl;
36 class UNOTOOLS_DLLPUBLIC SvtPathOptions: public utl::detail::Options
37 {
38 private:
39 	SvtPathOptions_Impl*	pImp;
40 
41 public:
42 	enum Pathes
43 	{
44 		PATH_ADDIN,
45 		PATH_AUTOCORRECT,
46 		PATH_AUTOTEXT,
47 		PATH_BACKUP,
48 		PATH_BASIC,
49 		PATH_BITMAP,
50 		PATH_CONFIG,
51 		PATH_DICTIONARY,
52 		PATH_FAVORITES,
53 		PATH_FILTER,
54 		PATH_GALLERY,
55 		PATH_GRAPHIC,
56 		PATH_HELP,
57 		PATH_LINGUISTIC,
58 		PATH_MODULE,
59 		PATH_PALETTE,
60 		PATH_PLUGIN,
61 		PATH_STORAGE,
62 		PATH_TEMP,
63 		PATH_TEMPLATE,
64 		PATH_USERCONFIG,
65         PATH_WORK,
66         PATH_UICONFIG,
67         PATH_FINGERPRINT,
68 		PATH_COUNT // should always be the last element
69 	};
70 
71 	SvtPathOptions();
72 	virtual ~SvtPathOptions();
73 
74 	// get the pathes, not const because of using a mutex
75 	const String&	GetAddinPath() const;
76 	const String&	GetAutoCorrectPath() const;
77 	const String&	GetAutoTextPath() const;
78 	const String&	GetBackupPath() const;
79 	const String&	GetBasicPath() const;
80 	const String&	GetBitmapPath() const;
81 	const String&	GetConfigPath() const;
82 	const String&	GetDictionaryPath() const;
83 	const String&	GetFavoritesPath() const;
84 	const String&	GetFilterPath() const;
85 	const String&	GetGalleryPath() const;
86 	const String&	GetGraphicPath() const;
87 	const String&	GetHelpPath() const;
88 	const String&	GetLinguisticPath() const;
89 	const String&	GetModulePath() const;
90 	const String&	GetPalettePath() const;
91 	const String&	GetPluginPath() const;
92 	const String&	GetStoragePath() const;
93 	const String&	GetTempPath() const;
94 	const String&	GetTemplatePath() const;
95 	const String&	GetUserConfigPath() const;
96 	const String&	GetWorkPath() const;
97     const String&   GetUIConfigPath() const;
98     const String&   GetFingerprintPath() const;
99 
100     sal_Bool            IsPathReadonly(Pathes ePath)const;
101     const String&   GetPath(Pathes ePath) const;
102 
103 	// set the pathes
104 	void			SetAddinPath( const String& rPath );
105 	void			SetAutoCorrectPath( const String& rPath );
106 	void			SetAutoTextPath( const String& rPath );
107 	void			SetBackupPath( const String& rPath );
108 	void			SetBasicPath( const String& rPath );
109 	void			SetBitmapPath( const String& rPath );
110 	void			SetConfigPath( const String& rPath );
111 	void			SetDictionaryPath( const String& rPath );
112 	void			SetFavoritesPath( const String& rPath );
113 	void			SetFilterPath( const String& rPath );
114 	void			SetGalleryPath( const String& rPath );
115 	void			SetGraphicPath( const String& rPath );
116 	void			SetHelpPath( const String& rPath );
117 	void			SetLinguisticPath( const String& rPath );
118 	void			SetModulePath( const String& rPath );
119 	void			SetPalettePath( const String& rPath );
120 	void			SetPluginPath( const String& rPath );
121 	void			SetStoragePath( const String& rPath );
122 	void			SetTempPath( const String& rPath );
123 	void			SetTemplatePath( const String& rPath );
124 	void			SetUserConfigPath( const String& rPath );
125 	void			SetWorkPath( const String& rPath );
126     void            SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath );
127 
128 	String			SubstituteVariable( const String& rVar ) const;
129     String          ExpandMacros( const String& rPath ) const;
130 	String			UseVariable( const String& rVar ) const;
131 	sal_Bool		SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG );
132     ::com::sun::star::lang::Locale GetLocale() const;
133     sal_Bool        IsReadonly() const;
134 };
135 
136 #endif // #ifndef INCLUDED_unotools_PATHOPTIONS_HXX
137 
138