import org.apache.poi.hslf.record.UserEditAtom;
import org.apache.poi.hslf.usermodel.ObjectData;
import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.model.Shape;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* This class contains the main functionality for the Powerpoint file
public class HSLFSlideShow extends POIDocument
{
// For logging
- protected POILogger logger = POILogFactory.getLogger(this.getClass());
+ private static final Log logger = LogFactory.getLog(HSLFSlideShow.class);
private InputStream istream;
try {
currentUser = new CurrentUserAtom(directory);
} catch(IOException ie) {
- logger.log(POILogger.ERROR, "Error finding Current User Atom:\n" + ie);
+ logger.error("Error finding Current User Atom:\n" + ie);
currentUser = new CurrentUserAtom();
}
}
// If they type (including the bonus 0xF018) is 0, skip it
if(type == 0) {
- logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
- logger.log(POILogger.ERROR, "" + pos);
+ logger.error("Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
+ logger.error("" + pos);
} else {
// Copy the data, ready to pass to PictureData
byte[] imgdata = new byte[imgsize];
pict.setOffset(offset);
p.add(pict);
} catch(IllegalArgumentException e) {
- logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
+ logger.error("Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
}
}
package org.apache.poi.hslf.record;
-import org.apache.poi.util.POILogger;
-
import java.io.IOException;
import java.io.OutputStream;
// (normally it's 2, or 3 if you have notes)
// Complain if it's not
if(slwtcount == 0) {
- logger.log(POILogger.WARN, "No SlideListWithText's found - there should normally be at least one!");
+ logger.warn("No SlideListWithText's found - there should normally be at least one!");
}
if(slwtcount > 3) {
- logger.log(POILogger.WARN, "Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
+ logger.warn("Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
}
// Now grab all the SLWTs
import java.io.IOException;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
/**
* This data represents an embedded object in the document.
if(_children[0] instanceof ExEmbedAtom) {
embedAtom = (ExEmbedAtom)_children[0];
} else {
- logger.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
+ logger.error("First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
}
// Second child should be the ExOleObjAtom
if (_children[1] instanceof ExOleObjAtom) {
oleObjAtom = (ExOleObjAtom)_children[1];
} else {
- logger.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
+ logger.error("Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
}
for (int i = 2; i < _children.length; i++) {
else if (progId == null) progId = (CString)_children[i];
else if (clipboardName == null) clipboardName = (CString)_children[i];
} else {
- logger.log(POILogger.ERROR, "Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
+ logger.error("Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
}
}
}
/**
- * Gets the {@code ExEmbedAtom}.
+ * Gets the {@link ExEmbedAtom}.
*
- * @return the {@code ExEmbedAtom}.
+ * @return the {@link ExEmbedAtom}.
*/
public ExEmbedAtom getExEmbedAtom()
{
}
/**
- * Gets the {@code ExOleObjAtom}.
+ * Gets the {@link ExOleObjAtom}.
*
- * @return the {@code ExOleObjAtom}.
+ * @return the {@link ExOleObjAtom}.
*/
public ExOleObjAtom getExOleObjAtom()
{
import java.io.OutputStream;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
/**
* This class represents the data of a link in the document.
if(_children[0] instanceof ExHyperlinkAtom) {
linkAtom = (ExHyperlinkAtom)_children[0];
} else {
- logger.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
+ logger.error("First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
}
for (int i = 1; i < _children.length; i++) {
if ( linkDetailsA == null) linkDetailsA = (CString)_children[i];
else linkDetailsB = (CString)_children[i];
} else {
- logger.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
+ logger.error("Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
}
}
package org.apache.poi.hslf.record;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
import java.io.*;
import java.util.*;
FontEntityAtom atom = (FontEntityAtom)_children[i];
fonts.add(atom.getFontName());
} else {
- logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
+ logger.warn("Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
}
}
}
package org.apache.poi.hslf.record;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
import org.apache.poi.ddf.*;
import org.apache.poi.hslf.model.ShapeTypes;
// Wind on
int size = r.getRecordSize();
if(size < 8) {
- logger.log(POILogger.WARN, "Hit short DDF record at " + startPos + " - " + size);
+ logger.warn("Hit short DDF record at " + startPos + " - " + size);
}
/**
* Sometimes it is not so, see an example in bug #44770. Most likely reason is that one of ddf records calculates wrong size.
*/
if(size != escherBytes){
- logger.log(POILogger.WARN, "Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
+ logger.warn("Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
size = escherBytes;
}
startPos += size;
package org.apache.poi.hslf.record;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
import java.io.IOException;
import java.io.OutputStream;
Integer newPos = (Integer)oldToNewReferencesLookup.get(oldPos);
if(newPos == null) {
- logger.log(POILogger.WARN, "Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
- logger.log(POILogger.WARN, "Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
+ logger.warn("Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
+ logger.warn("Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
newPos = oldPos;
}
import java.io.OutputStream;
import java.util.Vector;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.util.POILogFactory;
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
public abstract class Record
{
// For logging
- protected POILogger logger = POILogFactory.getLogger(this.getClass());
+ protected Log logger = LogFactory.getLog(this.getClass());
/**
* Is this record type an Atom record (only has data),
import org.apache.poi.hslf.model.textproperties.TextProp;
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
/**
* A StyleTextPropAtom (type 4001). Holds basic character properties
}
if (rawContents.length > 0 && textHandled != (size+1)){
- logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+ logger.warn("Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
}
// Now do the character stylings
}
}
if (rawContents.length > 0 && textHandled != (size+1)){
- logger.log(POILogger.WARN, "Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+ logger.warn("Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
}
// Handle anything left over
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.util.ArrayUtil;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* This class is a friendly wrapper on top of the more scary HSLFSlideShow.
private FontCollection _fonts;
// For logging
- private POILogger logger = POILogFactory.getLogger(this.getClass());
+ private static final Log logger = LogFactory.getLog(SlideShow.class);
/* ===============================================================
Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
return r;
} else {
- logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
+ logger.error("We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
return null;
}
}
Integer slideId = new Integer(spa.getSlideIdentifier());
slideIdToNotes.put(slideId, new Integer(i));
} else {
- logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+ logger.error("A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
}
}
notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
if(r instanceof org.apache.poi.hslf.record.Slide) {
slidesRecords[i] = (org.apache.poi.hslf.record.Slide)r;
} else {
- logger.log(POILogger.ERROR, "A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+ logger.error("A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
}
}
}
if (noteId != 0){
Integer notesPos = (Integer)slideIdToNotes.get(new Integer(noteId));
if (notesPos != null) notes = _notes[notesPos.intValue()];
- else logger.log(POILogger.ERROR, "Notes not found for noteId=" + noteId);
+ else logger.error("Notes not found for noteId=" + noteId);
}
// Now, build our slide
System.arraycopy(_slides, 0, s, 0, _slides.length);
s[_slides.length] = slide;
_slides = s;
- logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
+ logger.info("Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
// Add the core records for this new Slide to the record tree
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
// (Also need to tell it where it is)
slideRecord.setLastOnDiskOffset(slideOffset);
ptr.addSlideLookup(sp.getRefID(), slideOffset);
- logger.log(POILogger.INFO, "New slide ended up at " + slideOffset);
+ logger.info("New slide ended up at " + slideOffset);
// Last view is now of the slide
usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW);