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="frame_XComponentLoader" 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
36
37Sub RunTest()
38
39'*************************************************************************
40' INTERFACE:
41' com.sun.star.frame.XComponentLoader
42'*************************************************************************
43On Error Goto ErrHndl
44    Dim bOK As Boolean
45    Dim frameName As String
46    Dim doc As Object
47
48    Test.StartMethod("loadComponentFromURL()")
49    bOK = true
50    frameName = "_blank"
51
52    Dim szArgs(0) As new com.sun.star.beans.PropertyValue
53    szArgs(0).Name = "OpenFlags"
54    szArgs(0).Value = "S"
55    szArgs(0).Handle = -1
56    szArgs(0).State = com.sun.star.beans.PropertyState.DEFAULT_VALUE
57
58    Out.log("load a blank impress doc")
59    doc = oObj.loadComponentFromURL("private:factory/simpress", frameName, 0, szArgs())
60    bOK = Not isNull(doc)
61    Out.log("disposing impress doc")
62    doc.dispose()
63
64    Dim szEmptyArgs()
65
66    Out.log("load a blank writer doc")
67    doc = oObj.loadComponentFromURL("private:factory/swriter", frameName, 0, szEmptyArgs())
68    bOK = bOK and Not isNull(doc)
69    Out.log("disposing writer doc")
70    doc.dispose()
71
72    Out.log("load a blank calc doc")
73    doc = oObj.loadComponentFromURL("private:factory/scalc", frameName, 0, szEmptyArgs())
74    bOK = bOK and Not isNull(doc)
75    Out.log("disposing calc doc")
76    doc.dispose()
77
78    Out.log("load a blank draw doc")
79    doc = oObj.loadComponentFromURL("private:factory/sdraw", frameName, 0, szEmptyArgs())
80    bOK = bOK and Not isNull(doc)
81    Out.log("disposing draw doc")
82    doc.dispose()
83
84    Out.log("load a blank math doc")
85    oDoc = oObj.loadComponentFromURL("private:factory/smath", frameName, 0, szEmptyArgs())
86    bOK = bOK and Not isNull(doc)
87    Out.log("disposing math doc")
88    doc.dispose()
89
90    Out.log("load a blank  chart doc")
91    oDoc = oObj.loadComponentFromURL("private:factory/schart", frameName, 0, szEmptyArgs())
92    bOK = bOK and Not isNull(doc)
93    Out.log("disposing schart doc")
94    doc.dispose()
95
96    Test.MethodTested("loadComponentFromURL()", bOK)
97
98Exit Sub
99ErrHndl:
100    Test.Exception()
101    bOK = false
102    resume next
103End Sub
104</script:module>
105