use of org.apache.poi.hslf.model.textproperties.TextPFException9 in project poi by apache.
the class HSLFTextParagraph method getAutoNumberingScheme.
public AutoNumberingScheme getAutoNumberingScheme() {
if (styleTextProp9Atom == null) {
return null;
}
TextPFException9[] ant = styleTextProp9Atom.getAutoNumberTypes();
int level = getIndentLevel();
if (ant == null || level == -1 || level >= ant.length) {
return null;
}
return ant[level].getAutoNumberScheme();
}
use of org.apache.poi.hslf.model.textproperties.TextPFException9 in project poi by apache.
the class TestNumberedList2 method checkSlide0.
private void checkSlide0(final HSLFSlide s) {
final StyleTextProp9Atom[] numberedListArray = s.getNumberedListInfo();
assertNotNull(numberedListArray);
assertEquals(2, numberedListArray.length);
final StyleTextProp9Atom numberedListInfoForTextBox0 = numberedListArray[0];
final StyleTextProp9Atom numberedListInfoForTextBox1 = numberedListArray[1];
assertNotNull(numberedListInfoForTextBox0);
assertNotNull(numberedListInfoForTextBox1);
final TextPFException9[] autoNumbersOfTextBox0 = numberedListInfoForTextBox0.getAutoNumberTypes();
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox0[0].getfBulletHasAutoNumber());
//Default value = 1 will be used
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox0[0].getAutoNumberStartNumber());
assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
final TextPFException9[] autoNumbersOfTextBox1 = numberedListInfoForTextBox1.getAutoNumberTypes();
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox1[0].getfBulletHasAutoNumber());
//Default value = 1 will be used
assertEquals(Short.valueOf((short) 6), autoNumbersOfTextBox1[0].getAutoNumberStartNumber());
assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox1[0].getAutoNumberScheme());
List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
assertEquals(2, textParass.size());
List<HSLFTextParagraph> textParas = textParass.get(0);
assertEquals("List Item One\rList Item Two\rList Item Three", HSLFTextParagraph.getRawText(textParas));
assertEquals(3, textParas.size());
assertTrue(textParas.get(0).isBullet());
String expected = "A numbered list may start at any number \r" + "This would be used as a continuation list on another page\r" + "This list should start with #6";
assertEquals(expected, HSLFTextParagraph.getRawText(textParass.get(1)));
final EscherTextboxWrapper[] styleAtoms = s.getTextboxWrappers();
assertEquals(textParass.size(), styleAtoms.length);
checkSingleRunWrapper(44, styleAtoms[0]);
checkSingleRunWrapper(130, styleAtoms[1]);
}
use of org.apache.poi.hslf.model.textproperties.TextPFException9 in project poi by apache.
the class HSLFTextParagraph method getAutoNumberingStartAt.
public Integer getAutoNumberingStartAt() {
if (styleTextProp9Atom == null) {
return null;
}
TextPFException9[] ant = styleTextProp9Atom.getAutoNumberTypes();
int level = getIndentLevel();
if (ant == null || level >= ant.length) {
return null;
}
Short startAt = ant[level].getAutoNumberStartNumber();
assert (startAt != null);
return startAt.intValue();
}
use of org.apache.poi.hslf.model.textproperties.TextPFException9 in project poi by apache.
the class TestNumberedList2 method checkSlide1.
private void checkSlide1(final HSLFSlide s) {
final StyleTextProp9Atom[] numberedListArray = s.getNumberedListInfo();
assertNotNull(numberedListArray);
assertEquals(1, numberedListArray.length);
final StyleTextProp9Atom numberedListInfoForTextBox = numberedListArray[0];
assertNotNull(numberedListInfoForTextBox);
final TextPFException9[] autoNumbersOfTextBox = numberedListInfoForTextBox.getAutoNumberTypes();
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox[0].getfBulletHasAutoNumber());
//Default value = 1 will be used
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox[0].getAutoNumberStartNumber());
assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox[0].getAutoNumberScheme());
List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
assertEquals(3, textParass.size());
List<HSLFTextParagraph> textParas = textParass.get(0);
assertEquals("Bulleted list\rMore bullets", HSLFTextParagraph.getRawText(textParas));
assertEquals(2, textParas.size());
assertTrue(textParas.get(0).isBullet());
String expected = "Numbered list between two bulleted lists\rSecond numbered list item";
assertEquals(expected, HSLFTextParagraph.getRawText(textParass.get(1)));
expected = "Second bulleted list – should appear after numbered list\rMore bullets";
assertEquals(expected, HSLFTextParagraph.getRawText(textParass.get(2)));
final EscherTextboxWrapper[] styleAtoms = s.getTextboxWrappers();
assertEquals(textParass.size(), styleAtoms.length);
checkSingleRunWrapper(27, styleAtoms[0]);
checkSingleRunWrapper(67, styleAtoms[1]);
checkSingleRunWrapper(70, styleAtoms[2]);
}
use of org.apache.poi.hslf.model.textproperties.TextPFException9 in project poi by apache.
the class TestNumberedList3 method checkSlide.
private void checkSlide(final HSLFSlide s) {
final StyleTextProp9Atom[] numberedListArray = s.getNumberedListInfo();
assertNotNull(numberedListArray);
assertEquals(1, numberedListArray.length);
final StyleTextProp9Atom numberedListInfoForTextBox = numberedListArray[0];
assertNotNull(numberedListInfoForTextBox);
final TextPFException9[] autoNumbersOfTextBox0 = numberedListInfoForTextBox.getAutoNumberTypes();
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox0[0].getfBulletHasAutoNumber());
//Default value = 1 will be used
assertEquals(Short.valueOf((short) 1), autoNumbersOfTextBox0[0].getAutoNumberStartNumber());
assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
final List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
assertEquals(3, textParass.size());
assertEquals("Bulleted list\rMore bullets\rNo bullets here", HSLFTextParagraph.getRawText(textParass.get(0)));
assertEquals("Numbered list between two bulleted lists\rSecond numbered list item", HSLFTextParagraph.getRawText(textParass.get(1)));
assertEquals("Second bulleted list – should appear after numbered list\rMore bullets", HSLFTextParagraph.getRawText(textParass.get(2)));
assertEquals(3, textParass.get(0).size());
assertEquals(2, textParass.get(1).size());
assertEquals(2, textParass.get(2).size());
assertNull(textParass.get(0).get(0).getStyleTextProp9Atom());
assertNotNull(textParass.get(1).get(0).getStyleTextProp9Atom());
assertNull(textParass.get(2).get(0).getStyleTextProp9Atom());
final TextPFException9[] autoNumbers = textParass.get(1).get(0).getStyleTextProp9Atom().getAutoNumberTypes();
assertEquals(1, autoNumbers.length);
assertEquals(Short.valueOf((short) 1), autoNumbers[0].getfBulletHasAutoNumber());
//Default value = 1 will be used
assertEquals(Short.valueOf((short) 1), autoNumbers[0].getAutoNumberStartNumber());
assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
int chCovered = 0;
for (HSLFTextParagraph htp : textParass.get(1)) {
for (HSLFTextRun htr : htp.getTextRuns()) {
TextPropCollection textProp = htr.getCharacterStyle();
chCovered += textProp.getCharactersCovered();
}
}
assertEquals(67, chCovered);
assertTrue(textParass.get(0).get(0).isBullet());
final EscherTextboxWrapper[] styleAtoms = s.getTextboxWrappers();
assertEquals(textParass.size(), styleAtoms.length);
checkSingleRunWrapper(43, styleAtoms[0]);
checkSingleRunWrapper(67, styleAtoms[1]);
}
Aggregations