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_nothing.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 tBasicVBACompatImportNothing()
42 printlog( "Test VBA compatibility switch / executable Microsoft(R) Excel(R) Macros" )
43 printlog( "Test case 1: Do not import macros at all" )
45 ' This test case is based on the use cases provided in issue #i88690
46 ' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
48 dim cTestFile as string
49 cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/vba-test.xls"
51 dim cNodeCount as integer
53 ' Depending on the mode of macro import we have differtent basic libraries listed
54 const NODE_COUNT = 72 ' Do not import Microsoft(R) Excel(R) macros at all
55 const MACRO_LIST = 0 ' The document library should have no scripts listed
56 const DOCUMENT_POSITION_OFFSET = -1
58 const IMPORT_EXCEL_MACROS = FALSE
59 const EXEC_EXCEL_MACROS = FALSE
61 printlog( "Set macro security to low" )
62 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
64 printlog( "Open Tools/Options" )
66 hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
68 printlog( "Load the test file" )
69 hFileOpen( cTestFile )
71 printlog( "Open the Basic organizer" )
72 hOpenBasicOrganizerFromDoc()
74 printlog( "Expand all nodes" )
75 cNodeCount = hExpandAllNodes( MakroAus )
77 printlog( "Verify that we have the correct node count for the current mode" )
78 if ( cNodeCount <> NODE_COUNT ) then
79 warnlog( "The number of nodes is incorrect: " & cNodeCount )
82 printlog( "Verify position of the document node" )
83 MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
84 if ( MakroAus.getSelText() <> "vba-test.xls" ) then
85 qaerrorlog( "The document node is not at the expected position" )
88 printlog( "Select the last node, this should be the standard Library for the document" )
89 MakroAus.select( cNodeCount )
91 printlog( "Verify that the Standard library for the document has no scripts" )
92 if ( MakroListe.getItemCount <> MACRO_LIST ) then
93 warnlog( "There should be no macros listed for the current library"
96 printlog( "Close Macro Organizer" )
102 hSetExcelImportModeDefault()
103 hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )