poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1343218 [1/3] - in /poi/branches/gsoc2012: src/documentation/content/xdocs/ src/java/org/apache/poi/hssf/model/ src/java/org/apache/poi/hssf/record/ src/testcases/org/apache/poi/hssf/model/ test-data/spreadsheet/
Date Mon, 28 May 2012 12:15:16 GMT
Author: yegor
Date: Mon May 28 12:15:16 2012
New Revision: 1343218

URL: http://svn.apache.org/viewvc?rev=1343218&view=rev
Log:
Bugzilla 53302: fixed EscherAggregate to correctly handle Continue records in drawing blocks

Added:
    poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
    poi/branches/gsoc2012/test-data/spreadsheet/45129.xls   (with props)
    poi/branches/gsoc2012/test-data/spreadsheet/dg-text.xls   (with props)
Modified:
    poi/branches/gsoc2012/src/documentation/content/xdocs/status.xml
    poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java
    poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/EscherAggregate.java

Modified: poi/branches/gsoc2012/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/documentation/content/xdocs/status.xml?rev=1343218&r1=1343217&r2=1343218&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/documentation/content/xdocs/status.xml (original)
+++ poi/branches/gsoc2012/src/documentation/content/xdocs/status.xml Mon May 28 12:15:16 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.9-beta1" date="2012-??-??">
+          <action dev="poi-developers" type="add">53302 - Fixed EscherAggregate to
correctly handle Continue records in drawing blocks  </action>
           <action dev="poi-developers" type="add">53025 - Updatad documentation and
example on using Data Validations  </action>
           <action dev="poi-developers" type="add">53227 - Corrected AddDimensionedImage.java
to support XSSF/SXSSF  </action>
           <action dev="poi-developers" type="add">53058 - Utility for representing
drawings contained in a binary Excel file as a XML tree</action>

Modified: poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java?rev=1343218&r1=1343217&r2=1343218&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java (original)
+++ poi/branches/gsoc2012/src/java/org/apache/poi/hssf/model/InternalSheet.java Mon May 28
12:15:16 2012
@@ -21,43 +21,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.poi.hssf.record.BOFRecord;
-import org.apache.poi.hssf.record.CFHeaderRecord;
-import org.apache.poi.hssf.record.CalcCountRecord;
-import org.apache.poi.hssf.record.CalcModeRecord;
-import org.apache.poi.hssf.record.CellValueRecordInterface;
-import org.apache.poi.hssf.record.ColumnInfoRecord;
-import org.apache.poi.hssf.record.DVALRecord;
-import org.apache.poi.hssf.record.DefaultColWidthRecord;
-import org.apache.poi.hssf.record.DefaultRowHeightRecord;
-import org.apache.poi.hssf.record.DeltaRecord;
-import org.apache.poi.hssf.record.DimensionsRecord;
-import org.apache.poi.hssf.record.DrawingRecord;
-import org.apache.poi.hssf.record.EOFRecord;
-import org.apache.poi.hssf.record.EscherAggregate;
-import org.apache.poi.hssf.record.FeatHdrRecord;
-import org.apache.poi.hssf.record.FeatRecord;
-import org.apache.poi.hssf.record.GridsetRecord;
-import org.apache.poi.hssf.record.GutsRecord;
-import org.apache.poi.hssf.record.IndexRecord;
-import org.apache.poi.hssf.record.IterationRecord;
-import org.apache.poi.hssf.record.MergeCellsRecord;
-import org.apache.poi.hssf.record.NoteRecord;
-import org.apache.poi.hssf.record.ObjRecord;
-import org.apache.poi.hssf.record.PaneRecord;
-import org.apache.poi.hssf.record.PrintGridlinesRecord;
-import org.apache.poi.hssf.record.PrintHeadersRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordBase;
-import org.apache.poi.hssf.record.RefModeRecord;
-import org.apache.poi.hssf.record.RowRecord;
-import org.apache.poi.hssf.record.SCLRecord;
-import org.apache.poi.hssf.record.SaveRecalcRecord;
-import org.apache.poi.hssf.record.SelectionRecord;
-import org.apache.poi.hssf.record.TextObjectRecord;
-import org.apache.poi.hssf.record.UncalcedRecord;
-import org.apache.poi.hssf.record.WSBoolRecord;
-import org.apache.poi.hssf.record.WindowTwoRecord;
+import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.ChartSubstreamRecordAggregate;
 import org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate;
 import org.apache.poi.hssf.record.aggregates.ConditionalFormattingTable;
@@ -1553,6 +1517,14 @@ public final class InternalSheet {
         {
             loc += 2;
             if (records.get( loc ) instanceof NoteRecord) loc ++;
+            while ( loc + 1 < records.size()
+                    && records.get( loc ) instanceof ContinueRecord
+                    && (records.get( loc + 1 ) instanceof ObjRecord ||
+                    records.get( loc + 1 ) instanceof TextObjectRecord) )
+            {
+                loc += 2;
+                if (records.get( loc ) instanceof NoteRecord) loc ++;
+            }
         }
 
         int endloc = loc-1;

Modified: poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/EscherAggregate.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/EscherAggregate.java?rev=1343218&r1=1343217&r2=1343218&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/EscherAggregate.java (original)
+++ poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/EscherAggregate.java Mon May
28 12:15:16 2012
@@ -373,6 +373,13 @@ public final class EscherAggregate exten
 		{
 			dataSize += ( (DrawingRecord) records.get( loc ) ).getData().length;
 			loc += 2;
+            while ( loc + 1 < records.size()
+                    && sid( records, loc ) == ContinueRecord.sid
+                    && isObjectRecord( records, loc + 1 ) )
+            {
+                dataSize += ( (ContinueRecord) records.get( loc ) ).getData().length;
+                loc += 2;
+            }
 		}
 
 		// Create one big buffer
@@ -387,6 +394,15 @@ public final class EscherAggregate exten
 			System.arraycopy( drawingRecord.getData(), 0, buffer, offset, drawingRecord.getData().length
);
 			offset += drawingRecord.getData().length;
 			loc += 2;
+            while ( loc + 1 < records.size()
+                    && sid( records, loc ) == ContinueRecord.sid
+                    && isObjectRecord( records, loc + 1 ) )
+            {
+                ContinueRecord continueRecord = (ContinueRecord) records.get( loc );
+                System.arraycopy( continueRecord.getData(), 0, buffer, offset, continueRecord.getData().length
);
+                offset += continueRecord.getData().length;
+                loc += 2;
+            }
 		}
 
 		// Decode the shapes
@@ -411,6 +427,14 @@ public final class EscherAggregate exten
 			Record objRecord = (Record) records.get( loc + 1 );
 			agg.shapeToObj.put( shapeRecords.get( shapeIndex++ ), objRecord );
 			loc += 2;
+            while ( loc + 1 < records.size()
+                    && sid( records, loc ) == ContinueRecord.sid
+                    && isObjectRecord( records, loc + 1 ) )
+            {
+                objRecord = (Record) records.get( loc + 1 );
+                agg.shapeToObj.put( shapeRecords.get( shapeIndex++ ), objRecord );
+                loc += 2;
+            }
 		}
 
 		return agg;



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


Mime
View raw message