merge the formfield patch from ooo-build
[ooovba.git] / svtools / source / config / helpopt.cxx
blob4ffc9e3a91bd5af54589c05e6fc7df06b00da0ab
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: helpopt.cxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
34 #ifdef SVL_DLLIMPLEMENTATION
35 #undef SVL_DLLIMPLEMENTATION
36 #endif
37 #define SVT_DLLIMPLEMENTATION
39 #include <svtools/helpopt.hxx>
40 #include <unotools/configmgr.hxx>
41 #include <unotools/configitem.hxx>
42 #include <tools/debug.hxx>
43 #include <com/sun/star/uno/Any.hxx>
44 #include <com/sun/star/uno/Sequence.hxx>
45 #include <vcl/help.hxx>
46 #include <osl/mutex.hxx>
47 #include <comphelper/stl_types.hxx>
49 #include <rtl/logfile.hxx>
50 #include "itemholder2.hxx"
52 using namespace utl;
53 using namespace rtl;
54 using namespace com::sun::star::uno;
55 using namespace com::sun::star;
57 static SvtHelpOptions_Impl* pOptions = NULL;
58 static sal_Int32 nRefCount = 0;
60 #define EXTENDEDHELP 0
61 #define HELPTIPS 1
62 #define AGENT_ENABLED 2
63 #define AGENT_TIMEOUT 3
64 #define AGENT_RETRYLIMIT 4
65 #define LOCALE 5
66 #define SYSTEM 6
67 #define STYLESHEET 7
69 class SvtHelpOptions_Impl : public utl::ConfigItem
71 IdList* pList;
72 sal_Int32 nHelpAgentTimeoutPeriod;
73 sal_Int32 nHelpAgentRetryLimit;
74 sal_Bool bExtendedHelp;
75 sal_Bool bHelpTips;
76 sal_Bool bHelpAgentEnabled;
77 sal_Bool bWelcomeScreen;
78 String aLocale;
79 String aSystem;
80 String sHelpStyleSheet;
82 DECLARE_STL_USTRINGACCESS_MAP( sal_Int32, MapString2Int );
83 MapString2Int aURLIgnoreCounters;
84 ::osl::Mutex aIgnoreCounterSafety;
86 Sequence< OUString > GetPropertyNames();
88 public:
89 SvtHelpOptions_Impl();
91 virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
92 void Load( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aPropertyNames);
93 virtual void Commit();
95 void SetExtendedHelp( sal_Bool b ) { bExtendedHelp= b; SetModified(); }
96 sal_Bool IsExtendedHelp() const { return bExtendedHelp; }
97 void SetHelpTips( sal_Bool b ) { bHelpTips = b; SetModified(); }
98 sal_Bool IsHelpTips() const { return bHelpTips; }
100 void SetHelpAgentEnabled( sal_Bool b ) { bHelpAgentEnabled = b; SetModified(); }
101 sal_Bool IsHelpAgentEnabled() const { return bHelpAgentEnabled; }
102 void SetHelpAgentTimeoutPeriod( sal_Int32 _nSeconds ) { nHelpAgentTimeoutPeriod = _nSeconds; SetModified(); }
103 sal_Int32 GetHelpAgentTimeoutPeriod( ) const { return nHelpAgentTimeoutPeriod; }
104 void SetHelpAgentRetryLimit( sal_Int32 _nTrials ) { nHelpAgentRetryLimit = _nTrials; SetModified(); }
105 sal_Int32 GetHelpAgentRetryLimit( ) const { return nHelpAgentRetryLimit; }
107 sal_Int32 getAgentIgnoreURLCounter( const ::rtl::OUString& _rURL );
108 void decAgentIgnoreURLCounter( const ::rtl::OUString& _rURL );
109 void resetAgentIgnoreURLCounter( const ::rtl::OUString& _rURL );
110 void resetAgentIgnoreURLCounter();
112 void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); }
113 sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; }
114 IdList* GetPIStarterList() { return pList; }
115 void AddToPIStarterList( sal_Int32 nId );
116 void RemoveFromPIStarterList( sal_Int32 nId );
117 String GetLocale() const { return aLocale; }
118 String GetSystem() const { return aSystem; }
120 const String& GetHelpStyleSheet()const{return sHelpStyleSheet;}
121 void SetHelpStyleSheet(const String& rStyleSheet){sHelpStyleSheet = rStyleSheet; SetModified();}
123 static ::osl::Mutex & getInitMutex();
125 protected:
126 void implLoadURLCounters();
127 void implSaveURLCounters();
128 // to be called with aIgnoreCounterSafety locked
129 void implGetURLCounters( Sequence< ::rtl::OUString >& _rNodeNames, Sequence< Any >& _rURLs, Sequence< Any >& _rCounter );
132 Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames()
134 static const char* aPropNames[] =
136 "ExtendedTip",
137 "Tip",
138 "HelpAgent/Enabled",
139 "HelpAgent/Timeout",
140 "HelpAgent/RetryLimit",
141 "Locale",
142 "System",
143 "HelpStyleSheet",
144 // "HowTo/Show"
147 const int nCount = sizeof( aPropNames ) / sizeof( const char* );
148 Sequence< OUString > aNames( nCount );
149 OUString* pNames = aNames.getArray();
150 for ( int i = 0; i < nCount; i++ )
151 pNames[i] = OUString::createFromAscii( aPropNames[i] );
153 return aNames;
156 ::osl::Mutex & SvtHelpOptions_Impl::getInitMutex()
158 static ::osl::Mutex *pMutex = 0;
160 if( ! pMutex )
162 ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
163 if( ! pMutex )
165 static ::osl::Mutex mutex;
166 pMutex = &mutex;
169 return *pMutex;
173 // -----------------------------------------------------------------------
175 SvtHelpOptions_Impl::SvtHelpOptions_Impl()
176 : ConfigItem( OUString::createFromAscii("Office.Common/Help") )
177 , pList( 0 )
178 , bExtendedHelp( sal_False )
179 , bHelpTips( sal_True )
180 , bHelpAgentEnabled( sal_False )
181 , bWelcomeScreen( sal_False )
183 Sequence< OUString > aNames = GetPropertyNames();
184 Load( aNames );
185 EnableNotification( aNames );
186 implLoadURLCounters();
189 // -----------------------------------------------------------------------
190 static int lcl_MapPropertyName( const ::rtl::OUString rCompare,
191 const uno::Sequence< ::rtl::OUString>& aInternalPropertyNames)
193 for(int nProp = 0; nProp < aInternalPropertyNames.getLength(); ++nProp)
195 if( aInternalPropertyNames[nProp] == rCompare )
196 return nProp;
198 return -1;
201 void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rPropertyNames)
203 const uno::Sequence< ::rtl::OUString> aInternalPropertyNames( GetPropertyNames());
204 Sequence< Any > aValues = GetProperties( rPropertyNames );
205 const Any* pValues = aValues.getConstArray();
206 DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" );
207 if ( aValues.getLength() == rPropertyNames.getLength() )
209 for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ )
211 DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
212 if ( pValues[nProp].hasValue() )
214 sal_Bool bTmp = sal_Bool();
215 ::rtl::OUString aTmpStr;
216 sal_Int32 nTmpInt = 0;
217 if ( pValues[nProp] >>= bTmp )
219 switch ( lcl_MapPropertyName(rPropertyNames[nProp], aInternalPropertyNames) )
221 case EXTENDEDHELP :
222 bExtendedHelp = bTmp;
223 break;
224 case HELPTIPS :
225 bHelpTips = bTmp;
226 break;
227 case AGENT_ENABLED :
228 bHelpAgentEnabled = bTmp;
229 break;
230 default:
231 DBG_ERRORFILE( "Wrong Member!" );
232 break;
235 else if ( pValues[nProp] >>= aTmpStr )
237 switch ( nProp )
239 case LOCALE:
240 aLocale = aTmpStr;
241 break;
243 case SYSTEM:
244 aSystem = aTmpStr;
245 break;
246 case STYLESHEET :
247 sHelpStyleSheet = aTmpStr;
248 break;
249 default:
250 DBG_ERRORFILE( "Wrong Member!" );
251 break;
254 else if ( pValues[nProp] >>= nTmpInt )
256 switch ( nProp )
258 case AGENT_TIMEOUT:
259 nHelpAgentTimeoutPeriod = nTmpInt;
260 break;
262 case AGENT_RETRYLIMIT:
263 nHelpAgentRetryLimit = nTmpInt;
264 break;
266 default:
267 DBG_ERRORFILE( "Wrong Member!" );
268 break;
271 else
273 DBG_ERRORFILE( "Wrong Type!" );
277 if ( IsHelpTips() != Help::IsQuickHelpEnabled() )
278 IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
279 if ( IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
280 IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
284 // -----------------------------------------------------------------------
286 void SvtHelpOptions_Impl::implGetURLCounters( Sequence< ::rtl::OUString >& _rNodeNames, Sequence< Any >& _rURLs, Sequence< Any >& _rCounters )
288 // the ignore counters for the help agent URLs
289 const ::rtl::OUString sIgnoreListNodePath = ::rtl::OUString::createFromAscii("HelpAgent/IgnoreList");
290 const ::rtl::OUString sPathSeparator = ::rtl::OUString::createFromAscii("/");
291 const ::rtl::OUString sURLLocalPath = ::rtl::OUString::createFromAscii("/Name");
292 const ::rtl::OUString sCounterLocalPath = ::rtl::OUString::createFromAscii("/Counter");
294 // get the names of all the nodes containing ignore counters
295 // collect the node names we have to ask
296 // first get the node names of all children of HelpAgent/IgnoreList
297 _rNodeNames = GetNodeNames(sIgnoreListNodePath);
298 const ::rtl::OUString* pIgnoredURLsNodes = _rNodeNames.getConstArray();
299 const ::rtl::OUString* pIgnoredURLsNodesEnd = pIgnoredURLsNodes + _rNodeNames.getLength();
301 // then assemble the two lists (of node paths) for the URLs and the counters
302 Sequence< ::rtl::OUString > aIgnoredURLs(_rNodeNames.getLength());
303 Sequence< ::rtl::OUString > aIgnoredURLsCounter(_rNodeNames.getLength());
304 ::rtl::OUString* pIgnoredURLs = aIgnoredURLs.getArray();
305 ::rtl::OUString* pIgnoredURLsCounter = aIgnoredURLsCounter.getArray();
306 for (;pIgnoredURLsNodes != pIgnoredURLsNodesEnd; ++pIgnoredURLsNodes, ++pIgnoredURLs, ++pIgnoredURLsCounter)
308 ::rtl::OUString sLocalURLAccess = sIgnoreListNodePath;
309 sLocalURLAccess += sPathSeparator;
310 sLocalURLAccess += *pIgnoredURLsNodes;
312 // the path to the URL of this specific entry
313 *pIgnoredURLs = sLocalURLAccess;
314 *pIgnoredURLs += sURLLocalPath;
316 // the path of the counter for that URL
317 *pIgnoredURLsCounter = sLocalURLAccess;
318 *pIgnoredURLsCounter += sCounterLocalPath;
321 // now collect the values
322 _rURLs = GetProperties(aIgnoredURLs);
323 _rCounters = GetProperties(aIgnoredURLsCounter);
325 sal_Int32 nURLs = _rURLs.getLength();
326 sal_Int32 nCounters = _rCounters.getLength();
327 DBG_ASSERT(nURLs == nCounters, "SvtHelpOptions_Impl::implGetURLCounters: inconsistence while retrieving the visited URLs!");
329 // normalize in case something went wrong
330 sal_Int32 nKnownURLs = nURLs < nCounters ? nURLs : nCounters;
331 if (nURLs < nCounters)
333 _rCounters.realloc(nKnownURLs);
334 _rNodeNames.realloc(nKnownURLs);
336 else if (nURLs > nCounters)
338 _rURLs.realloc(nKnownURLs);
339 _rNodeNames.realloc(nKnownURLs);
343 // -----------------------------------------------------------------------
345 void SvtHelpOptions_Impl::implSaveURLCounters()
347 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
349 const ::rtl::OUString sIgnoreListNodePath = ::rtl::OUString::createFromAscii("HelpAgent/IgnoreList");
350 const ::rtl::OUString sPathSeparator = ::rtl::OUString::createFromAscii("/");
351 const ::rtl::OUString sURLLocalPath = ::rtl::OUString::createFromAscii("/Name");
352 const ::rtl::OUString sCounterLocalPath = ::rtl::OUString::createFromAscii("/Counter");
354 // get the current URL/counter pairs (as they're persistent at the moment)
355 Sequence< ::rtl::OUString > aNodeNames;
356 Sequence< Any > aURLs;
357 Sequence< Any > aCounters;
359 implGetURLCounters(aNodeNames, aURLs, aCounters);
360 sal_Int32 nKnownURLs = aURLs.getLength();
362 const ::rtl::OUString* pNodeNames = aNodeNames.getConstArray();
363 const Any* pURLs = aURLs.getConstArray();
364 const Any* pCounters = aCounters.getConstArray();
366 // check which of them must be deleted/modified
367 Sequence< ::rtl::OUString > aDeleteFromConfig(nKnownURLs); // names of nodes to be deleted
368 ::rtl::OUString* pDeleteFromConfig = aDeleteFromConfig.getArray();
369 ::std::set< ::rtl::OUString > aAlreadyPresent; // URLs currently persistent
371 // for modifying already existent nodes
372 Sequence< ::rtl::OUString > aNewCounterNodePaths(nKnownURLs);
373 Sequence< Any > aNewCounterValues(nKnownURLs);
374 ::rtl::OUString* pNewCounterNodePaths = aNewCounterNodePaths.getArray();
375 Any* pNewCounterValues = aNewCounterValues.getArray();
377 // temporaries needed inside the loop
378 ::rtl::OUString sCurrentURL, sCurrentURLNodeName;
380 for (sal_Int32 i=0; i<nKnownURLs; ++i, ++pNodeNames, ++pURLs, ++pCounters)
382 if (!((*pURLs) >>= sCurrentURL))
383 continue;
385 ConstMapString2IntIterator aThisURLNewCounter = aURLIgnoreCounters.find(sCurrentURL);
386 if (aURLIgnoreCounters.end() == aThisURLNewCounter)
387 { // we do not know anything about this URL anymore.
388 // -> have to removed it from the configuration later on
389 *pDeleteFromConfig = *pNodeNames;
390 ++pDeleteFromConfig;
392 else
393 { // we know this URL
394 sCurrentURLNodeName = sIgnoreListNodePath;
395 sCurrentURLNodeName += sPathSeparator;
396 sCurrentURLNodeName += *pNodeNames;
398 // -> remember this (so we don't need to add a new node for this URL later on)
399 aAlreadyPresent.insert(sCurrentURL);
401 sal_Int32 nThisURLPersistentCounter = 0;
402 (*pCounters) >>= nThisURLPersistentCounter;
404 if (aThisURLNewCounter->second != nThisURLPersistentCounter)
405 { // the counter changed
406 // -> remember the path and the new counter for the adjustment below
407 *pNewCounterNodePaths = sCurrentURLNodeName;
408 *pNewCounterNodePaths += sCounterLocalPath;
409 ++pNewCounterNodePaths;
411 (*pNewCounterValues) <<= aThisURLNewCounter->second;
412 ++pNewCounterValues;
417 // delete the nodes which are flagged so ...
418 aDeleteFromConfig.realloc(pDeleteFromConfig - aDeleteFromConfig.getArray());
419 if (0 != aDeleteFromConfig.getLength())
421 ClearNodeElements(sIgnoreListNodePath, aDeleteFromConfig);
424 // modify the nodes which need to be
425 aNewCounterNodePaths.realloc(pNewCounterNodePaths - aNewCounterNodePaths.getArray());
426 aNewCounterValues.realloc(pNewCounterValues - aNewCounterValues.getArray());
427 if (0 != aNewCounterNodePaths.getLength())
429 PutProperties(aNewCounterNodePaths, aNewCounterValues);
432 // and for the new ones ...
433 ::rtl::OUString sNewNodeName;
434 Sequence< ::rtl::OUString > aNewCounterDataNodeNames(2);
435 Sequence< Any > aNewCounterDataValues(2);
436 const ::rtl::OUString sNodeNameBase = ::rtl::OUString::createFromAscii("URL");
437 for ( ConstMapString2IntIterator aCollectNew = aURLIgnoreCounters.begin();
438 aCollectNew != aURLIgnoreCounters.end();
439 ++aCollectNew
442 if (aAlreadyPresent.end() == aAlreadyPresent.find(aCollectNew->first))
443 { // this URL is not persistent, yet
444 // -> add a new node
445 sNewNodeName = sNodeNameBase;
446 if (!getUniqueSetElementName(sIgnoreListNodePath, sNewNodeName))
448 DBG_ERRORFILE( "SvtHelpOptions_Impl::implSaveURLCounters: could not get a free name!" );
449 continue;
451 AddNode(sIgnoreListNodePath, sNewNodeName);
453 // and set the URL/counter pair
454 aNewCounterDataNodeNames[0] = sIgnoreListNodePath;
455 aNewCounterDataNodeNames[0] += sPathSeparator;
456 aNewCounterDataNodeNames[0] += sNewNodeName;
457 aNewCounterDataNodeNames[0] += sURLLocalPath;
458 aNewCounterDataValues[0] <<= aCollectNew->first;
460 aNewCounterDataNodeNames[1] = sIgnoreListNodePath;
461 aNewCounterDataNodeNames[1] += sPathSeparator;
462 aNewCounterDataNodeNames[1] += sNewNodeName;
463 aNewCounterDataNodeNames[1] += sCounterLocalPath;
464 aNewCounterDataValues[1] <<= aCollectNew->second;
466 PutProperties(aNewCounterDataNodeNames, aNewCounterDataValues);
471 // -----------------------------------------------------------------------
473 void SvtHelpOptions_Impl::implLoadURLCounters()
475 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
477 Sequence< ::rtl::OUString > aNodeNames;
478 Sequence< Any > aURLs;
479 Sequence< Any > aCounters;
481 implGetURLCounters(aNodeNames, aURLs, aCounters);
482 sal_Int32 nKnownURLs = aURLs.getLength();
484 const Any* pURLs = aURLs.getConstArray();
485 const Any* pCounters = aCounters.getConstArray();
487 ::rtl::OUString sCurrentURL;
488 sal_Int32 nCurrentCounter;
489 for (sal_Int32 i=0; i<nKnownURLs; ++i, ++pURLs, ++pCounters)
491 (*pURLs) >>= sCurrentURL;
492 nCurrentCounter = 0;
493 (*pCounters) >>= nCurrentCounter;
494 aURLIgnoreCounters[sCurrentURL] = nCurrentCounter;
498 // -----------------------------------------------------------------------
500 void SvtHelpOptions_Impl::Commit()
502 Sequence< OUString > aNames = GetPropertyNames();
503 Sequence< Any > aValues( aNames.getLength() );
504 Any* pValues = aValues.getArray();
505 for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
507 switch ( nProp )
509 case EXTENDEDHELP :
510 pValues[nProp] <<= bExtendedHelp;
511 break;
513 case HELPTIPS :
514 pValues[nProp] <<= bHelpTips;
515 break;
517 case AGENT_ENABLED :
518 pValues[nProp] <<= bHelpAgentEnabled;
519 break;
521 case AGENT_TIMEOUT:
522 pValues[nProp] <<= nHelpAgentTimeoutPeriod;
523 break;
525 case AGENT_RETRYLIMIT:
526 pValues[nProp] <<= nHelpAgentRetryLimit;
527 break;
529 case LOCALE:
530 pValues[nProp] <<= ::rtl::OUString(aLocale);
531 break;
533 case SYSTEM:
534 pValues[nProp] <<= ::rtl::OUString(aSystem);
535 break;
536 case STYLESHEET :
537 pValues[nProp] <<= ::rtl::OUString(sHelpStyleSheet);
538 break;
543 PutProperties( aNames, aValues );
545 implSaveURLCounters();
548 // -----------------------------------------------------------------------
550 void SvtHelpOptions_Impl::Notify( const Sequence<rtl::OUString>& aPropertyNames )
552 Load( aPropertyNames );
555 SvtHelpOptions::SvtHelpOptions()
557 // Global access, must be guarded (multithreading)
558 ::osl::MutexGuard aGuard( SvtHelpOptions_Impl::getInitMutex() );
559 ++nRefCount;
560 if ( !pOptions )
562 RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHelpOptions_Impl::ctor()");
563 pOptions = new SvtHelpOptions_Impl;
565 ItemHolder2::holdConfigItem(E_HELPOPTIONS);
567 pImp = pOptions;
570 // -----------------------------------------------------------------------
572 sal_Int32 SvtHelpOptions_Impl::getAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
574 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
575 ConstMapString2IntIterator aMapPos = aURLIgnoreCounters.find(_rURL);
576 if (aURLIgnoreCounters.end() == aMapPos)
577 return GetHelpAgentRetryLimit();
578 return aMapPos->second;
581 // -----------------------------------------------------------------------
583 void SvtHelpOptions_Impl::decAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
585 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
586 MapString2IntIterator aMapPos = aURLIgnoreCounters.find(_rURL);
587 if (aURLIgnoreCounters.end() == aMapPos)
588 { // nothing known about this URL 'til now
589 sal_Int32 nLimit = GetHelpAgentRetryLimit();
590 sal_Int32 nIgnoreAgain = nLimit > 0 ? nLimit - 1 : 0;
591 aURLIgnoreCounters[_rURL] = nIgnoreAgain;
593 else
595 sal_Int32& rCounter = aMapPos->second;
596 if (rCounter)
597 --rCounter;
599 SetModified();
602 // -----------------------------------------------------------------------
604 void SvtHelpOptions_Impl::resetAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
606 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
607 MapString2IntIterator aMapPos = aURLIgnoreCounters.find(_rURL);
608 if (aURLIgnoreCounters.end() != aMapPos)
610 aURLIgnoreCounters.erase(aMapPos);
611 SetModified();
615 // -----------------------------------------------------------------------
617 void SvtHelpOptions_Impl::resetAgentIgnoreURLCounter()
619 ::osl::MutexGuard aGuard(aIgnoreCounterSafety);
620 aURLIgnoreCounters.clear();
621 SetModified();
624 // -----------------------------------------------------------------------
626 SvtHelpOptions::~SvtHelpOptions()
628 // Global access, must be guarded (multithreading)
629 ::osl::MutexGuard aGuard( SvtHelpOptions_Impl::getInitMutex() );
630 if ( !--nRefCount )
632 if ( pOptions->IsModified() )
633 pOptions->Commit();
634 DELETEZ( pOptions );
638 void SvtHelpOptions::SetExtendedHelp( sal_Bool b )
640 pImp->SetExtendedHelp( b );
643 sal_Bool SvtHelpOptions::IsExtendedHelp() const
645 return pImp->IsExtendedHelp();
648 void SvtHelpOptions::SetHelpTips( sal_Bool b )
650 pImp->SetHelpTips( b );
653 sal_Bool SvtHelpOptions::IsHelpTips() const
655 return pImp->IsHelpTips();
658 // -----------------------------------------------------------------------
660 void SvtHelpOptions::SetHelpAgentRetryLimit( sal_Int32 _nTrials )
662 pImp->SetHelpAgentRetryLimit( _nTrials );
665 // -----------------------------------------------------------------------
667 sal_Int32 SvtHelpOptions::GetHelpAgentRetryLimit( ) const
669 return pImp->GetHelpAgentRetryLimit( );
672 // -----------------------------------------------------------------------
674 void SvtHelpOptions::SetHelpAgentTimeoutPeriod( sal_Int32 _nSeconds )
676 pImp->SetHelpAgentTimeoutPeriod( _nSeconds );
679 // -----------------------------------------------------------------------
681 sal_Int32 SvtHelpOptions::GetHelpAgentTimeoutPeriod( ) const
683 return pImp->GetHelpAgentTimeoutPeriod( );
686 // -----------------------------------------------------------------------
688 void SvtHelpOptions::SetHelpAgentAutoStartMode( sal_Bool b )
690 pImp->SetHelpAgentEnabled( b );
693 // -----------------------------------------------------------------------
695 sal_Bool SvtHelpOptions::IsHelpAgentAutoStartMode() const
697 return pImp->IsHelpAgentEnabled();
700 // -----------------------------------------------------------------------
702 sal_Int32 SvtHelpOptions::getAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
704 return pImp->getAgentIgnoreURLCounter( _rURL );
707 // -----------------------------------------------------------------------
709 void SvtHelpOptions::decAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
711 pImp->decAgentIgnoreURLCounter( _rURL );
714 // -----------------------------------------------------------------------
716 void SvtHelpOptions::resetAgentIgnoreURLCounter( const ::rtl::OUString& _rURL )
718 pImp->resetAgentIgnoreURLCounter( _rURL );
721 // -----------------------------------------------------------------------
723 void SvtHelpOptions::resetAgentIgnoreURLCounter()
725 pImp->resetAgentIgnoreURLCounter();
728 // -----------------------------------------------------------------------
730 void SvtHelpOptions::SetWelcomeScreen( sal_Bool b )
732 pImp->SetWelcomeScreen( b );
735 sal_Bool SvtHelpOptions::IsWelcomeScreen() const
737 return pImp->IsWelcomeScreen();
740 IdList* SvtHelpOptions::GetPIStarterList()
742 return pImp->GetPIStarterList();
745 void SvtHelpOptions::AddToPIStarterList( sal_Int32 )
749 void SvtHelpOptions::RemoveFromPIStarterList( sal_Int32 )
753 String SvtHelpOptions::GetLocale() const
755 return pImp->GetLocale();
758 String SvtHelpOptions::GetSystem() const
760 return pImp->GetSystem();
763 const String& SvtHelpOptions::GetHelpStyleSheet()const
765 return pImp->GetHelpStyleSheet();
768 void SvtHelpOptions::SetHelpStyleSheet(const String& rStyleSheet)
770 pImp->SetHelpStyleSheet(rStyleSheet);