Merge to XFA: Fix segmentation fault 'denial of service condition'
[pdfium.git] / fpdfsdk / src / javascript / Field.cpp
index c484cbb..94c5439 100644 (file)
@@ -149,7 +149,7 @@ void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &
                return;
        }
        std::wstring suffixal = strFieldNameParsed.substr(iStart+1);
-       iControlNo = FXSYS_wtoi((FX_LPCWSTR)suffixal.c_str());
+       iControlNo = FXSYS_wtoi(suffixal.c_str());
        if (iControlNo == 0)
        {
                int iStart;
@@ -188,13 +188,13 @@ FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldNam
        ASSERT(pInterForm != NULL);
 
        CFX_WideString swFieldNameTemp = csFieldName;
-       swFieldNameTemp.Replace((FX_LPCWSTR)L"..", (FX_LPCWSTR)L".");
+       swFieldNameTemp.Replace(L"..", L".");
 
        if (pInterForm->CountFields(swFieldNameTemp) <= 0)
        {
                std::wstring strFieldName;
                int iControlNo = -1;
-               ParseFieldName((wchar_t*)(FX_LPCWSTR)swFieldNameTemp, strFieldName, iControlNo);
+               ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo);
                if (iControlNo == -1) return FALSE;
                
                m_FieldName = strFieldName.c_str();
@@ -377,7 +377,7 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField)
 
 /* ---------------------------------------- property ---------------------------------------- */
 
-FX_BOOL Field::alignment(OBJ_PROP_PARAMS)
+FX_BOOL Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -415,16 +415,16 @@ FX_BOOL Field::alignment(OBJ_PROP_PARAMS)
                switch (pFormControl->GetControlAlignment())
                {
                        case 1:
-                               vp << (FX_LPCWSTR)L"center";
+                               vp << L"center";
                                break;
                        case 0:
-                               vp << (FX_LPCWSTR)L"left";
+                               vp << L"left";
                                break;
                        case 2:
-                               vp << (FX_LPCWSTR)L"right";
+                               vp << L"right";
                                break;
                        default:
-                               vp << (FX_LPCWSTR)L"";
+                               vp << L"";
                }
        }
 
@@ -437,7 +437,7 @@ void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::borderStyle(OBJ_PROP_PARAMS)
+FX_BOOL Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {      
        ASSERT(m_pDocument != NULL);
 
@@ -474,22 +474,22 @@ FX_BOOL Field::borderStyle(OBJ_PROP_PARAMS)
                switch (nBorderstyle)
                {
                        case BBS_SOLID:
-                               vp << (FX_LPCWSTR)L"solid";
+                               vp << L"solid";
                                break;
                        case BBS_DASH:
-                               vp << (FX_LPCWSTR)L"dashed";
+                               vp << L"dashed";
                                break;
                        case BBS_BEVELED:
-                               vp << (FX_LPCWSTR)L"beveled";
+                               vp << L"beveled";
                                break;
                        case BBS_INSET:
-                               vp << (FX_LPCWSTR)L"inset";
+                               vp << L"inset";
                                break;
                        case BBS_UNDERLINE:
-                               vp << (FX_LPCWSTR)L"underline";
+                               vp << L"underline";
                                break;
                        default:
-                               vp << (FX_LPCWSTR)L"";
+                               vp << L"";
                                break;
                }
        }
@@ -558,7 +558,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw
        }
 }
 
-FX_BOOL Field::buttonAlignX(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -609,7 +609,7 @@ void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& s
        //Not supported.
 }
 
-FX_BOOL Field::buttonAlignY(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -660,7 +660,7 @@ void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& s
        //Not supported.
 }
 
-FX_BOOL Field::buttonFitBounds(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -707,7 +707,7 @@ void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString
        //Not supported.
 }
 
-FX_BOOL Field::buttonPosition(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -752,7 +752,7 @@ void Field::SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString&
        //Not supported.
 }
 
-FX_BOOL Field::buttonScaleHow(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -802,7 +802,7 @@ void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString&
        //Not supported.
 }
 
-FX_BOOL Field::buttonScaleWhen(OBJ_PROP_PARAMS)
+FX_BOOL Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -864,7 +864,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString
        //Not supported.
 }
 
-FX_BOOL Field::calcOrderIndex(OBJ_PROP_PARAMS)
+FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -913,7 +913,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString&
        //Not supported.
 }
 
-FX_BOOL Field::charLimit(OBJ_PROP_PARAMS)
+FX_BOOL Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -955,7 +955,7 @@ void Field::SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::comb(OBJ_PROP_PARAMS)
+FX_BOOL Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1001,7 +1001,7 @@ void Field::SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
        //Not supported.
 }
 
-FX_BOOL Field::commitOnSelChange(OBJ_PROP_PARAMS)
+FX_BOOL Field::commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1047,7 +1047,7 @@ void Field::SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideStri
        //Not supported.
 }
 
-FX_BOOL Field::currentValueIndices(OBJ_PROP_PARAMS)
+FX_BOOL Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1152,7 +1152,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt
        }
 }
 
-FX_BOOL Field::defaultStyle(OBJ_PROP_PARAMS)
+FX_BOOL Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        // MQG sError = JSGetStringFromID(IDS_STRING_NOTSUPPORT);
        return FALSE;
@@ -1175,7 +1175,7 @@ void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& s
        //Not supported.
 }
 
-FX_BOOL Field::defaultValue(OBJ_PROP_PARAMS)
+FX_BOOL Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1219,7 +1219,7 @@ void Field::SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& s
        //Not supported.
 }
 
-FX_BOOL Field::doNotScroll(OBJ_PROP_PARAMS)
+FX_BOOL Field::doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1265,7 +1265,7 @@ void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& sw
        //Not supported.
 }
 
-FX_BOOL Field::doNotSpellCheck(OBJ_PROP_PARAMS)
+FX_BOOL Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1309,7 +1309,7 @@ void Field::SetDelay(FX_BOOL bDelay)
        }
 }
 
-FX_BOOL Field::delay(OBJ_PROP_PARAMS)
+FX_BOOL Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        if (vp.IsSetting())
        {
@@ -1327,7 +1327,7 @@ FX_BOOL Field::delay(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::display(OBJ_PROP_PARAMS)
+FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1498,28 +1498,24 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel
        }
 }
 
-FX_BOOL Field::doc(OBJ_PROP_PARAMS)
+FX_BOOL Field::doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
-       ASSERT(m_pJSDoc != NULL);
-
-       if (!vp.IsGetting())return FALSE;
-
-       vp << (CJS_Object*)(*m_pJSDoc);
-
+       if (!vp.IsGetting()) {
+               return FALSE;
+       }
+       vp << m_pJSDoc->GetCJSDoc();
        return TRUE;
 }
 
-FX_BOOL Field::editable(OBJ_PROP_PARAMS)
+FX_BOOL Field::editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
-
        if (vp.IsSetting())
        {
                if (!m_bCanSet) return FALSE;
 
                bool bVP;
                vp >> bVP;
-
        }
        else
        {
@@ -1542,7 +1538,7 @@ FX_BOOL Field::editable(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::exportValues(OBJ_PROP_PARAMS)
+FX_BOOL Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1573,7 +1569,7 @@ FX_BOOL Field::exportValues(OBJ_PROP_PARAMS)
                                CPDF_FormControl* pFormControl = pFormField->GetControl(i);
                                ASSERT(pFormControl != NULL);
 
-                               ExportValusArray.SetElement(i, CJS_Value(m_isolate,(FX_LPCWSTR)pFormControl->GetExportValue()));
+                               ExportValusArray.SetElement(i, CJS_Value(m_isolate,pFormControl->GetExportValue().c_str()));
                        }
                }
                else
@@ -1582,7 +1578,7 @@ FX_BOOL Field::exportValues(OBJ_PROP_PARAMS)
                        CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormControlIndex);
                        if (!pFormControl) return FALSE;
 
-                       ExportValusArray.SetElement(0, CJS_Value(m_isolate,(FX_LPCWSTR)pFormControl->GetExportValue()));
+                       ExportValusArray.SetElement(0, CJS_Value(m_isolate,pFormControl->GetExportValue().c_str()));
                }
 
                vp << ExportValusArray;
@@ -1591,7 +1587,7 @@ FX_BOOL Field::exportValues(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::fileSelect(OBJ_PROP_PARAMS)
+FX_BOOL Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1624,7 +1620,7 @@ FX_BOOL Field::fileSelect(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::fillColor(OBJ_PROP_PARAMS)
+FX_BOOL Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1702,7 +1698,7 @@ void Field::SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::hidden(OBJ_PROP_PARAMS)
+FX_BOOL Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1833,7 +1829,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField
        }
 }
 
-FX_BOOL Field::highlight(OBJ_PROP_PARAMS)
+FX_BOOL Field::highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1872,19 +1868,19 @@ FX_BOOL Field::highlight(OBJ_PROP_PARAMS)
                switch (eHM)
                {
                case CPDF_FormControl::None:
-                       vp  <<  (FX_LPCWSTR)L"none";
+                       vp  <<  L"none";
                        break;
                case CPDF_FormControl::Push:
-                       vp  <<  (FX_LPCWSTR)L"push";
+                       vp  <<  L"push";
                        break;
                case CPDF_FormControl::Invert:
-                       vp  <<  (FX_LPCWSTR)L"invert";
+                       vp  <<  L"invert";
                        break;
                case CPDF_FormControl::Outline:
-                       vp  <<  (FX_LPCWSTR)L"outline";
+                       vp  <<  L"outline";
                        break;
                case CPDF_FormControl::Toggle:
-                        vp  <<  (FX_LPCWSTR)L"toggle";
+                        vp  <<  L"toggle";
                         break;
                }
        }
@@ -1897,7 +1893,7 @@ void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::lineWidth(OBJ_PROP_PARAMS)
+FX_BOOL Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -1995,7 +1991,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        }
 }
 
-FX_BOOL Field::multiline(OBJ_PROP_PARAMS)
+FX_BOOL Field::multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2041,7 +2037,7 @@ void Field::SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::multipleSelection(OBJ_PROP_PARAMS)
+FX_BOOL Field::multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2087,7 +2083,7 @@ void Field::SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideStri
        //Not supported.
 }
 
-FX_BOOL Field::name(OBJ_PROP_PARAMS)
+FX_BOOL Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        if (!vp.IsGetting()) return FALSE;
 
@@ -2100,7 +2096,7 @@ FX_BOOL Field::name(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::numItems(OBJ_PROP_PARAMS)
+FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {      
        CFX_PtrArray FieldArray;
        GetFormFields(m_FieldName, FieldArray);
@@ -2120,7 +2116,7 @@ FX_BOOL Field::numItems(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::page(OBJ_PROP_PARAMS)
+FX_BOOL Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        if (!vp.IsGetting()) return FALSE;
 
@@ -2165,7 +2161,7 @@ FX_BOOL Field::page(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::password(OBJ_PROP_PARAMS)
+FX_BOOL Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2211,7 +2207,7 @@ void Field::SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::print(OBJ_PROP_PARAMS)
+FX_BOOL Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2298,7 +2294,7 @@ FX_BOOL Field::print(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::radiosInUnison(OBJ_PROP_PARAMS)
+FX_BOOL Field::radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2331,7 +2327,7 @@ FX_BOOL Field::radiosInUnison(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::readonly(OBJ_PROP_PARAMS)
+FX_BOOL Field::readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2361,7 +2357,7 @@ FX_BOOL Field::readonly(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::rect(OBJ_PROP_PARAMS)
+FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2516,7 +2512,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
        }
 }
 
-FX_BOOL Field::required(OBJ_PROP_PARAMS)
+FX_BOOL Field::required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2550,7 +2546,7 @@ FX_BOOL Field::required(OBJ_PROP_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::richText(OBJ_PROP_PARAMS)
+FX_BOOL Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2596,7 +2592,7 @@ void Field::SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::richValue(OBJ_PROP_PARAMS)
+FX_BOOL Field::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        return TRUE;
        if (vp.IsSetting())
@@ -2616,7 +2612,7 @@ void Field::SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::rotation(OBJ_PROP_PARAMS)
+FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2659,7 +2655,7 @@ void Field::SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::strokeColor(OBJ_PROP_PARAMS)
+FX_BOOL Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2738,7 +2734,7 @@ void Field::SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& sw
        //Not supported.
 }
 
-FX_BOOL Field::style(OBJ_PROP_PARAMS)
+FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2810,12 +2806,12 @@ void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
        //Not supported.
 }
 
-FX_BOOL Field::submitName(OBJ_PROP_PARAMS)
+FX_BOOL Field::submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        return TRUE;
 }
 
-FX_BOOL Field::textColor(OBJ_PROP_PARAMS)
+FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2878,7 +2874,7 @@ void Field::SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
        //Not supported.
 }
 
-FX_BOOL Field::textFont(OBJ_PROP_PARAMS)
+FX_BOOL Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2935,7 +2931,7 @@ void Field::SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::textSize(OBJ_PROP_PARAMS)
+FX_BOOL Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -2984,7 +2980,7 @@ void Field::SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::type(OBJ_PROP_PARAMS)
+FX_BOOL Field::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3000,38 +2996,38 @@ FX_BOOL Field::type(OBJ_PROP_PARAMS)
        switch (pFormField->GetFieldType())
        {
                case FIELDTYPE_UNKNOWN:
-                       vp << (FX_LPCWSTR)L"unknown";
+                       vp << L"unknown";
                        break;
                case FIELDTYPE_PUSHBUTTON:
-                       vp << (FX_LPCWSTR)L"button";
+                       vp << L"button";
                        break;
                case FIELDTYPE_CHECKBOX:
-                       vp << (FX_LPCWSTR)L"checkbox";
+                       vp << L"checkbox";
                        break;
                case FIELDTYPE_RADIOBUTTON:
-                       vp << (FX_LPCWSTR)L"radiobutton";
+                       vp << L"radiobutton";
                        break;
                case FIELDTYPE_COMBOBOX:
-                       vp << (FX_LPCWSTR)L"combobox";
+                       vp << L"combobox";
                        break;
                case FIELDTYPE_LISTBOX:
-                       vp << (FX_LPCWSTR)L"listbox";
+                       vp << L"listbox";
                        break;
                case FIELDTYPE_TEXTFIELD:
-                       vp << (FX_LPCWSTR)L"text";
+                       vp << L"text";
                        break;
                case FIELDTYPE_SIGNATURE:
-                       vp << (FX_LPCWSTR)L"signature";
+                       vp << L"signature";
                        break;
                default :
-                       vp << (FX_LPCWSTR)L"unknown";
+                       vp << L"unknown";
                        break;
        }
 
        return TRUE;
 }
 
-FX_BOOL Field::userName(OBJ_PROP_PARAMS)
+FX_BOOL Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3071,7 +3067,7 @@ void Field::SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
        //Not supported.
 }
 
-FX_BOOL Field::value(OBJ_PROP_PARAMS)
+FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3206,7 +3202,7 @@ FX_BOOL Field::value(OBJ_PROP_PARAMS)
                                                continue;
                                }
                                if (!bFind)
-                                       vp << (FX_LPCWSTR)L"Off";                                       
+                                       vp << L"Off";                                   
                        }
                        break;
                default:
@@ -3291,7 +3287,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
        }
 }
 
-FX_BOOL Field::valueAsString(OBJ_PROP_PARAMS)
+FX_BOOL Field::valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3312,9 +3308,9 @@ FX_BOOL Field::valueAsString(OBJ_PROP_PARAMS)
                if(!pFormField->CountControls()) return FALSE;
 
                if (pFormField->GetControl(0)->IsChecked())
-                       vp << (FX_LPCWSTR)L"Yes";
+                       vp << L"Yes";
                else
-                       vp << (FX_LPCWSTR)L"Off";
+                       vp << L"Off";
        }
        else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON))
        {
@@ -3322,26 +3318,26 @@ FX_BOOL Field::valueAsString(OBJ_PROP_PARAMS)
                {
                        if (pFormField->GetControl(i)->IsChecked())
                        {
-                               vp << (FX_LPCWSTR)pFormField->GetControl(i)->GetExportValue();
+                               vp << pFormField->GetControl(i)->GetExportValue().c_str();
                                break;
                        }
                        else
-                               vp << (FX_LPCWSTR)L"Off";
+                               vp << L"Off";
                }
        }
        else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField->CountSelectedItems() > 1))
        {
-               vp << (FX_LPCWSTR)L"";
+               vp << L"";
        }
        else
