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: t_doc1.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-13 10:27:10 $
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 : thorsten.bosbach@sun.com
36 '* short description : Global Routines for Document Handling
38 '\*************************************************************************************
40 sub hNewDocument ( optional bANewDoc )
41 '/// hNewDocument : open a new document dependent on 'gApplication' ///'
43 gApplication = gApplication
45 if IsMissing ( bANewDoc ) <> TRUE then
46 if bANewDoc = TRUE then
53 select case gApplication
55 Kontext "DocumentWriter"
56 if gNoNewDoc = TRUE then
57 FileOpen "FileName", "private:factory/swriter", "SynchronMode", TRUE
59 FileOpen "FileName", "private:factory/swriter", "FrameName", "_default", "SynchronMode", TRUE
61 if ( DocumentWriter.IsMax() = false ) then
62 DocumentWriter.Maximize()
66 Kontext "DocumentCalc"
67 if gNoNewDoc = TRUE then
68 FileOpen "FileName", "private:factory/scalc", "SynchronMode", TRUE
70 FileOpen "FileName", "private:factory/scalc", "FrameName", "_default", "SynchronMode", TRUE
72 if ( DocumentCalc.IsMax() = false ) then
73 DocumentCalc.Maximize()
77 Kontext "DocumentImpress"
78 if gNoNewDoc = TRUE then
79 FileOpen "FileName", "private:factory/simpress", "SynchronMode", TRUE
81 FileOpen "FileName", "private:factory/simpress", "FrameName", "_default", "SynchronMode", TRUE
82 Kontext "AutoPilotPraesentation1"
83 if AutoPilotPraesentation1.Exists (2) then
84 Printlog "------------------------------The Impress-Autopilot was active------------------"
85 Startwithwizard.Check ' opposite of the checkboxs' title
86 AutoPilotPraesentation1.OK
88 Kontext "SeitenLayout"
91 Kontext "DocumentImpress"
93 if ( DocumentImpress.IsMax() = false ) then
94 DocumentImpress.Maximize()
99 Kontext "DocumentDraw"
100 if gNoNewDoc = TRUE then
101 FileOpen "FileName", "private:factory/sdraw", "SynchronMode", TRUE
103 FileOpen "FileName", "private:factory/sdraw", "FrameName", "_default", "SynchronMode", TRUE
105 if ( DocumentDraw.IsMax() = false ) then
106 DocumentDraw.Maximize()
109 case "MASTERDOCUMENT"
110 Kontext "DocumentMasterDoc"
111 if gNoNewDoc = TRUE then
112 FileOpen "FileName", "private:factory/swriter/GlobalDocument", "SynchronMode", TRUE
114 FileOpen "FileName", "private:factory/swriter/GlobalDocument", "FrameName", "_default", "SynchronMode", TRUE
118 if Navigator.Exists(5) then Navigator.Close
119 Kontext "DocumentMasterDoc"
120 if ( DocumentMasterDoc.IsMax() = false ) then
121 DocumentMasterDoc.Maximize()
125 Kontext "DocumentMath"
126 if gNoNewDoc = TRUE then
127 FileOpen "FileName", "private:factory/smath", "SynchronMode", TRUE
129 FileOpen "FileName", "private:factory/smath", "FrameName", "_default", "SynchronMode", TRUE
131 Kontext "DocumentMath"
132 if ( DocumentMath.IsMax() = false ) then
133 DocumentMath.Maximize()
137 Kontext "DocumentWriterWeb"
138 if gNoNewDoc = TRUE then
139 FileOpen "FileName", "private:factory/swriter/web", "SynchronMode", TRUE
141 FileOpen "FileName", "private:factory/swriter/web", "FrameName", "_default", "SynchronMode", TRUE
143 Kontext "DocumentWriterWeb"
144 if ( DocumentWriterWeb.IsMax() = false ) then
145 DocumentWriterWeb.Maximize()
149 FileOpen "FileName", "private:factory/sdatabase?Interactive", "FrameName", "_default", "SynchronMode", TRUE
150 Kontext "DatabaseWizard"
151 if DatabaseWizard.exists(5) then
153 kontext "SpeichernDlg"
154 if SpeichernDlg.exists(5) then
155 if (Dateiname.getSelText = "") then
156 sTemp = convertPath(gOfficePath + "user/work/hNewDocument.odb")
157 if fileExists(sTemp) then
160 qaErrorlog "## lost default filename"
161 Dateiname.setText "hNewDocument"
166 warnlog "t_doc1.inc::hNewDocument():: Can't create Database Document 2"
169 warnlog "t_doc1.inc::hNewDocument():: Can't create Database Document 1"
174 if makro.exists(5) then
175 MakroAus.typeKeys "<home>"
177 while (NOT bearbeiten.isEnabled) AND (sTemp <> MakroAus.getSelText)
178 sTemp = MakroAus.getSelText
179 MakroAus.typeKeys "<down>+"
181 if (bearbeiten.isEnabled) then
184 qaErrorlog "Can't edit document."
187 warnlog "Can't open Basic IDE."
189 case else : WarnLog "hNewDocument: No Applikation named '" + gApplication + "' exists in this routine!"
194 '-------------------------------------------------------------------------------
196 function hCreateLabels() as Boolean
197 '/// hCreateLabels : open the tab-dialog for making a new lable (file/new/lable) ///'
198 FileOpen "FileName", "private:factory/swriter?slot=21051", "FrameName", "_default", "SynchronMode", TRUE
201 Active.Setpage TabEtiketten
202 Kontext "TabEtiketten"
203 if Not TabEtiketten.Exists then
204 Warnlog "Dialog for Labels is not up!"
205 hCreateLabels = False
212 '-------------------------------------------------------------------------------
214 function hCreateBusinessCards() as Boolean
215 '/// hCreateBusinessCards : open the tab-dialog for making a new business card (file/new/business cards) ///'
216 FileOpen "FileName", "private:factory/swriter?slot=21052", "FrameName", "_default", "SynchronMode", TRUE
219 Active.Setpage TabEtikettenMedium
220 Kontext "TabEtikettenMedium"
221 if Not TabEtikettenMedium.Exists then
222 Warnlog "Dialog for BusinessCards is not up!"
223 hCreateBusinessCards = False
225 hCreateBusinessCards = True
230 '-------------------------------------------------------------------------------
232 sub hCloseDocument ( optional bANewDoc )
233 '/// hCloseDocument : close a document without saving ///'
234 '///+ all documents will be closed without saving ///'
237 if IsMissing ( bANewDoc ) <> TRUE then
238 if bANewDoc = TRUE then
245 ' if no new document was created, it isn't closed
246 if gNoNewDoc = TRUE then
260 if Active.Exists(2) then
270 '-------------------------------------------------------------------------------
272 sub gMouseClick ( X%, Y%, optional mb% )
273 '/// gMouseClick ( x_Position, y-Position ) : make a mouseclick on the document (dependent on 'gApplication') ///'
274 '/// default left mousebutton will be used otherwise you can optionally give the mousebutton to press
275 '/// 1 = left mouse button
276 '/// 2 = left mouse button
277 '/// 3 = left mouse button
279 gApplication = gApplication
281 if IsMissing(mb%) then mb% = 1
283 select case gApplication
287 Desktop.MouseDown ( X%, Y%, mb% )
288 Desktop.MouseUp ( X%, Y%, mb% )
291 Kontext "DocumentCalc"
293 DocumentCalc.MouseDown ( X%, Y%, mb% )
294 DocumentCalc.MouseUp ( X%, Y%, mb% )
297 Kontext "DocumentDraw"
299 DocumentDraw.MouseDown ( X%, Y%, mb% )
300 DocumentDraw.MouseUp ( X%, Y%, mb% )
303 Kontext "DocumentWriter"
305 DocumentWriter.MouseDown ( X%, Y%, mb% )
306 DocumentWriter.MouseUp ( X%, Y%, mb% )
309 Kontext "DocumentWriterWeb"
311 DocumentWriterWeb.MouseDown ( X%, Y%, mb% )
312 DocumentWriterWeb.MouseUp ( X%, Y%, mb% )
314 case "MASTERDOCUMENT"
315 Kontext "DocumentMasterDoc"
317 DocumentMasterDoc.MouseDown ( X%, Y%, mb% )
318 DocumentMasterDoc.MouseUp ( X%, Y%, mb% )
321 Kontext "DocumentImpress"
323 DocumentImpress.MouseDown ( X%, Y%, mb% )
324 DocumentImpress.MouseUp ( X%, Y%, mb% )
327 Kontext "DocumentMath"
329 DocumentMath.MouseDown ( X%, Y%, mb% )
330 DocumentMath.MouseDown ( X%, Y%, mb% )
333 Kontext "DocumentChart"
335 DocumentChart.MouseDown ( X%, Y%, mb% )
336 DocumentChart.MouseUp ( X%, Y%, mb% )
342 '-------------------------------------------------------------------------------
344 sub gMouseDoubleClick ( X%, Y% )
345 '/// gMouseDoubleClick ( x_Position, y-Position ) : make a mouse-doubleclick on the document ( dependent on 'gApplication' ) ///'
346 gApplication = gApplication
348 select case gApplication
350 Kontext "DocumentCalc"
351 DocumentCalc.MouseDoubleClick ( X%, Y% )
353 Kontext "DocumentDraw"
354 DocumentDraw.MouseDoubleClick ( X%, Y% )
357 Desktop.MouseDoubleClick ( X%, Y% )
359 Kontext "DocumentWriter"
360 DocumentWriter.MouseDoubleClick ( X%, Y% )
362 Kontext "DocumentWriterWeb"
363 DocumentWriterWeb.MouseDoubleClick ( X%, Y% )
364 case "MASTERDOCUMENT"
365 Kontext "DocumentMasterDoc"
366 DocumentMasterDoc.MouseDoubleClick ( X%, Y% )
368 Kontext "DocumentImpress"
369 DocumentImpress.MouseDoubleClick ( X%, Y% )
371 Kontext "DocumentMath"
372 DocumentMath.MouseDoubleClick ( X%, Y% )
377 '-------------------------------------------------------------------------------
379 sub gMouseMove ( BeginX%, BeginY%, EndX%, EndY% )
380 '/// gMouseMove ( BeginX, BeginY, EndX, EndY ) : make a mousemove trom Bx,By to Ex,Ey on the document ( dependent on 'gApplication' ) ///'
381 gApplication = gApplication
383 select case gApplication
385 Kontext "DocumentCalc"
386 DocumentCalc.MouseDown ( BeginX%, BeginY% )
387 DocumentCalc.MouseMove ( EndX%, EndY%)
388 DocumentCalc.MouseUp ( EndX%, EndY% )
390 Kontext "DocumentDraw"
391 DocumentDraw.MouseDown ( BeginX%, BeginY% )
392 DocumentDraw.MouseMove ( EndX%, EndY% )
393 DocumentDraw.MouseUp ( EndX%, EndY% )
395 Kontext "DocumentWriter"
396 DocumentWriter.MouseDown ( BeginX%, BeginY% )
397 DocumentWriter.MouseMove ( EndX%, EndY%)
398 DocumentWriter.MouseUp ( EndX%, EndY% )
400 Kontext "DocumentWriterWeb"
401 DocumentWriterWeb.MouseDown ( BeginX%, BeginY% )
402 DocumentWriterWeb.MouseMove ( EndX%, EndY%)
403 DocumentWriterWeb.MouseUp ( EndX%, EndY% )
404 case "MASTERDOCUMENT"
405 Kontext "DocumentMasterDoc"
406 DocumentMasterDoc.MouseDown ( BeginX%, BeginY% )
407 DocumentMasterDoc.MouseMove ( EndX%, EndY%)
408 DocumentMasterDoc.MouseUp ( EndX%, EndY% )
410 Kontext "DocumentImpress"
411 DocumentImpress.MouseDown ( BeginX%, BeginY% )
412 DocumentImpress.MouseMove ( EndX%, EndY%)
413 DocumentImpress.MouseUp ( EndX%, EndY% )
415 Kontext "DocumentMath"
416 DocumentMath.MouseDown ( BeginX%, BeginY% )
417 DocumentMath.MouseMove ( EndX%, EndY%)
418 DocumentMath.MouseDown ( EndX%, EndY% )
423 '-------------------------------------------------------------------------------
425 sub gMouseDown ( BeginX%, BeginY% )
426 '/// gMouseDown ( x_Position, y-Position ) : make a mousedown on the document (dependent on 'gApplication') ///'
427 '///+ DON'T FORGETT to call gMouseUp ! ///'
428 gApplication = gApplication
430 select case gApplication
432 Kontext "DocumentCalc"
433 DocumentCalc.MouseDown ( BeginX%, BeginY% )
435 Kontext "DocumentDraw"
436 DocumentDraw.MouseDown ( BeginX%, BeginY% )
438 Kontext "DocumentWriter"
439 DocumentWriter.MouseDown ( BeginX%, BeginY% )
441 Kontext "DocumentWriterWeb"
442 DocumentWriterWeb.MouseDown ( BeginX%, BeginY% )
443 case "MASTERDOCUMENT"
444 Kontext "DocumentMasterDoc"
445 DocumentMasterDoc.MouseDown ( BeginX%, BeginY% )
447 Kontext "DocumentImpress"
448 DocumentImpress.MouseDown ( BeginX%, BeginY% )
450 Kontext "DocumentMath"
451 DocumentMath.MouseDown ( BeginX%, BeginY% )
456 '-------------------------------------------------------------------------------
458 sub gMouseMove2 ( EndX%, EndY% )
459 '/// gMouseMove2 ( x_Position, y-Position ) : move the pointer to position on the document (dependent on 'gApplication') ///'
460 gApplication = gApplication
462 select case gApplication
464 Kontext "DocumentCalc"
465 DocumentCalc.MouseMove ( EndX%, EndY%)
467 Kontext "DocumentDraw"
468 DocumentDraw.MouseMove ( EndX%, EndY% )
470 Kontext "DocumentWriter"
471 DocumentWriter.MouseMove ( EndX%, EndY%)
473 Kontext "DocumentWriterWeb"
474 DocumentWriterWeb.MouseMove ( EndX%, EndY%)
475 case "MASTERDOCUMENT"
476 Kontext "DocumentMasterDoc"
477 DocumentMasterDoc.MouseMove ( EndX%, EndY%)
479 Kontext "DocumentImpress"
480 DocumentImpress.MouseMove ( EndX%, EndY%)
482 Kontext "DocumentMath"
483 DocumentMath.MouseMove ( EndX%, EndY%)
488 '-------------------------------------------------------------------------------
490 sub gMouseUp ( EndX%, EndY% )
491 '/// gMouseUp ( x_Position, y-Position ) : make a release button on the document (dependent on 'gApplication') ///'
492 gApplication = gApplication
494 select case gApplication
496 Kontext "DocumentCalc"
497 DocumentCalc.MouseUp ( EndX%, EndY% )
499 Kontext "DocumentDraw"
500 DocumentDraw.MouseUp ( EndX%, EndY% )
502 Kontext "DocumentWriter"
503 DocumentWriter.MouseUp ( EndX%, EndY% )
505 Kontext "DocumentWriterWeb"
506 DocumentWriterWeb.MouseUp ( EndX%, EndY% )
507 case "MASTERDOCUMENT"
508 Kontext "DocumentMasterDoc"
509 DocumentMasterDoc.MouseUp ( EndX%, EndY% )
511 Kontext "DocumentImpress"
512 DocumentImpress.MouseUp ( EndX%, EndY% )
514 Kontext "DocumentMath"
515 DocumentMath.MouseUp ( EndX%, EndY% )
520 '-------------------------------------------------------------------------------
522 sub hTypeKeys ( OutputText , optional iLoop as Integer )
523 '/// hTypeKeys ( OutputText , optional iLoop as Integer ): type the keys in 'outputtext' 'iLoop' times ///'
526 If IsMissing(iLoop) = True then iLoop = 1
528 Select Case Ucase(gApplication)
530 Kontext "DocumentWriter"
531 DocumentWriter.TypeKeys OutputText
532 Case "MASTERDOCUMENT"
533 Kontext "DocumentMasterDoc"
534 DocumentMasterDoc.TypeKeys OutputText
536 Kontext "DocumentWriterWeb"
537 DocumentWriterWeb.TypeKeys OutputText
539 Kontext "DocumentCalc"
540 DocumentCalc.TypeKeys OutputText
542 Kontext "DocumentDraw"
543 DocumentDraw.TypeKeys OutputText
545 Kontext "DocumentImpress"
546 DocumentImpress.TypeKeys OutputText
548 Kontext "DocumentMath"
549 DocumentMath.TypeKeys OutputText