You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/05/21 20:15:01 UTC
svn commit: r777204 [9/21] - in /poi/trunk/src/scratchpad:
examples/src/org/apache/poi/hslf/examples/
examples/src/org/apache/poi/hwpf/ src/org/apache/poi/hdf/event/
src/org/apache/poi/hdf/extractor/ src/org/apache/poi/hdf/extractor/data/
src/org/apach...
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CString.java Thu May 21 18:12:22 2009
@@ -1,19 +1,20 @@
-/*
-* 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.
-*/
+/* ====================================================================
+ 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.hslf.record;
import java.io.IOException;
@@ -30,15 +31,15 @@
* @author Nick Burch
*/
-public class CString extends RecordAtom {
+public final class CString extends RecordAtom {
private byte[] _header;
private static long _type = 4026l;
-
+
/** The bytes that make up the text */
private byte[] _text;
-
+
/** Grabs the text. */
- public String getText() {
+ public String getText() {
return StringUtil.getFromUnicodeLE(_text);
}
@@ -51,18 +52,18 @@
// Update the size (header bytes 5-8)
LittleEndian.putInt(_header,4,_text.length);
}
-
- /**
+
+ /**
* Grabs the count, from the first two bytes of the header.
- * The meaning of the count is specific to the type of the parent record
+ * The meaning of the count is specific to the type of the parent record
*/
public int getOptions() {
return (int)LittleEndian.getShort(_header);
}
-
- /**
+
+ /**
* Sets the count
- * The meaning of the count is specific to the type of the parent record
+ * The meaning of the count is specific to the type of the parent record
*/
public void setOptions(int count) {
LittleEndian.putShort(_header, (short)count);
@@ -70,8 +71,8 @@
/* *************** record code follows ********************** */
- /**
- * For the CStrubg Atom
+ /**
+ * For the CStrubg Atom
*/
protected CString(byte[] source, int start, int len) {
// Sanity Checking
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -27,13 +25,13 @@
/**
* A ColorSchemeAtom (type 2032). Holds the 8 RGB values for the different
* colours of bits of text, that makes up a given colour scheme.
- * Slides (presumably) link to a given colour scheme atom, and that
+ * Slides (presumably) link to a given colour scheme atom, and that
* defines the colours to be used
*
* @author Nick Burch
*/
-public class ColorSchemeAtom extends RecordAtom
+public final class ColorSchemeAtom extends RecordAtom
{
private byte[] _header;
private static long _type = 2032l;
@@ -85,7 +83,7 @@
{ accentAndHyperlinkColourRGB = rgb; }
/** Fetch the RGB value for Accent And Following Hyperlink Colour */
- public int getAccentAndFollowingHyperlinkColourRGB()
+ public int getAccentAndFollowingHyperlinkColourRGB()
{ return accentAndFollowingHyperlinkColourRGB; }
/** Set the RGB value for Accent And Following Hyperlink Colour */
public void setAccentAndFollowingHyperlinkColourRGB(int rgb)
@@ -93,7 +91,7 @@
/* *************** record code follows ********************** */
- /**
+ /**
* For the Colour Scheme (ColorSchem) Atom
*/
protected ColorSchemeAtom(byte[] source, int start, int len) {
@@ -119,7 +117,7 @@
accentAndHyperlinkColourRGB = (int)LittleEndian.getInt(source,start+8+24);
accentAndFollowingHyperlinkColourRGB = (int)LittleEndian.getInt(source,start+8+28);
}
-
+
/**
* Create a new ColorSchemeAtom, to go with a new Slide
*/
@@ -128,7 +126,7 @@
LittleEndian.putUShort(_header, 0, 16);
LittleEndian.putUShort(_header, 2, (int)_type);
LittleEndian.putInt(_header, 4, 32);
-
+
// Setup the default rgb values
backgroundColourRGB = 16777215;
textAndLinesColourRGB = 0;
@@ -139,7 +137,7 @@
accentAndHyperlinkColourRGB = 16764108;
accentAndFollowingHyperlinkColourRGB = 11711154;
}
-
+
/**
* We are of type 3999
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000.java Thu May 21 18:12:22 2009
@@ -1,19 +1,20 @@
-/*
-* 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.
-*/
+/* ====================================================================
+ 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.hslf.record;
import java.io.IOException;
@@ -23,24 +24,24 @@
/**
* This class represents a comment on a slide, in the format used by
- * PPT 2000/XP/etc. (PPT 97 uses plain Escher Text Boxes for comments)
+ * PPT 2000/XP/etc. (PPT 97 uses plain Escher Text Boxes for comments)
* @author Nick Burch
*/
-public class Comment2000 extends RecordContainer {
+public final class Comment2000 extends RecordContainer {
private byte[] _header;
private static long _type = 12000;
-
+
// Links to our more interesting children
private CString authorRecord;
private CString authorInitialsRecord;
private CString commentRecord;
- private Comment2000Atom commentAtom;
-
- /**
+ private Comment2000Atom commentAtom;
+
+ /**
* Returns the Comment2000Atom of this Comment
- */
+ */
public Comment2000Atom getComment2000Atom() { return commentAtom; }
-
+
/**
* Get the Author of this comment
*/
@@ -79,8 +80,8 @@
public void setText(String text) {
commentRecord.setText(text);
}
-
- /**
+
+ /**
* Set things up, and find our more interesting children
*/
protected Comment2000(byte[] source, int start, int len) {
@@ -97,7 +98,7 @@
* Go through our child records, picking out the ones that are
* interesting, and saving those for use by the easy helper
* methods.
- */
+ */
private void findInterestingChildren() {
// First child should be the author
if(_children[0] instanceof CString) {
@@ -124,18 +125,18 @@
throw new IllegalStateException("Fourth child record wasn't a Comment2000Atom, was of type " + _children[3].getRecordType());
}
}
-
+
/**
* Create a new Comment2000, with blank fields
*/
public Comment2000() {
_header = new byte[8];
_children = new Record[4];
-
+
// Setup our header block
_header[0] = 0x0f; // We are a container record
LittleEndian.putShort(_header, 2, (short)_type);
-
+
// Setup our child records
CString csa = new CString();
CString csb = new CString();
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Comment2000Atom.java Thu May 21 18:12:22 2009
@@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -31,7 +30,7 @@
* @author Daniel Noll
*/
-public class Comment2000Atom extends RecordAtom
+public final class Comment2000Atom extends RecordAtom
{
/**
* Record header.
@@ -52,7 +51,7 @@
LittleEndian.putShort(_header, 2, (short)getRecordType());
LittleEndian.putInt(_header, 4, _data.length);
-
+
// It is fine for the other values to be zero
}
@@ -67,7 +66,7 @@
// Get the header.
_header = new byte[8];
System.arraycopy(source,start,_header,0,8);
-
+
// Get the record data.
_data = new byte[len-8];
System.arraycopy(source,start+8,_data,0,len-8);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Document.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -25,13 +23,13 @@
import java.io.OutputStream;
/**
- * Master container for Document. There is one of these for every
+ * Master container for Document. There is one of these for every
* slideshow, and it holds lots of definitions, and some summaries.
*
* @author Nick Burch
*/
-public class Document extends PositionDependentRecordContainer
+public final class Document extends PositionDependentRecordContainer
{
private byte[] _header;
private static long _type = 1000;
@@ -58,12 +56,12 @@
*/
public PPDrawingGroup getPPDrawingGroup() { return ppDrawing; }
/**
- * Returns the ExObjList, which holds the references to
+ * Returns the ExObjList, which holds the references to
* external objects used in the slides. This may be null, if
* there are no external references.
*/
public ExObjList getExObjList() { return exObjList; }
-
+
/**
* Returns all the SlideListWithTexts that are defined for
* this Document. They hold the text, and some of the text
@@ -74,9 +72,9 @@
/**
* Returns the SlideListWithText that deals with the
- * Master Slides
+ * Master Slides
*/
- public SlideListWithText getMasterSlideListWithText() {
+ public SlideListWithText getMasterSlideListWithText() {
for (int i = 0; i < slwts.length; i++) {
if(slwts[i].getInstance() == SlideListWithText.MASTER) {
return slwts[i];
@@ -111,7 +109,7 @@
}
- /**
+ /**
* Set things up, and find our more interesting children
*/
protected Document(byte[] source, int start, int len) {
@@ -146,7 +144,7 @@
exObjList = (ExObjList)_children[i];
}
}
-
+
// You should only every have 1, 2 or 3 SLWTs
// (normally it's 2, or 3 if you have notes)
// Complain if it's not
@@ -156,7 +154,7 @@
if(slwtcount > 3) {
logger.log(POILogger.WARN, "Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
}
-
+
// Now grab all the SLWTs
slwts = new SlideListWithText[slwtcount];
slwtcount = 0;
@@ -167,22 +165,22 @@
}
}
}
-
+
/**
- * Adds a new SlideListWithText record, at the appropriate
+ * Adds a new SlideListWithText record, at the appropriate
* point in the child records.
*/
public void addSlideListWithText(SlideListWithText slwt) {
- // The new SlideListWithText should go in
+ // The new SlideListWithText should go in
// just before the EndDocumentRecord
Record endDoc = _children[_children.length - 1];
if(endDoc.getRecordType() != RecordTypes.EndDocument.typeID) {
throw new IllegalStateException("The last child record of a Document should be EndDocument, but it was " + endDoc);
}
-
+
// Add in the record
addChildBefore(slwt, endDoc);
-
+
// Updated our cached list of SlideListWithText records
int newSize = slwts.length + 1;
SlideListWithText[] nl = new SlideListWithText[newSize];
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -30,7 +28,7 @@
* @author Nick Burch
*/
-public class DocumentAtom extends RecordAtom
+public final class DocumentAtom extends RecordAtom
{
private byte[] _header;
private static long _type = 1001l;
@@ -96,7 +94,7 @@
/* *************** record code follows ********************** */
- /**
+ /**
* For the Document Atom
*/
protected DocumentAtom(byte[] source, int start, int len) {
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -32,7 +30,7 @@
* @author Nick Burch
*/
-public class DocumentEncryptionAtom extends RecordAtom
+public final class DocumentEncryptionAtom extends RecordAtom
{
private byte[] _header;
private static long _type = 12052l;
@@ -40,7 +38,7 @@
private byte[] data;
private String encryptionProviderName;
- /**
+ /**
* For the Document Encryption Atom
*/
protected DocumentEncryptionAtom(byte[] source, int start, int len) {
@@ -67,21 +65,21 @@
int stringLen = (endPos-pos) / 2;
encryptionProviderName = StringUtil.getFromUnicodeLE(source, pos, stringLen);
}
-
+
/**
* Return the length of the encryption key, in bits
*/
public int getKeyLength() {
return data[28];
}
-
+
/**
* Return the name of the encryption provider used
*/
public String getEncryptionProviderName() {
return encryptionProviderName;
}
-
+
/**
* We are of type 12052
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyPositionSensitiveRecordWithChildren.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyPositionSensitiveRecordWithChildren.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyPositionSensitiveRecordWithChildren.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyPositionSensitiveRecordWithChildren.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -35,12 +33,12 @@
* @author Nick Burch
*/
-public class DummyPositionSensitiveRecordWithChildren extends PositionDependentRecordContainer
+public final class DummyPositionSensitiveRecordWithChildren extends PositionDependentRecordContainer
{
private byte[] _header;
private long _type;
- /**
+ /**
* Create a new holder for a boring record with children, but with
* position dependent characteristics
*/
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyRecordWithChildren.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyRecordWithChildren.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyRecordWithChildren.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DummyRecordWithChildren.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -31,12 +29,12 @@
* @author Nick Burch
*/
-public class DummyRecordWithChildren extends RecordContainer
+public final class DummyRecordWithChildren extends RecordContainer
{
private byte[] _header;
private long _type;
- /**
+ /**
* Create a new holder for a boring record with children
*/
protected DummyRecordWithChildren(byte[] source, int start, int len) {
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Environment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Environment.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Environment.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Environment.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -23,12 +21,12 @@
import java.io.OutputStream;
/**
- * Environment, which contains lots of settings for the document.
+ * Environment, which contains lots of settings for the document.
*
* @author Nick Burch
*/
-public class Environment extends PositionDependentRecordContainer
+public final class Environment extends PositionDependentRecordContainer
{
private byte[] _header;
private static long _type = 1010;
@@ -44,7 +42,7 @@
public FontCollection getFontCollection() { return fontCollection; }
- /**
+ /**
* Set things up, and find our more interesting children
*/
protected Environment(byte[] source, int start, int len) {
@@ -54,7 +52,7 @@
// Find our children
_children = Record.findChildRecords(source,start+8,len-8);
-
+
// Find our FontCollection record
for(int i=0; i<_children.length; i++) {
if(_children[i] instanceof FontCollection) {
@@ -63,7 +61,7 @@
txmaster = (TxMasterStyleAtom)_children[i];
}
}
-
+
if(fontCollection == null) {
throw new IllegalStateException("Environment didn't contain a FontCollection record!");
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -26,7 +24,7 @@
import java.io.ByteArrayOutputStream;
/**
- * A wrapper around a DDF (Escher) EscherTextbox Record. Causes the DDF
+ * A wrapper around a DDF (Escher) EscherTextbox Record. Causes the DDF
* Record to be accessible as if it were a HSLF record.
* Note: when asked to write out, will simply put any child records correctly
* into the Escher layer. A call to the escher layer to write out (by the
@@ -35,7 +33,7 @@
* @author Nick Burch
*/
-public class EscherTextboxWrapper extends RecordContainer
+public final class EscherTextboxWrapper extends RecordContainer
{
private EscherTextboxRecord _escherRecord;
private long _type;
@@ -46,7 +44,7 @@
*/
public EscherTextboxRecord getEscherRecord() { return _escherRecord; }
- /**
+ /**
* Creates the wrapper for the given DDF Escher Record and children
*/
public EscherTextboxWrapper(EscherTextboxRecord textbox) {
@@ -57,7 +55,7 @@
byte[] data = _escherRecord.getData();
_children = Record.findChildRecords(data,0,data.length);
}
-
+
/**
* Creates a new, empty wrapper for DDF Escher Records and their children
*/
@@ -68,7 +66,7 @@
_children = new Record[0];
}
-
+
/**
* Return the type of the escher record (normally in the 0xFnnn range)
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExAviMovie.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExAviMovie.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExAviMovie.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExAviMovie.java Thu May 21 18:12:22 2009
@@ -1,53 +1,54 @@
-/*
-* 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.hslf.record;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
-/**
- * A container record that specifies information about a movie stored externally.
- *
- * @author Yegor Kozlov
- */
-public class ExAviMovie extends ExMCIMovie {
-
- /**
- * Set things up, and find our more interesting children
- */
- protected ExAviMovie(byte[] source, int start, int len) {
- super(source, start, len);
- }
-
- /**
- * Create a new ExAviMovie, with blank fields
- */
- public ExAviMovie() {
- super();
-
- }
- /**
- * We are of type 4102
- */
- public long getRecordType() {
- return RecordTypes.ExAviMovie.typeID;
- }
-
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
+/**
+ * A container record that specifies information about a movie stored externally.
+ *
+ * @author Yegor Kozlov
+ */
+public final class ExAviMovie extends ExMCIMovie {
+
+ /**
+ * Set things up, and find our more interesting children
+ */
+ protected ExAviMovie(byte[] source, int start, int len) {
+ super(source, start, len);
+ }
+
+ /**
+ * Create a new ExAviMovie, with blank fields
+ */
+ public ExAviMovie() {
+ super();
+
+ }
+ /**
+ * We are of type 4102
+ */
+ public long getRecordType() {
+ return RecordTypes.ExAviMovie.typeID;
+ }
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java Thu May 21 18:12:22 2009
@@ -1,82 +1,82 @@
-/* ====================================================================
- 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.hslf.record;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
-/**
- * A container record that specifies information about an ActiveX control. It contains:
- * <p>
- * 1. ExControlAtom (4091)
- * 2. ExOleObjAtom (4035)
- * 3. CString (4026), Instance MenuName (1) used for menus and the Links dialog box.
- * 4. CString (4026), Instance ProgID (2) that stores the OLE Programmatic Identifier.
- * A ProgID is a string that uniquely identifies a given object.
- * 5. CString (4026), Instance ClipboardName (3) that appears in the paste special dialog.
- * 6. MetaFile( 4033), optional
- * </p>
- *
- *
- * @author Yegor kozlov
- */
-public class ExControl extends ExEmbed {
-
- /**
- * Set things up, and find our more interesting children
- *
- * @param source the source data as a byte array.
- * @param start the start offset into the byte array.
- * @param len the length of the slice in the byte array.
- */
- protected ExControl(byte[] source, int start, int len) {
- super(source, start, len);
- }
-
- /**
- * Create a new ExEmbed, with blank fields
- */
- public ExControl() {
- super();
-
- _children[0] = embedAtom = new ExControlAtom();
- }
-
- /**
- * Gets the {@link ExControlAtom}.
- *
- * @return the {@link ExControlAtom}.
- */
- public ExControlAtom getExControlAtom()
- {
- return (ExControlAtom)_children[0];
- }
-
- /**
- * Returns the type (held as a little endian in bytes 3 and 4)
- * that this class handles.
- *
- * @return the record type.
- */
- public long getRecordType() {
- return RecordTypes.ExControl.typeID;
- }
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.OutputStream;
+import java.io.IOException;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
+/**
+ * A container record that specifies information about an ActiveX control. It contains:
+ * <p>
+ * 1. ExControlAtom (4091)
+ * 2. ExOleObjAtom (4035)
+ * 3. CString (4026), Instance MenuName (1) used for menus and the Links dialog box.
+ * 4. CString (4026), Instance ProgID (2) that stores the OLE Programmatic Identifier.
+ * A ProgID is a string that uniquely identifies a given object.
+ * 5. CString (4026), Instance ClipboardName (3) that appears in the paste special dialog.
+ * 6. MetaFile( 4033), optional
+ * </p>
+ *
+ *
+ * @author Yegor kozlov
+ */
+public final class ExControl extends ExEmbed {
+
+ /**
+ * Set things up, and find our more interesting children
+ *
+ * @param source the source data as a byte array.
+ * @param start the start offset into the byte array.
+ * @param len the length of the slice in the byte array.
+ */
+ protected ExControl(byte[] source, int start, int len) {
+ super(source, start, len);
+ }
+
+ /**
+ * Create a new ExEmbed, with blank fields
+ */
+ public ExControl() {
+ super();
+
+ _children[0] = embedAtom = new ExControlAtom();
+ }
+
+ /**
+ * Gets the {@link ExControlAtom}.
+ *
+ * @return the {@link ExControlAtom}.
+ */
+ public ExControlAtom getExControlAtom()
+ {
+ return (ExControlAtom)_children[0];
+ }
+
+ /**
+ * Returns the type (held as a little endian in bytes 3 and 4)
+ * that this class handles.
+ *
+ * @return the record type.
+ */
+ public long getRecordType() {
+ return RecordTypes.ExControl.typeID;
+ }
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java Thu May 21 18:12:22 2009
@@ -1,117 +1,117 @@
-/* ====================================================================
- 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.hslf.record;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.poi.util.LittleEndian;
-
-/**
- * An atom record that specifies an ActiveX control.
- *
- * @author Yegor Kozlov
- */
-public class ExControlAtom extends RecordAtom {
-
-
- /**
- * Record header.
- */
- private byte[] _header;
-
- /**
- * slideId.
- */
- private int _id;
-
- /**
- * Constructs a brand new embedded object atom record.
- */
- protected ExControlAtom() {
- _header = new byte[8];
-
- LittleEndian.putShort(_header, 2, (short) getRecordType());
- LittleEndian.putInt(_header, 4, 4);
-
- }
-
- /**
- * Constructs the ExControlAtom record from its source data.
- *
- * @param source the source data as a byte array.
- * @param start the start offset into the byte array.
- * @param len the length of the slice in the byte array.
- */
- protected ExControlAtom(byte[] source, int start, int len) {
- // Get the header.
- _header = new byte[8];
- System.arraycopy(source, start, _header, 0, 8);
-
- _id = LittleEndian.getInt(source, start + 8);
- }
-
- /**
- * An integer that specifies which presentation slide is associated with the ActiveX control.
- * <p>
- * It MUST be 0x00000000 or equal to the value of the slideId field of a SlidePersistAtom record.
- * The value 0x00000000 specifies a null reference.
- * </p>
- *
- * @return an integer that specifies which presentation slide is associated with the ActiveX control
- */
- public int getSlideId() {
- return _id;
- }
-
- /**
- * Sets which presentation slide is associated with the ActiveX control.
- *
- * @param id an integer that specifies which presentation slide is associated with the ActiveX control
- * <p>
- * It MUST be 0x00000000 or equal to the value of the slideId field of a SlidePersistAtom record.
- * The value 0x00000000 specifies a null reference.
- * </p>
- */
- public void setSlideId(int id) {
- _id = id;
- }
-
- /**
- * Gets the record type.
- * @return the record type.
- */
- public long getRecordType() {
- return RecordTypes.ExControlAtom.typeID;
- }
-
- /**
- * Write the contents of the record back, so it can be written
- * to disk
- *
- * @param out the output stream to write to.
- * @throws java.io.IOException if an error occurs.
- */
- public void writeOut(OutputStream out) throws IOException {
- out.write(_header);
- byte[] data = new byte[4];
- LittleEndian.putInt(data, _id);
- out.write(data);
- }
-
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * An atom record that specifies an ActiveX control.
+ *
+ * @author Yegor Kozlov
+ */
+public final class ExControlAtom extends RecordAtom {
+
+
+ /**
+ * Record header.
+ */
+ private byte[] _header;
+
+ /**
+ * slideId.
+ */
+ private int _id;
+
+ /**
+ * Constructs a brand new embedded object atom record.
+ */
+ protected ExControlAtom() {
+ _header = new byte[8];
+
+ LittleEndian.putShort(_header, 2, (short) getRecordType());
+ LittleEndian.putInt(_header, 4, 4);
+
+ }
+
+ /**
+ * Constructs the ExControlAtom record from its source data.
+ *
+ * @param source the source data as a byte array.
+ * @param start the start offset into the byte array.
+ * @param len the length of the slice in the byte array.
+ */
+ protected ExControlAtom(byte[] source, int start, int len) {
+ // Get the header.
+ _header = new byte[8];
+ System.arraycopy(source, start, _header, 0, 8);
+
+ _id = LittleEndian.getInt(source, start + 8);
+ }
+
+ /**
+ * An integer that specifies which presentation slide is associated with the ActiveX control.
+ * <p>
+ * It MUST be 0x00000000 or equal to the value of the slideId field of a SlidePersistAtom record.
+ * The value 0x00000000 specifies a null reference.
+ * </p>
+ *
+ * @return an integer that specifies which presentation slide is associated with the ActiveX control
+ */
+ public int getSlideId() {
+ return _id;
+ }
+
+ /**
+ * Sets which presentation slide is associated with the ActiveX control.
+ *
+ * @param id an integer that specifies which presentation slide is associated with the ActiveX control
+ * <p>
+ * It MUST be 0x00000000 or equal to the value of the slideId field of a SlidePersistAtom record.
+ * The value 0x00000000 specifies a null reference.
+ * </p>
+ */
+ public void setSlideId(int id) {
+ _id = id;
+ }
+
+ /**
+ * Gets the record type.
+ * @return the record type.
+ */
+ public long getRecordType() {
+ return RecordTypes.ExControlAtom.typeID;
+ }
+
+ /**
+ * Write the contents of the record back, so it can be written
+ * to disk
+ *
+ * @param out the output stream to write to.
+ * @throws java.io.IOException if an error occurs.
+ */
+ public void writeOut(OutputStream out) throws IOException {
+ out.write(_header);
+ byte[] data = new byte[4];
+ LittleEndian.putInt(data, _id);
+ out.write(data);
+ }
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java Thu May 21 18:12:22 2009
@@ -1,100 +1,101 @@
-/*
-* 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.hslf.record;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
-/**
- * A container record that specifies information about a movie stored externally.
- *
- * @author Yegor Kozlov
- */
-public class ExMCIMovie extends RecordContainer {
- private byte[] _header;
-
- //An ExVideoContainer record that specifies information about the MCI movie
- private ExVideoContainer exVideo;
-
- /**
- * Set things up, and find our more interesting children
- */
- protected ExMCIMovie(byte[] source, int start, int len) {
- // Grab the header
- _header = new byte[8];
- System.arraycopy(source, start, _header, 0, 8);
-
- // Find our children
- _children = Record.findChildRecords(source, start + 8, len - 8);
- findInterestingChildren();
- }
-
- /**
- * Create a new ExMCIMovie, with blank fields
- */
- public ExMCIMovie() {
- _header = new byte[8];
- // Setup our header block
- _header[0] = 0x0f; // We are a container record
- LittleEndian.putShort(_header, 2, (short) getRecordType());
-
- exVideo = new ExVideoContainer();
- _children = new Record[]{exVideo};
-
- }
-
- /**
- * Go through our child records, picking out the ones that are
- * interesting, and saving those for use by the easy helper
- * methods.
- */
- private void findInterestingChildren() {
-
- // First child should be the ExVideoContainer
- if (_children[0] instanceof ExVideoContainer) {
- exVideo = (ExVideoContainer) _children[0];
- } else {
- logger.log(POILogger.ERROR, "First child record wasn't a ExVideoContainer, was of type " + _children[0].getRecordType());
- }
- }
-
- /**
- * We are of type 4103
- */
- public long getRecordType() {
- return RecordTypes.ExMCIMovie.typeID;
- }
-
- /**
- * Write the contents of the record back, so it can be written
- * to disk
- */
- public void writeOut(OutputStream out) throws IOException {
- writeOut(_header[0], _header[1], getRecordType(), _children, out);
- }
-
- /**
- * Returns the ExVideoContainer that specifies information about the MCI movie
- */
- public ExVideoContainer getExVideo() {
- return exVideo; }
-
-
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
+/**
+ * A container record that specifies information about a movie stored externally.
+ *
+ * @author Yegor Kozlov
+ */
+public class ExMCIMovie extends RecordContainer { // TODO - instantiable superclass
+ private byte[] _header;
+
+ //An ExVideoContainer record that specifies information about the MCI movie
+ private ExVideoContainer exVideo;
+
+ /**
+ * Set things up, and find our more interesting children
+ */
+ protected ExMCIMovie(byte[] source, int start, int len) {
+ // Grab the header
+ _header = new byte[8];
+ System.arraycopy(source, start, _header, 0, 8);
+
+ // Find our children
+ _children = Record.findChildRecords(source, start + 8, len - 8);
+ findInterestingChildren();
+ }
+
+ /**
+ * Create a new ExMCIMovie, with blank fields
+ */
+ public ExMCIMovie() {
+ _header = new byte[8];
+ // Setup our header block
+ _header[0] = 0x0f; // We are a container record
+ LittleEndian.putShort(_header, 2, (short) getRecordType());
+
+ exVideo = new ExVideoContainer();
+ _children = new Record[]{exVideo};
+
+ }
+
+ /**
+ * Go through our child records, picking out the ones that are
+ * interesting, and saving those for use by the easy helper
+ * methods.
+ */
+ private void findInterestingChildren() {
+
+ // First child should be the ExVideoContainer
+ if (_children[0] instanceof ExVideoContainer) {
+ exVideo = (ExVideoContainer) _children[0];
+ } else {
+ logger.log(POILogger.ERROR, "First child record wasn't a ExVideoContainer, was of type " + _children[0].getRecordType());
+ }
+ }
+
+ /**
+ * We are of type 4103
+ */
+ public long getRecordType() {
+ return RecordTypes.ExMCIMovie.typeID;
+ }
+
+ /**
+ * Write the contents of the record back, so it can be written
+ * to disk
+ */
+ public void writeOut(OutputStream out) throws IOException {
+ writeOut(_header[0], _header[1], getRecordType(), _children, out);
+ }
+
+ /**
+ * Returns the ExVideoContainer that specifies information about the MCI movie
+ */
+ public ExVideoContainer getExVideo() {
+ return exVideo; }
+
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java Thu May 21 18:12:22 2009
@@ -1,172 +1,171 @@
-/* ====================================================================
- 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.hslf.record;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Date;
-
-import org.apache.poi.hslf.util.SystemTimeUtils;
-import org.apache.poi.util.LittleEndian;
-
-/**
- * An atom record that specifies information about external audio or video data.
- *
- * @author Yegor Kozlov
- */
-public class ExMediaAtom extends RecordAtom
-{
-
- /**
- * A bit that specifies whether the audio or video data is repeated continuously during playback.
- */
- public static final int fLoop = 1;
- /**
- * A bit that specifies whether the audio or video data is rewound after playing.
- */
- public static final int fRewind = 2;
- /**
- * A bit that specifies whether the audio data is recorded narration for the slide show. It MUST be FALSE if this ExMediaAtom record is contained by an ExVideoContainer record.
- */
- public static final int fNarration = 4;
-
- /**
- * Record header.
- */
- private byte[] _header;
-
- /**
- * record data
- */
- private byte[] _recdata;
-
- /**
- * Constructs a brand new link related atom record.
- */
- protected ExMediaAtom() {
- _recdata = new byte[8];
-
- _header = new byte[8];
- LittleEndian.putShort(_header, 2, (short)getRecordType());
- LittleEndian.putInt(_header, 4, _recdata.length);
- }
-
- /**
- * Constructs the link related atom record from its
- * source data.
- *
- * @param source the source data as a byte array.
- * @param start the start offset into the byte array.
- * @param len the length of the slice in the byte array.
- */
- protected ExMediaAtom(byte[] source, int start, int len) {
- // Get the header
- _header = new byte[8];
- System.arraycopy(source,start,_header,0,8);
-
- // Grab the record data
- _recdata = new byte[len-8];
- System.arraycopy(source,start+8,_recdata,0,len-8);
- }
-
- /**
- * Gets the record type.
- * @return the record type.
- */
- public long getRecordType() { return RecordTypes.ExMediaAtom.typeID; }
-
- /**
- * Write the contents of the record back, so it can be written
- * to disk
- *
- * @param out the output stream to write to.
- * @throws java.io.IOException if an error occurs.
- */
- public void writeOut(OutputStream out) throws IOException {
- out.write(_header);
- out.write(_recdata);
- }
-
- /**
- * A 4-byte unsigned integer that specifies an ID for an external object.
- *
- * @return A 4-byte unsigned integer that specifies an ID for an external object.
- */
- public int getObjectId(){
- return LittleEndian.getInt(_recdata, 0);
- }
-
- /**
- * A 4-byte unsigned integer that specifies an ID for an external object.
- *
- * @param id A 4-byte unsigned integer that specifies an ID for an external object.
- */
- public void setObjectId(int id){
- LittleEndian.putInt(_recdata, 0, id);
- }
-
- /**
- * A bit mask specifying options for displaying headers and footers
- *
- * @return A bit mask specifying options for displaying headers and footers
- */
- public int getMask(){
- return LittleEndian.getInt(_recdata, 4);
- }
-
- /**
- * A bit mask specifying options for displaying video
- *
- * @param mask A bit mask specifying options for displaying video
- */
- public void setMask(int mask){
- LittleEndian.putInt(_recdata, 4, mask);
- }
-
- /**
- * @param bit the bit to check
- * @return whether the specified flag is set
- */
- public boolean getFlag(int bit){
- return (getMask() & bit) != 0;
- }
-
- /**
- * @param bit the bit to set
- * @param value whether the specified bit is set
- */
- public void setFlag(int bit, boolean value){
- int mask = getMask();
- if(value) mask |= bit;
- else mask &= ~bit;
- setMask(mask);
- }
-
- public String toString(){
- StringBuffer buf = new StringBuffer();
- buf.append("ExMediaAtom\n");
- buf.append("\tObjectId: " + getObjectId() + "\n");
- buf.append("\tMask : " + getMask() + "\n");
- buf.append("\t fLoop : " + getFlag(fLoop) + "\n");
- buf.append("\t fRewind : " + getFlag(fRewind) + "\n");
- buf.append("\t fNarration : " + getFlag(fNarration) + "\n");
- return buf.toString();
- }
-
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+
+import org.apache.poi.hslf.util.SystemTimeUtils;
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * An atom record that specifies information about external audio or video data.
+ *
+ * @author Yegor Kozlov
+ */
+public final class ExMediaAtom extends RecordAtom
+{
+
+ /**
+ * A bit that specifies whether the audio or video data is repeated continuously during playback.
+ */
+ public static final int fLoop = 1;
+ /**
+ * A bit that specifies whether the audio or video data is rewound after playing.
+ */
+ public static final int fRewind = 2;
+ /**
+ * A bit that specifies whether the audio data is recorded narration for the slide show. It MUST be FALSE if this ExMediaAtom record is contained by an ExVideoContainer record.
+ */
+ public static final int fNarration = 4;
+
+ /**
+ * Record header.
+ */
+ private byte[] _header;
+
+ /**
+ * record data
+ */
+ private byte[] _recdata;
+
+ /**
+ * Constructs a brand new link related atom record.
+ */
+ protected ExMediaAtom() {
+ _recdata = new byte[8];
+
+ _header = new byte[8];
+ LittleEndian.putShort(_header, 2, (short)getRecordType());
+ LittleEndian.putInt(_header, 4, _recdata.length);
+ }
+
+ /**
+ * Constructs the link related atom record from its
+ * source data.
+ *
+ * @param source the source data as a byte array.
+ * @param start the start offset into the byte array.
+ * @param len the length of the slice in the byte array.
+ */
+ protected ExMediaAtom(byte[] source, int start, int len) {
+ // Get the header
+ _header = new byte[8];
+ System.arraycopy(source,start,_header,0,8);
+
+ // Grab the record data
+ _recdata = new byte[len-8];
+ System.arraycopy(source,start+8,_recdata,0,len-8);
+ }
+
+ /**
+ * Gets the record type.
+ * @return the record type.
+ */
+ public long getRecordType() { return RecordTypes.ExMediaAtom.typeID; }
+
+ /**
+ * Write the contents of the record back, so it can be written
+ * to disk
+ *
+ * @param out the output stream to write to.
+ * @throws java.io.IOException if an error occurs.
+ */
+ public void writeOut(OutputStream out) throws IOException {
+ out.write(_header);
+ out.write(_recdata);
+ }
+
+ /**
+ * A 4-byte unsigned integer that specifies an ID for an external object.
+ *
+ * @return A 4-byte unsigned integer that specifies an ID for an external object.
+ */
+ public int getObjectId(){
+ return LittleEndian.getInt(_recdata, 0);
+ }
+
+ /**
+ * A 4-byte unsigned integer that specifies an ID for an external object.
+ *
+ * @param id A 4-byte unsigned integer that specifies an ID for an external object.
+ */
+ public void setObjectId(int id){
+ LittleEndian.putInt(_recdata, 0, id);
+ }
+
+ /**
+ * A bit mask specifying options for displaying headers and footers
+ *
+ * @return A bit mask specifying options for displaying headers and footers
+ */
+ public int getMask(){
+ return LittleEndian.getInt(_recdata, 4);
+ }
+
+ /**
+ * A bit mask specifying options for displaying video
+ *
+ * @param mask A bit mask specifying options for displaying video
+ */
+ public void setMask(int mask){
+ LittleEndian.putInt(_recdata, 4, mask);
+ }
+
+ /**
+ * @param bit the bit to check
+ * @return whether the specified flag is set
+ */
+ public boolean getFlag(int bit){
+ return (getMask() & bit) != 0;
+ }
+
+ /**
+ * @param bit the bit to set
+ * @param value whether the specified bit is set
+ */
+ public void setFlag(int bit, boolean value){
+ int mask = getMask();
+ if(value) mask |= bit;
+ else mask &= ~bit;
+ setMask(mask);
+ }
+
+ public String toString(){
+ StringBuffer buf = new StringBuffer();
+ buf.append("ExMediaAtom\n");
+ buf.append("\tObjectId: " + getObjectId() + "\n");
+ buf.append("\tMask : " + getMask() + "\n");
+ buf.append("\t fLoop : " + getFlag(fLoop) + "\n");
+ buf.append("\t fRewind : " + getFlag(fRewind) + "\n");
+ buf.append("\t fNarration : " + getFlag(fNarration) + "\n");
+ return buf.toString();
+ }
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java Thu May 21 18:12:22 2009
@@ -1,108 +1,109 @@
-/*
-* 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.hslf.record;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
-/**
- * A container record that specifies information about external video data.
- *
- * @author Yegor Kozlov
- */
-public class ExVideoContainer extends RecordContainer {
- private byte[] _header;
-
- // Links to our more interesting children
- private ExMediaAtom mediaAtom;
- //the UNC or local path to a video file.
- private CString pathAtom;
-
- /**
- * Set things up, and find our more interesting children
- */
- protected ExVideoContainer(byte[] source, int start, int len) {
- // Grab the header
- _header = new byte[8];
- System.arraycopy(source,start,_header,0,8);
-
- // Find our children
- _children = Record.findChildRecords(source,start+8,len-8);
- findInterestingChildren();
- }
-
- /**
- * Go through our child records, picking out the ones that are
- * interesting, and saving those for use by the easy helper
- * methods.
- */
- private void findInterestingChildren() {
-
- // First child should be the ExMediaAtom
- if(_children[0] instanceof ExMediaAtom) {
- mediaAtom = (ExMediaAtom)_children[0];
- } else {
- logger.log(POILogger.ERROR, "First child record wasn't a ExMediaAtom, was of type " + _children[0].getRecordType());
- }
- if(_children[1] instanceof CString) {
- pathAtom = (CString)_children[1];
- } else {
- logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type " + _children[1].getRecordType());
- }
- }
-
- /**
- * Create a new ExVideoContainer, with blank fields
- */
- public ExVideoContainer() {
- // Setup our header block
- _header = new byte[8];
- _header[0] = 0x0f; // We are a container record
- LittleEndian.putShort(_header, 2, (short)getRecordType());
-
- _children = new Record[2];
- _children[0] = mediaAtom = new ExMediaAtom();
- _children[1] = pathAtom = new CString();
- }
-
- /**
- * We are of type 4103
- */
- public long getRecordType() { return RecordTypes.ExVideoContainer.typeID; }
-
- /**
- * Write the contents of the record back, so it can be written
- * to disk
- */
- public void writeOut(OutputStream out) throws IOException {
- writeOut(_header[0],_header[1],getRecordType(),_children,out);
- }
-
- /**
- * Returns the ExMediaAtom of this link
- */
- public ExMediaAtom getExMediaAtom() { return mediaAtom; }
-
- /**
- * Returns the Path Atom (CString) of this link
- */
- public CString getPathAtom() { return pathAtom; }
-
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
+
+/**
+ * A container record that specifies information about external video data.
+ *
+ * @author Yegor Kozlov
+ */
+public final class ExVideoContainer extends RecordContainer {
+ private byte[] _header;
+
+ // Links to our more interesting children
+ private ExMediaAtom mediaAtom;
+ //the UNC or local path to a video file.
+ private CString pathAtom;
+
+ /**
+ * Set things up, and find our more interesting children
+ */
+ protected ExVideoContainer(byte[] source, int start, int len) {
+ // Grab the header
+ _header = new byte[8];
+ System.arraycopy(source,start,_header,0,8);
+
+ // Find our children
+ _children = Record.findChildRecords(source,start+8,len-8);
+ findInterestingChildren();
+ }
+
+ /**
+ * Go through our child records, picking out the ones that are
+ * interesting, and saving those for use by the easy helper
+ * methods.
+ */
+ private void findInterestingChildren() {
+
+ // First child should be the ExMediaAtom
+ if(_children[0] instanceof ExMediaAtom) {
+ mediaAtom = (ExMediaAtom)_children[0];
+ } else {
+ logger.log(POILogger.ERROR, "First child record wasn't a ExMediaAtom, was of type " + _children[0].getRecordType());
+ }
+ if(_children[1] instanceof CString) {
+ pathAtom = (CString)_children[1];
+ } else {
+ logger.log(POILogger.ERROR, "Second child record wasn't a CString, was of type " + _children[1].getRecordType());
+ }
+ }
+
+ /**
+ * Create a new ExVideoContainer, with blank fields
+ */
+ public ExVideoContainer() {
+ // Setup our header block
+ _header = new byte[8];
+ _header[0] = 0x0f; // We are a container record
+ LittleEndian.putShort(_header, 2, (short)getRecordType());
+
+ _children = new Record[2];
+ _children[0] = mediaAtom = new ExMediaAtom();
+ _children[1] = pathAtom = new CString();
+ }
+
+ /**
+ * We are of type 4103
+ */
+ public long getRecordType() { return RecordTypes.ExVideoContainer.typeID; }
+
+ /**
+ * Write the contents of the record back, so it can be written
+ * to disk
+ */
+ public void writeOut(OutputStream out) throws IOException {
+ writeOut(_header[0],_header[1],getRecordType(),_children,out);
+ }
+
+ /**
+ * Returns the ExMediaAtom of this link
+ */
+ public ExMediaAtom getExMediaAtom() { return mediaAtom; }
+
+ /**
+ * Returns the Path Atom (CString) of this link
+ */
+ public CString getPathAtom() { return pathAtom; }
+
+}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java Thu May 21 18:12:22 2009
@@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -30,7 +29,7 @@
* @author Yegor Kozlov
*/
-public class FontCollection extends RecordContainer {
+public final class FontCollection extends RecordContainer {
private List fonts;
private byte[] _header;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java Thu May 21 18:12:22 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hslf.record;
@@ -34,7 +32,7 @@
* @author Yegor Kozlov
*/
-public class FontEntityAtom extends RecordAtom {
+public final class FontEntityAtom extends RecordAtom {
/**
* record header
*/
@@ -75,7 +73,7 @@
/**
* A null-terminated string that specifies the typeface name of the font.
- * The length of this string must not exceed 32 characters
+ * The length of this string must not exceed 32 characters
* including the null terminator.
* @return font name
*/
@@ -99,7 +97,7 @@
/**
* Set the name of the font.
- * The length of this string must not exceed 32 characters
+ * The length of this string must not exceed 32 characters
* including the null terminator.
* Will be converted to null-terminated if not already
* @param name of the font
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java?rev=777204&r1=777203&r2=777204&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java Thu May 21 18:12:22 2009
@@ -1,213 +1,211 @@
-
-/* ====================================================================
- 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.hslf.record;
-
-import org.apache.poi.util.LittleEndian;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * An atom record that specifies options for displaying headers and footers
- * on a presentation slide or notes slide.
- *
- * @author Yegor Kozlov
- */
-
-public class HeadersFootersAtom extends RecordAtom {
-
- /**
- * A bit that specifies whether the date is displayed in the footer.
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasDate = 1;
-
- /**
- * A bit that specifies whether the current datetime is used for displaying the datetime.
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasTodayDate = 2;
-
- /**
- * A bit that specifies whether the date specified in UserDateAtom record
- * is used for displaying the datetime.
- *
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasUserDate = 4;
-
- /**
- * A bit that specifies whether the slide number is displayed in the footer.
- *
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasSlideNumber = 8;
-
- /**
- * bit that specifies whether the header text is displayed.
- *
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasHeader = 16;
-
- /**
- * bit that specifies whether the footer text is displayed.
- *
- * @see #getMask()
- * @see #setMask(int)
- */
- public static final int fHasFooter = 32;
-
- /**
- * record header
- */
- private byte[] _header;
-
- /**
- * record data
- */
- private byte[] _recdata;
-
- /**
- * Build an instance of <code>HeadersFootersAtom</code> from on-disk data
- */
- protected HeadersFootersAtom(byte[] source, int start, int len) {
- // Get the header
- _header = new byte[8];
- System.arraycopy(source,start,_header,0,8);
-
- // Grab the record data
- _recdata = new byte[len-8];
- System.arraycopy(source,start+8,_recdata,0,len-8);
- }
-
- /**
- * Create a new instance of <code>HeadersFootersAtom</code>
- */
- public HeadersFootersAtom() {
- _recdata = new byte[4];
-
- _header = new byte[8];
- LittleEndian.putShort(_header, 2, (short)getRecordType());
- LittleEndian.putInt(_header, 4, _recdata.length);
- }
-
- public long getRecordType() {
- return RecordTypes.HeadersFootersAtom.typeID;
- }
-
- /**
- * Write the contents of the record back, so it can be written to disk
- */
- public void writeOut(OutputStream out) throws IOException {
- out.write(_header);
- out.write(_recdata);
- }
-
- /**
- * A signed integer that specifies the format ID to be used to style the datetime.
- * <p>
- * It MUST be in the range [0, 12]. </br>
- * This value is converted into a string as specified by the index field of the DateTimeMCAtom record.
- * It MUST be ignored unless fHasTodayDate is TRUE.
- * </b>
- *
- * @return A signed integer that specifies the format ID to be used to style the datetime.
- */
- public int getFormatId(){
- return LittleEndian.getShort(_recdata, 0);
- }
-
- /**
- * A signed integer that specifies the format ID to be used to style the datetime.
- *
- * @param formatId A signed integer that specifies the format ID to be used to style the datetime.
- */
- public void setFormatId(int formatId){
- LittleEndian.putUShort(_recdata, 0, formatId);
- }
-
- /**
- * A bit mask specifying options for displaying headers and footers
- *
- * <li> A - {@link #fHasDate} (1 bit): A bit that specifies whether the date is displayed in the footer.
- * <li> B - {@link #fHasTodayDate} (1 bit): A bit that specifies whether the current datetime is used for
- * displaying the datetime.
- * <li> C - {@link #fHasUserDate} (1 bit): A bit that specifies whether the date specified in UserDateAtom record
- * is used for displaying the datetime.
- * <li> D - {@link #fHasSlideNumber} (1 bit): A bit that specifies whether the slide number is displayed in the footer.
- * <li> E - {@link #fHasHeader} (1 bit): A bit that specifies whether the header text specified by HeaderAtom
- * record is displayed.
- * <li> F - {@link #fHasFooter} (1 bit): A bit that specifies whether the footer text specified by FooterAtom
- * record is displayed.
- * <li> reserved (10 bits): MUST be zero and MUST be ignored.
- *
- * @return A bit mask specifying options for displaying headers and footers
- */
- public int getMask(){
- return LittleEndian.getShort(_recdata, 2);
- }
-
- /**
- * A bit mask specifying options for displaying headers and footers
- *
- * @param mask A bit mask specifying options for displaying headers and footers
- */
- public void setMask(int mask){
- LittleEndian.putUShort(_recdata, 2, mask);
- }
-
- /**
- * @param bit the bit to check
- * @return whether the specified flag is set
- */
- public boolean getFlag(int bit){
- return (getMask() & bit) != 0;
- }
-
- /**
- * @param bit the bit to set
- * @param value whether the specified bit is set
- */
- public void setFlag(int bit, boolean value){
- int mask = getMask();
- if(value) mask |= bit;
- else mask &= ~bit;
- setMask(mask);
- }
-
- public String toString(){
- StringBuffer buf = new StringBuffer();
- buf.append("HeadersFootersAtom\n");
- buf.append("\tFormatId: " + getFormatId() + "\n");
- buf.append("\tMask : " + getMask() + "\n");
- buf.append("\t fHasDate : " + getFlag(fHasDate) + "\n");
- buf.append("\t fHasTodayDate : " + getFlag(fHasTodayDate) + "\n");
- buf.append("\t fHasUserDate : " + getFlag(fHasUserDate) + "\n");
- buf.append("\t fHasSlideNumber : " + getFlag(fHasSlideNumber) + "\n");
- buf.append("\t fHasHeader : " + getFlag(fHasHeader) + "\n");
- buf.append("\t fHasFooter : " + getFlag(fHasFooter) + "\n");
- return buf.toString();
- }
-}
+/* ====================================================================
+ 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.hslf.record;
+
+import org.apache.poi.util.LittleEndian;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * An atom record that specifies options for displaying headers and footers
+ * on a presentation slide or notes slide.
+ *
+ * @author Yegor Kozlov
+ */
+
+public final class HeadersFootersAtom extends RecordAtom {
+
+ /**
+ * A bit that specifies whether the date is displayed in the footer.
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasDate = 1;
+
+ /**
+ * A bit that specifies whether the current datetime is used for displaying the datetime.
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasTodayDate = 2;
+
+ /**
+ * A bit that specifies whether the date specified in UserDateAtom record
+ * is used for displaying the datetime.
+ *
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasUserDate = 4;
+
+ /**
+ * A bit that specifies whether the slide number is displayed in the footer.
+ *
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasSlideNumber = 8;
+
+ /**
+ * bit that specifies whether the header text is displayed.
+ *
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasHeader = 16;
+
+ /**
+ * bit that specifies whether the footer text is displayed.
+ *
+ * @see #getMask()
+ * @see #setMask(int)
+ */
+ public static final int fHasFooter = 32;
+
+ /**
+ * record header
+ */
+ private byte[] _header;
+
+ /**
+ * record data
+ */
+ private byte[] _recdata;
+
+ /**
+ * Build an instance of <code>HeadersFootersAtom</code> from on-disk data
+ */
+ protected HeadersFootersAtom(byte[] source, int start, int len) {
+ // Get the header
+ _header = new byte[8];
+ System.arraycopy(source,start,_header,0,8);
+
+ // Grab the record data
+ _recdata = new byte[len-8];
+ System.arraycopy(source,start+8,_recdata,0,len-8);
+ }
+
+ /**
+ * Create a new instance of <code>HeadersFootersAtom</code>
+ */
+ public HeadersFootersAtom() {
+ _recdata = new byte[4];
+
+ _header = new byte[8];
+ LittleEndian.putShort(_header, 2, (short)getRecordType());
+ LittleEndian.putInt(_header, 4, _recdata.length);
+ }
+
+ public long getRecordType() {
+ return RecordTypes.HeadersFootersAtom.typeID;
+ }
+
+ /**
+ * Write the contents of the record back, so it can be written to disk
+ */
+ public void writeOut(OutputStream out) throws IOException {
+ out.write(_header);
+ out.write(_recdata);
+ }
+
+ /**
+ * A signed integer that specifies the format ID to be used to style the datetime.
+ * <p>
+ * It MUST be in the range [0, 12]. </br>
+ * This value is converted into a string as specified by the index field of the DateTimeMCAtom record.
+ * It MUST be ignored unless fHasTodayDate is TRUE.
+ * </b>
+ *
+ * @return A signed integer that specifies the format ID to be used to style the datetime.
+ */
+ public int getFormatId(){
+ return LittleEndian.getShort(_recdata, 0);
+ }
+
+ /**
+ * A signed integer that specifies the format ID to be used to style the datetime.
+ *
+ * @param formatId A signed integer that specifies the format ID to be used to style the datetime.
+ */
+ public void setFormatId(int formatId){
+ LittleEndian.putUShort(_recdata, 0, formatId);
+ }
+
+ /**
+ * A bit mask specifying options for displaying headers and footers
+ *
+ * <li> A - {@link #fHasDate} (1 bit): A bit that specifies whether the date is displayed in the footer.
+ * <li> B - {@link #fHasTodayDate} (1 bit): A bit that specifies whether the current datetime is used for
+ * displaying the datetime.
+ * <li> C - {@link #fHasUserDate} (1 bit): A bit that specifies whether the date specified in UserDateAtom record
+ * is used for displaying the datetime.
+ * <li> D - {@link #fHasSlideNumber} (1 bit): A bit that specifies whether the slide number is displayed in the footer.
+ * <li> E - {@link #fHasHeader} (1 bit): A bit that specifies whether the header text specified by HeaderAtom
+ * record is displayed.
+ * <li> F - {@link #fHasFooter} (1 bit): A bit that specifies whether the footer text specified by FooterAtom
+ * record is displayed.
+ * <li> reserved (10 bits): MUST be zero and MUST be ignored.
+ *
+ * @return A bit mask specifying options for displaying headers and footers
+ */
+ public int getMask(){
+ return LittleEndian.getShort(_recdata, 2);
+ }
+
+ /**
+ * A bit mask specifying options for displaying headers and footers
+ *
+ * @param mask A bit mask specifying options for displaying headers and footers
+ */
+ public void setMask(int mask){
+ LittleEndian.putUShort(_recdata, 2, mask);
+ }
+
+ /**
+ * @param bit the bit to check
+ * @return whether the specified flag is set
+ */
+ public boolean getFlag(int bit){
+ return (getMask() & bit) != 0;
+ }
+
+ /**
+ * @param bit the bit to set
+ * @param value whether the specified bit is set
+ */
+ public void setFlag(int bit, boolean value){
+ int mask = getMask();
+ if(value) mask |= bit;
+ else mask &= ~bit;
+ setMask(mask);
+ }
+
+ public String toString(){
+ StringBuffer buf = new StringBuffer();
+ buf.append("HeadersFootersAtom\n");
+ buf.append("\tFormatId: " + getFormatId() + "\n");
+ buf.append("\tMask : " + getMask() + "\n");
+ buf.append("\t fHasDate : " + getFlag(fHasDate) + "\n");
+ buf.append("\t fHasTodayDate : " + getFlag(fHasTodayDate) + "\n");
+ buf.append("\t fHasUserDate : " + getFlag(fHasUserDate) + "\n");
+ buf.append("\t fHasSlideNumber : " + getFlag(fHasSlideNumber) + "\n");
+ buf.append("\t fHasHeader : " + getFlag(fHasHeader) + "\n");
+ buf.append("\t fHasFooter : " + getFlag(fHasFooter) + "\n");
+ return buf.toString();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org