This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/SauveFormCode.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
<?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="SauveFormCode" 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

Sub Main
Dim a, ok as Boolean
	EcritFonction(&quot;sqr(x)&quot;)
	a = Gdmath_Fonction.Fonction(1, ok)
	a = Gdmath_Fonction.Fonction(2, ok)
End Sub

Sub InitialiseForm(uneDialogue as Object)
Dim aTexte() as String
Dim unObjet as Object
Dim i
Dim unTexte as String

	aTexte = uneDialogue.Model.getElementNames()	
	for i=lbound(aTexte()) to ubound(aTexte())
		unObjet = uneDialogue.GetControl(aTexte(i))
		If instr(1, aTexte(i), &quot;Image&quot;) Then
			If left(unObjet.Model.HelpText,1)=&quot;&amp;&quot; Then
				unTexte = Ressource(unObjet.Model, rHelpText)
				unObjet.Model.HelpText = unTexte
			End if
		End If
		If instr(1, aTexte(i), &quot;Text&quot;) or instr(1, aTexte(i), &quot;Echelle&quot;) or instr(1, aTexte(i), &quot;val&quot;) or instr(1, aTexte(i), &quot;Sommet&quot;) Then
			If left(unObjet.Model.Text,1)=&quot;&amp;&quot; Then
				unTexte = Ressource(unObjet.Model, rText)
				unObjet.Model.Text = unTexte
			End if
		End If
		If instr(1, aTexte(i), &quot;Label&quot;) Then
			If left(unObjet.Model.Label,1)=&quot;&amp;&quot; Then
				unTexte = Ressource(unObjet.Model, rLabel)
				unObjet.Model.Label = unTexte
			End if
		End If
	next i
End Sub

Sub SauveForm(uneDialogue as Object)
	if uneDialogue.GetControl(&quot;sauve&quot;).Model.State then
		RemplaceConstante uneDialogue.Model.Name &amp; &quot;_Sauve&quot;, GetTexteForm(uneDialogue)
	else
		RemplaceConstante uneDialogue.Model.Name &amp; &quot;_Sauve&quot;, &quot;&quot;
	end if
End Sub

Sub RestaureForm(uneDialogue as Object)
Dim uneListe as String
on error resume next

	uneListe = &quot;&quot;
	Select case uneDialogue.Model.Name
	case &quot;AdditionForm&quot;
		uneListe = AdditionForm_Sauve
	case &quot;AngleDDForm&quot;
		uneListe = AngleDDForm_Sauve
	case &quot;ArcDCForm&quot;
		uneListe = ArcDCForm_Sauve
	case &quot;CammForm&quot;
		uneListe = CammForm_Sauve
	case &quot;CarreForm&quot;
		uneListe = CarreForm_Sauve
	case &quot;CercleForm&quot;
		uneListe = CercleForm_Sauve
	case &quot;ConiquesForm&quot;
		uneListe = ConiquesForm_Sauve
	case &quot;DebugForm&quot;
		uneListe = DebugForm_Sauve
	case &quot;DivisionForm&quot;
		uneListe = DivisionForm_Sauve
	case &quot;DroiteGForm&quot;
		uneListe = DroiteGForm_Sauve
	case &quot;LosangeForm&quot;
		uneListe = LosangeForm_Sauve
	case &quot;MultiForm&quot;
		uneListe = MultiForm_Sauve
	case &quot;ParalleloForm&quot;
		uneListe = ParalleloForm_Sauve
	case &quot;QuadrillageForm&quot;
		uneListe = QuadrillageForm_Sauve
	case &quot;RapporteurForm&quot;
		uneListe = RapporteurForm_Sauve
	case &quot;RectangleForm&quot;
		uneListe = RectangleForm_Sauve
	case &quot;RepereForm&quot;
		uneListe = RepereForm_Sauve
	case &quot;RepFractionForm&quot;
		uneListe = RepFractionForm_Sauve
	case &quot;ReseauForm&quot;
		uneListe = ReseauForm_Sauve
	case &quot;TriangleForm&quot;
		uneListe = TriangleForm_Sauve
	case &quot;PolygoneRegulierForm&quot;
		uneListe = PolygoneRegulierForm_Sauve
	case &quot;TrapezeForm&quot;
		uneListe = TrapezeForm_Sauve
	End Select
	if uneListe&lt;&gt;&quot;&quot; then
		SetTexteForm uneDialogue, uneListe
	End if
