This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Tools.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
<?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="Tools" script:language="StarBasic">&apos;Copyright (C) 2008 Didier Dorange-Pattoret
&apos;38, chemin de l&apos;Abbaye  
&apos;74940 Annecy le Vieux
&apos;France
&apos;ddorange@dmaths.com
&apos;module créé le 25 novembre 2003
&apos;********************************************************************************
Public Const listeCar = &quot;Ç ü é â ä à å ç ê ë è ï î ì Ä Å É æ Æ ô ö ò û ù ÿ Ö Ü ø £ Ø × ƒ á í ó ú ñ Ñ ª º ¿ ® ¬ ½ ¼ ¡ « »   Á Â À ©   ¢ ¥   ã Ã   Ê Ë È ı Í Î Ï   Ì   Ó ß Ô Ò õ Õ µ   Ú Û Ù ý Ý   § &quot;
Public Const CarUTF8  = &quot;ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»  ÁÂÀ©  ¢¥  ãà  ÊËÈıÍÎÏ  Ì  ÓßÔÒõÕµ  ÚÛÙýÝ  §&quot;

Public Const iNumVersionDmathsNew = 3400
Global iNombreInstallDmOptions as Integer rem compte le nombre de fois ou les options sont reinstallees à partir de celle sauvegardee dans Dmoptions.txt


Sub Avertir(iNumero as integer) rem affiche un avertissement
	Dim sAvertissement as String
	Dim iParaMsgBox as Integer
	Dim oAverto As Object
&apos;	Print IsNull(iLang)
	iParaMsgBox = 0
&apos;	oAverto = LoadDialog(&quot;Dmaths&quot;,&quot;Avertir&quot;)
	sAvertissement = sVocab(iLang,iNumero)
&apos;	sAvertissement = oAverto.GetControl(&quot;Label&quot;+Cstr(iNumero)).Peer.Text	
	msgbox(sAvertissement,256+48+iParaMsgBox,&quot;Dmaths&quot;)
End Sub


Function IndexChaine(Mot as String,iNbreOver as Integer,maChaine as String) as Integer
&apos; fournit la position du premier caractere de la iNbreOver ieme occurence de maChaine dans Mot
&apos; renvoie 0 si maChaine n&apos;est pas trouvee, 1 si NbreOver = 0.
	Dim iPointVar, iCompteur as Integer &apos; Tant que maChaine n&apos;a pas ete trouvee, renvoit 0.
	iPointVar = 0
	iCompteur=0
	If iNbreOver &gt; 0 Then
	&apos; Renvoit 1 si iNbreOver=0.
		If InStr(Mot,maChaine)&gt; 0 Then
		&apos; iPointVar reste a 0 si maChaine n&apos;est pas trouvee.
		Do Until (iPointVar=0 And iCompteur &gt;0) Or iCompteur=iNbreOver
				&apos; Compte le nombre de fois ou on trouve maChaine jusqu&apos;a ce qu&apos;on atteigne iNbreOver ou qu&apos;on
				&apos; ne trouve plus d&apos;occurence de maChaine.
				iPointVar=InStr(iPointVar+Len(maChaine),Mot,maChaine)
				&apos; iPointVar prend la valeur de la position de la prochaine occurence de maChaine dans Mot
				&apos; (0 si on ne le trouve plus).
				iCompteur=iCompteur+1
		Loop
		EndIf
	Else
	iPointVar=1
	EndIf
	IndexChaine = iPointVar
End Function


Function RemplaceChaine(ByVal chaine As String, src As String, dest As String, casse As Boolean)        
&apos; fournit une chaine dont toutes les occurences de src ont été remplacées par dest      
&apos;casse = true pour distinguer majuscules/minuscules, = false sinon
Dim lsrc As Integer, i As Integer, kas As Integer
dim limite as string
  limite=&quot;&quot;
  kas = iif(casse, 0, 1)
  lsrc = len(src)
  i = instr(1, chaine, src, kas)
  while i&lt;&gt;0
    while i&lt;0
      limite=limite+left(chaine,32000)
      chaine=mid(chaine,32001)
      i=instr(1, chaine, src, kas)
    wend
    &apos; ici i est toujours positif non nul
    if i&gt;1 then
       limite = limite + Left(chaine, i-1) +dest
    else &apos; ici i vaut toujours 1
       limite = limite +dest
    endif   
    &apos; raccourcir en deux temps car risque : i+src &gt; 32767
    chaine = Mid(chaine, i)   
    chaine = Mid(chaine, 1+lsrc)
    i = instr(1, chaine, src, kas)
  wend
  RemplaceChaine = limite + chaine
End Function



rem cree le 3 decembre 2003
sub HideUserDefBar
dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dim Array(0) as new com.sun.star.beans.PropertyValue 
dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
dispatcher.executeDispatch(document, &quot;.uno:ConfigureDialog&quot;, &quot;&quot;, 0, Array())
end sub

Sub MultipleTextSelectionExample
	Dim oSelections As Object, oSel As Object, oText As Object
	Dim lSelCount As Long, lWhichSelection As Long
	&apos;  La sélection courante dans le contrôleur courant. 
	&apos;S&apos;il n&apos;y a pas de contrôleur courant, retourne null.
	oSelections = ThisComponent.getCurrentSelection()
	If Not IsNull(oSelections) Then
		oText = ThisComponent.Text
		lSelCount = oSelections.getCount()
		For lWhichSelection = 0 To lSelCount - 1
			oSel = oSelections.getByIndex(lWhichSelection)
			MsgBox oSel.getString()
		Next
	End If
End Sub


Sub Bordure_Selection rem macro initiée par Agnès Simonet et complétée le 25 novembre 2006 par Didier Dorange-Pattoret 
	Call VerifOperationnel

	Dim MonDocument As Object, MonTexte As Object
	Dim MonCurseur,Moncurseur2 As Object
	Dim CurseurVisible As Object
	Dim CurseurFormat As Object
	Dim MonRectangle, TexteRectangle As Object
	Dim TailleRectangle As New com.sun.star.awt.Size
	Dim TexteDeLaSelection As String
	Dim iLongueurdeSelection as Integer

	Dim CurseurRectangle As Object
	Dim CurseurDebut As Object
	Dim CurseurFin As Object

	&apos;récupère la sélection (4 lignes)
	MonDocument = StarDeskTop.CurrentComponent
	CurseurVisible = MonDocument.currentcontroller.ViewCursor
	MonTexte = CurseurVisible.Text
	
	&apos;crée et positionne le curseur permettant de récupérer le format (1 ligne)
	CurseurFormat = MonTexte.createTextCursorByRange(CurseurVisible.Start)
	&apos; cree et positionne le curseur d&apos;insertion de blanc en debut de paragraphe
	&apos;cela regle le bug qui se produit lorsque la selection comprend le premier caractère du paragraphe
	MonCurseur2 = MonTexte.createTextCursorByRange(CurseurVisible)
	&apos; ce curseur sert à gérer les débuts de paragraphe
	TexteDeLaSelection = CurseurVisible.String
	iLongueurdeSelection = Len(TexteDeLaSelection)


	&apos;cas où rien n&apos;est séctionné (sélection supposée &lt; à 64 ko !) (4 lignes)
	If iLongueurdeSelection = 0 Then 
		MsgBox(sVocab(iLang,376),48,&quot;Dmaths&quot;)
	Exit Sub
	Else
		&apos; cree un blanc en debut de paragraphe si la selection comprend le premier caractere du paragraphe
		If Not MonCurseur2.IsStartofParaGraph Then Moncurseur2.Goleft(Len(TexteDeLaSelection),False)
		If MonCurseur2.IsStartofParaGraph Then
		Montexte.InsertString(MonCurseur2,&quot; &quot;,False)
		Moncurseur2.Goleft(1,False)
		Endif
	
		Dim police(1 to iLongueurdeSelection) as String
		Dim taille(1 to iLongueurdeSelection) as Single
		Dim gras(1 to iLongueurdeSelection) as Single
		Dim italique(1 to iLongueurdeSelection) as Integer
		Dim souligne(1 to iLongueurdeSelection) as Integer
		Dim lcouleur(1 to iLongueurdeSelection) as Long
		Dim ombre(1 to iLongueurdeSelection) as Boolean
		Dim contour(1 to iLongueurdeSelection) as Boolean
		Dim relief(1 to iLongueurdeSelection) as Integer		
		
		rem recupere le format de chaque caractere
		For I = 1 To iLongueurdeSelection
		CurseurFormat.goRight(1,true)
		police(I) = CurseurFormat.CharFontName
		taille(I) =  CurseurFormat.CharHeight
		gras(I) = CurseurFormat.CharWeight
		italique(I) = CurseurFormat.CharPosture
		souligne(I) = CurseurFormat.CharUnderLine
		lcouleur(I) = CurseurFormat.CharColor
		ombre(I) = CurseurFormat.CharShadowed
		contour(I) = CurseurFormat.CharContoured
		relief(I) = CurseurFormat.CharRelief
		CurseurFormat.goRight(0,false)
		Next I
				
		&apos;crée et positionne le curseur d&apos;écriture (1 ligne)
		MonCurseur = MonTexte.createTextCursorByRange(CurseurVisible)
		
		&apos;crée un mini rectangle (5 lignes hors commentaires)
		TailleRectangle.Width = 1
		TailleRectangle.Height = 1
	
		MonRectangle=MonDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
		
		MonTexte.insertTextContent( MonCurseur,MonRectangle,true)
		MonRectangle.Size = TailleRectangle
		
		&apos;ancrage comme caractère (1 ligne)
		MonRectangle.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
		
		&apos;contour (1 ligne)
		MonRectangle.LineStyle = com.sun.star.drawing.LineStyle.SOLID
		
		&apos;centre le rectangle (1 ligne)
		MonRectangle.VertOrient = com.sun.star.text.VertOrientation.CHAR_CENTER
		
		&apos;centre verticalement le texte du rectangle (1 ligne)
		MonRectangle.TextVerticalAdjust = com.sun.star.drawing.TextVerticalAdjust.CENTER
		
		&apos;adapte la taille du rectangle à celle du texte (2 lignes)
		MonRectangle.TextAutoGrowWidth = true
		MonRectangle.TextAutoGrowHeight = true
		&apos; place le rectangle au premier plan
		MonRectangle.LayerId = 1
		&apos;place un curseur dans le rectangle (2 lignes)
		TexteRectangle = MonRectangle.Text
		CurseurRectangle = TexteRectangle.createTextCursor
		TexteRectangle.insertString(CurseurRectangle,TexteDeLaSelection,true)
		CurseurRectangle.goleft(iLongueurdeSelection,false)
		
		rem écrit le format de chaque caractere
		For I = 1 To iLongueurdeSelection
		CurseurRectangle.goright(1,true)		
		CurseurRectangle.CharFontName = police(I)
		CurseurRectangle.CharHeight = taille(I)
		CurseurRectangle.CharWeight = gras(I)
		CurseurRectangle.CharPosture = italique(I)
		CurseurRectangle.CharUnderLine = souligne(I)
		CurseurRectangle.CharColor = lcouleur(I)
		CurseurRectangle.CharShadowed = ombre(I)
		CurseurRectangle.CharContoured = contour(I)
		CurseurRectangle.CharRelief = relief(I)
		CurseurRectangle.goright(0,false)		
		Next I
		
		&apos;supprime le blanc cree en debut de paragraphe
		If MonCurseur2.IsStartofParaGraph Then
			MonCurseur2.Goright(1,True)
			Montexte.InsertString(MonCurseur2,&quot;&quot;,True) 
		Endif
	EndIf
End sub


Sub MetenItalic rem cette macro met en italique le caractère précédent le curseur visible ou la selection.
	Dim Mondocument, CurseurVisible, CurseurFormat as Object
	Call VerifOperationnel
	MonDocument = StarDeskTop.CurrentComponent
	CurseurVisible = MonDocument.currentcontroller.ViewCursor
	MonTexte = CurseurVisible.Text
	If CurseurVisible.IsCollapsed Then
		&apos;crée et positionne le curseur permettant de récupérer le format (1 ligne)
		CurseurFormat = MonTexte.createTextCursorByRange(CurseurVisible)
		CurseurFormat.GoLeft(1,TRUE)
		If CurseurFormat.CharPosture = com.sun.star.awt.FontSlant.NONE Then
			CurseurFormat.CharPosture = com.sun.star.awt.FontSlant.ITALIC
		Else 
			CurseurFormat.CharPosture = com.sun.star.awt.FontSlant.NONE
		End If
		CurseurFormat.GoRight(1,False)
	Else &apos;met en italique la partie sélectionnée
		If CurseurVisible.CharPosture = com.sun.star.awt.FontSlant.NONE Then
				CurseurVisible.CharPosture = com.sun.star.awt.FontSlant.ITALIC
		Else 
				CurseurVisible.CharPosture = com.sun.star.awt.FontSlant.NONE
		End If
		CurseurVisible.CollapseToEnd
	Endif
	If CurseurVisible.IsAtEndOfLine Then CurseurVisible.CharPosture = com.sun.star.awt.FontSlant.NONE
End Sub


Sub Metensurligne rem cette macro met en surligné le caractère précédent le curseur visible ou la selection.
	Dim Mondocument, CurseurVisible, CurseurFormat as Object
	Call VerifOperationnel
	MonDocument = StarDeskTop.CurrentComponent
	CurseurVisible = MonDocument.currentcontroller.ViewCursor
	MonTexte = CurseurVisible.Text
	If CurseurVisible.IsCollapsed Then
		&apos;crée et positionne le curseur permettant de récupérer le format (1 ligne)
		CurseurFormat = MonTexte.createTextCursorByRange(CurseurVisible)
		CurseurFormat.GoLeft(1,TRUE)
		If CurseurFormat.CharOverline = com.sun.star.awt.FontUnderline.NONE Then
			CurseurFormat.CharOverline = com.sun.star.awt.FontUnderline.SINGLE
		Elseif CurseurFormat.CharOverline = com.sun.star.awt.FontUnderline.SINGLE Then
			CurseurFormat.CharOverline = com.sun.star.awt.FontUnderline.DOUBLE
		Else
			CurseurFormat.CharOverline = com.sun.star.awt.FontUnderline.NONE
		End If
		CurseurFormat.GoRight(1,False)
	Else &apos;met en italique la partie sélectionnée
		If CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.NONE Then
				CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.SINGLE
		Elseif CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.SINGLE Then
				CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.DOUBLE
		Else
			CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.NONE
		End If
		CurseurVisible.CollapseToEnd		
	Endif
	If CurseurVisible.IsAtEndOfLine Then CurseurVisible.CharOverline = com.sun.star.awt.FontUnderline.NONE
End Sub


Sub MetenAtalante rem cette macro met en caractère arrondi ATALANTE le caractère précédent le curseur visible ou la selection.
	Dim Mondocument, CurseurVisible, CurseurFormat as Object
	Dim PoliceDefaut, CheminAtalanteUser, CheminAtalanteRezo, CheminAtalante as String
	Dim AtalanteTelechargee, DroitsAdmin as Boolean
	Call VerifOperationnel
rem ce qui suit teste la presence de la police Atalante et propose de la telecharger si besoin
	CheminAtalanteUser = GetRepertoirePath(&quot;user&quot;) &amp; GetPathSeparator &amp; &quot;fonts&quot;  &amp; GetPathSeparator &amp; &quot;Atalante.ttf&quot;
	CheminAtalanteRezo = GetRepertoirePath(&quot;inst&quot;) &amp; GetPathSeparator &amp; &quot;share&quot; &amp; GetPathSeparator &amp; &quot;fonts&quot; &amp; GetPathSeparator &amp; &quot;truetype&quot; &amp;  GetPathSeparator &amp; &quot;Atalante.ttf&quot;
	DroitsAdmin = ControleDroits(GetRepertoirePath(&quot;inst&quot;) &amp; GetPathSeparator &amp; &quot;share&quot; &amp; GetPathSeparator &amp; &quot;fonts&quot;)
	
	If Len(sNomPoliceCursive) = 0 Then
		Monmessage = sVocab(iLang,421)
		MsgBox(Monmessage , 64 + 0 , &quot;Dmaths installation&quot;)	
		Exit Sub
	Endif 
	If Not PoliceScriptTrouvee(sNomPoliceCursive) Then
		If sNomPoliceCursive = &quot;Atalante&quot; Then
			Monmessage = sVocab(iLang,422) &amp;&quot;.&quot; + Chr(13)
			Monmessage = Monmessage &amp; sVocab(iLang,423) + Chr(13)+ Chr(13)
			Monmessage = Monmessage &amp; sVocab(iLang,424) + Chr(13)
			Monmessage = Monmessage &amp; sVocab(iLang,425) + Chr(13)
			If MsgBox(Monmessage , 48 + 4 , &quot;Dmaths installation&quot;) = 6 Then
				If DroitsAdmin or GetGuiType &lt;&gt; 1 Then
						Monmessage = sVocab(iLang,426) + Chr(13)
						If MsgBox(Monmessage , 32 + 4 , &quot;Dmaths installation&quot;) = 6 Then
							If DroitsAdmin then CheminAtalante = CheminAtalanteRezo Else CheminAtalante = CheminAtalanteUser
							If  FileExistsLG(&quot;http://www.cdprof.com/telecharger/At______.ttf&quot;) Then 
								FileCopyLG(&quot;http://www.cdprof.com/telecharger/At______.ttf&quot;, CheminAtalante)				
								AtalanteTelechargee = True				
							Elseif FileExistsLG(&quot;http://archives.ac-strasbourg.fr/database/articles/fichiers/atalante.TTF&quot;) Then
								FileCopyLG(&quot;http://archives.ac-strasbourg.fr/database/articles/fichiers/atalante.TTF&quot;, CheminAtalante)
								AtalanteTelechargee = True			
							Else
							Print &quot;Fichier non trouvé&quot;
							Exit Sub
							Endif
						Endif
				Else 
						MonMessage = sVocab(iLang,427)
						MsgBox(Monmessage , 64 + 1 , &quot;Dmaths installation&quot;) = 6
						Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
						oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
						sGraphPlotter=sChemindmaths+&quot;install_atalante.odt&quot;
						mFileProperties(0).Name=&quot;MacroExecutionMode&quot;
						mFileProperties(0).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
						oDocument = oDesktop.LoadComponentFromURL(sGraphPlotter,&quot;_blank&quot;,0,mFileProperties())				
				Endif		
			Endif
			If AtalanteTelechargee Then
				BasicLibraries.loadLibrary(&quot;DmInstall&quot;)
				If (GetGuiType = 1 or Not FileExists(&quot;/Users&quot;))  Then Call DmInstall.CloseAndLaunchOOo.RelanceOOo
			Endif
		Else
			Monmessage = sVocab(iLang,428) &amp;&quot; &quot; &amp; sNomPoliceCursive &amp; &quot; &quot; &amp; sVocab(iLang,429)
			MsgBox(Monmessage , 64 + 0 , &quot;Dmaths installation&quot;)	
			Exit Sub
		Endif
	Endif
	
	MonDocument = StarDeskTop.CurrentComponent
	CurseurVisible = MonDocument.currentcontroller.ViewCursor
	PoliceDefaut = CurseurVisible.CharFontName
	MonTexte = CurseurVisible.Text
	If CurseurVisible.IsCollapsed Then
	&apos;crée et positionne le curseur permettant de récupérer le format (1 ligne)
	CurseurFormat = MonTexte.createTextCursorByRange(CurseurVisible)
	CurseurFormat.GoLeft(1,TRUE)
	CurseurFormat.CharFontName = sNomPoliceCursive
	CurseurFormat.GoRight(1,False)
	Else &apos;met en italique la partie sélectionnée
	CurseurVisible.CharFontName = sNomPoliceCursive
	CurseurVisible.CollapseToEnd
	Endif
	If CurseurVisible.IsAtEndOfLine Then CurseurVisible.CharFontName = PoliceDefaut
End Sub

Function PoliceScriptTrouvee(sLeNomPoliceScript as String) as Boolean rem Détecte la présence de Atalante
	Dim oWindow    &apos;The container window supports the awt XDevice interface.
	Dim oDescript  &apos;Array of awt FontDescriptor structures
  	Dim s$         &apos;Temporary string variable to hold all of the string names.
  	Dim i%         &apos;General index variable
  	Dim Presente as Boolean

	Presente = False
	oWindow = ThisComponent.getCurrentController().getFrame().getContainerWindow()
  	oDescript = oWindow.getFontDescriptors()
 	s = &quot;&quot;

	For i = LBound(oDescript) to UBound(oDescript)
    	s = s &amp; oDescript(i).Name &amp; &quot;, &quot;
    	If oDescript(i).Name = sLeNomPoliceScript Then Presente = True  
  	Next
  	PoliceScriptTrouvee = Presente
End Function

Sub Aide
	Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
	mFileProperties(0).Name=&quot;MacroExecutionMode&quot;
	mFileProperties(0).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
	Dim oDesktop,oDocument as object
	Dim mNoArgs()
		Call VerifOperationnel
		oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
		sUrl=sChemindmaths+&quot;userguides/&quot;+sVocab(iLang,216)
		oDocument=oDesktop.loadComponentFromUrl(sUrl,&quot;_blank&quot;,0, mFileProperties())
End Sub

Sub FAQ
&apos;Macro enregistrée : jeudi 23 fevrier 2006
	Dim oDesktop,oDocument as object
	Dim mNoArgs()
	Call VerifOperationnel
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sUrl=sChemindmaths+&quot;Faq/&quot;+sVocab(iLang,404)
	oDocument=oDesktop.loadComponentFromUrl(sUrl,&quot;_blank&quot;,0, mNoArgs())
End Sub

Sub Hotomaths
	&apos;Macro enregistrée : lundi 6 décembre 2004, modifiee le 14 decembre 2008
	Dim oDesktop,oDocument as object
	Dim mNoArgs()
	Call VerifOperationnel
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sUrl=sChemindmaths+&quot;userguides/how-to_math.odt&quot;
	oDocument=oDesktop.loadComponentFromUrl(sUrl,&quot;_blank&quot;,0, mNoArgs())
End Sub

Sub FormulaReference
&apos;Macro écrite le vendredi 17 mars 2006, , modifiee le 14 decembre 2008
	Call VerifOperationnel
	Dim oDesktop,oDocument as object
	Dim mNoArgs()
	Call VerifOperationnel
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sUrl=sChemindmaths+&quot;userguides/Formula_Command.odt&quot;
	oDocument=oDesktop.loadComponentFromUrl(sUrl,&quot;_blank&quot;,0, mNoArgs())
End Sub
	
Sub ReglesTypoGraphiques rem macro ecrite le 14 decembre 2008 permet d ouvrir les fichiers sur les regles typographiques
	Dim sUrl as String
	dim sFilePickerArgs as Variant
	dim oFilePicker as Object
	Call VerifOperationnel
	sUrl = sChemindmaths + &quot;userguides&quot; &amp; getPathseparator &amp; &quot;reglestypo&quot;
	If FileExists(sUrl) Then
		sFilePickerArgs = Array(com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE )
		oFilePicker = CreateUnoService( &quot;com.sun.star.ui.dialogs.FilePicker&quot; )
		oFilePicker.setTitle( &quot;Regles typographiques&quot; )	
		oFilePicker.setDisplayDirectory(ConvertToUrl(sUrl))
		If oFilePicker.execute() Then
			On Error Goto ImpLancer 
			Dim sys As Object
			Dim iFlags As Integer
			sys = CreateUnoService(&quot;com.sun.star.system.SystemShellExecute&quot;)
			iFlags = com.sun.star.system.SystemShellExecuteFlags.NO_SYSTEM_ERROR_MESSAGE &apos; = 0
			sys.execute(ConvertToUrl(oFilePicker.Files(0)),&quot; &quot;, iFlags)
			Exit Sub
			ImpLancer:
			MsgBox(&quot;  Dmaths n&apos;a pas pu ouvrir le fichier  &quot;,48,&quot;Dmaths&quot;)
		Endif 
	Else
		MsgBox(&quot;  Répertoire des règles typographiques non trouvé  &quot;,48,&quot;Dmaths&quot;)
	Endif
End Sub

Sub LanceMiliFred
	Call VerifOperationnel
	Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
	Dim oDocument as Object
	oDocumentCourant = ThisComponent
&apos;	oGrille.Visible = False
&apos;	Call FinRepreGrille
	oDesktop = createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sGraphPlotter = sChemindmaths + &quot;milifred.otg&quot;
	mFileProperties(0).Name = &quot;MacroExecutionMode&quot;
	mFileProperties(0).Value = com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
	oDocument = oDesktop.LoadComponentFromURL(sGraphPlotter,&quot;_blank&quot;,0,mFileProperties())
End Sub

Sub FermeMilifred
	Dim oMaGrille, goDoc as Object
	On error resume Next
	
&apos;	MRI Thiscomponent
	For I = 0 To ThisComponent.Drawpages(0).Count-1
		If ThisComponent.Drawpages(0).getByIndex(I).getImplementationName = &quot;SvxShape&quot; Then
			oMaGrille = ThisComponent.Drawpages(0).getByIndex(I)
		End if
	Next I
	goDoc = ThisComponent 
	If Not IsEmpty(oMaGrille) Then 
&apos;	Print &quot;uouo&quot;
	goDoc.CurrentController.Select(oMaGrille)
	ClipboardCopy(goDoc)	
	ClipboardPaste(oDocumentCourant)
	End if
&apos;	ToucheEchap(oDocumentCourant)
	goDoc.Dispose()
	On error Goto 0 

End Sub

Sub LanceBPH
	Call VerifOperationnel
	Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
	Dim oDocument as Object
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sGraphPlotter=sChemindmaths+&quot;BPH.ots&quot;
	mFileProperties(0).Name=&quot;MacroExecutionMode&quot;
	mFileProperties(0).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
	oDocument = oDesktop.LoadComponentFromURL(sGraphPlotter,&quot;_blank&quot;,0,mFileProperties())
End Sub

Sub Lancefitoo
	Call VerifOperationnel
	Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
	Dim oDocument as Object
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sGraphPlotter=sChemindmaths+&quot;fitoo.ots&quot;
	mFileProperties(0).Name=&quot;MacroExecutionMode&quot;
	mFileProperties(0).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
	oDocument = oDesktop.LoadComponentFromURL(sGraphPlotter,&quot;_blank&quot;,0,mFileProperties())
End Sub

Sub LanceBackup
	BasicLibraries.loadLibrary(&quot;DmathsBup&quot;)
	Call DmathsBup.Module3.Initialisation
End Sub

Sub LanceBatchConv
	BasicLibraries.loadLibrary(&quot;BatchConv&quot;)
	Call BatchConv.Module1.Main
End Sub

sub InsereObjetWriterdsPresentation rem cette macro permet linsertion du objet writer dans une presentation
									rem ajoutee le 16 mai 2010
	dim obj, controller as object
	dim aPos as variant
	dim aSize as variant
	obj = ThisComponent.CreateInstance(&quot;com.sun.star.drawing.OLE2Shape&quot;)

	aPos = obj.position
	aPos.x = 2000
	aPos.y = 2000
	obj.position = aPos

	aSize = obj.size
	aSize.height = 1000
	aSize.width = 1000
	obj.size = aSize

	obj.CLSID = &quot;8BC6B165-B1B2-4EDD-aa47-dae2ee689dd6&quot;
	obj.name = &quot;WriterObj&quot;
	thisComponent.drawpages(0).add(obj)
	obj.EmbeddedObject.Component.Text.String= &quot;&quot;

	ThisComponent.CurrentController.Select(obj)
	controller = thisComponent.currentController

	if (not isNull(controller)) then
		if (controller.select(obj)) then
			dim args1(0) as new com.sun.star.beans.PropertyValue
			dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
			args1(0).Name = &quot;VerbID&quot;
			args1(0).Value = 65535
			dispatcher.executeDispatch(controller.frame, &quot;.uno:ObjectMenue&quot;, &quot;&quot;, 0, args1())
		end if
	end if
end sub

Sub ChangebExecCoordColonne
	bExecCoordColonne = Not bExecCoordColonne
End Sub


&apos; cette fonction convertit la plupart des caractères nationaux ( en, fr, d, es, it notamment )
&apos; utilise deux tables dépendant du jeu de caractères en cours : listeCar et CarUTF8
&apos; arg2 : conversion de certains caractères en entités caractères xml prédéfinies
Function convertToUTF8(unTexte As String, entites As Boolean) As String
	Dim x1 As Integer, y2 As Integer
	Dim Texte8 As String, c1 As String
	Dim xmlEntites()
	Const listeEntites = &quot;&amp;&apos;&gt;&lt;&quot;&quot;&quot; &apos; caractères en conflit avec des délimiteurs de balisage
	
	xmlEntites = Array(&quot;&amp;amp;&quot;, &quot;&amp;apos;&quot;, &quot;&amp;gt;&quot;, &quot;&amp;lt;&quot;, &quot;&amp;quot;&quot;)
	Texte8 = &quot;&quot;
	for x1 = 1 to Len(unTexte)
	  c1 = Mid(unTexte, x1, 1)
	  if entites then
	    y2 = InStr(1, listeEntites, c1, 0)
	    if y2 &gt; 0 then
	      Texte8 = Texte8 &amp; xmlEntites(y2 -1)
	    else &apos; conversion éventuelle en UTF-8
	      if ASC(c1) &lt; 128 then
	        Texte8 = Texte8 &amp; c1 &apos; code UTF-8 identique au code ASCII
	      else
	        y2 = Instr(1, listeCar, c1, 0)
	        if y2 &gt; 0 then
	          Texte8 = Texte8 &amp; Mid(CarUTF8, y2, 2) &apos; equivalent UTF-8 ( deux octets )
	        else
	          Texte8 = Texte8 &amp; &quot;?&quot; &apos; caractère non traduit en UTF-8
	        end if
	      end if
	    end if
	  end if
	next
	convertToUTF8 = Texte8
End Function


Function GetRepertoirePath(sInstPath as String) as String &apos;donne le répertoire correspondant
	Dim  oPathSubstSrv as Object
	Dim sPath as String
		sInstPath = &quot;$(&quot;+sInstPath+&quot;)&quot;
		oPathSubstSrv = createUnoService(&quot;com.sun.star.comp.framework.PathSubstitution&quot;)
		sPath = ConvertFromUrl(oPathSubstSrv.getSubstituteVariableValue(sInstPath))
		GetRepertoirePath = sPath
End Function

&apos;--------------------------------------------------------------------------------------------------

Function ControleDroits(byVal optional LeChemin as string) as boolean
	on error goto PasDroit
		leChemin=convertToURL(leChemin)+&quot;/&quot;
	open  leChemin+&quot;temp&quot; for output as #1
		Print #1,cstr(now)
	close #1
	Kill LeChemin+&quot;temp&quot;
	ControleDroits=True
	Exit function
	PasDroit:
	ControleDroits=false
end function

Function GetConfigAccess( ByVal cNodePath As String,ByVal bWriteAccess As Boolean,Optional bEnableSync,Optional bLazyWrite) As Object
	If IsMissing(bEnableSync) Then 	bEnableSync = True 
	If IsMissing( bLazyWrite ) Then bLazyWrite = False
	Dim oConfigProvider, oConfigAccess as Object
	oConfigProvider = GetProcessServiceManager.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationProvider&quot;,Array( MakePropertyValue( &quot;enableasync&quot;, bEnableSync)))
	If bWriteAccess Then
		cServiceName = &quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;
	Else
		cServiceName = &quot;com.sun.star.configuration.ConfigurationAccess&quot;
	EndIf
	oConfigAccess = oConfigProvider.createInstanceWithArguments( cServiceName, Array( MakePropertyValue( &quot;nodepath&quot;, cNodePath ), MakePropertyValue( &quot;lazywrite&quot;, bLazyWrite )))
	GetConfigAccess() = oConfigAccess
End Function

&apos;----------
&apos;	Create and return a new com.sun.star.beans.PropertyValue.
&apos;
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
	Dim oPropertyValue As New com.sun.star.beans.PropertyValue
	If Not IsMissing( cName ) Then
		oPropertyValue.Name = cName
	EndIf
	If Not IsMissing( uValue ) Then
		oPropertyValue.Value = uValue
	EndIf
	MakePropertyValue() = oPropertyValue
End Function



Rem ces macros permettent de convertir une zone en adresse textuelle 
Function adrZoneString(maDoc As Object, adrZone As Object) As String
	Dim resu As String
	resu = alphaXY(adrZone.StartColumn, adrZone.StartRow)&amp;&quot;:&quot;&amp; alphaXY(adrZone.EndColumn, adrZone.EndRow)
	adrZoneString = resu
End Function


&apos; convertit une adresse de cellule en adresse textuelle
Function adresseString(maDoc As Object, adrCellule As Object) As String
	adresseString = maDoc.Sheets(adrCellule.Sheet).Name &amp; &quot;.&quot; &amp; alphaXY(adrCellule.Column, adrCellule.Row)
End Function


&apos; convertit une coordonnée XY en coordonnée alphanumérique
Function alphaXY(X As Long, Y As Long) As String
	if (Y&gt;=0) and (Y&lt;32000) then
	  alphaXY = lettreColonne(X) &amp; CStr(Y +1)
	else
	  alphaXY = lettreColonne(X) &amp; &quot;??&quot;
	end if
End Function


&apos; convertit numéro de colonne 0...255 en lettres A...IV
Function lettreColonne(n As Long) As String
	Select Case n
	Case &gt; 255
	  lettreColonne = &quot;??&quot;
	Case &lt; 0
	  lettreColonne = &quot;??&quot;
	Case &lt; 26
	  lettreColonne = _Lettre(n)
	Case Else
	  lettreColonne = _Lettre((n \ 26) -1) &amp; _Lettre(n Mod 26)
	End Select
End Function

&apos; fonction interne
Function _Lettre(p As Long) As String
_Lettre = chr(Asc(&quot;A&quot;) +p)
End Function

Sub Display_Dmaths_barre
	Dim sUrl, sUrl1 as String
	oFrame = ThisComponent.CurrentController.Frame
	layout = oFrame.LayoutManager
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )	
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;) Then
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/addon_2&quot;) Then
		sUrl=&quot;private:resource/toolbar/addon_0&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/Add-on 3&quot;) Then
		sUrl=&quot;private:resource/toolbar/Add-on 1&quot;
	Endif
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;) Then
		sUrl1=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/addon_2&quot;) Then
		sUrl1=&quot;private:resource/toolbar/addon_2&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/Add-on 3&quot;) Then
		sUrl1=&quot;private:resource/toolbar/Add-on 3&quot;
	Endif
	If layout.IsElementVisible(sUrl) Then
	layout.hideElement(sUrl)
	layout.hideElement(sUrl1)
	Else
	layout.showElement(sUrl)
	layout.showElement(sUrl1)
	Endif 
