<?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-2017 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 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(19,2) as String 
Public AppsPrefUbount As Integer
Public sRepertoireDmaths as String
Public PI, PF As Integer rem sert à la configuration de la position des barres d&apos;outils
Public positionBarre as New com.sun.star.awt.Point rem sert à la configuration de la position des barres d&apos;outils
Public const sPositionDesBarresdOutilsParDefaut = &quot;0,5:1070,0:0,4:821,4:950,0:16,1:72,1:16,2:14,1:&quot; 
Public const iVersion = &quot; 4.4.0.0 &quot;
Public const iNumVersionDmaths = 4400 rem à changer également dans Dmaths Tools ainsi que dans le fichier dmoptions.txt des options par défaut
Public const iNumVersionDmathsPlus = 4400 rem correspond à la version de DmathsPlus.dotm
Rem permet la mise aux normes Dmaths
Rem module6d.IntegreOOoAHmath3D à ajouter à la fin de la macro OOoAHmath3D.ahOutils.PosObjetFinal
Rem module ChangerStylesAretes chargement de la boite aoDlg Style -&gt; style pour fonctionnement sous Linux
Public const iNbreThemesIcones = 5
Public Const bTraitementErreurInstallation = True



Sub LanceFinInstallation (bOnMetAJour as Boolean, Optional bProgressVisible as Boolean)

	rem traitement des erreurs
	If bTraitementErreurInstallation Then On Error GoTo TraitementErreurFinInstallation
	
	If IsMissing(bProgressVisible) Then bProgressVisible = True

	rem on charge le dictionnaire
	ChargementDuVocabulaire
	
	rem on trouve la langue d&apos;installation
	iLangInstall = TrouveLang 
	
	rem Print &quot;entre LanceFinInstallation&quot;
	DialogLibraries.loadLibrary( &quot;DmInstall&quot;)
	oDmProgInst = CreateUnoDialog(DialogLibraries.DmInstall.DmProgInst)
	oDmProgInst.Visible = bProgressVisible
	Wait 500	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 0

	bMiseAJour = bOnMetAJour
	bPremInstall = Not bOnMetAJour
	
	
	BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 5

	Call TestPresencesMath				rem verifie que le module math est installé


	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 10
	
 	
    sUserPath = GetRepertoirePath(&quot;user&quot;)                         rem utilité a revoir


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

	Rem revoir cette ligne qui sert aux installations multiutilisateurs
&apos;	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;)
			DoubleSwitchF4F8 rem change deux fois cette configuration pour être sur que les touches F9 et F10 sont actives. 
		EndIf
	Endif
	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 30
	

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


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

	
	
rem------------------------------------------------------------------------------------
&apos; Renomme les anciennes configurations des barres d&apos;Addon


		dim ConfigRegistry as object
		dim LaBarre as object	
		dim Letiquette as String
		globalScope.basicLibraries.loadLibrary(&quot;Tools&quot;)
		
		
	REM ------- modul:writer Dmaths
		ConfigRegistry = getRegistryKeyContent(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;,True)
	
		Letiquette = &quot;Dmaths&quot;			
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette			
			ConfigRegistry.commitChanges()		
		End if
	
	REM ------- modul:writer Dmaths on/off 
		Select Case iLangInstall
			Case 0
				Letiquette = &quot;Dmaths Afficher/Masquer&quot;
			Case 2
				Letiquette = &quot;Dmaths an/aus-Schalter&quot;
			Case Else 
				Letiquette = &quot;Dmaths on/off switch&quot;
		End Select
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette
			ConfigRegistry.commitChanges()		
		End if		
	
	REM ------- modul:writer OOoTep 
		Letiquette = &quot;OOoTep-Gdmath&quot;
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette
			ConfigRegistry.commitChanges()		
		End if	

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

	
	REM ------- modul:writer OOoGdmath
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
			LaBarre.&quot;UIName&quot; = &quot;Gdmath&quot;
			ConfigRegistry.commitChanges()		
		End if
	
	Rem -------modul:writer AHmath3D
			If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;)
			LaBarre.&quot;UIName&quot; = &quot;AHmath3D&quot;
			ConfigRegistry.commitChanges()		
		End if
		
			
	
	REM ------- modul:draw OOoGdmath
		ConfigRegistry = getRegistryKeyContent(&quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States&quot;, True )
		
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;)
			LaBarre.&quot;UIName&quot; = &quot;Gdmath&quot;
			ConfigRegistry.commitChanges()		
		End if

	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 50
	
	REM ------- modul:draw OOoTep
		Letiquette = &quot;OOoTep-Gdmath&quot;		
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette
			ConfigRegistry.commitChanges()		
		End if			
	
	REM ------- modul:draw Dmaths on/off
		Select Case iLangInstall
			Case 0
				Letiquette = &quot;Dmaths Afficher/Masquer&quot;
			Case 2
				Letiquette = &quot;Dmaths an/aus-Schalter&quot;
			Case Else 
				Letiquette = &quot;Dmaths on/off switch&quot;
		End Select
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette
			ConfigRegistry.commitChanges()		
		End if		
		
	REM ------- modul:impress InsertWriter
		ConfigRegistry = getRegistryKeyContent(&quot;/org.openoffice.Office.UI.ImpressWindowState/UIElements/States&quot;, True )
		Select Case iLangInstall
			Case 0
				Letiquette = &quot;Inserer un document Writer&quot;
			Case Else 
				Letiquette = &quot;Insert a Writer Document&quot;
		End Select
		If ConfigRegistry.hasByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.InsertDocumentWriter&quot;) Then
			LaBarre = ConfigRegistry.getByName(&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.InsertDocumentWriter&quot;)
			LaBarre.&quot;UIName&quot; = Letiquette
			ConfigRegistry.commitChanges()		
		End if	

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

rem ----------------------------------------------------------------------------------
&apos; mise en place des barres d&apos;icônes si besoin	
	If bMiseAJour Then 
		If (sPositionDesBarresdOutilsParDefaut&lt;&gt;sPositionDesBarresdOutilsMemorisee And Len(sPositionDesBarresdOutilsMemorisee)&gt;0) Then
			PositionneLesBarresdOutils
		End If 
	End if

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

rem-------------------------------------------------------------------------------------
&apos;installation des options en cas de première installation

	If bPremInstall Then 
		Options 		
		MemoriseCheminIcasOptions	
	Else 
		OptionsUtilisateur
		If Len(sCheminIcas) = 0  Then  MemoriseCheminIcasOptions
	Endif	
	
	oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 70
	
rem ------------------------------------------------------------------------------------
&apos; repositione les fichiers Dmaths dans &lt;user&gt;/Dmaths
	If Not FileExists(ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/Dmaths/&quot;)) Then Mkdir ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/Dmaths/&quot;)
	If FileExists(ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/config/dmoptions.txt&quot;)) Then
		FileCopy ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/config/dmoptions.txt&quot;) , ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/Dmaths/dmoptions.txt&quot;)
		Kill ConvertToURL(GetRepertoirePath(&quot;user&quot;)&amp;&quot;/config/dmoptions.txt&quot;)
	Endif



rem -----------------------------------------------------------------------------------
rem regle le mode d&apos;affichage des icones et la securité des macros en cas de première installation
	If bPremInstall Then ChangeModeAffichageIconesAndMacroSecurity

	
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 = 80

	
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 = 90

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
&apos;	On Error GoTo 0
&apos;	If (TestInstallRezo and ControleDroits(GetRepertoirePath(&quot;inst&quot;)) and Len(sLeChemindeDmaths)&lt;&gt;0) Then 
&apos;	RegleCheminDesIcones(sLeChemindeDmaths)
&apos;	Endif 
&apos;	On Error GoTo TraitementErreurFinInstallation
	

	If Not bInstallationParExeWin Then
		Rem on ferme eventuellement le progressbar
		oDmProgInst.getControl(&quot;ProgressBar1&quot;).Value = 100
		oDmProgInst.Dispose()
		Rem on n&apos;affiche pas le message de fin si on installe par win.exe
 	    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
		oFinInst.execute()
	EndIf
	
Rem charge les options de Dmaths
	Call Dmaths.DmathsOptions.LoadOptionsDmaths
Rem --------------------------------------------------------------------------------------------------------------------------------------------
	
Rem --------------------------------------------------------------------------------------------------------------------------------------------- 
	Rem pour les mises à jour à partir de versions &lt;= 3599 on supprime le module dmOptions et on remet les options par défaut
	If (Not bPremInstall And iNumVersionDmathsCourante &lt;= 3599 And iNumVersionDmathsCourante &gt; 0 ) Then 
		sMessage = Trad(iLangChoisie,0)	
		msgbox(sMessage,64,&quot;Dmaths&quot;)
		If IsMacOS Then
			ReLanceOOoMac	
		ElseIf GetGuiType = 1 Then
			ReLanceOOoWin
		Else
			ReLanceOOo
		End if	
	Endif
rem ----------------------------------------------------------------------------------------------------------------------------------------------	
	
	Exit Sub

	
rem traitement des erreurs
	TraitementErreurFinInstallation:
	Print Trad(iLang,14) &amp; erl &amp; chr(13) &amp; Error
	Resume next	
	
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) and Not IsMacOs) 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

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
			Case &quot;es&quot;
				iLangT = 3		
			Case &quot;pt&quot;
				iLangT = 4
			Case &quot;et&quot;
				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  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  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 sFichierModule as String
		sFichierModule = GetRepertoirePath(&quot;user&quot;) &amp; getPathSeparator &amp; &quot;Dmaths&quot; &amp; getPathSeparator		
		If Not FileExists(sFichierModule) Then Mkdir ConvertToUrl(sFichierModule)		
		sFichierModule = sFichierModule &amp;  &quot;dmoptions.txt&quot;	
		If FileExists(sFichierModule) Then Kill ConvertToUrl(sFichierModule)	
		FileCopy fCheminDmaths &amp; &quot;Options/dmoptions.txt&quot; , ConvertToURL(sFichierModule)	
		If getGuiType = 1 Then
		
		
		Endif	
End Sub


rem cette macro met a jour les options en gardant celles de l utilisateur
Sub OptionsUtilisateur
	
	If bTraitementErreurInstallation Then On error Goto TraitementErreurOptionsUtilisateurs
	
	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;
	Rem gere l&apos;introduction de la prise en charge des autotextes pour les lettres grecques ex al be ga etc. Ajouté le 13 décembre 2015
	If iNumVersionDmathsCourante &lt;= 3570 Then oDmOptions.GetControl(&quot;CheckBox3&quot;).State = 1

	DmInstall.Install_Addon.LoadAppsPref(oDmOptions,sThemeIcons) rem bPremInstall=False 
	DmInstall.Install_Addon.RegleIconesAppsPref(oDmOptions,sThemeIcons)
	
	Rem les options utilisateur ne sont reprises que si Dmaths &gt;= 3600
	If iNumVersionDmathsCourante &gt;= 3600 Then 
		ValidOptionsDmaths
	Else
		DeleteModuleDmOptions
		sCheminDmOptions = GetRepertoirePath(&quot;user&quot;) &amp; GetPathSeparator &amp; &quot;Dmaths&quot; &amp; GetPathSeparator &amp; &quot;dmoptions.txt&quot; 
		If FileExists(sCheminDmOptions) Then Kill sCheminDmOptions
		FileCopy fCheminDmaths &amp; &quot;Options/dmoptions.txt&quot; , ConvertToURL(sCheminDmOptions)		
	Endif
	
	oDmOptions.Dispose
	
	Exit Sub

	
rem traitement des erreurs
	TraitementErreurOptionsUtilisateurs:
	Print Trad(iLang,14) &amp; erl &amp; chr(13) &amp; Error
	Resume next
			
End Sub

Rem macro ecrite le 1er novembre 2015
Rem cette macro calcule la position des barres d&apos;outils de Dmaths. Ecrite le 31 octobre 2015
Function PositionDesBarresdOutils as String
	Dim maPos,sUrl As String
	Dim bPosReelle As Boolean rem ce booleen vaut true si on lit la position instantanée

	bPosReelle = False
	If Not bInstallationParExeWin Then 
		On Error Goto Passe:
		If ThisComponent.CurrentController.ImplementationName = &quot;SwXTextView&quot; Then bPosReelle = True
		GoTo Suite:
		Passe: 
		bPosRelle = False
		On Error GoTo 0
		Suite:
	EndIf 

	rem dans Writer
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )	
	rem position instantanéé
	If bPosReelle Then
			oFrame = ThisComponent.CurrentController.Frame
			layout = oFrame.LayoutManager			
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  Cstr(layout.getElementPos(sUrl).X &amp; &quot;,&quot; &amp; Cstr(layout.getElementPos(sUrl).Y))
		Endif		
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  maPos &amp; &quot;:&quot; &amp; Cstr(layout.getElementPos(sUrl).X &amp; &quot;,&quot; &amp; Cstr(layout.getElementPos(sUrl).Y))
		Endif
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  maPos &amp; &quot;:&quot; &amp; Cstr(layout.getElementPos(sUrl).X &amp; &quot;,&quot; &amp; Cstr(layout.getElementPos(sUrl).Y))
		Endif
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  maPos &amp; &quot;:&quot; &amp; Cstr(layout.getElementPos(sUrl).X &amp; &quot;,&quot; &amp; Cstr(layout.getElementPos(sUrl).Y))
		EndIf
	rem posiotn mémorisée
	Else
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  oConfigAccess.getByName(sURL).DockPos
		EndIf
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;
		If oConfigAccess.HasByName(sUrl) Then	
			maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
		EndIf
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
		If oConfigAccess.HasByName(sUrl) Then	
			maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
		EndIf
		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
		If oConfigAccess.HasByName(sUrl) Then
			maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
		EndIf
	Endif
	
	Rem dans Draw
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States/&quot;, True )	
	
	sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;
	If oConfigAccess.HasByName(sUrl) Then
		maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
	EndIf
	sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;
	If oConfigAccess.HasByName(sUrl) Then	
		maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
	EndIf
	sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
	If oConfigAccess.HasByName(sUrl) Then	
		maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
	EndIf
	sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
	If oConfigAccess.HasByName(sUrl) Then
		maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
	EndIf
	
	
	
	Rem dans Impress
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.ImpressWindowState/UIElements/States/&quot;, True )
		
	sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.InsertDocumentWriter&quot;
	If oConfigAccess.HasByName(sUrl) Then	
		maPos =  maPos &amp;&quot;:&quot;&amp; oConfigAccess.getByName(sURL).DockPos
	EndIf
	
	PositionDesBarresdOutils = maPos &amp; &quot;:&quot;
		
End Function


Rem macro ecrite le 1er novembre 2015
Sub PositionneBarredOutilDansConfiguration(oConfigAccess As Object, sUrl As String)
	Dim sDockPos as String
	If oConfigAccess.HasByName(sUrl) Then
		PI = PF + 1
		PF = Instr(PI,sPositionDesBarresdOutilsMemorisee,&quot;:&quot;)
		sDockPos = Mid(sPositionDesBarresdOutilsMemorisee,PI,PF-PI)		
		oConfigAccess.getByName(sURL).DockPos = sDockPos
	EndIf 
End Sub


Rem macro ecrite le 1er novembre 2015
Sub PositionneBarredOutilDansFrame(oConfigAccess, layout As Object, sUrl As String)
		If oConfigAccess.HasByName(sUrl) Then
			PI = PF+1
			PF = Instr(PI,sPositionDesBarresdOutilsMemorisee,&quot;,&quot;)
			positionBarre.X = Mid(sPositionDesBarresdOutilsMemorisee,PI,PF-PI)
			PI = PF+1
			PF = Instr(PI,sPositionDesBarresdOutilsMemorisee,&quot;:&quot;)
			positionBarre.Y = Mid(sPositionDesBarresdOutilsMemorisee,PI,PF-PI)
			layout.dockWindow(sUrl,docArea,positionBarre)
		EndIf
End Sub


Rem macro ecrite le 1er novembre 2015
Sub PositionneLesBarresdOutils
	Dim sUrl as String
	Dim bPosReelle As Boolean rem ce booleen vaut true si on lit la position instantanée
	bPosReelle = False
	If Not bInstallationParExeWin Then 
		On Error Goto Passe:
		If ThisComponent.CurrentController.ImplementationName = &quot;SwXTextView&quot; Then bPosReelle = True
		GoTo Suite:
		Passe: 
		bPosRelle = False
		On Error GoTo 0
		Suite:
	EndIf 
	PI = 0
	PF = 0
	
&apos;	Print bPosReelle
Rem si on travaille sur la position instantanée 
	If bPosReelle Then
		oFrame = ThisComponent.CurrentController.Frame
		layout = oFrame.LayoutManager
		Rem positionne dans Writer
		oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )	

		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;
		PositionneBarredOutilDansFrame(oConfigAccess, layout, sUrl)		
		&apos;Print positionBarre.X,&quot;    &quot;,positionBarre.Y
	
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;	
		PositionneBarredOutilDansFrame(oConfigAccess, layout, sUrl)		
		&apos;Print positionBarre.X,&quot;    &quot;,positionBarre.Y

		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
		PositionneBarredOutilDansFrame(oConfigAccess, layout, sUrl)		
		&apos;Print positionBarre.X,&quot;    &quot;,positionBarre.Y

		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
		PositionneBarredOutilDansFrame(oConfigAccess, layout, sUrl)		
		&apos;Print positionBarre.X,&quot;    &quot;,positionBarre.Y	

Rem si l&apos;installation se fait par l&apos;executable windows
	Else
	
			Rem positionne dans Writer
		oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.WriterWindowState/UIElements/States&quot;, True )	
	
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsBarre&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos 
		
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos
		
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos 
		
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos
		
	oConfigAccess.commitChanges()
		
		
		
	EndIf 

	Rem positionne dans Draw
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.DrawWindowState/UIElements/States/&quot;, True )	
	
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.DMathsDisplayBarre&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos = sDockPos

		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoTep-Gdmath&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos = sDockPos

		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoGdmathBarre1&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos = sDockPos
	
		sUrl = &quot;private:resource/toolbar/addon_org.openoffice.Office.addon.OOoAHmath3D.OfficeToolBar&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos

	oConfigAccess.commitChanges()
	
	Rem positionne dans Impress
	oConfigAccess = GetConfigAccess(&quot;/org.openoffice.Office.UI.ImpressWindowState/UIElements/States/&quot;, True )	

		sUrl=&quot;private:resource/toolbar/addon_org.openoffice.Office.addon.InsertDocumentWriter&quot;
		PositionneBarredOutilDansConfiguration(oConfigAccess,sUrl)
		&apos;Print oConfigAccess.getByName(sURL).DockPos = sDockPos
		
	oConfigAccess.commitChanges()
	
	Rem regle le mode (taille) d&apos;affichage des icones
	Dim sNodePath As String
    Dim oCP, oCUA     
    sNodePath = &quot;/org.openoffice.Office.Common/Misc&quot;       
    Dim aProps(0) As New com.sun.star.beans.PropertyValue         
    oCP = CreateUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot; )       
    aProps(0).Name = &quot;nodepath&quot;
    aProps(0).Value = sNodePath
    oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )       
    oCUA.SymbolSet =  iModeAffichageIcones  
    oCUA.commitChanges()
    
End Sub

Function ModeAffichageIcones As Integer
       Dim sNodePath As String
       Dim oCP, oCUA     
       sNodePath = &quot;/org.openoffice.Office.Common/Misc&quot;       
       Dim aProps(0) As New com.sun.star.beans.PropertyValue         
       oCP = CreateUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot; )       
       aProps(0).Name = &quot;nodepath&quot;
       aProps(0).Value = sNodePath
       oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )       
       ModeAffichageIcones = oCUA.SymbolSet      
End Function

