summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/Field.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/Field.cpp')
-rw-r--r--fpdfsdk/src/javascript/Field.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 7476fa5728..e5572da3e6 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -11,6 +11,7 @@
#include "../../include/javascript/JS_Value.h"
#include "../../include/javascript/Field.h"
#include "../../include/javascript/JS_EventHandler.h"
+//#include "../include/JS_ResMgr.h"
#include "../../include/javascript/JS_Context.h"
#include "../../include/javascript/JS_Runtime.h"
#include "../../include/javascript/Document.h"
@@ -258,7 +259,7 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi
FX_BOOL bFormated = FALSE;
CFX_WideString sValue = pWidget->OnFormat(0, bFormated);
if (bFormated)
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
+ pWidget->ResetAppearance(sValue, FALSE);
else
pWidget->ResetAppearance(NULL, FALSE);
}
@@ -315,7 +316,7 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo
FX_BOOL bFormated = FALSE;
CFX_WideString sValue = pWidget->OnFormat(0, bFormated);
if (bFormated)
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
+ pWidget->ResetAppearance(sValue, FALSE);
else
pWidget->ResetAppearance(NULL, FALSE);
}
@@ -3126,7 +3127,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
double dRet;
FX_BOOL bDot;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, bDot))
+ if (CJS_PublicMethods::ConvertStringToNumber(swValue,dRet,bDot))
{
if (bDot)
vp << dRet;
@@ -3147,9 +3148,9 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++)
{
iIndex = pFormField->GetSelectedIndex(i);
- ElementValue = pFormField->GetOptionValue(iIndex).c_str();
+ ElementValue = pFormField->GetOptionValue(iIndex);
if (FXSYS_wcslen(ElementValue.ToCFXWideString().c_str()) == 0)
- ElementValue = pFormField->GetOptionLabel(iIndex).c_str();
+ ElementValue = pFormField->GetOptionLabel(iIndex);
ValueArray.SetElement(i, ElementValue);
}
vp << ValueArray;
@@ -3160,7 +3161,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
double dRet;
FX_BOOL bDot;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, bDot))
+ if (CJS_PublicMethods::ConvertStringToNumber(swValue,dRet,bDot))
{
if (bDot)
vp << dRet;
@@ -3181,9 +3182,10 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
if (pFormField->GetControl(i)->IsChecked())
{
CFX_WideString swValue = pFormField->GetControl(i)->GetExportValue();
+
double dRet;
FX_BOOL bDot;
- if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, bDot))
+ if (CJS_PublicMethods::ConvertStringToNumber(swValue,dRet,bDot))
{
if (bDot)
vp << dRet;
@@ -3389,11 +3391,11 @@ FX_BOOL Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params,
if (!pFormControl)return FALSE;
if (nface == 0)
- vRet = pFormControl->GetNormalCaption().c_str();
+ vRet = pFormControl->GetNormalCaption();
else if (nface == 1)
- vRet = pFormControl->GetDownCaption().c_str();
+ vRet = pFormControl->GetDownCaption();
else if (nface == 2)
- vRet = pFormControl->GetRolloverCaption().c_str();
+ vRet = pFormControl->GetRolloverCaption();
else
return FALSE;
@@ -3683,12 +3685,12 @@ FX_BOOL Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
{
CFX_WideString strval = pFormField->GetOptionValue(nIdx);
if (strval.IsEmpty())
- vRet = pFormField->GetOptionLabel(nIdx).c_str();
+ vRet = pFormField->GetOptionLabel(nIdx);
else
- vRet = strval.c_str();
+ vRet = strval;
}
else
- vRet = pFormField->GetOptionLabel(nIdx).c_str();
+ vRet = pFormField->GetOptionLabel(nIdx);
}
else
return FALSE;