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 
24 package ifc.chart;
25 
26 import lib.MultiPropertyTest;
27 import lib.Status;
28 import lib.StatusException;
29 
30 import com.sun.star.beans.XPropertySet;
31 import com.sun.star.chart.XChartDocument;
32 import com.sun.star.uno.UnoRuntime;
33 
34 /**
35 * Testing <code>com.sun.star.chart.Diagram</code>
36 * service properties :
37 * <ul>
38 *  <li><code> DataCaption</code></li>
39 *  <li><code> DataRowSource</code></li>
40 * </ul> <p>
41 * This test needs the following object relations :
42 * <ul>
43 *  <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>):
44 *  to have reference to chart document </li>
45 * </ul> <p>
46 * @see com.sun.star.chart.Diagram
47 */
48 public class _Diagram extends MultiPropertyTest {
49 
50     /**
51     * Retrieves object relations and prepares a chart document.
52     * @throws StatusException if one of relations not found.
53     */
before()54     protected void before() {
55         log.println("Setting Diagram type to LineDiagram");
56         XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
57         if (doc == null) throw new StatusException(Status.failed
58             ("Relation 'CHARTDOC' not found"));
59 
60         oObj = (XPropertySet)
61             UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() );
62     }
63 }
64 
65