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="forms_OCheckBoxControl" 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
41' REQUIRED VARIABLES for interface/service tests:
42
43' Required for  com.sun.star.awt.XView:
44  Global oGraphics as Object
45
46' Required for  com.sun.star.lang.XComponent:
47  Global oComponentInstance As Object ' it will be disposed
48
49' Required for  com.sun.star.awt.XControl:
50  Global oContext As Object
51  Global oWinpeer As Object
52  Global oToolkit As Object
53  Global oModel As Object
54
55' Required for  com.sun.star.awt.XWindow:
56  Global oXWindow as Object
57  Global oCtrlShape As Variant
58
59' Required for awt.XItemListener
60  Global bIL_itemStateChanged As Boolean
61  Global oEventItemListener As Object
62
63
64Sub CreateObj()
65
66'*************************************************************************
67' COMPONENT:
68' forms.OCheckBoxControl
69'*************************************************************************
70On Error Goto ErrHndl
71
72    Dim bOK As Boolean
73    Dim oShape1 As Object
74    Dim oShape2 As Object
75    Dim oShape3 As Object
76    Dim oCurrCtrl As Object
77    Dim oWin As Object
78    Dim oKit As Object
79    Dim oDevice As Object
80    Dim oDoc2 As Object
81    Dim oIListener As Object
82
83    bOK = true
84
85    oDoc = utils.createDocument("swriter", cObjectName)
86'    oDoc2 = utils.createDocument("swriter", cObjectName + "2")
87
88    oShape1 = toolkittools.addControlToDefaultForm("CheckBox", 1000, 1000, 2000, 1000)
89    oShape2 = toolkittools.addControlToDefaultForm("CheckBox", 1000, 3000, 2000, 1000)
90    oShape3 = toolkittools.addControlToDefaultForm("TextField", 1000, 5000, 2000, 1000)
91
92    oModel = oShape1.getControl()
93    oCurrCtrl = oDoc.getCurrentController()
94    oWin = oCurrCtrl.getControl(oModel).getPeer()
95    oKit = oWin.getToolkit()
96    oDevice = oKit.createScreenCompatibleDevice(200,200)
97    oGraphics = oDevice.createGraphics()
98
99    oObj = oCurrCtrl.getControl(oModel)
100    oComponentInstance = oCurrCtrl.getControl(oShape2.getControl())
101    oContext = oDoc
102    oWinpeer = oWin
103    oToolkit = oKit
104    oXWindow =  oCurrCtrl.getControl(oShape3.getControl())
105    oCtrlShape = oShape1
106
107    oIListener = createUnoListener("IL_", "com.sun.star.awt.XItemListener")
108    oObj.addItemListener(oIListener)
109
110Exit Sub
111ErrHndl:
112    Test.Exception()
113End Sub
114
115Sub IL_itemStateChanged(rEvent As Object)
116    bIL_itemStateChanged = True
117    Out.Log("CallBack for ItemListener itemStateChanged was called.")
118    oEventItemListener = rEvent
119End Sub
120
121
122'Sub DisposeObj()
123'    'Re-open this document to close it successfully
124'    oDoc2 = utils.createDocument("swriter", cObjectName + "2")
125'    oDoc2.Dispose()
126'End Sub
127</script:module>
128