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 17 matching lines...) Expand all Loading... |
28 {"GBK", 936}, | 28 {"GBK", 936}, |
29 {"Shift-JIS", 932}, | 29 {"Shift-JIS", 932}, |
30 {"UHC", 949}, | 30 {"UHC", 949}, |
31 }; | 31 }; |
32 | 32 |
33 CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, | 33 CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, |
34 const CFX_ByteString& bsEncoding) { | 34 const CFX_ByteString& bsEncoding) { |
35 const CFX_ByteString csBValue = pFieldDict.GetStringBy("V"); | 35 const CFX_ByteString csBValue = pFieldDict.GetStringBy("V"); |
36 for (const auto& encoding : g_fieldEncoding) { | 36 for (const auto& encoding : g_fieldEncoding) { |
37 if (bsEncoding == encoding.m_name) | 37 if (bsEncoding == encoding.m_name) |
38 return CFX_WideString::FromCodePage(csBValue.AsByteStringC(), | 38 return CFX_WideString::FromCodePage(csBValue.AsStringC(), |
39 encoding.m_codePage); | 39 encoding.m_codePage); |
40 } | 40 } |
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.AsByteStringC()); | 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_pStart = full_name.c_str(); |
53 m_pEnd = m_pStart + full_name.GetLength(); | 53 m_pEnd = m_pStart + full_name.GetLength(); |
54 m_pCur = m_pStart; | 54 m_pCur = m_pStart; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return csTmp; | 338 return csTmp; |
339 } | 339 } |
340 CPDF_Dictionary* pDict = pResDict->GetDictBy(csType); | 340 CPDF_Dictionary* pDict = pResDict->GetDictBy(csType); |
341 if (!pDict) { | 341 if (!pDict) { |
342 return csTmp; | 342 return csTmp; |
343 } | 343 } |
344 int num = 0; | 344 int num = 0; |
345 CFX_ByteString bsNum; | 345 CFX_ByteString bsNum; |
346 while (TRUE) { | 346 while (TRUE) { |
347 CFX_ByteString csKey = csTmp + bsNum; | 347 CFX_ByteString csKey = csTmp + bsNum; |
348 if (!pDict->KeyExist(csKey.AsByteStringC())) { | 348 if (!pDict->KeyExist(csKey.AsStringC())) { |
349 return csKey; | 349 return csKey; |
350 } | 350 } |
351 if (m < iCount) { | 351 if (m < iCount) { |
352 csTmp += csStr[m++]; | 352 csTmp += csStr[m++]; |
353 } else { | 353 } else { |
354 bsNum.Format("%d", num++); | 354 bsNum.Format("%d", num++); |
355 } | 355 } |
356 m++; | 356 m++; |
357 } | 357 } |
358 return csTmp; | 358 return csTmp; |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 FDF_ImportField(pField, L"", bNotify); | 1202 FDF_ImportField(pField, L"", bNotify); |
1203 } | 1203 } |
1204 if (bNotify && m_pFormNotify) { | 1204 if (bNotify && m_pFormNotify) { |
1205 m_pFormNotify->AfterFormImportData(this); | 1205 m_pFormNotify->AfterFormImportData(this); |
1206 } | 1206 } |
1207 return TRUE; | 1207 return TRUE; |
1208 } | 1208 } |
1209 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1209 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
1210 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1210 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
1211 } | 1211 } |
OLD | NEW |