Rem macro entièrement réécrite le 11 janvier 2016
Sub LoadAppsPref(oBoiteApps as Object, sThemeIcons as String)

	rem traitement des erreurs
	If bTraitementErreurInstallation Then On Error GoTo TraitementErreurLoadAppsPref


	Dim ApplicationsUtilisateur(1 To 3) As String
	Dim  sSourceIcone, sNomdeLapps As String
	Dim iIndiceAppsPref As Integer
	sRepertoireDmathsIcons = GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;Dmaths&quot;+GetPathSeparator+&quot;icons&quot;
	sRepertoireDmathsIcons = ConvertToURL(sRepertoireDmathsIcons)
	
	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;)
		oAddon = getToolBarItems(oAddon)
		For I = 1 To 3 	
			oDmOptions.GetControl(&quot;CheckBox3&quot; &amp; Cstr(I)).State = IIf(oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Context = &quot;com.sun.star.text.TextDocument&quot;,1,0)
			oDmOptions.GetControl(&quot;SoftButton&quot; &amp; Cstr(I)).Enable = IIf(oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Context = &quot;com.sun.star.text.TextDocument&quot;,1,0)
			oDmOptions.GetControl(&quot;ListBox&quot; &amp; Cstr(I+1)).Enable = IIf(oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Context = &quot;com.sun.star.text.TextDocument&quot;,1,0)
			If oDmOptions.GetControl(&quot;CheckBox31&quot;).State = 0 And oDmOptions.GetControl(&quot;CheckBox32&quot;).State = 0 And oDmOptions.GetControl(&quot;CheckBox33&quot;).State = 0 Then
			 	oDmOptions.GetControl(&quot;FileControl2&quot;).Enable = 0 
			Endif
		Next I
	Endif
	
	If IsMacOs Then 
		Call LoadAppsMac
	ElseIf GetguiType = 4 Then
		Call LoadAppsLinux
	Elseif GetguiType = 1 Then
		Call LoadAppsWin rem charge les noms des applications préférées
	End If	

	ApplicationsUtilisateur(1) = sCheminSoftware1 : ApplicationsUtilisateur(2) = sCheminSoftware2 : ApplicationsUtilisateur(3) = sCheminSoftware3
	
	Rem le tableau AppsPref est complété avec les applications que l&apos;utilisateur a définies
	For I = 1 To 3
		If Len(ApplicationsUtilisateur(I)) &gt; 0 And GetIndiceAppsPref(ApplicationsUtilisateur(I)) = -1 Then
			AppsPref(I,0) = ApplicationsUtilisateur(I)
			AppsPref(I,1) =  sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp;  Cstr(I)
			sNomdeLapps = getFileNameOnly(ConvertToUrl(ApplicationsUtilisateur(I)))
			AppsPref(I,2) =  Ucase(Mid(sNomdeLapps,1,1)) &amp; Mid(sNomdeLapps,2,Len(sNomdeLapps)-1)		
		Endif
	Next I
	
	Rem remplis la listebox2 en rangeant les items dans l&apos;ordre alphabétique.
	For I = 1 To AppsPrefUbount	
			If FileExists(AppsPref(I,0)) Then
					J = 0					
					If oBoiteApps.getControl(&quot;ListBox2&quot;).ItemCount &gt; 0 Then
						Do While (oBoiteApps.getControl(&quot;ListBox2&quot;).Items(J) &lt; AppsPref(I,2))						
							J = J+1
							If J = oBoiteApps.getControl(&quot;ListBox2&quot;).ItemCount Then Exit Do
						Loop
					Endif 
					oBoiteApps.getControl(&quot;ListBox2&quot;).AddItem(AppsPref(I,2),J)
			Endif
	Next I 		
	
	oBoiteApps.getControl(&quot;ListBox3&quot;).AddItems(oBoiteApps.getControl(&quot;ListBox2&quot;).Items,0)
	oBoiteApps.getControl(&quot;ListBox4&quot;).AddItems(oBoiteApps.getControl(&quot;ListBox2&quot;).Items,0)

	For I = 1 To 3
		If Len(ApplicationsUtilisateur(I)) &gt; 0 Then
			oBoiteApps.GetControl(&quot;SoftButton&quot; &amp; Cstr(I)).Model.ImageURL = sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp;  Cstr(I)  &amp;  &quot;_26.bmp&quot;
			iIndiceAppsPref = GetIndiceAppsPref(ApplicationsUtilisateur(I))
			oBoiteApps.getControl(&quot;ListBox&quot; &amp; Cstr(I+1)).SelectItem(AppsPref(iIndiceAppsPref,2),True)
		Endif	
	Next I
	
	Exit Sub
	
	rem traitement des erreurs
	TraitementErreurLoadAppsPref:
	Print &quot;Erreur dans la macro LoadAppsPref à la : ligne &quot; &amp; erl &amp;  &quot;   &quot; &amp; Error
	Resume next
	
End Sub

Rem macro écrite le 16 janvier 2016
Rem après choix dans la listbox, ajuste l&apos;image en conséquence
Sub ChangeAppsPreferee (oEvt As object)
	bIconesAppsPrefChoisies = True
	Dim iIndiceAppsPref As Integer
	Dim sNumSoftButton As String
	iNumListBox = Cint(Right(oEvt.Source.Model.Name,1))
	iIndiceAppsPref = GetIndiceAppsPref(oDmOptions.GetControl(oEvt.Source.Model.Name).SelectedItem)
    sNumSoftButton = Cstr(Cint(Right(oEvt.Source.Model.Name,1))-1)
   	oDmOptions.GetControl(&quot;SoftButton&quot; &amp; sNumSoftButton).Model.ImageURL = AppsPref(iIndiceAppsPref,1) &amp; &quot;_26.bmp&quot;
End Sub

Rem gere la listbox qui reçoit le clic lorsque le FileControle2 n&apos;est pas vide.
Sub GereFileControlDmOptions(oEVt As Object)
	Dim sCheminNouvelleApps As String
	Dim iIndiceAppsPref, iNumSoftButton As Integer
	sCheminNouvelleApps = oDmOptions.GetControl(&quot;FileControl2&quot;).Peer.Text

	If Len(sCheminNouvelleApps) &gt; 0 Then
		If FileExists(sCheminNouvelleApps) Then  	
			iNumSoftButton = Cint(Right(oEvt.Source.Model.Name,1))-1
			iIndiceAppsPref = GetIndiceAppsPref(oDmOptions.GetControl(&quot;TextField2&quot;).Peer.Text)
			
			If iIndiceAppsPref = -1 Then
					AppsPref(iNumSoftButton,0) = sCheminNouvelleApps
					AppsPref(iNumSoftButton,1) = fCheminDmaths+&quot;icons/&quot;+sThemeIcons+&quot;/launchsoftware&quot; &amp; iNumSoftButton
					AppsPref(iNumSoftButton,2) = oDmOptions.GetControl(&quot;TextField2&quot;).Peer.Text
					oDmOptions.getControl(oEvt.Source.Model.Name).AddItem(AppsPref(iNumSoftButton,2),0)
					oDmOptions.getControl(oEvt.Source.Model.Name).SelectItem(AppsPref(iNumSoftButton,2),True)
					oDmOptions.getControl(&quot;SoftButton&quot; &amp; Cstr(iNumSoftButton)).Model.ImageURL = AppsPref(iNumSoftButton,1) &amp; &quot;_26.bmp&quot;
			Else
					AppsPref(iIndiceAppsPref,0) = sCheminNouvelleApps
					oDmOptions.getControl(oEvt.Source.Model.Name).AddItem(AppsPref(iIndiceAppsPref,2),0)
					oDmOptions.getControl(oEvt.Source.Model.Name).SelectItem(AppsPref(iIndiceAppsPref,2),True)
					oDmOptions.getControl(&quot;SoftButton&quot; &amp; Cstr(iNumSoftButton)).Model.ImageURL = AppsPref(iIndiceAppsPref,1) &amp; &quot;_26.bmp&quot;	
			EndIf
		Else
			ChargementDuVocabulaire
			MsgBox (&quot;    &quot; &amp; Trad(iLand,13),48 , &quot;Dmaths (C) Didier Dorange-Pattoret&quot;)
		Endif				
		oEvt.Source.Context.GetControl(&quot;FileControl2&quot;).Peer.Text = &quot;&quot;
		oEvt.Source.Context.GetControl(&quot;TextField2&quot;).Peer.Text = &quot;&quot;
		oDmOptions.GetControl(&quot;TextField2&quot;).Enable = 0
	Endif
End Sub

Sub CalculeNomExecutable
	Dim sNomExecutable As string
	oDmOptions.getControl(&quot;TextField2&quot;).Enable = 1
	If FileExists(oDmOptions.GetControl(&quot;FileControl2&quot;).Model.Text) Then
		sNomExecutable = ConvertFromURL(getFileNameOnly(ConvertToURL(oDmOptions.GetControl(&quot;FileControl2&quot;).Model.Text)))
		oDmOptions.GetControl(&quot;TextField2&quot;).Peer.Text =  Ucase(Mid(sNomExecutable,1,1)) &amp; Mid(sNomExecutable,2,Len(sNomExecutable)-1)
		oDmOptions.GetControl(&quot;FileControl2&quot;).Model.HelpText = oDmOptions.GetControl(&quot;FileControl2&quot;).Model.Text
	Else
		oDmOptions.GetControl(&quot;TextField2&quot;).Peer.Text = &quot;&quot;
		oDmOptions.GetControl(&quot;FileControl2&quot;).Model.HelpText = &quot;&quot;
	Endif
End Sub

