This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/DmInstall/Install_Addon.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
<?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="Install_Addon" script:language="StarBasic">&apos;************************************************
&apos;Copyright (C) 2006-2010 Didier Dorange-Pattoret
&apos;38, chemin de l&apos;Abbaye 
&apos;74940 Annecy le Vieux
&apos;France
&apos;ddorange@dmaths.com
&apos;
&apos;
&apos;This library is free software; you can redistribute it and/or
&apos;modify it under the terms of the GNU General Public Licence (GPL)
&apos;as published by the Free Software Foundation; either
&apos;version 2.1 of the License, or (at your option) any later version.

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

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



REM  *****  BASIC  *****

Public oChoixrepinstallation, oDmProgInst as Object
Public iLangInstall as Integer 
Public sLang as String 
Public sNotfound as String rem sInstallOpen,
rem sInstallOpen est la racine du rep utilisateur, 
Public sUserPath as String
Public oDeskTop,oSheetLangues,oCalcLangues as Object
Public mFileProperties(0) As New com.sun.star.beans.PropertyValue
Public sUrl,sMotVar as String
Public bPremInstall, bMiseAJour as Boolean
Public AppsPref(9,2) as String
Public sRepertoireDmaths as String
Public const iVersion = &quot; 3.4.0.0 &quot;
Public const iNumVersionDmaths = 3400 rem à changer également dans Dmaths Tools
Public const iNbreThemesIcones = 5



Sub LanceFinInstallation (bOnMetAJour as Boolean)
	DialogLibraries.loadLibrary( &quot;DmInstall&quot;)
	oDmProgInst = CreateUnoDialog(DialogLibraries.DmInstall.DmProgInst)
	oDmProgInst.Visible = True
	Wait 500	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 0

	If bOnMetAJour Then rem on fait une mise a jour
		bPremInstall = FALSE
		bMiseAJour = TRUE	
	Else               rem on fait une premiere installation
		bPremInstall = TRUE
		bMiseAJour = FALSE
	Endif 
	
	
	iLangInstall = TrouveLang rem on charge les langues
	
	BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 5

	Call TestPresencesMath				rem verifie que le module math est installé
	Call AfficheChoixRepertoireInstallation

End Sub


Sub TestPresencesMath
	Dim sCheminMath, sAvertoMessage As String
	sCheminMath = GetRepertoirePathprog &amp; &quot;smath&quot;
	If GetGuiType = 1 Then sCheminMath = sCheminMath &amp; &quot;.exe&quot;
	If  Not FileExists(sCheminMath) Then
		MsgBox(&quot;Le module Math n&apos;est pas installé&quot;+chr(13)+chr(13)+&quot;Math module is not installed&quot;,48,&quot;Dmaths&quot;)	
		Stop	
	Endif
End Sub



Sub AfficheChoixRepertoireInstallation	

	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 10
	
	oChoixrepinstallation = CreateUnoDialog( DialogLibraries.DmInstall.Choixrepinstallation )


	rem recherche des logiciels installes
	LoadAppsPref(oChoixrepinstallation,bPremInstall,False,PreselectionneNumeroTheme)						

 
    sUserPath = GetRepertoirePath(&quot;user&quot;)                         rem utilité a revoir

	Call Fininstallation                                           rem nouveauté
End sub


Sub Fininstallation

	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 15

	BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
	sLeChemindeDmaths = sCheminDmaths 

	
rem---------------------------------------------------------------------------------------
&apos; en cas d&apos;installation reseau
&apos;	Print TestInstallRezo

	If bPremInstall Then
		If  TestInstallRezo   Then
			If Not FileExists(GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;dmaths&quot;) Then MkDir GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;dmaths&quot;
			If FileExists(GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;dmaths&quot;+GetPathSeparator+&quot;dmaths.ods&quot;) Then Kill GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;dmaths&quot;+GetPathSeparator+&quot;dmaths.ods&quot;
			FileCopy fChemindmaths+&quot;dmaths.ods&quot;, ConvertToURL(GetRepertoirePath(&quot;user&quot;)+&quot;/dmaths/dmaths.ods&quot;)
		EndIf
	Endif
	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 35
	

rem configure les raccourcis clavier pour les MAC	
	If IsMacOS Then
		Config4Mac(True)
	EndIf

rem configure les raccourcis claviers pour OOo &lt;  3.1

If OOONumVersion &lt; 310 Then
	RaccourcisClavier
End if



rem-----------------------------------------------------------------------------------
&apos; copie des fontes Cmath
rem Fontes



rem------------------------------------------------------------------------------------
&apos;regler le numerotation des icones et choix du theme d&apos;icones 	
	RegleNumerotationIcones rem cette macro regle lors de l&apos;installation la numerotation des icones de la barre dmaths
	 RegleIconesAppsPref(oChoixrepinstallation,DeterminesThemeIcons(oChoixrepinstallation)) rem regle les icones des 3 applications preferees
	ChoisirThemeIcone(DeterminesThemeIcons(oChoixrepinstallation)) rem met en place le theme d&apos;icones choisi
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 50
	
rem ---------------------------------------------------------------------------------------------------------------------------	
&apos;regler les icones du menu dmaths
	MaJIconesDuMenuDmaths
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 65
rem-------------------------------------------------------------------------------------
&apos;installation des options en cas de première installation


	If bPremInstall Then Options Else OptionsUtilisateur
	If bPremInstall Then OptionsBackup
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 80
	
	
rem------------------------------------------------------------------------------------
&apos; renommage des barres d&apos;Addon en Dmaths, Afficher-Masquer, Gdmath
	Dim sNomdeBarre as String

REM ------- modul:writer Dmaths
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )
	If iLangInstall = 0 Then sNomdeBarre = &quot;Dmaths Barre&quot; Else sNomdeBarre = &quot;Dmaths-Addon&quot;
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_1&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_1&quot;)	
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/Add-on 1&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/Add-on 1&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif
	oConfigAccess.commitChanges()


REM ------- modul:writer Dmaths on/off 
	If iLangInstall = 0 Then 
		sNomdeBarre = &quot;Dmaths Afficher/Masquer&quot;
	Elseif iLangInstall = 2 Then
		sNomdeBarre = &quot;Dmaths an/aus-Schalter&quot;
	Else
		sNomdeBarre = &quot;Dmaths on/off switch&quot;
	Endif
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_0&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_0&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/Add-on 2&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccess.commitChanges()
	
REM ------- modul:writer OOoTep 
	If iLangInstall = 0 Then 
		sNomdeBarre = &quot;OOoTep-Gdmath Afficher/Masquer&quot;
	Elseif iLangInstall = 2 Then
		sNomdeBarre = &quot;OooTep-Gdmath an/aus-Schalter&quot;
	Else
		sNomdeBarre = &quot;OooTep-Gdmath on/off switch&quot;
	Endif
	If oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccess.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccess.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccess.commitChanges()

REM ------- modul:writer OOoGdmath
	If iLangInstall = 0 Then sNomdeBarre = &quot;OOoGdmath&quot; Else sNomdeBarre = &quot;OOoGdmath-Addon&quot;
	oConfigAccessW = GetConfigAccess( &quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )
	If oConfigAccessW.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessW.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessW.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccessW.commitChanges()

REM ------- modul:draw OOoGdmath
	If iLangInstall = 0 Then sNomdeBarre = &quot;OOoGdmath&quot; Else sNomdeBarre = &quot;OOoGdmath-Addon&quot;
	oConfigAccessD = GetConfigAccess( &quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States&quot;, True )
	If oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccessD.commitChanges()

REM ------- modul:draw OOoTep 
	If iLangInstall = 0 Then 
		sNomdeBarre = &quot;OOoTep-Gdmath Afficher/Masquer&quot;
	Elseif iLangInstall = 2 Then
		sNomdeBarre = &quot;OooTep-Gdmath an/aus-Schalter&quot;
	Else
		sNomdeBarre = &quot;OooTep-Gdmath on/off switch&quot;
	Endif
	oConfigAccessD = GetConfigAccess( &quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States&quot;, True )
	If oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccessD.commitChanges()

	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 85
	
rem ------------------------------------------------------------------------------------------------------------------	
	rem supprime le test de nouvelle version au demarrage
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Events/ApplicationEvents/Bindings&quot;, True )
	If oConfigAccess.hasByName(&quot;OnStartApp&quot;) Then
		If oConfigAccess.OnStartApp.hasByName(&quot;BindingURL&quot;) Then
			If InStr(oConfigAccess.OnStartApp.BindingURL,&quot;TestNewVersionDemarrage&quot;) &gt; 0 Then 
			oConfigAccess.RemoveByName(&quot;OnStartApp&quot;)
			oConfigAccess.commitChanges()
			Endif
		Endif
	Endif	
	rem fin de la suppression

	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 90
	

	oChoixrepinstallation.Dispose()

	
rem on recharge la bibliothèque Standard et on supprime le module DmCloseQuick
	If GetguiType = 1 Then
		BasicLibraries.loadLibrary(&quot;Standard&quot;)
		oLib = GlobalScope.BasicLibraries.Standard
		If oLib.hasByName(&quot;DmCloseQuick&quot;) Then
	    oLib.removeByName(&quot;DmCloseQuick&quot;)
	    EndIf
    Endif
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 95

rem met à jour le fichier description.xml si DmathsClub presente        
	MetAJourDescription 
	
rem ----------------------------------------------------------------------------
rem regle le chemin des icones des autres comptes dans les installations multiutilisateurs
	If (TestInstallRezo and ControleDroits(GetRepertoirePath(&quot;inst&quot;)) and Len(sLeChemindeDmaths)&lt;&gt;0) Then 
	RegleCheminDesIcones(sLeChemindeDmaths)
	Endif 
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 100
	
	
   &apos; Wait 3000
    oFinInst = CreateUnoDialog(DialogLibraries.DmInstall.FinInst )

	oFinInst.GetControl(&quot;Label1&quot;).Peer.Text = oFinInst.GetControl(&quot;Label1&quot;).Peer.Text &amp; chr(13) &amp; chr(13) &amp; chr(13)  &amp; &quot;Version &quot; &amp; iVersion

	oDmProgInst.Dispose()
	oFinInst.execute()
	
		
End sub



Function TrouveLang as Integer &apos;retourne un nombre correspondant a la langue de l&apos;utilisateur.
	Dim iLangT as Integer
	Dim oLibT as Object rem sLang est un variable Public	
	oLibT = GlobalScope.BasicLibraries.Standard
	If oLibT.hasByName(&quot;DmOptions&quot;) Then
		iLangT = iLang
	Else
		sLang = GetRepertoirePath(&quot;vlang&quot;)    
		Select Case sLang
			Case &quot;fr&quot;
				iLangT = 0
			Case &quot;de&quot;
				iLangT = 2
		&apos;	Case &quot;es&quot;
		&apos;		iLangT = 3		
		&apos;	Case &quot;it&quot;
		&apos;		iLangT = 4
		&apos;	Case &quot;da&quot;
		&apos;		iLangT = 5
		&apos;	Case &quot;sk&quot;
		&apos;		iLangT = 6
			Case Else 
				iLangT = 1
		End Select
	Endif
	If iLangT &lt;&gt; 2 Then sLang = &quot;fr&quot; rem pour l&apos;installation des autotextes
		TrouveLang = iLangT
End Function

Sub RaccourcisClavier rem écrite par Jérôme Ortais modifiee par Didier Dorange-Pattoret le 24 fevririer 2008
	Dim sNomFichier as String, iF1 as Integer, sLigne as String, sDebut as String, sFin as String
	sNomFichier=GetRepertoirePath(&quot;user&quot;)+&quot;/config/soffice.cfg/modules/swriter/accelerator/&quot;+GetRepertoirePath(&quot;vlang&quot;)+&quot;/current.xml&quot;
	sNomFichierOld=GetRepertoirePath(&quot;user&quot;)+&quot;/config/soffice.cfg/modules/swriter/accelerator/&quot;+GetRepertoirePath(&quot;vlang&quot;)+&quot;/current.old&quot;

	If Not FileExists(sNomFichier) Then
		MkDir GetRepertoirePath(&quot;user&quot;)+&quot;/config/soffice.cfg/modules/swriter/accelerator/&quot;+GetRepertoirePath(&quot;vlang&quot;)
		FileCopy fCheminDmaths+&quot;current.xml&quot;, sNomFichier
	Elseif Not FileExists(sNomFichierOld) Then
		FileCopy sNomFichier, sNomFichierOld
	EndIf

	iF1=FreeFile
	Open sNomFichier For Input As #iF1
	For iCpt = 1 to 3
		Line Input #iF1, sLigne
		sDebut=sDebut+sLigne
		If iCpt&lt;3 Then sDebut=sDebut+Chr(10)
	Next
	While Not Eof(iF1)
		Line Input #iF1, sLigne
		If (InStr(sLigne,&quot;vnd.sun.star.script:Dmaths.&quot;)=0 and InStr(sLigne,&quot;vnd.sun.star.script:DmathsInstall.&quot;)=0  and InStr(sLigne,&quot;vnd.sun.star.script:CmathOOo.&quot;)=0 and InStr(sLigne,&quot;vnd.sun.star.script:OOoGdmath.&quot;)=0 and InStr(sLigne,&quot;vnd.sun.star.script:OOoTep.&quot;)=0) Then sFin=sFin+sLigne+Chr(10) &apos;Ne garde que les lignes ne concernant pas DMaths, pour éviter les doublons.
	WEnd
	Close #iF1
	iF1=FreeFile
	Open sNomFichier For Output As #iF1
	Print #iF1, sDebut
	&apos;Ajoute les raccourcis clavier
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_T&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Tableau.LanceCreationTableau?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F10&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenFormule?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F9&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetentreAccolades?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F10&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetentreAccolades?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_V&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenVecteur?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_E&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenMesureAlgebrique?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_A&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenAngle?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_L&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenLimite?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_I&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenIntegrale?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_S&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenSomme?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_R&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenRacine?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_X&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenSysteme?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_M&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetenMatrice?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F10&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.MetentreParentheses?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	If iLangInstall = 0 Then
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F3&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.RaccAutotextes.SuperAutotexte?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot;/&gt;&quot;
	Else
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F3&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.LoadParCro?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Endif
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F3&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Tools.MetenItalic?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_F4&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Tools.MetenAtalante?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_Z&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:Dmaths.Module1.LoadParCro?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, &quot; &lt;accel:item accel:code=&quot;+Chr(34)+&quot;KEY_O&quot;+Chr(34)+&quot; xlink:href=&quot;+Chr(34)+&quot;vnd.sun.star.script:DmInstall.Options.ChoixOptionsDmaths?language=Basic&amp;amp;location=application&quot;+Chr(34)+&quot; accel:shift=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot; accel:mod1=&quot;+Chr(34)+&quot;true&quot;+Chr(34)+&quot;/&gt;&quot;
	Print #iF1, sFin
	Close #iF1