End Sub

Sub Display_Gdmath_barre
	Dim sUrl, sUrl1 as String
	oFrame = ThisComponent.CurrentController.Frame
	layout = oFrame.LayoutManager
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )	
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/addon_2&quot;) Then
		sUrl=&quot;private:resource/toolbar/addon_0&quot;
	Elseif oConfigAccess.HasByName(&quot;private:resource/toolbar/Add-on 3&quot;) Then
		sUrl=&quot;private:resource/toolbar/Add-on 1&quot;
	Endif
	If layout.IsElementVisible(sUrl) Then
	layout.hideElement(sUrl)
	layout.hideElement(sUrl1)
	Else
	layout.showElement(sUrl)
REM	layout.showElement(sUrl1)
	Endif 
End Sub



Sub VerifOperationnel
	
	If DictionnaireCharge = False Then Call ChargementDuDictionnaire rem on charge le dictionnaire si pas encore fait
	Dim MyLibStandard as Object
	On error resume next
	MyLibStandard = BasicLibraries.Standard
	BasicLibraries.LoadLibrary(MyLibStandard)
	
	If (MyLibStandard.hasByName(&quot;DmOptions&quot;) and iNombreInstallDmOptions = 0) Then
		If 	iNumVersionDmathsNew &gt; iNumVersionDmathsCourante Then 
			BasicLibraries.loadLibrary(&quot;DmInstall&quot;)
			Call DmInstall.Install_Addon.LanceFinInstallation(TRUE)  rem le parametre est True si on met à jour	
		Endif			
	Else
		BasicLibraries.loadLibrary(&quot;DmInstall&quot;)
		Call DmInstall.Install_Addon.LanceFinInstallation(FALSE) rem le parametre est False si ne met pas à jour		
	Endif

	If ((Len(MyLibStandard.getByName(&quot;DmOptions&quot;)) &lt; 10) or (Len(cstr(iTailleFormules)) = 0)) Then rem installe dmoptions si module Dmoptions vide
		BasicLibraries.loadLibrary(&quot;DmInstall&quot;)
		&apos;Print &quot;passe&quot;
		iNombreInstallDmOptions = iNombreInstallDmOptions + 1 rem ce parametre compte le nombre dinstalation des options faites a partir de options.txt
		CloseAndLaunchOOo.InstallDmOptions
	Else
		iNombreInstallDmOptions = 0 rem on remet les compteurs à 0 si pas doptions reinstallee
	Endif
