1*34dd1e25SAndrew Rist /**************************************************************
2*34dd1e25SAndrew Rist  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*34dd1e25SAndrew Rist  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*34dd1e25SAndrew Rist  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19*34dd1e25SAndrew Rist  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // __________ Imports __________
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import java.lang.String;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir // __________ Implementation __________
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /**
33cdf0e10cSrcweir  * TODO
34cdf0e10cSrcweir  *
35cdf0e10cSrcweir  * @author     Andreas Schlüns
36cdf0e10cSrcweir  * @created    08.02.2002 14:05
37cdf0e10cSrcweir  */
38cdf0e10cSrcweir public class Desk
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     // ____________________
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     /**
43cdf0e10cSrcweir      * main
44cdf0e10cSrcweir      * Establish connection to a remote office and starts the demo application.
45cdf0e10cSrcweir      * User can overwrite some of neccessary start options by using command line parameters.
46cdf0e10cSrcweir      *
47cdf0e10cSrcweir      * syntax: Desk [mode={inplace|outplace}] [file=<filename>]
48cdf0e10cSrcweir      *
49cdf0e10cSrcweir      * @param  args  command line arguments
50cdf0e10cSrcweir      *                  mode        describe using mode of document view {inplace/outplace}
51cdf0e10cSrcweir      *                              default=inplace
52cdf0e10cSrcweir      *                  file        name of first file which should be open
53cdf0e10cSrcweir      *                              default="private:factory/swriter" to open empty writer document
54cdf0e10cSrcweir      */
55cdf0e10cSrcweir     public static void main(String[] lArguments)
56cdf0e10cSrcweir     {
57cdf0e10cSrcweir         // Analyze command line parameters.
58cdf0e10cSrcweir         String  sMode  = new String("inplace");
59cdf0e10cSrcweir         String  sFile  = new String("private:factory/swriter");
60cdf0e10cSrcweir 
61cdf0e10cSrcweir         for(int i=0; i<lArguments.length; ++i)
62cdf0e10cSrcweir         {
63cdf0e10cSrcweir             lArguments[i] = lArguments[i].toLowerCase();
64cdf0e10cSrcweir             if(lArguments[i].startsWith("mode=")==true)
65cdf0e10cSrcweir                 sMode = lArguments[i].substring(5);
66cdf0e10cSrcweir             else
67cdf0e10cSrcweir             if(lArguments[i].startsWith("file=")==true)
68cdf0e10cSrcweir                 sFile = lArguments[i].substring(5);
69cdf0e10cSrcweir         }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir         ViewContainer.mbInplace = (sMode.compareTo("inplace")==0);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         // Connect to remote office.
74cdf0e10cSrcweir         OfficeConnect.createConnection();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         // Create first document view.
77cdf0e10cSrcweir         // This one will register himself at the global
78cdf0e10cSrcweir         // ViewContainer. Further views will be open
79cdf0e10cSrcweir         // automaticly started from this first one.
80cdf0e10cSrcweir         DocumentView aView = new DocumentView();
81cdf0e10cSrcweir         aView.setVisible(true);
82cdf0e10cSrcweir         aView.createFrame();
83cdf0e10cSrcweir         aView.load(sFile);
84cdf0e10cSrcweir     }
85cdf0e10cSrcweir }
86