xref: /trunk/main/unotools/source/config/internaloptions.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_unotools.hxx"
30 #ifndef GCC
31 #endif
32 
33 //_________________________________________________________________________________________________________________
34 //  includes
35 //_________________________________________________________________________________________________________________
36 
37 #include <deque>
38 
39 #include <unotools/internaloptions.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 <com/sun/star/beans/PropertyValue.hpp>
46 
47 #include <rtl/logfile.hxx>
48 #include "itemholder1.hxx"
49 
50 //_________________________________________________________________________________________________________________
51 //  namespaces
52 //_________________________________________________________________________________________________________________
53 
54 using namespace ::utl                   ;
55 using namespace ::rtl                   ;
56 using namespace ::osl                   ;
57 using namespace ::std                   ;
58 using namespace ::com::sun::star::uno   ;
59 using namespace ::com::sun::star::beans ;
60 
61 //_________________________________________________________________________________________________________________
62 //  const
63 //_________________________________________________________________________________________________________________
64 
65 #define ROOTNODE_INTERNAL                   OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Internal"   ))
66 #define DEFAULT_SLOTCFG                     sal_False
67 #define DEFAULT_SENDCRASHMAIL               sal_False
68 #define DEFAULT_USEMAILUI                   sal_True
69 #define DEFAULT_CURRENTTEMPURL              OUString(RTL_CONSTASCII_USTRINGPARAM(""))
70 
71 #define FIXPROPERTYNAME_SLOTCFG             OUString(RTL_CONSTASCII_USTRINGPARAM("Slot"                     ))
72 #define FIXPROPERTYNAME_SENDCRASHMAIL       OUString(RTL_CONSTASCII_USTRINGPARAM("SendCrashMail"            ))
73 #define FIXPROPERTYNAME_USEMAILUI           OUString(RTL_CONSTASCII_USTRINGPARAM("UseMailUI"                ))
74 #define FIXPROPERTYNAME_CURRENTTEMPURL      OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentTempURL"           ))
75 //#define FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE           OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryClose"))
76 //#define FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP    OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryBackToWebtop"))
77 //#define FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP       OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryNewWebtop"))
78 //#define FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT          OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryLogout"))
79 
80 #define FIXPROPERTYHANDLE_SLOTCFG           0
81 #define FIXPROPERTYHANDLE_SENDCRASHMAIL     1
82 #define FIXPROPERTYHANDLE_USEMAILUI         2
83 #define FIXPROPERTYHANDLE_CURRENTTEMPURL    3
84 //#define FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE   3
85 //#define FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP         4
86 //#define FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP         5
87 //#define FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT         6
88 
89 #define FIXPROPERTYCOUNT                    4
90 /*
91 #define PROPERTYNAME_RECOVERYLIST           OUString(RTL_CONSTASCII_USTRINGPARAM("RecoveryList"             ))
92 #define PROPERTYNAME_URL                    OUString(RTL_CONSTASCII_USTRINGPARAM("OrgURL"                   ))
93 #define PROPERTYNAME_FILTER                 OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName"               ))
94 #define PROPERTYNAME_TEMPNAME               OUString(RTL_CONSTASCII_USTRINGPARAM("TempURL"                  ))
95 
96 #define OFFSET_URL                          0
97 #define OFFSET_FILTER                       1
98 #define OFFSET_TEMPNAME                     2
99 */
100 #define PATHDELIMITER                       OUString(RTL_CONSTASCII_USTRINGPARAM("/"                        ))
101 #define FIXR                                OUString(RTL_CONSTASCII_USTRINGPARAM("r"                        ))
102 
103 //_________________________________________________________________________________________________________________
104 //  private declarations!
105 //_________________________________________________________________________________________________________________
106 /*
107 struct tIMPL_RecoveryEntry
108 {
109     OUString    sURL        ;
110     OUString    sFilter     ;
111     OUString    sTempName   ;
112 
113     tIMPL_RecoveryEntry()
114     {
115         sURL        =   OUString();
116         sFilter     =   OUString();
117         sTempName   =   OUString();
118     }
119 
120     tIMPL_RecoveryEntry(    const   OUString&   sNewURL         ,
121                             const   OUString&   sNewFilter      ,
122                             const   OUString&   sNewTempName    )
123     {
124         sURL        =   sNewURL         ;
125         sFilter     =   sNewFilter      ;
126         sTempName   =   sNewTempName    ;
127     }
128 };
129 
130 typedef deque< tIMPL_RecoveryEntry > tIMPL_RecoveryStack;
131 */
132 class SvtInternalOptions_Impl : public ConfigItem
133 {
134     //-------------------------------------------------------------------------------------------------------------
135     //  private member
136     //-------------------------------------------------------------------------------------------------------------
137 
138     private:
139 
140         sal_Bool                m_bRemoveMenuEntryClose;
141         sal_Bool                m_bRemoveMenuEntryBackToWebtop;
142         sal_Bool                m_bRemoveMenuEntryNewWebtop;
143         sal_Bool                m_bRemoveMenuEntryLogout;
144         sal_Bool                m_bSlotCFG          ;   /// cache "Slot" of Internal section
145         sal_Bool                m_bSendCrashMail    ;   /// cache "SendCrashMail" of Internal section
146         sal_Bool                m_bUseMailUI;
147         OUString                m_aCurrentTempURL   ;
148     //  tIMPL_RecoveryStack     m_aRecoveryList     ;   /// cache "RecoveryList" of Internal section
149     //-------------------------------------------------------------------------------------------------------------
150     //  public methods
151     //-------------------------------------------------------------------------------------------------------------
152 
153     public:
154 
155         //---------------------------------------------------------------------------------------------------------
156         //  constructor / destructor
157         //---------------------------------------------------------------------------------------------------------
158 
159          SvtInternalOptions_Impl();
160         ~SvtInternalOptions_Impl();
161 
162         //---------------------------------------------------------------------------------------------------------
163         //  overloaded methods of baseclass
164         //---------------------------------------------------------------------------------------------------------
165 
166         /*-****************************************************************************************************//**
167             @short      called for notify of configmanager
168             @descr      These method is called from the ConfigManager before application ends or from the
169                         PropertyChangeListener if the sub tree broadcasts changes. You must update your
170                         internal values.
171 
172             @seealso    baseclass ConfigItem
173 
174             @param      "seqPropertyNames" is the list of properties which should be updated.
175             @return     -
176 
177             @onerror    -
178         *//*-*****************************************************************************************************/
179 
180         virtual void Notify( const Sequence< OUString >& )
181         {
182             DBG_ASSERT( sal_False, "SvtInternalOptions::Notify()\nNot used yet ... but called!?\n" );
183         }
184 
185         /*-****************************************************************************************************//**
186             @short      write changes to configuration
187             @descr      These method writes the changed values into the sub tree
188                         and should always called in our destructor to guarantee consistency of config data.
189 
190             @seealso    baseclass ConfigItem
191 
192             @param      -
193             @return     -
194 
195             @onerror    -
196         *//*-*****************************************************************************************************/
197 
198         virtual void Commit();
199 
200         //---------------------------------------------------------------------------------------------------------
201         //  public interface
202         //---------------------------------------------------------------------------------------------------------
203 
204         /*-****************************************************************************************************//**
205             @short      access method to get internal values
206             @descr      These method give us a chance to regulate acces to ouer internal values.
207                         It's not used in the moment - but it's possible for the feature!
208 
209             @seealso    -
210 
211             @param      -
212             @return     -
213 
214             @onerror    -
215         *//*-*****************************************************************************************************/
216 
217         sal_Bool    IsRemoveMenuEntryClose() const { return m_bRemoveMenuEntryClose; }
218         sal_Bool    IsRemoveMenuEntryBackToWebtop() const { return m_bRemoveMenuEntryBackToWebtop; }
219         sal_Bool    IsRemoveMenuEntryNewWebtop() const { return m_bRemoveMenuEntryNewWebtop; }
220         sal_Bool    IsRemoveMenuEntryLogout() const { return m_bRemoveMenuEntryLogout; }
221         sal_Bool    SlotCFGEnabled      () const { return m_bSlotCFG; }
222         sal_Bool    CrashMailEnabled    () const { return m_bSendCrashMail; }
223         sal_Bool    MailUIEnabled       () const { return m_bUseMailUI; }
224 
225         OUString    GetCurrentTempURL() const { return m_aCurrentTempURL; }
226         void        SetCurrentTempURL( const OUString& aNewCurrentTempURL );
227 /*
228         void        PushRecoveryItem    (   const   OUString&   sURL        ,
229                                             const   OUString&   sFilter     ,
230                                             const   OUString&   sTempName   );
231         void        PopRecoveryItem     (           OUString&   sURL        ,
232                                                     OUString&   sFilter     ,
233                                                     OUString&   sTempName   );
234         sal_Bool    IsRecoveryListEmpty (                                   ) const;
235 */
236     //-------------------------------------------------------------------------------------------------------------
237     //  private methods
238     //-------------------------------------------------------------------------------------------------------------
239 
240     private:
241 
242         /*-****************************************************************************************************//**
243             @short      return list of fix key names of ouer configuration management which represent oue module tree
244             @descr      These methods return a static const list of key names. We need it to get needed values from our
245                         configuration management. We return well known key names only - because the "UserData" node
246                         is handled in a special way!
247 
248             @seealso    -
249 
250             @param      -
251             @return     A list of needed configuration keys is returned.
252 
253             @onerror    -
254         *//*-*****************************************************************************************************/
255 
256         Sequence< OUString > impl_GetPropertyNames();
257 };
258 
259 //_________________________________________________________________________________________________________________
260 //  definitions
261 //_________________________________________________________________________________________________________________
262 
263 //*****************************************************************************************************************
264 //  constructor
265 //*****************************************************************************************************************
266 SvtInternalOptions_Impl::SvtInternalOptions_Impl()
267     // Init baseclasses first
268     :   ConfigItem          ( ROOTNODE_INTERNAL, CONFIG_MODE_IMMEDIATE_UPDATE )
269     // Init member then.
270     , m_bRemoveMenuEntryClose ( sal_False )
271     , m_bRemoveMenuEntryBackToWebtop ( sal_False )
272     , m_bRemoveMenuEntryNewWebtop ( sal_False )
273     , m_bRemoveMenuEntryLogout ( sal_False )
274     ,   m_bSlotCFG          ( DEFAULT_SLOTCFG           )
275     ,   m_bSendCrashMail    ( DEFAULT_SENDCRASHMAIL     )
276     ,   m_bUseMailUI        ( DEFAULT_USEMAILUI         )
277     ,   m_aCurrentTempURL   ( DEFAULT_CURRENTTEMPURL    )
278 {
279     // Use our list of configuration keys to get his values.
280     // structure of internal section: (first 2 entries are fixed - all other are member of a set!)
281     //      "Slot"
282     //      "SendCrashMail"
283     //      "RecoveryList/r1/URL"
284     //      "RecoveryList/r1/Filter"
285     //      "RecoveryList/r1/TempName"
286     //      "RecoveryList/r2/URL"
287     //      "RecoveryList/r2/Filter"
288     //      "RecoveryList/r2/TempName"
289     //      "RecoveryList/.."
290     Sequence< OUString >    seqNames    = impl_GetPropertyNames()   ;
291     Sequence< Any >         seqValues   = GetProperties( seqNames ) ;
292 
293     // Safe impossible cases.
294     // We need values from ALL configuration keys.
295     // Follow assignment use order of values in relation to our list of key names!
296     DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nI miss some values of configuration keys!\n" );
297 
298     // Read fixed values first!
299     DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass()!=TypeClass_BOOLEAN)       , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?"            );
300     DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?"   );
301     seqValues[FIXPROPERTYHANDLE_SLOTCFG         ] >>= m_bSlotCFG        ;
302     seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL   ] >>= m_bSendCrashMail  ;
303     seqValues[FIXPROPERTYHANDLE_USEMAILUI       ] >>= m_bUseMailUI  ;
304     seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL  ] >>= m_aCurrentTempURL ;
305 //    seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] >>= m_bRemoveMenuEntryClose  ;
306 //    seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] >>= m_bRemoveMenuEntryBackToWebtop  ;
307 //    seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] >>= m_bRemoveMenuEntryNewWebtop  ;
308 //    seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] >>= m_bRemoveMenuEntryLogout  ;
309 /*
310     // Read dynamical set "RecoveryList" then.
311     // 3 subkeys for every item!
312     // Attention: Start at next element after last fixed entry! We must ignore "Slot" and "SendCrashMail" ...
313     tIMPL_RecoveryEntry aEntry;
314     sal_uInt32 nCount       = seqValues.getLength() ;
315     sal_uInt32 nPosition    = FIXPROPERTYCOUNT      ;
316 
317     while( nPosition<nCount )
318     {
319         seqValues[nPosition] >>= aEntry.sURL        ;
320         ++nPosition;
321         seqValues[nPosition] >>= aEntry.sFilter     ;
322         ++nPosition;
323         seqValues[nPosition] >>= aEntry.sTempName   ;
324         ++nPosition;
325         m_aRecoveryList.push_front( aEntry );
326     }
327 */
328     // We don't need any notifications here.
329     // "Slot" and "SendCrashMail" are readonly(!) and our recovery list should not modified during runtime - it's used
330     // by our crash guard only ... otherwise we have a big problem.
331 }
332 
333 //*****************************************************************************************************************
334 //  destructor
335 //*****************************************************************************************************************
336 SvtInternalOptions_Impl::~SvtInternalOptions_Impl()
337 {
338     if( IsModified() == sal_True )
339     {
340         Commit();
341     }
342 }
343 
344 //*****************************************************************************************************************
345 //  public method
346 //*****************************************************************************************************************
347 void SvtInternalOptions_Impl::Commit()
348 {
349     // We have to write our current temp URL
350     Sequence< OUString > aNames( 1 );
351     OUString* pNames = aNames.getArray();
352     Sequence< Any > aValues( 1 );
353     Any* pValues = aValues.getArray();
354 
355     pNames[0] = FIXPROPERTYNAME_CURRENTTEMPURL;
356     pValues[0] <<= m_aCurrentTempURL;
357 
358     PutProperties( aNames, aValues );
359 
360 /*
361     // Write set of dynamic properties then.
362     ClearNodeSet( PROPERTYNAME_RECOVERYLIST );
363 
364     tIMPL_RecoveryEntry         aItem                   ;
365     OUString                    sNode                   ;
366     Sequence< PropertyValue >   seqPropertyValues( 3 )  ;   // Every node in set has 3 sub-nodes!( url, filter, tempname )
367 
368     // Copy list entries to save-list and write it to configuration.
369 
370     sal_uInt32 nCount = m_aRecoveryList.size();
371     for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
372     {
373         aItem = m_aRecoveryList.top();
374         m_aRecoveryList.pop();
375         sNode = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + FIXR + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
376         seqPropertyValues[OFFSET_URL        ].Name  =   sNode + PROPERTYNAME_URL        ;
377         seqPropertyValues[OFFSET_FILTER     ].Name  =   sNode + PROPERTYNAME_FILTER     ;
378         seqPropertyValues[OFFSET_TEMPNAME   ].Name  =   sNode + PROPERTYNAME_TEMPNAME   ;
379         seqPropertyValues[OFFSET_URL        ].Value <<= aItem.sURL                      ;
380         seqPropertyValues[OFFSET_FILTER     ].Value <<= aItem.sFilter                   ;
381         seqPropertyValues[OFFSET_TEMPNAME   ].Value <<= aItem.sTempName                 ;
382 
383         SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues );
384     }
385 
386     tIMPL_RecoveryStack::iterator iRecovery = m_aRecoveryList.begin();
387     for ( sal_uInt32 nItem=0; iRecovery != m_aRecoveryList.end(); ++nItem, ++iRecovery)
388     {
389         aItem = *iRecovery;
390         sNode = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + FIXR +
391             OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
392         seqPropertyValues[OFFSET_URL        ].Name  =   sNode + PROPERTYNAME_URL        ;
393         seqPropertyValues[OFFSET_FILTER     ].Name  =   sNode + PROPERTYNAME_FILTER     ;
394         seqPropertyValues[OFFSET_TEMPNAME   ].Name  =   sNode + PROPERTYNAME_TEMPNAME   ;
395         seqPropertyValues[OFFSET_URL        ].Value <<= iRecovery->sURL                 ;
396         seqPropertyValues[OFFSET_FILTER     ].Value <<= iRecovery->sFilter              ;
397         seqPropertyValues[OFFSET_TEMPNAME   ].Value <<= iRecovery->sTempName            ;
398         SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues );
399     }
400 
401     */
402 }
403 
404 //*****************************************************************************************************************
405 //  public method
406 //*****************************************************************************************************************
407 void SvtInternalOptions_Impl::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
408 {
409     m_aCurrentTempURL = aNewCurrentTempURL;
410     SetModified();
411     Commit();
412 }
413 
414 #if 0
415 //*****************************************************************************************************************
416 //  public method
417 //*****************************************************************************************************************
418 void SvtInternalOptions_Impl::PushRecoveryItem( const   OUString&   sURL        ,
419                                                 const   OUString&   sFilter     ,
420                                                 const   OUString&   sTempName   )
421 {
422     tIMPL_RecoveryEntry aEntry( sURL, sFilter, sTempName );
423     m_aRecoveryList.push_front( aEntry );
424     SetModified();
425 }
426 
427 //*****************************************************************************************************************
428 //  public method
429 //*****************************************************************************************************************
430 void SvtInternalOptions_Impl::PopRecoveryItem(  OUString&   sURL        ,
431                                                 OUString&   sFilter     ,
432                                                 OUString&   sTempName   )
433 {
434     tIMPL_RecoveryEntry aEntry = m_aRecoveryList.front();
435     m_aRecoveryList.pop_front();
436     SetModified();  // Don't forget it - we delete an entry here!
437     sURL        = aEntry.sURL       ;
438     sFilter     = aEntry.sFilter    ;
439     sTempName   = aEntry.sTempName  ;
440 }
441 
442 //*****************************************************************************************************************
443 //  public method
444 //*****************************************************************************************************************
445 sal_Bool SvtInternalOptions_Impl::IsRecoveryListEmpty() const
446 {
447     return ( m_aRecoveryList.empty() );
448 }
449 #endif
450 
451 //*****************************************************************************************************************
452 //  private method
453 //*****************************************************************************************************************
454 Sequence< OUString > SvtInternalOptions_Impl::impl_GetPropertyNames()
455 {
456     /*
457     // First get ALL names of current existing list items in configuration!
458     Sequence< OUString > seqRecoveryItems = GetNodeNames( PROPERTYNAME_RECOVERYLIST );
459     // Get information about list counts ...
460     sal_Int32 nRecoveryCount = seqRecoveryItems.getLength();
461     // ... and create a property list with right size! (+2...for fix properties!) (*3 ... = sub nodes for every set node!)
462     Sequence< OUString > seqProperties( FIXPROPERTYCOUNT + (nRecoveryCount*3) );
463     */
464     Sequence< OUString > seqProperties(4);
465 
466     // Add names of fix properties to list.
467     seqProperties[FIXPROPERTYHANDLE_SLOTCFG         ]   =   FIXPROPERTYNAME_SLOTCFG         ;
468     seqProperties[FIXPROPERTYHANDLE_SENDCRASHMAIL   ]   =   FIXPROPERTYNAME_SENDCRASHMAIL   ;
469     seqProperties[FIXPROPERTYHANDLE_USEMAILUI       ]   =   FIXPROPERTYNAME_USEMAILUI       ;
470     seqProperties[FIXPROPERTYHANDLE_CURRENTTEMPURL  ]   =   FIXPROPERTYNAME_CURRENTTEMPURL  ;
471 //    seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE        ]   =   FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE;
472 //    seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ]   =   FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP;
473 //    seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP    ]   =   FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP;
474 //    seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT       ]   =   FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT;
475 /*
476     sal_uInt32 nPosition = FIXPROPERTYCOUNT;
477     // Add names for recovery list to list.
478     // 3 subkeys for every item!
479     // nPosition is the start point of an list item, nItem an index into right list of node names!
480     for( sal_Int32 nItem=0; nItem<nRecoveryCount; ++nItem )
481     {
482         seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_URL       ;
483         ++nPosition;
484         seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_FILTER    ;
485         ++nPosition;
486         seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_TEMPNAME  ;
487         ++nPosition;
488     }
489 */
490     // Return result.
491     return seqProperties;
492 }
493 
494 //*****************************************************************************************************************
495 //  initialize static member
496 //  DON'T DO IT IN YOUR HEADER!
497 //  see definition for further informations
498 //*****************************************************************************************************************
499 SvtInternalOptions_Impl*    SvtInternalOptions::m_pDataContainer    = NULL  ;
500 sal_Int32                   SvtInternalOptions::m_nRefCount         = 0     ;
501 
502 //*****************************************************************************************************************
503 //  constructor
504 //*****************************************************************************************************************
505 SvtInternalOptions::SvtInternalOptions()
506 {
507     // Global access, must be guarded (multithreading!).
508     MutexGuard aGuard( GetOwnStaticMutex() );
509     // Increase ouer refcount ...
510     ++m_nRefCount;
511     // ... and initialize ouer data container only if it not already!
512     if( m_pDataContainer == NULL )
513     {
514         RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtInternalOptions_Impl::ctor()");
515         m_pDataContainer = new SvtInternalOptions_Impl();
516 
517         ItemHolder1::holdConfigItem(E_INTERNALOPTIONS);
518     }
519 }
520 
521 //*****************************************************************************************************************
522 //  destructor
523 //*****************************************************************************************************************
524 SvtInternalOptions::~SvtInternalOptions()
525 {
526     // Global access, must be guarded (multithreading!)
527     MutexGuard aGuard( GetOwnStaticMutex() );
528     // Decrease ouer refcount.
529     --m_nRefCount;
530     // If last instance was deleted ...
531     // we must destroy ouer static data container!
532     if( m_nRefCount <= 0 )
533     {
534         delete m_pDataContainer;
535         m_pDataContainer = NULL;
536     }
537 }
538 
539 //*****************************************************************************************************************
540 //  public method
541 //*****************************************************************************************************************
542 sal_Bool SvtInternalOptions::SlotCFGEnabled() const
543 {
544     MutexGuard aGuard( GetOwnStaticMutex() );
545     return m_pDataContainer->SlotCFGEnabled();
546 }
547 
548 //*****************************************************************************************************************
549 //  public method
550 //*****************************************************************************************************************
551 sal_Bool SvtInternalOptions::CrashMailEnabled() const
552 {
553     MutexGuard aGuard( GetOwnStaticMutex() );
554     return m_pDataContainer->CrashMailEnabled();
555 }
556 
557 //*****************************************************************************************************************
558 //  public method
559 //*****************************************************************************************************************
560 sal_Bool SvtInternalOptions::MailUIEnabled() const
561 {
562     MutexGuard aGuard( GetOwnStaticMutex() );
563     return m_pDataContainer->MailUIEnabled();
564 }
565 
566 //*****************************************************************************************************************
567 //  public methods
568 //*****************************************************************************************************************
569 sal_Bool SvtInternalOptions::IsRemoveMenuEntryClose() const
570 {
571     MutexGuard aGuard( GetOwnStaticMutex() );
572     return m_pDataContainer->IsRemoveMenuEntryClose();
573 }
574 
575 sal_Bool SvtInternalOptions::IsRemoveMenuEntryBackToWebtop() const
576 {
577     MutexGuard aGuard( GetOwnStaticMutex() );
578     return m_pDataContainer->IsRemoveMenuEntryBackToWebtop();
579 }
580 
581 sal_Bool SvtInternalOptions::IsRemoveMenuEntryNewWebtop() const
582 {
583     MutexGuard aGuard( GetOwnStaticMutex() );
584     return m_pDataContainer->IsRemoveMenuEntryNewWebtop();
585 }
586 
587 sal_Bool SvtInternalOptions::IsRemoveMenuEntryLogout() const
588 {
589     MutexGuard aGuard( GetOwnStaticMutex() );
590     return m_pDataContainer->IsRemoveMenuEntryLogout();
591 }
592 
593 OUString SvtInternalOptions::GetCurrentTempURL() const
594 {
595     MutexGuard aGuard( GetOwnStaticMutex() );
596     return m_pDataContainer->GetCurrentTempURL();
597 }
598 
599 void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
600 {
601     MutexGuard aGuard( GetOwnStaticMutex() );
602     m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL );
603 }
604 
605 //*****************************************************************************************************************
606 //  private method
607 //*****************************************************************************************************************
608 Mutex& SvtInternalOptions::GetOwnStaticMutex()
609 {
610     // Initialize static mutex only for one time!
611     static Mutex* pMutex = NULL;
612     // If these method first called (Mutex not already exist!) ...
613     if( pMutex == NULL )
614     {
615         // ... we must create a new one. Protect follow code with the global mutex -
616         // It must be - we create a static variable!
617         MutexGuard aGuard( Mutex::getGlobalMutex() );
618         // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
619         if( pMutex == NULL )
620         {
621             // Create the new mutex and set it for return on static variable.
622             static Mutex aMutex;
623             pMutex = &aMutex;
624         }
625     }
626     // Return new created or already existing mutex object.
627     return *pMutex;
628 }
629