'encoding UTF-8 Do not remove or change this line! '************************************************************************** ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ' ' Copyright 2000, 2010 Oracle and/or its affiliates. ' ' OpenOffice.org - a multi-platform office productivity suite ' ' This file is part of OpenOffice.org. ' ' OpenOffice.org is free software: you can redistribute it and/or modify ' it under the terms of the GNU Lesser General Public License version 3 ' only, as published by the Free Software Foundation. ' ' OpenOffice.org is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU Lesser General Public License version 3 for more details ' (a copy is included in the LICENSE file that accompanied this code). ' ' You should have received a copy of the GNU Lesser General Public License ' version 3 along with OpenOffice.org. If not, see ' ' for a copy of the LGPLv3 License. ' '/************************************************************************ '* '* owner : joerg.skottke@oracle.com '* '* short description : Tools to ease testing of security related funtionality '* '\****************************************************************************** function hSetPasswordRecommendation( bEnable as boolean ) as boolean '///

Toggle Tools/Options/OOo/Security: Password recommendation

'///Input: '///
    '///+
  1. Mode (boolean)
  2. '/// '///
'///Returns: '///
    '///+
  1. Prior state (boolean)
  2. '/// '///
'///Description: '/// end function '****************************************************************************** function hOpenDigitalSignaturesDialog() as boolean '///

Open the Digital Signatures Dialog via File-Menu

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hAllowMacroExecution() as boolean '///

Allow macro execution on Macro Security Warning dialog

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hDenyMacroExecution() as boolean '///

Deny macro execution on Macro Security Warning dialog

'///Input: '///
    '///+
  1. Nothing
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
'///Description: '/// end function '******************************************************************************* function hSwitchMacroSecurityTab( cTab as string ) '///

Switch between Security Level and Trusted Paths

'///Input: '///
    '///+
  1. The Tabpage to be activated (string). Valid options are:
  2. '/// '///
'///Returns: '///
    '///+
  1. Nothing
  2. '///
'///Description: '/// end function '******************************************************************************* function hAddTrustedPath( cPath as string ) as boolean '///

Add a directory to the list of trusted paths

'///Input: '///
    '///+
  1. Fully qualified path to the directory (string)
  2. '///
'///Return: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
const CFN = "hAddTrustedPath::" dim iPathCount as integer '///Description: '/// end function '******************************************************************************* function hRemoveTrustedPath( cPath as string ) as boolean '///

Remove a directory from the list of trusted paths

'///Input: '///
    '///+
  1. Fully qualified path to the directory (string)
  2. '///
'///Return: '///
    '///+
  1. Errorcondition (boolean)
  2. '/// '///
const CFN = "hRemoveTrustedPath()" dim iPathCount as integer dim iCurrentPathItem as integer hRemoveTrustedPath() = false '///Description: '/// end function '******************************************************************************* function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean '///

Enter password when saving a document

'///This function enters a password into the password dialog if the " '///+ Save with password" checkbox is checked. It will automatically '///+ generate a faulty password to be entered on first try (to see whether '///+ the "Invalid password confirmation" dialog pops up, on second '///+ attempt the password is confirmed correctly and thus the document should '///+ save ok. The office should return to the document, the File Save dialog '///+ should close after save.

'///Parameter(s):
'///
    '///+
  1. Password to use (String)
  2. '/// '///
'///Returns:
'///
    '///+
  1. Errorcondition (Boolean)
  2. '/// '///
const CFN = "hSecurityEnterPasswordOnSave::" if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///Description: '/// if ( GVERBOSE ) then printlog( CFN & "Exit" ) end function '******************************************************************************* function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) as boolean '///

Enter a password while loading a document

'///Enters a valid or invalid password while loading a passworded file

'///Parameter(s):
'///
    '///+
  1. Password (String)
  2. '/// '///+
  3. Password validity (Boolean)
  4. '/// '///
'///Returns:
'///
    '///+
  1. Errorcondition (Boolean)
  2. '/// '///
const CFN = "hSecurityEnterPasswordOnLoad::" if ( GVERBOSE ) then printlog( CFN & "Enter with option (Password): " & cPassword ) printlog( CFN & "Enter with option (Validity): " & bValid ) endif hSecurityEnterPasswordOnLoad() = true '///Description: '/// end function '******************************************************************************* function hSelectXMLSecTab( cTab as string ) as boolean const CFN = "hSelectXMLSecTab::" hSelectXMLSecTab() = false kontext select case ( ucase( cTab ) ) case "GENERAL" : active.setpage TabXMLSecGeneral if ( TabXMLSecGeneral.exists() and TabXMLSecGeneral.isVisible() ) then printlog( CFN & "Switched to General page" ) hSelectXMLSecTab() = true exit function endif case "DETAILS" : active.setpage TabXMLSecDetails if ( TabXMLSecDetails.exists() and TabXMLSecDetails.isVisible() ) then printlog( CFN & "Switched to Details page" ) hSelectXMLSecTab() = true exit function endif case "PATH" : active.setpage TabXMLSecCertPath if ( TabXMLSecCertPath.exists() and TabXMLSecCertPath.isVisible() ) then printlog( CFN & "Switched to Certification Path page" ) hSelectXMLSecTab() = true exit function endif end select warnlog( CFN & "Failed to switch XML Security Tabpage" ) end function