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="sd_SdDrawPage" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31
32' REQUIRED VARIABLES for interface/service tests:
33Global oXShapeInstance As Object
34Global oGrouperCollection AS Object
35Global oCombinerCollection As Object
36Global oBinderCollection As Object
37
38
39Sub CreateObj()
40
41'*************************************************************************
42' COMPONENT:
43' sd.SdDrawPage
44'*************************************************************************
45On Error Goto ErrHndl
46
47    Dim bOK As Boolean
48    bOK = true
49
50    oDoc = utils.createDocument("sdraw", cObjectName)
51
52    oXShapeInstance = oDoc.createInstance("com.sun.star.drawing.RectangleShape")
53
54    oObj = oDoc.DrawPages.getByIndex(0)
55    oGrouperCollection = createUNOService("com.sun.star.drawing.ShapeCollection")
56    oCombinerCollection = createUNOService("com.sun.star.drawing.ShapeCollection")
57    oBinderCollection = createUNOService("com.sun.star.drawing.ShapeCollection")
58
59    addShape(oObj, 1000, 1000)
60    addShape(oObj, 5000, 5000)
61    addShape(oObj, 2000, 2000)
62    addShape(oObj, 3000, 3000)
63    addShape(oObj, 4000, 4000)
64    addShape(oObj, 5000, 5000)
65    addShape(oObj, 6000, 6000)
66    addShape(oObj, 7000, 7000)
67
68    oGrouperCollection.Add(oObj.getByIndex(0))
69    oGrouperCollection.Add(oObj.getByIndex(1))
70    oCombinerCollection.Add(oObj.getByIndex(2))
71    oCombinerCollection.Add(oObj.getByIndex(3))
72    oBinderCollection.Add(oObj.getByIndex(4))
73    oBinderCollection.Add(oObj.getByIndex(5))
74
75
76Exit Sub
77ErrHndl:
78    Test.Exception()
79End Sub
80
81sub AddShape(oPage as Object, nPosX as Integer, nPosY as Integer)
82    Dim aPoint As New com.sun.star.awt.Point
83    Dim aSize As New com.sun.star.awt.Size
84    Dim oRectangleShape As Object
85
86    aPoint.x = nPosX
87    aPoint.y = nPosY
88    aSize.Width = 10000
89    aSize.Height = 10000
90    oRectangleShape = oDoc.createInstance("com.sun.star.drawing.RectangleShape")
91    oRectangleShape.Size = aSize
92    oRectangleShape.Position = aPoint
93    oRectangleShape.FillColor = RGB(255, 0, 0)
94    oPage.add(oRectangleShape)
95End Sub
96
97Sub DisposeObj()
98    if hasUnoInterfaces(oDoc, "com.sun.star.lang.XComponent") then
99        oDoc.Dispose()
100    end if
101End Sub
102</script:module>
103