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 : marc.neumann@oracle.com
30 '* short description : Report Helper Routines for Base tests.
32 '***************************************************************************************
34 '* #1 fOpenNewReoprtDesign
35 '* #1 fCloseReportDesign
36 '* #1 fCloseReportView
40 '* #1 fOpenReportNavigator
41 '* #1 fCloseReportNavigator
42 '* #1 fSwitchPageheader
44 '* #1 fCloseAddFieldDialog
45 '* #1 tools_reporttools_InstallExtension
47 '\***********************************************************************************
48 '-------------------------------------------------------------------------
49 function fOpenNewReportDesign()
50 '/// open a a new report design from an open database
51 '/// <u>parameter:</u>
54 if ( Database.NotExists(3) ) then
55 fOpenNewReportDesign = false
59 Database.MouseDown(50,50)
60 Database.MouseUp(50,50)
69 ' Kontext "ReportDesign"
70 ' ReportDesign.MouseDown(50,50)
71 ' ReportDesign.MouseUp(50,50)
75 fOpenNewReportDesign = true
78 '--------------------------------------------------------------------
79 function fCloseReportDesign( optional bSave )
80 '/// close an open Report
81 '/// <u>parameter:</u>
82 '/// <b><i>optional</i> bSave:</b> if true the Report shall be saved, if false the changes are lost
86 Kontext "ReportDesign"
88 hMenuSelectNr(1) ' the file menu
89 hMenuSelectNr(5) ' the Close Window
91 'when issue 30401 is fixed this has to be changed
93 if Messagebox.Exists(3) then
94 if ( IsMissing( bSave ) ) then
107 fCloseReportDesign = true
110 '--------------------------------------------------------------------
111 function fCloseReportView()
112 '/// close an open Report View
113 '/// <u>parameter:</u>
117 Kontext "DocumentWriter"
118 DocumentWriter.UseMenu
119 hMenuSelectNr(1) ' the file menu
120 hMenuSelectNr(5) ' the Close Window
124 fCloseReportView = true
127 '--------------------------------------------------------------------
128 function fSaveReport( sReportName as string, optional bCloseReport as boolean )
129 '/// save an open Report with the given name
130 '/// <u>parameter:</u>
131 '/// <b>sReportName:</b> the name under which the Report shall be saved. If the file allready exists, then the file will be overwritten
132 '/// <b><i>optional</i> bCloseReport:</b> if true the Report shall be closed after saving, if false Report stay open
135 Kontext "DocumentWriter"
136 DocumentWriter.UseMenu
137 hMenuSelectNr(1) ' the file menu
138 hMenuSelectNr(6) ' the Save
140 Kontext "ReportSaveDialog"
141 if FormSaveDialog.exists(3) then
142 FormName.setText(sReportName)
144 'click yes in the overwrite messages box
146 if MessageBox.exists(1) then
154 if ( IsMissing( bCloseReport ) ) then
157 call fCloseReportDesign()
161 '--------------------------------------------------------------------
162 function fOpenReport(sReportName as string)
163 '/// open a Report with the given name
164 '/// <u>parameter:</u>
165 '/// <b>sReportName:</b> the name of the Report which shall be open
167 if ( fFindReport(sReportName) = true ) then
168 printlog "Report found -> open"
169 Kontext "ContainerView"
170 OpenForm ' uno-Slot .uno:DB/Open
174 printlog "Report not found."
179 '--------------------------------------------------------------------
180 function fOpenReportInDesign(sReportName as string)
181 '/// open a Report with the given name in the design mode
182 '/// <u>parameter:</u>
183 '/// <b>sReportName:</b> the name of the Report which shall be open
185 if ( fFindReport(sReportName) = true ) then
186 printlog "Report found -> open"
187 Kontext "ContainerView"
188 EditReport ' uno-Slot .uno:DB/Edit
190 fOpenReportInDesign = true
192 printlog "Report not found."
193 fOpenReportInDesign = false
197 '--------------------------------------------------------------------
198 function fFindReport(sReportName as string)
199 '/// select a Report with the given name
200 '/// <u>parameter:</u>
201 '/// <b>sReportName:</b> the name of the Report which shall be selected
203 Dim iNumbersOfReports as integer
212 if ( Not DatabaseReportsView.exists(1) ) then
213 warnlog "The Report tree doesn't exists"
217 iNumbersOfReports = DatabaseReportsView.getItemCount()
219 ' this select the first entry
220 DatabaseReportsView.TypeKeys "<HOME>"
221 DatabaseReportsView.TypeKeys "<UP>"
224 for i = 1 to iNumbersOfReports
226 DatabaseReportsView.TypeKeys "<ADD>"
228 'printlog "ReportName.getItemCount = " + ReportTree.getItemCount
229 if DatabaseReportsView.getItemCount > iNumbersOfReports then
230 iNumbersOfReports = DatabaseReportsView.getItemCount()
232 'printlog "ReportName.getSeltext = " + ReportTree.getSeltext
233 if DatabaseReportsView.getSeltext = sReportName then
237 DatabaseReportsView.TypeKeys "<DOWN>"
242 '--------------------------------------------------------------------
243 function fOpenReportNavigator
244 '/// open the report navigator
245 '/// <u>parameter:</u>
246 printlog "open report navigator"
247 Kontext "ReportDesign"
250 if (hMenuItemIsChecked(5) = false) then
259 '--------------------------------------------------------------------
260 function fCloseReportNavigator
261 '/// open the report navigator
262 '/// <u>parameter:</u>
263 printlog "open report navigator"
264 Kontext "ReportDesign"
267 if (hMenuItemIsChecked(5) = true) then
276 '--------------------------------------------------------------------
277 function fExecuteReport
278 '/// execute the report via the menu
279 '/// <u>parameter:</u>
281 Kontext "ReportDesign"
287 '--------------------------------------------------------------------
288 function fSwitchPageHeader
289 '/// delete or insert the Page Header via the menu
290 '/// <u>parameter:</u>
292 Kontext "ReportDesign"
298 '--------------------------------------------------------------------
299 function fCloseAddFieldDialog
300 '/// close the Add Field Dialog via the slot or menu
301 '/// <u>parameter:</u>
303 Kontext "ReportAddField"
304 if (ReportAddField.exists(3)) then
307 ' check if the dialog is really not there
308 ' sometimes the focus is wrong. So I try a second way to disable the dialog
309 Kontext "ReportDesign"
312 if (hMenuItemIsChecked(3)) then
315 warnlog "there should be the Add field dialog. But there is none."
319 '--------------------------------------------------------------------
320 function fOpenAddFieldDialog
321 '/// open the Add Field Dialog via the slot or menu
322 '/// <u>parameter:</u>
324 Kontext "ReportAddField"
325 if (ReportAddField.exists(3)) then
328 Kontext "ReportDesign"
331 if (hMenuItemIsChecked(3)) then
341 Kontext "ReportAddField"
343 if (ReportAddField.exists(3)) then
346 warnlog "there should be the Add field dialog. But there is none."
351 '--------------------------------------------------------------------
352 function tools_reporttools_InstallExtension
353 '/// install the report designer extension
354 '/// <u>parameter:</u>
355 '/// <u>Return Value:</u><br>
358 '/// +<li>Errorcode (Integer)</li>
360 '/// <li>0 = No errors, extension was added correctly</li>
361 '/// <li> not 0 = an error occure see hExtensionAddGUI for more info </li>
366 use "global/tools/includes/optional/t_extension_manager_tools.inc"
367 if (not hIsExtensionAlreadyInstalled("Report Builder")) then
368 i = hExtensionAddGUI( gTesttoolPath + "dbaccess/required/input/oracle-report-builder.oxt", "AcceptLicense,InstallForUser" )
370 tools_reporttools_InstallExtension = 0
373 warnlog "Report extension was not installed due to unsatisfied dependencies."
374 tools_reporttools_InstallExtension = 5
376 warnlog "Report extension was not installed. Error Code = " + i
377 tools_reporttools_InstallExtension = i
381 tools_reporttools_InstallExtension = 0
385 call ExitRestartTheOffice