Index: core/include/fpdfapi/fpdf_objects.h |
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h |
index 1b7cb94583fe21f1d68a512defe1b4fb100fa5f7..046308d166a9fc82396b9b573cc3ccd00b44c501 100644 |
--- a/core/include/fpdfapi/fpdf_objects.h |
+++ b/core/include/fpdfapi/fpdf_objects.h |
@@ -1,7 +1,7 @@ |
// Copyright 2014 PDFium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
- |
+ |
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
#ifndef _FPDF_OBJECTS_ |
@@ -24,769 +24,590 @@ class CPDF_Reference; |
class IPDF_DocParser; |
class IFX_FileRead; |
class CPDF_CryptoHandler; |
-#define PDFOBJ_INVALID 0 |
-#define PDFOBJ_BOOLEAN 1 |
-#define PDFOBJ_NUMBER 2 |
-#define PDFOBJ_STRING 3 |
-#define PDFOBJ_NAME 4 |
-#define PDFOBJ_ARRAY 5 |
-#define PDFOBJ_DICTIONARY 6 |
-#define PDFOBJ_STREAM 7 |
-#define PDFOBJ_NULL 8 |
-#define PDFOBJ_REFERENCE 9 |
-typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, FX_LPVOID pUserData); |
-class CPDF_Object : public CFX_Object |
-{ |
-public: |
+#define PDFOBJ_INVALID 0 |
+#define PDFOBJ_BOOLEAN 1 |
+#define PDFOBJ_NUMBER 2 |
+#define PDFOBJ_STRING 3 |
+#define PDFOBJ_NAME 4 |
+#define PDFOBJ_ARRAY 5 |
+#define PDFOBJ_DICTIONARY 6 |
+#define PDFOBJ_STREAM 7 |
+#define PDFOBJ_NULL 8 |
+#define PDFOBJ_REFERENCE 9 |
+typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream* pStream, |
+ FX_LPVOID pUserData); |
+class CPDF_Object : public CFX_Object { |
+ public: |
+ int GetType() const { return m_Type; } |
- int GetType() const |
- { |
- return m_Type; |
- } |
+ FX_DWORD GetObjNum() const { return m_ObjNum; } |
- FX_DWORD GetObjNum() const |
- { |
- return m_ObjNum; |
- } |
+ FX_DWORD GetGenNum() const { return m_GenNum; } |
- FX_DWORD GetGenNum() const |
- { |
- return m_GenNum; |
- } |
+ FX_BOOL IsIdentical(CPDF_Object* pObj) const; |
- FX_BOOL IsIdentical(CPDF_Object* pObj) const; |
+ CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const; |
- CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const; |
+ CPDF_Object* CloneRef(CPDF_IndirectObjects* pObjs) const; |
- CPDF_Object* CloneRef(CPDF_IndirectObjects* pObjs) const; |
+ CPDF_Object* GetDirect() const; |
- CPDF_Object* GetDirect() const; |
+ void Release(); |
- void Release(); |
+ CFX_ByteString GetString() const; |
- CFX_ByteString GetString() const; |
+ CFX_ByteStringC GetConstString() const; |
- CFX_ByteStringC GetConstString() const; |
+ CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = NULL) const; |
- CFX_WideString GetUnicodeText(CFX_CharMap* pCharMap = NULL) const; |
+ FX_FLOAT GetNumber() const; |
- FX_FLOAT GetNumber() const; |
+ FX_FLOAT GetNumber16() const; |
- FX_FLOAT GetNumber16() const; |
+ int GetInteger() const; |
- int GetInteger() const; |
+ CPDF_Dictionary* GetDict() const; |
- CPDF_Dictionary* GetDict() const; |
+ CPDF_Array* GetArray() const; |
- CPDF_Array* GetArray() const; |
+ void SetString(const CFX_ByteString& str); |
- void SetString(const CFX_ByteString& str); |
+ void SetUnicodeText(FX_LPCWSTR pUnicodes, int len = -1); |
- void SetUnicodeText(FX_LPCWSTR pUnicodes, int len = -1); |
+ int GetDirectType() const; |
- int GetDirectType() const; |
+ FX_BOOL IsModified() const { return FALSE; } |
- FX_BOOL IsModified() const |
- { |
- return FALSE; |
- } |
-protected: |
- FX_DWORD m_Type; |
- CPDF_Object() |
- { |
- m_ObjNum = 0; |
- m_GenNum = 0; |
- } |
+ protected: |
+ FX_DWORD m_Type; |
+ CPDF_Object() { |
+ m_ObjNum = 0; |
+ m_GenNum = 0; |
+ } |
- FX_DWORD m_ObjNum; |
- FX_DWORD m_GenNum; |
+ FX_DWORD m_ObjNum; |
+ FX_DWORD m_GenNum; |
- void Destroy(); |
+ void Destroy(); |
+ ~CPDF_Object() {} |
+ friend class CPDF_IndirectObjects; |
+ friend class CPDF_Parser; |
+ friend class CPDF_SyntaxParser; |
- ~CPDF_Object() {} |
- friend class CPDF_IndirectObjects; |
- friend class CPDF_Parser; |
- friend class CPDF_SyntaxParser; |
-private: |
- CPDF_Object(const CPDF_Object& src) {} |
- CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; |
+ private: |
+ CPDF_Object(const CPDF_Object& src) {} |
+ CPDF_Object* CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visited) const; |
}; |
-class CPDF_Boolean : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Boolean* Create(FX_BOOL value) |
- { |
- return FX_NEW CPDF_Boolean(value); |
- } |
- |
- CPDF_Boolean() |
- { |
- m_Type = PDFOBJ_BOOLEAN; |
- } |
- |
- CPDF_Boolean(FX_BOOL value) |
- { |
- m_Type = PDFOBJ_BOOLEAN; |
- m_bValue = value; |
- } |
- |
- FX_BOOL Identical(CPDF_Boolean* pOther) const |
- { |
- return m_bValue == pOther->m_bValue; |
- } |
-protected: |
- |
- FX_BOOL m_bValue; |
- friend class CPDF_Object; |
+class CPDF_Boolean : public CPDF_Object { |
+ public: |
+ static CPDF_Boolean* Create(FX_BOOL value) { |
+ return FX_NEW CPDF_Boolean(value); |
+ } |
+ |
+ CPDF_Boolean() { m_Type = PDFOBJ_BOOLEAN; } |
+ |
+ CPDF_Boolean(FX_BOOL value) { |
+ m_Type = PDFOBJ_BOOLEAN; |
+ m_bValue = value; |
+ } |
+ |
+ FX_BOOL Identical(CPDF_Boolean* pOther) const { |
+ return m_bValue == pOther->m_bValue; |
+ } |
+ |
+ protected: |
+ FX_BOOL m_bValue; |
+ friend class CPDF_Object; |
}; |
-class CPDF_Number : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Number* Create(int value) |
- { |
- return FX_NEW CPDF_Number(value); |
- } |
+class CPDF_Number : public CPDF_Object { |
+ public: |
+ static CPDF_Number* Create(int value) { return FX_NEW CPDF_Number(value); } |
- static CPDF_Number* Create(FX_FLOAT value) |
- { |
- return FX_NEW CPDF_Number(value); |
- } |
+ static CPDF_Number* Create(FX_FLOAT value) { |
+ return FX_NEW CPDF_Number(value); |
+ } |
- static CPDF_Number* Create(FX_BSTR str) |
- { |
- return FX_NEW CPDF_Number(str); |
- } |
+ static CPDF_Number* Create(FX_BSTR str) { return FX_NEW CPDF_Number(str); } |
- static CPDF_Number* Create(FX_BOOL bInteger, void* pData) |
- { |
- return FX_NEW CPDF_Number(bInteger, pData); |
- } |
+ static CPDF_Number* Create(FX_BOOL bInteger, void* pData) { |
+ return FX_NEW CPDF_Number(bInteger, pData); |
+ } |
- CPDF_Number() |
- { |
- m_Type = PDFOBJ_NUMBER; |
- } |
+ CPDF_Number() { m_Type = PDFOBJ_NUMBER; } |
- CPDF_Number(FX_BOOL bInteger, void* pData); |
+ CPDF_Number(FX_BOOL bInteger, void* pData); |
- CPDF_Number(int value); |
+ CPDF_Number(int value); |
- CPDF_Number(FX_FLOAT value); |
+ CPDF_Number(FX_FLOAT value); |
- CPDF_Number(FX_BSTR str); |
+ CPDF_Number(FX_BSTR str); |
- FX_BOOL Identical(CPDF_Number* pOther) const; |
+ FX_BOOL Identical(CPDF_Number* pOther) const; |
- CFX_ByteString GetString() const; |
+ CFX_ByteString GetString() const; |
- void SetString(FX_BSTR str); |
+ void SetString(FX_BSTR str); |
- FX_BOOL IsInteger() const |
- { |
- return m_bInteger; |
- } |
+ FX_BOOL IsInteger() const { return m_bInteger; } |
- int GetInteger() const |
- { |
- return m_bInteger ? m_Integer : (int)m_Float; |
- } |
+ int GetInteger() const { return m_bInteger ? m_Integer : (int)m_Float; } |
- FX_FLOAT GetNumber() const |
- { |
- return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
- } |
+ FX_FLOAT GetNumber() const { |
+ return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
+ } |
- void SetNumber(FX_FLOAT value); |
+ void SetNumber(FX_FLOAT value); |
- FX_FLOAT GetNumber16() const |
- { |
- return GetNumber(); |
- } |
+ FX_FLOAT GetNumber16() const { return GetNumber(); } |
- FX_FLOAT GetFloat() const |
- { |
- return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
- } |
-protected: |
+ FX_FLOAT GetFloat() const { |
+ return m_bInteger ? (FX_FLOAT)m_Integer : m_Float; |
+ } |
- FX_BOOL m_bInteger; |
+ protected: |
+ FX_BOOL m_bInteger; |
- union { |
+ union { |
+ int m_Integer; |
- int m_Integer; |
- |
- FX_FLOAT m_Float; |
- }; |
- friend class CPDF_Object; |
-}; |
-class CPDF_String : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) |
- { |
- return FX_NEW CPDF_String(str, bHex); |
- } |
- |
- static CPDF_String* Create(const CFX_WideString& str) |
- { |
- return FX_NEW CPDF_String(str); |
- } |
- |
- CPDF_String() |
- { |
- m_Type = PDFOBJ_STRING; |
- m_bHex = FALSE; |
- } |
- |
- CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) : m_String(str) |
- { |
- m_Type = PDFOBJ_STRING; |
- m_bHex = bHex; |
- } |
- |
- CPDF_String(const CFX_WideString& str); |
- |
- CFX_ByteString& GetString() |
- { |
- return m_String; |
- } |
- |
- FX_BOOL Identical(CPDF_String* pOther) const |
- { |
- return m_String == pOther->m_String; |
- } |
- |
- FX_BOOL IsHex() const |
- { |
- return m_bHex; |
- } |
-protected: |
- |
- CFX_ByteString m_String; |
- |
- FX_BOOL m_bHex; |
- friend class CPDF_Object; |
+ FX_FLOAT m_Float; |
+ }; |
+ friend class CPDF_Object; |
}; |
-class CPDF_Name : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Name* Create(const CFX_ByteString& str) |
- { |
- return FX_NEW CPDF_Name(str); |
- } |
- |
- static CPDF_Name* Create(FX_BSTR str) |
- { |
- return FX_NEW CPDF_Name(str); |
- } |
- |
- static CPDF_Name* Create(FX_LPCSTR str) |
- { |
- return FX_NEW CPDF_Name(str); |
- } |
- |
- CPDF_Name(const CFX_ByteString& str) : m_Name(str) |
- { |
- m_Type = PDFOBJ_NAME; |
- } |
- |
- CPDF_Name(FX_BSTR str) : m_Name(str) |
- { |
- m_Type = PDFOBJ_NAME; |
- } |
- |
- CPDF_Name(FX_LPCSTR str) : m_Name(str) |
- { |
- m_Type = PDFOBJ_NAME; |
- } |
- |
- CFX_ByteString& GetString() |
- { |
- return m_Name; |
- } |
- |
- FX_BOOL Identical(CPDF_Name* pOther) const |
- { |
- return m_Name == pOther->m_Name; |
- } |
-protected: |
- |
- CFX_ByteString m_Name; |
- friend class CPDF_Object; |
-}; |
-class CPDF_Array : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Array* Create() |
- { |
- return FX_NEW CPDF_Array(); |
- } |
- |
- CPDF_Array() |
- { |
- m_Type = PDFOBJ_ARRAY; |
- } |
+class CPDF_String : public CPDF_Object { |
+ public: |
+ static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) { |
+ return FX_NEW CPDF_String(str, bHex); |
+ } |
- FX_DWORD GetCount() const |
- { |
- return m_Objects.GetSize(); |
- } |
+ static CPDF_String* Create(const CFX_WideString& str) { |
+ return FX_NEW CPDF_String(str); |
+ } |
- CPDF_Object* GetElement(FX_DWORD index) const; |
+ CPDF_String() { |
+ m_Type = PDFOBJ_STRING; |
+ m_bHex = FALSE; |
+ } |
- CPDF_Object* GetElementValue(FX_DWORD index) const; |
+ CPDF_String(const CFX_ByteString& str, FX_BOOL bHex = FALSE) : m_String(str) { |
+ m_Type = PDFOBJ_STRING; |
+ m_bHex = bHex; |
+ } |
+ CPDF_String(const CFX_WideString& str); |
+ CFX_ByteString& GetString() { return m_String; } |
- CFX_AffineMatrix GetMatrix(); |
+ FX_BOOL Identical(CPDF_String* pOther) const { |
+ return m_String == pOther->m_String; |
+ } |
- CFX_FloatRect GetRect(); |
+ FX_BOOL IsHex() const { return m_bHex; } |
+ protected: |
+ CFX_ByteString m_String; |
+ FX_BOOL m_bHex; |
+ friend class CPDF_Object; |
+}; |
+class CPDF_Name : public CPDF_Object { |
+ public: |
+ static CPDF_Name* Create(const CFX_ByteString& str) { |
+ return FX_NEW CPDF_Name(str); |
+ } |
+ static CPDF_Name* Create(FX_BSTR str) { return FX_NEW CPDF_Name(str); } |
- CFX_ByteString GetString(FX_DWORD index) const; |
+ static CPDF_Name* Create(FX_LPCSTR str) { return FX_NEW CPDF_Name(str); } |
- CFX_ByteStringC GetConstString(FX_DWORD index) const; |
+ CPDF_Name(const CFX_ByteString& str) : m_Name(str) { m_Type = PDFOBJ_NAME; } |
- int GetInteger(FX_DWORD index) const; |
+ CPDF_Name(FX_BSTR str) : m_Name(str) { m_Type = PDFOBJ_NAME; } |
- FX_FLOAT GetNumber(FX_DWORD index) const; |
+ CPDF_Name(FX_LPCSTR str) : m_Name(str) { m_Type = PDFOBJ_NAME; } |
- CPDF_Dictionary* GetDict(FX_DWORD index) const; |
+ CFX_ByteString& GetString() { return m_Name; } |
- CPDF_Stream* GetStream(FX_DWORD index) const; |
+ FX_BOOL Identical(CPDF_Name* pOther) const { |
+ return m_Name == pOther->m_Name; |
+ } |
- CPDF_Array* GetArray(FX_DWORD index) const; |
+ protected: |
+ CFX_ByteString m_Name; |
+ friend class CPDF_Object; |
+}; |
+class CPDF_Array : public CPDF_Object { |
+ public: |
+ static CPDF_Array* Create() { return FX_NEW CPDF_Array(); } |
- FX_FLOAT GetFloat(FX_DWORD index) const |
- { |
- return GetNumber(index); |
- } |
+ CPDF_Array() { m_Type = PDFOBJ_ARRAY; } |
+ FX_DWORD GetCount() const { return m_Objects.GetSize(); } |
+ CPDF_Object* GetElement(FX_DWORD index) const; |
+ CPDF_Object* GetElementValue(FX_DWORD index) const; |
- void SetAt(FX_DWORD index, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); |
+ CFX_AffineMatrix GetMatrix(); |
+ CFX_FloatRect GetRect(); |
- void InsertAt(FX_DWORD index, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); |
+ CFX_ByteString GetString(FX_DWORD index) const; |
- void RemoveAt(FX_DWORD index); |
+ CFX_ByteStringC GetConstString(FX_DWORD index) const; |
+ int GetInteger(FX_DWORD index) const; |
- void Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); |
+ FX_FLOAT GetNumber(FX_DWORD index) const; |
+ CPDF_Dictionary* GetDict(FX_DWORD index) const; |
+ CPDF_Stream* GetStream(FX_DWORD index) const; |
- void AddNumber(FX_FLOAT f); |
+ CPDF_Array* GetArray(FX_DWORD index) const; |
- void AddInteger(int i); |
+ FX_FLOAT GetFloat(FX_DWORD index) const { return GetNumber(index); } |
- void AddString(const CFX_ByteString& str); |
+ void SetAt(FX_DWORD index, |
+ CPDF_Object* pObj, |
+ CPDF_IndirectObjects* pObjs = NULL); |
- void AddName(const CFX_ByteString& str); |
+ void InsertAt(FX_DWORD index, |
+ CPDF_Object* pObj, |
+ CPDF_IndirectObjects* pObjs = NULL); |
- void AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
+ void RemoveAt(FX_DWORD index); |
- void AddReference(CPDF_IndirectObjects* pDoc, CPDF_Object* obj) |
- { |
- AddReference(pDoc, obj->GetObjNum()); |
- } |
+ void Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); |
+ void AddNumber(FX_FLOAT f); |
- FX_FLOAT GetNumber16(FX_DWORD index) const |
- { |
- return GetNumber(index); |
- } |
+ void AddInteger(int i); |
- void AddNumber16(FX_FLOAT value) |
- { |
- AddNumber(value); |
- } |
+ void AddString(const CFX_ByteString& str); |
- FX_BOOL Identical(CPDF_Array* pOther) const; |
-protected: |
+ void AddName(const CFX_ByteString& str); |
- ~CPDF_Array(); |
+ void AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
- CFX_PtrArray m_Objects; |
- friend class CPDF_Object; |
-}; |
-class CPDF_Dictionary : public CPDF_Object |
-{ |
-public: |
+ void AddReference(CPDF_IndirectObjects* pDoc, CPDF_Object* obj) { |
+ AddReference(pDoc, obj->GetObjNum()); |
+ } |
- static CPDF_Dictionary* Create() |
- { |
- return FX_NEW CPDF_Dictionary(); |
- } |
+ FX_FLOAT GetNumber16(FX_DWORD index) const { return GetNumber(index); } |
- CPDF_Dictionary() |
- { |
- m_Type = PDFOBJ_DICTIONARY; |
- } |
+ void AddNumber16(FX_FLOAT value) { AddNumber(value); } |
+ FX_BOOL Identical(CPDF_Array* pOther) const; |
+ protected: |
+ ~CPDF_Array(); |
- CPDF_Object* GetElement(FX_BSTR key) const; |
+ CFX_PtrArray m_Objects; |
+ friend class CPDF_Object; |
+}; |
+class CPDF_Dictionary : public CPDF_Object { |
+ public: |
+ static CPDF_Dictionary* Create() { return FX_NEW CPDF_Dictionary(); } |
- CPDF_Object* GetElementValue(FX_BSTR key) const; |
+ CPDF_Dictionary() { m_Type = PDFOBJ_DICTIONARY; } |
+ CPDF_Object* GetElement(FX_BSTR key) const; |
+ CPDF_Object* GetElementValue(FX_BSTR key) const; |
+ CFX_ByteString GetString(FX_BSTR key) const; |
+ CFX_ByteStringC GetConstString(FX_BSTR key) const; |
- CFX_ByteString GetString(FX_BSTR key) const; |
+ CFX_ByteString GetString(FX_BSTR key, FX_BSTR default_str) const; |
- CFX_ByteStringC GetConstString(FX_BSTR key) const; |
+ CFX_ByteStringC GetConstString(FX_BSTR key, FX_BSTR default_str) const; |
- CFX_ByteString GetString(FX_BSTR key, FX_BSTR default_str) const; |
+ CFX_WideString GetUnicodeText(FX_BSTR key, |
+ CFX_CharMap* pCharMap = NULL) const; |
- CFX_ByteStringC GetConstString(FX_BSTR key, FX_BSTR default_str) const; |
+ int GetInteger(FX_BSTR key) const; |
- CFX_WideString GetUnicodeText(FX_BSTR key, CFX_CharMap* pCharMap = NULL) const; |
+ int GetInteger(FX_BSTR key, int default_int) const; |
- int GetInteger(FX_BSTR key) const; |
+ FX_BOOL GetBoolean(FX_BSTR key, FX_BOOL bDefault = FALSE) const; |
- int GetInteger(FX_BSTR key, int default_int) const; |
+ FX_FLOAT GetNumber(FX_BSTR key) const; |
- FX_BOOL GetBoolean(FX_BSTR key, FX_BOOL bDefault = FALSE) const; |
+ CPDF_Dictionary* GetDict(FX_BSTR key) const; |
- FX_FLOAT GetNumber(FX_BSTR key) const; |
+ CPDF_Stream* GetStream(FX_BSTR key) const; |
- CPDF_Dictionary* GetDict(FX_BSTR key) const; |
+ CPDF_Array* GetArray(FX_BSTR key) const; |
- CPDF_Stream* GetStream(FX_BSTR key) const; |
+ CFX_FloatRect GetRect(FX_BSTR key) const; |
- CPDF_Array* GetArray(FX_BSTR key) const; |
+ CFX_AffineMatrix GetMatrix(FX_BSTR key) const; |
- CFX_FloatRect GetRect(FX_BSTR key) const; |
+ FX_FLOAT GetFloat(FX_BSTR key) const { return GetNumber(key); } |
- CFX_AffineMatrix GetMatrix(FX_BSTR key) const; |
+ FX_BOOL KeyExist(FX_BSTR key) const; |
- FX_FLOAT GetFloat(FX_BSTR key) const |
- { |
- return GetNumber(key); |
- } |
+ FX_POSITION GetStartPos() const; |
+ CPDF_Object* GetNextElement(FX_POSITION& pos, CFX_ByteString& key) const; |
- FX_BOOL KeyExist(FX_BSTR key) const; |
+ void SetAt(FX_BSTR key, |
+ CPDF_Object* pObj, |
+ CPDF_IndirectObjects* pObjs = NULL); |
- FX_POSITION GetStartPos() const; |
+ void SetAtName(FX_BSTR key, const CFX_ByteString& name); |
- CPDF_Object* GetNextElement(FX_POSITION& pos, CFX_ByteString& key) const; |
+ void SetAtString(FX_BSTR key, const CFX_ByteString& string); |
- void SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs = NULL); |
+ void SetAtInteger(FX_BSTR key, int i); |
+ void SetAtNumber(FX_BSTR key, FX_FLOAT f); |
+ void SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
- void SetAtName(FX_BSTR key, const CFX_ByteString& name); |
+ void SetAtReference(FX_BSTR key, |
+ CPDF_IndirectObjects* pDoc, |
+ CPDF_Object* obj) { |
+ SetAtReference(key, pDoc, obj->GetObjNum()); |
+ } |
+ void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
- void SetAtString(FX_BSTR key, const CFX_ByteString& string); |
+ void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) { |
+ AddReference(key, pDoc, obj->GetObjNum()); |
+ } |
+ void SetAtRect(FX_BSTR key, const CFX_FloatRect& rect); |
- void SetAtInteger(FX_BSTR key, int i); |
+ void SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix); |
+ void SetAtBoolean(FX_BSTR key, FX_BOOL bValue); |
- void SetAtNumber(FX_BSTR key, FX_FLOAT f); |
+ void RemoveAt(FX_BSTR key); |
- void SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
+ void ReplaceKey(FX_BSTR oldkey, FX_BSTR newkey); |
- void SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) |
- { |
- SetAtReference(key, pDoc, obj->GetObjNum()); |
- } |
+ FX_BOOL Identical(CPDF_Dictionary* pDict) const; |
- void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
+ int GetCount() const { return m_Map.GetCount(); } |
- void AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, CPDF_Object* obj) |
- { |
- AddReference(key, pDoc, obj->GetObjNum()); |
- } |
+ void AddValue(FX_BSTR key, CPDF_Object* pObj); |
- void SetAtRect(FX_BSTR key, const CFX_FloatRect& rect); |
+ protected: |
+ ~CPDF_Dictionary(); |
- void SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix); |
+ CFX_CMapByteStringToPtr m_Map; |
- void SetAtBoolean(FX_BSTR key, FX_BOOL bValue); |
+ friend class CPDF_Object; |
+}; |
+class CPDF_Stream : public CPDF_Object { |
+ public: |
+ static CPDF_Stream* Create(FX_LPBYTE pData, |
+ FX_DWORD size, |
+ CPDF_Dictionary* pDict) { |
+ return FX_NEW CPDF_Stream(pData, size, pDict); |
+ } |
+ CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); |
+ CPDF_Dictionary* GetDict() const { return m_pDict; } |
- void RemoveAt(FX_BSTR key); |
+ void SetData(FX_LPCBYTE pData, |
+ FX_DWORD size, |
+ FX_BOOL bCompressed, |
+ FX_BOOL bKeepBuf); |
+ void InitStream(FX_BYTE* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
- void ReplaceKey(FX_BSTR oldkey, FX_BSTR newkey); |
+ void InitStream(IFX_FileRead* pFile, CPDF_Dictionary* pDict); |
- FX_BOOL Identical(CPDF_Dictionary* pDict) const; |
+ FX_BOOL Identical(CPDF_Stream* pOther) const; |
- int GetCount() const |
- { |
- return m_Map.GetCount(); |
- } |
+ CPDF_StreamFilter* GetStreamFilter(FX_BOOL bRaw = FALSE) const; |
- void AddValue(FX_BSTR key, CPDF_Object* pObj); |
-protected: |
+ FX_DWORD GetRawSize() const { return m_dwSize; } |
- ~CPDF_Dictionary(); |
+ FX_BOOL ReadRawData(FX_FILESIZE start_pos, |
+ FX_LPBYTE pBuf, |
+ FX_DWORD buf_size) const; |
- CFX_CMapByteStringToPtr m_Map; |
+ FX_BOOL IsMemoryBased() const { return m_GenNum == (FX_DWORD)-1; } |
- friend class CPDF_Object; |
-}; |
-class CPDF_Stream : public CPDF_Object |
-{ |
-public: |
+ CPDF_Stream* Clone(FX_BOOL bDirect, |
+ FPDF_LPFCloneStreamCallback lpfCallback, |
+ FX_LPVOID pUserData) const; |
- static CPDF_Stream* Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) |
- { |
- return FX_NEW CPDF_Stream(pData, size, pDict); |
- } |
+ protected: |
+ ~CPDF_Stream(); |
- CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); |
+ CPDF_Dictionary* m_pDict; |
- CPDF_Dictionary* GetDict() const |
- { |
- return m_pDict; |
- } |
+ FX_DWORD m_dwSize; |
- void SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); |
+ FX_DWORD m_GenNum; |
- void InitStream(FX_BYTE* pData, FX_DWORD size, CPDF_Dictionary* pDict); |
+ union { |
+ FX_LPBYTE m_pDataBuf; |
- void InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict); |
+ IFX_FileRead* m_pFile; |
+ }; |
- FX_BOOL Identical(CPDF_Stream* pOther) const; |
+ FX_FILESIZE m_FileOffset; |
- CPDF_StreamFilter* GetStreamFilter(FX_BOOL bRaw = FALSE) const; |
+ CPDF_CryptoHandler* m_pCryptoHandler; |
+ void InitStream(CPDF_Dictionary* pDict); |
+ friend class CPDF_Object; |
+ friend class CPDF_StreamAcc; |
+ friend class CPDF_AttachmentAcc; |
+}; |
+class CPDF_StreamAcc : public CFX_Object { |
+ public: |
+ CPDF_StreamAcc(); |
+ ~CPDF_StreamAcc(); |
- FX_DWORD GetRawSize() const |
- { |
- return m_dwSize; |
- } |
+ void LoadAllData(const CPDF_Stream* pStream, |
+ FX_BOOL bRawAccess = FALSE, |
+ FX_DWORD estimated_size = 0, |
+ FX_BOOL bImageAcc = FALSE); |
- FX_BOOL ReadRawData(FX_FILESIZE start_pos, FX_LPBYTE pBuf, FX_DWORD buf_size) const; |
+ const CPDF_Stream* GetStream() const { return m_pStream; } |
+ CPDF_Dictionary* GetDict() const { |
+ return m_pStream ? m_pStream->GetDict() : NULL; |
+ } |
- FX_BOOL IsMemoryBased() const |
- { |
- return m_GenNum == (FX_DWORD) - 1; |
- } |
+ FX_LPCBYTE GetData() const; |
- CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const; |
-protected: |
+ FX_DWORD GetSize() const; |
- ~CPDF_Stream(); |
+ FX_LPBYTE DetachData(); |
- CPDF_Dictionary* m_pDict; |
+ const CFX_ByteString& GetImageDecoder() { return m_ImageDecoder; } |
- FX_DWORD m_dwSize; |
+ const CPDF_Dictionary* GetImageParam() { return m_pImageParam; } |
- FX_DWORD m_GenNum; |
+ protected: |
+ FX_LPBYTE m_pData; |
- union { |
+ FX_DWORD m_dwSize; |
- FX_LPBYTE m_pDataBuf; |
+ FX_BOOL m_bNewBuf; |
- IFX_FileRead* m_pFile; |
- }; |
+ CFX_ByteString m_ImageDecoder; |
- FX_FILESIZE m_FileOffset; |
+ CPDF_Dictionary* m_pImageParam; |
- CPDF_CryptoHandler* m_pCryptoHandler; |
+ const CPDF_Stream* m_pStream; |
- void InitStream(CPDF_Dictionary* pDict); |
- friend class CPDF_Object; |
- friend class CPDF_StreamAcc; |
- friend class CPDF_AttachmentAcc; |
+ FX_LPBYTE m_pSrcData; |
}; |
-class CPDF_StreamAcc : public CFX_Object |
-{ |
-public: |
+CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, |
+ const CPDF_Dictionary* pParam, |
+ int width = 0, |
+ int height = 0); |
+#define FPDF_FILTER_BUFFER_SIZE 20480 |
+class CPDF_StreamFilter : public CFX_Object { |
+ public: |
+ ~CPDF_StreamFilter(); |
- CPDF_StreamAcc(); |
+ FX_DWORD ReadBlock(FX_LPBYTE buffer, FX_DWORD size); |
- ~CPDF_StreamAcc(); |
+ FX_DWORD GetSrcPos() { return m_SrcOffset; } |
- void LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess = FALSE, |
- FX_DWORD estimated_size = 0, FX_BOOL bImageAcc = FALSE); |
+ const CPDF_Stream* GetStream() { return m_pStream; } |
- const CPDF_Stream* GetStream() const |
- { |
- return m_pStream; |
- } |
+ protected: |
+ CPDF_StreamFilter() {} |
- CPDF_Dictionary* GetDict() const |
- { |
- return m_pStream? m_pStream->GetDict() : NULL; |
- } |
+ FX_DWORD ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size); |
- FX_LPCBYTE GetData() const; |
+ const CPDF_Stream* m_pStream; |
- FX_DWORD GetSize() const; |
+ CFX_DataFilter* m_pFilter; |
- FX_LPBYTE DetachData(); |
+ CFX_BinaryBuf* m_pBuffer; |
- const CFX_ByteString& GetImageDecoder() |
- { |
- return m_ImageDecoder; |
- } |
+ FX_DWORD m_BufOffset; |
- const CPDF_Dictionary* GetImageParam() |
- { |
- return m_pImageParam; |
- } |
-protected: |
+ FX_DWORD m_SrcOffset; |
- FX_LPBYTE m_pData; |
- |
- FX_DWORD m_dwSize; |
- |
- FX_BOOL m_bNewBuf; |
- |
- CFX_ByteString m_ImageDecoder; |
- |
- CPDF_Dictionary* m_pImageParam; |
- |
- const CPDF_Stream* m_pStream; |
- |
- FX_LPBYTE m_pSrcData; |
+ FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; |
+ friend class CPDF_Stream; |
}; |
-CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, int width = 0, int height = 0); |
-#define FPDF_FILTER_BUFFER_SIZE 20480 |
-class CPDF_StreamFilter : public CFX_Object |
-{ |
-public: |
- |
- ~CPDF_StreamFilter(); |
+class CPDF_Null : public CPDF_Object { |
+ public: |
+ static CPDF_Null* Create() { return FX_NEW CPDF_Null(); } |
- FX_DWORD ReadBlock(FX_LPBYTE buffer, FX_DWORD size); |
- |
- FX_DWORD GetSrcPos() |
- { |
- return m_SrcOffset; |
- } |
- |
- const CPDF_Stream* GetStream() |
- { |
- return m_pStream; |
- } |
-protected: |
- |
- CPDF_StreamFilter() {} |
+ CPDF_Null() { m_Type = PDFOBJ_NULL; } |
+}; |
+class CPDF_Reference : public CPDF_Object { |
+ public: |
+ static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) { |
+ return FX_NEW CPDF_Reference(pDoc, objnum); |
+ } |
- FX_DWORD ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size); |
+ CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) { |
+ m_Type = PDFOBJ_REFERENCE; |
+ m_pObjList = pDoc; |
+ m_RefObjNum = objnum; |
+ } |
- const CPDF_Stream* m_pStream; |
+ CPDF_IndirectObjects* GetObjList() const { return m_pObjList; } |
- CFX_DataFilter* m_pFilter; |
+ FX_DWORD GetRefObjNum() const { return m_RefObjNum; } |
- CFX_BinaryBuf* m_pBuffer; |
+ void SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
- FX_DWORD m_BufOffset; |
+ FX_BOOL Identical(CPDF_Reference* pOther) const { |
+ return m_RefObjNum == pOther->m_RefObjNum; |
+ } |
- FX_DWORD m_SrcOffset; |
+ protected: |
+ CPDF_IndirectObjects* m_pObjList; |
- FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; |
- friend class CPDF_Stream; |
+ FX_DWORD m_RefObjNum; |
+ friend class CPDF_Object; |
}; |
-class CPDF_Null : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Null* Create() |
- { |
- return FX_NEW CPDF_Null(); |
- } |
- |
- CPDF_Null() |
- { |
- m_Type = PDFOBJ_NULL; |
- } |
-}; |
-class CPDF_Reference : public CPDF_Object |
-{ |
-public: |
- |
- static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) |
- { |
- return FX_NEW CPDF_Reference(pDoc, objnum); |
- } |
- |
- CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) |
- { |
- m_Type = PDFOBJ_REFERENCE; |
- m_pObjList = pDoc; |
- m_RefObjNum = objnum; |
- } |
- |
- CPDF_IndirectObjects* GetObjList() const |
- { |
- return m_pObjList; |
- } |
- |
- FX_DWORD GetRefObjNum() const |
- { |
- return m_RefObjNum; |
- } |
- |
- void SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum); |
- |
- FX_BOOL Identical(CPDF_Reference* pOther) const |
- { |
- return m_RefObjNum == pOther->m_RefObjNum; |
- } |
-protected: |
- |
- CPDF_IndirectObjects* m_pObjList; |
- |
- FX_DWORD m_RefObjNum; |
- friend class CPDF_Object; |
-}; |
-class CPDF_IndirectObjects : public CFX_Object |
-{ |
-public: |
- |
- CPDF_IndirectObjects(IPDF_DocParser* pParser); |
+class CPDF_IndirectObjects : public CFX_Object { |
+ public: |
+ CPDF_IndirectObjects(IPDF_DocParser* pParser); |
- ~CPDF_IndirectObjects(); |
+ ~CPDF_IndirectObjects(); |
- CPDF_Object* GetIndirectObject(FX_DWORD objnum, struct PARSE_CONTEXT* pContext = NULL); |
+ CPDF_Object* GetIndirectObject(FX_DWORD objnum, |
+ struct PARSE_CONTEXT* pContext = NULL); |
- int GetIndirectType(FX_DWORD objnum); |
+ int GetIndirectType(FX_DWORD objnum); |
- FX_DWORD AddIndirectObject(CPDF_Object* pObj); |
+ FX_DWORD AddIndirectObject(CPDF_Object* pObj); |
- void ReleaseIndirectObject(FX_DWORD objnum); |
+ void ReleaseIndirectObject(FX_DWORD objnum); |
- void InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); |
+ void InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); |
- FX_DWORD GetLastObjNum() const; |
+ FX_DWORD GetLastObjNum() const; |
- FX_POSITION GetStartPosition() const |
- { |
- return m_IndirectObjs.GetStartPosition(); |
- } |
+ FX_POSITION GetStartPosition() const { |
+ return m_IndirectObjs.GetStartPosition(); |
+ } |
- void GetNextAssoc(FX_POSITION& rPos, FX_DWORD& objnum, CPDF_Object*& pObject) const |
- { |
- m_IndirectObjs.GetNextAssoc(rPos, (void*&)objnum, (void*&)pObject); |
- } |
-protected: |
+ void GetNextAssoc(FX_POSITION& rPos, |
+ FX_DWORD& objnum, |
+ CPDF_Object*& pObject) const { |
+ m_IndirectObjs.GetNextAssoc(rPos, (void*&)objnum, (void*&)pObject); |
+ } |
- CFX_MapPtrToPtr m_IndirectObjs; |
+ protected: |
+ CFX_MapPtrToPtr m_IndirectObjs; |
- IPDF_DocParser* m_pParser; |
+ IPDF_DocParser* m_pParser; |
- FX_DWORD m_LastObjNum; |
+ FX_DWORD m_LastObjNum; |
}; |
#endif |