mirror of https://github.com/apache/poi.git
latest
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353204 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
195512bfcd
commit
b767e73069
|
@ -91,6 +91,11 @@ public class ComplexFileTable
|
|||
}
|
||||
}
|
||||
|
||||
public TextPieceTable getTextPieceTable()
|
||||
{
|
||||
return _tpt;
|
||||
}
|
||||
|
||||
public void writeTo(HWPFFileSystem sys)
|
||||
throws IOException
|
||||
{
|
||||
|
|
|
@ -67,295 +67,12 @@ import org.apache.poi.hwpf.model.hdftypes.definitions.FIBAbstractType;
|
|||
*/
|
||||
public class FileInformationBlock extends FIBAbstractType
|
||||
{
|
||||
/*
|
||||
private short field_1_id;
|
||||
private short field_2_version; // 101 = Word 6.0 +
|
||||
private short field_3_product_version;
|
||||
private short field_4_language_stamp;
|
||||
private short field_5_unknown;
|
||||
private short field_6_options;
|
||||
|
||||
private static final BitField template = new BitField(0x0001);
|
||||
private static final BitField glossary = new BitField(0x0002);
|
||||
private static final BitField quicksave = new BitField(0x0004);
|
||||
private static final BitField haspictr = new BitField(0x0008);
|
||||
private static final BitField nquicksaves = new BitField(0x00F0);
|
||||
private static final BitField encrypted = new BitField(0x0100);
|
||||
private static final BitField tabletype = new BitField(0x0200);
|
||||
private static final BitField readonly = new BitField(0x0400);
|
||||
private static final BitField writeReservation = new BitField(0x0800);
|
||||
private static final BitField extendedCharacter = new BitField(0x1000);
|
||||
private static final BitField loadOverride = new BitField(0x2000);
|
||||
private static final BitField farEast = new BitField(0x4000);
|
||||
private static final BitField crypto = new BitField(0x8000);
|
||||
|
||||
private short field_7_minversion;
|
||||
private short field_8_encrypted_key;
|
||||
private short field_9_environment; // 0 or 1 - windows or mac
|
||||
private short field_10_history;
|
||||
|
||||
private static final BitField history_mac = new BitField(0x01);
|
||||
private static final BitField empty_special = new BitField(0x02);
|
||||
private static final BitField load_override = new BitField(0x04);
|
||||
private static final BitField future_undo = new BitField(0x08);
|
||||
private static final BitField w97_saved = new BitField(0x10);
|
||||
private static final BitField spare = new BitField(0xfe);
|
||||
|
||||
private short field_11_default_charset;
|
||||
private short field_12_default_extcharset;
|
||||
private int field_13_offset_first_char;
|
||||
private int field_14_offset_last_char;
|
||||
private short field_15_count_shorts;
|
||||
|
||||
private short field_16_beg_shorts; //why same offset?
|
||||
|
||||
private short field_16_creator_id;
|
||||
private short field_17_revisor_id;
|
||||
private short field_18_creator_private;
|
||||
private short field_19_revisor_private;
|
||||
|
||||
private short field_20_unused;
|
||||
private short field_21_unused;
|
||||
private short field_22_unused;
|
||||
private short field_23_unused;
|
||||
private short field_24_unused;
|
||||
private short field_25_unused;
|
||||
private short field_26_unused;
|
||||
private short field_27_unused;
|
||||
private short field_28_unused;
|
||||
|
||||
private short field_29_fareastid;
|
||||
private short field_30_count_ints;
|
||||
|
||||
private int field_31_beg_ints; //why same offset?
|
||||
|
||||
private int field_31_last_byte;
|
||||
|
||||
private int field_32_creator_build_date;
|
||||
private int field_33_revisor_build_date; */
|
||||
/** length of main document text stream*/
|
||||
// private int field_34_main_streamlen;
|
||||
/**length of footnote subdocument text stream*/
|
||||
/* private int field_35_footnote_streamlen;
|
||||
private int field_36_header_streamlen;
|
||||
private int field_37_macro_streamlen;
|
||||
private int field_38_annotation_streamlen;
|
||||
private int field_39_endnote_streamlen;
|
||||
private int field_40_textbox_streamlen;
|
||||
private int field_41_headbox_streamlen; */
|
||||
/**offset in table stream of character property bin table*/
|
||||
// private int field_42_pointer_to_plc_list_chp; //rename me!
|
||||
// private int field_43_first_chp; //rename me
|
||||
// private int field_44_count_chps; //rename me
|
||||
/**offset in table stream of paragraph property bin */
|
||||
/* private int field_45_pointer_to_plc_list_pap; //rename me.
|
||||
private int field_46_first_pap; //rename me
|
||||
private int field_47_count_paps; //rename me
|
||||
private int field_48_pointer_to_plc_list_lvc; //rename me
|
||||
private int field_49_first_lvc; //rename me
|
||||
private int field_50_count_lvc; //rename me
|
||||
|
||||
private int field_51_unknown;
|
||||
private int field_52_unknown; */
|
||||
//not sure about this array.
|
||||
/*
|
||||
private short field_53_fc_lcb_array_size;
|
||||
private int field_54_original_stylesheet_offset;
|
||||
private int field_55_original_stylesheet_size;
|
||||
private int field_56_stylesheet_offset;
|
||||
private int field_57_stylesheet_size;
|
||||
private int field_58_footnote_ref_offset;
|
||||
private int field_59_footnote_ref_size;
|
||||
private int field_60_footnote_plc_offset;
|
||||
private int field_61_footnote_plc_size;
|
||||
private int field_62_annotation_ref_offset;
|
||||
private int field_63_annotation_ref_size;
|
||||
private int field_64_annotation_plc_offset;
|
||||
private int field_65_annotation_plc_size; */
|
||||
/** offset in table stream of section descriptor SED PLC*/
|
||||
/* private int field_66_section_plc_offset;
|
||||
private int field_67_section_plc_size;
|
||||
private int field_68_unused;
|
||||
private int field_69_unused;
|
||||
private int field_70_pheplc_offset;
|
||||
private int field_71_pheplc_size;
|
||||
private int field_72_glossaryST_offset;
|
||||
private int field_73_glossaryST_size;
|
||||
private int field_74_glossaryPLC_offset;
|
||||
private int field_75_glossaryPLC_size;
|
||||
private int field_76_headerPLC_offset;
|
||||
private int field_77_headerPLC_size;
|
||||
private int field_78_chp_bin_table_offset;
|
||||
private int field_79_chp_bin_table_size;
|
||||
private int field_80_pap_bin_table_offset;
|
||||
private int field_81_pap_bin_table_size;
|
||||
private int field_82_sea_plc_offset;
|
||||
private int field_83_sea_plc_size;
|
||||
private int field_84_fonts_offset;
|
||||
private int field_85_fonts_size;
|
||||
private int field_86_main_fields_offset;
|
||||
private int field_87_main_fields_size;
|
||||
private int field_88_header_fields_offset;
|
||||
private int field_89_header_fields_size;
|
||||
private int field_90_footnote_fields_offset;
|
||||
private int field_91_footnote_fields_size;
|
||||
private int field_92_ann_fields_offset;
|
||||
private int field_93_ann_fields_size;
|
||||
private int field_94_unused;
|
||||
private int field_95_unused;
|
||||
private int field_96_bookmark_names_offset;
|
||||
private int field_97_bookmark_names_size;
|
||||
private int field_98_bookmark_offsets_offset;
|
||||
private int field_99_bookmark_offsets_size;
|
||||
private int field_100_macros_offset;
|
||||
private int field_101_macros_size;
|
||||
private int field_102_unused;
|
||||
private int field_103_unused;
|
||||
private int field_104_unused;
|
||||
private int field_105_unused;
|
||||
private int field_106_printer_offset;
|
||||
private int field_107_printer_size;
|
||||
private int field_108_printer_portrait_offset;
|
||||
private int field_109_printer_portrait_size;
|
||||
private int field_110_printer_landscape_offset;
|
||||
private int field_111_printer_landscape_size;
|
||||
private int field_112_wss_offset;
|
||||
private int field_113_wss_size;
|
||||
private int field_114_DOP_offset;
|
||||
private int field_115_DOP_size;
|
||||
private int field_116_sttbfassoc_offset;
|
||||
private int field_117_sttbfassoc_size; */
|
||||
/**offset in table stream of beginning of information for complex files.
|
||||
* Also, this is the beginning of the Text piece table*/ /*
|
||||
private int field_118_textPieceTable_offset;
|
||||
private int field_119_textPieceTable_size;
|
||||
private int field_199_list_format_offset;
|
||||
private int field_200_list_format_size;
|
||||
private int field_201_list_format_override_offset;
|
||||
private int field_202_list_format_override_size;
|
||||
|
||||
|
||||
|
||||
|
||||
^/
|
||||
/** Creates a new instance of FileInformationBlock */
|
||||
public FileInformationBlock(byte[] mainDocument)
|
||||
{
|
||||
fillFields(mainDocument, (short)0, (short)0);
|
||||
/* field_1_id = LittleEndian.getShort(mainDocument, 0);
|
||||
field_2_version = LittleEndian.getShort(mainDocument, 0x2); // 101 = Word 6.0 +
|
||||
field_3_product_version = LittleEndian.getShort(mainDocument, 0x4);
|
||||
field_4_language_stamp = LittleEndian.getShort(mainDocument, 0x6);
|
||||
field_5_unknown = LittleEndian.getShort(mainDocument, 0x8);
|
||||
field_6_options = LittleEndian.getShort(mainDocument, 0xa);
|
||||
|
||||
|
||||
|
||||
field_13_offset_first_char = LittleEndian.getInt(mainDocument, 0x18);
|
||||
field_34_main_streamlen = LittleEndian.getInt(mainDocument, 0x4c);
|
||||
field_35_footnote_streamlen = LittleEndian.getInt(mainDocument, 0x50);
|
||||
|
||||
field_56_stylesheet_offset = LittleEndian.getInt(mainDocument, 0xa2);
|
||||
field_57_stylesheet_size = LittleEndian.getInt(mainDocument, 0xa6);
|
||||
field_66_section_plc_offset = LittleEndian.getInt(mainDocument, 0xca);
|
||||
field_67_section_plc_size = LittleEndian.getInt(mainDocument, 0xce);
|
||||
|
||||
field_78_chp_bin_table_offset = LittleEndian.getInt(mainDocument, 0xfa);
|
||||
field_79_chp_bin_table_size = LittleEndian.getInt(mainDocument, 0xfe);
|
||||
field_80_pap_bin_table_offset = LittleEndian.getInt(mainDocument, 0x102);
|
||||
field_81_pap_bin_table_size = LittleEndian.getInt(mainDocument, 0x106);
|
||||
|
||||
field_84_fonts_offset = LittleEndian.getInt(mainDocument, 0x112);
|
||||
field_85_fonts_size = LittleEndian.getInt(mainDocument, 0x116);
|
||||
|
||||
field_114_DOP_offset = LittleEndian.getInt(mainDocument, 0x192);
|
||||
field_115_DOP_size = LittleEndian.getInt(mainDocument, 0x196);
|
||||
field_118_textPieceTable_offset = LittleEndian.getInt(mainDocument, 0x1a2);
|
||||
|
||||
field_199_list_format_offset = LittleEndian.getInt(mainDocument, 0x2e2);
|
||||
field_200_list_format_size = LittleEndian.getInt(mainDocument, 0x2e6);
|
||||
field_201_list_format_override_offset = LittleEndian.getInt(mainDocument, 0x2ea);
|
||||
field_202_list_format_override_size= LittleEndian.getInt(mainDocument, 0x2ee);*/
|
||||
|
||||
}
|
||||
/*
|
||||
public boolean useTable1()
|
||||
{
|
||||
return tabletype.setShort(field_6_options) > 0;
|
||||
}
|
||||
public int getFirstCharOffset()
|
||||
{
|
||||
return field_13_offset_first_char;
|
||||
}
|
||||
public int getStshOffset()
|
||||
{
|
||||
return field_56_stylesheet_offset;
|
||||
}
|
||||
public int getStshSize()
|
||||
{
|
||||
return field_57_stylesheet_size;
|
||||
}
|
||||
public int getSectionDescriptorOffset()
|
||||
{
|
||||
return field_66_section_plc_offset;
|
||||
}
|
||||
public int getSectionDescriptorSize()
|
||||
{
|
||||
return field_67_section_plc_size;
|
||||
}
|
||||
public int getChpBinTableOffset()
|
||||
{
|
||||
return field_78_chp_bin_table_offset;
|
||||
}
|
||||
public int getChpBinTableSize()
|
||||
{
|
||||
return field_79_chp_bin_table_size;
|
||||
}
|
||||
public int getPapBinTableOffset()
|
||||
{
|
||||
return field_80_pap_bin_table_offset;
|
||||
}
|
||||
public int getPapBinTableSize()
|
||||
{
|
||||
return field_81_pap_bin_table_size;
|
||||
}
|
||||
public int getFontsOffset()
|
||||
{
|
||||
return field_84_fonts_offset;
|
||||
}
|
||||
public int getFontsSize()
|
||||
{
|
||||
return field_85_fonts_size;
|
||||
}
|
||||
public int getDOPOffset()
|
||||
{
|
||||
return field_114_DOP_offset;
|
||||
}
|
||||
public int getDOPSize()
|
||||
{
|
||||
return field_115_DOP_size;
|
||||
}
|
||||
public int getComplexOffset()
|
||||
{
|
||||
return field_118_textPieceTable_offset;
|
||||
}
|
||||
public int getLSTOffset()
|
||||
{
|
||||
return field_199_list_format_offset;
|
||||
}
|
||||
public int getLSTSize()
|
||||
{
|
||||
return field_200_list_format_size;
|
||||
}
|
||||
public int getLFOOffset()
|
||||
{
|
||||
return field_201_list_format_override_offset;
|
||||
}
|
||||
public int getLFOSize()
|
||||
{
|
||||
return field_202_list_format_override_size;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ public class TextPiece extends PropertyNode implements Comparable
|
|||
super(start, end, text);
|
||||
_usesUnicode = pd.isUnicode();
|
||||
_length = end - start;
|
||||
_pd = pd;
|
||||
}
|
||||
/**
|
||||
* @return If this text piece uses unicode
|
||||
|
|
Loading…
Reference in New Issue