protected void onAddTextShape(TextShape shape) { TextRun run = shape.getTextRun(); if(_runs == null) _runs = new TextRun[]{run}; else { TextRun[] tmp = new TextRun[_runs.length + 1]; System.arraycopy(_runs, 0, tmp, 0, _runs.length); tmp[tmp.length-1] = run; _runs = tmp; } } }
protected void onAddTextShape(TextShape shape) { TextRun run = shape.getTextRun(); if(_runs == null) _runs = new TextRun[]{run}; else { TextRun[] tmp = new TextRun[_runs.length + 1]; System.arraycopy(_runs, 0, tmp, 0, _runs.length); tmp[tmp.length-1] = run; _runs = tmp; } }
/** * Returns the text contained in this text frame. * * @return the text string for this textbox. */ public String getText(){ TextRun tx = getTextRun(); return tx == null ? null : tx.getText(); }
/** * 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 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 text contained in this text frame. * * @param text the text string used by this object. */ public void setText(String text){ TextRun tx = getTextRun(); if(tx == null){ tx = createTextRun(); } tx.setText(text); setTextId(text.hashCode()); }
/** * Return placeholder by text type * * @param type type of text, See {@link org.apache.poi.hslf.record.TextHeaderAtom} * @return <code>TextShape</code> or <code>null</code> */ public TextShape getPlaceholderByTextType(int type){ Shape[] shape = getShapes(); for (int i = 0; i < shape.length; i++) { if(shape[i] instanceof TextShape){ TextShape tx = (TextShape)shape[i]; TextRun run = tx.getTextRun(); if(run != null && run.getRunType() == type){ return tx; } } } 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(txt == null || txt.length() == 0) return new Rectangle2D.Float(); RichTextRun rt = getTextRun().getRichTextRuns()[0]; int size = rt.getFontSize(); int style = 0;
int type = getTextRun().getRunType(); MasterSheet master = getSheet().getMasterSheet(); if(master != null){
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; }
public TextElement[] getTextElements(float textWidth, FontRenderContext frc){ TextRun run = _shape.getTextRun(); if (run == null) return null;