summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/regexp/search.inc
blob: ce3d946fe3b91154cfead1a1470672015d483a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org.  If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : helge.delfs@sun.com
'*
'* short description : Search & Replace
'*
'\***********************************************************************

sub search

   if bAsianLan = false then Call ActiveDeactivateAsianSupport(False)
   call tCheckDialog
   call tCallDialog
   call tFree_Text

   call tAlle_Suchen
   call tSelection
   call tPart_of_a_word
   call tWhole_Word
   call tMatch_Case

   call tItalic_Search

   call tItalic_Replace
   call tUnderline_Search
   call tUnderline_Replace
   call tAll_Replace

   call tReplace_Arial_with_TmsRmn
   call tBackwards_Search
   call tSeveral_Times
   call tFurther_Look_up_At_The_Beginning
   call tParagraphStyle_Search
   call tText_In_Table
   call tText_In_Frame
   call tSimilarity_Search

end sub

'---------------------------------------------------------
testcase tCheckDialog
 Dim Checkboxtitel
   Call hNewDocument
   EditSearchAndReplace
   Sleep 2
   Kontext "FindAndReplace"
   if FindAndReplace.NotExists then EditSearchAndReplace

  printlog "Check Find-and-Replace-Dialog"
  printlog "- Dependencies of Buttons in Search-for-Entry"
   SearchFor.SetText ""
   if Not Backwards.IsVisible then More.Click
   if SimilaritySearch.IsEnabled and SimilaritySearch.IsChecked then SimilaritySearch.Uncheck
   if SearchAll.IsEnabled then Warnlog "Without Search-for-entry Find-All is active!"
   if SearchNow.IsEnabled then Warnlog "Without Search-for-entry Find is active!"
   if ReplaceAll.IsEnabled then Warnlog "Without Search-for-entry Replace-All is active!"
   if Replace.IsEnabled then Warnlog "Without Search-for-entry Replace is active!"
   if NoFormat.IsEnabled then Warnlog "Without selecting Formats , No-Format is active!"
   SearchFor.SetText "Hallo"
   if NOT SearchAll.IsEnabled then Warnlog "Containing Search-for-entry Find-All is inactive!"
   if NOT SearchNow.IsEnabled then Warnlog "Containing Search-for-entry Find inactive!"
   if NOT ReplaceAll.IsEnabled then Warnlog "Containing Search-for-entry Replace-All is inactive!"
   if NOT Replace.IsEnabled then Warnlog "Containing Search-for-entry Replace is inactive!"

   Sleep 5
  printlog "- Dependencies of Format-Properties"
   Kontext "FindAndReplace"
   Formats.Click
   wait 500
   Kontext
    Active.SetPage TabFontEffects
   Kontext "TabFontEffects"
    Outline.Check
    TabFontEffects.OK
   wait 500
   kontext "FindAndReplace"
    if NOT NoFormat.IsEnabled then Warnlog "Containing Formats, No-Formats is inactive!"
    NoFormat.Click
   wait 500

  printlog "- Dependencies of Checkboxes"
   RegularExpressions.Check
   wait 500
   if WholeWordsOnly.IsEnabled then Warnlog "Regular expressions: 'Whoole words only' is active => BUG!"
   if NOT Backwards.IsEnabled then Warnlog "Regular expressions: 'Backwards' is inactive => BUG!"
   if NOT MatchCase.IsEnabled then Warnlog "Regular expressions: 'Match case' is inactive => BUG!"
   if CurrentSelectionOnly.IsEnabled then Warnlog "Regular expressions: 'Current selection only' is active => BUG!"
   if NOT SearchForStyles.IsEnabled then Warnlog "Regular expressions: 'Search for Styles' is inactive => BUG!"
   if SimilaritySearch.IsEnabled then Warnlog "Regular expressions: 'Similarity search' is active => BUG!"
   if SimilaritySearchFor.IsEnabled then Warnlog "Regular expressions: Button for 'Similarity search' - dialog is active => BUG!"
   RegularExpressions.UnCheck

   wait 500
   SearchForStyles.Check
   if WholeWordsOnly.IsEnabled then Warnlog "Search for Styles: 'Whole words only' is active => BUG!"
   if NOT Backwards.IsEnabled then Warnlog "Search for Styles: 'Backwards' is inactive => BUG!"
   if RegularExpressions.IsEnabled then Warnlog "Search for Styles: 'Regular expressions' is active => BUG!"
   if MatchCase.IsEnabled then Warnlog "Search for Styles: 'Match case' is active => BUG!"
   if CurrentSelectionOnly.IsEnabled then Warnlog "Regular expressions: 'Current selection only' is active => BUG!"
   if SimilaritySearch.IsEnabled then Warnlog "Search for Styles: 'Similarity search' is active => BUG!"
   if SimilaritySearchFor.IsEnabled then Warnlog "Search for Styles: Button for 'Similarity search' - dialog is active => BUG! "
   SearchForStyles.UnCheck

   wait 500
   SimilaritySearch.Check
   if NOT WholeWordsOnly.IsEnabled then Warnlog "Similarity Search: 'Whole words only' is active => BUG!"
   if NOT Backwards.IsEnabled then Warnlog "Similarity Search: 'Backwards' is inactive => BUG!"
   if RegularExpressions.IsEnabled then Warnlog "Similarity Search: 'Regular expressions' is active => BUG!"
   if NOT MatchCase.IsEnabled then Warnlog "Similarity Search: 'Match case' is active => BUG!"
   if CurrentSelectionOnly.IsEnabled then Warnlog "Regular expressions: 'Current selection only' is active => BUG!"
   if SearchForStyles.IsEnabled then Warnlog "Regular expressions: 'Search for Styles' is active => BUG!"
   if NOT SimilaritySearchFor.IsEnabled then Warnlog "Similarity Search: Button for 'Similarity search' - dialog is active => BUG! "
   SimilaritySearch.UnCheck
   Sleep 2
   FindAndReplace.Close

   Kontext "DocumentWriter"
   DocumentWriter.TypeKeys "hallo <Shift Home>"
   EditSearchAndReplace
   kontext "FindAndReplace"
   if NOT CurrentSelectionOnly.IsEnabled then Warnlog "WIth a selected entry, 'Current selection only' isn't active! => BUG"
   Sleep 2
   FindAndReplace.Close
   wait 500
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tCallDialog
 Dim Shortcut as String
   Call hNewDocument
   '/// Open new document ///
   kontext "FindAndReplace"
   Sleep 2
   if FindAndReplace.Exists then FindAndReplace.Close
   '/// Close Search&Replace dialog if open ///
   Kontext "DocumentWriter"
   select case iSprache
      case 01 : Shortcut = "<Mod1 f>"
      case 03 : Shortcut = "<Mod1 g>"
      case 07 : Shortcut = "<Mod1 f>"
      case 31 : Shortcut = "<Mod1 f>"
      case 33 : Shortcut = "<Mod1 f>"
      case 34 : Shortcut = "<Mod1 b>"
      case 39 : Shortcut = "<Mod1 f>"
      case 46 : Shortcut = "<Mod1 f>"
      case 49 : Shortcut = "<Mod1 f>"
      case 50 : Shortcut = "<Mod1 f>"
      case 55 : Shortcut = "<Mod1 f>"
	  case 81 : Shortcut = "<Mod1 f>"
      case 82 : Shortcut = "<Mod1 f>"
      case 86 : Shortcut = "<Mod1 f>"
      case 88 : Shortcut = "<Mod1 f>"
      case else : QAErrorLog "Shortcut to call Find&Replace-Dialog has to be included!"
                  Call hCloseDocument
                  goto endsub
   end select
   '/// Open Search and Replace dialog with Shortcut depending on current language ///
   DocumentWriter.TypeKeys Shortcut
   kontext "FindAndReplace"
   if FindAndReplace.NotExists then
      Warnlog "Shortcut " + Shortcut + " didn't call the Find dialog"
   else
      printlog "- Dialog has been called with Shortcut: " + Shortcut
   end if
   Call hCloseDocument
   '/// Close active document ///
   Call hNewDocument
   '/// Open new document ///
   Kontext "Navigator"
   If Navigator.Exists then ViewNavigator
  printlog "- Check, if dialog is not present in a new document"
   '/// Check, if dialog is not present in a new document ///
   kontext "FindAndReplace"
   if FindAndReplace.Exists then
      Warnlog "Search-For-Dialog has been opened in a new document"
      EditSearchAndReplace
   end if
   Call hCloseDocument
   '/// Close active document ///
endcase

'---------------------------------------------------------
testcase tFree_Text
   Call wSetFindAndReplaceToDefault(1)
   Such_Text = "non"                               'Suchen in freiem Text
   Meldungs_Text = "Suchen in freiem Text"
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   call Vergleichen_und_ausgeben
   EditSearchAndReplace
   kontext "FindAndReplace"            'Suchen&Replace-Fenster "ffnen
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tSelection
   Call wSetFindAndReplaceToDefault(1)
   Such_Text = "d n"
   Meldungs_Text = "Suchen in selektiertem Text"              'Suchen in selektiertem Text
   Sleep 2
   FindAndReplace.Close
   kontext "DocumentWriter"
   DocumentWriter.TypeKeys "<Shift PageDown>"
   EditSearchAndReplace
   kontext "FindAndReplace"
   SearchFor.SetText Such_Text
   if CurrentSelectionOnly.IsVisible = False then More.Click
   if not CurrentSelectionOnly.ischecked then                        'Sollte automatisch
   Warnlog "   'Current selection only' has not been checked automatically"       'gecheckt sein, wenn
   CurrentSelectionOnly.check                                     'Text markiert ist
   else
      printlog "OK: Only in Selection is checked automatically"
   end if
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
    call Vergleichen_und_ausgeben

   EditSearchAndReplace
   kontext "FindAndReplace"            'Suchen&Replace-Fenster "ffnen
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tPart_of_a_word
   Call wSetFindAndReplaceToDefault(1)
   Such_Text = "te"
   Meldungs_Text = "Suchen Teil eines Wortes"         'Suchen  Teil eines Wortes
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tWhole_Word
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "illa"
   Meldungs_Text = "Suchen nur ganzes Wort"        'Suchen  nur ganzes Wort
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   WholeWordsOnly.Check
   SearchNow.Click                     '"te" ist Teil eines Wortes, "Te" als
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tMatch_Case
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "Be"                 'Exakte Suche
   Meldungs_Text = "Exakte Suche"
   ReplaceWith.SetText Meldungs_Text
   'sleep 1
   MatchCase.check
   SearchFor.SetText Such_Text
   SearchAll.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tItalic_Search
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "k"                     'Suche nach Format "kursiv"
   Meldungs_Text = "Suchen Format kursiv"
   SearchFor.SetText Such_Text
   try
    Formats.Click
    wait 500
   catch
    Warnlog "Button 'Format is disabled !"
    Call hCloseDocument
    goto endsub
   endcatch

   Kontext
   Active.Setpage TabFont
   Kontext "TabFont"
   if gAsianSup = True or gCTLSup = True then
      try
         StyleWest.Select 2
      catch
         Warnlog "Style has not been found ! -> Asian-Support: " + gAsianSup + "CTL-Support: " + gCTLSup
         Style.Select 2
      endcatch
   else
      Style.Select 2
   end if
   wait 500
   TabFont.Ok
   ' Workaround
   Kontext "FindAndReplace"
   NoFormat.Click
   wait 500
   Formats.Click
   sleep  1
   kontext
   Active.SetPage TabFont
   kontext "TabFont"
   sleep  1
   if gAsianSup = True or gCTLSup = True then
     StyleWest.Select 2
   else
     Style.Select 2
   end if
   sleep  1
   TabFont.OK
   sleep  1
   ' Workaround ends here
   Kontext "FindAndReplace"
   ReplaceWith.SetText Meldungs_Text
   sleep  1
   SearchAll.Click                     'wenn auf Format geachtet wird,
   sleep  1
   call Vergleichen_und_ausgeben             'darf nur ein "k" gefunden werden
   sleep  1
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tItalic_Replace
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "kursiv"                'Suche Format "kursiv", ersetze
   Meldungs_Text = "Ersetzte kursiv mit durchgestrichen"    'mit Format "durchgestrichen"
   SearchFor.SetText Such_Text
   wait 500
   try
    NoFormat.Click
   catch
   endcatch
   wait 500
   Formats.Click
   sleep  1
   kontext
   Active.SetPage TabFont
   kontext "TabFont"
   sleep  1
   if gAsianSup = True or gCTLSup = True then
      try
         StyleWest.Select 2
      catch
         Warnlog "Style has not been found ! -> Asian-Support: " + gAsianSup + "CTL-Support: " + gCTLSup
         Style.Select 2
      endcatch
   else
     Style.Select 2
   end if
   sleep  1
   TabFont.OK
   sleep  1
   kontext "FindAndReplace"
   NoFormat.Click
   ' Tried a workaround, because sometimes, searchstring ends with ','. Dont know why !?
   Formats.Click
   sleep  1
   kontext
   Active.SetPage TabFont
   kontext "TabFont"
   sleep  1
   if gAsianSup = True or gCTLSup = True then
     StyleWest.Select 2
   else
     Style.Select 2
   end if
   sleep  1
   TabFont.OK
   sleep  1
   kontext "FindAndReplace"


   ReplaceWith.SetText "durchgestrichen"
   sleep  1
   Formats.Click
   kontext
   sleep  1
   Active.SetPage TabFontEffects
   kontext "TabFontEffects"
   sleep  1
   StrikeThrough.Select 2
   sleep  1
   TabFontEffects.OK
   sleep  1
   kontext "FindAndReplace"
   sleep  1
   ReplaceAll.Click
   sleep  1
   kontext
   sleep  1
   Kontext "Active"
   if Active.Exists then
    if Active.GetRT = 304 then
     Active.OK                     'MSG-Box (... x ersetzt) schließen
    else
     Warnlog "Messagebox, how often replaced, not up !"
    end if
   end if
   sleep  2
   kontext "FindAndReplace"
   FindAndReplace.Close
   sleep  1
   Kontext "DocumentWriter"
   DocumentWriter.Typekeys "<MOD1 HOME>"
   EditSearchAndReplace
   kontext "FindAndReplace"
   Such_Text = "durchgestrichen"
   SearchFor.SetText Such_Text
   sleep  1
   if NoFormat.IsVisible = False then More.Click
   NoFormat.Click
   sleep  1
   ReplaceWith.SetText "durchgestrichen suchen"
   sleep  1
   NoFormat.Click
   sleep  1
   SearchAll.Click
   sleep  1
   call Vergleichen_und_ausgeben
   FormatCharacter
   Kontext
   active.SetPage TabFontEffects
   Kontext "TabFontEffects"
   if StrikeThrough.GetSelIndex <> 2 then Warnlog "Format 'Strikethrough' has not been overtaken!"
   TabFontEffects.Cancel
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tUnderline_Search
    if gCTLSup = True then
        QAErrorlog "No Check for attributes if CTL enabled!"
        goto endsub
    end if        
    call wSetFindAndReplaceToDefault(1)
    Such_Text = "U"                     'search for Attributes underlined
    Meldungs_Text = "search Attribut Underlined"
    if gAsianSup = false then
        Select Case iSprache
            case 01: ToggleAttribute(30,"True")             'Check Attributes underlined
            case 07: ToggleAttribute(16,"True")             'Check Attributes underlined
            case 31: ToggleAttribute(12,"True")             'Check Attributes underlined
            case 33: ToggleAttribute(27,"True")
            case 34: ToggleAttribute(28,"True")
            case 39: ToggleAttribute(27,"True")
            case 46: ToggleAttribute(30,"True")            
            case 49: ToggleAttribute(28,"True")
            case 50: ToggleAttribute(15,"True")
            case 55: ToggleAttribute(29,"True")
            case 88: ToggleAttribute(13,"True")
            case else : QAErrorlog "Please adapt test for this language!"
                    Call hCloseDocument
                    goto endsub
        end select
    else
        Select Case iSprache
            case 01: ToggleAttribute(39,"True")             'Check Attributes underlined
            case 07: ToggleAttribute(22,"True")             
            case 31: ToggleAttribute(17,"True")             'Onderstrepen
            case 33: ToggleAttribute(36,"True")             ' Soulignage
            case 34: ToggleAttribute(37,"True")             ' Subrayado
            case 39: ToggleAttribute(35,"True")             ' Sottolineato
            case 46: ToggleAttribute(40,"True")             ' Understruken
            case 49: ToggleAttribute(37,"True")             ' Unterstrichen
            case 50: ToggleAttribute(24,"True")             ' Podčrtano
            case 55: ToggleAttribute(38,"True")             ' Sublinhado
            case 88: ToggleAttribute(13,"True")
            case else : QAErrorlog "Please adapt test for this language!"
                    Call hCloseDocument
                    goto endsub
        end select   
    end if
   
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchAll.Click                     'if looking for the Attributes,
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tUnderline_Replace
    if gCTLSup = True then
        QAErrorlog "No Check for attributes if CTL enabled!"
        goto endsub
    end if        
    call wSetFindAndReplaceToDefault(1)
    Such_Text = "Unterstrichen"                  'search for Attributes underlined
    Meldungs_Text = "search underlined, replace shadow"      'replace with 'shadow'
    SearchFor.SetText Such_Text
    if gAsianSup = false then
        Select Case iSprache
            case 01: ToggleAttribute(30,"True")             'Check Attributes underlined
            case 07: ToggleAttribute(16,"True")
            case 31: ToggleAttribute(12,"True")
            case 33: ToggleAttribute(27,"True")
            case 34: ToggleAttribute(28,"True")
            case 39: ToggleAttribute(27,"True")
            case 46: ToggleAttribute(30,"True")            
            case 49: ToggleAttribute(28,"True")
            case 50: ToggleAttribute(15,"True")
            case 55: ToggleAttribute(29,"True")
            case 88: ToggleAttribute(13,"True")
            case else : QAErrorlog "Please adapt test for this language!"
                    Call hCloseDocument
                    goto endsub
        end select
    else
        Select Case iSprache
            case 01: ToggleAttribute(39,"True")             'Check Attributes underlined
            case 07: ToggleAttribute(22,"True")
            case 31: ToggleAttribute(17,"True")             ' Onderstrepen
            case 33: ToggleAttribute(36,"True")             ' Soulignage
            case 34: ToggleAttribute(37,"True")             ' Subrayado
            case 39: ToggleAttribute(35,"True")             ' Sottolineato
            case 46: ToggleAttribute(40,"True")             ' Understruken
            case 49: ToggleAttribute(37,"True")             ' Unterstrichen
            case 50: ToggleAttribute(24,"True")             ' Podčrtano
            case 55: ToggleAttribute(38,"True")             ' Sublinhado
            case 88: ToggleAttribute(13,"True")
            case else : QAErrorlog "Please adapt test for this language!"
                    Call hCloseDocument
                    goto endsub
        end select   
    end if
    ReplaceWith.SetText "Schatten"
    Formats.Click
    kontext
    Active.SetPage TabFontEffects
    kontext "TabFontEffects"
    Shadow.Check
    TabFontEffects.OK
    kontext "FindAndReplace"
    ReplaceAll.Click
    Kontext "Active"
    if Active.Exists then
        if Active.GetRT = 304 then
            Active.OK                     'MSG-Box (... x ersetzt) schließen
        end if
    end if
    kontext "FindAndReplace"
    Such_Text = "Schatten"
    SearchFor.SetText Such_Text
    NoFormat.Click
    'ReplaceWith.SetText Meldungs_Text
    SearchAll.Click
    call Vergleichen_und_ausgeben
    FormatCharacter
    Kontext
    active.SetPage TabFontEffects
    Kontext "TabFontEffects"
    if NOT Shadow.IsChecked then Warnlog "Attribute 'Shadow' has not been overtaken!"
    TabFontEffects.Cancel
    Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tAll_Replace
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "x"                     'Replace alle
   Meldungs_Text = "Replace alle"
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   ReplaceWith.SetText "y"
   ReplaceAll.Click
   Kontext "Active"
   if Active.Exists then
    if Active.GetRT = 304 then
     Active.OK                     'MSG-Box (... x ersetzt) schließen
    end if
   end if
   Such_Text = "y"                     'Suchen  aller "y", um die Ersetzung
   kontext "FindAndReplace"            'zu pruefen
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchAll.Click
   Such_Text = "yyyy"                  '4 mal wurde ersetzt
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tReplace_Arial_with_TmsRmn
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "opus"                  'Suche Arial, 16 pt, ersetze
   Meldungs_Text = "Ers. Arial mit Times Roman"       'mit Times New Roman, normal 24pt
   SearchFor.SetText Such_Text

   Formats.Click
   kontext
   Active.SetPage TabFont
   kontext "TabFont"
   try
      FontWest.SetText "Arial"
   catch
      Font.SetText "Arial"
   endcatch
   sleep 2
   try
      SizeWest.SetText "16"
   catch
      Size.SetText "16"
   endcatch
   sleep 2
   TabFont.OK
   kontext "FindAndReplace"
   ReplaceWith.SetText "Ersetzungstext"
   sleep 2

   Formats.Click
   kontext
   Active.SetPage TabFont
   kontext "TabFont"
   if gAsianSup = True or gCTLSup = True then
   		try
			FontWest.SetText "Times New Roman"
		catch
        	Warnlog "Control: 'FontWest' has not been found ! -> Asian-Support: " + gAsianSup + "CTL-Support: " + gCTLSup
			Font.SetText "Times New Roman"
		endcatch
	else
		Font.SetText "Times New Roman"
	end if
   sleep 2
   if gAsianSup = True or gCTLSup = True then
     StyleWest.Select 1
   else
     Style.Select 1
   end if
   sleep 2
   try
      SizeWest.SetText "20"
   catch
      Size.SetText "20"
   endcatch
   sleep 2
   TabFont.OK
   sleep 2
   kontext "FindAndReplace"
   ReplaceAll.Click

   sleep 2
   kontext
   Kontext "Active"
   if Active.Exists then
    if Active.GetRT = 304 then
     Active.OK                     'MSG-Box (... x ersetzt) schließen
    else
     Warnlog "Messagebox, how often replaced, not up !"
    end if
   end if
   Sleep 2
   kontext "FindAndReplace"
   FindAndReplace.Close
   Kontext "DocumentWriter"
   DocumentWriter.Typekeys "<MOD1 HOME>"

   EditSearchAndReplace
   kontext "FindAndReplace"
   Such_Text = "Ersetzungstext"
   SearchFor.SetText Such_Text
   if NoFormat.IsVisible = False then More.Click
   NoFormat.Click
   ReplaceWith.SetText "Ersetzungstext suchen"
   NoFormat.Click
   SearchAll.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tBackwards_Search
   call wSetFindAndReplaceToDefault(1)
   Sleep 2
   FindAndReplace.Close
   kontext "DocumentWriter"               'Suchen  rückwärts, dafür an
   DocumentWriter.Typekeys "<PAGEDOWN>"            'das Ende des Dokuments gehen
   DocumentWriter.Typekeys "<MOD1 END>"
   Such_Text = "no"
   Meldungs_Text = "Suchen rückwärts"
   EditSearchAndReplace
   kontext "FindAndReplace"
   if Backwards.IsVisible = False then More.Click
   Backwards.Check
   if WholeWordsOnly.ischecked then
      Warnlog "   'Match case' is checked"
      WholeWordsOnly.uncheck
   end if
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tSeveral_Times
  dim Zaehler as integer

   call wSetFindAndReplaceToDefault(1)
   Such_Text = "m"                     'Suchen  mehrmals
   Meldungs_Text = "Suchen mehrmals"
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   for Zaehler = 1 to 10
      SearchNow.Click
   next Zaehler
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tAlle_Suchen
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "x"                     'Suchen  alle
   Meldungs_Text = "Suchen alle"
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchAll.Click
   Such_Text = "xxxx"                  'im Beispieltext kommt "x" 4 mal vor
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tFurther_Look_up_At_The_Beginning
   call wSetFindAndReplaceToDefault(1)
   Sleep 2
   FindAndReplace.Close             'Meldung am Dokumentende
   kontext "DocumentWriter"
   DocumentWriter.Typekeys "<MOD1 END>"            'and Ende des Dokuments gehen
   Such_Text = "o"
   Meldungs_Text = "Am Dokumentanfang weitersuchen"
   EditSearchAndReplace
   kontext "FindAndReplace"
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   Kontext "Active"
   if Active.Exists (1) then
      dummy_text = Active.GetText               'Auslesen der Meldung (dt/engl/frz)
      call Meldungs_Test (dummy_text)           'in der Query-Box und Schließen
      Active.Yes                 'mit JA
   end if
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tParagraphStyle_Search
    call wSetFindAndReplaceToDefault(1)
    ' print "the base for the dialog isn't reached!???? before"
    if Not SearchForStyles.IsVisible then More.Click
    SearchForStyles.Check    
    ' <font color=#ff0000> TBO TODO : insert global LOCALE routine for text : 'Heading' </FONT>
    Select Case iSprache
        Case 01 : Such_Text = "Heading"
        Case 03 : Such_Text = "Título"
        Case 07 : Such_Text = "Заголовок"
        Case 31 : Such_Text = "Kop"
        Case 33 : Such_Text = "Titre"
        Case 34 : Such_Text = "Encabezado"
        Case 39 : Such_Text = "Intestazione"
        Case 46 : Such_Text = "Överskrift"
        Case 49 : Such_Text = "Überschrift"          'Suchen  Absatzformat "Überschrift"
        Case 50 : Such_Text = "Naslov"
        Case 55 : Such_Text = "Título Principal"
        Case 81 : Such_Text = "見出し"
        Case 86 : Such_Text = "标题"
        Case 88 : Such_Text = "標題"
        case else:  QAErrorlog "Insert heading-name (" + wGetHeadingName + ") for language: " + iSprache
                    Call hCloseDocument
                    goto endsub
    end select
    Meldungs_Text = "Suchen Absatzformat"
    Sleep 2
    FindAndReplace.Close
    kontext "DocumentWriter"
    DocumentWriter.Typekeys "<RIGHT>"
    DocumentWriter.Typekeys "<LEFT>"
    EditSearchAndReplace
    kontext "FindAndReplace"
    if SearchForStyles.IsVisible = False then More.Click
    SearchForStyles.Check
    sleep 1                       'Vorlagen muessen erst gelesen werden
    SearchForStyle.Select Such_Text
    SearchNow.Click
    Such_Text = chr(9) + "Absatzformat: Überschrift"
    call Vergleichen_und_ausgeben
    Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tText_In_Table
    call wSetFindAndReplaceToDefault(1)
'warnlog "WorkAround beginn-----------------"
'   kontext "FindAndReplace"
'   Sleep 2
'   if FindAndReplace.Exists then            'Evtl. offenes Fenster schließen
'      FindAndReplace.Close
'   end if
'   kontext "DocumentWriter"
'   EditSearchAndReplace
'   kontext "FindAndReplace"           'Suchen&Replace-Fenster öffnen
'   sleep 2
'warnlog "WorkAround ending!-----------------"

 'print "the base for the dialog isn't reached!???? after!"
   Such_Text = "Tabelle"                  'Suchen Text in Tabelle
   Meldungs_Text = "Text in Tabelle"
   try
      SearchFor.SetText Such_Text
   catch
      print "Text in table not enabled"
   endcatch
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------
testcase tText_In_Frame
   call wSetFindAndReplaceToDefault(1)
   Such_Text = "Rahmen"                'Suchen  Text in Rahmen
   Meldungs_Text = "Suchen Text in Rahmen"   '
   SearchFor.SetText Such_Text
   ReplaceWith.SetText Meldungs_Text
   SearchNow.Click
   call Vergleichen_und_ausgeben
   Call hCloseDocument
endcase

'---------------------------------------------------------

testcase tSimilarity_Search
  dim Zaehler as integer
  dim Zaehler2 as integer
  dim Zeichen_Tauschen as integer
  dim Zeichen_Hinzufuegen as integer
  dim Zeichen_Entfernen as integer

   call wSetFindAndReplaceToDefault(1)
   Such_Text = "Ähnlichkeit"              'Ähnlichkeitssuche
   SearchFor.SetText Such_Text
   if SimilaritySearch.IsVisible = False then More.Click
   SimilaritySearch.check
   for Zaehler2 = 1 to 4                  'Es werden die Optionen
      for Zaehler = 1 to 3                'Tauschen, Hinzufuegen und Entfernen
         Zeichen_Tauschen = 0             '1 bis 3 mal angechewählt
         Zeichen_Hinzufuegen = 0
         Zeichen_Entfernen = 0
         if SimilaritySearch.IsVisible = False then More.Click
         SimilaritySearchFor.click
         kontext "Aehnlichkeitssuche"
         Kombinieren.check
         ZeichenTauschen.ToMin
         ZeichenHinzufuegen.ToMin
         ZeichenEntfernen.ToMin
         ZeichenTauschen.Less
         ZeichenHinzufuegen.Less
         ZeichenEntfernen.Less
         select case Zaehler2
            Case 1 : Zeichen_Tauschen = Zaehler
            Case 2 : Zeichen_Hinzufuegen = Zaehler
            Case 3 : Zeichen_Entfernen = Zaehler
            Case 4 : Zaehler = 3             'Die 3 Optionen werden gleichzeitig
                     Zeichen_Tauschen = Zaehler       'angewählt.
                     Zeichen_Hinzufuegen = Zaehler
                     Zeichen_Entfernen = Zaehler
         end select
         ZeichenTauschen.More (Zeichen_Tauschen)
         ZeichenHinzufuegen.More (Zeichen_Hinzufuegen)
         ZeichenEntfernen.More (Zeichen_Entfernen)
         Aehnlichkeitssuche.OK
         kontext "FindAndReplace"
         SearchAll.Click
         select case Zeichen_Tauschen
            Case 1 : Such_Text = "Ähnlechkiit"
                     Meldungs_Text = "Ähnlichkeitssuche Tauschen 1x"
            Case 2 : Such_Text = "ÄhnlechkiitÄhnilchkiet"
                     Meldungs_Text = "Ähnlichkeitssuche Tauschen 2x"
            Case 3 : Such_Text = "ÄhnlechkiitÄhnilchkiethänilchkiet"
                     Meldungs_Text = "Ähnlichkeitssuche Tauschen 3x"
         end select
         select case Zeichen_Hinzufuegen
            Case 1 : Such_Text = "Ähnnlichkeit"
                     Meldungs_Text = "Ähnlichkeitssuche Hinzufuegen 1x"
            Case 2 : Such_Text = "ÄhnnlichkeitÄhnnliichkeit"
                     Meldungs_Text = "Ähnlichkeitssuche Hinzufuegen 2x"
            Case 3 : Such_Text = "ÄhnnlichkeitÄhnnliichkeitÄhnliichhkeeit"
                     Meldungs_Text = "Ähnlichkeitssuche Hinzufuegen 3x"
         end select
         select case Zeichen_Entfernen
            Case 1 : Such_Text = "Ähnlichkei"
                     Meldungs_Text = "Ähnlichkeitssuche Entfernen 1x"
            Case 2 : Such_Text = "ÄhnlichkeiÄhnlichke"
                     Meldungs_Text = "Ähnlichkeitssuche Entfernen 2x"
            Case 3 : Such_Text = "ÄhnlichkeiÄhnlichkeÄhnlichk"
                     Meldungs_Text = "Ähnlichkeitssuche Entfernen 3x"
         end select
         if Zaehler2 = 4 then
            Such_Text = "ÄhnlechkiitÄhnilchkiethänilchkietÄhnnlichkeitÄhnnliichkeitÄhnliichhkeeitÄhnlichkeiÄhnlichkeÄhnlichkÄnhliikheeii"
            Meldungs_Text ="Ähnlichkeitssuche Hinzu+Entfern+Tausch, je3x"
         end if
         call Vergleichen_und_ausgeben
         kontext "DocumentWriter"
         DocumentWriter.Typekeys "<PAGEUP>",          'an den Anfang des Textes gehen
         DocumentWriter.Typekeys "<MOD1 HOME>"
         EditSearchAndReplace
         kontext "FindAndReplace"            'Suchen&Replace-Fenster öffnen
      next Zaehler
   next Zaehler2
   Call hCloseDocument
