You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by sa...@apache.org on 2004/03/05 14:07:55 UTC

cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel CharacterProperties.java CharacterRun.java ListEntry.java Paragraph.java Range.java Section.java Table.java TableCell.java

sackley     2004/03/05 05:07:55

  Modified:    src/scratchpad/src/org/apache/poi/hwpf/usermodel
                        CharacterProperties.java CharacterRun.java
                        ListEntry.java Paragraph.java Range.java
                        Section.java Table.java TableCell.java
  Log:
  <No Comment Entered>
  
  Revision  Changes    Path
  1.6       +56 -0     jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
  
  Index: CharacterProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CharacterProperties.java	2 Mar 2004 06:19:41 -0000	1.5
  +++ CharacterProperties.java	5 Mar 2004 13:07:55 -0000	1.6
  @@ -113,6 +113,7 @@
     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 @@
       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
  
  
  
  1.4       +20 -6     jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
  
  Index: CharacterRun.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CharacterRun.java	2 Mar 2004 06:19:41 -0000	1.3
  +++ CharacterRun.java	5 Mar 2004 13:07:55 -0000	1.4
  @@ -127,12 +127,10 @@
       _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()
     {
  @@ -447,6 +445,22 @@
       _props.setFHighlight(true);
       _props.setIcoHighlight(color);
       _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()
  
  
  
  1.2       +5 -0      jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java
  
  Index: ListEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ListEntry.java	2 Mar 2004 06:22:29 -0000	1.1
  +++ ListEntry.java	5 Mar 2004 13:07:55 -0000	1.2
  @@ -21,4 +21,9 @@
       _overrideLevel = override.getOverrideLevel(pap.getIlvl());
       _level = tables.getLevel(override.getLsid(), pap.getIlvl());
     }
  +
  +  public int type()
  +  {
  +    return TYPE_LISTENTRY;
  +  }
   }
  
  
  
  1.3       +6 -1      jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java
  
  Index: Paragraph.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Paragraph.java	2 Mar 2004 06:19:41 -0000	1.2
  +++ Paragraph.java	5 Mar 2004 13:07:55 -0000	1.3
  @@ -131,7 +131,7 @@
   
     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();
  @@ -142,6 +142,11 @@
       super(start, end, parent);
       _props = pap;
       _papx = papx;
  +  }
  +
  +  public int type()
  +  {
  +    return TYPE_PARAGRAPH;
     }
   
     public boolean isInTable()
  
  
  
  1.2       +16 -9     jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
  
  Index: Range.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Range.java	2 Mar 2004 06:22:29 -0000	1.1
  +++ Range.java	5 Mar 2004 13:07:55 -0000	1.2
  @@ -95,10 +95,13 @@
   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 @@
     int _textStart;
     int _textEnd;
   
  -
   //  protected Range()
   //  {
   //
  @@ -162,28 +164,28 @@
   
       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();
  @@ -434,6 +436,11 @@
       }
   
       return pap;
  +  }
  +
  +  public int type()
  +  {
  +    return TYPE_UNDEFINED;
     }
   
     private void initAll()
  
  
  
  1.3       +5 -0      jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java
  
  Index: Section.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Section.java	2 Mar 2004 06:19:41 -0000	1.2
  +++ Section.java	5 Mar 2004 13:07:55 -0000	1.3
  @@ -68,6 +68,11 @@
       _props = sepx.getSectionProperties();
     }
   
  +  public int type()
  +  {
  +    return TYPE_SECTION;
  +  }
  +
     public Object clone()
        throws CloneNotSupportedException
      {
  
  
  
  1.2       +6 -1      jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Table.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Table.java	2 Mar 2004 06:22:29 -0000	1.1
  +++ Table.java	5 Mar 2004 13:07:55 -0000	1.2
  @@ -9,7 +9,7 @@
   
     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();
   
  @@ -31,6 +31,11 @@
     public int numRows()
     {
       return _rows.size();
  +  }
  +
  +  public int type()
  +  {
  +    return TYPE_TABLE;
     }
   
     public TableRow getRow(int index)
  
  
  
  1.2       +1 -1      jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCell.java
  
  Index: TableCell.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCell.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TableCell.java	2 Mar 2004 06:22:29 -0000	1.1
  +++ TableCell.java	5 Mar 2004 13:07:55 -0000	1.2
  @@ -8,7 +8,7 @@
   
     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;
     }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org