OLD | NEW |
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 "../../../public/fpdf_formfill.h" | 7 #include "../../../public/fpdf_formfill.h" |
8 #include "../../include/fsdk_define.h" | 8 #include "../../include/fsdk_define.h" |
9 #include "../../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../../include/fsdk_mgr.h" | 10 #include "../../include/fsdk_mgr.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) | 626 else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) |
627 { | 627 { |
628 CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidge
t); | 628 CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidge
t); |
629 if (pAnnot) { | 629 if (pAnnot) { |
630 pSdkPageView->DeleteAnnot(pAnnot); | 630 pSdkPageView->DeleteAnnot(pAnnot); |
631 //pEnv->FFI_WidgetEvent(hWidget, XFA_WIDGETEVENT_PreRemo
ved); | 631 //pEnv->FFI_WidgetEvent(hWidget, XFA_WIDGETEVENT_PreRemo
ved); |
632 } | 632 } |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 FX_INT32 CPDFXFA_Document::CountPages(IXFA_Doc* hDoc) | 636 int32_t CPDFXFA_Document::CountPages(IXFA_Doc* hDoc) |
637 { | 637 { |
638 if (hDoc == m_pXFADoc && m_pSDKDoc) | 638 if (hDoc == m_pXFADoc && m_pSDKDoc) |
639 { | 639 { |
640 return GetPageCount(); | 640 return GetPageCount(); |
641 } | 641 } |
642 return 0; | 642 return 0; |
643 } | 643 } |
644 FX_INT32 CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) | 644 int32_t CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) |
645 { | 645 { |
646 if (hDoc != m_pXFADoc || !m_pSDKDoc) | 646 if (hDoc != m_pXFADoc || !m_pSDKDoc) |
647 return -1; | 647 return -1; |
648 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) | 648 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) |
649 return -1; | 649 return -1; |
650 | 650 |
651 | 651 |
652 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 652 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
653 if (pEnv == NULL) | 653 if (pEnv == NULL) |
654 return -1; | 654 return -1; |
655 | 655 |
656 return pEnv->FFI_GetCurrentPageIndex(this); | 656 return pEnv->FFI_GetCurrentPageIndex(this); |
657 } | 657 } |
658 void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, FX_INT32 iCurPage) | 658 void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) |
659 { | 659 { |
660 if (hDoc != m_pXFADoc || !m_pSDKDoc) | 660 if (hDoc != m_pXFADoc || !m_pSDKDoc) |
661 return; | 661 return; |
662 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) | 662 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) |
663 return; | 663 return; |
664 | 664 |
665 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 665 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
666 if (pEnv == NULL) | 666 if (pEnv == NULL) |
667 return; | 667 return; |
668 | 668 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i); | 889 CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i); |
890 if (pPageView == NULL) | 890 if (pPageView == NULL) |
891 continue; | 891 continue; |
892 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); | 892 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); |
893 if (pAnnot) { | 893 if (pAnnot) { |
894 m_pSDKDoc->SetFocusAnnot(pAnnot); | 894 m_pSDKDoc->SetFocusAnnot(pAnnot); |
895 break; | 895 break; |
896 } | 896 } |
897 } | 897 } |
898 } | 898 } |
899 void CPDFXFA_Document::Print(IXFA_Doc* hDoc, FX_INT32 nStartPage, FX_INT32 nEndP
age, FX_DWORD dwOptions) | 899 void CPDFXFA_Document::Print(IXFA_Doc* hDoc, int32_t nStartPage, int32_t nEndPag
e, FX_DWORD dwOptions) |
900 { | 900 { |
901 if (hDoc != m_pXFADoc) | 901 if (hDoc != m_pXFADoc) |
902 return; | 902 return; |
903 | 903 |
904 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 904 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
905 if (pEnv == NULL) | 905 if (pEnv == NULL) |
906 return; | 906 return; |
907 | 907 |
908 if (!pEnv->GetFormFillInfo() || pEnv->GetFormFillInfo()->m_pJsPlatform =
= NULL) | 908 if (!pEnv->GetFormFillInfo() || pEnv->GetFormFillInfo()->m_pJsPlatform =
= NULL) |
909 return; | 909 return; |
(...skipping 18 matching lines...) Expand all Loading... |
928 | 928 |
929 FX_ARGB CPDFXFA_Document::GetHighlightColor(IXFA_Doc* hDoc) | 929 FX_ARGB CPDFXFA_Document::GetHighlightColor(IXFA_Doc* hDoc) |
930 { | 930 { |
931 if (hDoc != m_pXFADoc) | 931 if (hDoc != m_pXFADoc) |
932 return 0; | 932 return 0; |
933 if (m_pSDKDoc) | 933 if (m_pSDKDoc) |
934 { | 934 { |
935 if(CPDFSDK_InterForm* pInterForm = m_pSDKDoc->GetInterForm()) | 935 if(CPDFSDK_InterForm* pInterForm = m_pSDKDoc->GetInterForm()) |
936 { | 936 { |
937 FX_COLORREF color = pInterForm->GetHighlightColor(FPDF_F
ORMFIELD_XFA); | 937 FX_COLORREF color = pInterForm->GetHighlightColor(FPDF_F
ORMFIELD_XFA); |
938 » » » FX_BYTE alpha = pInterForm->GetHighlightAlpha(); | 938 » » » uint8_t alpha = pInterForm->GetHighlightAlpha(); |
939 FX_ARGB argb = ArgbEncode((int)alpha, color); | 939 FX_ARGB argb = ArgbEncode((int)alpha, color); |
940 return argb; | 940 return argb; |
941 } | 941 } |
942 } | 942 } |
943 return 0; | 943 return 0; |
944 } | 944 } |
945 | 945 |
946 void CPDFXFA_Document::AddDoRecord(IXFA_Widget* hWidget) | 946 void CPDFXFA_Document::AddDoRecord(IXFA_Widget* hWidget) |
947 { | 947 { |
948 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 948 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 } | 1432 } |
1433 | 1433 |
1434 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu
ntime()); | 1434 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu
ntime()); |
1435 | 1435 |
1436 } | 1436 } |
1437 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue
, IFXJS_Runtime* runTime) | 1437 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue
, IFXJS_Runtime* runTime) |
1438 { | 1438 { |
1439 return runTime->GetHValueByName(utf8Name, hValue); | 1439 return runTime->GetHValueByName(utf8Name, hValue); |
1440 } | 1440 } |
1441 | 1441 |
OLD | NEW |