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 
28 package ifc.linguistic2;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.lang.EventObject;
33 import com.sun.star.linguistic2.LinguServiceEvent;
34 import com.sun.star.linguistic2.XLinguServiceEventBroadcaster;
35 import com.sun.star.linguistic2.XLinguServiceEventListener;
36 
37 /**
38 * Testing <code>com.sun.star.linguistic2.XLinguServiceEventBroadcaster</code>
39 * interface methods:
40 * <ul>
41 *   <li><code>addLinguServiceEventListener()</code></li>
42 *   <li><code>removeLinguServiceEventListener()</code></li>
43 * </ul><p>
44 * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
45 */
46 public class _XLinguServiceEventBroadcaster extends MultiMethodTest {
47 
48     public XLinguServiceEventBroadcaster oObj = null;
49 
50     /**
51     * Class implements interface <code>XLinguServiceEventListener</code>
52     * for test method <code>addLinguServiceEventListener</code>.
53     * @see com.sun.star.linguistic2.XLinguServiceEventListener
54     */
55     public class MyLinguServiceEventListener implements
56             XLinguServiceEventListener {
57         public void disposing ( EventObject oEvent ) {
58             log.println("Listener has been disposed");
59         }
60         public void processLinguServiceEvent(LinguServiceEvent aServiceEvent) {
61             log.println("Listener called");
62         }
63 
64     };
65 
66     XLinguServiceEventListener listener = new MyLinguServiceEventListener();
67 
68     /**
69     * Test calls the method and checks returned value. <p>
70     * Has <b> OK </b> status if returned value is true. <p>
71     */
72     public void _addLinguServiceEventListener() {
73         boolean res = true;
74 
75         res = oObj.addLinguServiceEventListener(listener);
76 
77         tRes.tested("addLinguServiceEventListener()",res);
78     }
79 
80     /**
81     * Test calls the method and checks returned value. <p>
82     * Has <b> OK </b> status if returned value is true. <p>
83     */
84     public void _removeLinguServiceEventListener() {
85         boolean res = true;
86 
87         res = oObj.removeLinguServiceEventListener(listener);
88 
89         tRes.tested("removeLinguServiceEventListener()",res);
90     }
91 
92 }  // finish class XLinguServiceEventBroadcaster
93 
94 
95