1ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ef39d40dSAndrew Rist  * distributed with this work for additional information
6ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ef39d40dSAndrew Rist  *
11ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ef39d40dSAndrew Rist  *
13ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18ef39d40dSAndrew Rist  * under the License.
19ef39d40dSAndrew Rist  *
20ef39d40dSAndrew Rist  *************************************************************/
21ef39d40dSAndrew Rist 
22ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.sheet;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import com.sun.star.sheet.CellFlags;
29cdf0e10cSrcweir import com.sun.star.sheet.XArrayFormulaRange;
30cdf0e10cSrcweir import com.sun.star.sheet.XCellRangeAddressable;
31cdf0e10cSrcweir import com.sun.star.sheet.XSheetCellCursor;
32cdf0e10cSrcweir import com.sun.star.sheet.XSheetOperation;
33cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet;
34cdf0e10cSrcweir import com.sun.star.table.CellRangeAddress;
35cdf0e10cSrcweir import com.sun.star.table.XCellRange;
36cdf0e10cSrcweir import com.sun.star.table.XColumnRowRange;
37cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
38cdf0e10cSrcweir import com.sun.star.util.XMergeable;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir /**
41cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.XSheetCellCursor</code>
42cdf0e10cSrcweir * interface methods :
43cdf0e10cSrcweir * <ul>
44cdf0e10cSrcweir *  <li><code> collapseToCurrentRegion()</code></li>
45cdf0e10cSrcweir *  <li><code> collapseToCurrentArray()</code></li>
46cdf0e10cSrcweir *  <li><code> collapseToMergedArea()</code></li>
47cdf0e10cSrcweir *  <li><code> expandToEntireColumns()</code></li>
48cdf0e10cSrcweir *  <li><code> expandToEntireRows()</code></li>
49cdf0e10cSrcweir *  <li><code> collapseToSize()</code></li>
50cdf0e10cSrcweir * </ul> <p>
51cdf0e10cSrcweir * Component must also implement the following interfaces :
52cdf0e10cSrcweir * <ul>
53cdf0e10cSrcweir *  <li> <code> com.sun.star.sheet.XCellRangeAddressable </code> :
54cdf0e10cSrcweir *  to get range address </li>
55cdf0e10cSrcweir * <ul> <p>
56cdf0e10cSrcweir * Range of cursor must be of size 4 x 4. <p>
57cdf0e10cSrcweir * @see com.sun.star.sheet.XSheetCellCursor
58cdf0e10cSrcweir */
59cdf0e10cSrcweir public class _XSheetCellCursor extends MultiMethodTest {
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     public XSheetCellCursor oObj = null;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     /**
64cdf0e10cSrcweir     * Test creates the array formula, assigns this array to another array,
65cdf0e10cSrcweir     * collapses cursor into one cell, applies method, checks the size of the
66cdf0e10cSrcweir     * result range, erases array formula, checks that array formula has been
67cdf0e10cSrcweir     * cleared. <p>
68cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions were thrown, if size of the result
69cdf0e10cSrcweir     * range is equal to size of the range where the array formula was set and
70cdf0e10cSrcweir     * if array formula was successfully cleared. <p>
71cdf0e10cSrcweir     */
_collapseToCurrentArray()72cdf0e10cSrcweir     public void _collapseToCurrentArray() {
73cdf0e10cSrcweir         boolean bResult = false;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         XCellRangeAddressable crAddr = (XCellRangeAddressable)
76cdf0e10cSrcweir             UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
77cdf0e10cSrcweir         CellRangeAddress addr = crAddr.getRangeAddress() ;
78cdf0e10cSrcweir         int leftCol = addr.StartColumn ;
79cdf0e10cSrcweir         int topRow = addr.StartRow ;
80cdf0e10cSrcweir         int width = addr.EndColumn - addr.StartColumn + 1 ;
81cdf0e10cSrcweir         int height = addr.EndRow - addr.StartRow + 1 ;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         log.println( "Object area is ((" + leftCol + "," + topRow + "),(" +
84cdf0e10cSrcweir             (leftCol + width - 1) + "," + (topRow + height - 1) + ")" );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir         XCellRange new_range = null;
87cdf0e10cSrcweir         try {
88cdf0e10cSrcweir             // first we need to create an array formula
89cdf0e10cSrcweir             new_range =
90cdf0e10cSrcweir                 oObj.getCellRangeByPosition(0, 0, 0, height - 1);
91cdf0e10cSrcweir         } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
92cdf0e10cSrcweir             log.print("Get cell range by position failed: ");
93cdf0e10cSrcweir             e.printStackTrace(log);
94cdf0e10cSrcweir             tRes.tested("collapseToCurrentArray()", false);
95cdf0e10cSrcweir         }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir         log.println("DB: Successfully new range created");
98cdf0e10cSrcweir         XArrayFormulaRange arrFormulaRange = (XArrayFormulaRange)
99cdf0e10cSrcweir             UnoRuntime.queryInterface (XArrayFormulaRange.class, new_range);
100cdf0e10cSrcweir         // write a simple formula (this array assigns another array)
101cdf0e10cSrcweir         arrFormulaRange.setArrayFormula("A1:A" + height) ;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         // collapse cursor into one cell and then try to apply the method
104cdf0e10cSrcweir         oObj.collapseToSize (1, 1) ;
105cdf0e10cSrcweir         oObj.collapseToCurrentArray() ;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         // check the size of result range
108cdf0e10cSrcweir         int cols = ( (XColumnRowRange)UnoRuntime.queryInterface(
109cdf0e10cSrcweir                   XColumnRowRange.class, oObj) ).getColumns().getCount();
110cdf0e10cSrcweir         int rows = ( (XColumnRowRange)UnoRuntime.queryInterface(
111cdf0e10cSrcweir                   XColumnRowRange.class, oObj) ).getRows().getCount();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         if (cols == 1 && rows == height) {
114cdf0e10cSrcweir             bResult = true;
115cdf0e10cSrcweir         } else {
116cdf0e10cSrcweir             bResult = false;
117cdf0e10cSrcweir             log.println("The size of cell range must be 1x" + height +
118cdf0e10cSrcweir                 ", but after method call it was " + cols + "x" + rows);
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir         // erase array formula
122cdf0e10cSrcweir         arrFormulaRange.setArrayFormula("");
123cdf0e10cSrcweir 
124cdf0e10cSrcweir         // check if array formula has been cleared with last statement
125cdf0e10cSrcweir         try {
126cdf0e10cSrcweir             // if array formula isn't cleared exception is thrown
127cdf0e10cSrcweir             new_range.getCellByPosition(0,0).setValue(111) ;
128cdf0e10cSrcweir         } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
129cdf0e10cSrcweir             bResult = false ;
130cdf0e10cSrcweir             log.println(
131cdf0e10cSrcweir                 "Array formula hasn't been cleared with setArrayFormula(\"\")");
132cdf0e10cSrcweir             XSheetOperation clearRange = (XSheetOperation)
133cdf0e10cSrcweir                 UnoRuntime.queryInterface (XSheetOperation.class, new_range);
134cdf0e10cSrcweir             int allFlags =
135cdf0e10cSrcweir                 CellFlags.ANNOTATION | CellFlags.DATETIME | CellFlags.EDITATTR;
136cdf0e10cSrcweir             allFlags = allFlags
137cdf0e10cSrcweir                 | CellFlags.HARDATTR | CellFlags.OBJECTS | CellFlags.STRING;
138cdf0e10cSrcweir             allFlags = allFlags
139cdf0e10cSrcweir                 | CellFlags.VALUE | CellFlags.FORMULA | CellFlags.STYLES;
140cdf0e10cSrcweir             clearRange.clearContents(allFlags) ;
141cdf0e10cSrcweir         }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         tRes.tested("collapseToCurrentArray()", bResult );
144cdf0e10cSrcweir     }
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     /**
147cdf0e10cSrcweir     * Test clears contents of spreadsheet, collapses cursor to current range,
148cdf0e10cSrcweir     * checks size of cursor range, fills a cell that is close to
149cdf0e10cSrcweir     * cursor range, collapses cursor to current range, checks size of cursor
150cdf0e10cSrcweir     * range again and restores original size. <p>
151cdf0e10cSrcweir     * Has <b> OK </b> status if after clearing of content and collapsing cursor
152cdf0e10cSrcweir     * range size remains 4 x 4, if after filling of cell and collapsing cursor
153cdf0e10cSrcweir     * range extends by one in both dimensions and no exceptions were thrown.<p>
154cdf0e10cSrcweir     */
_collapseToCurrentRegion()155cdf0e10cSrcweir     public void _collapseToCurrentRegion(){
156cdf0e10cSrcweir         boolean bResult = true;
157cdf0e10cSrcweir         int width = 4, height = 4;
158cdf0e10cSrcweir         int leftCol = -1, topRow = -1;
159cdf0e10cSrcweir 
160cdf0e10cSrcweir         XSpreadsheet oSheet = oObj.getSpreadsheet();
161cdf0e10cSrcweir         ((XSheetOperation) UnoRuntime.queryInterface(
162cdf0e10cSrcweir             XSheetOperation.class, oSheet) ).clearContents(65535);
163cdf0e10cSrcweir         oObj.collapseToCurrentRegion();
164cdf0e10cSrcweir         int cols = ((XColumnRowRange)
165cdf0e10cSrcweir             UnoRuntime.queryInterface(
166cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getColumns().getCount();
167cdf0e10cSrcweir         int rows = ((XColumnRowRange)
168cdf0e10cSrcweir             UnoRuntime.queryInterface(
169cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getRows().getCount();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir         if (cols != width || rows != height) {
172cdf0e10cSrcweir             bResult = false ;
173cdf0e10cSrcweir             log.println("After collapseToCurrentRegion()"
174cdf0e10cSrcweir                  + " call Region must have size " + width + "x" + height
175cdf0e10cSrcweir                  + " but it is " + cols + "x" + rows);
176cdf0e10cSrcweir         }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir         // if previous test was successful try more complicated case
179cdf0e10cSrcweir         if (bResult) {
180cdf0e10cSrcweir             if (leftCol != -1 && topRow != -1) {
181cdf0e10cSrcweir                 try {
182cdf0e10cSrcweir                     oSheet.getCellByPosition(
183cdf0e10cSrcweir                         leftCol + width, topRow + height).setValue(1);
184cdf0e10cSrcweir                 } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
185cdf0e10cSrcweir                     log.print("Can't get cell by position:");
186cdf0e10cSrcweir                     e.printStackTrace(log);
187cdf0e10cSrcweir                     bResult = false;
188cdf0e10cSrcweir                 }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir                 oObj.collapseToCurrentRegion() ;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir                 // checking results
193cdf0e10cSrcweir                 cols = ((XColumnRowRange)
194cdf0e10cSrcweir                     UnoRuntime.queryInterface(
195cdf0e10cSrcweir                         XColumnRowRange.class, oObj)).getColumns().getCount();
196cdf0e10cSrcweir                 rows = ((XColumnRowRange)
197cdf0e10cSrcweir                     UnoRuntime.queryInterface(
198cdf0e10cSrcweir                         XColumnRowRange.class, oObj)).getRows().getCount();
199cdf0e10cSrcweir 
200cdf0e10cSrcweir                 if (cols == width + 1 && rows == height + 1) {
201cdf0e10cSrcweir                     bResult &= true;
202cdf0e10cSrcweir                 } else {
203cdf0e10cSrcweir                     bResult = false;
204cdf0e10cSrcweir                     log.println("After collapseToCurrentRegion() call [2]"
205cdf0e10cSrcweir                          + " region must have size " + (width+1) + "x"
206cdf0e10cSrcweir                          + (height + 1) + " but it is " + cols + "x" + rows );
207cdf0e10cSrcweir                 }
208cdf0e10cSrcweir             }
209cdf0e10cSrcweir         }
210cdf0e10cSrcweir 
211cdf0e10cSrcweir         tRes.tested("collapseToCurrentRegion()", bResult);
212cdf0e10cSrcweir 
213cdf0e10cSrcweir         // restore original size
214cdf0e10cSrcweir         oObj.collapseToSize(width, height);
215cdf0e10cSrcweir     }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     /**
218cdf0e10cSrcweir     * Test merges a cells of range that has a greater size, collapses cursor to
219cdf0e10cSrcweir     * merged area, checks size of cursor range and restores original size
220cdf0e10cSrcweir     * of cursor range. <p>
221cdf0e10cSrcweir     * Has <b> OK </b> status if after merging of cells and collapsing cursor
222cdf0e10cSrcweir     * range extends by one in both dimensions and no exceptions were thrown.<p>
223cdf0e10cSrcweir     */
_collapseToMergedArea()224cdf0e10cSrcweir     public void _collapseToMergedArea(){
225cdf0e10cSrcweir         int width = 1, height = 1 ;
226cdf0e10cSrcweir         int leftCol = 0, topRow = 0 ;
227cdf0e10cSrcweir 
228cdf0e10cSrcweir         boolean bResult = true ;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir         log.println("DB: Starting collapseToMergedArea() method test ...") ;
231cdf0e10cSrcweir         XSpreadsheet oSheet = oObj.getSpreadsheet() ;
232cdf0e10cSrcweir         log.println ("DB: got Spreadsheet.") ;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir         XCellRange newRange = null;
235cdf0e10cSrcweir         try {
236cdf0e10cSrcweir             newRange = oSheet.getCellRangeByPosition (
237cdf0e10cSrcweir                 leftCol + width - 1, topRow + height - 1,
238cdf0e10cSrcweir                 leftCol + width, topRow + height );
239cdf0e10cSrcweir         } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
240cdf0e10cSrcweir             log.println("Can't get cell range by position");
241cdf0e10cSrcweir             e.printStackTrace(log);
242cdf0e10cSrcweir             bResult = false;
243cdf0e10cSrcweir         }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         XMergeable mergeRange = (XMergeable)
246cdf0e10cSrcweir             UnoRuntime.queryInterface (XMergeable.class, newRange);
247cdf0e10cSrcweir         if (mergeRange == null) {
248cdf0e10cSrcweir             log.println("DB: newRange doesn't implement XMergeable interface");
249cdf0e10cSrcweir         } else {
250cdf0e10cSrcweir             log.println("DB: XMergeable interface successfully queried.");
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         mergeRange.merge(true);
254*30acf5e8Spfg         log.println("DB: Successfully merged.") ;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         oObj.collapseToMergedArea() ;
257bb6af6bcSPedro Giffuni         log.println("DB: Successfully collapseToMergedArea() method called");
258cdf0e10cSrcweir 
259cdf0e10cSrcweir         // unmerge area to restore SpreadSheet
260cdf0e10cSrcweir         mergeRange.merge(false);
261cdf0e10cSrcweir         log.println("DB: Successfully unmerged.") ;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         // checking results
264cdf0e10cSrcweir         int cols = ((XColumnRowRange)
265cdf0e10cSrcweir             UnoRuntime.queryInterface(
266cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getColumns().getCount();
267cdf0e10cSrcweir         int rows = ((XColumnRowRange)
268cdf0e10cSrcweir             UnoRuntime.queryInterface(
269cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getRows().getCount();
270bb6af6bcSPedro Giffuni         log.println("DB: Column and row numbers successfully get") ;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir         if (cols == width + 1  && rows == height + 3) {
273cdf0e10cSrcweir             bResult &= true;
274cdf0e10cSrcweir         } else {
275cdf0e10cSrcweir             bResult = false;
276cdf0e10cSrcweir             log.println(
277cdf0e10cSrcweir                 "After collapseToMergedArea() call region must have size "
278cdf0e10cSrcweir                 + (width + 1) + "x" + (height + 1) + " but it is " + cols
279cdf0e10cSrcweir                 + "x" + rows );
280cdf0e10cSrcweir         }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         tRes.tested("collapseToMergedArea()", bResult) ;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir         // restore original size
285cdf0e10cSrcweir         oObj.collapseToSize(width, height);
286cdf0e10cSrcweir     }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     /**
289cdf0e10cSrcweir     * Test collapses cursor to the new size, checks size
290cdf0e10cSrcweir     * of cursor range and restores original size of cursor range. <p>
291cdf0e10cSrcweir     * Has <b> OK </b> status if after collapsing cursor
292cdf0e10cSrcweir     * range extends by three in both dimensions. <p>
293cdf0e10cSrcweir     */
_collapseToSize()294cdf0e10cSrcweir     public void _collapseToSize(){
295cdf0e10cSrcweir         boolean bResult = false;
296cdf0e10cSrcweir         int width = 1, height = 1;
297cdf0e10cSrcweir 
298cdf0e10cSrcweir         // collapseToSize() method test
299cdf0e10cSrcweir         oObj.collapseToSize (width + 3, height + 3);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir         // checking results
302cdf0e10cSrcweir         int cols = ((XColumnRowRange)
303cdf0e10cSrcweir             UnoRuntime.queryInterface(
304cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getColumns().getCount();
305cdf0e10cSrcweir         int rows = ((XColumnRowRange)
306cdf0e10cSrcweir             UnoRuntime.queryInterface(
307cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getRows().getCount();
308cdf0e10cSrcweir 
309cdf0e10cSrcweir         if (cols == width + 3  && rows == height + 3) {
310cdf0e10cSrcweir             bResult = true ;
311cdf0e10cSrcweir         } else {
312cdf0e10cSrcweir             bResult = false ;
313cdf0e10cSrcweir             log.println( "After collapseToSize() call region must have size "
314cdf0e10cSrcweir                 + (width + 3) + "x" + (height + 3) + " but it is "
315cdf0e10cSrcweir                 + cols + "x" +rows);
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir         tRes.tested("collapseToSize()", bResult) ;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir         // restore original size
321cdf0e10cSrcweir         oObj.collapseToSize(width, height) ;
322cdf0e10cSrcweir     }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir     /**
325cdf0e10cSrcweir     * Test expands cursor to entire columns, checks size
326cdf0e10cSrcweir     * of cursor range and restores original size of cursor range. <p>
327cdf0e10cSrcweir     * Has <b> OK </b> status if after expanding cursor
328cdf0e10cSrcweir     * range extends to all rows in the columns (number of rows is greater than
329cdf0e10cSrcweir     * 32000 and number of columns remains the same). <p>
330cdf0e10cSrcweir     */
_expandToEntireColumns()331cdf0e10cSrcweir     public void _expandToEntireColumns(){
332cdf0e10cSrcweir         boolean bResult = false;
333cdf0e10cSrcweir         int width = 1, height = 1 ;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir         // expandToEntireColumns() method test
336cdf0e10cSrcweir         oObj.expandToEntireColumns () ;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         // checking results
339cdf0e10cSrcweir         int cols = ((XColumnRowRange)
340cdf0e10cSrcweir             UnoRuntime.queryInterface(
341cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getColumns().getCount();
342cdf0e10cSrcweir         int rows = ((XColumnRowRange)
343cdf0e10cSrcweir             UnoRuntime.queryInterface(
344cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getRows().getCount();
345cdf0e10cSrcweir 
346cdf0e10cSrcweir         if (cols == width && rows >= 32000) {
347cdf0e10cSrcweir             bResult = true ;
348cdf0e10cSrcweir         } else {
349cdf0e10cSrcweir             bResult = false ;
350cdf0e10cSrcweir             log.println(
351cdf0e10cSrcweir                 "After expandToEntireColumns() call region must have size "+
352cdf0e10cSrcweir                 width + "x(>=32000) but it is " + cols + "x" + rows);
353cdf0e10cSrcweir         }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         tRes.tested("expandToEntireColumns()", bResult) ;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         // restore original size
358cdf0e10cSrcweir         oObj.collapseToSize(width, height) ;
359cdf0e10cSrcweir     }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     /**
362cdf0e10cSrcweir     * Test expands cursor to entire rows, checks size
363cdf0e10cSrcweir     * of cursor range and restores original size of cursor range. <p>
364cdf0e10cSrcweir     * Has <b> OK </b> status if after expanding cursor
365cdf0e10cSrcweir     * range extends to all columns in the rows (number of columns is greater
366cdf0e10cSrcweir     * than 256 and number of rows remains the same). <p>
367cdf0e10cSrcweir     */
_expandToEntireRows()368cdf0e10cSrcweir     public void _expandToEntireRows(){
369cdf0e10cSrcweir         boolean bResult = false;
370cdf0e10cSrcweir         int width = 1, height = 1 ;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir         // expandToEntireRows() method test
373cdf0e10cSrcweir         oObj.expandToEntireRows () ;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir         // checking results
376cdf0e10cSrcweir         int cols = ((XColumnRowRange)
377cdf0e10cSrcweir             UnoRuntime.queryInterface(
378cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getColumns().getCount();
379cdf0e10cSrcweir         int rows = ((XColumnRowRange)
380cdf0e10cSrcweir             UnoRuntime.queryInterface(
381cdf0e10cSrcweir                 XColumnRowRange.class, oObj) ).getRows().getCount();
382cdf0e10cSrcweir 
383cdf0e10cSrcweir         if (cols >= 256 && rows == height) {
384cdf0e10cSrcweir             bResult = true;
385cdf0e10cSrcweir         } else {
386cdf0e10cSrcweir             bResult = false ;
387cdf0e10cSrcweir             log.println("After expandToEntireRows() call region " +
388cdf0e10cSrcweir                 "must have size (>=256)x" + height + " but it is " +
389cdf0e10cSrcweir                 cols + "x" + rows );
390cdf0e10cSrcweir         }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir         tRes.tested("expandToEntireRows()", bResult) ;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir         // restore original size
395cdf0e10cSrcweir         oObj.collapseToSize(width, height) ;
396cdf0e10cSrcweir     }
397cdf0e10cSrcweir 
398cdf0e10cSrcweir } // EOC _XSheetCellCursor
399cdf0e10cSrcweir 
400