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