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: ch_tools_select.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-13 14:27:02 $
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 : oliver.craemer@sun.com
36 '* short description : selecting charts
38 '**************************************************************************************************
40 ' #1 fSelectChartByNumber
42 ' #1 fChartSelectElement
44 '\************************************************************************************************
46 function fSelectChartByNumber ( iObjectPosition as INTEGER )
47 ' Select any Chart in document
48 ' INTEGER: iObjectPosition - Position of object (>=1) within OLE objects
49 ' NOTE: You're moving within a treelistbox which is quite messy to handle.
50 ' In case 'iObjectPosition' is larger than the real number of objects in category you're end up in another categories.
51 ' WITHOUT ANY WARNING!
52 ' RETURNS: BOOLEAN (success)
53 dim bNavigatorWasVisible as boolean
54 bNavigatorWasVisible = FALSE
56 dim iCategoryPosition as INTEGER
59 fSelectChartByNumber = FALSE
61 '/// Check if Navigator is visible
62 Kontext "NavigatorCalc"
63 if NavigatorCalc.exists (3) then
64 bNavigatorWasVisible = TRUE
66 '/// Invoke navigator if not visible
71 Kontext "NavigatorCalc"
72 '/// Go to Top in Navigator
73 liste.TypeKeys "<HOME>"
74 '/// Travel top to bottom through all categories
76 '/// Make sure all elements in category are hidden, apply '-' key
77 liste.TypeKeys "-<DOWN>"
79 '/// Select desired category OLE
80 liste.select ( iCategoryPosition )
81 '/// Unfold elements of selected category
83 '/// Select desired position within category
84 liste.select ( iCategoryPosition + iObjectPosition )
85 '/// Hit 'RETURN' key to select element in document
86 liste.TypeKeys "<RETURN>"
87 '/// Return 'TRUE' for 'fNavigatorSelectObject'
88 fSelectChartByNumber = TRUE
90 warnlog "Selecting the desired object failed. Perhaps your input wasn't valid"
92 '/// Close navigator if it wasn't visible before entering this function
93 if bNavigatorWasVisible = TRUE then
94 printlog "Leaving navigator open as initially found"
97 printlog "Closing navigator as initially found"
101 '--------------------------------------------------------------------
103 function fCalcSelectSheet ( sSelectThisSheet ) as boolean
104 ' Select a sheet by name (STRING) or number (INTEGER)
105 ' RETURNS: boolean (success)
106 fCalcSelectSheet = FALSE
108 Kontext "DocumentCalc"
109 '/// Invoke Edit::Sheet::Select
111 Kontext "SelectSheets"
112 '/// Select sheet no. or sheet name in listbox
113 SheetSelectionBox.Select ( sSelectThisSheet )
117 fCalcSelectSheet = TRUE
119 warnlog "Something went wrong while selecting a sheet by name"
120 '/// In case of Failure lookup 'Select sheets' dialog andd close it if exists
121 Kontext "SelectSheets"
122 if SelectSheets.exists(2) then
128 '--------------------------------------------------------------------
130 function fChartSelectElement ( iObjectPosition as INTEGER ) as boolean
131 ' Select a chartelement by using the ChartElementSelectorListBox in the Toolbar
132 ' RETURNS: boolean (success)
133 fChartSelectElement = FALSE
137 ChartElementSelector.Select (iObjectPosition)
138 fChartSelectElement = TRUE
140 warnlog "Something went wrong while selecting a chartelement"