Sub RegleIconesAppsPref(oBoiteApps as Object,sThemeIcons as String)
	Dim UnFich as String
		
	If bTraitementErreurInstallation Then On Error Goto TraitementErreurRegleIconesAppsPref
	
	sRepertoireDmathsIcons = GetRepertoirePath(&quot;user&quot;)+GetPathSeparator+&quot;Dmaths&quot;+GetPathSeparator+&quot;icons&quot;
	sRepertoireDmathsIcons = ConvertToURL(sRepertoireDmathsIcons)
	If Not FileExists(sRepertoireDmathsIcons) Then Mkdir sRepertoireDmathsIcons
	Rem GetConfigAccess2 pour tenir compte de la langue utilisateur
	oConfigAccess = GetConfigAccess2( &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;)
			oAddon = getToolBarItems(oAddon)

			FileCopy sRepertoireDmathsIcons, sRepertoireDmathsIcons &amp; &quot;_save&quot;

			For I = 1 To 3
			
				If oBoiteApps.GetControl(&quot;ListBox&quot; &amp; Cstr(I+1)).SelectedItem &lt;&gt; &quot;&quot; Then
					iIndiceAppsPref = GetIndiceAppsPref(oBoiteApps.GetControl(&quot;ListBox&quot; &amp; Cstr(I+1)).SelectedItem)				
					
				rem le contexte puis l&apos;icone
					If Instr(AppsPref(iIndiceAppsPref,1),sRepertoireDmathsIcons) = 0 Then	
						FileCopy AppsPref(iIndiceAppsPref,1) &amp; &quot;_16.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_16.bmp&quot;
						FileCopy AppsPref(iIndiceAppsPref,1) &amp; &quot;_26.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_26.bmp&quot;
						FileCopy AppsPref(iIndiceAppsPref,1) &amp; &quot;_16h.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_16h.bmp&quot;
						FileCopy AppsPref(iIndiceAppsPref,1) &amp; &quot;_26h.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_26h.bmp&quot;
					ElseIf I &lt;&gt; iIndiceAppsPref Then
						FileCopy sRepertoireDmathsIcons &amp; &quot;_save&quot; &amp; &quot;/launchsoftware&quot; &amp; Cstr(iIndiceAppsPref) &amp; &quot;_16.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_16.bmp&quot;
						FileCopy sRepertoireDmathsIcons &amp; &quot;_save&quot; &amp; &quot;/launchsoftware&quot; &amp; Cstr(iIndiceAppsPref) &amp; &quot;_26.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_26.bmp&quot;
						FileCopy sRepertoireDmathsIcons &amp; &quot;_save&quot; &amp; &quot;/launchsoftware&quot; &amp; Cstr(iIndiceAppsPref) &amp; &quot;_16h.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_16h.bmp&quot;
						FileCopy sRepertoireDmathsIcons &amp; &quot;_save&quot; &amp; &quot;/launchsoftware&quot; &amp; Cstr(iIndiceAppsPref) &amp; &quot;_26h.bmp&quot;, sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I) &amp; &quot;_26h.bmp&quot;
					Endif
						
					oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).ImageIdentifier = sRepertoireDmathsIcons &amp; &quot;/launchsoftware&quot; &amp; Cstr(I)		
					
				rem l&apos;infobulle
					oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Title = AppsPref(iIndiceAppsPref,2)
						
				Rem Affichée ou non					
					oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Context = IIf(oDmOptions.GetControl(&quot;CheckBox3&quot; &amp; Cstr(I)).State = 1,&quot;com.sun.star.text.TextDocument&quot;,&quot;hidden&quot;)
						
				Else
					oAddon.getByName(&quot;soft&quot; &amp; Cstr(I)).Context = &quot;hidden&quot;
				End If
			Next I			
	
	&apos;	Print sRepertoireDmathsIcons &amp; &quot;_save/&quot;
		unFich = Dir(sRepertoireDmathsIcons &amp; &quot;_save/*&quot;,0)
		Do While Len(unFich) &gt; 0
	&apos;		Print unFich 
			Kill sRepertoireDmathsIcons &amp; &quot;_save/&quot; &amp; unFich
			unFich = Dir
		Loop
		Rmdir sRepertoireDmathsIcons &amp; &quot;_save/&quot;

	Endif			
	oConfigAccess.commitChanges()
	
	Exit Sub
	
	rem traitement des erreurs
	TraitementErreurRegleIconesAppsPref:
	Print Trad(iLang,14) &amp; erl &amp; chr(13) &amp; Error
	Resume next	
	
End Sub

Sub ChangeActivate(oEvt As Object)
	Dim sNumero As String
	bIconesAppsPrefChoisies = True
	sNumero = Right(oEvt.Source.Model.Name,1)
	oDmOptions.GetControl(&quot;SoftButton&quot; &amp; sNumero).Enable  = (oEvt.Source.Model.State = 1)
	oDmOptions.GetControl(&quot;ListBox&quot; &amp; Cstr(Cint(sNumero)+1)).Enable  = (oEvt.Source.Model.State = 1)
	If oDmOptions.GetControl(&quot;CheckBox31&quot;).State = 0 And oDmOptions.GetControl(&quot;CheckBox32&quot;).State = 0 And oDmOptions.GetControl(&quot;CheckBox33&quot;).State = 0 Then
		oDmOptions.GetControl(&quot;FileControl2&quot;).Enable = 0 
	Else
		oDmOptions.GetControl(&quot;FileControl2&quot;).Enable = 1
	Endif
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


 rem cette macro permet choisir le theme des icones affichées ecrite le 31 octobre 2015
Function ChoisirThemeIcone(sTheme as String) As boolean
		
		sRepertoireDmaths = fChemindmaths rem sRepertoireDmaths donne l adresse des fichiers
		If Not TestInstallRezo Or  ControleDroits(getRepertoirePath(&quot;inst&quot;)) Then
			If FileExists(sRepertoireDmaths &amp; &quot;icons/theme&quot;) Then RmDir sRepertoireDmaths &amp; &quot;icons/theme&quot;
			FileCopy sRepertoireDmaths &amp; &quot;icons/&quot; &amp; sTheme  , sRepertoireDmaths &amp; &quot;icons/theme&quot;	
	
		Else &apos;If bIconesChangees Then
		
			Rem cas des comptes ordinaires dans les installations multiutilisateurs
			TheMsg = Trad(iLang,1) &amp; chr(13) &amp; Trad(iLang,7) &amp; chr(13)  &amp; chr(13) &amp; Trad(iLang,8)
			If MsgBox (TheMsg, 256 + 32 +1, &quot;Dmaths Installation (C) Didier Dorange-Pattoret&quot;) = 1 Then
				sRepertoireConfigUser = ConvertToURL( getRepertoirePath(&quot;user&quot;)) &amp; &quot;/Dmaths/&quot;
				If FileExists(sRepertoireConfigUser &amp; &quot;icons/theme&quot;) Then RmDir sRepertoireConfigUser &amp; &quot;icons/theme&quot;
				If Not FileExists(sRepertoireConfigUser &amp; &quot;icons&quot;) Then Mkdir sRepertoireConfigUser &amp; &quot;icons&quot;
				MkDir sRepertoireConfigUser &amp; &quot;icons/theme&quot;
				FileCopy sRepertoireDmaths &amp; &quot;icons/&quot; &amp; sTheme  , sRepertoireConfigUser &amp; &quot;icons/theme&quot;	
				Dim sElementNames$()
				Dim oToolBarItems as Object	
				
				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 = getElementNamesofToolbar(oAddon)
					oToolBarItems = getToolBarItems(oAddon)	
					For I = LBound(sElementNames()) To UBound(sElementNames())		
						 oToolBarItems.getByname(sElementNames(I)).ImageIdentifier = ReplacesTheme(oToolBarItems.getByname(sElementNames(I)).ImageIdentifier,sRepertoireConfigUser)
					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 = getElementNamesofToolbar(oAddon)
					oToolBarItems = getToolBarItems(oAddon)
					Rem on ne change que l&apos;icone relative à la barre Dmaths
					oToolBarItems.getByname(sElementNames(0)).ImageIdentifier = ReplacesTheme(oToolBarItems.getByname(sElementNames(0)).ImageIdentifier,sRepertoireConfigUser)
					&apos;For I = LBound(sElementNames()) To UBound(sElementNames())
					&apos;	oToolBarItems.getByname(sElementNames(I)).ImageIdentifier = ReplacesTheme(oToolBarItems.getByname(sElementNames(I)).ImageIdentifier,sRepertoireConfigUser)
					&apos;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())
						oMenu = oAddon.GetByName(sElementNames(I))
						oMenu.ImageIdentifier = ReplacesTheme(oMenu.ImageIdentifier,sRepertoireConfigUser)
					Next I
				EndIf		
				oConfigAccess.commitChanges()  
			Else
				Rem evite un redemarrage si l&apos;utilisateur clique sur annuler.				
				ChoisirThemeIcone = True
			EndIf 
		End if

End Function

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



Sub ChangeModeAffichageIconesAndMacroSecurity
       Dim sNodePath As String
       Dim oCP, oCUA
       Dim aProps(0) As New com.sun.star.beans.PropertyValue 
       oCP = CreateUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot; )
       aProps(0).Name = &quot;nodepath&quot;
rem change le mode d&apos;affichage des icones
       sNodePath = &quot;/org.openoffice.Office.Common/Misc&quot; 
       aProps(0).Value = sNodePath                           
       oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )
       oCUA.SymbolSet = 0
       oCUA.commitChanges()
rem change le mode de sécurité des macros
       sNodePath = &quot;/org.openoffice.Office.Common/Security/Scripting&quot;
       aProps(0).Value = sNodePath
       oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )       
       oCUA.MacroSecurityLevel = 1
       oCUA.commitChanges()
rem regle l&apos;espacement des doubles barres de surlignement par défaut
	   sNodePath = &quot;/org.openoffice.Office.Math/StandardFormat/Distance&quot;
       aProps(0).Value = sNodePath
       oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )       
       oCUA.OrnamentSpace = 8
       oCUA.commitChanges() 
rem supprime l&apos;insertion des inspace insécable.
	   sNodePath = &quot;/org.openoffice.Office.Common/AutoCorrect&quot;
       aProps(0).Value = sNodePath	
       oCUA = oCP.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aProps )       
       oCUA.AddNonBreakingSpace = False
       oCUA.commitChanges() 
End Sub


Rem Macro cree le 1 novembre 2013
Function DetermineImageIdentifierByName(oAddon as Object,Identifiant As String) as String
			DetermineImageIdentifierByName = getToolBarItems(oAddon).getByName(Identifiant).ImageIdentifier				
End Function

Rem Macro cree le 1 novembre 2013
Function DetermineImageIdentifierByNumber(oAddon as Object, iIndice as Integer) as String
		Dim Identifiant	
		Identifiant = getToolBarItems(oAddon).ElementNames(iIndice)		
		DetermineImageIdentifierByNumber = DetermineImageIdentifierByName(oAddon,Identifiant)
End Function

Rem Macro cree le 2 novembre 2013
Function getElementNamesofToolbar(oAddon as Object)		
			getElementNamesofToolbar = getToolBarItems(oAddon).getElementNames()		
End Function

Rem Macro cree le 2 novembre 2013
Function getToolBarItems(oAddon as Object) as Object
		If OOoName()&lt;&gt;&quot;OpenOffice&quot; Then
			getToolBarItems = oAddon
		Else
			getToolBarItems = oAddon.getByName(&quot;ToolBarItems&quot;)
		Endif 
End Function


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 donne l&apos;indice correspondant a l&apos;application modifiée le 22 ajnvier 2016
Function GetIndiceAppsPref(sAppsPref as String) as Integer
	GetIndiceAppsPref = -1 rem valeur si pas dans la liste prédéfinie
	For I = 1 To AppsPrefUbount
		If AppsPref(I,0) = sAppsPref Then
			GetIndiceAppsPref = I
			Exit For
		End If
	Next I
		For I = 1 To AppsPrefUbount
		If AppsPref(I,2) = sAppsPref And FileExists(AppsPref(I,0)) Then
			GetIndiceAppsPref = I
			Exit For
		End If
	Next I
End Function


Sub LoadAppsLinux
	Dim sCheminDmaths As String
	sCheminDmaths = fCheminDmaths
	AppsPrefUbount = 10
 	rem les images incluses dans l&apos;addon n&apos;ont pas d&apos;extension.
	AppsPref(4,0) = &quot;/usr/bin/geogebra&quot;
	AppsPref(4,1) = sCheminDmaths &amp; &quot;icons/appspref/geogebra&quot;
	AppsPref(4,2) = &quot;Geogebra&quot;
	AppsPref(5,0) = &quot;/usr/bin/algobox&quot;
	AppsPref(5,1) = sCheminDmaths &amp; &quot;icons/appspref/algobox&quot;
	AppsPref(5,2) = &quot;Algobox&quot;
	AppsPref(6,0) = TrouveCheminIcas(True) &apos;&quot;C:\xcas\xcas.exe&quot; &apos;&quot;/usr/bin/xcas&quot;
	AppsPref(6,1) = sCheminDmaths &amp; &quot;icons/appspref/xcas&quot;
	AppsPref(6,2) = &quot;Xcas&quot;
	AppsPref(7,0) = &quot;/usr/bin/firefox&quot;
	AppsPref(7,1) = sCheminDmaths+&quot;icons/appspref/firefox&quot;
	AppsPref(7,2) = &quot;Firefox&quot;
	AppsPref(8,0) = &quot;/usr/bin/thunderbird&quot;
	AppsPref(8,1) = sCheminDmaths+&quot;icons/appspref/thunderbird&quot;
	AppsPref(8,2) = &quot;Thunderbird&quot;
	AppsPref(9,0) = &quot;/usr/bin/google-chrome&quot;
	AppsPref(9,1) = sCheminDmaths+&quot;icons/appspref/chrome&quot;
	AppsPref(9,2) = &quot;Chrome&quot;	
	AppsPref(10,0)= &quot;/usr/bin/wabbitemu&quot;
	AppsPref(10,1)= sCheminDmaths+&quot;icons/appspref/wabbitemu&quot;
	AppsPref(10,2)= &quot;Wabbitemu&quot;
	AppsPref(11,0)= &quot;&quot;
	AppsPref(11,1)= &quot;&quot;
	AppsPref(11,2)= &quot;&quot;				
End Sub


Sub LoadAppsMac
	Dim sCheminDmaths As String
	sCheminDmaths = fCheminDmaths
	AppsPrefUbount = 11
 	rem les images incluses dans l&apos;addon n&apos;ont pas d&apos;extension.
	AppsPref(4,0) = &quot;/Applications/GeoGebra 5.app&quot;
	AppsPref(4,1) = sCheminDmaths &amp; &quot;icons/appspref/geogebra&quot;
	AppsPref(4,2) = &quot;Geogebra&quot;
	AppsPref(5,0) = &quot;/Applications/Algobox.app&quot;
	AppsPref(5,1) = sCheminDmaths &amp; &quot;icons/appspref/algobox&quot;
	AppsPref(5,2) = &quot;Algobox&quot;
	AppsPref(6,0) = &quot;/Applications/usr/bin/xcas.app&quot;
	AppsPref(6,1) = sCheminDmaths &amp; &quot;icons/appspref/xcas&quot;
	AppsPref(6,2) = &quot;Xcas&quot;
	AppsPref(7,0) = &quot;/Applications/Firefox.app&quot;
	AppsPref(7,1) = sCheminDmaths+&quot;icons/appspref/firefox&quot;
	AppsPref(7,2) = &quot;Firefox&quot;
	AppsPref(8,0) = &quot;/Applications/Thunderbird.app&quot;
	AppsPref(8,1) = sCheminDmaths+&quot;icons/appspref/thunderbird&quot;
	AppsPref(8,2) = &quot;Thunderbird&quot;
	AppsPref(9,0) = &quot;/Applications/Google Chrome.app&quot;
	AppsPref(9,1) = sCheminDmaths+&quot;icons/appspref/chrome&quot;
	AppsPref(9,2) = &quot;Chrome&quot;	
	AppsPref(10,0)= &quot;/Applications/WabbitEmu.app&quot;
	AppsPref(10,1)= sCheminDmaths+&quot;icons/appspref/wabbitemu&quot;
	AppsPref(10,2)= &quot;WabbitEmu&quot;
	AppsPref(11,0)= &quot;/Applications/Scratch 2.app&quot;
	AppsPref(11,1)= sCheminDmaths+&quot;icons/appspref/scratch&quot;
	AppsPref(11,2)= &quot;Scratch&quot;				
End Sub


Sub LoadAppsWin
	Dim sCheminDmaths As String
	sCheminDmaths = fCheminDmaths
	AppsPrefUbount = 19
 	rem les images incluses dans l&apos;addon n&apos;ont pas d&apos;extension.
	AppsPref(4,0) = environ(&quot;programfiles(x86)&quot;)&amp;&quot;\GeoGebra 5.0\GeoGebra.exe&quot;
	AppsPref(4,1) = sCheminDmaths &amp; &quot;icons/appspref/geogebra&quot;
	AppsPref(4,2) = &quot;Geogebra&quot;
	AppsPref(6,0) = environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Algobox\algobox.exe&quot;
	AppsPref(6,1) = sCheminDmaths &amp; &quot;icons/appspref/algobox&quot;
	AppsPref(6,2) = &quot;Algobox&quot;
	AppsPref(8,0) = TrouveCheminIcas(True) &apos;&quot;C:\xcas\xcas.exe&quot;
	AppsPref(8,1) = sCheminDmaths &amp; &quot;icons/appspref/xcas&quot;
	AppsPref(8,2) = &quot;Xcas&quot;
	AppsPref(9,0) = environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Mozilla Firefox\firefox.exe&quot;
	AppsPref(9,1) = sCheminDmaths+&quot;icons/appspref/firefox&quot;
	AppsPref(9,2) = &quot;Firefox&quot;
	AppsPref(11,0)= environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Mozilla Thunderbird\thunderbird.exe&quot;
	AppsPref(11,1)= sCheminDmaths+&quot;icons/appspref/thunderbird&quot;
	AppsPref(11,2)= &quot;Thunderbird&quot;
	AppsPref(13,0)= environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Google\Chrome\Application\chrome.exe&quot;
	AppsPref(13,1)= sCheminDmaths+&quot;icons/appspref/chrome&quot;
	AppsPref(13,2)= &quot;Chrome&quot;	
	AppsPref(15,0)= environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Sine qua non\sinequanon.exe&quot;
	AppsPref(15,1)= sCheminDmaths+&quot;icons/appspref/sinequanon&quot;
	AppsPref(15,2)= &quot;Sine qua non&quot;	
	AppsPref(17,0)= environ(&quot;USERPROFILE&quot;)&amp;&quot;\Wabbitemu.exe&quot;
	AppsPref(17,1)= sCheminDmaths+&quot;icons/appspref/wabbitemu&quot;
	AppsPref(17,2)= &quot;Wabbitemu&quot;	
	AppsPref(18,0)= environ(&quot;programfiles(x86)&quot;)&amp;&quot;\Scratch 2\Scratch 2.exe&quot;
	AppsPref(18,1)= sCheminDmaths+&quot;icons/appspref/scratch&quot;
	AppsPref(18,2)= &quot;Scratch&quot;	
		
	Rem la ligne suivante est utile pour éviter les doublons dans les ListBox123
	If  environ(&quot;programfiles&quot;) = environ(&quot;programfiles(x86)&quot;) Then Exit Sub

	AppsPref(5,0) = environ(&quot;programfiles&quot;)&amp;&quot;\GeoGebra 5.0\GeoGebra.exe&quot;
	AppsPref(5,1) = sCheminDmaths &amp; &quot;icons/appspref/geogebra&quot;
	AppsPref(5,2) = &quot;Geogebra&quot;
	AppsPref(7,0) = environ(&quot;programfiles&quot;)&amp;&quot;\Algobox\algobox.exe&quot;
	AppsPref(7,1) = sCheminDmaths &amp; &quot;icons/appspref/algobox&quot;
	AppsPref(7,2) = &quot;Algobox&quot;
	AppsPref(10,0)= environ(&quot;programfiles&quot;)&amp;&quot;\Mozilla Firefox\firefox.exe&quot;
	AppsPref(10,1)= sCheminDmaths+&quot;icons/appspref/firefox&quot;
	AppsPref(10,2)= &quot;Firefox&quot;
	AppsPref(12,0)= environ(&quot;programfiles&quot;)&amp;&quot;\Mozilla Thunderbird\thunderbird.exe&quot;
	AppsPref(12,1)= sCheminDmaths+&quot;icons/appspref/thunderbird&quot;
	AppsPref(12,2)= &quot;Thunderbird&quot;	
	AppsPref(14,0)= environ(&quot;programfiles&quot;)&amp;&quot;\Google\Chrome\Application\chrome.exe&quot;
	AppsPref(14,1)= sCheminDmaths+&quot;icons/appspref/chrome&quot;
	AppsPref(14,2)= &quot;Chrome&quot;	
	AppsPref(16,0)= environ(&quot;programfiles&quot;)&amp;&quot;\Sine qua non\sinequanon.exe&quot;
	AppsPref(16,1)= sCheminDmaths+&quot;icons/appspref/sinequanon&quot;
	AppsPref(16,2)= &quot;Sine qua non&quot;	
	AppsPref(19,0)= environ(&quot;programfiles&quot;)&amp;&quot;\Scratch 2\Scratch 2.exe&quot;
	AppsPref(19,1)= sCheminDmaths+&quot;icons/appspref/scratch&quot;
	AppsPref(19,2)= &quot;Scratch&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 = fChemindmaths 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 modifiée le 25 février 2013
		Dim GetPIP as Object, repExt as String
	  	GetPIP = GetDefaultContext.getValueByName(&quot;/singletons/com.sun.star.deployment.PackageInformationProvider&quot;) 
	  	repExt = GetPIP.getPackageLocation(&quot;Dmaths&quot;)
		fCheminDmaths = repExt &amp; &quot;/Fichiers/&quot;	
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

Function IsMacOS as Boolean	
	If Getguitype = 3 or (Getguitype = 4 and FileExists(&quot;/Users&quot;)) Then IsMacOS = True Else IsMacOS = False
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******************************************************************************************************************
&apos;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
&apos;	Dim sPath, sRacine, sValue, sCheminDuCompte as String
&apos;	sLeNouveauChemindeDmaths = fCheminDmaths
	rem determine les comptes et appelle la procedure de nettoyage de chacun	
&apos;	If GetGuitype = 1 Then 
&apos;		sPath = GetRepertoirePath(&quot;home&quot;)
&apos;		sRacine = GetRepertoire(sPath)
&apos;	ElseIf IsMacOS Then
&apos;		sRacine = &quot;/Users&quot;
&apos;	Else
&apos;		sRacine = &quot;/home&quot;
&apos;	EndIf
&apos;	sValue = Dir$(sRacine+GetPathSeparator,16)
&apos;		Do 	
&apos;			If sValue&lt;&gt;&quot;..&quot; and Mid(sValue,1,1)&lt;&gt;&quot;.&quot;  Then
&apos;					If (GetAttr(sRacine+GetPathSeparator+sValue) AND 16 &gt; 0) Then
&apos;						sCheminDuCompte = sRacine+GetPathSeparator+sValue			
&apos;						Call RegleChemin(sCheminDuCompte,sLeChemindeDmaths,sLeNouveauChemindeDmaths)						
&apos;					EndIf
&apos;			End If
&apos;			sValue = Dir$
&apos;		Loop Until sValue = &quot;&quot;	
&apos;End Sub


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


Function SuffixeDuCompte as String
		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




</script:module>