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="cached_CachedContentResultSetStubFactory" 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 com.sun.star.ucb.XCachedContentResultSetStubFactory 43 Global oContentResultSet As Object 44 45 46Sub CreateObj() 47 48'************************************************************************* 49' COMPONENT: 50' cached.CachedContentResultSetStubFactory 51'************************************************************************* 52On Error Goto ErrHndl 53 54 oObj = createUnoService("com.sun.star.ucb.CachedContentResultSetStubFactory") 55 56 Dim args As Variant 57 Dim oUCB As Object 58 args = Array("Local", "Office") 59 oUCB = createUnoService("com.sun.star.ucb.UniversalContentBroker") 60 oUCB.initialize(args()) 61 62 Dim sURL, sCntURL As String 63 Dim oCI, oContent As Object 64 sURL = utils.Path2URL(cTestDocsDir & "solibrary.jar") 65 sURL = utils.utils.StrReplace(sURL, "/", "%2F") 66 sCntURL = "vnd.sun.star.pkg://" & sURL & "/" 67 68 oCI = oUCB.createContentIdentifier(sCntUrl) 69 oContent = oUCB.queryContent(oCI) 70 71 Dim props(0) As new com.sun.star.beans.Property 72 Dim cmd As new com.sun.star.ucb.Command 73 Dim ocArg As new com.sun.star.ucb.OpenCommandArgument2 74 Dim sortInfo() As new com.sun.star.ucb.NumberedSortingInfo 75 Dim oDynResSet, oStubFactory As Object 76 77 props(0).Name = "Title" 78 79 ocArg.Mode = com.sun.star.ucb.OpenMode.ALL 80 ocArg.Priority = 10000 81 ocArg.Properties = props() 82 ocArg.SortingInfo = sortInfo() 83 84 cmd.Name = "open" 85 cmd.Handle = -1 86 cmd.Argument = ocArg 87 88 oDynResSet = oContent.execute(cmd, 0, NULL_OBJECT) 89 oContentResultSet = oDynResSet.getStaticResultSet() 90Exit Sub 91ErrHndl: 92 Test.Exception() 93End Sub 94</script:module> 95