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: formtools.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:46 $
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 : marc.neumann@sun.com
36 '* short description : Helper Routines for Base tests.
38 '***************************************************************************************
40 '* #1 fOpenNewFormDesign
46 '\***********************************************************************************
47 '-------------------------------------------------------------------------
48 function fOpenNewFormDesign()
49 '/// open a a new form design from an open database
50 '/// <u>parameter:</u>
53 if ( Database.NotExists(3) ) then
54 fOpenNewFormDesign = false
58 Database.MouseDown(50,50)
59 Database.MouseUp(50,50)
68 fOpenNewFormDesign = true
71 '--------------------------------------------------------------------
72 function fCloseForm( optional bSave )
73 '/// close an open form
74 '/// <u>parameter:</u>
75 '/// <b><i>optional</i> bSave:</b> if true the form shall be saved, if false the changes are lost
79 Kontext "DocumentWriter"
80 DocumentWriter.UseMenu
81 hMenuSelectNr(1) ' the file menu
82 hMenuSelectNr(5) ' the Close Window
84 'when issue 30401 is fixed this has to be changed
86 if Messagebox.Exists(3) then
87 if ( IsMissing( bSave ) ) then
103 '--------------------------------------------------------------------
104 function fSaveForm( sFormName as string, optional bCloseForm as boolean )
105 '/// save an open form with the given name
106 '/// <u>parameter:</u>
107 '/// <b>sFormName:</b> the name under which the form shall be saved. If the file allready exists, then the file will be overwritten
108 '/// <b><i>optional</i> bCloseForm:</b> if true the form shall be closed after saving, if false form stay open
111 Kontext "DocumentWriter"
112 DocumentWriter.UseMenu
113 hMenuSelectNr(1) ' the file menu
114 hMenuSelectNr(6) ' the Save
116 Kontext "FormSaveDialog"
117 if FormSaveDialog.exists(3) then
118 FormName.setText(sFormName)
120 'click yes in the overwrite messages box
122 if MessageBox.exists(1) then
130 if ( IsMissing( bCloseForm ) ) then
137 '--------------------------------------------------------------------
138 function fOpenForm(sFormName as string)
139 '/// open a form with the given name
140 '/// <u>parameter:</u>
141 '/// <b>sFormName:</b> the name of the form which shall be open
143 if ( fFindForm(sFormName) = true ) then
144 printlog "Form found -> open"
145 Kontext "ContainerView"
146 OpenForm ' uno-Slot .uno:DB/Open
150 printlog "Form not found."
155 '--------------------------------------------------------------------
156 function fFindForm(sFormName as string)
157 '/// select a form with the given name
158 '/// <u>parameter:</u>
159 '/// <b>sFormName:</b> the name of the form which shall be selected
161 Dim iNumbersOfForms as integer
164 Kontext "ContainerView"
170 if ( Not FormTree.exists(1) ) then
171 warnlog "The form tree doesn't exists"
175 iNumbersOfForms = FormTree.getItemCount()
177 ' this select the first entry
178 FormTree.TypeKeys "<HOME>"
179 FormTree.TypeKeys "<UP>"
182 for i = 1 to iNumbersOfForms
184 FormTree.TypeKeys "<ADD>"
186 'printlog "FormName.getItemCount = " + FormTree.getItemCount
187 if FormTree.getItemCount > iNumbersOfForms then
188 iNumbersOfForms = FormTree.getItemCount()
190 'printlog "FormName.getSeltext = " + FormTree.getSeltext
191 if FormTree.getSeltext = sFormName then
195 FormTree.TypeKeys "<DOWN>"