result = "LittleEndian.getShort(data, 0x"
+ Integer.toHexString( offset ) + " + offset)";
else if ( size.equals( "4" ) )
- result = "LittleEndian.getInt(data, 0x"
- + Integer.toHexString( offset ) + " + offset)";
+ if ( type.equals( "long" ) )
+ {
+ result = "LittleEndian.getUInt(data, 0x"
+ + Integer.toHexString( offset ) + " + offset)";
+ }
+ else
+ {
+ result = "LittleEndian.getInt(data, 0x"
+ + Integer.toHexString( offset ) + " + offset)";
+ }
else if ( size.equals( "1" ) )
result = "data[ 0x" + Integer.toHexString( offset ) + " + offset ]";
else if ( type.equals( "double" ) )
+ javaFieldName + ");";
}
else if ( size.equals( "4" ) )
- result = "LittleEndian.putInt(data, 0x"
- + Integer.toHexString( offset ) + " + offset, "
- + javaFieldName + ");";
+ if ( type.equals( "long" ) )
+ {
+ result = "LittleEndian.putUInt(data, 0x"
+ + Integer.toHexString( offset ) + " + offset, "
+ + javaFieldName + ");";
+ }
+ else
+ {
+ result = "LittleEndian.putInt(data, 0x"
+ + Integer.toHexString( offset ) + " + offset, "
+ + javaFieldName + ");";
+ }
else if ( size.equals( "1" ) )
result = "data[ 0x" + Integer.toHexString( offset )
+ " + offset] = " + javaFieldName + ";";
import java.util.List;
import java.util.Map;
+import org.apache.poi.hwpf.model.StyleDescription;
+
import org.apache.poi.POIDocument;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore;
+ "\t\t[--paragraphs] [--paragraphsText]\n"
+ "\t\t[--bookmarks]\n" + "\t\t[--escher]\n"
+ "\t\t[--fields]\n" + "\t\t[--pictures]\n"
- + "\t\t[--officeDrawings]\n" + "\t\t[--writereadback]\n" );
+ + "\t\t[--officeDrawings]\n" + "\t\t[--styles]\n"
+ + "\t\t[--writereadback]\n" );
System.exit( 1 );
}
boolean outputFields = false;
boolean outputPictures = false;
boolean outputOfficeDrawings = false;
+ boolean outputStyles = false;
boolean writereadback = false;
outputEscher = true;
if ( "--fields".equals( arg ) )
outputFields = true;
- if ( "--officeDrawings".equals( arg ) )
- outputOfficeDrawings = true;
if ( "--pictures".equals( arg ) )
outputPictures = true;
+ if ( "--officeDrawings".equals( arg ) )
+ outputOfficeDrawings = true;
+ if ( "--styles".equals( arg ) )
+ outputStyles = true;
if ( "--writereadback".equals( arg ) )
writereadback = true;
System.out.println( "== OLE streams ==" );
listerOriginal.dumpFileSystem();
-
+
System.out.println( "== FIB (original) ==" );
listerOriginal.dumpFIB();
System.out.println( "== PICTURES (rebuilded) ==" );
listerRebuilded.dumpPictures();
}
+
+ if ( outputStyles )
+ {
+ System.out.println( "== STYLES (rebuilded) ==" );
+ listerRebuilded.dumpStyles();
+ }
}
private static HWPFDocumentCore writeOutAndReadBack(
System.out.println( ( (HWPFDocument) _doc ).getEscherRecordHolder() );
}
+ public void dumpFIB()
+ {
+ FileInformationBlock fib = _doc.getFileInformationBlock();
+ System.out.println( fib );
+
+ }
+
+ private void dumpFields()
+ {
+ if ( !( _doc instanceof HWPFDocument ) )
+ {
+ System.out.println( "Word 95 not supported so far" );
+ return;
+ }
+
+ HWPFDocument document = (HWPFDocument) _doc;
+
+ for ( FieldsDocumentPart part : FieldsDocumentPart.values() )
+ {
+ System.out.println( "=== Document part: " + part + " ===" );
+ for ( Field field : document.getFields().getFields( part ) )
+ {
+ System.out.println( field );
+ }
+ }
+ }
+
public void dumpFileSystem() throws Exception
{
java.lang.reflect.Field field = POIDocument.class
return entry.getName();
}
- public void dumpFIB()
- {
- FileInformationBlock fib = _doc.getFileInformationBlock();
- System.out.println( fib );
-
- }
-
- private void dumpFields()
- {
- if ( !( _doc instanceof HWPFDocument ) )
- {
- System.out.println( "Word 95 not supported so far" );
- return;
- }
-
- HWPFDocument document = (HWPFDocument) _doc;
-
- for ( FieldsDocumentPart part : FieldsDocumentPart.values() )
- {
- System.out.println( "=== Document part: " + part + " ===" );
- for ( Field field : document.getFields().getFields( part ) )
- {
- System.out.println( field );
- }
- }
- }
-
private void dumpOfficeDrawings()
{
if ( !( _doc instanceof HWPFDocument ) )
}
}
+ private void dumpStyles()
+ {
+ if ( _doc instanceof HWPFOldDocument )
+ {
+ System.out.println( "Word 95 not supported so far" );
+ return;
+ }
+ HWPFDocument hwpfDocument = (HWPFDocument) _doc;
+ for ( int s = 0; s < hwpfDocument.getStyleSheet().numStyles(); s++ )
+ {
+ StyleDescription styleDescription = hwpfDocument.getStyleSheet()
+ .getStyleDescription( s );
+ if ( styleDescription == null )
+ continue;
+
+ System.out.println( "=== Style: '" + styleDescription.getName()
+ + "' ===" );
+ System.out.println( styleDescription );
+ System.out.println( "PAP:" + styleDescription.getPAP() );
+ System.out.println( "CHP:" + styleDescription.getCHP() );
+ }
+ }
+
public void dumpTextPieces( boolean withText )
{
for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() )
+ ");";
return retVal;
-
}
public static String getBitFieldSet( String name, String bitMask,
String retVal = null;
if ( type.equals( "boolean" ) )
- retVal = "(" + parentType + ")" + getFieldName( name, 0 )
- + ".setBoolean(" + parentField + ", value)";
+ if ( parentType.equals( "int" ) )
+ {
+ retVal = getFieldName( name, 0 ) + ".setBoolean(" + parentField
+ + ", value)";
+ }
+ else
+ {
+ retVal = "(" + parentType + ")" + getFieldName( name, 0 )
+ + ".setBoolean(" + parentField + ", value)";
+ }
else
- retVal = "(" + parentType + ")" + getFieldName( name, 0 )
- + ".setValue(" + parentField + ", value)";
+ {
+ if ( parentType.equals( "int" ) )
+ {
+ retVal = getFieldName( name, 0 ) + ".setValue(" + parentField
+ + ", value)";
+ }
+ else
+ {
+ retVal = "(" + parentType + ")" + getFieldName( name, 0 )
+ + ".setValue(" + parentField + ", value)";
+ }
+ }
return retVal;
}
package org.apache.poi.hwpf.model;
import org.apache.poi.hwpf.model.types.StdfBaseAbstractType;
+import org.apache.poi.util.Internal;
/**
* The StdfBase structure specifies general information about a style.
*/
-public class StdfBase extends StdfBaseAbstractType
+@Internal
+class StdfBase extends StdfBaseAbstractType
{
public StdfBase()
--- /dev/null
+/* ====================================================================
+ 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.hwpf.model;
+
+import org.apache.poi.hwpf.model.types.StdfPost2000AbstractType;
+import org.apache.poi.util.Internal;
+
+/**
+ * The StdfBase structure specifies general information about a style.
+ */
+@Internal
+class StdfPost2000 extends StdfPost2000AbstractType
+{
+
+ public StdfPost2000()
+ {
+ }
+
+ public StdfPost2000( byte[] std, int offset )
+ {
+ fillFields( std, offset );
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ return true;
+ if ( obj == null )
+ return false;
+ if ( getClass() != obj.getClass() )
+ return false;
+ StdfPost2000 other = (StdfPost2000) obj;
+ if ( field_1_info1 != other.field_1_info1 )
+ return false;
+ if ( field_2_rsid != other.field_2_rsid )
+ return false;
+ if ( field_3_info3 != other.field_3_info3 )
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + field_1_info1;
+ result = prime * result
+ + (int) ( field_2_rsid ^ ( field_2_rsid >>> 32 ) );
+ result = prime * result + field_3_info3;
+ return result;
+ }
+
+ public byte[] serialize()
+ {
+ byte[] result = new byte[getSize()];
+ serialize( result, 0 );
+ return result;
+ }
+}
--- /dev/null
+/* ====================================================================
+ 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.hwpf.model;
+
+import org.apache.poi.hwpf.model.types.StshifAbstractType;
+import org.apache.poi.util.Internal;
+
+/**
+ * The StdfBase structure specifies general information about a style.
+ */
+@Internal
+class Stshif extends StshifAbstractType
+{
+
+ public Stshif()
+ {
+ }
+
+ public Stshif( byte[] std, int offset )
+ {
+ fillFields( std, offset );
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ return true;
+ if ( obj == null )
+ return false;
+ if ( getClass() != obj.getClass() )
+ return false;
+ Stshif other = (Stshif) obj;
+ if ( field_1_cstd != other.field_1_cstd )
+ return false;
+ if ( field_2_cbSTDBaseInFile != other.field_2_cbSTDBaseInFile )
+ return false;
+ if ( field_3_info3 != other.field_3_info3 )
+ return false;
+ if ( field_4_stiMaxWhenSaved != other.field_4_stiMaxWhenSaved )
+ return false;
+ if ( field_5_istdMaxFixedWhenSaved != other.field_5_istdMaxFixedWhenSaved )
+ return false;
+ if ( field_6_nVerBuiltInNamesWhenSaved != other.field_6_nVerBuiltInNamesWhenSaved )
+ return false;
+ if ( field_7_ftcAsci != other.field_7_ftcAsci )
+ return false;
+ if ( field_8_ftcFE != other.field_8_ftcFE )
+ return false;
+ if ( field_9_ftcOther != other.field_9_ftcOther )
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + field_1_cstd;
+ result = prime * result + field_2_cbSTDBaseInFile;
+ result = prime * result + field_3_info3;
+ result = prime * result + field_4_stiMaxWhenSaved;
+ result = prime * result + field_5_istdMaxFixedWhenSaved;
+ result = prime * result + field_6_nVerBuiltInNamesWhenSaved;
+ result = prime * result + field_7_ftcAsci;
+ result = prime * result + field_8_ftcFE;
+ result = prime * result + field_9_ftcOther;
+ return result;
+ }
+
+ public byte[] serialize()
+ {
+ byte[] result = new byte[getSize()];
+ serialize( result, 0 );
+ return result;
+ }
+}
return false;
return true;
}
+
+ @Override
+ public String toString()
+ {
+ return "[STD]: '" + _name + "'"
+ + ( "\n" + _stdfBase ).replaceAll( "\n", "\n " );
+ }
}
private int _cbStshi;
/**
- * Length of STD Base as stored in a file
- * <p>
- * "The STD structure (see below) is divided into a fixed-length "base", and
- * a variable length part. The stshi.cbSTDBaseInFile indicates the size in
- * bytes of the fixed-length base of the STD as it was written in this file.
- * If the STD base is grown in a future version, the file format doesn't
- * change, because the style sheet reader can discard parts it doesn't know
- * about, or use defaults if the file's STD is not as large as it was
- * expecting. (Currently, stshi.cbSTDBaseInFile is 8.)"
+ * General information about a stylesheet
*/
- private int _cbSTDBaseInFile;
-
- /**
- * First bit - Are built-in stylenames stored?
- * <p>
- * "Previous versions of Word did not store the style name if the style was
- * a built-in style; Word 6.0 stores the style name for compatibility with
- * future versions. Note: the built-in style names may need to be
- * "regenerated" if the file is opened in a different language or if
- * stshi.nVerBuiltInNamesWhenSaved doesn't match the expected value."
- * <p>
- * other - Spare flags
- */
- private int _flags;
-
- /**
- * Max sti known when this file was written
- * <p>
- * "This indicates the last built-in style known to the version of Word that
- * saved this file."
- */
- private int _stiMaxWhenSaved;
-
- /**
- * How many fixed-index istds are there?
- * <p>
- * "Each array of styles has some fixed-index styles at the beginning. This
- * indicates the number of fixed-index positions reserved in the style sheet
- * when it was saved."
- */
- private int _istdMaxFixedWhenSaved;
-
- /**
- * Current version of built-in stylenames
- * <p>
- * "Since built-in style names are saved with the document, this provides a
- * way to see if the saved names are the same "version" as the names in the
- * version of Word that is loading the file. If not, the built-in style
- * names need to be "regenerated", i.e. the old names need to be replaced
- * with the new."
- */
- private int nVerBuiltInNamesWhenSaved;
-
- /**
- * rgftc used by StandardChpStsh for document
- * <p>
- * "This is a list of the default fonts for this style sheet. The first is
- * for ASCII characters (0-127), the second is for East Asian characters,
- * and the third is the default font for non-East Asian, non-ASCII text. See
- * notes on sprmCRgftcX for details."
- */
- private int[] _rgftcStandardChpStsh;
-
+ private Stshif _stshif;
+
StyleDescription[] _styleDescriptions;
/**
* (cbSTD, STD) pairs in the file following the STSHI. Note: styles can
* be empty, i.e. cbSTD==0.
*/
- int cstd = LittleEndian.getUShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- _cbSTDBaseInFile = LittleEndian.getUShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- _flags = LittleEndian.getShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- _stiMaxWhenSaved = LittleEndian.getUShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- _istdMaxFixedWhenSaved = LittleEndian.getUShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- nVerBuiltInNamesWhenSaved = LittleEndian.getUShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
-
- _rgftcStandardChpStsh = new int[3];
- _rgftcStandardChpStsh[0] = LittleEndian.getShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
- _rgftcStandardChpStsh[1] = LittleEndian.getShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
- _rgftcStandardChpStsh[2] = LittleEndian.getShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
+
+ _stshif = new Stshif( tableStream, offset );
+ offset += Stshif.getSize();
// shall we discard cbLSD and mpstilsd?
offset = startOffset + LittleEndian.SHORT_SIZE + _cbStshi;
- _styleDescriptions = new StyleDescription[cstd];
- for(int x = 0; x < cstd; x++)
+ _styleDescriptions = new StyleDescription[_stshif.getCstd()];
+ for(int x = 0; x < _stshif.getCstd(); x++)
{
int stdSize = LittleEndian.getShort(tableStream, offset);
//get past the size
//byte[] std = new byte[stdSize];
StyleDescription aStyle = new StyleDescription(tableStream,
- _cbSTDBaseInFile, offset, true);
+ _stshif.getCbSTDBaseInFile(), offset, true);
_styleDescriptions[x] = aStyle;
}
LittleEndian.putUShort(buf, offset, (short)_cbStshi);
offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putUShort(buf, offset, (short)_styleDescriptions.length);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putUShort(buf, offset, (short)_cbSTDBaseInFile);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putShort(buf, offset, (short)_flags);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putUShort(buf, offset, (short)_stiMaxWhenSaved);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putUShort(buf, offset, (short)_istdMaxFixedWhenSaved);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putUShort(buf, offset, (short)nVerBuiltInNamesWhenSaved);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putShort(buf, offset, (short)_rgftcStandardChpStsh[0]);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putShort(buf, offset, (short)_rgftcStandardChpStsh[1]);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putShort(buf, offset, (short)_rgftcStandardChpStsh[2]);
+ _stshif.setCstd( _styleDescriptions.length );
+ _stshif.serialize( buf, offset );
+ offset += Stshif.getSize();
out.write(buf);
{
StyleSheet ss = (StyleSheet)o;
- if (ss._cbSTDBaseInFile == _cbSTDBaseInFile && ss._flags == _flags &&
- ss._istdMaxFixedWhenSaved ==_istdMaxFixedWhenSaved && ss._stiMaxWhenSaved == _stiMaxWhenSaved &&
- ss._rgftcStandardChpStsh[0] == _rgftcStandardChpStsh[0] && ss._rgftcStandardChpStsh[1] == _rgftcStandardChpStsh[1] &&
- ss._rgftcStandardChpStsh[2] == _rgftcStandardChpStsh[2] && ss._cbStshi == _cbStshi &&
- ss.nVerBuiltInNamesWhenSaved == nVerBuiltInNamesWhenSaved)
+ if (ss._stshif.equals( this._stshif ) && ss._cbStshi == _cbStshi)
{
if (ss._styleDescriptions.length == _styleDescriptions.length)
{
--- /dev/null
+/* ====================================================================
+ 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.hwpf.model.types;
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.Internal;
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * The StdfPost2000 structure specifies general information about a style.
+ <p>Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary
+ File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+
+ * <p>
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/types/definitions.
+ * <p>
+ * This class is internal. It content or properties may change without notice
+ * due to changes in our knowledge of internal Microsoft Word binary structures.
+
+ * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
+ Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+
+ */
+@Internal
+public abstract class StdfPost2000AbstractType
+{
+
+ protected short field_1_info1;
+ /**/private static final BitField istdLink = new BitField(0x0FFF);
+ /**/private static final BitField fHasOriginalStyle = new BitField(0x1000);
+ /**/private static final BitField fSpare = new BitField(0xE000);
+ protected long field_2_rsid;
+ protected short field_3_info3;
+ /**/private static final BitField iftcHtml = new BitField(0x0007);
+ /**/private static final BitField unused = new BitField(0x0008);
+ /**/private static final BitField iPriority = new BitField(0xFFF0);
+
+ protected StdfPost2000AbstractType()
+ {
+ }
+
+ protected void fillFields( byte[] data, int offset )
+ {
+ field_1_info1 = LittleEndian.getShort(data, 0x0 + offset);
+ field_2_rsid = LittleEndian.getUInt(data, 0x2 + offset);
+ field_3_info3 = LittleEndian.getShort(data, 0x6 + offset);
+ }
+
+ public void serialize( byte[] data, int offset )
+ {
+ LittleEndian.putShort(data, 0x0 + offset, field_1_info1);
+ LittleEndian.putUInt(data, 0x2 + offset, field_2_rsid);
+ LittleEndian.putShort(data, 0x6 + offset, field_3_info3);
+ }
+
+ /**
+ * Size of record
+ */
+ public static int getSize()
+ {
+ return 0 + 2 + 4 + 2;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[StdfPost2000]\n");
+ builder.append(" .info1 = ");
+ builder.append(" (").append(getInfo1()).append(" )\n");
+ builder.append(" .istdLink = ").append(getIstdLink()).append('\n');
+ builder.append(" .fHasOriginalStyle = ").append(isFHasOriginalStyle()).append('\n');
+ builder.append(" .fSpare = ").append(getFSpare()).append('\n');
+ builder.append(" .rsid = ");
+ builder.append(" (").append(getRsid()).append(" )\n");
+ builder.append(" .info3 = ");
+ builder.append(" (").append(getInfo3()).append(" )\n");
+ builder.append(" .iftcHtml = ").append(getIftcHtml()).append('\n');
+ builder.append(" .unused = ").append(isUnused()).append('\n');
+ builder.append(" .iPriority = ").append(getIPriority()).append('\n');
+
+ builder.append("[/StdfPost2000]\n");
+ return builder.toString();
+ }
+
+ /**
+ * Get the info1 field for the StdfPost2000 record.
+ */
+ @Internal
+ public short getInfo1()
+ {
+ return field_1_info1;
+ }
+
+ /**
+ * Set the info1 field for the StdfPost2000 record.
+ */
+ @Internal
+ public void setInfo1( short field_1_info1 )
+ {
+ this.field_1_info1 = field_1_info1;
+ }
+
+ /**
+ * An unsigned integer that specifies the revision save identifier of the session when this style definition was last modified.
+ */
+ @Internal
+ public long getRsid()
+ {
+ return field_2_rsid;
+ }
+
+ /**
+ * An unsigned integer that specifies the revision save identifier of the session when this style definition was last modified.
+ */
+ @Internal
+ public void setRsid( long field_2_rsid )
+ {
+ this.field_2_rsid = field_2_rsid;
+ }
+
+ /**
+ * Get the info3 field for the StdfPost2000 record.
+ */
+ @Internal
+ public short getInfo3()
+ {
+ return field_3_info3;
+ }
+
+ /**
+ * Set the info3 field for the StdfPost2000 record.
+ */
+ @Internal
+ public void setInfo3( short field_3_info3 )
+ {
+ this.field_3_info3 = field_3_info3;
+ }
+
+ /**
+ * Sets the istdLink field value.
+ * An unsigned integer that specifies the istd of the style that is linked to this one, or 0x0000 if this style is not linked to any other style in the document.
+ */
+ @Internal
+ public void setIstdLink( short value )
+ {
+ field_1_info1 = (short)istdLink.setValue(field_1_info1, value);
+ }
+
+ /**
+ * An unsigned integer that specifies the istd of the style that is linked to this one, or 0x0000 if this style is not linked to any other style in the document.
+ * @return the istdLink field value.
+ */
+ @Internal
+ public short getIstdLink()
+ {
+ return ( short )istdLink.getValue(field_1_info1);
+ }
+
+ /**
+ * Sets the fHasOriginalStyle field value.
+ * Specifies whether the style is revision-marked. A revision-marked style stores the pre-revision formatting in addition to the current formatting. If this bit is set to 1, the cupx member of StdfBase MUST include the formatting sets that specify that pre-revision formatting
+ */
+ @Internal
+ public void setFHasOriginalStyle( boolean value )
+ {
+ field_1_info1 = (short)fHasOriginalStyle.setBoolean(field_1_info1, value);
+ }
+
+ /**
+ * Specifies whether the style is revision-marked. A revision-marked style stores the pre-revision formatting in addition to the current formatting. If this bit is set to 1, the cupx member of StdfBase MUST include the formatting sets that specify that pre-revision formatting
+ * @return the fHasOriginalStyle field value.
+ */
+ @Internal
+ public boolean isFHasOriginalStyle()
+ {
+ return fHasOriginalStyle.isSet(field_1_info1);
+ }
+
+ /**
+ * Sets the fSpare field value.
+ * Specifies whether the paragraph height information in the fcPlcfPhe field of FibRgFcLcb97
+ */
+ @Internal
+ public void setFSpare( byte value )
+ {
+ field_1_info1 = (short)fSpare.setValue(field_1_info1, value);
+ }
+
+ /**
+ * Specifies whether the paragraph height information in the fcPlcfPhe field of FibRgFcLcb97
+ * @return the fSpare field value.
+ */
+ @Internal
+ public byte getFSpare()
+ {
+ return ( byte )fSpare.getValue(field_1_info1);
+ }
+
+ /**
+ * Sets the iftcHtml field value.
+ * This field is undefined and MUST be ignored
+ */
+ @Internal
+ public void setIftcHtml( byte value )
+ {
+ field_3_info3 = (short)iftcHtml.setValue(field_3_info3, value);
+ }
+
+ /**
+ * This field is undefined and MUST be ignored
+ * @return the iftcHtml field value.
+ */
+ @Internal
+ public byte getIftcHtml()
+ {
+ return ( byte )iftcHtml.getValue(field_3_info3);
+ }
+
+ /**
+ * Sets the unused field value.
+ * This value MUST be zero and MUST be ignored
+ */
+ @Internal
+ public void setUnused( boolean value )
+ {
+ field_3_info3 = (short)unused.setBoolean(field_3_info3, value);
+ }
+
+ /**
+ * This value MUST be zero and MUST be ignored
+ * @return the unused field value.
+ */
+ @Internal
+ public boolean isUnused()
+ {
+ return unused.isSet(field_3_info3);
+ }
+
+ /**
+ * Sets the iPriority field value.
+ * An unsigned integer that specifies the priority value that is assigned to this style and that is used when ordering the styles by priority in the user interface
+ */
+ @Internal
+ public void setIPriority( short value )
+ {
+ field_3_info3 = (short)iPriority.setValue(field_3_info3, value);
+ }
+
+ /**
+ * An unsigned integer that specifies the priority value that is assigned to this style and that is used when ordering the styles by priority in the user interface
+ * @return the iPriority field value.
+ */
+ @Internal
+ public short getIPriority()
+ {
+ return ( short )iPriority.getValue(field_3_info3);
+ }
+
+} // END OF CLASS
--- /dev/null
+/* ====================================================================
+ 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.hwpf.model.types;
+
+
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.Internal;
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * The Stshif structure specifies general stylesheet information. <p>Class and
+ fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and
+ [MS-DOC] - v20110608 Word (.doc) Binary File Format
+
+ * <p>
+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or
+ * remove the record in src/types/definitions.
+ * <p>
+ * This class is internal. It content or properties may change without notice
+ * due to changes in our knowledge of internal Microsoft Word binary structures.
+
+ * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
+ Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+
+ */
+@Internal
+public abstract class StshifAbstractType
+{
+
+ protected int field_1_cstd;
+ protected int field_2_cbSTDBaseInFile;
+ protected int field_3_info3;
+ /**/private static final BitField fHasOriginalStyle = new BitField(0x0001);
+ /**/private static final BitField fReserved = new BitField(0xFFFE);
+ protected int field_4_stiMaxWhenSaved;
+ protected int field_5_istdMaxFixedWhenSaved;
+ protected int field_6_nVerBuiltInNamesWhenSaved;
+ protected short field_7_ftcAsci;
+ protected short field_8_ftcFE;
+ protected short field_9_ftcOther;
+
+ protected StshifAbstractType()
+ {
+ }
+
+ protected void fillFields( byte[] data, int offset )
+ {
+ field_1_cstd = LittleEndian.getShort(data, 0x0 + offset);
+ field_2_cbSTDBaseInFile = LittleEndian.getShort(data, 0x2 + offset);
+ field_3_info3 = LittleEndian.getShort(data, 0x4 + offset);
+ field_4_stiMaxWhenSaved = LittleEndian.getShort(data, 0x6 + offset);
+ field_5_istdMaxFixedWhenSaved = LittleEndian.getShort(data, 0x8 + offset);
+ field_6_nVerBuiltInNamesWhenSaved = LittleEndian.getShort(data, 0xa + offset);
+ field_7_ftcAsci = LittleEndian.getShort(data, 0xc + offset);
+ field_8_ftcFE = LittleEndian.getShort(data, 0xe + offset);
+ field_9_ftcOther = LittleEndian.getShort(data, 0x10 + offset);
+ }
+
+ public void serialize( byte[] data, int offset )
+ {
+ LittleEndian.putUShort(data, 0x0 + offset, field_1_cstd);
+ LittleEndian.putUShort(data, 0x2 + offset, field_2_cbSTDBaseInFile);
+ LittleEndian.putUShort(data, 0x4 + offset, field_3_info3);
+ LittleEndian.putUShort(data, 0x6 + offset, field_4_stiMaxWhenSaved);
+ LittleEndian.putUShort(data, 0x8 + offset, field_5_istdMaxFixedWhenSaved);
+ LittleEndian.putUShort(data, 0xa + offset, field_6_nVerBuiltInNamesWhenSaved);
+ LittleEndian.putShort(data, 0xc + offset, field_7_ftcAsci);
+ LittleEndian.putShort(data, 0xe + offset, field_8_ftcFE);
+ LittleEndian.putShort(data, 0x10 + offset, field_9_ftcOther);
+ }
+
+ /**
+ * Size of record
+ */
+ public static int getSize()
+ {
+ return 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[Stshif]\n");
+ builder.append(" .cstd = ");
+ builder.append(" (").append(getCstd()).append(" )\n");
+ builder.append(" .cbSTDBaseInFile = ");
+ builder.append(" (").append(getCbSTDBaseInFile()).append(" )\n");
+ builder.append(" .info3 = ");
+ builder.append(" (").append(getInfo3()).append(" )\n");
+ builder.append(" .fHasOriginalStyle = ").append(isFHasOriginalStyle()).append('\n');
+ builder.append(" .fReserved = ").append(getFReserved()).append('\n');
+ builder.append(" .stiMaxWhenSaved = ");
+ builder.append(" (").append(getStiMaxWhenSaved()).append(" )\n");
+ builder.append(" .istdMaxFixedWhenSaved = ");
+ builder.append(" (").append(getIstdMaxFixedWhenSaved()).append(" )\n");
+ builder.append(" .nVerBuiltInNamesWhenSaved = ");
+ builder.append(" (").append(getNVerBuiltInNamesWhenSaved()).append(" )\n");
+ builder.append(" .ftcAsci = ");
+ builder.append(" (").append(getFtcAsci()).append(" )\n");
+ builder.append(" .ftcFE = ");
+ builder.append(" (").append(getFtcFE()).append(" )\n");
+ builder.append(" .ftcOther = ");
+ builder.append(" (").append(getFtcOther()).append(" )\n");
+
+ builder.append("[/Stshif]\n");
+ return builder.toString();
+ }
+
+ /**
+ * An unsigned integer that specifies the count of elements in STSH.rglpstd. This value MUST be equal to or greater than 0x000F, and MUST be less than 0x0FFE.
+ */
+ @Internal
+ public int getCstd()
+ {
+ return field_1_cstd;
+ }
+
+ /**
+ * An unsigned integer that specifies the count of elements in STSH.rglpstd. This value MUST be equal to or greater than 0x000F, and MUST be less than 0x0FFE.
+ */
+ @Internal
+ public void setCstd( int field_1_cstd )
+ {
+ this.field_1_cstd = field_1_cstd;
+ }
+
+ /**
+ * An unsigned integer that specifies the size, in bytes, of the Stdf structure. The Stdf structure contains an StdfBase structure that is followed by a StdfPost2000OrNone structure which contains an optional StdfPost2000 structure. This value MUST be 0x000A when the Stdf structure does not contain an StdfPost2000 structure and MUST be 0x0012 when the Stdf structure does contain an StdfPost2000 structure..
+ */
+ @Internal
+ public int getCbSTDBaseInFile()
+ {
+ return field_2_cbSTDBaseInFile;
+ }
+
+ /**
+ * An unsigned integer that specifies the size, in bytes, of the Stdf structure. The Stdf structure contains an StdfBase structure that is followed by a StdfPost2000OrNone structure which contains an optional StdfPost2000 structure. This value MUST be 0x000A when the Stdf structure does not contain an StdfPost2000 structure and MUST be 0x0012 when the Stdf structure does contain an StdfPost2000 structure..
+ */
+ @Internal
+ public void setCbSTDBaseInFile( int field_2_cbSTDBaseInFile )
+ {
+ this.field_2_cbSTDBaseInFile = field_2_cbSTDBaseInFile;
+ }
+
+ /**
+ * Get the info3 field for the Stshif record.
+ */
+ @Internal
+ public int getInfo3()
+ {
+ return field_3_info3;
+ }
+
+ /**
+ * Set the info3 field for the Stshif record.
+ */
+ @Internal
+ public void setInfo3( int field_3_info3 )
+ {
+ this.field_3_info3 = field_3_info3;
+ }
+
+ /**
+ * An unsigned integer that specifies a value that is 1 larger than the largest StdfBase.sti index of any application-defined style. This SHOULD be equal to the largest sti index that is defined in the application, incremented by 1.
+ */
+ @Internal
+ public int getStiMaxWhenSaved()
+ {
+ return field_4_stiMaxWhenSaved;
+ }
+
+ /**
+ * An unsigned integer that specifies a value that is 1 larger than the largest StdfBase.sti index of any application-defined style. This SHOULD be equal to the largest sti index that is defined in the application, incremented by 1.
+ */
+ @Internal
+ public void setStiMaxWhenSaved( int field_4_stiMaxWhenSaved )
+ {
+ this.field_4_stiMaxWhenSaved = field_4_stiMaxWhenSaved;
+ }
+
+ /**
+ * An unsigned integer that specifies the count of elements at the start of STSH.rglpstd that are reserved for fixed-index application-defined styles. This value MUST be 0x000F.
+ */
+ @Internal
+ public int getIstdMaxFixedWhenSaved()
+ {
+ return field_5_istdMaxFixedWhenSaved;
+ }
+
+ /**
+ * An unsigned integer that specifies the count of elements at the start of STSH.rglpstd that are reserved for fixed-index application-defined styles. This value MUST be 0x000F.
+ */
+ @Internal
+ public void setIstdMaxFixedWhenSaved( int field_5_istdMaxFixedWhenSaved )
+ {
+ this.field_5_istdMaxFixedWhenSaved = field_5_istdMaxFixedWhenSaved;
+ }
+
+ /**
+ * An unsigned integer that specifies the version number of the style names as defined by the application that writes the file.
+ */
+ @Internal
+ public int getNVerBuiltInNamesWhenSaved()
+ {
+ return field_6_nVerBuiltInNamesWhenSaved;
+ }
+
+ /**
+ * An unsigned integer that specifies the version number of the style names as defined by the application that writes the file.
+ */
+ @Internal
+ public void setNVerBuiltInNamesWhenSaved( int field_6_nVerBuiltInNamesWhenSaved )
+ {
+ this.field_6_nVerBuiltInNamesWhenSaved = field_6_nVerBuiltInNamesWhenSaved;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc0 for default document formatting.
+ */
+ @Internal
+ public short getFtcAsci()
+ {
+ return field_7_ftcAsci;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc0 for default document formatting.
+ */
+ @Internal
+ public void setFtcAsci( short field_7_ftcAsci )
+ {
+ this.field_7_ftcAsci = field_7_ftcAsci;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc1 for default document formatting, as defined in the section Determining Formatting Properties.
+ */
+ @Internal
+ public short getFtcFE()
+ {
+ return field_8_ftcFE;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc1 for default document formatting, as defined in the section Determining Formatting Properties.
+ */
+ @Internal
+ public void setFtcFE( short field_8_ftcFE )
+ {
+ this.field_8_ftcFE = field_8_ftcFE;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc2 for default document formatting, as defined in the section Determining Formatting Properties.
+ */
+ @Internal
+ public short getFtcOther()
+ {
+ return field_9_ftcOther;
+ }
+
+ /**
+ * A signed integer that specifies an operand value for the sprmCRgFtc2 for default document formatting, as defined in the section Determining Formatting Properties.
+ */
+ @Internal
+ public void setFtcOther( short field_9_ftcOther )
+ {
+ this.field_9_ftcOther = field_9_ftcOther;
+ }
+
+ /**
+ * Sets the fHasOriginalStyle field value.
+ * This value MUST be 1 and MUST be ignored
+ */
+ @Internal
+ public void setFHasOriginalStyle( boolean value )
+ {
+ field_3_info3 = fHasOriginalStyle.setBoolean(field_3_info3, value);
+ }
+
+ /**
+ * This value MUST be 1 and MUST be ignored
+ * @return the fHasOriginalStyle field value.
+ */
+ @Internal
+ public boolean isFHasOriginalStyle()
+ {
+ return fHasOriginalStyle.isSet(field_3_info3);
+ }
+
+ /**
+ * Sets the fReserved field value.
+ * This value MUST be zero and MUST be ignored
+ */
+ @Internal
+ public void setFReserved( short value )
+ {
+ field_3_info3 = fReserved.setValue(field_3_info3, value);
+ }
+
+ /**
+ * This value MUST be zero and MUST be ignored
+ * @return the fReserved field value.
+ */
+ @Internal
+ public short getFReserved()
+ {
+ return ( short )fReserved.getValue(field_3_info3);
+ }
+
+} // END OF CLASS
--- /dev/null
+<?xml version="1.0"?>
+<!--
+ ====================================================================
+ 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.
+ ====================================================================
+-->
+<record fromfile="true" name="StdfPost2000" package="org.apache.poi.hwpf.model.types">
+ <suffix>AbstractType</suffix>
+ <description>The StdfPost2000 structure specifies general information about a style.
+ <p>Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary
+ File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+ </description>
+ <author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
+ Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+ </author>
+ <fields>
+ <field type="short" size="2" name="info1">
+ <bit number="1" mask="0x0FFF" name="istdLink"
+ description="An unsigned integer that specifies the istd of the style that is linked to this one, or 0x0000 if this style is not linked to any other style in the document."/>
+ <bit number="2" mask="0x1000" name="fHasOriginalStyle"
+ description="Specifies whether the style is revision-marked. A revision-marked style stores the pre-revision formatting in addition to the current formatting. If this bit is set to 1, the cupx member of StdfBase MUST include the formatting sets that specify that pre-revision formatting"/>
+ <bit number="3" mask="0xE000" name="fSpare"
+ description="Specifies whether the paragraph height information in the fcPlcfPhe field of FibRgFcLcb97"/>
+ </field>
+ <field type="long" size="4" name="rsid" description=" An unsigned integer that specifies the revision save identifier of the session when this style definition was last modified"/>
+ <field type="short" size="2" name="info3">
+ <bit number="1" mask="0x0007" name="iftcHtml" description="This field is undefined and MUST be ignored"/>
+ <bit number="2" mask="0x0008" name="unused" description="This value MUST be zero and MUST be ignored"/>
+ <bit number="2" mask="0xFFF0" name="iPriority" description="An unsigned integer that specifies the priority value that is assigned to this style and that is used when ordering the styles by priority in the user interface"/>
+ </field>
+ </fields>
+</record>
--- /dev/null
+<?xml version="1.0"?>
+<!--
+ ====================================================================
+ 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.
+ ====================================================================
+-->
+<record fromfile="true" name="Stshif" package="org.apache.poi.hwpf.model.types">
+ <suffix>AbstractType</suffix>
+ <description>The Stshif structure specifies general stylesheet information. <p>Class and
+ fields descriptions are quoted from Microsoft Office Word 97-2007 Binary File Format and
+ [MS-DOC] - v20110608 Word (.doc) Binary File Format
+ </description>
+ <author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
+ Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
+ </author>
+ <fields>
+ <field type="int" size="2" name="cstd"
+ description="An unsigned integer that specifies the count of elements in STSH.rglpstd. This value MUST be equal to or greater than 0x000F, and MUST be less than 0x0FFE"/>
+ <field type="int" size="2" name="cbSTDBaseInFile"
+ description="An unsigned integer that specifies the size, in bytes, of the Stdf structure. The Stdf structure contains an StdfBase structure that is followed by a StdfPost2000OrNone structure which contains an optional StdfPost2000 structure. This value MUST be 0x000A when the Stdf structure does not contain an StdfPost2000 structure and MUST be 0x0012 when the Stdf structure does contain an StdfPost2000 structure."/>
+ <field type="int" size="2" name="info3">
+ <bit mask="0x0001" name="fHasOriginalStyle" description="This value MUST be 1 and MUST be ignored"/>
+ <bit mask="0xFFFE" name="fReserved" description="This value MUST be zero and MUST be ignored"/>
+ </field>
+ <field type="int" size="2" name="stiMaxWhenSaved"
+ description="An unsigned integer that specifies a value that is 1 larger than the largest StdfBase.sti index of any application-defined style. This SHOULD be equal to the largest sti index that is defined in the application, incremented by 1"/>
+ <field type="int" size="2" name="istdMaxFixedWhenSaved"
+ description="An unsigned integer that specifies the count of elements at the start of STSH.rglpstd that are reserved for fixed-index application-defined styles. This value MUST be 0x000F"/>
+ <field type="int" size="2" name="nVerBuiltInNamesWhenSaved"
+ description="An unsigned integer that specifies the version number of the style names as defined by the application that writes the file"/>
+ <field type="short" size="2" name="ftcAsci"
+ description="A signed integer that specifies an operand value for the sprmCRgFtc0 for default document formatting"/>
+ <field type="short" size="2" name="ftcFE"
+ description="A signed integer that specifies an operand value for the sprmCRgFtc1 for default document formatting, as defined in the section Determining Formatting Properties"/>
+ <field type="short" size="2" name="ftcOther"
+ description="A signed integer that specifies an operand value for the sprmCRgFtc2 for default document formatting, as defined in the section Determining Formatting Properties"/>
+ </fields>
+</record>