Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 634641878D for ; Fri, 24 Jul 2015 21:48:04 +0000 (UTC) Received: (qmail 79138 invoked by uid 500); 24 Jul 2015 21:48:04 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 79027 invoked by uid 500); 24 Jul 2015 21:48:04 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 78816 invoked by uid 99); 24 Jul 2015 21:48:04 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 21:48:04 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 79722AC1B33 for ; Fri, 24 Jul 2015 21:48:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1692593 [10/17] - in /poi: site/src/documentation/content/xdocs/ trunk/ trunk/src/examples/src/org/apache/poi/hslf/examples/ trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ trunk/src/examples/src/org/apache/poi/xslf/usermode... Date: Fri, 24 Jul 2015 21:47:58 -0000 To: commits@poi.apache.org From: kiwiwings@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150724214803.79722AC1B33@hades.apache.org> Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java Fri Jul 24 21:47:55 2015 @@ -16,42 +16,45 @@ ==================================================================== */ package org.apache.poi.xslf.usermodel; -import junit.framework.TestCase; +import static org.junit.Assert.*; + +import java.awt.Color; +import java.util.List; + +import org.apache.poi.sl.usermodel.TextParagraph.TextAlign; +import org.apache.poi.sl.usermodel.VerticalAlignment; import org.apache.poi.xslf.XSLFTestDataSamples; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType; +import org.junit.Test; +import org.openxmlformats.schemas.drawingml.x2006.main.*; import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder; import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType; -import java.awt.Color; - /** * @author Yegor Kozlov */ -public class TestXSLFTextShape extends TestCase { +public class TestXSLFTextShape { + @Test public void testLayouts(){ XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("layouts.pptx"); - XSLFSlide[] slide = ppt.getSlides(); + List slide = ppt.getSlides(); - verifySlide1(slide[0]); - verifySlide2(slide[1]); - verifySlide3(slide[2]); - verifySlide4(slide[3]); - verifySlide7(slide[6]); - verifySlide8(slide[7]); - verifySlide10(slide[9]); + verifySlide1(slide.get(0)); + verifySlide2(slide.get(1)); + verifySlide3(slide.get(2)); + verifySlide4(slide.get(3)); + verifySlide7(slide.get(6)); + verifySlide8(slide.get(7)); + verifySlide10(slide.get(9)); } void verifySlide1(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Title Slide",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.CTR_TITLE, ph1.getType()); // anchor is not defined in the shape @@ -68,20 +71,20 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment()); // now check text properties assertEquals("Centered Title", shape1.getText()); XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(44.0, r1.getFontSize()); + assertEquals(44.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTPlaceholder ph2 = shape2.getCTPlaceholder(); assertEquals(STPlaceholderType.SUB_TITLE, ph2.getType()); // anchor is not defined in the shape @@ -98,26 +101,26 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); assertEquals("subtitle", shape2.getText()); XSLFTextRun r2 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals("Calibri", r2.getFontFamily()); - assertEquals(32.0, r2.getFontSize()); + assertEquals(32.0, r2.getFontSize(), 0); // TODO fix calculation of tint //assertEquals(new Color(137, 137, 137), r2.getFontColor()); } void verifySlide2(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Title and Content",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.TITLE, ph1.getType()); // anchor is not defined in the shape @@ -137,20 +140,20 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment()); // now check text properties assertEquals("Title", shape1.getText()); XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(44.0, r1.getFontSize()); + assertEquals(44.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTPlaceholder ph2 = shape2.getCTPlaceholder(); assertFalse(ph2.isSetType()); // assertTrue(ph2.isSetIdx()); @@ -172,54 +175,54 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr1.getParentParagraph().getLevel()); - assertEquals("Content", pr1.getText()); + assertEquals(0, pr1.getParentParagraph().getIndentLevel()); + assertEquals("Content", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); - assertEquals(32.0, pr1.getFontSize()); - assertEquals(27.0, pr1.getParentParagraph().getLeftMargin()); + assertEquals(32.0, pr1.getFontSize(), 0); + assertEquals(27.0, pr1.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr1.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr1.getParentParagraph().getBulletFont()); XSLFTextRun pr2 = shape2.getTextParagraphs().get(1).getTextRuns().get(0); - assertEquals(1, pr2.getParentParagraph().getLevel()); - assertEquals("Level 2", pr2.getText()); + assertEquals(1, pr2.getParentParagraph().getIndentLevel()); + assertEquals("Level 2", pr2.getRawText()); assertEquals("Calibri", pr2.getFontFamily()); - assertEquals(28.0, pr2.getFontSize()); - assertEquals(58.5, pr2.getParentParagraph().getLeftMargin()); + assertEquals(28.0, pr2.getFontSize(), 0); + assertEquals(58.5, pr2.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr2.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr2.getParentParagraph().getBulletFont()); XSLFTextRun pr3 = shape2.getTextParagraphs().get(2).getTextRuns().get(0); - assertEquals(2, pr3.getParentParagraph().getLevel()); - assertEquals("Level 3", pr3.getText()); + assertEquals(2, pr3.getParentParagraph().getIndentLevel()); + assertEquals("Level 3", pr3.getRawText()); assertEquals("Calibri", pr3.getFontFamily()); - assertEquals(24.0, pr3.getFontSize()); - assertEquals(90.0, pr3.getParentParagraph().getLeftMargin()); + assertEquals(24.0, pr3.getFontSize(), 0); + assertEquals(90.0, pr3.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr3.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr3.getParentParagraph().getBulletFont()); XSLFTextRun pr4 = shape2.getTextParagraphs().get(3).getTextRuns().get(0); - assertEquals(3, pr4.getParentParagraph().getLevel()); - assertEquals("Level 4", pr4.getText()); + assertEquals(3, pr4.getParentParagraph().getIndentLevel()); + assertEquals("Level 4", pr4.getRawText()); assertEquals("Calibri", pr4.getFontFamily()); - assertEquals(20.0, pr4.getFontSize()); - assertEquals(126.0, pr4.getParentParagraph().getLeftMargin()); + assertEquals(20.0, pr4.getFontSize(), 0); + assertEquals(126.0, pr4.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr4.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr4.getParentParagraph().getBulletFont()); XSLFTextRun pr5 = shape2.getTextParagraphs().get(4).getTextRuns().get(0); - assertEquals(4, pr5.getParentParagraph().getLevel()); - assertEquals("Level 5", pr5.getText()); + assertEquals(4, pr5.getParentParagraph().getIndentLevel()); + assertEquals("Level 5", pr5.getRawText()); assertEquals("Calibri", pr5.getFontFamily()); - assertEquals(20.0, pr5.getFontSize()); - assertEquals(162.0, pr5.getParentParagraph().getLeftMargin()); + assertEquals(20.0, pr5.getFontSize(), 0); + assertEquals(162.0, pr5.getParentParagraph().getLeftMargin(), 0); assertEquals("\u00bb", pr5.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr5.getParentParagraph().getBulletFont()); @@ -227,10 +230,10 @@ public class TestXSLFTextShape extends T void verifySlide3(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Section Header",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.TITLE, ph1.getType()); // anchor is not defined in the shape @@ -247,10 +250,10 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape1.getVerticalAlignment()); // now check text properties @@ -258,13 +261,13 @@ public class TestXSLFTextShape extends T XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.LEFT, r1.getParentParagraph().getTextAlign()); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(40.0, r1.getFontSize()); + assertEquals(40.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); assertTrue(r1.isBold()); assertFalse(r1.isItalic()); - assertFalse(r1.isUnderline()); + assertFalse(r1.isUnderlined()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTPlaceholder ph2 = shape2.getCTPlaceholder(); assertEquals(STPlaceholderType.BODY, ph2.getType()); // anchor is not defined in the shape @@ -281,27 +284,27 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.BOTTOM, shape2.getVerticalAlignment()); assertEquals("Section Header", shape2.getText()); XSLFTextRun r2 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.LEFT, r2.getParentParagraph().getTextAlign()); assertEquals("Calibri", r2.getFontFamily()); - assertEquals(20.0, r2.getFontSize()); + assertEquals(20.0, r2.getFontSize(), 0); // TODO fix calculation of tint //assertEquals(new Color(137, 137, 137), r2.getFontColor()); } void verifySlide4(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Two Content",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.TITLE, ph1.getType()); // anchor is not defined in the shape @@ -321,10 +324,10 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment()); // now check text properties @@ -332,10 +335,10 @@ public class TestXSLFTextShape extends T XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.CENTER, r1.getParentParagraph().getTextAlign()); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(44.0, r1.getFontSize()); + assertEquals(44.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTPlaceholder ph2 = shape2.getCTPlaceholder(); assertFalse(ph2.isSetType()); assertTrue(ph2.isSetIdx()); @@ -354,68 +357,69 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr1.getParentParagraph().getLevel()); - assertEquals("Left", pr1.getText()); + assertEquals(0, pr1.getParentParagraph().getIndentLevel()); + assertEquals("Left", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); - assertEquals(28.0, pr1.getFontSize()); - assertEquals(27.0, pr1.getParentParagraph().getLeftMargin()); + assertEquals(28.0, pr1.getFontSize(), 0); + assertEquals(27.0, pr1.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr1.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr1.getParentParagraph().getBulletFont()); XSLFTextRun pr2 = shape2.getTextParagraphs().get(1).getTextRuns().get(0); - assertEquals(1, pr2.getParentParagraph().getLevel()); + assertEquals(1, pr2.getParentParagraph().getIndentLevel()); assertEquals("Level 2", pr2.getParentParagraph().getText()); assertEquals("Calibri", pr2.getFontFamily()); - assertEquals(24.0, pr2.getFontSize()); - assertEquals(58.5, pr2.getParentParagraph().getLeftMargin()); + assertEquals(24.0, pr2.getFontSize(), 0); + assertEquals(58.5, pr2.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr2.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr2.getParentParagraph().getBulletFont()); XSLFTextRun pr3 = shape2.getTextParagraphs().get(2).getTextRuns().get(0); - assertEquals(2, pr3.getParentParagraph().getLevel()); + assertEquals(2, pr3.getParentParagraph().getIndentLevel()); assertEquals("Level 3", pr3.getParentParagraph().getText()); assertEquals("Calibri", pr3.getFontFamily()); - assertEquals(20.0, pr3.getFontSize()); - assertEquals(90.0, pr3.getParentParagraph().getLeftMargin()); + assertEquals(20.0, pr3.getFontSize(), 0); + assertEquals(90.0, pr3.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr3.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr3.getParentParagraph().getBulletFont()); XSLFTextRun pr4 = shape2.getTextParagraphs().get(3).getTextRuns().get(0); - assertEquals(3, pr4.getParentParagraph().getLevel()); + assertEquals(3, pr4.getParentParagraph().getIndentLevel()); assertEquals("Level 4", pr4.getParentParagraph().getText()); assertEquals("Calibri", pr4.getFontFamily()); - assertEquals(18.0, pr4.getFontSize()); - assertEquals(126.0, pr4.getParentParagraph().getLeftMargin()); + assertEquals(18.0, pr4.getFontSize(), 0); + assertEquals(126.0, pr4.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr4.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr4.getParentParagraph().getBulletFont()); - XSLFTextShape shape3 = (XSLFTextShape)shapes[2]; + XSLFTextShape shape3 = (XSLFTextShape)shapes.get(2); XSLFTextRun pr5 = shape3.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr5.getParentParagraph().getLevel()); - assertEquals("Right", pr5.getText()); + assertEquals(0, pr5.getParentParagraph().getIndentLevel()); + assertEquals("Right", pr5.getRawText()); assertEquals("Calibri", pr5.getFontFamily()); assertEquals(Color.black, pr5.getFontColor()); } + @SuppressWarnings("unused") void verifySlide5(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); // TODO } void verifySlide7(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Blank",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.TITLE, ph1.getType()); // anchor is not defined in the shape @@ -428,10 +432,10 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment()); // now check text properties @@ -439,11 +443,11 @@ public class TestXSLFTextShape extends T XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.CENTER, r1.getParentParagraph().getTextAlign()); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(44.0, r1.getFontSize()); + assertEquals(44.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); assertFalse(r1.isBold()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTTextBodyProperties bodyPr2 = shape2.getTextBodyPr(); // none of the following properties are set in the shapes and fetched from the master shape @@ -452,19 +456,19 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr1.getParentParagraph().getLevel()); - assertEquals("Default Text", pr1.getText()); + assertEquals(0, pr1.getParentParagraph().getIndentLevel()); + assertEquals("Default Text", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); - assertEquals(18.0, pr1.getFontSize()); + assertEquals(18.0, pr1.getFontSize(), 0); - XSLFTextShape shape3 = (XSLFTextShape)shapes[2]; + XSLFTextShape shape3 = (XSLFTextShape)shapes.get(2); assertEquals("Default", shape3.getTextParagraphs().get(0).getText()); assertEquals("Text with levels", shape3.getTextParagraphs().get(1).getText()); assertEquals("Level 1", shape3.getTextParagraphs().get(2).getText()); @@ -474,16 +478,16 @@ public class TestXSLFTextShape extends T for(int p = 0; p < 5; p++) { XSLFTextParagraph pr = shape3.getTextParagraphs().get(p); assertEquals("Calibri", pr.getTextRuns().get(0).getFontFamily()); - assertEquals(18.0, pr.getTextRuns().get(0).getFontSize()); + assertEquals(18.0, pr.getTextRuns().get(0).getFontSize(), 0); } } void verifySlide8(XSLFSlide slide){ XSLFSlideLayout layout = slide.getSlideLayout(); - XSLFShape[] shapes = slide.getShapes(); + List shapes = slide.getShapes(); assertEquals("Content with Caption",layout.getName()); - XSLFTextShape shape1 = (XSLFTextShape)shapes[0]; + XSLFTextShape shape1 = (XSLFTextShape)shapes.get(0); CTPlaceholder ph1 = shape1.getCTPlaceholder(); assertEquals(STPlaceholderType.TITLE, ph1.getType()); // anchor is not defined in the shape @@ -501,10 +505,10 @@ public class TestXSLFTextShape extends T !bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() && !bodyPr1.isSetAnchor() ); - assertEquals(7.2, shape1.getLeftInset()); // 0.1" - assertEquals(7.2, shape1.getRightInset()); // 0.1" - assertEquals(3.6, shape1.getTopInset()); // 0.05" - assertEquals(3.6, shape1.getBottomInset()); // 0.05" + assertEquals(7.2, shape1.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape1.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape1.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape1.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.BOTTOM, shape1.getVerticalAlignment()); // now check text properties @@ -512,11 +516,11 @@ public class TestXSLFTextShape extends T XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.LEFT, r1.getParentParagraph().getTextAlign()); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(20.0, r1.getFontSize()); + assertEquals(20.0, r1.getFontSize(), 0); assertEquals(Color.black, r1.getFontColor()); assertTrue(r1.isBold()); - XSLFTextShape shape2 = (XSLFTextShape)shapes[1]; + XSLFTextShape shape2 = (XSLFTextShape)shapes.get(1); CTPlaceholder ph2 = shape2.getCTPlaceholder(); assertFalse(ph2.isSetType()); assertTrue(ph2.isSetIdx()); @@ -535,57 +539,57 @@ public class TestXSLFTextShape extends T !bodyPr2.isSetBIns() && !bodyPr2.isSetTIns() && !bodyPr2.isSetAnchor() ); - assertEquals(7.2, shape2.getLeftInset()); // 0.1" - assertEquals(7.2, shape2.getRightInset()); // 0.1" - assertEquals(3.6, shape2.getTopInset()); // 0.05" - assertEquals(3.6, shape2.getBottomInset()); // 0.05" + assertEquals(7.2, shape2.getLeftInset(), 0); // 0.1" + assertEquals(7.2, shape2.getRightInset(), 0); // 0.1" + assertEquals(3.6, shape2.getTopInset(), 0); // 0.05" + assertEquals(3.6, shape2.getBottomInset(), 0); // 0.05" assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr1.getParentParagraph().getLevel()); - assertEquals("Level 1", pr1.getText()); + assertEquals(0, pr1.getParentParagraph().getIndentLevel()); + assertEquals("Level 1", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); - assertEquals(32.0, pr1.getFontSize()); - assertEquals(27.0, pr1.getParentParagraph().getLeftMargin()); + assertEquals(32.0, pr1.getFontSize(), 0); + assertEquals(27.0, pr1.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr1.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr1.getParentParagraph().getBulletFont()); XSLFTextRun pr2 = shape2.getTextParagraphs().get(1).getTextRuns().get(0); - assertEquals(1, pr2.getParentParagraph().getLevel()); + assertEquals(1, pr2.getParentParagraph().getIndentLevel()); assertEquals("Level 2", pr2.getParentParagraph().getText()); assertEquals("Calibri", pr2.getFontFamily()); - assertEquals(28.0, pr2.getFontSize()); - assertEquals(58.5, pr2.getParentParagraph().getLeftMargin()); + assertEquals(28.0, pr2.getFontSize(), 0); + assertEquals(58.5, pr2.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr2.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr2.getParentParagraph().getBulletFont()); XSLFTextRun pr3 = shape2.getTextParagraphs().get(2).getTextRuns().get(0); - assertEquals(2, pr3.getParentParagraph().getLevel()); + assertEquals(2, pr3.getParentParagraph().getIndentLevel()); assertEquals("Level 3", pr3.getParentParagraph().getText()); assertEquals("Calibri", pr3.getFontFamily()); - assertEquals(24.0, pr3.getFontSize()); - assertEquals(90.0, pr3.getParentParagraph().getLeftMargin()); + assertEquals(24.0, pr3.getFontSize(), 0); + assertEquals(90.0, pr3.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2022", pr3.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr3.getParentParagraph().getBulletFont()); XSLFTextRun pr4 = shape2.getTextParagraphs().get(3).getTextRuns().get(0); - assertEquals(3, pr4.getParentParagraph().getLevel()); + assertEquals(3, pr4.getParentParagraph().getIndentLevel()); assertEquals("Level 4", pr4.getParentParagraph().getText()); assertEquals("Calibri", pr4.getFontFamily()); - assertEquals(20.0, pr4.getFontSize()); - assertEquals(126.0, pr4.getParentParagraph().getLeftMargin()); + assertEquals(20.0, pr4.getFontSize(), 0); + assertEquals(126.0, pr4.getParentParagraph().getLeftMargin(), 0); assertEquals("\u2013", pr4.getParentParagraph().getBulletCharacter()); assertEquals("Arial", pr4.getParentParagraph().getBulletFont()); - XSLFTextShape shape3 = (XSLFTextShape)shapes[2]; + XSLFTextShape shape3 = (XSLFTextShape)shapes.get(2); assertEquals(VerticalAlignment.TOP, shape3.getVerticalAlignment()); assertEquals("Content with caption", shape3.getText()); pr1 = shape3.getTextParagraphs().get(0).getTextRuns().get(0); - assertEquals(0, pr1.getParentParagraph().getLevel()); - assertEquals("Content with caption", pr1.getText()); + assertEquals(0, pr1.getParentParagraph().getIndentLevel()); + assertEquals("Content with caption", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); - assertEquals(14.0, pr1.getFontSize()); + assertEquals(14.0, pr1.getFontSize(), 0); } @@ -599,7 +603,7 @@ public class TestXSLFTextShape extends T XSLFTextRun r1 = footer.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(TextAlign.CENTER, r1.getParentParagraph().getTextAlign()); assertEquals("Calibri", r1.getFontFamily()); - assertEquals(12.0, r1.getFontSize()); + assertEquals(12.0, r1.getFontSize(), 0); // TODO calculation of tint is incorrect assertEquals(new Color(64,64,64), r1.getFontColor()); @@ -610,18 +614,18 @@ public class TestXSLFTextShape extends T assertEquals("10", sldNum.getText()); } - + @Test public void testTitleStyles(){ XMLSlideShow ppt = new XMLSlideShow(); - XSLFSlideMaster master = ppt.getSlideMasters()[0]; + XSLFSlideMaster master = ppt.getSlideMasters().get(0); XSLFTheme theme = master.getTheme(); XSLFSlideLayout layout = master.getLayout(SlideLayout.TITLE); XSLFSlide slide = ppt.createSlide(layout) ; assertSame(layout, slide.getSlideLayout()); assertSame(master, slide.getSlideMaster()); - XSLFTextShape titleShape = (XSLFTextShape)slide.getPlaceholder(0); + XSLFTextShape titleShape = slide.getPlaceholder(0); titleShape.setText("Apache POI"); XSLFTextParagraph paragraph = titleShape.getTextParagraphs().get(0); XSLFTextRun textRun = paragraph.getTextRuns().get(0); @@ -631,12 +635,12 @@ public class TestXSLFTextShape extends T CTTextParagraphProperties lv1PPr = master.getXmlObject().getTxStyles().getTitleStyle().getLvl1PPr(); CTTextCharacterProperties lv1CPr = lv1PPr.getDefRPr(); assertEquals(4400, lv1CPr.getSz()); - assertEquals(44.0, textRun.getFontSize()); + assertEquals(44.0, textRun.getFontSize(), 0); assertEquals("+mj-lt", lv1CPr.getLatin().getTypeface()); assertEquals("Calibri", theme.getMajorFont()); assertEquals("Calibri", textRun.getFontFamily()); lv1CPr.setSz(3200); - assertEquals(32.0, textRun.getFontSize()); + assertEquals(32.0, textRun.getFontSize(), 0); lv1CPr.getLatin().setTypeface("Arial"); assertEquals("Arial", textRun.getFontFamily()); assertEquals(STTextAlignType.CTR, lv1PPr.getAlgn()); @@ -650,7 +654,7 @@ public class TestXSLFTextShape extends T CTTextParagraphProperties lv2PPr = tx2.getTextBody(true).getLstStyle().addNewLvl1PPr(); CTTextCharacterProperties lv2CPr = lv2PPr.addNewDefRPr(); lv2CPr.setSz(3300); - assertEquals(33.0, textRun.getFontSize()); + assertEquals(33.0, textRun.getFontSize(), 0); lv2CPr.addNewLatin().setTypeface("Times"); assertEquals("Times", textRun.getFontFamily()); lv2PPr.setAlgn(STTextAlignType.R); @@ -663,7 +667,7 @@ public class TestXSLFTextShape extends T CTTextParagraphProperties lv3PPr = tx3.getTextBody(true).getLstStyle().addNewLvl1PPr(); CTTextCharacterProperties lv3CPr = lv3PPr.addNewDefRPr(); lv3CPr.setSz(3400); - assertEquals(34.0, textRun.getFontSize()); + assertEquals(34.0, textRun.getFontSize(), 0); lv3CPr.addNewLatin().setTypeface("Courier New"); assertEquals("Courier New", textRun.getFontFamily()); lv3PPr.setAlgn(STTextAlignType.CTR); @@ -674,7 +678,7 @@ public class TestXSLFTextShape extends T CTTextParagraphProperties lv4PPr = titleShape.getTextBody(true).getLstStyle().addNewLvl1PPr(); CTTextCharacterProperties lv4CPr = lv4PPr.addNewDefRPr(); lv4CPr.setSz(3500); - assertEquals(35.0, textRun.getFontSize()); + assertEquals(35.0, textRun.getFontSize(), 0); lv4CPr.addNewLatin().setTypeface("Arial"); assertEquals("Arial", textRun.getFontFamily()); lv4PPr.setAlgn(STTextAlignType.L); @@ -684,40 +688,41 @@ public class TestXSLFTextShape extends T CTTextParagraphProperties lv5PPr = paragraph.getXmlObject().addNewPPr(); CTTextCharacterProperties lv5CPr = textRun.getXmlObject().getRPr(); lv5CPr.setSz(3600); - assertEquals(36.0, textRun.getFontSize()); + assertEquals(36.0, textRun.getFontSize(), 0); lv5CPr.addNewLatin().setTypeface("Calibri"); assertEquals("Calibri", textRun.getFontFamily()); lv5PPr.setAlgn(STTextAlignType.CTR); assertEquals(TextAlign.CENTER, paragraph.getTextAlign()); } + @Test public void testBodyStyles(){ XMLSlideShow ppt = new XMLSlideShow(); - XSLFSlideMaster master = ppt.getSlideMasters()[0]; + XSLFSlideMaster master = ppt.getSlideMasters().get(0); XSLFTheme theme = master.getTheme(); XSLFSlideLayout layout = master.getLayout(SlideLayout.TITLE_AND_CONTENT); XSLFSlide slide = ppt.createSlide(layout) ; assertSame(layout, slide.getSlideLayout()); assertSame(master, slide.getSlideMaster()); - XSLFTextShape tx1 = (XSLFTextShape)slide.getPlaceholder(1); + XSLFTextShape tx1 = slide.getPlaceholder(1); tx1.clearText(); XSLFTextParagraph p1 = tx1.addNewTextParagraph(); - assertEquals(0, p1.getLevel()); + assertEquals(0, p1.getIndentLevel()); XSLFTextRun r1 = p1.addNewTextRun(); r1.setText("Apache POI"); XSLFTextParagraph p2 = tx1.addNewTextParagraph(); - p2.setLevel(1); - assertEquals(1, p2.getLevel()); + p2.setIndentLevel(1); + assertEquals(1, p2.getIndentLevel()); XSLFTextRun r2 = p2.addNewTextRun(); r2.setText("HSLF"); XSLFTextParagraph p3 = tx1.addNewTextParagraph(); - p3.setLevel(2); - assertEquals(2, p3.getLevel()); + p3.setIndentLevel(2); + assertEquals(2, p3.getIndentLevel()); XSLFTextRun r3 = p3.addNewTextRun(); r3.setText("XSLF"); @@ -731,12 +736,12 @@ public class TestXSLFTextShape extends T CTTextCharacterProperties lv3CPr = lv3PPr.getDefRPr(); // lv1 assertEquals(3200, lv1CPr.getSz()); - assertEquals(32.0, r1.getFontSize()); + assertEquals(32.0, r1.getFontSize(), 0); assertEquals("+mn-lt", lv1CPr.getLatin().getTypeface()); assertEquals("Calibri", theme.getMinorFont()); assertEquals("Calibri", r1.getFontFamily()); lv1CPr.setSz(3300); - assertEquals(33.0, r1.getFontSize()); + assertEquals(33.0, r1.getFontSize(), 0); lv1CPr.getLatin().setTypeface("Arial"); assertEquals("Arial", r1.getFontFamily()); assertEquals(STTextAlignType.L, lv1PPr.getAlgn()); @@ -745,9 +750,9 @@ public class TestXSLFTextShape extends T assertEquals(TextAlign.RIGHT, p1.getTextAlign()); //lv2 assertEquals(2800, lv2CPr.getSz()); - assertEquals(28.0, r2.getFontSize()); + assertEquals(28.0, r2.getFontSize(), 0); lv2CPr.setSz(3300); - assertEquals(33.0, r2.getFontSize()); + assertEquals(33.0, r2.getFontSize(), 0); lv2CPr.getLatin().setTypeface("Times"); assertEquals("Times", r2.getFontFamily()); assertEquals(STTextAlignType.L, lv2PPr.getAlgn()); @@ -756,9 +761,9 @@ public class TestXSLFTextShape extends T assertEquals(TextAlign.RIGHT, p2.getTextAlign()); //lv3 assertEquals(2400, lv3CPr.getSz()); - assertEquals(24.0, r3.getFontSize()); + assertEquals(24.0, r3.getFontSize(), 0); lv3CPr.setSz(2500); - assertEquals(25.0, r3.getFontSize()); + assertEquals(25.0, r3.getFontSize(), 0); lv3CPr.getLatin().setTypeface("Courier New"); assertEquals("Courier New", r3.getFontFamily()); assertEquals(STTextAlignType.L, lv3PPr.getAlgn()); @@ -780,21 +785,21 @@ public class TestXSLFTextShape extends T lv3CPr = lv3PPr.addNewDefRPr(); lv1CPr.setSz(3300); - assertEquals(33.0, r1.getFontSize()); + assertEquals(33.0, r1.getFontSize(), 0); lv1CPr.addNewLatin().setTypeface("Times"); assertEquals("Times", r1.getFontFamily()); lv1PPr.setAlgn(STTextAlignType.L); assertEquals(TextAlign.LEFT, p1.getTextAlign()); lv2CPr.setSz(3300); - assertEquals(33.0, r2.getFontSize()); + assertEquals(33.0, r2.getFontSize(), 0); lv2CPr.addNewLatin().setTypeface("Times"); assertEquals("Times", r2.getFontFamily()); lv2PPr.setAlgn(STTextAlignType.L); assertEquals(TextAlign.LEFT, p2.getTextAlign()); lv3CPr.setSz(3300); - assertEquals(33.0, r3.getFontSize()); + assertEquals(33.0, r3.getFontSize(), 0); lv3CPr.addNewLatin().setTypeface("Times"); assertEquals("Times", r3.getFontFamily()); lv3PPr.setAlgn(STTextAlignType.L); @@ -812,21 +817,21 @@ public class TestXSLFTextShape extends T lv3CPr = lv3PPr.addNewDefRPr(); lv1CPr.setSz(3400); - assertEquals(34.0, r1.getFontSize()); + assertEquals(34.0, r1.getFontSize(), 0); lv1CPr.addNewLatin().setTypeface("Courier New"); assertEquals("Courier New", r1.getFontFamily()); lv1PPr.setAlgn(STTextAlignType.CTR); assertEquals(TextAlign.CENTER, p1.getTextAlign()); lv2CPr.setSz(3400); - assertEquals(34.0, r2.getFontSize()); + assertEquals(34.0, r2.getFontSize(), 0); lv2CPr.addNewLatin().setTypeface("Courier New"); assertEquals("Courier New", r2.getFontFamily()); lv2PPr.setAlgn(STTextAlignType.CTR); assertEquals(TextAlign.CENTER, p2.getTextAlign()); lv3CPr.setSz(3400); - assertEquals(34.0, r3.getFontSize()); + assertEquals(34.0, r3.getFontSize(), 0); lv3CPr.addNewLatin().setTypeface("Courier New"); assertEquals("Courier New", r3.getFontFamily()); lv3PPr.setAlgn(STTextAlignType.CTR); @@ -842,21 +847,21 @@ public class TestXSLFTextShape extends T lv3CPr = lv3PPr.addNewDefRPr(); lv1CPr.setSz(3500); - assertEquals(35.0, r1.getFontSize()); + assertEquals(35.0, r1.getFontSize(), 0); lv1CPr.addNewLatin().setTypeface("Arial"); assertEquals("Arial", r1.getFontFamily()); lv1PPr.setAlgn(STTextAlignType.L); assertEquals(TextAlign.LEFT, p1.getTextAlign()); lv2CPr.setSz(3500); - assertEquals(35.0, r2.getFontSize()); + assertEquals(35.0, r2.getFontSize(), 0); lv2CPr.addNewLatin().setTypeface("Arial"); assertEquals("Arial", r2.getFontFamily()); lv2PPr.setAlgn(STTextAlignType.L); assertEquals(TextAlign.LEFT, p2.getTextAlign()); lv3CPr.setSz(3500); - assertEquals(35.0, r3.getFontSize()); + assertEquals(35.0, r3.getFontSize(), 0); lv3CPr.addNewLatin().setTypeface("Arial"); assertEquals("Arial", r3.getFontFamily()); lv3PPr.setAlgn(STTextAlignType.L); @@ -871,21 +876,21 @@ public class TestXSLFTextShape extends T lv3CPr = r3.getXmlObject().getRPr(); lv1CPr.setSz(3600); - assertEquals(36.0, r1.getFontSize()); + assertEquals(36.0, r1.getFontSize(), 0); lv1CPr.addNewLatin().setTypeface("Calibri"); assertEquals("Calibri", r1.getFontFamily()); lv1PPr.setAlgn(STTextAlignType.CTR); assertEquals(TextAlign.CENTER, p1.getTextAlign()); lv2CPr.setSz(3600); - assertEquals(36.0, r2.getFontSize()); + assertEquals(36.0, r2.getFontSize(), 0); lv2CPr.addNewLatin().setTypeface("Calibri"); assertEquals("Calibri", r2.getFontFamily()); lv2PPr.setAlgn(STTextAlignType.CTR); assertEquals(TextAlign.CENTER, p2.getTextAlign()); lv3CPr.setSz(3600); - assertEquals(36.0, r3.getFontSize()); + assertEquals(36.0, r3.getFontSize(), 0); lv3CPr.addNewLatin().setTypeface("Calibri"); assertEquals("Calibri", r3.getFontFamily()); lv3PPr.setAlgn(STTextAlignType.CTR); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java Fri Jul 24 21:47:55 2015 @@ -16,32 +16,39 @@ ==================================================================== */ package org.apache.poi.xslf.usermodel; -import junit.framework.TestCase; -import org.apache.poi.xslf.XSLFTestDataSamples; +import static org.junit.Assert.*; import java.awt.Color; -import java.awt.TexturePaint; +import java.util.List; + +import org.apache.poi.sl.usermodel.*; +import org.apache.poi.sl.usermodel.PaintStyle.GradientPaint; +import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint; +import org.apache.poi.sl.usermodel.PaintStyle.TexturePaint; +import org.apache.poi.xslf.XSLFTestDataSamples; +import org.junit.Test; /** * test reading properties from a multi-theme and multi-master document * * @author Yegor Kozlov */ -public class TestXSLFTheme extends TestCase { +public class TestXSLFTheme { + @Test public void testRead(){ XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("themes.pptx"); - XSLFSlide[] slides = ppt.getSlides(); + List slides = ppt.getSlides(); - slide1(slides[0]); - slide2(slides[1]); - slide3(slides[2]); - slide4(slides[3]); - slide5(slides[4]); - slide6(slides[5]); - slide7(slides[6]); - slide8(slides[7]); - slide9(slides[8]); - slide10(slides[9]); + slide1(slides.get(0)); + slide2(slides.get(1)); + slide3(slides.get(2)); + slide4(slides.get(3)); + slide5(slides.get(4)); + slide6(slides.get(5)); + slide7(slides.get(6)); + slide8(slides.get(7)); + slide9(slides.get(8)); + slide10(slides.get(9)); } private XSLFShape getShape(XSLFSheet sheet, String name){ @@ -52,41 +59,39 @@ public class TestXSLFTheme extends TestC } void slide1(XSLFSlide slide){ - assertEquals(Color.white, slide.getBackground().getFillColor()); + assertEquals(Color.WHITE, slide.getBackground().getFillColor()); XSLFTheme theme = slide.getTheme(); assertEquals("Office Theme", theme.getName()); XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Rectangle 3"); - RenderableShape rsh1 = new RenderableShape(sh1); XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(Color.white, run1.getFontColor()); assertEquals(new Color(79, 129, 189), sh1.getFillColor()); - assertTrue(rsh1.getFillPaint(null) instanceof Color) ; // solid fill + assertTrue(sh1.getFillStyle().getPaint() instanceof SolidPaint) ; // solid fill } void slide2(XSLFSlide slide){ // Background 2, darker 10% // YK: PPT shows slightly different color: new Color(221, 217, 195) - assertEquals(new Color(214, 212, 203), slide.getBackground().getFillColor()); + assertEquals(new Color(221, 217, 195), slide.getBackground().getFillColor()); } void slide3(XSLFSlide slide){ - assertNull(slide.getBackground().getFillColor()); - assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient") > 0); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof GradientPaint); } void slide4(XSLFSlide slide){ - assertNull(slide.getBackground().getFillColor()); - assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient") > 0); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof GradientPaint); XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Rectangle 4"); - RenderableShape rsh1 = new RenderableShape(sh1); XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(Color.white, run1.getFontColor()); assertEquals(new Color(148, 198, 0), sh1.getFillColor()); - assertTrue(rsh1.getFillPaint(null) instanceof Color) ; // solid fill + assertTrue(sh1.getFillStyle().getPaint() instanceof SolidPaint) ; // solid fill XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Title 3"); XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0); @@ -97,14 +102,15 @@ public class TestXSLFTheme extends TestC } void slide5(XSLFSlide slide){ - assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof TexturePaint); XSLFTextShape sh2 = (XSLFTextShape)getShape(slide, "Title 1"); XSLFTextRun run2 = sh2.getTextParagraphs().get(0).getTextRuns().get(0); assertEquals(new Color(148, 198, 0), run2.getFontColor()); assertNull(sh2.getFillColor()); // no fill // font size is 40pt and scale factor is 90% - assertEquals(36.0, run2.getFontSize()); + assertEquals(36.0, run2.getFontSize(), 0); assertTrue(slide.getSlideLayout().getFollowMasterGraphics()); } @@ -127,21 +133,24 @@ public class TestXSLFTheme extends TestC void slide7(XSLFSlide slide){ //YK: PPT reports a slightly different color: r=189,g=239,b=87 - assertEquals(new Color(182, 218, 108), slide.getBackground().getFillColor()); + assertEquals(new Color(189, 239, 87), slide.getBackground().getFillColor()); assertFalse(slide.getFollowMasterGraphics()); } void slide8(XSLFSlide slide){ - assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof TexturePaint); } void slide9(XSLFSlide slide){ - assertTrue(slide.getBackground().getPaint(null) instanceof TexturePaint); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof TexturePaint); } void slide10(XSLFSlide slide){ - assertTrue(slide.getBackground().getPaint(null).getClass().getName().indexOf("Gradient") > 0); + PaintStyle fs = slide.getBackground().getFillStyle().getPaint(); + assertTrue(fs instanceof GradientPaint); XSLFTextShape sh1 = (XSLFTextShape)getShape(slide, "Title 3"); XSLFTextRun run1 = sh1.getTextParagraphs().get(0).getTextRuns().get(0); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java Fri Jul 24 21:47:55 2015 @@ -17,7 +17,7 @@ package org.apache.poi.hslf.blip; -import org.apache.poi.hslf.usermodel.PictureData; +import org.apache.poi.hslf.usermodel.HSLFPictureData; import java.io.IOException; import java.io.ByteArrayOutputStream; @@ -28,7 +28,7 @@ import java.io.ByteArrayOutputStream; * * @author Yegor Kozlov */ -public abstract class Bitmap extends PictureData { +public abstract class Bitmap extends HSLFPictureData { public byte[] getData(){ byte[] rawdata = getRawData(); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java Fri Jul 24 21:47:55 2015 @@ -17,7 +17,7 @@ package org.apache.poi.hslf.blip; -import org.apache.poi.hslf.model.Picture; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; import org.apache.poi.util.LittleEndian; import java.io.IOException; @@ -35,10 +35,10 @@ public final class DIB extends Bitmap { /** * @return type of this picture - * @see org.apache.poi.hslf.model.Picture#DIB + * @see org.apache.poi.hslf.usermodel.HSLFPictureShape#DIB */ public int getType(){ - return Picture.DIB; + return HSLFPictureShape.DIB; } /** @@ -105,4 +105,8 @@ public final class DIB extends Bitmap { System.arraycopy(data, HEADER_SIZE, dib, 0, dib.length); super.setData(dib); } + + public String getContentType() { + return "image/bmp"; + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java Fri Jul 24 21:47:55 2015 @@ -17,16 +17,16 @@ package org.apache.poi.hslf.blip; -import org.apache.poi.hslf.model.Picture; -import org.apache.poi.hslf.model.Shape; -import org.apache.poi.hslf.exceptions.HSLFException; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InputStream; import java.util.zip.InflaterInputStream; +import org.apache.poi.hslf.exceptions.HSLFException; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; +import org.apache.poi.util.Units; + /** * Represents EMF (Windows Enhanced Metafile) picture data. * @@ -67,7 +67,7 @@ public final class EMF extends Metafile header.wmfsize = data.length; //we don't have a EMF reader in java, have to set default image size 200x200 header.bounds = new java.awt.Rectangle(0, 0, 200, 200); - header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT, header.bounds.height*Shape.EMU_PER_POINT); + header.size = new java.awt.Dimension(header.bounds.width*Units.EMU_PER_POINT, header.bounds.height*Units.EMU_PER_POINT); header.zipsize = compressed.length; byte[] checksum = getChecksum(data); @@ -80,7 +80,7 @@ public final class EMF extends Metafile } public int getType(){ - return Picture.EMF; + return HSLFPictureShape.EMF; } /** @@ -88,7 +88,7 @@ public final class EMF extends Metafile * * @return EMF signature ({@code 0x3D40} or {@code 0x3D50}) */ - public int getSignature() { + public int getSignature(){ return (uidInstanceCount == 1 ? 0x3D40 : 0x3D50); } @@ -107,4 +107,8 @@ public final class EMF extends Metafile throw new IllegalArgumentException(signature+" is not a valid instance/signature value for EMF"); } } + + public String getContentType() { + return "image/x-emf"; + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java Fri Jul 24 21:47:55 2015 @@ -17,7 +17,7 @@ package org.apache.poi.hslf.blip; -import org.apache.poi.hslf.model.Picture; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; /** * Represents a JPEG picture data in a PPT file @@ -32,10 +32,10 @@ public final class JPEG extends Bitmap { /** * @return type of this picture - * @see org.apache.poi.hslf.model.Picture#JPEG + * @see org.apache.poi.hslf.usermodel.HSLFPictureShape#JPEG */ public int getType(){ - return Picture.JPEG; + return HSLFPictureShape.JPEG; } public ColorSpace getColorSpace() { @@ -81,5 +81,9 @@ public final class JPEG extends Bitmap { default: throw new IllegalArgumentException(signature+" is not a valid instance/signature value for JPEG"); } - } + } + + public String getContentType() { + return "image/jpeg"; + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java Fri Jul 24 21:47:55 2015 @@ -18,7 +18,7 @@ package org.apache.poi.hslf.blip; import org.apache.poi.util.LittleEndian; -import org.apache.poi.hslf.usermodel.PictureData; +import org.apache.poi.hslf.usermodel.HSLFPictureData; import java.awt.*; import java.io.*; @@ -30,7 +30,7 @@ import java.util.zip.DeflaterOutputStrea * * @author Yegor Kozlov */ -public abstract class Metafile extends PictureData { +public abstract class Metafile extends HSLFPictureData { /** * A structure which represents a 34-byte header preceeding the compressed metafile data Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java Fri Jul 24 21:47:55 2015 @@ -23,8 +23,8 @@ import java.io.IOException; import java.util.zip.InflaterInputStream; import org.apache.poi.hslf.exceptions.HSLFException; -import org.apache.poi.hslf.model.Picture; -import org.apache.poi.hslf.model.Shape; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; +import org.apache.poi.util.Units; /** * Represents Macintosh PICT picture data. @@ -82,8 +82,8 @@ public final class PICT extends Metafile header.wmfsize = data.length - 512; //we don't have a PICT reader in java, have to set default image size 200x200 header.bounds = new java.awt.Rectangle(0, 0, 200, 200); - header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT, - header.bounds.height*Shape.EMU_PER_POINT); + header.size = new java.awt.Dimension(header.bounds.width*Units.EMU_PER_POINT, + header.bounds.height*Units.EMU_PER_POINT); header.zipsize = compressed.length; byte[] checksum = getChecksum(data); @@ -98,10 +98,10 @@ public final class PICT extends Metafile } /** - * @see org.apache.poi.hslf.model.Picture#PICT + * @see org.apache.poi.hslf.usermodel.HSLFPictureShape#PICT */ public int getType(){ - return Picture.PICT; + return HSLFPictureShape.PICT; } /** @@ -128,4 +128,9 @@ public final class PICT extends Metafile throw new IllegalArgumentException(signature+" is not a valid instance/signature value for PICT"); } } + + public String getContentType() { + return "image/x-pict"; + } + } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java Fri Jul 24 21:47:55 2015 @@ -17,7 +17,7 @@ package org.apache.poi.hslf.blip; -import org.apache.poi.hslf.model.Picture; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; import org.apache.poi.util.PngUtils; /** @@ -46,10 +46,10 @@ public final class PNG extends Bitmap { /** * @return type of this picture - * @see org.apache.poi.hslf.model.Picture#PNG + * @see org.apache.poi.hslf.usermodel.HSLFPictureShape#PNG */ public int getType(){ - return Picture.PNG; + return HSLFPictureShape.PNG; } /** @@ -76,4 +76,8 @@ public final class PNG extends Bitmap { throw new IllegalArgumentException(signature+" is not a valid instance/signature value for PNG"); } } + + public String getContentType() { + return "image/png"; + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java Fri Jul 24 21:47:55 2015 @@ -17,14 +17,18 @@ package org.apache.poi.hslf.blip; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.InflaterInputStream; + +import org.apache.poi.hslf.exceptions.HSLFException; +import org.apache.poi.hslf.usermodel.HSLFPictureShape; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.POILogger; -import org.apache.poi.hslf.model.Picture; -import org.apache.poi.hslf.model.Shape; -import org.apache.poi.hslf.exceptions.HSLFException; - -import java.io.*; -import java.util.zip.InflaterInputStream; +import org.apache.poi.util.Units; /** * Represents a WMF (Windows Metafile) picture data. @@ -78,7 +82,7 @@ public final class WMF extends Metafile header.wmfsize = data.length - aldus.getSize(); header.bounds = new java.awt.Rectangle((short)aldus.left, (short)aldus.top, (short)aldus.right-(short)aldus.left, (short)aldus.bottom-(short)aldus.top); //coefficient to translate from WMF dpi to 96pdi - int coeff = 96*Shape.EMU_PER_POINT/aldus.inch; + int coeff = 96*Units.EMU_PER_POINT/aldus.inch; header.size = new java.awt.Dimension(header.bounds.width*coeff, header.bounds.height*coeff); header.zipsize = compressed.length; @@ -97,7 +101,7 @@ public final class WMF extends Metafile * We are of type Picture.WMF */ public int getType(){ - return Picture.WMF; + return HSLFPictureShape.WMF; } /** @@ -205,4 +209,9 @@ public final class WMF extends Metafile } } + + public String getContentType() { + return "image/x-wmf"; + } + } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java Fri Jul 24 21:47:55 2015 @@ -19,6 +19,7 @@ package org.apache.poi.hslf.dev; import org.apache.poi.hslf.*; import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** @@ -33,7 +34,7 @@ public final class PPDrawingTextListing System.exit(1); } - HSLFSlideShow ss = new HSLFSlideShow(args[0]); + HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]); // Find PPDrawings at any second level position Record[] records = ss.getRecords(); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java Fri Jul 24 21:47:55 2015 @@ -17,11 +17,11 @@ package org.apache.poi.hslf.dev; -import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.RecordTypes; import org.apache.poi.hslf.record.SlideListWithText; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** * Uses record level code to Documents. @@ -35,7 +35,7 @@ public final class SLWTListing { System.exit(1); } - HSLFSlideShow ss = new HSLFSlideShow(args[0]); + HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]); // Find the documents, and then their SLWT Record[] records = ss.getRecords(); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java Fri Jul 24 21:47:55 2015 @@ -19,6 +19,7 @@ package org.apache.poi.hslf.dev; import org.apache.poi.hslf.*; import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** * Uses record level code to locate SlideListWithText entries. @@ -32,7 +33,7 @@ public final class SLWTTextListing { System.exit(1); } - HSLFSlideShow ss = new HSLFSlideShow(args[0]); + HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]); // Find the documents, and then their SLWT Record[] records = ss.getRecords(); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java Fri Jul 24 21:47:55 2015 @@ -19,6 +19,7 @@ package org.apache.poi.hslf.dev; import org.apache.poi.hslf.*; import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** @@ -34,7 +35,7 @@ public final class SlideAndNotesAtomList System.exit(1); } - HSLFSlideShow ss = new HSLFSlideShow(args[0]); + HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]); System.out.println(""); // Find either Slides or Notes Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java Fri Jul 24 21:47:55 2015 @@ -20,7 +20,6 @@ package org.apache.poi.hslf.dev; import java.io.ByteArrayOutputStream; import java.util.Map; -import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Notes; import org.apache.poi.hslf.record.NotesAtom; @@ -31,7 +30,8 @@ import org.apache.poi.hslf.record.Slide; import org.apache.poi.hslf.record.SlideAtom; import org.apache.poi.hslf.record.SlideListWithText; import org.apache.poi.hslf.record.SlidePersistAtom; -import org.apache.poi.hslf.usermodel.SlideShow; +import org.apache.poi.hslf.usermodel.HSLFSlideShow; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; import org.apache.poi.util.LittleEndian; /** @@ -50,8 +50,8 @@ public final class SlideIdListing { // Create the slideshow object, for normal working with - HSLFSlideShow hss = new HSLFSlideShow(args[0]); - SlideShow ss = new SlideShow(hss); + HSLFSlideShowImpl hss = new HSLFSlideShowImpl(args[0]); + HSLFSlideShow ss = new HSLFSlideShow(hss); // Grab the base contents fileContents = hss.getUnderlyingBytes(); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java Fri Jul 24 21:47:55 2015 @@ -28,6 +28,8 @@ import org.apache.poi.ddf.EscherTextboxR import org.apache.poi.hslf.record.RecordTypes; import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; +import org.apache.poi.hslf.record.HSLFEscherRecordFactory; +import org.apache.poi.hslf.record.RecordTypes; import org.apache.poi.util.LittleEndian; /** @@ -270,7 +272,7 @@ public void walkTree(int depth, int star byte[] contents = new byte[len]; System.arraycopy(_docstream,pos,contents,0,len); - DefaultEscherRecordFactory erf = new DefaultEscherRecordFactory(); + DefaultEscherRecordFactory erf = new HSLFEscherRecordFactory(); EscherRecord record = erf.createRecord(contents,0); // For now, try filling in the fields Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java Fri Jul 24 21:47:55 2015 @@ -19,20 +19,16 @@ package org.apache.poi.hslf.dev; import java.io.ByteArrayOutputStream; import java.io.IOException; - import java.util.Iterator; -import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.record.Record; import org.apache.poi.util.HexDump; import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherTextboxRecord; -import org.apache.poi.hslf.record.EscherTextboxWrapper; -import org.apache.poi.hslf.record.TextCharsAtom; -import org.apache.poi.hslf.record.TextBytesAtom; -import org.apache.poi.hslf.record.StyleTextPropAtom; +import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** * This class provides a way to view the contents of a powerpoint file. @@ -44,7 +40,7 @@ import org.apache.poi.hslf.record.StyleT public final class SlideShowRecordDumper { private boolean optVerbose; private boolean optEscher; - private HSLFSlideShow doc; + private HSLFSlideShowImpl doc; /** * right now this function takes one parameter: a ppt file, and outputs @@ -103,7 +99,7 @@ public final class SlideShowRecordDumper { optVerbose = verbose; optEscher = escher; - doc = new HSLFSlideShow(fileName); + doc = new HSLFSlideShowImpl(fileName); } @@ -264,7 +260,7 @@ public final class SlideShowRecordDumper // print additional information for drawings and atoms if (optEscher && cname.equals("PPDrawing")) { - DefaultEscherRecordFactory factory = new DefaultEscherRecordFactory(); + DefaultEscherRecordFactory factory = new HSLFEscherRecordFactory(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); r.writeOut(baos); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java?rev=1692593&r1=1692592&r2=1692593&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java Fri Jul 24 21:47:55 2015 @@ -17,13 +17,11 @@ package org.apache.poi.hslf.dev; -import org.apache.poi.hslf.*; -import org.apache.poi.hslf.model.textproperties.BitMaskTextProp; -import org.apache.poi.hslf.model.textproperties.TextProp; -import org.apache.poi.hslf.model.textproperties.TextPropCollection; -import org.apache.poi.hslf.record.*; +import java.util.List; -import java.util.LinkedList; +import org.apache.poi.hslf.model.textproperties.*; +import org.apache.poi.hslf.record.*; +import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; /** * Uses record level code to locate StyleTextPropAtom entries. @@ -36,7 +34,7 @@ public final class TextStyleListing { System.exit(1); } - HSLFSlideShow ss = new HSLFSlideShow(args[0]); + HSLFSlideShowImpl ss = new HSLFSlideShowImpl(args[0]); // Find the documents, and then their SLWT Record[] records = ss.getRecords(); @@ -72,19 +70,19 @@ public final class TextStyleListing { public static void showStyleTextPropAtom(StyleTextPropAtom stpa) { System.out.println("\nFound a StyleTextPropAtom"); - LinkedList paragraphStyles = stpa.getParagraphStyles(); + List paragraphStyles = stpa.getParagraphStyles(); System.out.println("Contains " + paragraphStyles.size() + " paragraph styles:"); for(int i=0; i charStyles = stpa.getCharacterStyles(); System.out.println("Contains " + charStyles.size() + " character styles:"); for(int i=0; i textProps = tpc.getTextPropList(); System.out.println(" Contains " + textProps.size() + " TextProps"); for(int i=0; i"); return; } - SlideShow ppt = new SlideShow(new HSLFSlideShow(args[0])); + HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl(args[0])); //extract all pictures contained in the presentation - PictureData[] pdata = ppt.getPictureData(); + HSLFPictureData[] pdata = ppt.getPictureData(); for (int i = 0; i < pdata.length; i++) { - PictureData pict = pdata[i]; + HSLFPictureData pict = pdata[i]; // picture data byte[] data = pict.getData(); @@ -50,22 +47,22 @@ public final class ImageExtractor { int type = pict.getType(); String ext; switch (type) { - case Picture.JPEG: + case HSLFPictureShape.JPEG: ext = ".jpg"; break; - case Picture.PNG: + case HSLFPictureShape.PNG: ext = ".png"; break; - case Picture.WMF: + case HSLFPictureShape.WMF: ext = ".wmf"; break; - case Picture.EMF: + case HSLFPictureShape.EMF: ext = ".emf"; break; - case Picture.PICT: + case HSLFPictureShape.PICT: ext = ".pict"; break; - case Picture.DIB: + case HSLFPictureShape.DIB: ext = ".dib"; break; default: --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org