diff options
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_app.cpp | 60 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 21 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/include/fpdfxfa_app.h | 31 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftext.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 28 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/include/fxfa.h | 49 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 14 |
12 files changed, 117 insertions, 128 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp index f9c3ca65a3..e91bdf1699 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp @@ -131,8 +131,8 @@ void CPDFXFA_App::Beep(uint32_t dwType) { } } -int32_t CPDFXFA_App::MsgBox(const CFX_WideStringC& wsMessage, - const CFX_WideStringC& wsTitle, +int32_t CPDFXFA_App::MsgBox(const CFX_WideString& wsMessage, + const CFX_WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); @@ -184,11 +184,11 @@ int32_t CPDFXFA_App::MsgBox(const CFX_WideStringC& wsMessage, return XFA_IDYes; } -void CPDFXFA_App::Response(CFX_WideString& wsAnswer, - const CFX_WideStringC& wsQuestion, - const CFX_WideStringC& wsTitle, - const CFX_WideStringC& wsDefaultAnswer, - FX_BOOL bMark) { +CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, + const CFX_WideString& wsTitle, + const CFX_WideString& wsDefaultAnswer, + FX_BOOL bMark) { + CFX_WideString wsAnswer; CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { int nLength = 2048; @@ -206,6 +206,7 @@ void CPDFXFA_App::Response(CFX_WideString& wsAnswer, } delete[] pBuff; } + return wsAnswer; } int32_t CPDFXFA_App::GetCurDocumentInBatch() { @@ -225,39 +226,34 @@ int32_t CPDFXFA_App::GetDocumentCountInBatch() { return 0; } -IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideStringC& wsURL) { +IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - return pEnv->FFI_DownloadFromURL(wsURL.c_str()); - } - return NULL; + return pEnv ? pEnv->FFI_DownloadFromURL(wsURL.c_str()) : nullptr; } -FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsContentType, - const CFX_WideStringC& wsEncode, - const CFX_WideStringC& wsHeader, +FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsContentType, + const CFX_WideString& wsEncode, + const CFX_WideString& wsHeader, CFX_WideString& wsResponse) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - wsResponse = pEnv->FFI_PostRequestURL(wsURL.c_str(), wsData.c_str(), - wsContentType.c_str(), - wsEncode.c_str(), wsHeader.c_str()); - return TRUE; - } - return FALSE; + if (!pEnv) + return FALSE; + + wsResponse = pEnv->FFI_PostRequestURL(wsURL.c_str(), wsData.c_str(), + wsContentType.c_str(), wsEncode.c_str(), + wsHeader.c_str()); + return TRUE; } -FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsEncode) { +FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsEncode) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); - if (pEnv) { - return pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), - wsEncode.c_str()); - } - return FALSE; + return pEnv && + pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), + wsEncode.c_str()); } void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index deba943072..b2f752e8b9 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -625,21 +625,22 @@ void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc, } void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFilePath, + const CFX_WideString& wsFilePath, FX_BOOL bXDP) { if (hDoc != m_pXFADoc) return; + if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) return; + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - if (pEnv == NULL) + if (!pEnv) return; - int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; - CFX_ByteString bs = CFX_WideString(wsFilePath).UTF16LE_Encode(); + int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; + CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); if (wsFilePath.IsEmpty()) { - if (!pEnv->GetFormFillInfo() || - pEnv->GetFormFillInfo()->m_pJsPlatform == NULL) + if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) return; CFX_WideString filepath = pEnv->JS_fieldBrowse(); bs = filepath.UTF16LE_Encode(); @@ -649,12 +650,10 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "wb"); bs.ReleaseBuffer(len * sizeof(unsigned short)); - - if (pFileHandler == NULL) + if (!pFileHandler) return; CFPDF_FileStream fileWrite(pFileHandler); - CFX_ByteString content; if (fileType == FXFA_SAVEAS_XML) { content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; @@ -725,10 +724,10 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, } } void CPDFXFA_Document::ImportData(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFilePath) {} + const CFX_WideString& wsFilePath) {} void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, - const CFX_WideStringC& bsURL, + const CFX_WideString& bsURL, FX_BOOL bAppend) { if (hDoc != m_pXFADoc) return; diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h index 6491781cbe..3a61ef40c3 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h @@ -51,29 +51,28 @@ class CPDFXFA_App : public IXFA_AppProvider { } void Beep(uint32_t dwType) override; - int32_t MsgBox(const CFX_WideStringC& wsMessage, - const CFX_WideStringC& wsTitle, + int32_t MsgBox(const CFX_WideString& wsMessage, + const CFX_WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) override; - void Response(CFX_WideString& wsAnswer, - const CFX_WideStringC& wsQuestion, - const CFX_WideStringC& wsTitle, - const CFX_WideStringC& wsDefaultAnswer, - FX_BOOL bMark) override; + CFX_WideString Response(const CFX_WideString& wsQuestion, + const CFX_WideString& wsTitle, + const CFX_WideString& wsDefaultAnswer, + FX_BOOL bMark) override; int32_t GetDocumentCountInBatch() override; int32_t GetCurDocumentInBatch() override; - IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) override; - FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsContentType, - const CFX_WideStringC& wsEncode, - const CFX_WideStringC& wsHeader, + IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; + FX_BOOL PostRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsContentType, + const CFX_WideString& wsEncode, + const CFX_WideString& wsHeader, CFX_WideString& wsResponse) override; - FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsEncode) override; + FX_BOOL PutRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsEncode) override; void LoadString(int32_t iStringID, CFX_WideString& wsString) override; IFWL_AdapterTimerMgr* GetTimerMgr() override; diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h index a67b7803a0..416e4b9de3 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h @@ -92,11 +92,11 @@ class CPDFXFA_Document : public IXFA_DocProvider { virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle); virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle); virtual void ExportData(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFilePath, + const CFX_WideString& wsFilePath, FX_BOOL bXDP = TRUE); - virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath); + virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath); virtual void GotoURL(CXFA_FFDoc* hDoc, - const CFX_WideStringC& bsURL, + const CFX_WideString& bsURL, FX_BOOL bAppend = TRUE); virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc); virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled); diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index cd48a43a0e..4a610495dd 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -162,8 +162,7 @@ void CXFA_FFDocView::ShowNullTestMsg() { } CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); - pAppProvider->MsgBox(wsMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); } m_arrNullTestMsg.RemoveAll(); } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index cb65a0b9a9..7cf0c6e3fc 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -725,8 +725,8 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, XFA_MB_OK); + pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, + XFA_MB_OK); } } return 0; @@ -757,8 +757,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - if (pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); return 1; diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index c5e1cba2a8..1000b91c08 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -136,7 +136,7 @@ FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } CXFA_FFDoc* pDoc = GetDoc(); - pDoc->GetDocProvider()->GotoURL(pDoc, CFX_WideStringC(wsURLContent), FALSE); + pDoc->GetDocProvider()->GotoURL(pDoc, wsURLContent, FALSE); return TRUE; } FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index f5605c9775..ea641f2066 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -194,14 +194,13 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { if (pAppProvider) { CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); - CFX_WideString wsMessage; CFX_WideString wsError; pAppProvider->LoadString(XFA_IDS_ValidateNumberError, wsError); CFX_WideString wsSomField; pAcc->GetNode()->GetSOMExpression(wsSomField); + CFX_WideString wsMessage; wsMessage.Format(wsError.c_str(), wsText.c_str(), wsSomField.c_str()); - pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Error, XFA_MB_OK); } } } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 11081fd5d7..64ac9b2d60 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -389,12 +389,11 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, XFA_MB_OK); + pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, + XFA_MB_OK); return; } - if (pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); } @@ -402,8 +401,7 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, if (wsScriptMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); } } } @@ -436,8 +434,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, if (wsFormatMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); return XFA_EVENTERROR_Success; } if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { @@ -447,12 +444,12 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, XFA_MB_OK); + pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + XFA_MB_OK); return XFA_EVENTERROR_Success; } - if (pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { + if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); } return XFA_EVENTERROR_Success; @@ -507,8 +504,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); } - pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); return XFA_EVENTERROR_Error; } case XFA_ATTRIBUTEENUM_Warning: { @@ -522,8 +518,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), wsCaptionName.c_str()); } - if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), - XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { + if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, + XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); } return XFA_EVENTERROR_Error; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 484191f1be..e47d0af390 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -5440,7 +5440,7 @@ void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis, CFX_ByteString urlString; HValueToUTF8String(argOne, urlString); IFX_FileRead* pFile = pAppProvider->DownloadURL( - CFX_WideString::FromUTF8(urlString.AsStringC()).AsStringC()); + CFX_WideString::FromUTF8(urlString.AsStringC())); if (pFile) { int32_t size = pFile->GetSize(); uint8_t* pData = FX_Alloc(uint8_t, size); @@ -5500,12 +5500,11 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, } CFX_WideString decodedResponse; FX_BOOL bFlags = pAppProvider->PostRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsContentType.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsHeader.AsStringC()).AsStringC(), - decodedResponse); + CFX_WideString::FromUTF8(bsURL.AsStringC()), + CFX_WideString::FromUTF8(bsData.AsStringC()), + CFX_WideString::FromUTF8(bsContentType.AsStringC()), + CFX_WideString::FromUTF8(bsEncode.AsStringC()), + CFX_WideString::FromUTF8(bsHeader.AsStringC()), decodedResponse); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); if (argc > 2) { @@ -5561,9 +5560,9 @@ void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, HValueToUTF8String(argThree, bsEncode); } FX_BOOL bFlags = pAppProvider->PutRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), - CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC()); + CFX_WideString::FromUTF8(bsURL.AsStringC()), + CFX_WideString::FromUTF8(bsData.AsStringC()), + CFX_WideString::FromUTF8(bsEncode.AsStringC())); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); if (argc > 2) { diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index a7d1a282ba..871ab71164 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -311,25 +311,30 @@ class IXFA_AppProvider { /** * Displays a message box. - * @param[in] dwIconType Icon type, refer to XFA_MBICON. - * @param[in] dwButtonType Button type, refer to XFA_MESSAGEBUTTON. + * @param[in] wsMessage - Message string to display in box. + * @param[in] wsTitle - Title string for box. + * @param[in] dwIconType - Icon type, refer to XFA_MBICON. + * @param[in] dwButtonType - Button type, refer to XFA_MESSAGEBUTTON. * @return A valid integer representing the value of the button pressed by the * user, refer to XFA_ID. */ - virtual int32_t MsgBox(const CFX_WideStringC& wsMessage, - const CFX_WideStringC& wsTitle = FX_WSTRC(L""), + virtual int32_t MsgBox(const CFX_WideString& wsMessage, + const CFX_WideString& wsTitle = L"", uint32_t dwIconType = 0, uint32_t dwButtonType = 0) = 0; /** * Get a response from the user. - * @param[in] bMark - Mask the user input with * (asterisks) when true, + * @param[in] wsQuestion - Message string to display in box. + * @param[in] wsTitle - Title string for box. + * @param[in] wsDefaultAnswer - Initial contents for answer. + * @param[in] bMask - Mask the user input with asterisks when true, + * @return A string containing the user's response. */ - virtual void Response(CFX_WideString& wsAnswer, - const CFX_WideStringC& wsQuestion, - const CFX_WideStringC& wsTitle = FX_WSTRC(L""), - const CFX_WideStringC& wsDefaultAnswer = FX_WSTRC(L""), - FX_BOOL bMark = TRUE) = 0; + virtual CFX_WideString Response(const CFX_WideString& wsQuestion, + const CFX_WideString& wsTitle = L"", + const CFX_WideString& wsDefaultAnswer = L"", + FX_BOOL bMask = TRUE) = 0; virtual int32_t GetDocumentCountInBatch() = 0; virtual int32_t GetCurDocumentInBatch() = 0; @@ -339,7 +344,7 @@ class IXFA_AppProvider { * @param[in] wsURL - http, ftp, such as * "http://www.w3.org/TR/REC-xml-names/". */ - virtual IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) = 0; + virtual IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) = 0; /** * POST data to the given url. @@ -356,11 +361,11 @@ class IXFA_AppProvider { * @param[out] wsResponse decoded response from server. * @return TRUE Server permitted the post request, FALSE otherwise. */ - virtual FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsContentType, - const CFX_WideStringC& wsEncode, - const CFX_WideStringC& wsHeader, + virtual FX_BOOL PostRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsContentType, + const CFX_WideString& wsEncode, + const CFX_WideString& wsHeader, CFX_WideString& wsResponse) = 0; /** @@ -371,9 +376,9 @@ class IXFA_AppProvider { * ISO8859-1, any recognized [IANA]character encoding * @return TRUE Server permitted the post request, FALSE otherwise. */ - virtual FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL, - const CFX_WideStringC& wsData, - const CFX_WideStringC& wsEncode) = 0; + virtual FX_BOOL PutRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsEncode) = 0; virtual void LoadString(int32_t iStringID, CFX_WideString& wsString) = 0; virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; @@ -416,12 +421,12 @@ class IXFA_DocProvider { virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0; virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) = 0; virtual void ExportData(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFilePath, + const CFX_WideString& wsFilePath, FX_BOOL bXDP = TRUE) = 0; virtual void ImportData(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFilePath) = 0; + const CFX_WideString& wsFilePath) = 0; virtual void GotoURL(CXFA_FFDoc* hDoc, - const CFX_WideStringC& bsURL, + const CFX_WideString& bsURL, FX_BOOL bAppend = TRUE) = 0; virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0; virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0; diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index e6de66d803..94fa8db96c 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -290,7 +290,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); } - pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsStringC()); + pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); } void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( CFXJSE_Arguments* pArguments) { @@ -381,10 +381,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( if (iLength >= 4) { bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } - CFX_WideString wsAnswer; - pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsStringC(), - wsTitle.AsStringC(), - wsDefaultAnswer.AsStringC(), bMark); + CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( + wsQuestion, wsTitle, wsDefaultAnswer, bMark); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsStringC()); @@ -598,7 +596,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( } } int32_t iValue = pNotify->GetAppProvider()->MsgBox( - wsMessage.AsStringC(), bsTitle.AsStringC(), dwMessageType, dwButtonType); + wsMessage, bsTitle, dwMessageType, dwButtonType); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); @@ -730,7 +728,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsStringC()); + pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( CFXJSE_Arguments* pArguments) { @@ -753,7 +751,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsStringC(), bXDP); + pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { |