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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: basic_vba-compat_import_disabled.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Test VBA compatibility switches
38 '\******************************************************************************
40 testcase tBasicVBACompatImportDisabled()
42 printlog( "Test VBA compatibility switch / executable Microsoft(R) Excel(R) Macros" )
43 printlog( "Test case 2: Import macros but do not set the executable mode" )
46 ' This test case is based on the use cases provided in issue #i88690
47 ' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
49 dim cTestFile as string
50 cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/vba-test.xls"
52 dim cNodeCount as integer
54 dim caNodeData( 7 ) as string
55 caNodeData( 1 ) = "Standard"
56 caNodeData( 2 ) = "DieseArbeitsmappe"
57 caNodeData( 3 ) = "Modul1"
58 caNodeData( 4 ) = "Modul2"
59 caNodeData( 5 ) = "Tabelle1"
60 caNodeData( 6 ) = "Tabelle2"
61 caNodeData( 7 ) = "Tabelle3"
63 dim iCurrentModule as integer
64 dim cCurrentModule as string
67 ' Depending on the mode of macro import we have differtent basic libraries listed
70 const DOCUMENT_POSITION_OFFSET = -7
72 const IMPORT_EXCEL_MACROS = TRUE
73 const EXEC_EXCEL_MACROS = FALSE
75 printlog( "Set macro security to low" )
76 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
78 printlog( "Open Tools/Options" )
80 hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
82 printlog( "Load the test file" )
83 hFileOpen( cTestFile )
85 printlog( "Open the Basic organizer" )
86 hOpenBasicOrganizerFromDoc()
88 printlog( "Expand all nodes" )
89 cNodeCount = hExpandAllNodes( MakroAus )
91 printlog( "Verify that we have the correct node count for the current mode" )
92 if ( cNodeCount <> NODE_COUNT ) then
93 warnlog( "The number of nodes is incorrect: " & cNodeCount )
96 printlog( "Verify position of the document node" )
97 MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
98 if ( MakroAus.getSelText() <> "vba-test.xls" ) then
99 qaerrorlog( "The document node is not at the expected position" )
102 for iCurrentModule = 2 to 7
104 printlog( "Look for: " & caNodeData( iCurrentModule ) )
108 MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET + iCurrentModule )
109 cCurrentModule = MakroAus.getSelText()
111 for iCurrentModule = 2 to 7
113 if ( cCurrentModule = caNodeData( iCurrentModule ) ) then
115 if ( MakroListe.getSelText() <> caNodeData( iCurrentModule ) ) then
116 warnlog( "Module has incorrect script: " & cCurrentModule )
124 if ( not bFound ) then
125 warnlog( "The node was not found: " & cCurrentModule )
127 printlog( "Module found, script found, good" )
132 printlog( "Close Macro Organizer" )
138 hSetExcelImportModeDefault()
139 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )