1 'encoding UTF-8 Do not remove or change this line!
2 '*******************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/******************************************************************************
28 '* owner : gregor.hartmann@oracle.com
30 '* short description : Test VBA compatibility switches
32 '\******************************************************************************
34 testcase tBasicVBACompatImportDisabled()
36 printlog( "Test VBA compatibility switch / executable Microsoft(R) Excel(R) Macros" )
37 printlog( "Test case 2: Import macros but do not set the executable mode" )
39 ' This test case is based on the use cases provided in issue #i88690
40 ' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
44 const DOCUMENT_POSITION_OFFSET = -7
46 const IMPORT_EXCEL_MACROS = TRUE
47 const EXEC_EXCEL_MACROS = FALSE
49 const DOCUMENT_NAME = "vba-test.xls"
52 const MATCH_PARTLY = 2
54 dim cTestFile as string
55 cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
57 dim cNodeCount as integer
59 dim caNodeData( 7 ) as string
60 caNodeData( 1 ) = "Standard"
61 caNodeData( 2 ) = "DieseArbeitsmappe"
62 caNodeData( 3 ) = "Modul1"
63 caNodeData( 4 ) = "Modul2"
64 caNodeData( 5 ) = "Tabelle1"
65 caNodeData( 6 ) = "Tabelle2"
66 caNodeData( 7 ) = "Tabelle3"
68 dim iCurrentModule as integer
69 dim cCurrentModule as string
72 printlog( "Set macro security to low" )
73 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
75 printlog( "Open Tools/Options" )
77 hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
79 printlog( "Load the test file" )
80 hFileOpen( cTestFile )
82 printlog( "Open the Basic organizer" )
85 printlog( "Expand all nodes" )
87 cNodeCount = hExpandAllNodes( MakroAus )
89 printlog( "Verify that we have the correct node count for the current mode" )
91 if ( cNodeCount <> NODE_COUNT_OOO ) then warnlog( "The number of nodes is incorrect: " & cNodeCount )
93 if ( cNodeCount <> NODE_COUNT ) then warnlog( "The number of nodes is incorrect: " & cNodeCount )
96 printlog( "Verify position of the document node" )
97 MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
98 select case( hCompareSubStrings( MakroAus.getSelText(), DOCUMENT_NAME ) )
99 case MATCH_NONE : warnlog ( "The document is not listed at the expected position" )
100 case MATCH_EXACT : printlog( "The document is at the expected position and writable" )
101 case MATCH_PARTLY : printlog( "The document is at the expected position and write protected" )
104 for iCurrentModule = 2 to 7
106 printlog( "Look for: " & caNodeData( iCurrentModule ) )
110 MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET + iCurrentModule )
111 cCurrentModule = MakroAus.getSelText()
113 for iCurrentModule = 2 to 7
115 if ( cCurrentModule = caNodeData( iCurrentModule ) ) then
117 if ( MakroListe.getSelText() <> caNodeData( iCurrentModule ) ) then
118 warnlog( "Module has incorrect script: " & cCurrentModule )
126 if ( not bFound ) then
127 warnlog( "The node was not found: " & cCurrentModule )
129 printlog( "Module found, script found, good" )
134 printlog( "Close Macro Organizer" )
140 hSetExcelImportModeDefault()
141 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )