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

Side by Side Diff: fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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 | « fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h ('k') | fpdfsdk/fpdfxfa/cpdfxfa_page.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_array.h" 9 #include "core/fpdfapi/parser/cpdf_array.h"
10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 10 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 65 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
66 if (!pFormFillEnv) 66 if (!pFormFillEnv)
67 return; 67 return;
68 68
69 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); 69 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt);
70 pFormFillEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, 70 pFormFillEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom,
71 rcPage.right, rcPage.top); 71 rcPage.right, rcPage.top);
72 } 72 }
73 73
74 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, 74 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
75 FX_BOOL bVisible, 75 bool bVisible,
76 const CFX_RectF* pRtAnchor) { 76 const CFX_RectF* pRtAnchor) {
77 if (!hWidget || !pRtAnchor || !m_pContext->GetXFADoc() || 77 if (!hWidget || !pRtAnchor || !m_pContext->GetXFADoc() ||
78 !m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView()) 78 !m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView())
79 return; 79 return;
80 80
81 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA) 81 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
82 return; 82 return;
83 83
84 CXFA_FFWidgetHandler* pWidgetHandler = 84 CXFA_FFWidgetHandler* pWidgetHandler =
85 m_pContext->GetXFADocView()->GetWidgetHandler(); 85 m_pContext->GetXFADocView()->GetWidgetHandler();
(...skipping 10 matching lines...) Expand all
96 96
97 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 97 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
98 if (!pFormFillEnv) 98 if (!pFormFillEnv)
99 return; 99 return;
100 100
101 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); 101 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor);
102 pFormFillEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, 102 pFormFillEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left,
103 rcCaret.top, rcCaret.right, rcCaret.bottom); 103 rcCaret.top, rcCaret.right, rcCaret.bottom);
104 } 104 }
105 105
106 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, 106 bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
107 FX_FLOAT fMinPopup, 107 FX_FLOAT fMinPopup,
108 FX_FLOAT fMaxPopup, 108 FX_FLOAT fMaxPopup,
109 const CFX_RectF& rtAnchor, 109 const CFX_RectF& rtAnchor,
110 CFX_RectF& rtPopup) { 110 CFX_RectF& rtPopup) {
111 if (!hWidget) 111 if (!hWidget)
112 return FALSE; 112 return false;
113 113
114 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); 114 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
115 if (!pXFAPageView) 115 if (!pXFAPageView)
116 return FALSE; 116 return false;
117 117
118 CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView); 118 CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
119 if (!pPage) 119 if (!pPage)
120 return FALSE; 120 return false;
121 121
122 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); 122 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
123 int nRotate = pWidgetAcc->GetRotate(); 123 int nRotate = pWidgetAcc->GetRotate();
124 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 124 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
125 if (!pFormFillEnv) 125 if (!pFormFillEnv)
126 return FALSE; 126 return false;
127 127
128 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; 128 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f};
129 pFormFillEnv->GetPageViewRect(pPage, pageViewRect); 129 pFormFillEnv->GetPageViewRect(pPage, pageViewRect);
130 130
131 int t1; 131 int t1;
132 int t2; 132 int t2;
133 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor); 133 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor);
134 switch (nRotate) { 134 switch (nRotate) {
135 case 90: { 135 case 90: {
136 t1 = (int)(pageViewRect.right - rcAnchor.right); 136 t1 = (int)(pageViewRect.right - rcAnchor.right);
(...skipping 22 matching lines...) Expand all
159 t2 = (int)(rcAnchor.bottom - pageViewRect.bottom); 159 t2 = (int)(rcAnchor.bottom - pageViewRect.bottom);
160 if (rcAnchor.right > pageViewRect.right) 160 if (rcAnchor.right > pageViewRect.right)
161 rtPopup.left -= rcAnchor.right - pageViewRect.right; 161 rtPopup.left -= rcAnchor.right - pageViewRect.right;
162 break; 162 break;
163 } 163 }
164 } 164 }
165 165
166 int t; 166 int t;
167 uint32_t dwPos; 167 uint32_t dwPos;
168 if (t1 <= 0 && t2 <= 0) 168 if (t1 <= 0 && t2 <= 0)
169 return FALSE; 169 return false;
170 if (t1 <= 0) { 170 if (t1 <= 0) {
171 t = t2; 171 t = t2;
172 dwPos = 1; 172 dwPos = 1;
173 } else if (t2 <= 0) { 173 } else if (t2 <= 0) {
174 t = t1; 174 t = t1;
175 dwPos = 0; 175 dwPos = 0;
176 } else if (t1 > t2) { 176 } else if (t1 > t2) {
177 t = t1; 177 t = t1;
178 dwPos = 0; 178 dwPos = 0;
179 } else { 179 } else {
(...skipping 29 matching lines...) Expand all
209 } else { 209 } else {
210 rtPopup.top = -fPopupHeight; 210 rtPopup.top = -fPopupHeight;
211 rtPopup.height = fPopupHeight; 211 rtPopup.height = fPopupHeight;
212 } 212 }
213 break; 213 break;
214 } 214 }
215 default: 215 default:
216 break; 216 break;
217 } 217 }
218 218
219 return TRUE; 219 return true;
220 } 220 }
221 221
222 FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget, 222 bool CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
223 CFX_PointF ptPopup) { 223 CFX_PointF ptPopup) {
224 if (!hWidget) 224 if (!hWidget)
225 return FALSE; 225 return false;
226 226
227 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); 227 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
228 if (!pXFAPageView) 228 if (!pXFAPageView)
229 return FALSE; 229 return false;
230 230
231 CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView); 231 CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
232 if (!pPage) 232 if (!pPage)
233 return FALSE; 233 return false;
234 234
235 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 235 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
236 if (!pFormFillEnv) 236 if (!pFormFillEnv)
237 return FALSE; 237 return false;
238 238
239 int menuFlag = 0; 239 int menuFlag = 0;
240 if (hWidget->CanUndo()) 240 if (hWidget->CanUndo())
241 menuFlag |= FXFA_MENU_UNDO; 241 menuFlag |= FXFA_MENU_UNDO;
242 if (hWidget->CanRedo()) 242 if (hWidget->CanRedo())
243 menuFlag |= FXFA_MENU_REDO; 243 menuFlag |= FXFA_MENU_REDO;
244 if (hWidget->CanPaste()) 244 if (hWidget->CanPaste())
245 menuFlag |= FXFA_MENU_PASTE; 245 menuFlag |= FXFA_MENU_PASTE;
246 if (hWidget->CanCopy()) 246 if (hWidget->CanCopy())
247 menuFlag |= FXFA_MENU_COPY; 247 menuFlag |= FXFA_MENU_COPY;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) { 351 iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) {
352 return; 352 return;
353 } 353 }
354 354
355 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 355 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
356 if (!pFormFillEnv) 356 if (!pFormFillEnv)
357 return; 357 return;
358 pFormFillEnv->SetCurrentPage(this, iCurPage); 358 pFormFillEnv->SetCurrentPage(this, iCurPage);
359 } 359 }
360 360
361 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { 361 bool CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
362 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) 362 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
363 return FALSE; 363 return false;
364 if (m_pContext->GetFormFillEnv()->GetInterForm()) { 364 if (m_pContext->GetFormFillEnv()->GetInterForm()) {
365 return m_pContext->GetFormFillEnv() 365 return m_pContext->GetFormFillEnv()
366 ->GetInterForm() 366 ->GetInterForm()
367 ->IsXfaCalculateEnabled(); 367 ->IsXfaCalculateEnabled();
368 } 368 }
369 return FALSE; 369 return false;
370 } 370 }
371 371
372 void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc, 372 void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
373 FX_BOOL bEnabled) { 373 bool bEnabled) {
374 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) 374 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
375 return; 375 return;
376 if (m_pContext->GetFormFillEnv()->GetInterForm()) { 376 if (m_pContext->GetFormFillEnv()->GetInterForm()) {
377 m_pContext->GetFormFillEnv()->GetInterForm()->XfaEnableCalculate(bEnabled); 377 m_pContext->GetFormFillEnv()->GetInterForm()->XfaEnableCalculate(bEnabled);
378 } 378 }
379 } 379 }
380 380
381 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, 381 void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
382 CFX_WideString& wsTitle) { 382 CFX_WideString& wsTitle) {
383 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) 383 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
(...skipping 12 matching lines...) Expand all
396 const CFX_WideString& wsTitle) { 396 const CFX_WideString& wsTitle) {
397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) 397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
398 return; 398 return;
399 399
400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo()) 400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo())
401 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); 401 pInfoDict->SetFor("Title", new CPDF_String(wsTitle));
402 } 402 }
403 403
404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, 404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
405 const CFX_WideString& wsFilePath, 405 const CFX_WideString& wsFilePath,
406 FX_BOOL bXDP) { 406 bool bXDP) {
407 if (hDoc != m_pContext->GetXFADoc()) 407 if (hDoc != m_pContext->GetXFADoc())
408 return; 408 return;
409 409
410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && 410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { 411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
412 return; 412 return;
413 } 413 }
414 414
415 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 415 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
416 if (!pFormFillEnv) 416 if (!pFormFillEnv)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 return; 512 return;
513 513
514 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 514 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
515 if (!pFormFillEnv) 515 if (!pFormFillEnv)
516 return; 516 return;
517 517
518 CFX_WideStringC str(bsURL.c_str()); 518 CFX_WideStringC str(bsURL.c_str());
519 pFormFillEnv->GotoURL(this, str); 519 pFormFillEnv->GotoURL(this, str);
520 } 520 }
521 521
522 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { 522 bool CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
523 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) 523 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
524 return FALSE; 524 return false;
525 if (m_pContext->GetFormFillEnv()->GetInterForm()) { 525 if (m_pContext->GetFormFillEnv()->GetInterForm()) {
526 return m_pContext->GetFormFillEnv() 526 return m_pContext->GetFormFillEnv()
527 ->GetInterForm() 527 ->GetInterForm()
528 ->IsXfaValidationsEnabled(); 528 ->IsXfaValidationsEnabled();
529 } 529 }
530 return TRUE; 530 return true;
531 } 531 }
532 532
533 void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc, 533 void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
534 FX_BOOL bEnabled) { 534 bool bEnabled) {
535 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) 535 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
536 return; 536 return;
537 if (m_pContext->GetFormFillEnv()->GetInterForm()) { 537 if (m_pContext->GetFormFillEnv()->GetInterForm()) {
538 m_pContext->GetFormFillEnv()->GetInterForm()->XfaSetValidationsEnabled( 538 m_pContext->GetFormFillEnv()->GetInterForm()->XfaSetValidationsEnabled(
539 bEnabled); 539 bEnabled);
540 } 540 }
541 } 541 }
542 542
543 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, 543 void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc,
544 CXFA_FFWidget* hWidget) { 544 CXFA_FFWidget* hWidget) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 return 0; 592 return 0;
593 593
594 CPDFSDK_InterForm* pInterForm = m_pContext->GetFormFillEnv()->GetInterForm(); 594 CPDFSDK_InterForm* pInterForm = m_pContext->GetFormFillEnv()->GetInterForm();
595 if (!pInterForm) 595 if (!pInterForm)
596 return 0; 596 return 0;
597 597
598 return ArgbEncode(pInterForm->GetHighlightAlpha(), 598 return ArgbEncode(pInterForm->GetHighlightAlpha(),
599 pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA)); 599 pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA));
600 } 600 }
601 601
602 FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) { 602 bool CPDFXFA_DocEnvironment::NotifySubmit(bool bPrevOrPost) {
603 if (bPrevOrPost) 603 if (bPrevOrPost)
604 return OnBeforeNotifySubmit(); 604 return OnBeforeNotifySubmit();
605 605
606 OnAfterNotifySubmit(); 606 OnAfterNotifySubmit();
607 return TRUE; 607 return true;
608 } 608 }
609 609
610 FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() { 610 bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
611 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && 611 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
612 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { 612 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
613 return TRUE; 613 return true;
614 } 614 }
615 615
616 if (!m_pContext->GetXFADocView()) 616 if (!m_pContext->GetXFADocView())
617 return TRUE; 617 return true;
618 618
619 CXFA_FFWidgetHandler* pWidgetHandler = 619 CXFA_FFWidgetHandler* pWidgetHandler =
620 m_pContext->GetXFADocView()->GetWidgetHandler(); 620 m_pContext->GetXFADocView()->GetWidgetHandler();
621 if (!pWidgetHandler) 621 if (!pWidgetHandler)
622 return TRUE; 622 return true;
623 623
624 std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator( 624 std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
625 m_pContext->GetXFADocView()->CreateWidgetAccIterator()); 625 m_pContext->GetXFADocView()->CreateWidgetAccIterator());
626 if (pWidgetAccIterator) { 626 if (pWidgetAccIterator) {
627 CXFA_EventParam Param; 627 CXFA_EventParam Param;
628 Param.m_eType = XFA_EVENT_PreSubmit; 628 Param.m_eType = XFA_EVENT_PreSubmit;
629 while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) 629 while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext())
630 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); 630 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
631 } 631 }
632 632
633 pWidgetAccIterator.reset( 633 pWidgetAccIterator.reset(
634 m_pContext->GetXFADocView()->CreateWidgetAccIterator()); 634 m_pContext->GetXFADocView()->CreateWidgetAccIterator());
635 if (!pWidgetAccIterator) 635 if (!pWidgetAccIterator)
636 return TRUE; 636 return true;
637 637
638 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); 638 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
639 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 639 pWidgetAcc = pWidgetAccIterator->MoveToNext();
640 while (pWidgetAcc) { 640 while (pWidgetAcc) {
641 int fRet = pWidgetAcc->ProcessValidate(-1); 641 int fRet = pWidgetAcc->ProcessValidate(-1);
642 if (fRet == XFA_EVENTERROR_Error) { 642 if (fRet == XFA_EVENTERROR_Error) {
643 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 643 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
644 if (!pFormFillEnv) 644 if (!pFormFillEnv)
645 return FALSE; 645 return false;
646 646
647 CFX_WideString ws; 647 CFX_WideString ws;
648 ws.FromLocal(IDS_XFA_Validate_Input); 648 ws.FromLocal(IDS_XFA_Validate_Input);
649 CFX_ByteString bs = ws.UTF16LE_Encode(); 649 CFX_ByteString bs = ws.UTF16LE_Encode();
650 int len = bs.GetLength(); 650 int len = bs.GetLength();
651 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), 651 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
652 (FPDF_WIDESTRING)L"", 0, 1); 652 (FPDF_WIDESTRING)L"", 0, 1);
653 bs.ReleaseBuffer(len); 653 bs.ReleaseBuffer(len);
654 return FALSE; 654 return false;
655 } 655 }
656 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 656 pWidgetAcc = pWidgetAccIterator->MoveToNext();
657 } 657 }
658 m_pContext->GetXFADocView()->UpdateDocView(); 658 m_pContext->GetXFADocView()->UpdateDocView();
659 659
660 return TRUE; 660 return true;
661 } 661 }
662 662
663 void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() { 663 void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
664 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && 664 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
665 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) 665 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA)
666 return; 666 return;
667 667
668 if (!m_pContext->GetXFADocView()) 668 if (!m_pContext->GetXFADocView())
669 return; 669 return;
670 670
(...skipping 10 matching lines...) Expand all
681 CXFA_EventParam Param; 681 CXFA_EventParam Param;
682 Param.m_eType = XFA_EVENT_PostSubmit; 682 Param.m_eType = XFA_EVENT_PostSubmit;
683 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); 683 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
684 while (pWidgetAcc) { 684 while (pWidgetAcc) {
685 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); 685 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
686 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 686 pWidgetAcc = pWidgetAccIterator->MoveToNext();
687 } 687 }
688 m_pContext->GetXFADocView()->UpdateDocView(); 688 m_pContext->GetXFADocView()->UpdateDocView();
689 } 689 }
690 690
691 FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, 691 bool CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
692 CXFA_Submit submit) { 692 if (!NotifySubmit(true) || !m_pContext->GetXFADocView())
693 if (!NotifySubmit(TRUE) || !m_pContext->GetXFADocView()) 693 return false;
694 return FALSE;
695 694
696 m_pContext->GetXFADocView()->UpdateDocView(); 695 m_pContext->GetXFADocView()->UpdateDocView();
697 FX_BOOL ret = SubmitDataInternal(hDoc, submit); 696 bool ret = SubmitDataInternal(hDoc, submit);
698 NotifySubmit(FALSE); 697 NotifySubmit(false);
699 return ret; 698 return ret;
700 } 699 }
701 700
702 IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile( 701 IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile(
703 CXFA_FFDoc* hDoc, 702 CXFA_FFDoc* hDoc,
704 const CFX_WideString& wsLink) { 703 const CFX_WideString& wsLink) {
705 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 704 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
706 if (!pFormFillEnv) 705 if (!pFormFillEnv)
707 return nullptr; 706 return nullptr;
708 707
709 CFX_ByteString bs = wsLink.UTF16LE_Encode(); 708 CFX_ByteString bs = wsLink.UTF16LE_Encode();
710 int len = bs.GetLength(); 709 int len = bs.GetLength();
711 FPDF_FILEHANDLER* pFileHandler = 710 FPDF_FILEHANDLER* pFileHandler =
712 pFormFillEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); 711 pFormFillEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb");
713 bs.ReleaseBuffer(len); 712 bs.ReleaseBuffer(len);
714 if (!pFileHandler) 713 if (!pFileHandler)
715 return nullptr; 714 return nullptr;
716 715
717 return new CFPDF_FileStream(pFileHandler); 716 return new CFPDF_FileStream(pFileHandler);
718 } 717 }
719 718
720 FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, 719 bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
721 int fileType, 720 int fileType,
722 FPDF_DWORD encodeType, 721 FPDF_DWORD encodeType,
723 FPDF_DWORD flag) { 722 FPDF_DWORD flag) {
724 if (!m_pContext->GetXFADocView()) 723 if (!m_pContext->GetXFADocView())
725 return FALSE; 724 return false;
726 725
727 CFX_ByteString content; 726 CFX_ByteString content;
728 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 727 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
729 if (!pFormFillEnv) 728 if (!pFormFillEnv)
730 return FALSE; 729 return false;
731 730
732 CFPDF_FileStream fileStream(pFileHandler); 731 CFPDF_FileStream fileStream(pFileHandler);
733 if (fileType == FXFA_SAVEAS_XML) { 732 if (fileType == FXFA_SAVEAS_XML) {
734 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; 733 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
735 fileStream.WriteBlock(kContent, 0, strlen(kContent)); 734 fileStream.WriteBlock(kContent, 0, strlen(kContent));
736 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream, 735 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream,
737 nullptr); 736 nullptr);
738 return TRUE; 737 return true;
739 } 738 }
740 739
741 if (fileType != FXFA_SAVEAS_XDP) 740 if (fileType != FXFA_SAVEAS_XDP)
742 return TRUE; 741 return true;
743 742
744 if (!flag) { 743 if (!flag) {
745 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | 744 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
746 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; 745 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM;
747 } 746 }
748 if (!m_pContext->GetPDFDoc()) { 747 if (!m_pContext->GetPDFDoc()) {
749 fileStream.Flush(); 748 fileStream.Flush();
750 return FALSE; 749 return false;
751 } 750 }
752 751
753 CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot(); 752 CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
754 if (!pRoot) { 753 if (!pRoot) {
755 fileStream.Flush(); 754 fileStream.Flush();
756 return FALSE; 755 return false;
757 } 756 }
758 757
759 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); 758 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
760 if (!pAcroForm) { 759 if (!pAcroForm) {
761 fileStream.Flush(); 760 fileStream.Flush();
762 return FALSE; 761 return false;
763 } 762 }
764 763
765 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA")); 764 CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
766 if (!pArray) { 765 if (!pArray) {
767 fileStream.Flush(); 766 fileStream.Flush();
768 return FALSE; 767 return false;
769 } 768 }
770 769
771 int size = pArray->GetCount(); 770 int size = pArray->GetCount();
772 for (int i = 1; i < size; i += 2) { 771 for (int i = 1; i < size; i += 2) {
773 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); 772 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
774 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); 773 CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
775 if (!pPrePDFObj->IsString()) 774 if (!pPrePDFObj->IsString())
776 continue; 775 continue;
777 if (!pPDFObj->IsReference()) 776 if (!pPDFObj->IsReference())
778 continue; 777 continue;
(...skipping 18 matching lines...) Expand all
797 if (pPrePDFObj->GetString() == "form") { 796 if (pPrePDFObj->GetString() == "form") {
798 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, &fileStream, 797 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Form, &fileStream,
799 nullptr); 798 nullptr);
800 } else if (pPrePDFObj->GetString() == "datasets") { 799 } else if (pPrePDFObj->GetString() == "datasets") {
801 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, &fileStream, 800 m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Datasets, &fileStream,
802 nullptr); 801 nullptr);
803 } else { 802 } else {
804 // PDF,creator. 803 // PDF,creator.
805 } 804 }
806 } 805 }
807 return TRUE; 806 return true;
808 } 807 }
809 808
810 void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent, 809 void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
811 FPDF_DWORD& flag) { 810 FPDF_DWORD& flag) {
812 if (csSrcContent.Find(L" config ", 0) != -1) 811 if (csSrcContent.Find(L" config ", 0) != -1)
813 flag |= FXFA_CONFIG; 812 flag |= FXFA_CONFIG;
814 if (csSrcContent.Find(L" template ", 0) != -1) 813 if (csSrcContent.Find(L" template ", 0) != -1)
815 flag |= FXFA_TEMPLATE; 814 flag |= FXFA_TEMPLATE;
816 if (csSrcContent.Find(L" localeSet ", 0) != -1) 815 if (csSrcContent.Find(L" localeSet ", 0) != -1)
817 flag |= FXFA_LOCALESET; 816 flag |= FXFA_LOCALESET;
818 if (csSrcContent.Find(L" datasets ", 0) != -1) 817 if (csSrcContent.Find(L" datasets ", 0) != -1)
819 flag |= FXFA_DATASETS; 818 flag |= FXFA_DATASETS;
820 if (csSrcContent.Find(L" xmpmeta ", 0) != -1) 819 if (csSrcContent.Find(L" xmpmeta ", 0) != -1)
821 flag |= FXFA_XMPMETA; 820 flag |= FXFA_XMPMETA;
822 if (csSrcContent.Find(L" xfdf ", 0) != -1) 821 if (csSrcContent.Find(L" xfdf ", 0) != -1)
823 flag |= FXFA_XFDF; 822 flag |= FXFA_XFDF;
824 if (csSrcContent.Find(L" form ", 0) != -1) 823 if (csSrcContent.Find(L" form ", 0) != -1)
825 flag |= FXFA_FORM; 824 flag |= FXFA_FORM;
826 if (flag == 0) { 825 if (flag == 0) {
827 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | 826 flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
828 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; 827 FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM;
829 } 828 }
830 } 829 }
831 830
832 FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL, 831 bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
833 CFX_WideString& csToAddress, 832 CFX_WideString& csToAddress,
834 CFX_WideString& csCCAddress, 833 CFX_WideString& csCCAddress,
835 CFX_WideString& csBCCAddress, 834 CFX_WideString& csBCCAddress,
836 CFX_WideString& csSubject, 835 CFX_WideString& csSubject,
837 CFX_WideString& csMsg) { 836 CFX_WideString& csMsg) {
838 CFX_WideString srcURL = csURL; 837 CFX_WideString srcURL = csURL;
839 srcURL.TrimLeft(); 838 srcURL.TrimLeft();
840 if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0) 839 if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
841 return FALSE; 840 return false;
842 841
843 int pos = srcURL.Find(L'?', 0); 842 int pos = srcURL.Find(L'?', 0);
844 CFX_WideString tmp; 843 CFX_WideString tmp;
845 if (pos == -1) { 844 if (pos == -1) {
846 pos = srcURL.Find(L'@', 0); 845 pos = srcURL.Find(L'@', 0);
847 if (pos == -1) 846 if (pos == -1)
848 return FALSE; 847 return false;
849 848
850 tmp = srcURL.Right(csURL.GetLength() - 7); 849 tmp = srcURL.Right(csURL.GetLength() - 7);
851 } else { 850 } else {
852 tmp = srcURL.Left(pos); 851 tmp = srcURL.Left(pos);
853 tmp = tmp.Right(tmp.GetLength() - 7); 852 tmp = tmp.Right(tmp.GetLength() - 7);
854 } 853 }
855 tmp.TrimLeft(); 854 tmp.TrimLeft();
856 tmp.TrimRight(); 855 tmp.TrimRight();
857 856
858 csToAddress = tmp; 857 csToAddress = tmp;
(...skipping 25 matching lines...) Expand all
884 } else if (tmp.GetLength() >= 5 && 883 } else if (tmp.GetLength() >= 5 &&
885 tmp.Left(5).CompareNoCase(L"body=") == 0) { 884 tmp.Left(5).CompareNoCase(L"body=") == 0) {
886 tmp = tmp.Right(tmp.GetLength() - 5); 885 tmp = tmp.Right(tmp.GetLength() - 5);
887 csMsg += tmp; 886 csMsg += tmp;
888 } 887 }
889 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1)); 888 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1));
890 } 889 }
891 csToAddress.Replace(L",", L";"); 890 csToAddress.Replace(L",", L";");
892 csCCAddress.Replace(L",", L";"); 891 csCCAddress.Replace(L",", L";");
893 csBCCAddress.Replace(L",", L";"); 892 csBCCAddress.Replace(L",", L";");
894 return TRUE; 893 return true;
895 } 894 }
896 895
897 FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, 896 bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
898 CXFA_Submit submit) { 897 CXFA_Submit submit) {
899 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 898 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
900 if (!pFormFillEnv) 899 if (!pFormFillEnv)
901 return FALSE; 900 return false;
902 901
903 CFX_WideStringC csURLC; 902 CFX_WideStringC csURLC;
904 submit.GetSubmitTarget(csURLC); 903 submit.GetSubmitTarget(csURLC);
905 CFX_WideString csURL(csURLC); 904 CFX_WideString csURL(csURLC);
906 if (csURL.IsEmpty()) { 905 if (csURL.IsEmpty()) {
907 CFX_WideString ws; 906 CFX_WideString ws;
908 ws.FromLocal("Submit cancelled."); 907 ws.FromLocal("Submit cancelled.");
909 CFX_ByteString bs = ws.UTF16LE_Encode(); 908 CFX_ByteString bs = ws.UTF16LE_Encode();
910 int len = bs.GetLength(); 909 int len = bs.GetLength();
911 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), 910 pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
912 (FPDF_WIDESTRING)L"", 0, 4); 911 (FPDF_WIDESTRING)L"", 0, 4);
913 bs.ReleaseBuffer(len); 912 bs.ReleaseBuffer(len);
914 return FALSE; 913 return false;
915 } 914 }
916 915
917 FPDF_FILEHANDLER* pFileHandler = nullptr; 916 FPDF_FILEHANDLER* pFileHandler = nullptr;
918 int fileFlag = -1; 917 int fileFlag = -1;
919 switch (submit.GetSubmitFormat()) { 918 switch (submit.GetSubmitFormat()) {
920 case XFA_ATTRIBUTEENUM_Xdp: { 919 case XFA_ATTRIBUTEENUM_Xdp: {
921 CFX_WideStringC csContentC; 920 CFX_WideStringC csContentC;
922 submit.GetSubmitXDPContent(csContentC); 921 submit.GetSubmitXDPContent(csContentC);
923 CFX_WideString csContent; 922 CFX_WideString csContent;
924 csContent = csContentC; 923 csContent = csContentC;
(...skipping 21 matching lines...) Expand all
946 break; 945 break;
947 case XFA_ATTRIBUTEENUM_Urlencoded: 946 case XFA_ATTRIBUTEENUM_Urlencoded:
948 pFileHandler = pFormFillEnv->OpenFile(FXFA_SAVEAS_XML, nullptr, "wb"); 947 pFileHandler = pFormFillEnv->OpenFile(FXFA_SAVEAS_XML, nullptr, "wb");
949 fileFlag = FXFA_SAVEAS_XML; 948 fileFlag = FXFA_SAVEAS_XML;
950 ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL); 949 ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL);
951 break; 950 break;
952 default: 951 default:
953 return false; 952 return false;
954 } 953 }
955 if (!pFileHandler) 954 if (!pFileHandler)
956 return FALSE; 955 return false;
957 if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) { 956 if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
958 CFX_WideString csToAddress; 957 CFX_WideString csToAddress;
959 CFX_WideString csCCAddress; 958 CFX_WideString csCCAddress;
960 CFX_WideString csBCCAddress; 959 CFX_WideString csBCCAddress;
961 CFX_WideString csSubject; 960 CFX_WideString csSubject;
962 CFX_WideString csMsg; 961 CFX_WideString csMsg;
963 if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, 962 if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
964 csMsg)) { 963 csMsg)) {
965 return FALSE; 964 return false;
966 } 965 }
967 CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode(); 966 CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
968 CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode(); 967 CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
969 CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode(); 968 CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode();
970 CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode(); 969 CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode();
971 CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode(); 970 CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode();
972 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength()); 971 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
973 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength()); 972 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
974 FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength()); 973 FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
975 FPDF_WIDESTRING pSubject = 974 FPDF_WIDESTRING pSubject =
976 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); 975 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
977 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); 976 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
978 pFormFillEnv->EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); 977 pFormFillEnv->EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg);
979 bsTo.ReleaseBuffer(); 978 bsTo.ReleaseBuffer();
980 bsCC.ReleaseBuffer(); 979 bsCC.ReleaseBuffer();
981 bsBcc.ReleaseBuffer(); 980 bsBcc.ReleaseBuffer();
982 bsSubject.ReleaseBuffer(); 981 bsSubject.ReleaseBuffer();
983 bsMsg.ReleaseBuffer(); 982 bsMsg.ReleaseBuffer();
984 } else { 983 } else {
985 // HTTP or FTP 984 // HTTP or FTP
986 CFX_WideString ws; 985 CFX_WideString ws;
987 CFX_ByteString bs = csURL.UTF16LE_Encode(); 986 CFX_ByteString bs = csURL.UTF16LE_Encode();
988 int len = bs.GetLength(); 987 int len = bs.GetLength();
989 pFormFillEnv->UploadTo(pFileHandler, fileFlag, 988 pFormFillEnv->UploadTo(pFileHandler, fileFlag,
990 (FPDF_WIDESTRING)bs.GetBuffer(len)); 989 (FPDF_WIDESTRING)bs.GetBuffer(len));
991 bs.ReleaseBuffer(len); 990 bs.ReleaseBuffer(len);
992 } 991 }
993 return TRUE; 992 return true;
994 } 993 }
995 994
996 FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty( 995 bool CPDFXFA_DocEnvironment::SetGlobalProperty(
997 CXFA_FFDoc* hDoc, 996 CXFA_FFDoc* hDoc,
998 const CFX_ByteStringC& szPropName, 997 const CFX_ByteStringC& szPropName,
999 CFXJSE_Value* pValue) { 998 CFXJSE_Value* pValue) {
1000 if (hDoc != m_pContext->GetXFADoc()) 999 if (hDoc != m_pContext->GetXFADoc())
1001 return FALSE; 1000 return false;
1002 1001
1003 if (m_pContext->GetFormFillEnv() && 1002 if (m_pContext->GetFormFillEnv() &&
1004 m_pContext->GetFormFillEnv()->GetJSRuntime()) { 1003 m_pContext->GetFormFillEnv()->GetJSRuntime()) {
1005 return m_pContext->GetFormFillEnv()->GetJSRuntime()->SetValueByName( 1004 return m_pContext->GetFormFillEnv()->GetJSRuntime()->SetValueByName(
1006 szPropName, pValue); 1005 szPropName, pValue);
1007 } 1006 }
1008 return FALSE; 1007 return false;
1009 } 1008 }
1010 1009
1011 FX_BOOL CPDFXFA_DocEnvironment::GetGlobalProperty( 1010 bool CPDFXFA_DocEnvironment::GetGlobalProperty(
1012 CXFA_FFDoc* hDoc, 1011 CXFA_FFDoc* hDoc,
1013 const CFX_ByteStringC& szPropName, 1012 const CFX_ByteStringC& szPropName,
1014 CFXJSE_Value* pValue) { 1013 CFXJSE_Value* pValue) {
1015 if (hDoc != m_pContext->GetXFADoc()) 1014 if (hDoc != m_pContext->GetXFADoc())
1016 return FALSE; 1015 return false;
1017 if (!m_pContext->GetFormFillEnv() || 1016 if (!m_pContext->GetFormFillEnv() ||
1018 !m_pContext->GetFormFillEnv()->GetJSRuntime()) { 1017 !m_pContext->GetFormFillEnv()->GetJSRuntime()) {
1019 return FALSE; 1018 return false;
1020 } 1019 }
1021 1020
1022 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 1021 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
1023 if (!m_pJSContext) 1022 if (!m_pJSContext)
1024 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); 1023 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext();
1025 1024
1026 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); 1025 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue);
1027 } 1026 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h ('k') | fpdfsdk/fpdfxfa/cpdfxfa_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698