-               vp << (FX_LPCWSTR)pFormField->GetValue();
+               vp << pFormField->GetValue().c_str();
 
        return TRUE;
 }
 
 /* --------------------------------- methods --------------------------------- */
 
-FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS)
+FX_BOOL Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3372,7 +3368,7 @@ FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS)
 }
 
 
-FX_BOOL Field::buttonGetCaption(OBJ_METHOD_PARAMS)
+FX_BOOL Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3408,7 +3404,7 @@ FX_BOOL Field::buttonGetCaption(OBJ_METHOD_PARAMS)
 
 //#pragma warning(disable: 4800)
 
-FX_BOOL Field::buttonGetIcon(OBJ_METHOD_PARAMS)
+FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3463,7 +3459,7 @@ FX_BOOL Field::buttonGetIcon(OBJ_METHOD_PARAMS)
 
 //#pragma warning(default: 4800)
 
-FX_BOOL Field::buttonImportIcon(OBJ_METHOD_PARAMS)
+FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
 #if 0  
        ASSERT(m_pDocument != NULL);
@@ -3506,17 +3502,17 @@ FX_BOOL Field::buttonImportIcon(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::buttonSetCaption(OBJ_METHOD_PARAMS)
+FX_BOOL Field::buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::buttonSetIcon(OBJ_METHOD_PARAMS)
+FX_BOOL Field::buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::checkThisBox(OBJ_METHOD_PARAMS)
+FX_BOOL Field::checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3554,12 +3550,12 @@ FX_BOOL Field::checkThisBox(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::clearItems(OBJ_METHOD_PARAMS)
+FX_BOOL Field::clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return TRUE;
 }
 
-FX_BOOL Field::defaultIsChecked(OBJ_METHOD_PARAMS)
+FX_BOOL Field::defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3599,7 +3595,7 @@ FX_BOOL Field::defaultIsChecked(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::deleteItemAt(OBJ_METHOD_PARAMS)
+FX_BOOL Field::deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return TRUE;
 }
@@ -3613,7 +3609,7 @@ int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2)
 }
 
 
-FX_BOOL Field::getArray(OBJ_METHOD_PARAMS)
+FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3666,7 +3662,7 @@ FX_BOOL Field::getArray(OBJ_METHOD_PARAMS)
        return TRUE;
 }
        
-FX_BOOL Field::getItemAt(OBJ_METHOD_PARAMS)
+FX_BOOL Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3709,17 +3705,17 @@ FX_BOOL Field::getItemAt(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::getLock(OBJ_METHOD_PARAMS)
+FX_BOOL Field::getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::insertItemAt(OBJ_METHOD_PARAMS)
+FX_BOOL Field::insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return TRUE;
 }
 
-FX_BOOL Field::isBoxChecked(OBJ_METHOD_PARAMS)
+FX_BOOL Field::isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3754,7 +3750,7 @@ FX_BOOL Field::isBoxChecked(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::isDefaultChecked(OBJ_METHOD_PARAMS)
+FX_BOOL Field::isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3788,12 +3784,12 @@ FX_BOOL Field::isDefaultChecked(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::setAction(OBJ_METHOD_PARAMS)
+FX_BOOL Field::setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return TRUE;
 }
 
-FX_BOOL Field::setFocus(OBJ_METHOD_PARAMS)
+FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        ASSERT(m_pDocument != NULL);
 
@@ -3847,47 +3843,47 @@ FX_BOOL Field::setFocus(OBJ_METHOD_PARAMS)
        return TRUE;
 }
 
-FX_BOOL Field::setItems(OBJ_METHOD_PARAMS)
+FX_BOOL Field::setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return TRUE;
 }
 
-FX_BOOL Field::setLock(OBJ_METHOD_PARAMS)
+FX_BOOL Field::setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureGetModifications(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureGetSeedValue(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureInfo(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureSetSeedValue(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureSign(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::signatureValidate(OBJ_METHOD_PARAMS)
+FX_BOOL Field::signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
 {
        return FALSE;
 }
 
-FX_BOOL Field::source(OBJ_PROP_PARAMS)
+FX_BOOL Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
 {
        if (vp.IsGetting())
        {