/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Module2.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 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 1697 1698 1699 1700 1701 | <?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="Module2" script:language="StarBasic">'************************************************
'Copyright (C) 2008 Didier Dorange-Pattoret
'38, chemin de l'Abbaye
'74940 Annecy le Vieux
'France
'ddorange@dmaths.com
'
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public Licence (GPL)
'as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library 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
'General Public License for more details.
'You should have received a copy of the GNU General Public Licence (GPL)
'along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'************************************************
REM ***** BASIC *****
Public Memb1(10),Memb2(10),Egal(10) as String
Public Nbrequation,Pluslong,Nbrecolonne as integer
Public Coeff(8,8) as String
Public Form,Form1,Form2,bLong,bDroit,bSystemesEspaces as Boolean ' determine si la formule doit être écrite ou seulement le code,
' bSystemesEspaces = TRUE si on ecrit un systeme
Public bVecteur,bAngle,bMesureAlg,bPointe,bDPointe as Boolean 'true si on écrit un vecteur, un angle, une mesure algébrique
Public IsFormuleItalic as Boolean
Public oBoite as Object
Public oMatrice1 as Object
Public oBoiteFormuleGraphique as Object
Public oListBox as Object
Public oListBox2 as Object 'GF pour lettres grecques
Public oListBox3 as Object 'GF pour lettres grecques
Public oTextIndex as Object
Public sAjout as String
Public TF as String 'GF pour Metentre
Rem Form est Vraie si FormuleGraphique est lancée.
Rem Form2 est vraie si on a rencontré & et donc on ajoute
Rem Form1 est vraie si nous sommes dans une macro graphique, et dans Tava (GF) .
Sub InsereFormule
Selection.InsertObjectStarMath()
Selection.escape
End Sub
rem les macros suivantes servent à mettre le focus dans le champ de texte lorsque l'on clique
Sub TextFieldSet1 'GF pour FormuleGraphique
TF = "TextField1"
' Set oTextIndex=oBoiteFormuleGraphique.Model.getByName(TF)
Set oTextIndex = oBoiteFormuleGraphique.getControl(TF).Peer rem DDP modifie le 14 novembre 2009
End Sub
Sub TextField1Focuslost 'GF pour FormuleGraphique
TF = "TextField1"
oBoiteFormuleGraphique.GetControl(TF).setFocus
End Sub
Sub TextFieldSet2 'GF pour Formule2
TF = ""
End Sub
'The following macro replaces all previous TextIndexSetN macros (Tava was very hungry!)
'Gisbert Friege mai 2007
Sub TextIndexSet_any(event)
TF = event.source.model.name
' Set oTextIndex=oBoite.Model.getByName(TF)
Set oTextIndex=oBoite.getControl(TF).Peer rem DDP modifie le 14 novembre 2009
End Sub
Function SiChiffre(sCar as String) as Boolean
' Teste si le caractere (Charac) est un chiffre ou un separateur decimal.
Dim Retour as Boolean
Retour=False
If InStr("0123456789.,",sCar) > 0 Then Retour=True
SiChiffre=Retour
End Function
Function FinCalcul(Mot as String,Increment as Integer,Droite as Boolean) as Integer
' Jerome Ortais
' Cette fonction donne la position de la fin d'un calcul, soit vers la droite (quand Droite est Vrai), soit vers la gauche (quand Droite est Faux).
' Elle peut aussi modifier la chaine Mot si besoin est (pour gérer les exposants) et la valeur de Increment (pour prendre en compte les changements).
Dim sMot$, sCar$, iFin as Integer
Const cChiffres="0123456789,.²",cStop="(){}[]+-×*:/=≠≃≈~<≤≥>;#\$~^_&"
' Const cLettres="azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN'%²"
Const cLettres="azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN'%²'"
' % fait partie de cLettres pour prendre en compte les noms tels que %pi, %OMÉGA, etc...
iLongueur=Len(Mot)
If Droite Then
iFin=1
If Increment+iFin=iLongueur Then
' la fin du mot est le caractere courant. C'est donc aussi la fin du calcul.
' iFin prend pour valeur la position du caractere d'apres.
iFin=2
Goto FinDroite
EndIf
sCar=Mid(Mot,Increment+iFin,1)
While sCar=" "
' Ne compte pas les espaces qu'il pourrait y avoir en début de chaine.
iFin=iFin+1
sCar=Mid(Mot,Increment+iFin,1)
WEnd
If sCar="+" Or sCar="-" Then
' Cas ou l'expression a un signe
iFin=iFin+1
sCar=Mid(Mot,Increment+iFin,1)
EndIf
If InStr(cChiffres,sCar)>0 Then
' Si le 1er caractere est un chiffre, on cherche la fin des chiffres ...
iFin=iFin+1
While InStr(cChiffres,Mid(Mot,Increment+iFin,1))>0 And iFin<=iLongueur
iFin=iFin+1
WEnd
' ... puis la fin des lettres s'il y a lieu.
If (InStr(cLettres+"([{",Mid(Mot,Increment+iFin,1))>0) And iFin<=iLongueur Then iFin=FinCalcul(Mot,Increment+iFin-1,True)-Increment+1
ElseIf InStr(cLettres,sCar) Then
' Si le 1er caractere est une lettre, on cherche la fin des lettres ...
iFin=iFin+1
While (InStr(cLettres,Mid(Mot,Increment+iFin,1))>0) And iFin<=iLongueur
iFin=iFin+1
WEnd
' ... puis la fin des chiffres s'il y a lieu.
If InStr(cChiffres+"([{",Mid(Mot,Increment+iFin,1))>0 And iFin<=iLongueur Then iFin=FinCalcul(Mot,Increment+iFin-1,True)-Increment+1
ElseIf InStr("{([",sCar)>0 Then
iFin=TrouvePaire(Mot,Increment+iFin,sCar)-Increment+1
' Le caractere est le caractere suivant }, ] ou )
If InStr(cChiffres+cLettres+"([{",Mid(Mot,Increment+iFin,1))>0 And iFin<=iLongueur Then iFin=FinCalcul(Mot,Increment+iFin-1,True)-Increment+1
EndIf
sCar=Mid(Mot,Increment+iFin,1)
If sCar="_" or sCar="^" Then
' On cherche ou se finit l'indice ou l'exposant.
iFin=FinCalcul(Mot,Increment+iFin,True)-Increment+1
EndIf
FinDroite:
If (Mid(Mot,Increment,2)="^+" Or Mid(Mot,Increment,2)="^-") And iFin=2 Then
' Si l'expression correspond a ^+ ou ^-, on ajoute {} a la fin. Utile pour les limites.
Mot=InsereTexte(Mot,Increment+iFin-1,"{}")
FinCalcul=Increment+iFin+1
Else
FinCalcul=Increment+iFin-1
EndIf
Else
' On cherche la fin du calcul vers la droite.
iFin=0
If Increment=1 Then Goto FinGauche
For iFin = 1 To Increment-1
' On ecrit le mot a l'envers pour l'etudier, mais seulement jusqu'a la position etudiee.
sMot=Mid(Mot,iFin,1)+sMot
Next iFin
iLongueur=Len(sMot)
iFin=1
sCar=Mid(sMot,iFin,1)
While sCar=" "
iFin=iFin+1
sCar=Mid(Mot,iFin,1)
WEnd
If InStr(cLettres,sCar)>0 Then
iFin=iFin+1
While InStr(cLettres,Mid(sMot,iFin,1))>0 And iFin<=iLongueur
iFin=iFin+1
WEnd
If InStr(cChiffres+")]}",Mid(sMot,iFin,1))>0 And iFin<=iLongueur Then iFin=-FinCalcul(Mot,Increment-iFin+1,False)+Increment
' On cherche ou se termine les chiffres ensuite
' Le caractere n'est plus une lettre.
ElseIf InStr(cChiffres,sCar) Then
iFin=iFin+1
While (InStr(cChiffres,Mid(sMot,iFin,1))>0) And iFin<=iLongueur
iFin=iFin+1
WEnd
If InStr(cLettres+")]}",Mid(sMot,iFin,1))>0 And iFin<=iLongueur Then iFin=-FinCalcul(Mot,Increment-iFin+1,False)+Increment
' Le caractere n'est plus ni un chiffre ni une lettre.
ElseIf InStr("}])",sCar)>0 Then
iFin=TrouvePaire(sMot,iFin,sCar)+1
' Le caractere est le caractere suivant }, ] ou )
If (iFin=3 Or InStr(cChiffres+cLettres+")]}",Mid(sMot,iFin,1))>0) And iFin<=iLongueur Then iFin=-FinCalcul(Mot,Increment-iFin+1,False)+Increment
' Cas ou la paire trouvée est vide : {} ce qui peut arriver avec les exposants.
ElseIf InStr("+-",sCar)>0 And iFin<iLongueur Then
' Le signe est precede du symbole ^. On cherche le debut de la puissance.
If Mid(sMot,iFin+1,1)="^" Then iFin=-FinCalcul(Mot,Increment-iFin-1,False)+Increment
EndIf
If iFin>=iLongueur Then Goto FinGauche
If Mid(sMot,iFin,2)="-^" Or Mid(sMot,iFin,2)="+^" Then
'On a rencontre unexposant. On cherche le debut de la puissance.
iFin=-FinCalcul(Mot,Increment-iFin-1,False)+Increment
ElseIf InStr(iFin,sMot,"trqs")=iFin Then
' Le calcul est une racine carree. (sqrt donne trqs a l'envers)
iFin=-FinCalcul(Mot,Increment-iFin-3,False)+Increment
EndIf
sCar=Mid(sMot,iFin,1)
If sCar="_" Or sCar="^" Then iFin=-FinCalcul(Mot,Increment-iFin,False)+Increment
FinGauche:
FinCalcul=Increment-iFin
EndIf
End Function
Function TrouvePaire(sMot as String,Pos as Integer,Elt1 as String) as Integer
' Jerome Ortais
' Cherche le caractere Elt2 qui fait la paire avec le caractere Elt1 et renvoie sa position dans la phrase (Mot).
' Permet de trouver les paires "()", "{}", "[]", ")(", "}{" ou "][".
Dim Test as Boolean
Dim Cpt,Pos1,Pos2,iPos as Integer
Select Case Elt1
' Indique quel est l'element qui fait la paire avec Elt1.
Case "{"
Elt2="}"
Case "}"
Elt2="{"
Case "("
Elt2=")"
Case ")"
Elt2="("
Case "["
Elt2="]"
Case "]"
Elt2="["
End Select
iPos=Pos+1
Test=True
Cpt=1
Do
' Pos1 donne la position du premier caractere suivant Elt1 identique à Elt1.
Pos1=InStr(iPos,sMot,Elt1)
' Pos2 donne la position du premier caractere suivant Elt1 correspondant a la paire cherchee.
Pos2=InStr(iPos,sMot,Elt2)
If Pos1<>0 And Pos1<Pos2 Then
' Il y a une autre paire incluse dans la paire cherchee.
Cpt=Cpt+1
iPos=Pos1+1
Else
' On a trouve la fin d'une paire.
Cpt=Cpt-1
iPos=Pos2+1
EndIf
If Cpt=0 Then
' On a trouve le caractere cherche pour finir la paire à la position Pos2.
Test=False
EndIf
Loop While Test
TrouvePaire=Pos2
End Function
Function GereExposant(Mot as String,Pos as integer,LongMot as Integer) as String
' Jerome Ortais
' Fonction permettant la transformation de 5^-3 en 5^{-3} et de 0^+ en 0^{+{}}. Change Pos et LongMot.
Dim sMot$
Dim OldIncrement as Integer
Const cOperateurs="+-×*:/=≠≃≈~<≤≥>;#\$})]^_% "
sMot=Mot
OldIncrement = Increment
Car=Mid(sMot,Pos,1)
Pos=FinCalcul(sMot,Pos,True)
Increment = RecalculeIncrement(sMot,OldIncrement,Increment)
GereExposant=sMot
End Function
Function InsereTexte(Mot as String,Pos as Integer,Texte as String) as String
' Jerome Ortais
' Permet d'insérer des caractères (Texte) à une position donnée (Pos) dans une phrase (Mot).
Dim sMot$
sMot=Mot
If Pos=0 Then
' Insere Texte en début de Mot.
sMot=Texte+sMot
Else
If Pos=Len(sMot) Then
' Insere Texte en fin de Mot.
sMot=sMot+Texte
Else
' Insere Texte dans le Mot.
sMot=Mid(sMot,1,Pos)+Texte+Mid(sMot,Pos+1)
EndIf
EndIf
InsereTexte=sMot
End Function
Function GereDroit(Char$, Mot$, Increment as Integer, LongMot as Integer) as String
' Jerome Ortais
' Permet de verifier si le caractere Char doit etre droit ou en italique. Change Increment et LongMot.
Dim sMot$
Const cChaine="{([])}-+×*/:^=≃≈~≠<≤≥> .0123456789;#\$%"
sMot=Mot
If LongMot=1 Then
' Si Char est le seul caractere de la chaine, il est ecrit droit.
sMot="{nitalic "+Char+"}"
LongMot=LongMot+10
Increment=Increment+10
ElseIf Increment=1 Then
' Si c'est le premier caractere de Mot, Char est ecrit droit s'il est suivit de l'un des caracteres de Chaine,
' c'est-a-dire s'il ne fait pas partie d'un mot.
If InStr(cChaine,Mid(sMot,Increment+1,1))>0 Then
sMot="{nitalic "+Char+"}"+Mid(sMot,Increment+1)
LongMot=LongMot+10
Increment=Increment+10
EndIf
ElseIf Increment=LongMot Then
' Si c'est le dernier caractere de Mot, Char est ecrit droit s'il est precede de l'un des caracteres de Chaine,
' c'est-a-dire s'il ne fait pas partie d'un mot.
If InStr(cChaine,Mid(sMot,Increment-1,1))>0 Then
sMot=Mid(sMot,1,Increment-1)+"{nitalic "+Char+"}"
LongMot=LongMot+10
Increment=Increment+10
EndIf
ElseIf InStr(cChaine,Mid(sMot,Increment-1,1))>0 And InStr(cChaine,Mid(sMot,Increment+1,1))>0 Then
' Si ce n'est ni le premier ni le dernier caractere de Mot, Char est ecrit droit s'il est suivit et precede
' de l'un des caracteres de Chaine, c'est-a-dire s'il ne fait pas partie d'un mot.
sMot=Mid(sMot,1,Increment-1)+"{nitalic "+Char+"}"+Mid(sMot,Increment+1)
LongMot=LongMot+10
Increment=Increment+10
EndIf
GereDroit=sMot
End Function
Function ChiffresDroits(Mot,Increment,LongMot) as String
' Ecrit des accolades autour d'un nombre. Modifie les valeurs de Increment et LongMot.
Dim sMot$
Dim Curseur as integer
sMot=Mot
Curseur=1
Do while Increment+Curseur<=LongMot And SiChiffre(Mid(sMot,Increment+Curseur,1)
' Cherche le prochain caractere qui n'est ni un chiffre ni un separateur decimal ou la fin du Mot.
Curseur=Curseur+1
Loop
' Insere "}" a la fin du nombre et Insere "{" au debut du nombre.
sMot=InsereTexte(sMot,Increment+curseur-1,"}")
sMot=InsereTexte(sMot,Increment-1,"{")
' Decale la position du curseur de 1 pour contrebalancer l'insertion du "{".
Increment=Increment+Curseur+1
' Indique la nouvelle longueur du Mot auquel on a ajoute "{" et "}".
LongMot=LongMot+2
ChiffresDroits=sMot
End Function
Function GereEsperluettes(Mot$, Increment as Integer, LongMot as Integer)
Mot=Mid(Mot,1,Increment-1)+Mid(Mot,Increment+1)
LongMot=LongMot-1
Do Until Mid(Mot,Increment,1)="&"
If Mid(Mot,Increment,1)="§" Then
Form2=True
FormuleGraphique2
Mot=Mid(Mot,1,Increment-1)+sAjout+Mid(Mot,Increment+1)
LongMot=LongMot+Len(sAjout)
Form2=False
Endif
Increment=Increment+1
Loop
Mot=Mid(Mot,1,Increment-1)+Mid(Mot,Increment+1)
LongMot=LongMot-1
End Function
Function GereCrochets(Mot$, Increment as Integer, LongMot as Integer) as String
' Cherche s'il existe "left", "right" ou "\" devant un crochet. Dans le cas contraire, insere "\" devant le crochet
' afin que OpenOffice ne cherche pas des paires de crochets. Utile si on ecrit des intervalles du type [1;2[,
' car les crochets ne vont pas par paires.
Dim sMot$
Dim bAmodif as Boolean
sMot=Mot
bAmodif = True
If Increment >= 5 Then
If Mid(sMot,Increment-4,4)="left" Then bAmodif = False
Endif
If Increment >= 6 Then
If Mid(sMot,Increment-5,5)="right" Then bAmodif = False
Endif
If Increment >= 2 Then
If Mid(sMot,Increment-1,1)="\" Then bAmodif = False
Endif
If bAmodif=True Then
sMot=InsereTexte(sMot,Increment-1,"\")
Increment=Increment+1
LongMot=LongMot+1
Endif
GereCrochets=sMot
End Function
Function GereFractions(Mot$,Increment as Integer,LongMot as Integer) as String
' Jerome Ortais version du 06 janvier 2006
' Transforme le caractere "/" en "over" pour ecrire des fractions.
Dim sMot$
Dim OldIncrement as Integer
sMot=Mot
OldIncrement = Increment
If bFractions Then rem bFractions = True si l'option du Checkbox 17 est activee 2*1/3 = 2 fois 1/3
Dim Debut as Integer,Fin as Integer
' Cherche le début du numerateur pour le delimiter par "{"
Debut=FinCalcul(sMot,Increment,False)
' Cherche la fin du dénominateur pour le délimiter par "}"
Fin=FinCalcul(sMot,Increment,True)
sMot=InsereTexte(sMot,Fin,"}}")
sMot=InsereTexte(sMot,Debut,"{{")
' Decale le curseur de 1 pour compenser l'ajout de "{" en debut de fraction
Increment=Increment+2
sMot=Mid(sMot,1,Increment-1)+"}over{"+Mid(sMot,Increment+1)
' Ajoute les caracteres "{", "}over{" et "}" moins le caractere "/" qui a ete supprime
' au nombre de caracteres du sMot
Increment=Increment+5
LongMot=Len(sMot)
GereFractions=sMot
Else
sMot = Mid(sMot,1,Increment-1)+" over "+Mid(sMot,Increment+1)
GereFractions= sMot
Increment=Increment+5
LongMot=Len(sMot)
EndIf
Increment = RecalculeIncrement(sMot,OldIncrement,Increment)
End Function
Function RecalculeIncrement(TheMot as String, no, na as integer) as Integer
rem macro ecrite le 30 aout 2010. Corrige certains bugs apparus ...
Dim Conv as Variant
Dim var as Integer
Conv = Array("e","i","j","[","]","^","pi","(","/",")","<=",">=","inf","...","env","equ","dif","app","nap","union","intersection")
var = na '+1
For I = LBound(Conv) to UBound(Conv)
If InStr(no,TheMot,Conv(I)) > 0 and InStr(no,TheMot,Conv(I)) < na Then
na = InStr(no,TheMot,Conv(I))
Endif
Next I
RecalculeIncrement = na
End Function
Function SupprimeDoublons(sMot$) as String
Dim sTexte$, iPos%, iPosDoublon%, iPosOuverture%
sTexte=sMot
iPos=InStr(sTexte,"{{")
While iPos>0
iPosDoublon=InStr(iPos,sTexte,"}") ' Position d'une accolade fermante
iPosOuverture=InStr(iPos+2,sTexte,"{") ' Position d'une accolade ouvrante après les {{
While iPosOuverture<iPosDoublon And iPosOuverture>0' Une accolade ouvrante entre les {{ et le }
iPosDoublon=InStr(iPosDoublon+1,sTexte,"}") ' On cherche l'accolade } suivante
iPosOuverture=InStr(iPosOuverture+1,sTexte,"{") ' On cherche l'accolade { suivante
WEnd
If iPosDoublon>0 And Mid(sTexte,iPosDoublon,2)="}}" Then
If iPosDoublon+1<Len(sTexte) Then
' Cas où il y a qqchose d'écrit après le }}
sTexte=Mid(sTexte,1,iPos)+Mid(sTexte,iPos+2,iPosDoublon-iPos-1)+Mid(sTexte,iPosDoublon+2)
Else
' Cas où il n'y a rien d'écrit après le }}
sTexte=Mid(sTexte,1,iPos)+Mid(sTexte,iPos+2,iPosDoublon-iPos-1)
EndIf
iPos=InStr(iPos, sTexte,"{{")
Else
iPos=InStr(iPos+1,sTexte,"{{")
EndIf
WEnd
SupprimeDoublons=sTexte
End Function
Function Dixio(Mot as string) as String
rem macro validee le 3 janvier 03
Dim sMot$
Dim LongMot as integer
Dim bNorme as Boolean
sMot=Mot
LongMot=Len(sMot)
On error resume next
For Increment=1 to LongMot
If Mid(sMot,Increment,2)="__" Then
sMot=Mid(sMot,1,Increment-1)+" lsub "+Mid(sMot,Increment+2)
Increment=Increment+4
LongMot=LongMot+4
Endif
If Mid(sMot,Increment,2)="^^" Then
sMot=Mid(sMot,1,Increment-1)+" lsup "+Mid(sMot,Increment+2)
Increment=Increment+4
LongMot=LongMot+4
Endif
Select Case Mid(sMot,Increment,1)
' Teste la valeur du caractere a la position Increment :
Case "0","1","2","3","4","5","6","7","8","9"
If bChiffresDroits = True Then sMot=ChiffresDroits(sMot,Increment,LongMot)
Case "e"
If bEdroit = True Then sMot=GereDroit("e",sMot,Increment,LongMot)
Case "i"
If bIdroit = True Then sMot=GereDroit("i",sMot,Increment,LongMot)
Case "j"
If bIdroit = True Then sMot=GereDroit("j",sMot,Increment,LongMot)
Case "&"
GereEsperluettes(sMot,Increment,LongMot)
Case "/"
sMot=GereFractions(sMot,Increment,LongMot)
Case "[", "]"
sMot=GereCrochets(sMot,Increment,LongMot)
Case "^"
sMot=GereExposant(sMot,Increment,LongMot)
End Select
'remplace le pi
If Increment<LongMot and Mid(sMot,Increment,2)="pi" Then '1 if
If Increment=1 Then
sMot="%pi "+Mid(sMot,3)
LongMot=LongMot+2
Increment=4
ElseIf Mid(sMot,Increment-1,1)<>"%" Then
sMot=Mid(sMot,1,Increment-1)+" %pi "+Mid(sMot,Increment+2)
Increment=Increment+4
LongMot=LongMot+3
Endif
Endif
' gère infini
If Increment<LongMot-1 and Mid(sMot,Increment,3)="inf" and Mid(sMot,Increment+3,1)<>"i" Then
sMot=Mid(sMot,1,Increment-1)+"infinity "+Mid(sMot,Increment+3)
Increment=Increment+4
LongMot=LongMot+6
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="..." Then
sMot=Mid(sMot,1,Increment-1)+"dotslow"+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+4
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="env" Then
sMot=Mid(sMot,1,Increment-1)+" approx "+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+5
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="equ" Then
sMot=Mid(sMot,1,Increment-1)+" dlrarrow "+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+7
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="dif" Then
sMot=Mid(sMot,1,Increment-1)+" <> "+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+1
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="app" Then
sMot=Mid(sMot,1,Increment-1)+" in "+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+1
Endif
If Increment<LongMot-1 and Mid(sMot,Increment,3)="nap" Then
sMot=Mid(sMot,1,Increment-1)+" notin "+Mid(sMot,Increment+3)
Increment=Increment+3
LongMot=LongMot+4
Endif
rem Gère <= et >=
If Increment<LongMot and Mid(sMot,Increment,2)="<=" Then
sMot=Mid(sMot,1,Increment-1)+" leslant "+Mid(sMot,Increment+2)
Increment=Increment+2
LongMot=LongMot+7
Endif
If Increment<LongMot and Mid(sMot,Increment,2)=">=" Then
sMot=Mid(sMot,1,Increment-1)+" geslant "+Mid(sMot,Increment+2)
Increment=Increment+2
LongMot=LongMot+7
Endif
'Gère les signes - et + et = et ; en mode formules espacees
If bFormulesEspacees = TRUE or bSystemesEspaces = TRUE Then
If (Mid(sMot,Increment,1)="-" or Mid(sMot,Increment,1)="+" or Mid(sMot,Increment,1)="=" or Mid(sMot,Increment,1)=";" or Mid(sMot,Increment,1)="<" or Mid(sMot,Increment,1)=">") and Mid(sMot,Increment+1,1)="=" Then
sMot=Mid(sMot,1,Increment-1)+"`"+Mid(sMot,Increment,2)+"`"+Mid(sMot,Increment+2)
Increment=Increment+3
LongMot=LongMot+2
Endif
If (Mid(sMot,Increment,1)="-" or Mid(sMot,Increment,1)="+" or Mid(sMot,Increment,1)="=" or Mid(sMot,Increment,1)=";" or Mid(sMot,Increment,1)="<" or Mid(sMot,Increment,1)=">") and Mid(sMot,Increment+1,1)<>"=" Then
sMot=Mid(sMot,1,Increment-1)+"`"+Mid(sMot,Increment,1)+"`"+Mid(sMot,Increment+1)
Increment=Increment+2
LongMot=LongMot+2
Endif
Endif
'Gère les parenthèses et les normes et les va et les factoriels
TraitNoVa(sMot,Increment,LongMot,bNorme)
' print "après",sMot,Increment,LongMot,Mid(sMot,Increment,1)
Next Increment
bSystemesEspaces = FALSE
sMot= Dixio2(sMot)
If bGrandesParentheses = TRUE Then
Dim sMotPro as String
Dim iNbreSymbol as integer
If Instr(sMot,"union") > 0 Then
iNbreSymbol = 1
sMotPro = sMot
sMot = ""
Do until IndexChaine(sMotPro,iNbreSymbol,"{}union") = 0
sMot = sMot+Dixio3(Mid(sMotPro,IndexChaine(sMotPro,iNbreSymbol-1,"union"),IndexChaine(sMotPro,iNbreSymbol,"union")-IndexChaine(sMotPro,iNbreSymbol-1,"union")))
iNbreSymbol = iNbreSymbol + 1
Loop
sMot = sMot + Dixio3(Mid(sMotPro,IndexChaine(sMotPro,iNbreSymbol-1,"union"),Len(sMotPro)-IndexChaine(sMotPro,iNbreSymbol-1,"union")+1))
Elseif Instr(sMot,"intersection") > 0 Then
iNbreSymbol = 1
sMotPro = sMot
sMot = ""
Do until IndexChaine(sMotPro,iNbreSymbol,"{}intersection") = 0
sMot = sMot+Dixio3(Mid(sMotPro,IndexChaine(sMotPro,iNbreSymbol-1,"intersection"),IndexChaine(sMotPro,iNbreSymbol,"intersection")-IndexChaine(sMotPro,iNbreSymbol-1,"intersection")))
iNbreSymbol = iNbreSymbol + 1
Loop
sMot = sMot + Dixio3(Mid(sMotPro,IndexChaine(sMotPro,iNbreSymbol-1,"intersection"),Len(sMotPro)-IndexChaine(sMotPro,iNbreSymbol-1,"intersection")+1))
Elseif bExecCoordColonne = FALSE or (bVecteur = False and bMesureAlg = False) Then
sMot = Dixio3(sMot)
Endif
Endif
rem reinitialse les boolean
bVecteur=False
bAngle=False
bMesureAlg=False
Dixio = sMot
End Function
rem fin de Dixio
Function Dixio2 (Mot as String) 'traitement des caractères particuliers cree le 22 octobre 2004, modifie le 15 novembre 2008
Dim Conv2,Conv3,Conv4 as Variant
Dim LongueurMot as Integer
Dim CaracteresSpeciaux$
CaracteresSpeciaux="ℂ≠∅≃⇔ℕℚℝℤ∃⇒⊂∞∩∉⊄⊥∀°∪:;÷∧²≈~|×*"
If iLang = 0 Then
If bXpointaulieux Then
Conv2 = Array("%alpha "," in ","%bêta "," setC ","%delta ","%DELTA ","%différent "," emptyset "," simeq ","%epsilon "," dlrarrow ","%êta "," rightarrow ","%gamma ","%GAMMA "_
," setN "," setQ "," setR "," setZ "," exists "," drarrow "," subset "," leslant "," infinity "," {}intersection ","%lambda ","%LAMBDA ","%mu "," notin "," nsubset "_
,"%nu ","%oméga ","%OMÉGA "," ortho ","%varphi ","%PHI ","%pi ","%PI ","%psi ","%PSI "," forall ","%rhô "," circ ","%sigma ","%SIGMA "," geslant ","%tau "_
,"%thêta ","%THÊTA "," {}union ","%xi ","%XI "," nitalic: "," nitalic; "," div "," and ","^2"," approx "," sim ","%phi"," divides "," cdot "," cdot ")
Else
Conv2 = Array("%alpha "," in ","%bêta "," setC ","%delta ","%DELTA ","%différent "," emptyset "," simeq ","%epsilon "," dlrarrow ","%êta "," rightarrow ","%gamma ","%GAMMA "_
," setN "," setQ "," setR "," setZ "," exists "," drarrow "," subset "," leslant "," infinity "," {}intersection ","%lambda ","%LAMBDA ","%mu "," notin "," nsubset "_
,"%nu ","%oméga ","%OMÉGA "," ortho ","%varphi ","%PHI ","%pi ","%PI ","%psi ","%PSI "," forall ","%rhô "," circ ","%sigma ","%SIGMA "," geslant ","%tau "_
,"%thêta ","%THÊTA "," {}union ","%xi ","%XI "," nitalic: "," nitalic; "," div "," and ","^2"," approx "," sim ","%phi"," divides "," times "," times ")
Endif
Else
If bXpointaulieux Then
Conv2 = Array("%alpha "," in ","%beta "," setC ","%delta ","%DELTA ","%different "," emptyset "," simeq ","%epsilon "," dlrarrow ","%eta "," rightarrow ","%gamma ","%GAMMA "_
," setN "," setQ "," setR "," setZ "," exists "," drarrow "," subset "," leslant "," infinity "," {}intersection ","%lambda ","%LAMBDA ","%mu "," notin "," nsubset "_
,"%nu ","%omega ","%OMEGA "," ortho ","%varphi ","%PHI ","%pi ","%PI ","%psi ","%PSI "," forall ","%rho "," circ ","%sigma ","%SIGMA "," geslant ","%tau "_
,"%theta ","%THETA "," {}union ","%xi ","%XI "," nitalic: "," nitalic; "," div "," and ","^2"," approx "," sim ","%phi"," divides "," cdot "," cdot ")
Else
Conv2 = Array("%alpha "," in ","%beta "," setC ","%delta ","%DELTA ","%different "," emptyset "," simeq ","%epsilon "," dlrarrow ","%eta "," rightarrow ","%gamma ","%GAMMA "_
," setN "," setQ "," setR "," setZ "," exists "," drarrow "," subset "," leslant "," infinity "," {}intersection ","%lambda ","%LAMBDA ","%mu "," notin "," nsubset "_
,"%nu ","%omega ","%OMEGA "," ortho ","%varphi ","%PHI ","%pi ","%PI ","%psi ","%PSI "," forall ","%rho "," circ ","%sigma ","%SIGMA "," geslant ","%tau "_
,"%theta ","%THETA "," {}union ","%xi ","%XI "," nitalic: "," nitalic; "," div "," and ","^2"," approx "," sim ","%phi"," divides "," times "," times ")
Endif
Endif
LongueurMot = Len(Mot)
Conv3 = Array("argsh","argch","argth","DEF","GG'","and","IM","IN","RE","or","sh","ch","th")
Conv4 = Array("func argsh","func argch","func argth","%DEF","%GG'"," and ","%IM","%IN","%RE"," or ","func sh","func ch","func th")
Rem a ranger dans lordre decroissant des longueurs
rem macro corrigee le 25 septembre 2010 par Didier DP
For I=1 To LongueurMot
For J= LBound(Conv3()) To UBound(Conv3())
If Mid(Mot,I,Len(Conv3(J))) = Conv3(J) Then
Mot = Mid(Mot,1,I-1)+Conv4(J)+Mid(Mot,I+Len(Conv3(J)),LongueurMot-I-Len(Conv3(J))+1)
I = I + Len(Conv4(J)) '- Len(Conv3(J))
'Print I, J, Mot,LongueurMot
LongueurMot = LongueurMot + Len(Conv4(J))-Len(Conv3(J))
Exit For
Endif
Next J
Next I
rem modifie le 15 novembre 2008
LongueurMot = Len(Mot)
For I=1 to LongueurMot
J=InStr(CaracteresSpeciaux,Mid(Mot,I,1))-1
If J>=0 Then
If ((bVecteur = True or bAngle= True or bMesureAlg=True) and (InStr(Conv2(J),"%") > 0 or Mid(Mot,I,1)=";") ) Then
If Not (Mid(Mot,I,1)=";" and bExecCoordColonne = TRUE and (bVecteur=True or bMesureAlg = True)) Then
Mot = Mid(Mot,1,I-1)+"{"+Conv2(J)+"}"+Mid(Mot,I+1,LongueurMot-I)
I = I + Len(Conv2(J)) + 1
LongueurMot = LongueurMot + Len(Conv2(J))+1
Endif
Else
Mot = Mid(Mot,1,I-1)+Conv2(J)+Mid(Mot,I+1,LongueurMot-I)
I = I + Len(Conv2(J)) - 1
LongueurMot = LongueurMot + Len(Conv2(J))-1
Endif
EndIf
Next I
rem la macro dixio 4 traite les chaines contenant une lettre grecque et un vecteur ou un angle ou une mesure algébrique
If (Instr(Mot,"%")>0 or ((bVecteur = True or bAngle= True or bMesureAlg=True) and Instr(Mot,"_") > 0)) Then Dixio4(Mot)
rem traite le cas du souligne
' Ajout de Jérôme Ortais le 08 janvier 2006
Mot=SupprimeDoublons(Mot)
Dixio2=Mot
End Function
rem fin de dixio 2
Function Dixio3 (Mot as String) as String rem transforme les () en parenthèses variables
Dim iNiveauxParentheses, iNiveauxParenthesesPro, iNiveauParentheseMax, LongueurMot, iPosVar as Integer
Dim iNbreOver,iPosOver as Integer
LongueurMot = Len(Mot)
iNbreOver = 1
rem traitement de la chaine
Do while IndexChaine(Mot,iNbreOver,"over") > 0 and (Instr(Mot,"(") > 0 or Instr(Mot,"]") > 0 or Instr(Mot,"[") > 0)
iPosOver = IndexChaine(Mot,iNbreOver,"over")
rem recherche a droite
iPosVar = iPosOver
iNiveauxParentheses = 0
iNiveauxParenthesesPro = 0
Do until iPosVar = LongueurMot + 1 rem or iNiveauxParentheses = iNiveauParentheseMax
If Mid(Mot,iPosVar,1)=")" or Mid(Mot,iPosVar,1)="]" Then iNiveauxParenthesesPro = iNiveauxParenthesesPro+1
If Mid(Mot,iPosVar,1)="(" or Mid(Mot,iPosVar,1)="[" Then iNiveauxParenthesesPro = iNiveauxParenthesesPro-1
If iNiveauxParenthesesPro > iNiveauxParentheses Then
iNiveauxParentheses = iNiveauxParentheses + 1
If iPosVar<6 Then
If Mid(Mot,iPosVar,1)<>"[" Then
Mot = Mid(Mot,1,iPosVar-1)+"right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Else
Mot = Mid(Mot,1,iPosVar-2)+"right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Endif
LongueurMot = LongueurMot+5
iPosVar = iPosVar + 5
Elseif Mid(Mot,iPosVar-5,5)<>"right" Then
If Mid(Mot,iPosVar,1)<>"]" Then
Mot = Mid(Mot,1,iPosVar-1)+" right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Else
Mot = Mid(Mot,1,iPosVar-2)+" right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Endif
LongueurMot = LongueurMot+6
iPosVar = iPosVar + 6
Endif
Endif
iPosVar = iPosVar + 1
Loop
rem crochet envers a droite
If iNiveauxParentheses = 0 Then
iPosVar = iPosOver
Do until iPosVar = Len(Mot)+1
If Mid(Mot,iPosVar,1)="[" Then
If iPosVar < 6 Then
Mot = Mid(Mot,1,iPosVar-2)+"right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
LongueurMot = LongueurMot+5
Elseif Mid(Mot,iPosVar-5,5)<>"right" and Mid(Mot,iPosVar-4,4)<>"left" Then 'modif
Mot = Mid(Mot,1,iPosVar-2)+" right"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
LongueurMot = LongueurMot+6
Endif
iPosVar = Len(Mot)
Endif
iPosVar = iPosVar + 1
Loop
Endif
rem recherche a gauche
iNiveauxParentheses = 0
iNiveauxParenthesesPro = 0
iPosVar = iPosOver
Do until iPosVar = 0
If Mid(Mot,iPosVar,1)="(" or Mid(Mot,iPosVar,1)="[" Then iNiveauxParenthesesPro = iNiveauxParenthesesPro+1
If Mid(Mot,iPosVar,1)=")" or Mid(Mot,iPosVar,1)="]" Then iNiveauxParenthesesPro = iNiveauxParenthesesPro-1
If iNiveauxParenthesesPro > iNiveauxParentheses Then
iNiveauxParentheses = iNiveauxParentheses + 1
If iPosVar<5 Then
If Mid(Mot,iPosVar,1)<>"[" Then
Mot = Mid(Mot,1,iPosVar-1)+" left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Else
Mot = Mid(Mot,1,iPosVar-2)+" left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Endif
LongueurMot = LongueurMot+5
Elseif Mid(Mot,iPosVar-4,4)<>"left" Then
If Mid(Mot,iPosVar,1)<>"[" Then
Mot = Mid(Mot,1,iPosVar-1)+" left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Else
Mot = Mid(Mot,1,iPosVar-2)+" left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
Endif
LongueurMot = LongueurMot+5
Endif
Endif
iPosVar = iPosVar - 1
Loop
rem crochet envers a gauche
If iNiveauxParentheses = 0 Then
iPosVar = iPosOver
Do until iPosVar = 0
If Mid(Mot,iPosVar,1)="]" Then
If iPosVar < 5 Then
Mot = Mid(Mot,1,iPosVar-2)+"left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
LongueurMot = LongueurMot+4
Elseif Mid(Mot,iPosVar-4,4)<>"left" and Mid(Mot,iPosVar-5,5)<>"right" Then
Mot = Mid(Mot,1,iPosVar-2)+" left"+Mid(Mot,iPosVar,LongueurMot-iPosVar+1)
LongueurMot = LongueurMot+5
Endif
iPosVar = 1
Endif
iPosVar = iPosVar - 1
Loop
Endif
iNbreOver = iNbreOver + 1
Loop
Dixio3 = Mot
End Function
Function Dixio4(Mot as String)rem la macro dixio 4 traite les chaines contenant une lettre grecque et (un vecteur ou un angle ou une mesure algébrique)
Dim LongueurMot,iIndex as Integer
rem Print Mot
LongueurMot = Len(Mot)
If (bVecteur = True or bAngle = True) Then
rem Print bVecteur, bAngle
For I = 1 To LongueurMot-6
If (Mid(Mot,I,7)="widevec" or Mid(Mot,I,7)="widehat") Then
iIndex = I+9
Do until ((iIndex > I+12 and Mid(Mot,iIndex,1)=" " and Mid(Mot,iIndex+1,1)<>"{") or Mid(Mot,iIndex,1)="∧" or Mid(Mot,iIndex,1)="+" or Mid(Mot,iIndex,1)="=" or Mid(Mot,iIndex,1)="-" or Mid(Mot,iIndex,1)="(" or Mid(Mot,iIndex,1)=")" or (Mid(Mot,iIndex,1)="{" and Mid(Mot,iIndex+1,1)<>"%" and SiChiffre(Mid(Mot,iIndex+1,1))=False) or iIndex = LongueurMot+1)
iIndex = iIndex + 1
Loop
rem Print Len(Mot),Mot+" ",Mid(Mot,I,5)+" ",Mid(Mot,iIndex,1),Instr(Mid(Mot,I+8,iIndex-I-8),"%"),I,iIndex
If (Instr(Mid(Mot,I+8,iIndex-I-8),"%") > 0 or Instr(Mid(Mot,I+8,iIndex-I-8),"_")>0) Then
Mot = Mid(Mot,1,I+6)+"{"+Mid(Mot,I+7,iIndex-I-7)+"}"+Mid(Mot,iIndex,LongueurMot-iIndex+1)
LongueurMot = LongueurMot + 2
Endif
I = iIndex
Endif
Next I
Endif
If bMesureAlg = True Then
For I = 1 To LongueurMot-7
If Mid(Mot,I,8)="overline" Then
iIndex = I+10
Do until ((iIndex > I+13 and Mid(Mot,iIndex,1)=" " and Mid(Mot,iIndex+1,1)<>"{") or Mid(Mot,iIndex,1)="+" or Mid(Mot,iIndex,1)="=" or Mid(Mot,iIndex,1)="-" or Mid(Mot,iIndex,1)="(" or Mid(Mot,iIndex,1)=")" or (Mid(Mot,iIndex,1)="{" and Mid(Mot,iIndex+1,1)<>"%" and SiChiffre(Mid(Mot,iIndex+1,1))=False) or iIndex = LongueurMot+1)
iIndex = iIndex + 1
Loop
If (Instr(Mid(Mot,I+9,iIndex-1),"%") > 0 or Instr(Mid(Mot,I+9,iIndex-1),"_") > 0) Then
Mot = Mid(Mot,1,I+7)+"{"+Mid(Mot,I+8,iIndex-I-8)+"}"+Mid(Mot,iIndex,LongueurMot-iIndex+1)
LongueurMot = LongueurMot + 2
Endif
I = iIndex
Endif
Next I
Endif
End Function
Sub RepereGraphique
oBoite = LoadDialog("Dmaths","Repere")
'Xray.Xray oBoite.GetControl("CommandButton1")
oBoite.GetControl("CommandButton1").SetFocus()
oBoite.Execute
End Sub
Sub InsereRepereOij
InsereRepere("O","i","j","")
End Sub
Sub InsereRepereOijk
InsereRepere("O","i","j","k")
End Sub
Sub InsereRepereOuv
InsereRepere(oBoite.GetControl("TextField1").Peer.Text,oBoite.GetControl("TextField2").Peer.Text,oBoite.GetControl("TextField3").Peer.Text,oBoite.GetControl("TextField4").Peer.Text)
oBoite.EndExecute()
End Sub
Sub InsereRepere(st1,st2,st3,st4 as String) rem macro modifiée le 25 janvier 2007 par Didier Dorange-Pattoret
Dim sSource as String
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument= oDesktop.getCurrentComponent()
oText = oDocument.Text
oVCursor = oDocument.currentcontroller.getViewCursor()
oTextActif = oVcursor.Text
oCursor = oTextActif.createTextCursorByRange(oVCursor)
sSource = "("
If bItalic Then sSource = sSource + " italic "
sSource = sSource & st1 + " nitalic ; ` widevec {"
If bVecteursItalic Then sSource = sSource + " italic{"
sSource = sSource & st2
If bVecteursItalic Then sSource = sSource + "}"
sSource = sSource & "} nitalic , widevec {"
If bVecteursItalic Then sSource = sSource + " italic{"
sSource = sSource & st3
If bVecteursItalic Then sSource = sSource + "}"
sSource = sSource & "}"
If st4 = "" Then
sSource = sSource & ")"
Else
sSource = sSource & "nitalic , widevec {"
If bVecteursItalic Then sSource = sSource + " italic{"
sSource = sSource & st4
If bVecteursItalic Then sSource = sSource + "}"
sSource = sSource &"})"
EndIf
sSource = TraiteVecWidevec(sSource) rem change si besoin widevec en vec
iTailleDElaFormule = oVCursor.CharHeight rem la taille est provisoirement celle du caractère précédent la formule.
sNomPolice = oVCursor.CharFontName rem memorise la police du curseur.
If Not bTailleFormCarac Then iTailleDElaFormule = iTailleFormules
WriteFormula(oDocument,oVCursor,oCursor,sSource,iTailleDElaFormule,sNomPolice)
End Sub
Sub FinRepereGraphique
oBoite.EndExecute()
End Sub
Sub FractionGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Quotient")
Set oTextIndex=oBoite.Model.TextField1
oBoite.execute()
End Sub
Sub InsereFraction rem macro validee le 11 novembre 2003 / GF mai 2007 / DDP 15 novembre 2009
Dim Test as string
Dim oText1 as string
IsFormuleItalic = bItalic
Test="{" + oBoite.getControl("TextField1").Peer.Text + "}" + " over " + "{" + oBoite.getControl("TextField2").Peer.Text + "}"
If Form = True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Test+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout=Test
Else
Test = Dixio(Test)
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub VecteurGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Vecteur")
Set oTextIndex=oBoite.Model.TextField1
oBoite.execute()
End Sub
Sub InsereVecteur rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP 15 novembre 2009
Dim Test,Coord as string
Dim tCoordColonne as Boolean
IsFormuleItalic = bVecteursItalic
' Print bVecteurItalic
Test = oBoite.getControl("TextField2").Peer.Text
If oBoite.Model.CheckBox1.State=1 Then tCoordColonne = TRUE Else tCoordColonne = FALSE
If oBoite.getControl("TextField1").Peer.Text<>"" Then Test = Test + " widevec {" + oBoite.getControl("TextField1").Peer.Text + "} "
If oBoite.getControl("TextField3").Peer.Text<>"" and tCoordColonne = FALSE Then 'GF
Test = Test + " (" + oBoite.getControl("TextField3").Peer.Text
If oBoite.getControl("TextField4").Peer.Text<>"" Then Test = Test + ";" + oBoite.getControl("TextField4").Peer.Text
If oBoite.getControl("TextField5").Peer.Text<>"" Then Test = Test + ";" + oBoite.getControl("TextField5").Peer.Text
Test=Test+" )"
ElseIf oBoite.getControl("TextField3").Peer.Text<>"" and tCoordColonne = TRUE Then 'GF
Test = Test + " left(matrix{" + oBoite.getControl("TextField3").Peer.Text
If oBoite.getControl("TextField4").Peer.Text<>"" Then Test = Test + "##" + oBoite.getControl("TextField4").Peer.Text
If oBoite.getControl("TextField5").Peer.Text<>"" Then Test = Test + "##" + oBoite.getControl("TextField5").Peer.Text
Test=Test+" }right)"
Endif
If oBoite.Model.CheckBox2.State=1 Then Test="abs{abs{"+Test+"}}"
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Test+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
bVecteur = True
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub BarreGraphique rem macro validee le 3 janvier 2003 ' GF : et angle graphique
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Barre")
Set oTextIndex=oBoite.Model.TextField2
oBoite.Model.OptionButton1.State=1 rem default=barre 'GF
oBoite.execute()
End Sub
Sub InsereBarre rem macro validee le 16 novembre 2003 ' GF : et insereangle / GF mai 2007 / DDP novmebre 2009
Dim Test as string
Test = oBoite.getControl("TextField1").Peer.Text
If oBoite.Model.OptionButton1.State=1 Then
Test = Test + " overline " + oBoite.getControl("TextField2").Peer.Text
IsFormuleItalic = bMesuresAlgItalic
Else
Test = Test + " widehat " + oBoite.getControl("TextField2").Peer.Text
IsFormuleItalic = bAnglesItalic
Endif
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN) + " " + Test +" " + Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout=Test
Else
Test = Dixio(Test)
bMesureAlg = True
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub AngleGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Angle")
Set oTextIndex = oBoite.Model.TextField2
oBoite.execute()
End Sub
Sub InsereAngle rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP novembre 2009
Dim Test as string
IsFormuleItalic = bAnglesItalic
Test = oBoite.getControl("TextField1").Peer.Text
Test = Test + " widehat " + oBoite.getControl("TextField2").Peer.Text
If Form = True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Test+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
bAngle = True
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub AngleVecteurGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Anglevec")
oBoite.Model.OptionButton3.State=1 rem default=anglevec
Set oTextIndex=oBoite.Model.TextField2
oBoite.execute()
End Sub
Sub InsereAngleVecteur rem macro validee le ??? / GF mai 2007 / DDP novembre 2009
Dim Test,Test1 as string
Dim tCoordColonne as Boolean
IsFormuleItalic = bVecteursItalic
If oBoite.Model.CheckBox3.State=1 Then tCoordColonne = TRUE Else tCoordColonne = FALSE
Test = oBoite.getControl("TextField1").Peer.Text 'coeff1
If oBoite.getControl("TextField2").Peer.Text<>"" Then 'name1
Test = Test + " widevec {" + oBoite.getControl("TextField2").Peer.Text + "} "
Else
If oBoite.getControl("TextField5").Peer.Text<>"" and tCoordColonne = FALSE Then
Test = Test +" (" + oBoite.getControl("TextField5").Peer.Text
If oBoite.getControl("TextField6").Peer.Text<>"" Then Test = Test + ";" + oBoite.getControl("TextField6").Peer.Text
If oBoite.getControl("TextField7").Peer.Text<>"" Then Test = Test + ";" + oBoite.getControl("TextField7").Peer.Text
Test = Test + " )"
ElseIf oBoite.getControl("TextField5").Peer.Text<>"" and tCoordColonne = TRUE Then
Test = Test + " left(matrix{" + oBoite.getControl("TextField5").Peer.Text
If oBoite.getControl("TextField6").Peer.Text<>"" Then Test = Test + "##" + oBoite.getControl("TextField6").Peer.Text
If oBoite.getControl("TextField7").Peer.Text<>"" Then Test = Test + "##" + oBoite.getControl("TextField7").Peer.Text
Test = Test + " }right)"
Endif
EndIf
Test1 = oBoite.getControl("TextField3").Peer.Text 'coeff2
If oBoite.getControl("TextField4").Peer.Text<>"" Then 'name2
Test1 = Test1 + " widevec {" + oBoite.getControl("TextField4").Peer.Text + "} "
Else
If oBoite.getControl("TextField8").Peer.Text<>"" and tCoordColonne = FALSE Then
Test1 = Test1 + " (" + oBoite.getControl("TextField8").Peer.Text
If oBoite.getControl("TextField9").Peer.Text<>"" Then Test1 = Test1 + ";" + oBoite.getControl("TextField9").Peer.Text
If oBoite.getControl("TextField10").Peer.Text<>"" Then Test1 = Test1 + ";" + oBoite.getControl("TextField10").Peer.Text
Test1 = Test1 + " )"
ElseIf oBoite.getControl("TextField8").Peer.Text<>"" and tCoordColonne = TRUE Then
Test1 = Test1 + " left(matrix{" + oBoite.getControl("TextField8").Peer.Text
If oBoite.getControl("TextField9").Peer.Text<>"" Then Test1 = Test1 + "##" + oBoite.getControl("TextField9").Peer.Text
If oBoite.getControl("TextField10").Peer.Text<>"" Then Test1 = Test1 + "##" + oBoite.getControl("TextField10").Peer.Text
Test1 = Test1 + " }right)"
Endif
EndIf
If oBoite.Model.OptionButton2.State=1 Then
Test="{"+Test+"} cdot {"+Test1+"}"
ElseIf oBoite.Model.OptionButton1.State=1 Then
If iLang<>2 Then Test="{"+Test+"} AND {"+Test1+"}" Else Test="{"+Test+"} times {"+Test1+"}"
Else Test = "widehat ( " + Test +" ; " + Test1 + " )"
Endif
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN) + " " + Test + " " + Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
bAngle = True
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub LimiteGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Limite")
Set oTextIndex=oBoite.Model.TextField2
oBoite.execute()
End Sub
Sub InsereLimite rem macro validee le 16 novembre 2003 / GF mai 2007
Dim Test,Test1 as string
IsFormuleItalic = bItalic
Test = oBoite.getControl("TextField3").Peer.Text
Test="{"+Test+"}"
Test1 = oBoite.getControl("TextField2").Peer.Text
Test="lim from{" + oBoite.getControl("TextField1").Peer.Text + " rightarrow " + Test1 + "}" + Test
If Form=True Then
oText1 = oBoiteFormuleGraphique.GetControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Test+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible=True
Elseif Form2=True Then
sAjout = Test
Else
Test = Dixio(Test)
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form=True Then
oTextIndex = oBoiteFormuleGraphique.GetControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub IntegraleGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Integrale")
Set oTextIndex=oBoite.Model.TextField2
oBoite.Model.OptionButton3.State=1 rem default:Integral
oBoite.execute()
End Sub
Sub BoutonDIntegraleGraphique rem macro validee le 3 janvier 2003
If Integrale.CheckBox3.Value=True Then MetenSomme Else MetenIntegrale
End Sub
Sub SommeGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Integrale")
Set oTextIndex=oBoite.Model.TextField1
oBoite.Model.CheckBox2.State=1
oBoite.Model.TextField1.Text="i"
oBoite.Execute()
End Sub
Sub ProduitGraphique rem macro enregistrée le 10 decembre 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Integrale")
Set oTextIndex=oBoite.Model.TextField1
oBoite.Model.CheckBox1.State=1
oBoite.Model.TextField1.Text="i"
oBoite.Execute()
End Sub
Sub InsereIntegrale rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP novembre 2009
Dim Test,Test1 as string
IsFormuleItalic = bItalic
Test = oBoite.getControl("TextField4").Peer.Text
Test = "{" + Test + "}"
If Test1<>"" Then Test = "{" + Test + " over {" + Test1 + "}}"
If oBoite.getControl("TextField1").Peer.Text<>" " and oBoite.getControl("TextField1").Peer.Text<>"" and oBoite.Model.OptionButton1.State=0 and oBoite.Model.OptionButton2.State=0 then Test = Test + " nitalic{d}" + oBoite.getControl("TextField1").Peer.Text
Test1 = oBoite.getControl("TextField3").Peer.Text
Test = " " + sBorneSupIntegrales +" {" +Test1 +"} " + Test
Test1 = oBoite.getControl("TextField2").Peer.Text
If (oBoite.Model.OptionButton2.State=1 or oBoite.Model.OptionButton1.State=1) and oBoite.getControl("TextField1").Peer.Text<>"" and Test1<>"" Then Test1 = oBoite.getControl("TextField1").Peer.Text + "=" + Test1
Test= " " + sBorneInfIntegrales +" {" +Test1 +"} " + Test
If oBoite.Model.OptionButton2.State = 1 Then
Test = "sum" + Test
ElseIf oBoite.Model.OptionButton1.State = 1 Then
Test = "prod" + Test
Else Test = "int" + Test
Endif
If Form = True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN) +" " + Test +" " + Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub RacineGraphique rem macro validee le 3 janvier 2003
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","Racine")
Set oTextIndex=oBoite.Model.TextField2
oBoite.execute()
End Sub
Sub InsereRacine rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP novembre 2009
Dim Test,Test1 as string
IsFormuleItalic = bItalic
Test = oBoite.getControl("TextField2").Peer.Text
Test = "{" + Test + "}"
Test1 = oBoite.getControl("TextField1").Peer.Text
Test = "nroot{" + Dixio(Test1) + "}" + Test
If Form = True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN) + " " + Test +" " + Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible=True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Function SystemeGraphique rem macro validee le 3 janvier 2003
Call VerifOperationnel
bSystemesEspaces = bSystemesAlignes
If bSystemesAlignes = True Then
Form1=True ' added by GF 10.5.2007
oMatrice1 = LoadDialog("Dmaths","Matrice1")
oMatrice1.Model.OptionButton4.State=1
SaisieMatrice
Else
Form1=True
Nbrequation=0
Pluslong=0
If Form=True Then oBoiteFormuleGraphique.Visible=False
oBoite = LoadDialog("Dmaths","System2" )
oBoite.Model.TextField6.Text=Nbreequation+1
oBoite.Model.TextField3.Text="="
Set oTextIndex=oBoite.Model.TextField1
oBoite.execute()
Endif
End Function
Function ValideEquation rem macro validee le 3 janvier 2003
Dim Equation,Test as String
Dim LongCourant as Integer
Nbrequation=Nbrequation+1
Test=oBoite.Model.TextField1.Text
oBoite.Model.TextField1.Text=""
Memb1(Nbrequation)="{"+Test+"}"
Test=oBoite.Model.TextField3.Text
Egal(Nbrequation)=Test
Test=oBoite.Model.TextField4.Text
oBoite.Model.TextField4.Text=""
LongCourant=Len(Test)
Memb2(Nbrequation)="{"+Test+"}"
If LongCourant>Pluslong Then PlusLong=LongCourant
oBoite.Model.TextField6.Text=Nbrequation+1
End Function
Sub InsereSysteme rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP novembre 2009
ValideEquation
For I=1 to Nbrequation
For J=1 To PlusLong+2-Len(Memb2(I))
Memb2(I) = "`" + Memb2(I)
Next J
Next I
Equation = "{ "+Memb1(1)+" "+Egal(1)+" "+Memb2(1)+" }"
For I=2 to Nbrequation
Equation = Equation+" `#` { " + Memb1(I) + " " + Egal(I) + " " + Memb2(I) + " }" '2007 GF
Next I
Equation = "alignl left lbrace stack{" + Equation + "} right none"
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Equation+" "+Right(oText1,Len(oText1)-aSel0.MIN)
rem System1.Unload
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2=True Then
sAjout=Equation
Else
Equation = Dixio(Equation)
InsertSourceIntegrale(Equation)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Equation) ' here: not Test
End If
End Sub
Sub MatriceGraphique rem macro validee le 3 janvier 2003
Call VerifOperationnel
bSystemesEspaces = TRUE
Nbrequation=0
Nbrecolonne=0
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible=False
oMatrice1 = LoadDialog("Dmaths","Matrice1" )
oMatrice1.execute()
End Sub
Function SaisieMatrice
oMatrice1.Visible=False
oBoite = LoadDialog("Dmaths","Matrice2" )
If oMatrice1.Model.OptionButton4.State=1 Then REM systeme
oBoite.Model.TextField2.Text="+"
oBoite.Model.TextField4.Text="="
Endif
oMatrice1.Endexecute()
oBoite.execute()
End Function
Sub ValideLigne rem macro validee le 3 janvier 2003 / DDP le 15 novembre 2009
Dim Test as String
oBoite.Getcontrol("TextField1").SetFocus
oBoite.Model.TextField10.Text=Nbrequation+2
Test = oBoite.getControl("TextField1").Peer.Text
Coeff(Nbrequation,0)=Test
oBoite.Model.TextField1.Text=""
Test=oBoite.getControl("TextField2").Peer.Text
Coeff(Nbrequation,1)=Test
If oMatrice1.Model.OptionButton4.State=1 Then
oBoite.Model.TextField2.Text="+"
Else oBoite.Model.TextField2.Text=""
Endif
Test=oBoite.getControl("TextField3").Peer.Text
Coeff(Nbrequation,2)=Test
oBoite.Model.TextField3.Text=""
Test=oBoite.getControl("TextField4").Peer.Text
Coeff(Nbrequation,3)=Test
If oMatrice1.Model.OptionButton4.State=1 Then
oBoite.Model.TextField4.Text="="
Else oBoite.Model.TextField4.Text=""
Endif
Test=oBoite.getControl("TextField5").Peer.Text
Coeff(Nbrequation,4)=Test
oBoite.Model.TextField5.Text=""
Test=oBoite.getControl("TextField6").Peer.Text
Coeff(Nbrequation,5)=Test
oBoite.Model.TextField6.Text=""
Test=oBoite.getControl("TextField7").Peer.Text
Coeff(Nbrequation,6)=Test
oBoite.Model.TextField7.Text=""
Test=oBoite.getControl("TextField8").Peer.Text
Coeff(Nbrequation,7)=Test
oBoite.Model.TextField8.Text=""
Test=oBoite.getControl("TextField9").Peer.Text
Coeff(Nbrequation,8)=Test
' Print Coeff(Nbrequation,8)
oBoite.Model.TextField9.Text=""
Nbrequation=Nbrequation+1
End Sub
Sub InsereMatrice rem macro validee le 16 novembre 2003 / GF mai 2007 / DDP novembre 2009
Dim Matrice as string
' erst mal Schaltflächen deaktivieren
IsFormuleItalic = bItalic
oBoite.getControl( "CommandButton6" ).Enable = 0
oBoite.getControl( "CommandButton5" ).Enable = 0
oBoite.getControl( "CommandButton2" ).Enable = 0
ValideLigne
For I=0 to 8
If Coeff(Nbrequation-1,I)<>"" Then Nbrecolonne = Nbrecolonne+1
Next I
Matrice = "{"
For J=0 to Nbrequation-2
For I=0 to Nbrecolonne-1
Matrice=Matrice+Coeff(J,I)+"`#"
Next I
Matrice=Matrice+"#"
Next J
For I=0 to Nbrecolonne-2
Matrice=Matrice+Coeff(J,I)+"`#"
Next I
Matrice=Matrice+Coeff(Nbrequation-1,Nbrecolonne-1)+"}"
If oMatrice1.Model.OptionButton2.State=1 Then
Matrice=" left( matrix"+Matrice+" right) "
Elseif oMatrice1.Model.OptionButton3.State=1 Then
Matrice="alignl left lbrace matrix"+Matrice+" right rbrace"
Elseif oMatrice1.Model.OptionButton4.State=1 Then
Matrice="alignl left lbrace matrix"+Matrice+" right none"
Elseif oMatrice1.Model.OptionButton5.State=1 Then
Matrice="alignl left lline matrix"+Matrice+" right rline"
Else Matrice=" left[ matrix"+Matrice+" right] "
Endif
If oMatrice1.Model.TextField1.Text<>"" Then Matrice = Matrice+"^{"+ oMatrice1.getControl("TextField1").Peer.Text + "}"
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Matrice+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Matrice
Else
Matrice = Dixio(Matrice)
InsertSourceIntegrale(Matrice)
Endif
Form1 = False
oBoite.Endexecute()
oMatrice1.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Matrice) 'here: not Len(Test)!
End If
End Sub
Sub FormuleGraphique rem macro validee le 3 janvier 2003
Call VerifOperationnel
Form=True
oBoiteFormuleGraphique = LoadDialog("Dmaths","Formul")
oListBox = oBoiteFormuleGraphique.GetControl("ListBox1")
oListBox.selectItemPos(0,True)
oListBox2 = oBoiteFormuleGraphique.GetControl("ListBox2") 'GF
oListBox2.selectItemPos(0,True)
oListBox3 = oBoiteFormuleGraphique.GetControl("ListBox3") 'GF
oListBox3.selectItemPos(0,True)
oTextIndex=oBoiteFormuleGraphique.Model.TextField1
TF = "TextField1"
oBoiteFormuleGraphique.execute()
End sub
Sub FormuleGraphique2 rem macro validee le 3 janvier 2003
Call VerifOperationnel
TF=""
oBoite = LoadDialog("Dmaths","Formul2")
oListbox = oBoite.GetControl("ListBox1")
oListBox.selectItemPos(0,True)
oBoite.execute()
End sub
Sub FormuleBasique rem macro validee le 3 janvier 2003 ' GF mai 2007
If Form=False Then oBoite.Endexecute()
' FormuleGraphique2 sets TF=""
If TF <> "" Then
aSel0 = oBoiteFormuleGraphique.GetControl(TF).Selection 'GF
CursorPos = aSel0.MAX
End If
If oListBox.getSelectedItemPos ()=0 Then FractionGraphique
If oListBox.getSelectedItemPos ()=1 Then RacineGraphique
If oListBox.getSelectedItemPos ()=2 Then LimiteGraphique
If oListBox.getSelectedItemPos ()=3 Then BarreGraphique 'barre et angle
If oListBox.getSelectedItemPos ()=4 Then VecteurGraphique
If oListBox.getSelectedItemPos ()=5 Then IntegraleGraphique 'integrale,somme,produit
If oListBox.getSelectedItemPos ()=6 Then AngleVecteurGraphique 'anglevecteur, produits scal et vect
If oListBox.getSelectedItemPos ()=7 Then SystemeGraphique
If oListBox.getSelectedItemPos ()=8 Then MatriceGraphique
If oListBox.getSelectedItemPos ()=9 Then BinomGraphique
If oListBox.getSelectedItemPos ()=10 Then IsotopeGraphique
If Form Then 'when back from SubDialogue: set focus and selection inside TextField1 GF
TextField1Focuslost
aSel0.MIN = CursorPos + 1
aSel0.MAX = aSel0.MIN
oBoiteFormuleGraphique.GetControl(TF).Selection = aSel0
End If
End Sub
Sub FormuleGrecque rem macro by gfriege janvier 2007
REM %bêta, %êta, %zêta, %thêta, %oméga, %upsilon for the funny french spelling
If Form=False Then oBoite.Endexecute()
Select Case oListBox2.getSelectedItemPos()
Case 0
MetEntre(" %alpha ","")
Case 1
if ilang=0 then
MetEntre(" %bêta ","")
else
MetEntre(" %beta ","")
end if
Case 2
MetEntre(" %gamma ","")
Case 3
MetEntre(" %delta ","")
Case 4
MetEntre(" %epsilon ","")
Case 5
if ilang=0 then
MetEntre(" %zêta ","")
else
MetEntre(" %zeta ","")
end if
Case 6
if ilang=0 then
MetEntre(" %êta ","")
else
MetEntre(" %eta ","")
end if
Case 7
if ilang=0 then
MetEntre(" %thêta ","")
else
MetEntre(" %theta ","")
end if
Case 8
MetEntre(" %jota ","")
Case 9
MetEntre(" %kappa ","")
Case 10
MetEntre(" %lambda ","")
Case 11
MetEntre(" %my ","")
Case 12
MetEntre(" %ny ","")
Case 13
MetEntre(" %xi ","")
Case 14
MetEntre(" %omikron ","")
Case 15
MetEntre(" pi ","") ' % will be added by Dixio e.t.c
Case 16
MetEntre(" %rho ","")
Case 17
MetEntre(" %sigma ","")
Case 18
MetEntre(" %tau ","")
Case 19
if ilang=0 then
MetEntre(" %upsilon ","")
else
MetEntre(" %ypsilon ","")
end if
Case 20
MetEntre(" %phi ","")
Case 21
MetEntre(" %chi ","")
Case 22
MetEntre(" %psi ","")
Case 23
if ilang=0 then
MetEntre(" %oméga ","")
else
MetEntre(" %omega ","")
end if
Case Else
MetEntre(" Error! ","")
End Select
TextField1Focuslost ' give the stolen focus back to TextField1
End Sub
Sub FormuleGrecqueMaj rem macro by gfriege janvier 2007
If Form=False Then oBoite.Endexecute()
Select Case oListBox3.getSelectedItemPos()
Case 0
MetEntre(" %GAMMA ","")
Case 1
MetEntre(" %DELTA ","")
Case 2
MetEntre(" %THETA ","")
Case 3
MetEntre(" %LAMBDA ","")
Case 4
MetEntre(" %XI ","")
Case 5
MetEntre(" %PI ","")
Case 6
MetEntre(" %SIGMA ","")
Case 7
MetEntre(" %YPSILON ","")
Case 8
MetEntre(" %PHI ","")
Case 9
MetEntre(" %PSI ","")
Case 10
MetEntre(" %OMEGA ","")
Case Else
MetEntre(" Error! ","")
End Select
TextField1Focuslost ' give the stolen focus back to TextField1
End Sub
Sub InsereFormuleGraphique rem macro validee le 16 novembre 2003 insere formule boite formule complexe
Dim Formule as string
Formule = Dixio(oBoiteFormuleGraphique.getControl("TextField1").Peer.Text)
If Formule = "" Then
Avertir(7)
Else
InsertSourceIntegrale(Formule)
oBoiteFormuleGraphique.EndExecute()
Form=False
EndIf
End sub
Sub FinFormuleGraphique rem macro validee le 3 janvier 2003
If (Form = True and Form1 = False) Then
oBoiteFormuleGraphique.Endexecute()
Form=False
Elseif Form=True and Form1=True Then
oBoite.Endexecute()
oBoiteFormuleGraphique.Visible=True
Form1=False
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
Else
oBoite.Endexecute()
Form1=False
Endif
End Sub
Sub FinMatriceGraphique rem macro validee le 3 janvier 2003
oMatrice1.Endexecute()
If Form=True Then oBoiteFormuleGraphique.Visible=True
Form1=False
End Sub
Sub InsereBlancGraphique rem macro validee le 3 janvier 2003
oBoiteFormuleGraphique.Model.TextField1.Text= oBoiteFormuleGraphique.getControl("TextField1").Peer.Text+"`"
End Sub
</script:module>
|