klute       02/05/01 02:31:52

  Modified:    src/java/org/apache/poi/hpsf DocumentSummaryInformation.java
                        HPSFException.java HPSFRuntimeException.java
                        MarkUnsupportedException.java
                        NoPropertySetStreamException.java
                        NoSingleSectionException.java Property.java
                        PropertySet.java PropertySetFactory.java
                        Section.java SpecialPropertySet.java
                        SummaryInformation.java
                        UnexpectedPropertySetTypeException.java Util.java
                        Variant.java
               src/java/org/apache/poi/hpsf/wellknown PropertyIDMap.java
                        SectionIDMap.java
  Added:       src/java/org/apache/poi/hpsf Thumbnail.java
  Log:
  Added Drew's thumbnail enhancements.
  
  Revision  Changes    Path
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java
  
  Index: DocumentSummaryInformation.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DocumentSummaryInformation.java   30 Apr 2002 03:51:02 -0000      1.2
  +++ DocumentSummaryInformation.java   1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -73,7 +65,7 @@
    * @see SummaryInformation
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: DocumentSummaryInformation.java,v 1.2 2002/04/30 03:51:02 acoliver 
Exp $
  + * @version $Id: DocumentSummaryInformation.java,v 1.3 2002/05/01 09:31:52 klute 
