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.sheet;
25 
26 import com.sun.star.container.XNameAccess;
27 import com.sun.star.sheet.DataPilotFieldGroupBy;
28 import com.sun.star.sheet.DataPilotFieldGroupInfo;
29 import com.sun.star.sheet.XDataPilotField;
30 import com.sun.star.sheet.XDataPilotFieldGrouping;
31 import com.sun.star.uno.UnoRuntime;
32 import lib.MultiMethodTest;
33 
34 /**
35  *
36  * @author sw93809
37  */
38 public class _XDataPilotFieldGrouping extends MultiMethodTest
39 {
40     public XDataPilotFieldGrouping oObj = null;
41 
_createNameGroup()42     public void _createNameGroup() {
43         boolean result = true;
44         try {
45             XDataPilotField xDataPilotField = (XDataPilotField) UnoRuntime.queryInterface(XDataPilotField.class, oObj);
46             XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDataPilotField.getItems ());
47             String[] elements = xNameAccess.getElementNames ();
48             oObj.createNameGroup(elements);
49         } catch (com.sun.star.lang.IllegalArgumentException e) {
50             log.println("Exception while checking createNameGroup"+e);
51             result = false;
52         }
53         tRes.tested ("createNameGroup()",result);
54     }
55 
_createDateGroup()56     public void _createDateGroup() {
57         boolean result = true;
58         try {
59             DataPilotFieldGroupInfo aInfo = new DataPilotFieldGroupInfo();
60             aInfo.GroupBy = DataPilotFieldGroupBy.MONTHS;
61             aInfo.HasDateValues = true;
62             oObj.createDateGroup(aInfo);
63         } catch (com.sun.star.lang.IllegalArgumentException e) {
64             log.println("Exception while checking createDateGroup"+e);
65             result = false;
66         }
67         tRes.tested ("createDateGroup()",result);
68     }
69 }
70