endcase

' ----------------------------------------------------------------------------------

function wCountNumberOfAttributes() as Integer
   Dim i as integer, AttributeCount as integer
   Attribute.Click
   Kontext "Attribute"
   wait 500
   ' Count how much Attributes are in the list
   For i = 1 to 200
    try
       Auswahl.Select i
       printlog Auswahl.GetSelText
       AttributeCount = AttributeCount + 1
    catch
      wCountNumberOfAttributes = AttributeCount
      i = 202
    endcatch
   next i
   Attribute.Close
end function

' ----------------------------------------------------------------------------------

function wSelectAttributeName(aNumber as integer, AsianSupport as boolean, SetState as integer) as string
 'This function checks for the Attribute name depending on the given number (aNumber).
 'SetState is given to check or uncheck the Attribute in list
 'Returns the Attribute name if found and successfully checked in list.
 'Default for this test is given from the german office-Version (easier for me:-))
 Dim i as integer, aSelectIt as String
 Kontext "FindAndReplace"
 Attributes.Click
 Kontext "Attribute"

 Select Case aNumber
  Case 1
   Select Case iSprache
    Case 49: aSelectIt = "Absatz trennen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 2
   Select Case iSprache
    Case 49: aSelectIt = "Absätze zusammenhalten"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 3
   Select Case iSprache
    Case 49: aSelectIt = "Abstand"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 4
   Select Case iSprache
    Case 49: aSelectIt = "Asiatische Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 5
   Select Case iSprache
    Case 49: aSelectIt = "Ausrichtung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 6
   Select Case iSprache
    Case 49: aSelectIt = "Auszeichnung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 7
   Select Case iSprache
    Case 49: aSelectIt = "Betonungszeichen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 8
   Select Case iSprache
    Case 49: aSelectIt = "Blinkend"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 9
   Select Case iSprache
    Case 49: aSelectIt = "Doppelzeilig"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 10
   Select Case iSprache
    Case 49: aSelectIt = "Durchgestrichen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 11
   Select Case iSprache
    Case 49: aSelectIt = "Einzug"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 12
   Select Case iSprache
    Case 49: aSelectIt = "Hängende Interpunktion"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 13
   Select Case iSprache
    Case 49: aSelectIt = "Hurenkinder"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 14
   Select Case iSprache
    Case 49: aSelectIt = "Kerning"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 15
   Select Case iSprache
    Case 49: aSelectIt = "Kontur"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 16
   Select Case iSprache
    Case 49: aSelectIt = "Position"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 17
   Select Case iSprache
    Case 49: aSelectIt = "Registerhaltigkeit"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 18
   Select Case iSprache
    Case 49: aSelectIt = "Relief"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 19
   Select Case iSprache
    Case 49: aSelectIt = "Rotation"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 20
   Select Case iSprache
    Case 49: aSelectIt = "Schattiert"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 21
   Select Case iSprache
    Case 49: aSelectIt = "Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 22
   Select Case iSprache
    Case 49: aSelectIt = "Schriftfarbe"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 23
   Select Case iSprache
    Case 49: aSelectIt = "Schriftgrad"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 24
   Select Case iSprache
    Case 49: aSelectIt = "Schriftgrad asiatische Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 25
   Select Case iSprache
    Case 49: aSelectIt = "Schriftstärke"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 26
   Select Case iSprache
    Case 49: aSelectIt = "Schriftstärke asiatische Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 27
   Select Case iSprache
    Case 49: aSelectIt = "Schriftstellung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 28
   Select Case iSprache
    Case 49: aSelectIt = "Schriftstellung asiatische Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 29
   Select Case iSprache
    Case 49: aSelectIt = "Schusterjungen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 30
   Select Case iSprache
    Case 49: aSelectIt = "Seitenvorlage"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 31
   Select Case iSprache
    Case 49: aSelectIt = "Silbentrennung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 32
   Select Case iSprache
    Case 49: aSelectIt = "Skalierung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 33
   Select Case iSprache
    Case 49: aSelectIt = "Sprache"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 34
   Select Case iSprache
    Case 49: aSelectIt = "Sprache asiatische Schrift"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 35
   Select Case iSprache
    Case 49: aSelectIt = "Tabulatoren"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 36
   Select Case iSprache
    Case 49: aSelectIt = "Text Abstand"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 37
   Select Case iSprache
    Case 49: aSelectIt = "Unterstrichen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 38
   Select Case iSprache
    Case 49: aSelectIt = "Verbotene Zeichen"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 39
   Select Case iSprache
    Case 49: aSelectIt = "Vertikale Textausrichtung"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 40
   Select Case iSprache
    Case 49: aSelectIt = "Wortweise"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 41
   Select Case iSprache
    Case 49: aSelectIt = "Zeichenhintergrund"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

  Case 42
   Select Case iSprache
    Case 49: aSelectIt = "Zeilenabstand"
    Case else: Warnlog "Language not supported. No test"
               exit function
   end select

 end select

 ' Searches for selected Attribute in Attributes list
  For i = 1 to 42
   try
    Auswahl.Select i
    if Ucase(Auswahl.GetSelText) = Ucase(aSelectIt) then
     Select Case SetState
      Case 1
        Auswahl.UnCheck
      Case 2
        Auswahl.Check
     end select
     wSelectAttributeName = aSelectIt
     i = 50
    end if
   catch
     i = 50
   endcatch
  next i
  'if Attributes not found
  if i = 42 then
   if AsianSupport = True then Warnlog "Unable to locate Attribute in list!"
   wSelectAttributeName = ""
  end if
  Attribute.Ok
