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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (pPage == NULL) | 283 if (pPage == NULL) |
284 return; | 284 return; |
285 | 285 |
286 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 286 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
287 if (!pEnv) | 287 if (!pEnv) |
288 return; | 288 return; |
289 | 289 |
290 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPag
e.right, rcPage.top); | 290 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPag
e.right, rcPage.top); |
291 } | 291 } |
292 | 292 |
293 void CPDFXFA_Document::InvalidateRect(XFA_HWIDGET hWidget, FX_DWORD dwFlags /* =
0 */) | 293 void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, FX_DWORD dwFlags /*
= 0 */) |
294 { | 294 { |
295 if (!hWidget) | 295 if (!hWidget) |
296 return; | 296 return; |
297 | 297 |
298 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) | 298 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) |
299 return; | 299 return; |
300 | 300 |
301 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) | 301 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) |
302 return; | 302 return; |
303 | 303 |
304 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); | 304 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); |
305 if (!pWidgetHandler) | 305 if (!pWidgetHandler) |
306 return; | 306 return; |
307 | 307 |
308 IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); | 308 IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); |
309 if (!pPageView) | 309 if (!pPageView) |
310 return; | 310 return; |
311 | 311 |
312 CFX_RectF rect; | 312 CFX_RectF rect; |
313 pWidgetHandler->GetRect(hWidget, rect); | 313 pWidgetHandler->GetRect(hWidget, rect); |
314 InvalidateRect(pPageView, rect, dwFlags); | 314 InvalidateRect(pPageView, rect, dwFlags); |
315 } | 315 } |
316 | 316 |
317 void CPDFXFA_Document::DisplayCaret(XFA_HWIDGET hWidget, FX_BOOL bVisible, const
CFX_RectF* pRtAnchor) | 317 void CPDFXFA_Document::DisplayCaret(IXFA_Widget* hWidget, FX_BOOL bVisible, cons
t CFX_RectF* pRtAnchor) |
318 { | 318 { |
319 if (!hWidget || pRtAnchor == NULL) | 319 if (!hWidget || pRtAnchor == NULL) |
320 return; | 320 return; |
321 | 321 |
322 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) | 322 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) |
323 return; | 323 return; |
324 | 324 |
325 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) | 325 if (m_iDocType != DOCTYPE_DYNIMIC_XFA) |
326 return; | 326 return; |
327 | 327 |
(...skipping 14 matching lines...) Expand all Loading... |
342 FXRect2PDFRect(*pRtAnchor, rcCaret); | 342 FXRect2PDFRect(*pRtAnchor, rcCaret); |
343 | 343 |
344 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 344 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
345 if (!pEnv) | 345 if (!pEnv) |
346 return; | 346 return; |
347 | 347 |
348 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret
.top, rcCaret.right, rcCaret.bottom); | 348 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret
.top, rcCaret.right, rcCaret.bottom); |
349 | 349 |
350 } | 350 } |
351 | 351 |
352 FX_BOOL CPDFXFA_Document::GetPopupPos(XFA_HWIDGET hWidget, FX_FLOAT fMinPopup, F
X_FLOAT fMaxPopup, const CFX_RectF &rtAnchor, CFX_RectF &rtPopup) | 352 FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget, FX_FLOAT fMinPopup,
FX_FLOAT fMaxPopup, const CFX_RectF &rtAnchor, CFX_RectF &rtPopup) |
353 { | 353 { |
354 if (NULL == hWidget) | 354 if (NULL == hWidget) |
355 { | 355 { |
356 return FALSE; | 356 return FALSE; |
357 } | 357 } |
358 IXFA_PageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPage
View(hWidget); | 358 IXFA_PageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPage
View(hWidget); |
359 if (NULL == pXFAPageView) | 359 if (NULL == pXFAPageView) |
360 { | 360 { |
361 return FALSE; | 361 return FALSE; |
362 } | 362 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 503 } |
504 break; | 504 break; |
505 } | 505 } |
506 default: | 506 default: |
507 break; | 507 break; |
508 } | 508 } |
509 | 509 |
510 return TRUE; | 510 return TRUE; |
511 } | 511 } |
512 | 512 |
513 FX_BOOL»CPDFXFA_Document::PopupMenu(XFA_HWIDGET hWidget, CFX_PointF ptPopup, con
st CFX_RectF* pRectExclude) | 513 FX_BOOL»CPDFXFA_Document::PopupMenu(IXFA_Widget* hWidget, CFX_PointF ptPopup, co
nst CFX_RectF* pRectExclude) |
514 { | 514 { |
515 if (NULL == hWidget) | 515 if (NULL == hWidget) |
516 { | 516 { |
517 return FALSE; | 517 return FALSE; |
518 } | 518 } |
519 IXFA_PageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPage
View(hWidget); | 519 IXFA_PageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPage
View(hWidget); |
520 if (pXFAPageView == NULL) | 520 if (pXFAPageView == NULL) |
521 return FALSE; | 521 return FALSE; |
522 CPDFXFA_Page* pPage = GetPage(pXFAPageView); | 522 CPDFXFA_Page* pPage = GetPage(pXFAPageView); |
523 | 523 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 //pEnv->FFI_PageEvent(pPage, FXFA_PAGEVIEWEVENT_POSTADDED); | 566 //pEnv->FFI_PageEvent(pPage, FXFA_PAGEVIEWEVENT_POSTADDED); |
567 } | 567 } |
568 else if (dwFlags == FXFA_PAGEVIEWEVENT_POSTREMOVED) | 568 else if (dwFlags == FXFA_PAGEVIEWEVENT_POSTREMOVED) |
569 { | 569 { |
570 //pEnv->FFI_PageEvent(pPage, FXFA_PAGEVIEWEVENT_POSTREMOVED); | 570 //pEnv->FFI_PageEvent(pPage, FXFA_PAGEVIEWEVENT_POSTREMOVED); |
571 //RemovePage(pPage); | 571 //RemovePage(pPage); |
572 //delete pPage; | 572 //delete pPage; |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 void CPDFXFA_Document::WidgetEvent(XFA_HWIDGET hWidget, CXFA_WidgetAcc* pWidgetD
ata, FX_DWORD dwEvent, FX_LPVOID pParam, FX_LPVOID pAdditional) | 576 void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, CXFA_WidgetAcc* pWidget
Data, FX_DWORD dwEvent, FX_LPVOID pParam, FX_LPVOID pAdditional) |
577 { | 577 { |
578 if (m_iDocType != DOCTYPE_DYNIMIC_XFA || NULL == hWidget) | 578 if (m_iDocType != DOCTYPE_DYNIMIC_XFA || NULL == hWidget) |
579 return; | 579 return; |
580 | 580 |
581 int pageViewCount = m_pSDKDoc->GetPageViewCount(); | 581 int pageViewCount = m_pSDKDoc->GetPageViewCount(); |
582 | 582 |
583 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 583 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
584 if (pEnv == NULL) | 584 if (pEnv == NULL) |
585 return; | 585 return; |
586 | 586 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 866 |
867 return TRUE; | 867 return TRUE; |
868 } | 868 } |
869 void CPDFXFA_Document::SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) | 869 void CPDFXFA_Document::SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) |
870 { | 870 { |
871 if (hDoc != m_pXFADoc || !m_pSDKDoc) | 871 if (hDoc != m_pXFADoc || !m_pSDKDoc) |
872 return; | 872 return; |
873 if (m_pSDKDoc->GetInterForm()) | 873 if (m_pSDKDoc->GetInterForm()) |
874 m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled); | 874 m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled); |
875 } | 875 } |
876 void CPDFXFA_Document::SetFocusWidget(IXFA_Doc* hDoc, XFA_HWIDGET hWidget) | 876 void CPDFXFA_Document::SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) |
877 { | 877 { |
878 if (hDoc != m_pXFADoc) | 878 if (hDoc != m_pXFADoc) |
879 return; | 879 return; |
880 | 880 |
881 if (NULL == hWidget) { | 881 if (NULL == hWidget) { |
882 m_pSDKDoc->SetFocusAnnot(NULL); | 882 m_pSDKDoc->SetFocusAnnot(NULL); |
883 return; | 883 return; |
884 } | 884 } |
885 | 885 |
886 int pageViewCount = m_pSDKDoc->GetPageViewCount(); | 886 int pageViewCount = m_pSDKDoc->GetPageViewCount(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FX_BYTE 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(XFA_HWIDGET 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(); |
949 if (pEnv == NULL) | 949 if (pEnv == NULL) |
950 return; | 950 return; |
951 return; | 951 return; |
952 //pEnv->FFI_AddDoRecord(this, hWidget); | 952 //pEnv->FFI_AddDoRecord(this, hWidget); |
953 } | 953 } |
954 | 954 |
955 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) | 955 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) |
956 { | 956 { |
(...skipping 475 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 |