Enhancements from Drew for boolean properties. Plus doc change for DWord.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14dada7c69
commit
2ac503512a
@ -65,6 +65,8 @@ import org.apache.poi.hpsf.wellknown.*;
|
|||||||
* @see SummaryInformation
|
* @see SummaryInformation
|
||||||
*
|
*
|
||||||
* @author Rainer Klute (klute@rainer-klute.de)
|
* @author Rainer Klute (klute@rainer-klute.de)
|
||||||
|
* @author Drew Varner (Drew.Varner closeTo sc.edu)
|
||||||
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2002-02-09
|
* @since 2002-02-09
|
||||||
*/
|
*/
|
||||||
@ -191,16 +193,12 @@ public class DocumentSummaryInformation extends SpecialPropertySet
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Returns the stream's scale (or <code>null</code>)
|
* <p>Returns <code>true</code> when scaling of the thumbnail is
|
||||||
* <strong>when this method is implemented. Please note that the
|
* desired, <code>false</code> if cropping is desired.</p>
|
||||||
* return type is likely to change!</strong>
|
|
||||||
*/
|
*/
|
||||||
public boolean getScale()
|
public boolean getScale()
|
||||||
{
|
{
|
||||||
if (true)
|
return getPropertyBooleanValue(PropertyIDMap.PID_SCALE);
|
||||||
throw new UnsupportedOperationException("FIXME");
|
|
||||||
// return (byte[]) getProperty(PropertyIDMap.PID_SCALE);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,15 +252,15 @@ public class DocumentSummaryInformation extends SpecialPropertySet
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Returns the stream's links dirty information <strong>when
|
* <p>Returns <code>true</code> if the custom links are hampered
|
||||||
* this method is implemented.</strong>
|
* by excessive noise, for all applications.</p>
|
||||||
|
*
|
||||||
|
* <p><strong>FIXME:</strong> Explain this some more! I (Rainer)
|
||||||
|
* don't understand it.</p>
|
||||||
*/
|
*/
|
||||||
public boolean getLinksDirty()
|
public boolean getLinksDirty()
|
||||||
{
|
{
|
||||||
if (true)
|
return getPropertyBooleanValue(PropertyIDMap.PID_LINKSDIRTY);
|
||||||
throw new UnsupportedOperationException("FIXME");
|
|
||||||
// return (byte[]) getProperty(PropertyIDMap.PID_LINKSDIRTY);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@ import org.apache.poi.hpsf.littleendian.*;
|
|||||||
*
|
*
|
||||||
* @author Rainer Klute (klute@rainer-klute.de)
|
* @author Rainer Klute (klute@rainer-klute.de)
|
||||||
* @author Drew Varner (Drew.Varner InAndAround sc.edu)
|
* @author Drew Varner (Drew.Varner InAndAround sc.edu)
|
||||||
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2002-02-09
|
* @since 2002-02-09
|
||||||
*/
|
*/
|
||||||
@ -207,21 +208,45 @@ public class Property
|
|||||||
}
|
}
|
||||||
case Variant.VT_CF:
|
case Variant.VT_CF:
|
||||||
{
|
{
|
||||||
// the first four bytes in src, from
|
/* The first four bytes in src, from rc[offset] to
|
||||||
// src[offset] to src[offset + 3] contain
|
* src[offset + 3] contain the DWord for VT_CF, so
|
||||||
// the DWord for VT_CF, so skip it, we don't
|
* skip it, we don't need it. */
|
||||||
// need it
|
|
||||||
|
|
||||||
// truncate the length of the return array by
|
/* Truncate the length of the return array by a DWord
|
||||||
// a DWord length (4 bytes)
|
* length (4 bytes). */
|
||||||
length = length - DWord.LENGTH;
|
length = length - DWord.LENGTH;
|
||||||
|
|
||||||
final byte[] v = new byte[length];
|
final byte[] v = new byte[length];
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
v[i] = src[offset + i + DWord.LENGTH];
|
v[i] = src[o + i];
|
||||||
value = v;
|
value = v;
|
||||||
break;
|
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: Someone might invent a new
|
||||||
|
* HPSFRuntimeException subclass
|
||||||
|
* IllegalPropertySetDataException for this and
|
||||||
|
* similar cases. */
|
||||||
|
throw new HPSFRuntimeException
|
||||||
|
("Illegal property set data: A boolean must be " +
|
||||||
|
"either -1 (true) or 0 (false).");
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
final byte[] v = new byte[length];
|
final byte[] v = new byte[length];
|
||||||
|
@ -91,6 +91,8 @@ import org.apache.poi.poifs.filesystem.*;
|
|||||||
* Section}).
|
* Section}).
|
||||||
*
|
*
|
||||||
* @author Rainer Klute (klute@rainer-klute.de)
|
* @author Rainer Klute (klute@rainer-klute.de)
|
||||||
|
* @author Drew Varner (Drew.Varner hanginIn sc.edu)
|
||||||
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2002-02-09
|
* @since 2002-02-09
|
||||||
*/
|
*/
|
||||||
@ -465,6 +467,25 @@ public class PropertySet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Convenience method returning the value of the numeric
|
* <p>Convenience method returning the value of the numeric
|
||||||
* property with the specified ID. If the property is not
|
* property with the specified ID. If the property is not
|
||||||
|
@ -62,6 +62,8 @@ import org.apache.poi.hpsf.wellknown.*;
|
|||||||
* <p>Represents a section in a {@link PropertySet}.</p>
|
* <p>Represents a section in a {@link PropertySet}.</p>
|
||||||
*
|
*
|
||||||
* @author Rainer Klute (klute@rainer-klute.de)
|
* @author Rainer Klute (klute@rainer-klute.de)
|
||||||
|
* @author Drew Varner (Drew.Varner allUpIn sc.edu)
|
||||||
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2002-02-09
|
* @since 2002-02-09
|
||||||
*/
|
*/
|
||||||
@ -231,6 +233,24 @@ public class Section
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean wasNull;
|
private boolean wasNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
package org.apache.poi.hpsf.littleendian;
|
package org.apache.poi.hpsf.littleendian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Represents a double word (4 bytes).</p>
|
* <p>Represents an unsigned double word (4 bytes).</p>
|
||||||
*
|
*
|
||||||
* @author Rainer Klute (klute@rainer-klute.de)
|
* @author Rainer Klute (klute@rainer-klute.de)
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -97,7 +97,7 @@ public class DWord extends LittleEndian
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Return the integral value of this {@link DWord}.</p>
|
* <p>Returns the integral value of this {@link DWord}.</p>
|
||||||
*
|
*
|
||||||
* <p><strong>FIXME:</strong> Introduce a superclass for the
|
* <p><strong>FIXME:</strong> Introduce a superclass for the
|
||||||
* numeric types and make this a method of the superclass!</p>
|
* numeric types and make this a method of the superclass!</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user