You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by vi...@apache.org on 2015/10/19 07:59:38 UTC

svn commit: r1709355 [1/4] - in /poi/trunk/src/ooxml: java/org/apache/poi/xdgf/exceptions/ java/org/apache/poi/xdgf/geom/ java/org/apache/poi/xdgf/usermodel/ java/org/apache/poi/xdgf/usermodel/section/ java/org/apache/poi/xdgf/usermodel/section/geometr...

Author: virtuald
Date: Mon Oct 19 05:59:37 2015
New Revision: 1709355

URL: http://svn.apache.org/viewvc?rev=1709355&view=rev
Log:
poi-visio import: reformat code to fit project standards, remove JRE 7isms

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/exceptions/XDGFException.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineCollector.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineRenderer.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFConnection.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFDocument.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMaster.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageSheet.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFRelation.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFSheet.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFStyleSheet.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFText.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CharacterSection.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/GenericSection.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/GeometrySection.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/XDGFSection.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/ArcTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/Ellipse.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/EllipticalArcTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRow.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/GeometryRowFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/InfiniteLine.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/LineTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/MoveTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/NURBSTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/PolyLineTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelCubBezTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelEllipticalArcTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelLineTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelMoveTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/RelQuadBezTo.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineKnot.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/geometry/SplineStart.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeDataAcceptor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeDebuggerRenderer.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeRenderer.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeVisitor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeVisitorAcceptor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/exceptions/StopVisiting.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/exceptions/StopVisitingThisBranch.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/ObjectFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/Util.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.java
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/xml/XDGFXMLDocumentPart.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xdgf/usermodel/section/CombinedIteratorTest.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/exceptions/XDGFException.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/exceptions/XDGFException.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/exceptions/XDGFException.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/exceptions/XDGFException.java Mon Oct 19 05:59:37 2015
@@ -22,29 +22,32 @@ import org.apache.poi.POIXMLException;
 
 public class XDGFException {
 
-	/**
-	 * Creates an error message to be thrown
-	 */
-	public static POIXMLException error(String message, Object o) {
-		return new POIXMLException(o.toString() + ": " + message);
-	}
-	
-	public static POIXMLException error(String message, Object o, Throwable t) {
-		return new POIXMLException(o.toString() + ": " + message, t);
-	}
-	
-	//
-	// Use these to wrap error messages coming up so that we have at least
-	// some idea where the error was located
-	//
-
-	public static POIXMLException wrap(POIXMLDocumentPart part, POIXMLException e) {
-		return new POIXMLException(part.getPackagePart().getPartName().toString() + ": " + e.getMessage(),
-								  e.getCause() == null ? e : e.getCause());
-	}
-	
-	public static POIXMLException wrap(String where, POIXMLException e) {
-		return new POIXMLException(where + ": " + e.getMessage(),
-								  e.getCause() == null ? e : e.getCause());
-	}
+    /**
+     * Creates an error message to be thrown
+     */
+    public static POIXMLException error(String message, Object o) {
+        return new POIXMLException(o.toString() + ": " + message);
+    }
+
+    public static POIXMLException error(String message, Object o, Throwable t) {
+        return new POIXMLException(o.toString() + ": " + message, t);
+    }
+
+    //
+    // Use these to wrap error messages coming up so that we have at least
+    // some idea where the error was located
+    //
+
+    public static POIXMLException wrap(POIXMLDocumentPart part,
+            POIXMLException e) {
+        return new POIXMLException(part.getPackagePart().getPartName()
+                .toString()
+                + ": " + e.getMessage(), e.getCause() == null ? e
+                        : e.getCause());
+    }
+
+    public static POIXMLException wrap(String where, POIXMLException e) {
+        return new POIXMLException(where + ": " + e.getMessage(),
+                e.getCause() == null ? e : e.getCause());
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java Mon Oct 19 05:59:37 2015
@@ -21,53 +21,53 @@ import java.awt.geom.Dimension2D;
 
 public class Dimension2dDouble extends Dimension2D {
 
-	double width;
-	double height;
-	
-	public Dimension2dDouble() {
-		width = 0d;
-		height = 0d;
-	}
-	
-	public Dimension2dDouble(double width, double height) {
-		this.width = width;
-		this.height = height;
-	}
-	
-	@Override
-	public double getWidth() {
-		return width;
-	}
-
-	@Override
-	public double getHeight() {
-		return height;
-	}
-
-	@Override
-	public void setSize(double width, double height) {
-		this.width = width;
-		this.height = height;
-	}
-	
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof Dimension2dDouble) {
-			Dimension2dDouble other = (Dimension2dDouble)obj;
-			return width == other.width && height == other.height;
-		}
-		
-		return false;
-	}
-	
-	@Override
-	public int hashCode() {
-		double sum = width + height;
-        return (int)Math.ceil(sum * (sum + 1)/2 + width);
-	}
-	
-	@Override
-	public String toString() {
-		return "Dimension2dDouble[" + width + ", " + height + "]";
-	}
+    double width;
+    double height;
+
+    public Dimension2dDouble() {
+        width = 0d;
+        height = 0d;
+    }
+
+    public Dimension2dDouble(double width, double height) {
+        this.width = width;
+        this.height = height;
+    }
+
+    @Override
+    public double getWidth() {
+        return width;
+    }
+
+    @Override
+    public double getHeight() {
+        return height;
+    }
+
+    @Override
+    public void setSize(double width, double height) {
+        this.width = width;
+        this.height = height;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof Dimension2dDouble) {
+            Dimension2dDouble other = (Dimension2dDouble) obj;
+            return width == other.width && height == other.height;
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        double sum = width + height;
+        return (int) Math.ceil(sum * (sum + 1) / 2 + width);
+    }
+
+    @Override
+    public String toString() {
+        return "Dimension2dDouble[" + width + ", " + height + "]";
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineCollector.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineCollector.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineCollector.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineCollector.java Mon Oct 19 05:59:37 2015
@@ -20,60 +20,56 @@ package org.apache.poi.xdgf.geom;
 import java.awt.geom.Point2D;
 import java.util.ArrayList;
 
+import org.apache.poi.ss.formula.functions.LookupUtils.ValueVector;
 import org.apache.poi.xdgf.usermodel.XDGFShape;
 import org.apache.poi.xdgf.usermodel.section.geometry.SplineKnot;
 import org.apache.poi.xdgf.usermodel.section.geometry.SplineStart;
 
-import com.graphbuilder.curve.ControlPath;
-import com.graphbuilder.curve.ShapeMultiPath;
-import com.graphbuilder.curve.ValueVector;
-import com.graphbuilder.geom.PointFactory;
-
 public class SplineCollector {
 
-	SplineStart _start;
-	ArrayList<SplineKnot> _knots = new ArrayList<>();
+    SplineStart _start;
+    ArrayList<SplineKnot> _knots = new ArrayList<SplineKnot>();
+
+    public SplineCollector(SplineStart start) {
+        _start = start;
+    }
+
+    public void addKnot(SplineKnot knot) {
+        if (!knot.getDel())
+            _knots.add(knot);
+    }
+
+    public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) {
+        // ok, we have the start, and all knots... do something with this
+
+        Point2D last = path.getCurrentPoint();
+
+        // create a control path and knots
+        ControlPath controlPath = new ControlPath();
+        ValueVector knots = new ValueVector(_knots.size() + 3);
+
+        double firstKnot = _start.getB();
+        double lastKnot = _start.getC();
+        int degree = _start.getD();
+
+        // first/second knot
+        knots.add(firstKnot);
+        knots.add(_start.getA());
+
+        // first/second control point
+        controlPath.addPoint(PointFactory.create(last.getX(), last.getY()));
+        controlPath.addPoint(PointFactory.create(_start.getX(), _start.getY()));
+
+        // middle knots/control points
+        for (SplineKnot knot: _knots) {
+            knots.add(knot.getA());
+            controlPath.addPoint(PointFactory.create(knot.getX(), knot.getY()));
+        }
+
+        // last knot
+        knots.add(lastKnot);
 
-	public SplineCollector(SplineStart start) {
-		_start = start;
-	}
-	
-	public void addKnot(SplineKnot knot) {
-		if (!knot.getDel())
-			_knots.add(knot);
-	}
-	
-	public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) {
-		// ok, we have the start, and all knots... do something with this
-		
-		Point2D last = path.getCurrentPoint();
-		
-		// create a control path and knots
-		ControlPath controlPath = new ControlPath();
-		ValueVector knots = new ValueVector(_knots.size() + 3);
-		
-		double firstKnot = _start.getB();
-		double lastKnot = _start.getC();
-		int degree = _start.getD();
-		
-		// first/second knot
-		knots.add(firstKnot);
-		knots.add(_start.getA());
-		
-		// first/second control point
-		controlPath.addPoint(PointFactory.create(last.getX(), last.getY()));
-		controlPath.addPoint(PointFactory.create(_start.getX(), _start.getY()));
-		
-		// middle knots/control points
-		for (SplineKnot knot: _knots) {
-			knots.add(knot.getA());
-			controlPath.addPoint(PointFactory.create(knot.getX(), knot.getY()));
-		}
-		
-		// last knot
-		knots.add(lastKnot);
-		
-		ShapeMultiPath shape = SplineRenderer.createNurbsSpline(controlPath, knots, null, degree);
-		path.append(shape, true);
-	}
+        ShapeMultiPath shape = SplineRenderer.createNurbsSpline(controlPath, knots, null, degree);
+        path.append(shape, true);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineRenderer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineRenderer.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineRenderer.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/geom/SplineRenderer.java Mon Oct 19 05:59:37 2015
@@ -17,52 +17,46 @@
 
 package org.apache.poi.xdgf.geom;
 
-import com.graphbuilder.curve.ControlPath;
-import com.graphbuilder.curve.GroupIterator;
-import com.graphbuilder.curve.NURBSpline;
-import com.graphbuilder.curve.ShapeMultiPath;
-import com.graphbuilder.curve.ValueVector;
+import org.apache.poi.ss.formula.functions.LookupUtils.ValueVector;
 
 public class SplineRenderer {
 
-	public static ShapeMultiPath createNurbsSpline(ControlPath controlPoints,
-			 									   ValueVector knots,
-			 									   ValueVector weights,
-			 									   int degree) {
-		
-		double firstKnot = knots.get(0);
-		double lastKnot = knots.get(knots.size()-1);
-		
-		// scale knots to [0, 1] based on first/last knots
-		for (int i = 0; i < knots.size(); i++) {
-			knots.set((knots.get(i) - firstKnot)/lastKnot, i);
-		}
-		
-		// if we don't have enough knots, duplicate the last knot until we do
-		for (int i = knots.size(); i < controlPoints.numPoints() + degree + 1; i++) {
-			knots.add(1);
-		}
-		
-		GroupIterator gi = new GroupIterator("0:n-1", controlPoints.numPoints());
-		
-		NURBSpline spline = new NURBSpline(controlPoints, gi);
-		
-		spline.setDegree(degree);
-		spline.setKnotVectorType(NURBSpline.NON_UNIFORM);
-		spline.setKnotVector(knots);
-		
-		if (weights == null) {
-			spline.setUseWeightVector(false);
-		} else {
-			spline.setWeightVector(weights);
-		}
-		
-		// now that this is done, add it to the path
-		ShapeMultiPath shape = new ShapeMultiPath();
-		shape.setFlatness(0.01);
-		
-		spline.appendTo(shape);
-		return shape;
-	}
-	
+    public static ShapeMultiPath createNurbsSpline(ControlPath controlPoints,
+            ValueVector knots, ValueVector weights, int degree) {
+
+        double firstKnot = knots.get(0);
+        double lastKnot = knots.get(knots.size() - 1);
+
+        // scale knots to [0, 1] based on first/last knots
+        for (int i = 0; i < knots.size(); i++) {
+            knots.set((knots.get(i) - firstKnot) / lastKnot, i);
+        }
+
+        // if we don't have enough knots, duplicate the last knot until we do
+        for (int i = knots.size(); i < controlPoints.numPoints() + degree + 1; i++) {
+            knots.add(1);
+        }
+
+        GroupIterator gi = new GroupIterator("0:n-1", controlPoints.numPoints());
+
+        NURBSpline spline = new NURBSpline(controlPoints, gi);
+
+        spline.setDegree(degree);
+        spline.setKnotVectorType(NURBSpline.NON_UNIFORM);
+        spline.setKnotVector(knots);
+
+        if (weights == null) {
+            spline.setUseWeightVector(false);
+        } else {
+            spline.setWeightVector(weights);
+        }
+
+        // now that this is done, add it to the path
+        ShapeMultiPath shape = new ShapeMultiPath();
+        shape.setFlatness(0.01);
+
+        spline.appendTo(shape);
+        return shape;
+    }
+
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFBaseContents.java Mon Oct 19 05:59:37 2015
@@ -44,116 +44,116 @@ import com.microsoft.schemas.office.visi
  */
 public class XDGFBaseContents extends XDGFXMLDocumentPart {
 
-	protected PageContentsType _pageContents;
-	
-	// shapes without parents
-	protected List<XDGFShape> _toplevelShapes = new ArrayList<>();
-	protected Map<Long, XDGFShape> _shapes = new HashMap<>();
-	protected List<XDGFConnection> _connections = new ArrayList<>();
-	
-	public XDGFBaseContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
-		super(part, rel, document);
-	}
-	
-	@Internal
-	public PageContentsType getXmlObject() {
-		return _pageContents;
-	}
-	
-	
-	@Override
-	protected void onDocumentRead() {
-		
-		if (_pageContents.isSetShapes()) {
-			for (ShapeSheetType shapeSheet: _pageContents.getShapes().getShapeArray()) {
-				XDGFShape shape = new XDGFShape(shapeSheet, this, _document);
-				_toplevelShapes.add(shape);
-				addToShapeIndex(shape);
-			}
-		}
-		
-		if (_pageContents.isSetConnects()) {
-			for (ConnectType connect: _pageContents.getConnects().getConnectArray()) {
-				
-				XDGFShape from = _shapes.get(connect.getFromSheet());
-				XDGFShape to = _shapes.get(connect.getToSheet());
-				
-				if (from == null)
-					throw new POIXMLException(this.toString() + "; Connect; Invalid from id: " + connect.getFromSheet());
-				
-				if (to == null)
-					throw new POIXMLException(this.toString() + "; Connect; Invalid to id: " + connect.getToSheet());
-				
-				_connections.add(new XDGFConnection(connect, from, to));
-			}
-		}
-	}
-	
-	protected void addToShapeIndex(XDGFShape shape) {
-		_shapes.put(shape.getID(), shape);
-		
-		List<XDGFShape> shapes = shape.getShapes();
-		if (shapes == null)
-			return;
-		
-		for (XDGFShape subshape: shapes)
-			addToShapeIndex(subshape);
-	}
-	
-	//
-	// API
-	//
-	
-	/**
-	 * 
-	 * @param graphics
-	 */
-	public void draw(Graphics2D graphics) {
-		visitShapes(new ShapeRenderer(graphics));
-	}
-	
-	
-	public XDGFShape getShapeById(long id) {
-		return _shapes.get(id);
-	}
-	
-	public Map<Long, XDGFShape> getShapesMap() {
-		return Collections.unmodifiableMap(_shapes);
-	}
-	
-	public Collection<XDGFShape> getShapes() {
-		return _shapes.values();
-	}
-	
-	public List<XDGFShape> getTopLevelShapes() {
-		return Collections.unmodifiableList(_toplevelShapes);
-	}
-	
-	// get connections
-	public List<XDGFConnection> getConnections() {
-		return Collections.unmodifiableList(_connections);
-	}
-	
-	@Override
-	public String toString() {
-		return getPackagePart().getPartName().toString();
-	}
-	
-
-	/**
-	 * Provides iteration over the shapes using the visitor pattern, and provides
-	 * an easy way to convert shape coordinates into global coordinates
-	 */
-	public void visitShapes(ShapeVisitor visitor) {
-		try {
-			for (XDGFShape shape: _toplevelShapes) {
-				shape.visitShapes(visitor, new AffineTransform(), 0);
-			}
-		} catch (StopVisiting e) {
-			// intentionally empty
-		} catch (POIXMLException e) {
-			throw XDGFException.wrap(this, e);
-		}
-	}
-	
+    protected PageContentsType _pageContents;
+
+    // shapes without parents
+    protected List<XDGFShape> _toplevelShapes = new ArrayList<XDGFShape>();
+    protected Map<Long, XDGFShape> _shapes = new HashMap<Long, XDGFShape>();
+    protected List<XDGFConnection> _connections = new ArrayList<XDGFConnection>();
+
+    public XDGFBaseContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
+        super(part, rel, document);
+    }
+
+    @Internal
+    public PageContentsType getXmlObject() {
+        return _pageContents;
+    }
+
+
+    @Override
+    protected void onDocumentRead() {
+
+        if (_pageContents.isSetShapes()) {
+            for (ShapeSheetType shapeSheet: _pageContents.getShapes().getShapeArray()) {
+                XDGFShape shape = new XDGFShape(shapeSheet, this, _document);
+                _toplevelShapes.add(shape);
+                addToShapeIndex(shape);
+            }
+        }
+
+        if (_pageContents.isSetConnects()) {
+            for (ConnectType connect: _pageContents.getConnects().getConnectArray()) {
+
+                XDGFShape from = _shapes.get(connect.getFromSheet());
+                XDGFShape to = _shapes.get(connect.getToSheet());
+
+                if (from == null)
+                    throw new POIXMLException(this.toString() + "; Connect; Invalid from id: " + connect.getFromSheet());
+
+                if (to == null)
+                    throw new POIXMLException(this.toString() + "; Connect; Invalid to id: " + connect.getToSheet());
+
+                _connections.add(new XDGFConnection(connect, from, to));
+            }
+        }
+    }
+
+    protected void addToShapeIndex(XDGFShape shape) {
+        _shapes.put(shape.getID(), shape);
+
+        List<XDGFShape> shapes = shape.getShapes();
+        if (shapes == null)
+            return;
+
+        for (XDGFShape subshape: shapes)
+            addToShapeIndex(subshape);
+    }
+
+    //
+    // API
+    //
+
+    /**
+     *
+     * @param graphics
+     */
+    public void draw(Graphics2D graphics) {
+        visitShapes(new ShapeRenderer(graphics));
+    }
+
+
+    public XDGFShape getShapeById(long id) {
+        return _shapes.get(id);
+    }
+
+    public Map<Long, XDGFShape> getShapesMap() {
+        return Collections.unmodifiableMap(_shapes);
+    }
+
+    public Collection<XDGFShape> getShapes() {
+        return _shapes.values();
+    }
+
+    public List<XDGFShape> getTopLevelShapes() {
+        return Collections.unmodifiableList(_toplevelShapes);
+    }
+
+    // get connections
+    public List<XDGFConnection> getConnections() {
+        return Collections.unmodifiableList(_connections);
+    }
+
+    @Override
+    public String toString() {
+        return getPackagePart().getPartName().toString();
+    }
+
+
+    /**
+     * Provides iteration over the shapes using the visitor pattern, and provides
+     * an easy way to convert shape coordinates into global coordinates
+     */
+    public void visitShapes(ShapeVisitor visitor) {
+        try {
+            for (XDGFShape shape: _toplevelShapes) {
+                shape.visitShapes(visitor, new AffineTransform(), 0);
+            }
+        } catch (StopVisiting e) {
+            // intentionally empty
+        } catch (POIXMLException e) {
+            throw XDGFException.wrap(this, e);
+        }
+    }
+
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFCell.java Mon Oct 19 05:59:37 2015
@@ -25,126 +25,131 @@ import org.apache.poi.util.Internal;
 import com.microsoft.schemas.office.visio.x2012.main.CellType;
 
 /**
- * There are a lot of different cell types. Cell is really just an attribute
- * of the thing that it's attached to. Will probably refactor this once I
- * figure out a better way to use them
- * 
- * The various attributes of a Cell are constrained, and are better defined
- * in the XSD 1.1 visio schema 
+ * There are a lot of different cell types. Cell is really just an attribute of
+ * the thing that it's attached to. Will probably refactor this once I figure
+ * out a better way to use them
+ *
+ * The various attributes of a Cell are constrained, and are better defined in
+ * the XSD 1.1 visio schema
  */
 public class XDGFCell {
 
-	public static Boolean maybeGetBoolean(Map<String, XDGFCell> cells, String name) {
-		XDGFCell cell = cells.get(name);
-		if (cell == null)
-			return null;
-			
-		if (cell.getValue().equals("0"))
-			return false;
-		if (cell.getValue().equals("1"))
-			return true;
-		
-		throw new POIXMLException("Invalid boolean value for '" + cell.getName() + "'");
-	}
-	
-	public static Double maybeGetDouble(Map<String, XDGFCell> cells, String name) {
-		XDGFCell cell = cells.get(name);
-		if (cell != null)
-			return parseDoubleValue(cell._cell);
-		return null;
-	}
-	
-	public static Integer maybeGetInteger(Map<String, XDGFCell> cells, String name) {
-		XDGFCell cell = cells.get(name);
-		if (cell != null)
-			return parseIntegerValue(cell._cell);
-		return null;
-	}
-	
-	public static String maybeGetString(Map<String, XDGFCell> cells, String name) {
-		XDGFCell cell = cells.get(name);
-		if (cell != null) {
-			String v = cell._cell.getV();
-			if (v.equals("Themed"))
-				return null;
-			return v;
-		}
-		return null;
-	}
-	
-	public static Double parseDoubleValue(CellType cell) {
-		try {
-			return Double.parseDouble(cell.getV());
-		} catch (NumberFormatException e) {
-			if (cell.getV().equals("Themed"))
-				return null;
-			throw new POIXMLException("Invalid float value for '" + cell.getN() + "': " + e);
-		}
-	}
-	
-	public static Integer parseIntegerValue(CellType cell) {
-		try {
-			return Integer.parseInt(cell.getV());
-		} catch (NumberFormatException e) {
-			if (cell.getV().equals("Themed"))
-				return null;
-			throw new POIXMLException("Invalid integer value for '" + cell.getN() + "': " + e);
-		}
-	}
-	
-	// returns a length, converts it to inches?
-	public static Double parseVLength(CellType cell) {
-		try {
-			return Double.parseDouble(cell.getV());
-		} catch (NumberFormatException e) {
-			if (cell.getV().equals("Themed"))
-				return null;
-			throw new POIXMLException("Invalid float value for '" + cell.getN() + "': " + e);
-		}
-	}
-	
-	
-	CellType _cell;
-	
-	public XDGFCell(CellType cell) {
-		_cell = cell;
-	}
-	
-	@Internal
-	CellType getXmlObject() {
-		return _cell;
-	}
-	
-	/**
-	 * Represents the name of the ShapeSheet cell.
-	 */
-	public String getName() {
-		return _cell.getN();
-	}
-	
-	/**
-	 * Represents the value of the cell.
-	 */
-	public String getValue() {
-		return _cell.getV();
-	}
-	
-	/**
-	 * Represents the element’s formula. This attribute can contain one of the following strings:
-	 * - ‘(some formula)’ if the formula exists locally
-	 * - No Formula if the formula is locally deleted or blocked
-	 * - Inh if the formula is inherited.
-	 */
-	public String getFormula() {
-		return _cell.getF();
-	}
-	
-	/*
-	 * Indicates that the formula evaluates to an error. The value of E is the
-	 * current value (an error message string); the value of the V attribute is
-	 * the last valid value.
-	 */
-	public String getError() {
-		return _cell.getE();
-	}
+    public static Boolean maybeGetBoolean(Map<String, XDGFCell> cells,
+            String name) {
+        XDGFCell cell = cells.get(name);
+        if (cell == null)
+            return null;
+
+        if (cell.getValue().equals("0"))
+            return false;
+        if (cell.getValue().equals("1"))
+            return true;
+
+        throw new POIXMLException("Invalid boolean value for '"
+                + cell.getName() + "'");
+    }
+
+    public static Double maybeGetDouble(Map<String, XDGFCell> cells, String name) {
+        XDGFCell cell = cells.get(name);
+        if (cell != null)
+            return parseDoubleValue(cell._cell);
+        return null;
+    }
+
+    public static Integer maybeGetInteger(Map<String, XDGFCell> cells,
+            String name) {
+        XDGFCell cell = cells.get(name);
+        if (cell != null)
+            return parseIntegerValue(cell._cell);
+        return null;
+    }
+
+    public static String maybeGetString(Map<String, XDGFCell> cells, String name) {
+        XDGFCell cell = cells.get(name);
+        if (cell != null) {
+            String v = cell._cell.getV();
+            if (v.equals("Themed"))
+                return null;
+            return v;
+        }
+        return null;
+    }
+
+    public static Double parseDoubleValue(CellType cell) {
+        try {
+            return Double.parseDouble(cell.getV());
+        } catch (NumberFormatException e) {
+            if (cell.getV().equals("Themed"))
+                return null;
+            throw new POIXMLException("Invalid float value for '" + cell.getN()
+                    + "': " + e);
+        }
+    }
+
+    public static Integer parseIntegerValue(CellType cell) {
+        try {
+            return Integer.parseInt(cell.getV());
+        } catch (NumberFormatException e) {
+            if (cell.getV().equals("Themed"))
+                return null;
+            throw new POIXMLException("Invalid integer value for '"
+                    + cell.getN() + "': " + e);
+        }
+    }
+
+    // returns a length, converts it to inches?
+    public static Double parseVLength(CellType cell) {
+        try {
+            return Double.parseDouble(cell.getV());
+        } catch (NumberFormatException e) {
+            if (cell.getV().equals("Themed"))
+                return null;
+            throw new POIXMLException("Invalid float value for '" + cell.getN()
+                    + "': " + e);
+        }
+    }
+
+    CellType _cell;
+
+    public XDGFCell(CellType cell) {
+        _cell = cell;
+    }
+
+    @Internal
+    CellType getXmlObject() {
+        return _cell;
+    }
+
+    /**
+     * Represents the name of the ShapeSheet cell.
+     */
+    public String getName() {
+        return _cell.getN();
+    }
+
+    /**
+     * Represents the value of the cell.
+     */
+    public String getValue() {
+        return _cell.getV();
+    }
+
+    /**
+     * Represents the element's formula. This attribute can contain one of the
+     * following strings: - '(some formula)' if the formula exists locally - No
+     * Formula if the formula is locally deleted or blocked - Inh if the formula
+     * is inherited.
+     */
+    public String getFormula() {
+        return _cell.getF();
+    }
+
+    /*
+     * Indicates that the formula evaluates to an error. The value of E is the
+     * current value (an error message string); the value of the V attribute is
+     * the last valid value.
+     */
+    public String getError() {
+        return _cell.getE();
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFConnection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFConnection.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFConnection.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFConnection.java Mon Oct 19 05:59:37 2015
@@ -21,114 +21,116 @@ import com.microsoft.schemas.office.visi
 
 public class XDGFConnection {
 
-	// comments on frompart/topart taken from pkgVisio 
-	
-	// https://msdn.microsoft.com/en-us/library/ms367611(v=office.12).aspx
-	
-    //    The following constants declared by the Microsoft Office Visio type 
-    //       library show return values for the FromPart property.
-    // Constant                  Value  
-    // visConnectFromError         -1
-    // visFromNone                 0
-    // visLeftEdge                 1
-    // visCenterEdge               2
-    // visRightEdge                3
-    // visBottomEdge               4
-    // visMiddleEdge               5
-    // visTopEdge                  6
-    // visBeginX                   7
-    // visBeginY                   8
-    // visBegin                    9
-    // visEndX                     10
-    // visEndY                     11
-    // visEnd                      12
-    // visFromAngle                13
-    // visFromPin                  14
-    // visControlPoint             100 + zero-based row index (for example, visControlPoint = 100 if the control point is in row 0; visControlPoint = 101 if the control point is in row 1)
-	
-	public static final int visConnectFromError        = -1;
-	public static final int visFromNone                = 0;
-	public static final int visLeftEdge                = 1;
-	public static final int visCenterEdge              = 2;
-	public static final int visRightEdge               = 3;
-	public static final int visBottomEdge              = 4;
-	public static final int visMiddleEdge              = 5;
-	public static final int visTopEdge                 = 6;
-	public static final int visBeginX                  = 7;
-	public static final int visBeginY                  = 8;
-	public static final int visBegin                   = 9;
-	public static final int visEndX                    = 10;
-	public static final int visEndY                    = 11;
-	public static final int visEnd                     = 12;
-	public static final int visFromAngle               = 13;
-	public static final int visFromPin                 = 14;
-	
-	
-	//  The ToPart property identifies the part of a shape to which another 
-	//    shape is glued, such as its begin point or endpoint, one of its edges, 
-	//    or a connection point. The following constants declared by the Visio type library in member VisToParts show possible return values for the ToPart property.
-	// Constant               Value  
-	// visConnectToError       -1
-	// visToNone               0
-	// visGuideX               1
-	// visGuideY               2
-	// visWholeShape           3
-	// visGuideIntersect       4
-	// visToAngle              7
-	// visConnectionPoint      100 + row index of connection point
-	
-	public static final int visConnectToError          = -1;
-	public static final int visToNone                  = 0;
-	public static final int visGuideX                  = 1;
-	public static final int visGuideY                  = 2;
-	public static final int visWholeShape              = 3;
-	public static final int visGuideIntersect          = 4;
-	public static final int visToAngle                 = 7;
-	
-	private ConnectType _connect;
-	private XDGFShape _from;
-	private XDGFShape _to;
-	
-	
-	public XDGFConnection(ConnectType connect, XDGFShape from, XDGFShape to) {
-		_connect = connect;
-		_from = from;
-		_to = to;
-	}
-	
-	public XDGFShape getFromShape() {
-		return _from;
-	}
-	
-	public XDGFCell getFromCell() {
-		return _from.getCell(_connect.getFromCell());
-	}
-	
-	public String getFromCellName() {
-		return _connect.getFromCell();
-	}
-	
-	public XDGFShape getToShape() {
-		return _to;
-	}
-	
-	public String getToCellName() {
-		return _connect.getToCell();
-	}
-	
-	// see constants above
-	public Integer getFromPart() {
-		if (_connect.isSetFromPart())
-			return _connect.getFromPart();
-		else
-			return null;
-	}
-	
-	// see constants above
-	public Integer getToPart() {
-		if (_connect.isSetToPart())
-			return _connect.getToPart();
-		else
-			return null;
-	}
+    // comments on frompart/topart taken from pkgVisio
+
+    // https://msdn.microsoft.com/en-us/library/ms367611(v=office.12).aspx
+
+    // The following constants declared by the Microsoft Office Visio type
+    // library show return values for the FromPart property.
+    // Constant Value
+    // visConnectFromError -1
+    // visFromNone 0
+    // visLeftEdge 1
+    // visCenterEdge 2
+    // visRightEdge 3
+    // visBottomEdge 4
+    // visMiddleEdge 5
+    // visTopEdge 6
+    // visBeginX 7
+    // visBeginY 8
+    // visBegin 9
+    // visEndX 10
+    // visEndY 11
+    // visEnd 12
+    // visFromAngle 13
+    // visFromPin 14
+    // visControlPoint 100 + zero-based row index (for example, visControlPoint
+    // = 100 if the control point is in row 0; visControlPoint = 101 if the
+    // control point is in row 1)
+
+    public static final int visConnectFromError = -1;
+    public static final int visFromNone = 0;
+    public static final int visLeftEdge = 1;
+    public static final int visCenterEdge = 2;
+    public static final int visRightEdge = 3;
+    public static final int visBottomEdge = 4;
+    public static final int visMiddleEdge = 5;
+    public static final int visTopEdge = 6;
+    public static final int visBeginX = 7;
+    public static final int visBeginY = 8;
+    public static final int visBegin = 9;
+    public static final int visEndX = 10;
+    public static final int visEndY = 11;
+    public static final int visEnd = 12;
+    public static final int visFromAngle = 13;
+    public static final int visFromPin = 14;
+
+    // The ToPart property identifies the part of a shape to which another
+    // shape is glued, such as its begin point or endpoint, one of its edges,
+    // or a connection point. The following constants declared by the Visio type
+    // library in member VisToParts show possible return values for the ToPart
+    // property.
+    // Constant Value
+    // visConnectToError -1
+    // visToNone 0
+    // visGuideX 1
+    // visGuideY 2
+    // visWholeShape 3
+    // visGuideIntersect 4
+    // visToAngle 7
+    // visConnectionPoint 100 + row index of connection point
+
+    public static final int visConnectToError = -1;
+    public static final int visToNone = 0;
+    public static final int visGuideX = 1;
+    public static final int visGuideY = 2;
+    public static final int visWholeShape = 3;
+    public static final int visGuideIntersect = 4;
+    public static final int visToAngle = 7;
+
+    private ConnectType _connect;
+    private XDGFShape _from;
+    private XDGFShape _to;
+
+    public XDGFConnection(ConnectType connect, XDGFShape from, XDGFShape to) {
+        _connect = connect;
+        _from = from;
+        _to = to;
+    }
+
+    public XDGFShape getFromShape() {
+        return _from;
+    }
+
+    public XDGFCell getFromCell() {
+        return _from.getCell(_connect.getFromCell());
+    }
+
+    public String getFromCellName() {
+        return _connect.getFromCell();
+    }
+
+    public XDGFShape getToShape() {
+        return _to;
+    }
+
+    public String getToCellName() {
+        return _connect.getToCell();
+    }
+
+    // see constants above
+    public Integer getFromPart() {
+        if (_connect.isSetFromPart())
+            return _connect.getFromPart();
+        else
+            return null;
+    }
+
+    // see constants above
+    public Integer getToPart() {
+        if (_connect.isSetToPart())
+            return _connect.getToPart();
+        else
+            return null;
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFDocument.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFDocument.java Mon Oct 19 05:59:37 2015
@@ -32,85 +32,85 @@ import com.microsoft.schemas.office.visi
  */
 public class XDGFDocument {
 
-	protected VisioDocumentType _document;
+    protected VisioDocumentType _document;
+
+    Map<Long, XDGFStyleSheet> _styleSheets = new HashMap<Long, XDGFStyleSheet>();
+
+    // defaults
+    long _defaultFillStyle = 0;
+    long _defaultGuideStyle = 0;
+    long _defaultLineStyle = 0;
+    long _defaultTextStyle = 0;
+
+
+    public XDGFDocument(VisioDocumentType document) {
+
+        _document = document;
+
+        if (!_document.isSetDocumentSettings())
+            throw new POIXMLException("Document settings not found");
+
+        DocumentSettingsType docSettings = _document.getDocumentSettings();
+
+        if (docSettings.isSetDefaultFillStyle())
+            _defaultFillStyle = docSettings.getDefaultFillStyle();
+
+        if (docSettings.isSetDefaultGuideStyle())
+            _defaultGuideStyle = docSettings.getDefaultGuideStyle();
+
+        if (docSettings.isSetDefaultLineStyle())
+            _defaultLineStyle = docSettings.getDefaultLineStyle();
+
+        if (docSettings.isSetDefaultTextStyle())
+            _defaultTextStyle = docSettings.getDefaultTextStyle();
+
+        if (_document.isSetStyleSheets()) {
+
+            for (StyleSheetType styleSheet: _document.getStyleSheets().getStyleSheetArray()) {
+                _styleSheets.put(styleSheet.getID(), new XDGFStyleSheet(styleSheet, this));
+            }
+        }
+    }
+
+
+    @Internal
+    public VisioDocumentType getXmlObject() {
+        return _document;
+    }
+
+
+    public XDGFStyleSheet getStyleById(long id) {
+        return _styleSheets.get(id);
+    }
+
+
+    public XDGFStyleSheet getDefaultFillStyle() {
+        XDGFStyleSheet style = getStyleById(_defaultFillStyle);
+        if (style == null)
+            throw new POIXMLException("No default fill style found!");
+        return style;
+    }
+
+    public XDGFStyleSheet getDefaultGuideStyle() {
+        XDGFStyleSheet style = getStyleById(_defaultGuideStyle);
+        if (style == null)
+            throw new POIXMLException("No default guide style found!");
+        return style;
+    }
+
+    public XDGFStyleSheet getDefaultLineStyle() {
+        XDGFStyleSheet style = getStyleById(_defaultLineStyle);
+        if (style == null)
+            throw new POIXMLException("No default line style found!");
+        return style;
+    }
+
+    public XDGFStyleSheet getDefaultTextStyle() {
+        XDGFStyleSheet style = getStyleById(_defaultTextStyle);
+        if (style == null)
+            throw new POIXMLException("No default text style found!");
+        return style;
+    }
 
-	Map<Long, XDGFStyleSheet> _styleSheets = new HashMap<>();
-	
-	// defaults
-	long _defaultFillStyle = 0;
-	long _defaultGuideStyle = 0;
-	long _defaultLineStyle = 0;
-	long _defaultTextStyle = 0;
-	
-	
-	public XDGFDocument(VisioDocumentType document) {
-		
-		_document = document;
-		
-		if (!_document.isSetDocumentSettings())
-			throw new POIXMLException("Document settings not found");
-		
-		DocumentSettingsType docSettings = _document.getDocumentSettings();
-		
-		if (docSettings.isSetDefaultFillStyle())
-			_defaultFillStyle = docSettings.getDefaultFillStyle();
-		
-		if (docSettings.isSetDefaultGuideStyle())
-			_defaultGuideStyle = docSettings.getDefaultGuideStyle();
-		
-		if (docSettings.isSetDefaultLineStyle())
-			_defaultLineStyle = docSettings.getDefaultLineStyle();
-		
-		if (docSettings.isSetDefaultTextStyle())
-			_defaultTextStyle = docSettings.getDefaultTextStyle();
-		
-		if (_document.isSetStyleSheets()) {
-			
-			for (StyleSheetType styleSheet: _document.getStyleSheets().getStyleSheetArray()) { 
-				_styleSheets.put(styleSheet.getID(), new XDGFStyleSheet(styleSheet, this));
-			}
-		}
-	}
-	
-
-	@Internal
-	public VisioDocumentType getXmlObject() {
-		return _document;
-	}
-	
-
-	public XDGFStyleSheet getStyleById(long id) {
-		return _styleSheets.get(id);
-	}
-
-
-	public XDGFStyleSheet getDefaultFillStyle() {
-		XDGFStyleSheet style = getStyleById(_defaultFillStyle);
-		if (style == null)
-			throw new POIXMLException("No default fill style found!");
-		return style;
-	}
-	
-	public XDGFStyleSheet getDefaultGuideStyle() {
-		XDGFStyleSheet style = getStyleById(_defaultGuideStyle);
-		if (style == null)
-			throw new POIXMLException("No default guide style found!");
-		return style;
-	}
-	
-	public XDGFStyleSheet getDefaultLineStyle() {
-		XDGFStyleSheet style = getStyleById(_defaultLineStyle);
-		if (style == null)
-			throw new POIXMLException("No default line style found!");
-		return style;
-	}
-	
-	public XDGFStyleSheet getDefaultTextStyle() {
-		XDGFStyleSheet style = getStyleById(_defaultTextStyle);
-		if (style == null)
-			throw new POIXMLException("No default text style found!");
-		return style;
-	}
 
-	
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFFactory.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFFactory.java Mon Oct 19 05:59:37 2015
@@ -30,46 +30,57 @@ import org.apache.poi.util.POILogger;
 
 public class XDGFFactory extends POIXMLFactory {
 
-    private static final POILogger logger = POILogFactory.getLogger(XDGFFactory.class);
-    
-	private XDGFDocument _document;
-	
-	public XDGFFactory(XDGFDocument document){
-		_document = document;
+    private static final POILogger logger = POILogFactory
+            .getLogger(XDGFFactory.class);
+
+    private XDGFDocument _document;
+
+    public XDGFFactory(XDGFDocument document) {
+        _document = document;
     }
-	
-	@Override
-	public POIXMLDocumentPart createDocumentPart(POIXMLDocumentPart parent,
-			PackageRelationship rel, PackagePart part) {
-		POIXMLRelation descriptor = XDGFRelation.getInstance(rel.getRelationshipType());
-        if(descriptor == null || descriptor.getRelationClass() == null){
-            logger.log(POILogger.DEBUG, "using default POIXMLDocumentPart for " + rel.getRelationshipType());
+
+    @Override
+    public POIXMLDocumentPart createDocumentPart(POIXMLDocumentPart parent,
+            PackageRelationship rel, PackagePart part) {
+        POIXMLRelation descriptor = XDGFRelation.getInstance(rel
+                .getRelationshipType());
+        if (descriptor == null || descriptor.getRelationClass() == null) {
+            logger.log(POILogger.DEBUG, "using default POIXMLDocumentPart for "
+                    + rel.getRelationshipType());
             return new POIXMLDocumentPart(part, rel);
         }
 
         try {
-            Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
+            Class<? extends POIXMLDocumentPart> cls = descriptor
+                    .getRelationClass();
             try {
-                Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(POIXMLDocumentPart.class, PackagePart.class, PackageRelationship.class, XDGFDocument.class);
+                Constructor<? extends POIXMLDocumentPart> constructor = cls
+                        .getDeclaredConstructor(POIXMLDocumentPart.class,
+                                PackagePart.class, PackageRelationship.class,
+                                XDGFDocument.class);
                 return constructor.newInstance(parent, part, rel, _document);
             } catch (NoSuchMethodException e) {
-                Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor(PackagePart.class, PackageRelationship.class, XDGFDocument.class);
+                Constructor<? extends POIXMLDocumentPart> constructor = cls
+                        .getDeclaredConstructor(PackagePart.class,
+                                PackageRelationship.class, XDGFDocument.class);
                 return constructor.newInstance(part, rel, _document);
             }
-        } catch (Exception e){
+        } catch (Exception e) {
             throw new POIXMLException(e);
         }
-	}
+    }
 
-	@Override
-	public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor) {
+    @Override
+    public POIXMLDocumentPart newDocumentPart(POIXMLRelation descriptor) {
         try {
-            Class<? extends POIXMLDocumentPart> cls = descriptor.getRelationClass();
-            Constructor<? extends POIXMLDocumentPart> constructor = cls.getDeclaredConstructor();
+            Class<? extends POIXMLDocumentPart> cls = descriptor
+                    .getRelationClass();
+            Constructor<? extends POIXMLDocumentPart> constructor = cls
+                    .getDeclaredConstructor();
             return constructor.newInstance();
-        } catch (Exception e){
+        } catch (Exception e) {
             throw new POIXMLException(e);
         }
-	}
+    }
 
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMaster.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMaster.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMaster.java Mon Oct 19 05:59:37 2015
@@ -26,43 +26,44 @@ import com.microsoft.schemas.office.visi
  */
 public class XDGFMaster {
 
-	private MasterType _master;
-	private XDGFMasterContents _content;
-	XDGFSheet _pageSheet = null;
-	
-	public XDGFMaster(MasterType master, XDGFMasterContents content, XDGFDocument document) {
-		_master = master;
-		_content = content;
-		content.setMaster(this);
-		
-		if (master.isSetPageSheet())
-			_pageSheet = new XDGFPageSheet(master.getPageSheet(), document);
-	}
-	
-	@Internal
-	MasterType getXmlObject() {
-		return _master;
-	}
-	
-	@Override
-	public String toString() {
-		return "<Master ID=\"" + getID() + "\" " + _content + ">";
-	}
-	
-	public long getID() {
-		return _master.getID();
-	}
-	
-	public String getName() {
-		return _master.getName();
-	}
-	
-	public XDGFMasterContents getContent() {
-		return _content;
-	}
-	
-	public XDGFSheet getPageSheet() {
-		return _pageSheet;
-	}
-	
+    private MasterType _master;
+    private XDGFMasterContents _content;
+    XDGFSheet _pageSheet = null;
+
+    public XDGFMaster(MasterType master, XDGFMasterContents content,
+            XDGFDocument document) {
+        _master = master;
+        _content = content;
+        content.setMaster(this);
+
+        if (master.isSetPageSheet())
+            _pageSheet = new XDGFPageSheet(master.getPageSheet(), document);
+    }
+
+    @Internal
+    MasterType getXmlObject() {
+        return _master;
+    }
+
+    @Override
+    public String toString() {
+        return "<Master ID=\"" + getID() + "\" " + _content + ">";
+    }
+
+    public long getID() {
+        return _master.getID();
+    }
+
+    public String getName() {
+        return _master.getName();
+    }
+
+    public XDGFMasterContents getContent() {
+        return _content;
+    }
+
+    public XDGFSheet getPageSheet() {
+        return _pageSheet;
+    }
+
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasterContents.java Mon Oct 19 05:59:37 2015
@@ -29,36 +29,39 @@ import com.microsoft.schemas.office.visi
 
 public class XDGFMasterContents extends XDGFBaseContents {
 
-	private XDGFMaster _master;
-	
-	public XDGFMasterContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
-		super(part, rel, document);
-	}
-	
-	@Override
-	protected void onDocumentRead() {
-
-		try {
-		
-			try {
-				_pageContents = MasterContentsDocument.Factory.parse(getPackagePart().getInputStream()).getMasterContents();
-			} catch (XmlException | IOException e) {
-				throw new POIXMLException(e);
-			}
-			
-			super.onDocumentRead();
-			
-		} catch (POIXMLException e) {
-			throw XDGFException.wrap(this, e);
-		}
-	}
-
-	public XDGFMaster getMaster() {
-		return _master;
-	}
-
-	protected void setMaster(XDGFMaster master) {
-		_master = master;
-	}
+    private XDGFMaster _master;
+
+    public XDGFMasterContents(PackagePart part, PackageRelationship rel,
+            XDGFDocument document) {
+        super(part, rel, document);
+    }
+
+    @Override
+    protected void onDocumentRead() {
+
+        try {
+
+            try {
+                _pageContents = MasterContentsDocument.Factory.parse(getPackagePart().getInputStream()).getMasterContents();
+            } catch (XmlException e) {
+                throw new POIXMLException(e);
+            } catch (IOException e) {
+                throw new POIXMLException(e);
+            }
+
+            super.onDocumentRead();
+
+        } catch (POIXMLException e) {
+            throw XDGFException.wrap(this, e);
+        }
+    }
+
+    public XDGFMaster getMaster() {
+        return _master;
+    }
+
+    protected void setMaster(XDGFMaster master) {
+        _master = master;
+    }
 
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFMasters.java Mon Oct 19 05:59:37 2015
@@ -38,62 +38,64 @@ import com.microsoft.schemas.office.visi
 
 public class XDGFMasters extends XDGFXMLDocumentPart {
 
-	MastersType _mastersObject;
-	
-	// key: id of master
-	Map<Long, XDGFMaster> _masters = new HashMap<>();
-	
-	public XDGFMasters(PackagePart part, PackageRelationship rel, XDGFDocument document) {
-		super(part, rel, document);
-	}
-	
-	@Internal
-	MastersType getXmlObject() {
-		return _mastersObject;
-	}
-	
-	@Override
-	protected void onDocumentRead() {
-		try {
-			try {
-				_mastersObject = MastersDocument.Factory.parse(getPackagePart().getInputStream()).getMasters();
-			} catch (XmlException | IOException e) {
-				throw new POIXMLException(e);
-			}
-			
-			Map<String, MasterType> masterSettings = new HashMap<>();
-			for (MasterType master: _mastersObject.getMasterArray()) {
-				masterSettings.put(master.getRel().getId(), master);
-			}
-			
-			// create the masters
-			for (POIXMLDocumentPart part: getRelations()) {
-				
-				String relId = part.getPackageRelationship().getId();
-				MasterType settings = masterSettings.get(relId);
-				
-				if (settings == null)
-					throw new POIXMLException("Master relationship for " + relId + " not found");
-				
-				if (!(part instanceof XDGFMasterContents))
-					throw new POIXMLException("Unexpected masters relationship for " + relId + ": " + part);
-				
-				XDGFMasterContents contents = (XDGFMasterContents)part;
-				contents.onDocumentRead();
-				
-				XDGFMaster master = new XDGFMaster(settings, contents, _document);
-				_masters.put(master.getID(), master);
-			}
-		} catch (POIXMLException e) {
-			throw XDGFException.wrap(this, e);
-		}
-	}
-	
-	public Collection<XDGFMaster> getMastersList() {
-		return Collections.unmodifiableCollection(_masters.values());
-	}
-	
-	public XDGFMaster getMasterById(long masterId) {
-		return _masters.get(masterId);
-	}
+    MastersType _mastersObject;
+
+    // key: id of master
+    Map<Long, XDGFMaster> _masters = new HashMap<Long, XDGFMaster>();
+
+    public XDGFMasters(PackagePart part, PackageRelationship rel, XDGFDocument document) {
+        super(part, rel, document);
+    }
+
+    @Internal
+    MastersType getXmlObject() {
+        return _mastersObject;
+    }
+
+    @Override
+    protected void onDocumentRead() {
+        try {
+            try {
+                _mastersObject = MastersDocument.Factory.parse(getPackagePart().getInputStream()).getMasters();
+            } catch (XmlException e) {
+                throw new POIXMLException(e);
+            } catch (IOException e) {
+                throw new POIXMLException(e);
+            }
+
+            Map<String, MasterType> masterSettings = new HashMap<String, MasterType>();
+            for (MasterType master: _mastersObject.getMasterArray()) {
+                masterSettings.put(master.getRel().getId(), master);
+            }
+
+            // create the masters
+            for (POIXMLDocumentPart part: getRelations()) {
+
+                String relId = part.getPackageRelationship().getId();
+                MasterType settings = masterSettings.get(relId);
+
+                if (settings == null)
+                    throw new POIXMLException("Master relationship for " + relId + " not found");
+
+                if (!(part instanceof XDGFMasterContents))
+                    throw new POIXMLException("Unexpected masters relationship for " + relId + ": " + part);
+
+                XDGFMasterContents contents = (XDGFMasterContents)part;
+                contents.onDocumentRead();
+
+                XDGFMaster master = new XDGFMaster(settings, contents, _document);
+                _masters.put(master.getID(), master);
+            }
+        } catch (POIXMLException e) {
+            throw XDGFException.wrap(this, e);
+        }
+    }
+
+    public Collection<XDGFMaster> getMastersList() {
+        return Collections.unmodifiableCollection(_masters.values());
+    }
+
+    public XDGFMaster getMasterById(long masterId) {
+        return _masters.get(masterId);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java Mon Oct 19 05:59:37 2015
@@ -31,83 +31,82 @@ import com.microsoft.schemas.office.visi
  */
 public class XDGFPage {
 
-	PageType _page;
-	XDGFPageContents _content;
-	XDGFPages _pages;
-	XDGFSheet _pageSheet = null;
-	
-	public XDGFPage(PageType page, XDGFPageContents content, XDGFDocument document, XDGFPages pages) {
-		_page = page;
-		_content = content;
-		_pages = pages;
-		content.setPage(this);
-		
-		if (page.isSetPageSheet())
-			_pageSheet = new XDGFPageSheet(page.getPageSheet(), document);
-	}
-	
-	@Internal
-	PageType getXmlObject() {
-		return _page;
-	}
-	
-	public long getID() {
-		return _page.getID();
-	}
-	
-	public String getName() {
-		return _page.getName();
-	}
-	
-	public XDGFPageContents getContent() {
-		return _content;
-	}
-	
-	public XDGFSheet getPageSheet() {
-		return _pageSheet;
-	}
-	
-	public long getPageNumber() {
-		return _pages.getPageList().indexOf(this) + 1;
-	}
-	
-	// height/width of page
-	public Dimension2dDouble getPageSize() {
-		XDGFCell w = _pageSheet.getCell("PageWidth");
-		XDGFCell h = _pageSheet.getCell("PageHeight");
-		
-		if (w == null || h == null)
-			throw new POIXMLException("Cannot determine page size");
-		
-		return new Dimension2dDouble(Double.parseDouble(w.getValue()),
-									 Double.parseDouble(h.getValue()));
-	}
-	
-	// origin of coordinate system
-	public Point2D.Double getPageOffset() {
-		XDGFCell xoffcell = _pageSheet.getCell("XRulerOrigin");
-		XDGFCell yoffcell = _pageSheet.getCell("YRulerOrigin");
-		
-		double xoffset = 0;
-		double yoffset = 0;
-		
-		if (xoffcell != null)
-			xoffset = Double.parseDouble(xoffcell.getValue());
-		
-		if (xoffcell != null)
-			yoffset = Double.parseDouble(yoffcell.getValue());
-		
-		return new Point2D.Double(xoffset, yoffset);
-	}
-	
-	// bounding box of page
-	public Rectangle2D getBoundingBox() {
-		Dimension2dDouble sz = getPageSize();
-		Point2D.Double offset = getPageOffset();
-		
-		return new Rectangle2D.Double(-offset.getX(),
-									  -offset.getY(),
-									  sz.getWidth(),
-									  sz.getHeight());
-	}
+    PageType _page;
+    XDGFPageContents _content;
+    XDGFPages _pages;
+    XDGFSheet _pageSheet = null;
+
+    public XDGFPage(PageType page, XDGFPageContents content,
+            XDGFDocument document, XDGFPages pages) {
+        _page = page;
+        _content = content;
+        _pages = pages;
+        content.setPage(this);
+
+        if (page.isSetPageSheet())
+            _pageSheet = new XDGFPageSheet(page.getPageSheet(), document);
+    }
+
+    @Internal
+    PageType getXmlObject() {
+        return _page;
+    }
+
+    public long getID() {
+        return _page.getID();
+    }
+
+    public String getName() {
+        return _page.getName();
+    }
+
+    public XDGFPageContents getContent() {
+        return _content;
+    }
+
+    public XDGFSheet getPageSheet() {
+        return _pageSheet;
+    }
+
+    public long getPageNumber() {
+        return _pages.getPageList().indexOf(this) + 1;
+    }
+
+    // height/width of page
+    public Dimension2dDouble getPageSize() {
+        XDGFCell w = _pageSheet.getCell("PageWidth");
+        XDGFCell h = _pageSheet.getCell("PageHeight");
+
+        if (w == null || h == null)
+            throw new POIXMLException("Cannot determine page size");
+
+        return new Dimension2dDouble(Double.parseDouble(w.getValue()),
+                Double.parseDouble(h.getValue()));
+    }
+
+    // origin of coordinate system
+    public Point2D.Double getPageOffset() {
+        XDGFCell xoffcell = _pageSheet.getCell("XRulerOrigin");
+        XDGFCell yoffcell = _pageSheet.getCell("YRulerOrigin");
+
+        double xoffset = 0;
+        double yoffset = 0;
+
+        if (xoffcell != null)
+            xoffset = Double.parseDouble(xoffcell.getValue());
+
+        if (xoffcell != null)
+            yoffset = Double.parseDouble(yoffcell.getValue());
+
+        return new Point2D.Double(xoffset, yoffset);
+    }
+
+    // bounding box of page
+    public Rectangle2D getBoundingBox() {
+        Dimension2dDouble sz = getPageSize();
+        Point2D.Double offset = getPageOffset();
+
+        return new Rectangle2D.Double(-offset.getX(), -offset.getY(),
+                sz.getWidth(), sz.getHeight());
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageContents.java Mon Oct 19 05:59:37 2015
@@ -32,52 +32,54 @@ import com.microsoft.schemas.office.visi
 
 public class XDGFPageContents extends XDGFBaseContents {
 
-	Map<Long, XDGFMaster> _masters = new HashMap<>();
-	XDGFPage _page;
-	
-	public XDGFPageContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
-		super(part, rel, document);
-	}
-
-	@Override
-	protected void onDocumentRead() {
-		try {
-			try {
-				_pageContents = PageContentsDocument.Factory.parse(getPackagePart().getInputStream()).getPageContents();
-			} catch (XmlException | IOException e) {
-				throw new POIXMLException(e);
-			}
-			
-			for (POIXMLDocumentPart part: getRelations()) {
-				if (!(part instanceof XDGFMasterContents))
-					continue;
-					//throw new POIXMLException("Unexpected page relation: " + part);
-				
-				XDGFMaster master = ((XDGFMasterContents)part).getMaster();
-				_masters.put(master.getID(), master);
-			}
-			
-			super.onDocumentRead();
-			
-			for (XDGFShape shape: _shapes.values()) {
-				if (shape.isTopmost())
-					shape.setupMaster(this, null);
-			}
-		
-		} catch (POIXMLException e) {
-			throw XDGFException.wrap(this, e);
-		}
-	}
-
-	public XDGFPage getPage() {
-		return _page;
-	}
-	
-	protected void setPage(XDGFPage page) {
-		_page = page;
-	}
-	
-	public XDGFMaster getMasterById(long id) {
-		return _masters.get(id);
-	}
+    Map<Long, XDGFMaster> _masters = new HashMap<Long, XDGFMaster>();
+    XDGFPage _page;
+
+    public XDGFPageContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
+        super(part, rel, document);
+    }
+
+    @Override
+    protected void onDocumentRead() {
+        try {
+            try {
+                _pageContents = PageContentsDocument.Factory.parse(getPackagePart().getInputStream()).getPageContents();
+            } catch (XmlException e) {
+                throw new POIXMLException(e);
+            } catch (IOException e) {
+                throw new POIXMLException(e);
+            }
+
+            for (POIXMLDocumentPart part: getRelations()) {
+                if (!(part instanceof XDGFMasterContents))
+                    continue;
+                //throw new POIXMLException("Unexpected page relation: " + part);
+
+                XDGFMaster master = ((XDGFMasterContents)part).getMaster();
+                _masters.put(master.getID(), master);
+            }
+
+            super.onDocumentRead();
+
+            for (XDGFShape shape: _shapes.values()) {
+                if (shape.isTopmost())
+                    shape.setupMaster(this, null);
+            }
+
+        } catch (POIXMLException e) {
+            throw XDGFException.wrap(this, e);
+        }
+    }
+
+    public XDGFPage getPage() {
+        return _page;
+    }
+
+    protected void setPage(XDGFPage page) {
+        _page = page;
+    }
+
+    public XDGFMaster getMasterById(long id) {
+        return _masters.get(id);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageSheet.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPageSheet.java Mon Oct 19 05:59:37 2015
@@ -21,16 +21,16 @@ import com.microsoft.schemas.office.visi
 
 public class XDGFPageSheet extends XDGFSheet {
 
-	PageSheetType _pageSheet;
-	
-	public XDGFPageSheet(PageSheetType sheet, XDGFDocument document) {
-		super(sheet, document);
-		_pageSheet = sheet;
-	}
+    PageSheetType _pageSheet;
 
-	@Override
-	PageSheetType getXmlObject() {
-		return _pageSheet;
-	}
+    public XDGFPageSheet(PageSheetType sheet, XDGFDocument document) {
+        super(sheet, document);
+        _pageSheet = sheet;
+    }
+
+    @Override
+    PageSheetType getXmlObject() {
+        return _pageSheet;
+    }
 
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPages.java Mon Oct 19 05:59:37 2015
@@ -40,56 +40,58 @@ import com.microsoft.schemas.office.visi
  */
 public class XDGFPages extends XDGFXMLDocumentPart {
 
-	PagesType _pagesObject;
-	
-	// ordered by page number
-	List<XDGFPage> _pages = new ArrayList<>();
-	
-	public XDGFPages(PackagePart part, PackageRelationship rel, XDGFDocument document) {
-		super(part, rel, document);
-	}
-	
-	@Internal
-	PagesType getXmlObject() {
-		return _pagesObject;
-	}
-	
-	@Override
-	protected void onDocumentRead() {
-		try {
-			try {
-				_pagesObject = PagesDocument.Factory.parse(getPackagePart().getInputStream()).getPages();
-			} catch (XmlException | IOException e) {
-				throw new POIXMLException(e);
-			}
-			
-			// this iteration is ordered by page number
-			for (PageType pageSettings: _pagesObject.getPageArray()) {
-				
-				String relId = pageSettings.getRel().getId();
-				
-				POIXMLDocumentPart pageContentsPart = getRelationById(relId);
-				if (pageContentsPart == null)
-					throw new POIXMLException("PageSettings relationship for " + relId + " not found");
-				
-				if (!(pageContentsPart instanceof XDGFPageContents))
-					throw new POIXMLException("Unexpected pages relationship for " + relId + ": " + pageContentsPart);
-				
-				XDGFPageContents contents = (XDGFPageContents)pageContentsPart;
-				XDGFPage page = new XDGFPage(pageSettings, contents, _document, this);
-				
-				contents.onDocumentRead();
-				
-				_pages.add(page);
-			}
-			
-		} catch (POIXMLException e) {
-			throw XDGFException.wrap(this, e);
-		}
-	}
-	
-	// ordered by page number
-	public List<XDGFPage> getPageList() {
-		return Collections.unmodifiableList(_pages);
-	}
+    PagesType _pagesObject;
+
+    // ordered by page number
+    List<XDGFPage> _pages = new ArrayList<XDGFPage>();
+
+    public XDGFPages(PackagePart part, PackageRelationship rel, XDGFDocument document) {
+        super(part, rel, document);
+    }
+
+    @Internal
+    PagesType getXmlObject() {
+        return _pagesObject;
+    }
+
+    @Override
+    protected void onDocumentRead() {
+        try {
+            try {
+                _pagesObject = PagesDocument.Factory.parse(getPackagePart().getInputStream()).getPages();
+            } catch (XmlException e) {
+                throw new POIXMLException(e);
+            } catch (IOException e) {
+                throw new POIXMLException(e);
+            }
+
+            // this iteration is ordered by page number
+            for (PageType pageSettings: _pagesObject.getPageArray()) {
+
+                String relId = pageSettings.getRel().getId();
+
+                POIXMLDocumentPart pageContentsPart = getRelationById(relId);
+                if (pageContentsPart == null)
+                    throw new POIXMLException("PageSettings relationship for " + relId + " not found");
+
+                if (!(pageContentsPart instanceof XDGFPageContents))
+                    throw new POIXMLException("Unexpected pages relationship for " + relId + ": " + pageContentsPart);
+
+                XDGFPageContents contents = (XDGFPageContents)pageContentsPart;
+                XDGFPage page = new XDGFPage(pageSettings, contents, _document, this);
+
+                contents.onDocumentRead();
+
+                _pages.add(page);
+            }
+
+        } catch (POIXMLException e) {
+            throw XDGFException.wrap(this, e);
+        }
+    }
+
+    // ordered by page number
+    public List<XDGFPage> getPageList() {
+        return Collections.unmodifiableList(_pages);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFRelation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFRelation.java?rev=1709355&r1=1709354&r2=1709355&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFRelation.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFRelation.java Mon Oct 19 05:59:37 2015
@@ -25,8 +25,8 @@ import org.apache.poi.openxml4j.opc.Pack
 import org.apache.poi.xdgf.xml.XDGFXMLDocumentPart;
 
 public class XDGFRelation extends POIXMLRelation {
-	
-	/**
+
+    /**
      * A map to lookup POIXMLRelation by its relation type
      */
     protected static final Map<String, XDGFRelation> _table = new HashMap<String, XDGFRelation>();
@@ -34,62 +34,50 @@ public class XDGFRelation extends POIXML
     public static final XDGFRelation DOCUMENT = new XDGFRelation(
             "application/vnd.ms-visio.drawing.main+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/document",
-            "/visio/document.xml",
-            null
-    );
-    
+            "/visio/document.xml", null);
+
     public static final XDGFRelation MASTERS = new XDGFRelation(
             "application/vnd.ms-visio.masters+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/masters",
-            "/visio/masters/masters.xml",
-            XDGFMasters.class
-    );
-    
+            "/visio/masters/masters.xml", XDGFMasters.class);
+
     public static final XDGFRelation MASTER = new XDGFRelation(
             "application/vnd.ms-visio.master+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/master",
-            "/visio/masters/master#.xml",
-            XDGFMasterContents.class
-    );
-    
-    public static final XDGFRelation IMAGES = new XDGFRelation(
-            null,
-            PackageRelationshipTypes.IMAGE_PART,
-            null,
-            null // XSSFPictureData.class
-        );
-    
+            "/visio/masters/master#.xml", XDGFMasterContents.class);
+
+    public static final XDGFRelation IMAGES = new XDGFRelation(null,
+            PackageRelationshipTypes.IMAGE_PART, null, null // XSSFPictureData.class
+            );
+
     public static final XDGFRelation PAGES = new XDGFRelation(
             "application/vnd.ms-visio.pages+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/pages",
-            "/visio/pages/pages.xml",
-            XDGFPages.class
-    );
-    
+            "/visio/pages/pages.xml", XDGFPages.class);
+
     public static final XDGFRelation PAGE = new XDGFRelation(
             "application/vnd.ms-visio.page+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/page",
-            "/visio/pages/page#.xml",
-            XDGFPageContents.class
-    );
-    
+            "/visio/pages/page#.xml", XDGFPageContents.class);
+
     public static final XDGFRelation WINDOW = new XDGFRelation(
             "application/vnd.ms-visio.windows+xml",
             "http://schemas.microsoft.com/visio/2010/relationships/windows",
-            "/visio/windows.xml",
-            null
-    );
-    
-    private XDGFRelation(String type, String rel, String defaultName, Class<? extends XDGFXMLDocumentPart> cls) {
+            "/visio/windows.xml", null);
+
+    private XDGFRelation(String type, String rel, String defaultName,
+            Class<? extends XDGFXMLDocumentPart> cls) {
         super(type, rel, defaultName, cls);
 
-        if (cls != null && !_table.containsKey(rel)) _table.put(rel, this);
+        if (cls != null && !_table.containsKey(rel))
+            _table.put(rel, this);
     }
 
     /**
      * Get POIXMLRelation by relation type
      *
-     * @param rel relation type, for example,
+     * @param rel
+     *            relation type, for example,
      *            <code>http://schemas.openxmlformats.org/officeDocument/2006/relationships/image</code>
      * @return registered POIXMLRelation or null if not found
      */



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