1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="svx_SvxShapePolyPolygonBezier" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32'*************************************************************************
33
34
35
36' Be sure that all variables are dimensioned:
37option explicit
38
39
40' REQUIRED VARIABLES for interface/service tests:
41
42' Requiered for  com.sun.star.lang.XComponent
43 Global oComponentInstance As Object ' it will be disposed
44
45' Requiered for  com.sun.star.drawing.XShapeDescriptor
46 Global cShapeType As String
47
48' Requiered for  com.sun.star.text.XText
49 Global oInstance As Object
50
51
52Sub CreateObj()
53
54'*************************************************************************
55' COMPONENT:
56' svx.SvxShapePolyPolygonBezier
57'*************************************************************************
58On Error Goto ErrHndl
59
60    Dim bOK As Boolean
61    bOK = true
62
63    oDoc = utils.loadTestDocument("SvxShape.sxd")
64
65    cShapeType = "com.sun.star.drawing.ClosedBezierShape"
66
67    oObj = oDoc.createInstance("com.sun.star.drawing.ClosedBezierShape")
68    oDoc.DrawPages(0).add(oObj)
69    Dim oSize As new com.sun.star.awt.Size
70    Dim oPosition As new com.sun.star.awt.Point
71    oSize.Width = 5000
72    oSize.Height = 5000
73    oPosition.X = 4000
74    oPosition.Y = 4000
75    oObj.Size = oSize
76    oObj.Position = oPosition
77
78    oComponentInstance = oDoc.createInstance("com.sun.star.drawing.ClosedBezierShape")
79    oDoc.DrawPages(0).add(oComponentInstance)
80    oSize.Width = 8000
81    oSize.Height = 8000
82    oPosition.X = 4000
83    oPosition.Y = 4000
84    oComponentInstance.Size = oSize
85    oComponentInstance.Position = oPosition
86
87    Dim ps1(3) As new com.sun.star.awt.Point
88    Dim pf1(3) As Integer
89    with com.sun.star.drawing.PolygonFlags
90
91    ps1(0).X = 5000 : ps1(0).Y = 5000 : pf1(0) = .NORMAL
92    ps1(1).X = 10000 : ps1(1).Y = 5000 : pf1(1) = .CONTROL
93    ps1(2).X = 10000 : ps1(2).Y = 10000 : pf1(2) = .CONTROL
94    ps1(3).X = 5000 : ps1(3).Y = 10000 : pf1(3) = .NORMAL
95
96    Dim ps2(3) As new com.sun.star.awt.Point
97    Dim pf2(3) As Integer
98    ps2(0).X = 6500 : ps2(0).Y = 6500 : pf2(0) = .NORMAL
99    ps2(1).X = 8500 : ps2(1).Y = 6500 : pf2(1) = .CONTROL
100    ps2(2).X = 8500 : ps2(2).Y = 8500 : pf2(2) = .CONTROL
101    ps2(3).X = 6500 : ps2(3).Y = 8500 : pf2(3) = .NORMAL
102    end with
103
104    Dim psA As Variant
105    psA = Array( ps1(), ps2() )
106
107    Dim oFlags As Variant
108    oFlags = Array( pf1(), pf2() )
109
110    Dim oCoords As New com.sun.star.drawing.PolyPolygonBezierCoords
111    oCoords.Coordinates = psA()
112    oCoords.Flags = oFlags()
113
114    oInstance = oDoc.createInstance("com.sun.star.text.TextField.DateTime")
115
116    oObj.PolyPolygonBezier = oCoords
117Exit Sub
118ErrHndl:
119    Test.Exception()
120End Sub
121</script:module>
122