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 package mod._sc; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 26cdf0e10cSrcweir import com.sun.star.container.XIndexAccess; 27cdf0e10cSrcweir import com.sun.star.container.XNamed; 28cdf0e10cSrcweir import com.sun.star.lang.XComponent; 29cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 30cdf0e10cSrcweir import com.sun.star.sheet.DataPilotFieldOrientation; 31cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotDescriptor; 32cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTables; 33cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTablesSupplier; 34cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet; 35cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheetDocument; 36cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheets; 37cdf0e10cSrcweir import com.sun.star.table.CellAddress; 38cdf0e10cSrcweir import com.sun.star.table.CellRangeAddress; 39cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 40cdf0e10cSrcweir import com.sun.star.uno.Type; 41cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 42cdf0e10cSrcweir import com.sun.star.uno.XInterface; 43cdf0e10cSrcweir 44cdf0e10cSrcweir import java.io.PrintWriter; 45cdf0e10cSrcweir 46cdf0e10cSrcweir import lib.StatusException; 47cdf0e10cSrcweir import lib.TestCase; 48cdf0e10cSrcweir import lib.TestEnvironment; 49cdf0e10cSrcweir import lib.TestParameters; 50cdf0e10cSrcweir 51cdf0e10cSrcweir import util.SOfficeFactory; 52cdf0e10cSrcweir 53cdf0e10cSrcweir 54cdf0e10cSrcweir /** 55cdf0e10cSrcweir * Test for object which is represented by service 56cdf0e10cSrcweir * <code>com.sun.star.sheet.DataPilotField</code>. <p> 57cdf0e10cSrcweir * Object implements the following interfaces : 58cdf0e10cSrcweir * <ul> 59cdf0e10cSrcweir * <li> <code>com::sun::star::container::XNamed</code></li> 60cdf0e10cSrcweir * <li> <code>com::sun::star::sheet::DataPilotField</code></li> 61cdf0e10cSrcweir * <li> <code>com::sun::star::beans::XPropertySet</code></li> 62cdf0e10cSrcweir * </ul> 63cdf0e10cSrcweir * @see com.sun.star.sheet.DataPilotField 64cdf0e10cSrcweir * @see com.sun.star.container.XNamed 65cdf0e10cSrcweir * @see com.sun.star.sheet.DataPilotField 66cdf0e10cSrcweir * @see com.sun.star.beans.XPropertySet 67cdf0e10cSrcweir * @see ifc.container._XNamed 68cdf0e10cSrcweir * @see ifc.sheet._DataPilotField 69cdf0e10cSrcweir * @see ifc.beans._XPropertySet 70cdf0e10cSrcweir */ 71cdf0e10cSrcweir public class ScDataPilotFieldObj extends TestCase { 72cdf0e10cSrcweir static XSpreadsheetDocument xSheetDoc = null; 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** 75cdf0e10cSrcweir * A field is filled some values. This integer determines the size of the 76cdf0e10cSrcweir * field in x and y direction. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir private int mMaxFieldIndex = 6; 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** 81cdf0e10cSrcweir * Creates Spreadsheet document. 82cdf0e10cSrcweir */ initialize(TestParameters tParam, PrintWriter log)83cdf0e10cSrcweir protected void initialize(TestParameters tParam, PrintWriter log) { 84cdf0e10cSrcweir SOfficeFactory SOF = SOfficeFactory.getFactory( 85cdf0e10cSrcweir (XMultiServiceFactory) tParam.getMSF()); 86cdf0e10cSrcweir 87cdf0e10cSrcweir try { 88cdf0e10cSrcweir log.println("creating a Spreadsheet document"); 89cdf0e10cSrcweir xSheetDoc = SOF.createCalcDoc(null); 90cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 91*30acf5e8Spfg // Some exception occured.FAILED 92cdf0e10cSrcweir e.printStackTrace(log); 93cdf0e10cSrcweir throw new StatusException("Couldn't create document", e); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir /** 98cdf0e10cSrcweir * Disposes Spreadsheet document. 99cdf0e10cSrcweir */ cleanup(TestParameters tParam, PrintWriter log)100cdf0e10cSrcweir protected void cleanup(TestParameters tParam, PrintWriter log) { 101cdf0e10cSrcweir log.println(" disposing xSheetDoc "); 102cdf0e10cSrcweir 103cdf0e10cSrcweir XComponent oComp = (XComponent) UnoRuntime.queryInterface( 104cdf0e10cSrcweir XComponent.class, xSheetDoc); 105cdf0e10cSrcweir util.DesktopTools.closeDoc(oComp); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir /** 109cdf0e10cSrcweir * Creating a Testenvironment for the interfaces to be tested. 110cdf0e10cSrcweir * Retrieves a collection of spreadsheets from a document 111cdf0e10cSrcweir * and takes one of them. Fills some table in the spreadsheet. 112cdf0e10cSrcweir * Obtains the collection of data pilot tables using the interface 113cdf0e10cSrcweir * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor 114cdf0e10cSrcweir * for the filled table and inserts new data pilot table with this descriptor 115cdf0e10cSrcweir * to the collection. Obtains the collection of all the data pilot fields 116cdf0e10cSrcweir * using the interface <code>XDataPilotDescriptor</code>. Retrieves from 117cdf0e10cSrcweir * the collection the data pilot field with index 0. This data pilot field 118cdf0e10cSrcweir * is the instance of the service <code>com.sun.star.sheet.DataPilotField</code>. 119cdf0e10cSrcweir * @see com.sun.star.sheet.DataPilotField 120cdf0e10cSrcweir * @see com.sun.star.sheet.XDataPilotTablesSupplier 121cdf0e10cSrcweir * @see com.sun.star.sheet.XDataPilotDescriptor 122cdf0e10cSrcweir */ createTestEnvironment(TestParameters Param, PrintWriter log)123cdf0e10cSrcweir protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, 124cdf0e10cSrcweir PrintWriter log) { 125cdf0e10cSrcweir XInterface oObj = null; 126cdf0e10cSrcweir 127cdf0e10cSrcweir 128cdf0e10cSrcweir // creation of testobject here 129cdf0e10cSrcweir // first we write what we are intend to do to log file 130cdf0e10cSrcweir log.println("Creating a test environment"); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // the cell range 133cdf0e10cSrcweir CellRangeAddress sCellRangeAdress = new CellRangeAddress(); 134cdf0e10cSrcweir sCellRangeAdress.Sheet = 0; 135cdf0e10cSrcweir sCellRangeAdress.StartColumn = 1; 136cdf0e10cSrcweir sCellRangeAdress.StartRow = 0; 137cdf0e10cSrcweir sCellRangeAdress.EndColumn = mMaxFieldIndex - 1; 138cdf0e10cSrcweir sCellRangeAdress.EndRow = mMaxFieldIndex - 1; 139cdf0e10cSrcweir 140cdf0e10cSrcweir // position of the data pilot table 141cdf0e10cSrcweir CellAddress sCellAdress = new CellAddress(); 142cdf0e10cSrcweir sCellAdress.Sheet = 0; 143cdf0e10cSrcweir sCellAdress.Column = 7; 144cdf0e10cSrcweir sCellAdress.Row = 8; 145cdf0e10cSrcweir 146cdf0e10cSrcweir log.println("Getting a sheet"); 147cdf0e10cSrcweir 148cdf0e10cSrcweir XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets(); 149cdf0e10cSrcweir XSpreadsheet oSheet = null; 150cdf0e10cSrcweir XSpreadsheet oSheet2 = null; 151cdf0e10cSrcweir XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( 152cdf0e10cSrcweir XIndexAccess.class, xSpreadsheets); 153cdf0e10cSrcweir 154cdf0e10cSrcweir try { 155cdf0e10cSrcweir oSheet = (XSpreadsheet) AnyConverter.toObject( 156cdf0e10cSrcweir new Type(XSpreadsheet.class), 157cdf0e10cSrcweir oIndexAccess.getByIndex(0)); 158cdf0e10cSrcweir oSheet2 = (XSpreadsheet) AnyConverter.toObject( 159cdf0e10cSrcweir new Type(XSpreadsheet.class), 160cdf0e10cSrcweir oIndexAccess.getByIndex(1)); 161cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 162cdf0e10cSrcweir e.printStackTrace(); 163cdf0e10cSrcweir throw new StatusException("Couldn't get a spreadsheet", e); 164cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 165cdf0e10cSrcweir e.printStackTrace(); 166cdf0e10cSrcweir throw new StatusException("Couldn't get a spreadsheet", e); 167cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 168cdf0e10cSrcweir e.printStackTrace(); 169cdf0e10cSrcweir throw new StatusException("Couldn't get a spreadsheet", e); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir try { 173cdf0e10cSrcweir log.println("Filling a table"); 174cdf0e10cSrcweir 175cdf0e10cSrcweir for (int i = 1; i < mMaxFieldIndex; i++) { 176cdf0e10cSrcweir oSheet.getCellByPosition(i, 0).setFormula("Col" + i); 177cdf0e10cSrcweir oSheet.getCellByPosition(0, i).setFormula("Row" + i); 178cdf0e10cSrcweir oSheet2.getCellByPosition(i, 0).setFormula("Col" + i); 179cdf0e10cSrcweir oSheet2.getCellByPosition(0, i).setFormula("Row" + i); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir for (int i = 1; i < mMaxFieldIndex; i++) 183cdf0e10cSrcweir for (int j = 1; j < mMaxFieldIndex; j++) { 184cdf0e10cSrcweir oSheet.getCellByPosition(i, j).setValue(i * (j + 1)); 185cdf0e10cSrcweir oSheet2.getCellByPosition(i, j).setValue(i * (j + 2)); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 188cdf0e10cSrcweir e.printStackTrace(); 189cdf0e10cSrcweir throw new StatusException("Couldn't fill some cells", e); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir // change a value of a cell and check the change in the data pilot 193cdf0e10cSrcweir // (for the XDataPilotTable.refresh() test) 194cdf0e10cSrcweir Object oChangeCell = null; 195cdf0e10cSrcweir Object oCheckCell = null; 196cdf0e10cSrcweir Integer aChangeValue = null; 197cdf0e10cSrcweir 198cdf0e10cSrcweir try { 199cdf0e10cSrcweir // cell of data 200cdf0e10cSrcweir oChangeCell = oSheet.getCellByPosition(1, 5); 201cdf0e10cSrcweir 202cdf0e10cSrcweir int x = sCellAdress.Column; 203cdf0e10cSrcweir int y = sCellAdress.Row + 3; 204cdf0e10cSrcweir 205cdf0e10cSrcweir 206cdf0e10cSrcweir // cell of the data pilot output 207cdf0e10cSrcweir oCheckCell = oSheet.getCellByPosition(x, y); 208cdf0e10cSrcweir aChangeValue = new Integer(27); 209cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 210cdf0e10cSrcweir e.printStackTrace(); 211cdf0e10cSrcweir throw new StatusException("Couldn't get cells for changeing.", e); 212cdf0e10cSrcweir } 213cdf0e10cSrcweir 214cdf0e10cSrcweir 215cdf0e10cSrcweir // create the test objects 216cdf0e10cSrcweir log.println("Getting test objects"); 217cdf0e10cSrcweir 218cdf0e10cSrcweir XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface( 219cdf0e10cSrcweir XDataPilotTablesSupplier.class, 220cdf0e10cSrcweir oSheet); 221cdf0e10cSrcweir XDataPilotTables DPT = DPTS.getDataPilotTables(); 222cdf0e10cSrcweir XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor(); 223cdf0e10cSrcweir DPDsc.setSourceRange(sCellRangeAdress); 224cdf0e10cSrcweir 225cdf0e10cSrcweir XPropertySet fieldPropSet = null; 226cdf0e10cSrcweir 227cdf0e10cSrcweir try { 228cdf0e10cSrcweir Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0); 229cdf0e10cSrcweir fieldPropSet = (XPropertySet) UnoRuntime.queryInterface( 230cdf0e10cSrcweir XPropertySet.class, oDataPilotField); 231cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 232cdf0e10cSrcweir e.printStackTrace(); 233cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 234cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 235cdf0e10cSrcweir e.printStackTrace(); 236cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 237cdf0e10cSrcweir } 238cdf0e10cSrcweir 239cdf0e10cSrcweir try { 240cdf0e10cSrcweir fieldPropSet.setPropertyValue("Function", 241cdf0e10cSrcweir com.sun.star.sheet.GeneralFunction.SUM); 242cdf0e10cSrcweir fieldPropSet.setPropertyValue("Orientation", 243cdf0e10cSrcweir com.sun.star.sheet.DataPilotFieldOrientation.DATA); 244cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 245cdf0e10cSrcweir e.printStackTrace(); 246cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 247cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 248cdf0e10cSrcweir e.printStackTrace(); 249cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 250cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 251cdf0e10cSrcweir e.printStackTrace(); 252cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 253cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 254cdf0e10cSrcweir e.printStackTrace(); 255cdf0e10cSrcweir throw new StatusException("Couldn't create a test environment", e); 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir log.println("Insert the DataPilotTable"); 259cdf0e10cSrcweir 260cdf0e10cSrcweir if (DPT.hasByName("DataPilotTable")) { 261cdf0e10cSrcweir DPT.removeByName("DataPilotTable"); 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir XIndexAccess IA = DPDsc.getDataPilotFields(); 265cdf0e10cSrcweir getSRange(IA); 266cdf0e10cSrcweir 267cdf0e10cSrcweir DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc); 268cdf0e10cSrcweir 269cdf0e10cSrcweir try { 270cdf0e10cSrcweir oObj = (XInterface) AnyConverter.toObject( 271cdf0e10cSrcweir new Type(XInterface.class), IA.getByIndex(0)); 272cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 273cdf0e10cSrcweir e.printStackTrace(); 274cdf0e10cSrcweir throw new StatusException("Couldn't get data pilot field", e); 275cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 276cdf0e10cSrcweir e.printStackTrace(); 277cdf0e10cSrcweir throw new StatusException("Couldn't get data pilot field", e); 278cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 279cdf0e10cSrcweir e.printStackTrace(); 280cdf0e10cSrcweir throw new StatusException("Couldn't get data pilot field", e); 281cdf0e10cSrcweir } 282cdf0e10cSrcweir 283cdf0e10cSrcweir log.println("Creating object - " + 284cdf0e10cSrcweir ((oObj == null) ? "FAILED" : "OK")); 285cdf0e10cSrcweir 286cdf0e10cSrcweir TestEnvironment tEnv = new TestEnvironment(oObj); 287cdf0e10cSrcweir 288cdf0e10cSrcweir log.println("Implementationname: " + util.utils.getImplName(oObj)); 289cdf0e10cSrcweir 290cdf0e10cSrcweir // Other parameters required for interface tests 291cdf0e10cSrcweir return tEnv; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir getSRange(XIndexAccess IA)294cdf0e10cSrcweir private void getSRange(XIndexAccess IA) { 295cdf0e10cSrcweir int fieldsAmount = IA.getCount() + 1; 296cdf0e10cSrcweir 297cdf0e10cSrcweir String[] fieldsNames = new String[fieldsAmount]; 298cdf0e10cSrcweir 299cdf0e10cSrcweir int i = -1; 300cdf0e10cSrcweir int cnt = 0; 301cdf0e10cSrcweir 302cdf0e10cSrcweir while ((++i) < fieldsAmount) { 303cdf0e10cSrcweir Object field; 304cdf0e10cSrcweir 305cdf0e10cSrcweir try { 306cdf0e10cSrcweir field = IA.getByIndex(i); 307cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 308cdf0e10cSrcweir e.printStackTrace(log); 309cdf0e10cSrcweir 310cdf0e10cSrcweir return; 311cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 312cdf0e10cSrcweir e.printStackTrace(log); 313cdf0e10cSrcweir 314cdf0e10cSrcweir return; 315cdf0e10cSrcweir } 316cdf0e10cSrcweir 317cdf0e10cSrcweir XNamed named = (XNamed) UnoRuntime.queryInterface(XNamed.class, 318cdf0e10cSrcweir field); 319cdf0e10cSrcweir String name = named.getName(); 320cdf0e10cSrcweir 321cdf0e10cSrcweir log.println("**Field : '" + name + "' ... "); 322cdf0e10cSrcweir 323cdf0e10cSrcweir if (!name.equals("Data")) { 324cdf0e10cSrcweir fieldsNames[cnt] = name; 325cdf0e10cSrcweir 326cdf0e10cSrcweir XPropertySet props = (XPropertySet) UnoRuntime.queryInterface( 327cdf0e10cSrcweir XPropertySet.class, field); 328cdf0e10cSrcweir 329cdf0e10cSrcweir try { 330cdf0e10cSrcweir switch (cnt % 5) { 331cdf0e10cSrcweir case 0: 332cdf0e10cSrcweir props.setPropertyValue("Orientation", 333cdf0e10cSrcweir DataPilotFieldOrientation.COLUMN); 334cdf0e10cSrcweir log.println(" Column"); 335cdf0e10cSrcweir 336cdf0e10cSrcweir break; 337cdf0e10cSrcweir 338cdf0e10cSrcweir case 1: 339cdf0e10cSrcweir props.setPropertyValue("Orientation", 340cdf0e10cSrcweir DataPilotFieldOrientation.ROW); 341cdf0e10cSrcweir log.println(" Row"); 342cdf0e10cSrcweir 343cdf0e10cSrcweir break; 344cdf0e10cSrcweir 345cdf0e10cSrcweir case 2: 346cdf0e10cSrcweir props.setPropertyValue("Orientation", 347cdf0e10cSrcweir DataPilotFieldOrientation.DATA); 348cdf0e10cSrcweir log.println(" Data"); 349cdf0e10cSrcweir 350cdf0e10cSrcweir break; 351cdf0e10cSrcweir 352cdf0e10cSrcweir case 3: 353cdf0e10cSrcweir props.setPropertyValue("Orientation", 354cdf0e10cSrcweir DataPilotFieldOrientation.HIDDEN); 355cdf0e10cSrcweir log.println(" Hidden"); 356cdf0e10cSrcweir 357cdf0e10cSrcweir break; 358cdf0e10cSrcweir 359cdf0e10cSrcweir case 4: 360cdf0e10cSrcweir props.setPropertyValue("Orientation", 361cdf0e10cSrcweir DataPilotFieldOrientation.PAGE); 362cdf0e10cSrcweir log.println(" Page"); 363cdf0e10cSrcweir 364cdf0e10cSrcweir break; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 367cdf0e10cSrcweir e.printStackTrace(log); 368cdf0e10cSrcweir 369cdf0e10cSrcweir return; 370cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 371cdf0e10cSrcweir e.printStackTrace(log); 372cdf0e10cSrcweir 373cdf0e10cSrcweir return; 374cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 375cdf0e10cSrcweir e.printStackTrace(log); 376cdf0e10cSrcweir 377cdf0e10cSrcweir return; 378cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 379cdf0e10cSrcweir e.printStackTrace(log); 380cdf0e10cSrcweir 381cdf0e10cSrcweir return; 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir if ((++cnt) > 4) { 385cdf0e10cSrcweir break; 386cdf0e10cSrcweir } 387cdf0e10cSrcweir } else { 388cdf0e10cSrcweir return; 389cdf0e10cSrcweir } 390cdf0e10cSrcweir } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393