pub const MAGIC: &[u8; 8] = b"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1";
pub const MINIMAL_OLEFILE_SIZE: usize = 1536;
pub const DIRENTRY_SIZE: usize = 128;
pub const SECTOR_SIZE_V3: usize = 512;
pub const SECTOR_SIZE_V4: usize = 4096;
pub const MAXREGSECT: u32 = 0xFFFFFFFA; pub const DIFSECT: u32 = 0xFFFFFFFC; pub const FATSECT: u32 = 0xFFFFFFFD; pub const ENDOFCHAIN: u32 = 0xFFFFFFFE; pub const FREESECT: u32 = 0xFFFFFFFF;
pub const MAXREGSID: u32 = 0xFFFFFFFA; pub const NOSTREAM: u32 = 0xFFFFFFFF;
pub const STGTY_EMPTY: u8 = 0;
pub const STGTY_STORAGE: u8 = 1;
pub const STGTY_STREAM: u8 = 2;
pub const STGTY_LOCKBYTES: u8 = 3;
pub const STGTY_PROPERTY: u8 = 4;
pub const STGTY_ROOT: u8 = 5;
pub const UNKNOWN_SIZE: u32 = 0x7FFFFFFF;
pub const VT_EMPTY: u16 = 0;
pub const VT_NULL: u16 = 1;
pub const VT_I2: u16 = 2;
pub const VT_I4: u16 = 3;
pub const VT_R4: u16 = 4;
pub const VT_R8: u16 = 5;
pub const VT_CY: u16 = 6;
pub const VT_DATE: u16 = 7;
pub const VT_BSTR: u16 = 8;
pub const VT_DISPATCH: u16 = 9;
pub const VT_ERROR: u16 = 10;
pub const VT_BOOL: u16 = 11;
pub const VT_VARIANT: u16 = 12;
pub const VT_UNKNOWN: u16 = 13;
pub const VT_DECIMAL: u16 = 14;
pub const VT_I1: u16 = 16;
pub const VT_UI1: u16 = 17;
pub const VT_UI2: u16 = 18;
pub const VT_UI4: u16 = 19;
pub const VT_I8: u16 = 20;
pub const VT_UI8: u16 = 21;
pub const VT_INT: u16 = 22;
pub const VT_UINT: u16 = 23;
pub const VT_VOID: u16 = 24;
pub const VT_HRESULT: u16 = 25;
pub const VT_PTR: u16 = 26;
pub const VT_SAFEARRAY: u16 = 27;
pub const VT_CARRAY: u16 = 28;
pub const VT_USERDEFINED: u16 = 29;
pub const VT_LPSTR: u16 = 30;
pub const VT_LPWSTR: u16 = 31;
pub const VT_FILETIME: u16 = 64;
pub const VT_BLOB: u16 = 65;
pub const VT_STREAM: u16 = 66;
pub const VT_STORAGE: u16 = 67;
pub const VT_STREAMED_OBJECT: u16 = 68;
pub const VT_STORED_OBJECT: u16 = 69;
pub const VT_BLOB_OBJECT: u16 = 70;
pub const VT_CF: u16 = 71;
pub const VT_CLSID: u16 = 72;
pub const VT_VECTOR: u16 = 0x1000;
pub const WORD_CLSID: &str = "00020900-0000-0000-C000-000000000046";
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u16)]
pub enum PptRecordType {
Unknown = 0,
Document = 1000,
DocumentAtom = 1001,
EndDocument = 1002,
Slide = 1006,
SlideAtom = 1007,
Notes = 1008,
NotesAtom = 1009,
Environment = 1010,
SlidePersistAtom = 1011,
MainMaster = 1016,
SlideListWithText = 4080,
PersistPtrHolder = 6001,
SSSlideInfoAtom = 1017,
VBAInfo = 1023,
VBAInfoAtom = 1024,
ExObjList = 1033,
ExObjListAtom = 1034,
PPDrawingGroup = 1035,
PPDrawing = 1036,
OEPlaceholderAtom = 3011,
TextHeaderAtom = 3999,
TextCharsAtom = 4000,
TextBytesAtom = 4008,
TextSpecInfoAtom = 4010,
StyleTextPropAtom = 4001,
MasterTextPropAtom = 4002,
TxMasterStyleAtom = 4003,
TxCFStyleAtom = 4004,
TxPFStyleAtom = 4005,
TextRulerAtom = 4006,
FontEntityAtom = 4023,
CString = 4026,
HeadersFooters = 4057,
HeadersFootersAtom = 4058,
InteractiveInfo = 4082,
InteractiveInfoAtom = 4083,
UserEditAtom = 4085,
CurrentUserAtom = 4086,
DateTimeMCAtom = 4087,
AnimationInfo = 4116,
AnimationInfoAtom = 4081,
Comment2000 = 12000,
Comment2000Atom = 12001,
}
impl From<u16> for PptRecordType {
fn from(value: u16) -> Self {
match value {
0 => PptRecordType::Unknown,
1000 => PptRecordType::Document,
1001 => PptRecordType::DocumentAtom,
1002 => PptRecordType::EndDocument,
1006 => PptRecordType::Slide,
1007 => PptRecordType::SlideAtom,
1008 => PptRecordType::Notes,
1009 => PptRecordType::NotesAtom,
1010 => PptRecordType::Environment,
1011 => PptRecordType::SlidePersistAtom,
1016 => PptRecordType::MainMaster,
1017 => PptRecordType::SSSlideInfoAtom,
4080 => PptRecordType::SlideListWithText,
6001 | 6002 => PptRecordType::PersistPtrHolder, 1023 => PptRecordType::VBAInfo,
1024 => PptRecordType::VBAInfoAtom,
1033 => PptRecordType::ExObjList,
1034 => PptRecordType::ExObjListAtom,
1035 => PptRecordType::PPDrawingGroup,
1036 => PptRecordType::PPDrawing,
3011 => PptRecordType::OEPlaceholderAtom,
3999 => PptRecordType::TextHeaderAtom,
4000 => PptRecordType::TextCharsAtom,
4008 => PptRecordType::TextBytesAtom,
4010 => PptRecordType::TextSpecInfoAtom,
4001 => PptRecordType::StyleTextPropAtom,
4002 => PptRecordType::MasterTextPropAtom,
4003 => PptRecordType::TxMasterStyleAtom,
4004 => PptRecordType::TxCFStyleAtom,
4005 => PptRecordType::TxPFStyleAtom,
4006 => PptRecordType::TextRulerAtom,
4023 => PptRecordType::FontEntityAtom,
4026 => PptRecordType::CString,
4057 => PptRecordType::HeadersFooters,
4058 => PptRecordType::HeadersFootersAtom,
4082 => PptRecordType::InteractiveInfo,
4083 => PptRecordType::InteractiveInfoAtom,
4085 => PptRecordType::UserEditAtom,
4086 => PptRecordType::CurrentUserAtom,
4087 => PptRecordType::DateTimeMCAtom,
4116 => PptRecordType::AnimationInfo,
4081 => PptRecordType::AnimationInfoAtom,
12000 => PptRecordType::Comment2000,
12001 => PptRecordType::Comment2000Atom,
_ => PptRecordType::Unknown,
}
}
}
impl PptRecordType {
pub fn as_u16(self) -> u16 {
unsafe { std::mem::transmute::<Self, u16>(self) }
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u16)]
pub enum EscherRecordType {
Container = 0xF000,
Shape = 0xF004,
TextBox = 0xF00C,
ClientTextBox = 0xF00D,
ChildAnchor = 0xF00E,
ClientAnchor = 0xF00F,
ClientData = 0xF010,
Properties = 0xF011,
Transform = 0xF012,
Text = 0xF013,
PlaceholderData = 0xF014,
}
impl From<u16> for EscherRecordType {
fn from(value: u16) -> Self {
match value {
0xF000 => EscherRecordType::Container,
0xF004 => EscherRecordType::Shape,
0xF00C => EscherRecordType::TextBox,
0xF00D => EscherRecordType::ClientTextBox,
0xF00E => EscherRecordType::ChildAnchor,
0xF00F => EscherRecordType::ClientAnchor,
0xF010 => EscherRecordType::ClientData,
0xF011 => EscherRecordType::Properties,
0xF012 => EscherRecordType::Transform,
0xF013 => EscherRecordType::Text,
0xF014 => EscherRecordType::PlaceholderData,
_ => EscherRecordType::Container, }
}
}
impl EscherRecordType {
pub fn as_u16(self) -> u16 {
unsafe { std::mem::transmute::<Self, u16>(self) }
}
}
pub const ESCHER_VERSION_MASK: u16 = 0x0FFF;
pub const ESCHER_INSTANCE_MASK: u16 = 0x0FFF;
pub const ESCHER_HEADER_SIZE: usize = 8;
pub const ESCHER_MIN_RECORD_SIZE: usize = ESCHER_HEADER_SIZE;
pub const ESCHER_CONTAINER_FLAG: u16 = 0x000F;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u16)]
pub enum EscherShapeType {
NotPrimitive = 0,
Rectangle = 1,
RoundRectangle = 2,
Oval = 3,
Diamond = 4,
Triangle = 5,
RightTriangle = 6,
Parallelogram = 7,
Trapezoid = 8,
Hexagon = 9,
Octagon = 10,
Plus = 11,
Star = 12,
Arrow = 13,
ThickArrow = 14,
HomePlate = 15,
Cube = 16,
Balloon = 17,
Seal = 18,
Arc = 19,
Line = 20,
Plaque = 21,
Can = 22,
Donut = 23,
TextSimple = 24,
TextOctagon = 25,
TextHexagon = 26,
TextCurve = 27,
TextWave = 28,
TextRing = 29,
TextOnCurve = 30,
TextOnRing = 31,
StraightConnector1 = 32,
BentConnector2 = 33,
BentConnector3 = 34,
BentConnector4 = 35,
BentConnector5 = 36,
CurvedConnector2 = 37,
CurvedConnector3 = 38,
CurvedConnector4 = 39,
CurvedConnector5 = 40,
Callout1 = 41,
Callout2 = 42,
Callout3 = 43,
AccentCallout1 = 44,
AccentCallout2 = 45,
AccentCallout3 = 46,
BorderCallout1 = 47,
BorderCallout2 = 48,
BorderCallout3 = 49,
AccentBorderCallout1 = 50,
AccentBorderCallout2 = 51,
AccentBorderCallout3 = 52,
Custom = 255,
}
impl From<u16> for EscherShapeType {
fn from(value: u16) -> Self {
match value {
0 => EscherShapeType::NotPrimitive,
1 => EscherShapeType::Rectangle,
2 => EscherShapeType::RoundRectangle,
3 => EscherShapeType::Oval,
4 => EscherShapeType::Diamond,
5 => EscherShapeType::Triangle,
6 => EscherShapeType::RightTriangle,
7 => EscherShapeType::Parallelogram,
8 => EscherShapeType::Trapezoid,
9 => EscherShapeType::Hexagon,
10 => EscherShapeType::Octagon,
11 => EscherShapeType::Plus,
12 => EscherShapeType::Star,
13 => EscherShapeType::Arrow,
14 => EscherShapeType::ThickArrow,
15 => EscherShapeType::HomePlate,
16 => EscherShapeType::Cube,
17 => EscherShapeType::Balloon,
18 => EscherShapeType::Seal,
19 => EscherShapeType::Arc,
20 => EscherShapeType::Line,
21 => EscherShapeType::Plaque,
22 => EscherShapeType::Can,
23 => EscherShapeType::Donut,
24 => EscherShapeType::TextSimple,
25 => EscherShapeType::TextOctagon,
26 => EscherShapeType::TextHexagon,
27 => EscherShapeType::TextCurve,
28 => EscherShapeType::TextWave,
29 => EscherShapeType::TextRing,
30 => EscherShapeType::TextOnCurve,
31 => EscherShapeType::TextOnRing,
32 => EscherShapeType::StraightConnector1,
33 => EscherShapeType::BentConnector2,
34 => EscherShapeType::BentConnector3,
35 => EscherShapeType::BentConnector4,
36 => EscherShapeType::BentConnector5,
37 => EscherShapeType::CurvedConnector2,
38 => EscherShapeType::CurvedConnector3,
39 => EscherShapeType::CurvedConnector4,
40 => EscherShapeType::CurvedConnector5,
41 => EscherShapeType::Callout1,
42 => EscherShapeType::Callout2,
43 => EscherShapeType::Callout3,
44 => EscherShapeType::AccentCallout1,
45 => EscherShapeType::AccentCallout2,
46 => EscherShapeType::AccentCallout3,
47 => EscherShapeType::BorderCallout1,
48 => EscherShapeType::BorderCallout2,
49 => EscherShapeType::BorderCallout3,
50 => EscherShapeType::AccentBorderCallout1,
51 => EscherShapeType::AccentBorderCallout2,
52 => EscherShapeType::AccentBorderCallout3,
255 => EscherShapeType::Custom,
_ => EscherShapeType::NotPrimitive,
}
}
}
impl EscherShapeType {
pub fn as_u16(self) -> u16 {
unsafe { std::mem::transmute::<Self, u16>(self) }
}
}