1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 package mod._toolkit; 28 29 import com.sun.star.drawing.XControlShape; 30 import com.sun.star.lang.XMultiServiceFactory; 31 import com.sun.star.text.XTextDocument; 32 import com.sun.star.uno.XInterface; 33 34 import java.io.PrintWriter; 35 36 import lib.StatusException; 37 import lib.TestCase; 38 import lib.TestEnvironment; 39 import lib.TestParameters; 40 41 import util.FormTools; 42 import util.WriterTools; 43 import util.utils; 44 45 46 public class TabControllerModel extends TestCase { 47 private static XTextDocument xTextDoc; 48 49 protected void initialize(TestParameters param, PrintWriter log) { 50 try { 51 log.println("creating a textdocument"); 52 xTextDoc = WriterTools.createTextDoc( 53 (XMultiServiceFactory) param.getMSF()); 54 } catch (Exception e) { 55 e.printStackTrace(log); 56 throw new StatusException("Couldn't create document", e); 57 } 58 } 59 60 protected void cleanup(TestParameters param, PrintWriter log) { 61 log.println("disposing xTextDoc"); 62 util.DesktopTools.closeDoc(xTextDoc); 63 ; 64 } 65 66 public TestEnvironment createTestEnvironment(TestParameters param, 67 PrintWriter log) { 68 XInterface oObj = null; 69 70 log.println("inserting some ControlShapes"); 71 72 XControlShape shape1 = FormTools.createControlShape(xTextDoc, 3000, 73 4500, 15000, 1000, 74 "CommandButton"); 75 XControlShape shape2 = FormTools.createControlShape(xTextDoc, 5000, 76 3500, 7500, 5000, 77 "TextField"); 78 79 try { 80 oObj = (XInterface) ((XMultiServiceFactory) param.getMSF()).createInstance( 81 "com.sun.star.awt.TabControllerModel"); 82 } catch (Exception e) { 83 e.printStackTrace(log); 84 throw new StatusException("Couldn't create " + 85 "TabControllerModel", e); 86 } 87 88 log.println("creating a new environment for TabControllerModel"); 89 90 TestEnvironment tEnv = new TestEnvironment(oObj); 91 92 tEnv.addObjRelation("OBJNAME", 93 "stardiv.vcl.controlmodel.TabController"); 94 tEnv.addObjRelation("Model1", shape1.getControl()); 95 tEnv.addObjRelation("Model2", shape2.getControl()); 96 97 98 //Object Relation for XPersistObject 99 tEnv.addObjRelation("noPS", new Boolean(true)); 100 101 System.out.println("ImplementationName: " + utils.getImplName(oObj)); 102 103 return tEnv; 104 } // finish method getTestEnvironment 105 } // finish class TabControllerModel 106