/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ // Example DataPilot source component // helper class to hold the settings class ExampleSettings { static public final int nDimensionCount = 6; static public final int nValueDimension = 4; static public final int nDataDimension = 5; static public final String [] aDimensionNames = { "ones", "tens", "hundreds", "thousands", "value", "" }; static public final String getMemberName( int nMember ) { return String.valueOf( nMember ); } public int nMemberCount = 3; public java.util.List aColDimensions = new java.util.ArrayList(); public java.util.List aRowDimensions = new java.util.ArrayList(); } // XPropertySetInfo implementation for getPropertySetInfo class ExamplePropertySetInfo implements com.sun.star.beans.XPropertySetInfo { private com.sun.star.beans.Property[] aProperties; public ExamplePropertySetInfo( com.sun.star.beans.Property[] aProps ) { aProperties = aProps; } public com.sun.star.beans.Property[] getProperties() { return aProperties; } public com.sun.star.beans.Property getPropertyByName( String aName ) throws com.sun.star.beans.UnknownPropertyException { for ( int i=0; i= 0 ) nDimensions = aSettings.aColDimensions.size(); else { nPosition = aSettings.aRowDimensions.indexOf( new Integer(nDimension)); if ( nPosition >= 0 ) nDimensions = aSettings.aRowDimensions.size(); } if ( nPosition < 0 ) return new com.sun.star.sheet.MemberResult[0]; int nMembers = aSettings.nMemberCount; int nRepeat = 1; int nFill = 1; for ( int i=0; i nPosition ) nFill *= nMembers; } int nSize = nRepeat * nMembers * nFill; com.sun.star.sheet.MemberResult[] aResults = new com.sun.star.sheet.MemberResult[nSize]; int nResultPos = 0; for (int nOuter=0; nOuter= 1 ) { String aSource = com.sun.star.uno.AnyConverter.toString(aArguments[0]); if ( aSource != null && aSource.length() > 0) { int nValue = Integer.parseInt( aSource ); if ( nValue >= 2 && nValue <= 10 ) aSettings.nMemberCount = nValue; } } } catch ( NumberFormatException e ) { System.out.println( "Error: caught exception in " + "ExampleDataPilotSource.initialize!\nException Message = " + e.getMessage()); e.printStackTrace(); } catch ( com.sun.star.lang.IllegalArgumentException e ) { System.out.println( "Error: caught exception in " + "ExampleDataPilotSource.initialize!\nException Message = " + e.getMessage()); e.printStackTrace(); } } // XDataPilotResults public com.sun.star.sheet.DataResult[][] getResults() { int[] nDigits = new int[ExampleSettings.nDimensionCount]; int nValue = 1; for (int i=0; i