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.pexcel.records;
25 
26 import java.io.OutputStream;
27 import java.io.InputStream;
28 import java.io.IOException;
29 
30 import org.openoffice.xmerge.util.Debug;
31 import org.openoffice.xmerge.util.EndianConverter;
32 import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants;
33 
34 /**
35  * Represents a BIFF Record that describes a blank cell
36  */
37 public class BlankCell extends CellValue {
38 
39 	/**
40 	 * Constructs a BlankCell <code>InputStream</code>
41 	 *
42 	 * @param	is InputStream containing a BlankCell.
43 	 */
BlankCell(InputStream is)44     public BlankCell(InputStream is) throws IOException {
45        read(is);
46     }
47 
48 	/**
49  	 * Constructs a <code>BlankCell</code> using specified attributes
50 	 *
51 	 * @param row row number
52 	 * @param column column number
53 	 * @param ixfe font index
54  	 */
BlankCell(int row, int column, int ixfe)55     public BlankCell(int row, int column, int ixfe) throws IOException {
56 
57 		setRow(row);
58 	   	setCol(column);
59 		setIxfe(ixfe);
60     }
61 
62     /**
63 	 * Get the hex code for this particular <code>BIFFRecord</code>
64 	 *
65 	 * @return the hex code for <code>BlankCell</code>
66 	 */
getBiffType()67     public short getBiffType() {
68         return PocketExcelConstants.BLANK_CELL;
69     }
70 
write(OutputStream output)71     public void write(OutputStream output) throws IOException {
72 
73 		output.write(getBiffType());
74 		output.write(rw);
75 		output.write(col);
76 		output.write(ixfe);
77 
78 		Debug.log(Debug.TRACE, "Writing BlankCell record");
79 
80     }
81 
82 	/**
83 	 * Reads a BlankCell <code>InputStream</code>
84 	 *
85 	 * @param	input InputStream containing a BlankCell.
86 	 */
read(InputStream input)87     public int read(InputStream input) throws IOException {
88 
89         int numOfBytesRead 	= input.read(rw);
90         numOfBytesRead++;
91 		col					+= input.read();
92         numOfBytesRead		+= input.read(ixfe);
93 
94         Debug.log(Debug.TRACE, "\tRow : "+ EndianConverter.readShort(rw) +
95                             " Column : " + col +
96                             " ixfe : " + EndianConverter.readShort(ixfe));
97 
98         return numOfBytesRead;
99     }
100 
101     /**
102 	 * Gets the <code>String</code> representing the cells contents
103 	 *
104 	 * @return the <code>String</code> representing the cells contents
105 	 */
getString()106 	public String getString() throws IOException {
107 
108 		return (new String(""));
109 	}
110 }
111