Exp $
    * @since 2002-02-09
    */
   public class DocumentSummaryInformation extends SpecialPropertySet
  
  
  
  1.3       +1 -9      jakarta-poi/src/java/org/apache/poi/hpsf/HPSFException.java
  
  Index: HPSFException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/HPSFException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HPSFException.java        30 Apr 2002 03:51:02 -0000      1.2
  +++ HPSFException.java        1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -68,7 +60,7 @@
    * i.e. an exception that caused this one to be thrown.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: HPSFException.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: HPSFException.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class HPSFException extends Exception
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/HPSFRuntimeException.java
  
  Index: HPSFRuntimeException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/HPSFRuntimeException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HPSFRuntimeException.java 30 Apr 2002 03:51:02 -0000      1.2
  +++ HPSFRuntimeException.java 1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -68,7 +60,7 @@
    * throwable, i.e. an exception that caused this one to be thrown.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: HPSFRuntimeException.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: HPSFRuntimeException.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class HPSFRuntimeException extends RuntimeException
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/MarkUnsupportedException.java
  
  Index: MarkUnsupportedException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/MarkUnsupportedException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MarkUnsupportedException.java     30 Apr 2002 03:51:02 -0000      1.2
  +++ MarkUnsupportedException.java     1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -67,7 +59,7 @@
    * not support the {@link java.io.InputStream#mark} operation.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: MarkUnsupportedException.java,v 1.2 2002/04/30 03:51:02 acoliver 
Exp $
  + * @version $Id: MarkUnsupportedException.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class MarkUnsupportedException extends HPSFException
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/NoPropertySetStreamException.java
  
  Index: NoPropertySetStreamException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/NoPropertySetStreamException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NoPropertySetStreamException.java 30 Apr 2002 03:51:02 -0000      1.2
  +++ NoPropertySetStreamException.java 1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -71,7 +63,7 @@
    * superclass and documented there.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: NoPropertySetStreamException.java,v 1.2 2002/04/30 03:51:02 
acoliver Exp $
  + * @version $Id: NoPropertySetStreamException.java,v 1.3 2002/05/01 09:31:52 klute 
Exp $
    * @since 2002-02-09
    */
   public class NoPropertySetStreamException extends HPSFException
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/NoSingleSectionException.java
  
  Index: NoSingleSectionException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/NoSingleSectionException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NoSingleSectionException.java     30 Apr 2002 03:51:02 -0000      1.2
  +++ NoSingleSectionException.java     1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -72,7 +64,7 @@
    * superclass and documented there.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: NoSingleSectionException.java,v 1.2 2002/04/30 03:51:02 acoliver 
Exp $
  + * @version $Id: NoSingleSectionException.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class NoSingleSectionException extends HPSFRuntimeException
  
  
  
  1.3       +19 -1     jakarta-poi/src/java/org/apache/poi/hpsf/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/Property.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Property.java     30 Apr 2002 03:51:02 -0000      1.2
  +++ Property.java     1 May 2002 09:31:52 -0000       1.3
  @@ -89,7 +89,8 @@
    * @see Variant
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: Property.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @author Drew Varner (Drew.Varner InAndAround sc.edu)
  + * @version $Id: Property.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class Property
  @@ -202,6 +203,23 @@
                   while (src[last] == 0 && first <= last)
                       last--;
                   value = new String(src, first, last - first + 1);
  +                break;
  +            }
  +            case Variant.VT_CF:
  +            {
  +                // the first four bytes in src, from
  +                // src[offset] to src[offset + 3] contain
  +                // the DWord for VT_CF, so skip it, we don't
  +                // need it
  +
  +                // truncate the length of the return array by
  +                // a DWord length (4 bytes)
  +                length = length - DWord.LENGTH;
  +
  +                final byte[] v = new byte[length];
  +                for (int i = 0; i < length; i++)
  +                    v[i] = src[offset + i + DWord.LENGTH];
  +                value = v;
                   break;
               }
               default:
  
  
  
  1.3       +2 -10     jakarta-poi/src/java/org/apache/poi/hpsf/PropertySet.java
  
  Index: PropertySet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/PropertySet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertySet.java  30 Apr 2002 03:51:02 -0000      1.2
  +++ PropertySet.java  1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -99,7 +91,7 @@
    * Section}).
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: PropertySet.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: PropertySet.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class PropertySet
  @@ -385,7 +377,7 @@
           offset += ClassID.LENGTH;
           sectionCount = new DWord(src, offset).intValue();
           offset += DWord.LENGTH;
  -        
  +
           /* Read the sections, which are following the header. They
            * start with an array of section descriptions. Each one
            * consists of a format ID telling what the section contains
  
  
  
  1.3       +1 -9      jakarta-poi/src/java/org/apache/poi/hpsf/PropertySetFactory.java
  
  Index: PropertySetFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/PropertySetFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertySetFactory.java   30 Apr 2002 03:51:02 -0000      1.2
  +++ PropertySetFactory.java   1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -69,7 +61,7 @@
    * {@link DocumentSummaryInformation} and {@link PropertySet}.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: PropertySetFactory.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: PropertySetFactory.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class PropertySetFactory
  
  
  
  1.3       +1 -9      jakarta-poi/src/java/org/apache/poi/hpsf/Section.java
  
  Index: Section.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/Section.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Section.java      30 Apr 2002 03:51:02 -0000      1.2
  +++ Section.java      1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -70,7 +62,7 @@
    * <p>Represents a section in a {@link PropertySet}.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: Section.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: Section.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class Section
  
  
  
  1.3       +1 -9      jakarta-poi/src/java/org/apache/poi/hpsf/SpecialPropertySet.java
  
  Index: SpecialPropertySet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/SpecialPropertySet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpecialPropertySet.java   30 Apr 2002 03:51:02 -0000      1.2
  +++ SpecialPropertySet.java   1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -92,7 +84,7 @@
    * only late to my mind.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: SpecialPropertySet.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: SpecialPropertySet.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public abstract class SpecialPropertySet extends PropertySet
  
  
  
  1.6       +1 -3      jakarta-poi/src/java/org/apache/poi/hpsf/SummaryInformation.java
  
  Index: SummaryInformation.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/SummaryInformation.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SummaryInformation.java   28 Apr 2002 06:39:55 -0000      1.5
  +++ SummaryInformation.java   1 May 2002 09:31:52 -0000       1.6
  @@ -73,7 +73,7 @@
    * @see DocumentSummaryInformation
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: SummaryInformation.java,v 1.5 2002/04/28 06:39:55 klute Exp $
  + * @version $Id: SummaryInformation.java,v 1.6 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class SummaryInformation extends SpecialPropertySet
  @@ -276,8 +276,6 @@
        */
       public byte[] getThumbnail()
       {
  -        if (true)
  -            throw new UnsupportedOperationException("FIXME");
           return (byte[]) getProperty(PropertyIDMap.PID_THUMBNAIL);
       }
   
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/UnexpectedPropertySetTypeException.java
  
  Index: UnexpectedPropertySetTypeException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/UnexpectedPropertySetTypeException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UnexpectedPropertySetTypeException.java   30 Apr 2002 03:51:02 -0000      1.2
  +++ UnexpectedPropertySetTypeException.java   1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -71,7 +63,7 @@
    * superclass and documented there.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: UnexpectedPropertySetTypeException.java,v 1.2 2002/04/30 03:51:02 
