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="svx_SvxGraphCtrlAccessibleContext" 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 xController As Object 43Global oShape As Object 44Global multiSelection As Boolean 45 46Sub CreateObj() 47 48'************************************************************************* 49' COMPONENT: 50' svx.SvxGraphCtrlAccessibleContext 51'************************************************************************* 52On Error Goto ErrHndl 53 Dim oWin As Object, xRoot As Object 54 Dim oDP As Object, url As String 55 Dim newSize As New com.sun.star.awt.Size 56 Dim aUrl As new com.sun.star.util.URL 57 Dim xDispatcher As Object, urlTransformer As Object 58 Dim tk As Object 59 60 'creating document, toolkit and adding shape 61 oDoc = utils.createDocument("sdraw", cObjectName) 62 tk = createUnoService("com.sun.star.awt.Toolkit") 63 oShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape") 64 newSize = oShape.getSize() 65 newSize.Width = 5000 66 newSize.Height = 5000 67 oShape.setSize(newSize) 68 url = utils.Path2URL(cTestDocsDir + "space-metal.jpg") 69 Out.log("URL: "+url) 70 oShape.setPropertyValue("GraphicURL", url) 71 wait(500) 72 oDoc.getDrawPages().getByIndex(0).add(oShape) 73 wait(1000) 74 75 'opening ImageMapDialog 76 urlTransformer = createUNOService("com.sun.star.util.URLTransformer") 77 aUrl.Complete = "slot:10371" 78 urlTransformer.parseStrict(aUrl) 79 wait(500) 80 xController = oDoc.getCurrentController() 81 xDispatcher = xController.queryDispatch(aUrl,"",0) 82 if (NOT isNull(xDispatcher)) then 83 xDispatcher.dispatch(aUrl, DimArray()) 84 wait(2000) 85 oWin = tk.getActiveTopWindow() 86 xRoot = utils.at_getAccessibleObject(oWin) 87 oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL) 88 Out.Log("Implementation name: "+oObj.getImplementationName()) 89 multiSelection = true 90 else 91 Out.Log("QueryDispatch FAILED. Cannot open ImageMapDialog...") 92 End If 93 94Exit Sub 95ErrHndl: 96 Test.Exception() 97End Sub 98 99Sub fireEvent() 100 xController.select(oShape) 101 wait(500) 102End Sub 103</script:module> 104