diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-01 15:38:39 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-01 15:38:39 -0800 |
commit | 1654972e0c81f1841653f803903cc48b93f1738e (patch) | |
tree | 4e2cd623b0a1bc50dbc30556edcede984dfb3a56 /fpdfsdk/include/fsdk_mgr.h | |
parent | a620372c9e1d0ff825bcbe6620fe7e1b63c769c2 (diff) | |
download | pdfium-1654972e0c81f1841653f803903cc48b93f1738e.tar.xz |
Tidy up CPDF_DocEnvironment::JS_* methods
Remove code from header.
Put related declarations together.
Add convenience function for widestrings.
Avoid pointless releases.
Use early returns in all cases for consistency.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1658853002 .
Diffstat (limited to 'fpdfsdk/include/fsdk_mgr.h')
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 87 |
1 files changed, 37 insertions, 50 deletions
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 323b07a46d..130abc8436 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -31,6 +31,10 @@ class CPDFSDK_PageView; class CPDFSDK_Widget; class IFX_SystemHandler; +// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken +// since modifying the result would impact |bsUTF16LE|. +FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE); + class CPDFDoc_Environment final { public: CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); @@ -105,56 +109,6 @@ class CPDFDoc_Environment final { FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) const { return FALSE; } - int JS_appAlert(const FX_WCHAR* Msg, - const FX_WCHAR* Title, - FX_UINT Type, - FX_UINT Icon); - int JS_appResponse(const FX_WCHAR* Question, - const FX_WCHAR* Title, - const FX_WCHAR* Default, - const FX_WCHAR* cLabel, - FPDF_BOOL bPassword, - void* response, - int length); - - void JS_appBeep(int nType) { - if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep) - m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); - } - - CFX_WideString JS_fieldBrowse(); - CFX_WideString JS_docGetFilePath(); - - void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); - void JS_docmailForm(void* mailData, - int length, - FPDF_BOOL bUI, - const FX_WCHAR* To, - const FX_WCHAR* Subject, - const FX_WCHAR* CC, - const FX_WCHAR* BCC, - const FX_WCHAR* Msg); - - void JS_docprint(FPDF_BOOL bUI, - int nStart, - int nEnd, - FPDF_BOOL bSilent, - FPDF_BOOL bShrinkToFit, - FPDF_BOOL bPrintAsImage, - FPDF_BOOL bReverse, - FPDF_BOOL bAnnotations) { - if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print) - m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, - nEnd, bSilent, bShrinkToFit, - bPrintAsImage, bReverse, bAnnotations); - } - - void JS_docgotoPage(int nPageNum) { - if (m_pInfo && m_pInfo->m_pJsPlatform && - m_pInfo->m_pJsPlatform->Doc_gotoPage) - m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum); - } - FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) { if (m_pInfo && m_pInfo->FFI_GetPage) return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); @@ -200,6 +154,39 @@ class CPDFDoc_Environment final { sizeOfArray); } + int JS_appAlert(const FX_WCHAR* Msg, + const FX_WCHAR* Title, + FX_UINT Type, + FX_UINT Icon); + int JS_appResponse(const FX_WCHAR* Question, + const FX_WCHAR* Title, + const FX_WCHAR* Default, + const FX_WCHAR* cLabel, + FPDF_BOOL bPassword, + void* response, + int length); + void JS_appBeep(int nType); + CFX_WideString JS_fieldBrowse(); + CFX_WideString JS_docGetFilePath(); + void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); + void JS_docmailForm(void* mailData, + int length, + FPDF_BOOL bUI, + const FX_WCHAR* To, + const FX_WCHAR* Subject, + const FX_WCHAR* CC, + const FX_WCHAR* BCC, + const FX_WCHAR* Msg); + void JS_docprint(FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations); + void JS_docgotoPage(int nPageNum); + FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } |