From 73a9af683f7c986421d12e07e680111d94a609c4 Mon Sep 17 00:00:00 2001
From: Rainer Klute <klute@apache.org>
Date: Fri, 3 Mar 2006 16:57:55 +0000
Subject: * Writing support added to the SummaryInformation and
 DocumentSummaryInformation classes. These classes now have methods for
 setting and removing properties. Coherent extensions are: ** Documentation
 section about writing standard properties added to the HPSF HOW-TO. **
 Example application added showing how to modify the document summary
 information. ** Testcases added for testing modifying summary information and
 document summary information. ** PropertySetFactory extended to create
 SummaryInformation and DocumentSummaryInformation instances.

* Added MutablePropertySet.write(DirectoryEntry, String) to ease writing a property set to a POI filesystem document.

* Improved codepage handling.

* Bug fixed: Integral values were read and written as unsigned instead of signed.

* Reworked the mapping between variant types and Java types: Variant.VT_I4 is mapped to Integer now and Variant.VT_I8 to Long. This might cause incompatibilities if you are doing low-level HPSF programming.

* Changed SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID from a byte[] to a byte[][] in order to contain the format ID of the first and the second section. This is an incompatible change!

* Added PropertySet.getFirstSection(). This method is similar to getSingleSection() won't choke if the property set has more than one section.

* Support for low-level reading and writing of Variant.VT_I8 type properties added.

* Unnecessary casts removed.

* Poibrowser's display format changed slightly.



git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@382887 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/poi/hpsf/wellknown/PropertyIDMap.java   |  6 +++-
 .../apache/poi/hpsf/wellknown/SectionIDMap.java    | 34 +++++++++++++---------
 2 files changed, 25 insertions(+), 15 deletions(-)

(limited to 'src/java/org/apache/poi/hpsf/wellknown')

diff --git a/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java b/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
index 77a17b5224..517af3b1ed 100644
--- a/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
+++ b/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Copyright 2002-2004   Apache Software Foundation
 
@@ -231,6 +230,11 @@ public class PropertyIDMap extends HashMap
      * re-evaluated.</p>
      */
     public static final int PID_LINKSDIRTY = 16;
+    
+    /**
+     * <p>The highest well-known property ID. Applications are free to use higher values for custom purposes.</p>
+     */
+    public static final int PID_MAX = PID_LINKSDIRTY;
 
 
 
diff --git a/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java b/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java
index 93e837f2c6..e5e2045896 100644
--- a/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java
+++ b/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java
@@ -1,6 +1,5 @@
-
 /* ====================================================================
-   Copyright 2002-2004   Apache Software Foundation
+   Copyright 2002-2006   Apache Software Foundation
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -53,16 +52,23 @@ public class SectionIDMap extends HashMap
     };
 
     /**
-     * <p>The DocumentSummaryInformation's first section's format
-     * ID. The second section has a different format ID which is not
-     * well-known.</p>
+     * <p>The DocumentSummaryInformation's first and second sections' format
+     * ID.</p>
      */
-    public static final byte[] DOCUMENT_SUMMARY_INFORMATION_ID = new byte[]
+    public static final byte[][] DOCUMENT_SUMMARY_INFORMATION_ID = new byte[][]
     {
-        (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x02,
-        (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B,
-        (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00,
-        (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE
+        {
+            (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x02,
+            (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B,
+            (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00,
+            (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE
+        },
+        {
+            (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x05,
+            (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B,
+            (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00,
+            (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE
+        }
     };
 
     /**
@@ -91,7 +97,7 @@ public class SectionIDMap extends HashMap
             final SectionIDMap m = new SectionIDMap();
             m.put(SUMMARY_INFORMATION_ID,
                   PropertyIDMap.getSummaryInformationProperties());
-            m.put(DOCUMENT_SUMMARY_INFORMATION_ID,
+            m.put(DOCUMENT_SUMMARY_INFORMATION_ID[0],
                   PropertyIDMap.getDocumentSummaryInformationProperties());
             defaultMap = m;
         }
@@ -116,8 +122,7 @@ public class SectionIDMap extends HashMap
     public static String getPIDString(final byte[] sectionFormatID,
                                       final long pid)
     {
-        final PropertyIDMap m =
-            (PropertyIDMap) getInstance().get(sectionFormatID);
+        final PropertyIDMap m = getInstance().get(sectionFormatID);
         if (m == null)
             return UNDEFINED;
         else
@@ -178,7 +183,8 @@ public class SectionIDMap extends HashMap
 
     /**
      * @deprecated Use {@link #put(byte[], PropertyIDMap)} instead!
-     * @link #put(byte[], PropertyIDMap)
+     *
+     * @see #put(byte[], PropertyIDMap)
      * 
      * @param key This parameter remains undocumented since the method is
      * deprecated.
-- 
cgit v1.2.3