End Sub

Function Ressource(unObjet as Object, typeRessource) as String
Dim unTexte
Dim tObjet

	tObjet = unObjet
	Select case typeRessource
	case rText 
		unTexte = tObjet.Text
	case rLabel
		unTexte = tObjet.Label
	case rHelpText
		unTexte = tObjet.HelpText
	case rTitle
		unTexte = tObjet.Title
		tObjet = tObjet.Model
	End Select
	if left(unTexte,1)=&quot;&amp;&quot; then
		Ressource = tObjet.ResourceResolver.resolveString(mid(unTexte,2))
	else
		Ressource = unTexte
	end if
End Function

Function GetTexteForm(uneDialogueForm  as Object) as String
Dim i,j
Dim unNom as String
Dim unParam as String
Dim param as String
Dim unObjet as Object
Dim tObjet() as String

	tObjet = uneDialogueForm.Model.getElementNames()
	for i=lbound(tObjet()) to ubound(tObjet())
		unObjet = uneDialogueForm.GetControl(tObjet(i)).Model
		unParam = &quot;&quot;
		Select Case left(unObjet.Name, 3)
		case &quot;Ima&quot;
			if (unObjet.HelpText &lt;&gt; &quot;&quot;) Then unParam = unObjet.HelpText &amp; &quot;¤&quot; &amp; unObjet.BackgroundColor
		case &quot;Che&quot;, &quot;sau&quot;
			unParam = unObjet.State
		case &quot;Tex&quot;, &quot;val&quot;, &quot;Som&quot;, &quot;Ech&quot;
			unParam = unObjet.Text
		case &quot;Lab&quot;
			unParam = unObjet.Label
		case &quot;Opt&quot;
			unParam = unObjet.State
		case &quot;Lis&quot;, &quot;Com&quot;
			if left(unObjet.Name, 4)&lt;&gt;&quot;Comm&quot; and left(unObjet.Name, 6)&lt;&gt;&quot;ListeO&quot; Then
				for j = 0 to ListCount(uneDialogueForm, tObjet(i))-1
					unParam = unParam &amp; &quot;¤&quot; &amp; GetList(uneDialogueForm, tObjet(i), j)
				next j
				unParam = mid(unParam, 2)
			End if
		End Select
		if unParam &lt;&gt; &quot;&quot; then 
			RemplaceTexte unParam, chr(10), &quot;\n&quot;
			RemplaceTexte unParam, chr(34), &quot;\*&quot;
			RemplaceTexte unParam, &quot;:&quot;, &quot;\$&quot;
			RemplaceTexte unParam, &quot;;&quot;, &quot;&quot;
			If Not unObjet.Enabled then unParam = unParam &amp;  &quot;#&quot;
			unNom = unNom &amp; &quot;;&quot; &amp; tObjet(i) &amp; &quot;:&quot; &amp; unParam
		End if
	next i
	GetTexteForm() = mid(unNom,2)
End Function

