update credits
[LibreOffice.git] / unotools / source / config / securityoptions.cxx
blob153004f6cdba78666327c398c6d8b60302307ddc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <unotools/securityoptions.hxx>
22 #include <unotools/configmgr.hxx>
23 #include <unotools/configitem.hxx>
24 #include <tools/debug.hxx>
25 #include <com/sun/star/uno/Any.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <comphelper/sequenceasvector.hxx>
30 #include <tools/urlobj.hxx>
31 #include <tools/wldcrd.hxx>
33 #include <unotools/pathoptions.hxx>
35 #include <rtl/logfile.hxx>
36 #include "itemholder1.hxx"
38 //_________________________________________________________________________________________________________________
39 // namespaces
40 //_________________________________________________________________________________________________________________
42 using namespace ::utl ;
43 using namespace ::rtl ;
44 using namespace ::osl ;
45 using namespace ::com::sun::star::uno ;
47 #define ROOTNODE_SECURITY OUString("Office.Common/Security/Scripting")
48 #define DEFAULT_SECUREURL Sequence< OUString >()
49 #define DEFAULT_TRUSTEDAUTHORS Sequence< SvtSecurityOptions::Certificate >()
51 // xmlsec05 deprecated
52 #define DEFAULT_STAROFFICEBASIC eALWAYS_EXECUTE
54 #define CSTR_SECUREURL "SecureURL"
55 #define CSTR_DOCWARN_SAVEORSEND "WarnSaveOrSendDoc"
56 #define CSTR_DOCWARN_SIGNING "WarnSignDoc"
57 #define CSTR_DOCWARN_PRINT "WarnPrintDoc"
58 #define CSTR_DOCWARN_CREATEPDF "WarnCreatePDF"
59 #define CSTR_DOCWARN_REMOVEPERSONALINFO "RemovePersonalInfoOnSaving"
60 #define CSTR_DOCWARN_RECOMMENDPASSWORD "RecommendPasswordProtection"
61 #define CSTR_CTRLCLICK_HYPERLINK "HyperlinksWithCtrlClick"
62 #define CSTR_MACRO_SECLEVEL "MacroSecurityLevel"
63 #define CSTR_MACRO_TRUSTEDAUTHORS "TrustedAuthors"
64 #define CSTR_MACRO_DISABLE "DisableMacrosExecution"
65 #define CSTR_TRUSTEDAUTHOR_SUBJECTNAME "SubjectName"
66 #define CSTR_TRUSTEDAUTHOR_SERIALNUMBER "SerialNumber"
67 #define CSTR_TRUSTEDAUTHOR_RAWDATA "RawData"
69 #define PROPERTYNAME_SECUREURL OUString(CSTR_SECUREURL)
70 #define PROPERTYNAME_DOCWARN_SAVEORSEND OUString(CSTR_DOCWARN_SAVEORSEND)
71 #define PROPERTYNAME_DOCWARN_SIGNING OUString(CSTR_DOCWARN_SIGNING)
72 #define PROPERTYNAME_DOCWARN_PRINT OUString(CSTR_DOCWARN_PRINT)
73 #define PROPERTYNAME_DOCWARN_CREATEPDF OUString(CSTR_DOCWARN_CREATEPDF)
74 #define PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO OUString(CSTR_DOCWARN_REMOVEPERSONALINFO)
75 #define PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD OUString(CSTR_DOCWARN_RECOMMENDPASSWORD)
76 #define PROPERTYNAME_CTRLCLICK_HYPERLINK OUString(CSTR_CTRLCLICK_HYPERLINK)
77 #define PROPERTYNAME_MACRO_SECLEVEL OUString(CSTR_MACRO_SECLEVEL)
78 #define PROPERTYNAME_MACRO_TRUSTEDAUTHORS OUString(CSTR_MACRO_TRUSTEDAUTHORS)
79 #define PROPERTYNAME_MACRO_DISABLE OUString(CSTR_MACRO_DISABLE)
80 #define PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME OUString(CSTR_TRUSTEDAUTHOR_SUBJECTNAME)
81 #define PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER OUString(CSTR_TRUSTEDAUTHOR_SERIALNUMBER)
82 #define PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA OUString(CSTR_TRUSTEDAUTHOR_RAWDATA)
84 // xmlsec05 deprecated
85 #define PROPERTYNAME_STAROFFICEBASIC OUString("OfficeBasic")
86 #define PROPERTYNAME_EXECUTEPLUGINS OUString("ExecutePlugins")
87 #define PROPERTYNAME_WARNINGENABLED OUString("Warning")
88 #define PROPERTYNAME_CONFIRMATIONENABLED OUString("Confirmation")
89 // xmlsec05 deprecated
92 #define PROPERTYHANDLE_SECUREURL 0
94 // xmlsec05 deprecated
95 #define PROPERTYHANDLE_STAROFFICEBASIC 1
96 #define PROPERTYHANDLE_EXECUTEPLUGINS 2
97 #define PROPERTYHANDLE_WARNINGENABLED 3
98 #define PROPERTYHANDLE_CONFIRMATIONENABLED 4
99 // xmlsec05 deprecated
101 #define PROPERTYHANDLE_DOCWARN_SAVEORSEND 5
102 #define PROPERTYHANDLE_DOCWARN_SIGNING 6
103 #define PROPERTYHANDLE_DOCWARN_PRINT 7
104 #define PROPERTYHANDLE_DOCWARN_CREATEPDF 8
105 #define PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO 9
106 #define PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD 10
107 #define PROPERTYHANDLE_CTRLCLICK_HYPERLINK 11
108 #define PROPERTYHANDLE_MACRO_SECLEVEL 12
109 #define PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS 13
110 #define PROPERTYHANDLE_MACRO_DISABLE 14
112 #define PROPERTYCOUNT 15
113 #define PROPERTYHANDLE_INVALID -1
115 #define CFG_READONLY_DEFAULT sal_False
117 //_________________________________________________________________________________________________________________
118 // private declarations!
119 //_________________________________________________________________________________________________________________
121 class SvtSecurityOptions_Impl : public ConfigItem
123 //-------------------------------------------------------------------------------------------------------------
124 // public methods
125 //-------------------------------------------------------------------------------------------------------------
127 public:
129 //---------------------------------------------------------------------------------------------------------
130 // constructor / destructor
131 //---------------------------------------------------------------------------------------------------------
133 SvtSecurityOptions_Impl();
134 ~SvtSecurityOptions_Impl();
136 //---------------------------------------------------------------------------------------------------------
137 // overloaded methods of baseclass
138 //---------------------------------------------------------------------------------------------------------
140 /*-****************************************************************************************************//**
141 @short called for notify of configmanager
142 @descr These method is called from the ConfigManager before application ends or from the
143 PropertyChangeListener if the sub tree broadcasts changes. You must update your
144 internal values.
146 @seealso baseclass ConfigItem
148 @param "seqPropertyNames" is the list of properties which should be updated.
149 @return -
151 @onerror -
152 *//*-*****************************************************************************************************/
154 virtual void Notify( const Sequence< OUString >& seqPropertyNames );
156 /*-****************************************************************************************************//**
157 @short write changes to configuration
158 @descr These method writes the changed values into the sub tree
159 and should always called in our destructor to guarantee consistency of config data.
161 @seealso baseclass ConfigItem
163 @param -
164 @return -
166 @onerror -
167 *//*-*****************************************************************************************************/
169 virtual void Commit();
171 //---------------------------------------------------------------------------------------------------------
172 // public interface
173 //---------------------------------------------------------------------------------------------------------
175 sal_Bool IsReadOnly ( SvtSecurityOptions::EOption eOption ) const ;
177 Sequence< OUString > GetSecureURLs ( ) const ;
178 void SetSecureURLs ( const Sequence< OUString >& seqURLList ) ;
179 sal_Bool IsSecureURL ( const OUString& sURL,
180 const OUString& sReferer ) const ;
181 inline sal_Int32 GetMacroSecurityLevel ( ) const ;
182 void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ;
184 inline sal_Bool IsMacroDisabled ( ) const ;
186 Sequence< SvtSecurityOptions::Certificate > GetTrustedAuthors ( ) const ;
187 void SetTrustedAuthors ( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) ;
189 sal_Bool IsOptionSet ( SvtSecurityOptions::EOption eOption ) const ;
190 sal_Bool SetOption ( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) ;
191 sal_Bool IsOptionEnabled ( SvtSecurityOptions::EOption eOption ) const ;
192 private:
194 /*-****************************************************************************************************//**
195 @short return list of key names of ouer configuration management which represent our module tree
196 @descr These methods return a static const list of key names. We need it to get needed values from our
197 configuration management.
199 @seealso -
201 @param -
202 @return A list of needed configuration keys is returned.
204 @onerror -
205 *//*-*****************************************************************************************************/
207 void SetProperty( sal_Int32 nHandle, const Any& rValue, sal_Bool bReadOnly );
208 void LoadAuthors( void );
209 static sal_Int32 GetHandle( const OUString& rPropertyName );
210 bool GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO );
212 static Sequence< OUString > GetPropertyNames();
214 Sequence< OUString > m_seqSecureURLs;
215 sal_Bool m_bSaveOrSend;
216 sal_Bool m_bSigning;
217 sal_Bool m_bPrint;
218 sal_Bool m_bCreatePDF;
219 sal_Bool m_bRemoveInfo;
220 sal_Bool m_bRecommendPwd;
221 sal_Bool m_bCtrlClickHyperlink;
222 sal_Int32 m_nSecLevel;
223 Sequence< SvtSecurityOptions::Certificate > m_seqTrustedAuthors;
224 sal_Bool m_bDisableMacros;
226 sal_Bool m_bROSecureURLs;
227 sal_Bool m_bROSaveOrSend;
228 sal_Bool m_bROSigning;
229 sal_Bool m_bROPrint;
230 sal_Bool m_bROCreatePDF;
231 sal_Bool m_bRORemoveInfo;
232 sal_Bool m_bRORecommendPwd;
233 sal_Bool m_bROCtrlClickHyperlink;
234 sal_Bool m_bROSecLevel;
235 sal_Bool m_bROTrustedAuthors;
236 sal_Bool m_bRODisableMacros;
239 // xmlsec05 deprecated
240 EBasicSecurityMode m_eBasicMode;
241 sal_Bool m_bExecutePlugins;
242 sal_Bool m_bWarning;
243 sal_Bool m_bConfirmation;
245 sal_Bool m_bROConfirmation;
246 sal_Bool m_bROWarning;
247 sal_Bool m_bROExecutePlugins;
248 sal_Bool m_bROBasicMode;
249 public:
250 sal_Bool IsWarningEnabled() const;
251 void SetWarningEnabled( sal_Bool bSet );
252 sal_Bool IsConfirmationEnabled() const;
253 void SetConfirmationEnabled( sal_Bool bSet );
254 sal_Bool IsExecutePlugins() const;
255 void SetExecutePlugins( sal_Bool bSet );
256 EBasicSecurityMode GetBasicMode ( ) const ;
257 void SetBasicMode ( EBasicSecurityMode eMode ) ;
260 //*****************************************************************************************************************
261 // constructor
262 //*****************************************************************************************************************
263 SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()
264 :ConfigItem ( ROOTNODE_SECURITY )
265 ,m_seqSecureURLs ( DEFAULT_SECUREURL )
266 ,m_bSaveOrSend ( sal_True )
267 ,m_bSigning ( sal_True )
268 ,m_bPrint ( sal_True )
269 ,m_bCreatePDF ( sal_True )
270 ,m_bRemoveInfo ( sal_True )
271 ,m_nSecLevel ( sal_True )
272 ,m_seqTrustedAuthors ( DEFAULT_TRUSTEDAUTHORS )
273 ,m_bDisableMacros ( sal_False )
274 ,m_bROSecureURLs ( CFG_READONLY_DEFAULT )
275 ,m_bROSaveOrSend ( CFG_READONLY_DEFAULT )
276 ,m_bROSigning ( CFG_READONLY_DEFAULT )
277 ,m_bROPrint ( CFG_READONLY_DEFAULT )
278 ,m_bROCreatePDF ( CFG_READONLY_DEFAULT )
279 ,m_bRORemoveInfo ( CFG_READONLY_DEFAULT )
280 ,m_bROSecLevel ( CFG_READONLY_DEFAULT )
281 ,m_bROTrustedAuthors ( CFG_READONLY_DEFAULT )
282 ,m_bRODisableMacros ( sal_True ) // currently is not intended to be changed
284 // xmlsec05 deprecated
285 , m_eBasicMode ( DEFAULT_STAROFFICEBASIC )
286 , m_bExecutePlugins ( sal_True )
287 , m_bWarning ( sal_True )
288 , m_bConfirmation ( sal_True )
289 , m_bROConfirmation ( CFG_READONLY_DEFAULT )
290 , m_bROWarning ( CFG_READONLY_DEFAULT )
291 , m_bROExecutePlugins ( CFG_READONLY_DEFAULT )
292 , m_bROBasicMode ( CFG_READONLY_DEFAULT )
293 // xmlsec05 deprecated
296 Sequence< OUString > seqNames = GetPropertyNames ( );
297 Sequence< Any > seqValues = GetProperties ( seqNames );
298 Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames );
300 // Safe impossible cases.
301 // We need values from ALL configuration keys.
302 // Follow assignment use order of values in relation to our list of key names!
303 DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" );
305 // Copy values from list in right order to our internal member.
306 sal_Int32 nPropertyCount = seqValues.getLength();
307 for( sal_Int32 nProperty = 0 ; nProperty < nPropertyCount ; ++nProperty )
308 SetProperty( nProperty, seqValues[ nProperty ], seqRO[ nProperty ] );
310 LoadAuthors();
312 // Enable notification mechanism of our baseclass.
313 // We need it to get information about changes outside these class on our used configuration keys!*/
315 EnableNotification( seqNames );
318 //*****************************************************************************************************************
319 // destructor
320 //*****************************************************************************************************************
321 SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl()
323 if( IsModified() )
324 Commit();
327 void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, sal_Bool bRO )
329 switch( nProperty )
331 case PROPERTYHANDLE_SECUREURL:
333 m_seqSecureURLs.realloc( 0 );
334 rValue >>= m_seqSecureURLs;
335 SvtPathOptions aOpt;
336 sal_uInt32 nCount = m_seqSecureURLs.getLength();
337 for( sal_uInt32 nItem = 0 ; nItem < nCount ; ++nItem )
338 m_seqSecureURLs[ nItem ] = aOpt.SubstituteVariable( m_seqSecureURLs[ nItem ] );
339 m_bROSecureURLs = bRO;
341 break;
343 case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
345 rValue >>= m_bSaveOrSend;
346 m_bROSaveOrSend = bRO;
348 break;
350 case PROPERTYHANDLE_DOCWARN_SIGNING:
352 rValue >>= m_bSigning;
353 m_bROSigning = bRO;
355 break;
357 case PROPERTYHANDLE_DOCWARN_PRINT:
359 rValue >>= m_bPrint;
360 m_bROPrint = bRO;
362 break;
364 case PROPERTYHANDLE_DOCWARN_CREATEPDF:
366 rValue >>= m_bCreatePDF;
367 m_bROCreatePDF = bRO;
369 break;
371 case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
373 rValue >>= m_bRemoveInfo;
374 m_bRORemoveInfo = bRO;
376 break;
378 case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
380 rValue >>= m_bRecommendPwd;
381 m_bRORecommendPwd = bRO;
383 break;
385 case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
387 rValue >>= m_bCtrlClickHyperlink;
388 m_bROCtrlClickHyperlink = bRO;
390 break;
392 case PROPERTYHANDLE_MACRO_SECLEVEL:
394 rValue >>= m_nSecLevel;
395 m_bROSecLevel = bRO;
397 break;
399 case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
401 // don't care about value here...
402 m_bROTrustedAuthors = bRO;
404 break;
406 case PROPERTYHANDLE_MACRO_DISABLE:
408 rValue >>= m_bDisableMacros;
409 m_bRODisableMacros = bRO;
411 break;
414 // xmlsec05 deprecated
415 case PROPERTYHANDLE_STAROFFICEBASIC:
417 sal_Int32 nMode = 0;
418 rValue >>= nMode;
419 m_eBasicMode = (EBasicSecurityMode)nMode;
420 m_bROBasicMode = bRO;
422 break;
423 case PROPERTYHANDLE_EXECUTEPLUGINS:
425 rValue >>= m_bExecutePlugins;
426 m_bROExecutePlugins = bRO;
428 break;
429 case PROPERTYHANDLE_WARNINGENABLED:
431 rValue >>= m_bWarning;
432 m_bROWarning = bRO;
434 break;
435 case PROPERTYHANDLE_CONFIRMATIONENABLED:
437 rValue >>= m_bConfirmation;
438 m_bROConfirmation = bRO;
440 break;
441 // xmlsec05 deprecated
444 #if OSL_DEBUG_LEVEL > 1
445 default:
446 DBG_ASSERT( false, "SvtSecurityOptions_Impl::SetProperty()\nUnknown property!\n" );
447 #endif
451 void SvtSecurityOptions_Impl::LoadAuthors( void )
453 m_seqTrustedAuthors.realloc( 0 ); // first clear
454 Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
455 sal_Int32 c1 = lAuthors.getLength();
456 if( c1 )
458 sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor
459 Sequence< OUString > lAllAuthors( c2 );
461 sal_Int32 i1;
462 sal_Int32 i2;
463 OUString aSep( "/" );
464 for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
466 lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
467 ++i2;
468 lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
469 ++i2;
470 lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
471 ++i2;
474 Sequence< Any > lValues = GetProperties( lAllAuthors );
475 if( lValues.getLength() == c2 )
477 comphelper::SequenceAsVector< SvtSecurityOptions::Certificate > v;
478 SvtSecurityOptions::Certificate aCert( 3 );
479 for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
481 lValues[ i2 ] >>= aCert[ 0 ];
482 ++i2;
483 lValues[ i2 ] >>= aCert[ 1 ];
484 ++i2;
485 lValues[ i2 ] >>= aCert[ 2 ];
486 ++i2;
487 // Filter out TrustedAuthor entries with empty RawData, which
488 // would cause an unexpected std::bad_alloc in
489 // SecurityEnvironment_NssImpl::createCertificateFromAscii and
490 // have been observed in the wild (fdo#55019):
491 if( !aCert[ 2 ].isEmpty() )
493 v.push_back( aCert );
496 m_seqTrustedAuthors = v.getAsConstList();
501 sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName )
503 sal_Int32 nHandle;
505 if( rName.compareToAscii( CSTR_SECUREURL ) == 0 )
506 nHandle = PROPERTYHANDLE_SECUREURL;
507 else if( rName.compareToAscii( CSTR_DOCWARN_SAVEORSEND ) == 0 )
508 nHandle = PROPERTYHANDLE_DOCWARN_SAVEORSEND;
509 else if( rName.compareToAscii( CSTR_DOCWARN_SIGNING ) == 0 )
510 nHandle = PROPERTYHANDLE_DOCWARN_SIGNING;
511 else if( rName.compareToAscii( CSTR_DOCWARN_PRINT ) == 0 )
512 nHandle = PROPERTYHANDLE_DOCWARN_PRINT;
513 else if( rName.compareToAscii( CSTR_DOCWARN_CREATEPDF ) == 0 )
514 nHandle = PROPERTYHANDLE_DOCWARN_CREATEPDF;
515 else if( rName.compareToAscii( CSTR_DOCWARN_REMOVEPERSONALINFO ) == 0 )
516 nHandle = PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO;
517 else if( rName.compareToAscii( CSTR_DOCWARN_RECOMMENDPASSWORD ) == 0 )
518 nHandle = PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD;
519 else if( rName.compareToAscii( CSTR_CTRLCLICK_HYPERLINK ) == 0 )
520 nHandle = PROPERTYHANDLE_CTRLCLICK_HYPERLINK;
521 else if( rName.compareToAscii( CSTR_MACRO_SECLEVEL ) == 0 )
522 nHandle = PROPERTYHANDLE_MACRO_SECLEVEL;
523 else if( rName.compareToAscii( CSTR_MACRO_TRUSTEDAUTHORS ) == 0 )
524 nHandle = PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS;
525 else if( rName.compareToAscii( CSTR_MACRO_DISABLE ) == 0 )
526 nHandle = PROPERTYHANDLE_MACRO_DISABLE;
528 // xmlsec05 deprecated
529 else if( rName == PROPERTYNAME_STAROFFICEBASIC )
530 nHandle = PROPERTYHANDLE_STAROFFICEBASIC;
531 else if( rName == PROPERTYNAME_EXECUTEPLUGINS )
532 nHandle = PROPERTYHANDLE_EXECUTEPLUGINS;
533 else if( rName == PROPERTYNAME_WARNINGENABLED )
534 nHandle = PROPERTYHANDLE_WARNINGENABLED;
535 else if( rName == PROPERTYNAME_CONFIRMATIONENABLED )
536 nHandle = PROPERTYHANDLE_CONFIRMATIONENABLED;
537 // xmlsec05 deprecated
539 else
540 nHandle = PROPERTYHANDLE_INVALID;
542 return nHandle;
545 bool SvtSecurityOptions_Impl::GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO )
547 switch( eOption )
549 case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
550 rpValue = &m_bSaveOrSend;
551 rpRO = &m_bROSaveOrSend;
552 break;
553 case SvtSecurityOptions::E_DOCWARN_SIGNING:
554 rpValue = &m_bSigning;
555 rpRO = &m_bROSigning;
556 break;
557 case SvtSecurityOptions::E_DOCWARN_PRINT:
558 rpValue = &m_bPrint;
559 rpRO = &m_bROPrint;
560 break;
561 case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
562 rpValue = &m_bCreatePDF;
563 rpRO = &m_bROCreatePDF;
564 break;
565 case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
566 rpValue = &m_bRemoveInfo;
567 rpRO = &m_bRORemoveInfo;
568 break;
569 case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
570 rpValue = &m_bRecommendPwd;
571 rpRO = &m_bRORecommendPwd;
572 break;
573 case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
574 rpValue = &m_bCtrlClickHyperlink;
575 rpRO = &m_bROCtrlClickHyperlink;
576 break;
577 default:
578 rpValue = NULL;
579 rpRO = NULL;
580 break;
583 return rpValue != NULL;
586 void SvtSecurityOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
588 // Use given list of updated properties to get his values from configuration directly!
589 Sequence< Any > seqValues = GetProperties( seqPropertyNames );
590 Sequence< sal_Bool > seqRO = GetReadOnlyStates( seqPropertyNames );
591 // Safe impossible cases.
592 // We need values from ALL notified configuration keys.
593 DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
594 // Step over list of property names and get right value from coreesponding value list to set it on internal members!
595 sal_Int32 nCount = seqPropertyNames.getLength();
596 for( sal_Int32 nProperty = 0 ; nProperty < nCount ; ++nProperty )
597 SetProperty( GetHandle( seqPropertyNames[ nProperty ] ), seqValues[ nProperty ], seqRO[ nProperty ] );
599 // read set of trusted authors separately
600 LoadAuthors();
603 void SvtSecurityOptions_Impl::Commit()
605 // Get names of supported properties, create a list for values and copy current values to it.
606 Sequence< OUString > lOrgNames = GetPropertyNames();
607 sal_Int32 nOrgCount = lOrgNames.getLength();
609 Sequence< OUString > lNames(nOrgCount);
610 Sequence< Any > lValues(nOrgCount);
611 sal_Int32 nRealCount = 0;
612 bool bDone;
614 ClearNodeSet( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
616 for( sal_Int32 nProperty = 0 ; nProperty < nOrgCount ; ++nProperty )
618 switch( nProperty )
620 case PROPERTYHANDLE_SECUREURL:
622 bDone = !m_bROSecureURLs;
623 if( bDone )
625 Sequence< OUString > lURLs( m_seqSecureURLs );
626 SvtPathOptions aOpt;
627 sal_Int32 nURLsCnt = lURLs.getLength();
628 for( sal_Int32 nItem = 0 ; nItem < nURLsCnt ; ++nItem )
629 lURLs[ nItem ] = aOpt.UseVariable( lURLs[ nItem ] );
630 lValues[ nRealCount ] <<= lURLs;
633 break;
635 case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
637 bDone = !m_bROSaveOrSend;
638 if( bDone )
639 lValues[ nRealCount ] <<= m_bSaveOrSend;
641 break;
643 case PROPERTYHANDLE_DOCWARN_SIGNING:
645 bDone = !m_bROSigning;
646 if( bDone )
647 lValues[ nRealCount ] <<= m_bSigning;
649 break;
651 case PROPERTYHANDLE_DOCWARN_PRINT:
653 bDone = !m_bROPrint;
654 if( bDone )
655 lValues[ nRealCount ] <<= m_bPrint;
657 break;
659 case PROPERTYHANDLE_DOCWARN_CREATEPDF:
661 bDone = !m_bROCreatePDF;
662 if( bDone )
663 lValues[ nRealCount ] <<= m_bCreatePDF;
665 break;
667 case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
669 bDone = !m_bRORemoveInfo;
670 if( bDone )
671 lValues[ nRealCount ] <<= m_bRemoveInfo;
673 break;
675 case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
677 bDone = !m_bRORecommendPwd;
678 if( bDone )
679 lValues[ nRealCount ] <<= m_bRecommendPwd;
681 break;
683 case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
685 bDone = !m_bROCtrlClickHyperlink;
686 if( bDone )
687 lValues[ nRealCount ] <<= m_bCtrlClickHyperlink;
689 break;
691 case PROPERTYHANDLE_MACRO_SECLEVEL:
693 bDone = !m_bROSecLevel;
694 if( bDone )
695 lValues[ nRealCount ] <<= m_nSecLevel;
697 break;
699 case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
701 bDone = !m_bROTrustedAuthors;
702 if( bDone )
704 sal_Int32 nCnt = m_seqTrustedAuthors.getLength();
705 if( nCnt )
707 String s;
708 s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS );
709 s.AppendAscii( "/a" );
711 Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt );
712 for( sal_Int32 i = 0 ; i < nCnt ; ++i )
714 OUString aPrefix = OUStringBuffer(s).append(i).append('/').makeStringAndClear();
715 Sequence< com::sun::star::beans::PropertyValue > lPropertyValues( 3 );
716 lPropertyValues[ 0 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
717 lPropertyValues[ 0 ].Value <<= m_seqTrustedAuthors[ i ][0];
718 lPropertyValues[ 1 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
719 lPropertyValues[ 1 ].Value <<= m_seqTrustedAuthors[ i ][1];
720 lPropertyValues[ 2 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
721 lPropertyValues[ 2 ].Value <<= m_seqTrustedAuthors[ i ][2];
724 SetSetProperties( PROPERTYNAME_MACRO_TRUSTEDAUTHORS, lPropertyValues );
727 bDone = false; // because we save in loop above!
729 else
730 bDone = false;
733 break;
735 case PROPERTYHANDLE_MACRO_DISABLE:
737 bDone = !m_bRODisableMacros;
738 if( bDone )
739 lValues[ nRealCount ] <<= (sal_Bool)m_bDisableMacros;
741 break;
744 // xmlsec05 deprecated
745 case PROPERTYHANDLE_STAROFFICEBASIC:
747 bDone = !m_bROBasicMode;
748 if( bDone )
749 lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode;
751 break;
752 case PROPERTYHANDLE_EXECUTEPLUGINS:
754 bDone = !m_bROExecutePlugins;
755 if( bDone )
756 lValues[ nRealCount ] <<= m_bExecutePlugins;
758 break;
759 case PROPERTYHANDLE_WARNINGENABLED:
761 bDone = !m_bROWarning;
762 if( bDone )
763 lValues[ nRealCount ] <<= m_bWarning;
765 break;
766 case PROPERTYHANDLE_CONFIRMATIONENABLED:
768 bDone = !m_bROConfirmation;
769 if( bDone )
770 lValues[ nRealCount ] <<= m_bConfirmation;
772 break;
773 // xmlsec05 deprecated
776 default:
777 bDone = false;
780 if( bDone )
782 lNames[ nRealCount ] = lOrgNames[ nProperty ];
783 ++nRealCount;
786 // Set properties in configuration.
787 lNames.realloc(nRealCount);
788 lValues.realloc(nRealCount);
789 PutProperties( lNames, lValues );
792 sal_Bool SvtSecurityOptions_Impl::IsReadOnly( SvtSecurityOptions::EOption eOption ) const
794 sal_Bool bReadonly;
795 switch(eOption)
797 case SvtSecurityOptions::E_SECUREURLS :
798 bReadonly = m_bROSecureURLs;
799 break;
800 case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
801 bReadonly = m_bROSaveOrSend;
802 break;
803 case SvtSecurityOptions::E_DOCWARN_SIGNING:
804 bReadonly = m_bROSigning;
805 break;
806 case SvtSecurityOptions::E_DOCWARN_PRINT:
807 bReadonly = m_bROPrint;
808 break;
809 case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
810 bReadonly = m_bROCreatePDF;
811 break;
812 case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
813 bReadonly = m_bRORemoveInfo;
814 break;
815 case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
816 bReadonly = m_bRORecommendPwd;
817 break;
818 case SvtSecurityOptions::E_MACRO_SECLEVEL:
819 bReadonly = m_bROSecLevel;
820 break;
821 case SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS:
822 bReadonly = m_bROTrustedAuthors;
823 break;
824 case SvtSecurityOptions::E_MACRO_DISABLE:
825 bReadonly = m_bRODisableMacros;
826 break;
827 case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
828 bReadonly = m_bROCtrlClickHyperlink;
829 break;
832 // xmlsec05 deprecated
833 case SvtSecurityOptions::E_BASICMODE:
834 bReadonly = m_bROBasicMode;
835 break;
836 case SvtSecurityOptions::E_EXECUTEPLUGINS:
837 bReadonly = m_bROExecutePlugins;
838 break;
839 case SvtSecurityOptions::E_WARNING:
840 bReadonly = m_bROWarning;
841 break;
842 case SvtSecurityOptions::E_CONFIRMATION:
843 bReadonly = m_bROConfirmation;
844 break;
845 // xmlsec05 deprecated
848 default:
849 bReadonly = sal_True;
852 return bReadonly;
855 Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const
857 return m_seqSecureURLs;
860 void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList )
862 DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n");
863 if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList)
865 m_seqSecureURLs = seqURLList;
866 SetModified();
870 sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL ,
871 const OUString& sReferer) const
873 sal_Bool bState = sal_False;
875 // Check for uncritical protocols first
876 // All protocols different from "macro..." and "slot..." are secure per definition and must not be checked.
877 // "macro://#..." means AppBasic macros that are considered safe
878 INetURLObject aURL ( sURL );
879 INetProtocol aProtocol = aURL.GetProtocol();
881 // All other URLs must checked in combination with referer and internal information about security
882 if ( (aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT) ||
883 aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) )
885 // security check only for "macro" ( without app basic ) or "slot" protocols
886 bState = sal_True;
888 else
890 // check list of allowed URL patterns
891 // Trusted referer given?
892 // NO => bState will be false per default
893 // YES => search for it in our internal url list
894 if( !sReferer.isEmpty() )
896 // Search in internal list
897 OUString sRef = sReferer.toAsciiLowerCase();
898 sal_uInt32 nCount = m_seqSecureURLs.getLength();
899 for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
901 OUString sCheckURL = m_seqSecureURLs[nItem].toAsciiLowerCase();
902 sCheckURL += "*";
903 if( WildCard( sCheckURL ).Matches( sRef ) == sal_True )
905 bState = sal_True;
906 break;
910 if ( !bState )
911 bState = sRef.compareToAscii("private:user") == COMPARE_EQUAL;
915 // Return result of operation.
916 return bState;
919 inline sal_Int32 SvtSecurityOptions_Impl::GetMacroSecurityLevel() const
921 return m_nSecLevel;
924 inline sal_Bool SvtSecurityOptions_Impl::IsMacroDisabled() const
926 return m_bDisableMacros;
929 void SvtSecurityOptions_Impl::SetMacroSecurityLevel( sal_Int32 _nLevel )
931 if( !m_bROSecLevel )
933 if( _nLevel > 3 || _nLevel < 0 )
934 _nLevel = 3;
936 if( m_nSecLevel != _nLevel )
938 m_nSecLevel = _nLevel;
939 SetModified();
944 Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedAuthors() const
946 return m_seqTrustedAuthors;
949 void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors )
951 DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n");
952 if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors )
954 m_seqTrustedAuthors = rAuthors;
955 SetModified();
959 sal_Bool SvtSecurityOptions_Impl::IsOptionSet( SvtSecurityOptions::EOption eOption ) const
961 sal_Bool* pValue;
962 sal_Bool* pRO;
963 sal_Bool bRet = sal_False;
965 if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
966 bRet = *pValue;
968 return bRet;
971 sal_Bool SvtSecurityOptions_Impl::SetOption( SvtSecurityOptions::EOption eOption, sal_Bool bValue )
973 sal_Bool* pValue;
974 sal_Bool* pRO;
975 sal_Bool bRet = sal_False;
977 if( GetOption( eOption, pValue, pRO ) )
979 if( !*pRO )
981 bRet = sal_True;
982 if( *pValue != bValue )
984 *pValue = bValue;
985 SetModified();
990 return bRet;
993 sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption eOption ) const
995 sal_Bool* pValue;
996 sal_Bool* pRO;
997 sal_Bool bRet = sal_False;
999 if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
1000 bRet = !*pRO;
1002 return bRet;
1005 Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
1007 // Build static list of configuration key names.
1008 const OUString pProperties[] =
1010 PROPERTYNAME_SECUREURL,
1011 PROPERTYNAME_STAROFFICEBASIC,
1012 PROPERTYNAME_EXECUTEPLUGINS,
1013 PROPERTYNAME_WARNINGENABLED,
1014 PROPERTYNAME_CONFIRMATIONENABLED,
1015 PROPERTYNAME_DOCWARN_SAVEORSEND,
1016 PROPERTYNAME_DOCWARN_SIGNING,
1017 PROPERTYNAME_DOCWARN_PRINT,
1018 PROPERTYNAME_DOCWARN_CREATEPDF,
1019 PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO,
1020 PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD,
1021 PROPERTYNAME_CTRLCLICK_HYPERLINK,
1022 PROPERTYNAME_MACRO_SECLEVEL,
1023 PROPERTYNAME_MACRO_TRUSTEDAUTHORS,
1024 PROPERTYNAME_MACRO_DISABLE
1026 // Initialize return sequence with these list ...
1027 const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
1028 // ... and return it.
1029 return seqPropertyNames;
1032 //*****************************************************************************************************************
1033 // initialize static member
1034 // DON'T DO IT IN YOUR HEADER!
1035 // see definition for further information
1036 //*****************************************************************************************************************
1037 SvtSecurityOptions_Impl* SvtSecurityOptions::m_pDataContainer = NULL ;
1038 sal_Int32 SvtSecurityOptions::m_nRefCount = 0 ;
1040 SvtSecurityOptions::SvtSecurityOptions()
1042 // Global access, must be guarded (multithreading!).
1043 MutexGuard aGuard( GetInitMutex() );
1044 // Increase ouer refcount ...
1045 ++m_nRefCount;
1046 // ... and initialize ouer data container only if it not already exist!
1047 if( m_pDataContainer == NULL )
1049 RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSecurityOptions_Impl::ctor()");
1050 m_pDataContainer = new SvtSecurityOptions_Impl;
1052 ItemHolder1::holdConfigItem(E_SECURITYOPTIONS);
1056 SvtSecurityOptions::~SvtSecurityOptions()
1058 // Global access, must be guarded (multithreading!)
1059 MutexGuard aGuard( GetInitMutex() );
1060 // Decrease ouer refcount.
1061 --m_nRefCount;
1062 // If last instance was deleted ...
1063 // we must destroy ouer static data container!
1064 if( m_nRefCount <= 0 )
1066 delete m_pDataContainer;
1067 m_pDataContainer = NULL;
1071 sal_Bool SvtSecurityOptions::IsReadOnly( EOption eOption ) const
1073 MutexGuard aGuard( GetInitMutex() );
1074 return m_pDataContainer->IsReadOnly(eOption);
1077 Sequence< OUString > SvtSecurityOptions::GetSecureURLs() const
1079 MutexGuard aGuard( GetInitMutex() );
1080 return m_pDataContainer->GetSecureURLs();
1083 void SvtSecurityOptions::SetSecureURLs( const Sequence< OUString >& seqURLList )
1085 MutexGuard aGuard( GetInitMutex() );
1086 m_pDataContainer->SetSecureURLs( seqURLList );
1089 sal_Bool SvtSecurityOptions::IsSecureURL( const OUString& sURL ,
1090 const OUString& sReferer ) const
1092 MutexGuard aGuard( GetInitMutex() );
1093 return m_pDataContainer->IsSecureURL( sURL, sReferer );
1096 sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const
1098 MutexGuard aGuard( GetInitMutex() );
1099 return m_pDataContainer->GetMacroSecurityLevel();
1102 void SvtSecurityOptions::SetMacroSecurityLevel( sal_Int32 _nLevel )
1104 MutexGuard aGuard( GetInitMutex() );
1105 m_pDataContainer->SetMacroSecurityLevel( _nLevel );
1108 sal_Bool SvtSecurityOptions::IsMacroDisabled() const
1110 MutexGuard aGuard( GetInitMutex() );
1111 return m_pDataContainer->IsMacroDisabled();
1114 Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions::GetTrustedAuthors() const
1116 MutexGuard aGuard( GetInitMutex() );
1117 return m_pDataContainer->GetTrustedAuthors();
1120 void SvtSecurityOptions::SetTrustedAuthors( const Sequence< Certificate >& rAuthors )
1122 MutexGuard aGuard( GetInitMutex() );
1123 m_pDataContainer->SetTrustedAuthors( rAuthors );
1126 bool SvtSecurityOptions::IsOptionSet( EOption eOption ) const
1128 MutexGuard aGuard( GetInitMutex() );
1129 return m_pDataContainer->IsOptionSet( eOption );
1132 bool SvtSecurityOptions::SetOption( EOption eOption, bool bValue )
1134 MutexGuard aGuard( GetInitMutex() );
1135 return m_pDataContainer->SetOption( eOption, bValue );
1138 bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const
1140 MutexGuard aGuard( GetInitMutex() );
1141 return m_pDataContainer->IsOptionEnabled( eOption );
1144 namespace
1146 class theSecurityOptionsMutex : public rtl::Static<osl::Mutex, theSecurityOptionsMutex>{};
1149 Mutex& SvtSecurityOptions::GetInitMutex()
1151 return theSecurityOptionsMutex::get();
1157 // xmlsec05 deprecated
1159 EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const
1161 return m_eBasicMode;
1164 void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode )
1166 DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n");
1167 if (!m_bROBasicMode && m_eBasicMode!=eMode)
1169 m_eBasicMode = eMode;
1170 SetModified();
1174 sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const
1176 return m_bExecutePlugins;
1179 void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet )
1181 DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n");
1182 if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet)
1184 m_bExecutePlugins = bSet;
1185 SetModified();
1189 sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const
1191 return m_bWarning;
1194 void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet )
1196 DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n");
1197 if (!m_bROWarning && m_bWarning!=bSet)
1199 m_bWarning = bSet;
1200 SetModified();
1204 sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const
1206 return m_bConfirmation;
1209 void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet )
1211 DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n");
1212 if (!m_bROConfirmation && m_bConfirmation!=bSet)
1214 m_bConfirmation = bSet;
1215 SetModified();
1220 sal_Bool SvtSecurityOptions::IsExecutePlugins() const
1222 MutexGuard aGuard( GetInitMutex() );
1223 return m_pDataContainer->IsExecutePlugins();
1226 void SvtSecurityOptions::SetExecutePlugins( sal_Bool bSet )
1228 MutexGuard aGuard( GetInitMutex() );
1229 m_pDataContainer->SetExecutePlugins( bSet );
1232 sal_Bool SvtSecurityOptions::IsWarningEnabled() const
1234 MutexGuard aGuard( GetInitMutex() );
1235 return m_pDataContainer->IsWarningEnabled();
1238 void SvtSecurityOptions::SetWarningEnabled( sal_Bool bSet )
1240 MutexGuard aGuard( GetInitMutex() );
1241 m_pDataContainer->SetWarningEnabled( bSet );
1244 sal_Bool SvtSecurityOptions::IsConfirmationEnabled() const
1246 MutexGuard aGuard( GetInitMutex() );
1247 return m_pDataContainer->IsConfirmationEnabled();
1250 void SvtSecurityOptions::SetConfirmationEnabled( sal_Bool bSet )
1252 MutexGuard aGuard( GetInitMutex() );
1253 m_pDataContainer->SetConfirmationEnabled( bSet );
1256 void SvtSecurityOptions::SetBasicMode( EBasicSecurityMode eMode )
1258 MutexGuard aGuard( GetInitMutex() );
1259 m_pDataContainer->SetBasicMode( eMode );
1262 EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const
1264 MutexGuard aGuard( GetInitMutex() );
1265 return m_pDataContainer->GetBasicMode();
1268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */