Move and rename hslf line because of ambiguity with common sl line
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5827cee62d
commit
d90309db4e
@ -26,7 +26,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hslf.model.Line;
|
||||
import org.apache.poi.hslf.model.PPGraphics2D;
|
||||
import org.apache.poi.hslf.record.TextHeaderAtom;
|
||||
import org.apache.poi.hslf.usermodel.HSLFAutoShape;
|
||||
@ -38,6 +37,7 @@ import org.apache.poi.hslf.usermodel.HSLFTableCell;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextBox;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextRun;
|
||||
import org.apache.poi.hslf.usermodel.HSLFLine;
|
||||
import org.apache.poi.sl.usermodel.ShapeType;
|
||||
import org.apache.poi.sl.usermodel.VerticalAlignment;
|
||||
|
||||
@ -180,12 +180,12 @@ public final class ApacheconEU08 {
|
||||
}
|
||||
}
|
||||
|
||||
Line border1 = table1.createBorder();
|
||||
HSLFLine border1 = table1.createBorder();
|
||||
border1.setLineColor(Color.black);
|
||||
border1.setLineWidth(1.0);
|
||||
table1.setAllBorders(border1);
|
||||
|
||||
Line border2 = table1.createBorder();
|
||||
HSLFLine border2 = table1.createBorder();
|
||||
border2.setLineColor(Color.black);
|
||||
border2.setLineWidth(2.0);
|
||||
table1.setOutsideBorders(border2);
|
||||
|
@ -20,12 +20,12 @@ package org.apache.poi.hslf.examples;
|
||||
import java.awt.Color;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.apache.poi.hslf.model.Line;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlide;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTable;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTableCell;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextRun;
|
||||
import org.apache.poi.hslf.usermodel.HSLFLine;
|
||||
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
|
||||
import org.apache.poi.sl.usermodel.VerticalAlignment;
|
||||
|
||||
@ -71,7 +71,7 @@ public final class TableDemo {
|
||||
}
|
||||
}
|
||||
|
||||
Line border1 = table1.createBorder();
|
||||
HSLFLine border1 = table1.createBorder();
|
||||
border1.setLineColor(Color.black);
|
||||
border1.setLineWidth(1.0);
|
||||
table1.setAllBorders(border1);
|
||||
@ -119,7 +119,7 @@ public final class TableDemo {
|
||||
table2.setRowHeight(0, 30);
|
||||
table2.setRowHeight(1, 70);
|
||||
|
||||
Line border2 = table2.createBorder();
|
||||
HSLFLine border2 = table2.createBorder();
|
||||
table2.setOutsideBorders(border2);
|
||||
|
||||
slide.addShape(table2);
|
||||
|
@ -17,6 +17,14 @@
|
||||
|
||||
package org.apache.poi.sl.usermodel;
|
||||
|
||||
import org.apache.poi.util.Internal;
|
||||
|
||||
/**
|
||||
* Interface for Lines ... this will be eventually removed,
|
||||
* so don't depend on it in user classes, but use AutoShape instead!
|
||||
*/
|
||||
|
||||
@Internal
|
||||
public interface Line<T extends TextParagraph<? extends TextRun>> extends AutoShape<T> {
|
||||
|
||||
}
|
||||
|
@ -15,16 +15,13 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hslf.model;
|
||||
package org.apache.poi.hslf.usermodel;
|
||||
|
||||
import org.apache.poi.ddf.EscherContainerRecord;
|
||||
import org.apache.poi.ddf.EscherOptRecord;
|
||||
import org.apache.poi.ddf.EscherProperties;
|
||||
import org.apache.poi.ddf.EscherSpRecord;
|
||||
import org.apache.poi.hslf.usermodel.HSLFGroupShape;
|
||||
import org.apache.poi.hslf.usermodel.HSLFShape;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextShape;
|
||||
import org.apache.poi.sl.usermodel.Line;
|
||||
import org.apache.poi.sl.usermodel.ShapeContainer;
|
||||
import org.apache.poi.sl.usermodel.ShapeType;
|
||||
|
||||
@ -33,17 +30,17 @@ import org.apache.poi.sl.usermodel.ShapeType;
|
||||
*
|
||||
* @author Yegor Kozlov
|
||||
*/
|
||||
public final class Line extends HSLFTextShape implements org.apache.poi.sl.usermodel.Line<HSLFTextParagraph> {
|
||||
public Line(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
|
||||
public final class HSLFLine extends HSLFTextShape implements Line<HSLFTextParagraph> {
|
||||
public HSLFLine(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape> parent){
|
||||
super(escherRecord, parent);
|
||||
}
|
||||
|
||||
public Line(ShapeContainer<HSLFShape> parent){
|
||||
public HSLFLine(ShapeContainer<HSLFShape> parent){
|
||||
super(null, parent);
|
||||
_escherContainer = createSpContainer(parent instanceof HSLFGroupShape);
|
||||
}
|
||||
|
||||
public Line(){
|
||||
public HSLFLine(){
|
||||
this(null);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public final class HSLFShapeFactory {
|
||||
break;
|
||||
}
|
||||
case LINE:
|
||||
shape = new Line(spContainer, parent);
|
||||
shape = new HSLFLine(spContainer, parent);
|
||||
break;
|
||||
case NOT_PRIMITIVE: {
|
||||
EscherOptRecord opt = HSLFShape.getEscherChild(spContainer, EscherOptRecord.RECORD_ID);
|
||||
|
@ -31,7 +31,6 @@ import org.apache.poi.ddf.EscherProperties;
|
||||
import org.apache.poi.ddf.EscherRecord;
|
||||
import org.apache.poi.ddf.EscherSimpleProperty;
|
||||
import org.apache.poi.ddf.EscherTextboxRecord;
|
||||
import org.apache.poi.hslf.model.Line;
|
||||
import org.apache.poi.sl.usermodel.ShapeContainer;
|
||||
import org.apache.poi.sl.usermodel.TableShape;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
@ -144,16 +143,16 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
HSLFTableCell c = cells[i][j];
|
||||
addShape(c);
|
||||
|
||||
Line bt = c.getBorderTop();
|
||||
HSLFLine bt = c.getBorderTop();
|
||||
if(bt != null) addShape(bt);
|
||||
|
||||
Line br = c.getBorderRight();
|
||||
HSLFLine br = c.getBorderRight();
|
||||
if(br != null) addShape(br);
|
||||
|
||||
Line bb = c.getBorderBottom();
|
||||
HSLFLine bb = c.getBorderBottom();
|
||||
if(bb != null) addShape(bb);
|
||||
|
||||
Line bl = c.getBorderLeft();
|
||||
HSLFLine bl = c.getBorderLeft();
|
||||
if(bl != null) addShape(bl);
|
||||
|
||||
}
|
||||
@ -279,7 +278,7 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
*
|
||||
* @param line the border line
|
||||
*/
|
||||
public void setAllBorders(Line line){
|
||||
public void setAllBorders(HSLFLine line){
|
||||
for (int i = 0; i < cells.length; i++) {
|
||||
for (int j = 0; j < cells[i].length; j++) {
|
||||
HSLFTableCell cell = cells[i][j];
|
||||
@ -296,7 +295,7 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
*
|
||||
* @param line the border line
|
||||
*/
|
||||
public void setOutsideBorders(Line line){
|
||||
public void setOutsideBorders(HSLFLine line){
|
||||
for (int i = 0; i < cells.length; i++) {
|
||||
for (int j = 0; j < cells[i].length; j++) {
|
||||
HSLFTableCell cell = cells[i][j];
|
||||
@ -323,7 +322,7 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
*
|
||||
* @param line the border line
|
||||
*/
|
||||
public void setInsideBorders(Line line){
|
||||
public void setInsideBorders(HSLFLine line){
|
||||
for (int i = 0; i < cells.length; i++) {
|
||||
for (int j = 0; j < cells[i].length; j++) {
|
||||
HSLFTableCell cell = cells[i][j];
|
||||
@ -343,8 +342,8 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
}
|
||||
}
|
||||
|
||||
private Line cloneBorder(Line line){
|
||||
Line border = createBorder();
|
||||
private HSLFLine cloneBorder(HSLFLine line){
|
||||
HSLFLine border = createBorder();
|
||||
border.setLineWidth(line.getLineWidth());
|
||||
border.setLineDashing(line.getLineDashing());
|
||||
border.setLineColor(line.getLineColor());
|
||||
@ -357,8 +356,8 @@ public final class HSLFTable extends HSLFGroupShape implements TableShape {
|
||||
*
|
||||
* @return the created border
|
||||
*/
|
||||
public Line createBorder(){
|
||||
Line line = new Line(this);
|
||||
public HSLFLine createBorder(){
|
||||
HSLFLine line = new HSLFLine(this);
|
||||
|
||||
EscherOptRecord opt = getEscherOptRecord();
|
||||
setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, -1);
|
||||
|
@ -22,7 +22,6 @@ import java.awt.Rectangle;
|
||||
import org.apache.poi.ddf.EscherContainerRecord;
|
||||
import org.apache.poi.ddf.EscherOptRecord;
|
||||
import org.apache.poi.ddf.EscherProperties;
|
||||
import org.apache.poi.hslf.model.Line;
|
||||
import org.apache.poi.sl.usermodel.ShapeContainer;
|
||||
import org.apache.poi.sl.usermodel.ShapeType;
|
||||
|
||||
@ -35,10 +34,10 @@ public final class HSLFTableCell extends HSLFTextBox {
|
||||
protected static final int DEFAULT_WIDTH = 100;
|
||||
protected static final int DEFAULT_HEIGHT = 40;
|
||||
|
||||
private Line borderLeft;
|
||||
private Line borderRight;
|
||||
private Line borderTop;
|
||||
private Line borderBottom;
|
||||
private HSLFLine borderLeft;
|
||||
private HSLFLine borderRight;
|
||||
private HSLFLine borderTop;
|
||||
private HSLFLine borderBottom;
|
||||
|
||||
/**
|
||||
* Create a TableCell object and initialize it from the supplied Record container.
|
||||
@ -76,7 +75,7 @@ public final class HSLFTableCell extends HSLFTextBox {
|
||||
return _escherContainer;
|
||||
}
|
||||
|
||||
protected void anchorBorder(int type, Line line){
|
||||
protected void anchorBorder(int type, HSLFLine line){
|
||||
Rectangle cellAnchor = getAnchor();
|
||||
Rectangle lineAnchor = new Rectangle();
|
||||
switch(type){
|
||||
@ -110,38 +109,38 @@ public final class HSLFTableCell extends HSLFTextBox {
|
||||
line.setAnchor(lineAnchor);
|
||||
}
|
||||
|
||||
public Line getBorderLeft() {
|
||||
public HSLFLine getBorderLeft() {
|
||||
return borderLeft;
|
||||
}
|
||||
|
||||
public void setBorderLeft(Line line) {
|
||||
public void setBorderLeft(HSLFLine line) {
|
||||
if(line != null) anchorBorder(HSLFTable.BORDER_LEFT, line);
|
||||
this.borderLeft = line;
|
||||
}
|
||||
|
||||
public Line getBorderRight() {
|
||||
public HSLFLine getBorderRight() {
|
||||
return borderRight;
|
||||
}
|
||||
|
||||
public void setBorderRight(Line line) {
|
||||
public void setBorderRight(HSLFLine line) {
|
||||
if(line != null) anchorBorder(HSLFTable.BORDER_RIGHT, line);
|
||||
this.borderRight = line;
|
||||
}
|
||||
|
||||
public Line getBorderTop() {
|
||||
public HSLFLine getBorderTop() {
|
||||
return borderTop;
|
||||
}
|
||||
|
||||
public void setBorderTop(Line line) {
|
||||
public void setBorderTop(HSLFLine line) {
|
||||
if(line != null) anchorBorder(HSLFTable.BORDER_TOP, line);
|
||||
this.borderTop = line;
|
||||
}
|
||||
|
||||
public Line getBorderBottom() {
|
||||
public HSLFLine getBorderBottom() {
|
||||
return borderBottom;
|
||||
}
|
||||
|
||||
public void setBorderBottom(Line line) {
|
||||
public void setBorderBottom(HSLFLine line) {
|
||||
if(line != null) anchorBorder(HSLFTable.BORDER_BOTTOM, line);
|
||||
this.borderBottom = line;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import java.awt.Color;
|
||||
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlide;
|
||||
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
|
||||
import org.apache.poi.hslf.usermodel.HSLFLine;
|
||||
import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
|
||||
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
|
||||
import org.junit.Test;
|
||||
@ -40,36 +41,36 @@ public final class TestLine {
|
||||
|
||||
slide.addTitle().setText("Lines tester");
|
||||
|
||||
Line line;
|
||||
HSLFLine line;
|
||||
|
||||
/**
|
||||
* line styles
|
||||
*/
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 200, 300, 0));
|
||||
line.setLineCompound(LineCompound.SINGLE);
|
||||
line.setLineColor(Color.blue);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 230, 300, 0));
|
||||
line.setLineCompound(LineCompound.DOUBLE);
|
||||
line.setLineWidth(3.5);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 260, 300, 0));
|
||||
line.setLineCompound(LineCompound.TRIPLE);
|
||||
line.setLineWidth(6);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 290, 300, 0));
|
||||
line.setLineCompound(LineCompound.THICK_THIN);
|
||||
line.setLineWidth(4.5);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 320, 300, 0));
|
||||
line.setLineCompound(LineCompound.THIN_THICK);
|
||||
line.setLineWidth(5.5);
|
||||
@ -78,27 +79,27 @@ public final class TestLine {
|
||||
/**
|
||||
* line dashing
|
||||
*/
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(450, 200, 300, 0));
|
||||
line.setLineDashing(LineDash.SOLID);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(450, 230, 300, 0));
|
||||
line.setLineDashing(LineDash.DASH);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(450, 260, 300, 0));
|
||||
line.setLineDashing(LineDash.DOT);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(450, 290, 300, 0));
|
||||
line.setLineDashing(LineDash.DASH_DOT);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(450, 320, 300, 0));
|
||||
line.setLineDashing(LineDash.LG_DASH_DOT_DOT);
|
||||
slide.addShape(line);
|
||||
@ -106,21 +107,21 @@ public final class TestLine {
|
||||
/**
|
||||
* Combinations
|
||||
*/
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 400, 300, 0));
|
||||
line.setLineDashing(LineDash.DASH_DOT);
|
||||
line.setLineCompound(LineCompound.TRIPLE);
|
||||
line.setLineWidth(5.0);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 430, 300, 0));
|
||||
line.setLineDashing(LineDash.DASH);
|
||||
line.setLineCompound(LineCompound.THICK_THIN);
|
||||
line.setLineWidth(4.0);
|
||||
slide.addShape(line);
|
||||
|
||||
line = new Line();
|
||||
line = new HSLFLine();
|
||||
line.setAnchor(new java.awt.Rectangle(75, 460, 300, 0));
|
||||
line.setLineDashing(LineDash.DOT);
|
||||
line.setLineCompound(LineCompound.DOUBLE);
|
||||
|
@ -54,6 +54,7 @@ import org.apache.poi.hslf.usermodel.HSLFTextBox;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextRun;
|
||||
import org.apache.poi.hslf.usermodel.HSLFTextShape;
|
||||
import org.apache.poi.hslf.usermodel.HSLFLine;
|
||||
import org.apache.poi.sl.usermodel.PictureData.PictureType;
|
||||
import org.apache.poi.sl.usermodel.ShapeType;
|
||||
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
|
||||
@ -89,7 +90,7 @@ public final class TestShapes {
|
||||
public void graphics() throws Exception {
|
||||
HSLFSlide slide = ppt.createSlide();
|
||||
|
||||
Line line = new Line();
|
||||
HSLFLine line = new HSLFLine();
|
||||
java.awt.Rectangle lineAnchor = new java.awt.Rectangle(100, 200, 50, 60);
|
||||
line.setAnchor(lineAnchor);
|
||||
line.setLineWidth(3);
|
||||
@ -119,7 +120,7 @@ public final class TestShapes {
|
||||
List<HSLFShape> shape = slide.getShapes();
|
||||
assertEquals(2, shape.size());
|
||||
|
||||
assertTrue(shape.get(0) instanceof Line); //group shape
|
||||
assertTrue(shape.get(0) instanceof HSLFLine); //group shape
|
||||
assertEquals(lineAnchor, shape.get(0).getAnchor()); //group shape
|
||||
|
||||
assertTrue(shape.get(1) instanceof HSLFAutoShape); //group shape
|
||||
@ -335,7 +336,7 @@ public final class TestShapes {
|
||||
pict.setAnchor(new Rectangle(0, 0, 200, 200));
|
||||
group.addShape(pict);
|
||||
|
||||
Line line = new Line(group);
|
||||
HSLFLine line = new HSLFLine(group);
|
||||
line.setAnchor(new Rectangle(300, 300, 500, 0));
|
||||
group.addShape(line);
|
||||
|
||||
@ -358,12 +359,12 @@ public final class TestShapes {
|
||||
List<HSLFShape> grshape = group.getShapes();
|
||||
assertEquals(2, grshape.size());
|
||||
assertTrue(grshape.get(0) instanceof HSLFPictureShape);
|
||||
assertTrue(grshape.get(1) instanceof Line);
|
||||
assertTrue(grshape.get(1) instanceof HSLFLine);
|
||||
|
||||
pict = (HSLFPictureShape)grshape.get(0);
|
||||
assertEquals(new Rectangle(0, 0, 200, 200), pict.getAnchor());
|
||||
|
||||
line = (Line)grshape.get(1);
|
||||
line = (HSLFLine)grshape.get(1);
|
||||
assertEquals(new Rectangle(300, 300, 500, 0), line.getAnchor());
|
||||
}
|
||||
|
||||
@ -427,7 +428,7 @@ public final class TestShapes {
|
||||
int dgShapesUsed = dg.getNumShapes(); // number of shapes in the slide
|
||||
//insert 3 shapes and make sure the Ids are properly incremented
|
||||
for (int i = 0; i < 3; i++) {
|
||||
shape = new Line();
|
||||
shape = new HSLFLine();
|
||||
assertEquals(0, shape.getShapeId());
|
||||
slide.addShape(shape);
|
||||
assertTrue(shape.getShapeId() > 0);
|
||||
@ -454,7 +455,7 @@ public final class TestShapes {
|
||||
//make sure it is so
|
||||
int numClusters = dgg.getNumIdClusters();
|
||||
for (int i = 0; i < 1025; i++) {
|
||||
shape = new Line();
|
||||
shape = new HSLFLine();
|
||||
slide.addShape(shape);
|
||||
}
|
||||
assertEquals(numClusters + 1, dgg.getNumIdClusters());
|
||||
|
Loading…
Reference in New Issue
Block a user