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_SdUnoDrawView" 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' Be sure that all variables are dimensioned:
32option explicit
33
34
35' REQUIRED VARIABLES for interface/service tests:
36
37' Required for drawing.XDrawView
38Global oPages As Object
39
40' Required for frame.XController
41Global oFrameToAttach As Object
42Global oModelToAttach As Object
43Global bHasNoViewData As Boolean
44Global oObjToSuspend As Object
45Global bHasNoModel As Boolean
46
47' Required for lang.XComponent
48Global oComponentInstance As Object
49
50' Required for frame.XDispatchProvider
51Global dispatchUrl As String
52
53' Required for view.XSelectionSupplier
54Global SelectableObj1 As Object
55Global SelectableObj2 As Object
56
57Global oSecDoc As Object
58
59
60Sub CreateObj()
61
62'*************************************************************************
63' COMPONENT:
64' sd.SdUnoDrawView
65'*************************************************************************
66On Error Goto ErrHndl
67    Dim bOK As Boolean
68    bOK = true
69
70    oDoc = utils.createDocument("sdraw", cObjectName)
71
72    oObj = oDoc.getCurrentController()
73
74    oPages = oDoc.getDrawPages()
75
76    oSecDoc = utils.createDocument("sdraw", "For frame.XController")
77    bHasNoViewData = false
78    bHasNoModel = false
79    oObjToSuspend = oObj
80    oFrameToAttach = StarDesktop.getCurrentFrame()
81    oModelToAttach = oSecDoc
82
83    oComponentInstance = oObj
84
85    dispatchUrl = "slot:27009"
86
87    Dim page As Object
88    page = oPages.getByIndex(0)
89    AddShape(page, 100, 100)
90    AddShape(page, 12000, 100)
91
92    SelectableObj1 = page.getByIndex(0)
93    SelectableObj2 = page.getByIndex(1)
94Exit Sub
95ErrHndl:
96    Test.Exception()
97End Sub
98
99Sub DisposeObj()
100    oSecDoc.dispose()
101End Sub
102
103sub AddShape(oPage as Object, nPosX as Integer, nPosY as Integer)
104    Dim aPoint As New com.sun.star.awt.Point
105    Dim aSize As New com.sun.star.awt.Size
106    Dim oRectangleShape As Object
107
108    aPoint.x = nPosX
109    aPoint.y = nPosY
110    aSize.Width = 10000
111    aSize.Height = 10000
112    oRectangleShape = oDoc.createInstance("com.sun.star.drawing.RectangleShape")
113    oRectangleShape.Size = aSize
114    oRectangleShape.Position = aPoint
115    oRectangleShape.FillColor = RGB(255, 0, 0)
116    oPage.add(oRectangleShape)
117End Sub
118</script:module>
119