/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/PolygoneRegulierCode.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 | <?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="PolygoneRegulierCode" 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
Dim oPolygoneRegulierForm as Object
Sub Main
oPolygoneRegulierForm = LoadDialog("OOoGdmath","PolygoneRegulierForm")
ChangeTitreDialog(oPolygoneRegulierForm)
oPolygoneRegulierForm.Model.OptionButton1.ImageURL = fCheminImages & "poly1.gif"
oPolygoneRegulierForm.Model.OptionButton2.ImageURL = fCheminImages & "poly2.gif"
' RestaureForm(oPolygoneRegulierForm)
oPolygoneRegulierForm.Execute()
End Sub
Private Sub CheckBox1_Click()
oPolygoneRegulierForm.Model.TextBox3.Enabled = oPolygoneRegulierForm.Model.CheckBox1.State
End Sub
Private Sub CheckBox2_Click()
oPolygoneRegulierForm.Model.CheckBox7.Enabled = oPolygoneRegulierForm.Model.CheckBox2.State
End Sub
Private Sub CheckBox6_Click()
oPolygoneRegulierForm.Model.CheckBox8.Enabled = oPolygoneRegulierForm.Model.CheckBox6.State
End Sub
Private Sub CheckBox9_Click()
oPolygoneRegulierForm.Model.CheckBox10.Enabled = oPolygoneRegulierForm.Model.CheckBox9.State
End Sub
Private Sub CommandButton1_Click()
Dim unObjet As Object
Dim UnPointille As String
Dim secArray() As Single
Dim posx, posy, NombreCotes, tt, rayon, x0, y0, i, xx, yy, x1, y1, LeNomPoint
Dim UneCourbe as Object, LeCercle as Object
Dim Shapes as Object
oPolygoneRegulierForm.EndExecute()
SauveForm(oPolygoneRegulierForm)
InitialiseDessin(False)
Shapes=InitialiseGroupe
PointInsertion posx, posy
NombreCotes = Val(oPolygoneRegulierForm.Model.TextBox1.Text)
ReDim secArray(0 To NombreCotes , 0 To 1)
tt = oPolygoneRegulierForm.Model.TextBox2.Text
RemplaceVirgulePoint tt
rayon = CentimetersToPoints(Val(tt))
If NombreCotes < 3 Or Int(NombreCotes) <> NombreCotes Then
MsgBox1 "Le nombre de côtés doit être un nombre entier" + Chr(13) + "supérieur ou égal à 3...", vbOKOnly
Else
x0 = 100
y0 = 100
secArray(0, 0) = x0 + rayon
secArray(0, 1) = y0
If oPolygoneRegulierForm.Model.CheckBox2.State Then
InsereLigne x0, y0, x0 + rayon, y0, Shapes, oPolygoneRegulierForm.Model.Image3
End If
For i = 1 To NombreCotes
xx = x0 + rayon * Cos(i * 2 * Pi / NombreCotes)
yy = y0 + rayon * Sin(i * 2 * Pi / NombreCotes)
secArray(i, 0) = xx
secArray(i, 1) = yy
If oPolygoneRegulierForm.Model.CheckBox2.State Then
InsereLigne x0, y0, xx, yy, Shapes, oPolygoneRegulierForm.Model.Image3
If oPolygoneRegulierForm.Model.CheckBox7.State Then CodeLongueur x0, y0, xx, yy, 1, Shapes
End If
If oPolygoneRegulierForm.Model.CheckBox6.State Then
x1 = x0 + rayon * Cos((i * 2 + 1) * Pi / NombreCotes) * Cos(Pi / NombreCotes)
y1 = y0 + rayon * Sin((i * 2 + 1) * Pi / NombreCotes) * Cos(Pi / NombreCotes)
InsereLigne x0, y0, x1, y1, Shapes, oPolygoneRegulierForm.Model.Image5
MarqueAngleDroit x1, y1, x0, y0, Shapes
If oPolygoneRegulierForm.Model.CheckBox8.State Then CodeLongueur x0, y0, x1, y1, 2,Shapes
End If
If oPolygoneRegulierForm.Model.CheckBox4.State Then
xx = xx + 500 * Cos(i * 2 * Pi / NombreCotes)
yy = yy + 500 * Sin(i * 2 * Pi / NombreCotes)
If OOoGdmath_TypeNommage <> 0 Then
InsereTexte oPolygoneRegulierForm.Model.TextBox4.Text + Trim(Str(iif(OOoGdmath_SensNommage=0,i,NombreCotes+1-i))), xx, yy, Shapes, 0, 0, 0
Else
InsereTexte Chr(Asc(oPolygoneRegulierForm.Model.TextBox4.Text) + iif(OOoGdmath_SensNommage=0,i,NombreCotes+1-i) - 1), xx, yy, Shapes, 0, 0, 0
End If
End If
Next i
UneCourbe = InserePolygone(secArray, i, Shapes, oPolygoneRegulierForm.Model.Image1)
If oPolygoneRegulierForm.Model.CheckBox1.State Then
If Not oPolygoneRegulierForm.Model.CheckBox2.State Then croix x0, y0, Shapes
InsereTexte oPolygoneRegulierForm.Model.TextBox3.Text, x0, y0, Shapes, 0
End If
If oPolygoneRegulierForm.Model.CheckBox3.State Then
leCercle = InsereCercle(x0, y0, rayon, Shapes)
IOAttribut leCercle, oPolygoneRegulierForm.Model.Image2
End If
If oPolygoneRegulierForm.Model.CheckBox5.State Then
leCercle = InsereCercle(x0, y0, rayon * Cos(Pi / NombreCotes), Shapes)
IOAttribut leCercle, oPolygoneRegulierForm.Model.Image4
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
TermineDessin()
End If
End Sub
Private Sub CommandButton2_Click()
oPolygoneRegulierForm.EndExecute()
End Sub
Private Sub Image1_Click()
ChangeCouleur oPolygoneRegulierForm.Model.Image1
End Sub
Private Sub Image2_Click()
ChangeCouleur oPolygoneRegulierForm.Model.Image2
End Sub
Private Sub Image3_Click()
ChangeCouleur oPolygoneRegulierForm.Model.Image3
End Sub
Private Sub Image4_Click()
ChangeCouleur oPolygoneRegulierForm.Model.Image4
End Sub
Private Sub Image5_Click()
ChangeCouleur oPolygoneRegulierForm.Model.Image5
End Sub
Private Sub TextBox2_Change()
Dim tt, ri
tt = oPolygoneRegulierForm.Model.TextBox2.Text
RemplaceVirgulePoint tt
ri = Val(tt) * Cos(Pi / Val(oPolygoneRegulierForm.Model.TextBox1.Text))
If oPolygoneRegulierForm.Model.TextBox5.Text <> Trim(Str(ri)) Then oPolygoneRegulierForm.Model.TextBox5.Text = Trim(Str(ri))
End Sub
Private Sub TextBox5_Change()
Dim tt, rc
tt = oPolygoneRegulierForm.Model.TextBox5.Text
RemplaceVirgulePoint tt
rc = Val(tt) / Cos(Pi / Val(oPolygoneRegulierForm.Model.TextBox1.Text))
If oPolygoneRegulierForm.Model.TextBox2.Text <> Trim(Str(rc)) Then oPolygoneRegulierForm.Model.TextBox2.Text = Trim(Str(rc))
End Sub
Private Sub UserForm_Initialize()
Dim x, y
StartUpPosition = 0
x = Left
y = Top
ChangeSPForm x, y, Width, Height
Left = x
Top = y
ChargeCouleurDefaut oPolygoneRegulierForm.Model.Image1
ChargeCouleurDefaut oPolygoneRegulierForm.Model.Image2
ChargeCouleurDefaut oPolygoneRegulierForm.Model.Image3
ChargeCouleurDefaut oPolygoneRegulierForm.Model.Image4
ChargeCouleurDefaut oPolygoneRegulierForm.Model.Image5
End Sub
</script:module>
|