FileDocCategorySizeDatePackage
DocumentSummaryInformation.javaAPI DocApache Poi 3.0.118124Mon Jan 01 12:39:34 GMT 2007org.apache.poi.hpsf

DocumentSummaryInformation

public class DocumentSummaryInformation extends SpecialPropertySet

Convenience class representing a DocumentSummary Information stream in a Microsoft Office document.

author
Rainer Klute <klute@rainer-klute.de>
author
Drew Varner (Drew.Varner closeTo sc.edu)
author
robert_flaherty@hyperion.com
see
SummaryInformation
version
$Id: DocumentSummaryInformation.java 489730 2006-12-22 19:18:16Z bayard $
since
2002-02-09

Fields Summary
public static final String
DEFAULT_STREAM_NAME

The document name a document summary information stream usually has in a POIFS filesystem.

Constructors Summary
public DocumentSummaryInformation(PropertySet ps)

Creates a {@link DocumentSummaryInformation} from a given {@link PropertySet}.

param
ps A property set which should be created from a document summary information stream.
throws
UnexpectedPropertySetTypeException if ps does not contain a document summary information stream.




                                             
       
         
    
        super(ps);
        if (!isDocumentSummaryInformation())
            throw new UnexpectedPropertySetTypeException
                ("Not a " + getClass().getName());
    
Methods Summary
private voidensureSection2()

Creates section 2 if it is not already present.

        if (getSectionCount() < 2)
        {
            MutableSection s2 = new MutableSection();
            s2.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[1]);
            addSection(s2);
        }
    
public intgetByteCount()

Returns the byte count or 0 if the {@link DocumentSummaryInformation} does not contain a byte count.

return
The byteCount value

        return getPropertyIntValue(PropertyIDMap.PID_BYTECOUNT);
    
public java.lang.StringgetCategory()

Returns the category (or null).

return
The category value

        return (String) getProperty(PropertyIDMap.PID_CATEGORY);
    
public java.lang.StringgetCompany()

Returns the company (or null).

return
The company value

        return (String) getProperty(PropertyIDMap.PID_COMPANY);
    
public org.apache.poi.hpsf.CustomPropertiesgetCustomProperties()

Gets the custom properties.

return
The custom properties.
since
2006-02-09

        CustomProperties cps = null;
        if (getSectionCount() >= 2)
        {
            cps = new CustomProperties();
            final Section section = (Section) getSections().get(1);
            final Map dictionary = section.getDictionary();
            final Property[] properties = section.getProperties();
            int propertyCount = 0;
            for (int i = 0; i < properties.length; i++)
            {
                final Property p = properties[i];
                final long id = p.getID();
                if (id != 0 && id != 1)
                {
                    propertyCount++;
                    final CustomProperty cp = new CustomProperty(p,
                            (String) dictionary.get(new Long(id)));
                    cps.put(cp.getName(), cp);
                }
            }
            if (cps.size() != propertyCount)
                cps.setPure(false);
        }
        return cps;
    
public byte[]getDocparts()

Returns the doc parts (or null) when this method is implemented. Please note that the return type is likely to change!

return
The doc parts value

        notYetImplemented("Reading byte arrays");
        return (byte[]) getProperty(PropertyIDMap.PID_DOCPARTS);
    
public byte[]getHeadingPair()

Returns the heading pair (or null) when this method is implemented. Please note that the return type is likely to change!

return
The heading pair value

        notYetImplemented("Reading byte arrays ");
        return (byte[]) getProperty(PropertyIDMap.PID_HEADINGPAIR);
    
public intgetHiddenCount()

Returns the hidden count or 0 if the {@link DocumentSummaryInformation} does not contain a hidden count.

return
The hidden count value

        return getPropertyIntValue(PropertyIDMap.PID_HIDDENCOUNT);
    
public intgetLineCount()

Returns the line count or 0 if the {@link DocumentSummaryInformation} does not contain a line count.

return
The line count value

        return getPropertyIntValue(PropertyIDMap.PID_LINECOUNT);
    
public booleangetLinksDirty()

Returns true if the custom links are dirty.

return
The links dirty value

        return getPropertyBooleanValue(PropertyIDMap.PID_LINKSDIRTY);
    
public intgetMMClipCount()

Returns the mmclip count or 0 if the {@link DocumentSummaryInformation} does not contain a mmclip count.

return
The mmclip count value

        return getPropertyIntValue(PropertyIDMap.PID_MMCLIPCOUNT);
    
public java.lang.StringgetManager()

Returns the manager (or null).

return
The manager value

        return (String) getProperty(PropertyIDMap.PID_MANAGER);
    
public intgetNoteCount()

Returns the note count or 0 if the {@link DocumentSummaryInformation} does not contain a note count.

return
The note count value

        return getPropertyIntValue(PropertyIDMap.PID_NOTECOUNT);
    
public intgetParCount()

Returns the par count or 0 if the {@link DocumentSummaryInformation} does not contain a par count.

return
The par count value

        return getPropertyIntValue(PropertyIDMap.PID_PARCOUNT);
    
public java.lang.StringgetPresentationFormat()

Returns the presentation format (or null).

return
The presentation format value

        return (String) getProperty(PropertyIDMap.PID_PRESFORMAT);
    
public booleangetScale()

Returns true when scaling of the thumbnail is desired, false if cropping is desired.

return
The scale value

        return getPropertyBooleanValue(PropertyIDMap.PID_SCALE);
    
public intgetSlideCount()