&apos;	If iNombreInstallDmOptions &gt; 1 Then 	
		&apos;Avertir(100)
&apos;		BasicLibraries.loadLibrary(&quot;DmInstall&quot;)
&apos;		Call DmInstall.Install_Addon.LanceFinInstallation(FALSE)
&apos;	Endif
	On error goto 0
End Sub



Function OOoNumVersion() As Integer
  &apos;Retreives the running OOO version
  Dim aSettings, aConfigProvider
  Dim aParams2(0) As new com.sun.star.beans.PropertyValue
  Dim sProvider$, sAccess$
  sProvider = &quot;com.sun.star.configuration.ConfigurationProvider&quot;
  sAccess   = &quot;com.sun.star.configuration.ConfigurationAccess&quot;
  aConfigProvider = createUnoService(sProvider)
  aParams2(0).Name = &quot;nodepath&quot;
  aParams2(0).Value = &quot;/org.openoffice.Setup/Product&quot;
  aSettings = aConfigProvider.createInstanceWithArguments(sAccess, aParams2())
  If aSettings.hasbyname(&quot;ooSetupVersionAboutBox&quot;) Then
  sOOOVersion = aSettings.getbyname(&quot;ooSetupVersionAboutBox&quot;)
  Else
  sOOOVersion = aSettings.getbyname(&quot;ooSetupVersion&quot;)
  EndIf
  If Len(sOOOVersion) = 3 Then sOOOVersion = sOOOVersion &amp; &quot;.0&quot;
  OOoNumVersion = Cint(Mid(sOOOVersion,1,1))*100 + Cint(Mid(sOOOVersion,3,1))*10 + Cint(Mid(sOOOVersion,5,1))  
