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