End Sub




Sub Fontes

End Sub


Sub Autotextes rem écrite par Jérôme Ortais modifiée par Didier Dorange-Pattoret
Dim sFrom as String, sTo as String
	On error resume next
	sTo=ConvertFromURL(GetRepertoirePath(&quot;user&quot;)+&quot;/autotext/dmaths.bau&quot;)
	If FileExists(sTo) Then Kill sTo
	On error goto 0
	SetGalleryAndAutotext(&quot;AutoText&quot;, sLang, True )	
End Sub


Sub Galeries
	On error resume next
	For I = 1 To 8
	If FileExists(ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.sdg&quot;)) Then Kill ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.sdg&quot;)
	If FileExists(ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.sdv&quot;)) Then Kill ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.sdv&quot;)
	If FileExists(ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.thm&quot;)) Then Kill ConvertToURL(sUserPath+&quot;/gallery/sg100&quot;+cStr(I)+&quot;.thm&quot;)
	Next I
	On error goto 0
	SetGalleryAndAutotext(&quot;Gallery&quot;, sLang, True )	
End Sub


Sub Options rem cette macro installe les options par défaut
	Dim sCheminSoftware1, sCheminSoftware2, sCheminSoftware3, sNomPoliceCursive, sUsingDispatcher as String
	If oChoixrepinstallation.Model.FileControl2.Text &lt;&gt; sNotfound then sCheminSoftware1 = oChoixrepinstallation.Model.FileControl2.Text
	If oChoixrepinstallation.Model.FileControl3.Text &lt;&gt; sNotfound then sCheminSoftware2 = oChoixrepinstallation.Model.FileControl3.Text
	If oChoixrepinstallation.Model.FileControl4.Text &lt;&gt; sNotfound then sCheminSoftware3 = oChoixrepinstallation.Model.FileControl4.Text
	rem on utilise le dispatcher si la version de OOo est &gt; 230
	sUsingDispatcher = &quot;FALSE&quot;
	If GetguiType = 4 Then 
	sCheminSoftware1 = RegleAppsSousLinux(sCheminSoftware1)
	sCheminSoftware2 = RegleAppsSousLinux(sCheminSoftware2)
	sCheminSoftware3 = RegleAppsSousLinux(sCheminSoftware3)
	Endif
	
	If (GetguiType = 4 and FileExists(&quot;/Users&quot;)) Then 
		sNomPoliceCursive = &quot;Apple Chancery&quot;
	Else
		sNomPoliceCursive = &quot;Atalante&quot;
	Endif	

	sSource=&quot;Rem (C) Didier Dorange-Pattoret www.dmaths.org&quot;+Chr(13)
	sSource=sSource+&quot;Global const iLang = &quot;+iLangInstall+Chr(13)
	sSource=sSource+&quot;Public const iNumVersionDmathsCourante = &quot;+ iNumVersionDmaths +&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sChemindmaths = &quot;&quot;&quot; + DetermineRepertoireDmaths + &quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sChemindmathsODS = &quot;&quot;&quot; + fCheminduFichierDmathsODS + &quot;&quot;&quot;&quot; + Chr(13) rem sChemindmathsODS est le fichier dmaths.ods
	sSource=sSource+&quot;Public const bItalic = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bEdroit = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bIdroit = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bChiffresDroits = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bVecteursItalic = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bAnglesItalic = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bMesuresAlgItalic = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bLettresAreScalaires = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const sLettresScalaires = &quot;&quot;&quot; + &quot;abcdexyzt&quot; + &quot;&quot;&quot;&quot; +Chr(13)
	sSource=sSource+&quot;Public const bFormulesGras = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const iTailleFormules = &quot;+Cstr(12)+Chr(13)
	sSource=sSource+&quot;Public const bTailleFormCarac = TRUE&quot;+Chr(13)	
	sSource=sSource+&quot;Public const bPoliceFormCarac = TRUE&quot;+Chr(13)	
	sSource=sSource+&quot;Public const iMargesFormules = &quot; + Cstr(0) + Chr(13)	
	sSource=sSource+&quot;Public const bConcateneFormules = TRUE&quot;+Chr(13)	
	sSource=sSource+&quot;Public const iMarqHorPoints = &quot; + Cstr(40)+ Chr(13)
	sSource=sSource+&quot;Public const iMarqVerPoints = &quot;+ Cstr(0)+ Chr(13)
	sSource=sSource+&quot;Public const sBorneInfIntegrales = &quot;&quot;from&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sBorneSupIntegrales = &quot;&quot;to&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const bTextMode = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bCoordColonne = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bSystemesAlignes = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bMatricesRondes = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bFormulesEspacees = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bFormulesEncadrees = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bGrandesParentheses = TRUE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bModeFactoriel = FALSE&quot;+Chr(13)
	sSource=sSource+&quot;Public const bFractions = FALSE&quot;+Chr(13)
	If iLangInstall = 0 Then
		sSource=sSource+&quot;Public const bXpointaulieux = FALSE&quot;+Chr(13)
	Else
		sSource=sSource+&quot;Public const bXpointaulieux = TRUE&quot;+Chr(13)
	Endif
	sSource=sSource+&quot;Public const bUsingDispatcher = &quot;+ sUsingDispatcher +Chr(13)	
	sSource=sSource+&quot;Public const iDelaiEntreSauvegardes = &quot;+ Cstr(0) + Chr(13)
	sSource=sSource+&quot;Public const sThemeIcons = &quot;&quot;&quot;+DeterminesThemeIcons(oChoixrepinstallation)+&quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sCheminSoftware1 = &quot;&quot;&quot;+sCheminSoftware1+&quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sCheminSoftware2 = &quot;&quot;&quot;+sCheminSoftware2+&quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sCheminSoftware3 = &quot;&quot;&quot;+sCheminSoftware3+&quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public const sNomPoliceCursive = &quot;&quot;&quot;+sNomPoliceCursive+&quot;&quot;&quot;&quot;+Chr(13)	
	sSource=sSource+&quot;Sub MyTest2&quot; &amp; Chr(13) &amp; &quot;Print &quot;&quot;Vive Dmaths !&quot;&quot;&quot; &amp; Chr(13) &amp; &quot;End Sub&quot;

	EcritFichierDmOptionsTXT(sSource) rem ecrit le fichier dmoptions
	InsertModuleDmOptions(sSource) rem cree le module des options
	
