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