Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: core/src/fpdfdoc/doc_ap.cpp

Issue 1194933003: Make CPDF_Object::GetString() a virtual method. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 if (flags & (1 << 17)) { 21 if (flags & (1 << 17)) {
22 return CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict); 22 return CPVT_GenerateAP::GenerateComboBoxAP(pDoc, pAnnotDict);
23 } else { 23 } else {
24 return CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict); 24 return CPVT_GenerateAP::GenerateListBoxAP(pDoc, pAnnotDict);
25 } 25 }
26 } else if (field_type == "Btn") { 26 } else 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(
32 "AS", pParentDict->GetStringAt("AS"));
32 } 33 }
33 } 34 }
34 } 35 }
35 } 36 }
36 } 37 }
37 return FALSE; 38 return FALSE;
38 } 39 }
39 class CPVT_FontMap : public IPVT_FontMap 40 class CPVT_FontMap : public IPVT_FontMap
40 { 41 {
41 public: 42 public:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 pFormDict = pRootDict->GetDict("AcroForm"); 252 pFormDict = pRootDict->GetDict("AcroForm");
252 } 253 }
253 if (!pFormDict) { 254 if (!pFormDict) {
254 return FALSE; 255 return FALSE;
255 } 256 }
256 CFX_ByteString DA; 257 CFX_ByteString DA;
257 if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) { 258 if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) {
258 DA = pDAObj->GetString(); 259 DA = pDAObj->GetString();
259 } 260 }
260 if (DA.IsEmpty()) { 261 if (DA.IsEmpty()) {
261 DA = pFormDict->GetString("DA"); 262 DA = pFormDict->GetStringAt("DA");
262 } 263 }
263 if (DA.IsEmpty()) { 264 if (DA.IsEmpty()) {
264 return FALSE; 265 return FALSE;
265 } 266 }
266 CPDF_SimpleParser syntax(DA); 267 CPDF_SimpleParser syntax(DA);
267 syntax.FindTagParam("Tf", 2); 268 syntax.FindTagParam("Tf", 2);
268 CFX_ByteString sFontName = syntax.GetWord(); 269 CFX_ByteString sFontName = syntax.GetWord();
269 sFontName = PDF_NameDecode(sFontName); 270 sFontName = PDF_NameDecode(sFontName);
270 if (sFontName.IsEmpty()) { 271 if (sFontName.IsEmpty()) {
271 return FALSE; 272 return FALSE;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 FX_FLOAT fBorderWidth = 1; 338 FX_FLOAT fBorderWidth = 1;
338 CPVT_Dash dsBorder(3, 0, 0); 339 CPVT_Dash dsBorder(3, 0, 0);
339 CPVT_Color crLeftTop, crRightBottom; 340 CPVT_Color crLeftTop, crRightBottom;
340 if (CPDF_Dictionary * pBSDict = pAnnotDict->GetDict("BS")) { 341 if (CPDF_Dictionary * pBSDict = pAnnotDict->GetDict("BS")) {
341 if (pBSDict->KeyExist("W")) { 342 if (pBSDict->KeyExist("W")) {
342 fBorderWidth = pBSDict->GetNumber("W"); 343 fBorderWidth = pBSDict->GetNumber("W");
343 } 344 }
344 if (CPDF_Array * pArray = pBSDict->GetArray("D")) { 345 if (CPDF_Array * pArray = pBSDict->GetArray("D")) {
345 dsBorder = CPVT_Dash(pArray->GetInteger(0), pArray->GetInteger(1), p Array->GetInteger(2)); 346 dsBorder = CPVT_Dash(pArray->GetInteger(0), pArray->GetInteger(1), p Array->GetInteger(2));
346 } 347 }
347 switch (pBSDict->GetString("S").GetAt(0)) { 348 switch (pBSDict->GetStringAt("S").GetAt(0)) {
348 case 'S': 349 case 'S':
349 nBorderStyle = PBS_SOLID; 350 nBorderStyle = PBS_SOLID;
350 break; 351 break;
351 case 'D': 352 case 'D':
352 nBorderStyle = PBS_DASH; 353 nBorderStyle = PBS_DASH;
353 break; 354 break;
354 case 'B': 355 case 'B':
355 nBorderStyle = PBS_BEVELED; 356 nBorderStyle = PBS_BEVELED;
356 fBorderWidth *= 2; 357 fBorderWidth *= 2;
357 crLeftTop = CPVT_Color(CT_GRAY, 1); 358 crLeftTop = CPVT_Color(CT_GRAY, 1);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 case CT_GRAY: 802 case CT_GRAY:
802 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; 803 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n";
803 break; 804 break;
804 case CT_CMYK: 805 case CT_CMYK:
805 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " " 806 sColorStream << color.fColor1 << " " << color.fColor2 << " " << colo r.fColor3 << " " << color.fColor4 << " "
806 << (bFillOrStroke ? "k" : "K") << "\n"; 807 << (bFillOrStroke ? "k" : "K") << "\n";
807 break; 808 break;
808 } 809 }
809 return sColorStream.GetByteString(); 810 return sColorStream.GetByteString();
810 } 811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698