1 /* ==================================================================== 2 * The Apache Software License, Version 1.1 3 * 4 * Copyright (c) 2000 The Apache Software Foundation. All rights 5 * reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in 16 * the documentation and/or other materials provided with the 17 * distribution. 18 * 19 * 3. The end-user documentation included with the redistribution, 20 * if any, must include the following acknowledgment: 21 * "This product includes software developed by the 22 * Apache Software Foundation (http://www.apache.org/)." 23 * Alternately, this acknowledgment may appear in the software itself, 24 * if and wherever such third-party acknowledgments normally appear. 25 * 26 * 4. The names "Apache" and "Apache Software Foundation" must 27 * not be used to endorse or promote products derived from this 28 * software without prior written permission. For written 29 * permission, please contact apache@apache.org. 30 * 31 * 5. Products derived from this software may not be called "Apache", 32 * nor may "Apache" appear in their name, without prior written 33 * permission of the Apache Software Foundation. 34 * 35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 * SUCH DAMAGE. 47 * ==================================================================== 48 * 49 * This software consists of voluntary contributions made by many 50 * individuals on behalf of the Apache Software Foundation. For more 51 * information on the Apache Software Foundation, please see 52 * <http://www.apache.org/>. 53 * 54 * Portions of this software are based upon public domain software 55 * originally written at the National Center for Supercomputing Applications, 56 * University of Illinois, Urbana-Champaign. 57 */ 58 59 package org.apache.poi.hpsf; 60 61 import java.io.*; 62 import java.util.*; 63 import org.apache.poi.hpsf.wellknown.*; 64 65 /** 66 * <p>Convenience class representing a DocumentSummary Information 67 * stream in a Microsoft Office document.</p> 68 * 69 * @see SummaryInformation 70 * 71 * @author Rainer Klute (klute@rainer-klute.de) 72 * @version $Id: DocumentSummaryInformation.java,v 1.1 2002/02/14 04:00:59 mjohnson Exp $ 73 * @since 2002-02-09 74 */ 75 public class DocumentSummaryInformation extends SpecialPropertySet 76 { 77 78 /** 79 * <p>Creates a {@link DocumentSummaryInformation} from a given 80 * {@link PropertySet}.</p> 81 * 82 * @param ps A property set which should be created from a 83 * document summary information stream. 84 * 85 * @throws UnexpectedPropertySetTypeException if <var>ps</var> 86 * does not contain a document summary information stream. 87 */ 88 public DocumentSummaryInformation(final PropertySet ps) 89 throws UnexpectedPropertySetTypeException 90 { 91 super(ps); 92 if (!isDocumentSummaryInformation()) 93 throw new UnexpectedPropertySetTypeException 94 ("Not a " + getClass().getName()); 95 } 96 97 98 99 /** 100 * <p>Returns the stream's category (or <code>null</code>).</p> 101 */ 102 public String getCategory() 103 { 104 return (String) getProperty(PropertyIDMap.PID_CATEGORY); 105 } 106 107 108 109 /** 110 * <p>Returns the stream's presentation format (or 111 * <code>null</code>).</p> 112 */ 113 public String getPresentationFormat() 114 { 115 return (String) getProperty(PropertyIDMap.PID_PRESFORMAT); 116 } 117 118 119 120 /** 121 * <p>Returns the stream's byte count or 0 if the {@link 122 * DocumentSummaryInformation} does not contain a byte count.</p> 123 */ 124 public int getByteCount() 125 { 126 return getPropertyIntValue(PropertyIDMap.PID_BYTECOUNT); 127 } 128 129 130 131 /** 132 * <p>Returns the stream's line count or 0 if the {@link 133 * DocumentSummaryInformation} does not contain a line count.</p> 134 */ 135 public int getLineCount() 136 { 137 return getPropertyIntValue(PropertyIDMap.PID_LINECOUNT); 138 } 139 140 141 142 /** 143 * <p>Returns the stream's par count or 0 if the {@link 144 * DocumentSummaryInformation} does not contain a par count.</p> 145 */ 146 public int getParCount() 147 { 148 return getPropertyIntValue(PropertyIDMap.PID_PARCOUNT); 149 } 150 151 152 153 /** 154 * <p>Returns the stream's slide count or 0 if the {@link 155 * DocumentSummaryInformation} does not contain a slide count.</p> 156 */ 157 public int getSlideCount() 158 { 159 return getPropertyIntValue(PropertyIDMap.PID_SLIDECOUNT); 160 } 161 162 163 164 /** 165 * <p>Returns the stream's note count or 0 if the {@link 166 * DocumentSummaryInformation} does not contain a note count.</p> 167 */ 168 public int getNoteCount() 169 { 170 return getPropertyIntValue(PropertyIDMap.PID_NOTECOUNT); 171 } 172 173 174 175 /** 176 * <p>Returns the stream's hidden count or 0 if the {@link 177 * DocumentSummaryInformation} does not contain a hidden count.</p> 178 */ 179 public int getHiddenCount() 180 { 181 return getPropertyIntValue(PropertyIDMap.PID_HIDDENCOUNT); 182 } 183 184 185 186 /** 187 * <p>Returns the stream's mmclip count or 0 if the {@link 188 * DocumentSummaryInformation} does not contain a mmclip count.</p> 189 */ 190 public int getMMClipCount() 191 { 192 return getPropertyIntValue(PropertyIDMap.PID_MMCLIPCOUNT); 193 } 194 195 196 197 /** 198 * <p>Returns the stream's scale (or <code>null</code>) 199 * <strong>when this method is implemented. Please note that the 200 * return type is likely to change!</strong> 201 */ 202 public byte[] getScale() 203 { 204 if (true) 205 throw new UnsupportedOperationException("FIXME"); 206 return (byte[]) getProperty(PropertyIDMap.PID_SCALE); 207 } 208 209 210 211 /** 212 * <p>Returns the stream's heading pair (or <code>null</code>) 213 * <strong>when this method is implemented. Please note that the 214 * return type is likely to change!</strong> 215 */ 216 public byte[] getHeadingPair() 217 { 218 if (true) 219 throw new UnsupportedOperationException("FIXME"); 220 return (byte[]) getProperty(PropertyIDMap.PID_HEADINGPAIR); 221 } 222 223 224 225 /** 226 * <p>Returns the stream's doc parts (or <code>null</code>) 227 * <strong>when this method is implemented. Please note that the 228 * return type is likely to change!</strong> 229 */ 230 public byte[] getDocparts() 231 { 232 if (true) 233 throw new UnsupportedOperationException("FIXME"); 234 return (byte[]) getProperty(PropertyIDMap.PID_DOCPARTS); 235 } 236 237 238 239 /** 240 * <p>Returns the stream's manager (or <code>null</code>).</p> 241 */ 242 public String getManager() 243 { 244 return (String) getProperty(PropertyIDMap.PID_MANAGER); 245 } 246 247 248 249 /** 250 * <p>Returns the stream's company (or <code>null</code>).</p> 251 */ 252 public String getCompany() 253 { 254 return (String) getProperty(PropertyIDMap.PID_COMPANY); 255 } 256 257 258 259 /** 260 * <p>Returns the stream's links dirty (or <code>null</code>) 261 * <strong>when this method is implemented. Please note that the 262 * return type is likely to change!</strong> 263 */ 264 public byte[] getLinksDirty() 265 { 266 if (true) 267 throw new UnsupportedOperationException("FIXME"); 268 return (byte[]) getProperty(PropertyIDMap.PID_LINKSDIRTY); 269 } 270 271 } 272