/usr/lib/libreoffice/share/extensions/DmathsAddon/DmInstall/ToolsImages.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 | <?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="ToolsImages" 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 CreeIconesSoft1
CreeIcones(oChoixrepinstallation,1)
End Sub
Sub CreeIconesSoft2
CreeIcones(oChoixrepinstallation,2)
End Sub
Sub CreeIconesSoft3
CreeIcones(oChoixrepinstallation,3)
End Sub
Sub CreeIcones(oBoiteApps as Object, iNumero as Integer)
Dim FP As Object, lesFichiers() As String
FP = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
With FP
.DisplayDirectory = ConvertToURL(GetRepertoirePath("home"))
.appendFilter("Images", "*.bmp;*.png;*.jpg")
.CurrentFilter = "Images"
if .Execute = com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
lesFichiers() = .Files
FabriqueImages(oBoiteApps,lesFichiers(0),iNumero)
end if
.dispose
End With
End Sub
Sub FabriqueImages(oBoiteApps as Object,sSource,iNumero as Integer)
Dim sRepertoireDmathsIcons as String
sRepertoireDmathsIcons = GetRepertoirePath("user")+GetPathSeparator+"config"+GetPathSeparator+"icons"
sRepertoireDmathsIcons = ConvertToURL(sRepertoireDmathsIcons)
If Not FileExists(sRepertoireDmathsIcons) Then Mkdir sRepertoireDmathsIcons
ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+"/launchsoftware"&Cint(iNumero)&"_16.bmp",16)
ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+"/launchsoftware"&Cint(iNumero)&"_16h.bmp",16)
ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+"/launchsoftware"&Cint(iNumero)&"_26.bmp",26)
ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+"/launchsoftware"&Cint(iNumero)&"_26h.bmp",26)
oBoiteApps.GetControl("SoftButton"+Cint(iNumero)).Model.ImageURL = ""
oBoiteApps.GetControl("SoftButton"+Cint(iNumero)).Model.ImageURL = sRepertoireDmathsIcons+"/launchsoftware"&Cint(iNumero)&"_16.bmp"
End Sub
Sub Cancel_Click
oChoixImage.EndExecute()
End Sub
Function getFilePath(URLPath As String) As String
getFilePath = Mid(URLPath,1,Len(URLPath)-4)
End Function
' renvoie le répertoire contenant le fichier
Function getDirectory(URLPath As String) As String
Dim x1 As Integer
Dim resu As String
Const separ1 = "/"
resu = ""
for x1 = Len(URLPath) to 1 step -1
if Mid(URLPath, x1, 1) = separ1 then
resu = Left(URLPath, x1)
exit for
end if
next
getDirectory = resu
End Function
' renvoie le répertoire père de thisDir
Function getParentDir(thisDir As String) As String
Dim x1 As Integer
Const separ1 = "/"
for x1 = Len(thisDir) -1 to 1 step -1
if Mid(thisDir, x1, 1) = separ1 then
getParentDir = Left(thisDir, x1)
exit function
end if
next
getParentDir = "" ' chemin incorrect
End Function
' renvoie le nom complet d'un fichier : Nom.Ext
Function getFullFileName(URLPath As String) As String
Dim x1 As Integer
Const separ1 = "/"
for x1 = Len(URLPath) to 1 step -1
if Mid(URLPath, x1, 1) = separ1 then
getFullFileName = Mid(URLPath, x1 +1)
exit function
end if
next
End Function
' renvoie le nom du fichier, sans son extension
Function getFileNameOnly(URLPath As String) As String
If getFileExt(URLPath) = "" Then URLPath = URLPath + ".bmp"
Dim x1 As Integer, x2 As Integer
Dim resu As String
Const separ1 = "."
Const separ2 = "/"
x2 = 0
for x1 = Len(URLPath) to 1 step -1
if Mid(URLPath, x1, 1) = separ1 then
x2 = x1 -1
exit for
end if
next
resu = ""
for x1 = x2 to 1 step -1
if Mid(URLPath, x1, 1) = separ2 then
resu = Mid(URLPath, x1 +1, x2 - x1)
exit for
end if
next
getFileNameOnly = resu
End Function
' renvoie l'extension du fichier, avec le point
Function getFileExt(URLPath As String) As String
Dim x1 As Integer
Dim resu As String
Const separ1 = "."
resu = ""
for x1 = Len(URLPath) to 1 step -1
if Mid(URLPath, x1, 1) = separ1 then
resu = Mid(URLPath, x1)
exit for
end if
next
getFileExt = resu
End Function
Sub ResizeExternalImageByWidth(sURLImage,sURLImageResized as String, iWidth as Integer)
rem on ouvre un document sdraw invisible
Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
Dim Proportion as Single
mFileProperties(0).Name="Hidden"
mFileProperties(0).Value=True
oDesktop=createUnoService("com.sun.star.frame.Desktop")
monDocument = oDesktop.LoadComponentFromURL("private:factory/sdraw","_blank",0,mFileProperties())
maPage = monDocument.DrawPages(0)
rem on insère dans la page l'image à redimmensionner et on fixe sa largeur à 1000
ImageL = monDocument.createInstance("com.sun.star.drawing.GraphicObjectShape")
ImageL.GraphicURL = ConvertToURL(sURLImage)
maPage.add(ImageL)
resizeImageByWidth(ImageL,1000)
rem on redimensionne la page du doc draw au format de l'image
Proportion = ImageL.Size.Height/ImageL.Size.Width
maPage.Width = 1000
maPage.Height = ArrondiEntier(1000*Proportion)
rem on fixe les donnees du filtre d'export
Dim aFilterData (1) as new com.sun.star.beans.PropertyValue
aFilterData(0).Name = "PixelWidth" '
aFilterData(0).Value = iWidth
aFilterData(1).Name = "PixelHeight"
aFilterData(1).Value = ArrondiEntier(iWidth*Proportion)
rem on exporte la page de dessin au format bmp
Export( maPage,sURLImageResized , aFilterData() )
On error resume Next
monDocument.Close(True)
On error goto 0
End Sub
Function ArrondiEntier(Nombre as Single) as Integer
If Nombre-Int(Nombre) < 0.5 Then
ArrondiEntier = Int(Nombre)
Else
ArrondiEntier = Int(Nombre)+1
Endif
End Function
Sub Export( xObject, sFileUrl As String, aFilterData )
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
xExporter.SetSourceDocument( xObject )
Dim aArgs (2) as new com.sun.star.beans.PropertyValue
Dim aURL as new com.sun.star.util.URL
sFileUrl = ConvertToURL(sFileUrl)
aArgs(0).Name = "FilterName"
aArgs(0).Value = "bmp"
aArgs(1).Name = "URL"
aArgs(1).Value = sFileUrl
aArgs(2).Name = "FilterData"
aArgs(2).Value = aFilterData
xExporter.filter( aArgs() )
End Sub
Sub resizeImageByWidth(uneImage As Object, largeur As Long)
Dim leBitMap As Object, Proportion As Double
Dim Taille1 As New com.sun.star.awt.Size
LeBitmap = uneImage.GraphicObjectFillBitmap
Taille1 = LeBitMap.Size ' taille en pixels !
Proportion = Taille1.Height / Taille1.Width
Taille1.Width = largeur ' largeur en 1/100 de mm
Taille1.Height = Taille1.Width * Proportion
uneImage.Size = Taille1
End Sub
Function sCheminJava as String
Dim f1, sLenFile As Integer
Dim uneLigne As String
f1 = FreeFile ' obtenir un numéro de fichier ouvert
Open GetRepertoirePath("user")&"/config/javasettings_Linux_x86.xml" For Input As #f1
Do While not Eof(f1)
Line Input #f1, uneLigne
If InStr(uneLigne,"<location>") Then
sLenFile = Len(uneLigne)
sCheminJava = Mid(uneLigne,11,sLenFile-21)
Endif
Loop
Close #f1
sCheminJava = sCheminJava & "/bin/java"
End Function
</script:module>
|