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/fpdfdoc/fpdf_vt.h" | 8 #include "../../include/fpdfdoc/fpdf_vt.h" |
9 #include "pdf_vt.h" | 9 #include "pdf_vt.h" |
10 #include "../../include/fpdfdoc/fpdf_ap.h" | 10 #include "../../include/fpdfdoc/fpdf_ap.h" |
11 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) | 11 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) |
12 { | 12 { |
13 if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget
")) { | 13 if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget
")) { |
14 return FALSE; | 14 return FALSE; |
15 } | 15 } |
16 CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString()
; | 16 CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString()
; |
17 FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnn
otDict, "Ff")->GetInteger() : 0; | 17 FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnn
otDict, "Ff")->GetInteger() : 0; |
18 if (field_type == "Tx") { | 18 if (field_type == "Tx") { |
19 return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict); | 19 return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict); |
20 } else if (field_type == "Ch") { | 20 } |
21 if (flags & (1 << 17)) { | 21 if (field_type == "Ch") { |
22 return CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict); | 22 return (flags & (1 << 17)) ? |
23 } else { | 23 CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict) : |
24 return CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict); | 24 CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict); |
25 } | 25 } |
26 } else if (field_type == "Btn") { | 26 if (field_type == "Btn") { |
27 if (!(flags & (1 << 16))) { | 27 if (!(flags & (1 << 16))) { |
28 if (!pAnnotDict->KeyExist("AS")) { | 28 if (!pAnnotDict->KeyExist("AS")) { |
29 if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent")
) { | 29 if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent")
) { |
30 if (pParentDict->KeyExist("AS")) { | 30 if (pParentDict->KeyExist("AS")) { |
31 pAnnotDict->SetAtString("AS", pParentDict->GetString("AS
")); | 31 pAnnotDict->SetAtString("AS", pParentDict->GetString("AS
")); |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |
35 } | 35 } |
36 } | 36 } |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 case CT_GRAY: | 801 case CT_GRAY: |
802 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G")
<< "\n"; | 802 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G")
<< "\n"; |
803 break; | 803 break; |
804 case CT_CMYK: | 804 case CT_CMYK: |
805 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo
r.fColor3 << " " << color.fColor4 << " " | 805 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo
r.fColor3 << " " << color.fColor4 << " " |
806 << (bFillOrStroke ? "k" : "K") << "\n"; | 806 << (bFillOrStroke ? "k" : "K") << "\n"; |
807 break; | 807 break; |
808 } | 808 } |
809 return sColorStream.GetByteString(); | 809 return sColorStream.GetByteString(); |
810 } | 810 } |
OLD | NEW |