1 2 17 18 package org.apache.poi.hpsf; 19 20 import java.util.HashMap ; 21 import java.util.Iterator ; 22 import java.util.Map ; 23 24 import org.apache.poi.hpsf.wellknown.PropertyIDMap; 25 26 38 public class DocumentSummaryInformation extends SpecialPropertySet 39 { 40 41 45 public static final String DEFAULT_STREAM_NAME = 46 "\005DocumentSummaryInformation"; 47 48 49 50 59 public DocumentSummaryInformation(final PropertySet ps) 60 throws UnexpectedPropertySetTypeException 61 { 62 super(ps); 63 if (!isDocumentSummaryInformation()) 64 throw new UnexpectedPropertySetTypeException 65 ("Not a " + getClass().getName()); 66 } 67 68 69 70 75 public String getCategory() 76 { 77 return (String ) getProperty(PropertyIDMap.PID_CATEGORY); 78 } 79 80 81 82 88 public String getPresentationFormat() 89 { 90 return (String ) getProperty(PropertyIDMap.PID_PRESFORMAT); 91 } 92 93 94 95 101 public int getByteCount() 102 { 103 return getPropertyIntValue(PropertyIDMap.PID_BYTECOUNT); 104 } 105 106 107 108 114 public int getLineCount() 115 { 116 return getPropertyIntValue(PropertyIDMap.PID_LINECOUNT); 117 } 118 119 120 121 127 public int getParCount() 128 { 129 return getPropertyIntValue(PropertyIDMap.PID_PARCOUNT); 130 } 131 132 133 134 140 public int getSlideCount() 141 { 142 return getPropertyIntValue(PropertyIDMap.PID_SLIDECOUNT); 143 } 144 145 146 147 153 public int getNoteCount() 154 { 155 return getPropertyIntValue(PropertyIDMap.PID_NOTECOUNT); 156 } 157 158 159 160 167 public int getHiddenCount() 168 { 169 return getPropertyIntValue(PropertyIDMap.PID_HIDDENCOUNT); 170 } 171 172 173 174 181 public int getMMClipCount() 182 { 183 return getPropertyIntValue(PropertyIDMap.PID_MMCLIPCOUNT); 184 } 185 186 187 188 194 public boolean getScale() 195 { 196 return getPropertyBooleanValue(PropertyIDMap.PID_SCALE); 197 } 198 199 200 201 208 public byte[] getHeadingPair() 209 { 210 if (true) 211 throw new UnsupportedOperationException ("FIXME"); 212 return (byte[]) getProperty(PropertyIDMap.PID_HEADINGPAIR); 213 } 214 215 216 217 224 public byte[] getDocparts() 225 { 226 if (true) 227 throw new UnsupportedOperationException ("FIXME"); 228 return (byte[]) getProperty(PropertyIDMap.PID_DOCPARTS); 229 } 230 231 232 233 238 public String getManager() 239 { 240 return (String ) getProperty(PropertyIDMap.PID_MANAGER); 241 } 242 243 244 245 250 public String getCompany() 251 { 252 return (String ) getProperty(PropertyIDMap.PID_COMPANY); 253 } 254 255 256 257 262 public boolean getLinksDirty() 263 { 264 return getPropertyBooleanValue(PropertyIDMap.PID_LINKSDIRTY); 265 } 266 267 268 269 276 public Map getCustomProperties() 277 { 278 Map nameToValue = null; 279 if (getSectionCount() >= 2) 280 { 281 final Section section = (Section) getSections().get(1); 282 final Map pidToName = 283 (Map ) section.getProperty(PropertyIDMap.PID_DICTIONARY); 284 if (pidToName != null) 285 { 286 nameToValue = new HashMap (pidToName.size()); 287 for (Iterator i = pidToName.entrySet().iterator(); i.hasNext();) 288 { 289 final Map.Entry e = (Map.Entry ) i.next(); 290 final long pid = ((Number ) e.getKey()).longValue(); 291 nameToValue.put(e.getValue(), section.getProperty(pid)); 292 } 293 } 294 } 295 return nameToValue; 296 } 297 298 } 299 | Popular Tags |