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