Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645347,645349-645351,645353-645821 via svnmerge from
https://svn.apache.org:443/repos/asf/poi/trunk ........ r645560 | nick | 2008-04-07 16:20:57 +0100 (Mon, 07 Apr 2008) | 1 line Fix 43670, 44501 - Fix how HDGF deals with trailing data in the list of chunk headers ........ r645566 | yegor | 2008-04-07 16:34:53 +0100 (Mon, 07 Apr 2008) | 1 line empty.ppt with the master styles compatible with PPT 2003 ........ r645567 | yegor | 2008-04-07 16:35:49 +0100 (Mon, 07 Apr 2008) | 1 line misc usermodel improvements in HSLF ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@645823 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e35b1d786
commit
1b687abb8d
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<!-- Don't forget to update status.xml too! -->
|
<!-- Don't forget to update status.xml too! -->
|
||||||
<release version="3.0.3-beta1" date="2008-04-??">
|
<release version="3.0.3-beta1" date="2008-04-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">43670, 44501 - Fix how HDGF deals with trailing data in the list of chunk headers</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
|
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
|
<action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
|
<action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
<!-- Don't forget to update changes.xml too! -->
|
<!-- Don't forget to update changes.xml too! -->
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.0.3-beta1" date="2008-04-??">
|
<release version="3.0.3-beta1" date="2008-04-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">43670, 44501 - Fix how HDGF deals with trailing data in the list of chunk headers</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
|
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
|
<action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
|
<action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
|
||||||
|
@ -47,10 +47,32 @@ public abstract class ChunkHeader {
|
|||||||
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 18);
|
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 18);
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
} else if(documentVersion == 5) {
|
} else if(documentVersion == 5 || documentVersion == 4) {
|
||||||
throw new RuntimeException("TODO");
|
ChunkHeaderV4V5 ch = new ChunkHeaderV4V5();
|
||||||
|
|
||||||
|
ch.type = (int)LittleEndian.getShort(data, offset + 0);
|
||||||
|
ch.id = (int)LittleEndian.getShort(data, offset + 2);
|
||||||
|
ch.unknown2 = (short)LittleEndian.getUnsignedByte(data, offset + 4);
|
||||||
|
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 5);
|
||||||
|
ch.unknown1 = (short)LittleEndian.getShort(data, offset + 6);
|
||||||
|
ch.length = (int)LittleEndian.getUInt(data, offset + 8);
|
||||||
|
|
||||||
|
return ch;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Visio files with versions below 5 are not supported, yours was " + documentVersion);
|
throw new IllegalArgumentException("Visio files with versions below 4 are not supported, yours was " + documentVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the size of a chunk header for the given document version.
|
||||||
|
*/
|
||||||
|
public static int getHeaderSize(int documentVersion) {
|
||||||
|
if(documentVersion > 6) {
|
||||||
|
return ChunkHeaderV11.getHeaderSize();
|
||||||
|
} else if(documentVersion == 6) {
|
||||||
|
return ChunkHeaderV6.getHeaderSize();
|
||||||
|
} else {
|
||||||
|
return ChunkHeaderV4V5.getHeaderSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
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.hdgf.chunks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A chunk header from v4 or v5
|
||||||
|
*/
|
||||||
|
public class ChunkHeaderV4V5 extends ChunkHeader {
|
||||||
|
protected short unknown2;
|
||||||
|
protected short unknown3;
|
||||||
|
|
||||||
|
public short getUnknown2() {
|
||||||
|
return unknown2;
|
||||||
|
}
|
||||||
|
public short getUnknown3() {
|
||||||
|
return unknown3;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static int getHeaderSize() {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSizeInBytes() {
|
||||||
|
return getHeaderSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the chunk have a trailer?
|
||||||
|
*/
|
||||||
|
public boolean hasTrailer() {
|
||||||
|
// V4 and V5 never has trailers
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the chunk have a separator?
|
||||||
|
*/
|
||||||
|
public boolean hasSeparator() {
|
||||||
|
// V4 and V5 never has separators
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -30,9 +30,13 @@ public class ChunkHeaderV6 extends ChunkHeader {
|
|||||||
return unknown3;
|
return unknown3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSizeInBytes() {
|
protected static int getHeaderSize() {
|
||||||
|
// Looks like it ought to be 19...
|
||||||
return 19;
|
return 19;
|
||||||
}
|
}
|
||||||
|
public int getSizeInBytes() {
|
||||||
|
return getHeaderSize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the chunk have a trailer?
|
* Does the chunk have a trailer?
|
||||||
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.apache.poi.POITextExtractor;
|
import org.apache.poi.POITextExtractor;
|
||||||
import org.apache.poi.hdgf.HDGFDiagram;
|
import org.apache.poi.hdgf.HDGFDiagram;
|
||||||
|
import org.apache.poi.hdgf.chunks.Chunk;
|
||||||
import org.apache.poi.hdgf.chunks.Chunk.Command;
|
import org.apache.poi.hdgf.chunks.Chunk.Command;
|
||||||
import org.apache.poi.hdgf.streams.ChunkStream;
|
import org.apache.poi.hdgf.streams.ChunkStream;
|
||||||
import org.apache.poi.hdgf.streams.PointerContainingStream;
|
import org.apache.poi.hdgf.streams.PointerContainingStream;
|
||||||
@ -71,11 +72,13 @@ public class VisioTextExtractor extends POITextExtractor {
|
|||||||
if(stream instanceof ChunkStream) {
|
if(stream instanceof ChunkStream) {
|
||||||
ChunkStream cs = (ChunkStream)stream;
|
ChunkStream cs = (ChunkStream)stream;
|
||||||
for(int i=0; i<cs.getChunks().length; i++) {
|
for(int i=0; i<cs.getChunks().length; i++) {
|
||||||
if(cs.getChunks()[i] != null &&
|
Chunk chunk = cs.getChunks()[i];
|
||||||
cs.getChunks()[i].getName() != null &&
|
if(chunk != null &&
|
||||||
cs.getChunks()[i].getName().equals("Text")) {
|
chunk.getName() != null &&
|
||||||
|
chunk.getName().equals("Text") &&
|
||||||
|
chunk.getCommands().length > 0) {
|
||||||
// First command
|
// First command
|
||||||
Command cmd = cs.getChunks()[i].getCommands()[0];
|
Command cmd = chunk.getCommands()[0];
|
||||||
if(cmd != null && cmd.getValue() != null) {
|
if(cmd != null && cmd.getValue() != null) {
|
||||||
text.add( cmd.getValue().toString() );
|
text.add( cmd.getValue().toString() );
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.apache.poi.hdgf.chunks.Chunk;
|
import org.apache.poi.hdgf.chunks.Chunk;
|
||||||
import org.apache.poi.hdgf.chunks.ChunkFactory;
|
import org.apache.poi.hdgf.chunks.ChunkFactory;
|
||||||
|
import org.apache.poi.hdgf.chunks.ChunkHeader;
|
||||||
import org.apache.poi.hdgf.pointers.Pointer;
|
import org.apache.poi.hdgf.pointers.Pointer;
|
||||||
|
|
||||||
public class ChunkStream extends Stream {
|
public class ChunkStream extends Stream {
|
||||||
@ -51,10 +52,17 @@ public class ChunkStream extends Stream {
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
byte[] contents = getStore().getContents();
|
byte[] contents = getStore().getContents();
|
||||||
while(pos < contents.length) {
|
while(pos < contents.length) {
|
||||||
Chunk chunk = chunkFactory.createChunk(contents, pos);
|
// Ensure we have enough data to create a chunk from
|
||||||
chunksA.add(chunk);
|
int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
|
||||||
|
if(pos+headerSize <= contents.length) {
|
||||||
|
Chunk chunk = chunkFactory.createChunk(contents, pos);
|
||||||
|
chunksA.add(chunk);
|
||||||
|
|
||||||
pos += chunk.getOnDiskSize();
|
pos += chunk.getOnDiskSize();
|
||||||
|
} else {
|
||||||
|
System.err.println("Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
|
||||||
|
pos = contents.length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chunks = (Chunk[])chunksA.toArray(new Chunk[chunksA.size()]);
|
chunks = (Chunk[])chunksA.toArray(new Chunk[chunksA.size()]);
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
160
src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
Executable file
160
src/scratchpad/src/org/apache/poi/hslf/model/Polygon.java
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
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.hslf.model;
|
||||||
|
|
||||||
|
import org.apache.poi.ddf.*;
|
||||||
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple closed polygon shape
|
||||||
|
*
|
||||||
|
* @author Yegor Kozlov
|
||||||
|
*/
|
||||||
|
public class Polygon extends AutoShape {
|
||||||
|
/**
|
||||||
|
* Create a Polygon object and initialize it from the supplied Record container.
|
||||||
|
*
|
||||||
|
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
|
||||||
|
* @param parent the parent of the shape
|
||||||
|
*/
|
||||||
|
protected Polygon(EscherContainerRecord escherRecord, Shape parent){
|
||||||
|
super(escherRecord, parent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Polygon. This constructor is used when a new shape is created.
|
||||||
|
*
|
||||||
|
* @param parent the parent of this Shape. For example, if this text box is a cell
|
||||||
|
* in a table then the parent is Table.
|
||||||
|
*/
|
||||||
|
public Polygon(Shape parent){
|
||||||
|
super(null, parent);
|
||||||
|
_escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Polygon. This constructor is used when a new shape is created.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Polygon(){
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the polygon vertices
|
||||||
|
*
|
||||||
|
* @param xPoints
|
||||||
|
* @param yPoints
|
||||||
|
*/
|
||||||
|
public void setPoints(float[] xPoints, float[] yPoints)
|
||||||
|
{
|
||||||
|
float right = findBiggest(xPoints);
|
||||||
|
float bottom = findBiggest(yPoints);
|
||||||
|
float left = findSmallest(xPoints);
|
||||||
|
float top = findSmallest(yPoints);
|
||||||
|
|
||||||
|
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
||||||
|
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, (int)((right - left)*POINT_DPI/MASTER_DPI)));
|
||||||
|
opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, (int)((bottom - top)*POINT_DPI/MASTER_DPI)));
|
||||||
|
|
||||||
|
for (int i = 0; i < xPoints.length; i++) {
|
||||||
|
xPoints[i] += -left;
|
||||||
|
yPoints[i] += -top;
|
||||||
|
}
|
||||||
|
|
||||||
|
int numpoints = xPoints.length;
|
||||||
|
|
||||||
|
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0] );
|
||||||
|
verticesProp.setNumberOfElementsInArray(numpoints+1);
|
||||||
|
verticesProp.setNumberOfElementsInMemory(numpoints+1);
|
||||||
|
verticesProp.setSizeOfElements(0xFFF0);
|
||||||
|
for (int i = 0; i < numpoints; i++)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[4];
|
||||||
|
LittleEndian.putShort(data, 0, (short)(xPoints[i]*POINT_DPI/MASTER_DPI));
|
||||||
|
LittleEndian.putShort(data, 2, (short)(yPoints[i]*POINT_DPI/MASTER_DPI));
|
||||||
|
verticesProp.setElement(i, data);
|
||||||
|
}
|
||||||
|
byte[] data = new byte[4];
|
||||||
|
LittleEndian.putShort(data, 0, (short)(xPoints[0]*POINT_DPI/MASTER_DPI));
|
||||||
|
LittleEndian.putShort(data, 2, (short)(yPoints[0]*POINT_DPI/MASTER_DPI));
|
||||||
|
verticesProp.setElement(numpoints, data);
|
||||||
|
opt.addEscherProperty(verticesProp);
|
||||||
|
|
||||||
|
EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherProperties.GEOMETRY__SEGMENTINFO, false, null );
|
||||||
|
segmentsProp.setSizeOfElements(0x0002);
|
||||||
|
segmentsProp.setNumberOfElementsInArray(numpoints * 2 + 4);
|
||||||
|
segmentsProp.setNumberOfElementsInMemory(numpoints * 2 + 4);
|
||||||
|
segmentsProp.setElement(0, new byte[] { (byte)0x00, (byte)0x40 } );
|
||||||
|
segmentsProp.setElement(1, new byte[] { (byte)0x00, (byte)0xAC } );
|
||||||
|
for (int i = 0; i < numpoints; i++)
|
||||||
|
{
|
||||||
|
segmentsProp.setElement(2 + i * 2, new byte[] { (byte)0x01, (byte)0x00 } );
|
||||||
|
segmentsProp.setElement(3 + i * 2, new byte[] { (byte)0x00, (byte)0xAC } );
|
||||||
|
}
|
||||||
|
segmentsProp.setElement(segmentsProp.getNumberOfElementsInArray() - 2, new byte[] { (byte)0x01, (byte)0x60 } );
|
||||||
|
segmentsProp.setElement(segmentsProp.getNumberOfElementsInArray() - 1, new byte[] { (byte)0x00, (byte)0x80 } );
|
||||||
|
opt.addEscherProperty(segmentsProp);
|
||||||
|
|
||||||
|
opt.sortProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the polygon vertices
|
||||||
|
*
|
||||||
|
* @param points the polygon vertices
|
||||||
|
*/
|
||||||
|
public void setPoints(Point2D[] points)
|
||||||
|
{
|
||||||
|
float[] xpoints = new float[points.length];
|
||||||
|
float[] ypoints = new float[points.length];
|
||||||
|
for (int i = 0; i < points.length; i++) {
|
||||||
|
xpoints[i] = (float)points[i].getX();
|
||||||
|
ypoints[i] = (float)points[i].getY();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setPoints(xpoints, ypoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float findBiggest( float[] values )
|
||||||
|
{
|
||||||
|
float result = Float.MIN_VALUE;
|
||||||
|
for ( int i = 0; i < values.length; i++ )
|
||||||
|
{
|
||||||
|
if (values[i] > result)
|
||||||
|
result = values[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float findSmallest( float[] values )
|
||||||
|
{
|
||||||
|
float result = Float.MAX_VALUE;
|
||||||
|
for ( int i = 0; i < values.length; i++ )
|
||||||
|
{
|
||||||
|
if (values[i] < result)
|
||||||
|
result = values[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -24,6 +24,7 @@ import org.apache.poi.util.POILogFactory;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -143,24 +144,39 @@ public abstract class Shape {
|
|||||||
* @return the anchor of this shape
|
* @return the anchor of this shape
|
||||||
*/
|
*/
|
||||||
public java.awt.Rectangle getAnchor(){
|
public java.awt.Rectangle getAnchor(){
|
||||||
|
Rectangle2D anchor2d = getAnchor2D();
|
||||||
|
return anchor2d.getBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the anchor (the bounding box rectangle) of this shape.
|
||||||
|
* All coordinates are expressed in points (72 dpi).
|
||||||
|
*
|
||||||
|
* @return the anchor of this shape
|
||||||
|
*/
|
||||||
|
public Rectangle2D getAnchor2D(){
|
||||||
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
|
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
|
||||||
int flags = spRecord.getFlags();
|
int flags = spRecord.getFlags();
|
||||||
java.awt.Rectangle anchor=null;
|
Rectangle2D anchor=null;
|
||||||
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
|
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
|
||||||
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
|
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
|
||||||
anchor = new java.awt.Rectangle();
|
anchor = new java.awt.Rectangle();
|
||||||
anchor.x = rec.getDx1()*POINT_DPI/MASTER_DPI;
|
anchor = new Rectangle2D.Float(
|
||||||
anchor.y = rec.getDy1()*POINT_DPI/MASTER_DPI;
|
(float)rec.getDx1()*POINT_DPI/MASTER_DPI,
|
||||||
anchor.width = rec.getDx2()*POINT_DPI/MASTER_DPI - anchor.x;
|
(float)rec.getDy1()*POINT_DPI/MASTER_DPI,
|
||||||
anchor.height = rec.getDy2()*POINT_DPI/MASTER_DPI - anchor.y;
|
(float)(rec.getDx2()-rec.getDx1())*POINT_DPI/MASTER_DPI,
|
||||||
|
(float)(rec.getDy2()-rec.getDy1())*POINT_DPI/MASTER_DPI
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
|
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
|
||||||
anchor = new java.awt.Rectangle();
|
anchor = new java.awt.Rectangle();
|
||||||
anchor.y = rec.getFlag()*POINT_DPI/MASTER_DPI;
|
anchor = new Rectangle2D.Float(
|
||||||
anchor.x = rec.getCol1()*POINT_DPI/MASTER_DPI;
|
(float)rec.getCol1()*POINT_DPI/MASTER_DPI,
|
||||||
anchor.width = (rec.getDx1() - rec.getCol1())*POINT_DPI/MASTER_DPI;
|
(float)rec.getFlag()*POINT_DPI/MASTER_DPI,
|
||||||
anchor.height = (rec.getRow1() - rec.getFlag())*POINT_DPI/MASTER_DPI;
|
(float)(rec.getDx1()-rec.getCol1())*POINT_DPI/MASTER_DPI,
|
||||||
|
(float)(rec.getRow1()-rec.getFlag())*POINT_DPI/MASTER_DPI
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return anchor;
|
return anchor;
|
||||||
}
|
}
|
||||||
@ -171,22 +187,22 @@ public abstract class Shape {
|
|||||||
*
|
*
|
||||||
* @param anchor new anchor
|
* @param anchor new anchor
|
||||||
*/
|
*/
|
||||||
public void setAnchor(java.awt.Rectangle anchor){
|
public void setAnchor(Rectangle2D anchor){
|
||||||
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
|
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
|
||||||
int flags = spRecord.getFlags();
|
int flags = spRecord.getFlags();
|
||||||
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
|
if ((flags & EscherSpRecord.FLAG_CHILD) != 0){
|
||||||
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
|
EscherChildAnchorRecord rec = (EscherChildAnchorRecord)getEscherChild(_escherContainer, EscherChildAnchorRecord.RECORD_ID);
|
||||||
rec.setDx1(anchor.x*MASTER_DPI/POINT_DPI);
|
rec.setDx1((int)(anchor.getX()*MASTER_DPI/POINT_DPI));
|
||||||
rec.setDy1(anchor.y*MASTER_DPI/POINT_DPI);
|
rec.setDy1((int)(anchor.getY()*MASTER_DPI/POINT_DPI));
|
||||||
rec.setDx2((anchor.width + anchor.x)*MASTER_DPI/POINT_DPI);
|
rec.setDx2((int)((anchor.getWidth() + anchor.getX())*MASTER_DPI/POINT_DPI));
|
||||||
rec.setDy2((anchor.height + anchor.y)*MASTER_DPI/POINT_DPI);
|
rec.setDy2((int)((anchor.getHeight() + anchor.getY())*MASTER_DPI/POINT_DPI));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
|
EscherClientAnchorRecord rec = (EscherClientAnchorRecord)getEscherChild(_escherContainer, EscherClientAnchorRecord.RECORD_ID);
|
||||||
rec.setFlag((short)(anchor.y*MASTER_DPI/POINT_DPI));
|
rec.setFlag((short)(anchor.getY()*MASTER_DPI/POINT_DPI));
|
||||||
rec.setCol1((short)(anchor.x*MASTER_DPI/POINT_DPI));
|
rec.setCol1((short)(anchor.getX()*MASTER_DPI/POINT_DPI));
|
||||||
rec.setDx1((short)((anchor.width + anchor.x)*MASTER_DPI/POINT_DPI));
|
rec.setDx1((short)(((anchor.getWidth() + anchor.getX())*MASTER_DPI/POINT_DPI)));
|
||||||
rec.setRow1((short)((anchor.height + anchor.y)*MASTER_DPI/POINT_DPI));
|
rec.setRow1((short)(((anchor.getHeight() + anchor.getY())*MASTER_DPI/POINT_DPI)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -197,9 +213,9 @@ public abstract class Shape {
|
|||||||
* @param x the x coordinate of the top left corner of the shape
|
* @param x the x coordinate of the top left corner of the shape
|
||||||
* @param y the y coordinate of the top left corner of the shape
|
* @param y the y coordinate of the top left corner of the shape
|
||||||
*/
|
*/
|
||||||
public void moveTo(int x, int y){
|
public void moveTo(float x, float y){
|
||||||
java.awt.Rectangle anchor = getAnchor();
|
Rectangle2D anchor = getAnchor2D();
|
||||||
anchor.setLocation(x, y);
|
anchor.setRect(x, y, anchor.getWidth(), anchor.getHeight());
|
||||||
setAnchor(anchor);
|
setAnchor(anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +270,28 @@ public abstract class Shape {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an simple escher property for this shape.
|
||||||
|
*
|
||||||
|
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
|
||||||
|
* @param value value of the property. If value = -1 then the property is removed.
|
||||||
|
*/
|
||||||
|
public void setEscherProperty(short propId, int value){
|
||||||
|
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
||||||
|
setEscherProperty(opt, propId, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of a simple escher property for this shape.
|
||||||
|
*
|
||||||
|
* @param propId The id of the property. One of the constants defined in EscherOptRecord.
|
||||||
|
*/
|
||||||
|
public int getEscherProperty(short propId){
|
||||||
|
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
||||||
|
EscherSimpleProperty prop = (EscherSimpleProperty)getEscherProperty(opt, propId);
|
||||||
|
return prop == null ? 0 : prop.getPropertyNumber();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The shape container and it's children that can represent this
|
* @return The shape container and it's children that can represent this
|
||||||
* shape.
|
* shape.
|
||||||
|
@ -22,6 +22,7 @@ import org.apache.poi.util.POILogger;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a group of shapes.
|
* Represents a group of shapes.
|
||||||
@ -186,16 +187,16 @@ public class ShapeGroup extends Shape{
|
|||||||
*
|
*
|
||||||
* @return the anchor of this shape group
|
* @return the anchor of this shape group
|
||||||
*/
|
*/
|
||||||
public java.awt.Rectangle getAnchor(){
|
public Rectangle2D getAnchor2D(){
|
||||||
EscherContainerRecord groupInfoContainer = (EscherContainerRecord)_escherContainer.getChild(0);
|
EscherContainerRecord groupInfoContainer = (EscherContainerRecord)_escherContainer.getChild(0);
|
||||||
EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(groupInfoContainer, EscherSpgrRecord.RECORD_ID);
|
EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(groupInfoContainer, EscherSpgrRecord.RECORD_ID);
|
||||||
java.awt.Rectangle anchor=null;
|
Rectangle2D anchor = new Rectangle2D.Float(
|
||||||
|
(float)spgr.getRectX1()*POINT_DPI/MASTER_DPI,
|
||||||
|
(float)spgr.getRectY1()*POINT_DPI/MASTER_DPI,
|
||||||
|
(float)(spgr.getRectX2() - spgr.getRectX1())*POINT_DPI/MASTER_DPI,
|
||||||
|
(float)(spgr.getRectY2() - spgr.getRectY1())*POINT_DPI/MASTER_DPI
|
||||||
|
);
|
||||||
|
|
||||||
anchor = new java.awt.Rectangle();
|
|
||||||
anchor.x = spgr.getRectX1()*POINT_DPI/MASTER_DPI;
|
|
||||||
anchor.y = spgr.getRectY1()*POINT_DPI/MASTER_DPI;
|
|
||||||
anchor.width = (spgr.getRectX2() - spgr.getRectX1())*POINT_DPI/MASTER_DPI;
|
|
||||||
anchor.height = (spgr.getRectY2() - spgr.getRectY1())*POINT_DPI/MASTER_DPI;
|
|
||||||
return anchor;
|
return anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,13 @@ public class SimpleShape extends Shape {
|
|||||||
*/
|
*/
|
||||||
public void setLineColor(Color color){
|
public void setLineColor(Color color){
|
||||||
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
||||||
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
if (color == null) {
|
||||||
setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, rgb);
|
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80000);
|
||||||
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, color == null ? 0x180010 : 0x180018);
|
} else {
|
||||||
|
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
||||||
|
setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, rgb);
|
||||||
|
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, color == null ? 0x180010 : 0x180018);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -212,9 +216,13 @@ public class SimpleShape extends Shape {
|
|||||||
*/
|
*/
|
||||||
public void setFillColor(Color color){
|
public void setFillColor(Color color){
|
||||||
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
|
||||||
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
if(color == null) {
|
||||||
setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
|
setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150000);
|
||||||
setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, color == null ? 0x150010 : 0x150011);
|
} else {
|
||||||
|
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
||||||
|
setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
|
||||||
|
setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150011);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
src/scratchpad/testcases/org/apache/poi/hdgf/data/44594-2.vsd
Normal file
BIN
src/scratchpad/testcases/org/apache/poi/hdgf/data/44594-2.vsd
Normal file
Binary file not shown.
BIN
src/scratchpad/testcases/org/apache/poi/hdgf/data/44594.vsd
Normal file
BIN
src/scratchpad/testcases/org/apache/poi/hdgf/data/44594.vsd
Normal file
Binary file not shown.
@ -17,25 +17,21 @@
|
|||||||
package org.apache.poi.hdgf.extractor;
|
package org.apache.poi.hdgf.extractor;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.poi.hdgf.HDGFDiagram;
|
import org.apache.poi.hdgf.HDGFDiagram;
|
||||||
import org.apache.poi.hdgf.chunks.Chunk;
|
|
||||||
import org.apache.poi.hdgf.chunks.ChunkFactory;
|
|
||||||
import org.apache.poi.hdgf.pointers.Pointer;
|
|
||||||
import org.apache.poi.hdgf.pointers.PointerFactory;
|
|
||||||
import org.apache.poi.hssf.record.formula.eval.StringOperationEval;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
|
||||||
public class TestVisioExtractor extends TestCase {
|
public class TestVisioExtractor extends TestCase {
|
||||||
private String filename;
|
private String dirname;
|
||||||
|
private String defFilename;
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
String dirname = System.getProperty("HDGF.testdata.path");
|
dirname = System.getProperty("HDGF.testdata.path");
|
||||||
filename = dirname + "/Test_Visio-Some_Random_Text.vsd";
|
defFilename = dirname + "/Test_Visio-Some_Random_Text.vsd";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,14 +40,14 @@ public class TestVisioExtractor extends TestCase {
|
|||||||
public void testCreation() throws Exception {
|
public void testCreation() throws Exception {
|
||||||
VisioTextExtractor extractor;
|
VisioTextExtractor extractor;
|
||||||
|
|
||||||
extractor = new VisioTextExtractor(new FileInputStream(filename));
|
extractor = new VisioTextExtractor(new FileInputStream(defFilename));
|
||||||
assertNotNull(extractor);
|
assertNotNull(extractor);
|
||||||
assertNotNull(extractor.getAllText());
|
assertNotNull(extractor.getAllText());
|
||||||
assertEquals(3, extractor.getAllText().length);
|
assertEquals(3, extractor.getAllText().length);
|
||||||
|
|
||||||
extractor = new VisioTextExtractor(
|
extractor = new VisioTextExtractor(
|
||||||
new POIFSFileSystem(
|
new POIFSFileSystem(
|
||||||
new FileInputStream(filename)
|
new FileInputStream(defFilename)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assertNotNull(extractor);
|
assertNotNull(extractor);
|
||||||
@ -61,7 +57,7 @@ public class TestVisioExtractor extends TestCase {
|
|||||||
extractor = new VisioTextExtractor(
|
extractor = new VisioTextExtractor(
|
||||||
new HDGFDiagram(
|
new HDGFDiagram(
|
||||||
new POIFSFileSystem(
|
new POIFSFileSystem(
|
||||||
new FileInputStream(filename)
|
new FileInputStream(defFilename)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -72,7 +68,7 @@ public class TestVisioExtractor extends TestCase {
|
|||||||
|
|
||||||
public void testExtraction() throws Exception {
|
public void testExtraction() throws Exception {
|
||||||
VisioTextExtractor extractor =
|
VisioTextExtractor extractor =
|
||||||
new VisioTextExtractor(new FileInputStream(filename));
|
new VisioTextExtractor(new FileInputStream(defFilename));
|
||||||
|
|
||||||
// Check the array fetch
|
// Check the array fetch
|
||||||
String[] text = extractor.getAllText();
|
String[] text = extractor.getAllText();
|
||||||
@ -88,13 +84,30 @@ public class TestVisioExtractor extends TestCase {
|
|||||||
assertEquals("Test View\nI am a test view\nSome random text, on a page\n", textS);
|
assertEquals("Test View\nI am a test view\nSome random text, on a page\n", textS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testProblemFiles() throws Exception {
|
||||||
|
File a = new File(dirname, "44594.vsd");
|
||||||
|
VisioTextExtractor.main(new String[] {a.toString()});
|
||||||
|
|
||||||
|
File b = new File(dirname, "44594-2.vsd");
|
||||||
|
VisioTextExtractor.main(new String[] {b.toString()});
|
||||||
|
|
||||||
|
File c = new File(dirname, "ShortChunk1.vsd");
|
||||||
|
VisioTextExtractor.main(new String[] {c.toString()});
|
||||||
|
|
||||||
|
File d = new File(dirname, "ShortChunk2.vsd");
|
||||||
|
VisioTextExtractor.main(new String[] {d.toString()});
|
||||||
|
|
||||||
|
File e = new File(dirname, "ShortChunk3.vsd");
|
||||||
|
VisioTextExtractor.main(new String[] {e.toString()});
|
||||||
|
}
|
||||||
|
|
||||||
public void testMain() throws Exception {
|
public void testMain() throws Exception {
|
||||||
PrintStream oldOut = System.out;
|
PrintStream oldOut = System.out;
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
PrintStream capture = new PrintStream(baos);
|
PrintStream capture = new PrintStream(baos);
|
||||||
System.setOut(capture);
|
System.setOut(capture);
|
||||||
|
|
||||||
VisioTextExtractor.main(new String[] {filename});
|
VisioTextExtractor.main(new String[] {defFilename});
|
||||||
|
|
||||||
// Put things back
|
// Put things back
|
||||||
System.setOut(oldOut);
|
System.setOut(oldOut);
|
||||||
|
@ -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.hdgf.streams;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
import org.apache.poi.hdgf.HDGFDiagram;
|
||||||
|
import org.apache.poi.hdgf.chunks.ChunkFactory;
|
||||||
|
import org.apache.poi.hdgf.pointers.Pointer;
|
||||||
|
import org.apache.poi.hdgf.pointers.PointerFactory;
|
||||||
|
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||||
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for bugs with streams
|
||||||
|
*/
|
||||||
|
public class TestStreamBugs extends StreamTest {
|
||||||
|
private byte[] contents;
|
||||||
|
private ChunkFactory chunkFactory;
|
||||||
|
private PointerFactory ptrFactory;
|
||||||
|
private POIFSFileSystem filesystem;
|
||||||
|
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
String dirname = System.getProperty("HDGF.testdata.path");
|
||||||
|
String filename = dirname + "/44594.vsd";
|
||||||
|
ptrFactory = new PointerFactory(11);
|
||||||
|
chunkFactory = new ChunkFactory(11);
|
||||||
|
|
||||||
|
FileInputStream fin = new FileInputStream(filename);
|
||||||
|
filesystem = new POIFSFileSystem(fin);
|
||||||
|
|
||||||
|
DocumentEntry docProps =
|
||||||
|
(DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");
|
||||||
|
|
||||||
|
// Grab the document stream
|
||||||
|
contents = new byte[docProps.getSize()];
|
||||||
|
filesystem.createDocumentInputStream("VisioDocument").read(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetTrailer() throws Exception {
|
||||||
|
Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
|
||||||
|
Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TOIMPLEMENTtestGetCertainChunks() throws Exception {
|
||||||
|
int offsetA = 3708;
|
||||||
|
int offsetB = 3744;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetChildren() throws Exception {
|
||||||
|
Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
|
||||||
|
TrailerStream trailer = (TrailerStream)
|
||||||
|
Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);
|
||||||
|
|
||||||
|
// Get without recursing
|
||||||
|
Pointer[] ptrs = trailer.getChildPointers();
|
||||||
|
for(int i=0; i<ptrs.length; i++) {
|
||||||
|
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get with recursing into chunks
|
||||||
|
for(int i=0; i<ptrs.length; i++) {
|
||||||
|
Stream stream =
|
||||||
|
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||||
|
if(stream instanceof ChunkStream) {
|
||||||
|
ChunkStream cStream = (ChunkStream)stream;
|
||||||
|
cStream.findChunks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get with recursing into chunks and pointers
|
||||||
|
for(int i=0; i<ptrs.length; i++) {
|
||||||
|
Stream stream =
|
||||||
|
Stream.createStream(ptrs[i], contents, chunkFactory, ptrFactory);
|
||||||
|
if(stream instanceof PointerContainingStream) {
|
||||||
|
PointerContainingStream pStream =
|
||||||
|
(PointerContainingStream)stream;
|
||||||
|
pStream.findChildren(contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trailer.findChildren(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testOpen() throws Exception {
|
||||||
|
HDGFDiagram dg = new HDGFDiagram(filesystem);
|
||||||
|
}
|
||||||
|
}
|
@ -98,7 +98,7 @@ public class TestTxMasterStyleAtom extends TestCase {
|
|||||||
assertEquals(0, prop.getValue());
|
assertEquals(0, prop.getValue());
|
||||||
|
|
||||||
prop = props.findByName("font.size");
|
prop = props.findByName("font.size");
|
||||||
assertEquals(49, prop.getValue());
|
assertEquals(44, prop.getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ public class TestTxMasterStyleAtom extends TestCase {
|
|||||||
assertEquals(0, prop.getValue());
|
assertEquals(0, prop.getValue());
|
||||||
|
|
||||||
prop = props.findByName("font.size");
|
prop = props.findByName("font.size");
|
||||||
assertEquals(36, prop.getValue());
|
assertEquals(32, prop.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +164,7 @@ public class TestTxMasterStyleAtom extends TestCase {
|
|||||||
assertEquals(0, prop.getValue());
|
assertEquals(0, prop.getValue());
|
||||||
|
|
||||||
prop = props.findByName("font.size");
|
prop = props.findByName("font.size");
|
||||||
assertEquals(24, prop.getValue());
|
assertEquals(18, prop.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user