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

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

Issue 1108903002: Merge to XFA: Reduce usage of operator LPCWSTR from CFX_WideString(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 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
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfdoc/doc_basic.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 subWord = '*'; 457 subWord = '*';
458 vt.SetPasswordChar(subWord); 458 vt.SetPasswordChar(subWord);
459 } 459 }
460 FX_BOOL bCharArray = (dwFlags >> 24) & 1; 460 FX_BOOL bCharArray = (dwFlags >> 24) & 1;
461 if (bCharArray) { 461 if (bCharArray) {
462 vt.SetCharArray(dwMaxLen); 462 vt.SetCharArray(dwMaxLen);
463 } else { 463 } else {
464 vt.SetLimitChar(dwMaxLen); 464 vt.SetLimitChar(dwMaxLen);
465 } 465 }
466 vt.Initialize(); 466 vt.Initialize();
467 vt.SetText(swValue); 467 vt.SetText(swValue.c_str());
468 vt.RearrangeAll(); 468 vt.RearrangeAll();
469 CPDF_Rect rcContent = vt.GetContentRect(); 469 CPDF_Rect rcContent = vt.GetContentRect();
470 CPDF_Point ptOffset(0.0f, 0.0f); 470 CPDF_Point ptOffset(0.0f, 0.0f);
471 if (!bMultiLine) { 471 if (!bMultiLine) {
472 ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcBody.Hei ght()) / 2.0f); 472 ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcBody.Hei ght()) / 2.0f);
473 } 473 }
474 CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(&map, vt. GetIterator(), ptOffset, !bCharArray, subWord); 474 CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(&map, vt. GetIterator(), ptOffset, !bCharArray, subWord);
475 if (sBody.GetLength() > 0) { 475 if (sBody.GetLength() > 0) {
476 sAppStream << "/Tx BMC\n" << "q\n"; 476 sAppStream << "/Tx BMC\n" << "q\n";
477 if (rcContent.Width() > rcBody.Width() || 477 if (rcContent.Width() > rcBody.Width() ||
(...skipping 17 matching lines...) Expand all
495 CPDF_Rect rcEdit = rcBody; 495 CPDF_Rect rcEdit = rcBody;
496 rcEdit.right = rcButton.left; 496 rcEdit.right = rcButton.left;
497 rcEdit.Normalize(); 497 rcEdit.Normalize();
498 vt.SetPlateRect(rcEdit); 498 vt.SetPlateRect(rcEdit);
499 if (IsFloatZero(fFontSize)) { 499 if (IsFloatZero(fFontSize)) {
500 vt.SetAutoFontSize(TRUE); 500 vt.SetAutoFontSize(TRUE);
501 } else { 501 } else {
502 vt.SetFontSize(fFontSize); 502 vt.SetFontSize(fFontSize);
503 } 503 }
504 vt.Initialize(); 504 vt.Initialize();
505 vt.SetText(swValue); 505 vt.SetText(swValue.c_str());
506 vt.RearrangeAll(); 506 vt.RearrangeAll();
507 CPDF_Rect rcContent = vt.GetContentRect(); 507 CPDF_Rect rcContent = vt.GetContentRect();
508 CPDF_Point ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcE dit.Height()) / 2.0f); 508 CPDF_Point ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcE dit.Height()) / 2.0f);
509 CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt. GetIterator(), ptOffset, TRUE, 0); 509 CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt. GetIterator(), ptOffset, TRUE, 0);
510 if (sEdit.GetLength() > 0) { 510 if (sEdit.GetLength() > 0) {
511 sAppStream << "/Tx BMC\n" << "q\n"; 511 sAppStream << "/Tx BMC\n" << "q\n";
512 sAppStream << rcEdit.left << " " << rcEdit.bottom << " " 512 sAppStream << rcEdit.left << " " << rcEdit.bottom << " "
513 << rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n"; 513 << rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n";
514 sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crT ext, TRUE) << sEdit << "ET\n" << "Q\nEMC\n"; 514 sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crT ext, TRUE) << sEdit << "ET\n" << "Q\nEMC\n";
515 } 515 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 566 }
567 CPDF_VariableText vt; 567 CPDF_VariableText vt;
568 vt.SetProvider(&prd); 568 vt.SetProvider(&prd);
569 vt.SetPlateRect(CPDF_Rect(rcBody.left, 0.0f, rcBody. right, 0.0f)); 569 vt.SetPlateRect(CPDF_Rect(rcBody.left, 0.0f, rcBody. right, 0.0f));
570 if (IsFloatZero(fFontSize)) { 570 if (IsFloatZero(fFontSize)) {
571 vt.SetFontSize(12.0f); 571 vt.SetFontSize(12.0f);
572 } else { 572 } else {
573 vt.SetFontSize(fFontSize); 573 vt.SetFontSize(fFontSize);
574 } 574 }
575 vt.Initialize(); 575 vt.Initialize();
576 vt.SetText(swItem); 576 vt.SetText(swItem.c_str());
577 vt.RearrangeAll(); 577 vt.RearrangeAll();
578 FX_FLOAT fItemHeight = vt.GetContentRect().Height(); 578 FX_FLOAT fItemHeight = vt.GetContentRect().Height();
579 if (bSelected) { 579 if (bSelected) {
580 CPDF_Rect rcItem = CPDF_Rect(rcBody.left, fy - f ItemHeight, rcBody.right, fy); 580 CPDF_Rect rcItem = CPDF_Rect(rcBody.left, fy - f ItemHeight, rcBody.right, fy);
581 sBody << "q\n" << CPVT_GenerateAP::GenerateColor AP(CPVT_Color(CT_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f), TRUE) 581 sBody << "q\n" << CPVT_GenerateAP::GenerateColor AP(CPVT_Color(CT_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f), TRUE)
582 << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; 582 << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n";
583 sBody << "BT\n" << CPVT_GenerateAP::GenerateColo rAP(CPVT_Color(CT_GRAY, 1), TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.Ge tIterator(), CPDF_Point(0.0f, fy), TRUE, 0) << "ET\n"; 583 sBody << "BT\n" << CPVT_GenerateAP::GenerateColo rAP(CPVT_Color(CT_GRAY, 1), TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.Ge tIterator(), CPDF_Point(0.0f, fy), TRUE, 0) << "ET\n";
584 } else { 584 } else {
585 sBody << "BT\n" << CPVT_GenerateAP::GenerateColo rAP(crText, TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPD F_Point(0.0f, fy), TRUE, 0) << "ET\n"; 585 sBody << "BT\n" << CPVT_GenerateAP::GenerateColo rAP(crText, TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPD F_Point(0.0f, fy), TRUE, 0) << "ET\n";
586 } 586 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfdoc/doc_basic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698