End Function


rem cette fonction convertit un entier dans son ecriture en base 100

function ConvertEntier(iEntier as integer) as String
	ConvertEntier = cStr(iEntier)
	If iEntier &lt; 10 Then ConvertEntier = &quot;0&quot;&amp;ConvertEntier
end function

Function Arrondir(x as Double, nbre as integer) rem cette fonction arrondi les singles
	Dim y as Double
	y = Int(x*10^nbre+0.5)/(10^nbre)
	Arrondir = y
End Function


Function FileExistsLG(myURL) as boolean
	on error goto outWithError
	oFileRead = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
	FichInput = oFileRead.openfileread(convertToURL(myURL))
	FileExistsLG = true
	exit function
	outWithError:
	FileExistsLG = false
End Function

Sub FileCopyLG(src as string, dst as string, optional pgb)

	dim oFileRead, FichInput
	dim oFileWrite, FichOut
	dim unTab(), unTab2()
	dim BlockRead as long
	dim MajPgb as boolean
	
	BlockRead=10240
	MajPgb= Not IsMissing(pgb)
	
		oFileRead = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
		FichInput = oFileRead.openfileread(convertToURL(src))
		oFileWrite=createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
		FichOut=oFileWrite.openfilewrite(convertToURL(dst))
		
	retour=BlockRead
	
	while retour=BlockRead
		&apos;redim untab()
		retour=fichInput.readbytes(unTab,BlockRead)
		if retour=BlockRead then
			FichOut.writebytes(unTab())
		else
			redim untab2(0 to retour-1)
			for i=0 to retour-1
				untab2(i)=untab(i)
			next i
			FichOut.writebytes(unTab2())
		endif
		if MajPgb then
			pgb.setvalue(pgb.value+retour)	
		endif
	wend
	
	fichInput.closeinput
	fichout.closeoutput
