expose access to OEPlaceholderAtom so that users can determine whether a shape represents ppt placeholder (date/time, footer or slide number)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@664493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2008-06-08 12:37:39 +00:00
parent 4360c3607d
commit 3cbc6fc52a
7 changed files with 45 additions and 17 deletions

View File

@ -37,6 +37,9 @@
<!-- Don't forget to update status.xml too! -->
<release version="3.1-final" date="2008-06-??">
<action dev="POI-DEVELOPERS" type="add">Support custom image renderers in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">Correctly increment the reference count of a blip when a picture is inserted</action>
<action dev="POI-DEVELOPERS" type="fix">45110 - Fixed TextShape.resizeToFitText() to properly resize TextShape</action>
<action dev="POI-DEVELOPERS" type="fix">45091 - Fixed serialization of RefN~ tokens. Simplified Ptg class hierarchy</action>
<action dev="POI-DEVELOPERS" type="fix">45133 - Fixed OBJ Record (5Dh) to pad the sub-record data to a 4-byte boundary</action>
<action dev="POI-DEVELOPERS" type="fix">45145 - Fixed Sheet to always enforce RowRecordsAggregate before ValueRecordsAggregate</action>

View File

@ -34,6 +34,9 @@
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1-final" date="2008-06-??">
<action dev="POI-DEVELOPERS" type="add">Support custom image renderers in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">Correctly increment the reference count of a blip when a picture is inserted</action>
<action dev="POI-DEVELOPERS" type="fix">45110 - Fixed TextShape.resizeToFitText() to properly resize TextShape</action>
<action dev="POI-DEVELOPERS" type="fix">45091 - Fixed serialization of RefN~ tokens. Simplified Ptg class hierarchy</action>
<action dev="POI-DEVELOPERS" type="fix">45133 - Fixed OBJ Record (5Dh) to pad the sub-record data to a 4-byte boundary</action>
<action dev="POI-DEVELOPERS" type="fix">45145 - Fixed Sheet to always enforce RowRecordsAggregate before ValueRecordsAggregate</action>

View File

@ -51,21 +51,7 @@ public abstract class MasterSheet extends Sheet {
if(!(shape instanceof TextShape)) return false;
TextShape tx = (TextShape)shape;
TextRun run = tx.getTextRun();
if(run == null) return false;
Record[] records = run._records;
for (int i = 0; i < records.length; i++) {
int type = (int)records[i].getRecordType();
if (type == RecordTypes.BaseTextPropAtom.typeID ||
type == RecordTypes.DateTimeMCAtom.typeID ||
type == RecordTypes.GenericDateMCAtom.typeID ||
type == RecordTypes.FooterMCAtom.typeID ||
type == RecordTypes.SlideNumberMCAtom.typeID
) return true;
}
return false;
return tx.getPlaceholderAtom() != null;
}
/**

View File

@ -20,10 +20,12 @@ package org.apache.poi.hslf.model;
import org.apache.poi.ddf.*;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.hslf.record.ColorSchemeAtom;
import org.apache.poi.hslf.record.Record;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.util.Iterator;
/**
* An abstract simple (non-group) shape.
@ -284,4 +286,28 @@ public class SimpleShape extends Shape {
ShapePainter.paint(this, graphics);
graphics.setTransform(at);
}
/**
* Find a record in the underlying EscherClientDataRecord
*
* @param recordType type of the record to search
*/
protected Record getClientDataRecord(int recordType) {
Record oep = null;
EscherContainerRecord spContainer = getSpContainer();
for (Iterator it = spContainer.getChildRecords().iterator(); it.hasNext();) {
EscherRecord obj = (EscherRecord) it.next();
if (obj.getRecordId() == EscherClientDataRecord.RECORD_ID) {
byte[] data = obj.serialize();
Record[] records = Record.findChildRecords(data, 8, data.length - 8);
for (int j = 0; j < records.length; j++) {
if (records[j].getRecordType() == recordType) {
return records[j];
}
}
}
}
return oep;
}
}

View File

@ -147,6 +147,7 @@ public class Slide extends Sheet
int dgId = dgg.getMaxDrawingGroupId() + 1;
dg.setOptions((short)(dgId << 4));
dgg.setDrawingsSaved(dgg.getDrawingsSaved() + 1);
dgg.setMaxDrawingGroupId(dgId);
for (Iterator it = dgContainer.getChildContainers().iterator(); it.hasNext(); ) {
EscherContainerRecord c = (EscherContainerRecord)it.next();

View File

@ -683,4 +683,13 @@ public class TextRun
String ns = s.replaceAll("\\r?\\n", "\r");
return ns;
}
/**
* Returns records that make up this text run
*
* @return text run records
*/
public Record[] getRecords(){
return _records;
}
}

View File

@ -138,7 +138,7 @@ public class StyleTextPropAtom extends RecordAtom
new TextProp(2, 0x4000, "spaceafter"),
new TextProp(2, 0x8000, "para_unknown_4"),
new TextProp(2, 0x10000, "para_unknown_5"),
new TextProp(2, 0xE0000, "para_unknown_6"),
new TextProp(2, 0xA0000, "para_unknown_6"),
new TextProp(2, 0x200000, "para_unknown_7")
};
/** All the different kinds of character properties we might handle */
@ -167,7 +167,7 @@ public class StyleTextPropAtom extends RecordAtom
/**
* For the Text Style Properties (StyleTextProp) Atom
*/
protected StyleTextPropAtom(byte[] source, int start, int len) {
public StyleTextPropAtom(byte[] source, int start, int len) {
// Sanity Checking - we're always at least 8+10 bytes long
if(len < 18) {
len = 18;