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_SdUnoOutlineView" 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: 42 43' Required for frame.XController 44Global oFrameToAttach As Object 45Global oModelToAttach As Object 46Global bHasNoViewData As Boolean 47Global oObjToSuspend As Object 48Global bHasNoModel As Boolean 49 50' Required for lang.XComponent 51Global oComponentInstance As Object 52 53' Required for frame.XDispatchProvider 54Global dispatchUrl As String 55 56' Required for awt.XWindow 57Global oXWindow As Object 58Global oCtrlShape as Object 59 60 61Global oSecDoc As Object 62Global oXComponentDoc as Object 63 64Sub CreateObj() 65 66'************************************************************************* 67' COMPONENT: 68' sd.SdUnoOutlineView 69'************************************************************************* 70On Error Goto ErrHndl 71 Dim bOK As Boolean 72 73 bOK = true 74 75 oDoc = utils.createImpressDocument(cObjectName) 76 oXComponentDoc = utils.createImpressDocument(cObjectName+ "XComponent") 77 78 oObj = oDoc.getCurrentController() 79 oComponentInstance = oXComponentDoc.getCurrentController() 80 81 Out.log("Change to Outline view") 82 Dim aSlotID As String 83 aSlotID = "slot:27010" 84 85 Dim url as new com.sun.star.util.URL 86 url.Complete = aSlotID 87 88 Dim UrlTransformer As Object 89 UrlTransformer = createUnoService("com.sun.star.util.URLTransformer") 90 UrlTransformer.parseStrict(url) 91 92 Dim xDispatcher As Object 93 xDispatcher = oObj.queryDispatch( url,"",0) 94 if Not IsNULL(xDispatcher) then 95 xDispatcher.dispatch( url, DimArray() ) 96 wait(5000) 97 else 98 Out.log("queryDispatch FAILED... Object SdUnoOutlineView can't be created") 99 oObj = NULL_OBJECT 100 endif 101 102 xDispatcher = oComponentInstance.queryDispatch( url,"",0) 103 if Not IsNULL(xDispatcher) then 104 xDispatcher.dispatch( url, DimArray() ) 105 wait(5000) 106 else 107 Out.log("queryDispatch FAILED... Object SdUnoOutlineView can't be created") 108 endif 109 110 oSecDoc = utils.createImpressDocument("For frame.XController") 111 bHasNoViewData = false 112 bHasNoModel = false 113 oObjToSuspend = oObj 114 oFrameToAttach = StarDesktop.getCurrentFrame() 115 oModelToAttach = oSecDoc 116 117 118 dispatchUrl = "slot:27069" 119 120 ' For awt.XWindow 121 oXWindow = utils.at_getCurrentWindow(oSecDoc) 122 123Exit Sub 124ErrHndl: 125 Test.Exception() 126End Sub 127 128Sub DisposeObj() 129 utils.closeObject(oSecDoc) 130End Sub 131</script:module> 132