This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Module3.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
<?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="Module3" script:language="StarBasic">&apos;************************************************
&apos;Copyright (C) 2010 Didier Dorange-Pattoret
&apos;38, chemin de l&apos;Abbaye  
&apos;74940 Annecy le Vieux
&apos;France
&apos;ddorange@dmaths.com
&apos; amélioré par Jean-Luc Guillot pour le traitement des courbes avec des points hors grille ou hors limite 
&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;************************************************

Public oRepfonctions,oOptions,oRepboites,oGrille,oSheet1,oValeurs,oDocument2 as object
rem oSheet1 est la feuille courante d&apos;un classeur ouvert
Public oTextIndex as Object
Public sFormul(8),sNewFormul(8,1),sNomFonction(8) as String &apos;contient la formule
Public sNewFormulSpline(10,10,1) as String rem contient les formules des splines avec les bornes

Public Tmin(8),Tmax(8),Ymin(8),Ymax(8),NUX,NUY,MargeX,MargeY,LARG,HAUT,Pas as Single
Public Xmin(8),Xmax(8) as String
rem Pas repr?sente le pas du trac? en mm, NUX le nombre d&apos;unit?s par cm en abs
Public Nbrecourbes,NbreMaxcourbes,GraAxeXbas,GraAxeXhaut,GraAxeYbas,GraAxeYhaut,iEfftotal,iNbreValeurs1 as Integer rem iNbreValeurs1 garde le nombre de valeurs pour la proc?dure SauvStat
Public Couleur(30) as Long
Public bParalleleOrdonnees(8),bOntrace,bDiagbox,bCoeff,bError,bParam(8),bGrille,bCalcul,bModif,bNewCalc,bRepreGra as Boolean
rem bParalleleOrdonnees est true si on trace une droite paralléle à l&apos;axe des ordonn?es
rem GraAxebas position basse en points de la graduation de l&apos;axe
rem bDiagbox indique que l&apos;on a lancé la macro statistique, bGrille une grille, bPoints des points, bCalcul on calcule des valeurs
rem bCoeff indique si la série est donn?e avec des coefficients.
rem bParam=True si la courbe est parametrique,bModif=True si on la modifie,bRepreGra si on trace une courbe
Public bRecup as Boolean rem bRecup signifie que la courbe est recuperee
Public aLineShape as Variant
Public oNewCalc,oNewCalcVal,oSheetVal,oCellVal as Object
rem: objets pour la fonction d&apos;?valuation des fonctions
Public oDocument,oNewDocument, oPage as Object
&apos;Private Const CoeffZoom = 1.76
Global oDocumentCourant as Object rem cet objet contient le document courant qui appelle


Rem******************************************************
Rem** Fonctions r�utilisables
Rem******************************************************


Rem LimXY Function trouve le point d&apos;intersection entre le vecteur P1P2
Rem et les bord
Rem attention, renvoie un objet point donc tronque apres la virgule
Function LimXY (P1 as object,P2 as object,Xmin,Xmax,Ymin,Ymax) as object
  dim point as new com.sun.star.awt.Point
  rem Determine le point dedans et le point dehors
  if P1.X&gt;=Xmin and P1.X&lt;=Xmax and P1.Y&gt;=Ymin and P1.Y&lt;=Ymax then
    Xin=P1.X
    Yin=P1.Y
    Xout=P2.X
    Yout=P2.Y
  else
    Xin=P2.X
    Yin=P2.Y
    Xout=P1.X
    Yout=P1.Y
  endif
  If Xout&gt;Xmax or Xout&lt;Xmin then
    If  Xout&gt;Xmax then Xlim=Xmax else Xlim=Xmin
    If Yout&gt;Ymax or Yout&lt;Ymin then
			If  Yout&gt;Ymax then Ylim=Ymax else Ylim=Ymin
			rem doit rechercher la coupure la plus proche avec l&apos;axe des X ou des Y
			rem on essaie par les X
			Din=Xin-Xlim
			DeltaX=Xin-Xout
			DeltaY=Yin-Yout
			XCible=Xlim
			rem un petit coup de talles
			YCible=Yin-Din*DeltaY/DeltaX
			if YCible&gt;Ymax or YCible&lt;Ymin then
				Din=Xin-Xlim
				DeltaX=Xin-Xout
				DeltaY=Yin-Yout
				XCible=Xlim
				rem un petit coup de talles
				YCible=Yin-Din*DeltaY/DeltaX
			end if
		else
			rem doit rechercher la coupure avec une bordure en X
			rem on sait deja que l&apos;abscisse sera Xlim
			Din=Xin-Xlim
			DeltaX=Xin-Xout
			DeltaY=Yin-Yout
			XCible=Xlim
			rem un petit coup de talles
			YCible=Yin-Din*DeltaY/DeltaX  
		end if
  else
		rem doit rechercher la coupure avec une bordure en Y
    rem on sait deja que l&apos;abscisse sera Ylim
    If  Yout&gt;Ymax then Ylim=Ymax else Ylim=Ymin
    Din=Yin-Ylim
    DeltaX=Xin-Xout
    DeltaY=Yin-Yout
    YCible=Ylim
    rem un petit coup de talles
    XCible=Xin-Din*DeltaX/DeltaY
	end if
  point.X=XCible
  point.Y=YCible
  limXY=point  
End Function

Rem *********************************************
Rem Fonctions Tableur
Rem *********************************************
Function GetCell(oTable as Object,co,li as Integer) as com.sun.star.table.xCell			rem mis au point le 3 janvier 2003
	GetCell=oTable.GetCellByPosition(co,li)
End Function

Sub FormaTableau(oSheet as Object,N as Integer)  rem mis au point le 9 avril 2007
	Dim oCell as Object 							rem reinitialise le tableau 
	For Lin=3 To 2+N
		For Col=0 To N
			oCell=GetCell(oSheet,Col,Lin)
			If Lin-Col=3 Then oCell.SetValue(1) Else oCell.SetValue(0)
		Next Col
	Next Lin
	For I=0 To N
		oCell=GetCell(oSheet,40,I+3)
		oCell.SetValue(0)
	Next I 
End Sub


rem *********************************************
rem Fonctions Numeriques, strings et Array
rem *********************************************

Rem PRECISION donne le nombre de chiffres apres le separateur
Rem accepte un champ vide ou un chiffre sinon plante
Function Precision(number as variant) as integer
  separateur =Mid(CStr(1.1),2,1)
  if isEmpty(number) then
    Precision=0
  else
    TmpChaine=Cstr(number)
    TmpPos=InStr(TmpChaine,separateur)
  if TmpPos=0 then Precision = 0 else Precision=len(TmpChaine)-TmpPos
  end if
end function


Rem TRUNCATE arrondi number a &quot;precision chiffres apres la virgule
Rem Aucun test sur les donnees en entree
Function Truncate(ByVal number as variant,ByVal precision as integer) as double
  tmpnumber=number*10^precision
  TmpChaine=Cint(tmpnumber)
  TmpRes=Left(TmpChaine,Len(TmpChaine)-precision)+&quot;.&quot;+right(TmpChaine,precision)
  Truncate=TmpRes
end function

Rem REPLACE remplace toutes les occurences oldC par newC
Rem Marche aussi pour remplacer des chaines
function Replace(ByVal myString As String, ByVal oldC As String,ByVal newC As String)
  Replace = join(split(myString, oldC), newC)
End function


Rem arraypoint cree un tableau de points de taille n
Rem redim d&apos;un tableau de points ne marche pas sous windows
function arraypoint(n) as object
  dim tmptable(n) as new com.sun.star.awt.Point
  arraypoint=tmptable()
end function

