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