org.openxmlformats.schemas.presentationml.x2006.main.CTShape Java Examples
The following examples show how to use
org.openxmlformats.schemas.presentationml.x2006.main.CTShape.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeometryImpl.java From tephra with MIT License | 6 votes |
private double[] getViewBox(XSLFSimpleShape xslfSimpleShape) { if (!(xslfSimpleShape.getXmlObject() instanceof CTShape)) return null; CTCustomGeometry2D ctCustomGeometry2D = ((CTShape) xslfSimpleShape.getXmlObject()).getSpPr().getCustGeom(); if (ctCustomGeometry2D == null || ctCustomGeometry2D.isNil()) return null; CTPath2DList ctPath2DList = ctCustomGeometry2D.getPathLst(); if (ctPath2DList == null || ctPath2DList.isNil() || ctPath2DList.sizeOfPathArray() == 0) return null; CTPath2D ctPath2D = ctPath2DList.getPathArray(0); if (ctPath2D == null || ctPath2D.isNil()) return null; return new double[]{officeHelper.emuToPoint(ctPath2D.getW()), officeHelper.emuToPoint(ctPath2D.getH())}; }
Example #2
Source File: ImageParserSupport.java From tephra with MIT License | 5 votes |
void parse(XSLFSlide xslfSlide, XSLFPictureData xslfPictureData, JSONObject object) { if (!object.containsKey("alpha")) { parseImage(xslfSlide, xslfPictureData, object); return; } double alpha = object.getDoubleValue("alpha"); if (alpha >= 1.0D) { parseImage(xslfSlide, xslfPictureData, object); return; } PackagePart packagePart = xslfPictureData.getPackagePart(); POIXMLDocumentPart.RelationPart relationPart = xslfSlide.addRelation(null, XSLFRelation.IMAGES, new XSLFPictureData(packagePart)); XSLFAutoShape xslfAutoShape = xslfSlide.createAutoShape(); CTShape ctShape = (CTShape) xslfAutoShape.getXmlObject(); CTBlipFillProperties ctBlipFillProperties = ctShape.getSpPr().addNewBlipFill(); CTBlip ctBlip = ctBlipFillProperties.addNewBlip(); ctBlip.setEmbed(relationPart.getRelationship().getId()); ctBlip.setCstate(STBlipCompression.PRINT); ctBlip.addNewAlphaModFix().setAmt(numeric.toInt(alpha * 100000)); ctBlipFillProperties.addNewSrcRect(); ctBlipFillProperties.addNewStretch().addNewFillRect(); xslfAutoShape.setAnchor(parserHelper.getRectangle(object)); parserHelper.rotate(xslfAutoShape, object); }
Example #3
Source File: ShadowImpl.java From tephra with MIT License | 5 votes |
@Override public void parseShape(WriterContext writerContext, XSLFSimpleShape xslfSimpleShape, JSONObject shape) { if (!shape.containsKey("shadow")) return; JSONObject shadow = shape.getJSONObject("shadow"); CTShape ctShape = (CTShape) xslfSimpleShape.getXmlObject(); CTEffectList ctEffectList = ctShape.getSpPr().getEffectLst(); if (ctEffectList == null) ctEffectList = ctShape.getSpPr().addNewEffectLst(); switch (shadow.getString("type")) { case "inner": return; case "outer": CTOuterShadowEffect ctOuterShadowEffect = ctEffectList.addNewOuterShdw(); ctOuterShadowEffect.setAlgn(STRectAlignment.Enum.forString("ctr")); ctOuterShadowEffect.setBlurRad(officeHelper.pixelToEmu(shadow.getIntValue("blur"))); ctOuterShadowEffect.setDist(officeHelper.pixelToEmu(shadow.getIntValue("distance"))); ctOuterShadowEffect.setDir(shadow.getIntValue("angle") * 60000); Color color = officeHelper.jsonToColor(shadow.getJSONObject("color")); CTSRgbColor ctsRgbColor = ctOuterShadowEffect.addNewSrgbClr(); ctsRgbColor.addNewAlpha().setVal(officeHelper.toPercent(color.getAlpha() / 256.0D)); ctsRgbColor.addNewRed().setVal(color.getRed()); ctsRgbColor.addNewGreen().setVal(color.getGreen()); ctsRgbColor.addNewBlue().setVal(color.getBlue()); return; default: } }
Example #4
Source File: TextureImpl.java From tephra with MIT License | 5 votes |
private void parseFillRect(XSLFSimpleShape xslfSimpleShape, JSONObject texture) { XmlObject xmlObject = xslfSimpleShape.getXmlObject(); if (xmlObject instanceof CTBackground) parseBlipFill(((CTBackground) xmlObject).getBgPr().getBlipFill(), texture); else if (xmlObject instanceof CTShape) parseBlipFill(((CTShape) xmlObject).getSpPr().getBlipFill(), texture); }
Example #5
Source File: FlipImpl.java From tephra with MIT License | 5 votes |
private CTSphereCoords getScene3D(XSLFSimpleShape xslfSimpleShape) { XmlObject xmlObject = xslfSimpleShape.getXmlObject(); if (!(xmlObject instanceof CTShape)) return null; CTScene3D ctScene3D = ((CTShape) xmlObject).getSpPr().getScene3D(); if (ctScene3D == null) return null; CTCamera ctCamera = ctScene3D.getCamera(); if (ctCamera == null) return null; return ctCamera.getRot(); }
Example #6
Source File: PptTemplates.java From PPT-Templates with Apache License 2.0 | 5 votes |
private static boolean processTextShape(XSLFTextShape textShape, PptMapper mapper) { Optional<PptVariable> textVariable = parseHyperlinkVariable(textShape); if(shouldHide(textVariable, mapper)) { return true; } deleteParagraphsByIndex( processTextParagraphs(textShape.getTextParagraphs(), mapper), ((CTShape)textShape.getXmlObject()).getTxBody() ); styleShape(textShape, textVariable, mapper); return false; }
Example #7
Source File: PowerPointOOXMLDocument.java From olat with Apache License 2.0 | 5 votes |
private void extractShapeContent(final StringBuilder buffy, final CTGroupShape gs) { final CTShape[] shapes = gs.getSpArray(); for (final CTShape shape : shapes) { final CTTextBody textBody = shape.getTxBody(); if (textBody != null) { final CTTextParagraph[] paras = textBody.getPArray(); for (final CTTextParagraph textParagraph : paras) { final CTRegularTextRun[] textRuns = textParagraph.getRArray(); for (final CTRegularTextRun textRun : textRuns) { buffy.append(textRun.getT()).append(' '); } } } } }