You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RecordTypes.java 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hslf.record;
  16. import java.util.HashMap;
  17. import java.util.Map;
  18. /**
  19. * List of all known record types in a PowerPoint document, and the
  20. * classes that handle them.
  21. * There are two categories of records:
  22. * <li> PowerPoint records: 0 <= info <= 10002 (will carry class info)
  23. * <li> Escher records: info >= 0xF000 (handled by DDF, so no class info)
  24. */
  25. public enum RecordTypes {
  26. Unknown(0,null),
  27. UnknownRecordPlaceholder(-1, UnknownRecordPlaceholder::new),
  28. Document(1000,Document::new),
  29. DocumentAtom(1001,DocumentAtom::new),
  30. EndDocument(1002,null),
  31. Slide(1006,Slide::new),
  32. SlideAtom(1007,SlideAtom::new),
  33. Notes(1008,Notes::new),
  34. NotesAtom(1009,NotesAtom::new),
  35. Environment(1010,Environment::new),
  36. SlidePersistAtom(1011,SlidePersistAtom::new),
  37. SSlideLayoutAtom(1015,null),
  38. MainMaster(1016,MainMaster::new),
  39. SSSlideInfoAtom(1017,SSSlideInfoAtom::new),
  40. SlideViewInfo(1018,null),
  41. GuideAtom(1019,null),
  42. ViewInfo(1020,null),
  43. ViewInfoAtom(1021,null),
  44. SlideViewInfoAtom(1022,null),
  45. VBAInfo(1023,VBAInfoContainer::new),
  46. VBAInfoAtom(1024,VBAInfoAtom::new),
  47. SSDocInfoAtom(1025,null),
  48. Summary(1026,null),
  49. DocRoutingSlip(1030,null),
  50. OutlineViewInfo(1031,null),
  51. SorterViewInfo(1032,null),
  52. ExObjList(1033,ExObjList::new),
  53. ExObjListAtom(1034,ExObjListAtom::new),
  54. PPDrawingGroup(1035,PPDrawingGroup::new),
  55. PPDrawing(1036,PPDrawing::new),
  56. NamedShows(1040,null),
  57. NamedShow(1041,null),
  58. NamedShowSlides(1042,null),
  59. SheetProperties(1044,null),
  60. RoundTripCustomTableStyles12Atom(1064,null),
  61. List(2000,DocInfoListContainer::new),
  62. FontCollection(2005,FontCollection::new),
  63. BookmarkCollection(2019,null),
  64. SoundCollection(2020,SoundCollection::new),
  65. SoundCollAtom(2021,null),
  66. Sound(2022,Sound::new),
  67. SoundData(2023,SoundData::new),
  68. BookmarkSeedAtom(2025,null),
  69. ColorSchemeAtom(2032,ColorSchemeAtom::new),
  70. ExObjRefAtom(3009,ExObjRefAtom::new),
  71. OEPlaceholderAtom(3011,OEPlaceholderAtom::new),
  72. GPopublicintAtom(3024,null),
  73. GRatioAtom(3031,null),
  74. OutlineTextRefAtom(3998,OutlineTextRefAtom::new),
  75. TextHeaderAtom(3999,TextHeaderAtom::new),
  76. TextCharsAtom(4000,TextCharsAtom::new),
  77. StyleTextPropAtom(4001, StyleTextPropAtom::new),//0x0fa1 RT_StyleTextPropAtom
  78. MasterTextPropAtom(4002, MasterTextPropAtom::new),
  79. TxMasterStyleAtom(4003,TxMasterStyleAtom::new),
  80. TxCFStyleAtom(4004,null),
  81. TxPFStyleAtom(4005,null),
  82. TextRulerAtom(4006,TextRulerAtom::new),
  83. TextBookmarkAtom(4007,null),
  84. TextBytesAtom(4008,TextBytesAtom::new),
  85. TxSIStyleAtom(4009,null),
  86. TextSpecInfoAtom(4010, TextSpecInfoAtom::new),
  87. DefaultRulerAtom(4011,null),
  88. StyleTextProp9Atom(4012, StyleTextProp9Atom::new), //0x0FAC RT_StyleTextProp9Atom
  89. FontEntityAtom(4023,FontEntityAtom::new),
  90. FontEmbeddedData(4024,null),
  91. CString(4026,CString::new),
  92. MetaFile(4033,null),
  93. ExOleObjAtom(4035,ExOleObjAtom::new),
  94. SrKinsoku(4040,null),
  95. HandOut(4041,DummyPositionSensitiveRecordWithChildren::new),
  96. ExEmbed(4044,ExEmbed::new),
  97. ExEmbedAtom(4045,ExEmbedAtom::new),
  98. ExLink(4046,null),
  99. BookmarkEntityAtom(4048,null),
  100. ExLinkAtom(4049,null),
  101. SrKinsokuAtom(4050,null),
  102. ExHyperlinkAtom(4051,ExHyperlinkAtom::new),
  103. ExHyperlink(4055,ExHyperlink::new),
  104. SlideNumberMCAtom(4056,null),
  105. HeadersFooters(4057,HeadersFootersContainer::new),
  106. HeadersFootersAtom(4058,HeadersFootersAtom::new),
  107. TxInteractiveInfoAtom(4063,TxInteractiveInfoAtom::new),
  108. CharFormatAtom(4066,null),
  109. ParaFormatAtom(4067,null),
  110. RecolorInfoAtom(4071,null),
  111. ExQuickTimeMovie(4074,null),
  112. ExQuickTimeMovieData(4075,null),
  113. ExControl(4078,ExControl::new),
  114. SlideListWithText(4080,SlideListWithText::new),
  115. InteractiveInfo(4082,InteractiveInfo::new),
  116. InteractiveInfoAtom(4083,InteractiveInfoAtom::new),
  117. UserEditAtom(4085,UserEditAtom::new),
  118. CurrentUserAtom(4086,null),
  119. DateTimeMCAtom(4087,null),
  120. GenericDateMCAtom(4088,null),
  121. FooterMCAtom(4090,null),
  122. ExControlAtom(4091,ExControlAtom::new),
  123. ExMediaAtom(4100,ExMediaAtom::new),
  124. ExVideoContainer(4101,ExVideoContainer::new),
  125. ExAviMovie(4102,ExAviMovie::new),
  126. ExMCIMovie(4103,ExMCIMovie::new),
  127. ExMIDIAudio(4109,null),
  128. ExCDAudio(4110,null),
  129. ExWAVAudioEmbedded(4111,null),
  130. ExWAVAudioLink(4112,null),
  131. ExOleObjStg(4113,ExOleObjStg::new),
  132. ExCDAudioAtom(4114,null),
  133. ExWAVAudioEmbeddedAtom(4115,null),
  134. AnimationInfo(4116,AnimationInfo::new),
  135. AnimationInfoAtom(4081,AnimationInfoAtom::new),
  136. RTFDateTimeMCAtom(4117,null),
  137. ProgTags(5000,DummyPositionSensitiveRecordWithChildren::new),
  138. ProgStringTag(5001,null),
  139. ProgBinaryTag(5002,DummyPositionSensitiveRecordWithChildren::new),
  140. BinaryTagData(5003, BinaryTagDataBlob::new),//0x138b RT_BinaryTagDataBlob
  141. PrpublicintOptions(6000,null),
  142. PersistPtrFullBlock(6001,PersistPtrHolder::new),
  143. PersistPtrIncrementalBlock(6002,PersistPtrHolder::new),
  144. GScalingAtom(10001,null),
  145. GRColorAtom(10002,null),
  146. // Records ~12000 seem to be related to the Comments used in PPT 2000/XP
  147. // (Comments in PPT97 are normal Escher text boxes)
  148. Comment2000(12000,Comment2000::new),
  149. Comment2000Atom(12001,Comment2000Atom::new),
  150. Comment2000Summary(12004,null),
  151. Comment2000SummaryAtom(12005,null),
  152. // Records ~12050 seem to be related to Document Encryption
  153. DocumentEncryptionAtom(12052,DocumentEncryptionAtom::new),
  154. OriginalMainMasterId(1052,null),
  155. CompositeMasterId(1052,null),
  156. RoundTripContentMasterInfo12(1054,null),
  157. RoundTripShapeId12(1055,null),
  158. RoundTripHFPlaceholder12(1056,RoundTripHFPlaceholder12::new),
  159. RoundTripContentMasterId(1058,null),
  160. RoundTripOArtTextStyles12(1059,null),
  161. RoundTripShapeCheckSumForCustomLayouts12(1062,null),
  162. RoundTripNotesMasterTextStyles12(1063,null),
  163. RoundTripCustomTableStyles12(1064,null),
  164. // records greater then 0xF000 belong to with Microsoft Office Drawing format also known as Escher
  165. EscherDggContainer(0xF000,null),
  166. EscherDgg(0xf006,null),
  167. EscherCLSID(0xf016,null),
  168. EscherOPT(0xf00b,null),
  169. EscherBStoreContainer(0xf001,null),
  170. EscherBSE(0xf007,null),
  171. EscherBlip_START(0xf018,null),
  172. EscherBlip_END(0xf117,null),
  173. EscherDgContainer(0xf002,null),
  174. EscherDg(0xf008,null),
  175. EscherRegroupItems(0xf118,null),
  176. EscherColorScheme(0xf120,null),
  177. EscherSpgrContainer(0xf003,null),
  178. EscherSpContainer(0xf004,null),
  179. EscherSpgr(0xf009,null),
  180. EscherSp(0xf00a,null),
  181. EscherTextbox(0xf00c,null),
  182. EscherClientTextbox(0xf00d,null),
  183. EscherAnchor(0xf00e,null),
  184. EscherChildAnchor(0xf00f,null),
  185. EscherClientAnchor(0xf010,null),
  186. EscherClientData(0xf011,null),
  187. EscherSolverContainer(0xf005,null),
  188. EscherConnectorRule(0xf012,null),
  189. EscherAlignRule(0xf013,null),
  190. EscherArcRule(0xf014,null),
  191. EscherClientRule(0xf015,null),
  192. EscherCalloutRule(0xf017,null),
  193. EscherSelection(0xf119,null),
  194. EscherColorMRU(0xf11a,null),
  195. EscherDeletedPspl(0xf11d,null),
  196. EscherSplitMenuColors(0xf11e,null),
  197. EscherOleObject(0xf11f,null),
  198. // same as EscherTertiaryOptRecord.RECORD_ID
  199. EscherUserDefined(0xf122,null);
  200. @FunctionalInterface
  201. public interface RecordConstructor<T extends Record> {
  202. T apply(byte[] source, int start, int len);
  203. }
  204. private static final Map<Short,RecordTypes> LOOKUP;
  205. static {
  206. LOOKUP = new HashMap<>();
  207. for(RecordTypes s : values()) {
  208. LOOKUP.put(s.typeID, s);
  209. }
  210. }
  211. public final short typeID;
  212. public final RecordConstructor recordConstructor;
  213. RecordTypes(int typeID, RecordConstructor recordConstructor) {
  214. this.typeID = (short)typeID;
  215. this.recordConstructor = recordConstructor;
  216. }
  217. public static RecordTypes forTypeID(int typeID) {
  218. RecordTypes rt = LOOKUP.get((short)typeID);
  219. return (rt != null) ? rt : UnknownRecordPlaceholder;
  220. }
  221. }