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="toolkit_UnoControlDialog" 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' REQUIRED VARIABLES for interface/service tests: 42Global oGraphics as Object 43Global oContext as Object 44Global oWinpeer as Object 45Global oToolkit as Object 46Global oModel as Object 47 Global oXWindow as Object 48 Global oCtrlShape as Object 49 50Global oXControl1 as Object 51Global oXControl2 as Object 52 53 54Sub CreateObj() 55 56'************************************************************************* 57' COMPONENT: 58' toolkit.UnoControlDialog 59'************************************************************************* 60On Error Goto ErrHndl 61 Dim oWin As Object 62 Dim oKit As Object 63 Dim oDevice As Object 64 Dim oDoc2 As Object 65 Dim oDlgModel As Object 66 Dim oButModel As Object 67 Dim oDlgControl As Object 68 Dim oComponentInstance As Object 69 Dim oComponentModel As Object 70 Dim oXWindowModel As Object 71 72 oDlgModel = createUnoService("com.sun.star.awt.UnoControlDialogModel") 73 oDlgControl = createUnoService("com.sun.star.awt.UnoControlDialog") 74 oDlgControl.setModel(oDlgModel) 75 76 oComponentModel = createUnoService("com.sun.star.awt.UnoControlDialogModel") 77 oComponentInstance = createUnoService("com.sun.star.awt.UnoControlDialog") 78 oComponentInstance.setModel(oComponentModel) 79 80 oXWindowModel = createUnoService("com.sun.star.awt.UnoControlDialogModel") 81 oXWindow = createUnoService("com.sun.star.awt.UnoControlDialog") 82 oXWindow.setModel(oXWindowModel) 83 84 oButModel = createUnoService("com.sun.star.awt.UnoControlButtonModel") 85 oXControl1 = createUnoService("com.sun.star.awt.UnoControlButton") 86 oXControl1.setModel(oButModel) 87 oButModel = createUnoService("com.sun.star.awt.UnoControlButtonModel") 88 oXControl2 = createUnoService("com.sun.star.awt.UnoControlButton") 89 oXControl2.setModel(oButModel) 90 91 oDlgControl.setVisible(true) 92 oDlgControl.setPosSize(0, 0, 200, 100, com.sun.star.awt.PosSize.SIZE) 93 oContext = oDlgModel 94 oModel = oDlgModel 95 oWinpeer = oDlgControl.getPeer() 96 oToolkit = oWinpeer.getToolkit() 97 oDevice = oToolKit.createScreenCompatibleDevice(200,200) 98 oGraphics = oDevice.createGraphics() 99 100 oObj = oDlgControl 101Exit Sub 102ErrHndl: 103 Test.Exception() 104End Sub 105 106Sub DisposeObj() 107 oXWindow.Dispose() 108End Sub 109</script:module> 110