summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_mgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp77
1 files changed, 28 insertions, 49 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index aac1673346..69432a4af1 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -95,12 +95,9 @@ void CFX_SystemHandler::SetCursor(int32_t nCursorType) {
}
void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) {
- // g_pFormFillApp->FFI_Invalidate();
CPDFSDK_Annot* pSDKAnnot = (CPDFSDK_Annot*)hWnd;
- CPDFXFA_Page* pPage = NULL;
- CPDFSDK_PageView* pPageView = NULL;
- pPageView = pSDKAnnot->GetPageView();
- pPage = pSDKAnnot->GetPDFXFAPage();
+ CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
+ UnderlyingPageType* pPage = pSDKAnnot->GetUnderlyingPage();
if (!pPage || !pPageView)
return;
CPDF_Matrix page2device;
@@ -124,10 +121,8 @@ void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) {
CPDF_Point righttop = CPDF_Point(rect.right, rect.top);
CPDF_Point ptA = pFFL->PWLtoFFL(leftbottom);
CPDF_Point ptB = pFFL->PWLtoFFL(righttop);
-
CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot();
- ASSERT(pAnnot);
- CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage();
+ UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage();
ASSERT(pPage);
m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y);
}
@@ -210,9 +205,9 @@ FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() {
return m_pEnv->FFI_GetLocalTime();
}
-CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc,
+CPDFDoc_Environment::CPDFDoc_Environment(UnderlyingDocumentType* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
- : m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pXFADoc(pDoc) {
+ : m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pUnderlyingDoc(pDoc) {
m_pSysHandler.reset(new CFX_SystemHandler(this));
}
@@ -390,14 +385,13 @@ CFFL_IFormFiller* CPDFDoc_Environment::GetIFormFiller() {
return m_pIFormFiller.get();
}
-CPDFSDK_Document::CPDFSDK_Document(CPDFXFA_Document* pDoc,
+CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc,
CPDFDoc_Environment* pEnv)
: m_pDoc(pDoc),
m_pFocusAnnot(nullptr),
m_pEnv(pEnv),
m_bChangeMask(FALSE),
- m_bBeingDestroyed(FALSE) {
-}
+ m_bBeingDestroyed(FALSE) {}
CPDFSDK_Document::~CPDFSDK_Document() {
m_bBeingDestroyed = TRUE;
@@ -410,29 +404,32 @@ CPDFSDK_Document::~CPDFSDK_Document() {
m_pageMap.clear();
}
-CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDFXFA_Page* pPDFXFAPage,
- FX_BOOL ReNew) {
- auto it = m_pageMap.find(pPDFXFAPage);
+CPDFSDK_PageView* CPDFSDK_Document::GetPageView(
+ UnderlyingPageType* pUnderlyingPage,
+ FX_BOOL ReNew) {
+ auto it = m_pageMap.find(pUnderlyingPage);
if (it != m_pageMap.end())
return it->second;
if (!ReNew)
return nullptr;
- CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pPDFXFAPage);
- m_pageMap[pPDFXFAPage] = pPageView;
+ CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pUnderlyingPage);
+ m_pageMap[pUnderlyingPage] = pPageView;
// Delay to load all the annotations, to avoid endless loop.
pPageView->LoadFXAnnots();
return pPageView;
}
CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() {
- CPDFXFA_Page* pPage = (CPDFXFA_Page*)m_pEnv->FFI_GetCurrentPage(m_pDoc);
+ UnderlyingPageType* pPage =
+ UnderlyingFromFPDFPage(m_pEnv->FFI_GetCurrentPage(m_pDoc));
return pPage ? GetPageView(pPage, TRUE) : nullptr;
}
CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) {
- CPDFXFA_Page* pTempPage = (CPDFXFA_Page*)m_pEnv->FFI_GetPage(m_pDoc, nIndex);
+ UnderlyingPageType* pTempPage =
+ UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex));
if (!pTempPage)
return nullptr;
@@ -441,8 +438,8 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) {
}
void CPDFSDK_Document::ProcJavascriptFun() {
- CPDFXFA_Document* pPDFDoc = GetDocument();
- CPDF_DocJSActions docJS(pPDFDoc->GetPDFDoc());
+ CPDF_Document* pPDFDoc = GetPDFDocument();
+ CPDF_DocJSActions docJS(pPDFDoc);
int iCount = docJS.CountJSActions();
if (iCount < 1)
return;
@@ -459,7 +456,7 @@ FX_BOOL CPDFSDK_Document::ProcOpenAction() {
if (!m_pDoc)
return FALSE;
- CPDF_Dictionary* pRoot = m_pDoc->GetPDFDoc()->GetRoot();
+ CPDF_Dictionary* pRoot = GetPDFDocument()->GetRoot();
if (!pRoot)
return FALSE;
@@ -484,12 +481,12 @@ FX_BOOL CPDFSDK_Document::ProcOpenAction() {
CPDF_OCContext* CPDFSDK_Document::GetOCContext() {
if (!m_pOccontent)
- m_pOccontent.reset(new CPDF_OCContext(m_pDoc->GetPDFDoc()));
+ m_pOccontent.reset(new CPDF_OCContext(GetPDFDocument()));
return m_pOccontent.get();
}
-void CPDFSDK_Document::ReMovePageView(CPDFXFA_Page* pPDFXFAPage) {
- auto it = m_pageMap.find(pPDFXFAPage);
+void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) {
+ auto it = m_pageMap.find(pUnderlyingPage);
if (it == m_pageMap.end())
return;
@@ -502,11 +499,8 @@ void CPDFSDK_Document::ReMovePageView(CPDFXFA_Page* pPDFXFAPage) {
m_pageMap.erase(it);
}
-CPDFXFA_Page* CPDFSDK_Document::GetPage(int nIndex) {
- CPDFXFA_Page* pTempPage = (CPDFXFA_Page*)m_pEnv->FFI_GetPage(m_pDoc, nIndex);
- if (!pTempPage)
- return NULL;
- return pTempPage;
+UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) {
+ return UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex));
}
CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() {
@@ -590,21 +584,6 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) {
return FALSE;
}
-FX_BOOL CPDFSDK_Document::DeletePages(int nStart, int nCount) {
- if (nStart < 0 || nStart >= GetPageCount() || nCount <= 0) {
- return FALSE;
- }
-
- CPDFXFA_Page* pTempPage = NULL;
- for (int i = nCount - 1; i >= 0; i--) {
- pTempPage = GetPage(nStart + i);
- if (pTempPage != NULL) {
- ReMovePageView(pTempPage);
- }
- }
- return TRUE;
-}
-
void CPDFSDK_Document::OnCloseDocument() {
KillFocusAnnot();
}
@@ -1011,7 +990,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
SetLock(TRUE);
m_page->AddRef();
- if (m_pSDKDoc->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) {
+ if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) {
IXFA_PageView* pageView = NULL;
pageView = m_page->GetXFAPageView();
ASSERT(pageView != NULL);
@@ -1081,9 +1060,9 @@ void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) {
int CPDFSDK_PageView::GetPageIndex() {
if (m_page) {
CPDF_Dictionary* pDic = m_page->GetPDFPage()->m_pFormDict;
- CPDFXFA_Document* pDoc = m_pSDKDoc->GetDocument();
+ CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument();
if (pDoc && pDic) {
- return pDoc->GetPDFDoc()->GetPageIndex(pDic->GetObjNum());
+ return pDoc->GetPageIndex(pDic->GetObjNum());
}
}
return -1;