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_SdUnoPresView" 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
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41
42' REQUIRED VARIABLES for interface/service tests:
43
44' Required for frame.XController
45Global oFrameToAttach As Object
46Global oModelToAttach As Object
47Global bHasNoViewData As Boolean
48Global oObjToSuspend As Object
49Global bHasNoModel As Boolean
50
51' Required for lang.XComponent
52Global oComponentInstance As Object
53
54' Required for frame.XDispatchProvider
55Global dispatchUrl As String
56
57' Required for drawing.XDrawView
58Global oPages As Variant
59
60' Required for awt.XWindow
61Global oXWindow As Object
62Global oCtrlShape as Object
63
64Global oSecDoc As Object
65
66
67Sub CreateObj()
68
69'*************************************************************************
70' COMPONENT:
71' sd.SdUnoPresView
72'*************************************************************************
73On Error Goto ErrHndl
74    Dim bOK As Boolean
75    Dim oDP As Object, oDP1 As Object
76    Dim oDPs As Object
77    bOK = true
78
79    oDoc = utils.createImpressDocument(cObjectName)
80    oSecDoc = utils.createImpressDocument(cObjectName+"1")
81    wait(500)
82
83    oDPs = oDoc.getDrawPages()
84    oDP = oDPs.getByIndex(0)
85    oDPs.insertNewByIndex(0)
86    oDP1 = oDPs.getByIndex(1)
87
88    addShape(oDP, 1000, 1000, "Rectangle")
89    addShape(oDP, 5000, 5000, "Ellipse")
90
91    oObj = oDoc.getCurrentController()
92
93    ' For XDrawPages
94    oPages = oDoc.getDrawPages()
95
96    ' For XComponent
97    oComponentInstance = oObj
98
99    ' For XDispatchProvider
100    dispatchUrl = "slot:27009"
101
102    ' For frame.XController
103    oFrameToAttach = StarDesktop.getCurrentFrame()
104    oModelToAttach = oSecDoc
105    bHasNoViewData = false
106    bHasNoModel = false
107    oObjToSuspend = oObj
108
109    ' For awt.XWindow
110    oXWindow = utils.at_getCurrentWindow(oSecDoc)
111
112Exit Sub
113ErrHndl:
114    Test.Exception()
115End Sub
116
117Sub DisposeObj()
118    oDoc.dispose()
119    oSecDoc.dispose()
120End Sub
121
122Sub addShape(oPage as Object, nPosX as Integer, nPosY as Integer, oType As String)
123    Dim aPoint As New com.sun.star.awt.Point
124    Dim aSize As New com.sun.star.awt.Size
125    Dim oRectangleShape As Object
126
127    aPoint.x = nPosX
128    aPoint.y = nPosY
129    aSize.Width = 2000
130    aSize.Height = 1000
131    oRectangleShape = oDoc.createInstance("com.sun.star.drawing."+oType+"Shape")
132    oRectangleShape.Size = aSize
133    oRectangleShape.Position = aPoint
134    oRectangleShape.FillColor = RGB(128, 255, 0)
135    oPage.add(oRectangleShape)
136End Sub
137
138</script:module>
139