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