1*b5088357SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b5088357SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b5088357SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b5088357SAndrew Rist * distributed with this work for additional information
6*b5088357SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b5088357SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b5088357SAndrew Rist * "License"); you may not use this file except in compliance
9*b5088357SAndrew Rist * with the License. You may obtain a copy of the License at
10*b5088357SAndrew Rist *
11*b5088357SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b5088357SAndrew Rist *
13*b5088357SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b5088357SAndrew Rist * software distributed under the License is distributed on an
15*b5088357SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b5088357SAndrew Rist * KIND, either express or implied. See the License for the
17*b5088357SAndrew Rist * specific language governing permissions and limitations
18*b5088357SAndrew Rist * under the License.
19*b5088357SAndrew Rist *
20*b5088357SAndrew Rist *************************************************************/
21*b5088357SAndrew Rist
22*b5088357SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_unotools.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <unotools/defaultoptions.hxx>
28cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
29cdf0e10cSrcweir #include <unotools/configitem.hxx>
30cdf0e10cSrcweir #include <unotools/configmgr.hxx>
31cdf0e10cSrcweir #include <tools/debug.hxx>
32cdf0e10cSrcweir #include <tools/resmgr.hxx>
33cdf0e10cSrcweir #include <tools/urlobj.hxx>
34cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
35cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
36cdf0e10cSrcweir #include <osl/mutex.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include <vos/process.hxx>
39cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
40cdf0e10cSrcweir #include <rtl/instance.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <itemholder1.hxx>
43cdf0e10cSrcweir
44cdf0e10cSrcweir using namespace osl;
45cdf0e10cSrcweir using namespace utl;
46cdf0e10cSrcweir using namespace rtl;
47cdf0e10cSrcweir using namespace com::sun::star::uno;
48cdf0e10cSrcweir
49cdf0e10cSrcweir // define ----------------------------------------------------------------
50cdf0e10cSrcweir
51cdf0e10cSrcweir #define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
52cdf0e10cSrcweir
53cdf0e10cSrcweir #define DEFAULTPATH__ADDIN 0
54cdf0e10cSrcweir #define DEFAULTPATH__AUTOCORRECT 1
55cdf0e10cSrcweir #define DEFAULTPATH__AUTOTEXT 2
56cdf0e10cSrcweir #define DEFAULTPATH__BACKUP 3
57cdf0e10cSrcweir #define DEFAULTPATH__BASIC 4
58cdf0e10cSrcweir #define DEFAULTPATH__BITMAP 5
59cdf0e10cSrcweir #define DEFAULTPATH__CONFIG 6
60cdf0e10cSrcweir #define DEFAULTPATH__DICTIONARY 7
61cdf0e10cSrcweir #define DEFAULTPATH__FAVORITES 8
62cdf0e10cSrcweir #define DEFAULTPATH__FILTER 9
63cdf0e10cSrcweir #define DEFAULTPATH__GALLERY 10
64cdf0e10cSrcweir #define DEFAULTPATH__GRAPHIC 11
65cdf0e10cSrcweir #define DEFAULTPATH__HELP 12
66cdf0e10cSrcweir #define DEFAULTPATH__LINGUISTIC 13
67cdf0e10cSrcweir #define DEFAULTPATH__MODULE 14
68cdf0e10cSrcweir #define DEFAULTPATH__PALETTE 15
69cdf0e10cSrcweir #define DEFAULTPATH__PLUGIN 16
70cdf0e10cSrcweir #define DEFAULTPATH__TEMP 17
71cdf0e10cSrcweir #define DEFAULTPATH__TEMPLATE 18
72cdf0e10cSrcweir #define DEFAULTPATH__USERCONFIG 19
73cdf0e10cSrcweir #define DEFAULTPATH__WORK 20
74cdf0e10cSrcweir #define DEFAULTPATH__USERDICTIONARY 21
75cdf0e10cSrcweir
76cdf0e10cSrcweir // class SvtDefaultOptions_Impl ------------------------------------------
77cdf0e10cSrcweir
78cdf0e10cSrcweir class SvtDefaultOptions_Impl : public utl::ConfigItem
79cdf0e10cSrcweir {
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir String m_aAddinPath;
82cdf0e10cSrcweir String m_aAutoCorrectPath;
83cdf0e10cSrcweir String m_aAutoTextPath;
84cdf0e10cSrcweir String m_aBackupPath;
85cdf0e10cSrcweir String m_aBasicPath;
86cdf0e10cSrcweir String m_aBitmapPath;
87cdf0e10cSrcweir String m_aConfigPath;
88cdf0e10cSrcweir String m_aDictionaryPath;
89cdf0e10cSrcweir String m_aFavoritesPath;
90cdf0e10cSrcweir String m_aFilterPath;
91cdf0e10cSrcweir String m_aGalleryPath;
92cdf0e10cSrcweir String m_aGraphicPath;
93cdf0e10cSrcweir String m_aHelpPath;
94cdf0e10cSrcweir String m_aLinguisticPath;
95cdf0e10cSrcweir String m_aModulePath;
96cdf0e10cSrcweir String m_aPalettePath;
97cdf0e10cSrcweir String m_aPluginPath;
98cdf0e10cSrcweir String m_aTempPath;
99cdf0e10cSrcweir String m_aTemplatePath;
100cdf0e10cSrcweir String m_aUserConfigPath;
101cdf0e10cSrcweir String m_aWorkPath;
102cdf0e10cSrcweir String m_aUserDictionaryPath;
103cdf0e10cSrcweir
104cdf0e10cSrcweir SvtDefaultOptions_Impl();
105cdf0e10cSrcweir
106cdf0e10cSrcweir String GetDefaultPath( sal_uInt16 nId ) const;
107cdf0e10cSrcweir virtual void Commit();
108cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
109cdf0e10cSrcweir };
110cdf0e10cSrcweir
111cdf0e10cSrcweir // global ----------------------------------------------------------------
112cdf0e10cSrcweir
113cdf0e10cSrcweir static SvtDefaultOptions_Impl* pOptions = NULL;
114cdf0e10cSrcweir static sal_Int32 nRefCount = 0;
115cdf0e10cSrcweir
116cdf0e10cSrcweir typedef String SvtDefaultOptions_Impl:: *PathStrPtr;
117cdf0e10cSrcweir
118cdf0e10cSrcweir struct PathToDefaultMapping_Impl
119cdf0e10cSrcweir {
120cdf0e10cSrcweir SvtPathOptions::Pathes _ePath;
121cdf0e10cSrcweir PathStrPtr _pDefaultPath;
122cdf0e10cSrcweir };
123cdf0e10cSrcweir
124cdf0e10cSrcweir static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] =
125cdf0e10cSrcweir {
126cdf0e10cSrcweir { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath },
127cdf0e10cSrcweir { SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath },
128cdf0e10cSrcweir { SvtPathOptions::PATH_AUTOTEXT, &SvtDefaultOptions_Impl::m_aAutoTextPath },
129cdf0e10cSrcweir { SvtPathOptions::PATH_BACKUP, &SvtDefaultOptions_Impl::m_aBackupPath },
130cdf0e10cSrcweir { SvtPathOptions::PATH_BASIC, &SvtDefaultOptions_Impl::m_aBasicPath },
131cdf0e10cSrcweir { SvtPathOptions::PATH_BITMAP, &SvtDefaultOptions_Impl::m_aBitmapPath },
132cdf0e10cSrcweir { SvtPathOptions::PATH_CONFIG, &SvtDefaultOptions_Impl::m_aConfigPath },
133cdf0e10cSrcweir { SvtPathOptions::PATH_DICTIONARY, &SvtDefaultOptions_Impl::m_aDictionaryPath },
134cdf0e10cSrcweir { SvtPathOptions::PATH_FAVORITES, &SvtDefaultOptions_Impl::m_aFavoritesPath },
135cdf0e10cSrcweir { SvtPathOptions::PATH_FILTER, &SvtDefaultOptions_Impl::m_aFilterPath },
136cdf0e10cSrcweir { SvtPathOptions::PATH_GALLERY, &SvtDefaultOptions_Impl::m_aGalleryPath },
137cdf0e10cSrcweir { SvtPathOptions::PATH_GRAPHIC, &SvtDefaultOptions_Impl::m_aGraphicPath },
138cdf0e10cSrcweir { SvtPathOptions::PATH_HELP, &SvtDefaultOptions_Impl::m_aHelpPath },
139cdf0e10cSrcweir { SvtPathOptions::PATH_LINGUISTIC, &SvtDefaultOptions_Impl::m_aLinguisticPath },
140cdf0e10cSrcweir { SvtPathOptions::PATH_MODULE, &SvtDefaultOptions_Impl::m_aModulePath },
141cdf0e10cSrcweir { SvtPathOptions::PATH_PALETTE, &SvtDefaultOptions_Impl::m_aPalettePath },
142cdf0e10cSrcweir { SvtPathOptions::PATH_PLUGIN, &SvtDefaultOptions_Impl::m_aPluginPath },
143cdf0e10cSrcweir { SvtPathOptions::PATH_TEMP, &SvtDefaultOptions_Impl::m_aTempPath },
144cdf0e10cSrcweir { SvtPathOptions::PATH_TEMPLATE, &SvtDefaultOptions_Impl::m_aTemplatePath },
145cdf0e10cSrcweir { SvtPathOptions::PATH_USERCONFIG, &SvtDefaultOptions_Impl::m_aUserConfigPath },
146cdf0e10cSrcweir { SvtPathOptions::PATH_WORK, &SvtDefaultOptions_Impl::m_aWorkPath }
147cdf0e10cSrcweir };
148cdf0e10cSrcweir
149cdf0e10cSrcweir // functions -------------------------------------------------------------
150cdf0e10cSrcweir
GetDefaultPropertyNames()151cdf0e10cSrcweir Sequence< OUString > GetDefaultPropertyNames()
152cdf0e10cSrcweir {
153cdf0e10cSrcweir static const char* aPropNames[] =
154cdf0e10cSrcweir {
155cdf0e10cSrcweir "Addin", // PATH_ADDIN
156cdf0e10cSrcweir "AutoCorrect", // PATH_AUTOCORRECT
157cdf0e10cSrcweir "AutoText", // PATH_AUTOTEXT
158cdf0e10cSrcweir "Backup", // PATH_BACKUP
159cdf0e10cSrcweir "Basic", // PATH_BASIC
160cdf0e10cSrcweir "Bitmap", // PATH_BITMAP
161cdf0e10cSrcweir "Config", // PATH_CONFIG
162cdf0e10cSrcweir "Dictionary", // PATH_DICTIONARY
163cdf0e10cSrcweir "Favorite", // PATH_FAVORITES
164cdf0e10cSrcweir "Filter", // PATH_FILTER
165cdf0e10cSrcweir "Gallery", // PATH_GALLERY
166cdf0e10cSrcweir "Graphic", // PATH_GRAPHIC
167cdf0e10cSrcweir "Help", // PATH_HELP
168cdf0e10cSrcweir "Linguistic", // PATH_LINGUISTIC
169cdf0e10cSrcweir "Module", // PATH_MODULE
170cdf0e10cSrcweir "Palette", // PATH_PALETTE
171cdf0e10cSrcweir "Plugin", // PATH_PLUGIN
172cdf0e10cSrcweir "Temp", // PATH_TEMP
173cdf0e10cSrcweir "Template", // PATH_TEMPLATE
174cdf0e10cSrcweir "UserConfig", // PATH_USERCONFIG
175cdf0e10cSrcweir "Work" // PATH_WORK
176cdf0e10cSrcweir };
177cdf0e10cSrcweir
178cdf0e10cSrcweir const int nCount = sizeof( aPropNames ) / sizeof( const char* );
179cdf0e10cSrcweir Sequence< OUString > aNames( nCount );
180cdf0e10cSrcweir OUString* pNames = aNames.getArray();
181cdf0e10cSrcweir for ( int i = 0; i < nCount; i++ )
182cdf0e10cSrcweir pNames[i] = OUString::createFromAscii( aPropNames[i] );
183cdf0e10cSrcweir
184cdf0e10cSrcweir return aNames;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir
Notify(const Sequence<rtl::OUString> &)187cdf0e10cSrcweir void SvtDefaultOptions_Impl::Notify( const Sequence< rtl::OUString >& )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir // no notification, will never be changed
190cdf0e10cSrcweir }
191cdf0e10cSrcweir
Commit()192cdf0e10cSrcweir void SvtDefaultOptions_Impl::Commit()
193cdf0e10cSrcweir {
194cdf0e10cSrcweir // will never be changed
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir // class SvtDefaultOptions_Impl ------------------------------------------
198cdf0e10cSrcweir
GetDefaultPath(sal_uInt16 nId) const199cdf0e10cSrcweir String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const
200cdf0e10cSrcweir {
201cdf0e10cSrcweir String aRet;
202cdf0e10cSrcweir sal_uInt16 nIdx = 0;
203cdf0e10cSrcweir
204cdf0e10cSrcweir while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK )
205cdf0e10cSrcweir {
206cdf0e10cSrcweir if ( nId == PathMap_Impl[nIdx]._ePath && PathMap_Impl[nIdx]._pDefaultPath )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir aRet = this->*(PathMap_Impl[nIdx]._pDefaultPath);
209cdf0e10cSrcweir if ( nId == SvtPathOptions::PATH_ADDIN ||
210cdf0e10cSrcweir nId == SvtPathOptions::PATH_FILTER ||
211cdf0e10cSrcweir nId == SvtPathOptions::PATH_HELP ||
212cdf0e10cSrcweir nId == SvtPathOptions::PATH_MODULE ||
213cdf0e10cSrcweir nId == SvtPathOptions::PATH_PLUGIN )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir String aTmp;
216cdf0e10cSrcweir ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aRet, aTmp );
217cdf0e10cSrcweir aRet = aTmp;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
220cdf0e10cSrcweir break;
221cdf0e10cSrcweir }
222cdf0e10cSrcweir ++nIdx;
223cdf0e10cSrcweir }
224cdf0e10cSrcweir
225cdf0e10cSrcweir return aRet;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir // -----------------------------------------------------------------------
229cdf0e10cSrcweir
SvtDefaultOptions_Impl()230cdf0e10cSrcweir SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( ASCII_STR("Office.Common/Path/Default") )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir /*ConfigManager* pCfgMgr =*/ ConfigManager::GetConfigManager();
233cdf0e10cSrcweir Sequence< OUString > aNames = GetDefaultPropertyNames();
234cdf0e10cSrcweir Sequence< Any > aValues = GetProperties( aNames );
235cdf0e10cSrcweir EnableNotification( aNames );
236cdf0e10cSrcweir const Any* pValues = aValues.getConstArray();
237cdf0e10cSrcweir DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
238cdf0e10cSrcweir if ( aValues.getLength() == aNames.getLength() )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir SvtPathOptions aPathOpt;
241cdf0e10cSrcweir OUString aTempStr, aFullPath;
242cdf0e10cSrcweir
243cdf0e10cSrcweir for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir if ( pValues[nProp].hasValue() )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir switch ( pValues[nProp].getValueTypeClass() )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir case ::com::sun::star::uno::TypeClass_STRING :
250cdf0e10cSrcweir {
251cdf0e10cSrcweir // multi pathes
252cdf0e10cSrcweir if ( pValues[nProp] >>= aTempStr )
253cdf0e10cSrcweir aFullPath = aPathOpt.SubstituteVariable( aTempStr );
254cdf0e10cSrcweir else
255cdf0e10cSrcweir {
256cdf0e10cSrcweir DBG_ERRORFILE( "any operator >>= failed" );
257cdf0e10cSrcweir }
258cdf0e10cSrcweir break;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir
261cdf0e10cSrcweir case ::com::sun::star::uno::TypeClass_SEQUENCE :
262cdf0e10cSrcweir {
263cdf0e10cSrcweir // single pathes
264cdf0e10cSrcweir aFullPath = OUString();
265cdf0e10cSrcweir Sequence < OUString > aList;
266cdf0e10cSrcweir if ( pValues[nProp] >>= aList )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir sal_Int32 nCount = aList.getLength();
269cdf0e10cSrcweir for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition )
270cdf0e10cSrcweir {
271cdf0e10cSrcweir aTempStr = aPathOpt.SubstituteVariable( aList[ nPosition ] );
272cdf0e10cSrcweir aFullPath += aTempStr;
273cdf0e10cSrcweir if ( nPosition < nCount-1 )
274cdf0e10cSrcweir aFullPath += OUString( RTL_CONSTASCII_USTRINGPARAM(";") );
275cdf0e10cSrcweir }
276cdf0e10cSrcweir }
277cdf0e10cSrcweir else
278cdf0e10cSrcweir {
279cdf0e10cSrcweir DBG_ERRORFILE( "any operator >>= failed" );
280cdf0e10cSrcweir }
281cdf0e10cSrcweir break;
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
284cdf0e10cSrcweir default:
285cdf0e10cSrcweir {
286cdf0e10cSrcweir DBG_ERRORFILE( "Wrong any type" );
287cdf0e10cSrcweir }
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
290cdf0e10cSrcweir switch ( nProp )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir case DEFAULTPATH__ADDIN: m_aAddinPath = String( aFullPath ); break;
293cdf0e10cSrcweir case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = String( aFullPath ); break;
294cdf0e10cSrcweir case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = String( aFullPath ); break;
295cdf0e10cSrcweir case DEFAULTPATH__BACKUP: m_aBackupPath = String( aFullPath ); break;
296cdf0e10cSrcweir case DEFAULTPATH__BASIC: m_aBasicPath = String( aFullPath ); break;
297cdf0e10cSrcweir case DEFAULTPATH__BITMAP: m_aBitmapPath = String( aFullPath ); break;
298cdf0e10cSrcweir case DEFAULTPATH__CONFIG: m_aConfigPath = String( aFullPath ); break;
299cdf0e10cSrcweir case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = String( aFullPath ); break;
300cdf0e10cSrcweir case DEFAULTPATH__FAVORITES: m_aFavoritesPath = String( aFullPath ); break;
301cdf0e10cSrcweir case DEFAULTPATH__FILTER: m_aFilterPath = String( aFullPath ); break;
302cdf0e10cSrcweir case DEFAULTPATH__GALLERY: m_aGalleryPath = String( aFullPath ); break;
303cdf0e10cSrcweir case DEFAULTPATH__GRAPHIC: m_aGraphicPath = String( aFullPath ); break;
304cdf0e10cSrcweir case DEFAULTPATH__HELP: m_aHelpPath = String( aFullPath ); break;
305cdf0e10cSrcweir case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = String( aFullPath ); break;
306cdf0e10cSrcweir case DEFAULTPATH__MODULE: m_aModulePath = String( aFullPath ); break;
307cdf0e10cSrcweir case DEFAULTPATH__PALETTE: m_aPalettePath = String( aFullPath ); break;
308cdf0e10cSrcweir case DEFAULTPATH__PLUGIN: m_aPluginPath = String( aFullPath ); break;
309cdf0e10cSrcweir case DEFAULTPATH__TEMP: m_aTempPath = String( aFullPath ); break;
310cdf0e10cSrcweir case DEFAULTPATH__TEMPLATE: m_aTemplatePath = String( aFullPath ); break;
311cdf0e10cSrcweir case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = String( aFullPath ); break;
312cdf0e10cSrcweir case DEFAULTPATH__WORK: m_aWorkPath = String( aFullPath ); break;
313cdf0e10cSrcweir case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = String( aFullPath );break;
314cdf0e10cSrcweir
315cdf0e10cSrcweir default:
316cdf0e10cSrcweir DBG_ERRORFILE( "invalid index to load a default path" );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir }
319cdf0e10cSrcweir }
320cdf0e10cSrcweir }
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
323cdf0e10cSrcweir // class SvtDefaultOptions -----------------------------------------------
324cdf0e10cSrcweir namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
325cdf0e10cSrcweir
SvtDefaultOptions()326cdf0e10cSrcweir SvtDefaultOptions::SvtDefaultOptions()
327cdf0e10cSrcweir {
328cdf0e10cSrcweir // Global access, must be guarded (multithreading)
329cdf0e10cSrcweir ::osl::MutexGuard aGuard( lclMutex::get() );
330cdf0e10cSrcweir if ( !pOptions )
331cdf0e10cSrcweir {
332cdf0e10cSrcweir pOptions = new SvtDefaultOptions_Impl;
333cdf0e10cSrcweir ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS);
334cdf0e10cSrcweir }
335cdf0e10cSrcweir ++nRefCount;
336cdf0e10cSrcweir pImp = pOptions;
337cdf0e10cSrcweir }
338cdf0e10cSrcweir
339cdf0e10cSrcweir // -----------------------------------------------------------------------
340cdf0e10cSrcweir
~SvtDefaultOptions()341cdf0e10cSrcweir SvtDefaultOptions::~SvtDefaultOptions()
342cdf0e10cSrcweir {
343cdf0e10cSrcweir // Global access, must be guarded (multithreading)
344cdf0e10cSrcweir ::osl::MutexGuard aGuard( lclMutex::get() );
345cdf0e10cSrcweir if ( !--nRefCount )
346cdf0e10cSrcweir {
347cdf0e10cSrcweir if ( pOptions->IsModified() )
348cdf0e10cSrcweir pOptions->Commit();
349cdf0e10cSrcweir DELETEZ( pOptions );
350cdf0e10cSrcweir }
351cdf0e10cSrcweir }
352cdf0e10cSrcweir
353cdf0e10cSrcweir // -----------------------------------------------------------------------
354cdf0e10cSrcweir
GetDefaultPath(sal_uInt16 nId) const355cdf0e10cSrcweir String SvtDefaultOptions::GetDefaultPath( sal_uInt16 nId ) const
356cdf0e10cSrcweir {
357cdf0e10cSrcweir return pImp->GetDefaultPath( nId );
358cdf0e10cSrcweir }
359cdf0e10cSrcweir
360