blob: 9774e204653f3c2a1673c0542956ed33eb620fd9 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="remotebridge_various" script:language="StarBasic">
'*************************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'*************************************************************************
' Be sure that all variables are dimensioned:
option explicit
' REQUIRED VARIABLES for interface/service tests:
' Required for com.sun.star.lang.XComponent:
Global oComponentInstance As Object ' it will be disposed
' Required for com.sun.star.lang.XInitialization:
Global aInitArgs(3) As Variant
Global aNoInit()
' Required for com.sun.star.bridge.XBridge:
Global sBridgeName As String
Global sConnectionString As String
Dim xConnection As Object
Sub CreateObj()
'*************************************************************************
' COMPONENT:
' remotebridge.various
'*************************************************************************
On Error Goto ErrHndl
Dim protocol As String
Dim iPos1 As Integer
Dim iPos2 As Integer
oObj = createUNOService("com.sun.star.bridge.Bridge")
oComponentInstance = createUNOService("com.sun.star.bridge.Bridge")
sBridgeName = "remotebridge"
protocol = "urp"
xConnection = createUNOService("com.sun.star.connection.Connector")
iPos1 = inStr(CNCSTR, "socket")
iPos2 = inStr(iPos1, CNCSTR, ";")
sConnectionString = mid(CNCSTR, iPos1, iPos2 - iPos1)
Out.Log("Creating connection with parameters: " + sConnectionString)
xConnection = xConnection.Connect(sConnectionString)
aInitArgs(0) = sBridgeName
aInitArgs(1) = protocol
aInitArgs(2) = xConnection
aInitArgs(3) = ""
oObj.initialize(aInitArgs())
Exit Sub
ErrHndl:
Test.Exception()
End Sub
Sub DisposeObj()
Out.Log("Disposing object...")
if (NOT isNULL(xConnection)) then
xConnection.close()
end if
oObj.dispose()
End Sub
</script:module>