summaryrefslogtreecommitdiffstats
path: root/extensions/test/ole/DCOM
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/test/ole/DCOM')
-rw-r--r--extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas25
-rw-r--r--extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp33
-rw-r--r--extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw1
-rw-r--r--extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt4
-rw-r--r--extensions/test/ole/DCOM/dcom_test/Module1.bas55
-rw-r--r--extensions/test/ole/DCOM/dcom_test/dcom_test.vbp37
-rw-r--r--extensions/test/ole/DCOM/dcom_test/dcom_test.vbw1
-rw-r--r--extensions/test/ole/DCOM/dcom_test/readme.txt5
-rw-r--r--extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc186
-rw-r--r--extensions/test/ole/DCOM/scriptComponents/readme.txt12
10 files changed, 359 insertions, 0 deletions
diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas b/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas
new file mode 100644
index 000000000..88153b174
--- /dev/null
+++ b/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas
@@ -0,0 +1,25 @@
+rem
+rem This file is part of the LibreOffice project.
+rem
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+rem
+rem This file incorporates work covered by the following license notice:
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed
+rem with this work for additional information regarding copyright
+rem ownership. The ASF licenses this file to you under the Apache
+rem License, Version 2.0 (the "License"); you may not use this file
+rem except in compliance with the License. You may obtain a copy of
+rem the License at http://www.apache.org/licenses/LICENSE-2.0 .
+rem
+Attribute VB_Name = "Module1"
+Option Explicit
+
+Sub main()
+ Dim obj As Object
+ Set obj = CreateObject("dcomtest.writerdemo.wsc")
+ obj.run
+End Sub
diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp
new file mode 100644
index 000000000..ca477cff6
--- /dev/null
+++ b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp
@@ -0,0 +1,33 @@
+Type=Exe
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation
+Module=Module1; Module1.bas
+Startup="Sub Main"
+HelpFile=""
+Command32=""
+Name="client_writerdemo"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="StarOffice"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
+
+[MS Transaction Server]
+AutoRefresh=1
diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw
new file mode 100644
index 000000000..067d7529e
--- /dev/null
+++ b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw
@@ -0,0 +1 @@
+Module1 = 108, 108, 685, 544,
diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt b/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt
new file mode 100644
index 000000000..1d5a63492
--- /dev/null
+++ b/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt
@@ -0,0 +1,4 @@
+Visual Basic client that instantiates a Windows Script Component
+,dcomtest.writerdemo.wsc. That component is located in
+extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc. Don't forget to
+register that component (right-click,select register).
diff --git a/extensions/test/ole/DCOM/dcom_test/Module1.bas b/extensions/test/ole/DCOM/dcom_test/Module1.bas
new file mode 100644
index 000000000..27908068c
--- /dev/null
+++ b/extensions/test/ole/DCOM/dcom_test/Module1.bas
@@ -0,0 +1,55 @@
+rem
+rem This file is part of the LibreOffice project.
+rem
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+rem
+rem This file incorporates work covered by the following license notice:
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed
+rem with this work for additional information regarding copyright
+rem ownership. The ASF licenses this file to you under the Apache
+rem License, Version 2.0 (the "License"); you may not use this file
+rem except in compliance with the License. You may obtain a copy of
+rem the License at http://www.apache.org/licenses/LICENSE-2.0 .
+rem
+Attribute VB_Name = "Module1"
+Option Explicit
+
+Sub main()
+
+MsgBox "hallo"
+
+'The service manager is always the starting point
+'If there is no office running then an office is started up
+Dim objServiceManager As Object
+Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
+
+'Create the CoreReflection service that is later used to create structs
+Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+
+'Create the Desktop
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+
+'Open a new empty writer document
+
+Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+'get a type description class for Size
+Set propClass = objCoreReflection.forName("com.sun.star.beans.PropertyValue")
+
+Dim prop
+propClass.CreateObject prop
+prop.Name = "Hidden"
+prop.Value = True
+
+'create the actual object
+Dim args(0)
+Set args(0) = prop
+
+Dim args2()
+'Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
+Set objDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args2)
+
+End Sub
diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp
new file mode 100644
index 000000000..5b896434f
--- /dev/null
+++ b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp
@@ -0,0 +1,37 @@
+Type=Exe
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation
+Module=Module1; ..\..\..\..\..\..\Projects\VBasic\dcom_test\Module1.bas
+Startup="Sub Main"
+HelpFile=""
+Title="dcom_test"
+ExeName32="dcom_test.exe"
+Path32="..\..\..\..\..\..\Projects\VBasic\dcom_test"
+Command32=""
+Name="dcom_test"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="StarOffice"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
+DebugStartupOption=0
+
+[MS Transaction Server]
+AutoRefresh=1
diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw
new file mode 100644
index 000000000..dfe34e0d1
--- /dev/null
+++ b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw
@@ -0,0 +1 @@
+Module1 = 1, 1, 849, 604, Z
diff --git a/extensions/test/ole/DCOM/dcom_test/readme.txt b/extensions/test/ole/DCOM/dcom_test/readme.txt
new file mode 100644
index 000000000..215d6f409
--- /dev/null
+++ b/extensions/test/ole/DCOM/dcom_test/readme.txt
@@ -0,0 +1,5 @@
+The program creates the com.sun.star.Servicemanager on a remote machine:
+
+Set objServiceManager = CreateObject("com.sun.star.ServiceManager", "\\jl-1036")
+
+creates a document and writes in it. \ No newline at end of file
diff --git a/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc b/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc
new file mode 100644
index 000000000..51419022f
--- /dev/null
+++ b/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc
@@ -0,0 +1,186 @@
+<?xml version="1.0"?>
+<component>
+
+<?component error="true" debug="true"?>
+
+<registration
+ description="writerdemo script component"
+ progid="dcomtest.writerdemo.WSC"
+ version="1.00"
+ classid="{90c5ca1a-5e38-4c6d-9634-b0c740c569ad}"
+ remotable="true"
+>
+</registration>
+
+<public>
+ <method name="run">
+ </method>
+</public>
+
+<script language="JScript">
+<![CDATA[
+
+var description = new jscripttest;
+
+function jscripttest()
+{
+
+ this.run = run;
+}
+
+function run()
+{
+//The service manager is always the starting point
+//If there is no office running then an office is started up
+
+var objServiceManager= new ActiveXObject("com.sun.star.ServiceManager","\\jl-1036");
+
+//Create the CoreReflection service that is later used to create structs
+var objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection");
+
+//Create the Desktop
+var objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop");
+
+//Open a new empty writer document
+var objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection");
+
+//get a type description class for Size
+//var propClass = objCoreReflection.forName( "com.sun.star.beans.PropertyValue" );
+
+//var propParam= new Array();
+//propClass.createObject(propParam);
+//var prop= propParam[0];
+//prop.Name= "Hidden";
+//prop.Value= true;
+
+//create the actual object
+var args= new Array();
+var objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args);
+
+//Create a text object
+var objText= objDocument.getText();
+
+//Create a cursor object
+var objCursor= objText.createTextCursor();
+
+//Inserting some Text
+objText.insertString( objCursor, "The first line in the newly created text document.\n", false);
+
+//Inserting a second line
+objText.insertString( objCursor, "Now we're in the second line", false);
+
+//Create instance of a text table with 4 columns and 4 rows
+var objTable= objDocument.createInstance( "com.sun.star.text.TextTable");
+objTable.initialize( 4, 4);
+
+//Insert the table
+objText.insertTextContent( objCursor, objTable, false);
+
+//Get first row
+var objRows= objTable.getRows();
+var objRow= objRows.getByIndex( 0);
+
+//Set the table background color
+objTable.setPropertyValue( "BackTransparent", false);
+objTable.setPropertyValue( "BackColor", 13421823);
+
+//Set a different background color for the first row
+objRow.setPropertyValue( "BackTransparent", false);
+objRow.setPropertyValue( "BackColor", 6710932);
+
+//Fill the first table row
+insertIntoCell( "A1","FirstColumn", objTable);
+insertIntoCell( "B1","SecondColumn", objTable);
+insertIntoCell( "C1","ThirdColumn", objTable);
+insertIntoCell( "D1","SUM", objTable);
+
+
+objTable.getCellByName("A2").setValue( 22.5);
+objTable.getCellByName("B2").setValue( 5615.3);
+objTable.getCellByName("C2").setValue( -2315.7);
+objTable.getCellByName("D2").setFormula("sum <A2:C2>");
+
+objTable.getCellByName("A3").setValue( 21.5);
+objTable.getCellByName("B3").setValue( 615.3);
+objTable.getCellByName("C3").setValue( -315.7);
+objTable.getCellByName("D3").setFormula( "sum <A3:C3>");
+
+objTable.getCellByName("A4").setValue( 121.5);
+objTable.getCellByName("B4").setValue( -615.3);
+objTable.getCellByName("C4").setValue( 415.7);
+objTable.getCellByName("D4").setFormula( "sum <A4:C4>");
+
+//Change the CharColor and add a Shadow
+objCursor.setPropertyValue( "CharColor", 255);
+objCursor.setPropertyValue( "CharShadowed", true);
+
+//Create a paragraph break
+//The second argument is a css::text::ControlCharacter::PARAGRAPH_BREAK constant
+objText.insertControlCharacter( objCursor, 0 , false);
+
+//Inserting colored Text.
+objText.insertString( objCursor, " This is a colored Text - blue with shadow\n", false);
+
+//Create a paragraph break ( ControlCharacter::PARAGRAPH_BREAK).
+objText.insertControlCharacter( objCursor, 0, false );
+
+//Create a TextFrame.
+var objTextFrame= objDocument.createInstance("com.sun.star.text.TextFrame");
+
+//Create a Size struct.
+var objSize= createStruct("com.sun.star.awt.Size");
+objSize.Width= 15000;
+objSize.Height= 400;
+objTextFrame.setSize( objSize);
+
+//TextContentAnchorType.AS_CHARACTER = 1
+objTextFrame.setPropertyValue( "AnchorType", 1);
+
+//insert the frame
+objText.insertTextContent( objCursor, objTextFrame, false);
+
+//Get the text object of the frame
+var objFrameText= objTextFrame.getText();
+
+//Create a cursor object
+var objFrameTextCursor= objFrameText.createTextCursor();
+
+//Inserting some Text
+objFrameText.insertString( objFrameTextCursor, "The first line in the newly created text frame.",
+ false);
+objFrameText.insertString(objFrameTextCursor,
+ "With this second line the height of the frame raises.", false );
+
+//Create a paragraph break
+//The second argument is a css::text::ControlCharacter::PARAGRAPH_BREAK constant
+objFrameText.insertControlCharacter( objCursor, 0 , false);
+
+//Change the CharColor and add a Shadow
+objCursor.setPropertyValue( "CharColor", 65536);
+objCursor.setPropertyValue( "CharShadowed", false);
+
+//Insert another string
+objText.insertString( objCursor, " That's all for now !!", false );
+
+function insertIntoCell( strCellName, strText, objTable)
+{
+ var objCellText= objTable.getCellByName( strCellName);
+ var objCellCursor= objCellText.createTextCursor();
+ objCellCursor.setPropertyValue( "CharColor",16777215);
+ objCellText.insertString( objCellCursor, strText, false);
+}
+function createStruct( strTypeName)
+{
+ var classSize= objCoreReflection.forName( strTypeName);
+ var aStruct= new Array();
+ classSize.createObject( aStruct);
+ return aStruct[0];
+}
+
+
+}
+
+]]>
+</script>
+
+</component>
diff --git a/extensions/test/ole/DCOM/scriptComponents/readme.txt b/extensions/test/ole/DCOM/scriptComponents/readme.txt
new file mode 100644
index 000000000..5fa3a8bb7
--- /dev/null
+++ b/extensions/test/ole/DCOM/scriptComponents/readme.txt
@@ -0,0 +1,12 @@
+WriterDemo.wsc
+=================================================================================
+Register the component by right-clicking on the file in the file explorer and select
+register.
+The component registered as being remotable.That is, it has got an AppID entry (with
+a DllSurrogate subkey).That enables us to use dcomcnfg.exe in order to set AccessPermissions,etc.
+which is necessary because of the use of the JScript Array object. The automation
+bridge will query for IDispatchEx,which is a call from server to client.Hence the server
+needs the proper right within the client.
+
+The component implements a run function, which runs the demo example that is written
+in JScript.