End Sub


rem cette macro met a jour les options en gardant celles de l utilisateur
Sub OptionsUtilisateur
	BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
	bIconesChangees = False	
	bAfficherMasquerIcones = False
	oDmOptions = Dmaths.Module5.LoadDialog(&quot;DmInstall&quot;,&quot;DmOptions&quot;)
	rem la ligne suivante permet de remplir par besoin le champ des scalaires.
	If Len(oDmOptions.GetControl(&quot;TextField7&quot;).Peer.Text) = 0 Then oDmOptions.GetControl(&quot;TextField7&quot;).Peer.Text = &quot;abcdexyzt&quot;
	DmInstall.Install_Addon.LoadAppsPref(oDmOptions,False,True,sThemeIcons) rem bPremInstall=False bRegleOptions = True
	ValidOptionsDmaths
	oDmOptions.Dispose()
End Sub



Sub OptionsBackup
	sSource=&quot;Rem (C) Didier Dorange-Pattoret www.dmaths.org 2005&quot;+Chr(13)
	sSource=sSource+&quot;Public const sDateSauvegarde = &quot;&quot;&quot;+Date()+&quot;&quot;&quot;&quot;+Chr(13)
	sSource=sSource+&quot;Public Const sRepertoireSourceDefaut = &quot;&quot;&quot;+GetRepertoirePath(&quot;home&quot;)+&quot;&quot;&quot;&quot;+Chr(13)
		sSource=sSource+&quot;Public Const sRepertoireBackupDefaut = &quot;&quot;&quot;+GetRepertoirePath(&quot;home&quot;)+&quot;&quot;&quot;&quot;+Chr(13) 
		sSource=sSource+&quot;Sub MyTest3&quot; &amp; Chr(13) &amp; &quot;Print &quot;&quot;Vive Dmaths !&quot;&quot;&quot; &amp; Chr(13) &amp; &quot;End Sub&quot;
	    sMod = &quot;DmBackup&quot;
	    oLib = GlobalScope.BasicLibraries.Standard
	    If oLib.hasByName(sMod) Then
	       oLib.removeByName(sMod)
	    EndIf
		oLib.InsertByName(sMod,sSource)
End Sub

Sub LoadAppsPref(oBoiteApps as Object, bParDefaut, bRegleOptions as Boolean,sThemeIcons as String)

If bParDefaut Then rem on charge les applications reconnues par defaut
		If (GetguiType = 4 and Not IsMacOs) Then
		  Call LoadAppsLinux
		  Elseif GetguiType = 1 Then
		  Call LoadAppsWin rem charge les noms des applications préférées
		End If	
		oBoiteApps.Model.FileControl4.Text = &quot;&quot;
		oBoiteApps.Model.FileControl3.Text = &quot;&quot;
		oBoiteApps.Model.FileControl2.Text = &quot;&quot;
		For I = 9 To 0 Step -1
				If FileExists(AppsPref(I,0)) Then
					oBoiteApps.Model.FileControl4.Text = oBoiteApps.Model.FileControl3.Text
					oBoiteApps.Model.FileControl3.Text = oBoiteApps.Model.FileControl2.Text
					oBoiteApps.Model.FileControl2.Text = AppsPref(I,0)
				Endif
		Next I 
		rem on charge les icones par defaut si OS&lt;&gt;Mac 
	&apos;	If (GetguiType = 1 or Not FileExists(&quot;/Users&quot;))  Then
			If oBoiteApps.Model.FileControl2.Text &lt;&gt; &quot;&quot; Then
				oBoiteApps.GetControl(&quot;SoftButton1&quot;).Visible = True
			rem	si l&apos;icone existe dans la base on la passe en image du bouton
				If FileExists(AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl2.Text),1)) Then 
					oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl2.Text),1)
			rem		si l&apos;image n&apos;est pas dans la base donnée on la fabrique
					FabriqueImages(oBoiteApps,oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL,1)
				Else
				rem si l&apos;image ne peut etre fabriquee on met l&apos;image par defaut 
					oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware1_16.bmp&quot;
				Endif		
			End If 
			If oBoiteApps.Model.FileControl3.Text &lt;&gt; &quot;&quot; Then
				oBoiteApps.GetControl(&quot;SoftButton2&quot;).Visible = True
				If FileExists(AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl3.Text),1)) Then 
					oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl3.Text),1)
					FabriqueImages(oBoiteApps,oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL,2)
				Else
					oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware2_16.bmp&quot;
				Endif		
			End If 
			If oBoiteApps.Model.FileControl4.Text &lt;&gt; &quot;&quot; Then
				oBoiteApps.GetControl(&quot;SoftButton3&quot;).Visible = True
				If FileExists(AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl4.Text),1)) Then 
					oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl4.Text),1)
					FabriqueImages(oBoiteApps,oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL,3)
				Else
					oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware3_16.bmp&quot;
				Endif		
			End If
	&apos;	Endif
