/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/DivisionCode.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 | <?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="DivisionCode" 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
Global oDivisionForm as object
Sub Main
oDivisionForm = LoadDialog("OOoGdmath","DivisionForm")
ChangeTitreDialog(oDivisionForm)
' RestaureForm(oDivisionForm)
oDivisionForm.Execute()
End Sub
Private Sub DivisionCode_CheckBox1_Click()
oDivisionForm.Model.TextBox4.Enabled = oDivisionForm.Model.CheckBox1.State
End Sub
Private Sub DivisionCode_CommandButton1_Click()
Dim DD, d, param() as string
oDivisionForm.EndExecute
sauveForm(oDivisionForm)
ChargeParametre oDivisionForm.Model.TextBox1.Text, param(), "/"
DD=param(0)
d=param(1)
RemplaceVirgulePoint DD
RemplaceVirgulePoint d
InsereDivisionEntiere DD, d, MIif(oDivisionForm.Model.CheckBox1.State, MIif(oDivisionForm.Model.TextBox4.Text = "", ".", oDivisionForm.Model.TextBox4.Text), "")
End Sub
Private Sub DivisionCode_CommandButton2_Click()
oDivisionForm.EndExecute
End Sub
Private Sub DivisionCode_Image1_Click()
ChangeCouleur oDivisionForm.Model.Image1
End Sub
Private Sub DivisionCode_TextBox4_Change()
oDivisionForm.Model.TextBox4.Text = Left$(oDivisionForm.Model.TextBox4.Text, 1)
End Sub
Sub InsereDivisionEntiere(DD, d, OperationTrou)
Dim l,h, nchiffre, nchiffred, nchiffreq, nDD, zz, Q, qq$, Debut, DD1
Dim restei, qqTempo$, i, DD2, qi, di$, j
Dim Shapes as Object
InitialiseDessin(False)
Shapes=InitialiseGroupe
DimensionTexte "8",12,l,h
nchiffre = Val(oDivisionForm.Model.TextBox3.Text)
nchiffred = InStr(1, DD, ".")
If nchiffred <> 0 Then nchiffred = Len(DD) - nchiffred
nchiffreq = InStr(1, d, ".")
If nchiffreq <> 0 Then nchiffreq = Len(d) - nchiffreq
If nchiffreq > 0 Then
DD = Trim(Val(DD) * 10 ^ nchiffreq)
d = Trim(Val(d) * 10 ^ nchiffreq)
nchiffred = InStr(1, DD, ".")
If nchiffred <> 0 Then nchiffred = Len(DD) - nchiffred
nchiffreq = InStr(1, d, ".")
If nchiffreq <> 0 Then nchiffreq = Len(d) - nchiffreq
End If
If nchiffre < nchiffred Then nchiffre = nchiffred
If nchiffre < nchiffred Then
nchiffre = nchiffred
nDD = DD
Else
nDD = Str(Val(DD) * (10 ^ nchiffre))
nDD = Right$(nDD, Len(nDD) - 1)
If Val(DD) < 1 Then nDD = "0" & nDD
End If
zz = MIif(Val(DD) < Val(d), "0", "")
DD = nDD
If Val(d) = Int(Val(d)) Then
Q = Str(Int(Val(DD) / Val(d)))
qq$ = zz & Right$(Q, Len(Q) - InStr(1, Q, " "))
If Len(qq$) <= nchiffre Then qq$ = "0" & qq$
Debut = Len(DD) - Len(qq$)
DD1 = Left$(DD, Debut)
InsereLigne 2*l * (Len(DD) - Debut+1.2), h*(1+0.2), 2*l * (Len(DD) - Debut+1.2), h*(3+0.2), Shapes, oDivisionForm.Model.Image1
InsereLigne 2*l * (Len(DD) - Debut+1.2), h*(2+0.2), 2*l * (Len(DD) - Debut + Len(d)+1.5), h*(2+0.2), Shapes, oDivisionForm.Model.Image1
AfficheTexte Len(DD) + 1 - Debut, 1, DD, nchiffre > 0, nchiffre, Shapes,l,h
AfficheTexte Len(DD) + 2 - Debut + Len(d), 1, d, False, 0, Shapes,l,h
If OperationTrou <> "" Then
qqTempo$ = qq$
RemplaceChiffreCaractere qq$, OperationTrou
AfficheTexte Len(DD) + 2 - Debut + Len(qq$), 2, qq$, nchiffre > 0, nchiffre, Shapes,l,h
qq$ = qqTempo$
Else
AfficheTexte Len(DD) + 2 - Debut + Len(qq$), 2, qq$, nchiffre > 0, nchiffre, Shapes,l,h
End If
For i = 1 To Len(qq)
DD2 = DD1 & Mid$(DD, Debut + i, 1)
qi = Mid$(qq$, i, 1)
di$ = Str(Val(qi) * Val(d))
di$ = Right$(di, Len(di$) - 1)
restei = Str(Val(DD2) - Val(di$))
DD1 = Right$(restei, Len(restei) - 1)
For j = 1 To Len(DD2) - Len(di$)
di$ = " " & di$
Next j
If i = Len(qq$) Then
AfficheDivisionP i + 1, 2 * i, di$, DD1 & " ", OperationTrou,Shapes,l,h
Else
AfficheDivisionP i + 1, 2 * i, di$, DD1 & Mid$(DD, Debut + i + 1, 1), OperationTrou,Shapes,l,h
End If
Next i
Dim aPoint As New com.sun.star.awt.Point
Dim TheSize as new com.sun.star.awt.Size
Dim Group as Object
aPoint.x=3000
aPoint.y=3000
Group = GroupeObjet(Shapes)
Group.Position=aPoint
TermineDessin()
Else
End If
End Sub
Sub AfficheDivisionP(x, y, d$, r$, OperationTrou,Shapes,l,h)
If oDivisionForm.Model.CheckBox2.State Then
If OperationTrou <> "" Then RemplaceChiffreCaractere d$, OperationTrou
AfficheTexte x, y, "-" & d$, False, 0, Shapes,l,h
InsereLigne 2*l * (x - 1.5 - Len(d$)), h * (y + 1.2), 2*l * (x - 0.5), h * (y + 1.2), Shapes, oDivisionForm.Model.Image1
End If
If OperationTrou <> "" Then RemplaceChiffreCaractere r$, OperationTrou
If oDivisionForm.Model.CheckBox2.State Then
AfficheTexte x + 1, y + 1, r$, False, 0, Shapes,l,h
Else
AfficheTexte x + 1, Int(y / 2) + 1, r$, False, 0, Shapes,l,h
End If
End Sub
</script:module>
|