use of org.apache.poi.hslf.model.textproperties.TextPropCollection in project poi by apache.
the class StyleTextPropAtom method addCharacterTextPropCollection.
/**
* Create a new Character TextPropCollection, and add it to the list
* @param charactersCovered The number of characters this TextPropCollection will cover
* @return the new TextPropCollection, which will then be in the list
*/
public TextPropCollection addCharacterTextPropCollection(int charactersCovered) {
TextPropCollection tpc = new TextPropCollection(charactersCovered, TextPropType.character);
charStyles.add(tpc);
return tpc;
}
use of org.apache.poi.hslf.model.textproperties.TextPropCollection in project poi by apache.
the class TestTxMasterStyleAtom method checkNotesType.
/**
* Test styles for type=TextHeaderAtom.NOTES_TYPE
*/
private void checkNotesType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
//paragraph styles
props = txmaster.getParagraphStyles().get(0);
prop = props.findByName("alignment");
//title has center alignment
assertEquals(0, prop.getValue());
//character styles
props = txmaster.getCharacterStyles().get(0);
prop = props.findByName("font.color");
assertEquals(0x1000000, prop.getValue());
prop = props.findByName("font.index");
assertEquals(0, prop.getValue());
prop = props.findByName("font.size");
assertEquals(12, prop.getValue());
}
use of org.apache.poi.hslf.model.textproperties.TextPropCollection in project poi by apache.
the class TestTxMasterStyleAtom method checkBodyType.
/**
* Test styles for type=TextHeaderAtom.BODY_TYPE
*/
private void checkBodyType(TxMasterStyleAtom txmaster) {
TextPropCollection props;
TextProp prop;
List<TextPropCollection> prstyles = txmaster.getParagraphStyles();
List<TextPropCollection> chstyles = txmaster.getCharacterStyles();
assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " + "must contain styles for 5 indentation levels", 5, prstyles.size());
assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " + "must contain styles for 5 indentation levels", 5, chstyles.size());
//paragraph styles
props = prstyles.get(0);
prop = props.findByName("alignment");
assertEquals(0, prop.getValue());
for (int i = 0; i < prstyles.size(); i++) {
assertNotNull("text.offset is null for indentation level " + i, prstyles.get(i).findByName("text.offset"));
assertNotNull("bullet.offset is null for indentation level " + i, prstyles.get(i).findByName("bullet.offset"));
}
//character styles
props = chstyles.get(0);
prop = props.findByName("font.color");
assertEquals(0x1000000, prop.getValue());
prop = props.findByName("font.index");
assertEquals(0, prop.getValue());
prop = props.findByName("font.size");
assertEquals(32, prop.getValue());
}
use of org.apache.poi.hslf.model.textproperties.TextPropCollection in project poi by apache.
the class TestNumberedList2 method checkSingleRunWrapper.
private void checkSingleRunWrapper(final int exceptedLength, final EscherTextboxWrapper wrapper) {
final StyleTextPropAtom styleTextPropAtom = wrapper.getStyleTextPropAtom();
final List<TextPropCollection> textProps = styleTextPropAtom.getCharacterStyles();
assertEquals(1, textProps.size());
assertEquals(exceptedLength, textProps.get(0).getCharactersCovered());
}
use of org.apache.poi.hslf.model.textproperties.TextPropCollection 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