poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r387016 - /jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
Date Sun, 19 Mar 2006 18:44:11 GMT
Author: nick
Date: Sun Mar 19 10:44:10 2006
New Revision: 387016

URL: http://svn.apache.org/viewcvs?rev=387016&view=rev
Log:
Also grab text from CStrings, which will get Comments

Modified:
    jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java

Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
URL: http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java?rev=387016&r1=387015&r2=387016&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
(original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
Sun Mar 19 10:44:10 2006
@@ -28,7 +28,9 @@
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.util.LittleEndian;
 
+import org.apache.poi.hslf.record.CString;
 import org.apache.poi.hslf.record.Record;
+import org.apache.poi.hslf.record.RecordTypes;
 import org.apache.poi.hslf.record.StyleTextPropAtom;
 import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.record.TextBytesAtom;
@@ -181,17 +183,30 @@
 		TextRun trun = null;
 
 		// TextBytesAtom
-		if(type == 4008l) {
+		if(type == RecordTypes.TextBytesAtom.typeID) {
 			TextBytesAtom tba = (TextBytesAtom)Record.createRecordForType(type, pptContents, startPos,
len+8);
 			trun = new TextRun((TextHeaderAtom)null,tba,(StyleTextPropAtom)null);
 		}
 		// TextCharsAtom
-		if(type == 4000l) {
+		if(type == RecordTypes.TextCharsAtom.typeID) {
 			TextCharsAtom tca = (TextCharsAtom)Record.createRecordForType(type, pptContents, startPos,
len+8);
 			trun = new TextRun((TextHeaderAtom)null,tca,(StyleTextPropAtom)null);
 		}
+		
+		// CString (doesn't go via a TextRun)
+		if(type == RecordTypes.CString.typeID) {
+			CString cs = (CString)Record.createRecordForType(type, pptContents, startPos, len+8);
+			String text = cs.getText();
+			
+			// Ignore the ones we know to be rubbish
+			if(text.equals("___PPT10")) {
+			} else if(text.equals("Default Design")) {
+			} else {
+				textV.add(text);
+			}
+		}
 
-		// If we found text, save it in the vector
+		// If we found text via a TextRun, save it in the vector
 		if(trun != null) {
 			textV.add(trun.getText());
 		}



---------------------------------------------------------------------
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/


Mime
View raw message