1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge.converter.xml.sxc; 25 26 import java.io.IOException; 27 import java.util.Enumeration; 28 29 import org.openoffice.xmerge.converter.xml.sxc.Format; 30 import org.openoffice.xmerge.ConvertData; 31 32 /** 33 * This class is a abstract class for encoding a "Device" 34 * <code>Document</code> format into an alternative spreadsheet format. 35 * 36 * @author Mark Murnane 37 */ 38 public abstract class SpreadsheetDecoder { 39 40 /** 41 * Constructor for creating new <code>SpreadsheetDecoder</code>. 42 */ SpreadsheetDecoder(String name, String password)43 public SpreadsheetDecoder(String name, String password) throws IOException { 44 } 45 46 /** 47 * Returns the total number of sheets in the WorkBook. 48 * 49 * @return The number of sheets in the WorkBook. 50 */ getNumberOfSheets()51 public abstract int getNumberOfSheets(); 52 53 /** 54 * Returns an Enumeration to a Vector of <code>NameDefinition</code>. 55 * 56 * @return The Enumeration 57 */ getNameDefinitions()58 public abstract Enumeration getNameDefinitions(); 59 60 /** 61 * Returns an <code>BookSettings</code> 62 * 63 * @return The Enumeration 64 */ getSettings()65 public abstract BookSettings getSettings(); 66 67 /** 68 * Returns an Enumeration to a Vector of <code>ColumnRowInfo</code>. 69 * 70 * @return The Enumeration 71 */ getColumnRowInfos()72 public abstract Enumeration getColumnRowInfos(); 73 74 /** 75 * Returns the number of populated rows in the current WorkSheet. 76 * 77 * @return the number of populated rows in the current WorkSheet. 78 */ getNumberOfRows()79 public abstract int getNumberOfRows(); 80 81 82 /** 83 * Returns the number of populated columns in the current WorkSheet. 84 * 85 * @return The number of populated columns in the current WorkSheet. 86 */ getNumberOfColumns()87 public abstract int getNumberOfColumns(); 88 89 90 /** 91 * Returns the name of the current WorkSheet. 92 * 93 * @return Name of the current WorkSheet. 94 */ getSheetName()95 public abstract String getSheetName(); 96 97 98 /** 99 * Returns the number of the active column. 100 * 101 * @return The number of the active column. 102 */ getColNumber()103 public abstract int getColNumber(); 104 105 106 /** 107 * Returns the number of the active row. 108 * 109 * @return The number of the active row. 110 */ getRowNumber()111 public abstract int getRowNumber(); 112 113 114 /** 115 * Sets the active WorkSheet. 116 * 117 * @param sheetIndex The index of the sheet to be made active. 118 * 119 * @throws IOException If any I/O error occurs. 120 */ setWorksheet(int sheetIndex)121 public abstract void setWorksheet(int sheetIndex) throws IOException; 122 123 124 /** 125 * Move on the next populated cell in the current WorkSheet. 126 * 127 * @return true if successful, false otherwise. 128 * 129 * @throws IOException If any I/O error occurs. 130 */ goToNextCell()131 public abstract boolean goToNextCell() throws IOException; 132 133 134 /** 135 * Return the contents of the active cell. 136 * 137 * @return The cell contents. 138 */ getCellContents()139 public abstract String getCellContents(); 140 141 /** 142 * Return the value of the active cell. Used in the case of Formula where 143 * the cell contents and the cell value are not the same thing. 144 * 145 * @return The cell value. 146 */ getCellValue()147 public abstract String getCellValue(); 148 149 /** 150 * Return the data type of the active cell. 151 * 152 * @return The cell data type. 153 */ getCellDataType()154 public abstract String getCellDataType(); 155 156 157 /** 158 * Return a <code>Format</code> object describing the active cells 159 * formatting. 160 * 161 * @return <code>Format</code> object for the cell. 162 */ getCellFormat()163 public abstract Format getCellFormat(); 164 165 166 /** 167 * Add the contents of a <code>ConvertData</code> to the workbook. 168 * 169 * @param cd The <code>ConvertData</code> containing the 170 * content. 171 * 172 * @throws IOException If any I/O error occurs. 173 */ addDeviceContent(ConvertData cd)174 public abstract void addDeviceContent(ConvertData cd) throws IOException; 175 } 176 177