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_SdGenericDrawPage" script:
language=
"StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 ' Copyright
2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: sd_SdGenericDrawPage.xba,v $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version
3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version
3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version
3 along with OpenOffice.org. If not, see
32 '
<http://www.openoffice.org/license.html
>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
44 ' REQUIRED VARIABLES for interface/service tests:
45 Global oGrouperCollection AS Object
46 Global oCombinerCollection As Object
47 Global oBinderCollection As Object
49 'Required for com.sun.star.drawing.XShapes
50 Global oXShapeInstance As Object 'to add/remove
55 '*************************************************************************
57 ' sd.SdGenericDrawPage
58 '*************************************************************************
60 Dim oDrawPage As Object
62 oDoc = utils.createDocument(
"sdraw", cObjectName)
64 oDrawPage = oDoc.DrawPages(
0)
65 oGrouperCollection = createUNOService(
"com.sun.star.drawing.ShapeCollection")
66 oCombinerCollection = createUNOService(
"com.sun.star.drawing.ShapeCollection")
67 oBinderCollection = createUNOService(
"com.sun.star.drawing.ShapeCollection")
71 addShape(oObj,
1000,
1000)
72 addShape(oObj,
5000,
5000)
73 addShape(oObj,
2000,
2000)
74 addShape(oObj,
3000,
3000)
75 addShape(oObj,
4000,
4000)
76 addShape(oObj,
5000,
5000)
77 addShape(oObj,
6000,
6000)
78 addShape(oObj,
7000,
7000)
80 oGrouperCollection.Add(oObj.getByIndex(
0))
81 oGrouperCollection.Add(oObj.getByIndex(
1))
82 oCombinerCollection.Add(oObj.getByIndex(
2))
83 oCombinerCollection.Add(oObj.getByIndex(
3))
84 oBinderCollection.Add(oObj.getByIndex(
4))
85 oBinderCollection.Add(oObj.getByIndex(
5))
87 oXShapeInstance = oDoc.createInstance(
"com.sun.star.drawing.RectangleShape")
93 Sub AddShape(oPage as Object, nPosX as Integer, nPosY as Integer)
94 Dim aPoint As New com.sun.star.awt.Point
95 Dim aSize As New com.sun.star.awt.Size
96 Dim oRectangleShape As Object
101 oRectangleShape = oDoc.createInstance(
"com.sun.star.drawing.RectangleShape")
102 oRectangleShape.Size = aSize
103 oRectangleShape.Position = aPoint
104 oRectangleShape.FillColor = RGB(
255,
0,
0)
105 oPage.add(oRectangleShape)
109 if hasUnoInterfaces(oDoc,
"com.sun.star.lang.XComponent") then