Rem TRANSFDECIMAL 
Rem Transforme de la notation scientifique a la notation decimale
Function TransfDecimal(chaine as String) as String  rem mis au point le 6 avril 2007
	If InStr(chaine,&quot;E&quot;)&gt;0 Then
		If Mid(chaine,Len(chaine)-2,1)=&quot;-&quot; Then
			If Abs(Csng(chaine))&lt;10^(-14) Then
				chaine = &quot;0&quot;
			Else
				Dim bNegatif as Boolean : Dim NbreZero as integer
				If Mid(chaine,1,1)=&quot;-&quot; Then 
					chaine = Mid(chaine,2,Len(chaine)-1)
					bNegatif = True
				Endif				
				NbreZero = Cint(Mid(chaine,Len(chaine)-1,2)
				If InStr(chaine,&quot;,&quot;)&gt;0 Then
					chaine = Mid(chaine,1,1) &amp; Mid(chaine,3,Len(chaine)-6)
				Else
					chaine = Mid(chaine,1,1)&apos; &amp; Mid(chaine,3,Len(chaine)-6)
				Endif
				For I=1 To NbreZero-1
					chaine = &quot;0&quot;&amp; chaine
				Next I
				chaine = &quot;0.&quot;&amp;chaine
				If bNegatif Then chaine = &quot;-&quot; &amp; chaine
			Endif
		Endif
	Endif		
	TransfDecimal = chaine
End Function

Rem REMPLACEVIRGULE remplace dans la chaine en entree
Rem la virgule par le point et &quot;+-&quot; par &quot;-&quot; pas de gestion du separateur local
Function RemplaceVirgule(chaine as String) as String	rem mis au point le 6 avril 2007
		If InStr(chaine,&quot;,&quot;)&gt;0 Then
			For J = 1 To Len(chaine)
				If Mid(chaine,J,1)=&quot;,&quot; Then chaine = Mid(chaine,1,J-1)&amp;&quot;.&quot;&amp;Mid(chaine,J+1,Len(chaine)-J)
			Next J			
		Endif
		If InStr(chaine,&quot;+-&quot;)&gt;0 Then
			For J = 1 To Len(chaine)-1
				If Mid(chaine,J,2)=&quot;+-&quot; Then chaine = Mid(chaine,1,J-1)&amp;Mid(chaine,J+1,Len(chaine)-J)
			Next J
		Endif
		RemplaceVirgule = chaine
End Function


Rem******************************************************
Rem** OREPBOITES box
Rem******************************************************

Rem Open
Sub Reprediagbox					rem mis au point le 3 janvier 2003
	Call VerifOperationnel
	sFonteName = ThisComponent.CurrentController.ViewCursor.CharFontName
	iFonteTaille = ThisComponent.CurrentController.ViewCursor.CharHeight
	oRepfonctions = LoadDialog(&quot;Dmaths&quot;,&quot;Repfonctions&quot; )
	oOptions =  LoadDialog(&quot;Dmaths&quot;,&quot;Options&quot; )
	oRepboites =  LoadDialog(&quot;Dmaths&quot;,&quot;Repboites&quot; )
	Nbrecourbes=8
	bDiagbox=True
	oRepboites.Execute()
End Sub

Rem Close
Sub FinDiagBox
	If bNewCalc=True Then								rem mis au point le 3 janvier 2003
	&apos;oNewCalc.Store()
	If Not IsEmpty(oNewCalc) Then oNewCalc.Dispose()
	Endif
	oRepboites.EndExecute()
End Sub

Rem******************************************************
Rem** OOPTIONS box
Rem******************************************************




Rem******************************************************
Rem** OGRILLE box
Rem******************************************************
REM Open
Sub Repregrille						rem mis au point le 3 janvier 2003
	Call VerifOperationnel
	sFonteName = ThisComponent.CurrentController.ViewCursor.CharFontName
	iFonteTaille = ThisComponent.CurrentController.ViewCursor.CharHeight
	oRepfonctions = LoadDialog(&quot;Dmaths&quot;,&quot;Repfonctions&quot; )
	oGrille = LoadDialog(&quot;Dmaths&quot;,&quot;Grille&quot;)
	oOptions = LoadDialog(&quot;Dmaths&quot;,&quot;Options&quot;)
	oOptions.Model.OptionButton7.State = 1
	bGrille=True
	oGrille.Execute()
End Sub

Rem Close
Sub FinRepregrille							rem mis au point le 3 janvier 2003
	If bNewCalc=True Then							
	&apos;oNewCalc.Store()
	oNewCalc.Dispose()
	Endif
	oGrille.EndExecute()
End sub

Rem Param?tre Orepfonctions pour tracer une grille vide
Sub TraceGrille														rem mis au point le 3 janvier 2003
	oGrille.EndExecute()
	oRepfonctions = CreateUnoDialog( DialogLibraries.Dmaths.Repfonctions )
	oRepfonctions.Model.CheckBox5.State = 1
	oRepfonctions.Model.CheckBox2.State = 0
	oRepfonctions.Model.CheckBox4.State = 0
	oRepfonctions.Model.CheckBox6.State = 0
	oRepfonctions.Model.CheckBox7.State = 0
	oRepfonctions.Model.TextField1.Text = &quot;0&quot;
	oRepfonctions.Model.TextField5.Text = &quot;0&quot;
	oRepfonctions.Model.TextField7.Text = &quot;0&quot;
	oRepfonctions.Model.TextField8.Text = oGrille.GetControl(&quot;TextField2&quot;).Peer.Text
	oRepfonctions.Model.TextField13.Text = &quot;0&quot;
	oRepfonctions.Model.TextField14.Text = oGrille.GetControl(&quot;TextField1&quot;).Peer.Text
	oRepfonctions.Model.TextField10.Text = cstr(0.1)
	If oGrille.Model.OptionButton1.State = 1 or oGrille.Model.OptionButton2.State=1 Then
		oRepfonctions.Model.OptionButton1.State = 1
		oRepfonctions.Model.TextField6.Text = oGrille.GetControl(&quot;TextField3&quot;).Peer.Text
		oRepfonctions.Model.TextField9.Text = oGrille.GetControl(&quot;TextField4&quot;).Peer.Text
	Endif
	If oGrille.Model.OptionButton3.State=1 Then
		oRepfonctions.Model.OptionButton3.State = 1
		oRepfonctions.Model.TextField6.Text = cstr(0.1)
		oRepfonctions.Model.TextField9.Text = cstr(0.1)
	Endif
	If oGrille.Model.OptionButton4.State=1 Then
		oRepfonctions.Model.OptionButton4.State = 1
		oRepfonctions.Model.TextField6.Text = cstr(0.2)
		oRepfonctions.Model.TextField9.Text = cstr(0.2)
	Endif
	oRepfonctions.Model.CheckBox1.State = oGrille.Model.CheckBox1.State
	oRepfonctions.Model.CheckBox10.State = oGrille.Model.OptionButton2.State
	TraceCourbe
End Sub

Rem******************************************************
Rem** OREPFONCTIONS box
Rem******************************************************

REM Open
Sub Repregraphique (Optional sDescription as String)  rem mis au point le 3 janvier 2003 modofi?e le 13 d?cembre 2009	
	If IsMissing(sDescription) Then sDescription = &quot;&quot;			 
	Call VerifOperationnel
	sFonteName = ThisComponent.CurrentController.ViewCursor.CharFontName
	iFonteTaille = ThisComponent.CurrentController.ViewCursor.CharHeight
	oRepfonctions = LoadDialog(&quot;Dmaths&quot;,&quot;Repfonctions&quot; )
	oOptions = LoadDialog(&quot;Dmaths&quot;,&quot;Options&quot;)
	Nbrecourbes=0
	bDiagbox=False
	bRepreGra=True
	RecupereCourbe (sDescription) 
	oRepfonctions.Execute()
End Sub

REM Close
Sub Finrepregraphique						rem mis au point le 3 janvier 2003				
	oRepfonctions.EndExecute()
	If bFigure=True Then oFigure.Visible=True
	If bDiagBox=True Then oRepboites.Visible=True
	If bNewCalc=True Then
	&apos;oNewCalc.Store()
	oNewCalc.Dispose()
	bNewCalc=False
	Endif
	If Not IsEmpty(oDocument) Then oDocument.Dispose() rem ajoute le 8/11/07
End Sub

REM Add new Function
Sub NouvelleFonction
																rem mis au point le 3 janvier 2003
	If Nbrecourbes&gt;7 Then 
	Dmaths.Module5.Avertir(16)
	TraceCourbe
	Endif
	For I = 1 To 10
		oRepfonctions.GetControl(&quot;CheckBox&quot;&amp;CStr(I)).Enable = False
	Next I
	For I = 1 To 6
		oRepfonctions.GetControl(&quot;OptionButton&quot;&amp;CStr(I)).Enable = False
	Next I
	oRepfonctions.Model.TextField2.Enabled=False
	oRepfonctions.Model.TextField3.Enabled=False
	For I = 6 To 19
		If I&lt;&gt; 17 Then oRepfonctions.GetControl(&quot;TextField&quot;&amp;CStr(I)).Enable = False
	Next I
	oRepfonctions.GetControl(&quot;Label1&quot;).Enable=False	
	For I = 8 To 19
		oRepfonctions.GetControl(&quot;Label&quot;&amp;CStr(I)).Enable = False
	Next I
	sNomFonction(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField17&quot;).Peer.Text
	sFormul(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text
	Xmin(Nbrecourbes) = CsngPlus(oRepfonctions.GetControl(&quot;TextField4&quot;).Peer.Text)
	Xmax(Nbrecourbes) = CsngPlus(oRepfonctions.GetControl(&quot;TextField5&quot;).Peer.Text)
	rem remise ? 0 des valeurs du tableau NewFormulSpline
	For I=1 To 8
	  sNewFormulSpline(NbreCourbes,I,0)=&quot;&quot;
	  sNewFormulSpline(NbreCourbes,I,1)=&quot;&quot;
	Next I
	Nbrecourbes=Nbrecourbes+1
	If Instr(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,&quot;SC:&quot;)&gt;0 Then
			Dim I1,NbrCar as integer
			NbrCar = Len(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text)
			I1 = Instr(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,&quot;;&quot;)
			I1 = Instr(I1+1,oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,&quot;;&quot;)
			I1 = Instr(I1+1,oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,&quot;;&quot;)			
			oRepfonctions.Model.TextField1.Text = &quot;SC:&quot; &amp; Mid(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,I1+1,Nbcar-I1) &amp; &quot;;&quot;
			I1 = Instr(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,&quot;;&quot;)
			oRepfonctions.Model.TextField4.Text = Mid(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,4,I1-4)
			oRepfonctions.Model.TextField5.Text = Mid(oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text,4,I1-4)
	End if

	If ((bModif=True or bRecup = True) and Nbrecourbes &lt;= NbreMaxcourbes)  Then
		oRepfonctions.Model.TextField17.Text = sNomFonction(Nbrecourbes)
		oRepfonctions.Model.TextField1.Text = sFormul(Nbrecourbes)
		oRepfonctions.Model.TextField4.Text = Xmin(Nbrecourbes)
		oRepfonctions.Model.TextField5.Text = Xmax(Nbrecourbes)
	Else
		oRepfonctions.Model.TextField17.Text = cStr(Nbrecourbes+1)	
	End if
	If NbreMaxcourbes &lt; Nbrecourbes Then NbreMaxcourbes = Nbrecourbes
End Sub





Rem Trace la courbe
Sub TraceCourbe 
&apos;Macro commencee le vendredi 21 decembre 2001  mise au point le 3 janvier 2003
	Dim oCourbe(Nbrecourbes),oCourbeTmp as object &apos;les courbes a tracer
	Dim oShapes As Object &apos; la collection des traces
	Dim oText,oCursor,oTable,oGroup,oDmProgCourbe as object
	Dim oAxex,oAxey,oRep as Object
	Dim X,YenX,Xmini,Xmaxi,Ymini,Ymaxi,AbsMini,AbsMaxi,OrdonneeAxeX,AbscisseAxeY,Delta,NormeVectan as single
	rem Xmini,Xmaxi,Ymini,Ymaxi correspondent a la fonction
	rem AbsMini,AbsMaxi aux axes
	Dim K,PasGraduationenX,PasGraduationenY,PasNumerotationenX,PasNumerotationenY,NbreNumeronenX,NbreNumeroenY,NbreGraduationenX,NbreGraduationenY as integer
	Dim vLine as variant
	Dim sUrl as String
	Dim Imax,Imin as Integer
	Dim NumInter as Integer rem contient le numero de intervalle pour les fonctions splines
	Dim bFin,bModifXmin as Boolean
	Dim debug as Boolean
	Dim mCoord as object
    On error Goto Fin

	Rem JLG new parameter
	debug=False

rem creation de la collection de dessin 
	oShapes = createUnoService(&quot;com.sun.star.drawing.ShapeCollection&quot;)
	sNomFonction(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField17&quot;).Peer.Text
	sFormul(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text
	Xmin(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField4&quot;).Peer.Text
	Xmax(Nbrecourbes) = oRepfonctions.GetControl(&quot;TextField5&quot;).Peer.Text
	NUX = CsngPlus(oRepfonctions.GetControl(&quot;TextField2&quot;).Peer.Text)
	NUY = CsngPlus(oRepfonctions.GetControl(&quot;TextField3&quot;).Peer.Text)
	Pas = CsngPlus(oRepfonctions.GetControl(&quot;TextField10&quot;).Peer.Text)
	MargeX = CsngPlus(oRepfonctions.GetControl(&quot;TextField11&quot;).Peer.Text)
	MargeY = CsngPlus(oRepfonctions.GetControl(&quot;TextField12&quot;).Peer.Text)
	PasGraduationenX = CsngPlus(oRepfonctions.GetControl(&quot;TextField6&quot;).Peer.Text)
	PasGraduationenY = CsngPlus(oRepfonctions.GetControl(&quot;TextField9&quot;).Peer.Text)
	OrdonneeAxeX = CsngPlus(oRepfonctions.GetControl(&quot;TextField15&quot;).Peer.Text)
	AbscisseAxeY = CsngPlus(oRepfonctions.GetControl(&quot;TextField16&quot;).Peer.Text)
	Couleur(0)= oOptions.Model.FormattedField31.BackGroundColor
	For I=0 to Nbrecourbes
	  If isnumeric(Xmin(I)) Then 
		  Tmin(I)=CsngPlus(Xmin(I))
		Else
		  parse(Xmin(I),erflag)
			Tmin(I)=f(1)
		End If
	  If isnumeric(Xmax(I)) Then 
		  Tmax(I)=CsngPlus(Xmax(I))
		Else
		  parse(Xmax(I),erflag)
			Tmax(I)=f(1)
		End If
		if Tmin(I)=notdef or Tmax(I)=notdef then goto fin
	next
		
		
		
		
		
	Rem JLG new parameters
	
	if debug&lt;&gt;true then oDmProgCourbe = CreateUnoDialog(DialogLibraries.Dmaths.DmProgCourbe)	
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	
	Dim mNoArgs(0) As New com.sun.star.beans.PropertyValue
	Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
	mFileProperties(0).Name = &quot;Hidden&quot;
	if debug=False then 
	  mFileProperties(0).Value = True
	else  
	  mFileProperties(0).Value = False
	end if
	bError=False
	
	If bFigure = False Then  rem on ne trace pas une figure geometrique
		If oRepFonctions.Model.CheckBox1.State = 0  Then 
			monDocument = ThisComponent
			rem lalalla
			oPage1 = monDocument.Drawpage
		Else
			sUrl = &quot;private:factory/swriter&quot;
			monDocument = oDesktop.LoadComponentFromURL(sUrl,&quot;_blank&quot;,0,mNoArgs())
		End if
	End if

	If bModif = False Then rem on ne trace pas un diagramme en boite, premier trace			
		sUrl = &quot;private:factory/sdraw&quot;
		If bFigure = False Then rem on ne trace pas une figure geometrique
			oDocument = oDesktop.LoadComponentFromURL(sUrl,&quot;_blank&quot;,0,mFileProperties())
			oPage= oDocument.Drawpages(0)
		Else rem on trace une figure geometrique
			oDocument = ThisComponent
			oPage = oDocument.Drawpages(0)
		End if	
		
	End if

	if debug&lt;&gt;true then 
	oRepfonctions.Visible = False
	  oDmProgCourbe.Visible = True
		Wait 500	
	  oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 0
	end if

	rem verification des donnees
	If oRepfonctions.GetControl(&quot;TextField1&quot;).Peer.Text=&quot;&quot; and (oRepfonctions.GetControl(&quot;TextField13&quot;).Peer.Text=&quot;Xmin&quot; or  oRepfonctions.GetControl(&quot;TextField14&quot;).Peer.Text=&quot;Xmax&quot; or  oRepfonctions.GetControl(&quot;TextField7&quot;).Peer.Text=&quot;Ymin&quot; or  oRepfonctions.GetControl(&quot;TextField8&quot;).Peer.Text=&quot;Ymax&quot;) Then
		Dmaths.Module5.Avertir(17)
		Goto Fin
	End If
	rem fin verification des donnees

	For I = 1 To 30
		Couleur(I)= oOptions.GetControl(&quot;FormattedField&quot;+cStr(I)).Model.BackGroundColor
	Next I
	rem jlg : rajout d&apos;un operateur de precision en fonction de Tmin, Tmax et pas
	Pmin = precision(Tmin(0))
	Pmax = precision(Tmax(0))
	for  I=1 to Nbrecourbes
	if Pmin &lt; precision(Tmin(Nbrecourbes)) then Pmin = precision(Tmin(Nbrecourbes))
	if Pmax &lt; precision(Tmax(Nbrecourbes)) then Pmax = precision(Tmax(Nbrecourbes))
	Next
	PPas = precision(Pas)
	rem jlg : pour chaque cas, d?termine le nombre de chiffres apr?s la virgule ou le point.
	NbPrec=Pmin
	if Pmax&gt;NbPrec then NbPrec=Pmax
	if PPas&gt;NbPrec then NbPrec=PPas
    rem fin jlg
	bOntrace=False &apos;rem indique si on est en phase de trac? de courbe
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 5


  Rem R?cup?re les limites min et max de X si elles existent
  TmpField = oRepfonctions.GetControl(&quot;TextField13&quot;).Peer.Text
	If isnumeric(TmpField) Then
		LimXMin = CsngPlus(TmpField)
	Else
		LimXMin=-1e38
	Endif
	TmpField = oRepfonctions.GetControl(&quot;TextField14&quot;).Peer.Text
	If isnumeric(TmpField) Then
		LimXMax = CsngPlus(TmpField)
	Else
		LimXMax=1e38
	Endif
	
	If LimXMax&lt;LimXMin then
	  tmpvar=LimXMax
	  LimXMax=LimXMin
	  LimXMin=tmpvar
	  endif
	if LimXMax&lt;LimXMin+pas*NUX then LimXMax=LimXMin+pas*NUX
    rem change Tmax(I) and Tmin(I) si besoin	
	For I=0 to Nbrecourbes
    FdeX(sFormul(I),I)
	  If bParam(I)=False Then
	    if Tmax(I)&gt;LimXMax Then Tmax(I)=LimXMax
	    if Tmin(I)&lt;LimXMin Then Tmin(I)=LimXMin
	  Endif
	Next
	

	NbreMax=2 rem pour ?viter un plantage en cas de graphe sans fonction
	dim NbreX(Nbrecourbes) as integer
	For I=0 to Nbrecourbes
	  nbbrut=(Tmax(I)-Tmin(I))/(Pas*NUX)
	  Nbre=Int(nbbrut+0.001)+1
		NbreX(I)=Nbre
		If Nbre&gt;NbreMax then NbreMax=Nbre
	Next
	rem test nombreMax pas trop grand (sinon on modifie le pas)
  If NbreMax &gt; 1000 then
      rem !! a compl?ter
  end if
  rem initialise le tableau des valeurs en X et Y
  Dim XVal(Nbrecourbes,NbreMax-1) as single
  Dim XPos(Nbrecourbes,NbreMax-1) as single
  Dim YVal(Nbrecourbes,NbreMax-1) as single
  Dim YPos(Nbrecourbes,NbreMax-1) as single
  Dim Yinfo(Nbrecourbes,NbreMax-1) as string
    
Rem R?cup?ration des Ymin et Ymax    
  TmpField = oRepfonctions.GetControl(&quot;TextField7&quot;).Peer.Text
	If isnumeric(TmpField) Then
		LimYMin = CsngPlus(TmpField)
	Else
		LimYMin=-1e38
	End if
	
	TmpField = oRepfonctions.GetControl(&quot;TextField8&quot;).Peer.Text
	If isnumeric(TmpField) Then
		LimYMax = CsngPlus(TmpField)
	Else
		LimYMax=1e38
	End if
	
	If LimYMax&lt;LimYMin then
	  tmpvar=LimYMax
	  LimYMax=LimYMin
	  LimYMin=tmpvar
	end if
	
	If LimYMax=LimYMin then
    if LimYMax&lt;&gt;notdef then
      If LimYMin=0 then
        LimYMax=1
      else
        LimYMax=1.1*LimYMin
      end if
	  end if
	end if
  Rem !! a gérer le cas où     
  rem calcul des fonctions
	For I=0 to Nbrecourbes
	  bParalleleOrdonnees(I)=False		
	  FdeX(sFormul(I),I)
	  if bParalleleOrdonnees(I)=False then
	    Ymin(I)=1e38
        Ymax(I)=-1e38

	  if (NbreX(I) &gt; 1) then
	    pente= (Tmax(I)-Tmin(I))/(NbreX(I)-1)
	  else
	    pente=1
	  end if
	  NumInter = 0
	  If Len(sNewFormulSpline(I,NumInter,1))=0 Then parse(sNewFormul(I,1),erflag) Else parse(sNewFormulSpline(I,NumInter,0),erflag)	 
 	  If bParam(I)=True Then parse0(sNewFormul(I,0),erflag0)
      &apos;if isempty(Ymin(I)) then Ymin(I)=1e38
      &apos;if isempty(Ymax(I)) then Ymax(I)=-1e38
	  For k = 0 to NbreX(I)-1
      t=Tmin(I)+k*pente
	    Y=f1(t,I,NumInter)
	    If bParam(I)=True Then
  	    X=f0(t)
  	  else
  	    X=t
			End if
			XVal(I,k)=X
			YVal(I,k)=Y
			Yinfo(I,k)=&quot;ok&quot;
			if X&gt;LimXMax or X&lt;LimXMin then Yinfo(I,k)=&quot;out&quot;
			if Y&gt;LimYMax or Y&lt;LimYMin then Yinfo(I,k)=&quot;out&quot;
			if Y=notdef then Yinfo(I,k)=&quot;notdef&quot;
			if X=notdef then Yinfo(I,k)=&quot;notdef&quot;
			if Yinfo(I,k)=&quot;ok&quot; then
	      if Y&gt;Ymax(I) then Ymax(I)=Y
	      if Y&lt;Ymin(I) then Ymin(I)=Y
	    end if
		next
		For k = NbreX(I) to NbreMax-1
			Yinfo(I,k)=&quot;notdef&quot;
		next
	  EndIf
	next
    

	rem determination de Xmini et Xmaxi pour l&apos;absisce
	rem ainsi que les Ymini et Ymaxi pour les ordonnees

	For I=0 to Nbrecourbes
		If bParam(I)=true then rem courbe parametrique max et min dynamiques
		  Tmin(I)= 1e38
		  Tmax(I)=-1e38
		  For k =  0 to NbreX(I)-1
				if XVal(I,k) &lt; Tmin(I) and Yinfo(I,k)=&quot;ok&quot; then Tmin(I)= XVal(I,k)
				if XVal(I,k) &gt; Tmax(I) and Yinfo(I,k)=&quot;ok&quot; then Tmax(I)= XVal(I,k)
	    Next	      
	  end if
	next
	
    if isempty(Ymin(0)) then Ymin(0)=1e38
    if isempty(Ymax(0)) then Ymax(0)=-1e38
	Xmini=Tmin(0)
	Xmaxi=Tmax(0)
	Ymini=Ymin(0)
	Ymaxi=Ymax(0)
	for I= 1 to Nbrecourbes
	  If Tmin(I)&lt;Xmini and Tmin(I)&lt;&gt;-notdef and Tmin(I)&lt;&gt;notdef Then Xmini=Tmin(I)
	  If Tmax(I)&gt;Xmaxi and Tmax(I)&lt;&gt;-notdef and Tmax(I)&lt;&gt;notdef Then Xmaxi=Tmax(I)
	  If Ymin(I)&lt;Ymini and Ymin(I)&lt;&gt;-notdef and Ymin(I)&lt;&gt;notdef Then  Ymini=Ymin(I)
	  If Ymax(I)&gt;Ymaxi and Ymax(I)&lt;&gt;-notdef and Ymax(I)&lt;&gt;notdef Then  Ymaxi=Ymax(I)
	Next I
	
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 10

  rem determination de AbsMini et AbsMaxi
	If LimXMin=-1e38 Then
		AbsMini=Xmini
	Else
		AbsMini = LimXMin
	End if
	If LimXMax=1e38 Then
		AbsMaxi=Xmaxi
	Else
		AbsMaxi = LimXMax
	End if
  rem corrige en fonction du point d&apos;intersection entre l&apos;axe des X et des Y
    if Ymaxi &lt; OrdonneeAxeX then Ymaxi = OrdonneeAxeX
    if Ymini &gt; OrdonneeAxeX then Ymini = OrdonneeAxeX
    if AbsMini &gt; AbscisseAxeY then AbsMini = AbscisseAxeY
    if AbsMaxi &lt; AbscisseAxeY then AbsMaxi = AbscisseAxeY
    if Ymini =Ymaxi then
      Ymaxi= Ymini+1
    end if
	bOntrace=True rem indique de ne plus afficher les coefficients en mode plotteur

  rem determination de Ymaxi et Ymini
	If LimYMin&lt;&gt;-1e38 Then
		YMini = LimYMin
	End if
	If LimYMax&lt;&gt;1e38 Then
		YMaxi = LimYMax
	End if
	For I=0 to Nbrecourbes
		If bParalleleOrdonnees(I)=True and bDiagBox=False Then
			Ymin(I)=Ymini
			Ymax(I)=Ymaxi
		End if
	Next 
	If (NbreCourbes=0 and bParalleleOrdonnees(0)=True ) Then
		If LimYMin&lt;&gt;-1e38 Then Ymin(0) = LimYMin
		If LimYMax&lt;&gt;1e38 Then Ymax(0) = LimYMax
	End if
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 15

rem recherche automatique des dimensions de trac?: r?glage du Pas de graduation et du nombre d&apos;unit? par cm
	If (oRepfonctions.Model.CheckBox8.State=1 and bModif = False) Then rem seulement au premier trac?
		If ((AbsMaxi-AbsMini)/NUX)&gt;18 Then
			NUX=Int((AbsMaxi-AbsMini)/18)+1
			PasGraduationenX=NUX
			oRepfonctions.Model.TextField6.Text = CStr(PasGraduationenX)
		End if
		If ((Ymaxi-Ymini)/NUY)&gt;25 Then
			NUY=Int((Ymaxi-Ymini)/25)+1
			PasGraduationenY=NUY
			oRepfonctions.Model.TextField9.Text = CStr(PasGraduationenY)
		End if
	Endif

	If oRepfonctions.Model.OptionButton5.State=1 or oRepfonctions.Model.OptionButton6.State=1 Then 
	  rem pas de grille
		GraAxeXbas=-100
		GraAxeXhaut=100
		GraAxeYbas=-100
		GraAxeYhaut=100
	Elseif oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1 or oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1 Then
    rem pr?sence de grilles
		GraAxeYbas=AbsMini*1000/NUX
		GraAxeYhaut=AbsMaxi*1000/NUX
		GraAxeXbas=-Ymaxi*1000/NUY
		GraAxeXhaut=-Ymini*1000/NUY
	End if
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 20

rem: trac? des graduations de l&apos;axe des abscisses
	If oRepfonctions.Model.CheckBox2.State=1 or oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1  or oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1 Then
		Dim oGraAxeX(Int(AbsMini/PasGraduationenX)-1 to Int(AbsMaxi/PasGraduationenX)+1) as Object
		For  I=Int(AbsMini/PasGraduationenX)-1 to Int(AbsMaxi/PasGraduationenX)+1
			If PasGraduationenX*I &gt;= AbsMini and PasGraduationenX*I &lt;= AbsMaxi Then 
				oGraAxeX(I)=CreateLine(oDocument,oPage,(MargeX+(PasGraduationenX*I-AbsMini)/NUX)*1000,((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000+GraAxeXbas,(MargeX+(PasGraduationenX*I-AbsMini)/NUX)*1000,((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000+GraAxeXhaut,I)
				oShapes.add(oGraAxeX(I))			
			End if
		Next I
	End if
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 25



rem: trac? des graduations de l&apos;axe des ordonn?es
	If oRepfonctions.Model.CheckBox4.State=1 or oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1 or oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1 Then
		For I=Int(Ymini/PasGraduationenY)-1 to Int(Ymaxi/PasGraduationenY)+1 
			If PasGraduationenY*I &gt;= Ymini and PasGraduationenY*I &lt;= Ymaxi Then Imax=I
		Next I
		For I=Int(Ymaxi/PasGraduationenY)+1 to Int(Ymini/PasGraduationenY)-1 Step -1 
			If PasGraduationenY*I &gt;= Ymini and PasGraduationenY*I &lt;= Ymaxi Then Imin=I
		Next I
		Dim oGraAxeY(Imin to Imax) as Object
		For I=Imin to Imax
			oGraAxeY(I)=CreateLine(oDocument,oPage,(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000+GraAxeYbas,(MargeY+(Ymaxi+PasGraduationenY*(I-Imin-Imax))/NUY)*1000,(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000+GraAxeYhaut,(MargeY+(Ymaxi+PasGraduationenY*(I-Imin-Imax))/NUY)*1000,(IMin+Imax-I))
			oShapes.add(oGraAxeY(I))
		Next I
	Endif
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 30
	


rem: num?rotation de l&apos;axe des abscisses
	Dim aSize As New com.sun.star.awt.Size
	If  oRepfonctions.Model.CheckBox2.State=1 and oRepfonctions.Model.CheckBox6.State=1 Then &apos; and oRepfonctions.Model.OptionButton3.State=0 and  oRepfonctions.Model.OptionButton4.State=0  Then
		If Len(oRepfonctions.GetControl(&quot;TextField18&quot;).Peer.Text) = 0 Then 
			PasNumerotationenX = (Int((NUX*0.99)/PasGraduationenX+1))*PasGraduationenX
			oRepfonctions.Model.TextField18.Text = CStr(PasNumerotationenX)
		Else
			PasNumerotationenX = CSngPlus(oRepfonctions.GetControl(&quot;TextField18&quot;).Peer.Text)
		End if
		Dim oNumAxeX(Int(AbsMini/PasNumerotationenX)-1 to Int(AbsMaxi/PasNumerotationenX)+1) as Object
		Dim aPosenX(Int(AbsMini/PasNumerotationenX)-1 to Int(AbsMaxi/PasNumerotationenX)+1) As New com.sun.star.awt.Point
		aSize.Width=200*(Abs(Int(Log(Abs(PasNumerotationenX))))+2)
		aSize.Height=400
		For I=Int(AbsMini/PasNumerotationenX)-1 to Int(AbsMaxi/PasNumerotationenX)+1
			If (PasNumerotationenX*I &gt;= AbsMini and PasNumerotationenX*I &lt;= AbsMaxi and oOptions.Model.CheckBox2.State=0) or (PasNumerotationenX*I &gt; AbsMini and PasNumerotationenX*I &lt; AbsMaxi and oOptions.Model.CheckBox2.State=1) Then 
				oNumAxeX(I) = oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)		
				oNumAxeX(I).Size=aSize		
				aPosenX(I).x=(MargeX+(PasNumerotationenX*I-AbsMini)/NUX)*1000-180
				aPosenX(I).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000					
				aPosenX(I).x=aPosenX(I).x&apos;-1000
				aPosenX(I).y=aPosenX(I).y&apos;-1000
				oNumAxeX(I).Position=aPosenX(I)	
				If I&lt;0 or PasNumerotationenX*I&gt;1 or oRepfonctions.Model.CheckBox3.State=0 or oRepfonctions.GetControl(&quot;TextField15&quot;).Peer.Text&lt;&gt;&quot;0&quot; Then
					oPage.add(oNumAxeX(I))
	&apos;				Print &quot;Axe X Num&quot;
					oNumAxeX(I).TextAutoGrowWidth  = True
					oNumAxeX(I).TextAutoGrowHeight  = True
					oNumAxeX(I).String = Int(PasNumerotationenX*I*1000)/1000
					If oOptions.Model.CheckBox3.State=1 Then oNumAxeX(I).CharColor=DetermineColor					
					oNumAxeX(I).CharHeight=Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)
					oNumAxeX(I).CharFontName = sFonteName &apos; monDocument.CharFontName
					oShapes.add(oNumAxeX(I))					
				End if
			End if
		Next I
	End if
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 35
	
	
rem : graduations en abscisse si papier millimetre et numerotation
	If (oRepfonctions.Model.CheckBox6.State=1 and (oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1 or oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1)) Then
		ReDim oGraAxeX(Int(AbsMini/PasNumerotationenX)-1 to Int(AbsMaxi/PasNumerotationenX)+1) as Object
		For  I=Int(AbsMini/PasNumerotationenX)-1 to Int(AbsMaxi/PasNumerotationenX)+1
			If PasNumerotationenX*I &gt;= AbsMini and PasNumerotationenX*I &lt;= AbsMaxi Then 
				oGraAxeX(I)=CreateLine(oDocument,oPage,(MargeX+(PasNumerotationenX*I-AbsMini)/NUX)*1000,((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000-100,(MargeX+(PasNumerotationenX*I-AbsMini)/NUX)*1000,((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000+100,I)				
				oGraAxeX(I).LineColor = 0
				oShapes.add(oGraAxeX(I))
				&apos;CorrigeLeBugPosition(oGraAxeX(I))				
			End if
		Next I
	End if
	
		
rem: num?rotation en Y
	If  oRepfonctions.Model.CheckBox4.State=1 and oRepfonctions.Model.CheckBox7.State=1 Then &apos;and oRepfonctions.Model.OptionButton3.State=0 and  oRepfonctions.Model.OptionButton4.State=0  Then
		If Len(oRepfonctions.GetControl(&quot;TextField19&quot;).Peer.Text) = 0 Then 
			PasNumerotationenY = (Int((NUY*0.99)/PasGraduationenY+1))*PasGraduationenY
			oRepfonctions.Model.TextField19.Text = CStr(PasNumerotationenY)
		Else
			PasNumerotationenY = CSngPlus(oRepfonctions.GetControl(&quot;TextField19&quot;).Peer.Text)
		End if

		aSize.Width=200*(Abs(Int(Log(Abs(PasNumerotationenY))))+2) 
		aSize.Height=400
		For I=Int(Ymini/PasNumerotationenY)-1 to Int(Ymaxi/PasNumerotationenY)+1 
		If PasNumerotationenY*I &gt;= Ymini and PasNumerotationenY*I &lt;= Ymaxi Then Imax=I
		Next I
		For I=Int(Ymaxi/PasNumerotationenY)+1 to Int(Ymini/PasNumerotationenY)-1 Step -1 
		If PasNumerotationenY*I &gt;= Ymini and PasNumerotationenY*I &lt;= Ymaxi Then Imin=I
		Next I
		Dim oNumAxeY(Imin to Imax) as Object
		Dim aPosenY(Imin to Imax) As New com.sun.star.awt.Point
		For I=Imin to Imax
			If (PasNumerotationenY*I &gt;= Ymini and PasNumerotationenY*I &lt;= Ymaxi and oOptions.Model.CheckBox2.State=0) or (PasNumerotationenY*I &gt; Ymini and PasNumerotationenY*I &lt; Ymaxi and oOptions.Model.CheckBox2.State=1) Then 
				oNumAxeY(I) = oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
				oNumAxeY(I).Size=aSize
				
				aPosenY(I).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000-200-100*Int(Log(Abs(Ymaxi-Ymini))
				aPosenY(I).y=(MargeY+(Ymaxi+PasNumerotationenY*(I-Imin-Imax))/NUY)*1000-350	
				aPosenY(I).x=aPosenY(I).x -100
				aPosenY(I).y=aPosenY(I).y &apos;-100
				oNumAxeY(I).Position=aPosenY(I)
				If I&lt;Imax+Imin-1/PasNumerotationenY or I&gt;Imax+Imin or oRepfonctions.Model.CheckBox3.State=0 or oRepfonctions.GetControl(&quot;TextField16&quot;).Peer.Text&lt;&gt;&quot;0&quot; Then
					If Int(PasNumerotationenY*(Imax+Imin-I)*1000)/1000 &lt;&gt; 0 Then rem on ecrit pas le nombre 0 en ordonn?e.	
						oPage.add(oNumAxeY(I))
						&apos;print &quot;Num Axe Y&quot;
						oNumAxeY(I).TextAutoGrowHeight=False
						oNumAxeY(I).String=Int(PasNumerotationenY*(Imax+Imin-I)*1000)/1000
						If oOptions.Model.CheckBox3.State=1 Then oNumAxeY(I).CharColor=DetermineColor
						oNumAxeY(I).CharHeight=Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)
						oShapes.add(oNumAxeY(I))
					End if
				End if
				oNumAxeY(I).TextAutoGrowWidth  = True
				oNumAxeY(I).TextAutoGrowHeight  = True	
				oNumAxeY(I).CharFontName = sFonteName
			End if
		Next I
	End if

rem : graduations en abscisse si papier millimetre et numerotation
	If (oRepfonctions.Model.CheckBox7.State=1 and (oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1 or oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1)) Then
		For I=Int(Ymini/PasNumerotationenY)-1 to Int(Ymaxi/PasNumerotationenY)+1 
			If PasNumerotationenY*I &gt;= Ymini and PasNumerotationenY*I &lt;= Ymaxi Then Imax=I
		Next I
		For I=Int(Ymaxi/PasNumerotationenY)+1 to Int(Ymini/PasNumerotationenY)-1 Step -1 
			If PasNumerotationenY*I &gt;= Ymini and PasNumerotationenY*I &lt;= Ymaxi Then Imin=I
		Next I
		ReDim oGraAxeY(Imin to Imax) as Object
		For I=Imin to Imax
			oGraAxeY(I)=CreateLine(oDocument,oPage,(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000-100,(MargeY+(Ymaxi+PasNumerotationenY*(I-Imin-Imax))/NUY)*1000,(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000+100,(MargeY+(Ymaxi+PasNumerotationenY*(I-Imin-Imax))/NUY)*1000,(IMin+Imax-I))
			oGraAxeY(I).LineColor = 0
			oShapes.add(oGraAxeY(I))
			&apos;CorrigeLeBugPosition(oGraAxeY(I))
		Next I
	End if
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 40

	rem: trac? de l&apos;axe des ordonn?es
	If  oRepfonctions.Model.CheckBox4.State=1 Then
		oAxey = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
		If bDraw = False Then 
		Endif
		oPage.add(oAxey)
		oAxey.LineWidth = Csng(oOptions.GetControl(&quot;TextField1&quot;).Peer.Text)
		If oOptions.Model.OptionButton2.State=1 Then
			oAxey.LineColor=oOptions.Model.ImageControl2.BackGroundColor
		Elseif oOptions.Model.OptionButton3.State=1 Then
			oAxey.LineColor=oOptions.Model.ImageControl3.BackGroundColor
		Elseif oOptions.Model.OptionButton4.State=1 Then
			oAxey.LineColor=oOptions.Model.ImageControl4.BackGroundColor
		Elseif oOptions.Model.OptionButton5.State=1 Then
			oAxey.LineColor=oOptions.Model.ImageControl5.BackGroundColor
		Elseif oOptions.Model.OptionButton6.State=1 Then
			oAxey.LineColor=oOptions.Model.ImageControl6.BackGroundColor
		Else 
			oAxey.LineColor=oOptions.Model.ImageControl1.BackGroundColor
		Endif
		Dim Axey(4) as new com.sun.star.awt.Point
		Axey(0).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
		Axey(0).y=(MargeY+(Ymaxi-Ymini)/NUY)*1000
		Axey(1).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
		Axey(1).y=MargeY*1000
		If oOptions.Model.CheckBox1.State=1 Then
			Axey(2).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000-100
			Axey(2).y=MargeY*1000+200
			Axey(3).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
			Axey(3).y=MargeY*1000
			Axey(4).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000+100
			Axey(4).y=MargeY*1000+200
		Else
			Axey(2).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
			Axey(2).y=MargeY*1000
			Axey(3).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
			Axey(3).y=MargeY*1000
			Axey(4).x=(MargeX-(AbsMini-AbscisseAxeY)/NUX)*1000
			Axey(4).y=MargeY*1000
		Endif
		vLine=oAxey.PolyPolygon
		vLine=Array(Axey())
		oAxey.PolyPolygon=vLine
		oShapes.add(oAxey)
		&apos;CorrigeLeBugPosition(oAxey)
	Endif

	rem: trac? de l&apos;axe des abscisses
	If oRepfonctions.Model.CheckBox2.State=1 Then
		oAxex = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
		oPage.add(oAxex)
		oAxex.LineWidth = Csng(oOptions.GetControl(&quot;TextField1&quot;).Peer.Text)
		If oOptions.Model.OptionButton2.State=1 Then
			oAxex.LineColor=oOptions.Model.ImageControl2.BackGroundColor
		Elseif oOptions.Model.OptionButton3.State=1 Then
			oAxex.LineColor=oOptions.Model.ImageControl3.BackGroundColor
		Elseif oOptions.Model.OptionButton4.State=1 Then
			oAxex.LineColor=oOptions.Model.ImageControl4.BackGroundColor
		Elseif oOptions.Model.OptionButton5.State=1 Then
			oAxex.LineColor=oOptions.Model.ImageControl5.BackGroundColor
		Elseif oOptions.Model.OptionButton6.State=1 Then
			oAxex.LineColor=oOptions.Model.ImageControl6.BackGroundColor
		Else 
			oAxex.LineColor=oOptions.Model.ImageControl1.BackGroundColor
		Endif
		Dim Axex(4) as new com.sun.star.awt.Point
		Axex(0).x=MargeX*1000
		Axex(0).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
		Axex(1).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000
		Axex(1).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
		If oOptions.Model.CheckBox1.State=1 Then
			Axex(2).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000-200
			Axex(2).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000+100
			Axex(3).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000
			Axex(3).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
			Axex(4).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000-200
			Axex(4).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000-100
		Else
			Axex(2).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000
			Axex(2).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
			Axex(3).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000
			Axex(3).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
			Axex(4).x=(MargeX+(AbsMaxi-AbsMini)/NUX)*1000
			Axex(4).y=((Ymaxi-OrdonneeAxeX)/NUY+MargeY)*1000
		Endif
		vLine=oAxex.PolyPolygon
		vLine=Array(Axex())
		oAxex.PolyPolygon=vLine
		oShapes.add(oAxex)
		&apos;CorrigeLeBugPosition(oAxex)
	Endif
	

rem: trac? du rep?re
	If oRepfonctions.Model.CheckBox3.State=1 Then
		oRep = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
		oPage.add(oRep)
		oRep.LineWidth=Csng(oOptions.GetControl(&quot;TextField1&quot;).Peer.Text)*3
		If oOptions.Model.OptionButton2.State=1 Then
			oRep.LineColor=oOptions.Model.ImageControl2.BackGroundColor
		Elseif oOptions.Model.OptionButton3.State=1 Then
			oRep.LineColor=oOptions.Model.ImageControl3.BackGroundColor
		Elseif oOptions.Model.OptionButton4.State=1 Then
			oRep.LineColor=oOptions.Model.ImageControl4.BackGroundColor
		Elseif oOptions.Model.OptionButton5.State=1 Then
			oRep.LineColor=oOptions.Model.ImageControl5.BackGroundColor
		Elseif oOptions.Model.OptionButton6.State=1 Then
			oRep.LineColor=oOptions.Model.ImageControl6.BackGroundColor
		Else 
			oRep.LineColor=oOptions.Model.ImageControl1.BackGroundColor
		Endif
		Dim Rep(8) as new com.sun.star.awt.Point
		Rep(0).x= (MargeX-AbsMini/NUX)*1000+100
		Rep(0).y= (MargeY-(1-Ymaxi)/NUY)*1000+200
		Rep(1).x= (MargeX-AbsMini/NUX)*1000
		Rep(1).y= (MargeY-(1-Ymaxi)/NUY)*1000
		Rep(2).x= (MargeX-AbsMini/NUX)*1000-100
		Rep(2).y= (MargeY-(1-Ymaxi)/NUY)*1000+200
		Rep(3).x= (MargeX-AbsMini/NUX)*1000
		Rep(3).y= (MargeY-(1-Ymaxi)/NUY)*1000
		Rep(4).x= (MargeX-AbsMini/NUX)*1000
		Rep(4).y= (MargeY+Ymaxi/NUY)*1000
		Rep(5).x= (MargeX-(AbsMini-1)/NUX)*1000
		Rep(5).y= (MargeY+Ymaxi/NUY)*1000
		Rep(6).x= (MargeX-(AbsMini-1)/NUX)*1000-200
		Rep(6).y= (MargeY+Ymaxi/NUY)*1000+100
		Rep(7).x= (MargeX-(AbsMini-1)/NUX)*1000
		Rep(7).y= (MargeY+Ymaxi/NUY)*1000
		Rep(8).x= (MargeX-(AbsMini-1)/NUX)*1000-200
		Rep(8).y= (MargeY+Ymaxi/NUY)*1000-100
		vLine=oRep.PolyPolygon
		vLine=Array(Rep())
		oRep.PolyPolygon=vLine
		oShapes.add(oRep)
		Dim oOrigine as Object
		Dim aPosOrigine As New com.sun.star.awt.Point
		oOrigine=oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
		oOrigine.Size=aSize
		aPosOrigine.x=(MargeX-(AbsMini)/NUX)*1000-300
		aPosOrigine.y=(MargeY+(Ymaxi)/NUY)*1000
		oOrigine.Position=aPosOrigine
		oPage.add(oOrigine)
		&apos;print &quot;Add origine&quot;
		oOrigine.String = oOptions.GetControl(&quot;TextField18&quot;).Peer.Text
		oOrigine.CharHeight = Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)&apos; + 1
		oShapes.add(oOrigine)
		oOrigine.TextAutoGrowWidth  = True
		oOrigine.TextAutoGrowHeight  = True	
		oOrigine.CharFontName = sFonteName
	&apos;	oOrigine.CharPosture = com.sun.star.awt.FontSlant.ITALIC
	
	
		rem Trac? des vecteurs
		Dim aPosVecteurI As New com.sun.star.awt.Point
		Dim aPosVecteurJ As New com.sun.star.awt.Point
		Dim oVecteurI,oVecteurJ,oModelI,oModelJ as object
		clsid = &quot;078B7ABA-54FC-457F-8551-6147e776a997&quot;
		oVecteurI = oDocument.createInstance(&quot;com.sun.star.drawing.OLE2Shape&quot;)
		oVecteurJ = oDocument.createInstance(&quot;com.sun.star.drawing.OLE2Shape&quot;)
		oPage.add(oVecteurI)
		oPage.add(oVecteurJ)
		aPosVecteurI.x=(MargeX-(AbsMini-1)/NUX)*1000 - 900
		aPosVecteurI.y=(MargeY+Ymaxi/NUY)*1000 + 100
		aPosVecteurJ.x=(MargeX-AbsMini/NUX)*1000 - 650
		aPosVecteurJ.y=(MargeY-(1-Ymaxi)/NUY)*1000 + 300
		oVecteurI.setPosition(aPosVecteurI)
		oVecteurJ.setPosition(aPosVecteurJ)
		oVecteurI.setSize(aSize)
		oVecteurJ.setSize(aSize)
		oVecteurI.CLSID = clsid
		oVecteurJ.CLSID = clsid
		oModelI = oVecteurI.Model
		oModelJ = oVecteurJ.Model
		oVecteurI.SizeProtect = False
		oVecteurJ.SizeProtect = False
		oModelI.BaseFontHeight = Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)
		oModelJ.BaseFontHeight = Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)
		oModelI.formula = &quot;vec &quot;+ oOptions.GetControl(&quot;TextField19&quot;).Peer.Text
		oModelJ.formula = &quot;vec &quot;+ oOptions.GetControl(&quot;TextField20&quot;).Peer.Text
		oShapes.add(oVecteurI)
		oShapes.add(oVecteurJ)
		oModelI.FontNameVariables = sFonteName
		oModelJ.FontNameVariables = sFonteName
	Endif
	rem: fin du trac? du rep?re
	
	rem: trac? de la  ou des courbes
		if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 50
		
	For I=0 to Nbrecourbes 

		
		If bParalleleOrdonnees(I)=False then
		rem On ne trace pas une parall?le ? l&apos;axe des ordonn?es
			oCourbe(I) = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
															 rem +1
			Select Case I
			Case 0
				ColorField=oOptions.GetControl(&quot;TextField7&quot;).Peer.Text
				ColorNumber=Cint(ColorField)
				oCourbe(0).LineColor=Couleur(ColorNumber)
			Case 1
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(1).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField8&quot;).Peer.Text))
				Else
				oCourbe(1).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 2
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(2).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField9&quot;).Peer.Text))
				Else
				oCourbe(2).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 3
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(3).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField10&quot;).Peer.Text))
				Else
				oCourbe(3).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 4
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(4).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField11&quot;).Peer.Text))
				Else
				oCourbe(4).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 5
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(5).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField12&quot;).Peer.Text))
				Else
				oCourbe(5).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 6
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(6).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField15&quot;).Peer.Text))
				Else
				oCourbe(6).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 7
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(7).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField16&quot;).Peer.Text))
				Else
				oCourbe(7).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			Case 8
				If oRepfonctions.Model.CheckBox5.State=0 then 
				oCourbe(8).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField17&quot;).Peer.Text))
				Else
				oCourbe(8).LineColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
				Endif
			End Select
			oCourbe(I).LineWidth=Csng(oOptions.GetControl(&quot;TextField6&quot;).Peer.Text)
		&apos;	oPage.add(oCourbe(I)) 
	
			
			&apos;partie qui dessine les courbes	
			rem Absmini,Absmaxi,
			GraphMinX=1000*MargeX
			GraphMaxX=1000*(MargeX+(Absmaxi-AbsMini)/NUX)
			Rem Ymini,Ymaxi
			GraphMinY=1000*MargeY
			GraphMaxY=1000*(MargeY+(Ymaxi-Ymini)/NUY)
			ToDraw=false
			For k = 0 to NbreX(I)-1
				If Yinfo(I,k)=&quot;ok&quot; and ToDraw=false then 	      
					Firstk=k
					ToDraw=True
					before=false
					if k&lt;&gt;0 then
						if Yinfo(I,k-1)=&quot;out&quot; then 
							before=True 
							Firstk=Firstk-1
						end if
					end if
				end if 
				If Yinfo(I,k)&lt;&gt;&quot;ok&quot; and ToDraw=True then 
					Lastk=k-1
					rem check if connected points near
					after=false
					if Yinfo(I,k)=&quot;out&quot; then 
						after=True    
						Lastk=Lastk+1
					end if   
						length=Lastk-Firstk+1
						rem build coordonates.
						mCoord=arraypoint(length-1)
					for j=0 to length-1
						XPos(I,j)=1000*(MargeX+(XVal(I,j+Firstk)-AbsMini)/NUX)
						YPos(I,j)=1000*(MargeY+(Ymaxi-YVal(I,j+Firstk))/NUY)
						mCoord(j).x=XPos(I,j)
						mCoord(j).y=YPos(I,j)
					next
						
					if before=True then  mCoord(0)=LimXY (mCoord(0),mCoord(1),GraphMinX,GraphMaxX,GraphMinY,GraphMaxY)
					if after = True then  mCoord(length-1)=LimXY (mCoord(length-2),mCoord(length-1),GraphMinX,GraphMaxX,GraphMinY,GraphMaxY)
					rem Dessine cette partie
					on Error Resume Next
					oCourbeTmp = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
					on Error Goto 0
					oCourbeTmp.LineColor =oCourbe(I).LineColor
					oCourbeTmp.LineWidth =oCourbe(I).LineWidth
					oPage.add(oCourbeTmp)
					&apos;print &quot;add courbe tmp&quot;
					vLine=oCourbeTmp.PolyPolygon	
					vLine=Array(mCoord())
					oCourbeTmp.PolyPolygon=vLine
					&apos;Xray vLine
					oShapes.add(oCourbeTmp)      
					ToDraw=False
				end if 
			next
			If ToDraw=True then
			length=NbreX(I)-Firstk
					 rem build coordonates.
					 mCoord=arraypoint(length-1)
				for j=0 to length-1
						XPos(I,j)=1000*(MargeX+(XVal(I,j+Firstk)-AbsMini)/NUX)
						YPos(I,j)=1000*(MargeY+(Ymaxi-YVal(I,j+Firstk))/NUY)
						mCoord(j).x=XPos(I,j)
						mCoord(j).y=YPos(I,j)
					next
				if before=True then  mCoord(0)=LimXY (mCoord(0),mCoord(1),GraphMinX,GraphMaxX,GraphMinY,GraphMaxY)
					oCourbeTmp = oDocument.createInstance(&quot;com.sun.star.drawing.PolyLineShape&quot;)
						oCourbeTmp.LineColor =oCourbe(I).LineColor
						oCourbeTmp.LineWidth =oCourbe(I).LineWidth
						oPage.add(oCourbeTmp)
						&apos;print &quot;add courbe tmp 2&quot;
						vLine=oCourbeTmp.PolyPolygon	
					vLine=Array(mCoord())
					oCourbeTmp.PolyPolygon=vLine
					&apos;Xray vLine
					oShapes.add(oCourbeTmp)      
			end if
		
	&apos;	For ap = 0 to oPage.Count-1
	&apos;		Print oPage.GetByIndex(ap).Position.X
	&apos;	Next ap

		Else

			rem si on trace une parall?le ? Oy
			Dim iNumeColor as Long
			Select Case I
			Case 0
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Case 1
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField8&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 2
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField9&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 3
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField10&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 4
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField11&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 5
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField12&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 6
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField15&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 7
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField16&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			Case 8
			If oRepfonctions.Model.CheckBox5.State=0 then 
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField17&quot;).Peer.Text))
			Else
			iNumeColor=Couleur(Csng(oOptions.GetControl(&quot;TextField7&quot;).Peer.Text))
			Endif
			End Select
			oCourbe(I)=Createmarque(oDocument,oPage,(MargeX-(AbsMini-CsngPlus(Mid(sFormul(I),3,Len(sFormul(I))-2)))/NUX)*1000,(MargeY+(Ymaxi-Ymin(I))/NUY)*1000,(MargeX-(AbsMini-CsngPlus(Mid(sFormul(I),3,Len(sFormul(I))-2)))/NUX)*1000,(MargeY+(Ymaxi-Ymax(I))/NUY)*1000,iNumeColor)
			oShapes.add(oCourbe(I))
		End if 
			
		&apos;CorrigeLeBugPosition(oCourbe(I))
			
		rem affichage de la l?gende
		If oOptions.Model.CheckBox4.State=1 Then
			Dim oLegende(8),oMarque(8) as Object
			Dim aPosLegende(8) As New com.sun.star.awt.Point
			Dim aSizeFormul as New com.sun.star.awt.Size
			aSizeFormul.Width=3000
			aSizeFormul.Height=500
			oLegende(I) = oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
		&apos;	If bDraw=False Then oLegende(I).AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
			oLegende(I).Size=aSizeFormul
			aPosLegende(I).x=(MargeX+CsngPlus(oOptions.GetControl(&quot;TextField13&quot;).Peer.Text))*1000+500
			aPosLegende(I).y=(MargeY+CsngPlus(oOptions.GetControl(&quot;TextField14&quot;).Peer.Text))*1000+500*I
		&apos;	If oRepfonctions.Model.CheckBox1.State=0 Then
				aPosLegende(I).x=aPosLegende(I).x -1000
				aPosLegende(I).y=aPosLegende(I).y -100
		&apos;	Endif
			oLegende(I).Position=aPosLegende(I)
			If I&lt;&gt;0 Then
				If sNomFonction(I)&lt;&gt;sNomFonction(I-1) or (sNomFonction(I)=&quot;&quot; and sFormul(I)&lt;&gt;sFormul(I-1)) Then
					oMarque(I)=CreateMarque(oDocument,oPage,(MargeX+CsngPlus(oOptions.GetControl(&quot;TextField13&quot;).Peer.Text))*1000,(MargeY+CsngPlus(oOptions.GetControl(&quot;TextField14&quot;).Peer.Text))*1000+250+500*I,(MargeX+CsngPlus(oOptions.GetControl(&quot;TextField13&quot;).Peer.Text))*1000+400,(MargeY+CsngPlus(oOptions.GetControl(&quot;TextField14&quot;).Peer.Text))*1000+250+500*I,oCourbe(I).LineColor)
					oPage.add(oLegende(I))
					&apos;print &quot;legende&quot;
				End if
			Else
				oMarque(I)=CreateMarque(oDocument,oPage,(MargeX+CsngPlus(oOptions.GetControl(&quot;TextField13&quot;).Peer.Text))*1000,(MargeY+CsngPlus(oOptions.GetControl(&quot;TextField14&quot;).Peer.Text))*1000+250+500*I,(MargeX+CsngPlus(oOptions.GetControl(&quot;TextField13&quot;).Peer.Text))*1000+400,(MargeY+CsngPlus(oOptions.GetControl(&quot;TextField14&quot;).Peer.Text))*1000+250+500*I,oCourbe(I).LineColor)
				oPage.add(oLegende(I))
			End if
			If  bParalleleOrdonnees(I)=False Then 
				If sNomFonction(I)=&quot;&quot; Then
					oLegende(I).String=&quot;y = &quot;+sFormul(I) 
				Else
					oLegende(I).String=&quot;y = &quot;+sNomFonction(I)+&quot;(x)&quot;
				End if
			Else oLegende(I).String=sFormul(I)
			End if
			oLegende(I).CharHeight=Csng(oOptions.GetControl(&quot;TextField5&quot;).Peer.Text)
			oLegende(I).CharFontName = sFonteName
			oLegende(I).CharPosture = com.sun.star.awt.FontSlant.ITALIC
			oLegende(I).TextAutoGrowWidth  = True
			oLegende(I).TextAutoGrowHeight  = True
			oShapes.add(oMarque(I))
			oShapes.add(oLegende(I))
			&apos;CorrigeLeBugPosition(oMarque(I))
		End if
		if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value + (40/(Nbrecourbes+1))
	Next I
		rem fin du trac? des courbes

