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_doc2.inc,v $
13 '* last change: $Author: obo $ $Date: 2008-07-21 12:08:27 $
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; Part two
38 '\***********************************************************************
40 private const VERBOSE = TRUE
43 '/// <b>WRITER only </b>///'
44 '/// hTabelleEinfuegen hInsertTable ///'
45 '/// insert a dummy table in writer/writerweb/masterdocument ///'
48 Kontext "TabelleEinfuegenWriter"
50 TabelleEinfuegenWriter.OK
53 Kontext "TableObjectbar"
55 if TableObjectbar.NotExists then
56 Kontext "TextObjectbar"
57 TextObjectbar.SetNextToolBox
60 select case uCASE(gApplication)
62 Kontext "DocumentWriter"
64 Kontext "DocumentMasterDoc"
66 Kontext "DocumentWriterWeb"
71 '-------------------------------------------------------------------------------
73 sub ZellenMarkieren ( Down%, Right% )
74 '/// <b>CALC only</b> ///'
75 '/// ZellenMarkieren ( Down%, Right% ) : mark the cells ///'
78 Kontext "DocumentCalc"
80 DocumentCalc.TypeKeys "<Shift Right>", Anzahl
82 DocumentCalc.TypeKeys "<Shift Down>", Anzahl
85 '-------------------------------------------------------------------------------
87 sub hRechteckErstellen ( BeginX%, BeginY%, EndX%, EndY% )
88 '/// <b>IMPRESS/DRAW only</b> ///'
89 '/// hRechteckErstellen ( BeginX, BeginY, EndX, EndY ) : create a rectangle ///'
91 gMouseMove ( BeginX%, BeginY%, EndX%, EndY% )
94 '-------------------------------------------------------------------------------
96 sub hTextrahmenErstellen ( TextEingabe$, BeginX%, BeginY%, EndX%, EndY% )
97 '/// <b>IMPRESS/DRAW only</b> ///'
98 '/// hTextrahmenErstellen ( String, BeginX, BeginY, EndX, EndY ) : create a textbox with a textstring ///'
99 WL_SD_TextEinfuegenDraw
100 gMouseMove ( BeginX%, BeginY%, EndX%, EndY% )
101 hTypeKeys TextEingabe$
104 '-------------------------------------------------------------------------------
106 sub SchreibenInMathdok ( Eingabe as String )
107 '/// <b>MATH only</b> ///'
108 '/// SchreibenInMathDok ( String ) : write text in a mathdocument ( with clipboard ) ///'
109 if Eingabe <> "Unsinn" then
112 SetClipboard "NROOT <?> <?><over b==<?>"
114 if (GetClipboard() <> Eingabe) then
115 warnlog "--No Clipboard available :-(--"
116 printlog "---ClipTest--- should: "+Eingabe +", is: "+GetClipboard
122 '-------------------------------------------------------------------------------
124 function sMakeReadOnlyDocumentEditable() as boolean
126 ' Function returns TRUE if document has been made editable and FALSE if
127 ' no action was required (that is: Document was not read-only)
131 const CFN = "sMakeReadOnlyDocumentEditable::"
133 if ( VERBOSE ) then printlog( CFN & "Making document editable (create a copy) if it is readonly" )
135 Kontext "Standardbar"
136 if ( Bearbeiten.IsEnabled() ) then
138 if ( Bearbeiten.getState( 2 ) = 0 ) then
140 rc = hUseAsyncSlot("editdoc")
147 if ( Active.exists( 5 ) ) then
149 printlog( CFN & "Messagebox: " & Active.getText() )
152 if ( VERBOSE ) then printlog( CFN & "Document was read-only. A copy will be used." )
154 if ( VERBOSE ) then printlog( CFN & "Closed 'use copy' message" )
156 if ( VERBOSE ) then printlog( CFN & "Probing for unexpected messagebox..." )
158 qaerrorlog( "#i100701 - Object not found message" )
161 printlog( CFN & "No messagebox informing about a copy being used" )
163 sMakeReadOnlyDocumentEditable() = TRUE
166 printlog( CFN & "Document appears to be editable" )
169 if ( VERBOSE ) then printlog( CFN & "Button <Bearbeiten> is pressed, document is editable" )
170 sMakeReadOnlyDocumentEditable() = FALSE
173 if ( VERBOSE ) then printlog( CFN & "Control <Bearbeiten> is not enabled" )
178 '-------------------------------------------------------------------------------
180 function fSelectFirstOLE() as integer
181 'Select first visible OLE object using Navigator
184 '- 1 := unknown application
186 dim bNavigatorWasVisible as boolean
187 bNavigatorWasVisible = FALSE
192 select case uCASE(gApplication)
193 case "CALC" : Kontext "NavigatorCalc"
194 'First check if Navigator is visible and remember result
195 if NavigatorCalc.exists (10) then
196 bNavigatorWasVisible = TRUE
199 'Invoke Navigator if not visible
202 'If inside chart or elsewhere the call
203 'will fail. Again trying the slot after
204 'switching to the document.
205 Kontext "DocumentCalc"
206 DocumentCalc.TypeKeys "<Escape>"
210 Kontext "NavigatorCalc"
211 if NavigatorCalc.exists (10) then
212 'Select first OLE in list
213 Liste.TypeKeys "<HOME>"
217 Liste.TypeKeys "<DOWN>"
222 Liste.TypeKeys "<DOWN><RETURN>"
225 QAErrorLog "Navigator couldn't be opened!"
227 case "DRAW" , "IMPRESS" : Kontext "NavigatorDraw"
228 if NavigatorDraw.Exists(10) then
229 bNavigatorWasVisible = TRUE
232 'Invoke Navigator if not visible
235 'If inside chart or elsewhere the call
236 'will fail. Again trying the slot after
237 'switching to the document.
238 Kontext "DocumentDraw"
239 DocumentDraw.TypeKeys "<Escape>"
242 Kontext "NavigatorDraw"
243 if NavigatorDraw.exists(10) then
244 'Select first OLE in list
245 Liste.TypeKeys "<HOME>"
247 Liste.TypeKeys "+<DOWN><RETURN>"
250 QAErrorLog "Navigator did not occoured!"
254 case "WRITER" , "HTML" , "MASTERDOCUMENT" :
255 select case uCASE(gApplication)
256 case "MASTERDOCUMENT" : Kontext "NavigatorGlobalDoc"
257 if NavigatorGlobalDoc.Exists(10) then
258 bNavigatorWasVisible = TRUE
263 Kontext "NavigatorGlobalDoc"
264 if Liste.IsVisible then
265 Kontext "GlobaldokumentToolbox"
268 case else : Kontext "NavigatorWriter"
269 'First check if Navigator is visible and remember result
270 if NavigatorWriter.Exists (10) then
271 bNavigatorWasVisible = TRUE
274 'Invoke Navigator if not visible
277 'If inside chart or elsewhere the call
278 'will fail. Again trying the slot after
279 'switching to the document.
280 Kontext "DocumentWriter"
281 call gMouseclick (99,99)
282 call gMouseclick (50,50)
287 Kontext "NavigatorWriter"
288 if NavigatorWriter.Exists(10) then
289 ' Check if all content is visible
290 if Auswahlliste.GetItemCount < 2 then
293 'Select first OLE in list
294 Auswahlliste.TypeKeys "<HOME>"
296 Auswahlliste.TypeKeys "-<DOWN>"
298 Auswahlliste.select(5)
299 Auswahlliste.TypeKeys "+<DOWN><RETURN>"
302 QAErrorLog "Navigator did not occoured!"
304 case else : QAErrorLog "Application not supported"
307 'Close navigator if it was invisible by entering the routine
308 if bNavigatorWasVisible = TRUE then
309 printlog "Leaving navigator open as initially found"
311 if fSelectFirstOLE = 0 then
313 printlog "Closing navigator as initially found"
315 printlog "Closing navigator not needed. It was not possible to open it."