You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/03/20 00:44:25 UTC
svn commit: r1667902 [6/8] - in /poi/branches/common_sl/src:
examples/src/org/apache/poi/hslf/examples/
examples/src/org/apache/poi/hssf/usermodel/examples/
examples/src/org/apache/poi/xslf/usermodel/
examples/src/org/apache/poi/xssf/usermodel/examples...
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java Thu Mar 19 23:44:23 2015
@@ -38,9 +38,8 @@ import org.apache.poi.ddf.EscherDggRecor
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperties;
import org.apache.poi.ddf.EscherSimpleProperty;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.sl.usermodel.ShapeType;
import org.junit.Before;
import org.junit.Test;
@@ -53,17 +52,17 @@ import org.junit.Test;
public final class TestShapes {
private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
- private SlideShow ppt;
- private SlideShow pptB;
+ private HSLFSlideShow ppt;
+ private HSLFSlideShow pptB;
@Before
public void setUp() throws Exception {
InputStream is1 = null, is2 = null;
try {
is1 = _slTests.openResourceAsStream("empty.ppt");
- ppt = new SlideShow(is1);
+ ppt = new HSLFSlideShow(is1);
is2 = _slTests.openResourceAsStream("empty_textbox.ppt");
- pptB = new SlideShow(is2);
+ pptB = new HSLFSlideShow(is2);
} finally {
is1.close();
is2.close();
@@ -72,7 +71,7 @@ public final class TestShapes {
@Test
public void graphics() throws Exception {
- Slide slide = ppt.createSlide();
+ HSLFSlide slide = ppt.createSlide();
Line line = new Line();
java.awt.Rectangle lineAnchor = new java.awt.Rectangle(100, 200, 50, 60);
@@ -82,7 +81,7 @@ public final class TestShapes {
line.setLineColor(Color.red);
slide.addShape(line);
- AutoShape ellipse = new AutoShape(ShapeType.ELLIPSE);
+ HSLFAutoShape ellipse = new HSLFAutoShape(ShapeType.ELLIPSE);
java.awt.Rectangle ellipseAnchor = new Rectangle(320, 154, 55, 111);
ellipse.setAnchor(ellipseAnchor);
ellipse.setLineWidth(2);
@@ -97,7 +96,7 @@ public final class TestShapes {
//read ppt from byte array
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
assertEquals(1, ppt.getSlides().length);
slide = ppt.getSlides()[0];
@@ -107,7 +106,7 @@ public final class TestShapes {
assertTrue(shape[0] instanceof Line); //group shape
assertEquals(lineAnchor, shape[0].getAnchor()); //group shape
- assertTrue(shape[1] instanceof AutoShape); //group shape
+ assertTrue(shape[1] instanceof HSLFAutoShape); //group shape
assertEquals(ellipseAnchor, shape[1].getAnchor()); //group shape
}
@@ -117,17 +116,17 @@ public final class TestShapes {
*/
@Test
public void textBoxRead() throws Exception {
- ppt = new SlideShow(_slTests.openResourceAsStream("with_textbox.ppt"));
- Slide sl = ppt.getSlides()[0];
+ ppt = new HSLFSlideShow(_slTests.openResourceAsStream("with_textbox.ppt"));
+ HSLFSlide sl = ppt.getSlides()[0];
HSLFShape[] sh = sl.getShapes();
for (int i = 0; i < sh.length; i++) {
- assertTrue(sh[i] instanceof TextBox);
- TextBox txtbox = (TextBox)sh[i];
+ assertTrue(sh[i] instanceof HSLFTextBox);
+ HSLFTextBox txtbox = (HSLFTextBox)sh[i];
String text = txtbox.getText();
assertNotNull(text);
- assertEquals(txtbox.getTextRun().getRichTextRuns().length, 1);
- RichTextRun rt = txtbox.getTextRun().getRichTextRuns()[0];
+ assertEquals(txtbox.getTextParagraph().getRichTextRuns().length, 1);
+ HSLFTextRun rt = txtbox.getTextParagraph().getRichTextRuns()[0];
if (text.equals("Hello, World!!!")){
assertEquals(32, rt.getFontSize());
@@ -153,15 +152,15 @@ public final class TestShapes {
*/
@Test
public void textBoxWriteBytes() throws Exception {
- ppt = new SlideShow();
- Slide sl = ppt.createSlide();
- RichTextRun rt;
+ ppt = new HSLFSlideShow();
+ HSLFSlide sl = ppt.createSlide();
+ HSLFTextRun rt;
String val = "Hello, World!";
// Create a new textbox, and give it lots of properties
- TextBox txtbox = new TextBox();
- rt = txtbox.getTextRun().getRichTextRuns()[0];
+ HSLFTextBox txtbox = new HSLFTextBox();
+ rt = txtbox.getTextParagraph().getRichTextRuns()[0];
txtbox.setText(val);
rt.setFontName("Arial");
rt.setFontSize(42);
@@ -172,7 +171,7 @@ public final class TestShapes {
sl.addShape(txtbox);
// Check it before save
- rt = txtbox.getTextRun().getRichTextRuns()[0];
+ rt = txtbox.getTextParagraph().getRichTextRuns()[0];
assertEquals(val, rt.getText());
assertEquals(42, rt.getFontSize());
assertTrue(rt.isBold());
@@ -186,11 +185,11 @@ public final class TestShapes {
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
sl = ppt.getSlides()[0];
- txtbox = (TextBox)sl.getShapes()[0];
- rt = txtbox.getTextRun().getRichTextRuns()[0];
+ txtbox = (HSLFTextBox)sl.getShapes()[0];
+ rt = txtbox.getTextParagraph().getRichTextRuns()[0];
// Check after save
assertEquals(val, rt.getText());
@@ -208,8 +207,8 @@ public final class TestShapes {
@Test
public void emptyTextBox() {
assertEquals(2, pptB.getSlides().length);
- Slide s1 = pptB.getSlides()[0];
- Slide s2 = pptB.getSlides()[1];
+ HSLFSlide s1 = pptB.getSlides()[0];
+ HSLFSlide s2 = pptB.getSlides()[1];
// Check we can get the shapes count
assertEquals(2, s1.getShapes().length);
@@ -231,11 +230,11 @@ public final class TestShapes {
}
private void textBoxSet(String filename) throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(filename));
- Slide[] sl = ppt.getSlides();
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream(filename));
+ HSLFSlide[] sl = ppt.getSlides();
for (int k = 0; k < sl.length; k++) {
ArrayList<String> lst1 = new ArrayList<String>();
- TextRun[] txt = sl[k].getTextRuns();
+ HSLFTextParagraph[] txt = sl[k].getTextRuns();
for (int i = 0; i < txt.length; i++) {
lst1.add(txt[i].getText());
}
@@ -243,8 +242,8 @@ public final class TestShapes {
ArrayList<String> lst2 = new ArrayList<String>();
HSLFShape[] sh = sl[k].getShapes();
for (int i = 0; i < sh.length; i++) {
- if (sh[i] instanceof TextShape){
- TextShape tbox = (TextShape)sh[i];
+ if (sh[i] instanceof HSLFTextShape){
+ HSLFTextShape tbox = (HSLFTextShape)sh[i];
lst2.add(tbox.getText());
}
}
@@ -258,9 +257,9 @@ public final class TestShapes {
*/
@Test
public void shapeGroup() throws Exception {
- SlideShow ppt = new SlideShow();
+ HSLFSlideShow ppt = new HSLFSlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlide slide = ppt.createSlide();
Dimension pgsize = ppt.getPageSize();
HSLFGroupShape group = new HSLFGroupShape();
@@ -268,8 +267,8 @@ public final class TestShapes {
group.setAnchor(new Rectangle(0, 0, (int)pgsize.getWidth(), (int)pgsize.getHeight()));
slide.addShape(group);
- int idx = ppt.addPicture(_slTests.readFile("clock.jpg"), Picture.JPEG);
- Picture pict = new Picture(idx, group);
+ int idx = ppt.addPicture(_slTests.readFile("clock.jpg"), HSLFPictureShape.JPEG);
+ HSLFPictureShape pict = new HSLFPictureShape(idx, group);
pict.setAnchor(new Rectangle(0, 0, 200, 200));
group.addShape(pict);
@@ -283,7 +282,7 @@ public final class TestShapes {
out.close();
ByteArrayInputStream is = new ByteArrayInputStream(out.toByteArray());
- ppt = new SlideShow(is);
+ ppt = new HSLFSlideShow(is);
is.close();
slide = ppt.getSlides()[0];
@@ -295,10 +294,10 @@ public final class TestShapes {
group = (HSLFGroupShape)shape[0];
HSLFShape[] grshape = group.getShapes();
assertEquals(2, grshape.length);
- assertTrue(grshape[0] instanceof Picture);
+ assertTrue(grshape[0] instanceof HSLFPictureShape);
assertTrue(grshape[1] instanceof Line);
- pict = (Picture)grshape[0];
+ pict = (HSLFPictureShape)grshape[0];
assertEquals(new Rectangle(0, 0, 200, 200), pict.getAnchor());
line = (Line)grshape[1];
@@ -311,8 +310,8 @@ public final class TestShapes {
@Test
public void removeShapes() throws IOException {
String file = "with_textbox.ppt";
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(file));
- Slide sl = ppt.getSlides()[0];
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream(file));
+ HSLFSlide sl = ppt.getSlides()[0];
HSLFShape[] sh = sl.getShapes();
assertEquals("expected four shaped in " + file, 4, sh.length);
//remove all
@@ -328,30 +327,30 @@ public final class TestShapes {
ppt.write(out);
out.close();
- ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+ ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
sl = ppt.getSlides()[0];
assertEquals("expected 0 shaped in " + file, 0, sl.getShapes().length);
}
@Test
public void lineWidth() {
- SimpleShape sh = new AutoShape(ShapeType.RT_TRIANGLE);
+ HSLFSimpleShape sh = new HSLFAutoShape(ShapeType.RT_TRIANGLE);
EscherOptRecord opt = sh.getEscherOptRecord();
- EscherSimpleProperty prop = SimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
+ EscherSimpleProperty prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNull(prop);
- assertEquals(SimpleShape.DEFAULT_LINE_WIDTH, sh.getLineWidth(), 0);
+ assertEquals(HSLFSimpleShape.DEFAULT_LINE_WIDTH, sh.getLineWidth(), 0);
sh.setLineWidth(1.0);
- prop = SimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
+ prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNotNull(prop);
assertEquals(1.0, sh.getLineWidth(), 0);
}
@Test
public void shapeId() {
- SlideShow ppt = new SlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlideShow ppt = new HSLFSlideShow();
+ HSLFSlide slide = ppt.createSlide();
HSLFShape shape = null;
//EscherDgg is a document-level record which keeps track of the drawing groups
@@ -400,25 +399,25 @@ public final class TestShapes {
@Test
public void lineColor() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("51731.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("51731.ppt"));
HSLFShape[] shape = ppt.getSlides()[0].getShapes();
assertEquals(4, shape.length);
- TextShape sh1 = (TextShape)shape[0];
+ HSLFTextShape sh1 = (HSLFTextShape)shape[0];
assertEquals("Hello Apache POI", sh1.getText());
assertNull(sh1.getLineColor());
- TextShape sh2 = (TextShape)shape[1];
+ HSLFTextShape sh2 = (HSLFTextShape)shape[1];
assertEquals("Why are you showing this border?", sh2.getText());
assertNull(sh2.getLineColor());
- TextShape sh3 = (TextShape)shape[2];
+ HSLFTextShape sh3 = (HSLFTextShape)shape[2];
assertEquals("Text in a black border", sh3.getText());
assertEquals(Color.black, sh3.getLineColor());
assertEquals(0.75, sh3.getLineWidth(), 0);
- TextShape sh4 = (TextShape)shape[3];
+ HSLFTextShape sh4 = (HSLFTextShape)shape[3];
assertEquals("Border width is 5 pt", sh4.getText());
assertEquals(Color.black, sh4.getLineColor());
assertEquals(5.0, sh4.getLineWidth(), 0);
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java Thu Mar 19 23:44:23 2015
@@ -23,7 +23,7 @@ import junit.framework.TestCase;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
import org.apache.poi.hslf.record.ColorSchemeAtom;
import org.apache.poi.hslf.record.PPDrawing;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -42,7 +42,7 @@ public final class TestSheet extends Tes
String[] tests = {"SampleShow.ppt", "backgrounds.ppt", "text_shapes.ppt", "pictures.ppt"};
for (String file : tests) {
try {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(file));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream(file));
doSlideShow(ppt);
} catch (EncryptedPowerPointFileException e){
; //skip encrypted ppt
@@ -50,21 +50,21 @@ public final class TestSheet extends Tes
}
}
- private void doSlideShow(SlideShow ppt) {
- Slide[] slide = ppt.getSlides();
+ private void doSlideShow(HSLFSlideShow ppt) {
+ HSLFSlide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
verify(slide[i]);
- Notes notes = slide[i].getNotesSheet();
+ HSLFNotes notes = slide[i].getNotesSheet();
if(notes != null) verify(notes);
- MasterSheet master = slide[i].getMasterSheet();
+ HSLFMasterSheet master = slide[i].getMasterSheet();
assertNotNull(master);
verify(master);
}
}
- private void verify(Sheet sheet){
+ private void verify(HSLFSheet sheet){
assertNotNull(sheet.getSlideShow());
ColorSchemeAtom colorscheme = sheet.getColorScheme();
@@ -73,13 +73,13 @@ public final class TestSheet extends Tes
PPDrawing ppdrawing = sheet.getPPDrawing();
assertNotNull(ppdrawing);
- Background background = sheet.getBackground();
+ HSLFBackground background = sheet.getBackground();
assertNotNull(background);
assertTrue(sheet._getSheetNumber() != 0);
assertTrue(sheet._getSheetRefId() != 0);
- TextRun[] txt = sheet.getTextRuns();
+ HSLFTextParagraph[] txt = sheet.getTextRuns();
if (txt == null) {
throw new AssertionFailedError("no text runs");
}
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java Thu Mar 19 23:44:23 2015
@@ -20,9 +20,8 @@ package org.apache.poi.hslf.model;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.record.SlideAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -32,16 +31,16 @@ import org.apache.poi.POIDataSamples;
*/
public final class TestSlideChangeNotes extends TestCase {
// SlideShow primed on the test data
- private SlideShow ss;
+ private HSLFSlideShow ss;
public TestSlideChangeNotes() throws Exception {
POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
- HSLFSlideShow hss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
- ss = new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+ ss = new HSLFSlideShow(hss);
}
public void testSetToNone() {
- Slide slideOne = ss.getSlides()[0];
+ HSLFSlide slideOne = ss.getSlides()[0];
SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
slideOne.setNotes(null);
@@ -50,8 +49,8 @@ public final class TestSlideChangeNotes
}
public void testSetToSomething() {
- Slide slideOne = ss.getSlides()[0];
- Notes notesOne = ss.getNotes()[1];
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFNotes notesOne = ss.getNotes()[1];
SlideAtom sa = slideOne.getSlideRecord().getSlideAtom();
slideOne.setNotes(notesOne);
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Thu Mar 19 23:44:23 2015
@@ -22,12 +22,11 @@ import java.io.ByteArrayOutputStream;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
import org.apache.poi.hslf.record.Environment;
import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -43,7 +42,7 @@ public final class TestSlideMaster exten
* Check we can read their attributes.
*/
public void testSlideMaster() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
Environment env = ppt.getDocumentRecord().getEnvironment();
@@ -83,7 +82,7 @@ public final class TestSlideMaster exten
* Test we can read default text attributes for a title master sheet
*/
public void testTitleMasterTextAttributes() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
TitleMaster[] master = ppt.getTitleMasters();
assertEquals(1, master.length);
@@ -104,14 +103,14 @@ public final class TestSlideMaster exten
* Slide 3 has title layout and follows the TitleMaster. Verify that.
*/
public void testTitleMaster() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
- Slide slide = ppt.getSlides()[2];
- MasterSheet masterSheet = slide.getMasterSheet();
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlide slide = ppt.getSlides()[2];
+ HSLFMasterSheet masterSheet = slide.getMasterSheet();
assertTrue(masterSheet instanceof TitleMaster);
- TextRun[] txt = slide.getTextRuns();
+ HSLFTextParagraph[] txt = slide.getTextRuns();
for (int i = 0; i < txt.length; i++) {
- RichTextRun rt = txt[i].getRichTextRuns()[0];
+ HSLFTextRun rt = txt[i].getRichTextRuns()[0];
switch(txt[i].getRunType()){
case TextHeaderAtom.CENTER_TITLE_TYPE:
assertEquals("Arial", rt.getFontName());
@@ -133,20 +132,20 @@ public final class TestSlideMaster exten
* If a style attribute is not set ensure it is read from the master
*/
public void testMasterAttributes() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
- Slide[] slide = ppt.getSlides();
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlide[] slide = ppt.getSlides();
assertEquals(3, slide.length);
- TextRun[] trun;
+ HSLFTextParagraph[] trun;
trun = slide[0].getTextRuns();
for (int i = 0; i < trun.length; i++) {
if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
- RichTextRun rt = trun[i].getRichTextRuns()[0];
+ HSLFTextRun rt = trun[i].getRichTextRuns()[0];
assertEquals(40, rt.getFontSize());
assertEquals(true, rt.isUnderlined());
assertEquals("Arial", rt.getFontName());
} else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
- RichTextRun rt;
+ HSLFTextRun rt;
rt = trun[i].getRichTextRuns()[0];
assertEquals(0, rt.getIndentLevel());
assertEquals(32, rt.getFontSize());
@@ -163,12 +162,12 @@ public final class TestSlideMaster exten
trun = slide[1].getTextRuns();
for (int i = 0; i < trun.length; i++) {
if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
- RichTextRun rt = trun[i].getRichTextRuns()[0];
+ HSLFTextRun rt = trun[i].getRichTextRuns()[0];
assertEquals(48, rt.getFontSize());
assertEquals(true, rt.isItalic());
assertEquals("Georgia", rt.getFontName());
} else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
- RichTextRun rt;
+ HSLFTextRun rt;
rt = trun[i].getRichTextRuns()[0];
assertEquals(0, rt.getIndentLevel());
assertEquals(32, rt.getFontSize());
@@ -182,9 +181,9 @@ public final class TestSlideMaster exten
* Check we can dynamically assign a slide master to a slide.
*/
public void testChangeSlideMaster() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
SlideMaster[] master = ppt.getSlidesMasters();
- Slide[] slide = ppt.getSlides();
+ HSLFSlide[] slide = ppt.getSlides();
int sheetNo;
//each slide uses its own master
@@ -203,7 +202,7 @@ public final class TestSlideMaster exten
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
master = ppt.getSlidesMasters();
slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
@@ -216,19 +215,19 @@ public final class TestSlideMaster exten
* (typical for the "bullted body" placeholder)
*/
public void testIndentation() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
- Slide slide = ppt.getSlides()[0];
- TextRun[] trun;
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+ HSLFSlide slide = ppt.getSlides()[0];
+ HSLFTextParagraph[] trun;
trun = slide.getTextRuns();
for (int i = 0; i < trun.length; i++) {
if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
- RichTextRun rt = trun[i].getRichTextRuns()[0];
+ HSLFTextRun rt = trun[i].getRichTextRuns()[0];
assertEquals(40, rt.getFontSize());
assertEquals(true, rt.isUnderlined());
assertEquals("Arial", rt.getFontName());
} else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
- RichTextRun[] rt = trun[i].getRichTextRuns();
+ HSLFTextRun[] rt = trun[i].getRichTextRuns();
for (int j = 0; j < rt.length; j++) {
int indent = rt[j].getIndentLevel();
switch (indent){
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java Thu Mar 19 23:44:23 2015
@@ -18,8 +18,8 @@
package org.apache.poi.hslf.model;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
+
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
import java.io.ByteArrayOutputStream;
@@ -39,10 +39,10 @@ public final class TestSlides extends Te
* @throws Exception
*/
public void testAddSlides1() throws Exception {
- SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+ HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
assertTrue(ppt.getSlides().length == 0);
- Slide s1 = ppt.createSlide();
+ HSLFSlide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
@@ -53,7 +53,7 @@ public final class TestSlides extends Te
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
assertTrue(ppt.getSlides().length == 1);
}
@@ -62,16 +62,16 @@ public final class TestSlides extends Te
* @throws Exception
*/
public void testAddSlides2() throws Exception {
- SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+ HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
assertTrue(ppt.getSlides().length == 0);
- Slide s1 = ppt.createSlide();
+ HSLFSlide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
assertEquals(1, s1.getSlideNumber());
- Slide s2 = ppt.createSlide();
+ HSLFSlide s2 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 2);
assertEquals(4, s2._getSheetRefId());
assertEquals(257, s2._getSheetNumber());
@@ -82,7 +82,7 @@ public final class TestSlides extends Te
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
assertTrue(ppt.getSlides().length == 2);
}
@@ -91,22 +91,22 @@ public final class TestSlides extends Te
* @throws Exception
*/
public void testAddSlides3() throws Exception {
- SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+ HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
assertTrue(ppt.getSlides().length == 0);
- Slide s1 = ppt.createSlide();
+ HSLFSlide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
assertEquals(1, s1.getSlideNumber());
- Slide s2 = ppt.createSlide();
+ HSLFSlide s2 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 2);
assertEquals(4, s2._getSheetRefId());
assertEquals(257, s2._getSheetNumber());
assertEquals(2, s2.getSlideNumber());
- Slide s3 = ppt.createSlide();
+ HSLFSlide s3 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 3);
assertEquals(5, s3._getSheetRefId());
assertEquals(258, s3._getSheetNumber());
@@ -118,7 +118,7 @@ public final class TestSlides extends Te
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
assertTrue(ppt.getSlides().length == 3);
// Check IDs are still right
@@ -139,22 +139,22 @@ public final class TestSlides extends Te
*/
public void testAddSlides2to3() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- SlideShow ppt = new SlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
assertTrue(ppt.getSlides().length == 2);
// First slide is 256 / 4
- Slide s1 = ppt.getSlides()[0];
+ HSLFSlide s1 = ppt.getSlides()[0];
assertEquals(256, s1._getSheetNumber());
assertEquals(4, s1._getSheetRefId());
// Last slide is 257 / 6
- Slide s2 = ppt.getSlides()[1];
+ HSLFSlide s2 = ppt.getSlides()[1];
assertEquals(257, s2._getSheetNumber());
assertEquals(6, s2._getSheetRefId());
// Add another slide, goes in at the end
- Slide s3 = ppt.createSlide();
+ HSLFSlide s3 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 3);
assertEquals(258, s3._getSheetNumber());
assertEquals(8, s3._getSheetRefId());
@@ -165,7 +165,7 @@ public final class TestSlides extends Te
ppt.write(out);
out.close();
- ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+ ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
assertTrue(ppt.getSlides().length == 3);
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Thu Mar 19 23:44:23 2015
@@ -23,7 +23,7 @@ import java.io.ByteArrayOutputStream;
import junit.framework.TestCase;
import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Test <code>Table</code> object.
@@ -36,16 +36,16 @@ public final class TestTable extends Tes
* Test that ShapeFactory works properly and returns <code>Table</code>
*/
public void testShapeFactory() throws Exception {
- SlideShow ppt = new SlideShow();
+ HSLFSlideShow ppt = new HSLFSlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlide slide = ppt.createSlide();
Table tbl = new Table(2, 5);
slide.addShape(tbl);
TableCell cell = tbl.getCell(0, 0);
//table cells have type=TextHeaderAtom.OTHER_TYPE, see bug #46033
- assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextRun().getRunType());
+ assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextParagraph().getRunType());
assertTrue(slide.getShapes()[0] instanceof Table);
Table tbl2 = (Table)slide.getShapes()[0];
@@ -56,7 +56,7 @@ public final class TestTable extends Tes
ppt.write(out);
out.close();
- ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+ ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
slide = ppt.getSlides()[0];
assertTrue(slide.getShapes()[0] instanceof Table);
Table tbl3 = (Table)slide.getShapes()[0];
@@ -68,8 +68,8 @@ public final class TestTable extends Tes
* Error constructing Table when rownum=1
*/
public void test45889(){
- SlideShow ppt = new SlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlideShow ppt = new HSLFSlideShow();
+ HSLFSlide slide = ppt.createSlide();
HSLFShape[] shapes;
Table tbl1 = new Table(1, 5);
assertEquals(5, tbl1.getNumberOfColumns());
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java Thu Mar 19 23:44:23 2015
@@ -30,8 +30,8 @@ import org.apache.poi.hslf.record.Record
import org.apache.poi.hslf.record.TextBytesAtom;
import org.apache.poi.hslf.record.TextCharsAtom;
import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -43,24 +43,24 @@ public final class TestTextRun extends T
private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
// SlideShow primed on the test data
- private SlideShow ss;
- private SlideShow ssRich;
+ private HSLFSlideShow ss;
+ private HSLFSlideShow ssRich;
protected void setUp() throws IOException {
// Basic (non rich) test file
- ss = new SlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+ ss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
// Rich test file
- ssRich = new SlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
+ ssRich = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
}
/**
* Test to ensure that getting the text works correctly
*/
public void testGetText() {
- Slide slideOne = ss.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
assertEquals(2, textRuns.length);
@@ -74,8 +74,8 @@ public final class TestTextRun extends T
// Now check on a rich text run
- Slide slideOneR = ssRich.getSlides()[0];
- TextRun[] textRunsR = slideOneR.getTextRuns();
+ HSLFSlide slideOneR = ssRich.getSlides()[0];
+ HSLFTextParagraph[] textRunsR = slideOneR.getTextRuns();
assertEquals(2, textRunsR.length);
assertEquals("This is a title, it\u2019s in black", textRunsR[0].getText());
@@ -88,9 +88,9 @@ public final class TestTextRun extends T
* Test to ensure changing non rich text bytes->bytes works correctly
*/
public void testSetText() {
- Slide slideOne = ss.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
- TextRun run = textRuns[0];
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
+ HSLFTextParagraph run = textRuns[0];
// Check current text
assertEquals("This is a test title", run.getText());
@@ -110,8 +110,8 @@ public final class TestTextRun extends T
* chars works correctly
*/
public void testAdvancedSetText() {
- Slide slideOne = ss.getSlides()[0];
- TextRun run = slideOne.getTextRuns()[0];
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph run = slideOne.getTextRuns()[0];
TextHeaderAtom tha = run._headerAtom;
TextBytesAtom tba = run._byteAtom;
@@ -171,19 +171,19 @@ public final class TestTextRun extends T
* set up for it
*/
public void testGetRichTextNonRich() {
- Slide slideOne = ss.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
assertEquals(2, textRuns.length);
- TextRun trA = textRuns[0];
- TextRun trB = textRuns[1];
+ HSLFTextParagraph trA = textRuns[0];
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(1, trA.getRichTextRuns().length);
assertEquals(1, trB.getRichTextRuns().length);
- RichTextRun rtrA = trA.getRichTextRuns()[0];
- RichTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrA = trA.getRichTextRuns()[0];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
assertEquals(trA.getText(), rtrA.getText());
assertEquals(trB.getText(), rtrB.getText());
@@ -198,21 +198,21 @@ public final class TestTextRun extends T
* Tests to ensure that the rich text runs are built up correctly
*/
public void testGetRichText() {
- Slide slideOne = ssRich.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
+ HSLFSlide slideOne = ssRich.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
assertEquals(2, textRuns.length);
- TextRun trA = textRuns[0];
- TextRun trB = textRuns[1];
+ HSLFTextParagraph trA = textRuns[0];
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(1, trA.getRichTextRuns().length);
assertEquals(3, trB.getRichTextRuns().length);
- RichTextRun rtrA = trA.getRichTextRuns()[0];
- RichTextRun rtrB = trB.getRichTextRuns()[0];
- RichTextRun rtrC = trB.getRichTextRuns()[1];
- RichTextRun rtrD = trB.getRichTextRuns()[2];
+ HSLFTextRun rtrA = trA.getRichTextRuns()[0];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrC = trB.getRichTextRuns()[1];
+ HSLFTextRun rtrD = trB.getRichTextRuns()[2];
assertEquals(trA.getText(), rtrA.getText());
@@ -244,12 +244,12 @@ public final class TestTextRun extends T
* ensuring that everything stays with the same default styling
*/
public void testSetTextWhereNotRich() {
- Slide slideOne = ss.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
- TextRun trB = textRuns[1];
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(1, trB.getRichTextRuns().length);
- RichTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
assertEquals(trB.getText(), rtrB.getText());
assertNull(rtrB._getRawCharacterStyle());
assertNull(rtrB._getRawParagraphStyle());
@@ -268,14 +268,14 @@ public final class TestTextRun extends T
* sets everything to the same styling
*/
public void testSetTextWhereRich() {
- Slide slideOne = ssRich.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
- TextRun trB = textRuns[1];
+ HSLFSlide slideOne = ssRich.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(3, trB.getRichTextRuns().length);
- RichTextRun rtrB = trB.getRichTextRuns()[0];
- RichTextRun rtrC = trB.getRichTextRuns()[1];
- RichTextRun rtrD = trB.getRichTextRuns()[2];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrC = trB.getRichTextRuns()[1];
+ HSLFTextRun rtrD = trB.getRichTextRuns()[2];
TextPropCollection tpBP = rtrB._getRawParagraphStyle();
TextPropCollection tpBC = rtrB._getRawCharacterStyle();
TextPropCollection tpCP = rtrC._getRawParagraphStyle();
@@ -316,12 +316,12 @@ public final class TestTextRun extends T
* in a rich text run, that doesn't happen to actually be rich
*/
public void testChangeTextInRichTextRunNonRich() {
- Slide slideOne = ss.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
- TextRun trB = textRuns[1];
+ HSLFSlide slideOne = ss.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(1, trB.getRichTextRuns().length);
- RichTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
assertEquals(trB.getText(), rtrB.getText());
assertNull(rtrB._getRawCharacterStyle());
assertNull(rtrB._getRawParagraphStyle());
@@ -341,16 +341,16 @@ public final class TestTextRun extends T
* correctly
*/
public void testChangeTextInRichTextRun() {
- Slide slideOne = ssRich.getSlides()[0];
- TextRun[] textRuns = slideOne.getTextRuns();
- TextRun trB = textRuns[1];
+ HSLFSlide slideOne = ssRich.getSlides()[0];
+ HSLFTextParagraph[] textRuns = slideOne.getTextRuns();
+ HSLFTextParagraph trB = textRuns[1];
assertEquals(3, trB.getRichTextRuns().length);
// We start with 3 text runs, each with their own set of styles,
// but all sharing the same paragraph styles
- RichTextRun rtrB = trB.getRichTextRuns()[0];
- RichTextRun rtrC = trB.getRichTextRuns()[1];
- RichTextRun rtrD = trB.getRichTextRuns()[2];
+ HSLFTextRun rtrB = trB.getRichTextRuns()[0];
+ HSLFTextRun rtrC = trB.getRichTextRuns()[1];
+ HSLFTextRun rtrD = trB.getRichTextRuns()[2];
TextPropCollection tpBP = rtrB._getRawParagraphStyle();
TextPropCollection tpBC = rtrB._getRawCharacterStyle();
TextPropCollection tpCP = rtrC._getRawParagraphStyle();
@@ -421,11 +421,11 @@ public final class TestTextRun extends T
*
*/
public void testBug41015() throws IOException {
- RichTextRun[] rt;
+ HSLFTextRun[] rt;
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bug-41015.ppt"));
- Slide sl = ppt.getSlides()[0];
- TextRun[] txt = sl.getTextRuns();
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bug-41015.ppt"));
+ HSLFSlide sl = ppt.getSlides()[0];
+ HSLFTextParagraph[] txt = sl.getTextRuns();
assertEquals(2, txt.length);
rt = txt[0].getRichTextRuns();
@@ -448,24 +448,24 @@ public final class TestTextRun extends T
* Test creation of TextRun objects.
*/
public void testAddTextRun() {
- SlideShow ppt = new SlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlideShow ppt = new HSLFSlideShow();
+ HSLFSlide slide = ppt.createSlide();
assertNull(slide.getTextRuns());
- TextBox shape1 = new TextBox();
- TextRun run1 = shape1.getTextRun();
+ HSLFTextBox shape1 = new HSLFTextBox();
+ HSLFTextParagraph run1 = shape1.getTextParagraph();
assertSame(run1, shape1.createTextRun());
run1.setText("Text 1");
slide.addShape(shape1);
//The array of Slide's text runs must be updated when new text shapes are added.
- TextRun[] runs = slide.getTextRuns();
+ HSLFTextParagraph[] runs = slide.getTextRuns();
assertNotNull(runs);
assertSame(run1, runs[0]);
- TextBox shape2 = new TextBox();
- TextRun run2 = shape2.getTextRun();
+ HSLFTextBox shape2 = new HSLFTextBox();
+ HSLFTextParagraph run2 = shape2.getTextParagraph();
assertSame(run2, shape2.createTextRun());
run2.setText("Text 2");
slide.addShape(shape2);
@@ -479,14 +479,14 @@ public final class TestTextRun extends T
//as getShapes()
HSLFShape[] sh = slide.getShapes();
assertEquals(2, sh.length);
- assertTrue(sh[0] instanceof TextBox);
- TextBox box1 = (TextBox)sh[0];
- assertSame(run1, box1.getTextRun());
- TextBox box2 = (TextBox)sh[1];
- assertSame(run2, box2.getTextRun());
+ assertTrue(sh[0] instanceof HSLFTextBox);
+ HSLFTextBox box1 = (HSLFTextBox)sh[0];
+ assertSame(run1, box1.getTextParagraph());
+ HSLFTextBox box2 = (HSLFTextBox)sh[1];
+ assertSame(run2, box2.getTextParagraph());
//test Table - a complex group of shapes containing text objects
- Slide slide2 = ppt.createSlide();
+ HSLFSlide slide2 = ppt.createSlide();
assertNull(slide2.getTextRuns());
Table table = new Table(2, 2);
slide2.addShape(table);
@@ -496,12 +496,12 @@ public final class TestTextRun extends T
}
public void test48916() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("SampleShow.ppt"));
- for(Slide slide : ppt.getSlides()){
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("SampleShow.ppt"));
+ for(HSLFSlide slide : ppt.getSlides()){
for(HSLFShape sh : slide.getShapes()){
- if(sh instanceof TextShape){
- TextShape tx = (TextShape)sh;
- TextRun run = tx.getTextRun();
+ if(sh instanceof HSLFTextShape){
+ HSLFTextShape tx = (HSLFTextShape)sh;
+ HSLFTextParagraph run = tx.getTextParagraph();
//verify that records cached in TextRun and EscherTextboxWrapper are the same
Record[] runChildren = run.getRecords();
Record[] txboxChildren = tx.getEscherTextboxWrapper().getChildRecords();
@@ -517,13 +517,13 @@ public final class TestTextRun extends T
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
ppt.write(out);
- ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
- for(Slide slide : ppt.getSlides()){
+ ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
+ for(HSLFSlide slide : ppt.getSlides()){
for(HSLFShape sh : slide.getShapes()){
- if(sh instanceof TextShape){
- TextShape tx = (TextShape)sh;
- TextRun run = tx.getTextRun();
- RichTextRun rt = run.getRichTextRuns()[0];
+ if(sh instanceof HSLFTextShape){
+ HSLFTextShape tx = (HSLFTextShape)sh;
+ HSLFTextParagraph run = tx.getTextParagraph();
+ HSLFTextRun rt = run.getRichTextRuns()[0];
assertTrue(rt.isBold());
assertEquals(rt.getFontColor(), Color.RED);
}
@@ -533,9 +533,9 @@ public final class TestTextRun extends T
}
public void test52244() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("52244.ppt"));
- Slide slide = ppt.getSlides()[0];
- TextRun[] runs = slide.getTextRuns();
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("52244.ppt"));
+ HSLFSlide slide = ppt.getSlides()[0];
+ HSLFTextParagraph[] runs = slide.getTextRuns();
assertEquals("Arial", runs[0].getRichTextRuns()[0].getFontName());
assertEquals(36, runs[0].getRichTextRuns()[0].getFontSize());
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java Thu Mar 19 23:44:23 2015
@@ -19,11 +19,11 @@ package org.apache.poi.hslf.model;
import junit.framework.TestCase;
+
import java.io.*;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.POIDataSamples;
@@ -36,9 +36,9 @@ import org.apache.poi.POIDataSamples;
*/
public final class TestTextRunReWrite extends TestCase {
// HSLFSlideShow primed on the test data
- private HSLFSlideShow hss;
+ private HSLFSlideShowImpl hss;
// HSLFSlideShow primed on the test data
- private SlideShow ss;
+ private HSLFSlideShow ss;
// POIFS primed on the test data
private POIFSFileSystem pfs;
@@ -49,14 +49,14 @@ public final class TestTextRunReWrite ex
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
pfs = new POIFSFileSystem(slTests.openResourceAsStream(filename));
- hss = new HSLFSlideShow(pfs);
- ss = new SlideShow(hss);
+ hss = new HSLFSlideShowImpl(pfs);
+ ss = new HSLFSlideShow(hss);
}
public void testWritesOutTheSameNonRich() throws Exception {
// Grab the first text run on the first sheet
- TextRun tr1 = ss.getSlides()[0].getTextRuns()[0];
- TextRun tr2 = ss.getSlides()[0].getTextRuns()[1];
+ HSLFTextParagraph tr1 = ss.getSlides()[0].getTextRuns()[0];
+ HSLFTextParagraph tr2 = ss.getSlides()[0].getTextRuns()[1];
// Ensure the text lengths are as we'd expect to start with
assertEquals(1, ss.getSlides().length);
@@ -112,10 +112,10 @@ public final class TestTextRunReWrite ex
public void testWritesOutTheSameRich() throws Exception {
// Grab the first text run on the first sheet
- TextRun tr1 = ss.getSlides()[0].getTextRuns()[0];
+ HSLFTextParagraph tr1 = ss.getSlides()[0].getTextRuns()[0];
// Get the first rich text run
- RichTextRun rtr1 = tr1.getRichTextRuns()[0];
+ HSLFTextRun rtr1 = tr1.getRichTextRuns()[0];
// Check that the text sizes are as expected
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java Thu Mar 19 23:44:23 2015
@@ -34,7 +34,7 @@ import java.util.Map;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.sl.usermodel.ShapeType;
import org.junit.Test;
@@ -48,14 +48,14 @@ public final class TestTextShape {
@Test
public void createAutoShape(){
- TextShape shape = new AutoShape(ShapeType.TRAPEZOID);
- assertNull(shape.getTextRun());
+ HSLFTextShape shape = new HSLFAutoShape(ShapeType.TRAPEZOID);
+ assertNull(shape.getTextParagraph());
assertNull(shape.getText());
assertNull(shape.getEscherTextboxWrapper());
- TextRun run = shape.createTextRun();
+ HSLFTextParagraph run = shape.createTextRun();
assertNotNull(run);
- assertNotNull(shape.getTextRun());
+ assertNotNull(shape.getTextParagraph());
assertNotNull(shape.getEscherTextboxWrapper());
assertEquals("", shape.getText());
assertSame(run, shape.createTextRun());
@@ -64,14 +64,14 @@ public final class TestTextShape {
@Test
public void createTextBox(){
- TextShape shape = new TextBox();
- TextRun run = shape.getTextRun();
+ HSLFTextShape shape = new HSLFTextBox();
+ HSLFTextParagraph run = shape.getTextParagraph();
assertNotNull(run);
assertNotNull(shape.getText());
assertNotNull(shape.getEscherTextboxWrapper());
assertSame(run, shape.createTextRun());
- assertNotNull(shape.getTextRun());
+ assertNotNull(shape.getTextParagraph());
assertNotNull(shape.getEscherTextboxWrapper());
assertEquals("", shape.getText());
@@ -85,15 +85,15 @@ public final class TestTextShape {
*/
@Test
public void read() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("text_shapes.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("text_shapes.ppt"));
List<String> lst1 = new ArrayList<String>();
- Slide slide = ppt.getSlides()[0];
+ HSLFSlide slide = ppt.getSlides()[0];
HSLFShape[] shape = slide.getShapes();
for (int i = 0; i < shape.length; i++) {
- assertTrue("Expected TextShape but found " + shape[i].getClass().getName(), shape[i] instanceof TextShape);
- TextShape tx = (TextShape)shape[i];
- TextRun run = tx.getTextRun();
+ assertTrue("Expected TextShape but found " + shape[i].getClass().getName(), shape[i] instanceof HSLFTextShape);
+ HSLFTextShape tx = (HSLFTextShape)shape[i];
+ HSLFTextParagraph run = tx.getTextParagraph();
assertNotNull(run);
int runType = run.getRunType();
@@ -125,7 +125,7 @@ public final class TestTextShape {
}
List<String> lst2 = new ArrayList<String>();
- TextRun[] run = slide.getTextRuns();
+ HSLFTextParagraph[] run = slide.getTextRuns();
for (int i = 0; i < run.length; i++) {
lst2.add(run[i].getText());
}
@@ -135,18 +135,18 @@ public final class TestTextShape {
@Test
public void readWrite() throws IOException {
- SlideShow ppt = new SlideShow();
- Slide slide = ppt.createSlide();
+ HSLFSlideShow ppt = new HSLFSlideShow();
+ HSLFSlide slide = ppt.createSlide();
- TextShape shape1 = new TextBox();
- TextRun run1 = shape1.createTextRun();
+ HSLFTextShape shape1 = new HSLFTextBox();
+ HSLFTextParagraph run1 = shape1.createTextRun();
run1.setText("Hello, World!");
slide.addShape(shape1);
shape1.moveTo(100, 100);
- TextShape shape2 = new AutoShape(ShapeType.RIGHT_ARROW);
- TextRun run2 = shape2.createTextRun();
+ HSLFTextShape shape2 = new HSLFAutoShape(ShapeType.RIGHT_ARROW);
+ HSLFTextParagraph run2 = shape2.createTextRun();
run2.setText("Testing TextShape");
slide.addShape(shape2);
shape2.moveTo(300, 300);
@@ -155,37 +155,37 @@ public final class TestTextShape {
ppt.write(out);
out.close();
- ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+ ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
slide = ppt.getSlides()[0];
HSLFShape[] shape = slide.getShapes();
- assertTrue(shape[0] instanceof TextShape);
- shape1 = (TextShape)shape[0];
+ assertTrue(shape[0] instanceof HSLFTextShape);
+ shape1 = (HSLFTextShape)shape[0];
assertEquals(ShapeType.TEXT_BOX, shape1.getShapeType());
- assertEquals("Hello, World!", shape1.getTextRun().getText());
+ assertEquals("Hello, World!", shape1.getTextParagraph().getText());
- assertTrue(shape[1] instanceof TextShape);
- shape1 = (TextShape)shape[1];
+ assertTrue(shape[1] instanceof HSLFTextShape);
+ shape1 = (HSLFTextShape)shape[1];
assertEquals(ShapeType.RIGHT_ARROW, shape1.getShapeType());
- assertEquals("Testing TextShape", shape1.getTextRun().getText());
+ assertEquals("Testing TextShape", shape1.getTextParagraph().getText());
}
@Test
public void margins() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("text-margins.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("text-margins.ppt"));
- Slide slide = ppt.getSlides()[0];
+ HSLFSlide slide = ppt.getSlides()[0];
- Map<String,TextShape> map = new HashMap<String,TextShape>();
+ Map<String,HSLFTextShape> map = new HashMap<String,HSLFTextShape>();
HSLFShape[] shape = slide.getShapes();
for (int i = 0; i < shape.length; i++) {
- if(shape[i] instanceof TextShape){
- TextShape tx = (TextShape)shape[i];
+ if(shape[i] instanceof HSLFTextShape){
+ HSLFTextShape tx = (HSLFTextShape)shape[i];
map.put(tx.getText(), tx);
}
}
- TextShape tx;
+ HSLFTextShape tx;
tx = map.get("TEST1");
assertEquals(0.1, tx.getMarginLeft()*HSLFShape.EMU_PER_POINT/HSLFShape.EMU_PER_INCH, 0.01);
@@ -214,22 +214,22 @@ public final class TestTextShape {
@Test
public void bug52599() throws IOException {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("52599.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("52599.ppt"));
- Slide slide = ppt.getSlides()[0];
+ HSLFSlide slide = ppt.getSlides()[0];
HSLFShape[] sh = slide.getShapes();
assertEquals(3, sh.length);
- TextShape sh0 = (TextShape)sh[0];
+ HSLFTextShape sh0 = (HSLFTextShape)sh[0];
assertEquals(null, sh0.getText());
- assertEquals(null, sh0.getTextRun());
+ assertEquals(null, sh0.getTextParagraph());
- TextShape sh1 = (TextShape)sh[1];
+ HSLFTextShape sh1 = (HSLFTextShape)sh[1];
assertEquals(null, sh1.getText());
- assertEquals(null, sh1.getTextRun());
+ assertEquals(null, sh1.getTextParagraph());
- TextShape sh2 = (TextShape)sh[2];
+ HSLFTextShape sh2 = (HSLFTextShape)sh[2];
assertEquals("this box should be shown just once", sh2.getText());
- assertEquals(-1, sh2.getTextRun().getIndex());
+ assertEquals(-1, sh2.getTextParagraph().getIndex());
}
}
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TextPainterTest.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TextPainterTest.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TextPainterTest.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TextPainterTest.java Thu Mar 19 23:44:23 2015
@@ -19,7 +19,7 @@ package org.apache.poi.hslf.model;
import org.apache.poi.hslf.record.StyleTextPropAtom;
import org.apache.poi.hslf.record.TextCharsAtom;
import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hssf.usermodel.DummyGraphics2d;
import org.junit.Test;
@@ -27,22 +27,22 @@ import org.junit.Test;
public class TextPainterTest {
@Test
public void testTextPainter() {
- TextShape shape = new Polygon();
+ HSLFTextShape shape = new Polygon();
TextPainter painter = new TextPainter(shape);
- painter.getAttributedString(new TextRun(null, new TextCharsAtom(), null));
+ painter.getAttributedString(new HSLFTextParagraph(null, new TextCharsAtom(), null));
painter.paint(new DummyGraphics2d());
painter.getTextElements((float)1.0, null);
}
@Test
public void testTextPainterWithText() {
- TextShape shape = new Polygon();
+ HSLFTextShape shape = new Polygon();
TextPainter painter = new TextPainter(shape);
TextCharsAtom tca = new TextCharsAtom();
tca.setText("some text to read");
- TextRun txrun = new TextRun(new TextHeaderAtom(), tca, new StyleTextPropAtom(10));
- Slide sheet = new Slide(1, 1, 1);
- sheet.setSlideShow(new SlideShow());
+ HSLFTextParagraph txrun = new HSLFTextParagraph(new TextHeaderAtom(), tca, new StyleTextPropAtom(10));
+ HSLFSlide sheet = new HSLFSlide(1, 1, 1);
+ sheet.setSlideShow(new HSLFSlideShow());
txrun.setSheet(sheet);
painter.getAttributedString(txrun, new DummyGraphics2d());
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java Thu Mar 19 23:44:23 2015
@@ -24,8 +24,8 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.Test;
@@ -72,7 +72,7 @@ public final class TestCurrentUserAtom {
new CurrentUserAtom(fs);
assertTrue(true); // not yet failed
- new HSLFSlideShow(fs);
+ new HSLFSlideShowImpl(fs);
}
@Test
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java Thu Mar 19 23:44:23 2015
@@ -19,7 +19,7 @@ package org.apache.poi.hslf.record;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.POIDataSamples;
@@ -30,14 +30,14 @@ import org.apache.poi.POIDataSamples;
*/
public final class TestDocument extends TestCase {
// HSLFSlideShow primed on the test data
- private HSLFSlideShow ss;
+ private HSLFSlideShowImpl ss;
// POIFS primed on the test data
private POIFSFileSystem pfs;
public TestDocument() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
- ss = new HSLFSlideShow(pfs);
+ ss = new HSLFSlideShowImpl(pfs);
}
private Document getDocRecord() {
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java Thu Mar 19 23:44:23 2015
@@ -33,11 +33,11 @@ import org.apache.poi.hpsf.DocumentSumma
import org.apache.poi.hpsf.PropertySet;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.SummaryInformation;
-import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
-import org.apache.poi.hslf.model.Slide;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.model.HSLFSlide;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
+import org.apache.poi.hslf.usermodel.HSLFPictureData;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.poifs.crypt.CryptoFunctions;
import org.apache.poi.poifs.crypt.EncryptionInfo;
@@ -71,8 +71,8 @@ public class TestDocumentEncryption {
for (String pptFile : encPpts) {
try {
NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
- HSLFSlideShow hss = new HSLFSlideShow(fs);
- new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
+ new HSLFSlideShow(hss);
fs.close();
} catch (EncryptedPowerPointFileException e) {
fail(pptFile+" can't be decrypted");
@@ -85,9 +85,9 @@ public class TestDocumentEncryption {
String pptFile = "cryptoapi-proc2356.ppt";
Biff8EncryptionKey.setCurrentUserPassword("crypto");
NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
- HSLFSlideShow hss = new HSLFSlideShow(fs);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
// need to cache data (i.e. read all data) before changing the key size
- PictureData picsExpected[] = hss.getPictures();
+ HSLFPictureData picsExpected[] = hss.getPictures();
hss.getDocumentSummaryInformation();
EncryptionInfo ei = hss.getDocumentEncryptionAtom().getEncryptionInfo();
((CryptoAPIEncryptionHeader)ei.getHeader()).setKeySize(0x78);
@@ -97,8 +97,8 @@ public class TestDocumentEncryption {
fs.close();
fs = new NPOIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
- hss = new HSLFSlideShow(fs);
- PictureData picsActual[] = hss.getPictures();
+ hss = new HSLFSlideShowImpl(fs);
+ HSLFPictureData picsActual[] = hss.getPictures();
fs.close();
assertEquals(picsExpected.length, picsActual.length);
@@ -112,7 +112,7 @@ public class TestDocumentEncryption {
/* documents with multiple edits need to be normalized for encryption */
String pptFile = "57272_corrupted_usereditatom.ppt";
NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
- HSLFSlideShow hss = new HSLFSlideShow(fs);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
hss.normalizeRecords();
// normalized ppt
@@ -128,7 +128,7 @@ public class TestDocumentEncryption {
// decrypted
ByteArrayInputStream bis = new ByteArrayInputStream(encrypted.toByteArray());
fs = new NPOIFSFileSystem(bis);
- hss = new HSLFSlideShow(fs);
+ hss = new HSLFSlideShowImpl(fs);
Biff8EncryptionKey.setCurrentUserPassword(null);
ByteArrayOutputStream actual = new ByteArrayOutputStream();
hss.write(actual);
@@ -143,10 +143,10 @@ public class TestDocumentEncryption {
// http://blogs.msdn.com/b/openspecification/archive/2009/05/08/dominic-salemno.aspx
Biff8EncryptionKey.setCurrentUserPassword("crypto");
NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile("cryptoapi-proc2356.ppt"));
- HSLFSlideShow hss = new HSLFSlideShow(fs);
- SlideShow ss = new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
+ HSLFSlideShow ss = new HSLFSlideShow(hss);
- Slide slide = ss.getSlides()[0];
+ HSLFSlide slide = ss.getSlides()[0];
assertEquals("Dominic Salemno", slide.getTextRuns()[0].getText());
String picCmp[][] = {
@@ -160,9 +160,9 @@ public class TestDocumentEncryption {
};
MessageDigest md = CryptoFunctions.getMessageDigest(HashAlgorithm.sha1);
- PictureData pd[] = hss.getPictures();
+ HSLFPictureData pd[] = hss.getPictures();
int i = 0;
- for (PictureData p : pd) {
+ for (HSLFPictureData p : pd) {
byte hash[] = md.digest(p.getData());
assertEquals(Integer.parseInt(picCmp[i][0]), p.getOffset());
assertEquals(picCmp[i][1], Base64.encodeBase64String(hash));
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java Thu Mar 19 23:44:23 2015
@@ -25,8 +25,8 @@ import java.util.List;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -99,8 +99,8 @@ public final class TestExHyperlink exten
public void testRealFile() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
- SlideShow ss = new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
+ HSLFSlideShow ss = new HSLFSlideShow(hss);
// Get the document
Document doc = ss.getDocumentRecord();
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java Thu Mar 19 23:44:23 2015
@@ -20,8 +20,8 @@ package org.apache.poi.hslf.record;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.POIDataSamples;
/**
@@ -32,8 +32,8 @@ import org.apache.poi.POIDataSamples;
public class TestExObjList extends TestCase {
public void testRealFile() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
- SlideShow ss = new SlideShow(hss);
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
+ HSLFSlideShow ss = new HSLFSlideShow(hss);
// Get the document
Document doc = ss.getDocumentRecord();
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java Thu Mar 19 23:44:23 2015
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.record;
import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.model.HSLFSlideShowImpl;
import org.apache.poi.POIDataSamples;
/**
@@ -149,7 +149,7 @@ public final class TestRecordContainer e
// Find a real RecordContainer record
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+ HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
Record[] r = hss.getRecords();
for(int i=0; i<r.length; i++) {
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java Thu Mar 19 23:44:23 2015
@@ -24,7 +24,7 @@ import java.io.FileOutputStream;
import junit.framework.TestCase;
import org.apache.poi.hslf.record.SlideAtom.SSlideLayoutAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Tests that SlideAtom works properly
@@ -77,14 +77,14 @@ public final class TestSlideAtom extends
}
public void testSSSlideInfoAtom() throws Exception {
- SlideShow ss = new SlideShow();
- org.apache.poi.hslf.model.Slide slide1 = ss.createSlide(), slide2 = ss.createSlide();
+ HSLFSlideShow ss = new HSLFSlideShow();
+ org.apache.poi.hslf.model.HSLFSlide slide1 = ss.createSlide(), slide2 = ss.createSlide();
slide2.setHidden(true);
ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);
ss.write(bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- ss = new SlideShow(bis);
+ ss = new HSLFSlideShow(bis);
slide1 = ss.getSlides()[0];
slide2 = ss.getSlides()[1];
assertFalse(slide1.getHidden());
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java Thu Mar 19 23:44:23 2015
@@ -22,7 +22,7 @@ import junit.framework.AssertionFailedEr
import junit.framework.TestCase;
import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Tests Sound-related records: SoundCollection(2020), Sound(2022) and
@@ -34,7 +34,7 @@ public final class TestSound extends Tes
public void testRealFile() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("sound.ppt"));
// Get the document
Document doc = ppt.getDocumentRecord();
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java Thu Mar 19 23:44:23 2015
@@ -25,7 +25,7 @@ import junit.framework.TestCase;
import org.apache.poi.hslf.model.textproperties.TextProp;
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
@@ -36,10 +36,10 @@ import org.apache.poi.hslf.usermodel.Sli
* @author Yegor Kozlov
*/
public final class TestTxMasterStyleAtom extends TestCase {
- protected SlideShow _ppt;
+ protected HSLFSlideShow _ppt;
public void setUp() {
- _ppt = new SlideShow();
+ _ppt = new HSLFSlideShow();
}
public void testDefaultStyles() {
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java Thu Mar 19 23:44:23 2015
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import junit.framework.TestCase;
+
import org.apache.poi.hslf.*;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes;
@@ -37,31 +38,31 @@ import org.apache.poi.POIDataSamples;
*/
public final class TestAddingSlides extends TestCase {
// An empty SlideShow
- private HSLFSlideShow hss_empty;
- private SlideShow ss_empty;
+ private HSLFSlideShowImpl hss_empty;
+ private HSLFSlideShow ss_empty;
// A SlideShow with one slide
- private HSLFSlideShow hss_one;
- private SlideShow ss_one;
+ private HSLFSlideShowImpl hss_one;
+ private HSLFSlideShow ss_one;
// A SlideShow with two slides
- private HSLFSlideShow hss_two;
- private SlideShow ss_two;
+ private HSLFSlideShowImpl hss_two;
+ private HSLFSlideShow ss_two;
/**
* Create/open the slideshows
*/
public void setUp() throws Exception {
- hss_empty = HSLFSlideShow.create();
- ss_empty = new SlideShow(hss_empty);
+ hss_empty = HSLFSlideShowImpl.create();
+ ss_empty = new HSLFSlideShow(hss_empty);
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- hss_one = new HSLFSlideShow(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
- ss_one = new SlideShow(hss_one);
+ hss_one = new HSLFSlideShowImpl(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
+ ss_one = new HSLFSlideShow(hss_one);
- hss_two = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
- ss_two = new SlideShow(hss_two);
+ hss_two = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+ ss_two = new HSLFSlideShow(hss_two);
}
/**
@@ -86,7 +87,7 @@ public final class TestAddingSlides exte
assertNotNull(usredit);
// Add one
- Slide slide = ss_empty.createSlide();
+ HSLFSlide slide = ss_empty.createSlide();
assertEquals(1, ss_empty.getSlides().length);
assertEquals(256, slide._getSheetNumber());
assertEquals(3, slide._getSheetRefId());
@@ -98,8 +99,8 @@ public final class TestAddingSlides exte
hss_empty.write(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- HSLFSlideShow hss_read = new HSLFSlideShow(bais);
- SlideShow ss_read = new SlideShow(hss_read);
+ HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+ HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
// Check it now has a slide
assertEquals(1, ss_read.getSlides().length);
@@ -120,7 +121,7 @@ public final class TestAddingSlides exte
public void testAddSlideToExisting() throws Exception {
// Has one slide
assertEquals(1, ss_one.getSlides().length);
- Slide s1 = ss_one.getSlides()[0];
+ HSLFSlide s1 = ss_one.getSlides()[0];
// Should have two SLTWs
assertEquals(2, ss_one.getDocumentRecord().getSlideListWithTexts().length);
@@ -131,7 +132,7 @@ public final class TestAddingSlides exte
assertEquals(1, s1.getSlideNumber());
// Add a second one
- Slide s2 = ss_one.createSlide();
+ HSLFSlide s2 = ss_one.createSlide();
assertEquals(2, ss_one.getSlides().length);
assertEquals(257, s2._getSheetNumber());
assertEquals(4, s2._getSheetRefId());
@@ -142,8 +143,8 @@ public final class TestAddingSlides exte
hss_one.write(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- HSLFSlideShow hss_read = new HSLFSlideShow(bais);
- SlideShow ss_read = new SlideShow(hss_read);
+ HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+ HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
// Check it now has two slides
assertEquals(2, ss_read.getSlides().length);
@@ -180,8 +181,8 @@ public final class TestAddingSlides exte
// Has two slides
assertEquals(2, ss_two.getSlides().length);
- Slide s1 = ss_two.getSlides()[0];
- Slide s2 = ss_two.getSlides()[1];
+ HSLFSlide s1 = ss_two.getSlides()[0];
+ HSLFSlide s2 = ss_two.getSlides()[1];
// Check slide 1 is as expected
assertEquals(256, s1._getSheetNumber());
@@ -193,7 +194,7 @@ public final class TestAddingSlides exte
assertEquals(2, s2.getSlideNumber());
// Add a third one
- Slide s3 = ss_two.createSlide();
+ HSLFSlide s3 = ss_two.createSlide();
assertEquals(3, ss_two.getSlides().length);
assertEquals(258, s3._getSheetNumber());
assertEquals(8, s3._getSheetRefId()); // lots of notes before us
@@ -205,8 +206,8 @@ public final class TestAddingSlides exte
hss_two.write(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- HSLFSlideShow hss_read = new HSLFSlideShow(bais);
- SlideShow ss_read = new SlideShow(hss_read);
+ HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+ HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
// Check it now has three slides
assertEquals(3, ss_read.getSlides().length);
@@ -230,11 +231,11 @@ public final class TestAddingSlides exte
* Test SlideShow#removeSlide
*/
public void testRemoving() throws Exception {
- SlideShow ppt = new SlideShow();
- Slide slide1 = ppt.createSlide();
- Slide slide2 = ppt.createSlide();
+ HSLFSlideShow ppt = new HSLFSlideShow();
+ HSLFSlide slide1 = ppt.createSlide();
+ HSLFSlide slide2 = ppt.createSlide();
- Slide[] s1 = ppt.getSlides();
+ HSLFSlide[] s1 = ppt.getSlides();
assertEquals(2, s1.length);
try {
ppt.removeSlide(-1);
@@ -252,8 +253,8 @@ public final class TestAddingSlides exte
assertEquals(1, slide1.getSlideNumber());
- Slide removedSlide = ppt.removeSlide(0);
- Slide[] s2 = ppt.getSlides();
+ HSLFSlide removedSlide = ppt.removeSlide(0);
+ HSLFSlide[] s2 = ppt.getSlides();
assertEquals(1, s2.length);
assertSame(slide1, removedSlide);
assertSame(slide2, s2[0]);
@@ -263,17 +264,17 @@ public final class TestAddingSlides exte
ByteArrayOutputStream out = new ByteArrayOutputStream();
ppt.write(out);
- ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+ ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
- Slide[] s3 = ppt.getSlides();
+ HSLFSlide[] s3 = ppt.getSlides();
assertEquals(1, s3.length);
}
public void test47261() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
- SlideShow ppt = new SlideShow(slTests.openResourceAsStream("47261.ppt"));
- Slide[] slides = ppt.getSlides();
+ HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("47261.ppt"));
+ HSLFSlide[] slides = ppt.getSlides();
Document doc = ppt.getDocumentRecord();
assertNotNull(doc.getSlideSlideListWithText());
assertEquals(14, ppt.getSlides().length);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org