update CHP definition

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-16 11:57:40 +00:00
parent 66adcb6351
commit ac23837695
10 changed files with 2394 additions and 1187 deletions

View File

@ -0,0 +1,102 @@
/* ====================================================================
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.HRESIAbstractType;
import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.util.LittleEndian;
/**
* Hyphenation. Substructure of the {@link CharacterProperties}.
*
* @author Sergey Vladimirov ( vlsergey {at} gmail {dot} com )
*/
public final class Hyphenation extends HRESIAbstractType implements Cloneable
{
public Hyphenation()
{
super();
}
public Hyphenation( short hres )
{
byte[] data = new byte[2];
LittleEndian.putShort( data, hres );
fillFields( data, 0 );
}
public Hyphenation clone()
{
try
{
return (Hyphenation) super.clone();
}
catch ( CloneNotSupportedException e )
{
throw new RuntimeException( e );
}
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
Hyphenation other = (Hyphenation) obj;
if ( field_1_hres != other.field_1_hres )
return false;
if ( field_2_chHres != other.field_2_chHres )
return false;
return true;
}
public short getValue()
{
byte[] data = new byte[2];
serialize( data, 0 );
return LittleEndian.getShort( data );
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + field_1_hres;
result = prime * result + field_2_chHres;
return result;
}
public boolean isEmpty()
{
return field_1_hres == 0 && field_2_chHres == 0;
}
@Override
public String toString()
{
if ( isEmpty() )
return "[HRESI] EMPTY";
return super.toString();
}
}

View File

@ -0,0 +1,133 @@
/* ====================================================================
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;
/**
* Hyphenation (HRESI).
* <p>
* Class and fields descriptions are quoted from Microsoft Office Word 97-2007
* Binary File Format (.doc) Specification
*
* NOTE: This source is automatically generated please do not modify this file.
* Either subclass or remove the record in src/types/definitions.
*
* @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary
* File Format (.doc) Specification
*/
public abstract class HRESIAbstractType
{
protected byte field_1_hres;
/**/public final static byte HRES_NO = 0;
/**/public final static byte HRES_NORMAL = 1;
/**/public final static byte HRES_ADD_LETTER_BEFORE = 2;
/**/public final static byte HRES_CHANGE_LETTER_BEFORE = 3;
/**/public final static byte HRES_DELETE_LETTER_BEFORE = 4;
/**/public final static byte HRES_CHANGE_LETTER_AFTER = 5;
/**/public final static byte HRES_DELETE_BEFORE_CHANGE_BEFORE = 6;
protected byte field_2_chHres;
protected HRESIAbstractType()
{
}
protected void fillFields( byte[] data, int offset )
{
field_1_hres = data[ 0x0 + offset ];
field_2_chHres = data[ 0x1 + offset ];
}
public void serialize( byte[] data, int offset )
{
data[ 0x0 + offset] = field_1_hres;
data[ 0x1 + offset] = field_2_chHres;
}
/**
* Size of record (exluding 4 byte header)
*/
public static int getSize()
{
return 4 + + 1 + 1;
}
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("[HRESI]\n");
builder.append(" .hres = ");
builder.append(" (").append(getHres()).append(" )\n");
builder.append(" .chHres = ");
builder.append(" (").append(getChHres()).append(" )\n");
builder.append("[/HRESI]\n");
return builder.toString();
}
/**
* Hyphenation rule.
*
* @return One of
* <li>{@link #HRES_NO}
* <li>{@link #HRES_NORMAL}
* <li>{@link #HRES_ADD_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_BEFORE}
* <li>{@link #HRES_DELETE_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_AFTER}
* <li>{@link #HRES_DELETE_BEFORE_CHANGE_BEFORE}
*/
public byte getHres()
{
return field_1_hres;
}
/**
* Hyphenation rule.
*
* @param field_1_hres
* One of
* <li>{@link #HRES_NO}
* <li>{@link #HRES_NORMAL}
* <li>{@link #HRES_ADD_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_BEFORE}
* <li>{@link #HRES_DELETE_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_AFTER}
* <li>{@link #HRES_DELETE_BEFORE_CHANGE_BEFORE}
*/
public void setHres( byte field_1_hres )
{
this.field_1_hres = field_1_hres;
}
/**
* The character that will be used to add or change a letter when hres is 2, 3, 5 or 6.
*/
public byte getChHres()
{
return field_2_chHres;
}
/**
* The character that will be used to add or change a letter when hres is 2, 3, 5 or 6.
*/
public void setChHres( byte field_2_chHres )
{
this.field_2_chHres = field_2_chHres;
}
} // END OF CLASS

View File

@ -209,9 +209,9 @@ public final class CharacterSprmCompressor
{
size += SprmUtils.addSprm((short)0x484b, newCHP.getHpsKern(), null, sprmList);
}
if (newCHP.getYsr() != oldCHP.getYsr())
if (newCHP.getHresi().equals( oldCHP.getHresi() ))
{
size += SprmUtils.addSprm((short)0x484e, newCHP.getYsr(), null, sprmList);
size += SprmUtils.addSprm((short)0x484e, newCHP.getHresi().getValue(), null, sprmList);
}
if (newCHP.getFtcAscii() != oldCHP.getFtcAscii())
{

View File

@ -17,6 +17,7 @@
package org.apache.poi.hwpf.sprm;
import org.apache.poi.hwpf.model.Hyphenation;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.hwpf.usermodel.DateAndTime;
@ -437,18 +438,25 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
case 0x4b:
newCHP.setHpsKern (sprm.getOperand());
break;
case 0x4c:
// unCompressCHPOperation (oldCHP, newCHP, 0x47, param, varParam,
// styleSheet, opSize);
break;
case 0x4d:
float percentage = sprm.getOperand() / 100.0f;
int add = (int) (percentage * newCHP.getHps ());
newCHP.setHps (newCHP.getHps () + add);
break;
case 0x4e:
newCHP.setYsr ((byte) sprm.getOperand());
break;
// Microsoft Office Word 97-2007 Binary File Format (.doc) Specification
// Page 59 of 210
case 0x4c:
// sprmCMajority50 -- 0xCA4C
// unCompressCHPOperation (oldCHP, newCHP, 0x47, param, varParam,
// styleSheet, opSize);
break;
case 0x4d:
// sprmCHpsMul -- 0x4A4D
float percentage = sprm.getOperand() / 100.0f;
int add = (int) ( percentage * newCHP.getHps() );
newCHP.setHps( newCHP.getHps() + add );
break;
case 0x4e:
// sprmCHresi -- 0x484e
Hyphenation hyphenation = new Hyphenation(
(short) sprm.getOperand() );
newCHP.setHresi( hyphenation );
break;
case 0x4f:
newCHP.setFtcAscii ((short) sprm.getOperand());
break;
@ -473,13 +481,25 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
case 0x56:
newCHP.setFObj (getFlag (sprm.getOperand()));
break;
case 0x57:
byte[] buf = sprm.getGrpprl();
int offset = sprm.getGrpprlOffset();
newCHP.setFPropMark (buf[offset]);
newCHP.setIbstPropRMark (LittleEndian.getShort (buf, offset + 1));
newCHP.setDttmPropRMark (new DateAndTime(buf, offset +3));
break;
case 0x57:
// sprmCPropRMark -- 0xCA57
/*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification
*
* Page 78 of 210
*
* sprmCPropRMark (opcode 0xCA57) is interpreted by moving the first
* parameter byte to chp.fPropRMark, the next two bytes to
* chp.ibstPropRMark, and the remaining four bytes to
* chp.dttmPropRMark.
*/
byte[] buf = sprm.getGrpprl();
int offset = sprm.getGrpprlOffset();
newCHP.setFPropRMark( buf[offset] != 0 );
newCHP.setIbstPropRMark( LittleEndian.getShort( buf, offset + 1 ) );
newCHP.setDttmPropRMark( new DateAndTime( buf, offset + 3 ) );
break;
case 0x58:
newCHP.setFEmboss (getFlag (sprm.getOperand()));
break;
@ -509,16 +529,29 @@ public final class CharacterSprmUncompressor extends SprmUncompressor
case 0x61:
// sprmCHpsBi
break;
case 0x62:
byte[] xstDispFldRMark = new byte[32];
buf = sprm.getGrpprl();
offset = sprm.getGrpprlOffset();
newCHP.setFDispFldRMark (buf[offset]);
newCHP.setIbstDispFldRMark (LittleEndian.getShort (buf, offset + 1));
newCHP.setDttmDispFldRMark (new DateAndTime(buf, offset + 3));
System.arraycopy (buf, offset + 7, xstDispFldRMark, 0, 32);
newCHP.setXstDispFldRMark (xstDispFldRMark);
break;
case 0x62:
// sprmCDispFldRMark -- 0xCA62
/*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification
*
* Page 78 of 210
*
* sprmCDispFldRMark (opcode 0xCA62) is interpreted by moving the
* first parameter byte to chp.fDispFldRMark, the next two bytes to
* chp.ibstDispFldRMark, the next four bytes to
* chp.dttmDispFldRMark, and the remaining 32 bytes to
* chp.xstDispFldRMark.
*/
byte[] xstDispFldRMark = new byte[32];
buf = sprm.getGrpprl();
offset = sprm.getGrpprlOffset();
newCHP.setFDispFldRMark( 0 != buf[offset] );
newCHP.setIbstDispFldRMark( LittleEndian.getShort( buf, offset + 1 ) );
newCHP.setDttmDispFldRMark( new DateAndTime( buf, offset + 3 ) );
System.arraycopy( buf, offset + 7, xstDispFldRMark, 0, 32 );
newCHP.setXstDispFldRMark( xstDispFldRMark );
break;
case 0x63:
newCHP.setIbstRMarkDel ((short) sprm.getOperand());
break;

View File

@ -80,20 +80,8 @@ public final class CharacterProperties
public CharacterProperties()
{
setDttmRMark( new DateAndTime() );
setDttmRMarkDel( new DateAndTime() );
setDttmPropRMark( new DateAndTime() );
setDttmDispFldRMark( new DateAndTime() );
setFUsePgsuSettings( true );
setXstDispFldRMark( new byte[36] );
setShd( new ShadingDescriptor() );
setBrc( new BorderCode() );
setFcPic( -1 );
setHps( 20 );
setIstd( 10 );
setWCharScale( 100 );
setLidDefault( 0x0400 );
setLidFE( 0x0400 );
}
public boolean isMarkedDeleted()
@ -294,7 +282,7 @@ public final class CharacterProperties
public void setVerticalOffset(int hpsPos)
{
super.setHpsPos(hpsPos);
super.setHpsPos((short) hpsPos);
}
public int getKerning()

View File

@ -397,7 +397,7 @@ public final class CharacterRun
public void setVerticalOffset(int hpsPos)
{
_props.setHpsPos(hpsPos);
_props.setHpsPos((short) hpsPos);
_chpx.updateSprm(SPRM_HPSPOS, (byte)hpsPos);
}

View File

@ -1,21 +1,21 @@
<?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
====================================================================
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
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.
====================================================================
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 id="0x101B" name="CHP" package="org.apache.poi.hwpf.model.types">
<suffix>AbstractType</suffix>
@ -23,91 +23,331 @@
<description>Character Properties.</description>
<author>S. Ryan Ackley</author>
<fields>
<field type="int" size="2" name="format_flags">
<bit number="0" mask="0x0001" name="fBold"/>
<bit number="1" mask="0x0002" name="fItalic"/>
<bit number="2" mask="0x0004" name="fRMarkDel"/>
<bit number="3" mask="0x0008" name="fOutline"/>
<bit number="4" mask="0x0010" name="fFldVanish"/>
<bit number="5" mask="0x0020" name="fSmallCaps"/>
<bit number="6" mask="0x0040" name="fCaps"/>
<bit number="7" mask="0x0080" name="fVanish"/>
<bit number="8" mask="0x0100" name="fRMark"/>
<bit number="9" mask="0x0200" name="fSpec"/>
<bit number="10" mask="0x0400" name="fStrike"/>
<bit number="11" mask="0x0800" name="fObj"/>
<bit number="12" mask="0x1000" name="fShadow"/>
<bit number="13" mask="0x2000" name="fLowerCase"/>
<bit number="14" mask="0x4000" name="fData"/>
<bit number="15" mask="0x8000" name="fOle2"/>
</field>
<field type="int" size="2" name="format_flags1">
<bit number="0" mask="0x0001" name="fEmboss"/>
<bit number="1" mask="0x0002" name="fImprint"/>
<bit number="2" mask="0x0004" name="fDStrike"/>
<bit number="3" mask="0x0008" name="fUsePgsuSettings"/>
</field>
<field type="int" size="2" name="ftcAscii"/>
<field type="int" size="2" name="ftcFE"/>
<field type="int" size="2" name="ftcOther"/>
<field type="int" size="2" name="hps"/>
<field type="int" size="4" name="dxaSpace"/>
<field type="byte" size="1" name="iss"/>
<field type="byte" size="1" name="kul"/>
<field type="byte" size="1" name="ico"/>
<field type="int" size="2" name="hpsPos"/>
<field type="int" size="2" name="lidDefault"/>
<field type="int" size="2" name="lidFE"/>
<field type="byte" size="1" name="idctHint"/>
<field type="int" size="2" name="wCharScale"/>
<field type="int" size="4" name="fcPic"/>
<field type="int" size="4" name="fcObj"/>
<field type="int" size="4" name="lTagObj"/>
<field type="int" size="2" name="ibstRMark"/>
<field type="int" size="2" name="ibstRMarkDel"/>
<field type="DateAndTime" size="4" name="dttmRMark"/>
<field type="DateAndTime" size="4" name="dttmRMarkDel"/>
<field type="int" size="2" name="istd"/>
<field type="int" size="2" name="baseIstd"/>
<field type="int" size="2" name="ftcSym"/>
<field type="int" size="2" name="xchSym"/>
<field type="int" size="2" name="idslRMReason"/>
<field type="int" size="2" name="idslReasonDel"/>
<field type="byte" size="1" name="ysr"/>
<field type="byte" size="1" name="chYsr"/>
<field type="int" size="2" name="hpsKern"/>
<field type="short" size="2" name="Highlight">
<bit number="0" mask="0x001f" name="icoHighlight" description="Highlight color (see chp.ico)"/>
<bit number="1" mask="0x0020" name="fHighlight" description="When 1, characters are highlighted with color specified by chp.icoHighlight"/>
<bit number="2" mask="0x0040" name="fNavHighlight" description="Used internally by Word"/>
</field>
<field type="short" size="2" name="InternalFlags">
<bit number="0" mask="0x000f" name="iatrUndetType" description="Used internally by Word"/>
<bit number="1" mask="0x0010" name="fUlGap" description="Used internally by Word 8"/>
<bit number="2" mask="0x0800" name="fScriptAnchor" description="Used internally by Word"/>
<bit number="3" mask="0x1000" name="fFixedObj" description="Used internally by Word"/>
<bit number="4" mask="0x2000" name="spare2" description="Not used"/>
</field>
<field type="short" size="2" name="EncodingFlags">
<bit number="0" mask="0x0001" name="fChsDiff" description="Pre-Unicode files, char's char set different from FIB char set"/>
<bit number="1" mask="0x0002" name="fMacChs" description="fTrue if char's are Macintosh char set"/>
<bit number="2" mask="0x0004" name="fFtcAsciSym" description="Used internally by Word"/>
<bit number="3" mask="0x0008" name="fFtcReq" description="Used internally by Word"/>
<bit number="4" mask="0x0010" name="fLangApplied" description="Used internally by Word"/>
<bit number="5" mask="0x0020" name="fSpareLangApplied" description="Used internally by Word"/>
<bit number="6" mask="0x0040" name="fForcedCvAuto" description="Used internally by Word"/>
</field>
<!-- Not documented, but referenced by sprmCChs -->
<field type="short" size="2" name="chse" description="used to record a character set id for text that was pasted into the Word document that used a character set different than Word's default character set"/>
<field type="short" size="2" name="fPropMark"/>
<field type="int" size="2" name="ibstPropRMark"/>
<field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="byte" size="1" name="sfxtText"/>
<field type="byte" size="1" name="fDispFldRMark"/>
<field type="int" size="2" name="ibstDispFldRMark"/>
<field type="DateAndTime" size="4" name="dttmDispFldRMark"/>
<field type="byte[]" size="32" name="xstDispFldRMark"/>
<field type="ShadingDescriptor" size="2" name="shd"/>
<field type="BorderCode" size="4" name="brc"/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 102 of 210 -->
<field type="int" size="4" name="grpfChp" description="Collection of the 32 flags">
<bit number="00" mask="0x00000001" name="fBold" description="Text is bold"/>
<bit number="01" mask="0x00000002" name="fItalic" description="Italic"/>
<bit number="02" mask="0x00000004" name="fRMarkDel"
description="has been deleted and will be displayed with strikethrough when revision marked text is to be displayed"/>
<bit number="03" mask="0x00000008" name="fOutline" description="Outlined"/>
<bit number="04" mask="0x00000010" name="fFldVanish" description="Used internally by Word"/>
<bit number="05" mask="0x00000020" name="fSmallCaps" description="Displayed with small caps"/>
<bit number="06" mask="0x00000040" name="fCaps" description="Displayed with caps"/>
<bit number="07" mask="0x00000080" name="fVanish"
description="text has ―hidden‖ format, and is not displayed unless fPagHidden is set in the DOP"/>
<bit number="08" mask="0x00000100" name="fRMark"
description="text is newly typed since the last time revision marks have been accepted and will be displayed with an underline when revision marked text is to be displayed"/>
<bit number="09" mask="0x00000200" name="fSpec" description="Character is a Word special character"/>
<bit number="10" mask="0x00000400" name="fStrike" description="Displayed with strikethrough"/>
<bit number="11" mask="0x00000800" name="fObj" description="Embedded objec"/>
<bit number="12" mask="0x00001000" name="fShadow" description="Character is drawn with a shadow"/>
<bit number="13" mask="0x00002000" name="fLowerCase"
description="Character is displayed in lower case. This field may be set to 1 only when chp.fSmallCaps is 1."/>
<bit number="14" mask="0x00004000" name="fData"
description="chp.fcPic points to an FFDATA, the data structure binary data used by Word to describe a form field. The bit chp.fData may only be 1 when chp.fSpec is also 1 and the special character in the document stream that has this property is a chPicture (0x01)"/>
<bit number="15" mask="0x00008000" name="fOle2"
description="chp.lTagObj specifies a particular object in the object stream that specifies the particular OLE object in the stream that should be displayed when the chPicture fSpec character that is tagged with the fOle2 is encountered. The bit chp.fOle2 may only be 1 when chp.fSpec is also 1 and the special character in the document stream that has this property is a chPicture (0x01)."/>
<bit number="16" mask="0x00010000" name="fEmboss" description="Text is embossed"/>
<bit number="17" mask="0x00020000" name="fImprint" description="Text is engraved"/>
<bit number="18" mask="0x00040000" name="fDStrike" description="Displayed with double strikethrough"/>
<bit number="19" mask="0x00080000" name="fUsePgsuSettings" description="Used internally by Word"/>
<bit number="20" mask="0x00100000" name="fBoldBi" description="Complex Scripts text is bold"/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 103 of 210 -->
<bit number="21" mask="0x00200000" name="fComplexScripts"
description="Complex Scripts text that requires special processing to display and process"/>
<bit number="22" mask="0x00400000" name="fItalicBi" description="Complex Scripts text is italics"/>
<bit number="23" mask="0x00800000" name="fBiDi"
description="Complex Scripts right-to-left text that requires special processing to display and process (character reordering; contextual shaping; display of combining characters and diacritics; specialized justification rules; cursor positioning)"/>
<!-- fIcoBi -->
<!-- fNonGlyph -->
<!-- fBoldOther -->
<!-- fItalicOther -->
<!-- fNoProof -->
<!-- fWebHidden -->
<!-- fFitText -->
<!-- fCalc -->
</field>
<field type="int" size="2" name="hps" default="20" description="Font size in half points"/>
<field type="int" size="2" name="ftcAscii" description="Font for ASCII text"/>
<field type="int" size="2" name="ftcFE" description="Font for East Asian text"/>
<field type="int" size="2" name="ftcOther" description="Font for non-East Asian text"/>
<field type="int" size="2" name="ftcBi" description="Font for Complex Scripts text"/>
<!-- rgftc[iftcCompositeMax] -->
<field type="int" size="4" name="dxaSpace"
description="Space following each character in the run expressed in twip units."/>
<!-- cv -->
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 104 of 210 -->
<field type="byte" size="1" name="ico" description="Color of text for Word 97"/>
<field type="int" size="2" name="pctCharWidth" description="Character scale"/>
<!-- Lid -->
<!-- rglid[clidChpMax] -->
<field type="int" size="2" name="lidDefault" default="0x0400"/>
<field type="int" size="2" name="lidFE" default="0x0400"/>
<!-- lidBi -->
<field type="byte" size="1" name="kcd" description="Emphasis mark">
<const type="byte" value="0" name="NON"/>
<const type="byte" value="1" name="DOT"/>
<const type="byte" value="2" name="COMMA"/>
<const type="byte" value="3" name="CIRCLE"/>
<const type="byte" value="4" name="UNDER_DOT"/>
</field>
<field type="boolean" size="1" name="fUndetermine" description="Character is undetermined"/>
<field type="byte" size="1" name="iss" description="Superscript/subscript indices">
<const type="byte" value="0" name="NONE"/>
<const type="byte" value="1" name="SUPERSCRIPTED"/>
<const type="byte" value="2" name="SUBSCRIPTED"/>
</field>
<field type="boolean" size="1" name="fSpecSymbol" description="Used by Word internally"/>
<field type="byte" size="1" name="idct" description="Not stored in file"/>
<field type="byte" size="1" name="idctHint" description="Identifier of Character type"/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 105 of 210 -->
<field type="byte" size="1" name="kul" description="Underline code">
<const type="byte" value="0" name="NONE"/>
<const type="byte" value="1" name="SINGLE"/>
<const type="byte" value="2" name="BY_WORD"/>
<const type="byte" value="3" name="DOUBLE"/>
<const type="byte" value="4" name="DOTTED"/>
<const type="byte" value="5" name="HIDDEN"/>
<const type="byte" value="6" name="THICK"/>
<const type="byte" value="7" name="DASH"/>
<const type="byte" value="8" name="DOT"/>
<const type="byte" value="9" name="DOT_DASH"/>
<const type="byte" value="10" name="DOT_DOT_DASH"/>
<const type="byte" value="11" name="WAVE"/>
<const type="byte" value="20" name="DOTTED_HEAVY"/>
<const type="byte" value="23" name="DASHED_HEAVY"/>
<const type="byte" value="25" name="DOT_DASH_HEAVY"/>
<const type="byte" value="26" name="DOT_DOT_DASH_HEAVY"/>
<const type="byte" value="27" name="WAVE_HEAVY"/>
<const type="byte" value="39" name="DASH_LONG"/>
<const type="byte" value="43" name="WAVE_DOUBLE"/>
<const type="byte" value="55" name="DASH_LONG_HEAVY"/>
</field>
<field type="Hyphenation" size="2" name="hresi" />
<field type="int" size="2" name="hpsKern"
description="Kerning distance for characters in run recorded in half points"/>
<field type="short" size="2" name="hpsPos"
description="Reserved (actually used as vertical offset(?) value)"/>
<!-- cvUl -->
<field type="ShadingDescriptor" size="2" name="shd" description="Shading"/>
<field type="BorderCode" size="4" name="brc" description="Border"/>
<field type="int" size="2" name="ibstRMark"
description="Index to author IDs stored in hsttbfRMark. Used when text in run was newly typed when revision marking was enabled"/>
<field type="byte" size="1" name="sfxtText" description="Text animation">
<const type="byte" value="0" name="NO"/>
<const type="byte" value="1" name="LAS_VEGAS_LIGHTS"/>
<const type="byte" value="2" name="BACKGROUND_BLINK"/>
<const type="byte" value="3" name="SPARKLE_TEXT"/>
<const type="byte" value="4" name="MARCHING_ANTS"/>
<const type="byte" value="5" name="MARCHING_RED_ANTS"/>
<const type="byte" value="6" name="SHIMMER"/>
</field>
<field type="boolean" size="1" name="fDblBdr" description="Used internally by Word"/>
<field type="boolean" size="1" name="fBorderWS" description="Used internally by Word"/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 106 of 210 -->
<field type="short" size="2" name="ufel"
description="Collection properties represented by itypFELayout and copt (East Asian layout properties)">
<bit number="0" mask="0x00ff" name="itypFELayout"/>
<bit number="1" mask="0x0100" name="fTNY"
description="Tatenakayoko: Horizontalin-vertical (range of text in a direction perpendicular to the text flow) is used"/>
<bit number="2" mask="0x0200" name="fWarichu"
description="Two lines in one (text in the group is displayed as two half-height lines within a line)"/>
<bit number="3" mask="0x0400" name="fKumimoji" description="combine characters"/>
<bit number="4" mask="0x0800" name="fRuby" description="Phonetic guide"/>
<bit number="5" mask="0x1000" name="fLSFitText" description="fit text"/>
<bit number="5" mask="0xe000" name="spare" description="Unused"/>
</field>
<field type="byte" size="1" name="copt" description="Collection of the 5 flags">
<bit number="0" mask="0x07" name="iWarichuBracket" description="Bracket character for two-lines-in-one"/>
<bit number="1" mask="0x08" name="fWarichuNoOpenBracket" description="Two-lines-in-one uses no open"/>
<bit number="2" mask="0x10" name="fTNYCompress" description="fit text in line"/>
<bit number="4" mask="0x20" name="fTNYFetchTxm" description="fetch text metrics"/>
<bit number="5" mask="0x40" name="fCellFitText" description="Fit text in cell"/>
<bit number="6" mask="0x80" name="unused" description="Not used"/>
</field>
<field type="int" size="2" name="hpsAsci" description="Font size for ASCII font"/>
<field type="int" size="2" name="hpsFE" description="Font size for East Asian text"/>
<field type="int" size="2" name="hpsBi" description="Font size for Complex Scripts text"/>
<!-- rghps[ihpsMax] -->
<field type="int" size="2" name="ftcSym"
description="an index into the rgffn structure. When chp.fSpec is 1 and the character recorded for the run in the document stream is chSymbol (0x28), chp.ftcSym identifies the font code of the symbol font that will be used to display the symbol character recorded in chp.xchSym."/>
<field type="int" size="2" name="xchSym"
description="When chp.fSpec==1 and the character recorded for the run in the document stream is chSymbol (0x28), the character stored chp.xchSym will be displayed using the font specified in chp.ftcSym."/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 107 of 210 -->
<!-- fNumRunBi -->
<!-- fSysVanish -->
<!-- fDiacRunBi -->
<!-- fBoldPresent -->
<!-- fItalicPresent -->
<field type="int" size="4" name="fcPic" default="-1"
description="Offset in data stream pointing to beginning of a picture when character is a picture character (character is 0x01 and chp.fSpec is 1)."/>
<field type="int" size="4" name="fcObj"
description="Offset in data stream pointing to beginning of a picture when character is an OLE1 object character (character is 0x20 and chp.fSpec is 1, chp.fOle2 is 0)."/>
<field type="int" size="4" name="lTagObj"
description="An object ID for an OLE object, only set if chp.fSpec and chp.fOle2 are both true, and chp.fObj."/>
<field type="int" size="4" name="fcData"
description="Points to location of picture data, only if chp.fSpec is true."/>
<!-- hsp -->
<!-- docPic -->
<!-- dummy -->
<!-- fDirty -->
<field type="Hyphenation" size="2" name="hresiOld" />
<!-- dummy3 -->
<!-- dxpKashida -->
<!-- dxpSpace -->
<field type="int" size="2" name="ibstRMarkDel"
description="Index to author IDs stored in hsttbfRMark. Used when text in run was deleted when revision marking was enabled."/>
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 108 of 210 -->
<field type="DateAndTime" size="4" name="dttmRMark"
description="Date/time at which this run of text was entered/modified by the author (Only recorded when revision marking is on.)"/>
<field type="DateAndTime" size="4" name="dttmRMarkDel"
description="Date/time at which this run of text was deleted by the author (Only recorded when revision marking is on.)"/>
<!-- cHpsInc -->
<field type="int" size="2" name="istd" default="10"
description="Index to character style descriptor in the stylesheet that tags this run of text. When istd is istdNormalChar (10 decimal), characters in run are not affected by a character style. If chp.istd contains any other value, chpx of the specified character style are applied to CHP for this run before any other exceptional properties are applied."/>
<field type="int" size="2" name="idslRMReason"
description="An index to strings displayed as reasons for actions taken by Words AutoFormat code"/>
<field type="int" size="2" name="idslReasonDel"
description="An index to strings displayed as reasons for actions taken by Words AutoFormat code"/>
<field type="int" size="2" name="cpg" description="Code page of run in pre-Unicode files"/>
<!-- iatrUndetType -->
<!-- fUlGap -->
<field type="short" size="2" name="Highlight">
<bit number="0" mask="0x001f" name="icoHighlight" description="Highlight color (see chp.ico)"/>
<bit number="1" mask="0x0020" name="fHighlight"
description="When 1, characters are highlighted with color specified by chp.icoHighlight"/>
<!-- fNavHighlight -->
</field>
<field type="short" size="2" name="CharsetFlags">
<bit number="0" mask="0x0001" name="fChsDiff"
description="Pre-Unicode files, char's char set different from FIB char set"/>
<bit number="1" mask="0x0020" name="fMacChs" description="fTrue if char's are Macintosh char set"/>
<!-- fFtcAsciSym -->
<!-- fFtcReq -->
<!-- fLangApplied -->
<!-- fSpareLangApplied -->
<!-- fForcedCvAuto -->
</field>
<!-- Undocumented, but referenced -->
<field type="short" size="2" name="chse"/>
<field type="boolean" size="2" name="fPropRMark"
description="properties have been changed with revision marking on"/>
<field type="int" size="2" name="ibstPropRMark"
description="Index to author IDs stored in hsttbfRMark. Used when properties have been changed when revision marking was enabled."/>
<field type="DateAndTime" size="4" name="dttmPropRMark"
description="Date/time at which properties of this were changed for this run of text by the author. (Only recorded when revision marking is on.)"/>
<!-- fAnmPropRMark -->
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 109 of 210 -->
<field type="boolean" size="1" name="fConflictOrig"
description="When chp.wConflict!=0, this is TRUE when text is part of the original version of text. When FALSE, text is alternative introduced by reconciliation operation."/>
<field type="boolean" size="1" name="fConflictOtherDel"
description="When fConflictOtherDel==fTrue, the other side of a reconciliation conflict causes this text to be deleted"/>
<field type="int" size="2" name="wConflict"
description="When != 0, index number that identifies all text participating in a particular conflict incident"/>
<field type="int" size="2" name="IbstConflict" description="Who made this change for this side of the conflict."/>
<field type="DateAndTime" size="4" name="dttmConflict" description="When the change was made"/>
<field type="boolean" size="1" name="fDispFldRMark"
description="the number for a ListNum field is being tracked in xstDispFldRMark. If that number is different from the current value, the number has changed. Only valid for ListNum fields."/>
<field type="int" size="2" name="ibstDispFldRMark"
description="Index to author IDs stored in hsttbfRMark. Used when ListNum field numbering has been changed when revision marking was enabled."/>
<field type="DateAndTime" size="4" name="dttmDispFldRMark" description="The date for the ListNum field number change"/>
<field type="byte[]" size="32" name="xstDispFldRMark"
description="The string value of the ListNum field when revision mark tracking began"/>
<!-- dxtSpaceExtra -->
<field type="int" size="4" name="fcObjp"
description="Offset in the data stream indicating the location of OLE object data"/>
<!-- dxaFitText -->
<!-- lFitTextID -->
<field type="byte" size="1" name="lbrCRJ" description="Line BReak code for xchCRJ">
<const type="byte" value="0" name="NONE"/>
<const type="byte" value="1" name="LEFT"/>
<const type="byte" value="2" name="RIGHT"/>
<const type="byte" value="3" name="BOTH"/>
</field>
<!-- iuhi -->
<!-- bTransNoProof0 -->
<!-- bTransNoProof1 -->
<!-- rsidProp -->
<!-- rsidText -->
<!-- rsidRMDel -->
<!-- Microsoft Office Word 97-2007 Binary File Format (.doc) Specification -->
<!-- Page 110 of 210 -->
<field type="boolean" size="1" name="fSpecVanish"
description="Special hidden for leading emphasis (always hidden)"/>
<field type="boolean" size="1" name="fHasOldProps"
description="Used for character property revision marking. The chp at the time fHasOldProps is set to 1, the is the old chp."/>
<!-- pbi -->
<!-- hplcnf -->
<!-- ffm -->
<field type="boolean" size="1" name="fSdtVanish" description="Mark the character as hidden."/>
<!-- Referenced by "The standard CHP is all zeros except" -->
<field type="int" size="2" name="wCharScale" default="100"/>
<!-- From old version of description -->
<!-- <field type="short" size="2" name="InternalFlags"> -->
<!-- <bit number="0" mask="0x000f" name="iatrUndetType" description="Used internally by Word"/> -->
<!-- <bit number="1" mask="0x0010" name="fUlGap" description="Used internally by Word 8"/> -->
<!-- <bit number="2" mask="0x0800" name="fScriptAnchor" description="Used internally by Word"/> -->
<!-- <bit number="3" mask="0x1000" name="fFixedObj" description="Used internally by Word"/> -->
<!-- <bit number="4" mask="0x2000" name="spare2" description="Not used"/> -->
<!-- </field> -->
<!-- Not documented, but referenced by sprmCChs -->
<!-- description="used to record a character set id for text that was pasted into the Word
document that used a character set different than Word's default character set"/> -->
<!-- <field type="byte" size="1" name="idctHint"/> -->
<!-- <field type="int" size="2" name="baseIstd"/> -->
<!-- <field type="int" size="2" name="xchSym"/> -->
</fields>
</record>

View File

@ -0,0 +1,42 @@
<?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="HRESI" package="org.apache.poi.hwpf.model.types">
<suffix>AbstractType</suffix>
<description>Hyphenation (HRESI). &lt;p&gt;Class and fields descriptions are
quoted from
Microsoft Office Word 97-2007 Binary File Format (.doc) Specification
</description>
<author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format (.doc)
Specification
</author>
<fields>
<field type="byte" size="1" name="hres" description="Hyphenation rule">
<const type="byte" value="0" name="NO"/>
<const type="byte" value="1" name="NORMAL"/>
<const type="byte" value="2" name="ADD_LETTER_BEFORE"/>
<const type="byte" value="3" name="CHANGE_LETTER_BEFORE"/>
<const type="byte" value="4" name="DELETE_LETTER_BEFORE"/>
<const type="byte" value="5" name="CHANGE_LETTER_AFTER"/>
<const type="byte" value="6" name="DELETE_BEFORE_CHANGE_BEFORE"/>
</field>
<field type="byte" size="1" name="chHres"
description="The character that will be used to add or change a letter when hres is 2, 3, 5 or 6"/>
</fields>
</record>

View File

@ -115,23 +115,41 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
<xsl:call-template name="linebreak"/>
<xsl:call-template name="linebreak"/>
<xsl:if test='/@fromfile="true"'>
protected void fillFields(byte[] data, int offset)
{
<xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field">
<xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,30)"/> = <xsl:value-of select="field:fillDecoder($fieldIterator,@size,@type)"/>;
</xsl:for-each>
}
public void serialize(byte[] data, int offset)
<xsl:if test='/*/@fromfile="true"'>
<xsl:call-template name="indent"/>
<xsl:text>protected void fillFields( byte[] data, int offset )
{
</xsl:text>
<xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field">
<xsl:text> </xsl:text><xsl:value-of select="field:serialiseEncoder($fieldIterator,position(),@name,@size,@type)"/>;
</xsl:for-each>
}
<xsl:for-each select="//fields/field">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:value-of select="recutil:getFieldName(position(),@name,30)"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="field:fillDecoder($fieldIterator,@size,@type)"/>
<xsl:text>;
</xsl:text>
</xsl:for-each>
<xsl:call-template name="indent"/>
<xsl:text>}</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:text>public void serialize( byte[] data, int offset )
{
</xsl:text>
<xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:value-of select="field:serialiseEncoder($fieldIterator,position(),@name,@size,@type)"/>
<xsl:call-template name="linebreak"/>
</xsl:for-each>
<xsl:call-template name="indent"/>
<xsl:text>}</xsl:text>
<xsl:call-template name="linebreak"/>
/**
* Size of record (exluding 4 byte header)
*/
@ -182,7 +200,7 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
* Sets the <xsl:value-of select="@name"/> field value.
* <xsl:value-of select="@description"/>
*/
public void set<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>(<xsl:value-of select="recutil:getBitFieldType(@name, @mask, ../@type)"/> value)
public void set<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>( <xsl:value-of select="recutil:getBitFieldType(@name, @mask, ../@type)"/> value )
{
<xsl:value-of select="recutil:getFieldName($fieldNum,../@name,0)"/> = <xsl:value-of select="recutil:getBitFieldSet(@name, @mask, ../@type, recutil:getFieldName($fieldNum,../@name,0))"/>;
@ -284,7 +302,7 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
* @param <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
* One of <xsl:apply-templates select="./const" mode="listconsts"/></xsl:if>
*/
public void set<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>(<xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>)
public void set<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>( <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/> )
{
this.<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/> = <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>;
}