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._toolkit;
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 java.io.PrintWriter;
30 
31 import lib.TestCase;
32 import lib.TestEnvironment;
33 import lib.TestParameters;
34 
35 import util.WriterTools;
36 import util.utils;
37 
38 
39 public class UnoControlNumericFieldModel extends TestCase {
40     private static XTextDocument xTextDoc;
41 
42     /**
43     * Creates StarOffice Writer document.
44     */
initialize(TestParameters tParam, PrintWriter log)45     protected void initialize(TestParameters tParam, PrintWriter log) {
46         log.println("creating a textdocument");
47         xTextDoc = WriterTools.createTextDoc(
48                            (XMultiServiceFactory) tParam.getMSF());
49     }
50 
51     /**
52     * Disposes StarOffice Writer document.
53     */
cleanup(TestParameters tParam, PrintWriter log)54     protected void cleanup(TestParameters tParam, PrintWriter log) {
55         log.println("    disposing xTextDoc ");
56 
57         util.DesktopTools.closeDoc(xTextDoc);
58     }
59 
createTestEnvironment(TestParameters Param, PrintWriter log)60     public synchronized TestEnvironment createTestEnvironment(TestParameters Param,
61                                                               PrintWriter log) {
62         XInterface oObj = null;
63 
64         try {
65             oObj = (XInterface) ((XMultiServiceFactory) Param.getMSF()).createInstance(
66                            "com.sun.star.awt.UnoControlNumericFieldModel");
67         } catch (Exception e) {
68         }
69 
70         log.println(
71                 "creating a new environment for UnoControlNumericFieldModel object");
72 
73         TestEnvironment tEnv = new TestEnvironment(oObj);
74 
75         tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.NumericField");
76         System.out.println("ImplementationName: " + utils.getImplName(oObj));
77 
78         return tEnv;
79     } // finish method getTestEnvironment
80 } // finish class UnoControlNumericFieldModel
81