You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ni...@apache.org on 2006/04/21 16:05:44 UTC
svn commit: r395888 -
/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
Author: nick
Date: Fri Apr 21 07:05:42 2006
New Revision: 395888
URL: http://svn.apache.org/viewcvs?rev=395888&view=rev
Log:
Fix for bug 39374 - handle unicode text runs
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
URL: http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java?rev=395888&r1=395887&r2=395888&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java Fri Apr 21 07:05:42 2006
@@ -25,6 +25,7 @@
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import java.io.IOException;
+import java.util.Vector;
/**
* Represents a TextFrame shape in PowerPoint.
@@ -86,7 +87,7 @@
/**
* Create a TextBox object and initialize it from the supplied Record container.
- *
+ *
* @param escherRecord <code>EscherSpContainer</code> container which holds information about this shape
* @param parent the parent of the shape
*/
@@ -95,18 +96,17 @@
EscherTextboxRecord textbox = (EscherTextboxRecord)Shape.getEscherChild(_escherContainer, EscherTextboxRecord.RECORD_ID);
_txtbox = new EscherTextboxWrapper(textbox);
-
- TextHeaderAtom tha = null;
- TextBytesAtom tba = null;
- StyleTextPropAtom sta = null;
- 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];
+
+ // Find our TextRun
+ Vector v = new Vector();
+ Sheet.findTextRuns(_txtbox.getChildRecords(), v);
+
+ // 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());
}
-
- _txtrun = new TextRun(tha,tba,sta);
}
/**
@@ -157,6 +157,7 @@
_txtbox = new EscherTextboxWrapper();
TextHeaderAtom tha = new TextHeaderAtom();
+ tha.setParentRecord(_txtbox); // TextHeaderAtom is parent aware
_txtbox.appendChildRecord(tha);
TextBytesAtom tba = new TextBytesAtom();
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/