1b5088357SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b5088357SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b5088357SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b5088357SAndrew Rist * distributed with this work for additional information
6b5088357SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b5088357SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b5088357SAndrew Rist * "License"); you may not use this file except in compliance
9b5088357SAndrew Rist * with the License. You may obtain a copy of the License at
10b5088357SAndrew Rist *
11b5088357SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12b5088357SAndrew Rist *
13b5088357SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b5088357SAndrew Rist * software distributed under the License is distributed on an
15b5088357SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b5088357SAndrew Rist * KIND, either express or implied. See the License for the
17b5088357SAndrew Rist * specific language governing permissions and limitations
18b5088357SAndrew Rist * under the License.
19b5088357SAndrew Rist *
20b5088357SAndrew Rist *************************************************************/
21b5088357SAndrew Rist
22b5088357SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_unotools.hxx"
26cdf0e10cSrcweir #include "unotools/configmgr.hxx"
27cdf0e10cSrcweir #include "unotools/configitem.hxx"
28cdf0e10cSrcweir #include "unotools/configpathes.hxx"
29cdf0e10cSrcweir #include <unotools/processfactory.hxx>
30cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
33cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
35cdf0e10cSrcweir #include <osl/diagnose.h>
36cdf0e10cSrcweir #include <rtl/bootstrap.hxx>
37cdf0e10cSrcweir #include <rtl/instance.hxx>
38cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
39cdf0e10cSrcweir #include <rtl/strbuf.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <list>
43cdf0e10cSrcweir
44cdf0e10cSrcweir //-----------------------------------------------------------------------------
45cdf0e10cSrcweir
46cdf0e10cSrcweir using namespace utl;
47cdf0e10cSrcweir using namespace rtl;
48cdf0e10cSrcweir using namespace com::sun::star::uno;
49cdf0e10cSrcweir using namespace com::sun::star::lang;
50cdf0e10cSrcweir using namespace com::sun::star::beans;
51cdf0e10cSrcweir using namespace com::sun::star::container;
52cdf0e10cSrcweir
53cdf0e10cSrcweir #define C2U(cChar) OUString::createFromAscii(cChar)
54cdf0e10cSrcweir #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
55cdf0e10cSrcweir
56cdf0e10cSrcweir //-----------------------------------------------------------------------------
57cdf0e10cSrcweir const char* cConfigBaseURL = "/org.openoffice.";
58cdf0e10cSrcweir //const char* cConfigBaseURL = "/com.sun.star.";
59cdf0e10cSrcweir const char* cAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess";
60cdf0e10cSrcweir
61cdf0e10cSrcweir namespace
62cdf0e10cSrcweir {
63cdf0e10cSrcweir struct BrandName
64cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, BrandName > {};
65599cc5b4SOliver-Rainer Wittmann struct FullProductname
66599cc5b4SOliver-Rainer Wittmann : public rtl::Static< ::rtl::OUString, FullProductname > {};
67cdf0e10cSrcweir struct ProductVersion
68cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, ProductVersion > {};
69cdf0e10cSrcweir struct AboutBoxProductVersion
70cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {};
71cdf0e10cSrcweir struct OOOVendor
72cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, OOOVendor > {};
73cdf0e10cSrcweir struct ProductExtension
74cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, ProductExtension > {};
75cdf0e10cSrcweir struct XMLFileFormatName
76cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, XMLFileFormatName > {};
77cdf0e10cSrcweir struct XMLFileFormatVersion
78cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, XMLFileFormatVersion > {};
79cdf0e10cSrcweir struct WriterCompatibilityVersionOOo11
80cdf0e10cSrcweir : public rtl::Static< ::rtl::OUString, WriterCompatibilityVersionOOo11 > {};
81cdf0e10cSrcweir struct OpenSourceContext : public rtl::StaticWithInit< sal_Int32, OpenSourceContext >
82cdf0e10cSrcweir {
operator ()__anonb5dea0ca0111::OpenSourceContext83cdf0e10cSrcweir sal_Int32 operator() () { return sal_Int32( -1 ); }
84cdf0e10cSrcweir };
85cdf0e10cSrcweir
86cdf0e10cSrcweir }
87cdf0e10cSrcweir
88cdf0e10cSrcweir //-----------------------------------------------------------------------------
89cdf0e10cSrcweir struct ConfigItemListEntry_Impl
90cdf0e10cSrcweir {
91cdf0e10cSrcweir ConfigItem* pConfigItem;
92cdf0e10cSrcweir
ConfigItemListEntry_ImplConfigItemListEntry_Impl93cdf0e10cSrcweir ConfigItemListEntry_Impl(ConfigItem* pItem ) :
94cdf0e10cSrcweir pConfigItem(pItem){}
95cdf0e10cSrcweir };
96cdf0e10cSrcweir typedef std::list<ConfigItemListEntry_Impl> ConfigItemList;
97cdf0e10cSrcweir struct utl::ConfigMgr_Impl
98cdf0e10cSrcweir {
99cdf0e10cSrcweir ConfigItemList aItemList;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir
102cdf0e10cSrcweir /* -----------------------------28.08.00 15:35--------------------------------
103cdf0e10cSrcweir
104cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ConfigManager()105cdf0e10cSrcweir ConfigManager::ConfigManager() :
106cdf0e10cSrcweir pMgrImpl(new utl::ConfigMgr_Impl)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir GetConfigurationProvider(); // attempt to create the provider early
109cdf0e10cSrcweir }
110cdf0e10cSrcweir /* -----------------------------17.11.00 13:51--------------------------------
111cdf0e10cSrcweir
112cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ConfigManager(Reference<XMultiServiceFactory> xConfigProv)113cdf0e10cSrcweir ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) :
114cdf0e10cSrcweir xConfigurationProvider(xConfigProv),
115cdf0e10cSrcweir pMgrImpl(new utl::ConfigMgr_Impl)
116cdf0e10cSrcweir {
117cdf0e10cSrcweir }
118cdf0e10cSrcweir /* -----------------------------28.08.00 15:35--------------------------------
119cdf0e10cSrcweir
120cdf0e10cSrcweir ---------------------------------------------------------------------------*/
~ConfigManager()121cdf0e10cSrcweir ConfigManager::~ConfigManager()
122cdf0e10cSrcweir {
123cdf0e10cSrcweir //check list content -> should be empty!
124cdf0e10cSrcweir OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive");
125cdf0e10cSrcweir if(!pMgrImpl->aItemList.empty())
126cdf0e10cSrcweir {
127cdf0e10cSrcweir ConfigItemList::iterator aListIter;
128cdf0e10cSrcweir for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir ConfigItemListEntry_Impl& rEntry = *aListIter;
131cdf0e10cSrcweir rEntry.pConfigItem->ReleaseConfigMgr();
132cdf0e10cSrcweir }
133cdf0e10cSrcweir pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end());
134cdf0e10cSrcweir }
135cdf0e10cSrcweir delete pMgrImpl;
136cdf0e10cSrcweir
137cdf0e10cSrcweir }
138cdf0e10cSrcweir /* -----------------------------28.08.00 16:17--------------------------------
139cdf0e10cSrcweir
140cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetConfigurationProvider()141cdf0e10cSrcweir Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
142cdf0e10cSrcweir {
143cdf0e10cSrcweir if(!xConfigurationProvider.is())
144cdf0e10cSrcweir {
145cdf0e10cSrcweir Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
146cdf0e10cSrcweir if ( xMSF.is() )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir try
149cdf0e10cSrcweir {
150cdf0e10cSrcweir xConfigurationProvider = Reference< XMultiServiceFactory >
151cdf0e10cSrcweir (xMSF->createInstance(
152cdf0e10cSrcweir C2U("com.sun.star.configuration.ConfigurationProvider")),
153cdf0e10cSrcweir UNO_QUERY);
154cdf0e10cSrcweir }
155cdf0e10cSrcweir #ifdef DBG_UTIL
156cdf0e10cSrcweir catch(Exception& rEx)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir static sal_Bool bMessage = sal_True;
159cdf0e10cSrcweir if(bMessage)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir bMessage = sal_False;
162cdf0e10cSrcweir OString sMsg("CreateInstance with arguments exception: ");
163cdf0e10cSrcweir sMsg += OString(rEx.Message.getStr(),
164cdf0e10cSrcweir rEx.Message.getLength(),
165cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US);
166cdf0e10cSrcweir OSL_ENSURE(sal_False, sMsg.getStr());
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir #else
170cdf0e10cSrcweir catch(Exception&){}
171cdf0e10cSrcweir #endif
172cdf0e10cSrcweir }
173cdf0e10cSrcweir }
174cdf0e10cSrcweir return xConfigurationProvider;
175cdf0e10cSrcweir }
176cdf0e10cSrcweir /* -----------------------------03.12.02 -------------------------------------
177cdf0e10cSrcweir
178cdf0e10cSrcweir ---------------------------------------------------------------------------*/
179cdf0e10cSrcweir namespace
180cdf0e10cSrcweir {
181cdf0e10cSrcweir // helper to achieve exception - safe registration of a ConfigItem under construction
182cdf0e10cSrcweir class RegisterConfigItemHelper // : Noncopyable
183cdf0e10cSrcweir {
184cdf0e10cSrcweir utl::ConfigManager & rCfgMgr;
185cdf0e10cSrcweir utl::ConfigItem* pCfgItem;
186cdf0e10cSrcweir public:
RegisterConfigItemHelper(utl::ConfigManager & rMgr,utl::ConfigItem & rCfgItem)187cdf0e10cSrcweir RegisterConfigItemHelper(utl::ConfigManager & rMgr, utl::ConfigItem& rCfgItem)
188cdf0e10cSrcweir : rCfgMgr(rMgr)
189cdf0e10cSrcweir , pCfgItem(&rCfgItem)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir rCfgMgr.RegisterConfigItem(rCfgItem);
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
~RegisterConfigItemHelper()194cdf0e10cSrcweir ~RegisterConfigItemHelper()
195cdf0e10cSrcweir {
196cdf0e10cSrcweir if (pCfgItem) rCfgMgr.RemoveConfigItem(*pCfgItem);
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
keep()199cdf0e10cSrcweir void keep() { pCfgItem = 0; }
200cdf0e10cSrcweir };
201cdf0e10cSrcweir }
202cdf0e10cSrcweir /* -----------------------------12.12.00 17:19--------------------------------
203cdf0e10cSrcweir
204cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetLocalConfigurationProvider()205cdf0e10cSrcweir Reference< XMultiServiceFactory > ConfigManager::GetLocalConfigurationProvider()
206cdf0e10cSrcweir {
207cdf0e10cSrcweir return GetConfigurationProvider();
208cdf0e10cSrcweir }
209cdf0e10cSrcweir /* -----------------------------29.08.00 12:35--------------------------------
210cdf0e10cSrcweir
211cdf0e10cSrcweir ---------------------------------------------------------------------------*/
AddConfigItem(utl::ConfigItem & rCfgItem)212cdf0e10cSrcweir Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir RegisterConfigItemHelper registeredItem(*this,rCfgItem);
215cdf0e10cSrcweir Reference< XHierarchicalNameAccess > xTree = AcquireTree(rCfgItem);
216cdf0e10cSrcweir registeredItem.keep();
217cdf0e10cSrcweir return xTree;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir /* -----------------------------21.06.01 12:20--------------------------------
220cdf0e10cSrcweir
221cdf0e10cSrcweir ---------------------------------------------------------------------------*/
RegisterConfigItem(utl::ConfigItem & rCfgItem)222cdf0e10cSrcweir void ConfigManager::RegisterConfigItem(utl::ConfigItem& rCfgItem)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
225cdf0e10cSrcweir #ifdef DBG_UTIL
226cdf0e10cSrcweir for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
227cdf0e10cSrcweir {
228cdf0e10cSrcweir ConfigItemListEntry_Impl& rEntry = *aListIter;
229cdf0e10cSrcweir if(rEntry.pConfigItem == &rCfgItem)
230cdf0e10cSrcweir OSL_ENSURE(sal_False, "RegisterConfigItem: already inserted!");
231cdf0e10cSrcweir }
232cdf0e10cSrcweir #endif
233cdf0e10cSrcweir pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem));
234cdf0e10cSrcweir }
235cdf0e10cSrcweir /* -----------------------------21.06.01 12:20--------------------------------
236cdf0e10cSrcweir
237cdf0e10cSrcweir ---------------------------------------------------------------------------*/
AcquireTree(utl::ConfigItem & rCfgItem)238cdf0e10cSrcweir Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& rCfgItem)
239cdf0e10cSrcweir {
240cdf0e10cSrcweir ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
241cdf0e10cSrcweir #ifdef DBG_UTIL
242cdf0e10cSrcweir sal_Bool bFound = sal_False;
243cdf0e10cSrcweir for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
244cdf0e10cSrcweir {
245cdf0e10cSrcweir ConfigItemListEntry_Impl& rEntry = *aListIter;
246cdf0e10cSrcweir if(rEntry.pConfigItem == &rCfgItem)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir bFound = sal_True;
249cdf0e10cSrcweir break;
250cdf0e10cSrcweir }
251cdf0e10cSrcweir }
252cdf0e10cSrcweir OSL_ENSURE(bFound, "AcquireTree: ConfigItem unknown!");
253cdf0e10cSrcweir #endif
254cdf0e10cSrcweir OUString sPath = C2U(cConfigBaseURL);
255cdf0e10cSrcweir sPath += rCfgItem.GetSubTreeName();
256cdf0e10cSrcweir Sequence< Any > aArgs(2);
257cdf0e10cSrcweir Any* pArgs = aArgs.getArray();
258cdf0e10cSrcweir PropertyValue aPath;
259cdf0e10cSrcweir aPath.Name = C2U("nodepath");
260cdf0e10cSrcweir aPath.Value <<= sPath;
261cdf0e10cSrcweir pArgs[0] <<= aPath;
262cdf0e10cSrcweir sal_Bool bLazy = 0 != (rCfgItem.GetMode()&CONFIG_MODE_DELAYED_UPDATE);
263cdf0e10cSrcweir PropertyValue aUpdate;
264cdf0e10cSrcweir aUpdate.Name = C2U("lazywrite");
265cdf0e10cSrcweir aUpdate.Value.setValue(&bLazy, ::getBooleanCppuType());
266cdf0e10cSrcweir pArgs[1] <<= aUpdate;
267cdf0e10cSrcweir
268cdf0e10cSrcweir // Initialize item with support for reading/writing more then one locales at same time!
269cdf0e10cSrcweir // It's neccessary for creation of a complete configuration entry without changing office locale
270cdf0e10cSrcweir // at runtime.
271cdf0e10cSrcweir if((rCfgItem.GetMode() & CONFIG_MODE_ALL_LOCALES) == CONFIG_MODE_ALL_LOCALES)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir sal_Int32 nCount = aArgs.getLength();
274cdf0e10cSrcweir aArgs.realloc(nCount+1);
275cdf0e10cSrcweir
276cdf0e10cSrcweir PropertyValue aAllLocale;
277cdf0e10cSrcweir aAllLocale.Name = C2U("locale");
278cdf0e10cSrcweir aAllLocale.Value <<= C2U("*" );
279cdf0e10cSrcweir aArgs[nCount] <<= aAllLocale;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir Reference< XMultiServiceFactory > xCfgProvider = GetConfigurationProvider();
283cdf0e10cSrcweir Reference< XInterface > xIFace;
284cdf0e10cSrcweir if(xCfgProvider.is())
285cdf0e10cSrcweir {
286cdf0e10cSrcweir try
287cdf0e10cSrcweir {
288cdf0e10cSrcweir xIFace = xCfgProvider->createInstanceWithArguments(
289cdf0e10cSrcweir C2U(cAccessSrvc),
290cdf0e10cSrcweir aArgs);
291cdf0e10cSrcweir }
292cdf0e10cSrcweir catch(Exception& rEx)
293cdf0e10cSrcweir {
294cdf0e10cSrcweir if (CONFIG_MODE_PROPAGATE_ERRORS & rCfgItem.GetMode())
295cdf0e10cSrcweir {
296cdf0e10cSrcweir OSL_TRACE("ConfigItem: Propagating creation error: %s\n",
297cdf0e10cSrcweir OUStringToOString(rEx.Message,RTL_TEXTENCODING_ASCII_US).getStr());
298cdf0e10cSrcweir
299cdf0e10cSrcweir throw;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir #ifdef DBG_UTIL
302cdf0e10cSrcweir if(0 == (CONFIG_MODE_IGNORE_ERRORS & rCfgItem.GetMode()))
303cdf0e10cSrcweir {
304cdf0e10cSrcweir OString sMsg("CreateInstance exception: ");
305cdf0e10cSrcweir sMsg += OString(rEx.Message.getStr(),
306cdf0e10cSrcweir rEx.Message.getLength(),
307cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US);
308cdf0e10cSrcweir OSL_ENSURE(sal_False, sMsg.getStr());
309cdf0e10cSrcweir }
310cdf0e10cSrcweir #endif
311cdf0e10cSrcweir }
312cdf0e10cSrcweir }
313cdf0e10cSrcweir return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY);
314cdf0e10cSrcweir }
315cdf0e10cSrcweir /* -----------------------------29.08.00 12:35--------------------------------
316cdf0e10cSrcweir
317cdf0e10cSrcweir ---------------------------------------------------------------------------*/
RemoveConfigItem(utl::ConfigItem & rCfgItem)318cdf0e10cSrcweir void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir if( !pMgrImpl->aItemList.empty() )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
323cdf0e10cSrcweir for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
324cdf0e10cSrcweir {
325cdf0e10cSrcweir ConfigItemListEntry_Impl& rEntry = *aListIter;
326cdf0e10cSrcweir if(rEntry.pConfigItem == &rCfgItem)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir pMgrImpl->aItemList.erase(aListIter);
329cdf0e10cSrcweir break;
330cdf0e10cSrcweir }
331cdf0e10cSrcweir }
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir /* -----------------------------30.08.00 15:04--------------------------------
335cdf0e10cSrcweir
336cdf0e10cSrcweir ---------------------------------------------------------------------------*/
StoreConfigItems()337cdf0e10cSrcweir void ConfigManager::StoreConfigItems()
338cdf0e10cSrcweir {
339cdf0e10cSrcweir if(!pMgrImpl->aItemList.empty())
340cdf0e10cSrcweir {
341cdf0e10cSrcweir ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
342cdf0e10cSrcweir for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
343cdf0e10cSrcweir {
344cdf0e10cSrcweir ConfigItemListEntry_Impl& rEntry = *aListIter;
345cdf0e10cSrcweir if(rEntry.pConfigItem->IsModified())
346cdf0e10cSrcweir {
347cdf0e10cSrcweir rEntry.pConfigItem->Commit();
348cdf0e10cSrcweir rEntry.pConfigItem->ClearModified();
349cdf0e10cSrcweir }
350cdf0e10cSrcweir }
351cdf0e10cSrcweir }
352cdf0e10cSrcweir }
3534879a985SPedro Giffuni ConfigManager* ConfigManager::pConfigManager = 0;
354cdf0e10cSrcweir /* -----------------------------07.09.00 11:06--------------------------------
355cdf0e10cSrcweir
356cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetConfigManager()3574879a985SPedro Giffuni ConfigManager* ConfigManager::GetConfigManager()
3584879a985SPedro Giffuni {
3594879a985SPedro Giffuni if(!pConfigManager)
3604879a985SPedro Giffuni {
3614879a985SPedro Giffuni pConfigManager = new ConfigManager();
3624879a985SPedro Giffuni }
3634879a985SPedro Giffuni return pConfigManager;
3644879a985SPedro Giffuni }
3654879a985SPedro Giffuni /* -----------------------------07.09.00 11:06--------------------------------
366cdf0e10cSrcweir
3674879a985SPedro Giffuni ---------------------------------------------------------------------------*/
RemoveConfigManager()3684879a985SPedro Giffuni void ConfigManager::RemoveConfigManager()
369cdf0e10cSrcweir {
3704879a985SPedro Giffuni if(pConfigManager)
3714879a985SPedro Giffuni {
3724879a985SPedro Giffuni delete pConfigManager;
3734879a985SPedro Giffuni pConfigManager = 0;
3744879a985SPedro Giffuni }
375cdf0e10cSrcweir }
376cdf0e10cSrcweir /* -----------------------------08.09.00 13:22--------------------------------
377cdf0e10cSrcweir
378cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetConfigBaseURL()379cdf0e10cSrcweir rtl::OUString ConfigManager::GetConfigBaseURL()
380cdf0e10cSrcweir {
381cdf0e10cSrcweir return C2U(cConfigBaseURL);
382cdf0e10cSrcweir }
383cdf0e10cSrcweir /* -----------------------------25.09.00 16:34--------------------------------
384cdf0e10cSrcweir
385cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetDirectConfigProperty(ConfigProperty eProp)386cdf0e10cSrcweir Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir switch(eProp)
389cdf0e10cSrcweir {
390cdf0e10cSrcweir case INSTALLPATH:
391cdf0e10cSrcweir OSL_ENSURE( false,
392cdf0e10cSrcweir "ConfigManager::GetDirectConfigProperty: "
393cdf0e10cSrcweir "INSTALLPATH no longer supported." );
394cdf0e10cSrcweir return Any();
395cdf0e10cSrcweir case USERINSTALLURL:
396cdf0e10cSrcweir OSL_ENSURE( false,
397cdf0e10cSrcweir "ConfigManager::GetDirectConfigProperty: "
398cdf0e10cSrcweir "USERINSTALLURL no longer supported." );
399cdf0e10cSrcweir return Any();
400cdf0e10cSrcweir case OFFICEINSTALL:
401cdf0e10cSrcweir OSL_ENSURE( false,
402cdf0e10cSrcweir "ConfigManager::GetDirectConfigProperty: "
403cdf0e10cSrcweir "OFFICEINSTALL no longer supported." );
404cdf0e10cSrcweir return Any();
405cdf0e10cSrcweir case OFFICEINSTALLURL:
406cdf0e10cSrcweir OSL_ENSURE( false,
407cdf0e10cSrcweir "ConfigManager::GetDirectConfigProperty: "
408cdf0e10cSrcweir "OFFICEINSTALLURL no longer supported." );
409cdf0e10cSrcweir return Any();
410cdf0e10cSrcweir default:
411cdf0e10cSrcweir break;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
414cdf0e10cSrcweir Any aRet;
415cdf0e10cSrcweir ::rtl::OUString &rBrandName = BrandName::get();
416cdf0e10cSrcweir if ( eProp == PRODUCTNAME && rBrandName.getLength() )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir aRet <<= rBrandName;
419cdf0e10cSrcweir return aRet;
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422599cc5b4SOliver-Rainer Wittmann ::rtl::OUString& rFullProductname = FullProductname::get();
423599cc5b4SOliver-Rainer Wittmann if ( eProp == FULLPRODUCTNAME && rFullProductname.getLength() )
424599cc5b4SOliver-Rainer Wittmann {
425599cc5b4SOliver-Rainer Wittmann aRet <<= rFullProductname;
426599cc5b4SOliver-Rainer Wittmann return aRet;
427599cc5b4SOliver-Rainer Wittmann }
428599cc5b4SOliver-Rainer Wittmann
429cdf0e10cSrcweir rtl::OUString &rProductVersion = ProductVersion::get();
430cdf0e10cSrcweir if ( eProp == PRODUCTVERSION && rProductVersion.getLength() )
431cdf0e10cSrcweir {
432cdf0e10cSrcweir aRet <<= rProductVersion;
433cdf0e10cSrcweir return aRet;
434cdf0e10cSrcweir }
435cdf0e10cSrcweir
436cdf0e10cSrcweir rtl::OUString &rAboutBoxProductVersion = AboutBoxProductVersion::get();
437cdf0e10cSrcweir if ( eProp == ABOUTBOXPRODUCTVERSION && rAboutBoxProductVersion.getLength() )
438cdf0e10cSrcweir {
439cdf0e10cSrcweir aRet <<= rAboutBoxProductVersion;
440cdf0e10cSrcweir return aRet;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir
443cdf0e10cSrcweir rtl::OUString &rOOOVendor = OOOVendor::get();
444cdf0e10cSrcweir if ( eProp == OOOVENDOR && rOOOVendor.getLength() )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir aRet <<= rOOOVendor;
447cdf0e10cSrcweir return aRet;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir
450cdf0e10cSrcweir
451cdf0e10cSrcweir rtl::OUString &rProductExtension = ProductExtension::get();
452cdf0e10cSrcweir if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir aRet <<= rProductExtension;
455cdf0e10cSrcweir return aRet;
456cdf0e10cSrcweir }
457cdf0e10cSrcweir
458cdf0e10cSrcweir rtl::OUString &rXMLFileFormatName = XMLFileFormatName::get();
459cdf0e10cSrcweir if ( eProp == PRODUCTXMLFILEFORMATNAME && rXMLFileFormatName.getLength() )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir aRet <<= rXMLFileFormatName;
462cdf0e10cSrcweir return aRet;
463cdf0e10cSrcweir }
464cdf0e10cSrcweir
465cdf0e10cSrcweir rtl::OUString &rXMLFileFormatVersion = XMLFileFormatVersion::get();
466cdf0e10cSrcweir if ( eProp == PRODUCTXMLFILEFORMATVERSION && rXMLFileFormatVersion.getLength() )
467cdf0e10cSrcweir {
468cdf0e10cSrcweir aRet <<= rXMLFileFormatVersion;
469cdf0e10cSrcweir return aRet;
470cdf0e10cSrcweir }
471cdf0e10cSrcweir
472cdf0e10cSrcweir sal_Int32 &rOpenSourceContext = OpenSourceContext::get();
473cdf0e10cSrcweir if ( eProp == OPENSOURCECONTEXT && ( rOpenSourceContext >= 0 ) )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir aRet <<= rOpenSourceContext;
476cdf0e10cSrcweir return aRet;
477cdf0e10cSrcweir }
478cdf0e10cSrcweir
479cdf0e10cSrcweir rtl::OUString &rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get();
480cdf0e10cSrcweir if ( eProp == WRITERCOMPATIBILITYVERSIONOOO11 && rWriterCompatibilityVersionOOo11.getLength() )
481cdf0e10cSrcweir {
482cdf0e10cSrcweir aRet <<= rWriterCompatibilityVersionOOo11;
483cdf0e10cSrcweir return aRet;
484cdf0e10cSrcweir }
485cdf0e10cSrcweir
486cdf0e10cSrcweir if (eProp == PRODUCTEXTENSION) {
487cdf0e10cSrcweir rtl::OUString name(
488cdf0e10cSrcweir rtl::OUString(
489cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
490*910823aeSJürgen Schmidt "${OOO_BASE_DIR}/program/edition/edition.ini")));
491cdf0e10cSrcweir rtl::Bootstrap::expandMacros(name);
492cdf0e10cSrcweir if (rtl::Bootstrap(name).getFrom(
493cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EDITIONNAME")),
494cdf0e10cSrcweir rProductExtension))
495cdf0e10cSrcweir {
496cdf0e10cSrcweir return com::sun::star::uno::Any(rProductExtension);
497cdf0e10cSrcweir }
498cdf0e10cSrcweir }
499cdf0e10cSrcweir
500cdf0e10cSrcweir OUString sPath = C2U(cConfigBaseURL);
501cdf0e10cSrcweir switch(eProp)
502cdf0e10cSrcweir {
503cdf0e10cSrcweir case LOCALE: sPath += C2U("Setup/L10N"); break;
504cdf0e10cSrcweir
505cdf0e10cSrcweir case PRODUCTNAME:
506599cc5b4SOliver-Rainer Wittmann case FULLPRODUCTNAME:
507cdf0e10cSrcweir case PRODUCTVERSION:
508cdf0e10cSrcweir case PRODUCTEXTENSION:
509cdf0e10cSrcweir case PRODUCTXMLFILEFORMATNAME :
510cdf0e10cSrcweir case PRODUCTXMLFILEFORMATVERSION:
511cdf0e10cSrcweir case OPENSOURCECONTEXT:
512cdf0e10cSrcweir case OOOVENDOR:
513cdf0e10cSrcweir case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break;
514cdf0e10cSrcweir
515cdf0e10cSrcweir case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break;
516cdf0e10cSrcweir
517cdf0e10cSrcweir case WRITERCOMPATIBILITYVERSIONOOO11:
518cdf0e10cSrcweir sPath += C2U("Office.Compatibility/WriterCompatibilityVersion"); break;
519cdf0e10cSrcweir default:
520cdf0e10cSrcweir break;
521cdf0e10cSrcweir }
522cdf0e10cSrcweir Sequence< Any > aArgs(1);
523cdf0e10cSrcweir aArgs[0] <<= sPath;
524cdf0e10cSrcweir Reference< XMultiServiceFactory > xCfgProvider = GetConfigManager()->GetConfigurationProvider();
525cdf0e10cSrcweir if(!xCfgProvider.is())
526cdf0e10cSrcweir return aRet;
527cdf0e10cSrcweir Reference< XInterface > xIFace;
528cdf0e10cSrcweir try
529cdf0e10cSrcweir {
530cdf0e10cSrcweir xIFace = xCfgProvider->createInstanceWithArguments(
531cdf0e10cSrcweir C2U(cAccessSrvc),
532cdf0e10cSrcweir aArgs);
533cdf0e10cSrcweir
534cdf0e10cSrcweir }
535cdf0e10cSrcweir catch(Exception&){}
536cdf0e10cSrcweir Reference<XNameAccess> xDirectAccess(xIFace, UNO_QUERY);
537cdf0e10cSrcweir if(xDirectAccess.is())
538cdf0e10cSrcweir {
539cdf0e10cSrcweir OUString sProperty;
540cdf0e10cSrcweir switch(eProp)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir case LOCALE: sProperty = C2U("ooLocale"); break;
543cdf0e10cSrcweir case PRODUCTNAME: sProperty = C2U("ooName"); break;
544599cc5b4SOliver-Rainer Wittmann case FULLPRODUCTNAME: sProperty = C2U("ooFullname"); break;
545cdf0e10cSrcweir case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break;
546cdf0e10cSrcweir case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break;
547cdf0e10cSrcweir case OOOVENDOR: sProperty = C2U("ooVendor"); break;
548cdf0e10cSrcweir case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break;
549cdf0e10cSrcweir case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break;
550cdf0e10cSrcweir case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break;
551cdf0e10cSrcweir case OPENSOURCECONTEXT: sProperty = C2U("ooOpenSourceContext"); break;
552cdf0e10cSrcweir case DEFAULTCURRENCY: sProperty = C2U("ooSetupCurrency"); break;
553cdf0e10cSrcweir case WRITERCOMPATIBILITYVERSIONOOO11: sProperty = C2U("OOo11"); break;
554cdf0e10cSrcweir default:
555cdf0e10cSrcweir break;
556cdf0e10cSrcweir }
557cdf0e10cSrcweir try
558cdf0e10cSrcweir {
559cdf0e10cSrcweir aRet = xDirectAccess->getByName(sProperty);
560cdf0e10cSrcweir }
561cdf0e10cSrcweir catch(Exception&)
562cdf0e10cSrcweir {
563cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
564cdf0e10cSrcweir rtl::OStringBuffer aBuf(256);
565cdf0e10cSrcweir aBuf.append( "ConfigManager::GetDirectConfigProperty: could not retrieve the property \"" );
566cdf0e10cSrcweir aBuf.append( rtl::OUStringToOString( sProperty, RTL_TEXTENCODING_ASCII_US ) );
567cdf0e10cSrcweir aBuf.append( "\" under \"" );
568cdf0e10cSrcweir aBuf.append( rtl::OUStringToOString( sPath, RTL_TEXTENCODING_ASCII_US ) );
569cdf0e10cSrcweir aBuf.append( "\" (caught an exception)!" );
570cdf0e10cSrcweir OSL_ENSURE( sal_False, aBuf.getStr() );
571cdf0e10cSrcweir #endif
572cdf0e10cSrcweir }
573cdf0e10cSrcweir }
574cdf0e10cSrcweir
575cdf0e10cSrcweir if ( eProp == PRODUCTNAME )
576cdf0e10cSrcweir aRet >>= rBrandName;
577cdf0e10cSrcweir
578cdf0e10cSrcweir if ( eProp == PRODUCTXMLFILEFORMATNAME )
579cdf0e10cSrcweir aRet >>= rXMLFileFormatName;
580cdf0e10cSrcweir
581cdf0e10cSrcweir if ( eProp == PRODUCTXMLFILEFORMATVERSION )
582cdf0e10cSrcweir aRet >>= rXMLFileFormatVersion;
583cdf0e10cSrcweir
584cdf0e10cSrcweir if ( eProp == PRODUCTVERSION )
585cdf0e10cSrcweir aRet >>= rProductVersion;
586cdf0e10cSrcweir
587cdf0e10cSrcweir if( eProp == OOOVENDOR )
588cdf0e10cSrcweir aRet >>= rOOOVendor;
589cdf0e10cSrcweir
590cdf0e10cSrcweir if ( eProp == ABOUTBOXPRODUCTVERSION )
591cdf0e10cSrcweir {
592cdf0e10cSrcweir aRet >>= rAboutBoxProductVersion;
593cdf0e10cSrcweir getBasisAboutBoxProductVersion( rAboutBoxProductVersion );
594cdf0e10cSrcweir aRet <<= rAboutBoxProductVersion;
595cdf0e10cSrcweir }
596cdf0e10cSrcweir
597cdf0e10cSrcweir if ( eProp == PRODUCTEXTENSION )
598cdf0e10cSrcweir aRet >>= rProductExtension;
599cdf0e10cSrcweir
600cdf0e10cSrcweir if ( eProp == WRITERCOMPATIBILITYVERSIONOOO11 )
601cdf0e10cSrcweir aRet >>= rWriterCompatibilityVersionOOo11;
602cdf0e10cSrcweir
603cdf0e10cSrcweir if ( eProp == OPENSOURCECONTEXT )
604cdf0e10cSrcweir aRet >>= rOpenSourceContext;
605cdf0e10cSrcweir
606cdf0e10cSrcweir return aRet;
607cdf0e10cSrcweir }
608cdf0e10cSrcweir
609cdf0e10cSrcweir /*---------------------------------------------------------------------------*/
getBasisAboutBoxProductVersion(OUString & rVersion)610cdf0e10cSrcweir void ConfigManager::getBasisAboutBoxProductVersion( OUString& rVersion )
611cdf0e10cSrcweir {
612cdf0e10cSrcweir rtl::OUString aPackageVersion = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":OOOPackageVersion}" );
613cdf0e10cSrcweir rtl::Bootstrap::expandMacros( aPackageVersion );
614cdf0e10cSrcweir
615cdf0e10cSrcweir if ( aPackageVersion.getLength() )
616cdf0e10cSrcweir {
617cdf0e10cSrcweir sal_Int32 nTokIndex = 0;
618cdf0e10cSrcweir rtl::OUString aVersionMinor = aPackageVersion.getToken( 1, '.', nTokIndex );
619cdf0e10cSrcweir rtl::OUString aVersionMicro;
620cdf0e10cSrcweir
621cdf0e10cSrcweir if ( nTokIndex > 0 )
622cdf0e10cSrcweir aVersionMicro = aPackageVersion.getToken( 0, '.', nTokIndex );
623cdf0e10cSrcweir
624cdf0e10cSrcweir if ( aVersionMinor.getLength() == 0 )
625cdf0e10cSrcweir aVersionMinor = UNISTRING( "0" );
626cdf0e10cSrcweir if ( aVersionMicro.getLength() == 0 )
627cdf0e10cSrcweir aVersionMicro = UNISTRING( "0" );
628cdf0e10cSrcweir
629cdf0e10cSrcweir sal_Int32 nIndex = rVersion.indexOf( '.' );
630cdf0e10cSrcweir if ( nIndex == -1 )
631cdf0e10cSrcweir {
632cdf0e10cSrcweir rVersion += UNISTRING( "." );
633cdf0e10cSrcweir rVersion += aVersionMinor;
634cdf0e10cSrcweir }
635cdf0e10cSrcweir else
636cdf0e10cSrcweir {
637cdf0e10cSrcweir nIndex = rVersion.indexOf( '.', nIndex+1 );
638cdf0e10cSrcweir }
639cdf0e10cSrcweir if ( nIndex == -1 )
640cdf0e10cSrcweir {
641cdf0e10cSrcweir rVersion += UNISTRING( "." );
642cdf0e10cSrcweir rVersion += aVersionMicro;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir else
645cdf0e10cSrcweir {
646cdf0e10cSrcweir rVersion = rVersion.replaceAt( nIndex+1, rVersion.getLength()-nIndex-1, aVersionMicro );
647cdf0e10cSrcweir }
648cdf0e10cSrcweir }
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir /* -----------------------------12.12.00 17:22--------------------------------
652cdf0e10cSrcweir
653cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetHierarchyAccess(const OUString & rFullPath)654cdf0e10cSrcweir Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUString& rFullPath)
655cdf0e10cSrcweir {
656cdf0e10cSrcweir Sequence< Any > aArgs(1);
657cdf0e10cSrcweir aArgs[0] <<= rFullPath;
658cdf0e10cSrcweir Reference< XMultiServiceFactory > xCfgProvider = GetLocalConfigurationProvider();
659cdf0e10cSrcweir Reference< XInterface > xIFace;
660cdf0e10cSrcweir if(xCfgProvider.is())
661cdf0e10cSrcweir {
662cdf0e10cSrcweir try
663cdf0e10cSrcweir {
664cdf0e10cSrcweir xIFace = xCfgProvider->createInstanceWithArguments(
665cdf0e10cSrcweir C2U(cAccessSrvc),
666cdf0e10cSrcweir aArgs);
667cdf0e10cSrcweir }
668cdf0e10cSrcweir #ifdef DBG_UTIL
669cdf0e10cSrcweir catch(Exception& rEx)
670cdf0e10cSrcweir {
671cdf0e10cSrcweir OString sMsg("CreateInstance exception: ");
672cdf0e10cSrcweir sMsg += OString(rEx.Message.getStr(),
673cdf0e10cSrcweir rEx.Message.getLength(),
674cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US);
675cdf0e10cSrcweir OSL_ENSURE(sal_False, sMsg.getStr());
676cdf0e10cSrcweir }
677cdf0e10cSrcweir #else
678cdf0e10cSrcweir catch(Exception&){}
679cdf0e10cSrcweir #endif
680cdf0e10cSrcweir }
681cdf0e10cSrcweir return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY);
682cdf0e10cSrcweir }
683cdf0e10cSrcweir /* -----------------------------12.12.00 17:17--------------------------------
684cdf0e10cSrcweir
685cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetLocalProperty(const OUString & rProperty)686cdf0e10cSrcweir Any ConfigManager::GetLocalProperty(const OUString& rProperty)
687cdf0e10cSrcweir {
688cdf0e10cSrcweir OUString sPath = C2U(cConfigBaseURL);
689cdf0e10cSrcweir sPath += rProperty;
690cdf0e10cSrcweir
691cdf0e10cSrcweir OUString sNode, sProperty;
692cdf0e10cSrcweir OSL_VERIFY( splitLastFromConfigurationPath(sPath, sNode, sProperty) );
693cdf0e10cSrcweir
694cdf0e10cSrcweir Reference< XNameAccess> xAccess( GetHierarchyAccess(sNode), UNO_QUERY );
695cdf0e10cSrcweir Any aRet;
696cdf0e10cSrcweir try
697cdf0e10cSrcweir {
698cdf0e10cSrcweir if(xAccess.is())
699cdf0e10cSrcweir aRet = xAccess->getByName(sProperty);
700cdf0e10cSrcweir }
701cdf0e10cSrcweir #ifdef DBG_UTIL
702cdf0e10cSrcweir catch(Exception& rEx)
703cdf0e10cSrcweir {
704cdf0e10cSrcweir OString sMsg("GetLocalProperty: ");
705cdf0e10cSrcweir sMsg += OString(rEx.Message.getStr(),
706cdf0e10cSrcweir rEx.Message.getLength(),
707cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US);
708cdf0e10cSrcweir OSL_ENSURE(sal_False, sMsg.getStr());
709cdf0e10cSrcweir }
710cdf0e10cSrcweir #else
711cdf0e10cSrcweir catch(Exception&){}
712cdf0e10cSrcweir #endif
713cdf0e10cSrcweir return aRet;
714cdf0e10cSrcweir }
715cdf0e10cSrcweir /* -----------------------------12.12.00 17:17--------------------------------
716cdf0e10cSrcweir
717cdf0e10cSrcweir ---------------------------------------------------------------------------*/
PutLocalProperty(const OUString & rProperty,const Any & rValue)718cdf0e10cSrcweir void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValue)
719cdf0e10cSrcweir {
720cdf0e10cSrcweir OUString sPath = C2U(cConfigBaseURL);
721cdf0e10cSrcweir sPath += rProperty;
722cdf0e10cSrcweir
723cdf0e10cSrcweir OUString sNode, sProperty;
724cdf0e10cSrcweir OSL_VERIFY( splitLastFromConfigurationPath(sPath, sNode, sProperty) );
725cdf0e10cSrcweir
726cdf0e10cSrcweir Reference<XNameReplace> xNodeReplace(GetHierarchyAccess(sNode), UNO_QUERY);
727cdf0e10cSrcweir if(xNodeReplace.is())
728cdf0e10cSrcweir {
729cdf0e10cSrcweir try
730cdf0e10cSrcweir {
731cdf0e10cSrcweir xNodeReplace->replaceByName(sProperty, rValue);
732cdf0e10cSrcweir }
733cdf0e10cSrcweir #ifdef DBG_UTIL
734cdf0e10cSrcweir catch(Exception& rEx)
735cdf0e10cSrcweir {
736cdf0e10cSrcweir OString sMsg("PutLocalProperty: ");
737cdf0e10cSrcweir sMsg += OString(rEx.Message.getStr(),
738cdf0e10cSrcweir rEx.Message.getLength(),
739cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US);
740cdf0e10cSrcweir OSL_ENSURE(sal_False, sMsg.getStr());
741cdf0e10cSrcweir }
742cdf0e10cSrcweir #else
743cdf0e10cSrcweir catch(Exception& ){}
744cdf0e10cSrcweir #endif
745cdf0e10cSrcweir }
746cdf0e10cSrcweir }
747cdf0e10cSrcweir /* -----------------------------13.12.00 08:47--------------------------------
748cdf0e10cSrcweir
749cdf0e10cSrcweir ---------------------------------------------------------------------------*/
IsLocalConfigProvider()750cdf0e10cSrcweir sal_Bool ConfigManager::IsLocalConfigProvider()
751cdf0e10cSrcweir {
752cdf0e10cSrcweir return false;
753cdf0e10cSrcweir }
754cdf0e10cSrcweir
755