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_tools3.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-13 10:27:11 $
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 : helge.delfs@sun.com
36 '* short description : Global Tools III
38 '\*************************************************************************************
41 sub hToolbarSelect( sType as string, sOpen as boolean, optional SetToDefault as boolean )
42 Dim sDefault as integer, sKontext as string, sPosition as integer
43 Dim SteppedThrough as boolean
44 '/// Created by helge.delfs@sun.com
45 '/// This function opens/closes a toolbar through View/Toolbar menu
46 '/// Required parameters:
47 '/// sType as string -> Name of the toolbar to be opened / closed
48 '/// sOpen as boolean -> Shall the toolbar be opened (true) or closed (false)
49 '/// optional SetToDefault as boolean -> true if Toolbar-State should be set to default
51 Select Case Ucase(sType)
53 Kontext "ExtrusionObjectBar"
54 if ExtrusionObjectBar.Exists then
57 if IsMissing(SetToDefault) then
58 ViewToolbarsThreeDSettings
60 if SetToDefault = True then ViewToolbarsThreeDSettings
63 if IsMissing(SetToDefault) = False then
64 if SetToDefault = True then ViewToolbarsThreeDSettings
69 if IsMissing(SetToDefault) then
70 ViewToolbarsThreeDSettings
77 Kontext "Alignmentbar"
78 if Alignmentbar.Exists then
81 if IsMissing(SetToDefault) then
84 if SetToDefault = True then ViewToolbarsAlign
87 if IsMissing(SetToDefault) = False then
88 if SetToDefault = True then ViewToolbarsAlign
93 if IsMissing(SetToDefault) then
99 Case "BULLETSANDNUMBERING"
100 Kontext "NumObjectbar"
101 if NumObjectbar.Exists then
104 if IsMissing(SetToDefault) then
105 ViewToolbarsBulletsAndNumbering
107 if SetToDefault = True then ViewToolbarsBulletsAndNumbering
110 if IsMissing(SetToDefault) = False then
111 if SetToDefault = True then ViewToolbarsBulletsAndNumbering
116 if IsMissing(SetToDefault) then
117 ViewToolbarsBulletsAndNumbering
124 if ColorBar.Exists then
127 if IsMissing(SetToDefault) then
130 if SetToDefault = True then ViewToolbarsColor
133 if IsMissing(SetToDefault) = False then
134 if SetToDefault = True then ViewToolbarsColor
139 if IsMissing(SetToDefault) then
146 ViewToolbarsCustomize
150 if DrawBar.Exists then
153 if IsMissing(SetToDefault) then
156 if SetToDefault = True then ViewToolbarsDrawing
159 if IsMissing(SetToDefault) = False then
160 if SetToDefault = True then ViewToolbarsDrawing
165 if IsMissing(SetToDefault) then
172 Kontext "TextObjectbar"
173 if TextObjectbar.Exists then
176 if IsMissing(SetToDefault) then
177 ViewToolbarsFormatting
182 if IsMissing(SetToDefault) then
183 ViewToolbarsFormatting
185 if SetToDefault = True then ViewToolbarsFormatting
191 Kontext "FormControls"
192 if FormControls.Exists then
195 if IsMissing(SetToDefault) then
196 ViewToolbarsFormControls
198 if SetToDefault = True then ViewToolbarsFormControls
201 if IsMissing(SetToDefault) = False then
202 if SetToDefault = True then ViewToolbarsFormControls
207 if IsMissing(SetToDefault) then
208 ViewToolbarsFormControls
213 Kontext "FormControls"
214 if FormControls.Exists then
217 if IsMissing(SetToDefault) then
218 ViewToolbarsFormControls
220 if SetToDefault = True then ViewToolbarsFormControls
223 if IsMissing(SetToDefault) = False then
224 if SetToDefault = True then ViewToolbarsFormControls
229 if IsMissing(SetToDefault) then
230 ViewToolbarsFormControls
235 case "FORMDESIGNTOOLS", "FORMDESIGN"
236 Kontext "FormDesignTools"
237 if FormDesignTools.Exists then
240 if IsMissing(SetToDefault) then
241 ViewToolbarsFormDesign
243 if SetToDefault = True then ViewToolbarsFormDesign
246 if IsMissing(SetToDefault) = False then
247 if SetToDefault = True then ViewToolbarsFormDesign
252 if IsMissing(SetToDefault) then
253 ViewToolbarsFormDesign
258 case "HTMLSOURCEVIEW"
259 Kontext "SourceViewToolbar"
260 if SourceViewToolbar.Exists then
263 if IsMissing(SetToDefault) then
264 ViewToolbarsHTMLSourceView
266 if SetToDefault = True then ViewToolbarsHTMLSourceView
269 if IsMissing(SetToDefault) = False then
270 if SetToDefault = True then ViewToolbarsHTMLSourceView
275 if IsMissing(SetToDefault) then
276 ViewToolbarsHTMLSourceView
282 Kontext "FormsFilterBar"
283 if FormsFilterBar.Exists then
286 if IsMissing(SetToDefault) then
287 ViewToolbarsFormFilter
289 if SetToDefault = True then ViewToolbarsFormFilter
292 if IsMissing(SetToDefault) = False then
293 if SetToDefault = True then ViewToolbarsFormFilter
298 if IsMissing(SetToDefault) then
299 ViewToolbarsFormFilter
304 case "FORMNAVIGATION"
305 Kontext "FormsNavigationBar"
306 if FormsNavigationBar.Exists then
309 if IsMissing(SetToDefault) then
310 ViewToolbarsFormNavigation
312 if SetToDefault = True then ViewToolbarsFormNavigation
315 if IsMissing(SetToDefault) = False then
316 if SetToDefault = True then ViewToolbarsFormNavigation
321 if IsMissing(SetToDefault) then
322 ViewToolbarsFormNavigation
328 Kontext "FormsObjectbar"
329 if FormsObjectbar.Exists then
332 if IsMissing(SetToDefault) then
333 ViewToolbarsFormObject
335 if SetToDefault = True then ViewToolbarsFormObject
338 if IsMissing(SetToDefault) = False then
339 if SetToDefault = True then ViewToolbarsFormObject
344 if IsMissing(SetToDefault) then
345 ViewToolbarsFormObject
351 Kontext "FrameObjectbar"
352 if FrameObjectbar.Exists then
355 if IsMissing(SetToDefault) then
358 if SetToDefault = True then ViewToolbarsFrame
361 if IsMissing(SetToDefault) = False then
362 if SetToDefault = True then ViewToolbarsFrame
367 if IsMissing(SetToDefault) then
374 Kontext "FullScreenBar"
375 if FullScreenBar.Exists then
378 if IsMissing(SetToDefault) then
379 ViewToolbarsFullScreen
381 if SetToDefault = True then ViewToolbarsFullScreen
384 if IsMissing(SetToDefault) = False then
385 if SetToDefault = True then ViewToolbarsFullScreen
390 if IsMissing(SetToDefault) then
391 ViewToolbarsFullScreen
396 case "GRAPHIC", "DRAWINGOBJECTPROPERTIES"
397 Kontext "DrawingObjectbar"
398 if DrawingObjectbar.Exists then
401 if IsMissing(SetToDefault) then
404 if SetToDefault = True then ViewToolbarsGraphic
407 if IsMissing(SetToDefault) = False then
408 if SetToDefault = True then ViewToolbarsGraphic
413 if IsMissing(SetToDefault) then
419 case "HYPERLINK", "HYPERLINKBAR"
420 Kontext "Hyperlinkleiste"
421 if Hyperlinkleiste.Exists then
424 if IsMissing(SetToDefault) then
425 ViewToolbarsInsertHyperlink
427 if SetToDefault = True then ViewToolbarsInsertHyperlink
430 if IsMissing(SetToDefault) = False then
431 if SetToDefault = True then ViewToolbarsInsertHyperlink
436 if IsMissing(SetToDefault) then
437 ViewToolbarsInsertHyperlink
445 if InsertBar.Exists then
448 if IsMissing(SetToDefault) then
451 if SetToDefault = True then ViewToolbarsInsert
454 if IsMissing(SetToDefault) = False then
455 if SetToDefault = True then ViewToolbarsInsert
460 if IsMissing(SetToDefault) then
467 Kontext "InsertObjectBar"
468 if InsertObjectBar.Exists then
471 if IsMissing(SetToDefault) then
472 ViewToolbarsInsertObject
474 if SetToDefault = True then ViewToolbarsInsertObject
477 if IsMissing(SetToDefault) = False then
478 if SetToDefault = True then ViewToolbarsInsertObject
483 if IsMissing(SetToDefault) then
484 ViewToolbarsInsertObject
490 Kontext "MediaObjectBar"
491 if MediaObjectBar.Exists then
494 if IsMissing(SetToDefault) then
495 ViewToolbarsMediaPlayback
497 if SetToDefault = True then ViewToolbarsMediaPlayback
500 if IsMissing(SetToDefault) = False then
501 if SetToDefault = True then ViewToolbarsMediaPlayback
506 if IsMissing(SetToDefault) then
507 ViewToolbarsMediaPlayback
513 Kontext "MoreControls"
514 if MoreControls.Exists then
517 if IsMissing(SetToDefault) then
518 ViewToolbarsMoreControls
520 if SetToDefault = True then ViewToolbarsMoreControls
523 if IsMissing(SetToDefault) = False then
524 if SetToDefault = True then ViewToolbarsMoreControls
529 if IsMissing(SetToDefault) then
530 ViewToolbarsMoreControls
535 case "MOREXFORMCONTROLS"
536 Kontext "MoreXFormControls"
537 if MoreXFormControls.Exists then
540 if IsMissing(SetToDefault) then
541 ViewToolbarsMoreXFormControls
543 if SetToDefault = True then ViewToolbarsMoreXFormControls
546 if IsMissing(SetToDefault) = False then
547 if SetToDefault = True then ViewToolbarsMoreXFormControls
552 if IsMissing(SetToDefault) then
553 ViewToolbarsMoreXFormControls
559 Kontext "OLEObjectbar"
560 if OLEObjectbar.Exists then
563 if IsMissing(SetToDefault) then
564 ViewToolbarsOleObject
566 if SetToDefault = True then ViewToolbarsOleObject
569 if IsMissing(SetToDefault) = False then
570 if SetToDefault = True then ViewToolbarsOleObject
575 if IsMissing(SetToDefault) then
576 ViewToolbarsOleObject
582 Kontext "OptimizeTablebar"
583 if OptimizeTablebar.Exists then
586 if IsMissing(SetToDefault) then
587 ViewToolbarsOptimizeTable
589 if SetToDefault = True then ViewToolbarsOptimizeTable
592 if IsMissing(SetToDefault) = False then
593 if SetToDefault = True then ViewToolbarsOptimizeTable
598 if IsMissing(SetToDefault) then
599 ViewToolbarsOptimizeTable
605 Kontext "PreviewObjectbar"
606 if PreviewObjectbar.Exists then
609 if IsMissing(SetToDefault) then
610 ViewToolbarsPagePreview
612 if SetToDefault = True then ViewToolbarsPagePreview
615 if IsMissing(SetToDefault) = False then
616 if SetToDefault = True then ViewToolbarsPagePreview
621 if IsMissing(SetToDefault) then
622 ViewToolbarsPagePreview
628 Kontext "BezierObjectBar"
629 if BezierObjectBar.Exists then
632 if IsMissing(SetToDefault) then
635 if SetToDefault = True then ViewToolbarsBezier
638 if IsMissing(SetToDefault) = False then
639 if SetToDefault = True then ViewToolbarsBezier
644 if IsMissing(SetToDefault) then
651 Kontext "GraphicObjectbar"
652 if GraphicObjectbar.Exists then
655 if IsMissing(SetToDefault) then
658 if SetToDefault = True then ViewToolbarsPicture
661 if IsMissing(SetToDefault) = False then
662 if SetToDefault = True then ViewToolbarsPicture
667 if IsMissing(SetToDefault) then
674 Kontext "GraphicFilterBar"
675 if GraphicFilterBar.Exists then
678 if IsMissing(SetToDefault) then
679 ViewToolbarsPictureFilter
681 if SetToDefault = True then ViewToolbarsPictureFilter
684 if IsMissing(SetToDefault) = False then
685 if SetToDefault = True then ViewToolbarsPictureFilter
690 if IsMissing(SetToDefault) then
691 ViewToolbarsPictureFilter
697 Kontext "StandardBar"
698 if StandardBar.Exists then
699 if StandardBar.IsVisible then
702 if IsMissing(SetToDefault) then
708 if IsMissing(SetToDefault) then
711 if SetToDefault = True then ViewToolbarsStandard
717 if IsMissing(SetToDefault) then
720 if SetToDefault = True then ViewToolbarsStandard
725 case "STANDARDVIEWINGMODE"
727 if Viewerbar.Exists then
730 if IsMissing(SetToDefault) then
731 ViewToolbarsStandardView
733 if SetToDefault = True then ViewToolbarsStandardView
736 if IsMissing(SetToDefault) = False then
737 if SetToDefault = True then ViewToolbarsStandardView
742 if IsMissing(SetToDefault) then
743 ViewToolbarsStandardView
749 Kontext "TableObjectbar"
750 if TableObjectbar.Exists then
753 if IsMissing(SetToDefault) then
756 if SetToDefault = True then ViewToolbarsTable
759 if IsMissing(SetToDefault) = False then
760 if SetToDefault = True then ViewToolbarsTable
765 if IsMissing(SetToDefault) then
772 Kontext "DrawTextObjectBar"
773 if DrawTextObjectBar.Exists then
776 if IsMissing(SetToDefault) then
777 ViewToolbarsTextObject
779 if SetToDefault = True then ViewToolbarsTextObject
782 if IsMissing(SetToDefault) = False then
783 if SetToDefault = True then ViewToolbarsTextObject
788 if IsMissing(SetToDefault) then
789 ViewToolbarsTextObject
796 if Toolbar.Exists then
799 if IsMissing(SetToDefault) then
802 if SetToDefault = True then ViewToolbarsTools
805 if IsMissing(SetToDefault) = False then
806 if SetToDefault = True then ViewToolbarsTools
811 if IsMissing(SetToDefault) then
819 Kontext "OL_SW_Rechenleiste"
820 if OL_SW_Rechenleiste.Exists then
823 if IsMissing(SetToDefault) then
824 ViewToolbarsInsertFormula
826 if SetToDefault = True then ViewToolbarsInsertFormula
829 if IsMissing(SetToDefault) = False then
830 if SetToDefault = True then ViewToolbarsInsertFormula
835 if IsMissing(SetToDefault) then
836 ViewToolbarsInsertFormula
842 Warnlog "No menuentry for parameter " & sType & " found!"
849 sub hCloseAllToolbars
850 '/// Created by thorsten.bosbach@sun.com
851 '/// This function closes all known toolbars which are not docked
852 '/// only if Build ID is below 8892
853 if (gBuild < 8892) AND (gBuild > 8888) then
855 Kontext "ExtrusionObjectBar"
856 if ExtrusionObjectBar.Exists(0) then if NOT ExtrusionObjectBar.isDocked then ExtrusionObjectBar.close
857 Kontext "Alignmentbar"
858 if Alignmentbar.Exists(0) then if NOT Alignmentbar.isDocked then Alignmentbar.close
859 Kontext "NumObjectbar"
860 if NumObjectbar.Exists(0) then if NOT NumObjectbar.isDocked then NumObjectbar.close
862 if DrawBar.Exists(0) then if NOT DrawBar.isDocked then DrawBar.close
863 Kontext "TextObjectbar"
864 if TextObjectbar.Exists(0) then if NOT TextObjectbar.isDocked then TextObjectbar.close
865 Kontext "FormControls"
866 if FormControls.Exists(0) then if NOT FormControls.isDocked then FormControls.close
867 Kontext "FormControls"
868 if FormControls.Exists(0) then if NOT FormControls.isDocked then FormControls.close
869 Kontext "FormDesignTools"
870 if FormDesignTools.Exists(0) then if NOT FormDesignTools.isDocked then FormDesignTools.close
871 Kontext "SourceViewToolbar"
872 if SourceViewToolbar.Exists(0) then if NOT SourceViewToolbar.isDocked then SourceViewToolbar.close
873 Kontext "FormsFilterBar"
874 if FormsFilterBar.Exists(0) then if NOT FormsFilterBar.isDocked then FormsFilterBar.close
875 Kontext "FormsNavigationBar"
876 if FormsNavigationBar.Exists(0) then if NOT FormsNavigationBar.isDocked then FormsNavigationBar.close
877 Kontext "FormsObjectbar"
878 if FormsObjectbar.Exists(0) then if NOT FormsObjectbar.isDocked then FormsObjectbar.close
879 Kontext "FrameObjectbar"
880 if FrameObjectbar.Exists(0) then if NOT FrameObjectbar.isDocked then FrameObjectbar.close
881 Kontext "FullScreenBar"
882 if FullScreenBar.Exists(0) then if NOT FullScreenBar.isDocked then FullScreenBar.close
883 Kontext "DrawingObjectbar"
884 if DrawingObjectbar.Exists(0) then if NOT DrawingObjectbar.isDocked then DrawingObjectbar.close
885 Kontext "Hyperlinkleiste"
886 if Hyperlinkleiste.Exists(0) then if NOT Hyperlinkleiste.isDocked then Hyperlinkleiste.close
888 if InsertBar.Exists(0) then if NOT InsertBar.isDocked then InsertBar.close
889 Kontext "InsertObjectBar"
890 if InsertObjectBar.Exists(0) then if NOT InsertObjectBar.isDocked then InsertObjectBar.close
891 Kontext "MediaObjectBar"
892 if MediaObjectBar.Exists(0) then if NOT MediaObjectBar.isDocked then MediaObjectBar.close
893 Kontext "MoreControls"
894 if MoreControls.Exists(0) then if NOT MoreControls.isDocked then MoreControls.close
895 Kontext "OLEObjectbar"
896 if OLEObjectbar.Exists(0) then if NOT OLEObjectbar.isDocked then OLEObjectbar.close
897 Kontext "OptimizeTablebar"
898 if OptimizeTablebar.Exists(0) then if NOT OptimizeTablebar.isDocked then OptimizeTablebar.close
899 Kontext "PreviewObjectbar"
900 if PreviewObjectbar.Exists(0) then if NOT PreviewObjectbar.isDocked then PreviewObjectbar.close
901 Kontext "BezierObjectBar"
902 if BezierObjectBar.Exists(0) then if NOT BezierObjectBar.isDocked then BezierObjectBar.close
903 Kontext "GraphicObjectbar"
904 if GraphicObjectbar.Exists(0) then if NOT GraphicObjectbar.isDocked then GraphicObjectbar.close
905 Kontext "GraphicFilterBar"
906 if GraphicFilterBar.Exists(0) then if NOT GraphicFilterBar.isDocked then GraphicFilterBar.close
907 Kontext "StandardBar"
908 if StandardBar.Exists(0) then if NOT StandardBar.isDocked then StandardBar.close
910 if Viewerbar.Exists(0) then if NOT Viewerbar.isDocked then Viewerbar.close
911 Kontext "TableObjectbar"
912 if TableObjectbar.Exists(0) then if NOT TableObjectbar.isDocked then TableObjectbar.close
913 Kontext "DrawTextObjectBar"
914 if DrawTextObjectBar.Exists(0) then if NOT DrawTextObjectBar.isDocked then DrawTextObjectBar.close
916 if Toolbar.Exists(0) then if NOT Toolbar.isDocked then Toolbar.close
917 Kontext "OL_SW_Rechenleiste"
918 if OL_SW_Rechenleiste.Exists(0) then if NOT OL_SW_Rechenleiste.isDocked then OL_SW_Rechenleiste.close
920 printlog "tools3.inc::hCloseAllToolbars Can't close some toolbar"
926 function hIsAccessbridgeInstalled() as boolean
928 '/// detects if a Java Access Bridge is installed which decreases testtool performance
929 '/// and should not be installed while running automated tests
930 '/// 1. searches in testtool.ini entry "UseAccessBridge" in profile "current". Is it <> True then
931 '/// 2. searches in directory "C:\Program Files\Java Access Bridge" a Java-Bridge Installation. If this is not found
932 '/// 3. searches in options of installed StarOffice on Java-Tabpage for the entry "with accessibility support"
933 '/// if 1. = true then false is returned, because it should be tested with accessibility
934 '/// if 2. or 3. matches this func returns true else false
935 '/// if Java is deactivated in Office options it returns false, because no Java->no AccessBridge
936 '/// if AccessbridgeIsInstalled = false (after checking on Java-Tabpage) and iSprache <> English a warning will be printed, because the string in options maybe has to be adapted!
938 Dim i as integer, j as integer, sAccessibilityCompare as string
939 Dim sProgramFiles as string, sAccessBridgeFolder as string, sTmpEntry as string
940 Dim sCompareString as string, AccessbridgeIsInstalled as boolean
941 AccessbridgeIsInstalled = False
942 if GetIniValue ( gTesttoolIni, "UseAccessBridge", "Current" ) = True then
943 AccessbridgeIsInstalled = False
945 Select case gPlatgroup
947 sProgramFiles = environ("ProgramFiles")
948 sAccessBridgeFolder = "Java Access Bridge"
949 sCompareString = sProgramFiles & "\" & sAccessBridgeFolder & "\AccessBridgeTester.class"
950 sAccessibilityCompare = "with accessibility support"
951 if hFileExists(sCompareString) = True then
952 AccessbridgeIsInstalled = True
955 Call hToolsOptions("STAROFFICE","JAVA")
957 if UseJava.IsChecked = True then
958 For i = 1 to JavaList.GetItemCount()
960 if JavaList.GetText(4) = sAccessibilityCompare then
961 AccessbridgeIsInstalled = True
965 if AccessbridgeIsInstalled = false then
967 Case 01 : sAccessibilityCompare = "with accessibility support"
968 Case else : Warnlog "Accessibility check failed. Maybe language has to be adapted."
973 Kontext "OptionenDlg"
979 hIsAccessbridgeInstalled = AccessbridgeIsInstalled