end function


sub wCheckAttribute(aNumber as integer)
 Dim i as integer
 Kontext "FindAndReplace"
 SearchNow.Click
 if wCheckActiveMessageboxes = False then
  Warnlog "Search for Attributes has failed!"
  exit sub
 end if
 Select Case aNumber
  Case 1   ' "Absatz trennen"
    EditCopy
    if Left$(GetClipboardtext,15) <> "First Paragraph" then
     Warnlog "-  Wrong paragraph has been found!"
    end if
  Case 2    '"Absätze zusammenhalten"
    EditCopy
    if Left$(GetClipboardtext,25) <> "Keep with next paragraph1" then
     Warnlog "-  Wrong paragraph has been found!"
    end if
  Case 3    '"Abstand"
    EditCopy
    if Left$(GetClipBoardText,15) <> "Spacing between" then
     Warnlog "- Wrong paragraph has been found!"
    end if
  Case 4    '"Asiatische Schrift"
  Case 5    '"Ausrichtung"
     EditCopy
     if Left$(GetClipBoardtext,20) <> "Wow, Alignment right" then
      Warnlog "- Wrong paragraph has been found!"
     else
      printlog "-  'Alignment right' found!"
     end if
     For i = 1 to 2
      Kontext "FindAndReplace"
      SearchNow.Click
      if wCheckActiveMessageboxes = False then
       Warnlog "Search for Attributes has failed!"
       exit sub
      end if
      EditCopy
      Select Case i
       Case 1
         if Left$(GetClipBoardtext,23) <> "Wow, Alignment centered" then
          Warnlog "- Wrong paragraph has been found!"
          exit sub
         else
          printlog "-  'Alignment centered' found!"
         end if
       Case 2
         if Left$(GetClipBoardtext,24) <> "Wow, Alignment justified" then
          Warnlog "- Wrong paragraph has been found!"
         exit sub
         else
          printlog "-  'Alignment justified' found!"
         end if
      end select
     next i
  Case 6    '"Auszeichnung"
     EditCopy
     If Ucase(GetClipBoardtext) <> "CAPITALS" then
      Warnlog "Wrong effect has been found"
      exit sub
     end if
     For i = 1 to 3
      Kontext "FindAndReplace"
      SearchNow.Click
      if wCheckActiveMessageboxes = False then
       Warnlog "Search for effects has failed!"
       exit sub
      end if
      EditCopy
      Select Case i
       Case 1
        If Ucase(GetClipBoardtext) <> "LOWERCASE" then
         Warnlog "Wrong effect has been found"
         exit sub
        end if
       Case 2
        If Ucase(GetClipBoardtext) <> "TITLE" then
         Warnlog "Wrong effect has been found"
         exit sub
        end if
       Case 3
        If Ucase(GetClipBoardtext) <> "SMALL CAPITALS" then
         Warnlog "Wrong effect has been found"
         exit sub
        end if
      end select
     next i
  Case 7    '"Betonungszeichen"
  Case 8    '"Blinkend"
    EditCopy
    if Left$(GetClipBoardText,13) <> "Blinking text" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 9     '"Doppelzeilig"
  Case 10    '"Durchgestrichen"
    EditCopy
    if Left$(GetClipBoardText,14) <> "Strike through" then
     Warnlog "- Wrong Attribute has been found!"
    end if
    For i = 1 to 4
     Kontext "FindAndReplace"
     SearchNow.Click
     EditCopy
     if Left$(GetClipBoardText,14) <> "Strike through" then
      Warnlog "- Wrong Attribute has been found!"
     end if
    next i
  Case 11    '"Einzug"
    EditCopy
    if Left$(GetClipBoardText,6) <> "Indent" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 12    '"Hängende Interpunktion"
  Case 13    '"Hurenkinder"
    EditCopy
    if Left$(GetClipBoardText, 9) <> "Hurenkind" then
     Warnlog "- Wrong Attribute has been found!"
    end if
    Kontext "FindAndReplace"
    SearchNow.Click
    EditCopy
    if Left$(GetClipBoardText, 8) <> "tstststs" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 14    '"Kerning"
    EditCopy
    if Left$(GetClipBoardText, 8) <> "Kerning1" then
     Warnlog "- Wrong Attribute has been found!"
    end if
    Kontext "FindAndReplace"
    SearchNow.Click
    EditCopy
    if Left$(GetClipBoardText, 8) <> "Kerning2" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 15    '"Kontur"
    EditCopy
    if Left$(GetClipBoardText, 6) <> "Kontur" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 16    '"Position"
    EditCopy
    if Left$(GetClipBoardText, 4) <> "Hoch" then
     Warnlog "- Wrong Attribute has been found!"
    end if
    Kontext "FindAndReplace"
    SearchNow.Click
    EditCopy
    if Left$(GetClipBoardText, 4) <> "Tief" then
     Warnlog "- Wrong Attribute has been found!"
    end if
  Case 17    '"Registerhaltigkeit"

  Case 18    '"Relief"
  Case 19    '"Rotation"
  Case 20    '"Schattiert"
  Case 21    '"Schrift"
  Case 22    '"Schriftfarbe"
  Case 23    '"Schriftgrad"
  Case 24    '"Schriftgrad asiatische Schrift"
  Case 25    '"Schriftstärke"
  Case 26    '"Schriftstärke asiatische Schrift"
  Case 27    '"Schriftstellung"
  Case 28    '"Schriftstellung asiatische Schrift"
  Case 29    '"Schusterjungen"
  Case 30    '"Seitenvorlage"
  Case 31    '"Silbentrennung"
  Case 32    '"Skalierung"
  Case 33    '"Sprache"
  Case 34    '"Sprache asiatische Schrift"
  Case 35    '"Tabulatoren"
  Case 36    '"Text Abstand"
  Case 37    '"Unterstrichen"
  Case 38    '"Verbotene Zeichen"
  Case 39    '"Vertikale Textausrichtung"
  Case 40    '"Wortweise"
  Case 41    '"Zeichenhintergrund"
  Case 42    '"Zeilenabstand"
 end select
  Kontext "FindAndReplace"
