OLD | NEW |
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/include/cpdfxfa_docenvironment.h" | 7 #include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" |
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
12 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 12 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
13 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" | 13 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
14 #include "fpdfsdk/include/cpdfdoc_environment.h" | |
15 #include "fpdfsdk/include/cpdfsdk_document.h" | 14 #include "fpdfsdk/include/cpdfsdk_document.h" |
| 15 #include "fpdfsdk/include/cpdfsdk_environment.h" |
16 #include "fpdfsdk/include/cpdfsdk_interform.h" | 16 #include "fpdfsdk/include/cpdfsdk_interform.h" |
17 #include "fpdfsdk/include/cpdfsdk_pageview.h" | 17 #include "fpdfsdk/include/cpdfsdk_pageview.h" |
18 #include "fpdfsdk/javascript/ijs_runtime.h" | 18 #include "fpdfsdk/javascript/ijs_runtime.h" |
19 #include "xfa/fxfa/include/xfa_ffdocview.h" | 19 #include "xfa/fxfa/include/xfa_ffdocview.h" |
20 #include "xfa/fxfa/include/xfa_ffwidget.h" | 20 #include "xfa/fxfa/include/xfa_ffwidget.h" |
21 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" | 21 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" |
22 | 22 |
23 #define IDS_XFA_Validate_Input \ | 23 #define IDS_XFA_Validate_Input \ |
24 "At least one required field was empty. Please fill in the required " \ | 24 "At least one required field was empty. Please fill in the required " \ |
25 "fields\r\n(highlighted) before continuing." | 25 "fields\r\n(highlighted) before continuing." |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 58 if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
59 return; | 59 return; |
60 | 60 |
61 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 61 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
62 return; | 62 return; |
63 | 63 |
64 CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); | 64 CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); |
65 if (!pPage) | 65 if (!pPage) |
66 return; | 66 return; |
67 | 67 |
68 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 68 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
69 if (!pEnv) | 69 if (!pEnv) |
70 return; | 70 return; |
71 | 71 |
72 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); | 72 CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); |
73 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, | 73 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, |
74 rcPage.right, rcPage.top); | 74 rcPage.right, rcPage.top); |
75 } | 75 } |
76 | 76 |
77 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, | 77 void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, |
78 FX_BOOL bVisible, | 78 FX_BOOL bVisible, |
(...skipping 11 matching lines...) Expand all Loading... |
90 return; | 90 return; |
91 | 91 |
92 CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 92 CXFA_FFPageView* pPageView = hWidget->GetPageView(); |
93 if (!pPageView) | 93 if (!pPageView) |
94 return; | 94 return; |
95 | 95 |
96 CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); | 96 CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); |
97 if (!pPage) | 97 if (!pPage) |
98 return; | 98 return; |
99 | 99 |
100 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 100 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
101 if (!pEnv) | 101 if (!pEnv) |
102 return; | 102 return; |
103 | 103 |
104 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); | 104 CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); |
105 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, | 105 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, |
106 rcCaret.right, rcCaret.bottom); | 106 rcCaret.right, rcCaret.bottom); |
107 } | 107 } |
108 | 108 |
109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, | 109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, |
110 FX_FLOAT fMinPopup, | 110 FX_FLOAT fMinPopup, |
111 FX_FLOAT fMaxPopup, | 111 FX_FLOAT fMaxPopup, |
112 const CFX_RectF& rtAnchor, | 112 const CFX_RectF& rtAnchor, |
113 CFX_RectF& rtPopup) { | 113 CFX_RectF& rtPopup) { |
114 if (!hWidget) | 114 if (!hWidget) |
115 return FALSE; | 115 return FALSE; |
116 | 116 |
117 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 117 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); |
118 if (!pXFAPageView) | 118 if (!pXFAPageView) |
119 return FALSE; | 119 return FALSE; |
120 | 120 |
121 CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); | 121 CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); |
122 if (!pPage) | 122 if (!pPage) |
123 return FALSE; | 123 return FALSE; |
124 | 124 |
125 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 125 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); |
126 int nRotate = pWidgetAcc->GetRotate(); | 126 int nRotate = pWidgetAcc->GetRotate(); |
127 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 127 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
128 if (!pEnv) | 128 if (!pEnv) |
129 return FALSE; | 129 return FALSE; |
130 | 130 |
131 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; | 131 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; |
132 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); | 132 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); |
133 | 133 |
134 int t1; | 134 int t1; |
135 int t2; | 135 int t2; |
136 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor); | 136 CFX_FloatRect rcAnchor = CFX_FloatRect::FromCFXRectF(rtAnchor); |
137 switch (nRotate) { | 137 switch (nRotate) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return FALSE; | 228 return FALSE; |
229 | 229 |
230 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 230 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); |
231 if (!pXFAPageView) | 231 if (!pXFAPageView) |
232 return FALSE; | 232 return FALSE; |
233 | 233 |
234 CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); | 234 CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); |
235 if (!pPage) | 235 if (!pPage) |
236 return FALSE; | 236 return FALSE; |
237 | 237 |
238 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 238 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
239 if (!pEnv) | 239 if (!pEnv) |
240 return FALSE; | 240 return FALSE; |
241 | 241 |
242 int menuFlag = 0; | 242 int menuFlag = 0; |
243 if (hWidget->CanUndo()) | 243 if (hWidget->CanUndo()) |
244 menuFlag |= FXFA_MENU_UNDO; | 244 menuFlag |= FXFA_MENU_UNDO; |
245 if (hWidget->CanRedo()) | 245 if (hWidget->CanRedo()) |
246 menuFlag |= FXFA_MENU_REDO; | 246 menuFlag |= FXFA_MENU_REDO; |
247 if (hWidget->CanPaste()) | 247 if (hWidget->CanPaste()) |
248 menuFlag |= FXFA_MENU_PASTE; | 248 menuFlag |= FXFA_MENU_PASTE; |
249 if (hWidget->CanCopy()) | 249 if (hWidget->CanCopy()) |
250 menuFlag |= FXFA_MENU_COPY; | 250 menuFlag |= FXFA_MENU_COPY; |
251 if (hWidget->CanCut()) | 251 if (hWidget->CanCut()) |
252 menuFlag |= FXFA_MENU_CUT; | 252 menuFlag |= FXFA_MENU_CUT; |
253 if (hWidget->CanSelectAll()) | 253 if (hWidget->CanSelectAll()) |
254 menuFlag |= FXFA_MENU_SELECTALL; | 254 menuFlag |= FXFA_MENU_SELECTALL; |
255 | 255 |
256 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr); | 256 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr); |
257 } | 257 } |
258 | 258 |
259 void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, | 259 void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, |
260 uint32_t dwFlags) { | 260 uint32_t dwFlags) { |
261 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 261 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
262 if (!pEnv) | 262 if (!pEnv) |
263 return; | 263 return; |
264 | 264 |
265 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || | 265 if (m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_LOADING || |
266 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || | 266 m_pDocument->GetLoadStatus() == FXFA_LOADSTATUS_CLOSING || |
267 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) | 267 XFA_PAGEVIEWEVENT_StopLayout != dwFlags) |
268 return; | 268 return; |
269 | 269 |
270 int nNewCount = m_pDocument->GetPageCount(); | 270 int nNewCount = m_pDocument->GetPageCount(); |
271 if (nNewCount == m_pDocument->GetOriginalPageCount()) | 271 if (nNewCount == m_pDocument->GetOriginalPageCount()) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return m_pDocument->GetPageCount(); | 333 return m_pDocument->GetPageCount(); |
334 return 0; | 334 return 0; |
335 } | 335 } |
336 | 336 |
337 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { | 337 int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { |
338 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 338 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
339 return -1; | 339 return -1; |
340 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 340 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
341 return -1; | 341 return -1; |
342 | 342 |
343 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 343 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
344 if (!pEnv) | 344 if (!pEnv) |
345 return -1; | 345 return -1; |
346 | 346 |
347 return pEnv->FFI_GetCurrentPageIndex(this); | 347 return pEnv->FFI_GetCurrentPageIndex(this); |
348 } | 348 } |
349 | 349 |
350 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, | 350 void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, |
351 int32_t iCurPage) { | 351 int32_t iCurPage) { |
352 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc() || | 352 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc() || |
353 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || | 353 m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || |
354 iCurPage >= m_pDocument->GetSDKDoc()->GetPageCount()) { | 354 iCurPage >= m_pDocument->GetSDKDoc()->GetPageCount()) { |
355 return; | 355 return; |
356 } | 356 } |
357 | 357 |
358 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 358 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
359 if (!pEnv) | 359 if (!pEnv) |
360 return; | 360 return; |
361 pEnv->FFI_SetCurrentPage(this, iCurPage); | 361 pEnv->FFI_SetCurrentPage(this, iCurPage); |
362 } | 362 } |
363 | 363 |
364 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { | 364 FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { |
365 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 365 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
366 return FALSE; | 366 return FALSE; |
367 if (m_pDocument->GetSDKDoc()->GetInterForm()) | 367 if (m_pDocument->GetSDKDoc()->GetInterForm()) |
368 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaCalculateEnabled(); | 368 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaCalculateEnabled(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, | 403 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, |
404 const CFX_WideString& wsFilePath, | 404 const CFX_WideString& wsFilePath, |
405 FX_BOOL bXDP) { | 405 FX_BOOL bXDP) { |
406 if (hDoc != m_pDocument->GetXFADoc()) | 406 if (hDoc != m_pDocument->GetXFADoc()) |
407 return; | 407 return; |
408 | 408 |
409 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && | 409 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && |
410 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) | 410 m_pDocument->GetDocType() != DOCTYPE_STATIC_XFA) |
411 return; | 411 return; |
412 | 412 |
413 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 413 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
414 if (!pEnv) | 414 if (!pEnv) |
415 return; | 415 return; |
416 | 416 |
417 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; | 417 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; |
418 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); | 418 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); |
419 if (wsFilePath.IsEmpty()) { | 419 if (wsFilePath.IsEmpty()) { |
420 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) | 420 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) |
421 return; | 421 return; |
422 | 422 |
423 CFX_WideString filepath = pEnv->JS_fieldBrowse(); | 423 CFX_WideString filepath = pEnv->JS_fieldBrowse(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, | 502 void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, |
503 const CFX_WideString& bsURL, | 503 const CFX_WideString& bsURL, |
504 FX_BOOL bAppend) { | 504 FX_BOOL bAppend) { |
505 if (hDoc != m_pDocument->GetXFADoc()) | 505 if (hDoc != m_pDocument->GetXFADoc()) |
506 return; | 506 return; |
507 | 507 |
508 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 508 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
509 return; | 509 return; |
510 | 510 |
511 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 511 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
512 if (!pEnv) | 512 if (!pEnv) |
513 return; | 513 return; |
514 | 514 |
515 CFX_WideStringC str(bsURL.c_str()); | 515 CFX_WideStringC str(bsURL.c_str()); |
516 | 516 |
517 pEnv->FFI_GotoURL(this, str, bAppend); | 517 pEnv->FFI_GotoURL(this, str, bAppend); |
518 } | 518 } |
519 | 519 |
520 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { | 520 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |
521 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 521 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, | 561 void CPDFXFA_DocEnvironment::Print(CXFA_FFDoc* hDoc, |
562 int32_t nStartPage, | 562 int32_t nStartPage, |
563 int32_t nEndPage, | 563 int32_t nEndPage, |
564 uint32_t dwOptions) { | 564 uint32_t dwOptions) { |
565 if (hDoc != m_pDocument->GetXFADoc()) | 565 if (hDoc != m_pDocument->GetXFADoc()) |
566 return; | 566 return; |
567 | 567 |
568 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 568 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
569 if (!pEnv || !pEnv->GetFormFillInfo() || | 569 if (!pEnv || !pEnv->GetFormFillInfo() || |
570 !pEnv->GetFormFillInfo()->m_pJsPlatform || | 570 !pEnv->GetFormFillInfo()->m_pJsPlatform || |
571 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { | 571 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { |
572 return; | 572 return; |
573 } | 573 } |
574 | 574 |
575 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( | 575 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( |
576 pEnv->GetFormFillInfo()->m_pJsPlatform, | 576 pEnv->GetFormFillInfo()->m_pJsPlatform, |
577 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, | 577 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, |
578 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, | 578 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 pWidgetAccIterator.reset( | 625 pWidgetAccIterator.reset( |
626 m_pDocument->GetXFADocView()->CreateWidgetAccIterator()); | 626 m_pDocument->GetXFADocView()->CreateWidgetAccIterator()); |
627 if (!pWidgetAccIterator) | 627 if (!pWidgetAccIterator) |
628 return TRUE; | 628 return TRUE; |
629 | 629 |
630 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 630 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
631 pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 631 pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
632 while (pWidgetAcc) { | 632 while (pWidgetAcc) { |
633 int fRet = pWidgetAcc->ProcessValidate(-1); | 633 int fRet = pWidgetAcc->ProcessValidate(-1); |
634 if (fRet == XFA_EVENTERROR_Error) { | 634 if (fRet == XFA_EVENTERROR_Error) { |
635 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 635 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
636 if (!pEnv) | 636 if (!pEnv) |
637 return FALSE; | 637 return FALSE; |
638 | 638 |
639 CFX_WideString ws; | 639 CFX_WideString ws; |
640 ws.FromLocal(IDS_XFA_Validate_Input); | 640 ws.FromLocal(IDS_XFA_Validate_Input); |
641 CFX_ByteString bs = ws.UTF16LE_Encode(); | 641 CFX_ByteString bs = ws.UTF16LE_Encode(); |
642 int len = bs.GetLength(); | 642 int len = bs.GetLength(); |
643 pEnv->FFI_Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", | 643 pEnv->FFI_Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", |
644 0, 1); | 644 0, 1); |
645 bs.ReleaseBuffer(len); | 645 bs.ReleaseBuffer(len); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 687 |
688 m_pDocument->GetXFADocView()->UpdateDocView(); | 688 m_pDocument->GetXFADocView()->UpdateDocView(); |
689 FX_BOOL ret = SubmitDataInternal(hDoc, submit); | 689 FX_BOOL ret = SubmitDataInternal(hDoc, submit); |
690 NotifySubmit(FALSE); | 690 NotifySubmit(FALSE); |
691 return ret; | 691 return ret; |
692 } | 692 } |
693 | 693 |
694 IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( | 694 IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( |
695 CXFA_FFDoc* hDoc, | 695 CXFA_FFDoc* hDoc, |
696 const CFX_WideString& wsLink) { | 696 const CFX_WideString& wsLink) { |
697 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 697 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
698 if (!pEnv) | 698 if (!pEnv) |
699 return FALSE; | 699 return FALSE; |
700 | 700 |
701 CFX_ByteString bs = wsLink.UTF16LE_Encode(); | 701 CFX_ByteString bs = wsLink.UTF16LE_Encode(); |
702 int len = bs.GetLength(); | 702 int len = bs.GetLength(); |
703 FPDF_FILEHANDLER* pFileHandler = | 703 FPDF_FILEHANDLER* pFileHandler = |
704 pEnv->FFI_OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); | 704 pEnv->FFI_OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); |
705 bs.ReleaseBuffer(len); | 705 bs.ReleaseBuffer(len); |
706 | 706 |
707 if (!pFileHandler) | 707 if (!pFileHandler) |
708 return nullptr; | 708 return nullptr; |
709 return new CFPDF_FileStream(pFileHandler); | 709 return new CFPDF_FileStream(pFileHandler); |
710 } | 710 } |
711 | 711 |
712 FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, | 712 FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, |
713 int fileType, | 713 int fileType, |
714 FPDF_DWORD encodeType, | 714 FPDF_DWORD encodeType, |
715 FPDF_DWORD flag) { | 715 FPDF_DWORD flag) { |
716 if (!m_pDocument->GetXFADocView()) | 716 if (!m_pDocument->GetXFADocView()) |
717 return FALSE; | 717 return FALSE; |
718 | 718 |
719 CFX_ByteString content; | 719 CFX_ByteString content; |
720 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 720 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
721 if (!pEnv) | 721 if (!pEnv) |
722 return FALSE; | 722 return FALSE; |
723 | 723 |
724 CFPDF_FileStream fileStream(pFileHandler); | 724 CFPDF_FileStream fileStream(pFileHandler); |
725 if (fileType == FXFA_SAVEAS_XML) { | 725 if (fileType == FXFA_SAVEAS_XML) { |
726 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; | 726 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; |
727 fileStream.WriteBlock(kContent, 0, strlen(kContent)); | 727 fileStream.WriteBlock(kContent, 0, strlen(kContent)); |
728 m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream, | 728 m_pDocument->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream, |
729 nullptr); | 729 nullptr); |
730 return TRUE; | 730 return TRUE; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1)); | 881 srcURL = (pos == -1) ? L"" : srcURL.Right(csURL.GetLength() - (pos + 1)); |
882 } | 882 } |
883 csToAddress.Replace(L",", L";"); | 883 csToAddress.Replace(L",", L";"); |
884 csCCAddress.Replace(L",", L";"); | 884 csCCAddress.Replace(L",", L";"); |
885 csBCCAddress.Replace(L",", L";"); | 885 csBCCAddress.Replace(L",", L";"); |
886 return TRUE; | 886 return TRUE; |
887 } | 887 } |
888 | 888 |
889 FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, | 889 FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, |
890 CXFA_Submit submit) { | 890 CXFA_Submit submit) { |
891 CPDFDoc_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 891 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
892 if (!pEnv) | 892 if (!pEnv) |
893 return FALSE; | 893 return FALSE; |
894 | 894 |
895 CFX_WideStringC csURLC; | 895 CFX_WideStringC csURLC; |
896 submit.GetSubmitTarget(csURLC); | 896 submit.GetSubmitTarget(csURLC); |
897 CFX_WideString csURL(csURLC); | 897 CFX_WideString csURL(csURLC); |
898 if (csURL.IsEmpty()) { | 898 if (csURL.IsEmpty()) { |
899 CFX_WideString ws; | 899 CFX_WideString ws; |
900 ws.FromLocal("Submit cancelled."); | 900 ws.FromLocal("Submit cancelled."); |
901 CFX_ByteString bs = ws.UTF16LE_Encode(); | 901 CFX_ByteString bs = ws.UTF16LE_Encode(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 if (!m_pJSContext) { | 1014 if (!m_pJSContext) { |
1015 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1015 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( |
1016 m_pDocument->GetSDKDoc()); | 1016 m_pDocument->GetSDKDoc()); |
1017 m_pJSContext = | 1017 m_pJSContext = |
1018 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1018 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); |
1019 } | 1019 } |
1020 | 1020 |
1021 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1021 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( |
1022 szPropName, pValue); | 1022 szPropName, pValue); |
1023 } | 1023 } |
OLD | NEW |