diff options
-rw-r--r-- | fpdfsdk/cpdfsdk_formfillenvironment.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_formfillenvironment.h | 6 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 14 |
3 files changed, 17 insertions, 21 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index b9dbfe7785..4338f984e0 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -334,17 +334,15 @@ void CPDFSDK_FormFillEnvironment::DisplayCaret(CPDFXFA_Page* page, } } -int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex( - CPDFXFA_Context* document) { +int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex() const { if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) return -1; - return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document); + return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, m_pUnderlyingDoc.Get()); } -void CPDFSDK_FormFillEnvironment::SetCurrentPage(CPDFXFA_Context* document, - int iCurPage) { +void CPDFSDK_FormFillEnvironment::SetCurrentPage(int iCurPage) { if (m_pInfo && m_pInfo->FFI_SetCurrentPage) - m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); + m_pInfo->FFI_SetCurrentPage(m_pInfo, m_pUnderlyingDoc.Get(), iCurPage); } WideString CPDFSDK_FormFillEnvironment::GetPlatform() { @@ -365,13 +363,13 @@ WideString CPDFSDK_FormFillEnvironment::GetPlatform() { nActualLen / sizeof(uint16_t)); } -void CPDFSDK_FormFillEnvironment::GotoURL(CPDFXFA_Context* document, - const WideStringView& wsURL) { +void CPDFSDK_FormFillEnvironment::GotoURL(const WideString& wsURL) { if (!m_pInfo || !m_pInfo->FFI_GotoURL) return; - ByteString bsTo = WideString(wsURL).UTF16LE_Encode(); - m_pInfo->FFI_GotoURL(m_pInfo, document, AsFPDFWideString(&bsTo)); + ByteString bsTo = wsURL.UTF16LE_Encode(); + m_pInfo->FFI_GotoURL(m_pInfo, m_pUnderlyingDoc.Get(), + AsFPDFWideString(&bsTo)); } void CPDFSDK_FormFillEnvironment::GetPageViewRect(CPDFXFA_Page* page, diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index 697f51e79f..aba3f39c69 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -130,14 +130,14 @@ class CPDFSDK_FormFillEnvironment double top, double right, double bottom); - int GetCurrentPageIndex(CPDFXFA_Context* document); - void SetCurrentPage(CPDFXFA_Context* document, int iCurPage); + int GetCurrentPageIndex() const; + void SetCurrentPage(int iCurPage); // TODO(dsinclair): This should probably change to PDFium? WideString FFI_GetAppName() const { return WideString(L"Acrobat"); } WideString GetPlatform(); - void GotoURL(CPDFXFA_Context* document, const WideStringView& wsURL); + void GotoURL(const WideString& wsURL); void GetPageViewRect(CPDFXFA_Page* page, FS_RECTF& dstRect); bool PopupMenu(CPDFXFA_Page* page, FPDF_WIDGET hWidget, diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 4bf6064a34..984fff715c 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -351,14 +351,12 @@ int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) return -1; + if (m_pContext->GetFormType() != FormType::kXFAFull) return -1; CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); - if (!pFormFillEnv) - return -1; - - return pFormFillEnv->GetCurrentPageIndex(m_pContext.Get()); + return pFormFillEnv ? pFormFillEnv->GetCurrentPageIndex() : -1; } void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, @@ -372,7 +370,8 @@ void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); if (!pFormFillEnv) return; - pFormFillEnv->SetCurrentPage(m_pContext.Get(), iCurPage); + + pFormFillEnv->SetCurrentPage(iCurPage); } bool CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { @@ -517,7 +516,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, } void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, - const WideString& bsURL) { + const WideString& wsURL) { if (hDoc != m_pContext->GetXFADoc()) return; @@ -528,8 +527,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, if (!pFormFillEnv) return; - WideStringView str(bsURL.c_str()); - pFormFillEnv->GotoURL(m_pContext.Get(), str); + pFormFillEnv->GotoURL(wsURL); } bool CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |