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 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // Gets the CPDF_Document, either directly in master, or from the | 488 // Gets the CPDF_Document, either directly in master, or from the |
489 // CPDFXFA_Document for XFA. | 489 // CPDFXFA_Document for XFA. |
490 CPDF_Document* GetPDFDocument() const { | 490 CPDF_Document* GetPDFDocument() const { |
491 return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; | 491 return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; |
492 } | 492 } |
493 | 493 |
494 // Gets the XFA document directly (XFA-only). | 494 // Gets the XFA document directly (XFA-only). |
495 CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } | 495 CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } |
496 | 496 |
497 int GetPageViewCount() const { return m_pageMap.size(); } | 497 int GetPageViewCount() const { return m_pageMap.size(); } |
498 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPDFXFAPage, | 498 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, |
499 FX_BOOL ReNew = TRUE); | 499 FX_BOOL ReNew = TRUE); |
500 CPDFSDK_PageView* GetPageView(int nIndex); | 500 CPDFSDK_PageView* GetPageView(int nIndex); |
501 CPDFSDK_PageView* GetCurrentView(); | 501 CPDFSDK_PageView* GetCurrentView(); |
502 void RemovePageView(UnderlyingPageType* pPDFPage); | 502 void RemovePageView(UnderlyingPageType* pPage); |
503 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 503 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); |
504 | 504 |
505 CPDFSDK_Annot* GetFocusAnnot(); | 505 CPDFSDK_Annot* GetFocusAnnot(); |
506 | 506 |
507 IJS_Runtime* GetJsRuntime(); | 507 IJS_Runtime* GetJsRuntime(); |
508 | 508 |
509 FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0); | 509 FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0); |
510 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); | 510 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); |
511 | 511 |
512 FX_BOOL ExtractPages(const CFX_WordArray& arrExtraPages, | 512 FX_BOOL ExtractPages(const CFX_WordArray& arrExtraPages, |
513 CPDF_Document* pDstDoc); | 513 CPDF_Document* pDstDoc); |
514 FX_BOOL InsertPages(int nInsertAt, | 514 FX_BOOL InsertPages(int nInsertAt, |
515 const CPDF_Document* pSrcDoc, | 515 const CPDF_Document* pSrcDoc, |
516 const CFX_WordArray& arrSrcPages); | 516 const CFX_WordArray& arrSrcPages); |
517 FX_BOOL ReplacePages(int nPage, | 517 FX_BOOL ReplacePages(int nPage, |
518 const CPDF_Document* pSrcDoc, | 518 const CPDF_Document* pSrcDoc, |
519 const CFX_WordArray& arrSrcPages); | 519 const CFX_WordArray& arrSrcPages); |
520 | 520 |
521 void OnCloseDocument(); | 521 void OnCloseDocument(); |
522 | 522 |
523 int GetPageCount() { return m_pDoc->GetPageCount(); } | 523 int GetPageCount() { return m_pDoc->GetPageCount(); } |
524 FX_BOOL GetPermissions(int nFlag); | 524 FX_BOOL GetPermissions(int nFlag); |
525 FX_BOOL GetChangeMark() { return m_bChangeMask; } | 525 FX_BOOL GetChangeMark() { return m_bChangeMask; } |
526 void SetChangeMark() { m_bChangeMask = TRUE; } | 526 void SetChangeMark() { m_bChangeMask = TRUE; } |
527 void ClearChangeMark() { m_bChangeMask = FALSE; } | 527 void ClearChangeMark() { m_bChangeMask = FALSE; } |
528 CFX_WideString GetPath(); | 528 CFX_WideString GetPath(); |
529 CPDFXFA_Page* GetPage(int nIndex); | 529 UnderlyingPageType* GetPage(int nIndex); |
530 CPDFDoc_Environment* GetEnv() { return m_pEnv; } | 530 CPDFDoc_Environment* GetEnv() { return m_pEnv; } |
531 void ProcJavascriptFun(); | 531 void ProcJavascriptFun(); |
532 FX_BOOL ProcOpenAction(); | 532 FX_BOOL ProcOpenAction(); |
533 CPDF_OCContext* GetOCContext(); | 533 CPDF_OCContext* GetOCContext(); |
534 | 534 |
535 private: | 535 private: |
536 std::map<CPDFXFA_Page*, CPDFSDK_PageView*> m_pageMap; | 536 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; |
537 UnderlyingDocumentType* m_pDoc; | 537 UnderlyingDocumentType* m_pDoc; |
538 nonstd::unique_ptr<CPDFSDK_InterForm> m_pInterForm; | 538 nonstd::unique_ptr<CPDFSDK_InterForm> m_pInterForm; |
539 CPDFSDK_Annot* m_pFocusAnnot; | 539 CPDFSDK_Annot* m_pFocusAnnot; |
540 CPDFDoc_Environment* m_pEnv; | 540 CPDFDoc_Environment* m_pEnv; |
541 nonstd::unique_ptr<CPDF_OCContext> m_pOccontent; | 541 nonstd::unique_ptr<CPDF_OCContext> m_pOccontent; |
542 FX_BOOL m_bChangeMask; | 542 FX_BOOL m_bChangeMask; |
543 FX_BOOL m_bBeingDestroyed; | 543 FX_BOOL m_bBeingDestroyed; |
544 }; | 544 }; |
545 class CPDFSDK_PageView final { | 545 class CPDFSDK_PageView final { |
546 public: | 546 public: |
547 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, CPDFXFA_Page* page); | 547 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page); |
548 ~CPDFSDK_PageView(); | 548 ~CPDFSDK_PageView(); |
549 void PageView_OnDraw(CFX_RenderDevice* pDevice, | 549 void PageView_OnDraw(CFX_RenderDevice* pDevice, |
550 CPDF_Matrix* pUser2Device, | 550 CPDF_Matrix* pUser2Device, |
551 CPDF_RenderOptions* pOptions, | 551 CPDF_RenderOptions* pOptions, |
552 const FX_RECT& pClip); | 552 const FX_RECT& pClip); |
553 const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 553 const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
554 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 554 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
555 const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 555 const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
556 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 556 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
557 CPDFSDK_Annot* GetFocusAnnot(); | 557 CPDFSDK_Annot* GetFocusAnnot(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } | 603 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } |
604 FX_BOOL IsValid() { return m_bValid; } | 604 FX_BOOL IsValid() { return m_bValid; } |
605 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } | 605 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } |
606 FX_BOOL IsLocked() { return m_bLocked; } | 606 FX_BOOL IsLocked() { return m_bLocked; } |
607 | 607 |
608 private: | 608 private: |
609 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, | 609 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, |
610 CPDFSDK_Widget* pWidget); | 610 CPDFSDK_Widget* pWidget); |
611 | 611 |
612 CPDF_Matrix m_curMatrix; | 612 CPDF_Matrix m_curMatrix; |
613 CPDFXFA_Page* m_page; | 613 UnderlyingPageType* m_page; |
614 nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; | 614 nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; |
615 std::vector<CPDFSDK_Annot*> m_fxAnnotArray; | 615 std::vector<CPDFSDK_Annot*> m_fxAnnotArray; |
616 CPDFSDK_Document* m_pSDKDoc; | 616 CPDFSDK_Document* m_pSDKDoc; |
617 CPDFSDK_Annot* m_CaptureWidget; | 617 CPDFSDK_Annot* m_CaptureWidget; |
618 FX_BOOL m_bEnterWidget; | 618 FX_BOOL m_bEnterWidget; |
619 FX_BOOL m_bExitWidget; | 619 FX_BOOL m_bExitWidget; |
620 FX_BOOL m_bOnWidget; | 620 FX_BOOL m_bOnWidget; |
621 FX_BOOL m_bValid; | 621 FX_BOOL m_bValid; |
622 FX_BOOL m_bLocked; | 622 FX_BOOL m_bLocked; |
623 }; | 623 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 } | 689 } |
690 | 690 |
691 if (nStartPos < m) | 691 if (nStartPos < m) |
692 QuickSort(nStartPos, m, bAscend, pCompare); | 692 QuickSort(nStartPos, m, bAscend, pCompare); |
693 if (nStopPos > m) | 693 if (nStopPos > m) |
694 QuickSort(m, nStopPos, bAscend, pCompare); | 694 QuickSort(m, nStopPos, bAscend, pCompare); |
695 } | 695 } |
696 }; | 696 }; |
697 | 697 |
698 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ | 698 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ |
OLD | NEW |