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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "fpdfsdk/include/fsdk_mgr.h" | 9 #include "fpdfsdk/include/fsdk_mgr.h" |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 private: | 88 private: |
89 CPDFDoc_Environment* m_pEnv; | 89 CPDFDoc_Environment* m_pEnv; |
90 int m_nCharSet; | 90 int m_nCharSet; |
91 }; | 91 }; |
92 | 92 |
93 void CFX_SystemHandler::SetCursor(int32_t nCursorType) { | 93 void CFX_SystemHandler::SetCursor(int32_t nCursorType) { |
94 m_pEnv->FFI_SetCursor(nCursorType); | 94 m_pEnv->FFI_SetCursor(nCursorType); |
95 } | 95 } |
96 | 96 |
97 void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) { | 97 void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) { |
98 // g_pFormFillApp->FFI_Invalidate(); | |
99 CPDFSDK_Annot* pSDKAnnot = (CPDFSDK_Annot*)hWnd; | 98 CPDFSDK_Annot* pSDKAnnot = (CPDFSDK_Annot*)hWnd; |
100 CPDFXFA_Page* pPage = NULL; | 99 CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); |
101 CPDFSDK_PageView* pPageView = NULL; | 100 UnderlyingPageType* pPage = pSDKAnnot->GetUnderlyingPage(); |
102 pPageView = pSDKAnnot->GetPageView(); | |
103 pPage = pSDKAnnot->GetPDFXFAPage(); | |
104 if (!pPage || !pPageView) | 101 if (!pPage || !pPageView) |
105 return; | 102 return; |
106 CPDF_Matrix page2device; | 103 CPDF_Matrix page2device; |
107 pPageView->GetCurrentMatrix(page2device); | 104 pPageView->GetCurrentMatrix(page2device); |
108 CPDF_Matrix device2page; | 105 CPDF_Matrix device2page; |
109 device2page.SetReverse(page2device); | 106 device2page.SetReverse(page2device); |
110 FX_FLOAT left, top, right, bottom; | 107 FX_FLOAT left, top, right, bottom; |
111 device2page.Transform((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, left, top); | 108 device2page.Transform((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, left, top); |
112 device2page.Transform((FX_FLOAT)rect.right, (FX_FLOAT)rect.bottom, right, | 109 device2page.Transform((FX_FLOAT)rect.right, (FX_FLOAT)rect.bottom, right, |
113 bottom); | 110 bottom); |
114 CPDF_Rect rcPDF(left, bottom, right, top); | 111 CPDF_Rect rcPDF(left, bottom, right, top); |
115 rcPDF.Normalize(); | 112 rcPDF.Normalize(); |
116 | 113 |
117 m_pEnv->FFI_Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right, | 114 m_pEnv->FFI_Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right, |
118 rcPDF.bottom); | 115 rcPDF.bottom); |
119 } | 116 } |
120 void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) { | 117 void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) { |
121 CFFL_FormFiller* pFFL = (CFFL_FormFiller*)pFormFiller; | 118 CFFL_FormFiller* pFFL = (CFFL_FormFiller*)pFormFiller; |
122 if (pFFL) { | 119 if (pFFL) { |
123 CPDF_Point leftbottom = CPDF_Point(rect.left, rect.bottom); | 120 CPDF_Point leftbottom = CPDF_Point(rect.left, rect.bottom); |
124 CPDF_Point righttop = CPDF_Point(rect.right, rect.top); | 121 CPDF_Point righttop = CPDF_Point(rect.right, rect.top); |
125 CPDF_Point ptA = pFFL->PWLtoFFL(leftbottom); | 122 CPDF_Point ptA = pFFL->PWLtoFFL(leftbottom); |
126 CPDF_Point ptB = pFFL->PWLtoFFL(righttop); | 123 CPDF_Point ptB = pFFL->PWLtoFFL(righttop); |
127 | |
128 CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot(); | 124 CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot(); |
129 ASSERT(pAnnot); | 125 UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage(); |
130 CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); | |
131 ASSERT(pPage); | 126 ASSERT(pPage); |
132 m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y); | 127 m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y); |
133 } | 128 } |
134 } | 129 } |
135 | 130 |
136 FX_BOOL CFX_SystemHandler::IsSelectionImplemented() { | 131 FX_BOOL CFX_SystemHandler::IsSelectionImplemented() { |
137 if (m_pEnv) { | 132 if (m_pEnv) { |
138 FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo(); | 133 FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo(); |
139 if (pInfo && pInfo->FFI_OutputSelectedRect) | 134 if (pInfo && pInfo->FFI_OutputSelectedRect) |
140 return TRUE; | 135 return TRUE; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return m_pEnv->FFI_SetTimer(uElapse, lpTimerFunc); | 198 return m_pEnv->FFI_SetTimer(uElapse, lpTimerFunc); |
204 } | 199 } |
205 void CFX_SystemHandler::KillTimer(int32_t nID) { | 200 void CFX_SystemHandler::KillTimer(int32_t nID) { |
206 m_pEnv->FFI_KillTimer(nID); | 201 m_pEnv->FFI_KillTimer(nID); |
207 } | 202 } |
208 | 203 |
209 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() { | 204 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() { |
210 return m_pEnv->FFI_GetLocalTime(); | 205 return m_pEnv->FFI_GetLocalTime(); |
211 } | 206 } |
212 | 207 |
213 CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc, | 208 CPDFDoc_Environment::CPDFDoc_Environment(UnderlyingDocumentType* pDoc, |
214 FPDF_FORMFILLINFO* pFFinfo) | 209 FPDF_FORMFILLINFO* pFFinfo) |
215 : m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pXFADoc(pDoc) { | 210 : m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pUnderlyingDoc(pDoc) { |
216 m_pSysHandler.reset(new CFX_SystemHandler(this)); | 211 m_pSysHandler.reset(new CFX_SystemHandler(this)); |
217 } | 212 } |
218 | 213 |
219 CPDFDoc_Environment::~CPDFDoc_Environment() { | 214 CPDFDoc_Environment::~CPDFDoc_Environment() { |
220 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); | 215 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); |
221 if (pProvider->m_pEnvList.GetSize() == 0) | 216 if (pProvider->m_pEnvList.GetSize() == 0) |
222 pProvider->SetJavaScriptInitialized(FALSE); | 217 pProvider->SetJavaScriptInitialized(FALSE); |
223 } | 218 } |
224 | 219 |
225 int CPDFDoc_Environment::JS_appAlert(const FX_WCHAR* Msg, | 220 int CPDFDoc_Environment::JS_appAlert(const FX_WCHAR* Msg, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 m_pActionHandler.reset(new CPDFSDK_ActionHandler()); | 378 m_pActionHandler.reset(new CPDFSDK_ActionHandler()); |
384 return m_pActionHandler.get(); | 379 return m_pActionHandler.get(); |
385 } | 380 } |
386 | 381 |
387 CFFL_IFormFiller* CPDFDoc_Environment::GetIFormFiller() { | 382 CFFL_IFormFiller* CPDFDoc_Environment::GetIFormFiller() { |
388 if (!m_pIFormFiller) | 383 if (!m_pIFormFiller) |
389 m_pIFormFiller.reset(new CFFL_IFormFiller(this)); | 384 m_pIFormFiller.reset(new CFFL_IFormFiller(this)); |
390 return m_pIFormFiller.get(); | 385 return m_pIFormFiller.get(); |
391 } | 386 } |
392 | 387 |
393 CPDFSDK_Document::CPDFSDK_Document(CPDFXFA_Document* pDoc, | 388 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, |
394 CPDFDoc_Environment* pEnv) | 389 CPDFDoc_Environment* pEnv) |
395 : m_pDoc(pDoc), | 390 : m_pDoc(pDoc), |
396 m_pFocusAnnot(nullptr), | 391 m_pFocusAnnot(nullptr), |
397 m_pEnv(pEnv), | 392 m_pEnv(pEnv), |
398 m_bChangeMask(FALSE), | 393 m_bChangeMask(FALSE), |
399 m_bBeingDestroyed(FALSE) { | 394 m_bBeingDestroyed(FALSE) {} |
400 } | |
401 | 395 |
402 CPDFSDK_Document::~CPDFSDK_Document() { | 396 CPDFSDK_Document::~CPDFSDK_Document() { |
403 m_bBeingDestroyed = TRUE; | 397 m_bBeingDestroyed = TRUE; |
404 | 398 |
405 for (auto& it : m_pageMap) | 399 for (auto& it : m_pageMap) |
406 it.second->KillFocusAnnotIfNeeded(); | 400 it.second->KillFocusAnnotIfNeeded(); |
407 | 401 |
408 for (auto& it : m_pageMap) | 402 for (auto& it : m_pageMap) |
409 delete it.second; | 403 delete it.second; |
410 m_pageMap.clear(); | 404 m_pageMap.clear(); |
411 } | 405 } |
412 | 406 |
413 CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDFXFA_Page* pPDFXFAPage, | 407 CPDFSDK_PageView* CPDFSDK_Document::GetPageView( |
414 FX_BOOL ReNew) { | 408 UnderlyingPageType* pUnderlyingPage, |
415 auto it = m_pageMap.find(pPDFXFAPage); | 409 FX_BOOL ReNew) { |
| 410 auto it = m_pageMap.find(pUnderlyingPage); |
416 if (it != m_pageMap.end()) | 411 if (it != m_pageMap.end()) |
417 return it->second; | 412 return it->second; |
418 | 413 |
419 if (!ReNew) | 414 if (!ReNew) |
420 return nullptr; | 415 return nullptr; |
421 | 416 |
422 CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pPDFXFAPage); | 417 CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pUnderlyingPage); |
423 m_pageMap[pPDFXFAPage] = pPageView; | 418 m_pageMap[pUnderlyingPage] = pPageView; |
424 // Delay to load all the annotations, to avoid endless loop. | 419 // Delay to load all the annotations, to avoid endless loop. |
425 pPageView->LoadFXAnnots(); | 420 pPageView->LoadFXAnnots(); |
426 return pPageView; | 421 return pPageView; |
427 } | 422 } |
428 | 423 |
429 CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() { | 424 CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() { |
430 CPDFXFA_Page* pPage = (CPDFXFA_Page*)m_pEnv->FFI_GetCurrentPage(m_pDoc); | 425 UnderlyingPageType* pPage = |
| 426 UnderlyingFromFPDFPage(m_pEnv->FFI_GetCurrentPage(m_pDoc)); |
431 return pPage ? GetPageView(pPage, TRUE) : nullptr; | 427 return pPage ? GetPageView(pPage, TRUE) : nullptr; |
432 } | 428 } |
433 | 429 |
434 CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) { | 430 CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) { |
435 CPDFXFA_Page* pTempPage = (CPDFXFA_Page*)m_pEnv->FFI_GetPage(m_pDoc, nIndex); | 431 UnderlyingPageType* pTempPage = |
| 432 UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex)); |
436 if (!pTempPage) | 433 if (!pTempPage) |
437 return nullptr; | 434 return nullptr; |
438 | 435 |
439 auto it = m_pageMap.find(pTempPage); | 436 auto it = m_pageMap.find(pTempPage); |
440 return it->second; | 437 return it->second; |
441 } | 438 } |
442 | 439 |
443 void CPDFSDK_Document::ProcJavascriptFun() { | 440 void CPDFSDK_Document::ProcJavascriptFun() { |
444 CPDFXFA_Document* pPDFDoc = GetDocument(); | 441 CPDF_Document* pPDFDoc = GetPDFDocument(); |
445 CPDF_DocJSActions docJS(pPDFDoc->GetPDFDoc()); | 442 CPDF_DocJSActions docJS(pPDFDoc); |
446 int iCount = docJS.CountJSActions(); | 443 int iCount = docJS.CountJSActions(); |
447 if (iCount < 1) | 444 if (iCount < 1) |
448 return; | 445 return; |
449 for (int i = 0; i < iCount; i++) { | 446 for (int i = 0; i < iCount; i++) { |
450 CFX_ByteString csJSName; | 447 CFX_ByteString csJSName; |
451 CPDF_Action jsAction = docJS.GetJSAction(i, csJSName); | 448 CPDF_Action jsAction = docJS.GetJSAction(i, csJSName); |
452 if (m_pEnv->GetActionHander()) | 449 if (m_pEnv->GetActionHander()) |
453 m_pEnv->GetActionHander()->DoAction_JavaScript( | 450 m_pEnv->GetActionHander()->DoAction_JavaScript( |
454 jsAction, CFX_WideString::FromLocal(csJSName), this); | 451 jsAction, CFX_WideString::FromLocal(csJSName), this); |
455 } | 452 } |
456 } | 453 } |
457 | 454 |
458 FX_BOOL CPDFSDK_Document::ProcOpenAction() { | 455 FX_BOOL CPDFSDK_Document::ProcOpenAction() { |
459 if (!m_pDoc) | 456 if (!m_pDoc) |
460 return FALSE; | 457 return FALSE; |
461 | 458 |
462 CPDF_Dictionary* pRoot = m_pDoc->GetPDFDoc()->GetRoot(); | 459 CPDF_Dictionary* pRoot = GetPDFDocument()->GetRoot(); |
463 if (!pRoot) | 460 if (!pRoot) |
464 return FALSE; | 461 return FALSE; |
465 | 462 |
466 CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction"); | 463 CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction"); |
467 if (!pOpenAction) | 464 if (!pOpenAction) |
468 pOpenAction = pRoot->GetArray("OpenAction"); | 465 pOpenAction = pRoot->GetArray("OpenAction"); |
469 | 466 |
470 if (!pOpenAction) | 467 if (!pOpenAction) |
471 return FALSE; | 468 return FALSE; |
472 | 469 |
473 if (pOpenAction->IsArray()) | 470 if (pOpenAction->IsArray()) |
474 return TRUE; | 471 return TRUE; |
475 | 472 |
476 if (CPDF_Dictionary* pDict = pOpenAction->AsDictionary()) { | 473 if (CPDF_Dictionary* pDict = pOpenAction->AsDictionary()) { |
477 CPDF_Action action(pDict); | 474 CPDF_Action action(pDict); |
478 if (m_pEnv->GetActionHander()) | 475 if (m_pEnv->GetActionHander()) |
479 m_pEnv->GetActionHander()->DoAction_DocOpen(action, this); | 476 m_pEnv->GetActionHander()->DoAction_DocOpen(action, this); |
480 return TRUE; | 477 return TRUE; |
481 } | 478 } |
482 return FALSE; | 479 return FALSE; |
483 } | 480 } |
484 | 481 |
485 CPDF_OCContext* CPDFSDK_Document::GetOCContext() { | 482 CPDF_OCContext* CPDFSDK_Document::GetOCContext() { |
486 if (!m_pOccontent) | 483 if (!m_pOccontent) |
487 m_pOccontent.reset(new CPDF_OCContext(m_pDoc->GetPDFDoc())); | 484 m_pOccontent.reset(new CPDF_OCContext(GetPDFDocument())); |
488 return m_pOccontent.get(); | 485 return m_pOccontent.get(); |
489 } | 486 } |
490 | 487 |
491 void CPDFSDK_Document::ReMovePageView(CPDFXFA_Page* pPDFXFAPage) { | 488 void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) { |
492 auto it = m_pageMap.find(pPDFXFAPage); | 489 auto it = m_pageMap.find(pUnderlyingPage); |
493 if (it == m_pageMap.end()) | 490 if (it == m_pageMap.end()) |
494 return; | 491 return; |
495 | 492 |
496 CPDFSDK_PageView* pPageView = it->second; | 493 CPDFSDK_PageView* pPageView = it->second; |
497 if (pPageView->IsLocked()) | 494 if (pPageView->IsLocked()) |
498 return; | 495 return; |
499 | 496 |
500 pPageView->KillFocusAnnotIfNeeded(); | 497 pPageView->KillFocusAnnotIfNeeded(); |
501 delete pPageView; | 498 delete pPageView; |
502 m_pageMap.erase(it); | 499 m_pageMap.erase(it); |
503 } | 500 } |
504 | 501 |
505 CPDFXFA_Page* CPDFSDK_Document::GetPage(int nIndex) { | 502 UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) { |
506 CPDFXFA_Page* pTempPage = (CPDFXFA_Page*)m_pEnv->FFI_GetPage(m_pDoc, nIndex); | 503 return UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex)); |
507 if (!pTempPage) | |
508 return NULL; | |
509 return pTempPage; | |
510 } | 504 } |
511 | 505 |
512 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { | 506 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { |
513 if (!m_pInterForm) | 507 if (!m_pInterForm) |
514 m_pInterForm.reset(new CPDFSDK_InterForm(this)); | 508 m_pInterForm.reset(new CPDFSDK_InterForm(this)); |
515 return m_pInterForm.get(); | 509 return m_pInterForm.get(); |
516 } | 510 } |
517 | 511 |
518 void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, | 512 void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, |
519 CPDFSDK_Annot* pAnnot) { | 513 CPDFSDK_Annot* pAnnot) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 577 |
584 if (!m_pFocusAnnot) | 578 if (!m_pFocusAnnot) |
585 return TRUE; | 579 return TRUE; |
586 } else { | 580 } else { |
587 m_pFocusAnnot = pFocusAnnot; | 581 m_pFocusAnnot = pFocusAnnot; |
588 } | 582 } |
589 } | 583 } |
590 return FALSE; | 584 return FALSE; |
591 } | 585 } |
592 | 586 |
593 FX_BOOL CPDFSDK_Document::DeletePages(int nStart, int nCount) { | |
594 if (nStart < 0 || nStart >= GetPageCount() || nCount <= 0) { | |
595 return FALSE; | |
596 } | |
597 | |
598 CPDFXFA_Page* pTempPage = NULL; | |
599 for (int i = nCount - 1; i >= 0; i--) { | |
600 pTempPage = GetPage(nStart + i); | |
601 if (pTempPage != NULL) { | |
602 ReMovePageView(pTempPage); | |
603 } | |
604 } | |
605 return TRUE; | |
606 } | |
607 | |
608 void CPDFSDK_Document::OnCloseDocument() { | 587 void CPDFSDK_Document::OnCloseDocument() { |
609 KillFocusAnnot(); | 588 KillFocusAnnot(); |
610 } | 589 } |
611 | 590 |
612 FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { | 591 FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { |
613 FX_DWORD dwPermissions = m_pDoc->GetPDFDoc()->GetUserPermissions(); | 592 FX_DWORD dwPermissions = m_pDoc->GetPDFDoc()->GetUserPermissions(); |
614 return dwPermissions & nFlag; | 593 return dwPermissions & nFlag; |
615 } | 594 } |
616 | 595 |
617 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { | 596 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { | 983 FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { |
1005 return FALSE; | 984 return FALSE; |
1006 } | 985 } |
1007 | 986 |
1008 void CPDFSDK_PageView::LoadFXAnnots() { | 987 void CPDFSDK_PageView::LoadFXAnnots() { |
1009 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 988 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
1010 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 989 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
1011 | 990 |
1012 SetLock(TRUE); | 991 SetLock(TRUE); |
1013 m_page->AddRef(); | 992 m_page->AddRef(); |
1014 if (m_pSDKDoc->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) { | 993 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) { |
1015 IXFA_PageView* pageView = NULL; | 994 IXFA_PageView* pageView = NULL; |
1016 pageView = m_page->GetXFAPageView(); | 995 pageView = m_page->GetXFAPageView(); |
1017 ASSERT(pageView != NULL); | 996 ASSERT(pageView != NULL); |
1018 | 997 |
1019 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( | 998 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( |
1020 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | | 999 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | |
1021 XFA_WIDGETFILTER_Viewable | | 1000 XFA_WIDGETFILTER_Viewable | |
1022 XFA_WIDGETFILTER_AllType); | 1001 XFA_WIDGETFILTER_AllType); |
1023 if (!pWidgetHander) { | 1002 if (!pWidgetHander) { |
1024 m_page->Release(); | 1003 m_page->Release(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { | 1053 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { |
1075 CPDF_Rect rcWindow = pAnnot->GetRect(); | 1054 CPDF_Rect rcWindow = pAnnot->GetRect(); |
1076 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 1055 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
1077 pEnv->FFI_Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, | 1056 pEnv->FFI_Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, |
1078 rcWindow.bottom); | 1057 rcWindow.bottom); |
1079 } | 1058 } |
1080 | 1059 |
1081 int CPDFSDK_PageView::GetPageIndex() { | 1060 int CPDFSDK_PageView::GetPageIndex() { |
1082 if (m_page) { | 1061 if (m_page) { |
1083 CPDF_Dictionary* pDic = m_page->GetPDFPage()->m_pFormDict; | 1062 CPDF_Dictionary* pDic = m_page->GetPDFPage()->m_pFormDict; |
1084 CPDFXFA_Document* pDoc = m_pSDKDoc->GetDocument(); | 1063 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
1085 if (pDoc && pDic) { | 1064 if (pDoc && pDic) { |
1086 return pDoc->GetPDFDoc()->GetPageIndex(pDic->GetObjNum()); | 1065 return pDoc->GetPageIndex(pDic->GetObjNum()); |
1087 } | 1066 } |
1088 } | 1067 } |
1089 return -1; | 1068 return -1; |
1090 } | 1069 } |
1091 | 1070 |
1092 bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const { | 1071 bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const { |
1093 if (!p) | 1072 if (!p) |
1094 return false; | 1073 return false; |
1095 | 1074 |
1096 const auto& annots = m_pAnnotList->All(); | 1075 const auto& annots = m_pAnnotList->All(); |
1097 return std::find(annots.begin(), annots.end(), p) != annots.end(); | 1076 return std::find(annots.begin(), annots.end(), p) != annots.end(); |
1098 } | 1077 } |
1099 | 1078 |
1100 CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() { | 1079 CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() { |
1101 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1080 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
1102 if (!pFocusAnnot) | 1081 if (!pFocusAnnot) |
1103 return nullptr; | 1082 return nullptr; |
1104 | 1083 |
1105 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1084 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
1106 if (pAnnot == pFocusAnnot) | 1085 if (pAnnot == pFocusAnnot) |
1107 return pAnnot; | 1086 return pAnnot; |
1108 } | 1087 } |
1109 return nullptr; | 1088 return nullptr; |
1110 } | 1089 } |
OLD | NEW |