Else rem on charge les applications que l&apos;utilisateur a deja installées 
		oBoiteApps.Model.FileControl2.Text = sCheminSoftware1
		oBoiteApps.Model.FileControl3.Text = sCheminSoftware2
		oBoiteApps.Model.FileControl4.Text = sCheminSoftware3
		
		If Not bRegleOptions Then
		oBoiteApps.GetControl(&quot;Label1&quot;).Visible = False
		oBoiteApps.GetControl(&quot;FileControl2&quot;).Enable = False
		oBoiteApps.GetControl(&quot;FileControl3&quot;).Enable = False
		oBoiteApps.GetControl(&quot;FileControl4&quot;).Enable = False
		For I = 1 To iNbreThemesIcones
		oBoiteApps.GetControl(&quot;OptionButton&quot;+Cstr(I)).Visible = False
		Next I
		oBoiteApps.GetControl(&quot;Label3&quot;).Visible = False			
		End if
		
		rem recherche des icônes des apps preferees sauf sous Mac
	&apos;	If (GetguiType = 1 or Not FileExists(&quot;/Users&quot;))  Then
			oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )
			If oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;) Then
				oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;)
				If sCheminSoftware1 &lt;&gt; &quot;&quot; Then 
					oBoiteApps.GetControl(&quot;SoftButton1&quot;).Visible = True
					If Not bRegleOptions Then oBoiteApps.GetControl(&quot;SoftButton1&quot;).Enable = False
					If FileExists(oAddon.getByName(&quot;soft1&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;) Then	
						oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL = oAddon.getByName(&quot;soft1&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;
					Else
						oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware1_16.bmp&quot;
					Endif
				Endif
				If sCheminSoftware2 &lt;&gt; &quot;&quot; Then 
					oBoiteApps.GetControl(&quot;SoftButton2&quot;).Visible = True
					If Not bRegleOptions Then oBoiteApps.GetControl(&quot;SoftButton2&quot;).Enable = False
					If FileExists(oAddon.getByName(&quot;soft2&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;) Then	
						oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL = oAddon.getByName(&quot;soft2&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;
					Else
						oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware2_16.bmp&quot;
					Endif
				Endif
				If sCheminSoftware3 &lt;&gt; &quot;&quot; Then 
					oBoiteApps.GetControl(&quot;SoftButton3&quot;).Visible = True
					If Not bRegleOptions Then oBoiteApps.GetControl(&quot;SoftButton3&quot;).Enable = False	
					If FileExists(oAddon.getByName(&quot;soft3&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;) Then	
						oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL = oAddon.getByName(&quot;soft3&quot;).ImageIdentifier &amp; &quot;_16.bmp&quot;
					Else
						oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware3_16.bmp&quot;
					Endif
				Endif
			Endif
	&apos;	Endif
Endif
End Sub


Sub RegleIconesAppsPref(oBoiteApps as Object,sThemeIcons as String)
		oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )
		If oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;) Then
			oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;)
			
			If oBoiteApps.Model.FileControl2.Text &lt;&gt; &quot;&quot; Then
				rem le contexte puis l&apos;icone
				&apos;oAddon.getByName(&quot;soft1&quot;).Context = &quot;com.sun.star.text.TextDocument&quot;
				If oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL &lt;&gt;&quot;&quot; Then
					oAddon.getByName(&quot;soft1&quot;).ImageIdentifier = Mid(oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL,1,Len(oBoiteApps.GetControl(&quot;SoftButton1&quot;).Model.ImageURL)-7)
				Else
					oAddon.getByName(&quot;soft1&quot;).ImageIdentifier = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware1&quot;
				Endif
				rem l&apos;infobulle
				If GetIndiceAppsPref(oBoiteApps.Model.FileControl2.Text) = -1 Then
					oAddon.getByName(&quot;soft1&quot;).Title = getFileNameOnly(ConvertToURL(oBoiteApps.GetControl(&quot;FileControl2&quot;).Text))
				Elseif AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl2.Text),2)&lt;&gt;&quot;&quot; Then
				 	oAddon.getByName(&quot;soft1&quot;).Title = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl2.Text),2) 
				Else 	oAddon.getByName(&quot;soft1&quot;).Title = &quot;Software 1&quot;
				End If
			Else
				oAddon.getByName(&quot;soft1&quot;).Context = &quot;hidden&quot;
			End If
			
			If oBoiteApps.Model.FileControl3.Text &lt;&gt; &quot;&quot; Then
				rem le contexte puis l&apos;icone
				&apos;oAddon.getByName(&quot;soft2&quot;).Context = &quot;com.sun.star.text.TextDocument&quot;
				If oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL &lt;&gt;&quot;&quot; Then
					oAddon.getByName(&quot;soft2&quot;).ImageIdentifier = Mid(oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL,1,Len(oBoiteApps.GetControl(&quot;SoftButton2&quot;).Model.ImageURL)-7)
				Else
					oAddon.getByName(&quot;soft2&quot;).ImageIdentifier = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware2&quot;
				Endif
				rem l&apos;infobulle
				If GetIndiceAppsPref(oBoiteApps.Model.FileControl3.Text) = -1 Then
					oAddon.getByName(&quot;soft2&quot;).Title = getFileNameOnly(ConvertToURL(oBoiteApps.GetControl(&quot;FileControl3&quot;).Text))
				Elseif AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl3.Text),2)&lt;&gt;&quot;&quot; Then
				 	oAddon.getByName(&quot;soft2&quot;).Title = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl3.Text),2) 
				Else 	oAddon.getByName(&quot;soft2&quot;).Title = &quot;Software 2&quot;
				End If
			Else
				oAddon.getByName(&quot;soft2&quot;).Context = &quot;hidden&quot;
			End If
			
			If oBoiteApps.Model.FileControl4.Text &lt;&gt; &quot;&quot; Then
				rem le contexte puis l&apos;icone
				&apos;oAddon.getByName(&quot;soft3&quot;).Context = &quot;com.sun.star.text.TextDocument&quot;
				If oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL &lt;&gt;&quot;&quot; Then
					oAddon.getByName(&quot;soft3&quot;).ImageIdentifier = Mid(oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL,1,Len(oBoiteApps.GetControl(&quot;SoftButton3&quot;).Model.ImageURL)-7)
				Else
					oAddon.getByName(&quot;soft3&quot;).ImageIdentifier = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware3&quot;
				Endif
				rem l&apos;info bulle
				If GetIndiceAppsPref(oBoiteApps.Model.FileControl4.Text) = -1 Then
					oAddon.getByName(&quot;soft3&quot;).Title = getFileNameOnly(ConvertToURL(oBoiteApps.GetControl(&quot;FileControl4&quot;).Text))
				Elseif AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl4.Text),2)&lt;&gt;&quot;&quot; Then
				 	oAddon.getByName(&quot;soft3&quot;).Title = AppsPref(GetIndiceAppsPref(oBoiteApps.Model.FileControl4.Text),2) 
				Else 	oAddon.getByName(&quot;soft3&quot;).Title = &quot;Software 3&quot;
				End If
			Else
				oAddon.getByName(&quot;soft3&quot;).Context = &quot;hidden&quot;
			End If
		Endif		
		oConfigAccess.commitChanges()
End Sub

Function RegleAppsSousLinux(sCheminApps as String)as String
	If (InStr(sCheminApps,&quot;konqueror&quot;) &gt; 0 and InStr(sCheminApps,&quot;home&quot;) = 0) Then sCheminApps = sCheminApps &amp; &quot; &quot; &amp; GetRepertoirePath(&quot;home&quot;)
	If (getFileExt(ConvertToURL(sCheminApps)) = &quot;.jar&quot; and Mid(sCheminApps,1,4) &lt;&gt; &quot;file&quot;)  Then sCheminApps = sCheminJava &amp; &quot; -jar &quot; &amp;  sCheminApps 
	RegleAppsSousLinux = sCheminApps
End Function

