This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Module1.xba is in libreoffice-dmaths 3.4+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">&apos;************************************************
&apos;Copyright (C) 2008 Didier Dorange-Pattoret
&apos;38, chemin de l&apos;Abbaye  
&apos;74940 Annecy le Vieux
&apos;France
&apos;ddorange@dmaths.com
&apos;
&apos;
&apos;This library is free software; you can redistribute it and/or
&apos;modify it under the terms of the GNU General Public Licence (GPL)
&apos;as published by the Free Software Foundation; either
&apos;version 2.1 of the License, or (at your option) any later version.

&apos;This library is distributed in the hope that it will be useful,
&apos;but WITHOUT ANY WARRANTY; without even the implied warranty of
&apos;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
&apos;General Public License for more details.

&apos;You should have received a copy of the GNU General Public Licence (GPL)
&apos;along with this library; if not, write to the Free Software
&apos;Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
&apos;************************************************

REM  *****  BASIC  *****
&apos;Option Explicit
Global bVerifSauvegarde as Boolean
Global bExecCoordColonne as Boolean  rem Coordonnées en colonne si True
Public sEq as String
Public Erreur,bBoite as Boolean &apos;bBoite=True si la boite existe
&apos;Global bTaquetPose as Boolean &apos; prend la valeur true si un taquet est pose
&apos;Global oCursorTaquet as Object &apos;le curseur au taquet pose
Public iAverto as Integer &apos;iTaille contient la taille de la formule
Public Brac1,Brac2,Brac3,Brac4,Brac5,Brac6 as String &apos;Brac1 à gauche, 2 à droite, 3 le 4, 4 pour \, 5 pour left, 6 pour right.
rem iAverto contient le numéro de ligne du message
Private sNomPolice as String &apos;contient le nom de la police du curseur visible.
Public aSel as New com.sun.star.awt.Selection &apos;GF pour Metentre Form et Form1
Public aSel0 as New com.sun.star.awt.Selection &apos;GF pour Metentre Form
Public aSel1 as New com.sun.star.awt.Selection &apos;GF pour Metentre Form1
Public CursorPos as Integer &apos;for TextField1 in FormuleGraphique GF may 2007

REM Insert HelpText of any CommandButton, allow space before and after, GF Sept.2008 
REM Same method possible with property Tag (in german: Zusatzinformation): CBevent.Tag
Sub MetHelptext(event)
&apos;Xray event
	CBevent = event.source.Peer
 	MetEntre(&quot; &quot; + CBevent.AccessibleContext.ToolTipText + &quot; &quot;,&quot;&quot;)
End Sub

REM the following is needed for visible accolades in many dialogues (formule, racine...)
Sub MetentreAccolades2	&apos;GF
MetEntre(&quot;\{&quot;,&quot;\}&quot;) 
End Sub	

Sub Metgeslant	&apos;GF
MetEntre(&quot;`geslant`&quot;,&quot;&quot;)
End Sub

Sub Metleslant	&apos;GF
MetEntre(&quot;`leslant`&quot;,&quot;&quot;)
End Sub

Sub MetentreExp
MetEntre(&quot;^{&quot;,&quot;}&quot;) 
End Sub	

Sub MetentreIndex
MetEntre(&quot;_{&quot;,&quot;}&quot;) 
End Sub	

Sub LoadParCro
Call VerifOperationnel
oBoite=LoadDialog(&quot;Dmaths&quot;,&quot;ParCro&quot; )
oBoite.Execute()
End Sub

Sub MetLPi
MetEntre(&quot; pi &quot;,&quot;&quot;)
End Sub

Sub MetLcdot
MetEntre(&quot;`cdot`&quot;,&quot;&quot;)
End Sub

Sub MetLtimes
MetEntre(&quot;`times`&quot;,&quot;&quot;)
End Sub

Sub InsertBlanc
oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
oDocument= oDesktop.getCurrentComponent()
oText = oDocument.Text
oCursor = oDocument.currentcontroller.getViewCursor()
oCursor.getText().insertString(oCursor.getStart(),&quot; &quot;,false)
End Sub

Function recul(N as Integer)
oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
oDocument= oDesktop.getCurrentComponent()
oText = oDocument.Text
oCursor = oDocument.currentcontroller.getViewCursor()
oCursor.Goleft(N,False)
End Function

Sub recul1
recul(1)
End Sub

Sub recul2
recul(2)
End Sub

Sub recul5
recul(5)
End Sub

Sub recul6
recul(6)
End Sub

Sub recul8
recul(8)
End Sub

Sub recul10
recul(10)
End Sub

Sub recul11
recul(11)
End Sub

Sub recul12
recul(12)
End Sub

Sub recul3
recul(3)
End Sub

Sub recul14
recul(14)
End Sub

Sub recul21
recul(21)
End Sub

Sub recul22
recul(22)
End Sub

Sub recul26
recul(26)
End Sub

Sub recul32
recul(32)
End Sub

rem Traite norme et valeur absolue
Function TraitNoVa(sMot,Indice,LongMot,bNorme)
If bModeFactoriel = False Then
	If Mid(sMot,Indice,1)=&quot;!&quot; and Mid(sMot,Indice+1,1)&lt;&gt;&quot;!&quot; and bNorme=False Then  
	sMot=Mid(sMot,1,Indice-1)+&quot; left lline &quot;+Mid(sMot,Indice+1,LongMot-Indice)
	Indice=Indice+11
	LongMot=LongMot+11
	bNorme=True
	Endif
	If Mid(sMot,Indice,1)=&quot;!&quot; and Mid(sMot,Indice+1,1)&lt;&gt;&quot;!&quot; and bNorme=True Then  
	sMot=Mid(sMot,1,Indice-1)+&quot; right lline &quot;+Mid(sMot,Indice+1,LongMot-Indice)
	Indice=Indice+12
	LongMot=LongMot+12
	bNorme=False
	Endif
	If Mid(sMot,Indice,2)=&quot;!!&quot; and bNorme=False Then  
	sMot=Mid(sMot,1,Indice-1)+&quot; left ldline &quot;+Mid(sMot,Indice+2,LongMot-Indice-1)
	Indice=Indice+12
	LongMot=LongMot+12
	bNorme=True
	Endif
	If Mid(sMot,Indice,2)=&quot;!!&quot; and bNorme=True Then  
	sMot=Mid(sMot,1,Indice-1)+&quot; right ldline &quot;+Mid(sMot,Indice+2,LongMot-Indice-1)
	Indice=Indice+13
	LongMot=LongMot+13
	bNorme=False
	Endif
Else
	If Mid(sMot,Indice,1)=&quot;!&quot; Then
	sMot=Mid(sMot,1,Indice-1)+&quot; nitalic &quot;+Mid(sMot,Indice,LongMot-Indice+1)
	Indice=Indice+9
	LongMot=LongMot+9
	Endif
Endif
End Function

Function StopCar(oCurs as Object, iCar as Long, bGauche as Boolean) as Boolean
Rem ecrite le 18 septembre 2010, sert a arreter le curseur
	Dim bResul as Boolean, iVar as Integer
	bResul = False
	
	If ((Not bGauche and oCurs.isEndOfParagraph) or (bGauche and oCurs.isStartOfParagraph)) Then bResul = True
	
	If (iCar = 9 or iCar = 10 or iCar = 13 or iCar = 32 or iCar = -2) Then bResul = True
	
	If bGauche and iCar=45 Then
		oCurs.Goleft(1,True)
		If oCurs.string = &quot;-&quot; Then bResul = True
		oCurs.Goleft(0,False)
		oCurs.Goright(1,False)
	Endif


	If bGauche and iCar=95 Then
		oCurs.Goleft(1,True)
		If oCurs.string = &quot;_&quot; Then bResul = True
		oCurs.Goleft(0,False)
		oCurs.Goright(1,False)
	Endif

	If bGauche and iCar=46 then
		oCurs.Goleft(3,True)
&apos;		Print oCurs.string,Len(oCurs.string),&quot;ici&quot;
		If Mid(oCurs.String,3,1)=&quot;.&quot; and Mid(oCurs.String,2,1)=&quot;.&quot; and Mid(oCurs.String,1,1)&lt;&gt;&quot;)&quot; and Mid(oCurs.String,1,1)&lt;&gt;&quot;]&quot; _
			and Mid(oCurs.String,1,1)&lt;&gt;&quot;+&quot; and Mid(oCurs.String,1,1)&lt;&gt;&quot;*&quot; and Mid(oCurs.String,1,1)&lt;&gt;&quot;×&quot; Then
			bResul = True
&apos;			Print &quot;arret&quot;			
		End if
		If  Mid(oCurs.String,1,1)=&quot;&quot; or Mid(oCurs.String,2,1)=&quot;&quot; Then
			bResul = True			
		End if
		iVar = Len(oCurs.string)
