/usr/lib/libreoffice/share/extensions/DmathsAddon/DmInstall/CloseAndLaunchOOo.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 | <?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="CloseAndLaunchOOo" 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
'************************************************
'Declare Function GetActiveWindow Lib "user32" () As Long
'Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Private sNomFichierBatch as String
'Private HandleWin as Long
Private sURLFichierEnregistre as String
Private sEmplacementLocalAddon as String
Sub ReLanceOOo(Optional bInstMAJ as boolean,Optional bInstRezo as boolean)
If isMissing(bInstMAJ) Then bInstMAJ = False
If isMissing(bInstRezo) Then bInstRezo = False
Call FermeToutesLesFenetres
Call FabriqueBatch(bInstMAJ, bInstRezo)
rem modification du 28 octobre 2007
LanceShell(sNomFichierBatch, true)
If GetguiType = 1 Then
StarDesktop.SuspendQuickstartVeto = True
StarDesktop.Terminate
End if
End Sub
Sub ReLanceOOoMac
rem creation de moduleoptions.txt
EcritFichierDmOptionsTXT( sSource )
FermeToutesLesFenetres
rem definit le chemin du fichier applescript
sNomFichierBatch = GetRepertoirePath("user")&"/config/relanceOOo.scpt"
' Print sNomFichierBatch
rem definit le chemin de l'application OOo/Neo
sCheminOffice = GetRepertoirePathprog & "soffice"
' Print FileExists (sCheminOffice)
iNumber = Freefile
Open sNomFichierBatch For Output As iNumber
rem ferme OOo/Neo
sLine = "do shell script ""killall soffice"""
Print #iNumber, sLine
rem lance à nouveau OOo/Neo
If OOoName() = "NeoOffice" Then
sLine = "tell application ""NeoOffice"" to launch"
Elseif OOoName() = "LibreOffice" Then
sLine = "tell application ""LibreOffice"" to launch"
Else
sLine = "tell application ""OpenOffice.org"" to launch"
EndIf
Print #iNumber, sLine
rem lance la macro qui installe les options.
sLine = "do shell script (quoted form of (""" & sCheminOffice & """) & "" -norestore macro:///DmInstall.CloseAndLaunchOOo.InstallDmOptions"")"
Print #iNumber, sLine
Close #iNumber
Dim sys As Object
sys = CreateUnoService("com.sun.star.system.SystemShellExecute")
sys.execute("osascript",sNomFichierBatch,0)
End Sub
Sub FermeToutesLesFenetres
rem ferme toutes les fenetres
Dim myEnum,oDoc as Object
On error resume Next
myEnum = StarDesktop.Components.CreateEnumeration
Do while myEnum.HasmoreElements
oDoc = myEnum.NextElement
If HasUnoInterfaces(oDoc, "com.sun.star.util.XCloseable") Then
If oDoc.IsModified() Then
If oDoc.haslocation() Then
oDoc.Store()
Else
EnregistrerLeFichier(oDoc)
Endif
Endif
If getguitype = 1 Then sURLFichierEnregistre = " " & """" & ConvertFromURL(oDoc.URL) & """" Else sURLFichierEnregistre = " " & ConvertFromURL(oDoc.URL)
oDoc.Close(true)
Else
oDoc.dispose()
End If
Loop
On error goto 0
End Sub
Sub EnregistrerLeFichier(monDocument as Object)
Dim FP As Object, lesFichiers() As String
Dim FPtype(0) As Integer
FP = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
FPtype(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION
With FP
.initialize(FPtype())
.DisplayDirectory = GetRepertoirePath("home")
.appendFilter("Textes", "*.txt")
.appendFilter("Docs OpenOffice", "*.odt;*.ott")
.appendFilter("Docs MS-Office", "*.doc")
.CurrentFilter = "Docs OpenOffice"
if .Execute = com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
lesFichiers() = .Files ' tableau de 1 élément String
Dim propFich2(0) As New com.sun.star.beans.PropertyValue
monDocument.storeAsURL(lesFichiers(0), propFich2())
end if
.dispose
End With
End Sub
Sub FabriqueBatch(bInstMAJ, bInstRezo as boolean)
sCheminUnopkg = GetRepertoirePathprog & "unopkg"
sCheminWriter = GetRepertoirePathprog & "swriter"
sCheminOffice = GetRepertoirePathprog & "soffice"
If Getguitype = 1 Then
sCheminWriter = sCheminWriter +".exe"
sCheminOffice = sCheminOffice +".exe"
sCheminUnopkg = sCheminUnopkg +".exe"
Endif
sCheminWriter = ConvertFromURL(sCheminWriter)
sCheminOffice = ConvertFromURL(sCheminOffice)
sCheminUnopkg = ConvertFromURL(sCheminUnopkg)
If GetguiType = 1 Then
sCheminWriter = """"+sCheminWriter+""""
sCheminOffice = """"+sCheminOffice+""""
sCheminUnopkg = """"+sCheminUnopkg+""""
EndIf
rem ------------------------------------------------------------------------------------------------------------------------
rem creation de relanceooo
If Getguitype = 1 Then sNomFichierBatch = GetRepertoirePath("user")&"\config\relanceooo.bat" Else sNomFichierBatch = GetRepertoirePath("user")&"/config/relanceooo.sh"
If Fileexists(sNomFichierBatch) Then Kill sNomFichierBatch
iNumber = Freefile
Open sNomFichierBatch For Output As iNumber
rem lance un message patientez dans la console DOS sous windows
If GetguiType = 1 Then
sLine = "echo PATIENTEZ JUSQU'AU LANCEMENT COMPLET DE OOo !!!"
Print #iNumber, sLine
sLine = "echo CELA PEUT PRENDRE PLUSIEURS MINUTES."
Print #iNumber, sLine
Endif
rem ligne fermant le quickstarter ou ligne fermant soffice sous linux
If GetguiType = 1 Then
' If MSWin98 = False Then
' sLine = sCheminOffice & fInvisible & " ""macro:///Standard.DmCloseQuick.CloseQuick(" & Cstr( HandleWin ) &")"""
' Else
' sLine = """" & GetRepertoirePath("prog")&"\quickstart.exe" & """" & " -killtray"
' Endif
Else
sLine = "killall soffice"
'sLine = "killall soffice.bin"
Print #iNumber, sLine
End if
If bInstMAJ Then
Dim NomdelAddonEnPlace as String rem contient le nom de l'addon installé
If InStr(fCheminDmaths,"DmathsAddon.zip")>0 Then NomdelAddonEnPlace = "DmathsAddon.zip" Else NomdelAddonEnPlace = "DmathsAddon.oxt"
If bInstRezo Then sShare = " --shared" Else sShare = ""
sLine = sCheminUnopkg & " remove" & sShare & " " & NomdelAddonEnPlace
Print #iNumber, sLine
sLine = sCheminUnopkg & " add" & sShare & " """+ ConvertFromURL(sEmplacementLocalAddon)+""""
Print #iNumber, sLine
sLine = sCheminOffice + fInvisible +"""macro:///DmInstall.Install_Addon.MiseAJour"""
Print #iNumber, sLine
Else
Dim Parametre$
Parametre = IIf(OOoNumVersion >= 330,"norestore","headless")
sLine = sCheminOffice & " -" & Parametre & " ""macro:///DmInstall.CloseAndLaunchOOo.InstallDmOptions"""
Print #iNumber, sLine
Endif
If OOoNumVersion < 330 or (getGuiType = 1 and OOoName() = "OpenOffice.org") Then
sLine = sCheminWriter & sURLFichierEnregistre rem reouvre le dernier fichier ferme
Print #iNumber, sLine
Endif
If getguitype = 1 Then rem ferme la fenetre Dos sous windows
sLine = "exit"
Print #iNumber, sLine
Endif
Close #iNumber
If Getguitype = 4 Then Shell("chmod 777 "+ConvertFromURL(sNomFichierBatch))
rem ------------------------------------------------------------------------------------------------------------------------
rem creation de moduleoptions.txt
EcritFichierDmOptionsTXT( sSource )
End Sub
Sub EcritFichierDmOptionsTXT( sSource as String) rem cette macro écrit le fichier dmoptions.txt dans le dossier user/config
If Getguitype = 1 Then sFichierModule = GetRepertoirePath("user")&"\config\dmoptions.txt" Else sFichierModule = GetRepertoirePath("user")&"/config/dmoptions.txt"
If Fileexists(sFichierModule) Then Kill sFichierModule
iNumber = Freefile
Open sFichierModule For Output As iNumber
Print #iNumber, sSource
Close #iNumber
End Sub
Sub InstallDmOptions
Dim sSourceDmOptions, sFichierModule, sLigne as String
If Getguitype = 1 Then sFichierModule = GetRepertoirePath("user")&"\config\dmoptions.txt" Else sFichierModule = GetRepertoirePath("user")&"/config/dmoptions.txt"
iNumber = Freefile
Open sFichierModule For Input As iNumber
Line Input #iNumber, sSourceDmOptions
While Not Eof(iNumber)
Line Input #iNumber, sLigne
sSourceDmOptions = sSourceDmOptions + Chr(13) + sLigne
WEnd
Close #iNumber
InsertModuleDmOptions(sSourceDmOptions)
rem Kill sFichierModule
End Sub
Function LanceShell(sChemin as String,bMode as Boolean)
Dim sys As Object
Dim iFlags As Integer
sys = CreateUnoService("com.sun.star.system.SystemShellExecute")
iFlags = com.sun.star.system.SystemShellExecuteFlags.NO_SYSTEM_ERROR_MESSAGE ' = 0
sys.execute(sChemin," ", iFlags)
End Function
Function MSWin98 as boolean rem determine si OS = Win98
MSWin98 = false
If GetguiType = 1 Then
const HKEY_LOCAL_MACHINE = &H80000002
Dim sVersion as String
Globalscope.BasicLibraries.loadLibrary("ImportWizard")
OpenRegKey(HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows\CurrentVersion\")
sVersion = QueryValue(HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows\CurrentVersion\","ProductName")
If sVersion = "Microsoft Windows 98" Then MSWin98 = True
Endif
End function
Function fInvisible as String
fInvisible = " -invisible "
If MSWin98 = true Then fInvisible = " "
End Function
Function GetRepertoirePathprog as String rem fournit le chemin du repertoire program
If OOoNumVersion >= 300 Then
GetRepertoirePathprog = Mid(GetRepertoirePath("brandbaseurl"),1,Len(GetRepertoirePath("brandbaseurl"))-3) & GetPathSeparator
Else
GetRepertoirePathprog = GetRepertoirePath("prog") & GetPathSeparator
Endif
End Function
</script:module>
|