rem trac? des points
If bPoints=True Then
	For I=0 To NbrePoints
		Dim oNomPoints(8),oMarquePoints(15) as Object
		Dim aPosPoints(8) As New com.sun.star.awt.Point
		oNomPoints(I) = oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
		&apos;If bDraw=False Then oNomPoints(I).AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
		oNomPoints(I).TextAutoGrowWidth  = True
		oNomPoints(I).TextAutoGrowHeight  = True
		aPosPoints(I).x=1000*(MargeX+(sCoordPoints(I,0)-AbsMini)/NUX)
		aPosPoints(I).y=1000*(MargeY+(Ymaxi-sCoordPoints(I,1))/NUY)
		oNomPoints(I).Position=aPosPoints(I)
		oMarquePoints(2*I)=CreateMarque(oDocument,oPage,1000*(MargeX+(sCoordPoints(I,0)-AbsMini)/NUX)-iMarqHorPoints,1000*(MargeY+(Ymaxi-sCoordPoints(I,1))/NUY)-iMarqVerPoints,1000*(MargeX+(sCoordPoints(I,0)-AbsMini)/NUX)+iMarqHorPoints,1000*(MargeY+(Ymaxi-sCoordPoints(I,1))/NUY)+iMarqVerPoints,0)
		oMarquePoints(2*I+1)=CreateMarque(oDocument,oPage,1000*(MargeX+(sCoordPoints(I,0)-AbsMini)/NUX)+iMarqVerPoints,1000*(MargeY+(Ymaxi-sCoordPoints(I,1))/NUY)-iMarqHorPoints,1000*(MargeX+(sCoordPoints(I,0)-AbsMini)/NUX)-iMarqVerPoints,1000*(MargeY+(Ymaxi-sCoordPoints(I,1))/NUY)+iMarqHorPoints,0)
		oPage.add(oNomPoints(I))
		&apos;print		&quot; ajoute point&quot;
		oNomPoints(I).CharFontName = sFonteName
		oNomPoints(I).String = sPoints(I)
		oNomPoints(I).CharHeight = Csng(oOptions.GetControl(&quot;TextField21&quot;).Peer.Text)
	&apos;	oNomPoints(I).CharPosture = com.sun.star.awt.FontSlant.ITALIC
		oShapes.add(oMarquePoints(2*I))
		&apos;CorrigeLeBugPosition(oMarquePoints(2*I))
		oShapes.add(oMarquePoints(2*I+1))
		&apos;CorrigeLeBugPosition(oMarquePoints(2*I+1))
		oShapes.add(oNomPoints(I))
	Next I
