1*cf279e26SAndrew Rist /**************************************************************
2*cf279e26SAndrew Rist  *
3*cf279e26SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cf279e26SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cf279e26SAndrew Rist  * distributed with this work for additional information
6*cf279e26SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cf279e26SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cf279e26SAndrew Rist  * "License"); you may not use this file except in compliance
9*cf279e26SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cf279e26SAndrew Rist  *
11*cf279e26SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cf279e26SAndrew Rist  *
13*cf279e26SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cf279e26SAndrew Rist  * software distributed under the License is distributed on an
15*cf279e26SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cf279e26SAndrew Rist  * KIND, either express or implied.  See the License for the
17*cf279e26SAndrew Rist  * specific language governing permissions and limitations
18*cf279e26SAndrew Rist  * under the License.
19*cf279e26SAndrew Rist  *
20*cf279e26SAndrew Rist  *************************************************************/
21*cf279e26SAndrew Rist 
22cdf0e10cSrcweir using System;
23cdf0e10cSrcweir using unoidl.com.sun.star.lang;
24cdf0e10cSrcweir using unoidl.com.sun.star.uno;
25cdf0e10cSrcweir using unoidl.com.sun.star.bridge;
26cdf0e10cSrcweir using unoidl.com.sun.star.frame;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir class DynLoad
29cdf0e10cSrcweir {
30cdf0e10cSrcweir 
Main(string[] args)31cdf0e10cSrcweir     static void Main(string[] args)
32cdf0e10cSrcweir     {
33cdf0e10cSrcweir         connect(args);
34cdf0e10cSrcweir     }
35cdf0e10cSrcweir 
36cdf0e10cSrcweir /** Connect to a running office that is accepting connections.
37cdf0e10cSrcweir         @return  The ServiceManager to instantiate office components. */
connect( string[] args )38cdf0e10cSrcweir     static private XMultiServiceFactory connect( string[] args )
39cdf0e10cSrcweir     {
40cdf0e10cSrcweir         if (args.Length == 0)
41cdf0e10cSrcweir             Console.WriteLine("You need to provide a file URL to the office" +
42cdf0e10cSrcweir                               " program folder\n");
43cdf0e10cSrcweir         System.Collections.Hashtable ht = new System.Collections.Hashtable();
44cdf0e10cSrcweir         ht.Add( "SYSBINDIR", args[ 0 ] );
45cdf0e10cSrcweir         XComponentContext xContext =
46cdf0e10cSrcweir             uno.util.Bootstrap.defaultBootstrap_InitialComponentContext(
47cdf0e10cSrcweir                  args[ 0 ] + "/uno.ini", ht.GetEnumerator() );
48cdf0e10cSrcweir 
49cdf0e10cSrcweir         if (xContext != null)
50cdf0e10cSrcweir             Console.WriteLine("Successfully created XComponentContext\n");
51cdf0e10cSrcweir         else
52cdf0e10cSrcweir             Console.WriteLine("Could not create XComponentContext\n");
53cdf0e10cSrcweir 
54cdf0e10cSrcweir        return null;
55cdf0e10cSrcweir     }
56cdf0e10cSrcweir }
57