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 ifc.sheet; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import lib.MultiMethodTest; 27cdf0e10cSrcweir import lib.Status; 28cdf0e10cSrcweir import lib.StatusException; 29cdf0e10cSrcweir 30cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 31cdf0e10cSrcweir import com.sun.star.container.XIndexAccess; 32cdf0e10cSrcweir import com.sun.star.container.XNamed; 33cdf0e10cSrcweir import com.sun.star.sheet.DataPilotFieldOrientation; 34cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotDescriptor; 35cdf0e10cSrcweir import com.sun.star.table.CellRangeAddress; 36cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 37cdf0e10cSrcweir 38cdf0e10cSrcweir /** 39cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.XDataPilotDescriptor</code> 40cdf0e10cSrcweir * interface methods : 41cdf0e10cSrcweir * <ul> 42cdf0e10cSrcweir * <li><code> getTag()</code></li> 43cdf0e10cSrcweir * <li><code> setTag()</code></li> 44cdf0e10cSrcweir * <li><code> getSourceRange()</code></li> 45cdf0e10cSrcweir * <li><code> setSourceRange()</code></li> 46cdf0e10cSrcweir * <li><code> getFilterDescriptor()</code></li> 47cdf0e10cSrcweir * <li><code> getDataPilotFields()</code></li> 48cdf0e10cSrcweir * <li><code> getColumnFields()</code></li> 49cdf0e10cSrcweir * <li><code> getRowFields()</code></li> 50cdf0e10cSrcweir * <li><code> getPageFields()</code></li> 51cdf0e10cSrcweir * <li><code> getDataFields()</code></li> 52cdf0e10cSrcweir * <li><code> getHiddenFields()</code></li> 53cdf0e10cSrcweir * </ul> <p> 54cdf0e10cSrcweir * This test needs the following object relations : 55cdf0e10cSrcweir * <ul> 56cdf0e10cSrcweir * <li> <code>'FIELDSAMOUNT'</code> (of type <code>Integer</code>): 57cdf0e10cSrcweir * to have number of fields </li> 58cdf0e10cSrcweir * <ul> <p> 59cdf0e10cSrcweir * @see com.sun.star.sheet.XDataPilotDescriptor 60cdf0e10cSrcweir */ 61cdf0e10cSrcweir public class _XDataPilotDescriptor extends MultiMethodTest { 62cdf0e10cSrcweir 63cdf0e10cSrcweir public XDataPilotDescriptor oObj = null; 64cdf0e10cSrcweir CellRangeAddress CRA = new CellRangeAddress((short)1, 1, 1, 5, 5); 65cdf0e10cSrcweir CellRangeAddress oldCRA = null ; 66cdf0e10cSrcweir String sTag = new String ("XDataPilotDescriptor_Tag"); 67cdf0e10cSrcweir String fieldsNames[]; 68cdf0e10cSrcweir int fieldsAmount = 0; 69cdf0e10cSrcweir int tEnvFieldsAmount = 0; 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** 72cdf0e10cSrcweir * Retrieves object relations. 73cdf0e10cSrcweir * @throws StatusException If one of relations not found. 74cdf0e10cSrcweir */ before()75cdf0e10cSrcweir protected void before() { 76cdf0e10cSrcweir Integer amount = (Integer)tEnv.getObjRelation("FIELDSAMOUNT"); 77cdf0e10cSrcweir if (amount == null) throw new StatusException(Status.failed 78cdf0e10cSrcweir ("Relation 'FIELDSAMOUNT' not found")); 79cdf0e10cSrcweir tEnvFieldsAmount = amount.intValue(); 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir /** 83cdf0e10cSrcweir * Test calls the method and compares returned value with value that was set 84cdf0e10cSrcweir * in method <code>setSourceRange()</code>. <p> 85cdf0e10cSrcweir * Has <b> OK </b> status if all fields of cell range addresses are equal. <p> 86cdf0e10cSrcweir * The following method tests are to be completed successfully before : 87cdf0e10cSrcweir * <ul> 88cdf0e10cSrcweir * <li> <code> setSourceRange() </code> : to have current source range </li> 89cdf0e10cSrcweir * </ul> 90cdf0e10cSrcweir */ _getSourceRange()91cdf0e10cSrcweir public void _getSourceRange(){ 92cdf0e10cSrcweir requiredMethod("setSourceRange()"); 93cdf0e10cSrcweir boolean bResult = true; 94cdf0e10cSrcweir 95cdf0e10cSrcweir CellRangeAddress objRA = oObj.getSourceRange(); 96cdf0e10cSrcweir bResult &= objRA.Sheet == CRA.Sheet; 97cdf0e10cSrcweir bResult &= objRA.StartRow == CRA.StartRow; 98cdf0e10cSrcweir bResult &= objRA.StartColumn == CRA.StartColumn; 99cdf0e10cSrcweir bResult &= objRA.EndRow == CRA.EndRow; 100cdf0e10cSrcweir bResult &= objRA.EndColumn == CRA.EndColumn; 101cdf0e10cSrcweir 102cdf0e10cSrcweir tRes.tested("getSourceRange()", bResult); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir /** 106cdf0e10cSrcweir * Test gets the current source range, stores it and sets new source range.<p> 107cdf0e10cSrcweir * Has <b> OK </b> status if the method successfully returns. <p> 108cdf0e10cSrcweir * The following method tests are to be executed before : 109cdf0e10cSrcweir * <ul> 110cdf0e10cSrcweir * <li> <code> getColumnFields() </code> </li> 111cdf0e10cSrcweir * <li> <code> getRowFields() </code> </li> 112cdf0e10cSrcweir * <li> <code> getDataFields() </code> </li> 113cdf0e10cSrcweir * <li> <code> getHiddenFields() </code> </li> 114cdf0e10cSrcweir * <li> <code> getPageFields() </code> </li> 115cdf0e10cSrcweir * </ul> 116cdf0e10cSrcweir */ _setSourceRange()117cdf0e10cSrcweir public void _setSourceRange(){ 118cdf0e10cSrcweir executeMethod("getColumnFields()") ; 119cdf0e10cSrcweir executeMethod("getRowFields()") ; 120cdf0e10cSrcweir executeMethod("getDataFields()") ; 121cdf0e10cSrcweir executeMethod("getHiddenFields()") ; 122cdf0e10cSrcweir executeMethod("getPageFields()") ; 123cdf0e10cSrcweir 124cdf0e10cSrcweir oldCRA = oObj.getSourceRange() ; 125cdf0e10cSrcweir oObj.setSourceRange(CRA); 126cdf0e10cSrcweir 127cdf0e10cSrcweir tRes.tested("setSourceRange()", true); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir /** 131cdf0e10cSrcweir * Test calls the method and checks returned value with value that was set 132cdf0e10cSrcweir * by method <code>setTag()</code>. <p> 133cdf0e10cSrcweir * Has <b> OK </b> status if returned value is equal to value that was set 134cdf0e10cSrcweir * by method <code>setTag()</code>. <p> 135cdf0e10cSrcweir * The following method tests are to be completed successfully before : 136cdf0e10cSrcweir * <ul> 137cdf0e10cSrcweir * <li> <code> setTag() </code> : to have current tag </li> 138cdf0e10cSrcweir * </ul> 139cdf0e10cSrcweir */ _getTag()140cdf0e10cSrcweir public void _getTag(){ 141cdf0e10cSrcweir requiredMethod("setTag()"); 142cdf0e10cSrcweir boolean bResult = true; 143cdf0e10cSrcweir 144cdf0e10cSrcweir String objTag = oObj.getTag(); 145cdf0e10cSrcweir bResult &= objTag.equals(sTag); 146cdf0e10cSrcweir 147cdf0e10cSrcweir tRes.tested("getTag()", bResult); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir /** 151cdf0e10cSrcweir * Test just calls the method. <p> 152cdf0e10cSrcweir * Has <b> OK </b> status if the method successfully returns. <p> 153cdf0e10cSrcweir */ _setTag()154cdf0e10cSrcweir public void _setTag(){ 155cdf0e10cSrcweir oObj.setTag(sTag); 156cdf0e10cSrcweir tRes.tested("setTag()", true); 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir /** 160cdf0e10cSrcweir * Test calls the method , checks returned value, compares 161cdf0e10cSrcweir * number of fields goten from returned value and obtained by object 162cdf0e10cSrcweir * relation <code>'FIELDSAMOUNT'</code> and set property 163cdf0e10cSrcweir * <code>Orientation</code> to one of DataPilotFieldOrientation values. <p> 164cdf0e10cSrcweir * Has <b> OK </b> status if returned value isn't null, number of fields 165cdf0e10cSrcweir * goten from returned value is less than number of fields obtained by relation 166cdf0e10cSrcweir * and no exceptions were thrown. <p> 167cdf0e10cSrcweir */ _getDataPilotFields()168cdf0e10cSrcweir public void _getDataPilotFields(){ 169cdf0e10cSrcweir boolean bResult = true; 170cdf0e10cSrcweir XIndexAccess IA = null; 171cdf0e10cSrcweir 172cdf0e10cSrcweir IA = oObj.getDataPilotFields(); 173cdf0e10cSrcweir if (IA == null) { 174cdf0e10cSrcweir log.println("Returned value is null."); 175cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 176cdf0e10cSrcweir return; 177cdf0e10cSrcweir } else {log.println("getDataPilotFields returned not Null value -- OK");} 178cdf0e10cSrcweir 179cdf0e10cSrcweir fieldsAmount = IA.getCount(); 180cdf0e10cSrcweir if (fieldsAmount < tEnvFieldsAmount) { 181cdf0e10cSrcweir log.println("Number of fields is less than number goten by relation."); 182cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 183cdf0e10cSrcweir return; 184cdf0e10cSrcweir } else {log.println("count of returned fields -- OK");} 185cdf0e10cSrcweir 186cdf0e10cSrcweir fieldsNames = new String[tEnvFieldsAmount]; 187cdf0e10cSrcweir int i = -1 ; 188cdf0e10cSrcweir int cnt = 0 ; 189cdf0e10cSrcweir while (++i < fieldsAmount) { 190cdf0e10cSrcweir Object field; 191cdf0e10cSrcweir try { 192cdf0e10cSrcweir field = IA.getByIndex(i); 193cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 194cdf0e10cSrcweir e.printStackTrace(log); 195cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 196cdf0e10cSrcweir return; 197cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 198cdf0e10cSrcweir e.printStackTrace(log); 199cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 200cdf0e10cSrcweir return; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir XNamed named = (XNamed) 204cdf0e10cSrcweir UnoRuntime.queryInterface(XNamed.class, field); 205cdf0e10cSrcweir String name = named.getName(); 206cdf0e10cSrcweir 207cdf0e10cSrcweir log.print("Field : '" + name + "' ... ") ; 208cdf0e10cSrcweir 209cdf0e10cSrcweir if (!name.equals("Data")) { 210cdf0e10cSrcweir 211cdf0e10cSrcweir fieldsNames[cnt] = name ; 212cdf0e10cSrcweir 213cdf0e10cSrcweir XPropertySet props = (XPropertySet) 214cdf0e10cSrcweir UnoRuntime.queryInterface(XPropertySet.class, field); 215cdf0e10cSrcweir 216cdf0e10cSrcweir try { 217cdf0e10cSrcweir switch (cnt % 5) { 218cdf0e10cSrcweir case 0 : 219cdf0e10cSrcweir props.setPropertyValue("Orientation", 220cdf0e10cSrcweir DataPilotFieldOrientation.COLUMN); 221cdf0e10cSrcweir log.println(" Column") ; 222cdf0e10cSrcweir break; 223cdf0e10cSrcweir case 1 : 224cdf0e10cSrcweir props.setPropertyValue("Orientation", 225cdf0e10cSrcweir DataPilotFieldOrientation.ROW); 226cdf0e10cSrcweir log.println(" Row") ; 227cdf0e10cSrcweir break; 228cdf0e10cSrcweir case 2 : 229cdf0e10cSrcweir props.setPropertyValue("Orientation", 230cdf0e10cSrcweir DataPilotFieldOrientation.DATA); 231cdf0e10cSrcweir log.println(" Data") ; 232cdf0e10cSrcweir break; 233cdf0e10cSrcweir case 3 : 234cdf0e10cSrcweir props.setPropertyValue("Orientation", 235cdf0e10cSrcweir DataPilotFieldOrientation.HIDDEN); 236cdf0e10cSrcweir log.println(" Hidden") ; 237cdf0e10cSrcweir break; 238cdf0e10cSrcweir case 4 : 239cdf0e10cSrcweir props.setPropertyValue("Orientation", 240cdf0e10cSrcweir DataPilotFieldOrientation.PAGE); 241cdf0e10cSrcweir log.println(" Page") ; 242cdf0e10cSrcweir break; 243cdf0e10cSrcweir } } catch (com.sun.star.lang.WrappedTargetException e) { 244cdf0e10cSrcweir e.printStackTrace(log); 245cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 246cdf0e10cSrcweir return; 247cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 248cdf0e10cSrcweir e.printStackTrace(log); 249cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 250cdf0e10cSrcweir return; 251cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 252cdf0e10cSrcweir e.printStackTrace(log); 253cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 254cdf0e10cSrcweir return; 255cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 256cdf0e10cSrcweir e.printStackTrace(log); 257cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 258cdf0e10cSrcweir return; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir if (++cnt > 4) break; 261cdf0e10cSrcweir } else { 262cdf0e10cSrcweir tRes.tested("getDataPilotFields()", false); 263cdf0e10cSrcweir return; 264cdf0e10cSrcweir } 265cdf0e10cSrcweir } 266cdf0e10cSrcweir 267cdf0e10cSrcweir tRes.tested("getDataPilotFields()", bResult); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir 270cdf0e10cSrcweir /** 271cdf0e10cSrcweir * Test calls the method and checks returned collection using the method 272cdf0e10cSrcweir * <code>CheckNames()</code>. <p> 273cdf0e10cSrcweir * Has <b> OK </b> status if the method <code>CheckNames()</code> returns true 274cdf0e10cSrcweir * and no exceptions were thrown. <p> 275cdf0e10cSrcweir * The following method tests are to be completed successfully before : 276cdf0e10cSrcweir * <ul> 277cdf0e10cSrcweir * <li> <code> getDataPilotFields() </code> : to have array of field names </li> 278cdf0e10cSrcweir * </ul> 279cdf0e10cSrcweir */ _getColumnFields()280cdf0e10cSrcweir public void _getColumnFields(){ 281cdf0e10cSrcweir requiredMethod("getDataPilotFields()"); 282cdf0e10cSrcweir XIndexAccess IA = oObj.getColumnFields(); 283cdf0e10cSrcweir boolean bResult = CheckNames(IA, 0); 284cdf0e10cSrcweir tRes.tested("getColumnFields()", bResult); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir 287cdf0e10cSrcweir /** 288cdf0e10cSrcweir * Test calls the method and checks returned collection using the method 289cdf0e10cSrcweir * <code>CheckNames()</code>. <p> 290cdf0e10cSrcweir * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true 291cdf0e10cSrcweir * and no exceptions were thrown. <p> 292cdf0e10cSrcweir * The following method tests are to be completed successfully before : 293cdf0e10cSrcweir * <ul> 294cdf0e10cSrcweir * <li> <code> getDataPilotFields() </code> : to have array of field names </li> 295cdf0e10cSrcweir * </ul> 296cdf0e10cSrcweir */ _getDataFields()297cdf0e10cSrcweir public void _getDataFields(){ 298cdf0e10cSrcweir requiredMethod("getDataPilotFields()"); 299cdf0e10cSrcweir XIndexAccess IA = oObj.getDataFields(); 300cdf0e10cSrcweir boolean bResult = CheckNames(IA, 2); 301cdf0e10cSrcweir tRes.tested("getDataFields()", bResult); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir /** 305cdf0e10cSrcweir * Test calls the method and checks returned collection using the method 306cdf0e10cSrcweir * <code>CheckNames()</code>. <p> 307cdf0e10cSrcweir * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true 308cdf0e10cSrcweir * and no exceptions were thrown. <p> 309cdf0e10cSrcweir * The following method tests are to be completed successfully before : 310cdf0e10cSrcweir * <ul> 311cdf0e10cSrcweir * <li> <code> getDataPilotFields() </code> : to have array of field names </li> 312cdf0e10cSrcweir * </ul> 313cdf0e10cSrcweir */ _getHiddenFields()314cdf0e10cSrcweir public void _getHiddenFields(){ 315cdf0e10cSrcweir requiredMethod("getDataPilotFields()"); 316cdf0e10cSrcweir XIndexAccess IA = oObj.getHiddenFields(); 317cdf0e10cSrcweir boolean bResult = CheckNames(IA, 3); 318cdf0e10cSrcweir tRes.tested("getHiddenFields()", bResult); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir /** 322cdf0e10cSrcweir * Test calls the method and checks returned collection using the method 323cdf0e10cSrcweir * <code>CheckNames()</code>. <p> 324cdf0e10cSrcweir * Has <b> OK </b> status if the method <code>CheckNames()</code> returned true 325cdf0e10cSrcweir * and no exceptions were thrown. <p> 326cdf0e10cSrcweir * The following method tests are to be completed successfully before : 327cdf0e10cSrcweir * <ul> 328cdf0e10cSrcweir * <li> <code> getDataPilotFields() </code> : to have array of field names </li> 329cdf0e10cSrcweir * </ul> 330cdf0e10cSrcweir */ _getRowFields()331cdf0e10cSrcweir public void _getRowFields(){ 332cdf0e10cSrcweir requiredMethod("getDataPilotFields()"); 333cdf0e10cSrcweir XIndexAccess IA = oObj.getRowFields(); 334cdf0e10cSrcweir boolean bResult = CheckNames(IA, 1); 335cdf0e10cSrcweir tRes.tested("getRowFields()", bResult); 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir /** 339cdf0e10cSrcweir * setting of PageFields isn't supported by StarOffice Calc 340cdf0e10cSrcweir * Has <b> OK </b> status if the returned IndexAccess 341cdf0e10cSrcweir * isn't NULL. <p> 342cdf0e10cSrcweir * The following method tests are to be completed successfully before : 343cdf0e10cSrcweir * <ul> 344cdf0e10cSrcweir * <li> <code> getDataPilotFields() </code> : to have array of field names </li> 345cdf0e10cSrcweir * </ul> 346cdf0e10cSrcweir */ _getPageFields()347cdf0e10cSrcweir public void _getPageFields(){ 348cdf0e10cSrcweir requiredMethod("getDataPilotFields()"); 349cdf0e10cSrcweir XIndexAccess IA = oObj.getPageFields(); 350cdf0e10cSrcweir boolean bResult = (IA != null); 351cdf0e10cSrcweir // boolean bResult = CheckNames(IA, 4); 352cdf0e10cSrcweir tRes.tested("getPageFields()", bResult); 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir /** 356cdf0e10cSrcweir * Test calls the method and checks returned value. <p> 357cdf0e10cSrcweir * Has <b> OK </b> status if returned value isn't null 358cdf0e10cSrcweir * and no exceptions were thrown. <p> 359cdf0e10cSrcweir */ _getFilterDescriptor()360cdf0e10cSrcweir public void _getFilterDescriptor(){ 361cdf0e10cSrcweir boolean bResult = oObj.getFilterDescriptor() != null; 362cdf0e10cSrcweir tRes.tested("getFilterDescriptor()", bResult); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir /** 366cdf0e10cSrcweir * Method checks that the field with index <code>rem</code> exists 367cdf0e10cSrcweir * in the array <code>IA</code>. 368cdf0e10cSrcweir * @param IA collection of elements that support interface <code>XNamed</code> 369cdf0e10cSrcweir * @param rem index of field in the array of field names that was stored in 370cdf0e10cSrcweir * the method <code>getDataPilotFields()</code> 371cdf0e10cSrcweir * @return true if required field name exists in passed collection; 372cdf0e10cSrcweir * false otherwise 373cdf0e10cSrcweir * @see com.sun.star.container.XNamed 374cdf0e10cSrcweir */ CheckNames(XIndexAccess IA, int rem)375cdf0e10cSrcweir boolean CheckNames(XIndexAccess IA, int rem) { 376cdf0e10cSrcweir String name = null; 377cdf0e10cSrcweir 378cdf0e10cSrcweir if (IA == null) { 379cdf0e10cSrcweir log.println("Null retruned.") ; 380cdf0e10cSrcweir return false ; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir if (fieldsNames[rem] == null) { 384cdf0e10cSrcweir log.println("No fields were set to this orientation - cann't check result") ; 385cdf0e10cSrcweir return true ; 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir if (IA.getCount() == 0) { 389cdf0e10cSrcweir log.println("No fields found. Must be at least '" 390cdf0e10cSrcweir + fieldsNames[rem] + "'") ; 391cdf0e10cSrcweir return false ; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir 394cdf0e10cSrcweir try { 395cdf0e10cSrcweir log.print("Fields returned ") ; 396cdf0e10cSrcweir for (int i = 0; i < IA.getCount(); i++) { 397cdf0e10cSrcweir Object field = IA.getByIndex(i); 398cdf0e10cSrcweir XNamed named = (XNamed)UnoRuntime.queryInterface 399cdf0e10cSrcweir (XNamed.class, field); 400cdf0e10cSrcweir name = named.getName(); 401cdf0e10cSrcweir log.print(" " + name) ; 402cdf0e10cSrcweir if (fieldsNames[rem].equals(name)) { 403cdf0e10cSrcweir log.println(" - OK") ; 404cdf0e10cSrcweir return true ; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir } 407cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 408cdf0e10cSrcweir e.printStackTrace(log) ; 409cdf0e10cSrcweir return false ; 410cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 411cdf0e10cSrcweir e.printStackTrace(log) ; 412cdf0e10cSrcweir return false ; 413cdf0e10cSrcweir } 414cdf0e10cSrcweir log.println(" - FAILED (field " + fieldsNames[rem] + " was not found.") ; 415cdf0e10cSrcweir return false ; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir /** 419cdf0e10cSrcweir * Recreates object(to back old orientations of the fields). 420cdf0e10cSrcweir */ after()421cdf0e10cSrcweir protected void after() { 422cdf0e10cSrcweir disposeEnvironment(); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426