diff --git a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java index 292fec85fa..c089167533 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java @@ -29,6 +29,7 @@ import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.util.LittleEndian; import org.apache.poi.hslf.record.Record; +import org.apache.poi.hslf.record.StyleTextPropAtom; import org.apache.poi.hslf.record.TextHeaderAtom; import org.apache.poi.hslf.record.TextBytesAtom; import org.apache.poi.hslf.record.TextCharsAtom; @@ -182,12 +183,12 @@ public class QuickButCruddyTextExtractor // TextBytesAtom if(type == 4008l) { TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos, len+8); - trun = new TextRun((TextHeaderAtom)null,tba); + trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null); } // TextCharsAtom if(type == 4000l) { TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos, len+8); - trun = new TextRun((TextHeaderAtom)null,tca); + trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null); } // If we found text, save it in the vector diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java b/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java index 015d903283..ca5c1a565e 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java @@ -71,12 +71,22 @@ public abstract class Sheet if(records[i] instanceof TextHeaderAtom) { TextRun trun = null; TextHeaderAtom tha = (TextHeaderAtom)records[i]; + StyleTextPropAtom stpa = null; + + // Look for a subsequent StyleTextPropAtom + if(i < (records.length-2)) { + if(records[i+2] instanceof StyleTextPropAtom) { + stpa = (StyleTextPropAtom)records[i+2]; + } + } + + // See what follows the TextHeaderAtom if(records[i+1] instanceof TextCharsAtom) { TextCharsAtom tca = (TextCharsAtom)records[i+1]; - trun = new TextRun(tha,tca); + trun = new TextRun(tha,tca,stpa); } else if(records[i+1] instanceof TextBytesAtom) { TextBytesAtom tba = (TextBytesAtom)records[i+1]; - trun = new TextRun(tha,tba); + trun = new TextRun(tha,tba,stpa); } else if(records[i+1].getRecordType() == 4001l) { // StyleTextPropAtom - Safe to ignore } else if(records[i+1].getRecordType() == 4010l) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java index dc87c79ee1..a7d7a97d8d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java @@ -35,6 +35,7 @@ public class TextRun private TextHeaderAtom _headerAtom; private TextBytesAtom _byteAtom; private TextCharsAtom _charAtom; + private StyleTextPropAtom _styleAtom; private boolean _isUnicode; /** @@ -43,9 +44,10 @@ public class TextRun * @param tha the TextHeaderAtom that defines what's what * @param tca the TextCharsAtom containing the text */ - public TextRun(TextHeaderAtom tha, TextCharsAtom tca) { + public TextRun(TextHeaderAtom tha, TextCharsAtom tca, StyleTextPropAtom sta) { _headerAtom = tha; _charAtom = tca; + _styleAtom = sta; _isUnicode = true; } @@ -55,9 +57,10 @@ public class TextRun * @param tha the TextHeaderAtom that defines what's what * @param tba the TextBytesAtom containing the text */ - public TextRun(TextHeaderAtom tha, TextBytesAtom tba) { + public TextRun(TextHeaderAtom tha, TextBytesAtom tba, StyleTextPropAtom sta) { _headerAtom = tha; _byteAtom = tba; + _styleAtom = sta; _isUnicode = false; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java b/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java index 21846068be..c09bedf171 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java @@ -41,7 +41,7 @@ public class RecordTypes { public static final Type SlideAtom = new Type(1007,SlideAtom.class); public static final Type Notes = new Type(1008,Notes.class); public static final Type NotesAtom = new Type(1009,NotesAtom.class); - public static final Type Environment = new Type(1010,null); + public static final Type Environment = new Type(1010,DummyRecordWithChildren.class); public static final Type SlidePersistAtom = new Type(1011,SlidePersistAtom.class); public static final Type SSlideLayoutAtom = new Type(1015,null); public static final Type MainMaster = new Type(1016,DummyPositionSensitiveRecordWithChildren.class); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java index c0c21e96f1..2d8887bd28 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java @@ -26,7 +26,9 @@ import org.apache.poi.util.LittleEndian; import org.apache.poi.hslf.*; import org.apache.poi.hslf.model.*; +import org.apache.poi.hslf.record.FontCollection; import org.apache.poi.hslf.record.Record; +import org.apache.poi.hslf.record.RecordTypes; import org.apache.poi.hslf.record.SlideAtom; import org.apache.poi.hslf.record.SlideListWithText; import org.apache.poi.hslf.record.SlideListWithText.*; @@ -59,6 +61,7 @@ public class SlideShow // Friendly objects for people to deal with private Slide[] _slides; private Notes[] _notes; + private FontCollection _fonts; // MetaSheets (eg masters) not yet supported // private MetaSheets[] _msheets; @@ -183,7 +186,7 @@ public class SlideShow if(_mostRecentCoreRecords[i] instanceof org.apache.poi.hslf.record.Slide) { slidesV.add(_mostRecentCoreRecords[i]); } - if(_records[i].getRecordType() == 1000l) { + if(_records[i].getRecordType() == RecordTypes.Document.typeID) { documentRecord = _mostRecentCoreRecords[i]; } } @@ -210,9 +213,19 @@ public class SlideShow Record[] docChildren = documentRecord.getChildRecords(); for(int i=0; i