Get to a consistent indent
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@418849 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e077b9335
commit
519fa953c3
@ -36,111 +36,111 @@ import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
|
|||||||
|
|
||||||
public class Slide extends Sheet
|
public class Slide extends Sheet
|
||||||
{
|
{
|
||||||
private int _refSheetNo;
|
private int _refSheetNo;
|
||||||
private int _sheetNo;
|
private int _sheetNo;
|
||||||
private int _slideNo;
|
private int _slideNo;
|
||||||
private org.apache.poi.hslf.record.Slide _slide;
|
private org.apache.poi.hslf.record.Slide _slide;
|
||||||
private SlideAtomsSet _atomSet;
|
private SlideAtomsSet _atomSet;
|
||||||
private TextRun[] _runs;
|
private TextRun[] _runs;
|
||||||
private TextRun[] _otherRuns; // Any from the PPDrawing, shouldn't really be any though
|
private TextRun[] _otherRuns; // Any from the PPDrawing, shouldn't really be any though
|
||||||
private Notes _notes; // usermodel needs to set this
|
private Notes _notes; // usermodel needs to set this
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a Slide from the Slide record, and the SlideAtomsSet
|
* Constructs a Slide from the Slide record, and the SlideAtomsSet
|
||||||
* containing the text.
|
* containing the text.
|
||||||
* Initialises TextRuns, to provide easier access to the text
|
* Initialises TextRuns, to provide easier access to the text
|
||||||
*
|
*
|
||||||
* @param slide the Slide record we're based on
|
* @param slide the Slide record we're based on
|
||||||
* @param notes the Notes sheet attached to us
|
* @param notes the Notes sheet attached to us
|
||||||
* @param atomSet the SlideAtomsSet to get the text from
|
* @param atomSet the SlideAtomsSet to get the text from
|
||||||
*/
|
*/
|
||||||
public Slide(org.apache.poi.hslf.record.Slide slide, Notes notes, SlideAtomsSet atomSet, int slideIdentifier, int slideNumber) {
|
public Slide(org.apache.poi.hslf.record.Slide slide, Notes notes, SlideAtomsSet atomSet, int slideIdentifier, int slideNumber) {
|
||||||
_slide = slide;
|
_slide = slide;
|
||||||
_notes = notes;
|
_notes = notes;
|
||||||
_atomSet = atomSet;
|
_atomSet = atomSet;
|
||||||
_refSheetNo = slide.getSheetId();
|
_refSheetNo = slide.getSheetId();
|
||||||
_sheetNo = slideIdentifier;
|
_sheetNo = slideIdentifier;
|
||||||
_slideNo = slideNumber;
|
_slideNo = slideNumber;
|
||||||
|
|
||||||
// Grab the TextRuns from the PPDrawing
|
// Grab the TextRuns from the PPDrawing
|
||||||
_otherRuns = findTextRuns(_slide.getPPDrawing());
|
_otherRuns = findTextRuns(_slide.getPPDrawing());
|
||||||
|
|
||||||
// For the text coming in from the SlideAtomsSet:
|
// For the text coming in from the SlideAtomsSet:
|
||||||
// Build up TextRuns from pairs of TextHeaderAtom and
|
// Build up TextRuns from pairs of TextHeaderAtom and
|
||||||
// one of TextBytesAtom or TextCharsAtom
|
// one of TextBytesAtom or TextCharsAtom
|
||||||
Vector textRuns = new Vector();
|
Vector textRuns = new Vector();
|
||||||
if(_atomSet != null) {
|
if(_atomSet != null) {
|
||||||
findTextRuns(_atomSet.getSlideRecords(),textRuns);
|
findTextRuns(_atomSet.getSlideRecords(),textRuns);
|
||||||
} else {
|
} else {
|
||||||
// No text on the slide, must just be pictures
|
// No text on the slide, must just be pictures
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build an array, more useful than a vector
|
||||||
|
_runs = new TextRun[textRuns.size()+_otherRuns.length];
|
||||||
|
// Grab text from SlideListWithTexts entries
|
||||||
|
int i=0;
|
||||||
|
for(i=0; i<textRuns.size(); i++) {
|
||||||
|
_runs[i] = (TextRun)textRuns.get(i);
|
||||||
|
}
|
||||||
|
// Grab text from slide's PPDrawing
|
||||||
|
for(int k=0; k<_otherRuns.length; i++, k++) {
|
||||||
|
_runs[i] = _otherRuns[k];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build an array, more useful than a vector
|
|
||||||
_runs = new TextRun[textRuns.size()+_otherRuns.length];
|
|
||||||
// Grab text from SlideListWithTexts entries
|
|
||||||
int i=0;
|
|
||||||
for(i=0; i<textRuns.size(); i++) {
|
|
||||||
_runs[i] = (TextRun)textRuns.get(i);
|
|
||||||
}
|
|
||||||
// Grab text from slide's PPDrawing
|
|
||||||
for(int k=0; k<_otherRuns.length; i++, k++) {
|
|
||||||
_runs[i] = _otherRuns[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Slide instance
|
* Create a new Slide instance
|
||||||
* @param sheetNumber The internal number of the sheet, as used by PersistPtrHolder
|
* @param sheetNumber The internal number of the sheet, as used by PersistPtrHolder
|
||||||
* @param slideNumber The user facing number of the sheet
|
* @param slideNumber The user facing number of the sheet
|
||||||
*/
|
*/
|
||||||
public Slide(int sheetNumber, int sheetRefId, int slideNumber){
|
public Slide(int sheetNumber, int sheetRefId, int slideNumber){
|
||||||
_slide = new org.apache.poi.hslf.record.Slide();
|
_slide = new org.apache.poi.hslf.record.Slide();
|
||||||
_refSheetNo = sheetRefId;
|
_refSheetNo = sheetRefId;
|
||||||
_sheetNo = sheetNumber;
|
_sheetNo = sheetNumber;
|
||||||
_slideNo = slideNumber;
|
_slideNo = slideNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Notes that are associated with this. Updates the
|
* Sets the Notes that are associated with this. Updates the
|
||||||
* references in the records to point to the new ID
|
* references in the records to point to the new ID
|
||||||
*/
|
*/
|
||||||
public void setNotes(Notes notes) {
|
public void setNotes(Notes notes) {
|
||||||
_notes = notes;
|
_notes = notes;
|
||||||
|
|
||||||
// Update the Slide Atom's ID of where to point to
|
// Update the Slide Atom's ID of where to point to
|
||||||
SlideAtom sa = _slide.getSlideAtom();
|
SlideAtom sa = _slide.getSlideAtom();
|
||||||
|
|
||||||
if(notes == null) {
|
if(notes == null) {
|
||||||
// Set to 0
|
// Set to 0
|
||||||
sa.setNotesID(0);
|
sa.setNotesID(0);
|
||||||
} else {
|
} else {
|
||||||
// Set to the value from the notes' sheet id
|
// Set to the value from the notes' sheet id
|
||||||
sa.setNotesID(notes._getSheetNumber());
|
sa.setNotesID(notes._getSheetNumber());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the Slide's (external facing) page number.
|
* Changes the Slide's (external facing) page number.
|
||||||
* @see SlideShow.reorderSlide()
|
* @see SlideShow.reorderSlide()
|
||||||
*/
|
*/
|
||||||
public void setSlideNumber(int newSlideNumber) {
|
public void setSlideNumber(int newSlideNumber) {
|
||||||
_slideNo = newSlideNumber;
|
_slideNo = newSlideNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>TextBox</code> object that represents the slide's title.
|
* Create a <code>TextBox</code> object that represents the slide's title.
|
||||||
*
|
*
|
||||||
* @return <code>TextBox</code> object that represents the slide's title.
|
* @return <code>TextBox</code> object that represents the slide's title.
|
||||||
*/
|
*/
|
||||||
public TextBox addTitle() {
|
public TextBox addTitle() {
|
||||||
Placeholder pl = new Placeholder();
|
Placeholder pl = new Placeholder();
|
||||||
pl.setShapeType(ShapeTypes.Rectangle);
|
pl.setShapeType(ShapeTypes.Rectangle);
|
||||||
pl.setTextType(TextHeaderAtom.TITLE_TYPE);
|
pl.setTextType(TextHeaderAtom.TITLE_TYPE);
|
||||||
pl.setText("Click to edit title");
|
pl.setText("Click to edit title");
|
||||||
pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90));
|
pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90));
|
||||||
addShape(pl);
|
addShape(pl);
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Complex Accesser methods follow
|
// Complex Accesser methods follow
|
||||||
@ -171,45 +171,45 @@ public class Slide extends Sheet
|
|||||||
|
|
||||||
// Simple Accesser methods follow
|
// Simple Accesser methods follow
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the TextRuns found
|
* Returns an array of all the TextRuns found
|
||||||
*/
|
*/
|
||||||
public TextRun[] getTextRuns() { return _runs; }
|
public TextRun[] getTextRuns() { return _runs; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the (internal, RefID based) sheet number, as used
|
* Returns the (internal, RefID based) sheet number, as used
|
||||||
* to in PersistPtr stuff.
|
* to in PersistPtr stuff.
|
||||||
*/
|
*/
|
||||||
public int _getSheetRefId() { return _refSheetNo; }
|
public int _getSheetRefId() { return _refSheetNo; }
|
||||||
/**
|
/**
|
||||||
* Returns the (internal, SlideIdentifier based) sheet number
|
* Returns the (internal, SlideIdentifier based) sheet number
|
||||||
* @see #getSlideNumber()
|
* @see #getSlideNumber()
|
||||||
*/
|
*/
|
||||||
public int _getSheetNumber() { return _sheetNo; }
|
public int _getSheetNumber() { return _sheetNo; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the (public facing) page number of this slide
|
|
||||||
*/
|
|
||||||
public int getSlideNumber() { return _slideNo; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the underlying slide record
|
|
||||||
*/
|
|
||||||
public org.apache.poi.hslf.record.Slide getSlideRecord() { return _slide; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Notes Sheet for this slide, or null if there isn't one
|
* Returns the (public facing) page number of this slide
|
||||||
*/
|
*/
|
||||||
public Notes getNotesSheet() { return _notes; }
|
public int getSlideNumber() { return _slideNo; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PPDrawing associated with this slide, or null if there isn't one
|
* Returns the underlying slide record
|
||||||
*/
|
*/
|
||||||
protected PPDrawing getPPDrawing() { return _slide.getPPDrawing(); }
|
public org.apache.poi.hslf.record.Slide getSlideRecord() { return _slide; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return set of records inside <code>SlideListWithtext</code> container
|
* Returns the Notes Sheet for this slide, or null if there isn't one
|
||||||
* which hold text data for this slide (typically for placeholders).
|
*/
|
||||||
*/
|
public Notes getNotesSheet() { return _notes; }
|
||||||
protected SlideAtomsSet getSlideAtomsSet() { return _atomSet; }
|
|
||||||
|
/**
|
||||||
|
* Returns the PPDrawing associated with this slide, or null if there isn't one
|
||||||
|
*/
|
||||||
|
protected PPDrawing getPPDrawing() { return _slide.getPPDrawing(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return set of records inside <code>SlideListWithtext</code> container
|
||||||
|
* which hold text data for this slide (typically for placeholders).
|
||||||
|
*/
|
||||||
|
protected SlideAtomsSet getSlideAtomsSet() { return _atomSet; }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user