diff options
Diffstat (limited to 'core/include/fpdfapi')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 20 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_parser.h | 71 |
2 files changed, 35 insertions, 56 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 72beb2ceee..c0065def47 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -9,21 +9,22 @@ #include "../fxcrt/fx_ext.h" +class CPDF_Array; +class CPDF_Boolean; +class CPDF_CryptoHandler; +class CPDF_Dictionary; class CPDF_Document; class CPDF_IndirectObjects; class CPDF_Null; -class CPDF_Boolean; class CPDF_Number; -class CPDF_String; +class CPDF_Parser; +class CPDF_Reference; class CPDF_Stream; class CPDF_StreamAcc; class CPDF_StreamFilter; -class CPDF_Array; -class CPDF_Dictionary; -class CPDF_Reference; -class IPDF_DocParser; +class CPDF_String; class IFX_FileRead; -class CPDF_CryptoHandler; + #define PDFOBJ_INVALID 0 #define PDFOBJ_BOOLEAN 1 #define PDFOBJ_NUMBER 2 @@ -34,6 +35,7 @@ class CPDF_CryptoHandler; #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 { @@ -709,7 +711,7 @@ class CPDF_IndirectObjects { public: - CPDF_IndirectObjects(IPDF_DocParser* pParser); + CPDF_IndirectObjects(CPDF_Parser* pParser); ~CPDF_IndirectObjects(); @@ -738,7 +740,7 @@ protected: CFX_MapPtrToPtr m_IndirectObjs; - IPDF_DocParser* m_pParser; + CPDF_Parser* m_pParser; FX_DWORD m_LastObjNum; }; diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index 0dc9ca64a3..34568e79ca 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -11,7 +11,6 @@ #include "fpdf_objects.h" class CPDF_Document; -class IPDF_DocParser; class CPDF_Parser; class CPDF_SecurityHandler; class CPDF_StandardSecurityHandler; @@ -61,14 +60,12 @@ public: class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects { public: - - CPDF_Document(IPDF_DocParser* pParser); - CPDF_Document(); + explicit CPDF_Document(CPDF_Parser* pParser); ~CPDF_Document(); - IPDF_DocParser* GetParser() const + CPDF_Parser* GetParser() const { return m_pParser; } @@ -370,33 +367,6 @@ struct PARSE_CONTEXT { FX_FILESIZE m_DataEnd; }; -class IPDF_DocParser -{ -public: - virtual ~IPDF_DocParser() { } - virtual FX_DWORD GetRootObjNum() = 0; - - virtual FX_DWORD GetInfoObjNum() = 0; - - virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0; - - virtual FX_DWORD GetLastObjNum() = 0; - - virtual CPDF_Array* GetIDArray() = 0; - - virtual CPDF_Dictionary* GetEncryptDict() = 0; - - FX_BOOL IsEncrypted() - { - return GetEncryptDict() != NULL; - } - - virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) = 0; - - virtual FX_BOOL IsOwner() = 0; - - virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) = 0; -}; #define PDFPARSE_ERROR_SUCCESS 0 #define PDFPARSE_ERROR_FILE 1 @@ -404,24 +374,22 @@ public: #define PDFPARSE_ERROR_PASSWORD 3 #define PDFPARSE_ERROR_HANDLER 4 #define PDFPARSE_ERROR_CERT 5 -class CPDF_Parser FX_FINAL : public IPDF_DocParser + +class CPDF_Parser { public: - CPDF_Parser(); - ~CPDF_Parser() override; + ~CPDF_Parser(); FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse = FALSE); - FX_DWORD StartParse(FX_LPCWSTR filename, FX_BOOL bReParse = FALSE); - FX_DWORD StartParse(IFX_FileRead* pFile, FX_BOOL bReParse = FALSE, FX_BOOL bOwnFileRead = TRUE); void CloseParser(FX_BOOL bReParse = FALSE); - virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) FX_OVERRIDE; + FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); - virtual FX_BOOL IsOwner() FX_OVERRIDE; + FX_BOOL IsOwner(); void SetPassword(const FX_CHAR* password) { @@ -464,21 +432,30 @@ public: { return m_pDocument; } - CFX_ArrayTemplate<CPDF_Dictionary *> * GetOtherTrailers() + + CFX_ArrayTemplate<CPDF_Dictionary*>* GetOtherTrailers() { return &m_Trailers; } - virtual FX_DWORD GetRootObjNum() FX_OVERRIDE; - virtual FX_DWORD GetInfoObjNum() FX_OVERRIDE; - virtual CPDF_Array* GetIDArray() FX_OVERRIDE; - virtual CPDF_Dictionary* GetEncryptDict() FX_OVERRIDE + FX_DWORD GetRootObjNum(); + FX_DWORD GetInfoObjNum() ; + CPDF_Array* GetIDArray() ; + + CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } - virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) FX_OVERRIDE; - virtual FX_DWORD GetLastObjNum() FX_OVERRIDE; - virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) FX_OVERRIDE; + + FX_BOOL IsEncrypted() + { + return GetEncryptDict() != NULL; + } + + + CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) ; + FX_DWORD GetLastObjNum(); + FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); FX_FILESIZE GetObjectOffset(FX_DWORD objnum); |