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="cnt_CntUnoDataContainer" 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
38' Required for com.sun.star.container.XIndexContainer:
39  Global oInstance As Variant 'for InsertByName
40
41' Required for XIndexReplace
42  Global oIdxReplaceInstance As Object
43
44
45Sub CreateObj()
46
47'*************************************************************************
48' COMPONENT:
49' cnt.CntUnoDataContainer
50'*************************************************************************
51    Dim oDataContainer1 As Object
52    Dim oDataContainer2 As Object
53    Dim oInputStream As Object
54    Dim cFileName As String
55    Dim oFileAcc As Object
56    Dim hFile As Integer
57
58    oObj = createUNOService("com.sun.star.ucb.DataContainer")
59    oDataContainer1 = createUNOService("com.sun.star.ucb.DataContainer")
60    oDataContainer2 = createUNOService("com.sun.star.ucb.DataContainer")
61    oIdxReplaceInstance = createUNOService("com.sun.star.ucb.DataContainer")
62
63    oInstance = createUNOService("com.sun.star.ucb.DataContainer")
64
65    oObj.Name = "oDataContainer0"
66    oDataContainer1.Name = "oDataContainer1"
67    oDataContainer2.Name = "oDataContainer2"
68    oInstance.Name = "XDataContainer3"
69    oIdxReplaceInstance.Name = "oIdxReplaceInstance"
70
71    oObj.insertByIndex(0, oDataContainer1)
72    oObj.insertByIndex(1, oDataContainer2)
73
74    cFileName = utils.getTempFileURL("CntUnoDataContainer.dat")
75    #hFile = freefile()
76    Open cFileName For Output As #hFile
77    print #hFile "String content from cnt.CntUnoDataContainer"
78    close #hFile
79
80    oFileAcc = createUnoService("com.sun.star.ucb.SimpleFileAccess")
81    oInputStream = oFileAcc.openFileRead(cFileName)
82    oObj.setInputStream(oInputStream)
83    oObj.setContentType("text/plain")
84
85End Sub
86
87Sub ResetStreams()
88End Sub
89</script:module>
90