| Index: fpdfsdk/include/cpdfdoc_environment.h
|
| diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/cpdfdoc_environment.h
|
| similarity index 68%
|
| rename from fpdfsdk/include/fsdk_mgr.h
|
| rename to fpdfsdk/include/cpdfdoc_environment.h
|
| index 38b06a9b5a6d8eed81066a9792d5604882c83c01..f6211d264c83c52b9a8370a69181dc0c02632b39 100644
|
| --- a/fpdfsdk/include/fsdk_mgr.h
|
| +++ b/fpdfsdk/include/cpdfdoc_environment.h
|
| @@ -1,37 +1,28 @@
|
| -// Copyright 2014 PDFium Authors. All rights reserved.
|
| +// Copyright 2016 PDFium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| -#ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_
|
| -#define FPDFSDK_INCLUDE_FSDK_MGR_H_
|
| +#ifndef FPDFSDK_INCLUDE_CPDFDOC_ENVIRONMENT_H_
|
| +#define FPDFSDK_INCLUDE_CPDFDOC_ENVIRONMENT_H_
|
|
|
| -#include <map>
|
| #include <memory>
|
| -#include <vector>
|
|
|
| #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
|
| #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
|
| #include "core/fpdfdoc/include/cpdf_occontext.h"
|
| #include "core/fxcrt/include/cfx_observable.h"
|
| #include "fpdfsdk/cfx_systemhandler.h"
|
| -#include "fpdfsdk/include/cpdfsdk_annot.h"
|
| -#include "fpdfsdk/include/fsdk_actionhandler.h"
|
| -#include "fpdfsdk/include/fsdk_common.h"
|
| #include "fpdfsdk/include/fsdk_define.h"
|
| #include "public/fpdf_formfill.h"
|
| #include "public/fpdf_fwlevent.h"
|
|
|
| class CFFL_IFormFiller;
|
| class CFX_SystemHandler;
|
| -class CPDF_AnnotList;
|
| class CPDFSDK_ActionHandler;
|
| -class CPDFSDK_Annot;
|
| class CPDFSDK_AnnotHandlerMgr;
|
| -class CPDFSDK_InterForm;
|
| -class CPDFSDK_PageView;
|
| -class CPDFSDK_Widget;
|
| +class CPDFSDK_Document;
|
| class IJS_Runtime;
|
|
|
| class CPDFDoc_Environment final {
|
| @@ -445,188 +436,4 @@ class CPDFDoc_Environment final {
|
| std::unique_ptr<CFX_SystemHandler> m_pSysHandler;
|
| };
|
|
|
| -class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> {
|
| - public:
|
| - static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle);
|
| -
|
| - CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFDoc_Environment* pEnv);
|
| - ~CPDFSDK_Document();
|
| -
|
| - CPDFSDK_InterForm* GetInterForm();
|
| -
|
| - // Gets the document object for the next layer down; for master this is
|
| - // a CPDF_Document, but for XFA it is a CPDFXFA_Document.
|
| - UnderlyingDocumentType* GetUnderlyingDocument() const {
|
| -#ifdef PDF_ENABLE_XFA
|
| - return GetXFADocument();
|
| -#else // PDF_ENABLE_XFA
|
| - return GetPDFDocument();
|
| -#endif // PDF_ENABLE_XFA
|
| - }
|
| -
|
| - // Gets the CPDF_Document, either directly in master, or from the
|
| - // CPDFXFA_Document for XFA.
|
| - CPDF_Document* GetPDFDocument() const {
|
| -#ifdef PDF_ENABLE_XFA
|
| - return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr;
|
| -#else // PDF_ENABLE_XFA
|
| - return m_pDoc;
|
| -#endif // PDF_ENABLE_XFA
|
| - }
|
| -
|
| -#ifdef PDF_ENABLE_XFA
|
| - // Gets the XFA document directly (XFA-only).
|
| - CPDFXFA_Document* GetXFADocument() const { return m_pDoc; }
|
| -
|
| - int GetPageViewCount() const { return m_pageMap.size(); }
|
| -#endif // PDF_ENABLE_XFA
|
| -
|
| - CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew);
|
| - CPDFSDK_PageView* GetPageView(int nIndex);
|
| - CPDFSDK_PageView* GetCurrentView();
|
| - void RemovePageView(UnderlyingPageType* pPage);
|
| - void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
|
| -
|
| - CPDFSDK_Annot* GetFocusAnnot();
|
| -
|
| - IJS_Runtime* GetJsRuntime();
|
| -
|
| - FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);
|
| - FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0);
|
| -
|
| - FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages,
|
| - CPDF_Document* pDstDoc);
|
| - FX_BOOL InsertPages(int nInsertAt,
|
| - const CPDF_Document* pSrcDoc,
|
| - const std::vector<uint16_t>& arrSrcPages);
|
| - FX_BOOL ReplacePages(int nPage,
|
| - const CPDF_Document* pSrcDoc,
|
| - const std::vector<uint16_t>& arrSrcPages);
|
| -
|
| - void OnCloseDocument();
|
| -
|
| - int GetPageCount() { return m_pDoc->GetPageCount(); }
|
| - FX_BOOL GetPermissions(int nFlag);
|
| - FX_BOOL GetChangeMark() { return m_bChangeMask; }
|
| - void SetChangeMark() { m_bChangeMask = TRUE; }
|
| - void ClearChangeMark() { m_bChangeMask = FALSE; }
|
| - CFX_WideString GetPath();
|
| - UnderlyingPageType* GetPage(int nIndex);
|
| - CPDFDoc_Environment* GetEnv() { return m_pEnv; }
|
| - void ProcJavascriptFun();
|
| - FX_BOOL ProcOpenAction();
|
| - CPDF_OCContext* GetOCContext();
|
| -
|
| - private:
|
| - std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap;
|
| - UnderlyingDocumentType* m_pDoc;
|
| - std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
|
| - CPDFSDK_Annot* m_pFocusAnnot;
|
| - CPDFDoc_Environment* m_pEnv;
|
| - std::unique_ptr<CPDF_OCContext> m_pOccontent;
|
| - FX_BOOL m_bChangeMask;
|
| - FX_BOOL m_bBeingDestroyed;
|
| -};
|
| -
|
| -class CPDFSDK_PageView final : public CPDF_Page::View {
|
| - public:
|
| - CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page);
|
| - ~CPDFSDK_PageView();
|
| -
|
| -#ifdef PDF_ENABLE_XFA
|
| - void PageView_OnDraw(CFX_RenderDevice* pDevice,
|
| - CFX_Matrix* pUser2Device,
|
| - CPDF_RenderOptions* pOptions,
|
| - const FX_RECT& pClip);
|
| -#else // PDF_ENABLE_XFA
|
| - void PageView_OnDraw(CFX_RenderDevice* pDevice,
|
| - CFX_Matrix* pUser2Device,
|
| - CPDF_RenderOptions* pOptions);
|
| -#endif // PDF_ENABLE_XFA
|
| -
|
| - const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
|
| - CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
|
| - const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
|
| - CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
|
| - CPDFSDK_Annot* GetFocusAnnot();
|
| - void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, FX_UINT nFlag = 0) {
|
| - m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);
|
| - }
|
| - FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {
|
| - return m_pSDKDoc->KillFocusAnnot(nFlag);
|
| - }
|
| - void KillFocusAnnotIfNeeded();
|
| -
|
| - CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict);
|
| - CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict);
|
| - CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot);
|
| -
|
| - FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
|
| - size_t CountAnnots() const;
|
| - CPDFSDK_Annot* GetAnnot(size_t nIndex);
|
| - CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict);
|
| -
|
| -#ifdef PDF_ENABLE_XFA
|
| - CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot);
|
| - CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget);
|
| - CPDFXFA_Page* GetPDFXFAPage() { return m_page; }
|
| -#endif // PDF_ENABLE_XFA
|
| -
|
| - CPDF_Page* GetPDFPage() const;
|
| - CPDF_Document* GetPDFDocument();
|
| - CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; }
|
| - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_UINT nFlag);
|
| - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_UINT nFlag);
|
| -#ifdef PDF_ENABLE_XFA
|
| - FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, FX_UINT nFlag);
|
| - FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, FX_UINT nFlag);
|
| -#endif // PDF_ENABLE_XFA
|
| - FX_BOOL OnChar(int nChar, FX_UINT nFlag);
|
| - FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
|
| - FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
|
| -
|
| - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, int nFlag);
|
| - FX_BOOL OnMouseWheel(double deltaX,
|
| - double deltaY,
|
| - const CFX_FloatPoint& point,
|
| - int nFlag);
|
| - bool IsValidAnnot(const CPDF_Annot* p) const;
|
| - void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; }
|
| - void UpdateRects(const std::vector<CFX_FloatRect>& rects);
|
| - void UpdateView(CPDFSDK_Annot* pAnnot);
|
| - const std::vector<CPDFSDK_Annot*>& GetAnnotList() const {
|
| - return m_fxAnnotArray;
|
| - }
|
| -
|
| - int GetPageIndex() const;
|
| - void LoadFXAnnots();
|
| - void ClearFXAnnots();
|
| - void SetValid(FX_BOOL bValid) { m_bValid = bValid; }
|
| - FX_BOOL IsValid() { return m_bValid; }
|
| - void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; }
|
| - FX_BOOL IsLocked() { return m_bLocked; }
|
| -#ifndef PDF_ENABLE_XFA
|
| - bool OwnsPage() const { return m_bOwnsPage; }
|
| - void TakePageOwnership() { m_bOwnsPage = true; }
|
| -#endif // PDF_ENABLE_XFA
|
| -
|
| - private:
|
| - int GetPageIndexForStaticPDF() const;
|
| -
|
| - CFX_Matrix m_curMatrix;
|
| - UnderlyingPageType* const m_page;
|
| - std::unique_ptr<CPDF_AnnotList> m_pAnnotList;
|
| - std::vector<CPDFSDK_Annot*> m_fxAnnotArray;
|
| - CPDFSDK_Document* const m_pSDKDoc;
|
| - CPDFSDK_Annot* m_CaptureWidget;
|
| -#ifndef PDF_ENABLE_XFA
|
| - bool m_bOwnsPage;
|
| -#endif // PDF_ENABLE_XFA
|
| - FX_BOOL m_bEnterWidget;
|
| - FX_BOOL m_bExitWidget;
|
| - FX_BOOL m_bOnWidget;
|
| - FX_BOOL m_bValid;
|
| - FX_BOOL m_bLocked;
|
| -};
|
| -
|
| -#endif // FPDFSDK_INCLUDE_FSDK_MGR_H_
|
| +#endif // FPDFSDK_INCLUDE_CPDFDOC_ENVIRONMENT_H_
|
|
|