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 #include "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 #include "../../include/fxcrt/fx_xml.h" | 8 #include "../../include/fxcrt/fx_xml.h" |
9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); | 9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); |
10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu
ment* pDocument); | 10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu
ment* pDocument); |
(...skipping 11 matching lines...) Expand all Loading... |
22 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CP
DF_Font* pFont); | 22 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CP
DF_Font* pFont); |
23 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_Byte
String csNameTag); | 23 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_Byte
String csNameTag); |
24 CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF
_Document* pDocument); | 24 CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF
_Document* pDocument); |
25 void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPD
F_Document* pDocument, const CPDF_Font* pFont); | 25 void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPD
F_Document* pDocument, const CPDF_Font* pFont); |
26 void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteA
rray& statusArray); | 26 void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteA
rray& statusArray); |
27 FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFi
eldName); | 27 FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFi
eldName); |
28 FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, i
nt nLevel = 0); | 28 FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, i
nt nLevel = 0); |
29 void EncodeFieldName(const CFX_WideString& csName, CFX_ByteSt
ring& csT); | 29 void EncodeFieldName(const CFX_WideString& csName, CFX_ByteSt
ring& csT); |
30 void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int n
Level = 0); | 30 void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int n
Level = 0); |
31 const int nMaxRecursion = 32; | 31 const int nMaxRecursion = 32; |
32 class _CFieldNameExtractor : public CFX_Object | 32 class _CFieldNameExtractor |
33 { | 33 { |
34 public: | 34 public: |
35 _CFieldNameExtractor(const CFX_WideString& full_name) | 35 _CFieldNameExtractor(const CFX_WideString& full_name) |
36 { | 36 { |
37 m_pStart = full_name; | 37 m_pStart = full_name; |
38 m_pEnd = m_pStart + full_name.GetLength(); | 38 m_pEnd = m_pStart + full_name.GetLength(); |
39 m_pCur = m_pStart; | 39 m_pCur = m_pStart; |
40 } | 40 } |
41 void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size) | 41 void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size) |
42 { | 42 { |
43 pSubName = m_pCur; | 43 pSubName = m_pCur; |
44 while (m_pCur < m_pEnd && m_pCur[0] != L'.') { | 44 while (m_pCur < m_pEnd && m_pCur[0] != L'.') { |
45 m_pCur++; | 45 m_pCur++; |
46 } | 46 } |
47 size = (FX_STRSIZE)(m_pCur - pSubName); | 47 size = (FX_STRSIZE)(m_pCur - pSubName); |
48 if (m_pCur < m_pEnd && m_pCur[0] == L'.') { | 48 if (m_pCur < m_pEnd && m_pCur[0] == L'.') { |
49 m_pCur++; | 49 m_pCur++; |
50 } | 50 } |
51 } | 51 } |
52 protected: | 52 protected: |
53 FX_LPCWSTR m_pStart; | 53 FX_LPCWSTR m_pStart; |
54 FX_LPCWSTR m_pEnd; | 54 FX_LPCWSTR m_pEnd; |
55 FX_LPCWSTR m_pCur; | 55 FX_LPCWSTR m_pCur; |
56 }; | 56 }; |
57 class CFieldTree : public CFX_Object | 57 class CFieldTree |
58 { | 58 { |
59 public: | 59 public: |
60 struct _Node : public CFX_Object { | 60 struct _Node { |
61 _Node *parent; | 61 _Node *parent; |
62 CFX_PtrArray children; | 62 CFX_PtrArray children; |
63 CFX_WideString short_name; | 63 CFX_WideString short_name; |
64 CPDF_FormField *field_ptr; | 64 CPDF_FormField *field_ptr; |
65 int CountFields(int nLevel = 0) | 65 int CountFields(int nLevel = 0) |
66 { | 66 { |
67 if (nLevel > nMaxRecursion) { | 67 if (nLevel > nMaxRecursion) { |
68 return 0; | 68 return 0; |
69 } | 69 } |
70 if (field_ptr) { | 70 if (field_ptr) { |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 continue; | 1655 continue; |
1656 } | 1656 } |
1657 CPDF_FormControl* pControl = NULL; | 1657 CPDF_FormControl* pControl = NULL; |
1658 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { | 1658 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { |
1659 return iNewPage; | 1659 return iNewPage; |
1660 } | 1660 } |
1661 } | 1661 } |
1662 } while (TRUE); | 1662 } while (TRUE); |
1663 return -1; | 1663 return -1; |
1664 } | 1664 } |
OLD | NEW |