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: ctrl_Spreadsheet.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:41 $
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 : Controls linked to spreadsheet cells
38 '\***********************************************************************
40 '* preconditions : no FormDesignToolbar should be open
41 '* testpurpose : test if controls linked to cells work correct
45 call preCon_CloseFormDesignToolbar
51 '--------------------------------------------------------------------------------------
57 printlog "- Formular toolbox: List box element (" & gApplication & ")"
58 '/// open a spreadsheet, insert a listbox (the wizard appears)
61 Kontext "DocumentCalc"
62 DocumentCalc.TypeKeys("Value1")
63 DocumentCalc.TypeKeys("<RETURN>")
64 DocumentCalc.TypeKeys("Value2")
65 DocumentCalc.TypeKeys("<RETURN>")
66 DocumentCalc.TypeKeys("Value3")
67 DocumentCalc.TypeKeys("<RETURN>")
68 DocumentCalc.TypeKeys("Value4")
69 DocumentCalc.TypeKeys("<RETURN>")
70 DocumentCalc.TypeKeys("Value5")
71 DocumentCalc.TypeKeys("<RETURN>")
74 call hToolbarSelect("FormControls",true)
76 Kontext "FormControls"
79 call hDrawingWithSelection ( 60, 40, 70, 55 )
81 Kontext "AutoPilotListComboBox"
82 AutoPilotListComboBox.MouseDown(10,10)
83 AutoPilotListComboBox.MouseUp(10,10)
84 '/// close the autopilot
85 if AutoPilotListComboBox.Exists(1) then
86 AutopilotListComboBox.Cancel
90 call hToolbarSelect("FormControls",true)
92 Kontext "FormControls"
93 ControlProperties.Click
95 call fsetControlProperty("ListBox","CellRange","A1:A5")
96 call fsetControlProperty("ListBox","CellBound","B1")
98 '/// close control property browser
99 Kontext "ControlPropertiesDialog"
100 ControlPropertiesDialog.Close
101 '/// save the document
102 printlog "save the document"
103 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_ListBox.ods"))
106 '/// reload the document
107 printlog "reload the document"
108 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_ListBox.ods"))
110 KOntext "DocumentCalc"
111 DocumentCalc.TypeKeys "<MOD1 F5>" , true
113 DocumentCalc.TypeKeys "<DOWN>" , true
115 DocumentCalc.TypeKeys "<DOWN>" , true
117 DocumentCalc.TypeKeys "<MOD1 F6>" , true
119 DocumentCalc.TypeKeys "<MOD1 HOME>" , true
121 DocumentCalc.TypeKeys "<RIGHT>" , true
123 DocumentCalc.TypeKeys "<MOD1 C>" , true
126 str1 = getClipboardText()
127 if str1 <> "Value2" then
128 warnlog "the value is not right. Is should be Value2 but it is " + str1
133 '--------------------------------------------------------------------------------------
136 '/// Open a new document,
137 gApplication = "CALC"
138 printlog "Open a new document,"
140 Kontext "DocumentCalc"
141 'DocumentWriter.TypeKeys "tt_doc" , true
145 call hToolbarSelect("FormControls",true)
147 Kontext "FormControls"
152 '/// insert a text box
153 printlog "insert a text box"
155 call hDrawingWithSelection ( 30, 30, 40, 40 )
157 Kontext "FormControls"
158 ControlProperties.Click
160 '/// set multiline and alignment to right
161 call fsetControlProperty("TextBox","CellBound","A1")
163 Kontext "ControlPropertiesDialog"
164 ControlPropertiesDialog.Close
166 '/// save the document
167 printlog "save the document"
168 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_TextBox.ods"))
171 '/// reload the document
172 printlog "reload the document"
173 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_TextBox.ods"))
175 call hToolbarSelect("FormControls",true)
178 Kontext "FormControls"
179 SwitchControlDesignMode.Click
181 Kontext "DocumentCalc"
182 DocumentCalc.typeKeys "Hello world" , true ' this is important to get the focus into the document
184 DocumentCalc.typeKeys "<F6>" , 6 , true ' it's important that you don't do this in 6 lines
187 call hToolbarSelect("FormDesignTools",true)
189 Kontext "DocumentCalc"
190 DocumentCalc.MouseDown(50,50)
191 DocumentCalc.MouseUp(50,50)
193 Kontext "FormDesignTools"
196 Kontext "FormularNavigator"
197 Liste.TypeKeys "<HOME>"
199 Liste.TypeKeys "<DOWN>"
201 Liste.TypeKeys "<DOWN>"
204 Liste.OpenContextmenu
206 call hMenuSelectNr(5)
209 'Kontext "FormControls"
211 ' ControlProperties.Click
214 ' warnlog "error while open the control properties browser"
215 ' call hCloseDocument
218 '/// check if the values are saved
219 printlog "check if the values are saved"
221 Kontext "ControlPropertiesTabControl"
222 ControlPropertiesTabControl.SetPage TabDataControl
224 if fgetControlProperty("TextBox","CellBound") <> "A1" then
225 warnlog "the bound cell is not saved"
231 call hToolbarSelect("FormControls",true)
233 Kontext "FormControls"
234 SwitchControlDesignMode.Click
237 Kontext "DocumentCalc"
238 Documentcalc.TypeKeys "<MOD1 F5>", true
240 Documentcalc.TypeKeys "<MOD1 HOME>", true
242 Documentcalc.TypeKeys "<MOD1 SHIFT END>", true
244 Documentcalc.TypeKeys "<MOD1 C>", true
246 printlog getClipboard
247 if getClipboard <> "Hello world" then
248 warnlog "the cell bound doesn't work"
251 gApplication = "WRITER"
254 '--------------------------------------------------------------------------------------
257 '/// Open a new document,
258 gApplication = "CALC"
259 printlog "Open a new document,"
261 Kontext "DocumentCalc"
263 call hToolbarSelect("FormControls",true)
265 Kontext "FormControls"
268 '/// insert a checkbox box
269 printlog "insert a checkbox box"
270 call hDrawingWithSelection ( 50, 50, 70, 70 )
273 call hToolbarSelect("FormControls",true)
275 Kontext "FormControls"
276 ControlProperties.Click
278 '/// set multiline and alignment to right
279 call fsetControlProperty("CheckBox","CellBound","A1")
280 call fsetControlProperty("CheckBox","ReferenceValueOff","unchecked")
281 call fsetControlProperty("CheckBox","ReferenceValue","checked")
282 '/// close control property browser
283 Kontext "ControlPropertiesDialog"
284 ControlPropertiesDialog.Close
285 '/// save the document
286 printlog "save the document"
287 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_CheckBox.ods"))
289 '/// reload the document
290 printlog "reload the document"
291 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_CheckBox.ods"))
293 call hToolbarSelect("FormControls",true)
295 Kontext "FormControls"
296 SwitchControlDesignMode.Click
298 'Kontext "DocumentCalc"
299 ' DocumentCalc.typeKeys "hello world" , true ' this is important to get the focus into the document
301 call hToolbarSelect("FormDesignTools",true)
303 Kontext "FormDesignTools"
306 Kontext "FormularNavigator"
307 Liste.TypeKeys "<HOME>"
309 Liste.TypeKeys "<DOWN>"
311 Liste.TypeKeys "<DOWN>"
313 Liste.OpenContextmenu
315 call hMenuSelectNr(5)
318 'Kontext "FormControls"
320 ' ControlProperties.Click
322 ' warnlog "error while open the control properties browser"
323 ' call hCloseDocument
327 '/// check if the values are saved
328 printlog "check if the values are saved"
330 Kontext "ControlPropertiesTabControl"
331 ControlPropertiesTabControl.SetPage TabGeneralControl
332 Kontext "TabGeneralControl"
333 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
334 if fgetControlProperty("CheckBox","CellBound") <> "A1" then
335 warnlog "the bound cell is not saved"
341 call hToolbarSelect("FormControls",true)
342 Kontext "FormControls"
343 SwitchControlDesignMode.Click
346 Kontext "DocumentCalc"
347 DocumentCalc.MouseDown(20,20)
348 DocumentCalc.MouseUp(20,20)
352 Kontext "DocumentCalc"
353 Documentcalc.TypeKeys "<MOD1 F5>", true
355 Documentcalc.TypeKeys "<SPACE>", true
358 ' need to activate the document again
359 Documentcalc.MouseDown(10,10)
360 Documentcalc.MouseUp(10,10)
364 DocumentCalc.TypeKeys "<MOD1 HOME>" , true
368 Documentcalc.TypeKeys "<MOD1 C>", true
373 str2 = getClipboardText()
375 ' use STRCOMP to compare the strings thats works.
376 if StrComp(str2,"checked") <> 0 then
377 printlog StrComp(str2,"checked")
378 warnlog "the cell bound doesn't work"
381 gApplication = "WRITER"
384 '-------------------------------------------------------------------------
385 function preCon_CloseFormDesignToolbar
387 printlog "preCondition close FormDesignToolbar"
389 call hToolbarSelect("FormDesignTools",false)
391 call ExitRestartTheOffice