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>Convenience class representing a DocumentSummary Information stream in a 63 * Microsoft Office document.</p> 64 * 65 * @author Rainer Klute (klute@rainer-klute.de) 66 * @author Drew Varner (Drew.Varner closeTo sc.edu) 67 * @see SummaryInformation 68 * @version $Id: DocumentSummaryInformation.java,v 1.8 2002/12/10 06:15:19 klute Exp $ 69 * @since 2002-02-09 70 */ 71 public class DocumentSummaryInformation extends SpecialPropertySet 72 { 73 74 /** 75 * <p>Creates a {@link DocumentSummaryInformation} from a given 76 * {@link PropertySet}.</p> 77 * 78 * @param ps A property set which should be created from a 79 * document summary information stream. 80 * @throws UnexpectedPropertySetTypeException if <var>ps</var> 81 * does not contain a document summary information stream. 82 */ 83 public DocumentSummaryInformation(final PropertySet ps) 84 throws UnexpectedPropertySetTypeException 85 { 86 super(ps); 87 if (!isDocumentSummaryInformation()) 88 throw new UnexpectedPropertySetTypeException 89 ("Not a " + getClass().getName()); 90 } 91 92 93 94 /** 95 * <p>Returns the stream's category (or <code>null</code>).</p> 96 * 97 * @return The category value 98 */ 99 public String getCategory() 100 { 101 return (String) getProperty(PropertyIDMap.PID_CATEGORY); 102 } 103 104 105 106 /** 107 * <p>Returns the stream's presentation format (or 108 * <code>null</code>).</p> 109 * 110 * @return The presentationFormat value 111 */ 112 public String getPresentationFormat() 113 { 114 return (String) getProperty(PropertyIDMap.PID_PRESFORMAT); 115 } 116 117 118 119 /** 120 * <p>Returns the stream's byte count or 0 if the {@link 121 * DocumentSummaryInformation} does not contain a byte count.</p> 122 * 123 * @return The byteCount value 124 */ 125 public int getByteCount() 126 { 127 return getPropertyIntValue(PropertyIDMap.PID_BYTECOUNT); 128 } 129 130 131 132 /** 133 * <p>Returns the stream's line count or 0 if the {@link 134 * DocumentSummaryInformation} does not contain a line count.</p> 135 * 136 * @return The lineCount value 137 */ 138 public int getLineCount() 139 { 140 return getPropertyIntValue(PropertyIDMap.PID_LINECOUNT); 141 } 142 143 144 145 /** 146 * <p>Returns the stream's par count or 0 if the {@link 147 * DocumentSummaryInformation} does not contain a par count.</p> 148 * 149 * @return The parCount value 150 */ 151 public int getParCount() 152 { 153 return getPropertyIntValue(PropertyIDMap.PID_PARCOUNT); 154 } 155 156 157 158 /** 159 * <p>Returns the stream's slide count or 0 if the {@link 160 * DocumentSummaryInformation} does not contain a slide count.</p> 161 * 162 * @return The slideCount value 163 */ 164 public int getSlideCount() 165 { 166 return getPropertyIntValue(PropertyIDMap.PID_SLIDECOUNT); 167 } 168 169 170 171 /** 172 * <p>Returns the stream's note count or 0 if the {@link 173 * DocumentSummaryInformation} does not contain a note count.</p> 174 * 175 * @return The noteCount value 176 */ 177 public int getNoteCount() 178 { 179 return getPropertyIntValue(PropertyIDMap.PID_NOTECOUNT); 180 } 181 182 183 184 /** 185 * <p>Returns the stream's hidden count or 0 if the {@link 186 * DocumentSummaryInformation} does not contain a hidden 187 * count.</p> 188 * 189 * @return The hiddenCount value 190 */ 191 public int getHiddenCount() 192 { 193 return getPropertyIntValue(PropertyIDMap.PID_HIDDENCOUNT); 194 } 195 196 197 198 /** 199 * <p>Returns the stream's mmclip count or 0 if the {@link 200 * DocumentSummaryInformation} does not contain a mmclip 201 * count.</p> 202 * 203 * @return The mMClipCount value 204 */ 205 public int getMMClipCount() 206 { 207 return getPropertyIntValue(PropertyIDMap.PID_MMCLIPCOUNT); 208 } 209 210 211 212 /** 213 * <p>Returns <code>true</code> when scaling of the thumbnail is 214 * desired, <code>false</code> if cropping is desired.</p> 215 * 216 * @return The scale value 217 */ 218 public boolean getScale() 219 { 220 return getPropertyBooleanValue(PropertyIDMap.PID_SCALE); 221 } 222 223 224 225 /** 226 * <p>Returns the stream's heading pair (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 * @return The headingPair value 231 */ 232 public byte[] getHeadingPair() 233 { 234 if (true) 235 throw new UnsupportedOperationException("FIXME"); 236 return (byte[]) getProperty(PropertyIDMap.PID_HEADINGPAIR); 237 } 238 239 240 241 /** 242 * <p>Returns the stream's doc parts (or <code>null</code>) 243 * <strong>when this method is implemented. Please note that the 244 * return type is likely to change!</strong> 245 * 246 * @return The docparts value 247 */ 248 public byte[] getDocparts() 249 { 250 if (true) 251 throw new UnsupportedOperationException("FIXME"); 252 return (byte[]) getProperty(PropertyIDMap.PID_DOCPARTS); 253 } 254 255 256 257 /** 258 * <p>Returns the stream's manager (or <code>null</code>).</p> 259 * 260 * @return The manager value 261 */ 262 public String getManager() 263 { 264 return (String) getProperty(PropertyIDMap.PID_MANAGER); 265 } 266 267 268 269 /** 270 * <p>Returns the stream's company (or <code>null</code>).</p> 271 * 272 * @return The company value 273 */ 274 public String getCompany() 275 { 276 return (String) getProperty(PropertyIDMap.PID_COMPANY); 277 } 278 279 280 281 /** 282 * <p>Returns <code>true</code> if the custom links are hampered 283 * by excessive noise, for all applications.</p> <p> 284 * 285 * <strong>FIXME:</strong> Explain this some more! I (Rainer) 286 * don't understand it.</p> 287 * 288 * @return The linksDirty value 289 */ 290 public boolean getLinksDirty() 291 { 292 return getPropertyBooleanValue(PropertyIDMap.PID_LINKSDIRTY); 293 } 294 295 } 296