&apos;		Print &quot;iVar&quot;,iVar
		oCurs.Goleft(0,False)
		oCurs.Goright(iVar,False)
	Endif
	StopCar = bResul
End Function


Function Selec
Dim LongsEq as Integer,I as Integer,N as Integer,NbreBlanc as Integer
Dim Test as String
Dim oDesktop as Object, oDocument as Object,oText as Object, oVCursor as Object, oTextActif as Object
Dim oCursor as Object, oCursor2 as Object, oCursorBarre as Object
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	oDocument= oDesktop.getCurrentComponent()
	oText = oDocument.Text
	oVCursor = oDocument.currentcontroller.getViewCursor()
	oTextActif = oVCursor.Text &apos; la zone de texte actif page ou cellule ....
	oCursor = oTextActif.createTextCursorByRange(oVCursor)
	oCursor2 = oTextActif.createTextCursorByRange(oCursor)
	
	Erreur=False
	If oVCursor.IsCollapsed Then
		If oCursor.isEndOfParagraph and oCursor.isStartOfParagraph Then Goto Probleme1
		Dim Car as Long	

		Car = -1
		Do until StopCar(oCursor,Car,False)
			oCursor.Goright(1,True)
			If Len(oCursor.String())&lt;&gt;0 Then Car = Asc(oCursor.String()) Else  Car = -2			
			oCursor.Goright(0,False)			
		Loop
		If (Not oCursor.isEndOfParagraph and Car&lt;&gt;-1)  Then oCursor.Goleft(1,False)


		Car = -1
		Do Until StopCar(oCursor2,Car,True)
			oCursor2.Goleft(1,True)
			If Len(oCursor2.String())&lt;&gt;0 Then Car = Asc(oCursor2.String()) Else Car = -2
			oCursor2.Goleft(0,False)
		Loop
			
		If (Not oCursor2.isStartOfParagraph and Car&lt;&gt;-1) Then oCursor2.Goright(1,False)
		If  Car = -2  Then oCursor2.Goright(1,False)
		If Car = 9 and oCursor2.isStartOfParagraph Then oCursor2.Goright(1,False) 
	
	
		oCursor.GotoRange(oCursor2,True)

		sEq=oCursor.GetString()
			
		If Len(sEq) = 0 Then Goto Probleme1
		
		oVCursor.gotoRange(oCursor,True)
&apos;		Print sEq

	Else
		sEq=oCursor.getString()
	Endif
	
	rem dans cette partie on traite les caractères surlignés ou double surlignés Remarque uniquement pour OOo &gt;= 3.1
	If OOoNumVersion &gt;=310 Then 
		oCursorBarre = oTextActif.createTextCursorByRange(oCursor)
		oCursorBarre.CollapseToStart
		Dim bOuv, bdOuv as Boolean, iCompteur, J as Integer
		bOuv = False : bdOuv = False : iCompteur = Len(SEq) : J = 0
		For I=1 To iCompteur
			J = J + 1
			oCursorBarre.goRight(1,True)
			If (oCursorBarre.CharOverline = com.sun.star.awt.FontUnderline.SINGLE and bOuv = False) Then
				bOuv = Not bOuv 
				sEq = Mid(sEq,1,J-1) &amp; &quot; overline{&quot; &amp; Mid(sEq,J,Len(sEq)-J+1)
				J = J + 9
			Endif
			If (oCursorBarre.CharOverline &lt;&gt; com.sun.star.awt.FontUnderline.SINGLE and bOuv = True) Then
				bOuv = Not bOuv
				sEq = Mid(sEq,1,J) &amp; &quot;}&quot; &amp; Mid(sEq,J+1,Len(sEq)-J)
				J = J + 2
			Endif		
			If (oCursorBarre.CharOverline = com.sun.star.awt.FontUnderline.DOUBLE and bdOuv = False) Then
				bdOuv = Not bdOuv 
				sEq = Mid(sEq,1,J-1) &amp; &quot; overline{overline{&quot; &amp; Mid(sEq,J,Len(sEq)-J+1)
				J = J + 18
			Endif
			If (oCursorBarre.CharOverline &lt;&gt; com.sun.star.awt.FontUnderline.DOUBLE and bdOuv = True) Then			
				bdOuv = Not bdOuv
				sEq = Mid(sEq,1,J) &amp; &quot;}}&quot; &amp; Mid(sEq,J+1,Len(sEq)-J)
				J = J + 3
			Endif	
			If (I = iCompteur and bOuv ) Then sEq = sEq &amp; &quot;}&quot;
			If (I = iCompteur and bdOuv) Then sEq = sEq &amp; &quot;}}&quot; rem Ferme l&apos;accolade au dernier caractère 
			oCursorBarre.goRight(0,False)
		Next I
 	Endif
 
 	rem fin du traitement des caractères surlignés 
	If sEq= &quot; &quot; Then Goto Probleme1

	rem vérifie le parenthésage
	If bModeFactoriel = FALSE Then &apos; à vérifier en mode non factoriel seulement
		N=0
		For I=1 To Len(sEq)
			If Mid(sEq,I,1)=&quot;!&quot; Then N=N+1
		Next I
		If Int(N/2)&lt;&gt;Int(N)/2 Then
			If msgbox(sVocab(iLang,3),256+48+1,&quot;Dmaths&quot;)=2 Then Goto Probleme2 Else Goto FinVerifPar
		Endif
	Endif
	N=0
	For I=1 To Len(sEq)
		If Mid(sEq,I,1)=&quot;$&quot; Then N=N+1
	Next I
	If Int(N/2)&lt;&gt;Int(N)/2 Then
		If msgbox(sVocab(iLang,3),256+48+1,&quot;Dmaths&quot;)=2 Then Goto Probleme2 Else Goto FinVerifPar
	Endif
	N=0
	For I=1 To Len(sEq)
		If Mid(sEq,I,1)=&quot;(&quot; or  Mid(sEq,I,1)=&quot;)&quot; Then N=N+1
	Next I
	If Int(N/2)&lt;&gt;Int(N)/2 Then
		If msgbox(sVocab(iLang,3),256+48+1,&quot;Dmaths&quot;)=2 Then Goto Probleme2 Else Goto FinVerifPar
	Endif
	N=0
	For I=1 To Len(sEq)
		If Mid(sEq,I,1)=&quot;[&quot; or  Mid(sEq,I,1)=&quot;]&quot; Then N=N+1
	Next I
	If Int(N/2)&lt;&gt;Int(N)/2 Then
		If msgbox(sVocab(iLang,3),256+48+1,&quot;Dmaths&quot;)=2 Then Goto Probleme2 Else Goto FinVerifPar
	Endif
	N=0
	For I=1 To Len(sEq)
		If Mid(sEq,I,1)=&quot;&amp;&quot; Then N=N+1
	Next I
	If Int(N/2)&lt;&gt;Int(N)/2 Then
		If msgbox(sVocab(iLang,3),256+48+1,&quot;Dmaths&quot;)=2 Then Goto Probleme2 Else Goto FinVerifPar
	Endif
	rem fin vérification du parenthésage
	FinVerifPar:

	rem traitement du §
	LongsEq=Len(sEq)
	For I=1 to LongsEq
		If Mid(sEq,I,1)=&quot;§&quot; Then
			sEq=Mid(sEq,1,I-1)+&quot;&amp;§&amp;&quot;+Mid(sEq,I+1,LongsEq-I)
			LongsEq=LongsEq+2
			I=I+2
		Endif
	Next I

	Goto Fin
	rem Edition du message d&apos;erreur
	Probleme1: Avertir(iAverto)
	oVCursor.CollapseToEnd()
	Goto Finp
	Probleme2: oVCursor.CollapseToEnd()
	Finp: 
	Erreur=True
	Fin:
	If Erreur=False Then oCursor.setString(&quot;&quot;)
	Selec=sEq
End Function
rem fin de Selec


