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_package_export.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 : Export BASIC libraries as package
38 '\******************************************************************************
40 testcase tBasicPackageExport
42 '///<h1>Export a BASIC library as UNO package</h1>
43 ' Assumption: All actions take place in the user/work directory
44 ' macro taken from framework/tools/input/macros.txt::tBasicLibraryExport
46 const PACKAGE_NAME = "tBasicExport.oxt"
47 const LIBRARY_NAME = "tBasicExport"
48 const DOCUMENT_POSITION = 4
50 dim cDocumentName as string
51 dim cLibraryName as string
53 dim iNodeCount as integer
55 dim iCurrentLib as integer
58 cFile = hGetWorkPath() & PACKAGE_NAME
63 hExtensionRemoveGUI( PACKAGE_NAME )
67 '///+<li>Make sure that we have exactly one open document</li>
71 '///+<li>Create a new writer document</li>
72 printlog( "Create a new documentbound library for export" )
73 gApplication = "WRITER"
76 '///+<li>Go to Tools/Macros/Organize Macros/OpenOffice.org Basic</li>
79 '///+<li>Select the last node (number 4, document untitled2)</li>
81 iNodeCount = hGetNodeCount( MakroAus )
82 cDocumentName = hSelectNode( MakroAus, iNodeCount )
84 '///+<li>Click to open the organizer</li>
87 '///+<li>Switch to the libraries-tab</li>
88 hSelectBasicObjectOrganizerTab( 3 )
90 '///+<li>Select the document (untitled2 at pos. 4)</li>
91 kontext "TabBibliotheken"
92 Bibliothek.select( DOCUMENT_POSITION )
94 ' verify that the correct document is selected
95 if ( Bibliothek.getSelText() <> cDocumentName ) then
96 warnlog( "Incorrect document selected on libraries tab, aborting" )
100 '///+<li>Click to create a new library</li>
103 '///+<li>Name the library "tBasicLibraryExport", confirm with ok</li>
104 kontext "NeueBibliothek"
105 BibliotheksName.setText( LIBRARY_NAME )
108 '///+<li>Verify that the correct library is selected</li>
109 kontext "TabBibliotheken"
110 cLibraryName = BibliotheksListe.getSelText()
112 '///+<li>Click to edit the library</li>
115 '///+<li>Insert a macro (e.g. to print a messagebox)</li>
116 hInsertMacroFromFile( LIBRARY_NAME )
118 '///+<li>Close the Basic IDE</li>
121 '///+<li>Go to Tools/Macros/Organize Macros/OpenOffice.org Basic</li>
124 '///+<li>Select the last node (untitled2)</li>
126 iNodeCount = hGetNodeCount( MakroAus )
127 hSelectNode( MakroAus, iNodeCount )
129 '///+<li>Click to open the organizer</li>
132 '///+<li>Switch to the libraries-tab</li>
133 hSelectBasicObjectOrganizerTab( 3 )
135 '///+<li>Select the document (untitled2 at pos. 4)</li>
136 kontext "TabBibliotheken"
137 Bibliothek.select( DOCUMENT_POSITION )
139 '///+<li>Find the new library, select it</li>
140 printlog( "Select the new library" )
141 kontext "TabBibliotheken"
142 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
143 Bibliotheksliste.select( iCurrentLib )
144 if ( Bibliotheksliste.getSelText() = LIBRARY_NAME ) then
149 '///+<li>Click Export</li>
150 kontext "TabBibliotheken"
151 printlog( "Export the package, close the document afterwards" )
154 '///+<li>Select to export as package, click ok</li>
155 kontext "ExportBasicLibraryDlg"
156 ExportAsPackage.check()
157 ExportBasicLibraryDlg.ok()
159 '///+<li>Name the package "tBasicLibraryExportAsPackage", save it</li>
160 kontext "SpeichernDlg"
161 DateiName.setText( hGetWorkPath() & LIBRARY_NAME ) ' automatic filename extension/uno-pkg is default
164 '///+<li>Close the macro organizer</li>
165 kontext "TabBibliotheken"
166 TabBibliotheken.cancel()
168 '///+<li>Close OpenOffice.org Basic Macros dialog</li>
172 '///+<li>Close the first document</li>
175 '///+<li>Close the second document</li>