diff options
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 21 | ||||
-rw-r--r-- | fpdfsdk/javascript/Field.cpp | 32 |
2 files changed, 18 insertions, 35 deletions
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)); |