Returns the slide count or 0 if the {@link DocumentSummaryInformation} does not contain a slide count.

return
The slide count value

        return getPropertyIntValue(PropertyIDMap.PID_SLIDECOUNT);
    
private voidnotYetImplemented(java.lang.String msg)

Throws an {@link UnsupportedOperationException} with a message text telling which functionality is not yet implemented.

param
msg text telling was leaves to be implemented, e.g. "Reading byte arrays".

        throw new UnsupportedOperationException(msg + " is not yet implemented.");
    
public voidremoveByteCount()

Removes the byte count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_BYTECOUNT);
    
public voidremoveCategory()

Removes the category.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_CATEGORY);
    
public voidremoveCompany()

Removes the company.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_COMPANY);
    
public voidremoveCustomProperties()

Removes the custom properties.

since
2006-02-08

        if (getSectionCount() >= 2)
            getSections().remove(1);
        else
            throw new HPSFRuntimeException("Illegal internal format of Document SummaryInformation stream: second section is missing.");
    
public voidremoveDocparts()

Removes the doc parts.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_DOCPARTS);
    
public voidremoveHeadingPair()

Removes the heading pair.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_HEADINGPAIR);
    
public voidremoveHiddenCount()

Removes the hidden count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_HIDDENCOUNT);
    
public voidremoveLineCount()

Removes the line count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_LINECOUNT);
    
public voidremoveLinksDirty()

Removes the links dirty.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_LINKSDIRTY);
    
public voidremoveMMClipCount()

Removes the mmclip count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_MMCLIPCOUNT);
    
public voidremoveManager()

Removes the manager.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_MANAGER);
    
public voidremoveNoteCount()

Removes the noteCount.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_NOTECOUNT);
    
public voidremoveParCount()

Removes the par count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_PARCOUNT);
    
public voidremovePresentationFormat()

Removes the presentation format.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_PRESFORMAT);
    
public voidremoveScale()

Removes the scale.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_SCALE);
    
public voidremoveSlideCount()

Removes the slide count.

        final MutableSection s = (MutableSection) getFirstSection();
        s.removeProperty(PropertyIDMap.PID_SLIDECOUNT);
    
public voidsetByteCount(int byteCount)

Sets the byte count.

param
byteCount The byte count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_BYTECOUNT, byteCount);
    
public voidsetCategory(java.lang.String category)

Sets the category.

param
category The category to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_CATEGORY, category);
    
public voidsetCompany(java.lang.String company)

Sets the company.

param
company The company to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_COMPANY, company);
    
public voidsetCustomProperties(org.apache.poi.hpsf.CustomProperties customProperties)

Sets the custom properties.

param
customProperties The custom properties
since
2006-02-07

        ensureSection2();
        final MutableSection section = (MutableSection) getSections().get(1);
        final Map dictionary = customProperties.getDictionary();
        section.clear();

        /* Set the codepage. If both custom properties and section have a
         * codepage, the codepage from the custom properties wins, else take the
         * one that is defined. If none is defined, take Unicode. */
        int cpCodepage = customProperties.getCodepage();
        if (cpCodepage < 0)
            cpCodepage = section.getCodepage();
        if (cpCodepage < 0)
            cpCodepage = Constants.CP_UNICODE;
        customProperties.setCodepage(cpCodepage);
        section.setCodepage(cpCodepage);
        section.setDictionary(dictionary);
        for (final Iterator i = customProperties.values().iterator(); i.hasNext();)
        {
            final Property p = (Property) i.next();
            section.setProperty(p);
        }
    
public voidsetDocparts(byte[] docparts)

Sets the doc parts.

param
docparts The doc parts to set.

        notYetImplemented("Writing byte arrays");
    
public voidsetHeadingPair(byte[] headingPair)

Sets the heading pair.

param
headingPair The heading pair to set.

        notYetImplemented("Writing byte arrays ");
    
public voidsetHiddenCount(int hiddenCount)

Sets the hidden count.

param
hiddenCount The hidden count to set.

        final MutableSection s = (MutableSection) getSections().get(0);
        s.setProperty(PropertyIDMap.PID_HIDDENCOUNT, hiddenCount);
    
public voidsetLineCount(int lineCount)

Sets the line count.

param
lineCount The line count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_LINECOUNT, lineCount);
    
public voidsetLinksDirty(boolean linksDirty)

Sets the linksDirty.

param
linksDirty The links dirty value to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_LINKSDIRTY, linksDirty);
    
public voidsetMMClipCount(int mmClipCount)

Sets the mmclip count.

param
mmClipCount The mmclip count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_MMCLIPCOUNT, mmClipCount);
    
public voidsetManager(java.lang.String manager)

Sets the manager.

param
manager The manager to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_MANAGER, manager);
    
public voidsetNoteCount(int noteCount)

Sets the note count.

param
noteCount The note count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_NOTECOUNT, noteCount);
    
public voidsetParCount(int parCount)

Sets the par count.

param
parCount The par count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_PARCOUNT, parCount);
    
public voidsetPresentationFormat(java.lang.String presentationFormat)

Sets the presentation format.

param
presentationFormat The presentation format to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_PRESFORMAT, presentationFormat);
    
public voidsetScale(boolean scale)

Sets the scale.

param
scale The scale to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_SCALE, scale);
    
public voidsetSlideCount(int slideCount)

Sets the slideCount.

param
slideCount The slide count to set.

        final MutableSection s = (MutableSection) getFirstSection();
        s.setProperty(PropertyIDMap.PID_SLIDECOUNT, slideCount);