poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhei...@apache.org
Subject cvs commit: jakarta-poi/src/java/org/apache/poi/hssf/model Workbook.java WorkbookRecordList.java
Date Tue, 14 Oct 2003 22:50:48 GMT
jheight     2003/10/14 15:50:48

  Modified:    src/java/org/apache/poi/hssf/model Workbook.java
                        WorkbookRecordList.java
  Log:
  Fix on head for custom palettes.
  
  Resolves 16559
  
  Revision  Changes    Path
  1.33      +7 -4      jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java
  
  Index: Workbook.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Workbook.java	27 Jul 2003 19:15:14 -0000	1.32
  +++ Workbook.java	14 Oct 2003 22:50:48 -0000	1.33
  @@ -2074,15 +2074,18 @@
       public PaletteRecord getCustomPalette()
       {
           PaletteRecord palette;
  -        Record rec = records.get(records.getPalettepos());
  -        if (rec instanceof PaletteRecord)
  -        {
  +      int palettePos = records.getPalettepos();
  +      if (palettePos != -1) {
  +        Record rec = records.get(palettePos);
  +        if (rec instanceof PaletteRecord) {
               palette = (PaletteRecord) rec;
  +        } else throw new RuntimeException("InternalError: Expected PaletteRecord but got
a '"+rec+"'");
           }
           else
           {
               palette = createPalette();
  -            records.add(records.getPalettepos(), palette);
  +          //Add the palette record after the bof which is always the first record
  +          records.add(1, palette);
           }
           return palette;
       }
  
  
  
  1.4       +1 -1      jakarta-poi/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
  
  Index: WorkbookRecordList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WorkbookRecordList.java	30 Apr 2003 04:39:16 -0000	1.3
  +++ WorkbookRecordList.java	14 Oct 2003 22:50:48 -0000	1.4
  @@ -74,7 +74,7 @@
       private int  namepos     = 0;   // holds the position of last name record
       private int  supbookpos  = 0;   // holds the position of sup book
       private int  externsheetPos = 0;// holds the position of the extern sheet
  -    private int  palettepos  = 0;   // hold the position of the palette, if applicable
  +    private int  palettepos  = -1;   // hold the position of the palette, if applicable
   
   
       public void setRecords( List records )
  
  
  

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


Mime
View raw message