acoliver Exp $
  + * @version $Id: UnexpectedPropertySetTypeException.java,v 1.3 2002/05/01 09:31:52 
klute Exp $
    * @since 2002-02-09
    */
   public class UnexpectedPropertySetTypeException extends HPSFException
  
  
  
  1.3       +1 -9      jakarta-poi/src/java/org/apache/poi/hpsf/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/Util.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Util.java 30 Apr 2002 03:51:02 -0000      1.2
  +++ Util.java 1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -68,7 +60,7 @@
    * <p>Provides various static utility methods.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: Util.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: Util.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class Util
  
  
  
  1.3       +29 -12    jakarta-poi/src/java/org/apache/poi/hpsf/Variant.java
  
  Index: Variant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/Variant.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Variant.java      30 Apr 2002 03:51:02 -0000      1.2
  +++ Variant.java      1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf;
  @@ -73,7 +65,7 @@
    * <strong>[S]</strong> - may appear in a Safe Array.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: Variant.java,v 1.2 2002/04/30 03:51:02 acoliver Exp $
  + * @version $Id: Variant.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class Variant
  @@ -307,9 +299,34 @@
       public final static int VT_CF = 71;
   
       /**
  -     * <p>[P] A Class ID. <span style="background-color:
  -     * #ffff00">How long is this? How is it to be
  -     * interpreted?</span></p>
  +     * <p>[P] A Class ID.</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>
  +     *
  +     * <p>The valid Clipboard Format Tags are:
  +     * <ul>
  +     *     <li>{@link Thumbnail#CFTAG_WINDOWS}</li>
  +     *     <li>{@link Thumbnail#CFTAG_MACINTOSH}</li>
  +     *     <li>{@link Thumbnail#CFTAG_NODATA}</li>
  +     *     <li>{@link Thumbnail#CFTAG_FMTID}</li>
  +     * </ul></p>
  +     *
  +     * <p>
  +     * <pre>typedef struct  tagCLIPDATA {
  +     * // cbSize is the size of the buffer pointed to
  +     * // by pClipData, plus sizeof(ulClipFmt)
  +     * ULONG              cbSize;
  +     * long               ulClipFmt;
  +     * BYTE*              pClipData;
  +     * } CLIPDATA;</pre>
  +     * 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;
   
  
  
  
  1.1                  jakarta-poi/src/java/org/apache/poi/hpsf/Thumbnail.java
  
  Index: Thumbnail.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.poi.hpsf;
  
  import org.apache.poi.hpsf.littleendian.DWord;
  /**
   * <p>Class to manipulate  data in the Clipboard Variant
   * ({@link Variant#VT_CF VT_CF}) format.</p>
   *
   * @see SummaryInformation#getThumbnail()
   *
   * @author Drew Varner (Drew.Varner inOrAround sc.edu)
   * @version $Id: Thumbnail.java,v 1.1 2002/05/01 09:31:52 klute Exp $
   * @since 2002-04-29
   */
  public class Thumbnail
  {
  
  
  
      /**
       * <p>Offset in bytes where the Clipboard Format Tag
       * starts in the <code>byte[]</code> returned by
       * {@link SummaryInformation#getThumbnail()}</p>
       */
      public static int OFFSET_CFTAG = 4;
  
  
  
      /**
       * <p>Offset in bytes where the Clipboard Format
       * starts in the <code>byte[]</code> returned by
       * {@link SummaryInformation#getThumbnail()}</p>
       *
       * <p>This is only valid if the Clipboard Format Tag
       * is {@link #CFTAG_WINDOWS} </p>
       */
      public static int OFFSET_CF = 8;
  
  
  
      /**
       * <p>Offset in bytes where the Windows Metafile
       * (WMF) image data starts in the <code>byte[]</code>
       * returned by {@link SummaryInformation#getThumbnail()}</p>
       *
       * <p>There is only WMF data at this point in the
       * <code>byte[]</code> if the Clipboard Format Tag is
       * {@link #CFTAG_WINDOWS} and the Clipboard Format is
       * {@link #CF_METAFILEPICT}.</p>
       *
       * <p>Note: The <code>byte[]</code> that starts at
       * <code>OFFSET_WMFDATA</code> 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;
  
  
  
      /**
       * <p>Clipboard Format Tag - Windows clipboard format</p>
       * <p>A <code>DWORD</code> indicating a built-in Windows clipboard
       * format value</p>
       *
       * <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;
  
  
  
      /**
       * <p>Clipboard Format Tag - Macintosh clipboard format</p>
       * <p>A <code>DWORD</code> indicating a Macintosh clipboard format value</p>
       *
       * <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;
  
  
  
      /**
       * <p>Clipboard Format Tag - Format ID</p>
       * <p>A GUID containing a format identifier (FMTID). This is rarely used.</p>
       *
       * <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;
  
  
  
      /**
       * <p>Clipboard Format Tag - No Data</p>
       * <p>a <code>DWORD</code> indicating No data. This is rarely used.</p>
       *
       * <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_NODATA = 0;
  
  
  
      /**
       * <p>Clipboard Format - Windows metafile format.
       * This is the recommended way to store thumbnails
       * in Property Streams.</p>
       * <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;
  
  
  
      /**
       * <p>Clipboard Format - Device Independent Bitmap</p>
       */
      public static int CF_DIB = 8;
  
  
  
      /**
       * <p>Clipboard Format - Enhanced Windows metafile format</p>
       */
      public static int CF_ENHMETAFILE = 14;
  
  
  
      /**
       * <p>Clipboard Format - Bitmap</p>
       * <p>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>
       */
      public static int CF_BITMAP = 2;
  
  
  
      /**
       * <p> A <code>byte[]</code> to hold a thumbnail image in
       * ({@link Variant#VT_CF VT_CF}) format. </p>
       */
      private byte[] thumbnailData = null;
  
  
  
      /**
       * <p>Default Constructor. If you use then one you'll have to add
       * the thumbnail <code>byte[]</code> from {@link
       * SummaryInformation#getThumbnail()} to do any useful
       * manipulations, otherwise you'll get a
       * <code>NullPointerException</code>.</p>
       */
      public Thumbnail()
      {
          super();
      }
  
  
  
      /**
       * <p></p>
       */
      public Thumbnail(byte[] thumbnailData)
      {
          this.thumbnailData = thumbnailData;
      }
  
  
  
      /**
       * <p>Returns the thumbnail as a <code>byte[]</code> in
       * {@link Variant#VT_CF VT_CF} format.</p>
       *
       * @see SummaryInformation#getThumbnail()
       */
      public byte[] getThumbnail() {
          return thumbnailData;
      }
  
  
  
      /**
       * <p>Sets the Thumbnail's underlying <code>byte[]</code> in
       * {@link Variant#VT_CF VT_CF} format.</p>
       *
       * @see SummaryInformation#getThumbnail()
       */
      public void setThumbnail(byte[] thumbnail) {
          this.thumbnailData = thumbnail;
      }
  
  
  
      /**
       * <p>Returns an <code>int</code> representing the Clipboard
       * Format Tag</p>
       * <p>Possible return values are:
       * <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 int getClipboardFormatTag()
      {
          DWord clipboardFormatTag = new DWord(getThumbnail(),OFFSET_CFTAG);
          return clipboardFormatTag.intValue();
      }
  
  
  
      /**
       * <p>Returns an <code>int</code> representing the Clipboard
       * Format</p>
       *
       * <p>Will throw an exceptionif the Thumbnail's Clipboard
       * Format Tag is not
       * {@link Thumbnail#CFTAG_WINDOWS CFTAG_WINDOWS}
       * </p>
       *
       * <p>Possible return values are:
       * <ul>
       *   <li>{@link #CF_METAFILEPICT CF_METAFILEPICT}</li>
       *   <li>{@link #CF_DIB CF_DIB}</li>
       *   <li>{@link #CF_ENHMETAFILE CF_ENHMETAFILE}</li>
       *   <li>{@link #CF_BITMAP CF_BITMAP}</li>
       * </ul>
       * </p>
       *
       * @return a flag indicating the Clipboard Format
       *
       * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS
       *
       */
      public int getClipboardFormat() throws HPSFException
      {
          if ( !(getClipboardFormatTag() == CFTAG_WINDOWS) )
          {
              throw new HPSFException("Clipboard Format Tag of Thumbnail must " +
                                      "be CFTAG_WINDOWS.");
          }
  
          DWord clipboardFormat = new DWord(getThumbnail(),OFFSET_CF);
          return clipboardFormat.intValue();
      }
  
  
  
      /**
       * <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>
       *
       * <p> 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>
       *
       * @throws HPSFException if the Thumbnail isn't CFTAG_WINDOWS
       *                       and CF_METAFILEPICT
       *
       * @return a WMF image of the Thumbnail
       */
      public byte[] getThumbnailAsWMF() throws HPSFException
      {
          if ( !(getClipboardFormatTag() == CFTAG_WINDOWS) )
          {
              throw new HPSFException("Clipboard Format Tag of Thumbnail must " +
                                      "be CFTAG_WINDOWS.");
          }
          if ( !(getClipboardFormat() == CF_METAFILEPICT) )
          {
              throw new HPSFException("Clipboard Format of Thumbnail must " +
                                      "be CF_METAFILEPICT.");
          }
          else
          {
              byte[] thumbnail = getThumbnail();
              int wmfImageLength = thumbnail.length - OFFSET_WMFDATA;
              byte[] wmfImage = new byte[wmfImageLength];
              System.arraycopy(thumbnail,
                               OFFSET_WMFDATA,
                               wmfImage,
                               0,
                               wmfImageLength);
              return wmfImage;
          }
      }
  
  }
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
  
  Index: PropertyIDMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyIDMap.java        30 Apr 2002 03:51:03 -0000      1.2
  +++ PropertyIDMap.java        1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf.wellknown;
  @@ -80,7 +72,7 @@
    * lot of stupid typing, I won't do it for the time being.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: PropertyIDMap.java,v 1.2 2002/04/30 03:51:03 acoliver Exp $
  + * @version $Id: PropertyIDMap.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class PropertyIDMap extends HashMap
  
  
  
  1.3       +1 -9      
jakarta-poi/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java
  
  Index: SectionIDMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SectionIDMap.java 30 Apr 2002 03:51:03 -0000      1.2
  +++ SectionIDMap.java 1 May 2002 09:31:52 -0000       1.3
  @@ -50,14 +50,6 @@
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
  -*
  -* Portions of this software are based upon public domain software
  -* originally written at the National Center for Supercomputing Applications,
  -* University of Illinois, Urbana-Champaign.
  - *
  - * Portions of this software are based upon public domain software
  - * originally written at the National Center for Supercomputing Applications,
  - * University of Illinois, Urbana-Champaign.
    */
   
   package org.apache.poi.hpsf.wellknown;
  @@ -80,7 +72,7 @@
    * property IDs in sections with the specified section format ID.</p>
    *
    * @author Rainer Klute ([EMAIL PROTECTED])
  - * @version $Id: SectionIDMap.java,v 1.2 2002/04/30 03:51:03 acoliver Exp $
  + * @version $Id: SectionIDMap.java,v 1.3 2002/05/01 09:31:52 klute Exp $
    * @since 2002-02-09
    */
   public class SectionIDMap extends HashMap
  
  
  


Reply via email to