/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/CercleForm.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 | <?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="CercleForm" 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 oCercleForm as object
Sub Main
AfficheCercleForm
End Sub
Sub AfficheCercleForm()
oCercleForm = LoadDialog("OOoGdmath","CercleForm")
ChangeTitreDialog(oCercleForm)
oCercleForm.Model.Image1.ImageURL=fCheminImages & "cercle1.gif"
oCercleForm.Model.Image2.ImageURL=fCheminImages & "cercle2.gif"
' RestaureForm(oCercleForm)
oCercleForm.Execute()
End Sub
Private Sub CercleForm_AnnulerBouton_Click()
oCercleForm.EndExecute()
End Sub
Private Sub CercleForm_CheckBox1_Click()
oCercleForm.Model.CheckBox10.Enabled = oCercleForm.Model.CheckBox1.State
End Sub
Private Sub CercleForm_CheckBox2_Click()
oCercleForm.Model.TextBox8.Enabled = oCercleForm.Model.CheckBox2.State
End Sub
Private Sub CercleForm_CheckBox3_Click()
oCercleForm.Model.TextBox9.Enabled = oCercleForm.Model.CheckBox3.State
End Sub
Private Sub CercleForm_CheckBox4_Click()
oCercleForm.Model.TextBox10.Enabled = oCercleForm.Model.CheckBox4.State
End Sub
Private Sub CercleForm_CheckBox5_Click()
oCercleForm.Model.TextBox11.Enabled = oCercleForm.Model.CheckBox5.State
End Sub
Private Sub CercleForm_CheckBox6_Click()
oCercleForm.Model.TextBox3.Enabled = oCercleForm.Model.CheckBox6.State
End Sub
Private Sub CercleForm_CheckBox7_Click()
oCercleForm.Model.TextBox2.Enabled = oCercleForm.Model.CheckBox7.State
End Sub
Private Sub CercleForm_CheckBox9_Click()
oCercleForm.Model.CheckBox7.Enabled = oCercleForm.Model.CheckBox9.State
oCercleForm.Model.TextBox2.Enabled = (oCercleForm.Model.CheckBox9.State And oCercleForm.Model.CheckBox7.State)
End Sub
Private Sub CercleForm_Image1_Click()
oCercleForm.Model.OptionButton1.State = True
End Sub
Private Sub CercleForm_Image2_Click()
oCercleForm.Model.OptionButton2.State = True
End Sub
Private Sub CercleForm_Image3_Click()
ChangeCouleur Image3
End Sub
Private Sub CercleForm_Image4_Click()
ChangeCouleur Image4
End Sub
Private Sub CercleForm_Image5_Click()
ChangeCouleur Image5
End Sub
Private Sub CercleForm_Image6_Click()
ChangeCouleur Image6
End Sub
Private Sub CercleForm_Image7_Click()
ChangeCouleur Image7
End Sub
Private Sub CercleForm_OkBouton_Click()
Dim UneLigne As object
Dim UnCercle As object
Dim afmesure, t1 as string, a as single, posx, posy, i, aa, xx as single, yy as single, ang, xx1 as Single, yy1 as Single
Dim dx as Single, dy as Single, dx1 as Single, dy1 as Single, unangle as Double
' dessiner un cercle
afmesure = oCercleForm.Model.CheckBox1.State
oCercleForm.EndExecute()
sauveForm(oCercleForm)
' on groupe les ojets dessinés
Shapes = InitialiseGroupe()
InitialiseDessin(False)
t1 = oCercleForm.Model.TextBox1.Text
RemplaceVirgulePoint t1
a = Val(t1) * 1000
t1 = oCercleForm.Model.TextBox1.Text
If (oCercleForm.Model.OptionButton1.State) Then a = a * 2
posx=3000
posy=3000
If CestUneFigureGeometrique Then
posx = (xmin + xmax) / 2 - a / 2
posy = (ymin + ymax) / 2 - a / 2
Else
If oCercleForm.Model.Label7.Label <> "" Then
If Not oCercleForm.Model.OptionButton1.State Then
posx = (Val(oCercleForm.Model.Label7.Label) + Val(oCercleForm.Model.Label9.Label)) / 2 - a / 2
posy = (Val(oCercleForm.Model.Label8.Label) + Val(oCercleForm.Model.Label10.Label)) / 2 - a / 2
Else
posx = Val(oCercleForm.Model.Label7.Label) - a / 2
posy = Val(oCercleForm.Model.Label8.Label) - a / 2
End If
End If
End If
If oCercleForm.Model.CheckBox9.State Then
If oCercleForm.Model.CheckBox7.State Then
AjoutePoint posx + a / 2, posy + a / 2, oCercleForm.Model.TextBox2.Text, InsereTexte(oCercleForm.Model.TextBox2.Text, posx + a / 2-200, posy + a / 2 -200, Shapes,0), true,0, Shapes
Else
croix posx + a / 2, posy + a / 2, Shapes
End If
End If
If afmesure Then InsereTexte t1 & MIif(Not oCercleForm.Model.CheckBox10.State, " cm", ""), posx + a / 2, posy + a / 2 - 200, Shapes,0
UnCercle=InsereCercle(posx + a / 2, posy + a / 2, a / 2, Shapes)
UnCercle.FillStyle = com.sun.star.drawing.FillStyle.NONE
If oCercleForm.Model.CheckBox2.Enabled Then
For i = 1 To Val(oCercleForm.Model.TextBox4.Text)
DeplaceRayonCercle(posx + a / 2, posy + a / 2, a / 2, 0, xx, yy)
UneLigne = InsereLigne(posx + a / 2, posy + a / 2, xx, yy, Shapes)
If oCercleForm.Model.CheckBox2.State Then
unangle = CalculeAngle(posx + a / 2, posy + a / 2, xx, yy)
dx = 200*cos(unangle)
dy = 200*sin(unangle)
AjoutePoint xx, yy, Mid$(oCercleForm.Model.TextBox8.Text, i, 1), IIf(oCercleForm.Model.CheckBox2.State, InsereTexte(Mid$(oCercleForm.Model.TextBox8.Text, i, 1), xx + dx, yy + dy, Shapes),""),false,0, Shapes
End If
Next i
End If
If oCercleForm.Model.CheckBox3.Enabled Then
aa = InStr(1, oCercleForm.Model.TextBox9.Text, "[")
For i = 1 To Val(oCercleForm.Model.TextBox5.Text)
DeplaceDiametreCercle posx + a / 2, posy + a / 2, a / 2, 0,xx,yy
InsereLigne 2 * posx + a - xx, 2 * posy + a - yy, xx, yy,Shapes
If oCercleForm.Model.CheckBox3.State Then
unangle = CalculeAngle(posx + a / 2, posy + a / 2, xx, yy)
dx = 200*cos(unangle)
dy = 200*sin(unangle)
AjoutePoint xx, yy, Mid$(oCercleForm.Model.TextBox9.Text, aa + 1, 1), IIf(oCercleForm.Model.CheckBox3.State, InsereTexte(Mid$(oCercleForm.Model.TextBox9.Text, aa + 1, 1), xx + dx, yy + dy, Shapes),""), false, 0, Shapes
AjoutePoint 2 * posx + a - xx, 2 * posy + a - yy, Mid$(oCercleForm.Model.TextBox9.Text, aa + 2, 1), IIf(oCercleForm.Model.CheckBox3.State, InsereTexte(Mid$(oCercleForm.Model.TextBox9.Text, aa + 2, 1), 2 * posx + a - xx - dx, 2 * posy + a - yy - dy, Shapes),""), false, 0, Shapes
End If
aa = InStr(aa + 1, oCercleForm.Model.TextBox9.Text, "[")
Next i
End If
If oCercleForm.Model.CheckBox4.Enabled Then
aa = InStr(1, oCercleForm.Model.TextBox10.Text, "[")
For i = 1 To Val(oCercleForm.Model.TextBox6.Text)
DeplaceCordeCercle posx + a / 2, posy + a / 2, a / 2, 0, xx, yy, xx1, yy1
InsereLigne xx, yy, xx1, yy1,Shapes
If oCercleForm.Model.CheckBox4.State Then
unangle = CalculeAngle(posx + a / 2, posy + a / 2, xx, yy)
dx = 200*cos(unangle)
dy = 200*sin(unangle)
unangle = CalculeAngle(posx + a / 2, posy + a / 2, xx1, yy1)
dx1 = 200*cos(unangle)
dy1 = 200*sin(unangle)
AjoutePoint xx, xx, Mid$( oCercleForm.Model.TextBox10.Text, aa + 1, 1), IIf( oCercleForm.Model.CheckBox4.State, InsereTexte(Mid$( oCercleForm.Model.TextBox10.Text, aa + 1, 1), xx + dx, yy + dy, Shapes), ""), false, 0, Shapes
AjoutePoint xx1, yy1, Mid$( oCercleForm.Model.TextBox10.Text, aa + 2, 1), IIf( oCercleForm.Model.CheckBox4.State, InsereTexte(Mid$( oCercleForm.Model.TextBox10.Text, aa + 2, 1), xx1 + dx1, yy1 + dy1, Shapes), ""), false, 0, Shapes
End If
aa = InStr(aa + 1, oCercleForm.Model.TextBox10.Text, "[")
Next i
End If
If oCercleForm.Model.CheckBox5.Enabled Then
For i = 1 To Val(oCercleForm.Model.TextBox7.Text)
DeplaceTangenteCercle posx + a / 2, posy + a / 2, a / 2, 0, xx, yy, xx1, yy1
ang=CalculeAngle(xx,yy,xx1,yy1)+Pi/2
InsereLigne xx1, yy1, 2*xx-xx1,2*yy-yy1,Shapes
If oCercleForm.Model.CheckBox5.State Then
unangle = CalculeAngle(posx + a / 2, posy + a / 2, xx, yy)
dx = 200*cos(unangle)
dy = 200*sin(unangle)
AjoutePoint xx, yy, Mid$(oCercleForm.Model.TextBox11.Text, i, 1), IIf(oCercleForm.Model.CheckBox5.State, InsereTexte(Mid$(oCercleForm.Model.TextBox11.Text, i, 1), xx + dx, yy + dy, Shapes), ""), FG_TRAIT, ang, Shapes
End If
Next i
End If
If oCercleForm.Model.CheckBox6.State Then
InsereTexte oCercleForm.Model.TextBox3.Text, posx + (a / 2+300) * (1 - Cos(3 * Pi / 4)) - 5, posy + (a / 2+300) * (1 - Sin(3 * Pi / 4)) - 5, Shapes
End If
If oCercleForm.Model.CheckBox8.State Then
LesCercles(NbCercle).Centre = oCercleForm.Model.TextBox2.Text
LesCercles(NbCercle).nom = oCercleForm.Model.TextBox3.Text
LesCercles(NbCercle).rayon = a / 2
LesCercles(NbCercle).Shape = ActiveDocument.Shapes(UnCercle).Name
NbCercle = NbCercle + 1
End If
GroupeObjet(Shapes)
TermineDessin()
' DeplaceSelection posx, posy
End Sub
Private Sub CercleForm_TextBox4_Change()
oCercleForm.Model.CheckBox2.Enabled = (Val(oCercleForm.Model.TextBox4.Text) > 0)
oCercleForm.Model.TextBox8.Enabled = (Val(oCercleForm.Model.TextBox4.Text) > 0 And oCercleForm.Model.CheckBox2.State)
End Sub
Private Sub CercleForm_TextBox5_Change()
oCercleForm.Model.CheckBox3.Enabled = (Val(oCercleForm.Model.TextBox5.Text) > 0)
oCercleForm.Model.TextBox9.Enabled = (Val(oCercleForm.Model.TextBox5.Text) > 0 And oCercleForm.Model.CheckBox3.State)
End Sub
Private Sub CercleForm_TextBox6_Change()
oCercleForm.Model.CheckBox4.Enabled = (Val(oCercleForm.Model.TextBox6.Text) > 0)
oCercleForm.Model.TextBox10.Enabled = (Val(oCercleForm.Model.TextBox6.Text) > 0 And oCercleForm.Model.CheckBox4.State)
End Sub
Private Sub CercleForm_TextBox7_Change()
oCercleForm.Model.CheckBox5.Enabled = (Val(oCercleForm.Model.TextBox7.Text) > 0)
oCercleForm.Model.TextBox11.Enabled = (Val(oCercleForm.Model.TextBox7.Text) > 0 And oCercleForm.Model.CheckBox5.State)
End Sub
</script:module>
|