end sub

function wCheckActiveMessageboxes() as boolean
   wCheckActiveMessageboxes=True
   Kontext "Active"
   if Active.Exists then
    if Active.GetRT = 304 then
     try  ' Question if StarOffice should search at start of document
      Active.yes
      ' Exit when search has again failed
      if Active.Exists then
       if Active.GetRT = 304 then
        wCheckActiveMessageboxes = False
        Warnlog Active.Gettext
        Active.Ok
       end if
      end if
     catch
      wCheckActiveMessageboxes = False
      Warnlog Active.Gettext
      Active.Ok
     endcatch
    end if
   end if
end function

'---------------------------------------------------------
'            Unterprogramme
'---------------------------------------------------------
'---------------------------------------------------------
sub wSetFindAndReplaceToDefault(WhichDocument as integer)
    '/// <font color=#ff0000> TODO: translate this test ///'
    '/// file "input\\writer\\such_u_e.sxw" will be used <FONT> ///
    Dim i as integer
    Select Case WhichDocument
        Case 0
            Call hNewDocument  ' empty Document
        Case 1
            Call hFileOpen ( gTesttoolPath +"writer\optional\input\search\such_u_e.sxw")
            Call sMakeReadOnlyDocumentEditable
        case 2
            Call hFileOpen ( gTesttoolPath +"writer\optional\input\search\attrib.sxw")
            Call sMakeReadOnlyDocumentEditable
    end select
    kontext "FindAndReplace"
    Sleep 2
    if FindAndReplace.Exists then          'Evtl. offenes Fenster schließen
        FindAndReplace.Close
    end if
    kontext "DocumentWriter"
    DocumentWriter.Typekeys "<PAGEUP>",          'an den Anfang des Textes gehen
    DocumentWriter.Typekeys "<MOD1 HOME>"
    EditSearchAndReplace
    kontext "FindAndReplace"            'Suchen&Replace-Fenster öffnen
    if Not SearchForStyles.IsVisible then More.Click
    if SearchForStyles.IsEnabled then SearchForStyles.Uncheck
    try
        SearchFor.SetText ""
    catch
        warnlog "in 'grundzustand' writing a text to search for is not possible :-("
    endcatch
    if SimilaritySearch.IsEnabled then SimilaritySearch.Uncheck
    ' Column 1
    WholeWordsOnly.Uncheck
    Backwards.Uncheck
    RegularExpressions.Uncheck
    ' Column 2
    MatchCase.Uncheck
    if CurrentSelectionOnly.IsEnabled then CurrentSelectionOnly.Uncheck
    'Column 3
    Attributes.Click
    Kontext "Attribute"
    ' List has 32 Attributes
    For i = 1 to 32
        Auswahl.Select i
        Auswahl.Uncheck
    Next i
    Attribute.OK
    kontext "FindAndReplace"
    if NoFormat.IsEnabled then NoFormat.Click
    Kontext "FindAndReplace"
