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 lib.MultiMethodTest; 27 28 import com.sun.star.sheet.XSheetCellCursor; 29 import com.sun.star.sheet.XSheetCellRange; 30 import com.sun.star.sheet.XSpreadsheet; 31 import com.sun.star.table.XCellRange; 32 import com.sun.star.uno.UnoRuntime; 33 34 /** 35 * Testing <code>com.sun.star.sheet.XSpreadsheet</code> 36 * interface methods : 37 * <ul> 38 * <li><code> createCursor()</code></li> 39 * <li><code> createCursorByRange()</code></li> 40 * </ul> <p> 41 * @see com.sun.star.sheet.XSpreadsheet 42 */ 43 public class _XSpreadsheet extends MultiMethodTest { 44 45 // oObj filled by MultiMethodTest 46 public XSpreadsheet oObj = null; 47 48 /** 49 * Test calls the method and checks returned value. <p> 50 * Has <b> OK </b> status if returned value isn't null. <p> 51 */ _createCursor()52 public void _createCursor() { 53 log.println("Testing createCursor"); 54 XSheetCellCursor oCursor = oObj.createCursor() ; 55 tRes.tested("createCursor()", oCursor != null); 56 } 57 58 /** 59 * Test gets a cell range, call method using this cell range 60 * and checks returned value. <p> 61 * Has <b> OK </b> status if returned value isn't null 62 * and no exceptions were thrown. <p> 63 */ _createCursorByRange()64 public void _createCursorByRange() { 65 log.println("Testing createCursorByRange"); 66 67 log.println("getting cellrange"); 68 XCellRange oRange = null; 69 try { 70 oRange = oObj.getCellRangeByPosition (1, 1, 2, 3); 71 } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 72 log.println("Can't get cell range by address"); 73 e.printStackTrace(log); 74 tRes.tested("createCursorByRange()", false); 75 } 76 77 XSheetCellRange oSheetRange = (XSheetCellRange) 78 UnoRuntime.queryInterface(XSheetCellRange.class, oRange) ; 79 log.println("getting Cursor"); 80 XSheetCellCursor oCursor = oObj.createCursorByRange(oSheetRange); 81 tRes.tested("createCursorByRange()", oCursor != null); 82 } 83 84 } // finisch class _XSpreadsheet 85 86 87