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 hCloseAndLooseDocument
273 '/// <i>hCloseAndLooseDocument</i>
274 '///+ Closes a (modified) document and the verify dialog will be answered
275 '///+ with yes. That means you want to loose format information or you want
276 '///+ to loose the document!
287 if Active.Exists(2) then Active.Yes
290 '-------------------------------------------------------------------------------
292 sub gMouseClick ( X%, Y%, optional mb% )
293 '/// gMouseClick ( x_Position, y-Position ) : make a mouseclick on the document (dependent on 'gApplication') ///'
294 '/// default left mousebutton will be used otherwise you can optionally give the mousebutton to press
295 '/// 1 = left mouse button
296 '/// 2 = left mouse button
297 '/// 3 = left mouse button
299 gApplication = gApplication
301 if IsMissing(mb%) then mb% = 1
303 select case gApplication
307 Desktop.MouseDown ( X%, Y%, mb% )
308 Desktop.MouseUp ( X%, Y%, mb% )
311 Kontext "DocumentCalc"
313 DocumentCalc.MouseDown ( X%, Y%, mb% )
314 DocumentCalc.MouseUp ( X%, Y%, mb% )
317 Kontext "DocumentDraw"
319 DocumentDraw.MouseDown ( X%, Y%, mb% )
320 DocumentDraw.MouseUp ( X%, Y%, mb% )
323 Kontext "DocumentWriter"
325 DocumentWriter.MouseDown ( X%, Y%, mb% )
326 DocumentWriter.MouseUp ( X%, Y%, mb% )
329 Kontext "DocumentWriterWeb"
331 DocumentWriterWeb.MouseDown ( X%, Y%, mb% )
332 DocumentWriterWeb.MouseUp ( X%, Y%, mb% )
334 case "MASTERDOCUMENT"
335 Kontext "DocumentMasterDoc"
337 DocumentMasterDoc.MouseDown ( X%, Y%, mb% )
338 DocumentMasterDoc.MouseUp ( X%, Y%, mb% )
341 Kontext "DocumentImpress"
343 DocumentImpress.MouseDown ( X%, Y%, mb% )
344 DocumentImpress.MouseUp ( X%, Y%, mb% )
347 Kontext "DocumentMath"
349 DocumentMath.MouseDown ( X%, Y%, mb% )
350 DocumentMath.MouseDown ( X%, Y%, mb% )
353 Kontext "DocumentChart"
355 DocumentChart.MouseDown ( X%, Y%, mb% )
356 DocumentChart.MouseUp ( X%, Y%, mb% )
362 '-------------------------------------------------------------------------------
364 sub gMouseDoubleClick ( X%, Y% )
365 '/// gMouseDoubleClick ( x_Position, y-Position ) : make a mouse-doubleclick on the document ( dependent on 'gApplication' ) ///'
366 gApplication = gApplication
368 select case gApplication
370 Kontext "DocumentCalc"
371 DocumentCalc.MouseDoubleClick ( X%, Y% )
373 Kontext "DocumentDraw"
374 DocumentDraw.MouseDoubleClick ( X%, Y% )
377 Desktop.MouseDoubleClick ( X%, Y% )
379 Kontext "DocumentWriter"
380 DocumentWriter.MouseDoubleClick ( X%, Y% )
382 Kontext "DocumentWriterWeb"
383 DocumentWriterWeb.MouseDoubleClick ( X%, Y% )
384 case "MASTERDOCUMENT"
385 Kontext "DocumentMasterDoc"
386 DocumentMasterDoc.MouseDoubleClick ( X%, Y% )
388 Kontext "DocumentImpress"
389 DocumentImpress.MouseDoubleClick ( X%, Y% )
391 Kontext "DocumentMath"
392 DocumentMath.MouseDoubleClick ( X%, Y% )
397 '-------------------------------------------------------------------------------
399 sub gMouseMove ( BeginX%, BeginY%, EndX%, EndY% )
400 '/// gMouseMove ( BeginX, BeginY, EndX, EndY ) : make a mousemove trom Bx,By to Ex,Ey on the document ( dependent on 'gApplication' ) ///'
401 gApplication = gApplication
403 select case gApplication
405 Kontext "DocumentCalc"
406 DocumentCalc.MouseDown ( BeginX%, BeginY% )
407 DocumentCalc.MouseMove ( EndX%, EndY%)
408 DocumentCalc.MouseUp ( EndX%, EndY% )
410 Kontext "DocumentDraw"
411 DocumentDraw.MouseDown ( BeginX%, BeginY% )
412 DocumentDraw.MouseMove ( EndX%, EndY% )
413 DocumentDraw.MouseUp ( EndX%, EndY% )
415 Kontext "DocumentWriter"
416 DocumentWriter.MouseDown ( BeginX%, BeginY% )
417 DocumentWriter.MouseMove ( EndX%, EndY%)
418 DocumentWriter.MouseUp ( EndX%, EndY% )
420 Kontext "DocumentWriterWeb"
421 DocumentWriterWeb.MouseDown ( BeginX%, BeginY% )
422 DocumentWriterWeb.MouseMove ( EndX%, EndY%)
423 DocumentWriterWeb.MouseUp ( EndX%, EndY% )
424 case "MASTERDOCUMENT"
425 Kontext "DocumentMasterDoc"
426 DocumentMasterDoc.MouseDown ( BeginX%, BeginY% )
427 DocumentMasterDoc.MouseMove ( EndX%, EndY%)
428 DocumentMasterDoc.MouseUp ( EndX%, EndY% )
430 Kontext "DocumentImpress"
431 DocumentImpress.MouseDown ( BeginX%, BeginY% )
432 DocumentImpress.MouseMove ( EndX%, EndY%)
433 DocumentImpress.MouseUp ( EndX%, EndY% )
435 Kontext "DocumentMath"
436 DocumentMath.MouseDown ( BeginX%, BeginY% )
437 DocumentMath.MouseMove ( EndX%, EndY%)
438 DocumentMath.MouseDown ( EndX%, EndY% )
443 '-------------------------------------------------------------------------------
445 sub gMouseDown ( BeginX%, BeginY% )
446 '/// gMouseDown ( x_Position, y-Position ) : make a mousedown on the document (dependent on 'gApplication') ///'
447 '///+ DON'T FORGETT to call gMouseUp ! ///'
448 gApplication = gApplication
450 select case gApplication
452 Kontext "DocumentCalc"
453 DocumentCalc.MouseDown ( BeginX%, BeginY% )
455 Kontext "DocumentDraw"
456 DocumentDraw.MouseDown ( BeginX%, BeginY% )
458 Kontext "DocumentWriter"
459 DocumentWriter.MouseDown ( BeginX%, BeginY% )
461 Kontext "DocumentWriterWeb"
462 DocumentWriterWeb.MouseDown ( BeginX%, BeginY% )
463 case "MASTERDOCUMENT"
464 Kontext "DocumentMasterDoc"
465 DocumentMasterDoc.MouseDown ( BeginX%, BeginY% )
467 Kontext "DocumentImpress"
468 DocumentImpress.MouseDown ( BeginX%, BeginY% )
470 Kontext "DocumentMath"
471 DocumentMath.MouseDown ( BeginX%, BeginY% )
476 '-------------------------------------------------------------------------------
478 sub gMouseMove2 ( EndX%, EndY% )
479 '/// gMouseMove2 ( x_Position, y-Position ) : move the pointer to position on the document (dependent on 'gApplication') ///'
480 gApplication = gApplication
482 select case gApplication
484 Kontext "DocumentCalc"
485 DocumentCalc.MouseMove ( EndX%, EndY%)
487 Kontext "DocumentDraw"
488 DocumentDraw.MouseMove ( EndX%, EndY% )
490 Kontext "DocumentWriter"
491 DocumentWriter.MouseMove ( EndX%, EndY%)
493 Kontext "DocumentWriterWeb"
494 DocumentWriterWeb.MouseMove ( EndX%, EndY%)
495 case "MASTERDOCUMENT"
496 Kontext "DocumentMasterDoc"
497 DocumentMasterDoc.MouseMove ( EndX%, EndY%)
499 Kontext "DocumentImpress"
500 DocumentImpress.MouseMove ( EndX%, EndY%)
502 Kontext "DocumentMath"
503 DocumentMath.MouseMove ( EndX%, EndY%)
508 '-------------------------------------------------------------------------------
510 sub gMouseUp ( EndX%, EndY% )
511 '/// gMouseUp ( x_Position, y-Position ) : make a release button on the document (dependent on 'gApplication') ///'
512 gApplication = gApplication
514 select case gApplication
516 Kontext "DocumentCalc"
517 DocumentCalc.MouseUp ( EndX%, EndY% )
519 Kontext "DocumentDraw"
520 DocumentDraw.MouseUp ( EndX%, EndY% )
522 Kontext "DocumentWriter"
523 DocumentWriter.MouseUp ( EndX%, EndY% )
525 Kontext "DocumentWriterWeb"
526 DocumentWriterWeb.MouseUp ( EndX%, EndY% )
527 case "MASTERDOCUMENT"
528 Kontext "DocumentMasterDoc"
529 DocumentMasterDoc.MouseUp ( EndX%, EndY% )
531 Kontext "DocumentImpress"
532 DocumentImpress.MouseUp ( EndX%, EndY% )
534 Kontext "DocumentMath"
535 DocumentMath.MouseUp ( EndX%, EndY% )
540 '-------------------------------------------------------------------------------
542 sub hTypeKeys ( OutputText , optional iLoop as Integer )
543 '/// hTypeKeys ( OutputText , optional iLoop as Integer ): type the keys in 'outputtext' 'iLoop' times ///'
546 If IsMissing(iLoop) = True then iLoop = 1
548 Select Case Ucase(gApplication)
550 Kontext "DocumentWriter"
551 DocumentWriter.TypeKeys OutputText
552 Case "MASTERDOCUMENT"
553 Kontext "DocumentMasterDoc"
554 DocumentMasterDoc.TypeKeys OutputText
556 Kontext "DocumentWriterWeb"
557 DocumentWriterWeb.TypeKeys OutputText
559 Kontext "DocumentCalc"
560 DocumentCalc.TypeKeys OutputText
562 Kontext "DocumentDraw"
563 DocumentDraw.TypeKeys OutputText
565 Kontext "DocumentImpress"
566 DocumentImpress.TypeKeys OutputText
568 Kontext "DocumentMath"
569 DocumentMath.TypeKeys OutputText
575 '-------------------------------------------------------------------------------
577 function hOpenFileAndIgnoreMacroWarning (sDocName as string, optional IgnoreW) as Boolean
578 '/// Loading a (known) document with macro security warning.
579 '/// If the OPTIONAL parameter is used a PRINTLOG will be written into the result file otherwise a wrning.
582 'ConvertPath: Be sure that the path seperators has been set correctly (/ or \).
583 sDocName = ConvertPath(sDocName)
585 hOpenFileAndIgnoreMacroWarning = FALSE
587 if hFileExists(sDocName) = FALSE then
588 warnlog "global::tools::inc::t_doc1.inc::hOpenFileAndIgnoreMacroWarning: '" & sDocName & "' does not exists!"
589 'Setting the function to FALSE because file has not been found.
595 Dateiname.SetText sDocName
600 ' Since SRC680m?? we have TWO Security Warnings for
601 ' StarBasic and JavaScript; So this routine needs to
603 Kontext "SecurityWarning"
604 if SecurityWarning.Exists(2) then
605 if IsMissing(IgnoreW) = FALSE then
606 printLog "global::tools::inc::t_doc1.inc::hOpenFileAndIgnoreMacroWarning: Securitywarning dialog is visible."
608 warnlog "global::tools::inc::t_doc1.inc::hOpenFileAndIgnoreMacroWarning: Securitywarning dialog is visible"
613 QAErrorLog "global::tools::inc::t_doc1.inc::hOpenFileAndIgnoreMacroWarning: No Security warning dialog occured! Document loading aborted."
614 hOpenFileAndIgnoreMacroWarning = FALSE
620 if OeffnenDlg.Exists(1) then
622 warnlog "global::tools::inc::t_doc1.inc::hOpenFileAndIgnoreMacroWarning: The 'FileOpen'-Dialog is open!"
624 ' After the external routine IsItLoaded has been run the return value of this function should be set to TRUE.
625 if IsItLoaded = TRUE then
626 hOpenFileAndIgnoreMacroWarning = TRUE