1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package mod._sc;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import java.io.PrintWriter;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import lib.StatusException;
29cdf0e10cSrcweir import lib.TestCase;
30cdf0e10cSrcweir import lib.TestEnvironment;
31cdf0e10cSrcweir import lib.TestParameters;
32cdf0e10cSrcweir import util.SOfficeFactory;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir import com.sun.star.beans.XPropertySet;
35cdf0e10cSrcweir import com.sun.star.container.XIndexAccess;
36cdf0e10cSrcweir import com.sun.star.lang.XComponent;
37cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
38cdf0e10cSrcweir import com.sun.star.sheet.TableFilterField;
39cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotDescriptor;
40cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTables;
41cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTablesSupplier;
42cdf0e10cSrcweir import com.sun.star.sheet.XSheetFilterDescriptor;
43cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet;
44cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheetDocument;
45cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheets;
46cdf0e10cSrcweir import com.sun.star.table.CellAddress;
47cdf0e10cSrcweir import com.sun.star.table.CellRangeAddress;
48cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
49cdf0e10cSrcweir import com.sun.star.uno.Type;
50cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
51cdf0e10cSrcweir import com.sun.star.uno.XInterface;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /**
54cdf0e10cSrcweir * Test for object which is represented by service
55cdf0e10cSrcweir * <code>com.sun.star.sheet.DataPilotTable</code>. <p>
56cdf0e10cSrcweir * Object implements the following interfaces :
57cdf0e10cSrcweir * <ul>
58cdf0e10cSrcweir *  <li> <code>com::sun::star::container::XNamed</code></li>
59cdf0e10cSrcweir *  <li> <code>com::sun::star::sheet::XDataPilotTable</code></li>
60cdf0e10cSrcweir *  <li> <code>com::sun::star::sheet::XDataPilotDescriptor</code></li>
61cdf0e10cSrcweir * </ul>
62cdf0e10cSrcweir * @see com.sun.star.sheet.DataPilotTable
63cdf0e10cSrcweir * @see com.sun.star.container.XNamed
64cdf0e10cSrcweir * @see com.sun.star.sheet.XDataPilotTable
65cdf0e10cSrcweir * @see com.sun.star.sheet.XDataPilotDescriptor
66cdf0e10cSrcweir * @see ifc.container._XNamed
67cdf0e10cSrcweir * @see ifc.sheet._XDataPilotTable
68cdf0e10cSrcweir * @see ifc.sheet._XDataPilotDescriptor
69cdf0e10cSrcweir */
70cdf0e10cSrcweir public class ScDataPilotTableObj extends TestCase {
71cdf0e10cSrcweir     static XSpreadsheetDocument xSheetDoc = null;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     /**
74cdf0e10cSrcweir     * Creates Spreadsheet document.
75cdf0e10cSrcweir     */
initialize( TestParameters tParam, PrintWriter log )76cdf0e10cSrcweir     protected void initialize( TestParameters tParam, PrintWriter log ) {
77cdf0e10cSrcweir         SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         try {
80cdf0e10cSrcweir             log.println( "creating a Spreadsheet document" );
81cdf0e10cSrcweir             xSheetDoc = SOF.createCalcDoc(null);
82cdf0e10cSrcweir         } catch ( com.sun.star.uno.Exception e ) {
83cdf0e10cSrcweir             // Some exception occures.FAILED
84cdf0e10cSrcweir             e.printStackTrace( log );
85cdf0e10cSrcweir             throw new StatusException( "Couldn't create document", e );
86cdf0e10cSrcweir         }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     /**
91cdf0e10cSrcweir     * Disposes Spreadsheet document.
92cdf0e10cSrcweir     */
cleanup( TestParameters tParam, PrintWriter log )93cdf0e10cSrcweir     protected void cleanup( TestParameters tParam, PrintWriter log ) {
94cdf0e10cSrcweir         log.println( "    disposing xSheetDoc " );
95cdf0e10cSrcweir         XComponent oComp = (XComponent)
96cdf0e10cSrcweir             UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
97cdf0e10cSrcweir         util.DesktopTools.closeDoc(oComp);
98cdf0e10cSrcweir     }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     /**
101cdf0e10cSrcweir     * Creating a Testenvironment for the interfaces to be tested.
102cdf0e10cSrcweir     * Retrieves a collection of spreadsheets from a document
103cdf0e10cSrcweir     * and takes one of them. Fills some table in the spreadsheet.
104cdf0e10cSrcweir     * Obtains the collection of data pilot tables using the interface
105cdf0e10cSrcweir     * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
106cdf0e10cSrcweir     * for the filled table. Obtains the collection of all the data pilot fields
107cdf0e10cSrcweir     * using the interface <code>XDataPilotDescriptor</code>. Sets field
108cdf0e10cSrcweir     * orientation for every of the data pilot fields. Sets the definitions of
109cdf0e10cSrcweir     * the filter fields for the created description. Inserts new data pilot
110cdf0e10cSrcweir     * table with this descriptor to the collection.
111cdf0e10cSrcweir     * This new data pilot table is the instance of the service
112cdf0e10cSrcweir     * <code>com.sun.star.sheet.DataPilotTable</code>.
113cdf0e10cSrcweir     * Object relations created :
114cdf0e10cSrcweir     * <ul>
115cdf0e10cSrcweir     *  <li> <code>'OUTPUTRANGE'</code> for
116cdf0e10cSrcweir     *      {@link ifc.sheet._XDataPilotTable}(the cell range address of the
117cdf0e10cSrcweir     *      created data pilot table) </li>
118cdf0e10cSrcweir     * <li> <code>'FIELDSAMOUNT'</code> for
119cdf0e10cSrcweir     *      {@link ifc.sheet._XDataPilotDescriptor}(the number of filled fields
120cdf0e10cSrcweir     *      which descriptor was created for) </li>
121cdf0e10cSrcweir     *  <li> <code>'CELLFORCHANGE'</code> for
122cdf0e10cSrcweir     *      {@link ifc.sheet._XDataPilotTable}(value of this cell will be changed)</li>
123cdf0e10cSrcweir     *  <li> <code>'CELLFORCHECK'</code> for
124cdf0e10cSrcweir     *      {@link ifc.sheet._XDataPilotTable}(value of this cell must be changed
125cdf0e10cSrcweir     *      after refresh call)</li>
126cdf0e10cSrcweir     * </ul>
127cdf0e10cSrcweir     * @see com.sun.star.sheet.DataPilotTable
128cdf0e10cSrcweir     * @see com.sun.star.sheet.XDataPilotTablesSupplier
129cdf0e10cSrcweir     * @see com.sun.star.sheet.XDataPilotDescriptor
130cdf0e10cSrcweir     */
createTestEnvironment(TestParameters Param, PrintWriter log)131cdf0e10cSrcweir     protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         XInterface oObj = null;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         CellAddress sCellAddress = new CellAddress();
136cdf0e10cSrcweir         sCellAddress.Sheet = 0;
137cdf0e10cSrcweir         sCellAddress.Column = 7;
138cdf0e10cSrcweir         sCellAddress.Row = 8;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         // creation of testobject here
141cdf0e10cSrcweir         // first we write what we are intend to do to log file
142cdf0e10cSrcweir         log.println( "Creating a test environment" );
143cdf0e10cSrcweir         log.println("getting sheets");
144cdf0e10cSrcweir         XSpreadsheets xSpreadsheets = xSheetDoc.getSheets();
145cdf0e10cSrcweir         XIndexAccess oIndexAccess = (XIndexAccess)
146cdf0e10cSrcweir             UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
147cdf0e10cSrcweir         XSpreadsheet oSheet = null;
148cdf0e10cSrcweir         Object oChangeCell = null;
149cdf0e10cSrcweir         Object oCheckCell = null;
150cdf0e10cSrcweir         try {
151cdf0e10cSrcweir             oSheet = (XSpreadsheet) AnyConverter.toObject(
152cdf0e10cSrcweir                     new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
153cdf0e10cSrcweir             oChangeCell = oSheet.getCellByPosition(1, 5);
154cdf0e10cSrcweir             oCheckCell = oSheet.getCellByPosition(
155cdf0e10cSrcweir                 sCellAddress.Column, sCellAddress.Row + 3);
156cdf0e10cSrcweir         } catch (com.sun.star.lang.WrappedTargetException e) {
157cdf0e10cSrcweir             e.printStackTrace(log);
158cdf0e10cSrcweir             throw new StatusException( "Couldn't get a spreadsheet", e);
159cdf0e10cSrcweir         } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
160cdf0e10cSrcweir             e.printStackTrace(log);
161cdf0e10cSrcweir             throw new StatusException( "Couldn't get a spreadsheet", e);
162cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException e) {
163cdf0e10cSrcweir             e.printStackTrace(log);
164cdf0e10cSrcweir             throw new StatusException( "Couldn't get a spreadsheet", e);
165cdf0e10cSrcweir         }
166cdf0e10cSrcweir         log.println("Getting sheet - " + (oSheet == null ? "FAILED" : "OK"));
167cdf0e10cSrcweir         try {
168cdf0e10cSrcweir             log.println("Filing a table");
169cdf0e10cSrcweir             for (int i = 1; i < 6; i++) {
170cdf0e10cSrcweir                 oSheet.getCellByPosition(0, i).setFormula("Row" + i);
171cdf0e10cSrcweir                 oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
172cdf0e10cSrcweir             }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir             for (int i = 1; i < 6; i++)
175cdf0e10cSrcweir                 for (int j = 1; j < 6; j++) {
176cdf0e10cSrcweir                     oSheet.getCellByPosition(i, j).setValue(2.5 * j + i);
177cdf0e10cSrcweir                 }
178cdf0e10cSrcweir         } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
179cdf0e10cSrcweir             e.printStackTrace(log);
180cdf0e10cSrcweir             throw new StatusException("Couldn't fill some cells", e);
181cdf0e10cSrcweir         }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         CellRangeAddress sCellRangeAddress = new CellRangeAddress();
184cdf0e10cSrcweir         sCellRangeAddress.Sheet = 0;
185cdf0e10cSrcweir         sCellRangeAddress.StartColumn = 1;
186cdf0e10cSrcweir         sCellRangeAddress.StartRow = 0;
187cdf0e10cSrcweir         sCellRangeAddress.EndColumn = 5;
188cdf0e10cSrcweir         sCellRangeAddress.EndRow = 5;
189cdf0e10cSrcweir 
190cdf0e10cSrcweir         TableFilterField[] filterFields = new TableFilterField[2];
191cdf0e10cSrcweir         filterFields[0] = new TableFilterField();
192cdf0e10cSrcweir         filterFields[0].Connection = com.sun.star.sheet.FilterConnection.AND;
193cdf0e10cSrcweir         filterFields[0].Field = 1;
194cdf0e10cSrcweir         filterFields[0].IsNumeric = true;
195cdf0e10cSrcweir         filterFields[0].NumericValue = 4;
196cdf0e10cSrcweir         filterFields[0].Operator = com.sun.star.sheet.FilterOperator.GREATER;
197cdf0e10cSrcweir         filterFields[1] = new TableFilterField();
198cdf0e10cSrcweir         filterFields[1].Connection = com.sun.star.sheet.FilterConnection.AND;
199cdf0e10cSrcweir         filterFields[1].Field = 1;
200cdf0e10cSrcweir         filterFields[1].IsNumeric = true;
201cdf0e10cSrcweir         filterFields[1].NumericValue = 12;
202cdf0e10cSrcweir         filterFields[1].Operator = com.sun.star.sheet.FilterOperator.LESS_EQUAL;
203cdf0e10cSrcweir 
204cdf0e10cSrcweir         XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
205cdf0e10cSrcweir             UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
206cdf0e10cSrcweir         log.println("Getting test object");
207cdf0e10cSrcweir         XDataPilotTables DPT = DPTS.getDataPilotTables();
208cdf0e10cSrcweir         XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
209cdf0e10cSrcweir         DPDsc.setSourceRange(sCellRangeAddress);
210cdf0e10cSrcweir 
211cdf0e10cSrcweir         XSheetFilterDescriptor SFD = DPDsc.getFilterDescriptor();
212cdf0e10cSrcweir         SFD.setFilterFields(filterFields);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         XPropertySet fieldPropSet = null;
215cdf0e10cSrcweir         try {
216cdf0e10cSrcweir             Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
217cdf0e10cSrcweir             fieldPropSet = (XPropertySet)
218cdf0e10cSrcweir                 UnoRuntime.queryInterface(XPropertySet.class, oDataPilotField);
219cdf0e10cSrcweir         } catch (com.sun.star.lang.WrappedTargetException e) {
220cdf0e10cSrcweir             e.printStackTrace(log);
221cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
222cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
223cdf0e10cSrcweir             e.printStackTrace(log);
224cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
225cdf0e10cSrcweir         }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir         try {
228cdf0e10cSrcweir             fieldPropSet.setPropertyValue("Function",
229cdf0e10cSrcweir                 com.sun.star.sheet.GeneralFunction.SUM);
230cdf0e10cSrcweir             fieldPropSet.setPropertyValue("Orientation",
231cdf0e10cSrcweir                 com.sun.star.sheet.DataPilotFieldOrientation.DATA);
232cdf0e10cSrcweir         } catch(com.sun.star.lang.WrappedTargetException e) {
233cdf0e10cSrcweir             e.printStackTrace(log);
234cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
235cdf0e10cSrcweir         } catch(com.sun.star.lang.IllegalArgumentException e) {
236cdf0e10cSrcweir             e.printStackTrace(log);
237cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
238cdf0e10cSrcweir         } catch(com.sun.star.beans.PropertyVetoException e) {
239cdf0e10cSrcweir             e.printStackTrace(log);
240cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
241cdf0e10cSrcweir         } catch(com.sun.star.beans.UnknownPropertyException e) {
242cdf0e10cSrcweir             e.printStackTrace(log);
243cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
244cdf0e10cSrcweir         }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir         if (DPT.hasByName("DataPilotTable")) {
247cdf0e10cSrcweir             DPT.removeByName("DataPilotTable");
248cdf0e10cSrcweir         }
249cdf0e10cSrcweir         DPT.insertNewByName("DataPilotTable", sCellAddress, DPDsc);
250cdf0e10cSrcweir         try {
251cdf0e10cSrcweir             oObj = (XInterface) AnyConverter.toObject(
252cdf0e10cSrcweir                 new Type(XInterface.class),DPT.getByName(DPT.getElementNames()[0]));
253cdf0e10cSrcweir         } catch (com.sun.star.lang.WrappedTargetException e) {
254cdf0e10cSrcweir             e.printStackTrace(log);
255cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
256cdf0e10cSrcweir         } catch (com.sun.star.container.NoSuchElementException e) {
257cdf0e10cSrcweir             e.printStackTrace(log);
258cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
259cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException e) {
260cdf0e10cSrcweir             e.printStackTrace(log);
261cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
262cdf0e10cSrcweir         }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir         log.println("Creating object - " +
265cdf0e10cSrcweir                                     ((oObj == null) ? "FAILED" : "OK"));
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         TestEnvironment tEnv = new TestEnvironment( oObj );
268cdf0e10cSrcweir 
269cdf0e10cSrcweir         // Other parameters required for interface tests
270cdf0e10cSrcweir         tEnv.addObjRelation("OUTPUTRANGE", sCellAddress);
271cdf0e10cSrcweir         tEnv.addObjRelation("CELLFORCHANGE", oChangeCell);
272cdf0e10cSrcweir         tEnv.addObjRelation("CELLFORCHECK", oCheckCell);
273cdf0e10cSrcweir         tEnv.addObjRelation("FIELDSAMOUNT", new Integer(5));
274cdf0e10cSrcweir         tEnv.addObjRelation("SHEETDOCUMENT", xSheetDoc);
275cdf0e10cSrcweir 
276cdf0e10cSrcweir         createTable2(oSheet, sCellRangeAddress, tEnv);
277cdf0e10cSrcweir 
278cdf0e10cSrcweir         return tEnv;
279cdf0e10cSrcweir     }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     /**
282cdf0e10cSrcweir      * Create a new DataPilot table output for use with testing XDataPilotTable2
283cdf0e10cSrcweir      * interface.
284cdf0e10cSrcweir      *
285cdf0e10cSrcweir      * @param oSheet current sheet instance
286cdf0e10cSrcweir      * @param srcRange source range
287cdf0e10cSrcweir      * @param tEnv test environment instance
288cdf0e10cSrcweir      */
createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv)289cdf0e10cSrcweir     private void createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv)
290cdf0e10cSrcweir     {
291cdf0e10cSrcweir         XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
292cdf0e10cSrcweir             UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
293cdf0e10cSrcweir         log.println("Creating test table object");
294cdf0e10cSrcweir         XDataPilotTables DPT = DPTS.getDataPilotTables();
295cdf0e10cSrcweir         XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
296cdf0e10cSrcweir         DPDsc.setSourceRange(srcRange);
297cdf0e10cSrcweir 
298cdf0e10cSrcweir         XIndexAccess xIA = DPDsc.getDataPilotFields();
299cdf0e10cSrcweir         int fieldCount = xIA.getCount() - 1; // skip the last field because it's always hidden.
300cdf0e10cSrcweir         try
301cdf0e10cSrcweir         {
302cdf0e10cSrcweir             for (int i = 0; i < fieldCount; ++i)
303cdf0e10cSrcweir             {
304cdf0e10cSrcweir                 Object o = xIA.getByIndex(i);
305cdf0e10cSrcweir                 XPropertySet fieldPropSet = (XPropertySet)UnoRuntime.queryInterface(
306cdf0e10cSrcweir                     XPropertySet.class, o);
307cdf0e10cSrcweir 
308cdf0e10cSrcweir                 if (i == fieldCount - 1)
309cdf0e10cSrcweir                 {
310cdf0e10cSrcweir                     // last field
311cdf0e10cSrcweir                     fieldPropSet.setPropertyValue(
312cdf0e10cSrcweir                         "Function", com.sun.star.sheet.GeneralFunction.SUM);
313cdf0e10cSrcweir                     fieldPropSet.setPropertyValue(
314cdf0e10cSrcweir                         "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.DATA);
315cdf0e10cSrcweir                 }
316cdf0e10cSrcweir                 else if (i%2 == 0)
317cdf0e10cSrcweir                 {
318cdf0e10cSrcweir                     // even number fields
319cdf0e10cSrcweir                     fieldPropSet.setPropertyValue(
320cdf0e10cSrcweir                         "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
321cdf0e10cSrcweir                 }
322cdf0e10cSrcweir                 else if (i%2 == 1)
323cdf0e10cSrcweir                 {
324cdf0e10cSrcweir                     // odd number fields
325cdf0e10cSrcweir                     fieldPropSet.setPropertyValue(
326cdf0e10cSrcweir                         "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.ROW);
327cdf0e10cSrcweir                 }
328cdf0e10cSrcweir             }
329cdf0e10cSrcweir 
330cdf0e10cSrcweir             if (DPT.hasByName("DataPilotTable2"))
331cdf0e10cSrcweir                 DPT.removeByName("DataPilotTable2");
332cdf0e10cSrcweir 
333cdf0e10cSrcweir             CellAddress destAddr = new CellAddress();
334cdf0e10cSrcweir             destAddr.Sheet = 0;
335cdf0e10cSrcweir             destAddr.Column = 0;
336cdf0e10cSrcweir             destAddr.Row = 14;
337cdf0e10cSrcweir             DPT.insertNewByName("DataPilotTable2", destAddr, DPDsc);
338cdf0e10cSrcweir 
339cdf0e10cSrcweir             Object o = DPT.getByName("DataPilotTable2");
340cdf0e10cSrcweir             tEnv.addObjRelation("DATAPILOTTABLE2", o);
341cdf0e10cSrcweir         }
342cdf0e10cSrcweir         catch (com.sun.star.uno.Exception e)
343cdf0e10cSrcweir         {
344cdf0e10cSrcweir             e.printStackTrace(log);
345cdf0e10cSrcweir             throw new StatusException("Couldn't create a test environment", e);
346cdf0e10cSrcweir         }
347cdf0e10cSrcweir     }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 
352