This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/LosangeCode.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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<?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="LosangeCode" script:language="StarBasic">&apos;OOoGdmath
&apos;Copyright (C) 2005-2009  Gilles Daurat

&apos;This program is free software; you can redistribute it and/or
&apos;modify it under the terms of the GNU General Public License
&apos;as published by the Free Software Foundation; either version 2
&apos;of the License, or (at your option) any later version.

&apos;This program 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
&apos;GNU General Public License for more details.

&apos;You should have received a copy of the GNU General Public License
&apos;along with this program; if not, write to the Free Software
&apos;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Option Explicit

Global oMouseListener As Object

Global oLosangeForm as object
Sub Main
on error resume next
	oLosangeForm = LoadDialog(&quot;OOoGdmath&quot;,&quot;LosangeForm&quot;)
	ChangeTitreDialog(oLosangeForm)
&apos;	RestaureForm(oLosangeForm)
    oLosangeForm.Model.OptionButton1.ImageURL=fCheminImages &amp; &quot;los1.gif&quot;
    oLosangeForm.Model.OptionButton2.ImageURL=fCheminImages &amp; &quot;los2.gif&quot;
    oLosangeForm.Model.OptionButton3.ImageURL=fCheminImages &amp; &quot;los3.gif&quot;
    oLosangeForm.Model.OptionButton4.ImageURL=fCheminImages &amp; &quot;los4.gif&quot;
    oLosangeForm.Model.OptionButton5.ImageURL=fCheminImages &amp; &quot;los5.gif&quot;
    oLosangeForm.Model.ImageControl1.ImageURL=fCheminImages &amp; &quot;los6.gif&quot;
    MAJ_Label()
	oLosangeForm.Execute()
End Sub

Private Sub LosangeForm_AnnulerBouton_Click()
    oLosangeForm.EndExecute()
End Sub

Private Sub LosangeForm_ActiveLabel(et1, et2)
    If (et1) Then oLosangeForm.Model.Label4.Label = &quot;cm&quot; Else oLosangeForm.Model.Label4.Label = &quot;°&quot;
    If (et2) Then oLosangeForm.Model.Label5.Label = &quot;cm&quot; Else oLosangeForm.Model.Label5.Label = &quot;°&quot;
	LosangeForm_CheckBox1_Click
End Sub

Private Sub LosangeForm_CheckBox1_Click()
    oLosangeForm.Model.CheckBox4.Enabled = ((oLosangeForm.Model.CheckBox1.State = 1) And (oLosangeForm.Model.CheckBox2.State = 1))
    oLosangeForm.Model.CheckBox5.Enabled = ((oLosangeForm.Model.CheckBox1.State = 1) Or (oLosangeForm.Model.CheckBox2.State = 1))
End Sub

Private Sub LosangeForm_CheckBox10_Click()
    oLosangeForm.Model.TextBox7.Enabled = oLosangeForm.Model.CheckBox10.State
End Sub

Private Sub LosangeForm_CheckBox2_Click()
	LosangeForm_CheckBox1_Click
End Sub

Private Sub LosangeForm_CheckBox3_Click()
    oLosangeForm.Model.CheckBox40.Enabled = oLosangeForm.Model.CheckBox3.State
End Sub

Private Sub LosangeForm_Image11_Click()
    ChangeCouleur oLosangeForm.Model.Image11
End Sub

Private Sub LosangeForm_Image7_Click()
    ChangeCouleur oLosangeForm.Model.Image7
End Sub

Private Sub LosangeForm_Image8_Click()
    ChangeCouleur oLosangeForm.Model.Image8
End Sub

