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" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr); | 256 return pEnv->PopupMenu(pPage, hWidget, menuFlag, ptPopup); |
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 CPDFSDK_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 || |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), | 493 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), |
494 pAcc->GetSize()); | 494 pAcc->GetSize()); |
495 } | 495 } |
496 } | 496 } |
497 if (!fileWrite.Flush()) { | 497 if (!fileWrite.Flush()) { |
498 // Ignoring flush error. | 498 // Ignoring flush error. |
499 } | 499 } |
500 } | 500 } |
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) { | |
505 if (hDoc != m_pDocument->GetXFADoc()) | 504 if (hDoc != m_pDocument->GetXFADoc()) |
506 return; | 505 return; |
507 | 506 |
508 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 507 if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) |
509 return; | 508 return; |
510 | 509 |
511 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 510 CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); |
512 if (!pEnv) | 511 if (!pEnv) |
513 return; | 512 return; |
514 | 513 |
515 CFX_WideStringC str(bsURL.c_str()); | 514 CFX_WideStringC str(bsURL.c_str()); |
516 | 515 pEnv->GotoURL(this, str); |
517 pEnv->GotoURL(this, str, bAppend); | |
518 } | 516 } |
519 | 517 |
520 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { | 518 FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |
521 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 519 if (hDoc != m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) |
522 return FALSE; | 520 return FALSE; |
523 if (m_pDocument->GetSDKDoc()->GetInterForm()) | 521 if (m_pDocument->GetSDKDoc()->GetInterForm()) |
524 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaValidationsEnabled(); | 522 return m_pDocument->GetSDKDoc()->GetInterForm()->IsXfaValidationsEnabled(); |
525 return TRUE; | 523 return TRUE; |
526 } | 524 } |
527 | 525 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 if (!m_pJSContext) { | 1010 if (!m_pJSContext) { |
1013 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1011 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( |
1014 m_pDocument->GetSDKDoc()); | 1012 m_pDocument->GetSDKDoc()); |
1015 m_pJSContext = | 1013 m_pJSContext = |
1016 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1014 m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); |
1017 } | 1015 } |
1018 | 1016 |
1019 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1017 return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( |
1020 szPropName, pValue); | 1018 szPropName, pValue); |
1021 } | 1019 } |
OLD | NEW |