/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths2/AxesSetup.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 | <?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="AxesSetup" script:language="StarBasic">'************************************************
'Copyright (C) Andy Lewis. (lewiss@ntlworld.com)
'téléchargé sur www.ooomacros.org
'
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU Lesser General Public Licence (LGPL)
'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
'************************************************
'Routines connected with setting up a custom coordinate system defined by the four public
'variables below. Requires "DrawModule".
Option Explicit
public AxesParametres as Boolean 'true si les axes sont paramétrés
public gsScaleLeft as single
public gsScaleRight as single
public gsScaleTop as single
public gsScaleBottom as single
private glXScaleFactor as single
private glYScaleFactor as single
private gsCurrentX as single
private gsCurrentY as single
'___________________________________________________________________________________________
'Sets up the custom coordinate area using 4 input parameters
sub InitialiseGraphArea(ScaleLeft as Single, ScaleRight as Single, ScaleBottom as Single, ScaleTop as Single)
gsScaleLeft=ScaleLeft
gsScaleRight=ScaleRight
gsScaleTop=ScaleTop
gsScaleBottom=ScaleBottom
glXScaleFactor=glDiagramWidth/(gsScaleRight-gsScaleLeft)
glYScaleFactor=glDiagramHeight/(gsScaleTop-gsScaleBottom)
end sub
'___________________________________________________________________________________________
'Clear the page, except for the command buttons
sub ClearDrawPage2()
Dim ShapeCount as integer, Index as integer, Shape as object
ShapeCount = goPage.Count
For Index = ShapeCount - 1 to 0 Step -1
Shape = goPage.getByIndex(Index)
If Shape.GetShapeType()<>"com.sun.star.drawing.ControlShape" then goPage.remove( Shape )
Next Index
End Sub
'___________________________________________________________________________________________
'Create and return a new Point object.
'The coordinates are converted from those defined by the custom coordinate area
'to what OOo expects ie (0,0) at top left.
Function ScalePoint( x As single, y As single ) As object
Dim aPoint As New com.sun.star.awt.Point
dim newx as long, newy as long
newx = CLng((x-gsScaleLeft)*glxscalefactor)
newy = CLng((y-gsScaleBottom)*glyscalefactor)
aPoint.x = glDiagramLeft+newx
aPoint.y = glDiagramBottom-newy
ScalePoint() = aPoint
End Function
'___________________________________________________________________________________________
'Create and return a new Size object.
'The scaling is converted from that defined by the user
'to what OOo expects ie 1/1000s of a cm
Function ScaleSize( width As single, height As single ) As object
Dim aSize As New com.sun.star.awt.Size
aSize.width = width*glXScaleFactor
aSize.height = -height*glYScaleFactor
ScaleSize() = aSize
End Function
'___________________________________________________________________________________________
' Draw a line from (x1,y1) to (x2,y2) in the custom coordinate system.
'Optional style parameters can be supplied;if omitted, defaults defined in DrawModule are used
'Optionally, a ShapeCollection object can be supplied, in which case the line drawn will be
' added to this collection.
Function DrawScaleLine( x1 As single, y1 As single, x2 As single, y2 As single,_
optional LineColor, optional LineWidth, optional LineStyle, optional Collection) as object
' Create the line shape
if IsMissing(collection) then
DrawScaleLine = DrawLineShape(ScalePoint(x1, y1), ScaleSize(x2-x1, y2-y1),LineColor, Linewidth,LineStyle)
else
DrawScaleLine = DrawLineShape(ScalePoint(x1, y1), ScaleSize(x2-x1, y2-y1),LineColor, Linewidth,LineStyle,Collection)
end if
'Set the cursor to the end of the line
gsCurrentX = x2
gsCurrentY = y2
End Function
'___________________________________________________________________________________________
' Draw a line from the current position to (x,y) in the custom coordinate system.
'See above for optional parameters.
Function DrawScaleLineTo(x As single, y As single, optional LineColor,_
optional LineWidth, optional LineStyle, optional Collection) as object
If IsMissing(Collection) then
DrawScaleLineTo=DrawScaleLine(gsCurrentX, gsCurrentY, x, y, LineColor, LineWidth, LineStyle)
else
DrawScaleLineTo=DrawScaleLine(gsCurrentX, gsCurrentY, x, y, LineColor, LineWidth, LineStyle, Collection)
end if
End Function
</script:module>
|