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 package mod._sw; 24 25 import com.sun.star.lang.XMultiServiceFactory; 26 import com.sun.star.text.XTextDocument; 27 import com.sun.star.uno.XInterface; 28 29 import lib.TestCase; 30 import lib.TestEnvironment; 31 import lib.TestParameters; 32 33 import util.SOfficeFactory; 34 import util.WriterTools; 35 36 import java.io.PrintWriter; 37 38 39 public class DocumentSettings extends TestCase 40 { 41 XTextDocument xTextDoc = null; 42 43 /** 44 * Creates text document. 45 */ initialize(TestParameters tParam, PrintWriter log)46 protected void initialize(TestParameters tParam, PrintWriter log) 47 { 48 log.println(" opening xTextDoc "); 49 xTextDoc = 50 WriterTools.createTextDoc((XMultiServiceFactory) tParam.getMSF()); 51 } 52 53 /** 54 * Disposes text document. 55 */ cleanup(TestParameters tParam, PrintWriter log)56 protected void cleanup(TestParameters tParam, PrintWriter log) 57 { 58 log.println(" disposing xTextDoc "); 59 util.DesktopTools.closeDoc(xTextDoc); 60 } 61 createTestEnvironment( TestParameters tParam, PrintWriter log )62 protected TestEnvironment createTestEnvironment( 63 TestParameters tParam, PrintWriter log 64 ) 65 { 66 SOfficeFactory SOF = 67 SOfficeFactory.getFactory((XMultiServiceFactory) tParam.getMSF()); 68 XInterface oObj = null; 69 70 log.println("creating a test environment"); 71 72 oObj = 73 (XInterface) SOF.createInstance( 74 xTextDoc, "com.sun.star.text.DocumentSettings" 75 ); 76 77 TestEnvironment tEnv = new TestEnvironment(oObj); 78 79 return tEnv; 80 } 81 } 82