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: g_tools.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:41 $
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 : wolfram.garten@sun.com
36 '* short description : will be moved to autocorrection.bas/inc
38 '**************************************************************************************
40 ' #1 tiToolsHyphenation1
41 ' #1 tiToolsHyphenation2
43 '\*************************************************************************************
44 ' sFile = gTesttoolpath + "graphics\required\input\silben_"+iSprache+sExt
46 '-------------------------------------------------------------------------------
47 testcase tiToolsThesaurus
52 '/// for normal text, the thesaurus is enabled, if the format->character->language of the word has a thesaurus///'
53 '///+ unfortunately in textboxes this doesn't work, you can give the word a langauge, but this is been ignored by///'
54 '///+ our thesaurus :-(((///'
55 '/// so especially for asian languages you have to set a default language in the options, to be able to use///'
56 '///+ the thesaurus there - fallback to englisch, because there is no ? thesaurus for cjk languages ??///'
58 '/// First we make sure we test a language where Thesa
59 ' As long as OOo has no modules for that, disabled
61 printlog "No spellchecking in OOo"
66 case 01 : DasWort$ = "Hello"
67 case 03 : DasWort$ = "Alo"
68 case 07 : printlog "- No Thesaur for Russian available"
70 case 30 : Printlog "- No Thesaurus available !"
72 case 31 : DasWort$ = "Guiten"
73 case 33 : DasWort$ = "Bonjour"
74 case 34 : DasWort$ = "Hola"
75 case 35 : Printlog "- No Thesaurus available !"
77 case 36 : Printlog "- No Thesaurus available !"
79 case 37 : Printlog "- No Thesaurus available !"
81 case 39 : DasWort$ = "Ciao"
82 case 42 : Printlog "- No Thesaurus available !"
84 case 45 : DasWort$ = "Hej"
85 case 46 : DasWort$ = "Välkommen"
86 case 47 : Printlog "- No Thesaurus available !"
88 case 48 : Printlog "- No Thesaurus in Polish!"
90 case 49 : DasWort$ = "Hallo"
91 case 50 : DasWort$ = "Prosojnica"
92 case 51 : Printlog "- No Thesaurus available !"
94 case 55 : Printlog "- No Thesaurus in Brazilian!"
96 case 90 : Printlog "- No Thesaurus available !"
99 case else : if bAsianLan then
103 Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here"
108 printlog " Thesaurus without any word in the document"
109 Call hNewDocument '/// New document ///'
111 ExtrasThesaurusDraw '/// try thesaurus in empty document ///'
114 WarnLog " If no word is in the document, Thesaurus shouldn't be available"
116 PrintLog " No Thesaurus available"
119 PrintLog " Thesaurus with 1 word: " + DasWort$
121 Call hTextrahmenErstellen (DasWort$,20,20,50,30)
124 hTypeKeys "<Home><SHIFT END>"
125 '------------------------
127 Kontext "ExtrasOptionenDlg"
128 hToolsOptions("LANGUAGESETTINGS","Languages")
130 Kontext "ExtrasOptionenDlg"
133 '------------------------
135 ExtrasThesaurusDraw '/// Thesaurus with only 1 word ///'
137 if Thesaurus.Exists(3) then
138 if Wort.GetSelText <> DasWort$ Then WarnLog "marked word should be:" + DasWort$ + " but it is:" + Wort.GetSelText
139 if Wort.GetSelText = DasWort$ Then PrintLog " Marked word is correctly changed" '/// Control if word has changed ///'
140 ZaehlerBedeutung=Bedeutung.GetItemCount
141 if Bedeutung.GetItemCount = 0 Then
142 PrintLog " There are no suggestions for this word"
145 if ZaehlerBedeutung=1 Then
146 Bedeutung.Select ZaehlerBedeutung
148 Bedeutung.Select (ZaehlerBedeutung - 1)
151 Synonym.Select 1 '/// Select synonym 1///'
153 if Ersetzen.GetText=Synonym.GetSelText Then PrintLog " Meaning transfered into Replace edit field"
154 if Ersetzen.GetText<>Synonym.GetSelText Then WarnLog " Replacement should have been: '" + Bedeutung.GetSelText + "' but it is '" + Ersetzen.GetText+"'"
158 warnlog " thesaurus didn't come up, that's bad :-("
161 warnLog " No Thesaurus available ??! check if options western has smth selected !! !TL!"
163 Call hCloseDocument '/// Close document ///'
165 endcase 'tiToolsThesaurus
167 '-------------------------------------------------------------------------------
168 testcase tiToolsHyphenation1
170 printlog " - Hyphenation without any text"
171 Call hNewDocument '/// New impress document ///'
173 ExtrasSilbentrennungDraw '/// Try Silbentrennung with empty document ///'
174 Kontext "Silbentrennung"
175 if Silbentrennung.Exists(1) = True Then
176 Warnlog " - Dialog ist da"
177 Silbentrennung.Cancel
179 Printlog " - Hyphenation activated"
181 ' Kontext "DocumentImpress"
182 printlog " - Hyphenation with text, but without any possibility to break words"
184 case 01 : hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) '/// Create text without a pssibility to split words///'
185 case 03 : hTextrahmenErstellen ("Compare a tradu" + Chr(231) + Chr(227) + "o com o original",10,10,40,40)
186 case 07 : qaerrorlog "- No Hypenation for Russian available"
187 Call hCloseDocument '/// Close document ///'
189 case 31 : hTextrahmenErstellen ("Het is mijn bedoeling om voor en hulpmiddel.",10,10,40,40)
190 case 33 : hTextrahmenErstellen ("Merci beaucoup pout votre candidature du 13/11/97.",10,10,40,40)
191 case 34 : hTextrahmenErstellen ("This ist a text with no spliting words",10,10,40,40)
192 case 36 : hTextrahmenErstellen ("Semmi karhozattyoc nincz most azoknac, a kic az Iesus Christusban be oltattac",10,10,40,40)
193 case 39 : hTextrahmenErstellen ("Il documento 'Senza nome 1' stato modififcato",10,10,40,40)
194 case 45 : hTextrahmenErstellen ("at du har nok i dit hvis du",10,10,40,40 )
195 case 46 : hTextrahmenErstellen ("Detta är en text utan delade ord",10,10,40,40)
196 case 48 : hTextrahmenErstellen (" Jeoli jednak zechcesz",10,10,40,40)
197 case 49 : hTextrahmenErstellen ("Dies ist ein Text ohne eine Moeglichkeit Woerter zu trennen",10,10,40,40)
198 case 50 : hTextrahmenErstellen ("Zato ves čas iščemo nove člane: sodelujte",10,10,40,40)
199 case 55 : hTextrahmenErstellen ("a Sun tentou adquirir a Apple",10,10,40,40)
200 case else : if bAsianLan then
201 printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)"
202 printlog " :-) will use English instead"
203 hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40)
205 Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here"
209 ExtrasSilbentrennungDraw '/// Try Silbentrennung ///'
210 Kontext "Silbentrennung"
211 if Silbentrennung.Exists =True Then
212 Warnlog "Dialog exists"
213 Silbentrennung.Cancel
216 if Active.Exists then Active.OK
219 Call hCloseDocument '/// Close document ///'
221 endcase 'tiToolsHyphenation1
223 '-------------------------------------------------------------------------------
224 testcase tiToolsHyphenation2
226 dim iWaitIndex as integer
228 Dim i : Dim DasWort : Dim DasWort2 : Dim DasWort3 : Dim DasWort4 : Dim DasWort5 : Dim DasWort6 : Dim DasWort7
231 PrintLog "- Tools/Hyphenation2"
232 Select Case Ucase(gApplication)
233 case "DRAW" : sExt = ".odg"
234 case "IMPRESS" : sExt = ".odp"
237 if ((not bAsianLan) AND (iSprache <> 07)) then
238 sFile = gTesttoolpath + "graphics\required\input\silben_"+iSprache+sExt
239 Call hFileOpen (sFile)
242 select case iSprache '/// Open prepared document ///'
243 case 01 :DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34)
244 case 07 : qaerrorlog "- No Hypenation for Russian available"
246 case 31 :DasWort = "siteit" : DasWort2 = "iteit" : DasWort3 = "teit" : DasWort4 = "eit"
247 case 33 :DasWort = "ture" : DasWort2 = "ure" : DasWort3 = "re" : DasWort4 = "e"
248 case 34 :DasWort = "chvo" : DasWort2 = "hvo" : DasWort3 = "vo" : DasWort4 = "o"
249 case 36 :DasWort = "zatnal" : DasWort2 = "atnal" : DasWort3 = "tnal" : DasWort4 = "nal"
250 case 39 :DasWort = "sentu" : DasWort2 = "entu" : DasWort3 = "ntu" : DasWort4 = "tu"
251 case 46 :DasWort = "niska" : DasWort2 = "iska" : DasWort3 = "ska" : DasWort4 = "ka"
252 case 48 :DasWort = "nie" : DasWort2 = "ie" : DasWort3 = "e"
253 case 49 :DasWort = "nung" : DasWort2 = "ung" : DasWort3 = "ng" : DasWort4 = "g"
254 case 50 :DasWort = "nica" : DasWort2 = "ica" : DasWort3 = "ca" : DasWort4 = "a"
255 case 55 :DasWort = "gia" : DasWort2 = "ia" : DasWort3 = "a" : DasWort4 = "ogia"
256 case else : if bAsianLan then
257 printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)"
258 printlog " :-) will use English instead"
259 Call hFileOpen (gTesttoolpath + "graphics\required\input\silben_"+"1"+sExt)
260 DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34)
262 Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here and create file: "+sFile
267 Call sMakeReadOnlyDocumentEditable
269 printlog " - Test hyphenation"
270 EditSelectAll '/// Press CTRL + A to select all ///'
271 '/// press return to go into the edit mode ///'
275 ' WA for draw, or smth else: get text part before hyphenation:
276 if iSprache = "1" OR bAsianLan = TRUE then
277 hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT RIGHT>" '/// Select part of text and compare it with original text at this place ///'
279 hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>"
282 sDraw = GetClipboardText()
283 EditSelectAll '/// Select whole text ///'
284 ExtrasSilbentrennungDraw '/// Run Hyphenation ///'
286 hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" '/// Select part of text and compare it with original text at this place ///'
289 printlog GetClipboardText
290 select case GetClipboardText
291 case DasWort : printlog " - Hyphenation worked"
292 case DasWort2 : printlog " - Hyphenation worked"
293 case DasWort3 : printlog " - Hyphenation worked"
294 case DasWort4 : printlog " - Hyphenation worked"
295 case else : warnlog " - Hyphenation didnt work"
297 if GetClipboardText <> sDraw then
298 Printlog " - WA draw hyphenation did work :-)"
300 Warnlog " - Hyphenation did not work"
301 Printlog "Expected: '"+DasWort+"'; or something different than: '"+sDraw+"'; But what we got was: '"+GetClipboardText+"'"
304 Call hCloseDocument '/// Close document ///'
306 endcase 'tiToolsHyphenation2
308 '-------------------------------------------------------------------------------
313 Dim Zaehler as integer
314 Dim ZaehlerListe as integer
321 '/// to get the count of all macros, the list needs to get elapsed-all ///'
323 Zaehler=MakroAus.GetItemCount
324 MakroAus.typeKeys "<end>"
326 MakroAus.typeKeys "<+><up>"
329 Zaehler=MakroAus.GetItemCount
331 printlog "Starting Macro: (" + i + "/"+ Zaehler + ")"
333 if Makroname.GetText = "" Then
339 Warnlog " - Controls should not be visible"
341 Printlog " Contrls invisible because no macro choosen"
344 SetClipboard = Makroname.GetText
345 ZaehlerListe=MakroListe.GetItemCount
346 for j=2 to ZaehlerListe
348 if Makroname.GetText<>GetClipboardText Then
349 Printlog " Selection got used"
351 Warnlog " - Selection not right, it should be: " + Makroliste.GetSelText + " but it is: " + GetClipboardText
357 Printlog " run macros"
362 Warnlog " - Macro not executed"
364 Printlog " Macro executed"
371 Active.SetPage TabCustomizeMenu
372 Kontext "TabCustomizeMenu"
373 If TabCustomizeMenu.Exists Then
374 Printlog " Assign macro works"
375 TabCustomizeMenu.Cancel
379 Warnlog " - Assigning macro does not work"
384 sleep 1 ' this sleep is necessary. it takes some time, until focuse switched to basic window!
386 kontext "NavigatorDraw"
387 if NavigatorDraw.exists (5) then
388 Warnlog " - Edit macro does not work"
393 Kontext "DocumentDraw"
396 Printlog " Edit macro works"
399 MakroAus.typeKeys "<end>"
400 Zaehler = Makroliste.GetItemCount
401 Neu.Click ' same as delete
403 Modulname.SetText "NewMarco"
407 if (Makroliste.GetItemCount = (Zaehler+1)) Then
408 Printlog " New macro works"
410 Warnlog " - Macro wasn't created"
413 if (Makroliste.GetItemCount <> Makroliste.getSelIndex) Then
414 Warnlog " created Macro not selected"
415 Makroaus.Select(Makroaus.GetItemCount)
421 printlog Active.getText
425 if (Makroliste.GetItemCount = 0) Then
426 Printlog " Delete macro works"
428 Warnlog " - Macro wasn't deleted"
432 'TODO: organizer testing!