end sub

'---------------------------------------------------------
sub Vergleichen_und_ausgeben
                              'ht Such_Text mit dem,
    dim i as integer           
    dim Boxen_RT as integer    
    
    kontext
    for i = 1 to 2                      'Close all Message-, Info-, and Query-Boxes
      if active.exists (1) then           
         Boxen_RT = Active.GetRT
         select case Boxen_RT
            Case 304, 305 : Active.OK
            Case 308 : Active.Yes
         end select
    end if
    next i
    kontext "FindAndReplace"
    Sleep 2
    try
        FindAndReplace.Close
    catch
        Warnlog "Dialog is not present. Should be open!"
    endcatch
    
    wait 500
    Kontext "DocumentWriter"
    try
        BearbeitenKopieren               
    catch                     
        DocumentWriter.Typekeys "<PAGEUP>"
        DocumentWriter.Typekeys "<MOD1 END>"
        DocumentWriter.Typekeys "<SHIFT LEFT>", 15
        EditCopy
    endcatch
    wait 500
    dummy_Text = GetClipboardText
    if dummy_Text = Such_Text then
        Printlog "OK   ",Meldungs_Text
    else
        warnlog "'",Such_Text,"' was not found, but '", Dummy_Text, "' " '"With '" + Meldungs_Text+ "'
    end if
    Sleep 2
