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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 CFX_ByteString csTemp = csBValue.Left(2); | 41 CFX_ByteString csTemp = csBValue.Left(2); |
42 if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF") | 42 if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF") |
43 return PDF_DecodeText(csBValue); | 43 return PDF_DecodeText(csBValue); |
44 return CFX_WideString::FromLocal(csBValue.AsStringC()); | 44 return CFX_WideString::FromLocal(csBValue.AsStringC()); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 class CFieldNameExtractor { | 49 class CFieldNameExtractor { |
50 public: | 50 public: |
51 explicit CFieldNameExtractor(const CFX_WideString& full_name) { | 51 explicit CFieldNameExtractor(const CFX_WideString& full_name) |
52 m_pStart = full_name.c_str(); | 52 : m_FullName(full_name) { |
53 m_pEnd = m_pStart + full_name.GetLength(); | 53 m_pCur = m_FullName.c_str(); |
54 m_pCur = m_pStart; | 54 m_pEnd = m_pCur + m_FullName.GetLength(); |
55 } | 55 } |
| 56 |
56 void GetNext(const FX_WCHAR*& pSubName, FX_STRSIZE& size) { | 57 void GetNext(const FX_WCHAR*& pSubName, FX_STRSIZE& size) { |
57 pSubName = m_pCur; | 58 pSubName = m_pCur; |
58 while (m_pCur < m_pEnd && m_pCur[0] != L'.') { | 59 while (m_pCur < m_pEnd && m_pCur[0] != L'.') { |
59 m_pCur++; | 60 m_pCur++; |
60 } | 61 } |
61 size = (FX_STRSIZE)(m_pCur - pSubName); | 62 size = (FX_STRSIZE)(m_pCur - pSubName); |
62 if (m_pCur < m_pEnd && m_pCur[0] == L'.') { | 63 if (m_pCur < m_pEnd && m_pCur[0] == L'.') { |
63 m_pCur++; | 64 m_pCur++; |
64 } | 65 } |
65 } | 66 } |
66 | 67 |
67 protected: | 68 protected: |
68 const FX_WCHAR* m_pStart; | 69 CFX_WideString m_FullName; |
| 70 const FX_WCHAR* m_pCur; |
69 const FX_WCHAR* m_pEnd; | 71 const FX_WCHAR* m_pEnd; |
70 const FX_WCHAR* m_pCur; | |
71 }; | 72 }; |
| 73 |
72 class CFieldTree { | 74 class CFieldTree { |
73 public: | 75 public: |
74 struct _Node { | 76 struct _Node { |
75 _Node* parent; | 77 _Node* parent; |
76 CFX_ArrayTemplate<_Node*> children; | 78 CFX_ArrayTemplate<_Node*> children; |
77 CFX_WideString short_name; | 79 CFX_WideString short_name; |
78 CPDF_FormField* field_ptr; | 80 CPDF_FormField* field_ptr; |
79 int CountFields(int nLevel = 0) { | 81 int CountFields(int nLevel = 0) { |
80 if (nLevel > nMaxRecursion) { | 82 if (nLevel > nMaxRecursion) { |
81 return 0; | 83 return 0; |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 FDF_ImportField(pField, L"", bNotify); | 1203 FDF_ImportField(pField, L"", bNotify); |
1202 } | 1204 } |
1203 if (bNotify && m_pFormNotify) { | 1205 if (bNotify && m_pFormNotify) { |
1204 m_pFormNotify->AfterFormImportData(this); | 1206 m_pFormNotify->AfterFormImportData(this); |
1205 } | 1207 } |
1206 return TRUE; | 1208 return TRUE; |
1207 } | 1209 } |
1208 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1210 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
1209 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1211 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
1210 } | 1212 } |
OLD | NEW |