Index: fpdfsdk/cpdfsdk_pageview.cpp |
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp |
index c1424ece98b34e9b5d2f6d3e55bc1a64c40945fe..90163dc5e908f8723f6ede38afc4a946c301c767 100644 |
--- a/fpdfsdk/cpdfsdk_pageview.cpp |
+++ b/fpdfsdk/cpdfsdk_pageview.cpp |
@@ -42,7 +42,7 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, |
m_bValid(FALSE), |
m_bLocked(FALSE), |
m_bBeingDestroyed(false) { |
- CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); |
+ CPDFSDK_InterForm* pInterForm = pSDKDoc->GetEnv()->GetInterForm(); |
if (pInterForm) { |
CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
#ifdef PDF_ENABLE_XFA |
@@ -65,8 +65,9 @@ CPDFSDK_PageView::~CPDFSDK_PageView() { |
m_page->SetView(nullptr); |
#endif // PDF_ENABLE_XFA |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
+ |
for (CPDFSDK_Annot* pAnnot : m_SDKAnnotArray) |
pAnnotHandlerMgr->ReleaseAnnot(pAnnot); |
@@ -88,7 +89,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, |
CPDF_RenderOptions* pOptions) { |
#endif // PDF_ENABLE_XFA |
m_curMatrix = *pUser2Device; |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
#ifdef PDF_ENABLE_XFA |
CPDFXFA_Page* pPage = GetPDFXFAPage(); |
@@ -127,7 +128,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, |
// for pdf/static xfa. |
CPDFSDK_AnnotIterator annotIterator(this, true); |
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ pFormFillEnv->GetAnnotHandlerMgr(); |
pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device, |
pOptions->m_bDrawAnnots); |
} |
@@ -135,8 +137,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, |
CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, |
FX_FLOAT pageY) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pFormFillEnv->GetAnnotHandlerMgr(); |
CPDFSDK_AnnotIterator annotIterator(this, false); |
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); |
@@ -151,8 +153,8 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, |
CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, |
FX_FLOAT pageY) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pFormFillEnv->GetAnnotHandlerMgr(); |
CPDFSDK_AnnotIterator annotIterator(this, false); |
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
bool bHitTest = pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET; |
@@ -180,8 +182,8 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { |
if (pSDKAnnot) |
return pSDKAnnot; |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pFormFillEnv->GetAnnotHandlerMgr(); |
pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); |
if (!pSDKAnnot) |
return nullptr; |
@@ -200,8 +202,8 @@ FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { |
if (GetFocusAnnot() == pAnnot) |
m_pSDKDoc->KillFocusAnnot(0); |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pFormFillEnv->GetAnnotHandlerMgr(); |
if (pAnnotHandler) |
pAnnotHandler->ReleaseAnnot(pAnnot); |
@@ -263,8 +265,8 @@ FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, |
return FALSE; |
} |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
if (!pAnnotHandlerMgr->Annot_OnLButtonDown(this, &pAnnot, nFlag, point)) |
return FALSE; |
@@ -282,8 +284,8 @@ FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, |
if (!pAnnot) |
return FALSE; |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
FX_BOOL ok = |
pAnnotHandlerMgr->Annot_OnRButtonDown(this, &pAnnot, nFlag, point); |
if (!pAnnot) |
@@ -297,8 +299,8 @@ FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, |
FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, |
uint32_t nFlag) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); |
if (!pFXAnnot) |
return FALSE; |
@@ -312,8 +314,8 @@ FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, |
FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, |
uint32_t nFlag) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); |
CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot()); |
if (pFocusAnnot && pFocusAnnot != pFXAnnot) { |
@@ -326,8 +328,8 @@ FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, |
} |
FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); |
if (pFXAnnot) { |
if (m_pCaptureWidget && m_pCaptureWidget != pFXAnnot) { |
@@ -365,16 +367,16 @@ FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, |
if (!pAnnot) |
return FALSE; |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
return pAnnotHandlerMgr->Annot_OnMouseWheel(this, &pAnnot, nFlag, (int)deltaY, |
point); |
} |
FX_BOOL CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { |
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
return pAnnotHandlerMgr->Annot_OnChar(pAnnot, nChar, nFlag); |
} |
@@ -383,8 +385,8 @@ FX_BOOL CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { |
FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { |
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr(); |
return pAnnotHandlerMgr->Annot_OnKeyDown(pAnnot, nKeyCode, nFlag); |
} |
return FALSE; |
@@ -395,14 +397,15 @@ FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { |
} |
void CPDFSDK_PageView::LoadFXAnnots() { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = |
+ pFormFillEnv->GetAnnotHandlerMgr(); |
SetLock(TRUE); |
#ifdef PDF_ENABLE_XFA |
CFX_RetainPtr<CPDFXFA_Page> protector(m_page); |
- if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
+ if (pFormFillEnv->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
CXFA_FFPageView* pageView = m_page->GetXFAPageView(); |
std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( |
pageView->CreateWidgetIterator( |
@@ -449,16 +452,15 @@ void CPDFSDK_PageView::LoadFXAnnots() { |
} |
void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pSDKDoc->GetEnv(); |
for (const auto& rc : rects) |
- pEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); |
+ pFormFillEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); |
} |
void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { |
CFX_FloatRect rcWindow = pAnnot->GetRect(); |
- CPDFSDK_FormFillEnvironment* pEnv = m_pSDKDoc->GetEnv(); |
- pEnv->Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, |
- rcWindow.bottom); |
+ m_pSDKDoc->GetEnv()->Invalidate(m_page, rcWindow.left, rcWindow.top, |
+ rcWindow.right, rcWindow.bottom); |
} |
int CPDFSDK_PageView::GetPageIndex() const { |