Sub RegleNumerotationIcones rem cette macro regle lors de l&apos;installation la numerotation des icones de la barre dmaths
	NomIcone = Array(&quot;writeformula&quot;,&quot;lancecreationtableau&quot;,&quot;metenformule&quot;,&quot;metenvecteur&quot;,&quot;metenmesurealgebrique&quot;,&quot;metenangle&quot;,&quot;metenlimite&quot;,&quot;metenintegrale&quot;,&quot;metensomme&quot;,&quot;metenproduit&quot;,&quot;metenpointe&quot;,&quot;metendoublepointe&quot;,&quot;metenracine&quot;,&quot;metensysteme&quot;,&quot;metenmatrice&quot;,&quot;systemegraphique&quot;,&quot;matricegraphique&quot;,&quot;formulegraphique&quot;,&quot;formulegraphique2&quot;,_
				&quot;loadparcro&quot;,&quot;metentreaccolades&quot;,&quot;metentreparentheses&quot;,&quot;metenitalic&quot;,&quot;atalante&quot;,&quot;bordure_selection&quot;,&quot;affectetailleformule&quot;,&quot;encadreformule&quot;,&quot;augmentetailleformule&quot;,&quot;diminuetailleformule&quot;,&quot;repregraphique&quot;,&quot;lancetablevar&quot;,&quot;repregrille&quot;,&quot;reprediagbox&quot;,&quot;fairefigure&quot;,&quot;changemodeformule&quot;,&quot;lancebackup&quot;)
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )

	If  oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;) Then
		oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;)
		Dim sCheminImages$
		Dim sElementNames$(),sTheme$, sCheminIcones$
		Dim iPosition as Integer
		sElementNames = oAddon.getElementNames()
		iPosition = Instr(oAddon.getByname(oAddon.ElementNames(1)).ImageIdentifier,&quot;theme&quot;)
		sTheme = iif(iPosition&lt;&gt;0 , Mid(oAddon.getByname(oAddon.ElementNames(1)).ImageIdentifier,iPosition,6),&quot;theme1&quot;)
		sCheminIcones = fCheminDmaths &amp; &quot;icons/&quot; &amp; sTheme &amp; &quot;/&quot;
		
		For I = LBound(sElementNames()) To UBound(sElementNames())-3 rem car il y a les trois images des applications preferees
			oAddon.getByname(sElementNames(I)).ImageIdentifier = sCheminIcones &amp; NomIcone(I)
		Next I
	Endif
	oConfigAccess.commitChanges()
End Sub

Sub MaJIconesDuMenuDmaths rem cette macro ecrite le 20/02/2007 regle lors de l&apos;installation les icones du menu dmaths 
	NomIcone = Array(&quot;aide&quot;,&quot;faq&quot;,&quot;ref&quot;,&quot;addon&quot;,&quot;update&quot;,&quot;choixoptionsdmaths&quot;,&quot;update&quot;,&quot;info&quot;)
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeMenuBar&quot;, True )

	If  oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.aide&quot;) Then
		oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.aide&quot;).Submenu
		Dim sCheminImages$
		Dim sElementNames$(),sTheme$, sCheminIcones$
		Dim iPosition as Integer
		sElementNames = oAddon.getElementNames()
		iPosition = Instr(oAddon.getByname(oAddon.ElementNames(1)).ImageIdentifier,&quot;theme&quot;)
		sTheme = iif(iPosition&lt;&gt;0 , Mid(oAddon.getByname(oAddon.ElementNames(1)).ImageIdentifier,iPosition,6),&quot;theme1&quot;)
		sCheminIcones = fCheminDmaths &amp; &quot;icons/&quot; &amp; sTheme &amp; &quot;/&quot;
		For I = LBound(sElementNames()) To UBound(sElementNames())
			oAddon.getByname(sElementNames(I)).ImageIdentifier = sCheminIcones &amp; NomIcone(I)
		Next I	
	Endif
	oConfigAccess.commitChanges()
End Sub




Sub ChoisirThemeIcone(sTheme as String)  rem cette macro permet choisir le theme des icones affichées

	sRepertoireDmaths = DetermineRepertoireDmaths rem sRepertoireDmaths donne l adresse des fichiers
	Dim sElementNames$()
	
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )
	If  oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;) Then
		oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;)
		sElementNames = oAddon.getElementNames()
		For I = LBound(sElementNames()) To UBound(sElementNames())		
		oAddon.getByname(sElementNames(I)).ImageIdentifier = ReplacesTheme(oAddon.getByname(sElementNames(I)).ImageIdentifier , sTheme)
	&apos;	oAddon.getByname(sElementNames(I)).Context = &quot;com.sun.star.text.TextDocument&quot;
		Next I
	Endif
	oConfigAccess.commitChanges()
	
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )
	If  oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsDisplayBarre&quot;) Then
		oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsDisplayBarre&quot;)
		sElementNames = oAddon.getElementNames()
		For I = LBound(sElementNames()) To UBound(sElementNames())
		oAddon.getByname(sElementNames(I)).ImageIdentifier = ReplacesTheme(oAddon.getByname(sElementNames(I)).ImageIdentifier , sTheme)
	&apos;	oAddon.getByname(sElementNames(I)).Context = &quot;com.sun.star.text.TextDocument&quot;
		Next I
	Endif
	oConfigAccess.commitChanges()
	
	
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeMenuBar&quot;, True )
	If  oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.aide&quot;) Then
		oConfigAccess.getByName(&quot;org.openoffice.Office.addon.aide&quot;).Context = &quot;com.sun.star.text.TextDocument&quot;
		oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.aide&quot;).SubMenu
		sElementNames = oAddon.getElementNames()
		For I = LBound(sElementNames()) To UBound(sElementNames())
		oAddon.getByname(sElementNames(I)).ImageIdentifier = ReplacesTheme(oAddon.getByname(sElementNames(I)).ImageIdentifier , sTheme)
	Next I
	Endif
	oConfigAccess.commitChanges()

End Sub

