| 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 "core/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 8 #include "doc_utils.h" | 8 #include "doc_utils.h" |
| 9 | 9 |
| 10 const int nMaxRecursion = 32; | 10 const int nMaxRecursion = 32; |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 break; | 499 break; |
| 500 case 1361: | 500 case 1361: |
| 501 charSet = JOHAB_CHARSET; | 501 charSet = JOHAB_CHARSET; |
| 502 break; | 502 break; |
| 503 } | 503 } |
| 504 return charSet; | 504 return charSet; |
| 505 #else | 505 #else |
| 506 return 0; | 506 return 0; |
| 507 #endif | 507 #endif |
| 508 } | 508 } |
| 509 |
| 509 CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, | 510 CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, |
| 510 const CPDF_Document* pDocument) { | 511 CPDF_Document* pDocument) { |
| 511 if (pDocument == NULL) { | 512 if (!pDocument) |
| 512 return NULL; | 513 return nullptr; |
| 513 } | 514 |
| 514 CPDF_Font* pFont = NULL; | |
| 515 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 515 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 516 LOGFONTA lf; | 516 LOGFONTA lf; |
| 517 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); | 517 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); |
| 518 if (!csFontName.IsEmpty()) { | 518 if (!csFontName.IsEmpty()) { |
| 519 if (csFontName == "Helvetica") { | 519 if (csFontName == "Helvetica") |
| 520 pFont = AddStandardFont(pDocument, csFontName); | 520 return pFont = AddStandardFont(pDocument, csFontName); |
| 521 } else { | 521 return pDocument->AddWindowsFont(&lf, FALSE, TRUE); |
| 522 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE); | |
| 523 } | |
| 524 } | 522 } |
| 525 #endif | 523 #endif |
| 526 return pFont; | 524 return nullptr; |
| 527 } | 525 } |
| 528 CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) { | 526 |
| 529 if (pDocument == NULL) { | 527 CPDF_Font* CPDF_InterForm::AddNativeFont(CPDF_Document* pDocument) { |
| 530 return NULL; | 528 return pDocument ? AddNativeFont(GetNativeCharSet(), pDocument) : nullptr; |
| 531 } | |
| 532 CPDF_Font* pFont = NULL; | |
| 533 uint8_t charSet = GetNativeCharSet(); | |
| 534 pFont = AddNativeFont(charSet, pDocument); | |
| 535 return pFont; | |
| 536 } | 529 } |
| 530 |
| 537 FX_BOOL CPDF_InterForm::ValidateFieldName( | 531 FX_BOOL CPDF_InterForm::ValidateFieldName( |
| 538 CFX_WideString& csNewFieldName, | 532 CFX_WideString& csNewFieldName, |
| 539 int iType, | 533 int iType, |
| 540 const CPDF_FormField* pExcludedField, | 534 const CPDF_FormField* pExcludedField, |
| 541 const CPDF_FormControl* pExcludedControl) { | 535 const CPDF_FormControl* pExcludedControl) { |
| 542 if (csNewFieldName.IsEmpty()) { | 536 if (csNewFieldName.IsEmpty()) { |
| 543 return FALSE; | 537 return FALSE; |
| 544 } | 538 } |
| 545 int iPos = 0; | 539 int iPos = 0; |
| 546 int iLength = csNewFieldName.GetLength(); | 540 int iLength = csNewFieldName.GetLength(); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 FDF_ImportField(pField, L"", bNotify); | 1270 FDF_ImportField(pField, L"", bNotify); |
| 1277 } | 1271 } |
| 1278 if (bNotify && m_pFormNotify != NULL) { | 1272 if (bNotify && m_pFormNotify != NULL) { |
| 1279 m_pFormNotify->AfterFormImportData(this); | 1273 m_pFormNotify->AfterFormImportData(this); |
| 1280 } | 1274 } |
| 1281 return TRUE; | 1275 return TRUE; |
| 1282 } | 1276 } |
| 1283 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1277 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
| 1284 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1278 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
| 1285 } | 1279 } |
| OLD | NEW |