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