summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfformfill.cpp76
-rw-r--r--fpdfsdk/fpdfsave.cpp12
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp108
-rw-r--r--fpdfsdk/fsdk_annothandler.cpp12
-rw-r--r--fpdfsdk/fsdk_baseform.cpp292
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h10
6 files changed, 210 insertions, 300 deletions
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index ea36c78da4..26bc30e07c 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -24,6 +24,7 @@
#include "xfa/include/fxfa/xfa_ffapp.h"
#include "xfa/include/fxfa/xfa_ffdocview.h"
#include "xfa/include/fxfa/xfa_ffpageview.h"
+#include "xfa/include/fxfa/xfa_ffwidget.h"
#endif // PDF_ENABLE_XFA
namespace {
@@ -100,7 +101,7 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
CXFA_FFWidget* pXFAAnnot = pWidgetIterator->MoveToNext();
while (pXFAAnnot) {
CFX_RectF rcBBox;
- pWidgetHandler->GetBBox(pXFAAnnot, rcBBox, 0);
+ pXFAAnnot->GetBBox(rcBBox, 0);
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
rcWidget.left -= 1.0f;
@@ -412,7 +413,7 @@ DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle,
#ifdef PDF_ENABLE_XFA
DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -420,16 +421,11 @@ DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
- pXFAMenuHander->Undo((CXFA_FFWidget*)hWidget);
+ static_cast<CXFA_FFWidget*>(hWidget)->Undo();
}
DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -437,17 +433,12 @@ DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
- pXFAMenuHander->Redo((CXFA_FFWidget*)hWidget);
+ static_cast<CXFA_FFWidget*>(hWidget)->Redo();
}
DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -455,18 +446,13 @@ DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
- pXFAMenuHander->SelectAll((CXFA_FFWidget*)hWidget);
+ static_cast<CXFA_FFWidget*>(hWidget)->SelectAll();
}
DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
FPDF_DWORD* size) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -474,13 +460,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
CFX_WideString wsCpText;
- pXFAMenuHander->Copy((CXFA_FFWidget*)hWidget, wsCpText);
+ static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsCpText);
CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
@@ -510,17 +491,12 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
CFX_WideString wsCpText;
- pXFAMenuHander->Cut((CXFA_FFWidget*)hWidget, wsCpText);
+ static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText);
CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
- if (wsText == NULL) {
+ if (!wsText) {
*size = len;
return;
}
@@ -539,7 +515,7 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
FPDF_DWORD size) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -547,13 +523,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size);
- pXFAMenuHander->Paste((CXFA_FFWidget*)hWidget, wstr);
+ static_cast<CXFA_FFWidget*>(hWidget)->Paste(wstr);
}
DLLEXPORT void STDCALL
@@ -562,7 +533,7 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document,
float x,
float y,
FPDF_BYTESTRING bsText) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
@@ -570,17 +541,11 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander == NULL)
- return;
-
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
CFX_ByteStringC bs(bsText);
- pXFAMenuHander->ReplaceSpellCheckWord(
- reinterpret_cast<CXFA_FFWidget*>(hWidget), ptPopup, bs);
+ static_cast<CXFA_FFWidget*>(hWidget)->ReplaceSpellCheckWord(ptPopup, bs);
}
DLLEXPORT void STDCALL
@@ -597,17 +562,12 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document,
pDocument->GetDocType() != XFA_DOCTYPE_Static)
return;
- CXFA_FFMenuHandler* pXFAMenuHander =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
- if (!pXFAMenuHander)
- return;
-
std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>;
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
- pXFAMenuHander->GetSuggestWords(reinterpret_cast<CXFA_FFWidget*>(hWidget),
- ptPopup, *sSuggestWords);
+ static_cast<CXFA_FFWidget*>(hWidget)
+ ->GetSuggestWords(ptPopup, *sSuggestWords);
*stringHandle = ToFPDFStringHandle(sSuggestWords);
}
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index b9d393e505..11a22ac854 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -91,8 +91,6 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (!pXFADocView)
return true;
- CXFA_FFDocHandler* pXFADocHandler =
- CPDFXFA_App::GetInstance()->GetXFAApp()->GetDocHandler();
CPDF_Document* pPDFDocument = pDocument->GetPDFDoc();
if (!pDocument)
return false;
@@ -177,9 +175,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
// L"datasets"
{
ScopedFileStream pDsfileWrite(FX_CreateMemoryStream());
- if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(),
- CFX_WideStringC(L"datasets"),
- pDsfileWrite.get()) &&
+ if (pXFADocView->GetDoc()->SavePackage(CFX_WideStringC(L"datasets"),
+ pDsfileWrite.get()) &&
pDsfileWrite->GetSize() > 0) {
// Datasets
pContext->UpdateChecksum(pDsfileWrite.get());
@@ -202,9 +199,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
// L"form"
{
ScopedFileStream pfileWrite(FX_CreateMemoryStream());
- if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(),
- CFX_WideStringC(L"form"), pfileWrite.get(),
- pContext.get()) &&
+ if (pXFADocView->GetDoc()->SavePackage(CFX_WideStringC(L"form"),
+ pfileWrite.get(), pContext.get()) &&
pfileWrite->GetSize() > 0) {
CPDF_Dictionary* pDataDict = new CPDF_Dictionary;
if (iFormIndex != -1) {
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index 11434ae947..79147b172e 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -20,6 +20,7 @@
#include "xfa/include/fxfa/xfa_ffdoc.h"
#include "xfa/include/fxfa/xfa_ffdocview.h"
#include "xfa/include/fxfa/xfa_ffpageview.h"
+#include "xfa/include/fxfa/xfa_ffwidget.h"
#define IDS_XFA_Validate_Input \
"At least one required field was empty. Please fill in the required " \
@@ -104,22 +105,22 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() {
return FALSE;
}
- pDocHandler->StartLoad(m_pXFADoc);
- int iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
+ m_pXFADoc->StartLoad();
+ int iStatus = m_pXFADoc->DoLoad(nullptr);
if (iStatus != XFA_PARSESTATUS_Done) {
CloseXFADoc(pDocHandler);
SetLastError(FPDF_ERR_XFALOAD);
return FALSE;
}
- pDocHandler->StopLoad(m_pXFADoc);
- pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->GetJSERuntime());
+ m_pXFADoc->StopLoad();
+ m_pXFADoc->GetXFADoc()->InitScriptContext(m_pApp->GetJSERuntime());
- if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DOCTYPE_Dynamic)
+ if (m_pXFADoc->GetDocType() == XFA_DOCTYPE_Dynamic)
m_iDocType = DOCTYPE_DYNAMIC_XFA;
else
m_iDocType = DOCTYPE_STATIC_XFA;
- m_pXFADocView = pDocHandler->CreateDocView(m_pXFADoc, XFA_DOCVIEW_View);
+ m_pXFADocView = m_pXFADoc->CreateDocView(XFA_DOCVIEW_View);
if (m_pXFADocView->StartLayout() < 0) {
CloseXFADoc(pDocHandler);
SetLastError(FPDF_ERR_XFALAYOUT);
@@ -275,12 +276,12 @@ void CPDFXFA_Document::InvalidateRect(CXFA_FFWidget* hWidget,
if (!pWidgetHandler)
return;
- CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget);
+ CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
CFX_RectF rect;
- pWidgetHandler->GetRect(hWidget, rect);
+ hWidget->GetRect(rect);
InvalidateRect(pPageView, rect, dwFlags);
}
@@ -300,7 +301,7 @@ void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
if (!pWidgetHandler)
return;
- CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget);
+ CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
@@ -325,28 +326,25 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
FX_FLOAT fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
- if (NULL == hWidget) {
+ if (!hWidget)
return FALSE;
- }
- CXFA_FFPageView* pXFAPageView =
- m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
- if (NULL == pXFAPageView) {
+
+ CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
+ if (!pXFAPageView)
return FALSE;
- }
+
CPDFXFA_Page* pPage = GetPage(pXFAPageView);
- if (pPage == NULL)
+ if (!pPage)
return FALSE;
- CXFA_WidgetAcc* pWidgetAcc =
- m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget);
-
+ CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
int nRotate = 0;
#ifdef PDF_ENABLE_XFA
nRotate = pWidgetAcc->GetRotate();
#endif
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return FALSE;
FS_RECTF pageViewRect;
pEnv->FFI_GetPageViewRect(pPage, pageViewRect);
@@ -457,39 +455,34 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget,
CFX_PointF ptPopup,
const CFX_RectF* pRectExclude) {
- if (NULL == hWidget) {
+ if (!hWidget)
return FALSE;
- }
- CXFA_FFPageView* pXFAPageView =
- m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
- if (pXFAPageView == NULL)
+
+ CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
+ if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = GetPage(pXFAPageView);
- if (pPage == NULL)
+ CPDFXFA_Page* pPage = GetPage(pXFAPageView);
+ if (!pPage)
return FALSE;
int menuFlag = 0;
- CXFA_FFMenuHandler* pXFAMenuHander = m_pApp->GetXFAApp()->GetMenuHandler();
- if (pXFAMenuHander->CanUndo(hWidget))
+ if (hWidget->CanUndo())
menuFlag |= FXFA_MEMU_UNDO;
- if (pXFAMenuHander->CanRedo(hWidget))
+ if (hWidget->CanRedo())
menuFlag |= FXFA_MEMU_REDO;
- if (pXFAMenuHander->CanPaste(hWidget))
+ if (hWidget->CanPaste())
menuFlag |= FXFA_MEMU_PASTE;
- if (pXFAMenuHander->CanCopy(hWidget))
+ if (hWidget->CanCopy())
menuFlag |= FXFA_MEMU_COPY;
- if (pXFAMenuHander->CanCut(hWidget))
+ if (hWidget->CanCut())
menuFlag |= FXFA_MEMU_CUT;
- if (pXFAMenuHander->CanSelectAll(hWidget))
+ if (hWidget->CanSelectAll())
menuFlag |= FXFA_MEMU_SELECTALL;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
- return FALSE;
-
- return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL);
+ return pEnv && pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL);
}
void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView,
@@ -540,33 +533,30 @@ void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget,
if (!pEnv)
return;
- CXFA_FFPageView* pPageView =
- m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
- if (pPageView == NULL)
+ CXFA_FFPageView* pPageView = hWidget->GetPageView();
+ if (!pPageView)
return;
CPDFXFA_Page* pXFAPage = GetPage(pPageView);
- if (pXFAPage == NULL)
+ if (!pXFAPage)
return;
CPDFSDK_PageView* pSdkPageView = m_pSDKDoc->GetPageView(pXFAPage);
if (dwEvent == XFA_WIDGETEVENT_PostAdded) {
pSdkPageView->AddAnnot(hWidget);
-
} else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) {
CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget);
- if (pAnnot) {
+ if (pAnnot)
pSdkPageView->DeleteAnnot(pAnnot);
- }
}
}
int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pXFADoc && m_pSDKDoc) {
+ if (hDoc == m_pXFADoc && m_pSDKDoc)
return GetPageCount();
- }
return 0;
}
+
int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) {
if (hDoc != m_pXFADoc || !m_pSDKDoc)
return -1;
@@ -574,11 +564,12 @@ int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) {
return -1;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return -1;
return pEnv->FFI_GetCurrentPageIndex(this);
}
+
void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) {
if (hDoc != m_pXFADoc || !m_pSDKDoc || m_iDocType != DOCTYPE_DYNAMIC_XFA ||
iCurPage < 0 || iCurPage >= m_pSDKDoc->GetPageCount()) {
@@ -662,14 +653,13 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
CFPDF_FileStream fileWrite(pFileHandler);
- CXFA_FFDocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler();
CFX_ByteString content;
if (fileType == FXFA_SAVEAS_XML) {
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(),
content.GetLength());
CFX_WideStringC data(L"data");
- if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) {
+ if (m_pXFADocView->GetDoc()->SavePackage(data, &fileWrite)) {
// Ignoring error.
}
} else if (fileType == FXFA_SAVEAS_XDP) {
@@ -702,11 +692,10 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
continue;
if (pPrePDFObj->GetString() == "form") {
CFX_WideStringC form(L"form");
- pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), form, &fileWrite);
+ m_pXFADocView->GetDoc()->SavePackage(form, &fileWrite);
} else if (pPrePDFObj->GetString() == "datasets") {
CFX_WideStringC datasets(L"datasets");
- pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), datasets,
- &fileWrite);
+ m_pXFADocView->GetDoc()->SavePackage(datasets, &fileWrite);
} else {
if (i == size - 1) {
CFX_WideString wPath = CFX_WideString::FromUTF16LE(
@@ -953,13 +942,12 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
int fileType,
FPDF_DWORD encodeType,
FPDF_DWORD flag) {
- if (NULL == m_pXFADocView)
+ if (!m_pXFADocView)
return FALSE;
- CXFA_FFDocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler();
- CFX_ByteString content;
+ CFX_ByteString content;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return FALSE;
CFPDF_FileStream fileStream(pFileHandler);
@@ -969,7 +957,7 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
ws.FromLocal("data");
CFX_ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength());
- pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream);
+ m_pXFADoc->SavePackage(ws, &fileStream);
} else if (fileType == FXFA_SAVEAS_XDP) {
if (flag == 0)
flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
@@ -1030,11 +1018,11 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
if (pPrePDFObj->GetString() == "form") {
CFX_WideString ws;
ws.FromLocal("form");
- pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream);
+ m_pXFADoc->SavePackage(ws, &fileStream);
} else if (pPrePDFObj->GetString() == "datasets") {
CFX_WideString ws;
ws.FromLocal("datasets");
- pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream);
+ m_pXFADoc->SavePackage(ws, &fileStream);
} else {
// PDF,creator.
}
diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp
index b89a63696c..5afe8e493b 100644
--- a/fpdfsdk/fsdk_annothandler.cpp
+++ b/fpdfsdk/fsdk_annothandler.cpp
@@ -20,6 +20,7 @@
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
#include "xfa/fxgraphics/include/cfx_graphics.h"
+#include "xfa/include/fxfa/xfa_ffwidget.h"
#endif // PDF_ENABLE_XFA
CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) {
@@ -785,15 +786,12 @@ CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
ASSERT(pAnnot);
- CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
CFX_RectF rcBBox;
- XFA_ELEMENT eType =
- pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType();
+ XFA_ELEMENT eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType();
if (eType == XFA_ELEMENT_Signature)
- pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox,
- XFA_WIDGETSTATUS_Visible, TRUE);
+ pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WIDGETSTATUS_Visible, TRUE);
else
- pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0);
+ pAnnot->GetXFAWidget()->GetBBox(rcBBox, 0);
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
@@ -1004,7 +1002,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
FX_BOOL bRet = TRUE;
CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL;
if (hWidget) {
- CXFA_FFPageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget);
+ CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
if (pXFAPageView) {
bRet = pXFAPageView->GetDocView()->SetFocus(hWidget);
if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget)
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index f22111ce73..be92b4a7e2 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -27,6 +27,7 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
+#include "xfa/include/fxfa/xfa_ffwidget.h"
#endif // PDF_ENABLE_XFA
#define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01)
@@ -189,14 +190,14 @@ FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) {
if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
GetFieldType() == FIELDTYPE_RADIOBUTTON) {
if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) {
- CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget);
+ CXFA_WidgetAcc* pAcc = hGroupWidget->GetDataAcc();
if (pXFAWidgetHandler->HasEvent(pAcc, eEventType))
return TRUE;
}
}
{
- CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
+ CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc();
return pXFAWidgetHandler->HasEvent(pAcc, eEventType);
}
}
@@ -236,7 +237,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
GetFieldType() == FIELDTYPE_RADIOBUTTON) {
if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) {
- CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget);
+ CXFA_WidgetAcc* pAcc = hGroupWidget->GetDataAcc();
param.m_pTarget = pAcc;
if (pXFAWidgetHandler->ProcessEvent(pAcc, &param) !=
XFA_EVENTERROR_Success) {
@@ -244,7 +245,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
}
}
}
- CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
+ CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc();
param.m_pTarget = pAcc;
int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
@@ -261,48 +262,44 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
- CPDF_FormField* pFormField = GetFormField();
- if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
- switch (GetFieldType()) {
- case FIELDTYPE_CHECKBOX:
- case FIELDTYPE_RADIOBUTTON: {
- CPDF_FormControl* pFormCtrl = GetFormControl();
- XFA_CHECKSTATE eCheckState =
- pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
- pWidgetAcc->SetCheckState(eCheckState);
- } break;
- case FIELDTYPE_TEXTFIELD:
- pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
- break;
- case FIELDTYPE_LISTBOX: {
- pWidgetAcc->ClearAllSelections();
-
- for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz;
- i++) {
- int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
- pWidgetAcc->SetItemState(nIndex, TRUE, FALSE);
- }
- } break;
- case FIELDTYPE_COMBOBOX: {
- pWidgetAcc->ClearAllSelections();
-
- for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz;
- i++) {
- int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
- pWidgetAcc->SetItemState(nIndex, TRUE, FALSE);
- }
+ CPDF_FormField* pFormField = GetFormField();
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ switch (GetFieldType()) {
+ case FIELDTYPE_CHECKBOX:
+ case FIELDTYPE_RADIOBUTTON: {
+ CPDF_FormControl* pFormCtrl = GetFormControl();
+ XFA_CHECKSTATE eCheckState =
+ pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
+ pWidgetAcc->SetCheckState(eCheckState);
+ } break;
+ case FIELDTYPE_TEXTFIELD:
+ pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
+ break;
+ case FIELDTYPE_LISTBOX: {
+ pWidgetAcc->ClearAllSelections();
+
+ for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
+ int nIndex = pFormField->GetSelectedIndex(i);
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ pWidgetAcc->SetItemState(nIndex, TRUE, FALSE);
}
+ } break;
+ case FIELDTYPE_COMBOBOX: {
+ pWidgetAcc->ClearAllSelections();
- pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
- break;
+ for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
+ int nIndex = pFormField->GetSelectedIndex(i);
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ pWidgetAcc->SetItemState(nIndex, TRUE, FALSE);
+ }
}
- if (bSynchronizeElse)
- pWidgetAcc->ProcessValueChanged();
+ pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
+ break;
}
+
+ if (bSynchronizeElse)
+ pWidgetAcc->ProcessValueChanged();
}
}
}
@@ -340,71 +337,62 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl) {
ASSERT(hWidget);
+ ASSERT(pFormControl);
+
+ switch (pFormField->GetFieldType()) {
+ case FIELDTYPE_CHECKBOX: {
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ pFormField->CheckControl(
+ pFormField->GetControlIndex(pFormControl),
+ pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true);
+ }
+ } break;
+ case FIELDTYPE_RADIOBUTTON: {
+ // TODO(weili): Check whether we need to handle checkbox and radio
+ // button differently, otherwise, merge these two cases.
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ pFormField->CheckControl(
+ pFormField->GetControlIndex(pFormControl),
+ pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true);
+ }
+ } break;
+ case FIELDTYPE_TEXTFIELD: {
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ CFX_WideString sValue;
+ pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
+ pFormField->SetValue(sValue, TRUE);
+ }
+ } break;
+ case FIELDTYPE_LISTBOX: {
+ pFormField->ClearSelection(FALSE);
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler =
- pXFADocView->GetWidgetHandler()) {
- ASSERT(pFormControl);
-
- switch (pFormField->GetFieldType()) {
- case FIELDTYPE_CHECKBOX: {
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- pFormField->CheckControl(
- pFormField->GetControlIndex(pFormControl),
- pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true);
- }
- } break;
- case FIELDTYPE_RADIOBUTTON: {
- // TODO(weili): Check whether we need to handle checkbox and radio
- // button differently, otherwise, merge these two cases.
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- pFormField->CheckControl(
- pFormField->GetControlIndex(pFormControl),
- pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true);
- }
- } break;
- case FIELDTYPE_TEXTFIELD: {
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- CFX_WideString sValue;
- pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
- pFormField->SetValue(sValue, TRUE);
- }
- } break;
- case FIELDTYPE_LISTBOX: {
- pFormField->ClearSelection(FALSE);
-
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) {
- int nIndex = pWidgetAcc->GetSelectedItem(i);
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) {
+ int nIndex = pWidgetAcc->GetSelectedItem(i);
- if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
- pFormField->SetItemSelection(nIndex, TRUE, TRUE);
- }
+ if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
+ pFormField->SetItemSelection(nIndex, TRUE, TRUE);
}
}
- } break;
- case FIELDTYPE_COMBOBOX: {
- pFormField->ClearSelection(FALSE);
+ }
+ } break;
+ case FIELDTYPE_COMBOBOX: {
+ pFormField->ClearSelection(FALSE);
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) {
- int nIndex = pWidgetAcc->GetSelectedItem(i);
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) {
+ int nIndex = pWidgetAcc->GetSelectedItem(i);
- if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
- pFormField->SetItemSelection(nIndex, TRUE, TRUE);
- }
+ if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
+ pFormField->SetItemSelection(nIndex, TRUE, TRUE);
}
-
- CFX_WideString sValue;
- pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
- pFormField->SetValue(sValue, TRUE);
}
- } break;
- }
+
+ CFX_WideString sValue;
+ pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
+ pFormField->SetValue(sValue, TRUE);
+ }
+ } break;
}
}
@@ -414,42 +402,35 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
CPDF_FormControl* pFormControl) {
ASSERT(hWidget);
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler =
- pXFADocView->GetWidgetHandler()) {
- switch (pFormField->GetFieldType()) {
- case FIELDTYPE_LISTBOX: {
- pFormField->ClearSelection(FALSE);
- pFormField->ClearOptions(TRUE);
-
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz;
- i++) {
- CFX_WideString swText;
- pWidgetAcc->GetChoiceListItem(swText, i);
-
- pFormField->InsertOption(swText, i, TRUE);
- }
+ switch (pFormField->GetFieldType()) {
+ case FIELDTYPE_LISTBOX: {
+ pFormField->ClearSelection(FALSE);
+ pFormField->ClearOptions(TRUE);
+
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) {
+ CFX_WideString swText;
+ pWidgetAcc->GetChoiceListItem(swText, i);
+
+ pFormField->InsertOption(swText, i, TRUE);
}
- } break;
- case FIELDTYPE_COMBOBOX: {
- pFormField->ClearSelection(FALSE);
- pFormField->ClearOptions(FALSE);
-
- if (CXFA_WidgetAcc* pWidgetAcc =
- pXFAWidgetHandler->GetDataAcc(hWidget)) {
- for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz;
- i++) {
- CFX_WideString swText;
- pWidgetAcc->GetChoiceListItem(swText, i);
-
- pFormField->InsertOption(swText, i, FALSE);
- }
+ }
+ } break;
+ case FIELDTYPE_COMBOBOX: {
+ pFormField->ClearSelection(FALSE);
+ pFormField->ClearOptions(FALSE);
+
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) {
+ CFX_WideString swText;
+ pWidgetAcc->GetChoiceListItem(swText, i);
+
+ pFormField->InsertOption(swText, i, FALSE);
}
+ }
- pFormField->SetValue(L"", TRUE);
- } break;
- }
+ pFormField->SetValue(L"", TRUE);
+ } break;
}
}
#endif // PDF_ENABLE_XFA
@@ -595,11 +576,9 @@ FX_FLOAT CPDFSDK_Widget::GetFontSize() const {
int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
#ifdef PDF_ENABLE_XFA
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
- if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
- if (nIndex < pWidgetAcc->CountSelectedItems())
- return pWidgetAcc->GetSelectedItem(nIndex);
- }
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ if (nIndex < pWidgetAcc->CountSelectedItems())
+ return pWidgetAcc->GetSelectedItem(nIndex);
}
}
#endif // PDF_ENABLE_XFA
@@ -610,13 +589,11 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
#ifdef PDF_ENABLE_XFA
CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
- if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
- CFX_WideString sValue;
- pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display
- : XFA_VALUEPICTURE_Edit);
- return sValue;
- }
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ CFX_WideString sValue;
+ pWidgetAcc->GetValue(
+ sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit);
+ return sValue;
}
}
#else
@@ -644,13 +621,11 @@ int CPDFSDK_Widget::CountOptions() const {
FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
#ifdef PDF_ENABLE_XFA
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
- if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
- return pWidgetAcc->GetItemState(nIndex);
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ return pWidgetAcc->GetItemState(nIndex);
- return FALSE;
- }
+ return FALSE;
}
}
#endif // PDF_ENABLE_XFA
@@ -665,11 +640,9 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const {
bool CPDFSDK_Widget::IsChecked() const {
#ifdef PDF_ENABLE_XFA
- if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
- if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
- if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget))
- return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On;
- }
+ if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
+ if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc())
+ return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On;
}
#endif // PDF_ENABLE_XFA
CPDF_FormControl* pFormCtrl = GetFormControl();
@@ -1900,7 +1873,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]);
param.m_wsPrevText = data.sValue;
- CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
+ CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc();
param.m_pTarget = pAcc;
int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
@@ -2001,15 +1974,8 @@ CFX_ByteString CPDFSDK_XFAWidget::GetType() const {
}
CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
- CPDFSDK_PageView* pPageView = GetPageView();
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
- CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
- CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
-
CFX_RectF rcBBox;
- pWidgetHandler->GetRect(GetXFAWidget(), rcBBox);
-
+ GetXFAWidget()->GetRect(rcBBox);
return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
}
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
index 6d501317d6..dc09c8b656 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
@@ -11,6 +11,7 @@
#include "public/fpdfview.h"
#include "xfa/include/fxfa/fxfa.h"
+#include "xfa/include/fxfa/xfa_ffdoc.h"
#include "xfa/include/fxfa/xfa_ffdochandler.h"
class CPDFXFA_App;
@@ -212,12 +213,13 @@ class CPDFXFA_Document : public IXFA_DocProvider {
FXFA_LOADSTATUS_CLOSING,
FXFA_LOADSTATUS_CLOSED
};
+
void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
if (pDoc) {
- pDoc->CloseDoc(m_pXFADoc);
- pDoc->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
- m_pXFADocView = NULL;
+ m_pXFADoc->CloseDoc();
+ delete m_pXFADoc;
+ m_pXFADoc = nullptr;
+ m_pXFADocView = nullptr;
}
}