ASF Bugzilla – Attachment 1768 Details for
Bug 8764
[PATCH] Add VT_BOOL functionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch to add VT_BOOL functionality in HPSF
vt_bool_patch.txt (text/plain), 6.21 KB, created by
Drew Varner
on 2002-05-03 06:13:38 UTC
(
hide
)
Description:
A patch to add VT_BOOL functionality in HPSF
Filename:
MIME Type:
Creator:
Drew Varner
Created:
2002-05-03 06:13:38 UTC
Size:
6.21 KB
patch
obsolete
>cvs diff -u > >*****CVS exited normally with code 1***** > >cvs server: Diffing . >Index: DocumentSummaryInformation.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java,v >retrieving revision 1.5 >diff -u -r1.5 DocumentSummaryInformation.java >--- DocumentSummaryInformation.java 2 May 2002 16:03:41 -0000 1.5 >+++ DocumentSummaryInformation.java 3 May 2002 06:05:02 -0000 >@@ -65,6 +65,7 @@ > * @see SummaryInformation > * > * @author Rainer Klute (klute@rainer-klute.de) >+ * @author Drew Varner (Drew.Varner closeTo sc.edu) > * @version $Id: DocumentSummaryInformation.java,v 1.5 2002/05/02 16:03:41 klute Exp $ > * @since 2002-02-09 > */ >@@ -191,16 +192,12 @@ > > > /** >- * <p>Returns the stream's scale (or <code>null</code>) >- * <strong>when this method is implemented. Please note that the >- * return type is likely to change!</strong> >+ * <p><code>true</code> when scaling of the thumbnail is >+ * desired. <code>false</code> if cropping is desired.</p> > */ > public boolean getScale() > { >- if (true) >- throw new UnsupportedOperationException("FIXME"); >- // return (byte[]) getProperty(PropertyIDMap.PID_SCALE); >- return false; >+ return getPropertyBooleanValue(PropertyIDMap.PID_SCALE); > } > > >@@ -254,15 +251,12 @@ > > > /** >- * <p>Returns the stream's links dirty information <strong>when >- * this method is implemented.</strong> >+ * <p>Returns whether the custom links are hampered by >+ * excessive noise, for all applications</p> > */ > public boolean getLinksDirty() > { >- if (true) >- throw new UnsupportedOperationException("FIXME"); >- // return (byte[]) getProperty(PropertyIDMap.PID_LINKSDIRTY); >- return false; >+ return getPropertyBooleanValue(PropertyIDMap.PID_LINKSDIRTY); > } > > } >Index: Property.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hpsf/Property.java,v >retrieving revision 1.3 >diff -u -r1.3 Property.java >--- Property.java 1 May 2002 09:31:52 -0000 1.3 >+++ Property.java 3 May 2002 06:05:03 -0000 >@@ -218,8 +218,35 @@ > > final byte[] v = new byte[length]; > for (int i = 0; i < length; i++) >- v[i] = src[offset + i + DWord.LENGTH]; >+ v[i] = src[o + i]; > value = v; >+ break; >+ } >+ case Variant.VT_BOOL: >+ { >+ // the first four bytes in src, from >+ // src[offset] to src[offset + 3] contain >+ // the DWord for VT_BOOL, so skip it, we don't >+ // need it >+ final int first = o + DWord.LENGTH; >+ DWord bool = new DWord(src,o); >+ if (bool.intValue() == -1) >+ { >+ value = new Boolean(true); >+ } >+ else if (bool.intValue() == 0) >+ { >+ value = new Boolean(false); >+ } >+ else >+ { >+ //FIXME: What do we do here? >+ //VT_BOOL must be >+ // -1 for false >+ // 0 for true >+ // this is undefined! >+ } >+ > break; > } > default: >Index: PropertySet.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hpsf/PropertySet.java,v >retrieving revision 1.3 >diff -u -r1.3 PropertySet.java >--- PropertySet.java 1 May 2002 09:31:52 -0000 1.3 >+++ PropertySet.java 3 May 2002 06:05:05 -0000 >@@ -91,6 +91,7 @@ > * Section}). > * > * @author Rainer Klute (klute@rainer-klute.de) >+ * @author Drew Varner (Drew.Varner hanginIn sc.edu) > * @version $Id: PropertySet.java,v 1.3 2002/05/01 09:31:52 klute Exp $ > * @since 2002-02-09 > */ >@@ -461,6 +462,25 @@ > throws NoSingleSectionException > { > return getSingleSection().getProperty(id); >+ } >+ >+ >+ >+ /** >+ * <p>Convenience method returning the value of a boolean >+ * property with the specified ID. If the property is not >+ * available, <code>false</code> is returned. A subsequent call to >+ * {@link #wasNull} will return <code>true</code> to let the caller >+ * distinguish that case from a real property value of <code>false</code>. >+ * </p> >+ * >+ * @throws NoSingleSectionException if the {@link PropertySet} has >+ * more or less than one {@link Section}. >+ */ >+ protected boolean getPropertyBooleanValue(final int id) >+ throws NoSingleSectionException >+ { >+ return getSingleSection().getPropertyBooleanValue(id); > } > > >Index: Section.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hpsf/Section.java,v >retrieving revision 1.3 >diff -u -r1.3 Section.java >--- Section.java 1 May 2002 09:31:52 -0000 1.3 >+++ Section.java 3 May 2002 06:05:05 -0000 >@@ -62,6 +62,7 @@ > * <p>Represents a section in a {@link PropertySet}.</p> > * > * @author Rainer Klute (klute@rainer-klute.de) >+ * @author Drew Varner (Drew.Varner allUpIn sc.edu) > * @version $Id: Section.java,v 1.3 2002/05/01 09:31:52 klute Exp $ > * @since 2002-02-09 > */ >@@ -227,6 +228,24 @@ > return i.intValue(); > else > return 0; >+ } >+ >+ >+ >+ /** >+ * <p>Returns the value of the boolean property with the specified >+ * ID. If the property is not available, <code>false</code> is returned. A >+ * subsequent call to {@link #wasNull} will return >+ * <code>true</code> to let the caller distinguish that case from >+ * a real property value of <code>false</code>.</p> >+ */ >+ protected boolean getPropertyBooleanValue(final int id) >+ { >+ final Boolean b = (Boolean) getProperty(id); >+ if (b != null) >+ return b.booleanValue(); >+ else >+ return false; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 8764
: 1768