You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2009/11/12 02:10:20 UTC
svn commit: r835183 - in /poi/trunk/src/java/org/apache/poi/hssf/record:
FeatHdrRecord.java FeatRecord.java common/ common/Ref8U.java
Author: nick
Date: Thu Nov 12 01:10:19 2009
New Revision: 835183
URL: http://svn.apache.org/viewvc?rev=835183&view=rev
Log:
Make a start on feature related records. Not finished yet, so not enabled in the recordfactory until complete+tested
Added:
poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java (with props)
poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java (with props)
poi/trunk/src/java/org/apache/poi/hssf/record/common/
poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java (with props)
Added: poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java?rev=835183&view=auto
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java (added)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java Thu Nov 12 01:10:19 2009
@@ -0,0 +1,100 @@
+/* ====================================================================
+ 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.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Title: FeatHdr (Feature Header) Record
+ * <P>
+ * This record specifies common information for Shared Features, and
+ * specifies the beginning of a collection of records to define them.
+ * The collection of data (Globals Substream ABNF, macro sheet substream
+ * ABNF or worksheet substream ABNF) specifies Shared Feature data.
+ */
+public final class FeatHdrRecord extends StandardRecord {
+ /**
+ * Specifies the enhanced protection type. Used to protect a
+ * shared workbook by restricting access to some areas of it
+ */
+ public static final int SHAREDFEATURES_ISFPROTECTION = 0x02;
+ /**
+ * Specifies that formula errors should be ignored
+ */
+ public static final int SHAREDFEATURES_ISFFEC2 = 0x03;
+ /**
+ * Specifies the smart tag type. Recognises certain
+ * types of entries (proper names, dates/times etc) and
+ * flags them for action
+ */
+ public static final int SHAREDFEATURES_ISFFACTOID = 0x04;
+ /**
+ * Specifies the shared list type. Used for a table
+ * within a sheet
+ */
+ public static final int SHAREDFEATURES_ISFLIST = 0x05;
+
+
+ public final static short sid = 0x0867;
+
+ private int isf_sharedFeatureType; // See SHAREDFEATURES_
+ private byte reserved; // Should always be one
+ /**
+ * 0x00000000 = rgbHdrData not present
+ * 0xffffffff = rgbHdrData present
+ */
+ private long cbHdrData;
+ /** We need a BOFRecord to make sense of this... */
+ private byte[] rgbHdrData;
+
+ public FeatHdrRecord() {
+ }
+
+ public short getSid() {
+ return sid;
+ }
+
+ public FeatHdrRecord(RecordInputStream in) {
+ isf_sharedFeatureType = in.readShort();
+ reserved = in.readByte();
+ cbHdrData = in.readLong();
+ // Don't process this just yet, need the BOFRecord
+ rgbHdrData = in.readRemainder();
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[FEATURE HEADER]\n");
+
+ // TODO ...
+
+ buffer.append("[/FEATURE HEADER]\n");
+ return buffer.toString();
+ }
+
+ public void serialize(LittleEndianOutput out) {
+ out.writeShort(isf_sharedFeatureType);
+ out.writeByte(reserved);
+ out.writeLong(cbHdrData);
+ out.write(rgbHdrData);
+ }
+
+ protected int getDataSize() {
+ return 2+1+4+rgbHdrData.length;
+ }
+}
Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java?rev=835183&view=auto
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java (added)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java Thu Nov 12 01:10:19 2009
@@ -0,0 +1,90 @@
+/* ====================================================================
+ 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.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.hssf.record.common.Ref8U;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Title: Feat (Feature) Record
+ * <P>
+ * This record specifies Shared Features data. It is normally paired
+ * up with a {@link FeatHdrRecord}.
+ */
+public final class FeatRecord extends StandardRecord {
+ public final static short sid = 0x0868;
+
+ /**
+ * See SHAREDFEATURES_* on {@link FeatHdrRecord}
+ */
+ private int isf_sharedFeatureType;
+ private byte reserved1; // Should always be zero
+ private long reserved2; // Should always be zero
+ /** The number of refs */
+ private int cref;
+ /** Only matters if type is ISFFEC2 */
+ private long cbFeatData;
+ private int reserved3; // Should always be zero
+ private Ref8U[] cellRefs;
+
+ private byte[] rgbFeat;
+
+ public FeatRecord() {
+ }
+
+ public short getSid() {
+ return sid;
+ }
+
+ public FeatRecord(RecordInputStream in) {
+ isf_sharedFeatureType = in.readShort();
+ reserved1 = in.readByte();
+ reserved2 = in.readLong();
+ cref = in.readUShort();
+ cbFeatData = in.readLong();
+ reserved3 = in.readShort();
+
+ cellRefs = new Ref8U[cref];
+ for(int i=0; i<cellRefs.length; i++) {
+ cellRefs[i] = new Ref8U(in);
+ }
+
+ rgbFeat = in.readRemainder();
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[SHARDED FEATURE]\n");
+
+ // TODO ...
+
+ buffer.append("[/SHARED FEATURE]\n");
+ return buffer.toString();
+ }
+
+ public void serialize(LittleEndianOutput out) {
+ out.writeShort(isf_sharedFeatureType);
+
+ // TODO ...
+
+ }
+
+ protected int getDataSize() {
+ return -1; // TODO
+ }
+}
Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/FeatRecord.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java?rev=835183&view=auto
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java (added)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java Thu Nov 12 01:10:19 2009
@@ -0,0 +1,64 @@
+/* ====================================================================
+ 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.
+==================================================================== */
+
+package org.apache.poi.hssf.record.common;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.util.LittleEndianOutput;
+
+/**
+ * Title: Ref8U (Cell Range) common record part
+ * <P>
+ * This record part specifies common way of encoding a
+ * block of cells via first-last row-column.
+ */
+public final class Ref8U {
+ private short firstRow; // zero-based
+ private short lastRow; // zero-based
+ private short firstCol; // zero-based
+ private short lastCol; // zero-based
+
+ public Ref8U() {
+ }
+
+ public Ref8U(RecordInputStream in) {
+ firstRow = in.readShort();
+ lastRow = in.readShort();
+ firstCol = in.readShort();
+ lastCol = in.readShort();
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(" [CELL RANGE]\n");
+ buffer.append(" Rows " + firstRow + " to " + lastRow);
+ buffer.append(" Cols " + firstCol + " to " + lastCol);
+ buffer.append(" [/CELL RANGE]\n");
+ return buffer.toString();
+ }
+
+ public void serialize(LittleEndianOutput out) {
+ out.writeShort(firstRow);
+ out.writeShort(lastRow);
+ out.writeShort(firstCol);
+ out.writeShort(lastCol);
+ }
+
+ protected int getDataSize() {
+ return 8;
+ }
+}
Propchange: poi/trunk/src/java/org/apache/poi/hssf/record/common/Ref8U.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org