Fix for bug 39374 - handle unicode text runs

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@395888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2006-04-21 14:05:42 +00:00
parent 55e3a643b6
commit bee666439e
1 changed files with 13 additions and 12 deletions

View File

@ -25,6 +25,7 @@ import java.awt.*;
import java.awt.font.FontRenderContext; import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout; import java.awt.font.TextLayout;
import java.io.IOException; import java.io.IOException;
import java.util.Vector;
/** /**
* Represents a TextFrame shape in PowerPoint. * Represents a TextFrame shape in PowerPoint.
@ -96,17 +97,16 @@ public class TextBox extends SimpleShape {
EscherTextboxRecord textbox = (EscherTextboxRecord)Shape.getEscherChild(_escherContainer, EscherTextboxRecord.RECORD_ID); EscherTextboxRecord textbox = (EscherTextboxRecord)Shape.getEscherChild(_escherContainer, EscherTextboxRecord.RECORD_ID);
_txtbox = new EscherTextboxWrapper(textbox); _txtbox = new EscherTextboxWrapper(textbox);
TextHeaderAtom tha = null; // Find our TextRun
TextBytesAtom tba = null; Vector v = new Vector();
StyleTextPropAtom sta = null; Sheet.findTextRuns(_txtbox.getChildRecords(), v);
Record[] child = _txtbox.getChildRecords();
for (int i = 0; i < child.length; i++) {
if (child[i] instanceof TextHeaderAtom) tha = (TextHeaderAtom)child[i];
else if (child[i] instanceof TextBytesAtom) tba = (TextBytesAtom)child[i];
else if (child[i] instanceof StyleTextPropAtom) sta = (StyleTextPropAtom)child[i];
}
_txtrun = new TextRun(tha,tba,sta); // We should just have one
if(v.size() == 1) {
_txtrun = (TextRun)v.get(0);
} else {
throw new IllegalStateException("A TextBox should have one TextRun's worth of records in it, found " + v.size());
}
} }
/** /**
@ -157,6 +157,7 @@ public class TextBox extends SimpleShape {
_txtbox = new EscherTextboxWrapper(); _txtbox = new EscherTextboxWrapper();
TextHeaderAtom tha = new TextHeaderAtom(); TextHeaderAtom tha = new TextHeaderAtom();
tha.setParentRecord(_txtbox); // TextHeaderAtom is parent aware
_txtbox.appendChildRecord(tha); _txtbox.appendChildRecord(tha);
TextBytesAtom tba = new TextBytesAtom(); TextBytesAtom tba = new TextBytesAtom();