Function CoefficientsVecteurs(Mot$,iPos as Integer) as String
&apos; Jerome Ortais
&apos; Selectionne et traite avec Dixio une zone dans un calcul de vecteurs. Vérifie que les caractères binaires
&apos;(*, =, /) en debut ou fin de Mot ne sont pas traites par Dixio. Renvoie la position du dernier caractere traite.
Dim sMot$, iCurseur as Integer
Dim bEstVecteurNul as Boolean, iLong as integer
Const cOperateurs=&quot;+-.=≃≈~≠ &quot;, cNombres=&quot;0123456789,+-*/=≃≈~≠&lt;≤≥&gt;:;){}[]&quot;, cInterdits=&quot;*/=≃≈~≠&lt;≤≥&gt;&quot;
    sMot=Mot
    iLong=Len(sMot)
    iCurseur=1
    bEstVecteurNul=False
    Do While InStr(cNombres,Mid(sMot,iPos+iCurseur,1))&gt;0 And iPos+iCurseur&lt;=iLong And Not bEstVecteurNul
        If Mid(sMot,iCurseur+iPos,1)=&quot;0&quot; Then
        &apos;Verifie si un 0 est un vecteur nul ou un chiffre.
            If iPos+iCurseur&lt;iLong Then
                bEstVecteurNul=(InStr(cOperateurs,Mid(sMot,iPos+iCurseur-1,1))&gt;0) And (InStr(cOperateurs,Mid(sMot,iPos+iCurseur+1,1))&gt;0)
            Else
                bEstVecteurNul=(InStr(cOperateurs,Mid(sMot,iPos+iCurseur-1,1))&gt;0)
            EndIf
        EndIf
        iCurseur=iCurseur+1
    Loop
    If bEstVecteurNul Then iCurseur=iCurseur-2 Else iCurseur=iCurseur-1
    Car=Mid(sMot,iPos+iCurseur,1)
    Select Case iCurseur
    Case 0
        If InStr(cInterdits,Mid(sMot,iPos,1))&gt;0 Then
            CoefficientsVecteurs=Dixio2(Mid(sMot,iPos,1))
        Else
            CoefficientsVecteurs=Dixio(Mid(sMot,iPos,1))
        EndIf
    Case 1
        If InStr(cInterdits,Mid(sMot,iPos,1))&gt;0 Then
            If InStr(cInterdits,Mid(sMot,iPos+1,1))&gt;0 Then
                &apos; Gere le cas de &gt;=, &lt;=, &lt;&gt;
                CoefficientsVecteurs=Dixio(Mid(sMot,iPos,2))
            Else
                CoefficientsVecteurs=Dixio2(Mid(sMot,iPos,1))_
                    +Dixio(Mid(sMot,iPos+1,1))
            EndIf
        Else
            If InStr(cInterdits,Mid(sMot,iPos+1,1))&gt;0 Then
                CoefficientsVecteurs=Dixio(Mid(sMot,iPos,1))_
                    +Dixio2(Mid(sMot,iPos+1,1))
            Else
                CoefficientsVecteurs=Dixio(Mid(sMot,iPos,2))
            EndIf
        EndIf
    Case Else
        If InStr(cInterdits,Mid(sMot,iPos,1))&gt;0 Then
            If InStr(cInterdits,Mid(sMot,iPos+iCurseur,1))&gt;0 Then
                CoefficientsVecteurs=Dixio2(Mid(sMot,iPos,1))_
                    +Dixio(Mid(sMot,iPos+1,iCurseur-1))_
                    +Dixio2(Mid(sMot,iPos+iCurseur,1))
            Else
                CoefficientsVecteurs=Dixio2(Mid(sMot,iPos,1))_
                    +Dixio(Mid(sMot,iPos+1,iCurseur))
            EndIf
        Else
            If InStr(cInterdits,Mid(sMot,iPos+iCurseur,1))&gt;0 Then
                CoefficientsVecteurs=Dixio(Mid(sMot,iPos,iCurseur))_
                    +Dixio2(Mid(sMot,iPos+iCurseur,1))
            Else
                CoefficientsVecteurs=Dixio(Mid(sMot,iPos,iCurseur+1))
            EndIf
        EndIf
    End Select
    iPos=iPos+iCurseur
End Function

Function TraiteGeometrie(Chaine$,Param$) as String
&apos; Jerome Ortais
&apos; Gere l&apos;affichage des angles, vecteurs et derives pointees.
Const cOperateurs = &quot;+-. =≃≈~≠&quot;