Sub PreselectionneNumeroTheme as String
		Dim iNumeroTheme, iPos as Integer
		iNumeroTheme = 1
		oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Addons/AddonUI/OfficeToolBar&quot;, True )
		If oConfigAccess.hasByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;) Then
			oAddon = oConfigAccess.getByName(&quot;org.openoffice.Office.addon.DMathsBarre&quot;)
			iPos = Instr(oAddon.getByname(oAddon.ElementNames(0)).ImageIdentifier,&quot;theme&quot;)
			If iPos &gt; 0 Then
			iNumeroTheme = Cint(Mid(oAddon.getByname(oAddon.ElementNames(0)).ImageIdentifier,iPos+5,1)
			Endif
		End If
		oChoixrepinstallation.GetControl(&quot;OptionButton&quot;&amp;Cstr(iNumeroTheme)).State = 1
		PreselectionneNumeroTheme = &quot;theme&quot; &amp; Cstr(iNumeroTheme)
End Sub



rem cette macro détermine la chaine theme 1, 2 ou 3 ... choisie dans la boite
Function DeterminesThemeIcons(oBoiteApps as Object) as String 
		Dim sResult as String	
		sResult = &quot;theme1&quot;
		For I = 2 To iNbreThemesIcones
		If oBoiteApps.GetControl(&quot;OptionButton&quot;&amp;Cstr(I)).State = True then sResult = &quot;theme&quot;&amp; Cstr(I)
		Next I
		DeterminesThemeIcons = sResult
End Function

rem cette macro fabrique l&apos;image identifier
Function ReplacesTheme(sCheminImage,sTheme as String) as String
	Dim iPos,iLen as Integer	
	iPos = Instr(sCheminImage,&quot;theme&quot;) 
	iLen = Len(sCheminImage)
	if iPos &gt; 0 Then 
	ReplacesTheme = sRepertoireDmaths &amp; &quot;icons/&quot; &amp; sTheme &amp; Mid(sCheminImage,iPos+6,iLen-iPos-5)
	Else
	ReplacesTheme = sCheminImage
	Endif
End Function



rem macros gérant les boutons soft après changement du texte d&apos;un filecontrol
Sub GereSoftButton1
	GereSoftButton(oChoixrepinstallation,1)
End Sub

Sub GereSoftButton2
	GereSoftButton(oChoixrepinstallation,2)
End Sub

Sub GereSoftButton3
	GereSoftButton(oChoixrepinstallation,3)
End Sub

Sub GereSoftButton(oBoiteApps as Object, iNumero as Integer)
	If oBoiteApps.GetControl(&quot;FileControl&quot;+Cint(iNumero+1)).Text &lt;&gt; &quot;&quot; Then
		If Len(oBoiteApps.GetControl(&quot;FileControl&quot;+Cint(iNumero+1)).Model.Text) = 1 Then oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Model.ImageURL = fCheminDmaths &amp; &quot;icons/launchsoftware&quot; &amp; Cint(iNumero) &amp;&quot;_16.bmp&quot;
		oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Visible = True
		oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Enable = True	
	Else
		oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Visible = False
		oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Enable = False
	Endif
End Sub

rem donne l&apos;indice correspondant a l&apos;application
Function GetIndiceAppsPref(sAppsPref as String) as Integer
	GetIndiceAppsPref = -1 rem valeur si pas dans la liste prédéfinie
	For I = 0 To 9
		If AppsPref(I,0) = sAppsPref Then
			GetIndiceAppsPref = I
			Exit For
		End If
	Next I
End Function


Sub LoadAppsLinux
 	rem les images incluses dans l&apos;addon n&apos;ont pas d&apos;extension.
	AppsPref(0,0) = &quot;/usr/bin/dia&quot;
	AppsPref(0,1) = fCheminDmaths+&quot;icons/appspref/launchdia_16.bmp&quot;
	AppsPref(0,2) = &quot; Dia &quot;
	AppsPref(1,0) = &quot;/usr/bin/drgeo&quot;
	AppsPref(1,1) = &quot;&quot;
	AppsPref(1,2) = &quot; Dr Geo &quot;
	AppsPref(2,0) = &quot;/usr/local/Declic/declic.sh&quot;
	AppsPref(2,1) = &quot;&quot;
	AppsPref(2,2) = &quot; Déclic &quot;
	AppsPref(3,0) =  CurDir+&quot;/Declic/declic.sh&quot;
	AppsPref(3,1) = &quot;&quot;
	AppsPref(3,2) = &quot; Déclic &quot;
	AppsPref(4,0) = &quot;/usr/bin/konqueror&quot;
	AppsPref(4,1) = fCheminDmaths+&quot;icons/appspref/konqueror_16.bmp&quot;
	AppsPref(4,2) = &quot; Konqueror &quot;
	AppsPref(5,0) = &quot;/usr/bin/konsole&quot;
	AppsPref(5,1) = &quot;&quot;
	AppsPref(5,2) = &quot; Konsole &quot;	
	AppsPref(6,0) = &quot;/usr/bin/kmail&quot;
	AppsPref(6,1) = &quot;&quot;
	AppsPref(6,2) = &quot; Kmail &quot;
	AppsPref(7,0) =  CurDir+&quot;/Declic/declic.sh&quot;
	AppsPref(7,1) = &quot;&quot;
	AppsPref(7,2) = &quot; Declic &quot;				
End Sub

Sub LoadAppsWin
	AppsPref(0,0) = &quot;C:\Program Files\GeoGebra\Geogebra.exe&quot;
	AppsPref(0,1) = &quot;&quot;
	AppsPref(0,2) = &quot; GeoGebra &quot;
	AppsPref(1,0) = &quot;C:\Program Files\dia\bin\dia.bat&quot;
	AppsPref(1,1) = fCheminDmaths+&quot;icons/appspref/launchdia_16.bmp&quot;
	AppsPref(1,2) = &quot; Dia &quot;
	AppsPref(2,0) = &quot;C:\Program Files\ATELIERS\geom3D\Geom3d.exe&quot;
	AppsPref(2,1) = &quot;&quot;
	AppsPref(2,2) = &quot; Atelier géomtrie 3D &quot;
	AppsPref(3,0) = &quot;C:\Program Files\ATELIERS\geom2D\Geom96.exe&quot;
	AppsPref(3,1) = &quot;&quot;
	AppsPref(3,2) = &quot; Atelier géométrie 2D &quot;
End Sub	

Sub SetGalleryAndAutotext(sModule, Optional sLangue as String, Optional bInst as Boolean)
	Dim I, J, Nbre as integer
	Dim sLeCheminGaleAuto(), sSuffixe as String
	sRepertoireDmaths = DetermineRepertoireDmaths rem sRepertoireDmaths donne l adresse des fichiers
	If IsMissing(bInst) Then bInst = False
	If IsMissing(sLangue) Then sLangue = &quot;fr&quot;
	If sModule = &quot;Gallery&quot; Then sSuffixe = &quot;gallery&quot; Else sSuffixe = &quot;autotext/&quot; &amp; sLangue
	oConfigAccess = GetConfigAccess( &quot;/org.openoffice.Office.Common&quot;, True )
	sLeCheminGaleAuto() = oConfigAccess.getByName(&quot;Path&quot;).getByName(&quot;Current&quot;).getByName(sModule)
	rem suppression du chemin inutile
	J = -1
	If Not IsEmpty(sLeCheminGaleAuto()) Then
	For I = LBound(sLeCheminGaleAuto()) To Ubound(sLeCheminGaleAuto())
		If Instr(sLeCheminGaleAuto(I),&quot;DmathsAddon&quot;) = 0 Then
			J = J+1
			sLeCheminGaleAuto(J) = sLeCheminGaleAuto(I)			
		Endif
	Next I
	Endif	
	rem ajout du nouveau chemin
	If bInst = True Then
		ReDim Preserve sLeCheminGaleAuto(J+1)
		sLeCheminGaleAuto(J+1) =	sRepertoireDmaths &amp; sSuffixe
	ElseIf J&gt;=0 Then
		 ReDim Preserve sLeCheminGaleAuto(J)
	Endif	
	oConfigAccess.getByName(&quot;Path&quot;).getByName(&quot;Current&quot;).replaceByName(sModule,sLeCheminGaleAuto())
	oConfigAccess.Commitchanges()
End Sub




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

Function fCheminDmaths() as String rem écrite par Didier Dorange-Pattoret
	&apos;	Dim GetPIP as Object, repExt as String
	 &apos; 	GetPIP = GetDefaultContext.getValueByName(&quot;/singletons/com.sun.star.deployment.PackageInformationProvider&quot;) 
	  &apos;	repExt = GetPIP.getPackageLocation(&quot;Dmaths&quot;)
	&apos;	fCheminDmaths = repExt &amp; &quot;/Fichiers/&quot;	
		Dim xContext, LeRep as String						rem modifiee le 20 mars 2009
		Dim oAC  As Object
 		oCmdEnv = CreateUnoListener( &quot;CmdEnv_&quot;,&quot;com.sun.star.deployment.XCommandEnvironment&quot; )
 		GetPMF = GetDefaultContext.getValueByName(&quot;/singletons/com.sun.star.deployment.thePackageManagerFactory&quot;)
		If TestInstallRezo Then xContext = &quot;shared&quot; Else xContext = &quot;user&quot;
		LeRep = GetPMF.getPackageManager(xContext).getDeployedPackage(&quot;Dmaths&quot;,&quot;DmathsAddon.oxt&quot;,oAc,oCmdEnv).URL &amp; &quot;/Fichiers/&quot;
		fCheminDmaths = LeRep	
End Function

Function fCheminduFichierDmathsODS as String rem cette fonction donne le chemin du fichier dmaths.ods utilise pour les tracer point par point
	If  TestInstallRezo   Then
		fCheminduFichierDmathsODS = ConvertToURL(GetRepertoirePath(&quot;user&quot;)+&quot;/dmaths/dmaths.ods&quot;)
	Else
		fCheminduFichierDmathsODS = fChemindmaths &amp; &quot;dmaths.ods&quot;
	EndIf
End function


Rem devra etre remplacee par fChemindmaths
Function DetermineRepertoireDmaths as String rem cette fonction determine le fichier racine pour le choix des icones, autotext, galleries
	Dim xContext, LeRep as String						rem modifiee le 20 mars 2009
	Dim oAC  As Object
	oCmdEnv = CreateUnoListener( &quot;CmdEnv_&quot;,&quot;com.sun.star.deployment.XCommandEnvironment&quot; )
	GetPMF = GetDefaultContext.getValueByName(&quot;/singletons/com.sun.star.deployment.thePackageManagerFactory&quot;)
	If TestInstallRezo Then xContext = &quot;shared&quot; Else xContext = &quot;user&quot;
	LeRep = GetPMF.getPackageManager(xContext).getDeployedPackage(&quot;Dmaths&quot;,&quot;DmathsAddon.oxt&quot;,oAc,oCmdEnv).URL &amp; &quot;/Fichiers/&quot;
	DetermineRepertoireDmaths = LeRep
End Function


&apos;Function DetermineOS as Integer
&apos;	If Getguitype = 1 Then
&apos;		DetermineOS = 1
&apos;	ElseIf Getguitype = 3 or (Getguitype = 4 and FileExists(&quot;/Users&quot;)) Then
&apos;		DetermineOS = 3
&apos;	Else
&apos;		DetermineOS = 4
&apos;	Endif
&apos;End Function

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


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

Function OOoName As String
  &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())