Private Sub LosangeForm_OkBouton_Click()
Dim UneLigne As Object
Dim afmesure, t1, t2, a, b, posx, posy, x0, y0, x1, y1, x2, y2, x3, y3, UnLosange
Dim mm1, mm2, ga, gb, xm, ym, xn, yn
Dim rayon
&apos;On Error GoTo erreur
&apos; Dessiner un losange
    oLosangeForm.EndExecute()
	SauveForm(oLosangeForm)
	InitialiseDessin(False)
    Shapes = InitialiseGroupe
    afmesure = (oLosangeForm.Model.CheckBox3.State = 1)
    t1 = oLosangeForm.Model.TextBox1.Text
    t2 = oLosangeForm.Model.TextBox2.Text
    RemplaceVirgulePoint t1
    RemplaceVirgulePoint t2
    a = Val(t1)
    b = Val(t2)
    PointInsertion posx, posy
    t1 = oLosangeForm.Model.TextBox1.Text
    t2 = oLosangeForm.Model.TextBox2.Text
    InitialiseGroupe
    If (oLosangeForm.Model.OptionButton1.State) Then
        a = a * 1000
        b = b * Pi / 180
        If CestUneFigureGeometrique Then
            posx = (xmin + xmax) / 2 - a * Cos(b / 2)
            posy = (ymin + ymax) / 2 - a * Sin(b / 2)
        End If
        x0 = posx
        y0 = posy + a * Sin(b / 2)
        x1 = x0 + a * Cos(b / 2)
        y1 = posy
        x2 = x0 + 2 * a * Cos(b / 2)
        y2 = y0
        x3 = x1
        y3 = posy + 2 * a * Sin(b / 2)
        UnLosange=InsereQuadrilatere(x0, y0, x1, y1, x2, y2, x3, y3, Shapes,oLosangeForm.Model.Image8)
        MarqueAngle x1, y1, x0, y0, x3, y3, (Val(t2) &gt; 180), 1, 0, Shapes
        If afmesure Then
            InsereTexte t1 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), (x0 + x1) / 2, (y0 + y1) / 2, Shapes, 0
            InsereTexte t2 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot;°&quot;, &quot;&quot;), (6 * x0 + x2) / 7, (6 * y0 + y2) / 7, Shapes, 0
        End If
    End If
    If (oLosangeForm.Model.OptionButton2.State) Then
        a = a * 1000
        b = b * 1000
        If CestUneFigureGeometrique Then
            posx = (xmin + xmax) / 2 - Sqr(a * a - b * b / 4)
            posy = (ymin + ymax) / 2 - b / 2
        End If
        x0 = posx
        y0 = posy + Sqr(a * a - b * b / 4)
        x1 = posx + b / 2
        y1 = posy
        x2 = posx + b
        y2 = y0
        x3 = x1
        y3 = posy + 2 * Sqr(a * a - b * b / 4)
        UnLosange = InsereQuadrilatere(x0, y0, x1, y1, x2, y2, x3, y3, Shapes,oLosangeForm.Model.Image8)
        If afmesure Then
            InsereTexte t1 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), (x0 + x1) / 2, (y0 + y1) / 2, Shapes,0
            InsereTexte t2 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), (x0 + x2) / 2, (y0 + y2) / 2, Shapes,0
        End If
    End If
    If (oLosangeForm.Model.OptionButton3.State) Then
        b = b * 1000
        a = a * 1000
        If CestUneFigureGeometrique Then
            posx = (xmin + xmax) / 2 - a / 2
            posy = (ymin + ymax) / 2 - b / 2
        End If
        x0 = posx
        y0 = posy + b / 2
        x1 = posx + a / 2
        y1 = posy
        x2 = x0 + a
        y2 = y0
        x3 = x1
        y3 = y1 + b
        UnLosange = InsereQuadrilatere(x0, y0, x1, y1, x2, y2, x3, y3, Shapes, oLosangeForm.Model.Image8)
        If afmesure Then
            InsereTexte t1 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), ((x0 + x2) / 2 + x0) / 2, ((y0 + y2) / 2 + y0) / 2, Shapes, 0
            InsereTexte t2 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), ((x0 + x2) / 2 + x1) / 2, ((y0 + y2) / 2 + y1) / 2, Shapes, 0
        End If
    End If
    If (oLosangeForm.Model.OptionButton4.State) Then
        a = a * 1000
        b = b * Pi / 180
        If CestUneFigureGeometrique Then
            posx = (xmin + xmax) / 2 - Sqr(a * a - b * b / 4)
            posy = (ymin + ymax) / 2 - a / (2 * Tan(b / 2))
        End If
        x0 = posx
        y0 = posy + a / 2
        x1 = x0 + a / (2 * Tan(b / 2))
        y1 = posy
        x2 = x0 + a / Tan(b / 2)
        y2 = y0
        x3 = x1
        y3 = y1 + a
        UnLosange = InsereQuadrilatere(x0, y0, x1, y1, x2, y2, x3, y3, Shapes, oLosangeForm.Model.Image8)
        If afmesure Then
            InsereTexte t1 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), (x1 + x3) / 2, (y1 + y3) / 2, Shapes, 0
            InsereTexte t2 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot;°&quot;, &quot;&quot;), (6 * x0 + x2) / 7, (6 * y0 + y2) / 7, Shapes, 0
        End If
        MarqueAngle x1, y1, x0, y0, x3, y3, (Val(t2) &gt; 180), 1, 0, Shapes
    End If
    If (oLosangeForm.Model.OptionButton5.State) Then
        a = a * 1000
        b = b * Pi / 180
        If CestUneFigureGeometrique Then
            posx = (xmin + xmax) / 2 - a / 2
            posy = (ymin + ymax) / 2 - a * Tan(b / 2) / 2
        End If
        x0 = posx
        y0 = posy + a * Tan(b / 2) / 2
        x1 = x0 + a / 2
        y1 = posy
        x2 = x0 + a
        y2 = y0
        x3 = x1
        y3 = y1 + a * Tan(b / 2)
        UnLosange=InsereQuadrilatere(x0, y0, x1, y1, x2, y2, x3, y3, Shapes,oLosangeForm.Model.Image8)
        If afmesure Then
            InsereTexte t1 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot; cm&quot;, &quot;&quot;), (x0 + x2) / 2, (y0 + y2) / 2, Shapes, 0
            InsereTexte t2 &amp; MIif(oLosangeForm.Model.CheckBox40.State = 0, &quot;°&quot;, &quot;&quot;), (6 * x0 + x2) / 7, (6 * y0 + y2) / 7, Shapes, 0
        End If
        MarqueAngle x1, y1, x0, y0, x3, y3, (Val(t2) &gt; 180), 1, 0, Shapes
    End If
    mm1 = False
    mm2 = False
    Dim iCode as Integer
    iCode = 1
    If oLosangeForm.Model.CheckBox6.State = 1 Then
        CodeLongueur x0, y0, x1, y1, iCode, Shapes, oLosangeForm.Model.Image8
        CodeLongueur x1, y1, x2, y2, iCode, Shapes, oLosangeForm.Model.Image8
        CodeLongueur x2, y2, x3, y3, iCode, Shapes, oLosangeForm.Model.Image8
        CodeLongueur x3, y3, x0, y0, iCode, Shapes, oLosangeForm.Model.Image8
        iCode = iCode + 1
    End If
    If oLosangeForm.Model.CheckBox1.State = 1 Then
        uneLigne=InsereLigne(x1, y1, x3, y3, Shapes, oLosangeForm.Model.Image7)
        If oLosangeForm.Model.CheckBox5.Enabled And oLosangeForm.Model.CheckBox5.State = 1 Then
            CodeLongueur x1, y1, (x1 + x3) / 2, (y1 + y3) / 2, iCode, Shapes, oLosangeForm.Model.Image7
            CodeLongueur x3, y3, (x1 + x3) / 2, (y1 + y3) / 2, iCode, Shapes, oLosangeForm.Model.Image7
            iCode = iCode + 1
            If oLosangeForm.Model.CheckBox2.State = 0 Then
                MarqueMilieu x1, y1, x3, y3, Shapes, oLosangeForm.Model.Image7
                mm1 = True
            End If
        End If
    End If
    If oLosangeForm.Model.CheckBox2.State = 1 Then
        uneLigne=InsereLigne(x0, y0, x2, y2, Shapes, oLosangeForm.Model.Image7)
        If oLosangeForm.Model.CheckBox5.Enabled And oLosangeForm.Model.CheckBox5.State = 1 Then
            CodeLongueur x0, y0, (x0 + x2) / 2, (y0 + y2) / 2, iCode, Shapes, oLosangeForm.Model.Image7
            CodeLongueur x2, y2, (x0 + x2) / 2, (y0 + y2) / 2, iCode, Shapes, oLosangeForm.Model.Image7
            iCode = iCode + 1
            If oLosangeForm.Model.CheckBox1.State = 0 Then
                MarqueMilieu x0, y0, x2, y2, Shapes, oLosangeForm.Model.Image7
                mm2 = True
            End If
        End If
    End If
    If oLosangeForm.Model.CheckBox4.Enabled And oLosangeForm.Model.CheckBox4.State = 1 Then
        MarqueAngleDroit((x0 + x2) / 2, (y0 + y2) / 2, x0, y0, Shapes, oLosangeForm.Model.Image8
    End If
    ga = 20
    gb = ga - 2
    If oLosangeForm.Model.CheckBox7.State = 1 Then
    	NormaliseCoordonnees xn, yn, x1, y1, x0, y0, x3, y3
        InsereTexte(oLosangeForm.Model.TextBox3.Text, xn, yn, Shapes, 0, 0, 0)
    	NormaliseCoordonnees xn, yn, x0, y0, x1, y1, x2, y2
        InsereTexte(oLosangeForm.Model.TextBox4.Text, xn, yn, Shapes, 0, 0, 0)
    	NormaliseCoordonnees xn, yn, x3, y3, x2, y2, x1, y1
        InsereTexte(oLosangeForm.Model.TextBox5.Text, xn, yn, Shapes, 0, 0, 0)
    	NormaliseCoordonnees xn, yn, x2, y2, x3, y3, x0, y0
        InsereTexte(oLosangeForm.Model.TextBox6.Text, xn, yn, Shapes, 0, 0, 0)
    End If
    If oLosangeForm.Model.CheckBox10.State = 1 Then
        xm = (x0 + x2) / 2
        ym = (y0 + y2) / 2
        
        If oLosangeForm.Model.CheckBox1.State = 1 and Not mm1 Then 
        	MarqueMilieu x0, y0, x2, y2, Shapes, oLosangeForm.Model.Image7
        	mm1=True
        end if
        If oLosangeForm.Model.CheckBox2.State = 1 and  Not mm2 Then 
        	MarqueMilieu x1, y1, x3, y3, Shapes, oLosangeForm.Model.Image7
        	mm2=True
        End if
        AjoutePoint xm, ym, oLosangeForm.Model.TextBox7.Text, InsereTexte(oLosangeForm.Model.TextBox7.Text, xm-200, ym-200, Shapes), not (mm1 or mm2), 0, Shapes
    End If
    If oLosangeForm.Model.CheckBox18.State = 1 Then
        xm = (x0 + x2) / 2
        ym = (y0 + y2) / 2
        rayon = Sqr((x0 - x2) ^ 2 + (y0 - y2) ^ 2) * Sqr((x1 - x3) ^ 2 + (y1 - y3) ^ 2) / (4 * Sqr((x0 - x1) ^ 2 + (y1 - y0) ^ 2))
        InsereCercle xm, ym, rayon, Shapes, oLosangeForm.Model.Image11
    End If
	Dim aPoint As New com.sun.star.awt.Point
    Dim TheSize as new com.sun.star.awt.Size
    Dim Group as Object
    Dim Coeff
    
	aPoint.x = 3000
	aPoint.y = 3000
	Group = GroupeObjet(Shapes)
	Group.Position = aPoint
	TheSize = Group.Size
	coeff = oLosangeForm.Model.Echelle.Text
	RemplaceVirgulePoint(coeff)
	TheSize.width = TheSize.Width*val(coeff)/100
	TheSize.height = TheSize.Height*val(coeff)/100
	Group.Size = TheSize
	TermineDessin()
Exit Sub
erreur:
    MsgBoxP &quot;message6&quot;
End Sub

Private Sub LosangeForm_OptionButton1_Click()
    oLosangeForm.Model.CheckBox1.State = 0
    oLosangeForm.Model.CheckBox2.State = 0
    LosangeForm_ActiveLabel 1, 0
End Sub

Private Sub LosangeForm_OptionButton2_Click()
    oLosangeForm.Model.CheckBox1.State = 0
    oLosangeForm.Model.CheckBox2.State = 1
    LosangeForm_ActiveLabel 1, 1
End Sub

Private Sub LosangeForm_OptionButton3_Click()
    oLosangeForm.Model.CheckBox1.State = 1
    oLosangeForm.Model.CheckBox2.State = 1
    LosangeForm_ActiveLabel 1, 1
End Sub

Private Sub LosangeForm_OptionButton4_Click()
    oLosangeForm.Model.CheckBox1.State = 1
    oLosangeForm.Model.CheckBox2.State = 0
    LosangeForm_ActiveLabel 1, 0
End Sub

Private Sub LosangeForm_OptionButton5_Click()
    oLosangeForm.Model.CheckBox1.State = 0
    oLosangeForm.Model.CheckBox2.State = 1
    LosangeForm_ActiveLabel 1, 0
End Sub

Private Sub MAJ_Label()
	LosangeForm_TextBox3_Change()
	LosangeForm_TextBox4_Change()
	LosangeForm_TextBox5_Change()
	LosangeForm_TextBox6_Change()
	LosangeForm_TextBox7_Change()
	LosangeForm_TextBox8_Change()
End Sub

Private Sub LosangeForm_TextBox4_Change()
    oLosangeForm.Model.CheckBox1.Label = &quot;[&quot; &amp; oLosangeForm.Model.TextBox4.Text &amp; oLosangeForm.Model.TextBox6.Text &amp; &quot;]&quot;
End Sub

Private Sub LosangeForm_TextBox5_Change()
    oLosangeForm.Model.CheckBox2.Label = &quot;[&quot; &amp; oLosangeForm.Model.TextBox5.Text &amp; oLosangeForm.Model.TextBox3.Text &amp; &quot;]&quot;
End Sub

Private Sub LosangeForm_TextBox6_Change()
    oLosangeForm.Model.CheckBox1.Label = &quot;[&quot; &amp; oLosangeForm.Model.TextBox4.Text &amp; oLosangeForm.Model.TextBox6.Text &amp; &quot;]&quot;
End Sub

Private Sub LosangeForm_TextBox3_Change()
    oLosangeForm.Model.CheckBox2.Label = &quot;[&quot; &amp; oLosangeForm.Model.TextBox5.Text &amp; oLosangeForm.Model.TextBox3.Text &amp; &quot;]&quot;
End Sub

Private Sub LosangeForm_TextBox7_Change()
    If oLosangeForm.Model.TextBox7.Text &lt;&gt; oLosangeForm.Model.TextBox8.Text Then oLosangeForm.Model.TextBox8.Text = oLosangeForm.Model.TextBox7.Text
End Sub

Private Sub LosangeForm_TextBox8_Change()
    If oLosangeForm.Model.TextBox7.Text &lt;&gt; oLosangeForm.Model.TextBox8.Text Then oLosangeForm.Model.TextBox7.Text = oLosangeForm.Model.TextBox8.Text
End Sub

Private Sub LosangeForm_Label1_Click(unDialogue,unObjet,x,y)
Dim unIndice

	if y &lt; 21 then
		unIndice = 5
		if x &lt; 210 then unIndice = 4
		if x &lt; 160 then unIndice = 3
		if x &lt; 110 then unIndice = 2
		if x &lt; 61 then unIndice = 1
		unDialogue.Step = unIndice
	    unObjet.ImageURL = fCheminImages() &amp; &quot;multipage5-&quot; &amp; trim(str(unIndice)) &amp; &quot;.gif&quot;
   	end if
End Sub

Sub RegisterMouseListener(unObjet as Object)
  oMouseListener = createUnoListener(&quot;MyApp_&quot;, &quot;com.sun.star.awt.XMouseListener&quot;)
  unObjet.addMouseListener(oMouseListener)
End Sub

Sub UnregisterMouseListener(unObjet as Object)
  on error resume next
  unObjet.removeMouseListener(oMouseListener)
  on error goto 0
End Sub

Sub MyApp_disposing(oEvt)
End Sub

Function MyApp_mouseEntered(oEvt) As Boolean
  MyApp_mouseEntered = False
End Function

Function MyApp_mouseExited(oEvt) As Boolean
  MyApp_mouseExited = False
End Function

Function MyApp_mousePressed(oEvt) As Boolean
  MyApp_mousePressed = False
End Function

Function MyApp_mouseReleased(oEvt) As Boolean
Dim unObjet
Dim uneDialogue

	unObjet=oEvt.Source.Model
	
	uneDialogue=oEvt.Source.View.GetContext().Model
	With oEvt
		LosangeForm_Label1_Click(uneDialogue,unObjet,.X,.Y)
	End With
	MyApp_mouseReleased = False
End Function

Private Sub Renomme(evt as Object)
	GRenomme evt, oLosangeForm, Array(&quot;TextBox4&quot;, &quot;TextBox5&quot;, &quot;TextBox6&quot;, &quot;TextBox7&quot;)
End Sub

</script:module>