diff options
-rw-r--r-- | core/fxcrt/extension.h | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_iformfiller.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/fsdk_actionhandler.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/fsdk_annothandler.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 21 | ||||
-rw-r--r-- | fpdfsdk/javascript/Field.cpp | 32 |
6 files changed, 27 insertions, 47 deletions
diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index 698bded9b6..877f1ca144 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -47,7 +47,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { IFX_FileAccess* Retain() override { m_RefCount++; - return (IFX_FileAccess*)this; + return this; } void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; } diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp index 107197fa72..c63ee0e8c4 100644 --- a/fpdfsdk/formfiller/cffl_iformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp @@ -709,10 +709,8 @@ void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, if (!m_bNotifying) { ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); pInterForm->OnCalculate(pWidget->GetFormField()); - m_bNotifying = FALSE; } } @@ -724,8 +722,7 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, if (!m_bNotifying) { ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); FX_BOOL bFormated = FALSE; CFX_WideString sValue = diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index bc6bd2826c..38e5bfe00d 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -604,7 +604,7 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); if (pInterForm->DoAction_Hide(action)) { pDocument->SetChangeMark(); return TRUE; @@ -616,21 +616,21 @@ FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); return pInterForm->DoAction_SubmitForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); return pInterForm->DoAction_ResetForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); if (pInterForm->DoAction_ImportData(action)) { pDocument->SetChangeMark(); return TRUE; diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index eda3b49058..ded04c9371 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -423,7 +423,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); if (!pCtrl) @@ -729,7 +729,7 @@ CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPage) { CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); pInterForm->AddXFAMap(pAnnot, pWidget); return pWidget; diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 076e99849e..258dddbe10 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -379,8 +379,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc, CFX_WideString cSubject = iLength > 4 ? params[4].ToCFXWideString() : L""; CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString() : L""; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CFX_ByteTextBuf textBuf; if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) return FALSE; @@ -478,12 +477,9 @@ FX_BOOL Document::removeField(IJS_Context* cc, } CFX_WideString sFieldName = params[0].ToCFXWideString(); - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); std::vector<CPDFSDK_Widget*> widgets; pInterForm->GetWidgets(sFieldName, &widgets); - if (widgets.empty()) return TRUE; @@ -520,8 +516,7 @@ FX_BOOL Document::resetForm(IJS_Context* cc, m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array aName(pRuntime); @@ -611,8 +606,7 @@ FX_BOOL Document::submitForm(IJS_Context* cc, CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToV8Array()); } - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); if (aFields.GetLength() == 0 && bEmpty) { if (pPDFInterForm->CheckRequiredFields(nullptr, true)) { @@ -1028,9 +1022,7 @@ FX_BOOL Document::baseURL(IJS_Context* cc, FX_BOOL Document::calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); if (vp.IsGetting()) { if (pInterForm->IsCalculateEnabled()) vp << true; @@ -1311,8 +1303,7 @@ FX_BOOL Document::calculateNow(IJS_Context* cc, m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); pInterForm->OnCalculate(); return TRUE; } diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 43bc89e26e..ecf4f5a7e2 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -213,7 +213,7 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, FX_BOOL bResetAP, FX_BOOL bRefresh) { std::vector<CPDFSDK_Widget*> widgets; - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); pInterForm->GetWidgets(pFormField, &widgets); if (bResetAP) { @@ -249,7 +249,7 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, FX_BOOL bRefresh) { ASSERT(pFormControl); - CPDFSDK_InterForm* pForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pForm = pDocument->GetInterForm(); CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl); if (pWidget) { @@ -1193,8 +1193,7 @@ FX_BOOL Field::display(IJS_Context* cc, CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField)); if (!pWidget) @@ -1224,7 +1223,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1509,8 +1508,7 @@ FX_BOOL Field::hidden(IJS_Context* cc, CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField)); if (!pWidget) @@ -1531,7 +1529,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1679,8 +1677,7 @@ FX_BOOL Field::lineWidth(IJS_Context* cc, if (!pFormControl) return FALSE; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); if (!pFormField->CountControls()) return FALSE; @@ -1698,8 +1695,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1936,8 +1932,7 @@ void Field::SetPassword(CPDFSDK_Document* pDocument, FX_BOOL Field::print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2101,8 +2096,7 @@ FX_BOOL Field::rect(IJS_Context* cc, return FALSE; CPDF_FormField* pFormField = FieldArray[0]; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField)); if (!pWidget) @@ -2128,8 +2122,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_FloatRect& rect) { - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - + CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -3252,8 +3245,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc, if (nCount < 1) return FALSE; - CPDFSDK_InterForm* pInterForm = - (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); + CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); CPDFSDK_Widget* pWidget = nullptr; if (nCount == 1) { pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); |