Sub SetTexteForm(uneDialogueForm  as Object, uneListe as String)
Dim i,j
Dim param() as String
Dim param1() as String
Dim param2() as String

	ChargeParametre uneListe, param(), &quot;;&quot;
	
	For i=lbound(param()) to ubound(param())
		ChargeParametre param(i), param1(), &quot;:&quot;
		if ubound(param1())=1 then
			RemplaceTexte param1(1), &quot;\$&quot;, &quot;:&quot;
			RemplaceTexte param1(1), &quot;&quot;, &quot;;&quot;
			RemplaceTexte param1(1), &quot;\n&quot;, chr(10)
			RemplaceTexte param1(1), &quot;\*&quot;, chr(34)
			If right(param1(1), 1)=&quot;#&quot; Then 
				uneDialogueForm.GetControl(param1(0)).Model.Enabled = False
				param1(1) = left(param1(1), len(param1(1)) - 1
			Else
				uneDialogueForm.GetControl(param1(0)).Model.Enabled = True
			End if
			Select Case left(param1(0), 3)
			case &quot;Che&quot;
				uneDialogueForm.GetControl(param1(0)).Model.State = param1(1)
			case &quot;Tex&quot;, &quot;val&quot;, &quot;Som&quot;
				uneDialogueForm.GetControl(param1(0)).Model.Text = param1(1)
			case &quot;Lab&quot;
				uneDialogueForm.GetControl(param1(0)).Model.Label = param1(1)
			case &quot;Opt&quot;
				uneDialogueForm.GetControl(param1(0)).Model.State = param1(1)
			case &quot;Ima&quot;
				ChargeParametre param1(1), param2(), &quot;¤&quot;
				uneDialogueForm.GetControl(param1(0)).Model.HelpText = param2(0)
				uneDialogueForm.GetControl(param1(0)).Model.BackgroundColor = val(param2(1))
			case &quot;Lis&quot;, &quot;Com&quot;
				ChargeParametre param1(1), param2(), &quot;¤&quot;
				for j = lbound(param2()) to ubound(param2())
					Add uneDialogueForm, param1(0), param2(j)
				next j
			End Select
		End if
	next i
End Sub

Sub RemplaceConstante(nomConstante, valeur)
Dim unTexte
Dim a,b,c
Dim num as Boolean

	unTexte = getModuleText(&quot;Standard&quot;, &quot;Gdmath_Dyn&quot;)
	num = False
	if left(nomConstante,2)=&quot;n_&quot; then
		nomConstante = mid(nomConstante, 3)
		num = True
	End if
	a = instr(1, unTexte, nomConstante)
	if a = 0 then
		if num Then
			unTexte = &quot;Public Const &quot; &amp; nomConstante &amp; &quot; = &quot; &amp; valeur &amp; chr(10) &amp; unTexte
		Else
			unTexte = &quot;Public Const &quot; &amp; nomConstante &amp; &quot; = &quot; &amp; chr(34) &amp; valeur &amp; chr(34) &amp; chr(10) &amp; unTexte
		End if
	Else
		if num then
			b = instr(a, unTexte, &quot;=&quot;) + 1
			c = instr(b + 1, unTexte, chr(10))
		else
			b = instr(a, unTexte, chr(34))
			c = instr(b+1, unTexte, chr(34))
		end if
		unTexte = left(unTexte, b) &amp; valeur &amp; mid(unTexte, c)
	End if
	saveModuleText(&quot;Standard&quot;, &quot;Gdmath_Dyn&quot;, unTexte)
End Sub

Sub EcritFonction(unTexte as String)
Dim unModule as String

	unModule = &quot;Function Fonction(x as double, ok as Boolean) as double&quot; &amp; chr(10) &amp; &quot;   on error goto fin&quot; &amp; chr(10) &amp; &quot;   ok = False&quot; &amp; chr(10) &amp; &quot;   Fonction() =&quot; &amp; unTexte &amp; chr(10) &amp; &quot;ok = True&quot; &amp; chr(10) &amp; &quot;fin:&quot; &amp; chr(10) &amp; &quot;End Function&quot; &amp; chr(10)
	saveModuleText(&quot;Standard&quot;, &quot;Gdmath_Fonction&quot;, unModule)
End Sub

Sub InitialiseGdmath()
Dim a
	a = getModuleText(&quot;Standard&quot;, &quot;Gdmath_Dyn&quot;)
End Sub


</script:module>