| 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" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
, const FX_INT32 & nWidgetType) | 247 static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
, const FX_INT32 & nWidgetType) |
| 248 { | 248 { |
| 249 CPDF_Dictionary* pFormDict = NULL; | 249 CPDF_Dictionary* pFormDict = NULL; |
| 250 if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { | 250 if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { |
| 251 pFormDict = pRootDict->GetDict("AcroForm"); | 251 pFormDict = pRootDict->GetDict("AcroForm"); |
| 252 } | 252 } |
| 253 if (!pFormDict) { | 253 if (!pFormDict) { |
| 254 return FALSE; | 254 return FALSE; |
| 255 } | 255 } |
| 256 CFX_ByteString DA = FPDF_GetFieldAttr(pAnnotDict, "DA") ? FPDF_GetFieldAttr(
pAnnotDict, "DA")->GetString() : CFX_ByteString(); | 256 CFX_ByteString DA; |
| 257 if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) { |
| 258 DA = pDAObj->GetString(); |
| 259 } |
| 257 if (DA.IsEmpty()) { | 260 if (DA.IsEmpty()) { |
| 258 DA = pFormDict->GetString("DA"); | 261 DA = pFormDict->GetString("DA"); |
| 259 } | 262 } |
| 260 if (DA.IsEmpty()) { | 263 if (DA.IsEmpty()) { |
| 261 return FALSE; | 264 return FALSE; |
| 262 } | 265 } |
| 263 CPDF_SimpleParser syntax(DA); | 266 CPDF_SimpleParser syntax(DA); |
| 264 syntax.FindTagParam("Tf", 2); | 267 syntax.FindTagParam("Tf", 2); |
| 265 CFX_ByteString sFontName = syntax.GetWord(); | 268 CFX_ByteString sFontName = syntax.GetWord(); |
| 266 sFontName = PDF_NameDecode(sFontName); | 269 sFontName = PDF_NameDecode(sFontName); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 case CT_GRAY: | 802 case CT_GRAY: |
| 800 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G")
<< "\n"; | 803 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G")
<< "\n"; |
| 801 break; | 804 break; |
| 802 case CT_CMYK: | 805 case CT_CMYK: |
| 803 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo
r.fColor3 << " " << color.fColor4 << " " | 806 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo
r.fColor3 << " " << color.fColor4 << " " |
| 804 << (bFillOrStroke ? "k" : "K") << "\n"; | 807 << (bFillOrStroke ? "k" : "K") << "\n"; |
| 805 break; | 808 break; |
| 806 } | 809 } |
| 807 return sColorStream.GetByteString(); | 810 return sColorStream.GetByteString(); |
| 808 } | 811 } |
| OLD | NEW |