Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: fpdfsdk/cpdfsdk_widget.cpp

Issue 2400473002: Start proxying CPDFSDK_Document methods through CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_widget.cpp
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 94555b70c5d6fe304071b06cf1570d9231d21fed..12817ab9d16381ad1297ec0feb51d7e0817ed1ca 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -69,8 +69,7 @@ CPDFSDK_Widget::~CPDFSDK_Widget() {}
#ifdef PDF_ENABLE_XFA
CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
@@ -94,8 +93,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
}
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
CFX_WideString sName = GetName();
@@ -108,8 +106,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
}
CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
if (!m_pWidgetHandler) {
if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
@@ -223,8 +220,7 @@ FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) {
FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
PDFSDK_FieldAction& data,
CPDFSDK_PageView* pPageView) {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
CXFA_FFWidget* hWidget = GetMixXFAWidget();
if (!hWidget)
@@ -327,8 +323,7 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
}
void CPDFSDK_Widget::SynchronizeXFAValue() {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
if (!pXFADocView)
return;
@@ -342,8 +337,7 @@ void CPDFSDK_Widget::SynchronizeXFAValue() {
}
void CPDFSDK_Widget::SynchronizeXFAItems() {
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
if (!pXFADocView)
return;
@@ -509,8 +503,7 @@ int CPDFSDK_Widget::GetFieldType() const {
FX_BOOL CPDFSDK_Widget::IsAppearanceValid() {
#ifdef PDF_ENABLE_XFA
- CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
int nDocType = pDoc->GetDocType();
if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
return TRUE;
@@ -852,9 +845,8 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
uint8_t alpha = m_pInterForm->GetHighlightAlpha();
CFX_FloatRect rcDevice;
- ASSERT(m_pInterForm->GetDocument());
- CPDFSDK_FormFillEnvironment* pEnv = m_pInterForm->GetDocument()->GetEnv();
- if (!pEnv)
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
+ if (!pFormFillEnv)
return;
CFX_Matrix page2device;
pPageView->GetCurrentMatrix(page2device);
@@ -999,10 +991,8 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
CPDF_IconFit iconFit = pControl->GetIconFit();
- CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
- CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv();
-
- CBA_FontMap font_map(this, pEnv->GetSysHandler());
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
+ CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
font_map.SetAPType("N");
CFX_ByteString csAP =
@@ -1377,9 +1367,8 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->EnableRefresh(FALSE);
- CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
- CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv();
- CBA_FontMap font_map(this, pEnv->GetSysHandler());
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
+ CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
CFX_FloatRect rcEdit = rcClient;
@@ -1443,10 +1432,8 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->EnableRefresh(FALSE);
- CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
- CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv();
-
- CBA_FontMap font_map(this, pEnv->GetSysHandler());
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
+ CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f));
@@ -1530,10 +1517,8 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->EnableRefresh(FALSE);
- CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
- CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv();
-
- CBA_FontMap font_map(this, pEnv->GetSysHandler());
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
+ CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
pEdit->SetFontMap(&font_map);
CFX_FloatRect rcClient = GetClientRect();
@@ -1846,11 +1831,10 @@ void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) {
FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
CPDFSDK_PageView* pPageView) {
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
+ CPDFXFA_Document* pXFADoc = pFormFillEnv->GetXFADocument();
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit);
@@ -1878,7 +1862,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
param.m_pTarget = pAcc;
int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
- if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
+ if (CXFA_FFDocView* pDocView = pXFADoc->GetXFADocView())
pDocView->UpdateDocView();
if (nRet == XFA_EVENTERROR_Success)
@@ -1890,9 +1874,9 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
CPDF_Action action = GetAAction(type);
if (action.GetDict() && action.GetType() != CPDF_Action::Unknown) {
- CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
- return pActionHandler->DoAction_Field(action, type, pDocument,
- GetFormField(), data);
+ CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHander();
+ return pActionHandler->DoAction_Field(
+ action, type, pFormFillEnv->GetSDKDocument(), GetFormField(), data);
}
return FALSE;
}
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698