Dim sChaine$, sParam$, sCar$, cScalaires$
Dim iLongueur as Integer, iPos as Integer, iPos1 as Integer, iPos2 as Integer, iFin as Integer
Dim bEstVecteurNul as Boolean

	Rem permet de considerer si option choisie les lettres comme scalaires
	cScalaires = &quot;0123456789,.+-×*:/=≠≃≈&lt;≤≥&gt;;#\})]^∧° &apos;&quot;
	If bLettresAreScalaires = TRUE Then cScalaires = cScalaires &amp; sLettresScalaires &amp;&quot;&quot;
	rem ---------------------------------------------------------------------------
	sChaine=Chaine
	sParam=Param
	If sChaine=&quot;&quot; Then Goto SortieFonction
	iLongueur=Len(sChaine)
	sCar=Mid(sChaine,1,1)
	Select Case sCar
	Case &quot;$&quot;
		&apos; Ce qui est entre $...$ doit etre traite comme une formule.
		iFin=InStr(2,sChaine,&quot;$&quot;)
		sChaine=Dmaths.Module2.Dixio(Mid(sChaine,2,iFin-2))_
			+TraiteGeometrie(Mid(sChaine,iFin+1),sParam)
	Case &quot;(&quot;    
		If InStr(sParam,&quot;widehat&quot;)&gt;0 Then
			&apos; Les valeurs entre parentheses sont des vecteurs.
			&apos; On appelle TraiteGeometrie sur le contenu des parentheses.
			iFin=Dmaths.Module2.TrouvePaire(sChaine,1,&quot;(&quot;)
			sChaine=sParam+&quot;{(&quot;_
				+TraiteGeometrie(Mid(sChaine,2,iFin-2),&quot; widevec  &quot;)+&quot;)}&quot;_
				+TraiteGeometrie(Mid(sChaine,iFin+1),sParam)
		Else
			iPos=1
			sChaine=CoefficientsVecteurs(sChaine,iPos)_
				+TraiteGeometrie(Mid(sChaine,iPos+1),sParam)
		EndIf
	Case &quot;.&quot;
		&apos; Gestion des ..., produits scalaires et . A ameliorer.
		If iLongueur&gt;=3 Then
			If Mid(sChaine,1,3)=&quot;...&quot; Then
				sChaine=&quot; dotslow &quot;_
					+TraiteGeometrie(Mid(sChaine,4),sParam)
			Else
				sChaine=&quot; cdot &quot;+TraiteGeometrie(Mid(sChaine,2),sParam)
			EndIf
		Else sChaine=&quot; cdot &quot;+TraiteGeometrie(Mid(sChaine,2),sParam)
		EndIf
	Case &quot;0&quot;
		&apos; Gestion du vecteur nul (un peu basique)
		bEstVecteurNul=False
		If InStr(sParam,&quot;widevec&quot;)&gt;0 Then
			If iLongueur=1 Then
				bEstVecteurNul=True
			Else
				bEstVecteurNul=(InStr(cOperateurs,Mid(sChaine,2,1))&gt;0)
			EndIf
		EndIf
		If bEstVecteurNul Then
			sChaine=sParam+&quot;{0}&quot;+TraiteGeometrie(Mid(sChaine,2),sParam)
		Else
			iPos=1
			sChaine=CoefficientsVecteurs(sChaine,iPos)_
				+TraiteGeometrie(Mid(sChaine,iPos+1),sParam)
		EndIf
	Case &quot;%&quot;
		&apos; Gestion du caractere %. On le supprime pour l&apos;ajouter plus tard.
		sChaine=TraiteGeometrie(Mid(sChaine,2),sParam)
	Case Else
		&apos; Gestion des normes de vecteurs
		If iLongueur&gt;1 Then
			If Mid(sChaine,1,2)=&quot;!!&quot; Then
				iPos=InStr(3,sChaine,&quot;!!&quot;)
				sChaine=&quot; left ldline &quot;+_
					TraiteGeometrie(Mid(sChaine,3,iPos-3),sParam)+_
					&quot; right ldline &quot; +_
					TraiteGeometrie(Mid(sChaine,iPos+2),sParam)
				Goto SortieFonction
			&apos; Gestion de pi
			ElseIf     Mid(sChaine,1,2)=&quot;pi&quot; Then
				sChaine=&quot;%pi&quot;+TraiteGeometrie(Mid(sChaine,3),sParam)
				Goto SortieFonction
			EndIf
		EndIf
		&apos; Si le caractere n&apos;est pas un nombre, c&apos;est un vecteur ou un angle.
		If InStr(1,cScalaires,sCar,0)=0 Then
			If iLongueur&gt;1 Then
				iFin=1
				While (InStr(&quot;.+-×*:/=≠≃≈&lt;≤≥&gt;;#\{}()[]^∧° &quot;,Mid(sChaine,iFin+1,1))=0) And iFin&lt;iLongueur
					iFin=iFin+1
				WEnd
				sChaine=sParam+&quot;{&quot;+Dixio2(Mid(sChaine,1,iFin))_
					+&quot;}&quot;+TraiteGeometrie(Mid(sChaine,iFin+1),sParam)
			Else sChaine=sParam+&quot;{&quot;+Dixio2(sChaine)+&quot;}&quot;
			EndIf
			&apos; Le caractere est un nombre ou une operation. On cherche la fin de cette
			&apos; operation sans vecteur et on lui applique Dixio.
		Else
		    iPos=1
			sChaine=CoefficientsVecteurs(sChaine,iPos)_
				+TraiteGeometrie(Mid(sChaine,iPos+1),sParam)
		EndIf
	End Select
	SortieFonction:
	TraiteGeometrie=sChaine
	Erreur=False
End Function


Rem la macro ci-dessous corrige le CharPosture des scalaires
Rem ecrite le 8 septembre 2010
Function TraiteItalicScalVect(MaSource as String,bVecI, bScaI as boolean) as String
	Dim sResultat, sIorNotI as String
	Dim iPos1, iPos2, iLong as Integer
	iLong = Len(MaSource)
	iPos1 = 1
	sResultat = Masource	
	If (Not bvecI and bScaI) Then
		sIorNotI = &quot; italic{&quot;
	ElseIf (bvecI and Not bScaI) Then
		sIorNotI = &quot; nitalic{&quot;
	Else 
		Goto RienaFaire
	Endif
	Do while iPos1 &lt;= iLong
		If CarIsScalaire(iPos1,sResultat) Then
			iPos2 = iPos1 + 1
			&apos;Print iPos2, CarIsScalaire(iPos2,sResultat)
			Do while CarIsScalaire(iPos2,sResultat)
				iPos2 = iPos2 + 1
			Loop
			sResultat = Mid(sResultat,1,iPos1-1) &amp; sIorNotI &amp; Mid(sResultat,iPos1,iPos2-iPos1) &amp; &quot;} &quot; &amp;  Mid(sResultat,iPos2,iLong-iPos2+1)
			iPos1 = iPos1 + Len(sIorNotI) + 2
			iLong = iLong + Len(sIorNotI) + 2			
		Endif
		iPos1 = iPos1 + 1
	Loop 
	RienAFaire:	
	TraiteItalicScalVect = sResultat
End Function

Rem determine si le caractere est un scalaire
Function CarIsScalaire(iPos as Integer, MaSource As String) as Boolean
rem macro cree le 8 septembre
	Dim sCar as String
	Dim bReponse as Boolean	
	bReponse = FALSE
	sCar = Mid(MaSource,iPos,1)
	If Instr(1,sLettresScalaires,sCar,0) &gt; 0 Then
		saEviter = Array(&quot;widevec&quot;,&quot;widehat&quot;,&quot;overline&quot;,&quot;italic&quot;,&quot;nitalic&quot;)	
		bReponse = TRUE
		
		For I = LBound(saEviter) To UBound(saEviter)
				If iPos = 1 Then
					If Mid(MaSource,1,3) = Mid(saEviter(I),1,3) then
						bReponse = FALSE : Goto Termine
					Endif
				ElseIf 	iPos = Len(MaSource) Then			
					If Mid(MaSource,Len(MaSource)-2,3) = Mid(saEviter(I),Len(saEviter(I))-2,3) then
						bReponse = FALSE : Goto Termine
					Endif
				Else
					If iPos &lt; Len(MaSource)-1 Then
						If Mid(MaSource,iPos,3) = Mid(saEviter(I),1,3) then
								bReponse = FALSE : Goto Termine
						Endif
					Endif
					If iPos &gt; 2 Then
						If Mid(MaSource,iPos-2,3) = Mid(saEviter(I),Len(saEviter(I))-2,3) then
								bReponse = FALSE : Goto Termine
						Endif
					Endif
					For J=2 To Len(saEviter(I))-1
						If Mid(MaSource,iPos-1,3) = Mid(saEviter(I),J-1,3) then
								bReponse = FALSE : Goto Termine
						Endif						
					Next J	
				Endif			
		Next I		
	End if
	Termine:
	CarIsScalaire = bReponse
End Function



Function TraiteVecWidevec(MaSource as String) as String 
	rem cette macro transforme widevec en vec si un seul caractère ex widevec {u} devient vec {u}
	rem macro ecrite le 30 aout 2010
	Dim iPos1,iPos2 as Integer
	iPos1 = InStr(MaSource,&quot;widevec&quot;)
	While iPos1 &gt; 0 
		iPos2 = Instr(iPos1,MaSource,&quot;}&quot;)
		If (iPos2-iPos1 = 10 or (iPos2-iPos1 = 18 and Mid(MaSource,iPos1+10,6)=&quot;italic&quot;))  Then
			MaSource = Mid(MaSource,1,iPos1-1) &amp; Mid(MaSource,iPos1+4,Len(MaSource)-iPos1-3)
		Endif
		iPos1 = InStr(iPos2,MaSource,&quot;widevec&quot;)
	Wend
	TraiteVecWidevec = MaSource
End Function



Sub MetenPointe
	Call VerifOperationnel
	rem macro modifiée le 15 novembre 2003
	iAverto=323
	bPointe=True
	IsFormuleItalic = bItalic
	InsertSourceFormule()
End Sub

Sub MetenDoublePointe
	Call VerifOperationnel
	rem macro modifiée le 15 novembre 2003
	iAverto=323
	bDPointe=True
	IsFormuleItalic = bItalic
	InsertSourceFormule()
End Sub

Sub MetenVecteur
	Call VerifOperationnel
	rem macro modifiée le 15 novembre 2003
	iAverto=4
	bVecteur=True
	IsFormuleItalic = bVecteursItalic
	InsertSourceFormule()
End Sub

Sub MetenVecteurColonne (sChaine as String) 
rem macro crée le samedi 21 novembre 2003
rem cette macro modifie la source d&apos;un vecteur mettre les coordonnées en colonne
On Error Goto Fin
Dim iLongChaine as Integer, I as Integer, iGdePar as Integer
Dim bParent as Boolean, bPointVirgule as Boolean
iLongChaine = Len (sChaine)
	bPointVirgule=(InStr(sChaine,&quot;;&quot;)&gt;0)
	bParent=(InStr(sChaine,&quot;(&quot;)&gt;0)
	If bParent = True and bPointVirgule = True Then
		I=1
		I=InStr(I,sChaine,&quot;(&quot;)
		iGdePar=InStr(sChaine,&quot;left(&quot;)
		Do While I&gt;0
			If iGdePar=0 Or iGdePar+4&lt;&gt;I Then
				sChaine = Mid(sChaine,1,I-1)+&quot; left(matrix{&quot;+Mid(sChaine,I+1,iLongChaine-I)
				iGdePar=InStr(I+13,sChaine,&quot;left(&quot;)
				I=InStr(I+13,sChaine,&quot;(&quot;)
				iLongChaine = iLongChaine+12
			Else
				sChaine = Mid(sChaine,1,I)+&quot;matrix{&quot;+Mid(sChaine,I+1,iLongChaine-I)
				iGdePar=InStr(I+7,sChaine,&quot;left(&quot;)
				I=InStr(I+7,sChaine,&quot;(&quot;)
			EndIf
		Loop
		I=1
		I=InStr(I,sChaine,&quot;`&quot;)
		Do While I&gt;0
			sChaine = Mid(sChaine,1,I-1)+Mid(sChaine,I+1)
			I=InStr(I,sChaine,&quot;`&quot;)
			iLongChaine = iLongChaine - 1
		Loop
		I=1
		I=InStr(I,sChaine,&quot;nitalic;&quot;)
		Do While I&gt;0 and I&lt;iLongChaine 
			sChaine = Mid(sChaine,1,I-1)+&quot;##&quot;+Mid(sChaine,I+8)
			I=InStr(I+2,sChaine,&quot;nitalic;&quot;)
			iLongChaine = iLongChaine + 1
		Loop		
		I=1
		I=InStr(I,sChaine,&quot;;&quot;)
		Do While I&gt;0 and I&lt;iLongChaine 
			sChaine = Mid(sChaine,1,I-1)+&quot;##&quot;+Mid(sChaine,I+1)
			I=InStr(I+2,sChaine,&quot;;&quot;)
			iLongChaine = iLongChaine + 1
		Loop
		I=1
		I=InStr(I,sChaine,&quot;)&quot;)
		iGdePar=InStr(sChaine,&quot;right)&quot;)
		Do While I&gt;1
			If iGdePar=0 Or iGdePar+5&lt;&gt;I Then
				sChaine=Mid(sChaine,1,I-1)+&quot;}right&quot;+Mid(sChaine,I)
				iGdePar=InStr(I+7,sChaine,&quot;right)&quot;)
				I=InStr(I+7,sChaine,&quot;)&quot;)
				iLongChaine = iLongChaine+6
			Else
				sChaine=Mid(sChaine,1,iGdePar-1)+&quot;}&quot;+Mid(sChaine,iGdePar)
				iGdePar=InStr(I+2,sChaine,&quot;right)&quot;)
				I=InStr(I+2,sChaine,&quot;)&quot;)
			EndIf
		Loop
	Endif
	Goto FinMacro
Fin:
Print sVocab(iLang,305)
FinMacro:
End Sub


Sub MetenMesureAlgebrique
	Call VerifOperationnel
	 rem macro modifiée le 15 novembre 2003
	iAverto=5
	bMesureAlg=True
	IsFormuleItalic = bMesuresAlgItalic
	InsertSourceFormule()
End Sub

Sub MetenAngle
	Call VerifOperationnel
	 rem macro modifiée le 15 novembre 2003
	iAverto=6
	bVecteur=False &apos;ajoute le 7 dec 04 
	bAngle=True
	IsFormuleItalic = bAnglesItalic
	InsertSourceFormule()
End Sub


Sub MetenFormule
	Call VerifOperationnel
		rem macro modifiée le 6 fevrier 2005
	If bVerifSauvegarde = False and BasicLibraries.Standard.HasByname(&quot;DmOptions&quot;) Then Call VerifDateSauvegarde 
	bVerifSauvegarde = True
	iAverto=7
	IsFormuleItalic = bItalic
	InsertSourceFormule()
End Sub

Function Lissm(sMot,sModule) as string
rem etudie la chaine et insere limite,integrale,somme,systeme,matrice  
Dim sVar as string
Compteur=0
LongsMot=Len(sMot)


rem determine la présence de $
For N=1 to LongsMot
If Mid(sMot,N,1)=&quot;$&quot; Then Compteur=Compteur+1
Next N

If Compteur=0 Then
sMot=TraiteModule(sMot,sModule)
Else
	N=1
	Do until N=LongsMot+1
		If Mid(sMot,N,1)=&quot;$&quot; Then
			sMot=Mid(sMot,1,N-1)+Mid(sMot,N+1,LongsMot)
			LongsMot=LongsMot-1
			Do until Mid(sMot,N,1)=&quot;$&quot;
			N=N+1
			Loop
			sMot=Mid(sMot,1,N-1)+Mid(sMot,N+1,LongsMot)
			LongsMot=LongsMot-1
			N=N-1
		Else
			M=N
			Do until Mid(sMot,M,1)=&quot;$&quot; or M=LongsMot
			M=M+1
			Loop
			If N&lt;&gt;1 and M&lt;&gt;LongsMot Then
			sVar=TraiteModule(Mid(sMot,N,M-N),sModule)
			sMot=Mid(sMot,1,N-1)+sVar+Mid(sMot,M,LongsMot-M+1)
			Elseif N=1 Then
			sVar=TraiteModule(Mid(sMot,N,M-N),sModule)
			sMot=sVar+Mid(sMot,M,LongsMot-M+1)
			Else
			sVar=TraiteModule(Mid(sMot,N,M-N+1),sModule)
			sMot=Mid(sMot,1,N-1)+sVar
			Endif
			LongsMot=Len(sMot)
			N=N-1+Len(sVar)						
		Endif
		N=N+1
	Loop
Endif
If Erreur=True Then goto fin
sMot=Dmaths.Module2.Dixio(sMot)
InsertSourceIntegrale(sMot)
fin:
Erreur=False
End Function

Function TraiteModule(Chaine,Module)
Dim LongChaine,Mode as integer
Dim Resul,sV as string
LongChaine=Len(Chaine)
	Mode=1
	For I=1 To LongChaine
	If Mid(Chaine,I,1)=&quot;;&quot; Then Mode=Mode+1
	Next I
	
If Module=&quot;Limite&quot; Then
rem lim from{x rightarrow } {}
		Dim BI as Integer &apos; rem determine si limite supperposee
		BI=1
		Do until Mid(Chaine,BI,1)=&quot;#&quot; or BI = LongChaine
		BI = BI + 1
		Loop
	
	If Mode&gt;3 Then Goto Pb
	Resul=&quot;} &quot;
	N=LongChaine
	M=N
	Do until Mid(Chaine,M,1)=&quot;;&quot; or M=1
	M=M-1
	Loop
	If M=1 Then
	Goto Pb
	Else
	Resul=&quot; } { &quot;+Mid(Chaine,M+1,N-M)+Resul
	N=M-1
	M=M-1
	Endif
	Do until Mid(Chaine,M,1)=&quot;;&quot; or M=1
	M=M-1
	Loop
	If BI = LongChaine Then
		If M=1 Then
		Resul=&quot; Lim from{ x rightarrow &quot;+Mid(Chaine,1,N)+Resul
		Else
		Resul=&quot; Lim from{ &quot;+Mid(Chaine,1,M-1)+&quot; rightarrow &quot;+Mid(Chaine,M+1,N-M)+Resul
		Endif
	Else
		If M=1 Then
		Resul=&quot; Lim from{ binom {x rightarrow &quot;+Mid(Chaine,1,BI-1)+&quot;}{&quot;+Mid(Chaine,BI+1,N-BI)+&quot;}&quot;+Resul
		Else
		Resul=&quot; Lim from{ binom {&quot;+Mid(Chaine,1,M-1)+&quot; rightarrow &quot;+Mid(Chaine,M+1,BI-M-1)+&quot;}{&quot;+Mid(Chaine,BI+1,N-BI)+&quot;}&quot;+Resul
		Endif
	Endif
Endif
rem fin limite

If Module=&quot;Integrale&quot; Then
	If Mode&gt;4 Then Goto Pb
	If Mode=1 Then Resul=&quot; int &quot;+sBorneInfIntegrales+&quot; {} &quot;+sBorneSupIntegrales+&quot; {} { &quot;+Chaine+&quot; } nitalic{d}x &quot;
	
	If Mode=2 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot; int &quot;+sBorneInfIntegrales+&quot; {} &quot;+sBorneSupIntegrales+&quot; {} { &quot;+Mid(Chaine,1,M-1)+&quot; } nitalic{d}&quot;+Mid(Chaine,M+1,LongChaine-M)
	Endif
	
	 rem int from{} to {} {} dx 
	If Mode=3 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot; int &quot;+sBorneInfIntegrales+&quot; {&quot;+Mid(Chaine,1,M-1)+&quot;} &quot;+sBorneSupIntegrales+&quot; {&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} { &quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; } nitalic{d}x &quot;
	Endif

	rem int from{} to {} {} dx 
	If Mode=4 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot; int &quot;+sBorneInfIntegrales+&quot; {&quot;+Mid(Chaine,1,M-1)+&quot;} &quot;+sBorneSupIntegrales+&quot; {&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} { &quot;
	MP=MP+1
	M=MP
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M,LongChaine-M-1)+&quot; } nitalic{d}&quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; &quot;
	Endif
Endif
rem fin integrale

If Module=&quot;Somme&quot; Then
	If Mode&gt;4 or Mode=2 Then Goto Pb
	If Mode=1 Then Resul=&quot; sum from {} to {} { &quot;+Chaine+&quot; } &quot;

	rem sum{} to {} {} dx 
	If Mode=3 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot; sum from {&quot;+Mid(Chaine,1,M-1)+&quot;} to {&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} { &quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; } &quot;
	Endif

	rem sum from{} to {} {} dx 
	If Mode=4 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	sV=Mid(Chaine,1,M-1)
	Resul=&quot; sum from {&quot;+Mid(Chaine,1,M-1)+&quot;=&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} to { &quot;+sV+&quot;=&quot;
	MP=MP+1
	M=MP
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M,MP-M)+&quot; } { &quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; } &quot;
	Endif
Endif
rem fin somme

If Module=&quot;Produit&quot; Then
	If Mode&gt;4 or Mode=2 Then Goto Pb
	If Mode=1 Then Resul=&quot; prod from {} to {} { &quot;+Chaine+&quot; } &quot;

	rem sum{} to {} {} dx 
	If Mode=3 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot; prod from {&quot;+Mid(Chaine,1,M-1)+&quot;} to {&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} { &quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; } &quot;
	Endif

	rem sum from{} to {} {} dx 
	If Mode=4 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	sV=Mid(Chaine,1,M-1)
	Resul=&quot; prod from {&quot;+Mid(Chaine,1,M-1)+&quot;=&quot;
	MP=M+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M+1,MP-M-1)+&quot;} to { &quot;+sV+&quot;=&quot;
	MP=MP+1
	M=MP
	Do until Mid(Chaine,MP,1)=&quot;;&quot;
	MP=MP+1
	Loop
	Resul=Resul+Mid(Chaine,M,MP-M)+&quot; } { &quot;+Mid(Chaine,MP+1,LongChaine-MP)+&quot; } &quot;
	Endif
Endif
rem fin produit

If Module=&quot;Racine&quot; Then
	If Mode&gt;2 Then Goto Pb
	If Mode=1 Then	Resul=&quot; sqrt{&quot;+Chaine+&quot;}&quot;
	If Mode=2 Then
	M=1
	Do until Mid(Chaine,M,1)=&quot;;&quot;
	M=M+1
	Loop
	Resul=&quot;nroot{&quot;+Mid(Chaine,1,M-1)+&quot;}{&quot;+Mid(Chaine,M+1,LongChaine)+&quot;}&quot;
	Endif
Endif
rem fin racine

If Module=&quot;Systeme&quot; Then
	If Mode=1 Then Goto Pb
		Resul=&quot;left lbrace stack{{ &quot;
	M=1
	MP=1
	Do until MP=LongChaine+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot; or MP=LongChaine
	MP=MP+1
	Loop
	If MP&lt;&gt;LongChaine Then
	Resul=Resul+Mid(Chaine,M,MP-M)+&quot;} # {&quot;
	Else
	Resul=Resul+Mid(Chaine,M,MP-M+1)+&quot; }} right none&quot;
	Endif	
	MP=MP+1
	M=MP
	Loop		
Endif
rem fin systeme
	
If Module=&quot;Matrice&quot; Then
	If Mode=1 Then Goto Pb
	If bMatricesRondes = True Then 	Resul=&quot;left( matrix{ &quot; Else Resul=&quot;left[ matrix{ &quot; 
	M=1
	MP=1
	Do until MP=LongChaine+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot; or MP=LongChaine or Mid(Chaine,MP,1)=&quot;^&quot;
	MP=MP+1
	Loop
	If MP&lt;&gt;LongChaine Then
	If Mid(Chaine,MP,1)=&quot;^&quot; Then
		Resul=Resul+Mid(Chaine,M,MP-M)+&quot; } &quot;
		If bMatricesRondes = True Then 	Resul=Resul+&quot;right)&quot; Else Resul=Resul+&quot;right]&quot;
		Resul=Resul+&quot;^&quot;
	Else
	Resul=Resul+Mid(Chaine,M,MP-M)+&quot;#&quot;
	Endif	
	Else
	If Mid(Chaine,M-1,1)=&quot;^&quot; Then
	Resul=Resul+Mid(Chaine,M,MP-M+1)
	Else 
	Resul=Resul+Mid(Chaine,M,MP-M+1)+&quot; } &quot;
	If bMatricesRondes = True Then 	Resul=Resul+&quot;right)&quot; Else Resul=Resul+&quot;right]&quot;
	Endif
	Endif	
	MP=MP+1
	M=MP
	Loop		
Endif
rem fin matrice

If Module=&quot;MatriceSysteme&quot; Then
	If Mode=1 Then Goto Pb
	Resul=&quot;alignr left lbrace matrix{ &quot; 
	M=1
	MP=1
	Do until MP=LongChaine+1
	Do until Mid(Chaine,MP,1)=&quot;;&quot; or MP=LongChaine &apos; or Mid(Chaine,MP,1)=&quot;^&quot;
	MP=MP+1
	Loop
	If MP&lt;&gt;LongChaine Then
		Resul=Resul+Mid(Chaine,M,MP-M)+&quot;#&quot;
	Else
	Resul=Resul+Mid(Chaine,M,MP-M+1)+&quot; } &quot;
	Resul = Resul + &quot;right none&quot;
	Endif	
	MP=MP+1
	M=MP
	Loop		
Endif	
rem fin matricesysteme

TraiteModule=Resul
Goto finT
Pb: Avertir(iAverto)
Erreur = True
finT:
End Function		

Sub MetenLimite
	Call VerifOperationnel
	rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	iAverto=8
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Limite&quot;)
	Fin:
End Sub

Sub MetenIntegrale
	Call VerifOperationnel
	 rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	iAverto=9 
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Integrale&quot;)
	Fin:
End Sub

Sub MetenSomme
	Call VerifOperationnel
	rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	iAverto=10
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Somme&quot;)
	Fin:
End Sub

Sub MetenProduit
	Call VerifOperationnel
	rem Macro enregistrée : mercredi 10 décembre 2003 
	iAverto=317
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Produit&quot;)
	Fin:
End Sub

Sub MetenRacine
	Call VerifOperationnel
	 rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	iAverto=11
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Racine&quot;)
	Fin:
End Sub

Sub MetenSysteme
	Call VerifOperationnel
	rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	bSystemesEspaces = bSystemesAlignes
	iAverto=12
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	If bSystemesAlignes = True Then  Lissm(sEq,&quot;MatriceSysteme&quot;) Else Lissm(sEq,&quot;Systeme&quot;)
	Fin:
End Sub

Sub MetenMatrice
	Call VerifOperationnel
	rem Macro enregistrée : vendredi 23 novembre 2001, 21:00
	iAverto=13 
	IsFormuleItalic = bItalic
	sEq=Dmaths.Module1.Selec
	If Erreur=True Then Goto Fin
	Lissm(sEq,&quot;Matrice&quot;)
	Fin:
End Sub

Sub MetenRacineBleue
MetEntre(&quot; nroot{}{&quot;,&quot;} &quot;)
End Sub

Sub MetLInfini
MetEntre(&quot; inf &quot;,&quot;&quot;)
End Sub