end sub

'---------------------------------------------------------  'abhängig von der Sprache wird die
sub Meldungs_Test
                     'Meldung "...bis zum Dokumentende
    dim Text_In_Meldung as string, sProduct as string

    if gOOO = true then
        sProduct = "OpenOffice.org"
    else
        sProduct = "Oracle Open Office"
    end if
    
    select case iSprache
        Case 01 : Text_In_Meldung = sProduct & " Writer has searched to the end of the document. Do you want to continue at the beginning?"
        Case 07 : Text_In_Meldung = sProduct & " Writer осуществил поиск к концу документа. Продолжить поиск с начала документа?"
        Case 03 : Text_In_Meldung = "O " & sProduct & " Writer procurou até ao fim do documento. Deseja continuar a procura no início do documento?"
        Case 31 : Text_In_Meldung = sProduct & " Writer heeft tot aan het einde van het document gezocht. Wilt u doorgaan met zoeken vanaf het begin?"
        Case 33 : Text_In_Meldung = sProduct & " Writer a atteint la fin du document. Souhaitez-vous reprendre la recherche au début du document ?"
        Case 34 : Text_In_Meldung = sProduct & " Writer ha buscado hasta el final del documento. ¿Desea continuar la búsqueda desde el principio?"
        Case 39 : Text_In_Meldung = sProduct & " Writer ha cercato fino alla fine del documento. Volete continuare dall'inizio del documento?"
        Case 46 : Text_In_Meldung = sProduct & " Writer har sökt till slutet av dokument. Vill du fortsätta sökningen i början av dokumentet?"
        Case 49 : Text_In_Meldung = sProduct & " Writer hat bis zum Ende des Dokumentes gesucht. Möchten Sie die Suche am Dokumentanfang fortsetzen?"
        Case 50 : Text_In_Meldung = sProduct & " Writer je preiskal do konca dokumenta. Ali želite nadaljevati na začetku?"
		Case 55 : Text_In_Meldung = sProduct & " Writer pesquisou até o final do documento. Deseja continuar do início?"
        Case 81 : Text_In_Meldung = sProduct & " Writer は、文書末まで検索しました。文書の始めに戻って続行しますか。"
        Case 82 : Text_In_Meldung = sProduct & " Writer가 문서의 끝까지 검색했습니다. 문서의 시작부분에서 검색을 계속하겠습니까?"
        Case 88 : Text_In_Meldung = sProduct & " Writer 已經搜尋至文件的結束位置。要從文件的起始位置繼續搜尋?"
    end select

    if Dummy_text = Text_In_Meldung then
        printlog "OK   Correct Message at end of document"
    else
        if Text_In_Meldung > "" then
            Warnlog "   No correct message at end of document"
            printlog Dummy_text
        else
            QAErrorlog "Please adapt test for this language!"
            printlog Dummy_text
        end if
    end if
end sub


function ToggleAttribute(sNumber as integer, sCheck as boolean)
    Kontext "FindAndReplace"
    Attributes.Click
    Kontext "Attribute"
    Auswahl.Select sNumber             'Check Attributes underlined
    wait 500
    if sCheck = "True" then
        Auswahl.Check
    else
        Auswahl.Uncheck
    end if
    wait 500
    Attribute.OK
    Kontext "FindAndReplace"
end function


function wGetHeadingName() as string
   ' This function gets the name 'Heading' from Stylist
   ' Needed this function for additional languages !
   FormatStylist
   Kontext "Stylist"
   if Stylist.NotExists then FormatStylist
   Absatzvorlagen.Click

   ' "Heading" should always be the 9th entry
   Gruppenliste.Select 5 ' Automatic
   wait 500
   Vorlagenliste.Select 9 ' Heading
   wGetHeadingName = Vorlagenliste.GetSeltext
   Call SetClipboard (wGetHeadingName)
   printlog "- Name of 'heading' for this language has been pasted to clipboard!"
   Stylist.Close
end function

'---------------------------------------------------------
sub   LoadIncludeFiles
   use "inc\master.inc"
   use "inc\gvariabl.inc"
   gApplication = "WRITER"
   Call GetUseFiles
end sub