/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoGdmath/MultiCode.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 | <?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="MultiCode" 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 oMultiForm as object
Sub Main
oMultiForm = LoadDialog("OOoGdmath","MultiForm")
ChangeTitreDialog(oMultiForm)
' RestaureForm(oMultiForm)
oMultiForm.Execute()
End Sub
Private Sub MultiCode_CheckBox1_Click()
oMultiForm.Model.TextBox4.Enabled = oMultiForm.Model.CheckBox1.State
End Sub
Private Sub MultiCode_CheckBox2_Click()
oMultiForm.Model.TextBox3.Enabled = oMultiForm.Model.CheckBox2.State
End Sub
Private Sub MultiCode_CommandButton1_Click()
Dim MM, m
dim param() as string
oMultiForm.EndExecute()
sauveForm(oMultiForm)
ChargeParametre oMultiForm.Model.TextBox1.Text,param(),"*"
MM = param(0)
RemplaceVirgulePoint MM
m = param(1)
RemplaceVirgulePoint m
InsereMultiplication MM, m, MIif(oMultiForm.Model.CheckBox1.State, oMultiForm.Model.TextBox4.Text,""),MIif(oMultiForm.Model.CheckBox2.State, oMultiForm.Model.TextBox3.Text,""), oMultiForm.Model.CheckBox3.State
End Sub
Private Sub MultiCode_CommandButton2_Click()
oMultiForm.EndExecute()
End Sub
Private Sub MultiCode_Image1_Click()
ChangeCouleur oMultiForm.Model.Image1
End Sub
Private Sub MultiCode_TextBox4_Change()
oMultiForm.Model.TextBox4.Text = Left$(oMultiForm.Model.TextBox4.Text, 1)
End Sub
Private Sub MultiCode_TextBox3_Change()
oMultiForm.Model.TextBox3.Text = Left$(oMultiForm.Model.TextBox3.Text, 1)
End Sub
Sub InsereMultiplication(MM, m, OperationTrou,CarDecalage,Intermediaire)
Dim l,h, nchiffre1, nchiffre2, nchiffre3, piz, i, c, mp$, j, mpp$, Resultat$
Dim Shapes as Object
InitialiseDessin(False)
Shapes=InitialiseGroupe()
DimensionTexte "8",12,l,h
RemplaceVirgulePoint MM
RemplaceVirgulePoint m
nchiffre1 = InStr(1, MM, ".")
If nchiffre1 > 0 Then nchiffre1 = Len(MM) - nchiffre1
nchiffre2 = InStr(1, m, ".")
If nchiffre2 > 0 Then nchiffre2 = Len(m) - nchiffre2
If nchiffre1 > 0 Then MM = Left$(MM, Len(MM) - 1 - nchiffre1) & Right$(MM, nchiffre1)
If nchiffre2 > 0 Then m = Left$(m, Len(m) - 1 - nchiffre2) & Right$(m, nchiffre2)
AfficheTexte 10, 1, MM, nchiffre1 > 0, nchiffre1, Shapes,l,h
AfficheTexte 10 - max(Len(m), Len(MM)), 2, Chr(180), False, 0, Shapes,l,h
AfficheTexte 10, 2, m, nchiffre2 > 0, nchiffre2, Shapes,l,h
TraceLigneGroupe Shapes, "s", oMultiForm.Model.Image1
nchiffre3 = nchiffre1 + nchiffre2
While Left$(m, 1) = "0"
m = Right$(m, Len(m) - 1)
Wend
While Left$(MM, 1) = "0"
MM = Right$(MM, Len(MM) - 1)
Wend
piz = 0
For i = 1 To Len(m)
c = Mid$(m, Len(m) + 1 - i, 1)
mp$ = Str(Val(MM) * Val(c))
mp$ = Right$(mp, Len(mp$) - InStr(1, mp$, " "))
If mp$ = "0" Then
piz = piz + 1
Else
If OperationTrou <> "" Then RemplaceChiffreCaractere mp$, OperationTrou
If Len(m) = 1 Then
AfficheTexte 11 - i, i + 2 - piz, mp$, nchiffre3 > 0, nchiffre3, Shapes,l,h
Else
if Intermediaire then
if OperationTrou <> "" Then
CarDecalage = OperationTrou
else
CarDecalage = "0"
End if
End if
If CarDecalage <> "" Then
For j = 1 To i - 1
mp$ = mp$ & CarDecalage
Next j
AfficheTexte 10, i + 2 - piz, mp$, False, 0, Shapes,l,h
Else
AfficheTexte 11 - i, i + 2 - piz, mp$, False, 0, Shapes,l,h
End If
End If
End If
Next i
If Len(m) > 1 Then
Resultat$ = Str(Val(MM) * Val(m))
Resultat$ = Right$(Resultat$, Len(Resultat$) - 1)
If OperationTrou <> "" Then RemplaceChiffreCaractere Resultat$, OperationTrou
TraceLigneGroupe Shapes, "s", oMultiForm.Model.Image1
AfficheTexte 10, Len(m) + 3 - piz, Resultat$, nchiffre1 + nchiffre2 > 0, nchiffre1 + nchiffre2, Shapes,l,h
End If
For i = 1 To Len(m)
c = Mid$(m, Len(m) + 1 - i, 1)
mp$ = Str(Val(MM) * Val(c))
mp$ = Right$(mp, Len(mp$) - InStr(1, mp$, " "))
If mp$ = "0" Then
piz = piz + 1
Else
If OperationTrou <> "" Then RemplaceChiffreCaractere mp$, OperationTrou
If Len(m) > 1 Then
If Intermediaire Then
mpp$ = " = " & MM & " x " & c
If CarDecalage<>"" Then
For j = 1 To i - 1
mpp$ = mpp$ & "0"
Next j
End If
InsereTexte mpp$, 10*l, (i + 3 - piz)*h, Shapes,0,1,-1
End If
End If
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()
End Sub
</script:module>
|