Sub MetLBlanc
MetEntre(&quot; ` &quot;,&quot;&quot;)
End Sub

Sub MetLLBlanc &apos;GF does not yet work
MetEntre(&quot; \~ &quot;,&quot;&quot;)
End Sub

Sub MetentreAccolades
Call VerifOperationnel
MetEntre(&quot;{&quot;,&quot;}&quot;)
End Sub

Sub MetentreAccoladesVariables
MetEntre(&quot;left lbrace &quot;,&quot; right rbrace&quot;)
End Sub

Sub MetentreCrochets
oBoite=LoadDialog(&quot;Dmaths&quot;,&quot;ParCro&quot; )
oBoite.Execute()
End Sub

Sub MetentreParentheses
Call VerifOperationnel
MetEntre(&quot;(&quot;,&quot;)&quot;)
End Sub

Sub MetentreParenthesesVariables
MetEntre(&quot; left(&quot;,&quot;right)&quot;)
End Sub

Sub MetentreCrochets1
MetEntre(&quot;[&quot;,&quot;]&quot;)
End Sub

Sub MetentreCrochets2
MetEntre(&quot;\[&quot;,&quot;\[&quot;)
End Sub

Sub MetentreCrochets3
MetEntre(&quot;\]&quot;,&quot;\]&quot;)
End Sub

Sub MetentreCrochets4
MetEntre(&quot;\]&quot;,&quot;\[&quot;)
End Sub

Sub MetentreCrochets1Variables
MetEntre(&quot; left[&quot;,&quot;right]&quot;)
End Sub

Sub MetentreCrochets2Variables
MetEntre(&quot; left[&quot;,&quot;right[&quot;)
End Sub

Sub MetentreCrochets3Variables
MetEntre(&quot; left]&quot;,&quot;right]&quot;)
End Sub

Sub MetentreCrochets4Variables
MetEntre(&quot; left]&quot;,&quot;right[&quot;)
End Sub

Sub MetenValeurAbsolue
MetEntre(&quot; abs{&quot;,&quot;}&quot;)
End Sub

Sub MetenNorme
MetEntre(&quot; ldline &quot;,&quot; rdline &quot;)
End Sub

Sub MetenConjugue
MetEntre(&quot; overline{&quot;,&quot;}&quot;)
End Sub

Sub InsereObjetFormule
	Dim  iTailleDElaFormule as Integer
	Dim oTextActif as Object, oCursor as Object
	Dim oDesktop as Object, oDocument as Object, oVCursor as Object
	
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	oDocument= oDesktop.getCurrentComponent()
	
	oVCursor = oDocument.currentcontroller.getViewCursor()
	sEq = oVCursor.String()
	If Len(sEq)&gt;0 Then
		oTextActif = oVcursor.Text
		oCursor = oTextActif.createTextCursorByRange(oVCursor.getstart())
		If oVCursor.CharHeight &lt;&gt; 0 Then iTailleDElaFormule = oVCursor.CharHeight Else iTailleDElaFormule = oDocument.Text.End.CharHeight
		If Len(oVCursor.CharFontName)&gt;0 Then sNomPolice = oVCursor.CharFontName Else sNomPolice = oDocument.Text.End.CharFontName
		rem memorise la police du curseur. 	rem la taille est provisoirement celle du caractère précédent la formule.
		rem ----------------------------------------------------------------------------------
			&apos; on fixe la taille de la formule à la taille imposée si option choisie.
		If  Not bTailleFormCarac Then iTailleDElaFormule = iTailleFormules		
		If Not bUsingDispatcher Then oVCursor.String() = &quot;&quot;
	   	WriteFormula(oDocument,oVCursor,oCursor,sEq,iTailleDElaFormule,sNomPolice)
	Else	
		oDispHelper = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
		oProvider = ThisComponent.CurrentController.Frame
		oDispHelper.executeDispatch(oProvider, &quot;.uno:InsertObjectStarMath&quot;, &quot;&quot;, 0, Array())
	Endif
End Sub

rem cette macro insere la formule
rem elle a ete reecrite le 26 decembre
Sub WriteFormula(oDoc as object, oViewCursor as Object, oTextCursor as Object, sFormule as String, iTaille as Integer, sNomPolice as string)

	dim obj as object, document as object
	
&apos;	Print bUsingDispatcher
	
	If bUsingDispatcher Then
		oProvider = ThisComponent.CurrentController.Frame
		oDispHelper = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
 		dim Array(0) as new com.sun.star.beans.PropertyValue
 		oDispHelper.executeDispatch(oProvider, &quot;.uno:InsertObjectStarMath&quot;, &quot;&quot;, 0, Array()) 
  		obj = ThisComponent.getCurrentSelection()	  
    	rem on regle les marges
    	obj.LeftMargin = cint(iMargesFormules)*100 
		obj.RightMargin = cint(iMargesFormules)*100
		document   = oDoc.CurrentController
		oDoc.getCurrentController().select(oTextCursor)
	  	obj.EmbeddedObject.BaseFontHeight= iTaille
  		rem la police de la formule est celle de la ligne si option choisie
		If (bPoliceFormCarac = True and obj.model.FontNameVariables &lt;&gt; sNomPolice) Then
		  	obj.EmbeddedObject.FontNameVariables=sNomPolice
	  		obj.EmbeddedObject.FontNameNumbers=sNomPolice
	  		obj.EmbeddedObject.FontNameText=sNomPolice
	 		obj.EmbeddedObject.FontNameFunctions=sNomPolice
		EndIf
	&apos;	If bVecteur = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bVecteursItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bVecteursItalic
	&apos;	ElseIf bAngle = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bAnglesItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bAnglesItalic
	&apos;	ElseIf bMesureAlg = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bMesuresAlgItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bMesuresAlgItalic
	&apos;	ElseIf  bVecteur = False and bAngle=False and bMeseureAlg = False and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bItalic Then
			obj.embeddedobject.FontVariablesIsItalic = IsFormuleItalic
	&apos;	EndIf
		
		If obj.embeddedobject.IsTextMode &lt;&gt; bTextMode Then
			obj.embeddedobject.IsTextMode = bTextMode
		EndIf
		
		If bFormulesGras = TRUE Then
			obj.embeddedobject.FontTextIsBold = TRUE
			obj.embeddedobject.FontFunctionsIsBold = TRUE
			obj.embeddedobject.FontNumbersIsBold = TRUE
			obj.embeddedobject.FontVariablesIsBold = TRUE
		End If
		
		If bFormulesEncadrees = TRUE Then
			EncadrerFormule(obj,2)
		Endif

		rem rehausse la barre de surlignage
		If InStr(obj.embeddedObject.Formula,&quot;overline&quot;)&gt;0 or InStr(obj.embeddedObject.Formula,&quot;bar&quot;)&gt;0 Then
			obj.embeddedObject.RelativeSymbolPrimaryHeight = 10
		Endif	
		obj.EmbeddedObject.formula= sFormule
		obj.embeddedObject.setmodified(true)
		oDispHelper.executeDispatch(oProvider, &quot;.uno:Escape&quot;, &quot;&quot;, 0, Array()) 
	
	
	Else
		obj=ThisComponent.CreateInstance(&quot;com.sun.star.text.TextEmbeddedObject&quot;)
		obj.CLSID=&quot;078B7ABA-54FC-457F-8551-6147e776a997&quot;
	    obj.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER   
		rem regle la marge des formules
	    obj.LeftMargin = cint(iMargesFormules)*100 
		obj.RightMargin = cint(iMargesFormules)*100	
	    document   = oDoc.CurrentController
		oDoc.getCurrentController().select(oTextCursor)
	    oTextCursor.Text.insertTextContent(oTextCursor, obj, true)    
	  	obj.EmbeddedObject.BaseFontHeight= iTaille
	  		rem la police de la formule est celle de la ligne si option choisie
		If (bPoliceFormCarac = True and obj.model.FontNameVariables &lt;&gt; sNomPolice) Then
		  	obj.EmbeddedObject.FontNameVariables=sNomPolice
	  		obj.EmbeddedObject.FontNameNumbers=sNomPolice
	  		obj.EmbeddedObject.FontNameText=sNomPolice
	 		obj.EmbeddedObject.FontNameFunctions=sNomPolice
		EndIf
	&apos;	If bVecteur = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bVecteursItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bVecteursItalic
	&apos;	ElseIf bAngle = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bAnglesItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bAnglesItalic
	&apos;	ElseIf bMesureAlg = True and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bMesuresAlgItalic Then
	&apos;		obj.embeddedobject.FontVariablesIsItalic = bMesuresAlgItalic
	&apos;	ElseIf  bVecteur = False and bAngle=False and bMeseureAlg = False and obj.embeddedobject.FontVariablesIsItalic&lt;&gt;bItalic Then
				obj.embeddedobject.FontVariablesIsItalic = IsFormuleItalic
	&apos;	EndIf
			
		If obj.embeddedobject.IsTextMode &lt;&gt; bTextMode Then
			obj.embeddedobject.IsTextMode = bTextMode
		EndIf
			
		If bFormulesGras = TRUE Then
			obj.embeddedobject.FontTextIsBold = TRUE
			obj.embeddedobject.FontFunctionsIsBold = TRUE
			obj.embeddedobject.FontNumbersIsBold = TRUE
			obj.embeddedobject.FontVariablesIsBold = TRUE
		End If
			
		If bFormulesEncadrees = TRUE Then
			EncadrerFormule(obj,2)
		Endif
	
			rem rehausse la barre de surlignage
		If InStr(obj.embeddedObject.Formula,&quot;overline&quot;)&gt;0 or InStr(obj.embeddedObject.Formula,&quot;bar&quot;)&gt;0 Then
			obj.embeddedObject.RelativeSymbolPrimaryHeight = 10
		Endif
	
		obj.EmbeddedObject.formula=sFormule
		obj.embeddedObject.setmodified(true)
		oViewCursor.goLeft(1,False)
		oViewCursor.goRight(1,False)
	
	Endif
		
		Goto FinSub:
		Fin: MsgBox sVocab(iLang,305)
		FinSub:
End sub

&apos;**************************************************************************************
&apos; macro écrite le 15 novembre 2003.
&apos; Elle insert la source de la formule et éventuellement l&apos;écrit
&apos;**************************************************************************************
Sub InsertSourceFormule
&apos;Dim bNorme as Boolean
	Dim LongsEq, iTailleDElaFormule,  iNbrePas as Integer
	Dim oTextActif as Object, oCursor as Object
	Dim oDesktop as Object, oDocument as Object, oVCursor as Object
	
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	oDocument= oDesktop.getCurrentComponent()
	
	oVCursor = oDocument.currentcontroller.getViewCursor()
	
&apos;	MRI oVCursor
	
	oTextActif = oVcursor.Text
	oCursor = oTextActif.createTextCursorByRange(oVCursor.getstart())
	
	If IsNull(bExecCoordColonne) Then bExecCoordColonne = bCoordColonne Rem Initialise ce boolean 
	
	If oVCursor.CharHeight &lt;&gt; 0 Then iTailleDElaFormule = oVCursor.CharHeight Else iTailleDElaFormule = oDocument.Text.End.CharHeight
	If Len(oVCursor.CharFontName)&gt;0 Then sNomPolice = oVCursor.CharFontName Else sNomPolice = oDocument.Text.End.CharFontName
	rem memorise la police du curseur. 	rem la taille est provisoirement celle du caractère précédent la formule.
	sEq = Selec
		If Erreur = True Then goto fin
		If bAngle = True Then
			sEq = TraiteGeometrie(sEq,&quot; widehat &quot;)		
			sEq = TraiteItalicScalVect(sEq,bAnglesItalic,bItalic) rem corrige le Charposture des scalaires
		Elseif bVecteur = True Then
			sEq =TraiteGeometrie(sEq,&quot; widevec &quot;)
			sEq = TraiteVecWidevec(sEq) Rem Choisit Vec ou Widevec
			sEq = TraiteItalicScalVect(sEq,bVecteursItalic,bItalic) rem corrige le Charposture des scalaires
			If bExecCoordColonne = True Then MetenVecteurColonne (sEq) 
		Elseif bMesureAlg = True Then
			sEq=TraiteGeometrie(sEq,&quot; overline &quot;)
			sEq = TraiteItalicScalVect(sEq,bMesuresAlgItalic,bItalic) rem corrige le Charposture des scalaires
			If bExecCoordColonne = True Then MetenVecteurColonne (sEq) 
		Elseif bPointe = True Then
			sEq=TraiteGeometrie(sEq,&quot; dot &quot;)
		Elseif bDPointe = True Then
			sEq=TraiteGeometrie(sEq,&quot; ddot &quot;)
		Else
		sEq = Dmaths.Module2.Dixio(sEq)
		Endif
	
		rem ----------------------------------------------------------------------------------
		&apos; on fixe la taille de la formule à la taille imposée si option choisie.
		If  Not bTailleFormCarac Then iTailleDElaFormule = iTailleFormules	

	PostTraitementFormule(oCursor,oTextActif ,sEq, iNbrePas) rem permet de traiter les caractères et/ou formules précédentes

	oTextActif.insertString(oCursor,sEq,True)
	oVCursor.GoLeft(iNbrePas,True)

	If bManuelFormula = FALSE Then WriteFormula(oDocument,oVCursor,oCursor,sEq,iTailleDElaFormule,sNomPolice)
	fin:
	Erreur=False
End Sub

Sub InsertSourceIntegrale ( sMot as String)
	Dim iTailleDElaFormule, iNbrePas as Integer
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	oDocument= oDesktop.getCurrentComponent()
	oText = oDocument.Text
	oVCursor = oDocument.currentcontroller.getViewCursor()
	oTextActif = oVcursor.Text
	oCursor = oTextActif.createTextCursorByRange(oVCursor.getstart())
	If oVCursor.CharHeight &lt;&gt; 0 Then iTailleDElaFormule = oVCursor.CharHeight Else iTailleDElaFormule = oDocument.Text.End.CharHeight
	If Len(oVCursor.CharFontName)&gt;0 Then sNomPolice = oVCursor.CharFontName Else sNomPolice = oDocument.Text.End.CharFontName
	rem memorise la police du curseur. 	rem la taille est provisoirement celle du caractère précédent la formule. 
	If Erreur=True Then goto fin
	rem ----------------------------------------------------------------------------------
		&apos; on fixe la taille de la formule à la taille imposée si option choisie.
	If  Not bTailleFormCarac Then iTailleDElaFormule = iTailleFormules	
		
	PostTraitementFormule(oCursor,oTextActif ,sMot, iNbrePas) rem permet de traiter les caractères et/ou formules précédentes
	oTextActif.insertString(oCursor,sMot,True)
	oVCursor.GoLeft(iNbrePas,True)
	
	&apos;print iNbrePas
	
	If bManuelFormula = FALSE Then WriteFormula(oDocument,oVCursor,oCursor,sMot,iTailleDElaFormule,sNomPolice)
	fin:
	Erreur=False
End Sub
 
&apos; ecrite par Didier Dorange-Pattoret 
Sub PostTraitementFormule(oTextCursor, oTextActif as Object,sFormule as String, iNbreCaracteres as Integer)
	Dim iNbreFormulesPassees as integer
	Dim sFormulaPre as String &apos;contient le code de la formule précedente
	Dim Car as Long
	iNbreCaracteres = Len(sFormule)
	oTextCursor2 = oTextCursor
	if (Not oTextCursor2.isStartOfSentence and bConcateneFormules = TRUE) Then
			iNbreFormulesPassees = 0	
			Car = -1
			do until (oTextCursor2.isStartOfSentence()= True  or  Car=9 or Car=10 or Car=13 or Car=32 or Car=46 or Car=95 ) &apos; (oTextCursor2.getString()=&quot; &quot;)) &apos; or (Asc(oTextCursor2.getString())=9))
				oTextCursor2.goLeft(0,False)
				oTextCursor2.goLeft(1,True)
				If oTextCursor2.getString()&lt;&gt;&quot;&quot; Then Car = Asc(oTextCursor2.getString)
			&apos;	Print oTextCursor2.getString, Car
					if (Car=9 or Car=10 or Car=13 or Car=32 or Car=46 or Car=95) Then 
				&apos;	if (oTextCursor2.getString()=&quot; &quot;) Then &apos; or oTextCursor2.getString()=&quot;.&quot; ) Then 
						iNbreCaracteres = iNbreCaracteres + iNbreFormulesPassees
						oTextActif.insertString(oTextCursor,Chr(Car),False)						
					elseif oTextCursor2.getString()&lt;&gt;&quot;&quot; Then	rem il y a un caractère
						sFormule = oTextCursor2.getString() + sFormule
						iNbreCaracteres = iNbreCaracteres + 1				
						oTextActif.insertString(oTextCursor2,&quot;&quot;,True)
					else		rem il s&apos;agit d&apos;une formule
						Objets=oTextCursor2.createContentEnumeration(&quot;com.sun.star.text.TextContent&quot;)
								if Objets.HasMoreElements then
									obj = Objets.NextElement
									if obj.getImplementationName=&quot;SwXTextEmbeddedObject&quot; then
										if obj.embeddedObject.getImplementationName=&quot;com.sun.star.comp.math.FormulaDocument&quot; then
											sFormulaPre = obj.embeddedobject.Formula
											If Left(sFormule,4) = &quot;size&quot; Then 
												iNbreCaracteres = iNbreCaracteres - Instr(sFormule,&quot;{&quot;)-1
												sFormule = Mid(sFormule,Instr(sFormule,&quot;{&quot;)+1,Len(sFormule)-Instr(sFormule,&quot;{&quot;)-1)	
											Endif				
											If Left(sFormulaPre,4) = &quot;size&quot; Then											
												sFormule = Mid(sFormulaPre,1,Len(sFormulaPre)-1) &amp; sFormule &amp; &quot;}&quot;
											Else
						  		       			sFormule = sFormulaPre + sFormule
						  		       		Endif
						  		       		iNbreCaracteres = iNbreCaracteres + Len(obj.embeddedobject.Formula) &apos;+ 1
						  		       		iNbreFormulesPassees = iNbreFormulesPassees + 1	
						  		       		If bUsingDispatcher Then oTextCursor2.String()=&quot; &quot; Else oTextCursor2.String()=&quot;&quot;			  		       	
										endif
									endif
								endif
					end if	
				If Car=45 Then rem cette partie traite le cas du caractere -
					oTextCursor2.goLeft(0,False)
					oTextCursor2.goLeft(1,True)
					If oTextCursor2.String = &quot;-&quot; Then 
						oTextActif.insertString(oTextCursor,&quot;-&quot;,False)	
					&apos;	oTextCursor2.goright(1,False)						
						Exit Do
					Else
						oTextCursor2.goright(1,False)
					Endif			
				Endif
			loop
	Elseif (Not bConcateneFormules) Then
			oTextCursor2.goLeft(0,False)
			oTextCursor2.goLeft(1,True)		
			oTextCursor2.goRight(1,False)
	Endif 
End Sub




Sub MetEntre (ChaineG,ChaineD as String) &apos; improved with insertion at position of cursor GF may 2007
	If Form=True or Form1=True Then

		If Form1=True Then
			fSel1 = oBoite.GetControl(TF)
			aSel = fSel1.Selection 
		Else
			fSel0 = oBoiteFormuleGraphique.GetControl(TF)
			aSel = fSel0.Selection
		End If

		oTextIndex.Text = Left(oTextIndex.Text,aSel.MIN)+ChaineG+ChaineD+Right(oTextIndex.Text,Len(oTextIndex.Text)-aSel.MIN)

&apos; must not loose the focus! therefore buttons metLcdot etc must have FocusOnClick=False

&apos; new position of cursor:
		aSel.MIN=aSel.MIN+Len(ChaineG) &apos;between brackets
		aSel.MAX=aSel.MIN
		If Form1=True Then
			oBoite.GetControl(TF).Selection = aSel 
		Else
			oBoiteFormuleGraphique.GetControl(TF).Selection = aSel 
		End If
		
	Else
		oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
		oDocument= oDesktop.getCurrentComponent()
		oText = oDocument.Text
		oVCursor = oDocument.currentcontroller.getViewCursor()
		oTextActif = oVCursor.Text &apos; la zone de texte actif page ou cellule ....
		oCursor = oTextActif.createTextCursorByRange(oVCursor.Getstart())
		If oVCursor.iscollapsed Then 
			oTextActif.insertString(oCursor,ChaineG+ChaineD,True)
			oVCursor.Goleft(Len(ChaineD),False)
		Else
			oCursor.GotoRange(oVCursor.GetEnd(),True)
			oTextActif.insertString(oCursor,ChaineG+oCursor.GetString()+ChaineD,True)
		Endif
	Endif

	If bBoite=True Then oBoite.Endexecute()
End Sub

Sub VerifDateSauvegarde
	if iDelaiEntreSauvegardes&lt;&gt;0 Then
	Dim iLadifdedate as Long
	iLadifdedate = DateValue(date())  - DateValue(sDateSauvegarde)
	rem		iLadifdedate = iLadifdedate - DateValue(sDateSauvegarde)
	if iLadifdedate &gt;= iDelaiEntreSauvegardes  Then MsgBox(sVocab(iLang,382)+&quot; &quot;+sDateSauvegarde,48,&quot;Dmaths Backup&quot;)
	End If
End Sub

</script:module>