/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Module2b.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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | <?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="Module2b" script:language="StarBasic">REM ***** BASIC *****
Public Form,Form1,Form2 as Boolean
Public oBoite as Object
Public oBoiteFormuleGraphique as Object
Public oTextIndex as Object
rem --------------------------------------------------------------------------------------------------
rem macros pour l'écriture du binôme by gfriege (GF) fevrier 2006, move to new Module2b and revised: september 2008
Sub BinomGraphique rem DDP corrigee le 15 novembre 2009
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible = False
oBoite = LoadDialog("Dmaths","Binom")
Set oTextIndex = oBoite.getControl("TextField1").Peer
oBoite.execute()
End Sub
Sub InsereBinom
Dim Test,Operator as string
Dim reduce as Boolean
IsFormuleItalic = bItalic
If oBoite.Model.CheckBox1.State = 1 Then reduce = True Else reduce = False
If oBoite.Model.OptionButton5.State = 1 Then
Operator = " "
ElseIf oBoite.Model.OptionButton6.State = 1 Then
Operator = " cdot "
ElseIf oBoite.Model.OptionButton7.State = 1 Then Operator = " times "
End If
' if empty, write letters n,k,p
n_text = "n"
p_text = "p"
k_text = "k"
' ... else ...
If oBoite.getControl("TextField1").Peer.Text<>"" Then n_text = oBoite.getControl("TextField1").Peer.Text
If oBoite.getControl("TextField2").Peer.Text<>"" Then p_text = oBoite.getControl("TextField2").Peer.Text
If oBoite.getControl("TextField3").Peer.Text<>"" Then k_text = oBoite.getControl("TextField3").Peer.Text
' build left hand side
If oBoite.Model.OptionButton2.State=1 Then
Test=Test+"P(X="+k_text+")="
ElseIf oBoite.Model.OptionButton3.State=1 Then
Test=Test+"b("+n_text+";"+p_text+";"+k_text+")="
EndIf
' build right hand side
nk_text=nk_string(n_text,k_text,reduce)
q_text=q_string(p_text,reduce)
Test=Test+"left( matrix{ "+n_text+"##"+k_text+" } right)"+ Operator +"{"+p_text+"^"+k_text+"}"+ Operator +"{" + q_text+"^{"+nk_text+"}}"
If Form=True Then
oText1 = oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN) +" " + Test + " " + Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
bVecteur = True
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub binom_hide_LHS
oBoite.Model.Label4.enabled=False
oBoite.Model.Label5.enabled=False
oBoite.Model.Label6.enabled=False
oBoite.Model.Label17.enabled=False
oBoite.Model.Label18.enabled=False
End Sub
Sub binom_show_P
oBoite.Model.Label4.Label="P"
oBoite.Model.Label4.enabled=True
oBoite.Model.Label5.Label="X = "
oBoite.Model.Label5.enabled=True
oBoite.Model.Label6.enabled=True
oBoite.Model.Label17.enabled=True
oBoite.Model.Label18.enabled=True
End Sub
Sub binom_show_b
oBoite.Model.Label4.Label="b"
oBoite.Model.Label4.enabled=True
oBoite.Model.Label5.Label = oBoite.getControl("TextField1").Peer.Text + ";" + oBoite.getControl("TextField2").Peer.Text + ";"
oBoite.Model.Label5.enabled=True
oBoite.Model.Label6.enabled=True
oBoite.Model.Label17.enabled=True
oBoite.Model.Label18.enabled=True
End Sub
Sub binom_n_changed
If oBoite.Model.OptionButton3.State=1 Then
oBoite.Model.Label5.Label = oBoite.getControl("TextField1").Peer.Text + ";"+ oBoite.getControl("TextField2").Peer.Text + ";"
EndIf
oBoite.Model.Label9.Label = oBoite.getControl("TextField1").Peer.Text
If oBoite.Model.CheckBox1.State=1 Then 'reduced
'rechne
oBoite.Model.Label24.Label = oBoite.getControl("TextField1").Peer.Text + "-" + oBoite.getControl("TextField3").Peer.Text
Else
oBoite.Model.Label24.Label = oBoite.getControl("TextField1").Peer.Text + "-" + oBoite.getControl("TextField3").Peer.Text
EndIf
End Sub
Sub binom_k_changed
oBoite.Model.Label10.Label = oBoite.getControl("TextField3").Peer.Text
oBoite.Model.Label13.Label = oBoite.getControl("TextField3").Peer.Text
oBoite.Model.Label17.Label = oBoite.getControl("TextField3").Peer.Text
oBoite.Model.Label24.Label = oBoite.getControl("TextField1").Peer.Text + "-" + oBoite.getControl("TextField3").Peer.Text
End Sub
Sub binom_p_changed
If oBoite.Model.OptionButton3.State=1 Then
oBoite.Model.Label5.Label = oBoite.getControl("TextField1").Peer.Text +";" + oBoite.getControl("TextField2").Peer.Text + ";"
EndIf
oBoite.Model.Label11.Label = oBoite.getControl("TextField2").Peer.Text
oBoite.Model.Label12.Label="(1-" + oBoite.getControl("TextField2").Peer.Text + ")"
End Sub
Sub binom_Op(event)
BinOp = event.source.model.name
Set oBO=oBoite.Model.getByName(BinOp)
oBoite.Model.Label15.Label = oBO.Label
oBoite.Model.Label16.Label = oBO.Label
End Sub
Sub binom_reduced
n_text = oBoite.getControl("TextField1").Peer.Text
p_text = oBoite.getControl("TextField2").Peer.Text
k_text = oBoite.getControl("TextField3").Peer.Text
If oBoite.Model.CheckBox1.State=1 Then
oBoite.Model.Label12.Label = q_string(p_text,True)
oBoite.Model.Label24.Label = nk_string(n_text,k_text,True)
Else
oBoite.Model.Label12.Label = q_string(p_text,False)
oBoite.Model.Label24.Label = nk_string(n_text,k_text,False)
EndIf
End Sub
Function q_string(p_string As String, red As Boolean) As String
q_string="(1-"+p_string+")"
If (val(p_string)<>0) Then
iPos = Instr(p_string,",") 'for the calculation, decimal dot is needed
If iPos<>0 Then
Mid(p_string,iPos,1,".")
End If
p_val=val(p_string)
q_val=1-p_val
If red Then q_string=format(q_val)
End If
End Function
Function nk_string(n_string As String, k_string As String, red As Boolean) As String
nk_string=n_string+"-"+k_string
If (val(n_string)<>0) Then n_val=val(n_string)
If (val(k_string)<>0) Then k_val=val(k_string)
If (val(n_string)<>0) and (val(k_string)<>0) then
nk_val=val(n_string)-val(k_string)
If red Then nk_string=str(nk_val)
End If
End Function
rem fin macros pour l'écriture du binôme
rem --------------------------------------------------------------------------------------------------
rem macros pour l'écriture des isotopes by gfriege (GF) june/september 2008
Sub IsotopeGraphique
Form1=True
If Form=True Then oBoiteFormuleGraphique.Visible = False
oBoite = LoadDialog("Dmaths","Isotope")
Set oTextIndex = oBoite.getControl("TextField1").Peer
oBoite.execute()
End Sub
Sub InsereIsotope rem
Dim Test as string
Dim oText1 as string
If oBoite.Model.OptionButton5.State=1 Then
Operator=" "
ElseIf oBoite.Model.OptionButton6.State=1 Then
Operator=" cdot "
ElseIf oBoite.Model.OptionButton7.State=1 Then Operator=" times "
End If
Test="{} sup {" + oBoite.getControl("TextField1").Peer.Text + "} sub {" + oBoite.getControl("TextField2").Peer.Text + "} " + oBoite.getControl("TextField3").Peer.Text
If oBoite.getControl("TfFact").Peer.Text <> "" Then
Test = oBoite.getControl("TfFact").Peer.Text + Operator + Test
End If
If oBoite.getControl("TfExp").Peer.Text <> "" Then
Test = Test + "{} sup { " + oBoite.getControl("TfExp").Peer.Text + " }"
End If
If oBoite.getControl("TextField4").Peer.Text <> "" Then
Test = Test + oBoite.getControl("TextField4").Peer.Text
End If
If Form=True Then
oText1=oBoiteFormuleGraphique.getControl("TextField1").Peer.Text
oBoiteFormuleGraphique.Model.TextField1.Text = Left(oText1,aSel0.MIN)+" "+Test+" "+Right(oText1,Len(oText1)-aSel0.MIN)
oBoiteFormuleGraphique.Getcontrol("TextField1").SetFocus
oBoiteFormuleGraphique.Visible = True
Elseif Form2 = True Then
sAjout = Test
Else
Test = Dixio(Test)
InsertSourceIntegrale(Test)
Endif
Form1 = False
oBoite.Endexecute()
If Form = True Then
oTextIndex = oBoiteFormuleGraphique.getControl("TextField1").Peer
CursorPos = CursorPos + Len(Test)
End If
End Sub
Sub IsotopeFact(event)
IsoF = event.source.model.name
Set oIF=oBoite.Model.getByName(IsoF)
oBoite.Model.LbOp.Label=oIF.Tag
End Sub
Sub IsotopeExp(event)
IsoE = event.source.model.name
Set oIE=oBoite.Model.getByName(IsoE)
oBoite.Model.TfExp.Text=oIE.Tag
End Sub
</script:module>
|