End if
Rem: fin du trace des points
	if debug&lt;&gt;true then oDmProgCourbe.getControl(&quot;ProgressBar1&quot;).Value = 95
	
	
	
Rem fin du la macro

	oGroup = oPage.group(oShapes)
	oEssai = oPage.GetByIndex(oPage.GetCount()-1)
	rem correctif pour reprendre les param?tres

	oEssai.Description = MemoriseCourbe(oEssai)
	
	rem lalalalal
&apos;	Xray oPage1
&apos;	oPage1.add(oEssai)
	
&apos;	oEssai.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
	&apos;	oEssai.Description = &quot;Toto&quot;
	&apos;	Xray oEssai
	If bGrille=True Then		
					&apos;oEssai.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
		oDocument.CurrentController.Select(oEssai)
		ClipboardCopy(oDocument)						
		oDocument.Dispose()
		ClipboardPaste(monDocument)
		If oRepfonctions.Model.CheckBox1.State = 0 Then ToucheEchap(monDocument)
	Goto Fin
	Endif 

	&apos;	oDocument.CurrentController.Frame.ContainerWindow.ToFront
	If bFigure = False Then rem on ne trace pas une figure geometrique
	oDocument.CurrentController.Select(oEssai)
	ClipboardCopy(oDocument)
	if debug&lt;&gt;true then oDmProgCourbe.Visible = False
	rem lalalalalla 
	ToucheSuppr	( monDocument )
	ClipboardPaste( monDocument )
    FrameDocument   = monDocument.CurrentController.Frame
	dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
    dispatcher.executeDispatch(FrameDocument, &quot;.uno:SetAnchorToChar&quot;, &quot;&quot;, 0, Array())

