use of org.apache.poi.hslf.usermodel.HSLFSimpleShape in project poi by apache.
the class HeadersFooters method getPlaceholderText.
private String getPlaceholderText(Placeholder ph, CString cs) {
String text;
if (_ppt2007) {
HSLFSimpleShape ss = _sheet.getPlaceholder(ph);
text = (ss instanceof HSLFTextShape) ? ((HSLFTextShape) ss).getText() : null;
// default text in master placeholders is not visible
if ("*".equals(text)) {
text = null;
}
} else {
text = (cs == null) ? null : cs.getText();
}
return text;
}
use of org.apache.poi.hslf.usermodel.HSLFSimpleShape in project poi by apache.
the class TestShapes method lineWidth.
@Test
public void lineWidth() {
HSLFSimpleShape sh = new HSLFAutoShape(ShapeType.RT_TRIANGLE);
AbstractEscherOptRecord opt = sh.getEscherOptRecord();
EscherSimpleProperty prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNull(prop);
assertEquals(HSLFSimpleShape.DEFAULT_LINE_WIDTH, sh.getLineWidth(), 0);
sh.setLineWidth(1.0);
prop = HSLFSimpleShape.getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
assertNotNull(prop);
assertEquals(1.0, sh.getLineWidth(), 0);
}
use of org.apache.poi.hslf.usermodel.HSLFSimpleShape in project poi by apache.
the class Hyperlinks method main.
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {
FileInputStream is = new FileInputStream(args[i]);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
for (HSLFSlide slide : ppt.getSlides()) {
System.out.println("\nslide " + slide.getSlideNumber());
// read hyperlinks from the slide's text runs
System.out.println("- reading hyperlinks from the text runs");
for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) {
for (HSLFTextParagraph para : paras) {
for (HSLFTextRun run : para) {
HSLFHyperlink link = run.getHyperlink();
if (link != null) {
System.out.println(toStr(link, run.getRawText()));
}
}
}
}
// in PowerPoint you can assign a hyperlink to a shape without text,
// for example to a Line object. The code below demonstrates how to
// read such hyperlinks
System.out.println("- reading hyperlinks from the slide's shapes");
for (HSLFShape sh : slide.getShapes()) {
if (sh instanceof HSLFSimpleShape) {
HSLFHyperlink link = ((HSLFSimpleShape) sh).getHyperlink();
if (link != null) {
System.out.println(toStr(link, null));
}
}
}
}
ppt.close();
}
}
use of org.apache.poi.hslf.usermodel.HSLFSimpleShape in project poi by apache.
the class HeadersFooters method isVisible.
private boolean isVisible(int flag, Placeholder placeholderId) {
boolean visible;
if (_ppt2007) {
HSLFSimpleShape ss = _sheet.getPlaceholder(placeholderId);
visible = ss instanceof HSLFTextShape && ((HSLFTextShape) ss).getText() != null;
} else {
visible = _container.getHeadersFootersAtom().getFlag(flag);
}
return visible;
}
Aggregations