LCOV - code coverage report
Current view: top level - unotools/source/config - securityoptions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 118 483 24.4 %
Date: 2012-08-25 Functions: 15 54 27.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 89 756 11.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       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/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      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 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      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>
      27                 :            : 
      28                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      29                 :            : #include <tools/urlobj.hxx>
      30                 :            : #include <tools/wldcrd.hxx>
      31                 :            : 
      32                 :            : #include <unotools/pathoptions.hxx>
      33                 :            : 
      34                 :            : #include <rtl/logfile.hxx>
      35                 :            : #include "itemholder1.hxx"
      36                 :            : 
      37                 :            : //_________________________________________________________________________________________________________________
      38                 :            : //  namespaces
      39                 :            : //_________________________________________________________________________________________________________________
      40                 :            : 
      41                 :            : using namespace ::utl                   ;
      42                 :            : using namespace ::rtl                   ;
      43                 :            : using namespace ::osl                   ;
      44                 :            : using namespace ::com::sun::star::uno   ;
      45                 :            : 
      46                 :            : #define ROOTNODE_SECURITY               OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Security/Scripting"))
      47                 :            : #define DEFAULT_SECUREURL               Sequence< OUString >()
      48                 :            : #define DEFAULT_TRUSTEDAUTHORS          Sequence< SvtSecurityOptions::Certificate >()
      49                 :            : 
      50                 :            : // xmlsec05 depricated
      51                 :            : #define DEFAULT_STAROFFICEBASIC         eALWAYS_EXECUTE
      52                 :            : 
      53                 :            : #define CSTR_SECUREURL                  "SecureURL"
      54                 :            : #define CSTR_DOCWARN_SAVEORSEND         "WarnSaveOrSendDoc"
      55                 :            : #define CSTR_DOCWARN_SIGNING            "WarnSignDoc"
      56                 :            : #define CSTR_DOCWARN_PRINT              "WarnPrintDoc"
      57                 :            : #define CSTR_DOCWARN_CREATEPDF          "WarnCreatePDF"
      58                 :            : #define CSTR_DOCWARN_REMOVEPERSONALINFO "RemovePersonalInfoOnSaving"
      59                 :            : #define CSTR_DOCWARN_RECOMMENDPASSWORD  "RecommendPasswordProtection"
      60                 :            : #define CSTR_CTRLCLICK_HYPERLINK        "HyperlinksWithCtrlClick"
      61                 :            : #define CSTR_MACRO_SECLEVEL             "MacroSecurityLevel"
      62                 :            : #define CSTR_MACRO_TRUSTEDAUTHORS       "TrustedAuthors"
      63                 :            : #define CSTR_MACRO_DISABLE              "DisableMacrosExecution"
      64                 :            : #define CSTR_TRUSTEDAUTHOR_SUBJECTNAME  "SubjectName"
      65                 :            : #define CSTR_TRUSTEDAUTHOR_SERIALNUMBER "SerialNumber"
      66                 :            : #define CSTR_TRUSTEDAUTHOR_RAWDATA      "RawData"
      67                 :            : 
      68                 :            : #define PROPERTYNAME_SECUREURL                  OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_SECUREURL                     ))
      69                 :            : #define PROPERTYNAME_DOCWARN_SAVEORSEND         OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SAVEORSEND            ))
      70                 :            : #define PROPERTYNAME_DOCWARN_SIGNING            OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SIGNING               ))
      71                 :            : #define PROPERTYNAME_DOCWARN_PRINT              OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_PRINT                 ))
      72                 :            : #define PROPERTYNAME_DOCWARN_CREATEPDF          OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_CREATEPDF             ))
      73                 :            : #define PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_REMOVEPERSONALINFO    ))
      74                 :            : #define PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD  OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_RECOMMENDPASSWORD     ))
      75                 :            : #define PROPERTYNAME_CTRLCLICK_HYPERLINK        OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_CTRLCLICK_HYPERLINK           ))
      76                 :            : #define PROPERTYNAME_MACRO_SECLEVEL             OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_SECLEVEL                ))
      77                 :            : #define PROPERTYNAME_MACRO_TRUSTEDAUTHORS       OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_TRUSTEDAUTHORS          ))
      78                 :            : #define PROPERTYNAME_MACRO_DISABLE              OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_DISABLE                 ))
      79                 :            : #define PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME  OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SUBJECTNAME))
      80                 :            : #define PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SERIALNUMBER))
      81                 :            : #define PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA      OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_RAWDATA))
      82                 :            : 
      83                 :            : // xmlsec05 depricated
      84                 :            : #define PROPERTYNAME_STAROFFICEBASIC    OUString(RTL_CONSTASCII_USTRINGPARAM("OfficeBasic"  ))
      85                 :            : #define PROPERTYNAME_EXECUTEPLUGINS     OUString(RTL_CONSTASCII_USTRINGPARAM("ExecutePlugins"  ))
      86                 :            : #define PROPERTYNAME_WARNINGENABLED     OUString(RTL_CONSTASCII_USTRINGPARAM("Warning"  ))
      87                 :            : #define PROPERTYNAME_CONFIRMATIONENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Confirmation"  ))
      88                 :            : // xmlsec05 depricated
      89                 :            : 
      90                 :            : 
      91                 :            : #define PROPERTYHANDLE_SECUREURL                    0
      92                 :            : 
      93                 :            : // xmlsec05 depricated
      94                 :            : #define PROPERTYHANDLE_STAROFFICEBASIC  1
      95                 :            : #define PROPERTYHANDLE_EXECUTEPLUGINS   2
      96                 :            : #define PROPERTYHANDLE_WARNINGENABLED   3
      97                 :            : #define PROPERTYHANDLE_CONFIRMATIONENABLED 4
      98                 :            : // xmlsec05 depricated
      99                 :            : 
     100                 :            : #define PROPERTYHANDLE_DOCWARN_SAVEORSEND           5
     101                 :            : #define PROPERTYHANDLE_DOCWARN_SIGNING              6
     102                 :            : #define PROPERTYHANDLE_DOCWARN_PRINT                7
     103                 :            : #define PROPERTYHANDLE_DOCWARN_CREATEPDF            8
     104                 :            : #define PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO   9
     105                 :            : #define PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD    10
     106                 :            : #define PROPERTYHANDLE_CTRLCLICK_HYPERLINK          11
     107                 :            : #define PROPERTYHANDLE_MACRO_SECLEVEL               12
     108                 :            : #define PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS         13
     109                 :            : #define PROPERTYHANDLE_MACRO_DISABLE                14
     110                 :            : 
     111                 :            : #define PROPERTYCOUNT                               15
     112                 :            : #define PROPERTYHANDLE_INVALID                      -1
     113                 :            : 
     114                 :            : #define CFG_READONLY_DEFAULT                        sal_False
     115                 :            : 
     116                 :            : //_________________________________________________________________________________________________________________
     117                 :            : //  private declarations!
     118                 :            : //_________________________________________________________________________________________________________________
     119                 :            : 
     120                 :            : class SvtSecurityOptions_Impl : public ConfigItem
     121                 :            : {
     122                 :            :     //-------------------------------------------------------------------------------------------------------------
     123                 :            :     //  public methods
     124                 :            :     //-------------------------------------------------------------------------------------------------------------
     125                 :            : 
     126                 :            :     public:
     127                 :            : 
     128                 :            :         //---------------------------------------------------------------------------------------------------------
     129                 :            :         //  constructor / destructor
     130                 :            :         //---------------------------------------------------------------------------------------------------------
     131                 :            : 
     132                 :            :          SvtSecurityOptions_Impl();
     133                 :            :         ~SvtSecurityOptions_Impl();
     134                 :            : 
     135                 :            :         //---------------------------------------------------------------------------------------------------------
     136                 :            :         //  overloaded methods of baseclass
     137                 :            :         //---------------------------------------------------------------------------------------------------------
     138                 :            : 
     139                 :            :         /*-****************************************************************************************************//**
     140                 :            :             @short      called for notify of configmanager
     141                 :            :             @descr      These method is called from the ConfigManager before application ends or from the
     142                 :            :                          PropertyChangeListener if the sub tree broadcasts changes. You must update your
     143                 :            :                         internal values.
     144                 :            : 
     145                 :            :             @seealso    baseclass ConfigItem
     146                 :            : 
     147                 :            :             @param      "seqPropertyNames" is the list of properties which should be updated.
     148                 :            :             @return     -
     149                 :            : 
     150                 :            :             @onerror    -
     151                 :            :         *//*-*****************************************************************************************************/
     152                 :            : 
     153                 :            :         virtual void Notify( const Sequence< OUString >& seqPropertyNames );
     154                 :            : 
     155                 :            :         /*-****************************************************************************************************//**
     156                 :            :             @short      write changes to configuration
     157                 :            :             @descr      These method writes the changed values into the sub tree
     158                 :            :                         and should always called in our destructor to guarantee consistency of config data.
     159                 :            : 
     160                 :            :             @seealso    baseclass ConfigItem
     161                 :            : 
     162                 :            :             @param      -
     163                 :            :             @return     -
     164                 :            : 
     165                 :            :             @onerror    -
     166                 :            :         *//*-*****************************************************************************************************/
     167                 :            : 
     168                 :            :         virtual void Commit();
     169                 :            : 
     170                 :            :         //---------------------------------------------------------------------------------------------------------
     171                 :            :         //  public interface
     172                 :            :         //---------------------------------------------------------------------------------------------------------
     173                 :            : 
     174                 :            :         sal_Bool                IsReadOnly      ( SvtSecurityOptions::EOption eOption                   ) const ;
     175                 :            : 
     176                 :            :         Sequence< OUString >    GetSecureURLs   (                                                       ) const ;
     177                 :            :         void                    SetSecureURLs   (   const   Sequence< OUString >&   seqURLList          )       ;
     178                 :            :         sal_Bool                IsSecureURL     (   const   OUString&               sURL,
     179                 :            :                                                     const   OUString&               sReferer            ) const ;
     180                 :            :         inline sal_Int32        GetMacroSecurityLevel   (                                               ) const ;
     181                 :            :         void                    SetMacroSecurityLevel   ( sal_Int32 _nLevel                             )       ;
     182                 :            : 
     183                 :            :         inline sal_Bool         IsMacroDisabled         (                                               ) const ;
     184                 :            : 
     185                 :            :         Sequence< SvtSecurityOptions::Certificate > GetTrustedAuthors       (                                                                                       ) const ;
     186                 :            :         void                                        SetTrustedAuthors       ( const Sequence< SvtSecurityOptions::Certificate >& rAuthors                           )       ;
     187                 :            : 
     188                 :            :         sal_Bool                IsOptionSet     ( SvtSecurityOptions::EOption eOption                   ) const ;
     189                 :            :         sal_Bool                SetOption       ( SvtSecurityOptions::EOption eOption, sal_Bool bValue  )       ;
     190                 :            :         sal_Bool                IsOptionEnabled ( SvtSecurityOptions::EOption eOption                   ) const ;
     191                 :            : private:
     192                 :            : 
     193                 :            :         /*-****************************************************************************************************//**
     194                 :            :             @short      return list of key names of ouer configuration management which represent our module tree
     195                 :            :             @descr      These methods return a static const list of key names. We need it to get needed values from our
     196                 :            :                         configuration management.
     197                 :            : 
     198                 :            :             @seealso    -
     199                 :            : 
     200                 :            :             @param      -
     201                 :            :             @return     A list of needed configuration keys is returned.
     202                 :            : 
     203                 :            :             @onerror    -
     204                 :            :         *//*-*****************************************************************************************************/
     205                 :            : 
     206                 :            :         void                    SetProperty( sal_Int32 nHandle, const Any& rValue, sal_Bool bReadOnly );
     207                 :            :         void                    LoadAuthors( void );
     208                 :            :         static sal_Int32        GetHandle( const OUString& rPropertyName );
     209                 :            :         bool                    GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO );
     210                 :            : 
     211                 :            :         static Sequence< OUString > GetPropertyNames();
     212                 :            : 
     213                 :            :         Sequence< OUString >                        m_seqSecureURLs;
     214                 :            :         sal_Bool                                    m_bSaveOrSend;
     215                 :            :         sal_Bool                                    m_bSigning;
     216                 :            :         sal_Bool                                    m_bPrint;
     217                 :            :         sal_Bool                                    m_bCreatePDF;
     218                 :            :         sal_Bool                                    m_bRemoveInfo;
     219                 :            :         sal_Bool                                    m_bRecommendPwd;
     220                 :            :         sal_Bool                                    m_bCtrlClickHyperlink;
     221                 :            :         sal_Int32                                   m_nSecLevel;
     222                 :            :         Sequence< SvtSecurityOptions::Certificate > m_seqTrustedAuthors;
     223                 :            :         sal_Bool                                    m_bDisableMacros;
     224                 :            : 
     225                 :            :         sal_Bool                                    m_bROSecureURLs;
     226                 :            :         sal_Bool                                    m_bROSaveOrSend;
     227                 :            :         sal_Bool                                    m_bROSigning;
     228                 :            :         sal_Bool                                    m_bROPrint;
     229                 :            :         sal_Bool                                    m_bROCreatePDF;
     230                 :            :         sal_Bool                                    m_bRORemoveInfo;
     231                 :            :         sal_Bool                                    m_bRORecommendPwd;
     232                 :            :         sal_Bool                                    m_bROCtrlClickHyperlink;
     233                 :            :         sal_Bool                                    m_bROSecLevel;
     234                 :            :         sal_Bool                                    m_bROTrustedAuthors;
     235                 :            :         sal_Bool                                    m_bRODisableMacros;
     236                 :            : 
     237                 :            : 
     238                 :            :         // xmlsec05 depricated
     239                 :            :         EBasicSecurityMode      m_eBasicMode;
     240                 :            :         sal_Bool                m_bExecutePlugins;
     241                 :            :         sal_Bool                m_bWarning;
     242                 :            :         sal_Bool                m_bConfirmation;
     243                 :            : 
     244                 :            :         sal_Bool                m_bROConfirmation;
     245                 :            :         sal_Bool                m_bROWarning;
     246                 :            :         sal_Bool                m_bROExecutePlugins;
     247                 :            :         sal_Bool                m_bROBasicMode;
     248                 :            :         public:
     249                 :            :         sal_Bool IsWarningEnabled() const;
     250                 :            :         void SetWarningEnabled( sal_Bool bSet );
     251                 :            :         sal_Bool IsConfirmationEnabled() const;
     252                 :            :         void SetConfirmationEnabled( sal_Bool bSet );
     253                 :            :         sal_Bool    IsExecutePlugins() const;
     254                 :            :         void        SetExecutePlugins( sal_Bool bSet );
     255                 :            :         EBasicSecurityMode      GetBasicMode    (                                               ) const ;
     256                 :            :         void                    SetBasicMode    (           EBasicSecurityMode      eMode       )       ;
     257                 :            : };
     258                 :            : 
     259                 :            : //*****************************************************************************************************************
     260                 :            : //  constructor
     261                 :            : //*****************************************************************************************************************
     262                 :        128 : SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()
     263                 :            :     :ConfigItem             ( ROOTNODE_SECURITY         )
     264                 :            :     ,m_seqSecureURLs        ( DEFAULT_SECUREURL         )
     265                 :            :     ,m_bSaveOrSend          ( sal_True                  )
     266                 :            :     ,m_bSigning             ( sal_True                  )
     267                 :            :     ,m_bPrint               ( sal_True                  )
     268                 :            :     ,m_bCreatePDF           ( sal_True                  )
     269                 :            :     ,m_bRemoveInfo          ( sal_True                  )
     270                 :            :     ,m_nSecLevel            ( sal_True                  )
     271                 :            :     ,m_seqTrustedAuthors    ( DEFAULT_TRUSTEDAUTHORS    )
     272                 :            :     ,m_bDisableMacros       ( sal_False                 )
     273                 :            :     ,m_bROSecureURLs        ( CFG_READONLY_DEFAULT      )
     274                 :            :     ,m_bROSaveOrSend        ( CFG_READONLY_DEFAULT      )
     275                 :            :     ,m_bROSigning           ( CFG_READONLY_DEFAULT      )
     276                 :            :     ,m_bROPrint             ( CFG_READONLY_DEFAULT      )
     277                 :            :     ,m_bROCreatePDF         ( CFG_READONLY_DEFAULT      )
     278                 :            :     ,m_bRORemoveInfo        ( CFG_READONLY_DEFAULT      )
     279                 :            :     ,m_bROSecLevel          ( CFG_READONLY_DEFAULT      )
     280                 :            :     ,m_bROTrustedAuthors    ( CFG_READONLY_DEFAULT      )
     281                 :            :     ,m_bRODisableMacros     ( sal_True                  ) // currently is not intended to be changed
     282                 :            : 
     283                 :            :     // xmlsec05 depricated
     284                 :            :     ,   m_eBasicMode        ( DEFAULT_STAROFFICEBASIC )
     285                 :            :     ,   m_bExecutePlugins   ( sal_True                )
     286                 :            :     ,   m_bWarning          ( sal_True                )
     287                 :            :     ,   m_bConfirmation     ( sal_True                )
     288                 :            :     ,   m_bROConfirmation   ( CFG_READONLY_DEFAULT    )
     289                 :            :     ,   m_bROWarning        ( CFG_READONLY_DEFAULT    )
     290                 :            :     ,   m_bROExecutePlugins ( CFG_READONLY_DEFAULT    )
     291 [ +  - ][ +  - ]:        128 :     ,   m_bROBasicMode      ( CFG_READONLY_DEFAULT    )
                 [ +  - ]
     292                 :            :     // xmlsec05 depricated
     293                 :            : 
     294                 :            : {
     295         [ +  - ]:        128 :     Sequence< OUString >    seqNames    = GetPropertyNames  (           );
     296         [ +  - ]:        128 :     Sequence< Any >         seqValues   = GetProperties     ( seqNames  );
     297         [ +  - ]:        128 :     Sequence< sal_Bool >    seqRO       = GetReadOnlyStates ( seqNames  );
     298                 :            : 
     299                 :            :     // Safe impossible cases.
     300                 :            :     // We need values from ALL configuration keys.
     301                 :            :     // Follow assignment use order of values in relation to our list of key names!
     302                 :            :     DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" );
     303                 :            : 
     304                 :            :     // Copy values from list in right order to our internal member.
     305                 :        128 :     sal_Int32               nPropertyCount = seqValues.getLength();
     306         [ +  + ]:       2048 :     for( sal_Int32 nProperty = 0 ; nProperty < nPropertyCount ; ++nProperty )
     307 [ +  - ][ +  - ]:       1920 :         SetProperty( nProperty, seqValues[ nProperty ], seqRO[ nProperty ] );
                 [ +  - ]
     308                 :            : 
     309         [ +  - ]:        128 :     LoadAuthors();
     310                 :            : 
     311                 :            :     // Enable notification mechanism of our baseclass.
     312                 :            :     // We need it to get information about changes outside these class on our used configuration keys!*/
     313                 :            : 
     314 [ +  - ][ +  - ]:        128 :     EnableNotification( seqNames );
         [ +  - ][ +  - ]
     315                 :        128 : }
     316                 :            : 
     317                 :            : //*****************************************************************************************************************
     318                 :            : //  destructor
     319                 :            : //*****************************************************************************************************************
     320 [ +  - ][ +  - ]:        128 : SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl()
     321                 :            : {
     322 [ +  - ][ -  + ]:        128 :     if( IsModified() )
     323         [ #  # ]:          0 :         Commit();
     324         [ -  + ]:        256 : }
     325                 :            : 
     326                 :       1920 : void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, sal_Bool bRO )
     327                 :            : {
     328   [ +  +  +  +  :       1920 :     switch( nProperty )
          +  +  +  +  +  
          +  +  +  +  +  
                   +  - ]
     329                 :            :     {
     330                 :            :         case PROPERTYHANDLE_SECUREURL:
     331                 :            :         {
     332         [ +  - ]:        128 :             m_seqSecureURLs.realloc( 0 );
     333         [ +  - ]:        128 :             rValue >>= m_seqSecureURLs;
     334         [ +  - ]:        128 :             SvtPathOptions  aOpt;
     335                 :        128 :             sal_uInt32      nCount = m_seqSecureURLs.getLength();
     336         [ -  + ]:        128 :             for( sal_uInt32 nItem = 0 ; nItem < nCount ; ++nItem )
     337 [ #  # ][ #  # ]:          0 :                 m_seqSecureURLs[ nItem ] = aOpt.SubstituteVariable( m_seqSecureURLs[ nItem ] );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     338         [ +  - ]:        128 :             m_bROSecureURLs = bRO;
     339                 :            :         }
     340                 :        128 :         break;
     341                 :            : 
     342                 :            :         case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
     343                 :            :         {
     344                 :        128 :             rValue >>= m_bSaveOrSend;
     345                 :        128 :             m_bROSaveOrSend = bRO;
     346                 :            :         }
     347                 :        128 :         break;
     348                 :            : 
     349                 :            :         case PROPERTYHANDLE_DOCWARN_SIGNING:
     350                 :            :         {
     351                 :        128 :             rValue >>= m_bSigning;
     352                 :        128 :             m_bROSigning = bRO;
     353                 :            :         }
     354                 :        128 :         break;
     355                 :            : 
     356                 :            :         case PROPERTYHANDLE_DOCWARN_PRINT:
     357                 :            :         {
     358                 :        128 :             rValue >>= m_bPrint;
     359                 :        128 :             m_bROPrint = bRO;
     360                 :            :         }
     361                 :        128 :         break;
     362                 :            : 
     363                 :            :         case PROPERTYHANDLE_DOCWARN_CREATEPDF:
     364                 :            :         {
     365                 :        128 :             rValue >>= m_bCreatePDF;
     366                 :        128 :             m_bROCreatePDF = bRO;
     367                 :            :         }
     368                 :        128 :         break;
     369                 :            : 
     370                 :            :         case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
     371                 :            :         {
     372                 :        128 :             rValue >>= m_bRemoveInfo;
     373                 :        128 :             m_bRORemoveInfo = bRO;
     374                 :            :         }
     375                 :        128 :         break;
     376                 :            : 
     377                 :            :         case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
     378                 :            :         {
     379                 :        128 :             rValue >>= m_bRecommendPwd;
     380                 :        128 :             m_bRORecommendPwd = bRO;
     381                 :            :         }
     382                 :        128 :         break;
     383                 :            : 
     384                 :            :         case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
     385                 :            :         {
     386                 :        128 :             rValue >>= m_bCtrlClickHyperlink;
     387                 :        128 :             m_bROCtrlClickHyperlink = bRO;
     388                 :            :         }
     389                 :        128 :         break;
     390                 :            : 
     391                 :            :         case PROPERTYHANDLE_MACRO_SECLEVEL:
     392                 :            :         {
     393                 :        128 :             rValue >>= m_nSecLevel;
     394                 :        128 :             m_bROSecLevel = bRO;
     395                 :            :         }
     396                 :        128 :         break;
     397                 :            : 
     398                 :            :         case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
     399                 :            :         {
     400                 :            :             // don't care about value here...
     401                 :        128 :             m_bROTrustedAuthors = bRO;
     402                 :            :         }
     403                 :        128 :         break;
     404                 :            : 
     405                 :            :         case PROPERTYHANDLE_MACRO_DISABLE:
     406                 :            :         {
     407                 :        128 :             rValue >>= m_bDisableMacros;
     408                 :        128 :             m_bRODisableMacros = bRO;
     409                 :            :         }
     410                 :        128 :         break;
     411                 :            : 
     412                 :            : 
     413                 :            :         // xmlsec05 depricated
     414                 :            :         case PROPERTYHANDLE_STAROFFICEBASIC:
     415                 :            :         {
     416                 :        128 :             sal_Int32 nMode = 0;
     417                 :        128 :             rValue >>= nMode;
     418                 :        128 :             m_eBasicMode = (EBasicSecurityMode)nMode;
     419                 :        128 :             m_bROBasicMode = bRO;
     420                 :            :         }
     421                 :        128 :         break;
     422                 :            :         case PROPERTYHANDLE_EXECUTEPLUGINS:
     423                 :            :         {
     424                 :        128 :             rValue >>= m_bExecutePlugins;
     425                 :        128 :             m_bROExecutePlugins = bRO;
     426                 :            :         }
     427                 :        128 :         break;
     428                 :            :         case PROPERTYHANDLE_WARNINGENABLED:
     429                 :            :         {
     430                 :        128 :             rValue >>= m_bWarning;
     431                 :        128 :             m_bROWarning = bRO;
     432                 :            :         }
     433                 :        128 :         break;
     434                 :            :         case PROPERTYHANDLE_CONFIRMATIONENABLED:
     435                 :            :         {
     436                 :        128 :             rValue >>= m_bConfirmation;
     437                 :        128 :             m_bROConfirmation = bRO;
     438                 :            :         }
     439                 :        128 :         break;
     440                 :            :         // xmlsec05 depricated
     441                 :            : 
     442                 :            : 
     443                 :            :         #if OSL_DEBUG_LEVEL > 1
     444                 :            :         default:
     445                 :            :             DBG_ASSERT( false, "SvtSecurityOptions_Impl::SetProperty()\nUnkown property!\n" );
     446                 :            :         #endif
     447                 :            :     }
     448                 :       1920 : }
     449                 :            : 
     450                 :        128 : void SvtSecurityOptions_Impl::LoadAuthors( void )
     451                 :            : {
     452         [ +  - ]:        128 :     m_seqTrustedAuthors.realloc( 0 );       // first clear
     453 [ +  - ][ +  - ]:        128 :     Sequence< OUString >    lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
     454                 :        128 :     sal_Int32               c1 = lAuthors.getLength();
     455         [ -  + ]:        128 :     if( c1 )
     456                 :            :     {
     457                 :          0 :         sal_Int32               c2 = c1 * 3;                // 3 Properties inside Struct TrustedAuthor
     458         [ #  # ]:          0 :         Sequence< OUString >    lAllAuthors( c2 );
     459                 :            : 
     460                 :            :         sal_Int32               i1;
     461                 :            :         sal_Int32               i2;
     462         [ #  # ]:          0 :         OUString                aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
     463         [ #  # ]:          0 :         for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
     464                 :            :         {
     465 [ #  # ][ #  # ]:          0 :             lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
         [ #  # ][ #  # ]
     466                 :          0 :             ++i2;
     467 [ #  # ][ #  # ]:          0 :             lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
         [ #  # ][ #  # ]
     468                 :          0 :             ++i2;
     469 [ #  # ][ #  # ]:          0 :             lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
         [ #  # ][ #  # ]
     470                 :          0 :             ++i2;
     471                 :            :         }
     472                 :            : 
     473         [ #  # ]:          0 :         Sequence< Any >         lValues = GetProperties( lAllAuthors );
     474         [ #  # ]:          0 :         if( lValues.getLength() == c2 )
     475                 :            :         {
     476         [ #  # ]:          0 :             m_seqTrustedAuthors.realloc( c1 );
     477         [ #  # ]:          0 :             SvtSecurityOptions::Certificate aCert( 3 );
     478         [ #  # ]:          0 :             for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
     479                 :            :             {
     480 [ #  # ][ #  # ]:          0 :                 lValues[ i2 ] >>= aCert[ 0 ];
     481                 :          0 :                 ++i2;
     482 [ #  # ][ #  # ]:          0 :                 lValues[ i2 ] >>= aCert[ 1 ];
     483                 :          0 :                 ++i2;
     484 [ #  # ][ #  # ]:          0 :                 lValues[ i2 ] >>= aCert[ 2 ];
     485                 :          0 :                 ++i2;
     486 [ #  # ][ #  # ]:          0 :                 m_seqTrustedAuthors[ i1 ] = aCert;
     487         [ #  # ]:          0 :             }
     488 [ #  # ][ #  # ]:          0 :         }
     489         [ +  - ]:        128 :     }
     490                 :        128 : }
     491                 :            : 
     492                 :          0 : sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName )
     493                 :            : {
     494                 :            :     sal_Int32   nHandle;
     495                 :            : 
     496         [ #  # ]:          0 :     if( rName.compareToAscii( CSTR_SECUREURL ) == 0 )
     497                 :          0 :         nHandle = PROPERTYHANDLE_SECUREURL;
     498         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_SAVEORSEND ) == 0 )
     499                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_SAVEORSEND;
     500         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_SIGNING ) == 0 )
     501                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_SIGNING;
     502         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_PRINT ) == 0 )
     503                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_PRINT;
     504         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_CREATEPDF ) == 0 )
     505                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_CREATEPDF;
     506         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_REMOVEPERSONALINFO ) == 0 )
     507                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO;
     508         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_DOCWARN_RECOMMENDPASSWORD ) == 0 )
     509                 :          0 :         nHandle = PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD;
     510         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_CTRLCLICK_HYPERLINK ) == 0 )
     511                 :          0 :         nHandle = PROPERTYHANDLE_CTRLCLICK_HYPERLINK;
     512         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_MACRO_SECLEVEL ) == 0 )
     513                 :          0 :         nHandle = PROPERTYHANDLE_MACRO_SECLEVEL;
     514         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_MACRO_TRUSTEDAUTHORS ) == 0 )
     515                 :          0 :         nHandle = PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS;
     516         [ #  # ]:          0 :     else if( rName.compareToAscii( CSTR_MACRO_DISABLE ) == 0 )
     517                 :          0 :         nHandle = PROPERTYHANDLE_MACRO_DISABLE;
     518                 :            : 
     519                 :            :     // xmlsec05 depricated
     520         [ #  # ]:          0 :     else if( rName == PROPERTYNAME_STAROFFICEBASIC )
     521                 :          0 :         nHandle = PROPERTYHANDLE_STAROFFICEBASIC;
     522         [ #  # ]:          0 :     else if( rName == PROPERTYNAME_EXECUTEPLUGINS )
     523                 :          0 :         nHandle = PROPERTYHANDLE_EXECUTEPLUGINS;
     524         [ #  # ]:          0 :     else if( rName == PROPERTYNAME_WARNINGENABLED )
     525                 :          0 :         nHandle = PROPERTYHANDLE_WARNINGENABLED;
     526         [ #  # ]:          0 :     else if( rName == PROPERTYNAME_CONFIRMATIONENABLED )
     527                 :          0 :         nHandle = PROPERTYHANDLE_CONFIRMATIONENABLED;
     528                 :            :     // xmlsec05 depricated
     529                 :            : 
     530                 :            :     else
     531                 :          0 :         nHandle = PROPERTYHANDLE_INVALID;
     532                 :            : 
     533                 :          0 :     return nHandle;
     534                 :            : }
     535                 :            : 
     536                 :        400 : bool SvtSecurityOptions_Impl::GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO )
     537                 :            : {
     538   [ -  -  -  -  :        400 :     switch( eOption )
             +  -  +  - ]
     539                 :            :     {
     540                 :            :         case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
     541                 :          0 :             rpValue = &m_bSaveOrSend;
     542                 :          0 :             rpRO = &m_bROSaveOrSend;
     543                 :          0 :             break;
     544                 :            :         case SvtSecurityOptions::E_DOCWARN_SIGNING:
     545                 :          0 :             rpValue = &m_bSigning;
     546                 :          0 :             rpRO = &m_bROSigning;
     547                 :          0 :             break;
     548                 :            :         case SvtSecurityOptions::E_DOCWARN_PRINT:
     549                 :          0 :             rpValue = &m_bPrint;
     550                 :          0 :             rpRO = &m_bROPrint;
     551                 :          0 :             break;
     552                 :            :         case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
     553                 :          0 :             rpValue = &m_bCreatePDF;
     554                 :          0 :             rpRO = &m_bROCreatePDF;
     555                 :          0 :             break;
     556                 :            :         case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
     557                 :         33 :             rpValue = &m_bRemoveInfo;
     558                 :         33 :             rpRO = &m_bRORemoveInfo;
     559                 :         33 :             break;
     560                 :            :         case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
     561                 :          0 :             rpValue = &m_bRecommendPwd;
     562                 :          0 :             rpRO = &m_bRORecommendPwd;
     563                 :          0 :             break;
     564                 :            :         case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
     565                 :        367 :             rpValue = &m_bCtrlClickHyperlink;
     566                 :        367 :             rpRO = &m_bROCtrlClickHyperlink;
     567                 :        367 :             break;
     568                 :            :         default:
     569                 :          0 :             rpValue = NULL;
     570                 :          0 :             rpRO = NULL;
     571                 :          0 :             break;
     572                 :            :     }
     573                 :            : 
     574                 :        400 :     return rpValue != NULL;
     575                 :            : }
     576                 :            : 
     577                 :          0 : void SvtSecurityOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
     578                 :            : {
     579                 :            :     // Use given list of updated properties to get his values from configuration directly!
     580         [ #  # ]:          0 :     Sequence< Any >         seqValues = GetProperties( seqPropertyNames );
     581         [ #  # ]:          0 :     Sequence< sal_Bool >    seqRO = GetReadOnlyStates( seqPropertyNames );
     582                 :            :     // Safe impossible cases.
     583                 :            :     // We need values from ALL notified configuration keys.
     584                 :            :     DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
     585                 :            :     // Step over list of property names and get right value from coreesponding value list to set it on internal members!
     586                 :          0 :     sal_Int32               nCount = seqPropertyNames.getLength();
     587         [ #  # ]:          0 :     for( sal_Int32 nProperty = 0 ; nProperty < nCount ; ++nProperty )
     588 [ #  # ][ #  # ]:          0 :         SetProperty( GetHandle( seqPropertyNames[ nProperty ] ), seqValues[ nProperty ], seqRO[ nProperty ] );
         [ #  # ][ #  # ]
     589                 :            : 
     590                 :            :     // read set of trusted authors separately
     591 [ #  # ][ #  # ]:          0 :     LoadAuthors();
                 [ #  # ]
     592                 :          0 : }
     593                 :            : 
     594                 :          0 : void SvtSecurityOptions_Impl::Commit()
     595                 :            : {
     596                 :            :     // Get names of supported properties, create a list for values and copy current values to it.
     597         [ #  # ]:          0 :     Sequence< OUString >    lOrgNames = GetPropertyNames();
     598                 :          0 :     sal_Int32               nOrgCount = lOrgNames.getLength();
     599                 :            : 
     600         [ #  # ]:          0 :     Sequence< OUString >    lNames(nOrgCount);
     601         [ #  # ]:          0 :     Sequence< Any >         lValues(nOrgCount);
     602                 :          0 :     sal_Int32               nRealCount = 0;
     603                 :            :     bool                    bDone;
     604                 :            : 
     605 [ #  # ][ #  # ]:          0 :     ClearNodeSet( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
     606                 :            : 
     607         [ #  # ]:          0 :     for( sal_Int32 nProperty = 0 ; nProperty < nOrgCount ; ++nProperty )
     608                 :            :     {
     609   [ #  #  #  #  :          0 :         switch( nProperty )
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     610                 :            :         {
     611                 :            :             case PROPERTYHANDLE_SECUREURL:
     612                 :            :             {
     613                 :          0 :                 bDone = !m_bROSecureURLs;
     614         [ #  # ]:          0 :                 if( bDone )
     615                 :            :                 {
     616         [ #  # ]:          0 :                     Sequence< OUString >    lURLs( m_seqSecureURLs );
     617         [ #  # ]:          0 :                     SvtPathOptions          aOpt;
     618                 :          0 :                     sal_Int32               nURLsCnt = lURLs.getLength();
     619         [ #  # ]:          0 :                     for( sal_Int32 nItem = 0 ; nItem < nURLsCnt ; ++nItem )
     620 [ #  # ][ #  # ]:          0 :                         lURLs[ nItem ] = aOpt.UseVariable( lURLs[ nItem ] );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     621 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= lURLs;
         [ #  # ][ #  # ]
     622                 :            :                 }
     623                 :            :             }
     624                 :          0 :             break;
     625                 :            : 
     626                 :            :             case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
     627                 :            :             {
     628                 :          0 :                 bDone = !m_bROSaveOrSend;
     629         [ #  # ]:          0 :                 if( bDone )
     630 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bSaveOrSend;
     631                 :            :             }
     632                 :          0 :             break;
     633                 :            : 
     634                 :            :             case PROPERTYHANDLE_DOCWARN_SIGNING:
     635                 :            :             {
     636                 :          0 :                 bDone = !m_bROSigning;
     637         [ #  # ]:          0 :                 if( bDone )
     638 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bSigning;
     639                 :            :             }
     640                 :          0 :             break;
     641                 :            : 
     642                 :            :             case PROPERTYHANDLE_DOCWARN_PRINT:
     643                 :            :             {
     644                 :          0 :                 bDone = !m_bROPrint;
     645         [ #  # ]:          0 :                 if( bDone )
     646 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bPrint;
     647                 :            :             }
     648                 :          0 :             break;
     649                 :            : 
     650                 :            :             case PROPERTYHANDLE_DOCWARN_CREATEPDF:
     651                 :            :             {
     652                 :          0 :                 bDone = !m_bROCreatePDF;
     653         [ #  # ]:          0 :                 if( bDone )
     654 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bCreatePDF;
     655                 :            :             }
     656                 :          0 :             break;
     657                 :            : 
     658                 :            :             case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
     659                 :            :             {
     660                 :          0 :                 bDone = !m_bRORemoveInfo;
     661         [ #  # ]:          0 :                 if( bDone )
     662 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bRemoveInfo;
     663                 :            :             }
     664                 :          0 :             break;
     665                 :            : 
     666                 :            :             case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
     667                 :            :             {
     668                 :          0 :                 bDone = !m_bRORecommendPwd;
     669         [ #  # ]:          0 :                 if( bDone )
     670 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bRecommendPwd;
     671                 :            :             }
     672                 :          0 :             break;
     673                 :            : 
     674                 :            :             case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
     675                 :            :             {
     676                 :          0 :                 bDone = !m_bROCtrlClickHyperlink;
     677         [ #  # ]:          0 :                 if( bDone )
     678 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bCtrlClickHyperlink;
     679                 :            :             }
     680                 :          0 :             break;
     681                 :            : 
     682                 :            :             case PROPERTYHANDLE_MACRO_SECLEVEL:
     683                 :            :             {
     684                 :          0 :                 bDone = !m_bROSecLevel;
     685         [ #  # ]:          0 :                 if( bDone )
     686 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_nSecLevel;
     687                 :            :             }
     688                 :          0 :             break;
     689                 :            : 
     690                 :            :             case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
     691                 :            :             {
     692                 :          0 :                 bDone = !m_bROTrustedAuthors;
     693         [ #  # ]:          0 :                 if( bDone )
     694                 :            :                 {
     695                 :          0 :                     sal_Int32   nCnt = m_seqTrustedAuthors.getLength();
     696         [ #  # ]:          0 :                     if( nCnt )
     697                 :            :                     {
     698         [ #  # ]:          0 :                         String  s;
     699         [ #  # ]:          0 :                         s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS );
     700         [ #  # ]:          0 :                         s.AppendAscii( "/a" );
     701                 :            : 
     702         [ #  # ]:          0 :                         Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt );
     703         [ #  # ]:          0 :                         for( sal_Int32 i = 0 ; i < nCnt ; ++i )
     704                 :            :                         {
     705 [ #  # ][ #  # ]:          0 :                             rtl::OUString aPrefix = rtl::OUStringBuffer(s).append(i).append('/').makeStringAndClear();
         [ #  # ][ #  # ]
                 [ #  # ]
     706         [ #  # ]:          0 :                             Sequence< com::sun::star::beans::PropertyValue >    lPropertyValues( 3 );
     707 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 0 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
     708 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 0 ].Value <<= m_seqTrustedAuthors[ i ][0];
         [ #  # ][ #  # ]
     709 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 1 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
     710 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 1 ].Value <<= m_seqTrustedAuthors[ i ][1];
         [ #  # ][ #  # ]
     711 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 2 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
     712 [ #  # ][ #  # ]:          0 :                             lPropertyValues[ 2 ].Value <<= m_seqTrustedAuthors[ i ][2];
         [ #  # ][ #  # ]
     713                 :            : 
     714                 :            : 
     715 [ #  # ][ #  # ]:          0 :                             SetSetProperties( PROPERTYNAME_MACRO_TRUSTEDAUTHORS, lPropertyValues );
         [ #  # ][ #  # ]
     716         [ #  # ]:          0 :                         }
     717                 :            : 
     718 [ #  # ][ #  # ]:          0 :                         bDone = false;      // because we save in loop above!
     719                 :            :                     }
     720                 :            :                     else
     721                 :          0 :                         bDone = false;
     722                 :            :                 }
     723                 :            :             }
     724                 :          0 :             break;
     725                 :            : 
     726                 :            :             case PROPERTYHANDLE_MACRO_DISABLE:
     727                 :            :             {
     728                 :          0 :                 bDone = !m_bRODisableMacros;
     729         [ #  # ]:          0 :                 if( bDone )
     730 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= (sal_Bool)m_bDisableMacros;
     731                 :            :             }
     732                 :          0 :             break;
     733                 :            : 
     734                 :            : 
     735                 :            :             // xmlsec05 depricated
     736                 :            :             case PROPERTYHANDLE_STAROFFICEBASIC:
     737                 :            :             {
     738                 :          0 :                 bDone = !m_bROBasicMode;
     739         [ #  # ]:          0 :                 if( bDone )
     740 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode;
     741                 :            :             }
     742                 :          0 :             break;
     743                 :            :             case PROPERTYHANDLE_EXECUTEPLUGINS:
     744                 :            :             {
     745                 :          0 :                 bDone = !m_bROExecutePlugins;
     746         [ #  # ]:          0 :                 if( bDone )
     747 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bExecutePlugins;
     748                 :            :             }
     749                 :          0 :             break;
     750                 :            :             case PROPERTYHANDLE_WARNINGENABLED:
     751                 :            :             {
     752                 :          0 :                 bDone = !m_bROWarning;
     753         [ #  # ]:          0 :                 if( bDone )
     754 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bWarning;
     755                 :            :             }
     756                 :          0 :             break;
     757                 :            :             case PROPERTYHANDLE_CONFIRMATIONENABLED:
     758                 :            :             {
     759                 :          0 :                 bDone = !m_bROConfirmation;
     760         [ #  # ]:          0 :                 if( bDone )
     761 [ #  # ][ #  # ]:          0 :                     lValues[ nRealCount ] <<= m_bConfirmation;
     762                 :            :             }
     763                 :          0 :             break;
     764                 :            :             // xmlsec05 depricated
     765                 :            : 
     766                 :            : 
     767                 :            :             default:
     768                 :          0 :                 bDone = false;
     769                 :            :         }
     770                 :            : 
     771         [ #  # ]:          0 :         if( bDone )
     772                 :            :         {
     773 [ #  # ][ #  # ]:          0 :             lNames[ nRealCount ] = lOrgNames[ nProperty ];
     774                 :          0 :             ++nRealCount;
     775                 :            :         }
     776                 :            :     }
     777                 :            :     // Set properties in configuration.
     778         [ #  # ]:          0 :     lNames.realloc(nRealCount);
     779         [ #  # ]:          0 :     lValues.realloc(nRealCount);
     780 [ #  # ][ #  # ]:          0 :     PutProperties( lNames, lValues );
         [ #  # ][ #  # ]
     781                 :          0 : }
     782                 :            : 
     783                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsReadOnly( SvtSecurityOptions::EOption eOption ) const
     784                 :            : {
     785                 :            :     sal_Bool    bReadonly;
     786   [ #  #  #  #  :          0 :     switch(eOption)
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     787                 :            :     {
     788                 :            :         case SvtSecurityOptions::E_SECUREURLS :
     789                 :          0 :             bReadonly = m_bROSecureURLs;
     790                 :          0 :             break;
     791                 :            :         case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
     792                 :          0 :             bReadonly = m_bROSaveOrSend;
     793                 :          0 :             break;
     794                 :            :         case SvtSecurityOptions::E_DOCWARN_SIGNING:
     795                 :          0 :             bReadonly = m_bROSigning;
     796                 :          0 :             break;
     797                 :            :         case SvtSecurityOptions::E_DOCWARN_PRINT:
     798                 :          0 :             bReadonly = m_bROPrint;
     799                 :          0 :             break;
     800                 :            :         case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
     801                 :          0 :             bReadonly = m_bROCreatePDF;
     802                 :          0 :             break;
     803                 :            :         case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
     804                 :          0 :             bReadonly = m_bRORemoveInfo;
     805                 :          0 :             break;
     806                 :            :         case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
     807                 :          0 :             bReadonly = m_bRORecommendPwd;
     808                 :          0 :             break;
     809                 :            :         case SvtSecurityOptions::E_MACRO_SECLEVEL:
     810                 :          0 :             bReadonly = m_bROSecLevel;
     811                 :          0 :             break;
     812                 :            :         case SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS:
     813                 :          0 :             bReadonly = m_bROTrustedAuthors;
     814                 :          0 :             break;
     815                 :            :         case SvtSecurityOptions::E_MACRO_DISABLE:
     816                 :          0 :             bReadonly = m_bRODisableMacros;
     817                 :          0 :             break;
     818                 :            :         case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
     819                 :          0 :             bReadonly = m_bROCtrlClickHyperlink;
     820                 :          0 :             break;
     821                 :            : 
     822                 :            : 
     823                 :            :         // xmlsec05 depricated
     824                 :            :         case SvtSecurityOptions::E_BASICMODE:
     825                 :          0 :             bReadonly = m_bROBasicMode;
     826                 :          0 :             break;
     827                 :            :         case SvtSecurityOptions::E_EXECUTEPLUGINS:
     828                 :          0 :             bReadonly = m_bROExecutePlugins;
     829                 :          0 :             break;
     830                 :            :         case SvtSecurityOptions::E_WARNING:
     831                 :          0 :             bReadonly = m_bROWarning;
     832                 :          0 :             break;
     833                 :            :         case SvtSecurityOptions::E_CONFIRMATION:
     834                 :          0 :             bReadonly = m_bROConfirmation;
     835                 :          0 :             break;
     836                 :            :         // xmlsec05 depricated
     837                 :            : 
     838                 :            : 
     839                 :            :         default:
     840                 :          0 :             bReadonly = sal_True;
     841                 :            :     }
     842                 :            : 
     843                 :          0 :     return bReadonly;
     844                 :            : }
     845                 :            : 
     846                 :          0 : Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const
     847                 :            : {
     848                 :          0 :     return m_seqSecureURLs;
     849                 :            : }
     850                 :            : 
     851                 :          0 : void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList )
     852                 :            : {
     853                 :            :     DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n");
     854 [ #  # ][ #  # ]:          0 :     if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList)
                 [ #  # ]
     855                 :            :     {
     856                 :          0 :         m_seqSecureURLs = seqURLList;
     857                 :          0 :         SetModified();
     858                 :            :     }
     859                 :          0 : }
     860                 :            : 
     861                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsSecureURL(  const   OUString&   sURL    ,
     862                 :            :                                                 const   OUString&   sReferer) const
     863                 :            : {
     864                 :          0 :     sal_Bool bState = sal_False;
     865                 :            : 
     866                 :            :     // Check for uncritical protocols first
     867                 :            :     // All protocols different from "macro..." and "slot..." are secure per definition and must not be checked.
     868                 :            :     // "macro://#..." means AppBasic macros that are considered safe
     869         [ #  # ]:          0 :     INetURLObject   aURL        ( sURL );
     870                 :          0 :     INetProtocol    aProtocol   = aURL.GetProtocol();
     871                 :            : 
     872                 :            :     // All other URLs must checked in combination with referer and internal information about security
     873   [ #  #  #  # ]:          0 :     if ( (aProtocol != INET_PROT_MACRO && aProtocol !=  INET_PROT_SLOT) ||
         [ #  # ][ #  # ]
     874 [ #  # ][ #  # ]:          0 :          aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) == 0)
                 [ #  # ]
     875                 :            :     {
     876                 :            :         // security check only for "macro" ( without app basic ) or "slot" protocols
     877                 :          0 :         bState = sal_True;
     878                 :            :     }
     879                 :            :     else
     880                 :            :     {
     881                 :            :         //  check list of allowed URL patterns
     882                 :            :         // Trusted referer given?
     883                 :            :         // NO  => bState will be false per default
     884                 :            :         // YES => search for it in our internal url list
     885         [ #  # ]:          0 :         if( !sReferer.isEmpty() )
     886                 :            :         {
     887                 :            :             // Search in internal list
     888                 :          0 :             ::rtl::OUString sRef = sReferer.toAsciiLowerCase();
     889                 :          0 :             sal_uInt32 nCount = m_seqSecureURLs.getLength();
     890         [ #  # ]:          0 :             for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
     891                 :            :             {
     892                 :          0 :                 OUString sCheckURL = m_seqSecureURLs[nItem].toAsciiLowerCase();
     893         [ #  # ]:          0 :                 sCheckURL += OUString(RTL_CONSTASCII_USTRINGPARAM("*"));
     894 [ #  # ][ #  # ]:          0 :                 if( WildCard( sCheckURL ).Matches( sRef ) == sal_True )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     895                 :            :                 {
     896                 :          0 :                     bState = sal_True;
     897                 :            :                     break;
     898                 :            :                 }
     899         [ #  # ]:          0 :             }
     900                 :            : 
     901         [ #  # ]:          0 :             if ( !bState )
     902                 :          0 :                 bState = sRef.compareToAscii("private:user") == COMPARE_EQUAL;
     903                 :            :         }
     904                 :            :     }
     905                 :            : 
     906                 :            :     // Return result of operation.
     907         [ #  # ]:          0 :     return bState;
     908                 :            : }
     909                 :            : 
     910                 :          0 : inline sal_Int32 SvtSecurityOptions_Impl::GetMacroSecurityLevel() const
     911                 :            : {
     912                 :          0 :     return m_nSecLevel;
     913                 :            : }
     914                 :            : 
     915                 :       2650 : inline sal_Bool SvtSecurityOptions_Impl::IsMacroDisabled() const
     916                 :            : {
     917                 :       2650 :     return m_bDisableMacros;
     918                 :            : }
     919                 :            : 
     920                 :          0 : void SvtSecurityOptions_Impl::SetMacroSecurityLevel( sal_Int32 _nLevel )
     921                 :            : {
     922         [ #  # ]:          0 :     if( !m_bROSecLevel )
     923                 :            :     {
     924 [ #  # ][ #  # ]:          0 :         if( _nLevel > 3 || _nLevel < 0 )
     925                 :          0 :             _nLevel = 3;
     926                 :            : 
     927         [ #  # ]:          0 :         if( m_nSecLevel != _nLevel )
     928                 :            :         {
     929                 :          0 :             m_nSecLevel = _nLevel;
     930                 :          0 :             SetModified();
     931                 :            :         }
     932                 :            :     }
     933                 :          0 : }
     934                 :            : 
     935                 :          0 : Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedAuthors() const
     936                 :            : {
     937                 :          0 :     return m_seqTrustedAuthors;
     938                 :            : }
     939                 :            : 
     940                 :          0 : void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors )
     941                 :            : {
     942                 :            :     DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n");
     943 [ #  # ][ #  # ]:          0 :     if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors )
                 [ #  # ]
     944                 :            :     {
     945                 :          0 :         m_seqTrustedAuthors = rAuthors;
     946                 :          0 :         SetModified();
     947                 :            :     }
     948                 :          0 : }
     949                 :            : 
     950                 :        400 : sal_Bool SvtSecurityOptions_Impl::IsOptionSet( SvtSecurityOptions::EOption eOption ) const
     951                 :            : {
     952                 :            :     sal_Bool*   pValue;
     953                 :            :     sal_Bool*   pRO;
     954                 :        400 :     sal_Bool    bRet = sal_False;
     955                 :            : 
     956         [ +  - ]:        400 :     if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
     957                 :        400 :         bRet = *pValue;
     958                 :            : 
     959                 :        400 :     return bRet;
     960                 :            : }
     961                 :            : 
     962                 :          0 : sal_Bool SvtSecurityOptions_Impl::SetOption( SvtSecurityOptions::EOption eOption, sal_Bool bValue )
     963                 :            : {
     964                 :            :     sal_Bool*   pValue;
     965                 :            :     sal_Bool*   pRO;
     966                 :          0 :     sal_Bool    bRet = sal_False;
     967                 :            : 
     968         [ #  # ]:          0 :     if( GetOption( eOption, pValue, pRO ) )
     969                 :            :     {
     970         [ #  # ]:          0 :         if( !*pRO )
     971                 :            :         {
     972                 :          0 :             bRet = sal_True;
     973         [ #  # ]:          0 :             if( *pValue != bValue )
     974                 :            :             {
     975                 :          0 :                 *pValue = bValue;
     976         [ #  # ]:          0 :                 SetModified();
     977                 :            :             }
     978                 :            :         }
     979                 :            :     }
     980                 :            : 
     981                 :          0 :     return bRet;
     982                 :            : }
     983                 :            : 
     984                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption eOption ) const
     985                 :            : {
     986                 :            :     sal_Bool*   pValue;
     987                 :            :     sal_Bool*   pRO;
     988                 :          0 :     sal_Bool    bRet = sal_False;
     989                 :            : 
     990         [ #  # ]:          0 :     if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
     991                 :          0 :         bRet = !*pRO;
     992                 :            : 
     993                 :          0 :     return bRet;
     994                 :            : }
     995                 :            : 
     996                 :        128 : Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
     997                 :            : {
     998                 :            :     // Build static list of configuration key names.
     999                 :            :     const OUString pProperties[] =
    1000                 :            :     {
    1001                 :            :         PROPERTYNAME_SECUREURL,
    1002                 :            :         PROPERTYNAME_STAROFFICEBASIC,
    1003                 :            :         PROPERTYNAME_EXECUTEPLUGINS,
    1004                 :            :         PROPERTYNAME_WARNINGENABLED,
    1005                 :            :         PROPERTYNAME_CONFIRMATIONENABLED,
    1006                 :            :         PROPERTYNAME_DOCWARN_SAVEORSEND,
    1007                 :            :         PROPERTYNAME_DOCWARN_SIGNING,
    1008                 :            :         PROPERTYNAME_DOCWARN_PRINT,
    1009                 :            :         PROPERTYNAME_DOCWARN_CREATEPDF,
    1010                 :            :         PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO,
    1011                 :            :         PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD,
    1012                 :            :         PROPERTYNAME_CTRLCLICK_HYPERLINK,
    1013                 :            :         PROPERTYNAME_MACRO_SECLEVEL,
    1014                 :            :         PROPERTYNAME_MACRO_TRUSTEDAUTHORS,
    1015                 :            :         PROPERTYNAME_MACRO_DISABLE
    1016 [ +  - ][ +  - ]:       2048 :     };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
           [ #  #  #  # ]
    1017                 :            :     // Initialize return sequence with these list ...
    1018         [ +  - ]:        128 :     const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
    1019                 :            :     // ... and return it.
    1020 [ +  + ][ #  # ]:       2048 :     return seqPropertyNames;
    1021                 :            : }
    1022                 :            : 
    1023                 :            : //*****************************************************************************************************************
    1024                 :            : //  initialize static member
    1025                 :            : //  DON'T DO IT IN YOUR HEADER!
    1026                 :            : //  see definition for further informations
    1027                 :            : //*****************************************************************************************************************
    1028                 :            : SvtSecurityOptions_Impl*    SvtSecurityOptions::m_pDataContainer    = NULL  ;
    1029                 :            : sal_Int32                   SvtSecurityOptions::m_nRefCount         = 0     ;
    1030                 :            : 
    1031                 :       3178 : SvtSecurityOptions::SvtSecurityOptions()
    1032                 :            : {
    1033                 :            :     // Global access, must be guarded (multithreading!).
    1034 [ +  - ][ +  - ]:       3178 :     MutexGuard aGuard( GetInitMutex() );
    1035                 :            :     // Increase ouer refcount ...
    1036                 :       3178 :     ++m_nRefCount;
    1037                 :            :     // ... and initialize ouer data container only if it not already exist!
    1038         [ +  + ]:       3178 :     if( m_pDataContainer == NULL )
    1039                 :            :     {
    1040                 :            :         RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSecurityOptions_Impl::ctor()");
    1041 [ +  - ][ +  - ]:        128 :         m_pDataContainer = new SvtSecurityOptions_Impl;
    1042                 :            : 
    1043         [ +  - ]:        128 :         ItemHolder1::holdConfigItem(E_SECURITYOPTIONS);
    1044         [ +  - ]:       3178 :     }
    1045                 :       3178 : }
    1046                 :            : 
    1047                 :       3178 : SvtSecurityOptions::~SvtSecurityOptions()
    1048                 :            : {
    1049                 :            :     // Global access, must be guarded (multithreading!)
    1050 [ +  - ][ +  - ]:       3178 :     MutexGuard aGuard( GetInitMutex() );
    1051                 :            :     // Decrease ouer refcount.
    1052                 :       3178 :     --m_nRefCount;
    1053                 :            :     // If last instance was deleted ...
    1054                 :            :     // we must destroy ouer static data container!
    1055         [ +  + ]:       3178 :     if( m_nRefCount <= 0 )
    1056                 :            :     {
    1057 [ +  - ][ +  - ]:        128 :         delete m_pDataContainer;
    1058                 :        128 :         m_pDataContainer = NULL;
    1059         [ +  - ]:       3178 :     }
    1060         [ -  + ]:       3306 : }
    1061                 :            : 
    1062                 :          0 : sal_Bool SvtSecurityOptions::IsReadOnly( EOption eOption ) const
    1063                 :            : {
    1064 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1065         [ #  # ]:          0 :     return m_pDataContainer->IsReadOnly(eOption);
    1066                 :            : }
    1067                 :            : 
    1068                 :          0 : Sequence< OUString > SvtSecurityOptions::GetSecureURLs() const
    1069                 :            : {
    1070 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1071 [ #  # ][ #  # ]:          0 :     return m_pDataContainer->GetSecureURLs();
    1072                 :            : }
    1073                 :            : 
    1074                 :          0 : void SvtSecurityOptions::SetSecureURLs( const Sequence< OUString >& seqURLList )
    1075                 :            : {
    1076 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1077 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetSecureURLs( seqURLList );
    1078                 :          0 : }
    1079                 :            : 
    1080                 :          0 : sal_Bool SvtSecurityOptions::IsSecureURL(   const   OUString&   sURL        ,
    1081                 :            :                                             const   OUString&   sReferer    ) const
    1082                 :            : {
    1083 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1084 [ #  # ][ #  # ]:          0 :     return m_pDataContainer->IsSecureURL( sURL, sReferer );
    1085                 :            : }
    1086                 :            : 
    1087                 :          0 : sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const
    1088                 :            : {
    1089 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1090         [ #  # ]:          0 :     return m_pDataContainer->GetMacroSecurityLevel();
    1091                 :            : }
    1092                 :            : 
    1093                 :          0 : void SvtSecurityOptions::SetMacroSecurityLevel( sal_Int32 _nLevel )
    1094                 :            : {
    1095 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1096 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetMacroSecurityLevel( _nLevel );
    1097                 :          0 : }
    1098                 :            : 
    1099                 :       2650 : sal_Bool SvtSecurityOptions::IsMacroDisabled() const
    1100                 :            : {
    1101 [ +  - ][ +  - ]:       2650 :     MutexGuard aGuard( GetInitMutex() );
    1102         [ +  - ]:       2650 :     return m_pDataContainer->IsMacroDisabled();
    1103                 :            : }
    1104                 :            : 
    1105                 :          0 : Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions::GetTrustedAuthors() const
    1106                 :            : {
    1107 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1108 [ #  # ][ #  # ]:          0 :     return m_pDataContainer->GetTrustedAuthors();
    1109                 :            : }
    1110                 :            : 
    1111                 :          0 : void SvtSecurityOptions::SetTrustedAuthors( const Sequence< Certificate >& rAuthors )
    1112                 :            : {
    1113 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1114 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetTrustedAuthors( rAuthors );
    1115                 :          0 : }
    1116                 :            : 
    1117                 :        400 : bool SvtSecurityOptions::IsOptionSet( EOption eOption ) const
    1118                 :            : {
    1119 [ +  - ][ +  - ]:        400 :     MutexGuard aGuard( GetInitMutex() );
    1120         [ +  - ]:        400 :     return m_pDataContainer->IsOptionSet( eOption );
    1121                 :            : }
    1122                 :            : 
    1123                 :          0 : bool SvtSecurityOptions::SetOption( EOption eOption, bool bValue )
    1124                 :            : {
    1125 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1126 [ #  # ][ #  # ]:          0 :     return m_pDataContainer->SetOption( eOption, bValue );
    1127                 :            : }
    1128                 :            : 
    1129                 :          0 : bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const
    1130                 :            : {
    1131 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1132         [ #  # ]:          0 :     return m_pDataContainer->IsOptionEnabled( eOption );
    1133                 :            : }
    1134                 :            : 
    1135                 :            : namespace
    1136                 :            : {
    1137                 :            :     class theSecurityOptionsMutex : public rtl::Static<osl::Mutex, theSecurityOptionsMutex>{};
    1138                 :            : }
    1139                 :            : 
    1140                 :       9406 : Mutex& SvtSecurityOptions::GetInitMutex()
    1141                 :            : {
    1142                 :       9406 :     return theSecurityOptionsMutex::get();
    1143                 :            : }
    1144                 :            : 
    1145                 :            : 
    1146                 :            : 
    1147                 :            : 
    1148                 :            : // xmlsec05 depricated
    1149                 :            : 
    1150                 :          0 : EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const
    1151                 :            : {
    1152                 :          0 :     return m_eBasicMode;
    1153                 :            : }
    1154                 :            : 
    1155                 :          0 : void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode )
    1156                 :            : {
    1157                 :            :     DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n");
    1158 [ #  # ][ #  # ]:          0 :     if (!m_bROBasicMode && m_eBasicMode!=eMode)
    1159                 :            :     {
    1160                 :          0 :         m_eBasicMode = eMode;
    1161                 :          0 :         SetModified();
    1162                 :            :     }
    1163                 :          0 : }
    1164                 :            : 
    1165                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const
    1166                 :            : {
    1167                 :          0 :     return m_bExecutePlugins;
    1168                 :            : }
    1169                 :            : 
    1170                 :          0 : void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet )
    1171                 :            : {
    1172                 :            :     DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n");
    1173 [ #  # ][ #  # ]:          0 :     if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet)
    1174                 :            :     {
    1175                 :          0 :         m_bExecutePlugins = bSet;
    1176                 :          0 :         SetModified();
    1177                 :            :     }
    1178                 :          0 : }
    1179                 :            : 
    1180                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const
    1181                 :            : {
    1182                 :          0 :     return m_bWarning;
    1183                 :            : }
    1184                 :            : 
    1185                 :          0 : void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet )
    1186                 :            : {
    1187                 :            :     DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n");
    1188 [ #  # ][ #  # ]:          0 :     if (!m_bROWarning && m_bWarning!=bSet)
    1189                 :            :     {
    1190                 :          0 :         m_bWarning = bSet;
    1191                 :          0 :         SetModified();
    1192                 :            :     }
    1193                 :          0 : }
    1194                 :            : 
    1195                 :          0 : sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const
    1196                 :            : {
    1197                 :          0 :     return m_bConfirmation;
    1198                 :            : }
    1199                 :            : 
    1200                 :          0 : void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet )
    1201                 :            : {
    1202                 :            :     DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n");
    1203 [ #  # ][ #  # ]:          0 :     if (!m_bROConfirmation && m_bConfirmation!=bSet)
    1204                 :            :     {
    1205                 :          0 :         m_bConfirmation = bSet;
    1206                 :          0 :         SetModified();
    1207                 :            :     }
    1208                 :          0 : }
    1209                 :            : 
    1210                 :            : 
    1211                 :          0 : sal_Bool SvtSecurityOptions::IsExecutePlugins() const
    1212                 :            : {
    1213 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1214         [ #  # ]:          0 :     return m_pDataContainer->IsExecutePlugins();
    1215                 :            : }
    1216                 :            : 
    1217                 :          0 : void SvtSecurityOptions::SetExecutePlugins( sal_Bool bSet )
    1218                 :            : {
    1219 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1220 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetExecutePlugins( bSet );
    1221                 :          0 : }
    1222                 :            : 
    1223                 :          0 : sal_Bool SvtSecurityOptions::IsWarningEnabled() const
    1224                 :            : {
    1225 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1226         [ #  # ]:          0 :     return m_pDataContainer->IsWarningEnabled();
    1227                 :            : }
    1228                 :            : 
    1229                 :          0 : void SvtSecurityOptions::SetWarningEnabled( sal_Bool bSet )
    1230                 :            : {
    1231 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1232 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetWarningEnabled( bSet );
    1233                 :          0 : }
    1234                 :            : 
    1235                 :          0 : sal_Bool SvtSecurityOptions::IsConfirmationEnabled() const
    1236                 :            : {
    1237 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1238         [ #  # ]:          0 :     return m_pDataContainer->IsConfirmationEnabled();
    1239                 :            : }
    1240                 :            : 
    1241                 :          0 : void SvtSecurityOptions::SetConfirmationEnabled( sal_Bool bSet )
    1242                 :            : {
    1243 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1244 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetConfirmationEnabled( bSet );
    1245                 :          0 : }
    1246                 :            : 
    1247                 :          0 : void SvtSecurityOptions::SetBasicMode( EBasicSecurityMode eMode )
    1248                 :            : {
    1249 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1250 [ #  # ][ #  # ]:          0 :     m_pDataContainer->SetBasicMode( eMode );
    1251                 :          0 : }
    1252                 :            : 
    1253                 :          0 : EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const
    1254                 :            : {
    1255 [ #  # ][ #  # ]:          0 :     MutexGuard aGuard( GetInitMutex() );
    1256         [ #  # ]:          0 :     return m_pDataContainer->GetBasicMode();
    1257                 :            : }
    1258                 :            : 
    1259                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10