/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/Module3b.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 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | <?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="Module3b" script:language="StarBasic">'************************************************
'Copyright (C) 2010 Didier Dorange-Pattoret
'38, chemin de l'Abbaye
'74940 Annecy le Vieux
'France
'ddorange@dmaths.com
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public Licence (GPL)
'as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library 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 Licence (GPL)
'along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'************************************************
Private LaBoite as Object
Private Const LesOptionsParDefaut = "1:0:0:0:15:10:15:12:10:25:0:0:0:0:0:0:0:0:0:0:0:O:i:j:10:1:0:0:0:0:0:1:0:0:0:0:0:"
Global oDocGraphPlotter as Object
Function MemoriseCourbe(LaCourbe as Object) as String Rem cette macro memorise les parametres de la courbe
Dim LeTexte as String
LaBoite = oRepFonctions
LeTexte = CStr(Nbrecourbes) & "::"
For I = 1 To 10
LeTexte = LeTexte & CC(I) & ":"
Next I
LeTexte = LeTexte & CT(2) & ":"
LeTexte = LeTexte & CT(3) & ":"
For I = 6 To 16
LeTexte = LeTexte & CT(I) & ":"
Next I
LeTexte = LeTexte & CT(18) & ":"
LeTexte = LeTexte & CT(19) & ":"
For I = 1 To 6
LeTexte = LeTexte & CO(I) & ":"
Next I
For I = 0 To Nbrecourbes
LeTexte = LeTexte & ":" & sNomFonction(I) & ":" & sFormul(I) & ":" & Xmin(I) & ":" & Xmax(I) & ":"
Next I
LeTexte = LeTexte & MemoriseOptions
MemoriseCourbe = LeTexte
End Function
Function MemoriseOptions as String Rem cette macro memorise les parametres de la courbe
Dim LeTexte as String
LaBoite = oOptions
LeTexte = ":"
For I = 1 To 4
LeTexte = LeTexte & CC(I) & ":"
Next I
For I = 1 To 21
LeTexte = LeTexte & CT(I) & ":"
Next I
For I = 1 To 12
LeTexte = LeTexte & CO(I) & ":"
Next I
MemoriseOptions = LeTexte
End Function
Sub SauveOptionsTrace Rem cette macro sauvegarde dans les options de trac� dans celle de Dmaths ecrite le 26 f�vrier 2010
Dim sOptionsCourbe, sSrce as String
Dim oLib as Object
Dim iIndex, iIndex2 as Integer
oLib = GlobalScope.BasicLibraries.Standard
If oLib.hasByName("DmOptions") Then
sSrce = oLib.getByName("DmOptions")
oLib.removeByName("DmOptions")
iIndex = InsTr(sSrce,"Public const sOptionsTraceCourbe = ")
sOptionsCourbe = MemoriseOptions
sOptionsCourbe = Mid(sOptionsCourbe,2,Len(sOptionsCourbe)-1)
If iIndex > 0 Then Rem les options de trac� existent
iIndex2 = InsTr(iIndex,sSrce,chr(13))
sSrce = Mid(sSrce,1,iIndex+34) & """" & sOptionsCourbe & """" & Mid(sSrce,iIndex2,Len(sSrce)-iIndex2+1)
Else Rem les options n'existent pas
iIndex2 = InsTr(sSrce,"Sub MyTest2")
sSrce = Mid(sSrce,1,iIndex2-1) & "Public const sOptionsTraceCourbe = """ & sOptionsCourbe & """" _
& Chr(13) & Mid(sSrce,iIndex2,Len(sSrce)-iIndex2+1)
Endif
oLib.InsertByName("DmOptions",sSrce)
msgbox(sVocab(iLang,1),64,"Dmaths")
Endif
End sub
Sub ChargeOptionsParDefaut Rem macro permettant de reinitialiser les options d etracer par defaut ecrite le 27 fevrier 2010 modifiee le 14 mars 2010
Dim sDefaut as String
sDefaut = LesOptionsParDefaut
RecupereOptions(sDefaut)
End Sub
Sub RecupereCourbe (sDescription As String) rem modifi�e le 13 d�cembre 2009
rem on charge la boite avec les parametres transmis
If Len(sDescription)>0 Then
ChargeCourbe (sDescription)
Else
rem on recupere les parametres dune courbe selectionnee
If Not IsEmpty(ThisComponent.CurrentSelection) Then
If ThisComponent.CurrentSelection.ImplementationName = "com.sun.star.drawing.SvxShapeCollection" Then
If Len(ThisComponent.CurrentSelection.getByIndex(0).Description) > 0 Then
If Len(ThisComponent.CurrentSelection.getByIndex(0).Description) > 2 Then
If (Mid(ThisComponent.CurrentSelection.getByIndex(0).Description,2,2) = "::") Then
Call ChargeCourbe(ThisComponent.CurrentSelection.getByIndex(0).Description)
Else
rem on charge seulement les options m�moris�es
RecupereOptions(sOptionsTraceCourbe)
Endif
Else
RecupereOptions(sOptionsTraceCourbe)
Endif
Else
RecupereOptions(sOptionsTraceCourbe)
Endif
Else
RecupereOptions(sOptionsTraceCourbe)
Endif
Else
RecupereOptions(sOptionsTraceCourbe)
Endif
Endif
End Sub
Sub ChargeCourbe(LT as String) rem recupere la courbe selectionnee
Nbrecourbes = Cint(Mid(LT,1,1)
LaBoite = oRepFonctions
Dim Index,NewIndex as Integer
For I = 1 To 10
LaBoite.getControl("CheckBox"&Cstr(I)).State = Cint(Mid(LT,2+2*I,1)
Next I
Index = 23
NewIndex = InStr(Index+1,LT,":")
LaBoite.getControl("TextField"&Cstr(2)).Text = Mid(LT,Index+1,NewIndex-Index-1)
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
LaBoite.getControl("TextField"&Cstr(3)).Text = Mid(LT,Index+1,NewIndex-Index-1)
For I = 6 To 16
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
LaBoite.getControl("TextField"&Cstr(I)).Text = Mid(LT,Index+1,NewIndex-Index-1)
Next I
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
LaBoite.getControl("TextField"&Cstr(18)).Text = Mid(LT,Index+1,NewIndex-Index-1)
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
LaBoite.getControl("TextField"&Cstr(19)).Text = Mid(LT,Index+1,NewIndex-Index-1)
For I = 1 To 6
Index = NewIndex
NewIndex = Index + 2
If Mid(LT,Index+1,1) = "0" Then
LaBoite.getControl("OptionButton"&Cstr(I)).State = False
Else
LaBoite.getControl("OptionButton"&Cstr(I)).State = True
Endif
Next I
For I = 0 To Nbrecourbes rem recupere les fonctions
Index = NewIndex + 1 rem on tient compte du ::
NewIndex = InStr(Index+1,LT,":")
sNomFonction(I) = Mid(LT,Index+1,NewIndex-Index-1)
If I = 0 Then LaBoite.getControl("TextField"&Cstr(17)).Text = sNomFonction(I)
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
sFormul(I) = Mid(LT,Index+1,NewIndex-Index-1)
If I = 0 Then LaBoite.getControl("TextField"&Cstr(1)).Text = sFormul(I)
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
Xmin(I) = CSngPlus(Mid(LT,Index+1,NewIndex-Index-1))
If I = 0 Then LaBoite.getControl("TextField"&Cstr(4)).Text = Mid(LT,Index+1,NewIndex-Index-1)
Index = NewIndex
NewIndex = InStr(Index+1,LT,":")
Xmax(I) = CSngPlus(Mid(LT,Index+1,NewIndex-Index-1))
If I = 0 Then LaBoite.getControl("TextField"&Cstr(5)).Text = Mid(LT,Index+1,NewIndex-Index-1)
Next I
RecupereOptions(Mid(LT,NewIndex+2,Len(LT)-NewIndex-1)
NbreMaxcourbes = Nbrecourbes rem reinitialise le nbremax de courbes
Nbrecourbes = 0 rem reinitialise le nbre de courbes
bRecup = True
End Sub
Sub RecupereOptions(LTO As String) Rem permet de charger les options dans la boite de dialogue oOptions
If Len(LTO) = 0 Then
LTO = LesOptionsParDefaut
SauveOptionsTrace
Endif
LaBoite = oOptions
Dim Index,NewIndex as Integer
For I = 1 To 4 rem les CheckBoxs
LaBoite.getControl("CheckBox"&Cstr(I)).State = Mid(LTO,1+2*(I-1),1)
Next I
NewIndex = 8
For I = 1 To 21 rem les TextFields
Index = NewIndex
NewIndex = InStr(Index+1,LTO,":")
LaBoite.getControl("TextField"&Cstr(I)).Text = Mid(LTO,Index+1,NewIndex-Index-1)
Next I
For I = 1 To 12 rem les OptionButtons
If Mid(LTO,NewIndex+1+2*(I-1),1) = "0" Then
LaBoite.getControl("OptionButton"&Cstr(I)).State = False
Else
LaBoite.getControl("OptionButton"&Cstr(I)).State = True
Endif
Next I
End Sub
REM Open
Sub ChoixDesOptions rem mis au point le 3 janvier 2003 modifiee le 11 avril 2009
'oRepfonctions.Visible=False
If bDiagBox=True or bGrille=True Then
oOptions.GetControl("FrameControl7").Visible = False
oOptions.GetControl("CheckBox4").Visible = False
oOptions.GetControl("Label14").Visible = False
oOptions.GetControl("Label15").Visible = False
oOptions.GetControl("TextField13").Visible = False
oOptions.GetControl("TextField14").Visible = False
Endif
If oRepfonctions.Model.CheckBox5.State=1 or bGrille=True Then
oOptions.Model.TextField8.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField8.Enabled = False
oOptions.Model.TextField9.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField9.Enabled = False
oOptions.Model.TextField10.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField10.Enabled = False
oOptions.Model.TextField11.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField11.Enabled = False
oOptions.Model.TextField12.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField12.Enabled = False
oOptions.Model.TextField15.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField15.Enabled = False
oOptions.Model.TextField16.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField16.Enabled = False
oOptions.Model.TextField17.Text = oOptions.GetControl("TextField7").Peer.Text
oOptions.Model.TextField17.Enabled = False
Else
oOptions.Model.TextField8.Enabled=True
oOptions.Model.TextField9.Enabled=True
oOptions.Model.TextField10.Enabled=True
oOptions.Model.TextField11.Enabled=True
oOptions.Model.TextField12.Enabled=True
oOptions.Model.TextField15.Enabled=True
oOptions.Model.TextField16.Enabled=True
oOptions.Model.TextField17.Enabled=True
Endif
RecupereOptions(sOptionsTraceCourbe)
oOptions.Execute()
End Sub
Rem Close
Sub ValiderOptions rem mis au point le 3 janvier 2003
oOptions.EndExecute()
End Sub
Function CT(Entier as Integer) as String rem code le TextField numero Entier
CT = LaBoite.getControl("TextField"&Cstr(Entier)).Peer.Text
End Function
Function CC(Entier as Integer) as String rem code le CheckBox numero Entier
CC = LaBoite.getControl("CheckBox"&Cstr(Entier)).State
End Function
Function CO(Entier as Integer) as String rem code le CheckBox numero Entier
If LaBoite.getControl("OptionButton"&Cstr(Entier)).State = True Then
CO = "1"
Else
CO = "0"
Endif
End Function
rem diverses macro
'--------------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------------
Sub LanceGraphPlotter rem ouvre le fichier du module GraphPlotter ecrit le 24 janvier 2004 modifiee le 11 avril 2009
rem corrigee le 21 mars 2010
Call VerifOperationnel
Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
Dim oPage as Object
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocumentCourant = ThisComponent
sGraphPlotter = sChemindmaths + "GraphPlotter.otg"
oDocGraphPlotter = oDesktop.LoadComponentFromURL(sGraphPlotter,"_blank",0,mFileProperties())
oPage = oDocGraphPlotter.Drawpages(0)
Select Case iLang
Case 0
oPage.Forms(0).GetByName("PushButton1").Label = "Tracer Axes "
oPage.Forms(0).GetByName("PushButton2").Label = "Terminer"
oPage.Forms(0).GetByName("PushButton3").Label = "Tracer Courbes"
Case 1
oPage.Forms(0).GetByName("PushButton1").Label = "Draw Axes"
oPage.Forms(0).GetByName("PushButton2").Label = "End"
oPage.Forms(0).GetByName("PushButton3").Label = "Draw Graphs"
Case 2
oPage.Forms(0).GetByName("PushButton1").Label = "Zeichne Achsen"
oPage.Forms(0).GetByName("PushButton2").Label = "Beenden"
oPage.Forms(0).GetByName("PushButton3").Label = "Zeichne Graphen"
End Select
End Sub
Sub Axeencm rem mis au point le 3 janvier 2003 modifiee le 11 avril 2009
If oRepfonctions.Model.OptionButton6.State = 0 Then
If oRepfonctions.Model.OptionButton2.State = 1 Then
oRepfonctions.Model.TextField6.Text = CsngPlus(oRepfonctions.GetControl("TextField2").Peer.Text)*0.5
oRepfonctions.Model.TextField9.Text = CsngPlus(oRepfonctions.GetControl("TextField3").Peer.Text)*0.5
oRepfonctions.Model.CheckBox6.State=1
oRepfonctions.Model.CheckBox6.Enabled=True
oRepfonctions.Model.CheckBox7.State=1
oRepfonctions.Model.CheckBox7.Enabled=True
Elseif oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton5.State=1 Then
oRepfonctions.Model.TextField6.Text = oRepfonctions.GetControl("TextField2").Peer.Text
oRepfonctions.Model.TextField9.Text = oRepfonctions.GetControl("TextField3").Peer.Text
oRepfonctions.Model.CheckBox6.State=1
oRepfonctions.Model.CheckBox6.Enabled=True
oRepfonctions.Model.CheckBox7.State=1
oRepfonctions.Model.CheckBox7.Enabled=True
Elseif oRepfonctions.Model.OptionButton3.State=1 Then
oRepfonctions.Model.TextField6.Text = CsngPlus(oRepfonctions.GetControl("TextField2").Peer.Text)*0.1
oRepfonctions.Model.TextField9.Text = CsngPlus(oRepfonctions.GetControl("TextField3").Peer.Text)*0.1
Elseif oRepfonctions.Model.OptionButton4.State=1 Then
oRepfonctions.Model.TextField6.Text = CsngPlus(oRepfonctions.GetControl("TextField2").Peer.Text)*0.2
oRepfonctions.Model.TextField9.Text = CsngPlus(oRepfonctions.GetControl("TextField3").Peer.Text)*0.2
Endif
oRepfonctions.Model.TextField6.Enabled=False
oRepfonctions.Model.TextField9.Enabled=False
Endif
' oOptions.Model.OptionButton8.State=1
End Sub
Sub Axeenunite rem mis au point le 3 janvier 2003
If (oRepfonctions.Model.OptionButton6.State=1 or oRepfonctions.Model.OptionButton2.State=1) Then
oRepfonctions.Model.TextField6.Enabled = True
oRepfonctions.Model.TextField9.Enabled = True
oRepfonctions.Model.TextField6.Text = 1
oRepfonctions.Model.TextField9.Text = 1
oRepfonctions.Model.CheckBox6.State = 1
oRepfonctions.Model.CheckBox6.Enabled = True
oRepfonctions.Model.CheckBox7.State = 1
oRepfonctions.Model.CheckBox7.Enabled = True
Endif
' oOptions.Model.OptionButton8.State=1
End Sub
Function DetermineColor rem mis au point le 3 janvier 2003
Dim iColorNumber as Long
If oOptions.Model.OptionButton7.State=1 Then
iColorNumber=oOptions.Model.ImageControl7.BackGroundColor
Elseif oOptions.Model.OptionButton8.State=1 Then
iColorNumber=oOptions.Model.ImageControl8.BackGroundColor
Elseif oOptions.Model.OptionButton9.State=1 Then
iColorNumber=oOptions.Model.ImageControl9.BackGroundColor
Elseif oOptions.Model.OptionButton10.State=1 Then
iColorNumber=oOptions.Model.ImageControl10.BackGroundColor
Elseif oOptions.Model.OptionButton11.State=1 Then
iColorNumber=oOptions.Model.ImageControl11.BackGroundColor
Elseif oOptions.Model.OptionButton12.State=1 Then
iColorNumber=oOptions.Model.ImageControl12.BackGroundColor
Elseif oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1 Then
iColorNumber=oOptions.Model.ImageControl8.BackGroundColor
Else
iColorNumber=oOptions.Model.ImageControl7.BackGroundColor
Endif
DetermineColor=iColorNumber
End Function
Function createLine (oDocument,oPage,x1,y1,x2,y2,iNumero) As Object rem mis au point le 3 janvier 2003
Dim aPoint As New com.sun.star.awt.Point
Dim aSize As New com.sun.star.awt.Size
Dim oLine as Object
oLine = oDocument.createInstance("com.sun.star.drawing.LineShape")
' Xray oLine
rem: on trace une graduation
If oRepfonctions.Model.OptionButton3.State=1 or oRepfonctions.Model.OptionButton4.State=1 Then
If (iNumero mod 10)=0 Then
oLine.LineWidth=Csng(oOptions.getControl("TextField4").Peer.Text)*3
Elseif (iNumero mod 5)=0 Then
oLine.LineWidth=Csng(oOptions.getControl("TextField4").Peer.Text)*2
Else
oLine.LineWidth=Csng(oOptions.getControl("TextField4").Peer.Text)
Endif
Else
If (iNumero mod 5)=0 Then
oLine.LineWidth=Csng(oOptions.getControl("TextField3").Peer.Text)
Else
oLine.LineWidth=Csng(oOptions.getControl("TextField2").Peer.Text)
Endif
Endif
oLine.LineColor = DetermineColor
rem: ligne pointill�e
If (oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1) and oRepfonctions.Model.CheckBox10.State=0 Then
Dim aLineDash As New com.sun.star.drawing.LineDash
with aLineDash
.Style = com.sun.star.drawing.DashStyle.ROUND
.Dots = 1
.Dashes = 2 'number of lines
.DotLen = 5 'dimension of lines
.Distance = 40 'distance
end With
Endif
oPage.add(oLine)
' Xray oLine
If (oRepfonctions.Model.OptionButton1.State=1 or oRepfonctions.Model.OptionButton2.State=1) and oRepfonctions.Model.CheckBox10.State=0 Then
with oLine
.LineStyle = com.sun.star.drawing.LineStyle.DASH
.LineDash = aLineDash
end with
Endif
Dim points(1) As New com.sun.star.awt.Point
points(0).x = x1
points(0).y = y1
points(1).x = x2
points(1).y = y2
aLineShape = oLine.PolyPolygon
aLineShape = Array(points())
oLine.PolyPolygon = aLineShape
createLine = oLine
End Function
Function Createmarque (oDocument,oPage,x1,y1,x2,y2,iColor, Optional bAnchorATPage ) As Object rem mis au point le 3 janvier 2003
Dim aPoint As New com.sun.star.awt.Point
Dim aSize As New com.sun.star.awt.Size
Dim oLine as Object
oLine = oDocument.createInstance("com.sun.star.drawing.LineShape")
rem: on trace une graduation
oLine.LineWidth=Csng(oOptions.getControl("TextField1").Peer.Text)
' Print Csng(oOptions.getControl("TextField1").Peer.Text)
oLine.LineColor=iColor
If bAnchorATPage = True Then oLine.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
oPage.add(oLine)
Dim points(1) As New com.sun.star.awt.Point
points(0).x = x1
points(0).y = y1
points(1).x = x2
points(1).y = y2
aLineShape = oLine.PolyPolygon
aLineShape = Array(points())
oLine.PolyPolygon = aLineShape
' oLine.LineWidth = 80
Createmarque = oLine
End Function
Sub FdeX(sFormul as String,Numero as Integer) rem mis au point le 3 janvier 2003
Dim Longueur,N,I1,I2,P as Integer
rem Si Plott alors N=nombre de points
Dim Plott as Boolean rem Plott=True si Plott
bParam(Numero)=False
N=0
Plott=False
Longueur=Len(sFormul)
' Print sFormul
rem Determine si Plott
NiveauParenthese=0
LastSC=0
For I=1 To Longueur
CurChar=Mid(sFormul,I,1)
if instr("({[",CurChar) then NiveauParenthese=NiveauParenthese+1
if instr(")}]",CurChar) then NiveauParenthese=NiveauParenthese-1
If Mid(sFormul,I,1)=";" and NiveauParenthese=0 Then
N=N+1
LastSC=I
Endif
Next I
Rem si N=1 alors la courbe est parametrique
If N>=2 Then
Plott=True
If Instr(sFormul,";;;")>0 Then
Dmaths.Module5.Avertir(14)
bError=True
rem marque l'erreur
Goto Fin
ElseIf Instr(sFormul,";;")>0 Then
I1 = 1
I2 = Instr(sFormul,";;")
Do Until I2 > Longueur
If Instr(I2,sFormul,";;")>0 Then I2 = Instr(I2,sFormul,";;") Else I2 = Longueur
CompteurPV = 0
For I = I1 To I2-1
If Mid(sFormul,I,1) = ";" Then CompteurPV = CompteurPV + 1
Next I
If (CompteurPV >=3 or CompteurPV=0) Then
Dmaths.Module5.Avertir(14)
bError=True
Goto Fin
Endif
I1 = I2 + 2
I2 = I2 + 2
Loop
ElseIf N>39 Then
Dmaths.Module5.Avertir(15)
bError=True
Goto Fin
ElseIf 2*Int(N/2)=N Then
Dmaths.Module5.Avertir(14)
bError=True
rem marque l'erreur
Goto Fin
EndIf
Endif
If Plott=True Then
Dim oSheet,oCell as Object
If bNewcalc = False Then
rem chargement du fichier tableur
oDesktop=createUnoService("com.sun.star.frame.Desktop")
Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
mFileProperties(0).Name = "Hidden"
rem fichier cache
mFileProperties(0).Value = True
sCalc = sChemindmathsODS
oNewCalc = oDesktop.LoadComponentFromURL(sCalc,"_blank",0,mFileProperties())
bNewCalc=True
Endif
oSheet=oNewCalc.Sheets(0)
oCell=GetCell(oSheet,1,0)
P=0 rem num�ro du point trait�
I2=0
If Instr(sFormul,";;")>0 Then
Dim Valeur(1 to 3) as String
Dim NombrePV,NombreDPV as Integer rem compte les pointvirgule et les doubles
I1=1
NombreDPV = 1
NombrePV = 0
Do While I1<Longueur
For I=1 To 3
Valeur(I)="nondef"
Next I
Do While (Mid(sFormul,I1,1)<>";" and I1<=Longueur)
Do While (Mid(sFormul,I1+I2,1)<>";" and I1+I2<=Longueur)
I2 = I2+1
Loop
NombrePV = NombrePV + 1
Valeur(NombrePV) = Mid(sFormul,I1,I2)
I1 = I1+I2+1
I2 = 0
Loop
If NombreDPV = 1 Then
For I=1 To 3
'Print Valeur(1)
oCell=GetCell(oSheet,I,3)
oCell.SetValue(Csng(Valeur(1))^I)
oCell=GetCell(oSheet,I,4)
oCell.SetValue(I*Csng(Valeur(1))^(I-1))
Next I
oCell=GetCell(oSheet,40,3)
oCell.SetValue(Csng(Valeur(2))
oCell=GetCell(oSheet,40,4)
If Valeur(3)="nondef" Then oCell.SetValue(0) Else oCell.SetValue(Csng(Valeur(3))
Elseif I1<Longueur Then
For I=0 To 3
oCell=GetCell(oSheet,I+(NombreDPV-2)*4,5+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(1))^I)
oCell=GetCell(oSheet,I+(NombreDPV-2)*4,6+(NombreDPV-2)*4)
If I=0 Then oCell.SetValue(0) Else oCell.SetValue(I*Csng(Valeur(1))^(I-1))
Next I
oCell=GetCell(oSheet,40,5+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(2))
If Valeur(3)="nondef" Then
For I=0 To 3
oCell=GetCell(oSheet,I+(NombreDPV-1)*4,6+(NombreDPV-2)*4)
If I=0 Then oCell.SetValue(0) Else oCell.SetValue(-1*I*Csng(Valeur(1))^(I-1))
oCell=GetCell(oSheet,I+(NombreDPV-2)*4,7+(NombreDPV-2)*4)
If (I=0 or I=1) Then oCell.SetValue(0) Else oCell.SetValue(0.5*I*(I-1)*Csng(Valeur(1))^(I-2))
oCell=GetCell(oSheet,I+(NombreDPV-1)*4,7+(NombreDPV-2)*4)
If (I=0 or I=1) Then oCell.SetValue(0) Else oCell.SetValue(-0.5*I*(I-1)*Csng(Valeur(1))^(I-2))
oCell=GetCell(oSheet,I+(NombreDPV-1)*4,8+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(1))^(I))
Next I
oCell=GetCell(oSheet,40,6+(NombreDPV-2)*4)
oCell.SetValue(0)
oCell=GetCell(oSheet,40,7+(NombreDPV-2)*4)
oCell.SetValue(0)
oCell=GetCell(oSheet,40,8+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(2))
Else
oCell=GetCell(oSheet,40,6+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(3))
oCell=GetCell(oSheet,40,7+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(2))
oCell=GetCell(oSheet,40,8+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(3))
For I=0 To 3
oCell=GetCell(oSheet,I+(NombreDPV-1)*4,3+(NombreDPV-1)*4)
oCell.SetValue(Csng(Valeur(1))^I)
oCell=GetCell(oSheet,I+(NombreDPV-1)*4,4+(NombreDPV-1)*4)
If I=0 Then oCell.SetValue(0) Else oCell.SetValue(I*Csng(Valeur(1))^(I-1))
Next I
Endif
Else
For I=0 To 3
oCell=GetCell(oSheet,I+(NombreDPV-2)*4,5+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(1))^I)
oCell=GetCell(oSheet,I+(NombreDPV-2)*4,6+(NombreDPV-2)*4)
If I=0 Then oCell.SetValue(0) Else oCell.SetValue(I*Csng(Valeur(1))^(I-1))
Next I
oCell=GetCell(oSheet,40,5+(NombreDPV-2)*4)
oCell.SetValue(Csng(Valeur(2))
oCell=GetCell(oSheet,40,6+(NombreDPV-2)*4)
If Valeur(3)="nondef" Then oCell.SetValue(0) Else oCell.SetValue(Csng(Valeur(3))
Endif
sNewFormulSpline(Numero,NombreDPV-1,1) = Valeur(1)
NombrePV = 0
I1 = I1 + 1
NombreDPV = NombreDPV + 1
Loop
rem ecriture des formules trouv�es
For J = 0 To NombreDPV-3
oCell=GetCell(oSheet,41,3+4*J)
sNewFormulSpline(Numero,J,0) = TransfDecimal(cStr(oCell.GetValue()))
For I=1 To 3
oCell=GetCell(oSheet,41,3+4*J+I)
sNewFormulSpline(Numero,J,0) = sNewFormulSpline(Numero,J,0)&"+"&TransfDecimal(cStr(oCell.GetValue()))&"*x^"&cStr(I)
Next I
sNewFormulSpline(Numero,J,0) = RemplaceVirgule(sNewFormulSpline(Numero,J,0))
rem nettoie la feuille oSheet
If (oRepfonctions.Model.CheckBox9.State=1 and bOntrace=False) Then
Print "Fonction "&CStr(Numero+1) & " Intervalle ["& sNewFormulSpline(Numero,J,1)&" ; " & sNewFormulSpline(Numero,J+1,1) & "] : f(x)=" & sNewFormulSpline(Numero,J,0)
Endif
Next J
sNewFormul(Numero,1)="Spline cubique"
'Print "stop"
FormaTableau(oSheet,4*(NombreDPV-2))
Else
N=Int(N/2)+1
I1=1
Do While P<>N
oCell=GetCell(oSheet,0,P+3)
oCell.SetValue(1)
Do While Mid(sFormul,I1+I2,1)<>";"
I2=I2+1
Loop
For I=1 To N-1
oCell=GetCell(oSheet,I,P+3)
oCell.SetValue(Csng(Mid(sFormul,I1,I2))^I)
Next I
I1=I1+I2+1
I2=0
Do While (Mid(sFormul,I1+I2,1)<>";" and I1+I2<>Longueur)
I2=I2+1
Loop
If I1+I2=Longueur Then I2=I2+1
oCell=GetCell(oSheet,40,3+P)
oCell.SetValue(Csng(Mid(sFormul,I1,I2)))
I1=I1+I2+1
I2=0
P=P+1
Loop
rem calcule l'expression du polynome
oCell=GetCell(oSheet,41,3)
Print oCell.Value
sNewFormul(Numero,1) = TransfDecimal(cStr(oCell.GetValue()))
For I=1 To N-1
oCell=GetCell(oSheet,41,3+I)
sNewFormul(Numero,1) = sNewFormul(Numero,1)&"+"&TransfDecimal(cStr(oCell.GetValue()))&"*x^"&cStr(I)
Next I
sNewFormul(Numero,1) = RemplaceVirgule(sNewFormul(Numero,1))
rem nettoie la feuille oSheet
FormaTableau(oSheet,N)
rem affiche les coefficients
If (oRepfonctions.Model.CheckBox9.State=1 and bOntrace=False) Then
Endif
Endif
Else
sNewFormul(Numero,1)=RemplaceVirgule(sFormul)
'Print sFormul
If Mid(sFormul,1,2)="x=" Then
bParalleleOrdonnees(Numero)=True
Endif
If N=1 Then
NiveauParenthese=0
For I=1 To Longueur
CurChar=Mid(sNewFormul(Numero,1),I,1)
if instr("({[",CurChar) then NiveauParenthese=NiveauParenthese+1
if instr(")}]",CurChar) then NiveauParenthese=NiveauParenthese-1
If CurChar=";" and NiveauParenthese=0 Then
N=I
Endif
Next I
bParam(Numero)=True
If N=Longueur-1 and Mid(sNewFormul(Numero,1),N+1,1)="P" Then
sNewFormul(Numero,0)="("+Mid(sNewFormul(Numero,1),1,N-1)+")*cos(x)"
sNewFormul(Numero,1)="("+Mid(sNewFormul(Numero,1),1,N-1)+")*sin(x)"
Else
sNewFormul(Numero,0)=Mid(sNewFormul(Numero,1),1,N-1)
sNewFormul(Numero,1)=Mid(sNewFormul(Numero,1),N+1,Longueur-N)
Endif
Endif
EndIf
Fin:
If bError = True Then oRepfonctions.Visible = True
End Sub
Sub Plottfonctions
Dim K,I1,I2,K1 as integer
Dim thechaine as string
oRepFonctions.Visible = False
oPlott = LoadDialog("Dmaths","RepFoncPlott")
thechaine = oRepFonctions.getControl("TextField1").Peer.Text
If Instr(thechaine,";;")>0 Then
I1=1
K = 0 : K1 = 1
Do While I1<Len(thechaine)
Do While (Mid(thechaine,I1,1)<>";" and I1<=Len(thechaine))
Do While (Mid(thechaine,I1+I2,1)<>";" and I1+I2<=Len(thechaine))
I2 = I2+1
Loop
K = K + 1
Select Case K
Case 1:
oPlott.getControl("vx"&Cstr(K1)).Text = Mid(thechaine,I1,I2)
Case 2:
oPlott.getControl("vf"&Cstr(K1)).Text = Mid(thechaine,I1,I2)
Case 3:
oPlott.getControl("vfp"&Cstr(K1)).Text = Mid(thechaine,I1,I2)
End Select
I1 = I1+I2+1
I2 = 0
Loop
K = 0
K1 = K1 + 1
I1 = I1 + 1
Loop
Endif
exitOK = com.sun.star.ui.dialogs.ExecutableDialogResults.OK
If oPlott.Execute = ExitOK Then
' Xray oPlott.getControl("vx1")
If (Len(oPlott.getControl("vx1").Peer.Text)>0 and Len(oPlott.getControl("vf1").Peer.Text)>0) Then
thechaine = oPlott.getControl("vx1").Peer.Text & ";" & oPlott.getControl("vf1").Peer.Text
If Len(oPlott.getControl("vfp1").Text)>0 Then thechaine = thechaine & ";" & oPlott.getControl("vfp1").Text
K = 2
Do while (Len(oPlott.getControl("vx"&Cstr(K)).Peer.Text)>0 and Len(oPlott.getControl("vf"&Cstr(K)).Peer.Text)>0 and K<=11)
thechaine = thechaine & ";;"
thechaine = thechaine & oPlott.getControl("vx"&Cstr(K)).Peer.Text & ";" & oPlott.getControl("vf"&Cstr(K)).Peer.Text
If Len(oPlott.getControl("vfp"&Cstr(K)).Peer.Text)>0 Then thechaine = thechaine & ";" & oPlott.getControl("vfp"&Cstr(K)).Peer.Text
K = K+1
Loop
oRepFonctions.getControl("TextField1").Text = thechaine
oRepFonctions.Visible = True
Endif
Endif
oRepFonctions.Visible = True
End Sub
</script:module>
|