/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/RepFractionForm.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 | <?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="RepFractionForm" 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 facteur(1 To 2)
Dim LesNombresPremiers
Dim oRepFractionForm as Object
Dim num, den, nn, profae
dim Shapes as Object
Sub Main
oRepFractionForm=LoadDialog("OOoGdmath", "RepFractionForm")
ChangeTitreDialog(oRepFractionForm)
oRepFractionForm.Model.Step=1
oRepFractionForm.Model.OptionButton1.State=True
oRepFractionForm.Model.OptionButton4.State=True
' RestaureForm(oRepFractionForm)
oRepFractionForm.Execute()
End Sub
Sub RempliDecomposition(nombre)
Dim i
For i = 1 To 2
facteur(i) = 1
Next i
LesNombresPremiers = Array(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 39, 41, 43, 47, 51, 53, 57, 59, 61, 67, 71, 73, 79, 83)
Decompose nombre
End Sub
Sub Decompose(nombre)
Dim i, a
For i = 0 To 25
If Int(nombre / LesNombresPremiers(i)) * LesNombresPremiers(i) = nombre And Int(facteur(1) / LesNombresPremiers(i)) * LesNombresPremiers(i) <> facteur(1) And Int(facteur(2) / LesNombresPremiers(i)) * LesNombresPremiers(i) <> facteur(2) Then
a = LesNombresPremiers(i)
Decompose nombre / a
If facteur(1) > facteur(2) Then
facteur(2) = facteur(2) * a
Else
facteur(1) = facteur(1) * a
End If
End If
Next i
End Sub
Private Sub RepFractionForm_CommandButton1()
Dim i, j, k, lh, lv, x0, y0, x1, y1, x2, y2, x3, y3, rayon, unepart
dim delta, angled, anglea
dim num as string
dim den as string
dim vnum as single
dim vden as single
If InStr(1, oRepFractionForm.Model.TextField1.Text, "/") = 0 Then
MsgBoxP ("message9")
rem MsgBox "Il faut taper une fraction pour pouvoir la représenter !"
Exit Sub
End If
AACExtraitNDF oRepFractionForm.Model.TextField1.Text, num, den
vnum = Val(num)
vden = Val(den)
If oRepFractionForm.Model.OptionButton7.State And (oRepFractionForm.Model.OptionButton2.State Or oRepFractionForm.Model.OptionButton1.State) Then
profae = Int(Log(vden) / Log(2))
If 2 ^ profae <> vden Then
MsgBoxP ("message10")
rem MsgBox "Il faut que le dénominateur soit une puissance de 2" & Chr(13) & "pour pouvoir tracer des diagonales..."
Exit Sub
End If
End if
oRepFractionForm.EndExecute()
sauveForm(oRepFractionForm)
RempliDecomposition vden
InitialiseDessin(true)
Shapes=InitialiseGroupe()
nn = 0
If oRepFractionForm.Model.OptionButton5.State Then
facteur(1) = vden
facteur(2) = 1
ElseIf oRepFractionForm.Model.OptionButton6.State Then
facteur(1) = 1
facteur(2) = vden
End If
lh=oRepFractionForm.Model.TextField2.Text
RemplaceVirgulePoint(lh)
lh=val(lh)
lv=oRepFractionForm.Model.TextField3.Text
RemplaceVirgulePoint(lv)
lv=val(lv)
lh = lh * 1000
lv = lv * 1000
If oRepFractionForm.Model.OptionButton1.State Then lv = lh
rayon = oRepFractionForm.Model.TextField2.Text
RemplaceVirgulePoint rayon
rayon=val(rayon) * 1000
If oRepFractionForm.Model.OptionButton7.State And (oRepFractionForm.Model.OptionButton2.State Or oRepFractionForm.Model.OptionButton1.State) Then
For i = 0 To Int(vnum / vden)
x0 = 3000 + i * (lh + 1000)
y0 = 3000
x1 = x0 + lh
y1 = y0
x2 = x0 + lh
y2 = y0 + lv
x3 = x0
y3 = y0 + lv
RepFractionForm_Triangle x0, y0, x1, y1, x3, y3, 1, vnum
RepFractionForm_Triangle x2, y2, x1, y1, x3, y3, 1, vnum
Next i
Else
If oRepFractionForm.Model.OptionButton3.State Then
nn=0
delta=int(36000/vden)
For k = 0 To Int(vnum / vden)
For i = 0 To val(den)-1
angled=i*delta
anglea=(i+1)*delta
unePart = InserePart(3000 + k * (2 * rayon + 1000), 3000, angled, anglea,rayon, Shapes,oRepFractionForm.Model.ImageControl9 )
If nn < vnum Then
unePart.FillColor =oRepFractionForm.Model.ImageControl10.BackGroundColor
nn = nn + 1
else
unePart.FillColor =rgb(255,255,255)
End If
Next i
Next k
Else
lh = lh / facteur(1)
lv = lv / facteur(2)
For k = 0 To Int(vnum / vden)
For i = 1 To facteur(1)
For j = 1 To facteur(2)
x0 = 3000 + (i - 1) * lh + k * (lh * facteur(1) + 1000)
y0 = 3000 + (j - 1) * lv
x1 = x0 + lh
y1 = y0
x2 = x0 + lh
y2 = y0 + lv
x3 = x0
y3 = y0 + lv
unePart=InsereQuadrilatereB(x0, y0, x2, y2, Shapes, oRepFractionForm.Model.ImageControl9
If nn < num Then
unePart.FillColor = oRepFractionForm.Model.ImageControl10.BackgroundColor
nn = nn + 1
else
unePart.FillColor = RGB(255,255,255)
End If
Next j
Next i
Next k
End If
End If
GroupeObjet(Shapes)
TermineDessin()
End Sub
Sub RepFractionForm_Triangle(x0, y0, x1, y1, x2, y2, prof, num)
Dim xm, ym
dim unTriangle as Object
If prof = profae Then
unTriangle = InsereTriangleB(x0, y0, x1, y1, x2, y2, Shapes, oRepFractionForm.Model.ImageControl9)
If nn < num Then
unTriangle.FillColor = oRepFractionForm.Model.ImageControl10.BackgroundColor
nn = nn + 1
else
unTriangle.FillColor = RGB(255,255,255)
End If
Else
xm = (x1 + x2) / 2
ym = (y1 + y2) / 2
RepFractionForm_Triangle(xm, ym, x0, y0, x1, y1, prof + 1, num)
RepFractionForm_Triangle(xm, ym, x0, y0, x2, y2, prof + 1, num)
End If
End Sub
Private Sub RepFractionForm_CommandButton2()
oRepFractionForm.EndExecute()
End Sub
Private Sub RepFractionForm_Image10()
ChangeCouleur oRepFractionForm.Model.ImageControl10
End Sub
Private Sub RepFractionForm_Image9()
ChangeCouleur oRepFractionForm.Model.ImageControl9
End Sub
Private Sub RepFractionForm_OptionButton1()
oRepFractionForm.Model.OptionButton5.Enabled = True
oRepFractionForm.Model.OptionButton6.Enabled = True
oRepFractionForm.Model.OptionButton7.Enabled = True
oRepFractionForm.Model.Label2.Label = Chaine("cote") & " :"
oRepFractionForm.Model.Step=1
End Sub
Private Sub RepFractionForm_OptionButton2()
oRepFractionForm.Model.OptionButton5.Enabled = True
oRepFractionForm.Model.OptionButton6.Enabled = True
oRepFractionForm.Model.OptionButton7.Enabled = True
oRepFractionForm.Model.Label2.Label = Chaine("longueur") & " :"
oRepFractionForm.Model.Label5.Label = Chaine("largeur") & " :"
oRepFractionForm.Model.Step=0
End Sub
Private Sub RepFractionForm_OptionButton3()
oRepFractionForm.Model.OptionButton4.State = True
oRepFractionForm.Model.OptionButton5.Enabled = False
oRepFractionForm.Model.OptionButton6.Enabled = False
oRepFractionForm.Model.OptionButton7.Enabled = False
oRepFractionForm.Model.Label2.Label = Chaine("rayon") & " :"
oRepFractionForm.Model.Step=1
End Sub
</script:module>
|