All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.poi.hpsf.SummaryInformation Maven / Gradle / Ivy

/* ====================================================================
   Copyright 2002-2004   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.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */

package org.apache.poi.hpsf;

import java.io.*;
import java.util.*;
import org.apache.poi.hpsf.wellknown.*;

/**
 * 

Convenience class representing a Summary Information stream in a * Microsoft Office document.

* *

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgu_8910.asp * for documentation from That Redmond Company.

* * @author Rainer Klute ([email protected]) * @see DocumentSummaryInformation * @version $Id: SummaryInformation.java,v 1.10.4.1 2004/02/22 11:54:45 glens Exp $ * @since 2002-02-09 */ public class SummaryInformation extends SpecialPropertySet { /** *

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

*/ public static final String DEFAULT_STREAM_NAME = "\005SummaryInformation"; /** *

Creates a {@link SummaryInformation} from a given {@link * PropertySet}.

* * @param ps A property set which should be created from a summary * information stream. * @throws UnexpectedPropertySetTypeException if ps * does not contain a summary information stream. */ public SummaryInformation(final PropertySet ps) throws UnexpectedPropertySetTypeException { super(ps); if (!isSummaryInformation()) throw new UnexpectedPropertySetTypeException ("Not a " + getClass().getName()); } /** *

Returns the stream's title (or null).

* * @return The title or null */ public String getTitle() { return (String) getProperty(PropertyIDMap.PID_TITLE); } /** *

Returns the stream's subject (or null).

* * @return The subject or null */ public String getSubject() { return (String) getProperty(PropertyIDMap.PID_SUBJECT); } /** *

Returns the stream's author (or null).

* * @return The author or null */ public String getAuthor() { return (String) getProperty(PropertyIDMap.PID_AUTHOR); } /** *

Returns the stream's keywords (or null).

* * @return The keywords or null */ public String getKeywords() { return (String) getProperty(PropertyIDMap.PID_KEYWORDS); } /** *

Returns the stream's comments (or null).

* * @return The comments or null */ public String getComments() { return (String) getProperty(PropertyIDMap.PID_COMMENTS); } /** *

Returns the stream's template (or null).

* * @return The template or null */ public String getTemplate() { return (String) getProperty(PropertyIDMap.PID_TEMPLATE); } /** *

Returns the stream's last author (or null).

* * @return The last author or null */ public String getLastAuthor() { return (String) getProperty(PropertyIDMap.PID_LASTAUTHOR); } /** *

Returns the stream's revision number (or * null).

* * @return The revision number or null */ public String getRevNumber() { return (String) getProperty(PropertyIDMap.PID_REVNUMBER); } /** *

Returns the stream's edit time (or null).

* * @return The edit time or null */ public Date getEditTime() { return (Date) getProperty(PropertyIDMap.PID_EDITTIME); } /** *

Returns the stream's last printed time (or * null).

* * @return The last printed time or null */ public Date getLastPrinted() { return (Date) getProperty(PropertyIDMap.PID_LASTPRINTED); } /** *

Returns the stream's creation time (or * null).

* * @return The creation time or null */ public Date getCreateDateTime() { return (Date) getProperty(PropertyIDMap.PID_CREATE_DTM); } /** *

Returns the stream's last save time (or * null).

* * @return The last save time or null */ public Date getLastSaveDateTime() { return (Date) getProperty(PropertyIDMap.PID_LASTSAVE_DTM); } /** *

Returns the stream's page count or 0 if the {@link * SummaryInformation} does not contain a page count.

* * @return The page count or null */ public int getPageCount() { return getPropertyIntValue(PropertyIDMap.PID_PAGECOUNT); } /** *

Returns the stream's word count or 0 if the {@link * SummaryInformation} does not contain a word count.

* * @return The word count or null */ public int getWordCount() { return getPropertyIntValue(PropertyIDMap.PID_WORDCOUNT); } /** *

Returns the stream's character count or 0 if the {@link * SummaryInformation} does not contain a char count.

* * @return The character count or null */ public int getCharCount() { return getPropertyIntValue(PropertyIDMap.PID_CHARCOUNT); } /** *

Returns the stream's thumbnail (or null) * when this method is implemented. Please note that the * return type is likely to change!

* *

FIXME / Hint to developers: Drew Varner * <Drew.Varner -at- sc.edu> said that this is an image in * WMF or Clipboard (BMP?) format. He also provided two links that * might be helpful: http://www.csn.ul.ie/~caolan/publink/file/OLE2SummaryAgainst_file-3.27.patch * and http://msdn.microsoft.com/library/en-us/dno97ta/html/msdn_docprop.asp * . However, we won't do any conversion into any image type * but instead just return a byte array.

* * @return The thumbnail or null */ public byte[] getThumbnail() { return (byte[]) getProperty(PropertyIDMap.PID_THUMBNAIL); } /** *

Returns the stream's application name (or * null).

* * @return The application name or null */ public String getApplicationName() { return (String) getProperty(PropertyIDMap.PID_APPNAME); } /** *

Returns a security code which is one of the following * values:

* *
    *
  • *

    0 if the {@link SummaryInformation} does not contain a * security field or if there is no security on the * document. Use {@link #wasNull} to distinguish between the * two cases!

    *
  • * *
  • *

    1 if the document is password protected

    *
  • * *
  • *

    2 if the document is read-only recommended

    *
  • * *
  • *

    4 if the document is read-only enforced

    *
  • * *
  • *

    8 if the document is locked for annotations

    *
  • * *
* * @return The security code or null */ public int getSecurity() { return getPropertyIntValue(PropertyIDMap.PID_SECURITY); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy