/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/ConiquesCode.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 | <?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="ConiquesCode" script:language="StarBasic">'OOoGdmath
'Copyright (C) 2005-2009 Gilles Daurat
'This program is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2
'of the License, or (at your option) any later version.
'This program 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 License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Option Explicit
Public oConiquesForm as object
Sub Main
AfficheConiquesForm(1)
End Sub
Function ChargeConiquesForm() as Object
oConiquesForm = LoadDialog("OOoGdmath","ConiquesForm")
ChangeTitreDialog(oConiquesForm)
End Function
Sub AfficheConiquesForm(page)
ChargeConiquesForm()
oConiquesForm.Model.Step=page
' RestaureForm(oConiquesForm)
oConiquesForm.Execute()
End Sub
Private Sub ConiquesForm_CommandButton1_Click()
oConiquesForm.Model.Label14.Label = "oui"
oConiquesForm.EndExecute()
sauveForm(oConiquesForm)
End Sub
Private Sub ConiquesForm_CommandButton2_Click()
oConiquesForm.Model.Label14.Label = "non"
oConiquesForm.EndExecute()
End Sub
Private Sub ConiquesForm_CommandButton3_Click()
oConiquesForm.Model.Step = 1
End Sub
Private Sub ConiquesForm_CommandButton4_Click()
oConiquesForm.Model.Step = 2
End Sub
Private Sub ConiquesForm_CommandButton5_Click()
oConiquesForm.Model.Step = 3
End Sub
Private Sub ConiquesForm_OptionButton1_Click()
oConiquesForm.Model.TextBox5.Enabled = True
oConiquesForm.Model.TextBox6.Enabled = False
End Sub
Private Sub ConiquesForm_OptionButton2_Click()
oConiquesForm.Model.TextBox5.Enabled = False
oConiquesForm.Model.TextBox6.Enabled = True
End Sub
Private Sub ConiquesForm_OptionButton4_Click()
oConiquesForm.Model.TextBox4.Enabled = True
oConiquesForm.Model.TextBox7.Enabled = True
oConiquesForm.Model.TextBox5.Enabled = False
oConiquesForm.Model.TextBox6.Enabled = False
End Sub
Private Sub ConiquesForm_OptionButton3_Click()
oConiquesForm.Model.TextBox4.Enabled = False
oConiquesForm.Model.TextBox7.Enabled = False
oConiquesForm.Model.TextBox5.Enabled = True
oConiquesForm.Model.TextBox6.Enabled = True
End Sub
Private Sub ConiquesForm_OptionButton5_Click()
oConiquesForm.Model.TextBox1.Enabled = False
oConiquesForm.Model.TextBox2.Enabled = True
oConiquesForm.Model.TextBox3.Enabled = True
End Sub
Private Sub ConiquesForm_OptionButton6_Click()
oConiquesForm.Model.TextBox1.Enabled = True
oConiquesForm.Model.TextBox2.Enabled = False
oConiquesForm.Model.TextBox3.Enabled = False
End Sub
Private Sub ConiquesForm_OptionButton7_Click()
oConiquesForm.Model.TextBox8.Enabled = False
oConiquesForm.Model.TextBox9.Enabled = False
oConiquesForm.Model.TextBox10.Enabled = True
oConiquesForm.Model.TextBox11.Enabled = True
oConiquesForm.Model.TextBox12.Enabled = True
End Sub
Private Sub ConiquesForm_OptionButton8_Click()
oConiquesForm.Model.TextBox8.Enabled = True
oConiquesForm.Model.TextBox9.Enabled = True
oConiquesForm.Model.TextBox10.Enabled = False
oConiquesForm.Model.TextBox11.Enabled = False
oConiquesForm.Model.TextBox12.Enabled = False
End Sub
Private Sub ConiquesForm_TextBox1_Change()
If oConiquesForm.Model.OptionButton6.State Then
oConiquesForm.Model.TextBox2.Text = Trim(Val(oConiquesForm.Model.TextBox1.Text) / 2)
oConiquesForm.Model.TextBox3.Text = oConiquesForm.Model.TextBox2.Text
End If
End Sub
Private Sub ConiquesForm_TextBox10_Change()
Dim c, a, b
On Error GoTo Fin
If oConiquesForm.Model.OptionButton7.State Then
c = Val(oConiquesForm.Model.TextBox11.Text)
a = Sqr(Val(oConiquesForm.Model.TextBox10.Text) * c)
b = Val(oConiquesForm.Model.TextBox12.Text) * a
oConiquesForm.Model.TextBox8.Text = Trim(a)
oConiquesForm.Model.TextBox9.Text = Trim(b)
oConiquesForm.Model.TextBox10.Text = Trim(a ^ 2 / c)
oConiquesForm.Model.TextBox12.Text = Trim(b / a)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox11_Change()
Dim c, a, b
On Error GoTo Fin
If oConiquesForm.Model.OptionButton7.State Then
c = Val(oConiquesForm.Model.TextBox11.Text)
a = Sqr(Val(oConiquesForm.Model.TextBox10.Text) * c)
b = Val(oConiquesForm.Model.TextBox12.Text) * a
oConiquesForm.Model.TextBox8.Text = Trim(a)
oConiquesForm.Model.TextBox9.Text = Trim(b)
oConiquesForm.Model.TextBox10.Text = Trim(a ^ 2 / c)
oConiquesForm.Model.TextBox12.Text = Trim(b / a)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox12_Change()
Dim c, a, b
On Error GoTo Fin
If oConiquesForm.Model.OptionButton7.State Then
c = Val(oConiquesForm.Model.TextBox11.Text)
a = Sqr(Val(oConiquesForm.Model.TextBox10.Text) * c)
b = Val(oConiquesForm.Model.TextBox12.Text) * a
oConiquesForm.Model.TextBox8.Text = Trim(a)
oConiquesForm.Model.TextBox9.Text = Trim(b)
oConiquesForm.Model.TextBox10.Text = Trim(a ^ 2 / c)
oConiquesForm.Model.TextBox12.Text = Trim(b / a)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox2_Change()
If oConiquesForm.Model.OptionButton5.State Then
oConiquesForm.Model.TextBox3.Text = oConiquesForm.Model.TextBox2.Text
oConiquesForm.Model.TextBox1.Text = Trim(Val(oConiquesForm.Model.TextBox2.Text) * 2)
End If
End Sub
Private Sub ConiquesForm_TextBox3_Change()
If oConiquesForm.Model.OptionButton5.State Then
oConiquesForm.Model.TextBox2.Text = oConiquesForm.Model.TextBox3.Text
oConiquesForm.Model.TextBox1.Text = Trim(Val(oConiquesForm.Model.TextBox2.Text) * 2)
End If
End Sub
Private Sub ConiquesForm_TextBox4_Change()
Dim a, b, c, e
On Error GoTo Fin
If oConiquesForm.Model.OptionButton4.State Then
a = Val(oConiquesForm.Model.TextBox4.Text)
b = Val(oConiquesForm.Model.TextBox7.Text)
c = Sqr(max(a, b) ^ 2 - Min(a, b) ^ 2)
e = c / a
oConiquesForm.Model.Label7.Label = Trim(e)
oConiquesForm.Model.TextBox5.Text = Trim(c)
oConiquesForm.Model.TextBox6.Text = Trim(a / e)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox5_Change()
Dim c, a, b, e
On Error GoTo Fin
If oConiquesForm.Model.OptionButton3.State Then
c = Val(oConiquesForm.Model.TextBox5.Text)
a = Sqr(Val(oConiquesForm.Model.TextBox6.Text) * c)
b = Sqr(max(a, c) ^ 2 - Min(c, a) ^ 2)
e = c / a
oConiquesForm.Model.TextBox4.Text = Trim(a)
oConiquesForm.Model.TextBox7.Text = Trim(b)
oConiquesForm.Model.TextBox6.Text = Trim(a / e)
oConiquesForm.Model.Label7.Label = Trim(e)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox6_Change()
Dim c, a, b, e
On Error GoTo Fin
If oConiquesForm.Model.OptionButton3.State Then
c = Val(oConiquesForm.Model.TextBox5.Text)
a = Sqr(Val(oConiquesForm.Model.TextBox6.Text) * c)
b = Sqr(max(a, c) ^ 2 - Min(c, a) ^ 2)
e = c / a
oConiquesForm.Model.TextBox4.Text = Trim(a)
oConiquesForm.Model.TextBox7.Text = Trim(b)
oConiquesForm.Model.TextBox6.Text = Trim(a / e)
oConiquesForm.Model.Label7.Label = Trim(e)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox7_Change()
Dim a, b, c, e
On Error GoTo Fin
If oConiquesForm.Model.OptionButton4.State Then
a = Val(oConiquesForm.Model.TextBox4.Text)
b = Val(oConiquesForm.Model.TextBox7.Text)
c = Sqr(max(a, b) ^ 2 - Min(b, a) ^ 2)
e = c / a
oConiquesForm.Model.Label7.Label = Trim(e)
oConiquesForm.Model.TextBox5.Text = Trim(c)
oConiquesForm.Model.TextBox6.Text = Trim(a / e)
End If
Fin:
End Sub
Private Sub ConiquesForm_TextBox8_Change()
Dim a, b, c, d, e, f
On Error GoTo Fin
If oConiquesForm.Model.OptionButton8.State Then
a = Val(oConiquesForm.Model.TextBox8.Text)
b = Val(oConiquesForm.Model.TextBox9.Text)
c = Sqr(a ^ 2 + b ^ 2)
d = a ^ 2 / c
e = c / a
f = b / a
oConiquesForm.Model.TextBox11.Text = Trim(c)
oConiquesForm.Model.TextBox10.Text = Trim(d)
oConiquesForm.Model.TextBox12.Text = Trim(f)
oConiquesForm.Model.Label8.Label = Trim(e)
End If
Fin:
End Sub
Private Sub ConiquesForm_Image1_Click()
ChangeCouleur oConiquesForm.Model.Image1
End Sub
Private Sub ConiquesForm_TextBox9_Change()
Dim a, b, c, d, e, f
If oConiquesForm.Model.OptionButton8.State Then
a = Val(oConiquesForm.Model.TextBox8.Text)
b = Val(oConiquesForm.Model.TextBox9.Text)
c = Sqr(a ^ 2 + b ^ 2)
d = a ^ 2 / c
e = c / a
f = b / a
oConiquesForm.Model.TextBox11.Text = Trim(c)
oConiquesForm.Model.TextBox10.Text = Trim(d)
oConiquesForm.Model.TextBox12.Text = Trim(f)
oConiquesForm.Model.Label8.Label = Trim(e)
End If
End Sub
Sub AjouteConique(Optional Modifie as Boolean)
Dim BFoyers, BDirectrices, BAsymptotes, texte$
if IsMissing(Modifie) then Modifie = False
Select Case oConiquesForm.Model.Step
Case 1
BFoyers = oConiquesForm.Model.CheckBox4.State
BDirectrices = oConiquesForm.Model.CheckBox5.State
BAsymptotes = 0
texte$ = "ELLIPSE(" + oConiquesForm.Model.TextBox4.Text + ";" + oConiquesForm.Model.TextBox7.Text + ")"
Case 2
BFoyers = oConiquesForm.Model.CheckBox6.State
BDirectrices = oConiquesForm.Model.CheckBox7.State
BAsymptotes = 0
texte$ = "PARABOLE(" + oConiquesForm.Model.TextBox1.Text + ")"
Case 3
BFoyers = oConiquesForm.Model.CheckBox8.State
BDirectrices = oConiquesForm.Model.CheckBox9.State
BAsymptotes = oConiquesForm.Model.CheckBox10.State
texte$ = "HYPERBOLE(" + oConiquesForm.Model.TextBox8.Text + ";" + oConiquesForm.Model.TextBox9.Text + ")"
End Select
If Modifie Then
Dim ListBox6 as Integer
ListBox6 = GetListIndex(oRepereForm, "ListBox6")
RemplaceItem oRepereForm, "ComboBox29", ListBox6, BFoyers
RemplaceItem oRepereForm, "ComboBox30", ListBox6, BDirectrices
RemplaceItem oRepereForm, "ComboBox31", ListBox6, BAsymptotes
RemplaceItem oRepereForm, "ComboBox22", ListBox6, oConiquesForm.Model.Image1.BackGroundColor
RemplaceItem oRepereForm, "ComboBox23", ListBox6, ExtraitEpaisseur(oConiquesForm.Model.Image1.HelpText)
RemplaceItem oRepereForm, "ComboBox24", ListBox6, ExtraitTypeTrait(oConiquesForm.Model.Image1.HelpText)
RemplaceItem oRepereForm, "ListBox6", ListBox6, texte$
Else
Add oRepereForm, "ComboBox29", BFoyers
Add oRepereForm, "ComboBox30", BDirectrices
Add oRepereForm, "ComboBox31", BAsymptotes
Add oRepereForm, "ComboBox22", oConiquesForm.Model.Image1.BackGroundColor
Add oRepereForm, "ComboBox23", ExtraitEpaisseur(oConiquesForm.Model.Image1.HelpText)
Add oRepereForm, "ComboBox24", ExtraitTypeTrait(oConiquesForm.Model.Image1.HelpText)
Add oRepereForm, "ListBox6", texte$
End If
If ListCount(oRepereForm, "ListBox6") > 0 Then
SetListIndex(oRepereForm, "ListBox6", ListCount(oRepereForm, "ListBox6") - 1)
End If
End Sub
Sub ExtraitConique(texte$, i, TypeConique, ca, cb)
Dim tc, a, b, c
a = InStr(i, texte$, "(")
If a = 0 Then
i = -1
Else
tc = Left$(texte$, a - 1)
Select Case UCase(tc)
case "ELLIPSE"
TypeConique = 0
case "PARABOLE"
TypeConique = 1
case "HYPERBOLE"
TypeConique = 2
End Select
If TypeConique <> -1 Then
b = InStr(a, texte$, ";")
If b = 0 And TypeConique <> 1 Then
i = -1
Else
If TypeConique = 1 Then b = a
c = InStr(b, texte$, ")")
If c = 0 Then
i = -1
Else
cb = Val(Mid$(texte$, b + 1, c - b - 1))
If b = a Then
ca = cb
Else
ca = Val(Mid$(texte$, a + 1, b - a - 1))
End If
i = c + 1
End If
End If
Else
i = -1
End If
End If
End Sub
</script:module>
|