&apos;	ToucheEchap	( monDocument )
	Endif
	
	rem on modifie la courbe obtenue
	If msgBox(sVocab(iLang,222),256+32+4,&quot;Dmaths : &quot;+sVocab(iLang,173))=6 Then 
		oPage.Remove(oEssai)
	&apos;	If oRepfonctions.Model.CheckBox1.State=1 Then oDocument.Dispose()
			If bDiagBox = False Then
				Nbrecourbes = 0
				bModif = True			
				For I=1 To 10
					 oRepfonctions.GetControl(&quot;CheckBox&quot;&amp;CStr(I)).Enable = True
				Next I		
				For I=1 To 6
					oRepfonctions.GetControl(&quot;OptionButton&quot;&amp;CStr(I)).Enable = True
				Next I	
				For I=2 To 3
					oRepfonctions.GetControl(&quot;TextField&quot;&amp;CStr(I)).Enable = True
				Next I	
				For I=6 To 19
					If I&lt;&gt; 17 Then oRepfonctions.GetControl(&quot;TextField&quot;&amp;CStr(I)).Enable = True
				Next I	
				oRepfonctions.GetControl(&quot;Label1&quot;).Enable = True
				For I= 8 To 17
					oRepfonctions.GetControl(&quot;Label&quot;&amp;CStr(I)).Enable = True
				Next I					
				oRepfonctions.Model.TextField17.Text = sNomFonction(Nbrecourbes)
				oRepfonctions.Model.TextField1.Text = sFormul(Nbrecourbes)
				oRepfonctions.Model.TextField4.Text = Xmin(Nbrecourbes)
				oRepfonctions.Model.TextField5.Text = Xmax(Nbrecourbes)
				sNewFormulSpline(NbreCourbes,0,0) = &quot;&quot;
				sNewFormulSpline(NbreCourbes,0,1) = &quot;&quot;
			&apos;	Xray oRepFonctions	
				oRepfonctions.SetVisible(True)
			Else
				oRepfonctions.EndExecute()
				oRepboites.Visible = True
			Endif
	rem la courbe obtenue est validee
	Else		
		oRepFonctions.SetVisible(False)
		oRepfonctions.EndExecute()
		If bDiagBox=True Then 
			rem oRepboites.EndExecute()
			rem bDiagBox=False
			oRepboites.Visible=True
		ElseIf bFigure=True Then
			If bCourbe=True Then
				iNumCourbe=iNumCourbe+1
				oFigure.GetControl(&quot;ListBox2&quot;).Additem(sVocab(iLang,270) &amp; Str(iNumCourbe),iNbreDessinFait)
				bCourbe=False
			Else
				oFigure.GetControl(&quot;ListBox2&quot;).Additem(sVocab(iLang,272),iNbreDessinFait)
			End if
			oFigure.GetControl(&quot;ListBox2&quot;).SelectItemPos(iNbreDessinFait,True)
			iNbreDessinFait=iNbreDessinFait+1
			oFigure.Visible=True
			oFigue.ToFront
		ElseIf oRepfonctions.Model.CheckBox1.State = 0 Then
			&apos;	oEssai.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
			&apos;	oEssai.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
			&apos;	Xray oEssai			
			&apos;	oEssai.LayerID = 1
			&apos;	oDocument.CurrentController.Select(oEssai)
			&apos;	ClipboardCopy(oDocument)						
				oDocument.Dispose()	
				ToucheEchap	( monDocument )
									rem a revoir
			&apos;	ClipboardPaste(monDocument)
				&apos;Xray monDocument
			&apos;Endif 
		Endif
	&apos;	oRepfonctions.Dispose()
		bGrille=False
	End if
Fin:

	if debug&lt;&gt;true then oDmProgCourbe.Dispose()
	If bNewCalc=True Then
		oNewCalc.Dispose()
		bNewCalc=False
	End if
	
	if bFigure = True Then Module6.MAJoFigure() &apos;cf procedure dans module 6 on trace une figure
	
End Sub




</script:module>