@Override public XSLFHyperlink getHyperlink(){ CTTextCharacterProperties rPr = getRPr(false); if (rPr == null) { return null; } CTHyperlink hl = rPr.getHlinkClick(); if (hl == null) { return null; } return new XSLFHyperlink(hl, _p.getParentShape().getSheet()); }
@Override public XSLFHyperlink createHyperlink(){ XSLFHyperlink hl = getHyperlink(); if (hl != null) { return hl; } CTTextCharacterProperties rPr = getRPr(true); return new XSLFHyperlink(rPr.addNewHlinkClick(), _p.getParentShape().getSheet()); }
boolean fetchThemeProperty(final ParagraphPropertyFetcher<?> visitor) { final XSLFTextShape shape = getParentShape(); if (shape.isPlaceholder()) { return false; } // if it is a plain text box then take defaults from presentation.xml @SuppressWarnings("resource") final XMLSlideShow ppt = shape.getSheet().getSlideShow(); final CTTextParagraphProperties themeProps = ppt.getDefaultParagraphStyle(getIndentLevel()); return themeProps != null && visitor.fetch(themeProps); }
@Override public void clearTabStops() { final XSLFSheet sheet = getParentShape().getSheet(); CTTextParagraphProperties tpp = (sheet instanceof XSLFSlideMaster) ? getDefaultMasterStyle() : getXmlObject().getPPr(); if (tpp != null && tpp.isSetTabLst()) { tpp.unsetTabLst(); } }
/** * * @return the color of bullet characters within a given paragraph. * A <code>null</code> value means to use the text font color. */ @SuppressWarnings("WeakerAccess") public PaintStyle getBulletFontColor(){ final XSLFTheme theme = getParentShape().getSheet().getTheme(); ParagraphPropertyFetcher<Color> fetcher = new ParagraphPropertyFetcher<Color>(getIndentLevel()){ public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuClr()){ XSLFColor c = new XSLFColor(props.getBuClr(), theme, null); setValue(c.getColor()); return true; } return false; } }; fetchParagraphProperty(fetcher); Color col = fetcher.getValue(); return (col == null) ? null : DrawPaint.createSolidPaint(col); }
private void fetchParagraphProperty(final ParagraphPropertyFetcher<?> visitor){ final XSLFTextShape shape = getParentShape(); final XSLFSheet sheet = shape.getSheet(); if (!(sheet instanceof XSLFSlideMaster)) { if (_p.isSetPPr() && visitor.fetch(_p.getPPr())) { return; } if (shape.fetchShapeProperty(visitor)) { return; } if (fetchThemeProperty(visitor)) { return; } } fetchMasterProperty(visitor); }
if (typeface.startsWith("+mj-") || typeface.startsWith("+mn-")) { final XSLFTheme theme = _p.getParentShape().getSheet().getTheme(); CTFontScheme fontTheme = theme.getXmlObject().getThemeElements().getFontScheme(); CTFontCollection coll = typeface.startsWith("+mj-")
@Override public void setFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!"); return; } SolidPaint sp = (SolidPaint)color; Color c = DrawPaint.applyColorTransform(sp.getSolidColor()); CTTextCharacterProperties rPr = getRPr(true); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr()); col.setColor(c); }
@Override public void addTabStops(double positionInPoints, TabStopType tabStopType) { final XSLFSheet sheet = getParentShape().getSheet(); final CTTextParagraphProperties tpp; if (sheet instanceof XSLFSlideMaster) { tpp = getDefaultMasterStyle(); } else { final CTTextParagraph xo = getXmlObject(); tpp = (xo.isSetPPr()) ? xo.getPPr() : xo.addNewPPr(); } if (tpp == null) { return; } final CTTextTabStopList stl = (tpp.isSetTabLst()) ? tpp.getTabLst() : tpp.addNewTabLst(); XSLFTabStop tab = new XSLFTabStop(stl.addNewTab()); tab.setPositionInPoints(positionInPoints); tab.setType(tabStopType); }
XSLFSheet masterSheet = _shape.getSheet(); for (XSLFSheet m = masterSheet; m != null; m = (XSLFSheet)m.getMasterSheet()) { masterSheet = m;
@Override public XSLFHyperlink getHyperlink(){ CTTextCharacterProperties rPr = getRPr(false); if (rPr == null) { return null; } CTHyperlink hl = rPr.getHlinkClick(); if (hl == null) { return null; } return new XSLFHyperlink(hl, _p.getParentShape().getSheet()); }
@Override public XSLFHyperlink createHyperlink(){ XSLFHyperlink hl = getHyperlink(); if (hl != null) { return hl; } CTTextCharacterProperties rPr = getRPr(true); return new XSLFHyperlink(rPr.addNewHlinkClick(), _p.getParentShape().getSheet()); }
boolean fetchThemeProperty(final ParagraphPropertyFetcher<?> visitor) { final XSLFTextShape shape = getParentShape(); if (shape.isPlaceholder()) { return false; } // if it is a plain text box then take defaults from presentation.xml @SuppressWarnings("resource") final XMLSlideShow ppt = shape.getSheet().getSlideShow(); final CTTextParagraphProperties themeProps = ppt.getDefaultParagraphStyle(getIndentLevel()); return themeProps != null && visitor.fetch(themeProps); }
@Override public void clearTabStops() { final XSLFSheet sheet = getParentShape().getSheet(); CTTextParagraphProperties tpp = (sheet instanceof XSLFSlideMaster) ? getDefaultMasterStyle() : getXmlObject().getPPr(); if (tpp != null && tpp.isSetTabLst()) { tpp.unsetTabLst(); } }
public byte getPitchAndFamily(){ final XSLFTheme theme = _p.getParentShape().getSheet().getTheme(); CharacterPropertyFetcher<Byte> visitor = new CharacterPropertyFetcher<Byte>(_p.getLevel()){ public boolean fetch(CTTextCharacterProperties props){ CTTextFont font = props.getLatin(); if(font != null){ setValue(font.getPitchFamily()); return true; } return false; } }; fetchCharacterProperty(visitor); return visitor.getValue() == null ? 0 : visitor.getValue(); }
public void setAddress(String address){ XSLFSheet sheet = _r.getParentParagraph().getParentShape().getSheet(); PackageRelationship rel = sheet.getPackagePart(). addExternalRelationship(address, XSLFRelation.HYPERLINK.getRelation()); _link.setId(rel.getId()); }
@Internal public URI getTargetURI(){ XSLFSheet sheet = _r.getParentParagraph().getParentShape().getSheet(); String id = _link.getId(); return sheet.getPackagePart().getRelationship(id).getTargetURI(); } }
public void setAddress(XSLFSlide slide){ XSLFSheet sheet = _r.getParentParagraph().getParentShape().getSheet(); PackageRelationship rel = sheet.getPackagePart(). addRelationship(slide.getPackagePart().getPartName(), TargetMode.INTERNAL, XSLFRelation.SLIDE.getRelation()); _link.setId(rel.getId()); _link.setAction("ppaction://hlinksldjump"); }
@Override public void setFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!"); return; } SolidPaint sp = (SolidPaint)color; Color c = DrawPaint.applyColorTransform(sp.getSolidColor()); CTTextCharacterProperties rPr = getRPr(true); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr()); col.setColor(c); }
@Override public void addTabStops(double positionInPoints, TabStopType tabStopType) { final XSLFSheet sheet = getParentShape().getSheet(); final CTTextParagraphProperties tpp; if (sheet instanceof XSLFSlideMaster) { tpp = getDefaultMasterStyle(); } else { final CTTextParagraph xo = getXmlObject(); tpp = (xo.isSetPPr()) ? xo.getPPr() : xo.addNewPPr(); } if (tpp == null) { return; } final CTTextTabStopList stl = (tpp.isSetTabLst()) ? tpp.getTabLst() : tpp.addNewTabLst(); XSLFTabStop tab = new XSLFTabStop(stl.addNewTab()); tab.setPositionInPoints(positionInPoints); tab.setType(tabStopType); }