This file is indexed.

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

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

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

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(&quot;com.sun.star.ui.dialogs.FilePicker&quot;) 
	With FP
	  .DisplayDirectory = ConvertToURL(GetRepertoirePath(&quot;home&quot;))
	  .appendFilter(&quot;Images&quot;, &quot;*.bmp;*.png;*.jpg&quot;)
	  .CurrentFilter = &quot;Images&quot;

	  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(&quot;user&quot;)+GetPathSeparator+&quot;config&quot;+GetPathSeparator+&quot;icons&quot;
		sRepertoireDmathsIcons = ConvertToURL(sRepertoireDmathsIcons)
		If Not FileExists(sRepertoireDmathsIcons) Then Mkdir sRepertoireDmathsIcons
	   ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+&quot;/launchsoftware&quot;&amp;Cint(iNumero)&amp;&quot;_16.bmp&quot;,16)
	   ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+&quot;/launchsoftware&quot;&amp;Cint(iNumero)&amp;&quot;_16h.bmp&quot;,16) 
	   ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+&quot;/launchsoftware&quot;&amp;Cint(iNumero)&amp;&quot;_26.bmp&quot;,26)
	   ResizeExternalImageByWidth(sSource,sRepertoireDmathsIcons+&quot;/launchsoftware&quot;&amp;Cint(iNumero)&amp;&quot;_26h.bmp&quot;,26)
	   oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Model.ImageURL = &quot;&quot;
	   oBoiteApps.GetControl(&quot;SoftButton&quot;+Cint(iNumero)).Model.ImageURL = sRepertoireDmathsIcons+&quot;/launchsoftware&quot;&amp;Cint(iNumero)&amp;&quot;_16.bmp&quot;
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

&apos; renvoie le répertoire contenant le fichier
Function getDirectory(URLPath As String) As String
Dim x1 As Integer
Dim resu As String
Const separ1 = &quot;/&quot;
resu = &quot;&quot;
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




&apos; renvoie le répertoire père de thisDir
Function getParentDir(thisDir As String) As String
Dim x1 As Integer
Const separ1 = &quot;/&quot;

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 = &quot;&quot; &apos; chemin incorrect
End Function



&apos; renvoie le nom complet d&apos;un fichier : Nom.Ext
Function getFullFileName(URLPath As String) As String
Dim x1 As Integer
Const separ1 = &quot;/&quot;

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



&apos; renvoie le nom du fichier, sans son extension
Function getFileNameOnly(URLPath As String) As String
If getFileExt(URLPath) = &quot;&quot; Then URLPath = URLPath + &quot;.bmp&quot; 
Dim x1 As Integer, x2 As Integer
Dim resu As String
Const separ1 = &quot;.&quot;
Const separ2 = &quot;/&quot;
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 = &quot;&quot;
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


&apos; renvoie l&apos;extension du fichier, avec le point
Function getFileExt(URLPath As String) As String
Dim x1 As Integer
Dim resu As String
Const separ1 = &quot;.&quot;

resu = &quot;&quot;
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=&quot;Hidden&quot;
	mFileProperties(0).Value=True
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	monDocument = oDesktop.LoadComponentFromURL(&quot;private:factory/sdraw&quot;,&quot;_blank&quot;,0,mFileProperties())
	maPage = monDocument.DrawPages(0)
	rem on insère dans la page l&apos;image à redimmensionner et on fixe sa largeur à 1000
	ImageL = monDocument.createInstance(&quot;com.sun.star.drawing.GraphicObjectShape&quot;)
	ImageL.GraphicURL = ConvertToURL(sURLImage)
	maPage.add(ImageL) 
	resizeImageByWidth(ImageL,1000) 
	rem on redimensionne la page du doc draw au format de l&apos;image
	Proportion = ImageL.Size.Height/ImageL.Size.Width
	maPage.Width = 1000
	maPage.Height = ArrondiEntier(1000*Proportion)
	rem on fixe les donnees du filtre d&apos;export
	Dim aFilterData (1) as new com.sun.star.beans.PropertyValue
   	aFilterData(0).Name  = &quot;PixelWidth&quot;        &apos;
  	aFilterData(0).Value = iWidth
   	aFilterData(1).Name  = &quot;PixelHeight&quot;
   	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) &lt; 0.5 Then
ArrondiEntier = Int(Nombre)
Else
ArrondiEntier = Int(Nombre)+1
Endif
End Function



Sub Export( xObject, sFileUrl As String, aFilterData )
   xExporter = createUnoService( &quot;com.sun.star.drawing.GraphicExportFilter&quot; )
   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  = &quot;FilterName&quot;
   aArgs(0).Value = &quot;bmp&quot;
   aArgs(1).Name  = &quot;URL&quot;
   aArgs(1).Value = sFileUrl
   aArgs(2).Name  = &quot;FilterData&quot;
   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 &apos; taille en pixels !
	Proportion = Taille1.Height / Taille1.Width
	Taille1.Width = largeur &apos; 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 &apos; obtenir un numéro de fichier ouvert
	Open GetRepertoirePath(&quot;user&quot;)&amp;&quot;/config/javasettings_Linux_x86.xml&quot; For Input As #f1
	Do While not Eof(f1)
	 	Line Input #f1, uneLigne
	 	If InStr(uneLigne,&quot;&lt;location&gt;&quot;) Then
	 		sLenFile = Len(uneLigne)  		
	 		sCheminJava = Mid(uneLigne,11,sLenFile-21)
	 	Endif
	Loop	
	Close #f1
	sCheminJava = sCheminJava &amp; &quot;/bin/java&quot;
End Function





</script:module>