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 CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA"); | |
258 if (pDAObj) { | |
Nico
2014/07/21 05:07:53
Since pDAObj is only used in the if, you can write
Bo Xu
2014/07/21 16:40:44
Agree!
| |
259 DA = pDAObj->GetString(); | |
260 } | |
257 if (DA.IsEmpty()) { | 261 if (DA.IsEmpty()) { |
258 DA = pFormDict->GetString("DA"); | 262 DA = pFormDict->GetString("DA"); |
259 } | 263 } |
260 if (DA.IsEmpty()) { | 264 if (DA.IsEmpty()) { |
261 return FALSE; | 265 return FALSE; |
262 } | 266 } |
263 CPDF_SimpleParser syntax(DA); | 267 CPDF_SimpleParser syntax(DA); |
264 syntax.FindTagParam("Tf", 2); | 268 syntax.FindTagParam("Tf", 2); |
265 CFX_ByteString sFontName = syntax.GetWord(); | 269 CFX_ByteString sFontName = syntax.GetWord(); |
266 sFontName = PDF_NameDecode(sFontName); | 270 sFontName = PDF_NameDecode(sFontName); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 case CT_GRAY: | 803 case CT_GRAY: |
800 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; | 804 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; |
801 break; | 805 break; |
802 case CT_CMYK: | 806 case CT_CMYK: |
803 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " " | 807 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " " |
804 << (bFillOrStroke ? "k" : "K") << "\n"; | 808 << (bFillOrStroke ? "k" : "K") << "\n"; |
805 break; | 809 break; |
806 } | 810 } |
807 return sColorStream.GetByteString(); | 811 return sColorStream.GetByteString(); |
808 } | 812 } |
OLD | NEW |