&apos;  Print aSettings.getbyname(&quot;ooName&quot;)
  OOoName = aSettings.getbyname(&quot;ooName&quot;)
End Function


rem******************************************************************************************************************
Sub RegleCheminDesIcones(sLeChemindeDmaths as String) rem cette macro regle le chemin des icones des comptes non admin dans les install multi
	rem à reprendre pour Mac
	Dim sPath, sRacine, sValue, sCheminDuCompte as String
	sLeNouveauChemindeDmaths = fCheminDmaths
	rem determine les comptes et appelle la procedure de nettoyage de chacun	
	If GetGuitype = 1 Then 
		sPath = GetRepertoirePath(&quot;home&quot;)
		sRacine = GetRepertoire(sPath)
	ElseIf IsMacOS Then
		sRacine = &quot;/Users&quot;
	Else
		sRacine = &quot;/home&quot;
	EndIf
	sValue = Dir$(sRacine+GetPathSeparator,16)
		Do 	
			If sValue&lt;&gt;&quot;..&quot; and Mid(sValue,1,1)&lt;&gt;&quot;.&quot;  Then
					If (GetAttr(sRacine+GetPathSeparator+sValue) AND 16 &gt; 0) Then
						sCheminDuCompte = sRacine+GetPathSeparator+sValue			
						Call RegleChemin(sCheminDuCompte,sLeChemindeDmaths,sLeNouveauChemindeDmaths)						
					EndIf
			End If
			sValue = Dir$
		Loop Until sValue = &quot;&quot;	
End Sub


Sub RegleChemin(sCheminDuCompte,src,dest as String)
	Dim sCheminUser, aFile, aNewFile, sLine as String &apos; contient le chemin de l&apos;utilisateur en cours
	sCheminUser = sCheminDuCompte + SuffixeDuCompte 

	aFile = ConvertToUrl(sCheminUser &amp; &quot;/registry/data/org/openoffice/Office/Addons.xcu&quot;)
	&apos;Print aFile
	&apos;Print FileExists(aFile)
	If FileExists(aFile) Then
		aFileNew = ConvertToUrl(sCheminUser &amp; &quot;/registry/data/org/openoffice/Office/Addons.new&quot;)
		iNumberNew = Freefile
		Open aFileNew For Output As iNumberNew
		iNumber = Freefile
		Open aFile For Input As iNumber
		While not eof(iNumber)
			Line Input #iNumber, sLine
		&apos;	If InStr(sLine,src)&gt;0 then print &quot;on change&quot;
			sLine = RemplaceChaine(sLine,src,dest,False)  
			Print #iNumberNew, sLine      
		wend
		Close #iNumber
		Close #iNumberNew
		kill (aFile)
		Name aFileNew as aFile
	End If
End Sub


Function SuffixeDuCompte
		Dim iPos , iLong as Integer		
		If GetGuitype = 1 Then iPos = Len(GetRepertoire(GetRepertoirePath(&quot;home&quot;)&amp;&quot;\&quot;))+1 Else iPos = Len(GetRepertoirePath(&quot;home&quot;))+1 
		iLong = Len(GetRepertoirePath(&quot;user&quot;))
		SuffixeDuCompte = Mid(GetRepertoirePath(&quot;user&quot;),iPos,iLong-iPos+1)			
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

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 GetRepertoire (thePath as String) as String rem donne le repertoire situe deux branches en aval
Dim newSplit()
ReDim NewSplit(0)
	splitted = split(thePath,GetPathSeparator)
	newSplit() = splitted()
	ReDim Preserve newSplit(0 to ubound(splitted)-2)
	GetRepertoire = join(NewSplit(),GetPathSeparator)
End Function

Sub Nommage_Gdmath_bars     &apos;for testing: GF
&apos; renommage des barres d&apos;Addon en Gdmath
	Dim sNomdeBarre as String

REM ------- modul:writer OOoGdmath
	If iLangInstall = 0 Then sNomdeBarre = &quot;OOoGdmath&quot; Else sNomdeBarre = &quot;OOoGdmath-Addon&quot;
	oConfigAccessW = GetConfigAccess( &quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )
	If oConfigAccessW.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessW.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessW.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccessW.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccessW.commitChanges()

REM ------- modul:draw OOoGdmath
	If iLangInstall = 0 Then sNomdeBarre = &quot;OOoGdmath&quot; Else sNomdeBarre = &quot;OOoGdmath-Addon&quot;
	oConfigAccessD = GetConfigAccess( &quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States&quot;, True )
	If oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/addon_2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/addon_2&quot;)
		oAddon.UIName = sNomdeBarre
	Elseif oConfigAccessD.HasByName( &quot;private:resource/toolbar/Add-on 2&quot;) Then
		oAddon = oConfigAccessD.getByName( &quot;private:resource/toolbar/Add-on 3&quot;)	
		oAddon.UIName = sNomdeBarre
	Endif	
	oConfigAccessD.commitChanges()
	
End Sub



</script:module>