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

org.apache.poi.hpsf.wellknown.PropertyIDMap Maven / Gradle / Ivy

There is a newer version: 3.1-FINAL
Show newest version
/* ====================================================================
   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.wellknown;

import java.util.*;

/**
 * 

This is a dictionary which maps property ID values to property * ID strings.

* *

The methods {@link #getSummaryInformationProperties} and {@link * #getDocumentSummaryInformationProperties} return singleton {@link * PropertyIDMap}s. An application that wants to extend these maps * should treat them as unmodifiable, copy them and modifiy the * copies.

* *

FIXME: Make the singletons * unmodifiable. However, since this requires to use a {@link HashMap} * delegate instead of extending {@link HashMap} and thus requires a * lot of stupid typing. I won't do that for the time being.

* * @author Rainer Klute ([email protected]) * @version $Id: PropertyIDMap.java,v 1.7.4.1 2004/02/22 11:54:46 glens Exp $ * @since 2002-02-09 */ public class PropertyIDMap extends HashMap { /* * The following definitions are for property IDs in the first * (and only) section of the Summary Information property set. */ public final static int PID_TITLE = 2; public final static int PID_SUBJECT = 3; public final static int PID_AUTHOR = 4; public final static int PID_KEYWORDS = 5; public final static int PID_COMMENTS = 6; public final static int PID_TEMPLATE = 7; public final static int PID_LASTAUTHOR = 8; public final static int PID_REVNUMBER = 9; public final static int PID_EDITTIME = 10; public final static int PID_LASTPRINTED = 11; public final static int PID_CREATE_DTM = 12; public final static int PID_LASTSAVE_DTM = 13; public final static int PID_PAGECOUNT = 14; public final static int PID_WORDCOUNT = 15; public final static int PID_CHARCOUNT = 16; public final static int PID_THUMBNAIL = 17; public final static int PID_APPNAME = 18; public final static int PID_SECURITY = 19; /* * The following definitions are for property IDs in the first * section of the Document Summary Information property set. */ /** *

The entry is a dictionary.

*/ public final static int PID_DICTIONARY = 0; /** *

The entry denotes a code page.

*/ public final static int PID_CODEPAGE = 1; /** *

The entry is a string denoting the category the file belongs * to, e.g. review, memo, etc. This is useful to find documents of * same type.

*/ public final static int PID_CATEGORY = 2; /** *

Target format for power point presentation, e.g. 35mm, * printer, video etc.

*/ public final static int PID_PRESFORMAT = 3; /** *

Number of bytes.

*/ public final static int PID_BYTECOUNT = 4; /** *

Number of lines.

*/ public final static int PID_LINECOUNT = 5; /** *

Number of paragraphs.

*/ public final static int PID_PARCOUNT = 6; /** *

Number of slides in a power point presentation.

*/ public final static int PID_SLIDECOUNT = 7; /** *

Number of slides with notes.

*/ public final static int PID_NOTECOUNT = 8; /** *

Number of hidden slides.

*/ public final static int PID_HIDDENCOUNT = 9; /** *

Number of multimedia clips, e.g. sound or video.

*/ public final static int PID_MMCLIPCOUNT = 10; /** *

This entry is set to -1 when scaling of the thumbnail is * desired. Otherwise the thumbnail should be cropped.

*/ public final static int PID_SCALE = 11; /** *

This entry denotes an internally used property. It is a * vector of variants consisting of pairs of a string (VT_LPSTR) * and a number (VT_I4). The string is a heading name, and the * number tells how many document parts are under that * heading.

*/ public final static int PID_HEADINGPAIR = 12; /** *

This entry contains the names of document parts (word: names * of the documents in the master document, excel: sheet names, * power point: slide titles, binder: document names).

*/ public final static int PID_DOCPARTS = 13; /** *

This entry contains the name of the project manager.

*/ public final static int PID_MANAGER = 14; /** *

This entry contains the company name.

*/ public final static int PID_COMPANY = 15; /** *

If this entry is -1 the links are dirty and should be * re-evaluated.

*/ public final static int PID_LINKSDIRTY = 16; /** *

Contains the summary information property ID values and * associated strings. See the overall HPSF documentation for * details!

*/ private static PropertyIDMap summaryInformationProperties; /** *

Contains the summary information property ID values and * associated strings. See the overall HPSF documentation for * details!

*/ private static PropertyIDMap documentSummaryInformationProperties; /** *

Creates a {@link PropertyIDMap}.

*/ public PropertyIDMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } /** *

Puts a ID string for an ID into the {@link * PropertyIDMap}.

* * @param id The ID. * @param idString The ID string. * @return As specified by the {@link Map} interface, this method * returns the previous value associated with the specified * id, or null if there was no mapping for * key. */ public Object put(int id, String idString) { return put(new Integer(id), idString); } /** *

Gets the ID string for an ID from the {@link * PropertyIDMap}.

* * @param id The ID. * @return The ID string associated with id. */ public Object get(int id) { return get(new Integer(id)); } /** *

Returns the Summary Information properties singleton.

*/ public static PropertyIDMap getSummaryInformationProperties() { if (summaryInformationProperties == null) { PropertyIDMap m = new PropertyIDMap(18, (float) 1.0); m.put(PID_TITLE, "PID_TITLE"); m.put(PID_SUBJECT, "PID_SUBJECT"); m.put(PID_AUTHOR, "PID_AUTHOR"); m.put(PID_KEYWORDS, "PID_KEYWORDS"); m.put(PID_COMMENTS, "PID_COMMENTS"); m.put(PID_TEMPLATE, "PID_TEMPLATE"); m.put(PID_LASTAUTHOR, "PID_LASTAUTHOR"); m.put(PID_REVNUMBER, "PID_REVNUMBER"); m.put(PID_EDITTIME, "PID_EDITTIME"); m.put(PID_LASTPRINTED, "PID_LASTPRINTED"); m.put(PID_CREATE_DTM, "PID_CREATE_DTM"); m.put(PID_LASTSAVE_DTM, "PID_LASTSAVE_DTM"); m.put(PID_PAGECOUNT, "PID_PAGECOUNT"); m.put(PID_WORDCOUNT, "PID_WORDCOUNT"); m.put(PID_CHARCOUNT, "PID_CHARCOUNT"); m.put(PID_THUMBNAIL, "PID_THUMBNAIL"); m.put(PID_APPNAME, "PID_APPNAME"); m.put(PID_SECURITY, "PID_SECURITY"); summaryInformationProperties = m; } return summaryInformationProperties; } /** *

Returns the Document Summary Information properties * singleton.

* * @return The Document Summary Information properties singleton. */ public static PropertyIDMap getDocumentSummaryInformationProperties() { if (documentSummaryInformationProperties == null) { PropertyIDMap m = new PropertyIDMap(17, (float) 1.0); m.put(PID_DICTIONARY, "PID_DICTIONARY"); m.put(PID_CODEPAGE, "PID_CODEPAGE"); m.put(PID_CATEGORY, "PID_CATEGORY"); m.put(PID_PRESFORMAT, "PID_PRESFORMAT"); m.put(PID_BYTECOUNT, "PID_BYTECOUNT"); m.put(PID_LINECOUNT, "PID_LINECOUNT"); m.put(PID_PARCOUNT, "PID_PARCOUNT"); m.put(PID_SLIDECOUNT, "PID_SLIDECOUNT"); m.put(PID_NOTECOUNT, "PID_NOTECOUNT"); m.put(PID_HIDDENCOUNT, "PID_HIDDENCOUNT"); m.put(PID_MMCLIPCOUNT, "PID_MMCLIPCOUNT"); m.put(PID_SCALE, "PID_SCALE"); m.put(PID_HEADINGPAIR, "PID_HEADINGPAIR"); m.put(PID_DOCPARTS, "PID_DOCPARTS"); m.put(PID_MANAGER, "PID_MANAGER"); m.put(PID_COMPANY, "PID_COMPANY"); m.put(PID_LINKSDIRTY, "PID_LINKSDIRTY"); documentSummaryInformationProperties = m; } return documentSummaryInformationProperties; } /** *

For the most basic testing.

*/ public static void main(String args[]) { PropertyIDMap s1 = getSummaryInformationProperties(); PropertyIDMap s2 = getDocumentSummaryInformationProperties(); System.out.println("s1: " + s1); System.out.println("s2: " + s2); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy