<No Comment Entered>
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7553198a32
commit
74b4e4792e
@ -313,6 +313,11 @@ public class CharacterSprmCompressor
|
||||
{
|
||||
size += SprmUtils.addSprm((short)0x2859, newCHP.getSfxtText(), null, sprmList);
|
||||
}
|
||||
if (newCHP.getIco24() != oldCHP.getIco24())
|
||||
{
|
||||
if(newCHP.getIco24() != -1) // don't add a sprm if we're looking at an ico = Auto
|
||||
size += SprmUtils.addSprm((short)0x6870, newCHP.getIco24(), null, sprmList);
|
||||
}
|
||||
|
||||
return SprmUtils.getGrpprl(sprmList, size);
|
||||
}
|
||||
|
@ -575,6 +575,9 @@ public class CharacterSprmUncompressor
|
||||
case 0x6f:
|
||||
newCHP.setIdctHint ((byte) sprm.getOperand());
|
||||
break;
|
||||
case 0x70:
|
||||
newCHP.setIco24 (sprm.getOperand());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,6 +113,7 @@ public class CharacterProperties
|
||||
public final static short SPRM_FELID = 0x486E;
|
||||
public final static short SPRM_IDCTHINT = 0x286F;
|
||||
|
||||
int _ico24 = -1; // default to -1 so we can ignore it for word 97 files
|
||||
|
||||
public CharacterProperties()
|
||||
{
|
||||
@ -352,6 +353,61 @@ public class CharacterProperties
|
||||
super.setIcoHighlight(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ico24 field for the CHP record.
|
||||
*/
|
||||
public int getIco24()
|
||||
{
|
||||
if ( _ico24 == -1 )
|
||||
{
|
||||
switch(field_11_ico) // convert word 97 colour numbers to 0xBBGGRR value
|
||||
{
|
||||
case 0: // auto
|
||||
return -1;
|
||||
case 1: // black
|
||||
return 0x000000;
|
||||
case 2: // blue
|
||||
return 0xFF0000;
|
||||
case 3: // cyan
|
||||
return 0xFFFF00;
|
||||
case 4: // green
|
||||
return 0x00FF00;
|
||||
case 5: // magenta
|
||||
return 0xFF00FF;
|
||||
case 6: // red
|
||||
return 0x0000FF;
|
||||
case 7: // yellow
|
||||
return 0x00FFFF;
|
||||
case 8: // white
|
||||
return 0x0FFFFFF;
|
||||
case 9: // dark blue
|
||||
return 0x800000;
|
||||
case 10: // dark cyan
|
||||
return 0x808000;
|
||||
case 11: // dark green
|
||||
return 0x008000;
|
||||
case 12: // dark magenta
|
||||
return 0x800080;
|
||||
case 13: // dark red
|
||||
return 0x000080;
|
||||
case 14: // dark yellow
|
||||
return 0x008080;
|
||||
case 15: // dark grey
|
||||
return 0x808080;
|
||||
case 16: // light grey
|
||||
return 0xC0C0C0;
|
||||
}
|
||||
}
|
||||
return _ico24;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ico24 field for the CHP record.
|
||||
*/
|
||||
public void setIco24(int colour24)
|
||||
{
|
||||
_ico24 = colour24 & 0xFFFFFF; // only keep the 24bit 0xBBGGRR colour
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
throws CloneNotSupportedException
|
||||
|
@ -127,12 +127,10 @@ public class CharacterRun
|
||||
_chpx = chpx.getSprmBuf();
|
||||
}
|
||||
|
||||
// SprmBuffer initProperties(CharacterProperties baseStyle)
|
||||
// {
|
||||
// byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(_props, baseStyle);
|
||||
// _chpx = new SprmBuffer(grpprl);
|
||||
// return _chpx;
|
||||
// }
|
||||
public int type()
|
||||
{
|
||||
return TYPE_CHARACTER;
|
||||
}
|
||||
|
||||
public boolean isMarkedDeleted()
|
||||
{
|
||||
@ -449,6 +447,22 @@ public class CharacterRun
|
||||
_chpx.addSprm(SPRM_HIGHLIGHT, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ico24 field for the CHP record.
|
||||
*/
|
||||
public int getIco24()
|
||||
{
|
||||
return _props.getIco24();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ico24 field for the CHP record.
|
||||
*/
|
||||
public void setIco24(int colour24)
|
||||
{
|
||||
_props.setIco24(colour24);
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
throws CloneNotSupportedException
|
||||
{
|
||||
|
@ -21,4 +21,9 @@ public class ListEntry
|
||||
_overrideLevel = override.getOverrideLevel(pap.getIlvl());
|
||||
_level = tables.getLevel(override.getLsid(), pap.getIlvl());
|
||||
}
|
||||
|
||||
public int type()
|
||||
{
|
||||
return TYPE_LISTENTRY;
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class Paragraph
|
||||
|
||||
protected Paragraph(int startIdx, int endIdx, Table parent)
|
||||
{
|
||||
super(startIdx, endIdx, Range.PARAGRAPH_INDEX, parent);
|
||||
super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent);
|
||||
PAPX papx = (PAPX)_paragraphs.get(_parEnd - 1);
|
||||
_props = papx.getParagraphProperties(_doc.getStyleSheet());
|
||||
_papx = papx.getSprmBuf();
|
||||
@ -144,6 +144,11 @@ public class Paragraph
|
||||
_papx = papx;
|
||||
}
|
||||
|
||||
public int type()
|
||||
{
|
||||
return TYPE_PARAGRAPH;
|
||||
}
|
||||
|
||||
public boolean isInTable()
|
||||
{
|
||||
return _props.getFInTable() != 0;
|
||||
|
@ -95,10 +95,13 @@ import java.lang.ref.WeakReference;
|
||||
public class Range
|
||||
{
|
||||
|
||||
public static final int PARAGRAPH_INDEX = 0;
|
||||
public static final int CHARACTER_INDEX = 1;
|
||||
public static final int SECTION_INDEX = 2;
|
||||
public static final int TEXT_INDEX = 3;
|
||||
public static final int TYPE_PARAGRAPH = 0;
|
||||
public static final int TYPE_CHARACTER= 1;
|
||||
public static final int TYPE_SECTION = 2;
|
||||
public static final int TYPE_TEXT = 3;
|
||||
public static final int TYPE_LISTENTRY = 4;
|
||||
public static final int TYPE_TABLE = 5;
|
||||
public static final int TYPE_UNDEFINED = 6;
|
||||
|
||||
private WeakReference _parent;
|
||||
protected int _start;
|
||||
@ -121,7 +124,6 @@ public class Range
|
||||
int _textStart;
|
||||
int _textEnd;
|
||||
|
||||
|
||||
// protected Range()
|
||||
// {
|
||||
//
|
||||
@ -162,28 +164,28 @@ public class Range
|
||||
|
||||
switch (idxType)
|
||||
{
|
||||
case PARAGRAPH_INDEX:
|
||||
case TYPE_PARAGRAPH:
|
||||
_parStart = parent._parStart + startIdx;
|
||||
_parEnd = parent._parStart + endIdx;
|
||||
_start = ((PropertyNode)_paragraphs.get(_parStart)).getStart();
|
||||
_end = ((PropertyNode)_paragraphs.get(_parEnd)).getEnd();
|
||||
_parRangeFound = true;
|
||||
break;
|
||||
case CHARACTER_INDEX:
|
||||
case TYPE_CHARACTER:
|
||||
_charStart = parent._charStart + startIdx;
|
||||
_charEnd = parent._charStart + endIdx;
|
||||
_start = ((PropertyNode)_characters.get(_charStart)).getStart();
|
||||
_end = ((PropertyNode)_characters.get(_charEnd)).getEnd();
|
||||
_charRangeFound = true;
|
||||
break;
|
||||
case SECTION_INDEX:
|
||||
case TYPE_SECTION:
|
||||
_sectionStart = parent._sectionStart + startIdx;
|
||||
_sectionEnd = parent._sectionStart + endIdx;
|
||||
_start = ((PropertyNode)_sections.get(_sectionStart)).getStart();
|
||||
_end = ((PropertyNode)_sections.get(_sectionEnd)).getEnd();
|
||||
_sectionRangeFound = true;
|
||||
break;
|
||||
case TEXT_INDEX:
|
||||
case TYPE_TEXT:
|
||||
_textStart = parent._textStart + startIdx;
|
||||
_textEnd = parent._textStart + endIdx;
|
||||
_start = ((PropertyNode)_text.get(_textStart)).getStart();
|
||||
@ -436,6 +438,11 @@ public class Range
|
||||
return pap;
|
||||
}
|
||||
|
||||
public int type()
|
||||
{
|
||||
return TYPE_UNDEFINED;
|
||||
}
|
||||
|
||||
private void initAll()
|
||||
{
|
||||
initText();
|
||||
|
@ -68,6 +68,11 @@ public class Section
|
||||
_props = sepx.getSectionProperties();
|
||||
}
|
||||
|
||||
public int type()
|
||||
{
|
||||
return TYPE_SECTION;
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
throws CloneNotSupportedException
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ public class Table
|
||||
|
||||
Table(int startIdx, int endIdx, Range parent, int levelNum)
|
||||
{
|
||||
super(startIdx, endIdx, Range.PARAGRAPH_INDEX, parent);
|
||||
super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent);
|
||||
_rows = new ArrayList();
|
||||
int numParagraphs = numParagraphs();
|
||||
|
||||
@ -33,6 +33,11 @@ public class Table
|
||||
return _rows.size();
|
||||
}
|
||||
|
||||
public int type()
|
||||
{
|
||||
return TYPE_TABLE;
|
||||
}
|
||||
|
||||
public TableRow getRow(int index)
|
||||
{
|
||||
return (TableRow)_rows.get(index);
|
||||
|
@ -8,7 +8,7 @@ public class TableCell
|
||||
|
||||
public TableCell(int startIdx, int endIdx, TableRow parent, int levelNum, TableCellDescriptor tcd)
|
||||
{
|
||||
super(startIdx, endIdx, Range.PARAGRAPH_INDEX, parent);
|
||||
super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent);
|
||||
_levelNum = levelNum;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user