1 /************************************************************************* 2 * 3 * The Contents of this file are made available subject to the terms of 4 * the BSD license. 5 * 6 * Copyright 2000, 2010 Oracle and/or its affiliates. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 30 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 31 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * 33 *************************************************************************/ 34 35 // __________ Imports __________ 36 37 import com.sun.star.uno.UnoRuntime; 38 39 import java.lang.String; 40 41 // __________ Implementation __________ 42 43 /** 44 * TODO 45 * 46 * @author Andreas Schlüns 47 * @created 08.02.2002 14:05 48 */ 49 public class Desk 50 { 51 // ____________________ 52 53 /** 54 * main 55 * Establish connection to a remote office and starts the demo application. 56 * User can overwrite some of neccessary start options by using command line parameters. 57 * 58 * syntax: Desk [mode={inplace|outplace}] [file=<filename>] 59 * 60 * @param args command line arguments 61 * mode describe using mode of document view {inplace/outplace} 62 * default=inplace 63 * file name of first file which should be open 64 * default="private:factory/swriter" to open empty writer document 65 */ 66 public static void main(String[] lArguments) 67 { 68 // Analyze command line parameters. 69 String sMode = new String("inplace"); 70 String sFile = new String("private:factory/swriter"); 71 72 for(int i=0; i<lArguments.length; ++i) 73 { 74 lArguments[i] = lArguments[i].toLowerCase(); 75 if(lArguments[i].startsWith("mode=")==true) 76 sMode = lArguments[i].substring(5); 77 else 78 if(lArguments[i].startsWith("file=")==true) 79 sFile = lArguments[i].substring(5); 80 } 81 82 ViewContainer.mbInplace = (sMode.compareTo("inplace")==0); 83 84 // Connect to remote office. 85 OfficeConnect.createConnection(); 86 87 // Create first document view. 88 // This one will register himself at the global 89 // ViewContainer. Further views will be open 90 // automaticly started from this first one. 91 DocumentView aView = new DocumentView(); 92 aView.setVisible(true); 93 aView.createFrame(); 94 aView.load(sFile); 95 } 96 } 97