end sub


Function DetermineOS as Integer rem renvoie 1 si win, 3 si Mac, 4 si Linux
	If GetGuiType = 1 Then
		DetermineOS = 1
	ElseIf GetGuiType = 3 or (GetGuiType = 4 and FileExists(&quot;/Users&quot;)) Then
		DetermineOS = 3
	Else
		DetermineOS = 4
	Endif
End Function

Function IsMacOS as Boolean	
	If GetGuiType = 3 or (GetGuiType = 4 and FileExists(&quot;/Users&quot;)) Then IsMacOS = True Else IsMacOS = False
End Function

Function GetDocumentFrame( oDoc As Object ) As Object
   Dim oFrame As Object
   Dim oCtrl As Object
   
   &apos; If the caller gave us the document model...
   If oDoc.supportsService( &quot;com.sun.star.document.OfficeDocument&quot; ) Then
      &apos; ...then get the controller from that.
      oCtrl = oDoc.getCurrentController()
      &apos; ...then get the frame from the controller.
      oFrame = oCtrl.getFrame()

   &apos; If the caller gave us a document controller...
   ElseIf HasUnoInterfaces( oDoc, &quot;com.sun.star.frame.XController&quot; ) Then
      oCtrl = oDoc
      &apos; ...then get the frame from the controller.
      oFrame = oCtrl.getFrame()
   
   &apos; If the caller gave us the document frame...
   ElseIf HasUnoInterfaces( oDoc, &quot;com.sun.star.frame.XFrame&quot; ) Then
      &apos; ...thanks!  That&apos;s just what we wanted!
      oFrame = oDoc
   
   Else
      &apos; The caller did not give us what we expected!
      MsgBox( &quot;GetDocumentFrame called with incorrect parameter.&quot; )
   EndIf
   
   GetDocumentFrame() = oFrame
End Function



&apos;----------
&apos; An easy to use Dispatch on an office document.
&apos; Arguments are similar to the args for the com.sun.star.frame.XDispatchHelper
&apos;  interface of com.sun.star.frame.DispatchHelper.
&apos; What makes this so easy to use are two things:
&apos;   1. The fact that the oDocumentFrame parameter can actually accept
&apos;      either the document model or one of its controllers.
&apos;   2. The optional parameters.
&apos; For an example of how simple this routine is to use, see
&apos;  routines such as ClipboardCopy().
&apos;
&apos; Parameters:
&apos;      oDocumentFrame      -   An office document frame.
&apos;                        But wait!  It could be the document controller
&apos;                         or the document model.  This routine will find
&apos;                         the document frame from either of these.
&apos;      cURL            -   The dispatch URL.
&apos; Optional:
&apos;      cTargetFrameName   -   Defaults to blank.
&apos;      nSearchFlags      -   Defaults to zero.
&apos;      aDispatchArgs      -   Defaults an an empty sequence.
&apos;
Sub DocumentDispatch( ByVal oDocumentFrame As Object,_
                  ByVal cURL As String,_
                  Optional cTargetFrameName,_
                  Optional nSearchFlags,_
                  Optional aDispatchArgs )

   dim oDispatchHelper   

   &apos; If they gave us the wrong parameter...
   If Not HasUnoInterfaces( oDocumentFrame, &quot;com.sun.star.frame.XFrame&quot; ) Then
      &apos; Be sure that we&apos;ve got the document frame.
      &apos; Someone might have passed us the document model or one of
      &apos;  its controller&apos;s.
      oDocumentFrame = GetDocumentFrame( oDocumentFrame )
   EndIf
   
   If IsMissing( cTargetFrameName ) Then
      cTargetFrameName = &quot;&quot;
   EndIf
   If IsMissing( nSearchFlags ) Then
      nSearchFlags = 0
   EndIf
   If IsMissing( aDispatchArgs ) Then
      aDispatchArgs = Array()
   EndIf
   
   oDispatchHelper = createUnoService( &quot;com.sun.star.frame.DispatchHelper&quot; )
   oDispatchHelper.executeDispatch( oDocumentFrame, cURL, cTargetFrameName, nSearchFlags, aDispatchArgs )
End Sub

&apos;############################################################
&apos;   Clipboard manipulation
&apos;############################################################

Sub ClipboardPaste( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Paste&quot; )
End Sub

Sub ClipboardCopy( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Copy&quot; )
End Sub

Sub ClipboardCut( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Cut&quot; )
End Sub
	
Sub ToucheEchap ( oDocumentFrame )
	DocumentDispatch( oDocumentFrame, &quot;.uno:Escape&quot; )
End Sub 

Sub ToucheSuppr ( oDocumentFrame )
	DocumentDispatch( oDocumentFrame, &quot;.uno:Delete&quot; )
End Sub 

Sub LanceMacroDansDocument ( oDocumentFrame, sLaMacro )
	DocumentDispatch( oDocumentFrame, &quot;macro://&quot; &amp; sLaMacro )
End Sub



</script:module>