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