/usr/lib/libreoffice/share/extensions/DmathsAddon/DmInstall/Un_Install.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 | <?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="Un_Install" script:language="StarBasic">'************************************************
'Copyright (C) 2006-2010 Didier Dorange-Pattoret
'38, chemin de l'Abbaye
'74940 Annecy le Vieux
'France
'ddorange@dmaths.com
'
'
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public Licence (GPL)
'as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
'General Public License for more details.
'You should have received a copy of the GNU General Public Licence (GPL)
'along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'************************************************
Sub Desinstaller
Dim LeMessage, NomdelAddonEnPlace as String rem contient le nom de l'addon installé
Dim sCheminUnopkg as String
BasicLibraries.LoadLibrary("Dmaths")
Call ChargementDuVocabulaire
LeMessage = Trad(iLang,2) & " "
rem si abandon goto fin
If Msgbox(LeMessage,33,"Dmaths")=2 Then Goto Fin
LeMessage = Trad(iLang,4) & " "
rem mise en place d'une progressbar
Globalscope.DialogLibraries.loadLibrary("DmInstall")
oDmProgInst = CreateUnoDialog(DialogLibraries.DmInstall.DmProgInst)
oDmProgInst.getControl("Label1").Visible = False
rem remet la configuration clavier à l'origine
If Not IsMacOS Then
Config4Mac(False)
EndIf
If Not TestInstallRezo Then
oDmProgInst.Visible = True
oDmProgInst.getControl("ProgressBar1").Value = 0
Call Nettoyer rem macro ci-dessous
sCheminUnopkg = TrouveCheminUnopkg
oDmProgInst.getControl("ProgressBar1").Value = 90
If InStr(fCheminDmaths,"DmathsAddon.zip")>0 Then NomdelAddonEnPlace = "DmathsAddon.zip" Else NomdelAddonEnPlace = "DmathsAddon.oxt"
Shell(sCheminUnopkg &" remove " & NomdelAddonEnPlace,0)
oDmProgInst.getControl("ProgressBar1").Value = 100
Wait 2000
Elseif ControleDroits(GetRepertoirePath("inst")) Then
oDmProgInst.Visible = True
oDmProgInst.getControl("ProgressBar1").Value = 0
Call NettoieLesComptes
sCheminUnopkg = TrouveCheminUnopkg
oDmProgInst.getControl("ProgressBar1").Value = 85
If InStr(fCheminDmaths,"DmathsAddon.zip")>0 Then NomdelAddonEnPlace = "DmathsAddon.zip" Else NomdelAddonEnPlace = "DmathsAddon.oxt"
Shell(sCheminUnopkg &" remove --shared " & NomdelAddonEnPlace,0)
oDmProgInst.getControl("ProgressBar1").Value = 100
Wait 2000
Else
LeMessage = Trad(iLang,1) & " "
Msgbox(LeMessage,48,"Dmaths")
Goto Fin
Endif
oDmProgInst.Dispose()
Msgbox(LeMessage,48,"Dmaths")
Wait 2000
Fin:
End Sub
rem lance la procedure en mode multiutilisateurs
Sub NettoieLesComptes
Dim sPath, sRacine, sValue, sCheminDuCompte, sCheminUnopkg as String
If GetGuitype = 1 Then
sPath = GetRepertoirePath("home")
sRacine = GetRepertoire(sPath)
ElseIf IsMacOS Then
sRacine = "/Users"
Else
sRacine = "/home"
EndIf
rem determine les comptes et appelle la procedure de nettoyage de chacun
sValue = Dir$(sRacine+GetPathSeparator,16)
Do
If oDmProgInst.getControl("ProgressBar1").Value < 80 Then
oDmProgInst.getControl("ProgressBar1").Value = oDmProgInst.getControl("ProgressBar1").Value + 10
Endif
rem Print sValue
If sValue<>".." and Mid(sValue,1,1)<>"." Then
If (GetAttr(sRacine+GetPathSeparator+sValue) AND 16 > 0) Then
sCheminDuCompte = sRacine+GetPathSeparator+sValue
Call NettoieLeCompte(sCheminDuCompte)
EndIf
End If
sValue = Dir$
Loop Until sValue = ""
If (GetGuiType = 4 and not IsMacOS) Then
NettoieLeCompte("/root")
If oDmProgInst.getControl("ProgressBar1").Value < 80 Then
oDmProgInst.getControl("ProgressBar1").Value = oDmProgInst.getControl("ProgressBar1").Value + 10
Endif
Endif
End Sub
rem nettoie un compte
Sub NettoieLeCompte(sCheminLeDuCompte as String)
Dim sCheminUser, aFile, aNewFile, sLine as String ' contient le chemin de l'utilisateur en cours
rem Print sCheminLeDuCompte
sCheminUser = sCheminLeDuCompte + SuffixeDuCompte + GetPathSeparator
rem Print sCheminUser
rem Print sSuffixeDuCompte
rem Print sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmBackup.xba"
rem suppression des modules
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmBackup.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmBackup.xba"
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmOptions.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmOptions.xba"
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"Lang.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"Lang.xba"
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmOptionsTableau.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"DmOptionsTableau.xba"
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"Gdmath_Dyn.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"Gdmath_Dyn.xba"
If FileExists(sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"OOoTep_dyn.xba") Then Kill sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"OOoTep_dyn.xba"
rem suppression des références aux modules
aFile = sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"script.xlb"
rem Print aFile
If FileExists(aFile) Then
aFileNew = sCheminUser+"basic"+GetPathSeparator+"Standard"+GetPathSeparator+"script.new"
iNumberNew = Freefile
Open aFileNew For Output As iNumberNew
iNumber = Freefile
Open aFile For Input As iNumber
While not eof(iNumber)
Line Input #iNumber, sLine
rem Print sLine
If (InStr(sLine,"Gdmath_Dyn")+InStr(sLine,"OOoTep_dyn")+InStr(sLine,"Lang")+InStr(sLine,"DmOptions")+InStr(sLine,"DmBackup")+InStr(sLine,"DmOptionsTableau"))=0 then Print #iNumberNew, sLine
wend
Close #iNumber
Close #iNumberNew
kill (aFile)
Name aFileNew as aFile
End If
rem suppression des références aux autotextes et aux galeries
aFile = sCheminUser+"registry"+GetPathSeparator+"data"+GetPathSeparator+"org"+GetPathSeparator+"openoffice"+GetPathSeparator+"Office"+GetPathSeparator+"Common.xcu"
rem Print aFile
If FileExists(aFile) Then
aFileNew = Mid(aFile,1,(Len(aFile)-3)) & "new"
iNumberNew = Freefile
Open aFileNew For Output As iNumberNew
iNumber = Freefile
Open aFile For Input As iNumber
While not eof(iNumber)
Line Input #iNumber, sLine
rem Print sLine
If (InStr(sLine,"DmathsAddon.oxt/Fichiers/autotext")+InStr(sLine,"DmathsAddon.oxt/Fichiers/gallery"))=0 then Print #iNumberNew, sLine
wend
Close #iNumber
Close #iNumberNew
kill (aFile)
Name aFileNew as aFile
End If
rem suppression du repertoire dmaths
If FileExists(sCheminUser+"dmaths") Then RmDir sCheminUser+"dmaths"
rem suppression de l'autotexte
If FileExists(sCheminUser+"autotext"+GetPathSeparator+"dmaths.bau") Then Kill sCheminUser+"autotext"+GetPathSeparator+"dmaths.bau"
rem suppression des raccourcis claviers
If FileExists(sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"accelerator"+GetPathSeparator+"fr"+GetPathSeparator+"current.old") Then
If FileExists(sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"accelerator"+GetPathSeparator+"fr"+GetPathSeparator+"current.xml") Then
Kill sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"accelerator"+GetPathSeparator+"fr"+GetPathSeparator+"current.xml"
Endif
FileCopy sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"accelerator"+GetPathSeparator+"fr"+GetPathSeparator+"current.old",sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"accelerator"+GetPathSeparator+"fr"+GetPathSeparator+"current.xml"
Endif
rem suppression des custom_toolbar eventuelles
If FileExists(sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"images") Then RmDir sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"images"
If FileExists(sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"toolbar") Then RmDir sCheminUser+"config"+GetPathSeparator+"soffice.cfg"+GetPathSeparator+"modules"+GetPathSeparator+"swriter"+GetPathSeparator+"toolbar"
rem suppression des icones eventuelles
If FileExists(sCheminUser+"config"+GetPathSeparator+"icons") Then RmDir sCheminUser+"config"+GetPathSeparator+"icons"
rem suppression des galeries
For I = 1 To 7
If FileExists(sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".sdg") Then Kill sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".sdg"
If FileExists(sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".sdv") Then Kill sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".sdv"
If FileExists(sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".thm") Then Kill sCheminUser+"gallery"+GetPathSeparator+"sg100"+cStr(I)+".thm"
Next I
End Sub
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 Nettoyer
Dim oLibContainer as Object
Dim sLib as String
rem suppression de smodules
DeleteBasicModule("DmOptions","Standard")
DeleteBasicModule("DmBackup","Standard")
oDmProgInst.getControl("ProgressBar1").Value = 10
DeleteBasicModule("Lang","Standard")
DeleteBasicModule("DmOptionsTableau","Standard")
oDmProgInst.getControl("ProgressBar1").Value = 15
DeleteBasicModule("Gdmath_Dyn","Standard")
DeleteBasicModule("OOoTep_dyn","Standard")
oDmProgInst.getControl("ProgressBar1").Value = 20
rem suppression des autotextes
If FileExists(ConvertFromURL(GetRepertoirePath("user")+"/autotext/dmaths.bau")) Then Kill ConvertFromURL(GetRepertoirePath("user")+"/autotext/dmaths.bau")
SetGalleryAndAutotext("AutoText")
oDmProgInst.getControl("ProgressBar1").Value = 30
rem suppression des galeries
For I = 1 To 8
If FileExists(ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".sdg")) Then Kill ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".sdg")
If FileExists(ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".sdv")) Then Kill ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".sdv")
If FileExists(ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".thm")) Then Kill ConvertToURL(GetRepertoirePath("user")+"/gallery/sg100"+cStr(I)+".thm")
Next I
SetGalleryAndAutotext("Gallery")
oDmProgInst.getControl("ProgressBar1").Value = 40
rem des raccourcis claviers
sNomFichier=ConvertToURL(GetRepertoirePath("user")+"/config/soffice.cfg/modules/swriter/accelerator/"+GetRepertoirePath("vlang")+"/current.xml")
sNomFichierOld=ConvertToURL(GetRepertoirePath("user")+"/config/soffice.cfg/modules/swriter/accelerator/"+GetRepertoirePath("vlang")+"/current.old")
If FileExists(sNomFichierOld) Then
If FileExists(sNomFichier) Then Kill sNomFichier
FileCopy(sNomFichierOld,sNomFichier)
Kill sNomFichierOld
Endif
oDmProgInst.getControl("ProgressBar1").Value = 50
rem suppression du dossier icons
If FileExists(ConvertToURL(GetRepertoirePath("user")+"/config/icons")) Then RmDir ConvertToURL(GetRepertoirePath("user")+"/config/icons")
oDmProgInst.getControl("ProgressBar1").Value = 60
rem suppression de la custom_toolbar eventuelle
sNomFichier = ConvertToURL(GetRepertoirePath("user")+"/config/soffice.cfg/modules/swriter/")
If FileExists(sNomFichier + "images") Then RmDir sNomFichier + "images"
If FileExists(sNomFichier + "toolbar") Then RmDir sNomFichier + "toolbar"
oDmProgInst.getControl("ProgressBar1").Value = 65
rem suppression du process mise à jour automatique
oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Events/ApplicationEvents/Bindings", True )
If oConfigAccess.hasByName("OnStartApp") Then oConfigAccess.removeByName("OnStartApp")
oConfigAccess.CommitChanges
oDmProgInst.getControl("ProgressBar1").Value = 70
rem desaffiche la barre Dmaths
Dim sElementNames$()
oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Addons/AddonUI/OfficeToolBar", True )
If oConfigAccess.hasByName("org.openoffice.Office.addon.DMathsBarre") Then
oAddon = oConfigAccess.getByName("org.openoffice.Office.addon.DMathsBarre")
sElementNames = oAddon.getElementNames()
For I = LBound(sElementNames()) To UBound(sElementNames())
oAddon.getByname(sElementNames(I)).Context = " "
Next I
Endif
oConfigAccess.commitChanges()
oDmProgInst.getControl("ProgressBar1").Value = 75
oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Addons/AddonUI/OfficeToolBar", True )
If oConfigAccess.hasByName("org.openoffice.Office.addon.DMathsDisplayBarre") Then
oAddon = oConfigAccess.getByName("org.openoffice.Office.addon.DMathsDisplayBarre")
sElementNames = oAddon.getElementNames()
For I = LBound(sElementNames()) To UBound(sElementNames())
oAddon.getByname(sElementNames(I)).Context = " "
Next I
Endif
oConfigAccess.commitChanges()
oDmProgInst.getControl("ProgressBar1").Value = 80
oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Addons/AddonUI/OfficeMenuBar", True )
If oConfigAccess.hasByName("org.openoffice.Office.addon.aide") Then
oAddon = oConfigAccess.getByName("org.openoffice.Office.addon.aide")
oAddon.Context = " "
Endif
oConfigAccess.commitChanges()
oDmProgInst.getControl("ProgressBar1").Value = 85
End Sub
Sub DeleteBasicModule(srcname,libname) rem supprime le module srcname dans la biblio libname
Dim oGlobalLib, oLib as Object
oGlobalLib = GlobalScope.BasicLibraries
oLib = oGlobalLib.GetByName(libname)
If oLib.HasByName(srcname) Then oLib.RemoveByName(srcname)
End Sub
</script:module>
|