/** * Fetch the text, in output suitable form */ public String getText() { return parentRun.getText().substring(startPos, startPos+length); } /**
/** * Change the text */ public void setRawText(String text) { length = text.length(); parentRun.changeTextInRichTextRun(this,text); }
/** * Fetch the text, in raw storage form */ public String getRawText() { return parentRun.getRawText().substring(startPos, startPos+length); }
/** * Return title of this slide or <code>null</code> if the slide does not have title. * <p> * The title is a run of text of type <code>TextHeaderAtom.CENTER_TITLE_TYPE</code> or * <code>TextHeaderAtom.TITLE_TYPE</code> * </p> * * @see TextHeaderAtom * * @return title of this slide */ public String getTitle(){ TextRun[] txt = getTextRuns(); for (int i = 0; i < txt.length; i++) { int type = txt[i].getRunType(); if (type == TextHeaderAtom.CENTER_TITLE_TYPE || type == TextHeaderAtom.TITLE_TYPE ){ String title = txt[i].getText(); return title; } } return null; }
public void setSheet(Sheet sheet) { _sheet = sheet; // Initialize _txtrun object. // (We can't do it in the constructor because the sheet // is not assigned then, it's only built once we have // all the records) TextRun tx = getTextRun(); if (tx != null) { // Supply the sheet to our child RichTextRuns tx.setSheet(_sheet); RichTextRun[] rt = tx.getRichTextRuns(); for (int i = 0; i < rt.length; i++) { rt[i].supplySlideShow(_sheet.getSlideShow()); } } }
if (run == null) return null; String text = run.getText(); if (text == null || text.equals("")) return null; if(prStart) measurer.setPosition(startIndex++); RichTextRun rt = run.getRichTextRunAt(startIndex == text.length() ? (startIndex-1) : startIndex); if(rt == null) { logger.log(POILogger.WARN, "RichTextRun not found at pos" + startIndex + "; text.length: " + text.length()); int indent = rt.getIndentLevel(); TextRulerAtom ruler = run.getTextRuler(); if(ruler != null) { int bullet_val = ruler.getBulletOffsets()[indent]*Shape.POINT_DPI/Shape.MASTER_DPI;
/** * Internal constructor and initializer */ private TextRun(TextHeaderAtom tha, TextBytesAtom tba, TextCharsAtom tca, StyleTextPropAtom sta) { _headerAtom = tha; _styleAtom = sta; if(tba != null) { _byteAtom = tba; _isUnicode = false; } else { _charAtom = tca; _isUnicode = true; } String runRawText = getText(); // Figure out the rich text runs LinkedList pStyles = new LinkedList(); LinkedList cStyles = new LinkedList(); if(_styleAtom != null) { // Get the style atom to grok itself _styleAtom.setParentTextSize(runRawText.length()); pStyles = _styleAtom.getParagraphStyles(); cStyles = _styleAtom.getCharacterStyles(); } buildRichTextRuns(pStyles, cStyles, runRawText); }
ensureStyleAtomPresent(); int oldSize = getRawText().length(); storeText( getRawText() + s );
int idx = ota.getTextIndex(); for (int i = 0; i < runs.length; i++) { if(runs[i].getIndex() == idx){ _txtrun = runs[i]; break; int shapeId = escherSpRecord.getShapeId(); if(runs != null) for (int i = 0; i < runs.length; i++) { if(runs[i].getShapeId() == shapeId){ _txtrun = runs[i]; break; for (Record r : _txtrun.getRecords()) { if (child[i].getRecordType() == r.getRecordType()) { child[i] = r;
String text = txrun.getText(); RichTextRun[] rt = txrun.getRichTextRuns(); for (int i = 0; i < rt.length; i++) { int start = rt[i].getStartIndex();
txt.getTextRun().supplySlideShow(_group.getSheet().getSlideShow()); txt.getTextRun().setSheet(_group.getSheet()); txt.setText(s); RichTextRun rt = txt.getTextRun().getRichTextRuns()[0]; rt.setFontSize(_font.getSize()); rt.setFontName(_font.getFamily());
ensureStyleAtomPresent(); storeText(newText.toString());
public TextRun createTextRun(){ _txtbox = getEscherTextboxWrapper(); if(_txtbox == null) _txtbox = new EscherTextboxWrapper(); _txtrun = getTextRun(); if(_txtrun == null){ TextHeaderAtom tha = new TextHeaderAtom(); tha.setParentRecord(_txtbox); _txtbox.appendChildRecord(tha); TextCharsAtom tca = new TextCharsAtom(); _txtbox.appendChildRecord(tca); StyleTextPropAtom sta = new StyleTextPropAtom(0); _txtbox.appendChildRecord(sta); _txtrun = new TextRun(tha,tca,sta); _txtrun._records = new Record[]{tha, tca, sta}; _txtrun.setText(""); _escherContainer.addChildRecord(_txtbox.getEscherRecord()); setDefaultTextProperties(_txtrun); } return _txtrun; }
/** * Sets the type of horizontal alignment for the text. * One of the <code>Align*</code> constants defined in this class. * * @param align - the type of horizontal alignment */ public void setHorizontalAlignment(int align){ TextRun tx = getTextRun(); if(tx != null) tx.getRichTextRuns()[0].setAlignment(align); }
/** * Sets the value of the given Character TextProp, add if required * @param propName The name of the Character TextProp * @param val The value to set for the TextProp */ public void setParaTextPropVal(String propName, int val) { // Ensure we have the StyleTextProp atom we're going to need if(paragraphStyle == null) { parentRun.ensureStyleAtomPresent(); // paragraphStyle will now be defined } TextProp tp = fetchOrAddTextProp(paragraphStyle, propName); tp.setValue(val); } /**
/** * Gets the type of horizontal alignment for the text. * One of the <code>Align*</code> constants defined in this class. * * @return align - the type of horizontal alignment */ public int getHorizontalAlignment(){ TextRun tx = getTextRun(); return tx == null ? -1 : tx.getRichTextRuns()[0].getAlignment(); }
/** * Sets the value of the given Paragraph TextProp, add if required * @param propName The name of the Paragraph TextProp * @param val The value to set for the TextProp */ public void setCharTextPropVal(String propName, int val) { // Ensure we have the StyleTextProp atom we're going to need if(characterStyle == null) { parentRun.ensureStyleAtomPresent(); // characterStyle will now be defined } TextProp tp = fetchOrAddTextProp(characterStyle, propName); tp.setValue(val); }
private void textRunsToText(StringBuffer ret, TextRun[] runs) { if (runs==null) { return; } for (int j = 0; j < runs.length; j++) { TextRun run = runs[j]; if (run != null) { String text = run.getText(); ret.append(text); if (!text.endsWith("\n")) { ret.append("\n"); } } } } }