Formatting fixed.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352995 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2003-02-01 13:28:28 +00:00
parent 315c315103
commit 0bb781cabc
13 changed files with 690 additions and 953 deletions

View File

@ -55,54 +55,52 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is the superclass of all other checked exceptions
* thrown in this package. It supports a nested "reason" throwable,
* i.e. an exception that caused this one to be thrown.</p>
* *
* This exception is the superclass of all other checked exceptions thrown in * @author Rainer Klute (klute@rainer-klute.de)
* this package. It supports a nested "reason" throwable, i.e. an exception * @version $Id$
* that caused this one to be thrown.</p> * @since 2002-02-09
*
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class HPSFException extends Exception { public class HPSFException extends Exception
{
private Throwable reason; private Throwable reason;
/** /**
* <p> * <p>Creates a new {@link HPSFException}.</p>
*
* Creates a new {@link HPSFException}.</p>
*/ */
public HPSFException() { public HPSFException()
{
super(); super();
} }
/** /**
* <p> * <p>Creates a new {@link HPSFException} with a message
* string.</p>
* *
* Creates a new {@link HPSFException} with a message string.</p> * @param msg The message string.
*
*@param msg Description of the Parameter
*/ */
public HPSFException(final String msg) { public HPSFException(final String msg)
{
super(msg); super(msg);
} }
/** /**
* <p> * <p>Creates a new {@link HPSFException} with a reason.</p>
* *
* Creates a new {@link HPSFException} with a reason.</p> * @param reason The reason, i.e. a throwable that indirectly
* * caused this exception.
*@param reason Description of the Parameter
*/ */
public HPSFException(final Throwable reason) { public HPSFException(final Throwable reason)
{
super(); super();
this.reason = reason; this.reason = reason;
} }
@ -110,15 +108,15 @@ public class HPSFException extends Exception {
/** /**
* <p> * <p>Creates a new {@link HPSFException} with a message string
* and a reason.</p>
* *
* Creates a new {@link HPSFException} with a message string and a reason. * @param msg The message string.
* </p> * @param reason The reason, i.e. a throwable that indirectly
* * caused this exception.
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/ */
public HPSFException(final String msg, final Throwable reason) { public HPSFException(final String msg, final Throwable reason)
{
super(msg); super(msg);
this.reason = reason; this.reason = reason;
} }
@ -126,14 +124,14 @@ public class HPSFException extends Exception {
/** /**
* <p> * <p>Returns the {@link Throwable} that caused this exception to
* be thrown or <code>null</code> if there was no such {@link
* Throwable}.</p>
* *
* Returns the {@link Throwable} that caused this exception to be thrown or * @return The reason
* <code>null</code> if there was no such {@link Throwable}.</p>
*
*@return The reason value
*/ */
public Throwable getReason() { public Throwable getReason()
{
return reason; return reason;
} }

View File

@ -55,55 +55,53 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is the superclass of all other unchecked
* exceptions thrown in this package. It supports a nested "reason"
* throwable, i.e. an exception that caused this one to be thrown.</p>
* *
* This exception is the superclass of all other unchecked exceptions thrown in * @author Rainer Klute (klute@rainer-klute.de)
* this package. It supports a nested "reason" throwable, i.e. an exception * @version $Id$
* that caused this one to be thrown.</p> * @since 2002-02-09
*
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id: HPSFRuntimeException.java,v 1.3 2002/05/01 09:31:52 klute Exp
* $
*@since 2002-02-09
*/ */
public class HPSFRuntimeException extends RuntimeException { public class HPSFRuntimeException extends RuntimeException
{
private Throwable reason; private Throwable reason;
/** /**
* <p> * <p>Creates a new {@link HPSFRuntimeException}.</p>
*
* Creates a new {@link HPSFRuntimeException}.</p>
*/ */
public HPSFRuntimeException() { public HPSFRuntimeException()
{
super(); super();
} }
/** /**
* <p> * <p>Creates a new {@link HPSFRuntimeException} with a message
* string.</p>
* *
* Creates a new {@link HPSFRuntimeException} with a message string.</p> * @param msg The message string.
*
*@param msg Description of the Parameter
*/ */
public HPSFRuntimeException(final String msg) { public HPSFRuntimeException(final String msg)
{
super(msg); super(msg);
} }
/** /**
* <p> * <p>Creates a new {@link HPSFRuntimeException} with a
* reason.</p>
* *
* Creates a new {@link HPSFRuntimeException} with a reason.</p> * @param reason The reason, i.e. a throwable that indirectly
* * caused this exception.
*@param reason Description of the Parameter
*/ */
public HPSFRuntimeException(final Throwable reason) { public HPSFRuntimeException(final Throwable reason)
{
super(); super();
this.reason = reason; this.reason = reason;
} }
@ -111,15 +109,15 @@ public class HPSFRuntimeException extends RuntimeException {
/** /**
* <p> * <p>Creates a new {@link HPSFRuntimeException} with a message
* string and a reason.</p>
* *
* Creates a new {@link HPSFRuntimeException} with a message string and a * @param msg The message string.
* reason.</p> * @param reason The reason, i.e. a throwable that indirectly
* * caused this exception.
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/ */
public HPSFRuntimeException(final String msg, final Throwable reason) { public HPSFRuntimeException(final String msg, final Throwable reason)
{
super(msg); super(msg);
this.reason = reason; this.reason = reason;
} }
@ -127,14 +125,14 @@ public class HPSFRuntimeException extends RuntimeException {
/** /**
* <p> * <p>Returns the {@link Throwable} that caused this exception to
* be thrown or <code>null</code> if there was no such {@link
* Throwable}.</p>
* *
* Returns the {@link Throwable} that caused this exception to be thrown or * @return The reason
* <code>null</code> if there was no such {@link Throwable}.</p>
*
*@return The reason value
*/ */
public Throwable getReason() { public Throwable getReason()
{
return reason; return reason;
} }

View File

@ -55,73 +55,45 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is thrown when there is an illegal value set in a
* {@link PropertySet}. For example, a {@link Variant#VT_BOOL} must
* have a value of <code>-1 (true)</code> or <code>0 (false)</code>.
* Any other value would trigger this exception. It supports a nested
* "reason" throwable, i.e. an exception that caused this one to be
* thrown.</p>
* *
* This exception is thrown when there is an illegal value set in a * @author Drew Varner(Drew.Varner atDomain sc.edu)
* {@link PropertySet}. For example, a {@link Variant#VT_BOOL} must have * @version $Id$
* a value of <code>-1 (true)</code> or <code>0 (false)</code>. * @since 2002-05-26
* Any other value would trigger this exception. It supports a nested
* "reason" throwable, i.e. an exception that caused this one to be thrown.
* </p>
*
*@author Drew Varner(Drew.Varner atDomain sc.edu)
*@version $Id$
*@since 2002-05-26
*/ */
public class IllegalPropertySetDataException extends HPSFRuntimeException { public class IllegalPropertySetDataException extends HPSFRuntimeException
{
public IllegalPropertySetDataException()
{
/**
* <p>
*
* Creates a new {@link IllegalPropertySetDataException}.</p>
*/
public IllegalPropertySetDataException() {
super(); super();
} }
/** public IllegalPropertySetDataException(final String msg)
* <p> {
*
* Creates a new {@link IllegalPropertySetDataException} with a message string.</p>
*
*@param msg Description of the Parameter
*/
public IllegalPropertySetDataException(final String msg) {
super(msg); super(msg);
} }
/** public IllegalPropertySetDataException(final Throwable reason)
* <p> {
*
* Creates a new {@link IllegalPropertySetDataException} with a reason.</p>
*
*@param reason Description of the Parameter
*/
public IllegalPropertySetDataException(final Throwable reason) {
super(reason); super(reason);
} }
/**
* <p>
*
* Creates a new {@link IllegalPropertySetDataException} with a message
* string and a reason.</p>
*
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/
public IllegalPropertySetDataException(final String msg, public IllegalPropertySetDataException(final String msg,
final Throwable reason) { final Throwable reason)
{
super(msg,reason); super(msg,reason);
} }
} }

View File

@ -55,52 +55,36 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is thrown if an {@link java.io.InputStream} does
* not support the {@link java.io.InputStream#mark} operation.</p>
* *
* This exception is thrown if an {@link java.io.InputStream} does not support * @author Rainer Klute (klute@rainer-klute.de)
* the {@link java.io.InputStream#mark} operation.</p> * @version $Id$
* * @since 2002-02-09
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class MarkUnsupportedException extends HPSFException { public class MarkUnsupportedException extends HPSFException
{
/** public MarkUnsupportedException()
* Constructor for the MarkUnsupportedException object {
*/
public MarkUnsupportedException() {
super(); super();
} }
/** public MarkUnsupportedException(final String msg)
* Constructor for the MarkUnsupportedException object {
*
*@param msg Description of the Parameter
*/
public MarkUnsupportedException(final String msg) {
super(msg); super(msg);
} }
/** public MarkUnsupportedException(final Throwable reason)
* Constructor for the MarkUnsupportedException object {
*
*@param reason Description of the Parameter
*/
public MarkUnsupportedException(final Throwable reason) {
super(reason); super(reason);
} }
/** public MarkUnsupportedException(final String msg, final Throwable reason)
* Constructor for the MarkUnsupportedException object {
*
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/
public MarkUnsupportedException(final String msg, final Throwable reason) {
super(msg, reason); super(msg, reason);
} }

View File

@ -68,44 +68,30 @@ package org.apache.poi.hpsf;
*@version $Id$ *@version $Id$
*@since 2002-02-09 *@since 2002-02-09
*/ */
public class NoPropertySetStreamException extends HPSFException { public class NoPropertySetStreamException extends HPSFException
{
/** public NoPropertySetStreamException()
* Constructor for the NoPropertySetStreamException object {
*/
public NoPropertySetStreamException() {
super(); super();
} }
/** public NoPropertySetStreamException(final String msg)
* Constructor for the NoPropertySetStreamException object {
*
*@param msg Description of the Parameter
*/
public NoPropertySetStreamException(final String msg) {
super(msg); super(msg);
} }
/** public NoPropertySetStreamException(final Throwable reason)
* Constructor for the NoPropertySetStreamException object {
*
*@param reason Description of the Parameter
*/
public NoPropertySetStreamException(final Throwable reason) {
super(reason); super(reason);
} }
/**
* Constructor for the NoPropertySetStreamException object
*
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/
public NoPropertySetStreamException(final String msg, public NoPropertySetStreamException(final String msg,
final Throwable reason) { final Throwable reason)
{
super(msg, reason); super(msg, reason);
} }

View File

@ -55,56 +55,41 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is thrown if one of the {@link PropertySet}'s
* convenience methods that require a single {@link Section} is called
* and the {@link PropertySet} does not contain exactly one {@link
* Section}.</p>
* *
* This exception is thrown if one of the {@link PropertySet}'s convenience * <p>The constructors of this class are analogous to those of its
* methods that require a single {@link Section} is called and the {@link * superclass and documented there.</p>
* PropertySet} does not contain exactly one {@link Section}.</p> <p>
* *
* The constructors of this class are analogous to those of its superclass and * @author Rainer Klute (klute@rainer-klute.de)
* documented there.</p> * @version $Id$
* * @since 2002-02-09
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class NoSingleSectionException extends HPSFRuntimeException { public class NoSingleSectionException extends HPSFRuntimeException
{
/** public NoSingleSectionException()
* Constructor for the NoSingleSectionException object {
*/
public NoSingleSectionException() {
super(); super();
} }
/** public NoSingleSectionException(final String msg)
* Constructor for the NoSingleSectionException object {
*
*@param msg Description of the Parameter
*/
public NoSingleSectionException(final String msg) {
super(msg); super(msg);
} }
/** public NoSingleSectionException(final Throwable reason)
* Constructor for the NoSingleSectionException object {
*
*@param reason Description of the Parameter
*/
public NoSingleSectionException(final Throwable reason) {
super(reason); super(reason);
} }
/** public NoSingleSectionException(final String msg, final Throwable reason)
* Constructor for the NoSingleSectionException object {
*
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/
public NoSingleSectionException(final String msg, final Throwable reason) {
super(msg, reason); super(msg, reason);
} }

View File

@ -57,50 +57,45 @@ package org.apache.poi.hpsf;
import java.io.*; import java.io.*;
/** /**
* <p> * <p>Factory class to create instances of {@link SummaryInformation},
* {@link DocumentSummaryInformation} and {@link PropertySet}.</p>
* *
* Factory class to create instances of {@link SummaryInformation}, {@link * @author Rainer Klute (klute@rainer-klute.de)
* DocumentSummaryInformation} and {@link PropertySet}.</p> * @version $Id$
* * @since 2002-02-09
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class PropertySetFactory { public class PropertySetFactory
{
/** /**
* <p> * <p>Creates the most specific {@link PropertySet} from an {@link
* InputStream}. This is preferrably a {@link
* DocumentSummaryInformation} or a {@link SummaryInformation}. If
* the specified {@link InputStream} does not contain a property
* set stream, an exception is thrown and the {@link InputStream}
* is repositioned at its beginning.</p>
* *
* Creates the most specific {@link PropertySet} from an {@link * @param stream Contains the property set stream's data.
* InputStream}. This is preferrably a {@link DocumentSummaryInformation} * @return The created {@link PropertySet}.
* or a {@link SummaryInformation}. If the specified {@link InputStream} * @throws NoPropertySetStreamException if the stream does not
* does not contain a property set stream, an exception is thrown and the * contain a property set.
* {@link InputStream} is repositioned at its beginning.</p> * @throws MarkUnsupportedException if the stream does not support
* * the <code>mark</code> operation.
*@param stream Contains the property set * @throws UnexpectedPropertySetTypeException if the property
* stream's data. * set's type is unexpected.
*@return Description of the Return * @throws IOException if some I/O problem occurs.
* Value
*@exception NoPropertySetStreamException Description of the
* Exception
*@exception MarkUnsupportedException Description of the
* Exception
*@exception UnexpectedPropertySetTypeException Description of the
* Exception
*@exception IOException Description of the
* Exception
*/ */
public static PropertySet create(final InputStream stream) public static PropertySet create(final InputStream stream)
throws NoPropertySetStreamException, MarkUnsupportedException, throws NoPropertySetStreamException, MarkUnsupportedException,
UnexpectedPropertySetTypeException, IOException { UnexpectedPropertySetTypeException, IOException
{
final PropertySet ps = new PropertySet(stream); final PropertySet ps = new PropertySet(stream);
if (ps.isSummaryInformation()) { if (ps.isSummaryInformation())
return new SummaryInformation(ps); return new SummaryInformation(ps);
} else if (ps.isDocumentSummaryInformation()) { else if (ps.isDocumentSummaryInformation())
return new DocumentSummaryInformation(ps); return new DocumentSummaryInformation(ps);
} else { else
return ps; return ps;
}
} }
} }

View File

@ -58,147 +58,107 @@ import java.util.*;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
/** /**
* <p> * <p>Abstract superclass for the convenience classes {@link
* SummaryInformation} and {@link DocumentSummaryInformation}.</p>
* *
* Abstract superclass for the convenience classes {@link SummaryInformation} * <p>The motivation behind this class is quite nasty if you look
* and {@link DocumentSummaryInformation}.</p> <p> * behind the scenes, but it serves the application programmer well by
* providing him with the easy-to-use {@link SummaryInformation} and
* {@link DocumentSummaryInformation} classes. When parsing the data a
* property set stream consists of (possibly coming from an {@link
* java.io.InputStream}) we want to read and process each byte only
* once. Since we don't know in advance which kind of property set we
* have, we can expect only the most general {@link
* PropertySet}. Creating a special subclass should be as easy as
* calling the special subclass' constructor and pass the general
* {@link PropertySet} in. To make things easy internally, the special
* class just holds a reference to the general {@link PropertySet} and
* delegates all method calls to it.</p>
* *
* The motivation behind this class is quite nasty if you look behind the * <p>A cleaner implementation would have been like this: The {@link
* scenes, but it serves the application programmer well by providing him with * PropertySetFactory} parses the stream data into some internal
* the easy-to-use {@link SummaryInformation} and {@link * object first. Then it finds out whether the stream is a {@link
* DocumentSummaryInformation} classes. When parsing the data a property set * SummaryInformation}, a {@link DocumentSummaryInformation} or a
* stream consists of (possibly coming from an {@link java.io.InputStream}) we * general {@link PropertySet}. However, the current implementation
* want to read and process each byte only once. Since we don't know in advance * went the other way round historically: the convenience classes came
* which kind of property set we have, we can expect only the most general * only late to my mind.</p>
* {@link PropertySet}. Creating a special subclass should be as easy as
* calling the special subclass' constructor and pass the general {@link
* PropertySet} in. To make things easy internally, the special class just
* holds a reference to the general {@link PropertySet} and delegates all
* method calls to it.</p> <p>
* *
* A cleaner implementation would have been like this: The {@link * @author Rainer Klute (klute@rainer-klute.de)
* PropertySetFactory} parses the stream data into some internal object first. * @version $Id$
* Then it finds out whether the stream is a {@link SummaryInformation}, a * @since 2002-02-09
* {@link DocumentSummaryInformation} or a general {@link PropertySet}.
* However, the current implementation went the other way round historically:
* the convenience classes came only late to my mind.</p>
*
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public abstract class SpecialPropertySet extends PropertySet { public abstract class SpecialPropertySet extends PropertySet
{
private PropertySet delegate; private PropertySet delegate;
/** public SpecialPropertySet(PropertySet ps)
* Constructor for the SpecialPropertySet object {
*
*@param ps Description of the Parameter
*/
public SpecialPropertySet(PropertySet ps) {
delegate = ps; delegate = ps;
} }
/** public int getByteOrder()
* Gets the byteOrder attribute of the SpecialPropertySet object {
*
*@return The byteOrder value
*/
public int getByteOrder() {
return delegate.getByteOrder(); return delegate.getByteOrder();
} }
/** public int getFormat()
* Gets the format attribute of the SpecialPropertySet object {
*
*@return The format value
*/
public int getFormat() {
return delegate.getFormat(); return delegate.getFormat();
} }
/** public long getOSVersion()
* Gets the oSVersion attribute of the SpecialPropertySet object {
*
*@return The oSVersion value
*/
public long getOSVersion() {
return delegate.getOSVersion(); return delegate.getOSVersion();
} }
/** public ClassID getClassID()
* Gets the classID attribute of the SpecialPropertySet object {
*
*@return The classID value
*/
public ClassID getClassID() {
return delegate.getClassID(); return delegate.getClassID();
} }
/** public long getSectionCount()
* Gets the sectionCount attribute of the SpecialPropertySet object {
*
*@return The sectionCount value
*/
public long getSectionCount() {
return delegate.getSectionCount(); return delegate.getSectionCount();
} }
/** public List getSections()
* Gets the sections attribute of the SpecialPropertySet object {
*
*@return The sections value
*/
public List getSections() {
return delegate.getSections(); return delegate.getSections();
} }
/** public boolean isSummaryInformation()
* Gets the summaryInformation attribute of the SpecialPropertySet object {
*
*@return The summaryInformation value
*/
public boolean isSummaryInformation() {
return delegate.isSummaryInformation(); return delegate.isSummaryInformation();
} }
/** public boolean isDocumentSummaryInformation()
* Gets the documentSummaryInformation attribute of the SpecialPropertySet {
* object
*
*@return The documentSummaryInformation value
*/
public boolean isDocumentSummaryInformation() {
return delegate.isDocumentSummaryInformation(); return delegate.isDocumentSummaryInformation();
} }
/** public Section getSingleSection()
* Gets the singleSection attribute of the SpecialPropertySet object {
*
*@return The singleSection value
*/
public Section getSingleSection() {
return delegate.getSingleSection(); return delegate.getSingleSection();
} }

View File

@ -63,310 +63,301 @@ import java.util.*;
import org.apache.poi.hpsf.wellknown.*; import org.apache.poi.hpsf.wellknown.*;
/** /**
* <p> * <p>Convenience class representing a Summary Information stream in a
* Microsoft Office document.</p>
* *
* Convenience class representing a Summary Information stream in a Microsoft * <p>See <a
* Office document.</p> <p> * href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgu_8910.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgu_8910.asp</a>
* for documentation from That Redmond Company.</p>
* *
* See <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgu_8910.asp"> * @author Rainer Klute (klute@rainer-klute.de)
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgu_8910.asp * @see DocumentSummaryInformation
* </a> for documentation from That Redmond Company. * @version $Id$
* * @since 2002-02-09
*@author Rainer Klute (klute@rainer-klute.de)
*@see DocumentSummaryInformation
*@version $Id$
*@since 2002-02-09
*/ */
public class SummaryInformation extends SpecialPropertySet { public class SummaryInformation extends SpecialPropertySet
{
/** /**
* <p> * <p>Creates a {@link SummaryInformation} from a given {@link
* PropertySet}.</p>
* *
* Creates a {@link SummaryInformation} from a given {@link PropertySet}. * @param ps A property set which should be created from a summary
* </p> * information stream.
* * @throws UnexpectedPropertySetTypeException if <var>ps</var>
*@param ps A property set which * does not contain a summary information stream.
* should be created from a summary information stream.
*@exception UnexpectedPropertySetTypeException Description of the
* Exception
*@throws UnexpectedPropertySetTypeException if <var>ps</var> does not
* contain a summary information stream.
*/ */
public SummaryInformation(final PropertySet ps) public SummaryInformation(final PropertySet ps)
throws UnexpectedPropertySetTypeException { throws UnexpectedPropertySetTypeException
{
super(ps); super(ps);
if (!isSummaryInformation()) { if (!isSummaryInformation())
throw new UnexpectedPropertySetTypeException throw new UnexpectedPropertySetTypeException
("Not a " + getClass().getName()); ("Not a " + getClass().getName());
}
} }
/** /**
* <p> * <p>Returns the stream's title (or <code>null</code>).</p>
* *
* Returns the stream's title (or <code>null</code>).</p> * @return The title or <code>null</code>
*
*@return The title value
*/ */
public String getTitle() { public String getTitle()
{
return (String) getProperty(PropertyIDMap.PID_TITLE); return (String) getProperty(PropertyIDMap.PID_TITLE);
} }
/** /**
* <p> * <p>Returns the stream's subject (or <code>null</code>).</p>
* *
* Returns the stream's subject (or <code>null</code>).</p> * @return The subject or <code>null</code>
*
*@return The subject value
*/ */
public String getSubject() { public String getSubject()
{
return (String) getProperty(PropertyIDMap.PID_SUBJECT); return (String) getProperty(PropertyIDMap.PID_SUBJECT);
} }
/** /**
* <p> * <p>Returns the stream's author (or <code>null</code>).</p>
* *
* Returns the stream's author (or <code>null</code>).</p> * @return The author or <code>null</code>
*
*@return The author value
*/ */
public String getAuthor() { public String getAuthor()
{
return (String) getProperty(PropertyIDMap.PID_AUTHOR); return (String) getProperty(PropertyIDMap.PID_AUTHOR);
} }
/** /**
* <p> * <p>Returns the stream's keywords (or <code>null</code>).</p>
* *
* Returns the stream's keywords (or <code>null</code>).</p> * @return The keywords or <code>null</code>
*
*@return The keywords value
*/ */
public String getKeywords() { public String getKeywords()
{
return (String) getProperty(PropertyIDMap.PID_KEYWORDS); return (String) getProperty(PropertyIDMap.PID_KEYWORDS);
} }
/** /**
* <p> * <p>Returns the stream's comments (or <code>null</code>).</p>
* *
* Returns the stream's comments (or <code>null</code>).</p> * @return The comments or <code>null</code>
*
*@return The comments value
*/ */
public String getComments() { public String getComments()
{
return (String) getProperty(PropertyIDMap.PID_COMMENTS); return (String) getProperty(PropertyIDMap.PID_COMMENTS);
} }
/** /**
* <p> * <p>Returns the stream's template (or <code>null</code>).</p>
* *
* Returns the stream's template (or <code>null</code>).</p> * @return The template or <code>null</code>
*
*@return The template value
*/ */
public String getTemplate() { public String getTemplate()
{
return (String) getProperty(PropertyIDMap.PID_TEMPLATE); return (String) getProperty(PropertyIDMap.PID_TEMPLATE);
} }
/** /**
* <p> * <p>Returns the stream's last author (or <code>null</code>).</p>
* *
* Returns the stream's last author (or <code>null</code>).</p> * @return The last author or <code>null</code>
*
*@return The lastAuthor value
*/ */
public String getLastAuthor() { public String getLastAuthor()
{
return (String) getProperty(PropertyIDMap.PID_LASTAUTHOR); return (String) getProperty(PropertyIDMap.PID_LASTAUTHOR);
} }
/** /**
* <p> * <p>Returns the stream's revision number (or
* <code>null</code>). </p>
* *
* Returns the stream's revision number (or <code>null</code>). </p> * @return The revision number or <code>null</code>
*
*@return The revNumber value
*/ */
public String getRevNumber() { public String getRevNumber()
{
return (String) getProperty(PropertyIDMap.PID_REVNUMBER); return (String) getProperty(PropertyIDMap.PID_REVNUMBER);
} }
/** /**
* <p> * <p>Returns the stream's edit time (or <code>null</code>).</p>
* *
* Returns the stream's edit time (or <code>null</code>).</p> * @return The edit time or <code>null</code>
*
*@return The editTime value
*/ */
public Date getEditTime() { public Date getEditTime()
{
return (Date) getProperty(PropertyIDMap.PID_EDITTIME); return (Date) getProperty(PropertyIDMap.PID_EDITTIME);
} }
/** /**
* <p> * <p>Returns the stream's last printed time (or
* <code>null</code>).</p>
* *
* Returns the stream's last printed time (or <code>null</code>).</p> * @return The last printed time or <code>null</code>
*
*@return The lastPrinted value
*/ */
public Date getLastPrinted() { public Date getLastPrinted()
{
return (Date) getProperty(PropertyIDMap.PID_LASTPRINTED); return (Date) getProperty(PropertyIDMap.PID_LASTPRINTED);
} }
/** /**
* <p> * <p>Returns the stream's creation time (or
* <code>null</code>).</p>
* *
* Returns the stream's creation time (or <code>null</code>).</p> * @return The creation time or <code>null</code>
*
*@return The createDateTime value
*/ */
public Date getCreateDateTime() { public Date getCreateDateTime()
{
return (Date) getProperty(PropertyIDMap.PID_CREATE_DTM); return (Date) getProperty(PropertyIDMap.PID_CREATE_DTM);
} }
/** /**
* <p> * <p>Returns the stream's last save time (or
* <code>null</code>).</p>
* *
* Returns the stream's last save time (or <code>null</code>).</p> * @return The last save time or <code>null</code>
*
*@return The lastSaveDateTime value
*/ */
public Date getLastSaveDateTime() { public Date getLastSaveDateTime()
{
return (Date) getProperty(PropertyIDMap.PID_LASTSAVE_DTM); return (Date) getProperty(PropertyIDMap.PID_LASTSAVE_DTM);
} }
/** /**
* <p> * <p>Returns the stream's page count or 0 if the {@link
* SummaryInformation} does not contain a page count.</p>
* *
* Returns the stream's page count or 0 if the {@link SummaryInformation} * @return The page count or <code>null</code>
* does not contain a page count.</p>
*
*@return The pageCount value
*/ */
public int getPageCount() { public int getPageCount()
{
return getPropertyIntValue(PropertyIDMap.PID_PAGECOUNT); return getPropertyIntValue(PropertyIDMap.PID_PAGECOUNT);
} }
/** /**
* <p> * <p>Returns the stream's word count or 0 if the {@link
* SummaryInformation} does not contain a word count.</p>
* *
* Returns the stream's word count or 0 if the {@link SummaryInformation} * @return The word count or <code>null</code>
* does not contain a word count.</p>
*
*@return The wordCount value
*/ */
public int getWordCount() { public int getWordCount()
{
return getPropertyIntValue(PropertyIDMap.PID_WORDCOUNT); return getPropertyIntValue(PropertyIDMap.PID_WORDCOUNT);
} }
/** /**
* <p> * <p>Returns the stream's character count or 0 if the {@link
* SummaryInformation} does not contain a char count.</p>
* *
* Returns the stream's char count or 0 if the {@link SummaryInformation} * @return The character count or <code>null</code>
* does not contain a char count.</p>
*
*@return The charCount value
*/ */
public int getCharCount() { public int getCharCount()
{
return getPropertyIntValue(PropertyIDMap.PID_CHARCOUNT); return getPropertyIntValue(PropertyIDMap.PID_CHARCOUNT);
} }
/** /**
* <p> * <p>Returns the stream's thumbnail (or <code>null</code>)
* <strong>when this method is implemented. Please note that the
* return type is likely to change!</strong></p>
* *
* Returns the stream's thumbnail (or <code>null</code>) <strong>when this * <p><strong>FIXME / Hint to developers:</strong> Drew Varner
* method is implemented. Please note that the return type is likely to * &lt;Drew.Varner -at- sc.edu&gt; said that this is an image in
* change!</strong> <p> * WMF or Clipboard (BMP?) format. He also provided two links that
* might be helpful: <a
* href="http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch"
* target="_blank">http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch
* </a> and <a
* href="http://msdn.microsoft.com/library/en-us/dno97ta/html/msdn_docprop.asp"
* target="_blank">http://msdn.microsoft.com/library/en-us/dno97ta/html/msdn_docprop.asp
* </a>. However, we won't do any conversion into any image type
* but instead just return a byte array.</p>
* *
* <strong>FIXME / Hint to developers:</strong> Drew Varner &lt;Drew.Varner * @return The thumbnail or <code>null</code>
* -at- sc.edu&gt; said that this is an image in WMF or Clipboard (BMP?)
* format. He also provided two links that might be helpful: <a
* href="http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch"
* target="_blank">http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch
* </a> and <a href="http://msdn.microsoft.com/library/en-us/dno97ta/html/msdn_docprop.asp"
* target="_blank">http://msdn.microsoft.com/library/en-us/dno97ta/html/msdn_docprop.asp
* </a>. However, we won't do any conversion into any image type but
* instead just return a byte array.</p>
*
*@return The thumbnail value
*/ */
public byte[] getThumbnail() { public byte[] getThumbnail()
{
return (byte[]) getProperty(PropertyIDMap.PID_THUMBNAIL); return (byte[]) getProperty(PropertyIDMap.PID_THUMBNAIL);
} }
/** /**
* <p> * <p>Returns the stream's application name (or
* <code>null</code>).</p>
* *
* Returns the stream's application name (or <code>null</code>).</p> * @return The application name or <code>null</code>
*
*@return The applicationName value
*/ */
public String getApplicationName() { public String getApplicationName()
{
return (String) getProperty(PropertyIDMap.PID_APPNAME); return (String) getProperty(PropertyIDMap.PID_APPNAME);
} }
/** /**
* <p> * <p>Returns a security code which is one of the following
* values:</p>
* *
* Returns one of the following values:</p> * <ul>
* <ul> * <li>
* <li> <p> * <p>0 if the {@link SummaryInformation} does not contain a
* security field or if there is no security on the
* document. Use {@link #wasNull} to distinguish between the
* two cases!</p>
* </li>
* *
* 0 if the {@link SummaryInformation} does not contain a security field * <li>
* or if there is no security on the document. Use {@link #wasNull} to * <p>1 if the document is password protected</p>
* distinguish between the two cases!</p> </li> * </li>
* <li> <p>
* *
* 1 if the document is password protected</p> </li> * <li>
* <li> <p> * <p>2 if the document is read-only recommended</p>
* </li>
* *
* 2 if the document is read-only recommended</p> </li> * <li>
* <li> <p> * <p>4 if the document is read-only enforced</p>
* </li>
* *
* 4 if the document is read-only enforced</p> </li> * <li>
* <li> <p> * <p>8 if the document is locked for annotations</p>
* </li>
* *
* 8 if the document is locked for annotations</p> </li> * </ul>
* </ul>
* *
* * @return The security code or <code>null</code>
*@return The security value
*/ */
public int getSecurity() { public int getSecurity()
{
return getPropertyIntValue(PropertyIDMap.PID_SECURITY); return getPropertyIntValue(PropertyIDMap.PID_SECURITY);
} }

View File

@ -56,306 +56,280 @@ package org.apache.poi.hpsf;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
/** /**
* <p> * <p>Class to manipulate data in the Clipboard Variant ({@link
* Variant#VT_CF VT_CF}) format.</p>
* *
* Class to manipulate data in the Clipboard Variant ({@link Variant#VT_CF * @author Drew Varner (Drew.Varner inOrAround sc.edu)
* VT_CF}) format.</p> * @see SummaryInformation#getThumbnail()
* * @version $Id$
*@author Drew Varner (Drew.Varner inOrAround sc.edu) * @since 2002-04-29
*@see SummaryInformation#getThumbnail()
*@version $Id$
*@since 2002-04-29
*/ */
public class Thumbnail { public class Thumbnail
{
/** /**
* <p> * <p>Offset in bytes where the Clipboard Format Tag starts in the
* * <code>byte[]</code> returned by {@link
* Offset in bytes where the Clipboard Format Tag starts in the <code>byte[]</code> * SummaryInformation#getThumbnail()}</p>
* returned by {@link SummaryInformation#getThumbnail()}</p>
*/ */
public static int OFFSET_CFTAG = 4; public static int OFFSET_CFTAG = 4;
/** /**
* <p> * <p>Offset in bytes where the Clipboard Format starts in the
* <code>byte[]</code> returned by {@link
* SummaryInformation#getThumbnail()}</p>
* *
* Offset in bytes where the Clipboard Format starts in the <code>byte[]</code> * <p>This is only valid if the Clipboard Format Tag is {@link
* returned by {@link SummaryInformation#getThumbnail()}</p> <p> * #CFTAG_WINDOWS}</p>
*
* This is only valid if the Clipboard Format Tag is {@link #CFTAG_WINDOWS}
* </p>
*/ */
public static int OFFSET_CF = 8; public static int OFFSET_CF = 8;
/** /**
* <p> * <p>Offset in bytes where the Windows Metafile (WMF) image data
* starts in the <code>byte[]</code> returned by {@link
* SummaryInformation#getThumbnail()}</p>
* *
* Offset in bytes where the Windows Metafile (WMF) image data starts in * <p>There is only WMF data at this point in the
* the <code>byte[]</code> returned by {@link * <code>byte[]</code> if the Clipboard Format Tag is {@link
* SummaryInformation#getThumbnail()}</p> <p> * #CFTAG_WINDOWS} and the Clipboard Format is {@link
* #CF_METAFILEPICT}.</p>
* *
* There is only WMF data at this point in the <code>byte[]</code> if the * <p>Note: The <code>byte[]</code> that starts at
* Clipboard Format Tag is {@link #CFTAG_WINDOWS} and the Clipboard Format * <code>OFFSET_WMFDATA</code> and ends at
* is {@link #CF_METAFILEPICT}.</p> <p> * <code>getThumbnail().length - 1</code> forms a complete WMF
* * image. It can be saved to disk with a <code>.wmf</code> file
* Note: The <code>byte[]</code> that starts at <code>OFFSET_WMFDATA</code> * type and read using a WMF-capable image viewer.</p>
* and ends at <code>getThumbnail().length - 1</code> forms a complete WMF
* image. It can be saved to disk with a <code>.wmf</code> file type and
* read using a WMF-capable image viewer.</p>
*/ */
public static int OFFSET_WMFDATA = 20; public static int OFFSET_WMFDATA = 20;
/** /**
* <p> * <p>Clipboard Format Tag - Windows clipboard format</p>
* *
* Clipboard Format Tag - Windows clipboard format</p> <p> * <p>A <code>DWORD</code> indicating a built-in Windows clipboard
* format value</p>
* *
* A <code>DWORD</code> indicating a built-in Windows clipboard format * <p>See: <a
* value</p> <p> * href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* * target="_blank">http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp</a>.</p>
* See: <a href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* target="_blank"> http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp
* </a>
*/ */
public static int CFTAG_WINDOWS = -1; public static int CFTAG_WINDOWS = -1;
/** /**
* <p> * <p>Clipboard Format Tag - Macintosh clipboard format</p>
* *
* Clipboard Format Tag - Macintosh clipboard format</p> <p> * <p>A <code>DWORD</code> indicating a Macintosh clipboard format
* value</p>
* *
* A <code>DWORD</code> indicating a Macintosh clipboard format value</p> * <p>See: <a
* <p> * href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* * target="_blank">http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp</a>.</p>
* See: <a href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* target="_blank"> http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp
* </a>
*/ */
public static int CFTAG_MACINTOSH = -2; public static int CFTAG_MACINTOSH = -2;
/** /**
* <p> * <p>Clipboard Format Tag - Format ID</p>
* *
* Clipboard Format Tag - Format ID</p> <p> * <p>A GUID containing a format identifier (FMTID). This is
* rarely used.</p>
* *
* A GUID containing a format identifier (FMTID). This is rarely used.</p> * <p>See: <a
* <p> * href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* * target="_blank">http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp</a>.</p>
* See: <a href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* target="_blank"> http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp
* </a>
*/ */
public static int CFTAG_FMTID = -3; public static int CFTAG_FMTID = -3;
/** /**
* <p> * <p>Clipboard Format Tag - No Data</p>
* *
* Clipboard Format Tag - No Data</p> <p> * <p>A <code>DWORD</code> indicating No data. This is rarely
* used.</p>
* *
* a <code>DWORD</code> indicating No data. This is rarely used.</p> <p> * <p>See: <a
* * href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp"
* See: <a href="http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp" * target="_blank">
* target="_blank"> http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp * http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.asp</a>.</p>
* </a>
*/ */
public static int CFTAG_NODATA = 0; public static int CFTAG_NODATA = 0;
/** /**
* <p> * <p>Clipboard Format - Windows metafile format. This is the
* recommended way to store thumbnails in Property Streams.</p>
* *
* Clipboard Format - Windows metafile format. This is the recommended way * <p><strong>Note:</strong> This is not the same format used in
* to store thumbnails in Property Streams.</p> <p> * regular WMF images. The clipboard version of this format has an
* * extra clipboard-specific header.</p>
* <strong>Note:</strong> this is not the same format used in regular WMF
* images. The clipboard version of this format has an extra
* clipboard-specific header</p>
*/ */
public static int CF_METAFILEPICT = 3; public static int CF_METAFILEPICT = 3;
/** /**
* <p> * <p>Clipboard Format - Device Independent Bitmap</p>
*
* Clipboard Format - Device Independent Bitmap</p>
*/ */
public static int CF_DIB = 8; public static int CF_DIB = 8;
/** /**
* <p> * <p>Clipboard Format - Enhanced Windows metafile format</p>
*
* Clipboard Format - Enhanced Windows metafile format</p>
*/ */
public static int CF_ENHMETAFILE = 14; public static int CF_ENHMETAFILE = 14;
/** /**
* <p> * <p>Clipboard Format - Bitmap</p>
* *
* Clipboard Format - Bitmap</p> <p> * <p>Obsolete, see <a
* * href="msdn.microsoft.com/library/en-us/dnw98bk/html/clipboardoperations.asp
* Obsolete, See: <a href="msdn.microsoft.com/library/en-us/dnw98bk/html/clipboardoperations.asp * target="_blank">msdn.microsoft.com/library/en-us/dnw98bk/html/clipboardoperations.asp</a>.</p>
* target="_blank"> msdn.microsoft.com/library/en-us/dnw98bk/html/clipboardoperations.asp
* </a> </p>
*/ */
public static int CF_BITMAP = 2; public static int CF_BITMAP = 2;
/** /**
* <p> * <p>A <code>byte[]</code> to hold a thumbnail image in ({@link
* * Variant#VT_CF VT_CF}) format.</p>
* A <code>byte[]</code> to hold a thumbnail image in ({@link Variant#VT_CF
* VT_CF}) format. </p>
*/ */
private byte[] thumbnailData = null; private byte[] thumbnailData = null;
/** /**
* <p> * <p>Default Constructor. If you use it then one you'll have to add
* * the thumbnail <code>byte[]</code> from {@link
* Default Constructor. If you use then one you'll have to add the * SummaryInformation#getThumbnail()} to do any useful
* thumbnail <code>byte[]</code> from {@link * manipulations, otherwise you'll get a
* SummaryInformation#getThumbnail()} to do any useful manipulations, * <code>NullPointerException</code>.</p>
* otherwise you'll get a <code>NullPointerException</code>.</p>
*/ */
public Thumbnail() { public Thumbnail()
{
super(); super();
} }
/** /**
* <p> * <p>Creates a <code>Thumbnail</code> instance and initializes
* with the specified image bytes.</p>
* *
* </p> * @param thumbnailData The thumbnail data
*
*@param thumbnailData Description of the Parameter
*/ */
public Thumbnail(byte[] thumbnailData) { public Thumbnail(byte[] thumbnailData)
{
this.thumbnailData = thumbnailData; this.thumbnailData = thumbnailData;
} }
/** /**
* <p> * <p>Returns the thumbnail as a <code>byte[]</code> in {@link
* Variant#VT_CF VT_CF} format.</p>
* *
* Returns the thumbnail as a <code>byte[]</code> in {@link Variant#VT_CF * @return The thumbnail value
* VT_CF} format.</p> * @see SummaryInformation#getThumbnail()
*
*@return The thumbnail value
*@see SummaryInformation#getThumbnail()
*/ */
public byte[] getThumbnail() { public byte[] getThumbnail()
{
return thumbnailData; return thumbnailData;
} }
/** /**
* <p> * <p>Sets the Thumbnail's underlying <code>byte[]</code> in
* {@link Variant#VT_CF VT_CF} format.</p>
* *
* Sets the Thumbnail's underlying <code>byte[]</code> in {@link * @param thumbnail The new thumbnail value
* Variant#VT_CF VT_CF} format.</p> * @see SummaryInformation#getThumbnail()
*
*@param thumbnail The new thumbnail value
*@see SummaryInformation#getThumbnail()
*/ */
public void setThumbnail(byte[] thumbnail) { public void setThumbnail(byte[] thumbnail)
{
this.thumbnailData = thumbnail; this.thumbnailData = thumbnail;
} }
/** /**
* <p> * <p>Returns an <code>int</code> representing the Clipboard
* Format Tag</p>
* *
* Returns an <code>int</code> representing the Clipboard Format Tag</p> * <p>Possible return values are:</p>
* <p> * <ul>
* <li>{@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li>
* <li>{@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li>
* <li>{@link #CFTAG_FMTID CFTAG_FMTID}</li>
* <li>{@link #CFTAG_NODATA CFTAG_NODATA}</li>
* </ul>
* *
* Possible return values are: * @return A flag indicating the Clipboard Format Tag
* <ul>
* <li> {@link #CFTAG_WINDOWS CFTAG_WINDOWS}</li>
* <li> {@link #CFTAG_MACINTOSH CFTAG_MACINTOSH}</li>
* <li> {@link #CFTAG_FMTID CFTAG_FMTID}</li>
* <li> {@link #CFTAG_NODATA CFTAG_NODATA}</li>
* </ul>
* </p>
*
*@return a flag indicating the Clipboard Format Tag
*/ */
public long getClipboardFormatTag() { public long getClipboardFormatTag()
long clipboardFormatTag = LittleEndian.getUInt(getThumbnail(), OFFSET_CFTAG); {
long clipboardFormatTag = LittleEndian.getUInt(getThumbnail(),
OFFSET_CFTAG);
return clipboardFormatTag; return clipboardFormatTag;
} }
/** /**
* <p> * <p>Returns an <code>int</code> representing the Clipboard
* Format</p>
* *
* Returns an <code>int</code> representing the Clipboard Format</p> <p> * <p>Will throw an exception if the Thumbnail's Clipboard Format
* Tag is not {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}.</p>
* *
* Will throw an exceptionif the Thumbnail's Clipboard Format Tag is not * <p>Possible return values are:</p>
* {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS} </p> <p>
* *
* Possible return values are: * <ul>
* <ul> * <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li>
* <li> {@link #CF_METAFILEPICT CF_METAFILEPICT}</li> * <li>{@link #CF_DIB CF_DIB}</li>
* <li> {@link #CF_DIB CF_DIB}</li> * <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li>
* <li> {@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li> * <li>{@link #CF_BITMAP CF_BITMAP}</li>
* <li> {@link #CF_BITMAP CF_BITMAP}</li> * </ul>
* </ul>
* </p>
* *
*@return a flag indicating the Clipboard Format * @return a flag indicating the Clipboard Format
*@throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS
*/ */
public long getClipboardFormat() throws HPSFException { public long getClipboardFormat() throws HPSFException
if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) { {
if (!(getClipboardFormatTag() == CFTAG_WINDOWS))
throw new HPSFException("Clipboard Format Tag of Thumbnail must " + throw new HPSFException("Clipboard Format Tag of Thumbnail must " +
"be CFTAG_WINDOWS."); "be CFTAG_WINDOWS.");
}
long clipboardFormat = LittleEndian.getUInt(getThumbnail(), OFFSET_CF); return LittleEndian.getUInt(getThumbnail(), OFFSET_CF);
return clipboardFormat;
} }
/** /**
* <p> * <p>Returns the Thumbnail as a <code>byte[]</code> of WMF data
* if the Thumbnail's Clipboard Format Tag is {@link
* #CFTAG_WINDOWS CFTAG_WINDOWS} and its Clipboard Format is
* {@link #CF_METAFILEPICT CF_METAFILEPICT}</p> <p>This
* <code>byte[]</code> is in the traditional WMF file, not the
* clipboard-specific version with special headers.</p>
* *
* Returns the Thumbnail as a <code>byte[]</code> of WMF data if the * <p>See <a href="http://www.wvware.com/caolan/ora-wmf.html"
* Thumbnail's Clipboard Format Tag is {@link #CFTAG_WINDOWS CFTAG_WINDOWS} * target="_blank">http://www.wvware.com/caolan/ora-wmf.html</a>
* and its Clipboard Format is {@link #CF_METAFILEPICT CF_METAFILEPICT}</p> * for more information on the WMF image format.</p>
* <p>
* *
* This <code>byte[]</code> is in the traditional WMF file, not the * @return A WMF image of the Thumbnail
* clipboard-specific version with special headers.</p> <p> * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS and
* * CF_METAFILEPICT
* See <a href="http://www.wvware.com/caolan/ora-wmf.html" target="_blank">
* http://www.wvware.com/caolan/ora-wmf.html</a> for more information on
* the WMF image format.</p>
*
*@return a WMF image of the Thumbnail
*@throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS and
* CF_METAFILEPICT
*/ */
public byte[] getThumbnailAsWMF() throws HPSFException { public byte[] getThumbnailAsWMF() throws HPSFException
if (!(getClipboardFormatTag() == CFTAG_WINDOWS)) { {
if (!(getClipboardFormatTag() == CFTAG_WINDOWS))
throw new HPSFException("Clipboard Format Tag of Thumbnail must " + throw new HPSFException("Clipboard Format Tag of Thumbnail must " +
"be CFTAG_WINDOWS."); "be CFTAG_WINDOWS.");
} if (!(getClipboardFormat() == CF_METAFILEPICT))
if (!(getClipboardFormat() == CF_METAFILEPICT)) {
throw new HPSFException("Clipboard Format of Thumbnail must " + throw new HPSFException("Clipboard Format of Thumbnail must " +
"be CF_METAFILEPICT."); "be CF_METAFILEPICT.");
} else { else
{
byte[] thumbnail = getThumbnail(); byte[] thumbnail = getThumbnail();
int wmfImageLength = thumbnail.length - OFFSET_WMFDATA; int wmfImageLength = thumbnail.length - OFFSET_WMFDATA;
byte[] wmfImage = new byte[wmfImageLength]; byte[] wmfImage = new byte[wmfImageLength];
System.arraycopy(thumbnail, System.arraycopy(thumbnail,
OFFSET_WMFDATA, OFFSET_WMFDATA,
wmfImage, wmfImage,
0, 0,
wmfImageLength); wmfImageLength);
return wmfImage; return wmfImage;
} }
} }

View File

@ -55,57 +55,41 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>This exception is thrown if a certain type of property set is
* expected (e.g. a Document Summary Information) but the provided
* property set is not of that type.</p>
* *
* This exception is thrown if a certain type of property set is expected (e.g. * <p>The constructors of this class are analogous to those of its
* a Document Summary Information) but the provided property set is not of that * superclass and documented there.</p>
* type.</p> <p>
* *
* The constructors of this class are analogous to those of its superclass and * @author Rainer Klute (klute@rainer-klute.de)
* documented there.</p> * @version $Id$
* * @since 2002-02-09
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class UnexpectedPropertySetTypeException extends HPSFException { public class UnexpectedPropertySetTypeException extends HPSFException
{
/** public UnexpectedPropertySetTypeException()
* Constructor for the UnexpectedPropertySetTypeException object {
*/
public UnexpectedPropertySetTypeException() {
super(); super();
} }
/** public UnexpectedPropertySetTypeException(final String msg)
* Constructor for the UnexpectedPropertySetTypeException object {
*
*@param msg Description of the Parameter
*/
public UnexpectedPropertySetTypeException(final String msg) {
super(msg); super(msg);
} }
/** public UnexpectedPropertySetTypeException(final Throwable reason)
* Constructor for the UnexpectedPropertySetTypeException object {
*
*@param reason Description of the Parameter
*/
public UnexpectedPropertySetTypeException(final Throwable reason) {
super(reason); super(reason);
} }
/**
* Constructor for the UnexpectedPropertySetTypeException object
*
*@param msg Description of the Parameter
*@param reason Description of the Parameter
*/
public UnexpectedPropertySetTypeException(final String msg, public UnexpectedPropertySetTypeException(final String msg,
final Throwable reason) { final Throwable reason)
{
super(msg, reason); super(msg, reason);
} }

View File

@ -57,111 +57,101 @@ package org.apache.poi.hpsf;
import java.util.*; import java.util.*;
/** /**
* <p> * <p>Provides various static utility methods.</p>
* *
* Provides various static utility methods.</p> * @author Rainer Klute (klute@rainer-klute.de)
* * @version $Id$
*@author Rainer Klute (klute@rainer-klute.de) * @since 2002-02-09
*@version $Id$
*@since 2002-02-09
*/ */
public class Util { public class Util
{
/** /**
* <p> * <p>Checks whether two byte arrays <var>a</var> and <var>b</var>
* are equal. They are equal</p>
* *
* Checks whether two byte arrays <var>a</var> and <var>b</var> are equal. * <ul>
* They are equal</p>
* <ul>
* <li> <p>
* *
* if they have the same length and</p> </li> * <li><p>if they have the same length and</p></li>
* <li> <p>
* *
* if for each <var>i</var> with <var>i</var> &nbsp;&gt;=&nbsp;0 and * <li><p>if for each <var>i</var> with
* <var>i</var> &nbsp;&lt;&nbsp;<var>a.length</var> holds <var>a</var> [ * <var>i</var>&nbsp;&gt;=&nbsp;0 and
* <var>i</var> ]&nbsp;==&nbsp;<var>b</var> [<var>i</var> ].</p> </li> * <var>i</var>&nbsp;&lt;&nbsp;<var>a.length</var> holds
* <var>a</var>[<var>i</var>]&nbsp;==&nbsp;<var>b</var>[<var>i</var>].</p></li>
* *
* </ul> * </ul>
* *
* * @param a The first byte array
*@param a Description of the Parameter * @param b The first byte array
*@param b Description of the Parameter * @return <code>true</code> if the byte arrays are equal, else
*@return Description of the Return Value * <code>false</code>
*/ */
public static boolean equal(final byte[] a, final byte[] b) { public static boolean equal(final byte[] a, final byte[] b)
if (a.length != b.length) { {
if (a.length != b.length)
return false; return false;
} for (int i = 0; i < a.length; i++)
for (int i = 0; i < a.length; i++) { if (a[i] != b[i])
if (a[i] != b[i]) {
return false; return false;
} return true;
}
return true;
} }
/** /**
* <p> * <p>Copies a part of a byte array into another byte array.</p>
* *
* Copies a part of a byte array into another byte array.</p> * @param src The source byte array.
* * @param srcOffset Offset in the source byte array.
*@param src Description of the Parameter * @param length The number of bytes to copy.
*@param srcOffset Description of the Parameter * @param dst The destination byte array.
*@param length Description of the Parameter * @param dstOffset Offset in the destination byte array.
*@param dst Description of the Parameter
*@param dstOffset Description of the Parameter
*/ */
public static void copy(final byte[] src, final int srcOffset, public static void copy(final byte[] src, final int srcOffset,
final int length, final int length, final byte[] dst,
final byte[] dst, final int dstOffset) { final int dstOffset)
for (int i = 0; i < length; i++) { {
for (int i = 0; i < length; i++)
dst[dstOffset + i] = src[srcOffset + i]; dst[dstOffset + i] = src[srcOffset + i];
}
} }
/** /**
* <p> * <p>Concatenates the contents of several byte arrays into a
* single one.</p>
* *
* Concatenates the contents of several byte arrays into a single one.</p> * @param byteArrays The byte arrays to be concatened.
* * @return A new byte array containing the concatenated byte
*@param byteArrays The byte arrays to be concatened. * arrays.
*@return A new byte array containing the concatenated byte
* arrays.
*/ */
public static byte[] cat(final byte[][] byteArrays) { public static byte[] cat(final byte[][] byteArrays)
{
int capacity = 0; int capacity = 0;
for (int i = 0; i < byteArrays.length; i++) { for (int i = 0; i < byteArrays.length; i++)
capacity += byteArrays[i].length; capacity += byteArrays[i].length;
} final byte[] result = new byte[capacity];
final byte[] result = new byte[capacity];
int r = 0; int r = 0;
for (int i = 0; i < byteArrays.length; i++) { for (int i = 0; i < byteArrays.length; i++)
for (int j = 0; j < byteArrays[i].length; j++) { for (int j = 0; j < byteArrays[i].length; j++)
result[r++] = byteArrays[i][j]; result[r++] = byteArrays[i][j];
}
}
return result; return result;
} }
/** /**
* <p> * <p>Copies bytes from a source byte array into a new byte
* array.</p>
* *
* Copies bytes from a source byte array into a new byte array.</p> * @param src Copy from this byte array.
* * @param offset Start copying here.
*@param src Copy from this byte array. * @param length Copy this many bytes.
*@param offset Start copying here. * @return The new byte array. Its length is number of copied bytes.
*@param length Copy this many bytes.
*@return The new byte array. Its length is number of copied bytes.
*/ */
public static byte[] copy(final byte[] src, final int offset, public static byte[] copy(final byte[] src, final int offset,
final int length) { final int length)
{
final byte[] result = new byte[length]; final byte[] result = new byte[length];
copy(src, offset, length, result, 0); copy(src, offset, length, result, 0);
return result; return result;
@ -170,31 +160,30 @@ public class Util {
/** /**
* <p> * <p>The difference between the Windows epoch (1601-01-01
* * 00:00:00) and the Unix epoch (1970-01-01 00:00:00) in
* The difference between the Windows epoch (1601-01-01 00:00:00) and the * milliseconds: 11644473600000L. (Use your favorite spreadsheet
* Unix epoch (1970-01-01 00:00:00) in milliseconds: 11644473600000L. (Use * program to verify the correctness of this value. By the way,
* your favorite spreadsheet program to verify the correctness of this * did you notice that you can tell from the epochs which
* value. By the way, did you notice that you can tell from the epochs * operating system is the modern one? :-))</p>
* which operating system is the modern one? :-))</p>
*/ */
public final static long EPOCH_DIFF = 11644473600000L; public final static long EPOCH_DIFF = 11644473600000L;
/** /**
* <p> * <p>Converts a Windows FILETIME into a {@link Date}. The Windows
* FILETIME structure holds a date and time associated with a
* file. The structure identifies a 64-bit integer specifying the
* number of 100-nanosecond intervals which have passed since
* January 1, 1601. This 64-bit value is split into the two double
* word stored in the structure.</p>
* *
* Converts a Windows FILETIME into a {@link Date}. The Windows FILETIME * @param high The higher double word of the FILETIME structure.
* structure holds a date and time associated with a file. The structure * @param low The lower double word of the FILETIME structure.
* identifies a 64-bit integer specifying the number of 100-nanosecond * @return The Windows FILETIME as a {@link Date}.
* intervals which have passed since January 1, 1601. This 64-bit value is
* split into the two double word stored in the structure.</p>
*
*@param high The higher double word of the FILETIME structure.
*@param low The lower double word of the FILETIME structure.
*@return Description of the Return Value
*/ */
public static Date filetimeToDate(final int high, final int low) { public static Date filetimeToDate(final int high, final int low)
{
final long filetime = ((long) high) << 32 | ((long) low); final long filetime = ((long) high) << 32 | ((long) low);
final long ms_since_16010101 = filetime / (1000 * 10); final long ms_since_16010101 = filetime / (1000 * 10);
final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF; final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF;
@ -202,4 +191,3 @@ public class Util {
} }
} }

View File

@ -55,388 +55,310 @@
package org.apache.poi.hpsf; package org.apache.poi.hpsf;
/** /**
* <p> * <p>The <em>Variant</em> types as defined by Microsoft's COM. I
* found this information in <a
* href="http://www.marin.clara.net/COM/variant_type_definitions.htm">
* http://www.marin.clara.net/COM/variant_type_definitions.htm</a>.</p>
* *
* The <em>Variant</em> types as defined by Microsoft's COM. I found this * <p>In the variant types descriptions the following shortcuts are
* information in <a href="http://www.marin.clara.net/COM/variant_type_definitions.htm"> * used: <strong> [V]</strong> - may appear in a VARIANT,
* http://www.marin.clara.net/COM/variant_type_definitions.htm</a> .</p> <p> * <strong>[T]</strong> - may appear in a TYPEDESC,
* <strong>[P]</strong> - may appear in an OLE property set,
* <strong>[S]</strong> - may appear in a Safe Array.</p>
* *
* In the variant types descriptions the following shortcuts are used: <strong> * @author Rainer Klute (klute@rainer-klute.de)
* [V]</strong> - may appear in a VARIANT, <strong>[T]</strong> - may appear in * @version $Id$
* a TYPEDESC, <strong>[P]</strong> - may appear in an OLE property set, * @since 2002-02-09
* <strong>[S]</strong> - may appear in a Safe Array.</p>
*
*@author Rainer Klute (klute@rainer-klute.de)
*@version $Id$
*@since 2002-02-09
*/ */
public class Variant { public class Variant
{
/** /**
* <p> * <p>[V][P] Nothing.</p>
*
* [V][P] Nothing.</p>
*/ */
public final static int VT_EMPTY = 0; public final static int VT_EMPTY = 0;
/** /**
* <p> * <p>[V][P] SQL style Null.</p>
*
* [V][P] SQL style Null.</p>
*/ */
public final static int VT_NULL = 1; public final static int VT_NULL = 1;
/** /**
* <p> * <p>[V][T][P][S] 2 byte signed int.</p>
*
* [V][T][P][S] 2 byte signed int.</p>
*/ */
public final static int VT_I2 = 2; public final static int VT_I2 = 2;
/** /**
* <p> * <p>[V][T][P][S] 4 byte signed int.</p>
*
* [V][T][P][S] 4 byte signed int.</p>
*/ */
public final static int VT_I4 = 3; public final static int VT_I4 = 3;
/** /**
* <p> * <p>[V][T][P][S] 4 byte real.</p>
*
* [V][T][P][S] 4 byte real.</p>
*/ */
public final static int VT_R4 = 4; public final static int VT_R4 = 4;
/** /**
* <p> * <p>[V][T][P][S] 8 byte real.</p>
*
* [V][T][P][S] 8 byte real.</p>
*/ */
public final static int VT_R8 = 5; public final static int VT_R8 = 5;
/** /**
* <p> * <p>[V][T][P][S] currency. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V][T][P][S] currency. <span style="background-color: #ffff00">How long * interpreted?</span></p>
* is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_CY = 6; public final static int VT_CY = 6;
/** /**
* <p> * <p>[V][T][P][S] date. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V][T][P][S] date. <span style="background-color: #ffff00">How long is * interpreted?</span></p>
* this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_DATE = 7; public final static int VT_DATE = 7;
/** /**
* <p> * <p>[V][T][P][S] OLE Automation string. <span
* * style="background-color: #ffff00">How long is this? How is it
* [V][T][P][S] OLE Automation string. <span style="background-color: * to be interpreted?</span></p>
* #ffff00">How long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_BSTR = 8; public final static int VT_BSTR = 8;
/** /**
* <p> * <p>[V][T][P][S] IDispatch *. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V][T][P][S] IDispatch *. <span style="background-color: #ffff00">How * interpreted?</span></p>
* long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_DISPATCH = 9; public final static int VT_DISPATCH = 9;
/** /**
* <p> * <p>[V][T][S] SCODE. <span style="background-color: #ffff00">How
* * long is this? How is it to be interpreted?</span></p>
* [V][T][S] SCODE. <span style="background-color: #ffff00">How long is
* this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_ERROR = 10; public final static int VT_ERROR = 10;
/** /**
* <p> * <p>[V][T][P][S] True=-1, False=0.</p>
*
* [V][T][P][S] True=-1, False=0.</p>
*/ */
public final static int VT_BOOL = 11; public final static int VT_BOOL = 11;
/** /**
* <p> * <p>[V][T][P][S] VARIANT *. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V][T][P][S] VARIANT *. <span style="background-color: #ffff00">How long * interpreted?</span></p>
* is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_VARIANT = 12; public final static int VT_VARIANT = 12;
/** /**
* <p> * <p>[V][T][S] IUnknown *. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V][T][S] IUnknown *. <span style="background-color: #ffff00">How long * interpreted?</span></p>
* is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_UNKNOWN = 13; public final static int VT_UNKNOWN = 13;
/** /**
* <p> * <p>[V][T][S] 16 byte fixed point.</p>
*
* [V][T][S] 16 byte fixed point.</p>
*/ */
public final static int VT_DECIMAL = 14; public final static int VT_DECIMAL = 14;
/** /**
* <p> * <p>[T] signed char.</p>
*
* [T] signed char.</p>
*/ */
public final static int VT_I1 = 16; public final static int VT_I1 = 16;
/** /**
* <p> * <p>[V][T][P][S] unsigned char.</p>
*
* [V][T][P][S] unsigned char.</p>
*/ */
public final static int VT_UI1 = 17; public final static int VT_UI1 = 17;
/** /**
* <p> * <p>[T][P] unsigned short.</p>
*
* [T][P] unsigned short.</p>
*/ */
public final static int VT_UI2 = 18; public final static int VT_UI2 = 18;
/** /**
* <p> * <p>[T][P] unsigned int.</p>
*
* [T][P] unsigned int.</p>
*/ */
public final static int VT_UI4 = 19; public final static int VT_UI4 = 19;
/** /**
* <p> * <p>[T][P] signed 64-bit int.</p>
*
* [T][P] signed 64-bit int.</p>
*/ */
public final static int VT_I8 = 20; public final static int VT_I8 = 20;
/** /**
* <p> * <p>[T][P] unsigned 64-bit int.</p>
*
* [T][P] unsigned 64-bit int.</p>
*/ */
public final static int VT_UI8 = 21; public final static int VT_UI8 = 21;
/** /**
* <p> * <p>[T] signed machine int.</p>
*
* [T] signed machine int.</p>
*/ */
public final static int VT_INT = 22; public final static int VT_INT = 22;
/** /**
* <p> * <p>[T] unsigned machine int.</p>
*
* [T] unsigned machine int.</p>
*/ */
public final static int VT_UINT = 23; public final static int VT_UINT = 23;
/** /**
* <p> * <p>[T] C style void.</p>
*
* [T] C style void.</p>
*/ */
public final static int VT_VOID = 24; public final static int VT_VOID = 24;
/** /**
* <p> * <p>[T] Standard return type. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [T] Standard return type. <span style="background-color: #ffff00">How * interpreted?</span></p>
* long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_HRESULT = 25; public final static int VT_HRESULT = 25;
/** /**
* <p> * <p>[T] pointer type. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [T] pointer type. <span style="background-color: #ffff00">How long is * interpreted?</span></p>
* this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_PTR = 26; public final static int VT_PTR = 26;
/** /**
* <p> * <p>[T] (use VT_ARRAY in VARIANT).</p>
*
* [T] (use VT_ARRAY in VARIANT).</p>
*/ */
public final static int VT_SAFEARRAY = 27; public final static int VT_SAFEARRAY = 27;
/** /**
* <p> * <p>[T] C style array. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [T] C style array. <span style="background-color: #ffff00">How long is * interpreted?</span></p>
* this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_CARRAY = 28; public final static int VT_CARRAY = 28;
/** /**
* <p> * <p>[T] user defined type. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [T] user defined type. <span style="background-color: #ffff00">How long * interpreted?</span></p>
* is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_USERDEFINED = 29; public final static int VT_USERDEFINED = 29;
/** /**
* <p> * <p>[T][P] null terminated string.</p>
*
* [T][P] null terminated string.</p>
*/ */
public final static int VT_LPSTR = 30; public final static int VT_LPSTR = 30;
/** /**
* <p> * <p>[T][P] wide (Unicode) null terminated string.</p>
*
* [T][P] wide (Unicode) null terminated string.</p>
*/ */
public final static int VT_LPWSTR = 31; public final static int VT_LPWSTR = 31;
/** /**
* <p> * <p>[P] FILETIME. The FILETIME structure holds a date and time
* * associated with a file. The structure identifies a 64-bit
* [P] FILETIME. The FILETIME structure holds a date and time associated * integer specifying the number of 100-nanosecond intervals which
* with a file. The structure identifies a 64-bit integer specifying the * have passed since January 1, 1601. This 64-bit value is split
* number of 100-nanosecond intervals which have passed since January 1, * into the two dwords stored in the structure.</p>
* 1601. This 64-bit value is split into the two dwords stored in the
* structure.</p>
*/ */
public final static int VT_FILETIME = 64; public final static int VT_FILETIME = 64;
/** /**
* <p> * <p>[P] Length prefixed bytes.</p>
*
* [P] Length prefixed bytes.</p>
*/ */
public final static int VT_BLOB = 65; public final static int VT_BLOB = 65;
/** /**
* <p> * <p>[P] Name of the stream follows.</p>
*
* [P] Name of the stream follows.</p>
*/ */
public final static int VT_STREAM = 66; public final static int VT_STREAM = 66;
/** /**
* <p> * <p>[P] Name of the storage follows.</p>
*
* [P] Name of the storage follows.</p>
*/ */
public final static int VT_STORAGE = 67; public final static int VT_STORAGE = 67;
/** /**
* <p> * <p>[P] Stream contains an object. <span
* * style="background-color: #ffff00"> How long is this? How is it
* [P] Stream contains an object. <span style="background-color: #ffff00"> * to be interpreted?</span></p>
* How long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_STREAMED_OBJECT = 68; public final static int VT_STREAMED_OBJECT = 68;
/** /**
* <p> * <p>[P] Storage contains an object. <span
* * style="background-color: #ffff00"> How long is this? How is it
* [P] Storage contains an object. <span style="background-color: #ffff00"> * to be interpreted?</span></p>
* How long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_STORED_OBJECT = 69; public final static int VT_STORED_OBJECT = 69;
/** /**
* <p> * <p>[P] Blob contains an object. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [P] Blob contains an object. <span style="background-color: #ffff00">How * interpreted?</span></p>
* long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_BLOB_OBJECT = 70; public final static int VT_BLOB_OBJECT = 70;
/** /**
* <p> * <p>[P] Clipboard format. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [P] Clipboard format. <span style="background-color: #ffff00">How long * interpreted?</span></p>
* is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_CF = 71; public final static int VT_CF = 71;
/** /**
* <p> * <p>[P] A Class ID.</p>
* *
* [P] A Class ID.</p> <p> * <p>It consists of a 32 bit unsigned integer indicating the size
* of the structure, a 32 bit signed integer indicating (Clipboard
* Format Tag) indicating the type of data that it contains, and
* then a byte array containing the data.</p>
* *
* It consists of a 32 bit unsigned integer indicating the size of the * <p>The valid Clipboard Format Tags are:</p>
* structure, a 32 bit signed integer indicating (Clipboard Format Tag)
* indicating the type of data that it contains, and then a byte array
* containing the data.</p> <p>
* *
* The valid Clipboard Format Tags are: * <ul>
* <ul> * <li>{@link Thumbnail#CFTAG_WINDOWS}</li>
* <li> {@link Thumbnail#CFTAG_WINDOWS}</li> * <li>{@link Thumbnail#CFTAG_MACINTOSH}</li>
* <li> {@link Thumbnail#CFTAG_MACINTOSH}</li> * <li>{@link Thumbnail#CFTAG_NODATA}</li>
* <li> {@link Thumbnail#CFTAG_NODATA}</li> * <li>{@link Thumbnail#CFTAG_FMTID}</li>
* <li> {@link Thumbnail#CFTAG_FMTID}</li> * </ul>
* </ul>
* </p> <p>
* *
* <pre>typedef struct tagCLIPDATA { * <pre>typedef struct tagCLIPDATA {
* // cbSize is the size of the buffer pointed to * // cbSize is the size of the buffer pointed to
* // by pClipData, plus sizeof(ulClipFmt) * // by pClipData, plus sizeof(ulClipFmt)
* ULONG cbSize; * ULONG cbSize;
* long ulClipFmt; * long ulClipFmt;
* BYTE* pClipData; * BYTE* pClipData;
* } CLIPDATA;</pre> See <a href="msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp" * } CLIPDATA;</pre>
* target="_blank"> msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp *
* </a> </p> * <p>See <a
* href="msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp"
* target="_blank">
* msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp</a>.</p>
*/ */
public final static int VT_CLSID = 72; public final static int VT_CLSID = 72;
/** /**
* <p> * <p>[P] simple counted array. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [P] simple counted array. <span style="background-color: #ffff00">How * interpreted?</span></p>
* long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_VECTOR = 0x1000; public final static int VT_VECTOR = 0x1000;
/** /**
* <p> * <p>[V] SAFEARRAY*. <span style="background-color: #ffff00">How
* * long is this? How is it to be interpreted?</span></p>
* [V] SAFEARRAY*. <span style="background-color: #ffff00">How long is
* this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_ARRAY = 0x2000; public final static int VT_ARRAY = 0x2000;
/** /**
* <p> * <p>[V] void* for local use. <span style="background-color:
* * #ffff00">How long is this? How is it to be
* [V] void* for local use. <span style="background-color: #ffff00">How * interpreted?</span></p>
* long is this? How is it to be interpreted?</span> </p>
*/ */
public final static int VT_BYREF = 0x4000; public final static int VT_BYREF = 0x4000;
/**
* Description of the Field
*/
public final static int VT_RESERVED = 0x8000; public final static int VT_RESERVED = 0x8000;
/**
* Description of the Field
*/
public final static int VT_ILLEGAL = 0xFFFF; public final static int VT_ILLEGAL = 0xFFFF;
/**
* Description of the Field
*/
public final static int VT_ILLEGALMASKED = 0xFFF; public final static int VT_ILLEGALMASKED = 0xFFF;
/**
* Description of the Field
*/
public final static int VT_TYPEMASK = 0xFFF; public final static int VT_TYPEMASK = 0xFFF;
} }