OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FPDF_PARSER_ | 7 #ifndef _FPDF_PARSER_ |
8 #define _FPDF_PARSER_ | 8 #define _FPDF_PARSER_ |
9 #ifndef _FX_BASIC_H_ | 9 #ifndef _FX_BASIC_H_ |
10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 CPDF_DocRenderData* m_pDocRender; | 205 CPDF_DocRenderData* m_pDocRender; |
206 | 206 |
207 }; | 207 }; |
208 | 208 |
209 #define PDFWORD_EOF 0 | 209 #define PDFWORD_EOF 0 |
210 #define PDFWORD_NUMBER 1 | 210 #define PDFWORD_NUMBER 1 |
211 #define PDFWORD_TEXT 2 | 211 #define PDFWORD_TEXT 2 |
212 #define PDFWORD_DELIMITER 3 | 212 #define PDFWORD_DELIMITER 3 |
213 #define PDFWORD_NAME 4 | 213 #define PDFWORD_NAME 4 |
214 class CPDF_SimpleParser : public CFX_Object | 214 class CPDF_SimpleParser |
215 { | 215 { |
216 public: | 216 public: |
217 | 217 |
218 CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize); | 218 CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize); |
219 | 219 |
220 CPDF_SimpleParser(FX_BSTR str); | 220 CPDF_SimpleParser(FX_BSTR str); |
221 | 221 |
222 CFX_ByteStringC GetWord(); | 222 CFX_ByteStringC GetWord(); |
223 | 223 |
224 FX_BOOL SearchToken(FX_BSTR token); | 224 FX_BOOL SearchToken(FX_BSTR token); |
(...skipping 18 matching lines...) Expand all Loading... |
243 private: | 243 private: |
244 | 244 |
245 void ParseWord(FX_LPCBYTE& pStart, FX_DWORD&
dwSize, int& type); | 245 void ParseWord(FX_LPCBYTE& pStart, FX_DWORD&
dwSize, int& type); |
246 | 246 |
247 FX_LPCBYTE m_pData; | 247 FX_LPCBYTE m_pData; |
248 | 248 |
249 FX_DWORD m_dwSize; | 249 FX_DWORD m_dwSize; |
250 | 250 |
251 FX_DWORD m_dwCurPos; | 251 FX_DWORD m_dwCurPos; |
252 }; | 252 }; |
253 class CPDF_SyntaxParser : public CFX_Object | 253 class CPDF_SyntaxParser |
254 { | 254 { |
255 public: | 255 public: |
256 | 256 |
257 CPDF_SyntaxParser(); | 257 CPDF_SyntaxParser(); |
258 virtual ~CPDF_SyntaxParser(); | 258 virtual ~CPDF_SyntaxParser(); |
259 | 259 |
260 void InitParser(IFX_FileRead* pFileAccess, FX
_DWORD HeaderOffset); | 260 void InitParser(IFX_FileRead* pFileAccess, FX
_DWORD HeaderOffset); |
261 | 261 |
262 FX_FILESIZE SavePos() | 262 FX_FILESIZE SavePos() |
263 { | 263 { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 FX_BOOL m_Flags; | 365 FX_BOOL m_Flags; |
366 | 366 |
367 FX_FILESIZE m_DictStart; | 367 FX_FILESIZE m_DictStart; |
368 | 368 |
369 FX_FILESIZE m_DictEnd; | 369 FX_FILESIZE m_DictEnd; |
370 | 370 |
371 FX_FILESIZE m_DataStart; | 371 FX_FILESIZE m_DataStart; |
372 | 372 |
373 FX_FILESIZE m_DataEnd; | 373 FX_FILESIZE m_DataEnd; |
374 }; | 374 }; |
375 class IPDF_DocParser : public CFX_Object | 375 class IPDF_DocParser |
376 { | 376 { |
377 public: | 377 public: |
378 virtual ~IPDF_DocParser() { } | 378 virtual ~IPDF_DocParser() { } |
379 virtual FX_DWORD GetRootObjNum() = 0; | 379 virtual FX_DWORD GetRootObjNum() = 0; |
380 | 380 |
381 virtual FX_DWORD GetInfoObjNum() = 0; | 381 virtual FX_DWORD GetInfoObjNum() = 0; |
382 | 382 |
383 virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjLi
st, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0; | 383 virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjLi
st, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0; |
384 | 384 |
385 virtual FX_DWORD GetLastObjNum() = 0; | 385 virtual FX_DWORD GetLastObjNum() = 0; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 FX_DWORD m_dwFirstPageNo; | 606 FX_DWORD m_dwFirstPageNo; |
607 | 607 |
608 FX_DWORD m_dwXrefStartObjNum; | 608 FX_DWORD m_dwXrefStartObjNum; |
609 friend class CPDF_Creator; | 609 friend class CPDF_Creator; |
610 friend class CPDF_DataAvail; | 610 friend class CPDF_DataAvail; |
611 }; | 611 }; |
612 #define FXCIPHER_NONE 0 | 612 #define FXCIPHER_NONE 0 |
613 #define FXCIPHER_RC4 1 | 613 #define FXCIPHER_RC4 1 |
614 #define FXCIPHER_AES 2 | 614 #define FXCIPHER_AES 2 |
615 #define FXCIPHER_AES2 3 | 615 #define FXCIPHER_AES2 3 |
616 class CPDF_SecurityHandler : public CFX_Object | 616 class CPDF_SecurityHandler |
617 { | 617 { |
618 public: | 618 public: |
619 | 619 |
620 virtual ~CPDF_SecurityHandler() {} | 620 virtual ~CPDF_SecurityHandler() {} |
621 | 621 |
622 virtual FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pE
ncryptDict) = 0; | 622 virtual FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pE
ncryptDict) = 0; |
623 | 623 |
624 virtual FX_DWORD GetPermissions() = 0; | 624 virtual FX_DWORD GetPermissions() = 0; |
625 | 625 |
626 virtual FX_BOOL IsOwner() = 0; | 626 virtual FX_BOOL IsOwner() = 0; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 FX_BOOL m_bOwner; | 708 FX_BOOL m_bOwner; |
709 | 709 |
710 FX_DWORD m_Permissions; | 710 FX_DWORD m_Permissions; |
711 | 711 |
712 int m_Cipher; | 712 int m_Cipher; |
713 | 713 |
714 FX_BYTE m_EncryptKey[32]; | 714 FX_BYTE m_EncryptKey[32]; |
715 | 715 |
716 int m_KeyLen; | 716 int m_KeyLen; |
717 }; | 717 }; |
718 class CPDF_CryptoHandler : public CFX_Object | 718 class CPDF_CryptoHandler |
719 { | 719 { |
720 public: | 720 public: |
721 | 721 |
722 virtual ~CPDF_CryptoHandler() {} | 722 virtual ~CPDF_CryptoHandler() {} |
723 | 723 |
724 virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, CPDF_Securit
yHandler* pSecurityHandler) = 0; | 724 virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, CPDF_Securit
yHandler* pSecurityHandler) = 0; |
725 | 725 |
726 virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; | 726 virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; |
727 | 727 |
728 virtual FX_LPVOID DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; | 728 virtual FX_LPVOID DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 virtual FX_BOOL CryptFinish(FX_LPVOID context, CFX_BinaryBuf& de
st_buf, FX_BOOL bEncrypt); | 765 virtual FX_BOOL CryptFinish(FX_LPVOID context, CFX_BinaryBuf& de
st_buf, FX_BOOL bEncrypt); |
766 | 766 |
767 FX_BYTE m_EncryptKey[32]; | 767 FX_BYTE m_EncryptKey[32]; |
768 | 768 |
769 int m_KeyLen; | 769 int m_KeyLen; |
770 | 770 |
771 int m_Cipher; | 771 int m_Cipher; |
772 | 772 |
773 FX_LPBYTE m_pAESContext; | 773 FX_LPBYTE m_pAESContext; |
774 }; | 774 }; |
775 class CPDF_Point : public CFX_Object | 775 class CPDF_Point |
776 { | 776 { |
777 public: | 777 public: |
778 | 778 |
779 CPDF_Point(FX_FLOAT xx, FX_FLOAT yy) | 779 CPDF_Point(FX_FLOAT xx, FX_FLOAT yy) |
780 { | 780 { |
781 x = xx; | 781 x = xx; |
782 y = yy; | 782 y = yy; |
783 } | 783 } |
784 | 784 |
785 FX_FLOAT x; | 785 FX_FLOAT x; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 IFX_FileRead* m_pFile; | 822 IFX_FileRead* m_pFile; |
823 FX_BOOL m_bOwnFile; | 823 FX_BOOL m_bOwnFile; |
824 }; | 824 }; |
825 | 825 |
826 CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec); | 826 CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec); |
827 void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const
CFX_WideString& fullpath); | 827 void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const
CFX_WideString& fullpath); |
828 | 828 |
829 void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
FX_DWORD& dest_size); | 829 void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf,
FX_DWORD& dest_size); |
830 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size); | 830 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size); |
831 FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d
est_buf, FX_DWORD& dest_size); | 831 FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d
est_buf, FX_DWORD& dest_size); |
832 class CPDF_NumberTree : public CFX_Object | 832 class CPDF_NumberTree |
833 { | 833 { |
834 public: | 834 public: |
835 | 835 |
836 CPDF_NumberTree(CPDF_Dictionary* pRoot) | 836 CPDF_NumberTree(CPDF_Dictionary* pRoot) |
837 { | 837 { |
838 m_pRoot = pRoot; | 838 m_pRoot = pRoot; |
839 } | 839 } |
840 | 840 |
841 CPDF_Object* LookupValue(int num); | 841 CPDF_Object* LookupValue(int num); |
842 protected: | 842 protected: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; | 878 virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; |
879 virtual FX_INT32 IsLinearizedPDF() = 0; | 879 virtual FX_INT32 IsLinearizedPDF() = 0; |
880 virtual void GetLinearizedMainXRefInfo(FX_FIL
ESIZE *pPos, FX_DWORD *pSize) = 0; | 880 virtual void GetLinearizedMainXRefInfo(FX_FIL
ESIZE *pPos, FX_DWORD *pSize) = 0; |
881 | 881 |
882 protected: | 882 protected: |
883 IPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead); | 883 IPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead); |
884 | 884 |
885 IFX_FileAvail* m_pFileAvail; | 885 IFX_FileAvail* m_pFileAvail; |
886 IFX_FileRead* m_pFileRead; | 886 IFX_FileRead* m_pFileRead; |
887 }; | 887 }; |
888 class CPDF_SortObjNumArray : public CFX_Object | 888 class CPDF_SortObjNumArray |
889 { | 889 { |
890 public: | 890 public: |
891 | 891 |
892 void AddObjNum(FX_DWORD dwObjNum); | 892 void AddObjNum(FX_DWORD dwObjNum); |
893 | 893 |
894 FX_BOOL Find(FX_DWORD dwObjNum); | 894 FX_BOOL Find(FX_DWORD dwObjNum); |
895 | 895 |
896 void RemoveAll() | 896 void RemoveAll() |
897 { | 897 { |
898 m_number_array.RemoveAll(); | 898 m_number_array.RemoveAll(); |
899 } | 899 } |
900 protected: | 900 protected: |
901 | 901 |
902 FX_BOOL BinarySearch(FX_DWORD value, int &iNext); | 902 FX_BOOL BinarySearch(FX_DWORD value, int &iNext); |
903 protected: | 903 protected: |
904 | 904 |
905 CFX_DWordArray m_number_array; | 905 CFX_DWordArray m_number_array; |
906 }; | 906 }; |
907 enum PDF_PAGENODE_TYPE { | 907 enum PDF_PAGENODE_TYPE { |
908 PDF_PAGENODE_UNKOWN = 0, | 908 PDF_PAGENODE_UNKOWN = 0, |
909 PDF_PAGENODE_PAGE, | 909 PDF_PAGENODE_PAGE, |
910 PDF_PAGENODE_PAGES, | 910 PDF_PAGENODE_PAGES, |
911 PDF_PAGENODE_ARRAY, | 911 PDF_PAGENODE_ARRAY, |
912 }; | 912 }; |
913 class CPDF_PageNode : public CFX_Object | 913 class CPDF_PageNode |
914 { | 914 { |
915 public: | 915 public: |
916 CPDF_PageNode() : m_type(PDF_PAGENODE_UNKOWN) {} | 916 CPDF_PageNode() : m_type(PDF_PAGENODE_UNKOWN) {} |
917 ~CPDF_PageNode(); | 917 ~CPDF_PageNode(); |
918 PDF_PAGENODE_TYPE m_type; | 918 PDF_PAGENODE_TYPE m_type; |
919 FX_DWORD m_dwPageNo; | 919 FX_DWORD m_dwPageNo; |
920 CFX_PtrArray m_childNode; | 920 CFX_PtrArray m_childNode; |
921 }; | 921 }; |
922 enum PDF_DATAAVAIL_STATUS { | 922 enum PDF_DATAAVAIL_STATUS { |
923 PDF_DATAAVAIL_HEADER = 0, | 923 PDF_DATAAVAIL_HEADER = 0, |
(...skipping 12 matching lines...) Expand all Loading... |
936 PDF_DATAAVAIL_PAGETREE, | 936 PDF_DATAAVAIL_PAGETREE, |
937 PDF_DATAAVAIL_PAGE, | 937 PDF_DATAAVAIL_PAGE, |
938 PDF_DATAAVAIL_PAGE_LATERLOAD, | 938 PDF_DATAAVAIL_PAGE_LATERLOAD, |
939 PDF_DATAAVAIL_RESOURCES, | 939 PDF_DATAAVAIL_RESOURCES, |
940 PDF_DATAAVAIL_DONE, | 940 PDF_DATAAVAIL_DONE, |
941 PDF_DATAAVAIL_ERROR, | 941 PDF_DATAAVAIL_ERROR, |
942 PDF_DATAAVAIL_LOADALLFILE, | 942 PDF_DATAAVAIL_LOADALLFILE, |
943 PDF_DATAAVAIL_TRAILER_APPEND | 943 PDF_DATAAVAIL_TRAILER_APPEND |
944 }; | 944 }; |
945 #endif | 945 #endif |
OLD | NEW |