Examples of CTPlaceholder


Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Title Slide",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.CTR_TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
        assertNotNull(masterShape1.getSpPr().getXfrm());
        assertEquals(masterShape1.getAnchor(), shape1.getAnchor());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
        assertTrue(
                !bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
                !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(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(Color.black, r1.getFontColor());

        XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
        CTPlaceholder ph2 = shape2.getCTPlaceholder();
        assertEquals(STPlaceholderType.SUB_TITLE, ph2.getType());
        // anchor is not defined in the shape
        assertNull(shape2.getSpPr().getXfrm());

        XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
        assertNotNull(masterShape2.getSpPr().getXfrm());
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Title and Content",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
        // layout does not have anchor info either, it is in the slide master
        assertNull(masterShape1.getSpPr().getXfrm());
        masterShape1 = (XSLFTextShape)layout.getSlideMaster().getPlaceholder(ph1);
        assertNotNull(masterShape1.getSpPr().getXfrm());
        assertEquals(masterShape1.getAnchor(), shape1.getAnchor());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
        assertTrue(
                !bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
                !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(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(Color.black, r1.getFontColor());

        XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
        CTPlaceholder ph2 = shape2.getCTPlaceholder();
        assertFalse(ph2.isSetType()); // <p:ph idx="1"/>
        assertTrue(ph2.isSetIdx());
        assertEquals(1, ph2.getIdx());
        // anchor is not defined in the shape
        assertNull(shape2.getSpPr().getXfrm());

        XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
        // anchor of the body text is missing in the slide layout, llokup in the slide master
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Section Header",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
        assertNotNull(masterShape1.getSpPr().getXfrm());
        assertEquals(masterShape1.getAnchor(), shape1.getAnchor());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
        assertTrue(
                !bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
                !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(VerticalAlignment.TOP, shape1.getVerticalAlignment());

        // now check text properties
        assertEquals("Section Title", shape1.getText());
        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(Color.black, r1.getFontColor());
        assertTrue(r1.isBold());
        assertFalse(r1.isItalic());
        assertFalse(r1.isUnderline());

        XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
        CTPlaceholder ph2 = shape2.getCTPlaceholder();
        assertEquals(STPlaceholderType.BODY, ph2.getType());
        // anchor is not defined in the shape
        assertNull(shape2.getSpPr().getXfrm());

        XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
        assertNotNull(masterShape2.getSpPr().getXfrm());
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Two Content",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
        // layout does not have anchor info either, it is in the slide master
        assertNull(masterShape1.getSpPr().getXfrm());
        masterShape1 = (XSLFTextShape)layout.getSlideMaster().getPlaceholder(ph1);
        assertNotNull(masterShape1.getSpPr().getXfrm());
        assertEquals(masterShape1.getAnchor(), shape1.getAnchor());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
        assertTrue(
                !bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
                !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(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());

        // now check text properties
        assertEquals("Title", shape1.getText());
        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(Color.black, r1.getFontColor());

        XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
        CTPlaceholder ph2 = shape2.getCTPlaceholder();
        assertFalse(ph2.isSetType());
        assertTrue(ph2.isSetIdx());
        assertEquals(1, ph2.getIdx())//<p:ph sz="half" idx="1"/>
        // anchor is not defined in the shape
        assertNull(shape2.getSpPr().getXfrm());

        XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
        assertNotNull(masterShape2.getSpPr().getXfrm());
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Blank",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFShape[] shapes = slide.getShapes();
        assertEquals("Content with Caption",layout.getName());

        XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
        CTPlaceholder ph1 = shape1.getCTPlaceholder();
        assertEquals(STPlaceholderType.TITLE, ph1.getType());
        // anchor is not defined in the shape
        assertNull(shape1.getSpPr().getXfrm());

        XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
        // layout does not have anchor info either, it is in the slide master
        assertNotNull(masterShape1.getSpPr().getXfrm());
        assertEquals(masterShape1.getAnchor(), shape1.getAnchor());

        CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
        // none of the following properties are set in the shapes and fetched from the master shape
        assertTrue(
                !bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
                !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(VerticalAlignment.BOTTOM, shape1.getVerticalAlignment());

        // now check text properties
        assertEquals("Caption", shape1.getText());
        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(Color.black, r1.getFontColor());
        assertTrue(r1.isBold());

        XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
        CTPlaceholder ph2 = shape2.getCTPlaceholder();
        assertFalse(ph2.isSetType());
        assertTrue(ph2.isSetIdx());
        assertEquals(1, ph2.getIdx());
        // anchor is not defined in the shape
        assertNull(shape2.getSpPr().getXfrm());

        XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
        assertNotNull(masterShape2.getSpPr().getXfrm());
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

            _placeholderByTypeMap = new HashMap<Integer, XSLFSimpleShape>();

            for(XSLFShape sh : getShapes()){
                if(sh instanceof XSLFTextShape){
                    XSLFTextShape sShape = (XSLFTextShape)sh;
                    CTPlaceholder ph = sShape.getCTPlaceholder();
                    if(ph != null) {
                        _placeholders.add(sShape);
                        if(ph.isSetIdx()) {
                            int idx = (int)ph.getIdx();
                            _placeholderByIdMap.put(idx, sShape);
                        }
                        if(ph.isSetType()){
                            _placeholderByTypeMap.put(ph.getType().intValue(), sShape);
                        }
                    }
                }
            }
        }
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

    protected abstract CTTextBody getTextBody(boolean create);


    public Placeholder getTextType(){
        CTPlaceholder ph;
        XmlObject[] obj = getXmlObject().selectPath(
                "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:nvPr/p:ph");
        if(obj.length == 1){
            ph = (CTPlaceholder)obj[0];
            int val = ph.getType().intValue();
            return Placeholder.values()[val - 1];
        }
        else {
            return null;
        }
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        }
        return _lines;
    }

    CTTextParagraphProperties getDefaultMasterStyle(){
        CTPlaceholder ph = _shape.getCTPlaceholder();
        String defaultStyleSelector;
        if(ph == null) defaultStyleSelector = "otherStyle";   // no placeholder means plain text box
        else {
            switch(ph.getType().intValue()){
                case STPlaceholderType.INT_TITLE:
                case STPlaceholderType.INT_CTR_TITLE:
                    defaultStyleSelector = "titleStyle";
                    break;
                case STPlaceholderType.INT_FTR:
View Full Code Here

Examples of org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder

        if(!ok) {
            XSLFTextShape shape = getParentShape();
            ok = shape.fetchShapeProperty(visitor);
            if(!ok){
                CTPlaceholder ph = shape.getCTPlaceholder();
                if(ph == null){
                    // if it is a plain text box then take defaults from presentation.xml
                    XMLSlideShow ppt = getParentShape().getSheet().getSlideShow();
                    CTTextParagraphProperties themeProps = ppt.getDefaultParagraphStyle(getLevel());
                    if(themeProps != null) ok = visitor.fetch(themeProps);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.