From df4bc596c64fb848647c670be66a29ea0861b4f4 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 31 Mar 2016 20:34:43 -0700 Subject: Remove IXFA_* interfaces. This CL removes the IXFA_* interfaces which are: - Implemented once. - Not implemented by an fpdfsdk class. This requires making a few classes visible to fpdfsdk so we can have the correct instances available instead of the IXFA types. Review URL: https://codereview.chromium.org/1846993002 --- BUILD.gn | 22 +- fpdfsdk/fpdfformfill.cpp | 44 +-- fpdfsdk/fpdfsave.cpp | 24 +- fpdfsdk/fpdfxfa/fpdfxfa_app.cpp | 17 +- fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 110 +++--- fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 8 +- fpdfsdk/fsdk_annothandler.cpp | 52 +-- fpdfsdk/fsdk_baseform.cpp | 86 ++--- fpdfsdk/fsdk_mgr.cpp | 17 +- fpdfsdk/include/fpdfxfa/fpdfxfa_app.h | 5 +- fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h | 101 +++--- fpdfsdk/include/fpdfxfa/fpdfxfa_page.h | 10 +- fpdfsdk/include/fsdk_annothandler.h | 14 +- fpdfsdk/include/fsdk_baseannot.h | 2 +- fpdfsdk/include/fsdk_baseform.h | 36 +- fpdfsdk/include/fsdk_mgr.h | 4 +- xfa.gyp | 18 +- xfa/DEPS | 1 + xfa/fwl/basewidget/fwl_editimp.cpp | 2 +- xfa/fxfa/app/xfa_checksum.cpp | 6 +- xfa/fxfa/app/xfa_checksum.h | 73 ---- xfa/fxfa/app/xfa_ffapp.cpp | 37 +- xfa/fxfa/app/xfa_ffapp.h | 82 ----- xfa/fxfa/app/xfa_ffbarcode.cpp | 2 +- xfa/fxfa/app/xfa_ffbarcode.h | 2 +- xfa/fxfa/app/xfa_ffcheckbutton.cpp | 8 +- xfa/fxfa/app/xfa_ffcheckbutton.h | 2 +- xfa/fxfa/app/xfa_ffchoicelist.cpp | 6 +- xfa/fxfa/app/xfa_ffchoicelist.h | 2 +- xfa/fxfa/app/xfa_ffdoc.cpp | 37 +- xfa/fxfa/app/xfa_ffdoc.h | 64 ---- xfa/fxfa/app/xfa_ffdochandler.cpp | 80 +++-- xfa/fxfa/app/xfa_ffdochandler.h | 51 --- xfa/fxfa/app/xfa_ffdocview.cpp | 66 ++-- xfa/fxfa/app/xfa_ffdocview.h | 170 --------- xfa/fxfa/app/xfa_ffdraw.cpp | 6 +- xfa/fxfa/app/xfa_ffdraw.h | 2 +- xfa/fxfa/app/xfa_ffexclgroup.cpp | 6 +- xfa/fxfa/app/xfa_ffexclgroup.h | 2 +- xfa/fxfa/app/xfa_fffield.cpp | 8 +- xfa/fxfa/app/xfa_fffield.h | 2 +- xfa/fxfa/app/xfa_ffimage.cpp | 6 +- xfa/fxfa/app/xfa_ffimageedit.cpp | 6 +- xfa/fxfa/app/xfa_ffnotify.cpp | 48 +-- xfa/fxfa/app/xfa_ffnotify.h | 104 +++--- xfa/fxfa/app/xfa_ffpageview.cpp | 48 ++- xfa/fxfa/app/xfa_ffpageview.h | 111 ------ xfa/fxfa/app/xfa_ffpath.cpp | 6 +- xfa/fxfa/app/xfa_ffpushbutton.cpp | 4 +- xfa/fxfa/app/xfa_ffsignature.cpp | 4 +- xfa/fxfa/app/xfa_ffsubform.cpp | 6 +- xfa/fxfa/app/xfa_ffsubform.h | 2 +- xfa/fxfa/app/xfa_fftext.cpp | 6 +- xfa/fxfa/app/xfa_fftextedit.cpp | 8 +- xfa/fxfa/app/xfa_ffwidget.cpp | 14 +- xfa/fxfa/app/xfa_ffwidget.h | 8 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 14 +- xfa/fxfa/app/xfa_ffwidgetacc.h | 23 +- xfa/fxfa/app/xfa_ffwidgethandler.cpp | 249 +++++++------ xfa/fxfa/app/xfa_ffwidgethandler.h | 176 ---------- xfa/fxfa/app/xfa_fontmgr.cpp | 34 +- xfa/fxfa/app/xfa_fontmgr.h | 100 ------ xfa/fxfa/app/xfa_fwladapter.cpp | 2 +- xfa/fxfa/app/xfa_fwltheme.cpp | 2 +- xfa/fxfa/app/xfa_fwltheme.h | 2 +- xfa/fxfa/app/xfa_rendercontext.cpp | 8 +- xfa/fxfa/app/xfa_rendercontext.h | 35 -- xfa/fxfa/app/xfa_textlayout.cpp | 37 +- xfa/fxfa/app/xfa_textlayout.h | 49 +-- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 9 +- xfa/fxfa/parser/xfa_docdata.h | 20 -- xfa/fxfa/parser/xfa_doclayout.h | 37 +- xfa/fxfa/parser/xfa_document.h | 93 +---- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 2 + xfa/fxfa/parser/xfa_document_imp.cpp | 21 +- xfa/fxfa/parser/xfa_document_layout_imp.cpp | 6 +- xfa/fxfa/parser/xfa_document_layout_imp.h | 17 +- xfa/fxfa/parser/xfa_document_serialize.cpp | 9 +- xfa/fxfa/parser/xfa_document_serialize.h | 30 +- xfa/fxfa/parser/xfa_layout_appadapter.cpp | 6 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 18 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 33 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.h | 4 +- xfa/fxfa/parser/xfa_locale.cpp | 6 +- xfa/fxfa/parser/xfa_localemgr.cpp | 13 +- xfa/fxfa/parser/xfa_localemgr.h | 23 +- xfa/fxfa/parser/xfa_object_imp.cpp | 81 ++--- xfa/fxfa/parser/xfa_objectacc_imp.cpp | 1 + xfa/fxfa/parser/xfa_parser.h | 10 +- xfa/fxfa/parser/xfa_parser_imp.cpp | 15 +- xfa/fxfa/parser/xfa_parser_imp.h | 70 ++-- xfa/fxfa/parser/xfa_script.h | 36 -- xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 14 +- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 99 +++--- xfa/fxfa/parser/xfa_script_hostpseudomodel.h | 2 +- xfa/fxfa/parser/xfa_script_imp.cpp | 8 +- xfa/fxfa/parser/xfa_script_imp.h | 57 ++- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 47 +-- xfa/fxfa/parser/xfa_script_layoutpseudomodel.h | 2 +- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 4 +- .../parser/xfa_script_signaturepseudomodel.cpp | 19 +- xfa/include/fxfa/fxfa.h | 385 +++------------------ xfa/include/fxfa/xfa_checksum.h | 74 ++++ xfa/include/fxfa/xfa_ffapp.h | 81 +++++ xfa/include/fxfa/xfa_ffdoc.h | 65 ++++ xfa/include/fxfa/xfa_ffdochandler.h | 53 +++ xfa/include/fxfa/xfa_ffdocview.h | 172 +++++++++ xfa/include/fxfa/xfa_ffpageview.h | 113 ++++++ xfa/include/fxfa/xfa_ffwidgethandler.h | 171 +++++++++ xfa/include/fxfa/xfa_fontmgr.h | 99 ++++++ xfa/include/fxfa/xfa_rendercontext.h | 36 ++ 111 files changed, 2013 insertions(+), 2447 deletions(-) delete mode 100644 xfa/fxfa/app/xfa_checksum.h delete mode 100644 xfa/fxfa/app/xfa_ffapp.h delete mode 100644 xfa/fxfa/app/xfa_ffdoc.h delete mode 100644 xfa/fxfa/app/xfa_ffdochandler.h delete mode 100644 xfa/fxfa/app/xfa_ffdocview.h delete mode 100644 xfa/fxfa/app/xfa_ffpageview.h delete mode 100644 xfa/fxfa/app/xfa_ffwidgethandler.h delete mode 100644 xfa/fxfa/app/xfa_fontmgr.h delete mode 100644 xfa/fxfa/app/xfa_rendercontext.h create mode 100644 xfa/include/fxfa/xfa_checksum.h create mode 100644 xfa/include/fxfa/xfa_ffapp.h create mode 100644 xfa/include/fxfa/xfa_ffdoc.h create mode 100644 xfa/include/fxfa/xfa_ffdochandler.h create mode 100644 xfa/include/fxfa/xfa_ffdocview.h create mode 100644 xfa/include/fxfa/xfa_ffpageview.h create mode 100644 xfa/include/fxfa/xfa_ffwidgethandler.h create mode 100644 xfa/include/fxfa/xfa_fontmgr.h create mode 100644 xfa/include/fxfa/xfa_rendercontext.h diff --git a/BUILD.gn b/BUILD.gn index aa8c58f707..b5d8950854 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -42,9 +42,7 @@ config("pdfium_config") { } if (is_win) { - cflags += [ - "/wd4267", - ] + cflags += [ "/wd4267" ] } if (is_clang || is_posix) { @@ -1392,9 +1390,7 @@ if (pdf_enable_xfa) { "xfa/fxbarcode/qrcode/BC_QRGridSampler.h", "xfa/fxbarcode/utils.h", "xfa/fxfa/app/xfa_checksum.cpp", - "xfa/fxfa/app/xfa_checksum.h", "xfa/fxfa/app/xfa_ffapp.cpp", - "xfa/fxfa/app/xfa_ffapp.h", "xfa/fxfa/app/xfa_ffbarcode.cpp", "xfa/fxfa/app/xfa_ffbarcode.h", "xfa/fxfa/app/xfa_ffcheckbutton.cpp", @@ -1402,11 +1398,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/app/xfa_ffchoicelist.cpp", "xfa/fxfa/app/xfa_ffchoicelist.h", "xfa/fxfa/app/xfa_ffdoc.cpp", - "xfa/fxfa/app/xfa_ffdoc.h", "xfa/fxfa/app/xfa_ffdochandler.cpp", - "xfa/fxfa/app/xfa_ffdochandler.h", "xfa/fxfa/app/xfa_ffdocview.cpp", - "xfa/fxfa/app/xfa_ffdocview.h", "xfa/fxfa/app/xfa_ffdraw.cpp", "xfa/fxfa/app/xfa_ffdraw.h", "xfa/fxfa/app/xfa_ffexclgroup.cpp", @@ -1420,7 +1413,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/app/xfa_ffnotify.cpp", "xfa/fxfa/app/xfa_ffnotify.h", "xfa/fxfa/app/xfa_ffpageview.cpp", - "xfa/fxfa/app/xfa_ffpageview.h", "xfa/fxfa/app/xfa_ffpath.cpp", "xfa/fxfa/app/xfa_ffpath.h", "xfa/fxfa/app/xfa_ffpushbutton.cpp", @@ -1438,15 +1430,12 @@ if (pdf_enable_xfa) { "xfa/fxfa/app/xfa_ffwidgetacc.cpp", "xfa/fxfa/app/xfa_ffwidgetacc.h", "xfa/fxfa/app/xfa_ffwidgethandler.cpp", - "xfa/fxfa/app/xfa_ffwidgethandler.h", "xfa/fxfa/app/xfa_fontmgr.cpp", - "xfa/fxfa/app/xfa_fontmgr.h", "xfa/fxfa/app/xfa_fwladapter.cpp", "xfa/fxfa/app/xfa_fwladapter.h", "xfa/fxfa/app/xfa_fwltheme.cpp", "xfa/fxfa/app/xfa_fwltheme.h", "xfa/fxfa/app/xfa_rendercontext.cpp", - "xfa/fxfa/app/xfa_rendercontext.h", "xfa/fxfa/app/xfa_textlayout.cpp", "xfa/fxfa/app/xfa_textlayout.h", "xfa/fxfa/fm2js/xfa_error.cpp", @@ -1539,6 +1528,15 @@ if (pdf_enable_xfa) { "xfa/include/fxfa/fxfa_basic.h", "xfa/include/fxfa/fxfa_objectacc.h", "xfa/include/fxfa/fxfa_widget.h", + "xfa/include/fxfa/xfa_checksum.h", + "xfa/include/fxfa/xfa_ffapp.h", + "xfa/include/fxfa/xfa_ffdoc.h", + "xfa/include/fxfa/xfa_ffdochandler.h", + "xfa/include/fxfa/xfa_ffdocview.h", + "xfa/include/fxfa/xfa_ffpageview.h", + "xfa/include/fxfa/xfa_ffwidgethandler.h", + "xfa/include/fxfa/xfa_fontmgr.h", + "xfa/include/fxfa/xfa_rendercontext.h", ] include_dirs = [ "." ] if (pdf_enable_v8) { diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index ed6279a2c6..ea36c78da4 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -21,6 +21,9 @@ #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #endif // PDF_ENABLE_XFA namespace { @@ -75,15 +78,15 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, if (!pXFAPage) return -1; - IXFA_PageView* pPageView = pXFAPage->GetXFAPageView(); + CXFA_FFPageView* pPageView = pXFAPage->GetXFAPageView(); if (!pPageView) return -1; - IXFA_DocView* pDocView = pPageView->GetDocView(); + CXFA_FFDocView* pDocView = pPageView->GetDocView(); if (!pDocView) return -1; - IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); if (!pWidgetHandler) return -1; @@ -94,7 +97,7 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, if (!pWidgetIterator) return -1; - IXFA_Widget* pXFAAnnot = pWidgetIterator->MoveToNext(); + CXFA_FFWidget* pXFAAnnot = pWidgetIterator->MoveToNext(); while (pXFAAnnot) { CFX_RectF rcBBox; pWidgetHandler->GetBBox(pXFAAnnot, rcBBox, 0); @@ -417,12 +420,12 @@ DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; - pXFAMenuHander->Undo((IXFA_Widget*)hWidget); + pXFAMenuHander->Undo((CXFA_FFWidget*)hWidget); } DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget) { @@ -434,12 +437,12 @@ DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; - pXFAMenuHander->Redo((IXFA_Widget*)hWidget); + pXFAMenuHander->Redo((CXFA_FFWidget*)hWidget); } DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, @@ -452,12 +455,12 @@ DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; - pXFAMenuHander->SelectAll((IXFA_Widget*)hWidget); + pXFAMenuHander->SelectAll((CXFA_FFWidget*)hWidget); } DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, @@ -471,13 +474,13 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; CFX_WideString wsCpText; - pXFAMenuHander->Copy((IXFA_Widget*)hWidget, wsCpText); + pXFAMenuHander->Copy((CXFA_FFWidget*)hWidget, wsCpText); CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); @@ -507,13 +510,13 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; CFX_WideString wsCpText; - pXFAMenuHander->Cut((IXFA_Widget*)hWidget, wsCpText); + pXFAMenuHander->Cut((CXFA_FFWidget*)hWidget, wsCpText); CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); @@ -544,13 +547,13 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); - pXFAMenuHander->Paste((IXFA_Widget*)hWidget, wstr); + pXFAMenuHander->Paste((CXFA_FFWidget*)hWidget, wstr); } DLLEXPORT void STDCALL @@ -567,7 +570,7 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander == NULL) return; @@ -576,7 +579,8 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, ptPopup.x = x; ptPopup.y = y; CFX_ByteStringC bs(bsText); - pXFAMenuHander->ReplaceSpellCheckWord((IXFA_Widget*)hWidget, ptPopup, bs); + pXFAMenuHander->ReplaceSpellCheckWord( + reinterpret_cast(hWidget), ptPopup, bs); } DLLEXPORT void STDCALL @@ -593,7 +597,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, pDocument->GetDocType() != XFA_DOCTYPE_Static) return; - IXFA_MenuHandler* pXFAMenuHander = + CXFA_FFMenuHandler* pXFAMenuHander = CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); if (!pXFAMenuHander) return; @@ -602,7 +606,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, CFX_PointF ptPopup; ptPopup.x = x; ptPopup.y = y; - pXFAMenuHander->GetSuggestWords(reinterpret_cast(hWidget), + pXFAMenuHander->GetSuggestWords(reinterpret_cast(hWidget), ptPopup, *sSuggestWords); *stringHandle = ToFPDFStringHandle(sSuggestWords); } diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index e11e1f2d6d..b9d393e505 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -23,6 +23,10 @@ #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" #include "public/fpdf_formfill.h" +#include "xfa/include/fxfa/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" #endif #if _FX_OS_ == _FX_ANDROID_ @@ -83,11 +87,11 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, if (!CPDFXFA_App::GetInstance()->GetXFAApp()) return true; - IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); + CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView(); if (!pXFADocView) return true; - IXFA_DocHandler* pXFADocHandler = + CXFA_FFDocHandler* pXFADocHandler = CPDFXFA_App::GetInstance()->GetXFAApp()->GetDocHandler(); CPDF_Document* pPDFDocument = pDocument->GetPDFDoc(); if (!pDocument) @@ -128,8 +132,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, else if (pPDFObj->GetString() == "template") iTemplate = i + 1; } - std::unique_ptr> - pContext(XFA_Checksum_Create()); + std::unique_ptr> + pContext(new CXFA_ChecksumContext); pContext->StartChecksum(); // template @@ -228,13 +232,13 @@ bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) { pDocument->GetDocType() != DOCTYPE_STATIC_XFA) return true; - IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); + CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView(); if (!pXFADocView) return false; - IXFA_WidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); CXFA_WidgetAcc* pWidgetAcc = NULL; - IXFA_WidgetAccIterator* pWidgetAccIterator = + CXFA_WidgetAccIterator* pWidgetAccIterator = pXFADocView->CreateWidgetAccIterator(); pWidgetAcc = pWidgetAccIterator->MoveToNext(); while (pWidgetAcc) { @@ -255,13 +259,13 @@ bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument, pDocument->GetDocType() != DOCTYPE_STATIC_XFA) return true; - IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); + CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView(); if (!pXFADocView) return true; - IXFA_WidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); CXFA_WidgetAcc* pWidgetAcc = NULL; - IXFA_WidgetAccIterator* pWidgetAccIterator = + CXFA_WidgetAccIterator* pWidgetAccIterator = pXFADocView->CreateWidgetAccIterator(); pWidgetAcc = pWidgetAccIterator->MoveToNext(); while (pWidgetAcc) { diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp index b52879a25a..4e1b95ea64 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp @@ -11,6 +11,8 @@ #include "fpdfsdk/include/fsdk_mgr.h" #include "public/fpdf_formfill.h" #include "xfa/fxbarcode/include/BC_Library.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CPDFXFA_App* CPDFXFA_App::g_pApp = NULL; @@ -29,7 +31,6 @@ void CPDFXFA_App::ReleaseInstance() { CPDFXFA_App::CPDFXFA_App() : m_bJavaScriptInitialized(FALSE), m_pXFAApp(NULL), - m_pFontMgr(NULL), m_hJSERuntime(NULL), m_csAppType(JS_STR_VIEWERTYPE_STANDARD), m_bOwnedRuntime(false) { @@ -37,9 +38,6 @@ CPDFXFA_App::CPDFXFA_App() } CPDFXFA_App::~CPDFXFA_App() { - delete m_pFontMgr; - m_pFontMgr = NULL; - delete m_pXFAApp; m_pXFAApp = NULL; @@ -62,15 +60,8 @@ FX_BOOL CPDFXFA_App::Initialize(FXJSE_HRUNTIME hRuntime) { if (!m_hJSERuntime) return FALSE; - m_pXFAApp = IXFA_App::Create(this); - if (!m_pXFAApp) - return FALSE; - - m_pFontMgr = IXFA_FontMgr::CreateDefault(); - if (!m_pFontMgr) - return FALSE; - - m_pXFAApp->SetDefaultFontMgr(m_pFontMgr); + m_pXFAApp = new CXFA_FFApp(this); + m_pXFAApp->SetDefaultFontMgr(new CXFA_DefFontMgr); #endif return TRUE; } diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 23efc3321a..11434ae947 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -16,6 +16,10 @@ #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/javascript/ijs_runtime.h" #include "public/fpdf_formfill.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #define IDS_XFA_Validate_Input \ "At least one required field was empty. Please fill in the required " \ @@ -53,9 +57,9 @@ CPDFXFA_Document::~CPDFXFA_Document() { m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; if (m_pXFADoc) { - IXFA_App* pApp = m_pApp->GetXFAApp(); + CXFA_FFApp* pApp = m_pApp->GetXFAApp(); if (pApp) { - IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); + CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); if (pDocHandler) { CloseXFADoc(pDocHandler); } @@ -84,7 +88,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() { m_XFAPageList.RemoveAll(); - IXFA_App* pApp = m_pApp->GetXFAApp(); + CXFA_FFApp* pApp = m_pApp->GetXFAApp(); if (!pApp) return FALSE; @@ -94,7 +98,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() { return FALSE; } - IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); + CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); if (!pDocHandler) { SetLastError(FPDF_ERR_XFALOAD); return FALSE; @@ -170,7 +174,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { return pPage; } -CPDFXFA_Page* CPDFXFA_Document::GetPage(IXFA_PageView* pPage) { +CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) { if (!pPage) return NULL; @@ -219,19 +223,19 @@ void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF, pdfRect.bottom = fxRectF.top; } -void CPDFXFA_Document::SetChangeMark(IXFA_Doc* hDoc) { +void CPDFXFA_Document::SetChangeMark(CXFA_FFDoc* hDoc) { if (hDoc == m_pXFADoc && m_pSDKDoc) { m_pSDKDoc->SetChangeMark(); } } -FX_BOOL CPDFXFA_Document::GetChangeMark(IXFA_Doc* hDoc) { +FX_BOOL CPDFXFA_Document::GetChangeMark(CXFA_FFDoc* hDoc) { if (hDoc == m_pXFADoc && m_pSDKDoc) return m_pSDKDoc->GetChangeMark(); return FALSE; } -void CPDFXFA_Document::InvalidateRect(IXFA_PageView* pPageView, +void CPDFXFA_Document::InvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rt, uint32_t dwFlags /* = 0 */) { if (!m_pXFADoc || !m_pSDKDoc) @@ -256,7 +260,7 @@ void CPDFXFA_Document::InvalidateRect(IXFA_PageView* pPageView, rcPage.right, rcPage.top); } -void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, +void CPDFXFA_Document::InvalidateRect(CXFA_FFWidget* hWidget, uint32_t dwFlags /* = 0 */) { if (!hWidget) return; @@ -267,11 +271,11 @@ void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, if (m_iDocType != DOCTYPE_DYNAMIC_XFA) return; - IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); if (!pWidgetHandler) return; - IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); + CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget); if (!pPageView) return; @@ -280,7 +284,7 @@ void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, InvalidateRect(pPageView, rect, dwFlags); } -void CPDFXFA_Document::DisplayCaret(IXFA_Widget* hWidget, +void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget, FX_BOOL bVisible, const CFX_RectF* pRtAnchor) { if (!hWidget || pRtAnchor == NULL) @@ -292,11 +296,11 @@ void CPDFXFA_Document::DisplayCaret(IXFA_Widget* hWidget, if (m_iDocType != DOCTYPE_DYNAMIC_XFA) return; - IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); if (!pWidgetHandler) return; - IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); + CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget); if (!pPageView) return; @@ -316,7 +320,7 @@ void CPDFXFA_Document::DisplayCaret(IXFA_Widget* hWidget, rcCaret.right, rcCaret.bottom); } -FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget, +FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget, FX_FLOAT fMinPopup, FX_FLOAT fMaxPopup, const CFX_RectF& rtAnchor, @@ -324,7 +328,7 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget, if (NULL == hWidget) { return FALSE; } - IXFA_PageView* pXFAPageView = + CXFA_FFPageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); if (NULL == pXFAPageView) { return FALSE; @@ -450,13 +454,13 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget, return TRUE; } -FX_BOOL CPDFXFA_Document::PopupMenu(IXFA_Widget* hWidget, +FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup, const CFX_RectF* pRectExclude) { if (NULL == hWidget) { return FALSE; } - IXFA_PageView* pXFAPageView = + CXFA_FFPageView* pXFAPageView = m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); if (pXFAPageView == NULL) return FALSE; @@ -467,7 +471,7 @@ FX_BOOL CPDFXFA_Document::PopupMenu(IXFA_Widget* hWidget, int menuFlag = 0; - IXFA_MenuHandler* pXFAMenuHander = m_pApp->GetXFAApp()->GetMenuHandler(); + CXFA_FFMenuHandler* pXFAMenuHander = m_pApp->GetXFAApp()->GetMenuHandler(); if (pXFAMenuHander->CanUndo(hWidget)) menuFlag |= FXFA_MEMU_UNDO; if (pXFAMenuHander->CanRedo(hWidget)) @@ -488,7 +492,7 @@ FX_BOOL CPDFXFA_Document::PopupMenu(IXFA_Widget* hWidget, return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL); } -void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, +void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); if (!pEnv) @@ -501,7 +505,7 @@ void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, if (nNewCount == m_nPageCount) return; - IXFA_DocView* pXFADocView = GetXFADocView(); + CXFA_FFDocView* pXFADocView = GetXFADocView(); if (!pXFADocView) return; for (int iPageIter = 0; iPageIter < m_nPageCount; iPageIter++) { @@ -509,7 +513,7 @@ void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, if (!pPage) continue; m_pSDKDoc->RemovePageView(pPage); - IXFA_PageView* pXFAPageView = pXFADocView->GetPageView(iPageIter); + CXFA_FFPageView* pXFAPageView = pXFADocView->GetPageView(iPageIter); pPage->SetXFAPageView(pXFAPageView); if (pXFAPageView) pXFAPageView->LoadPageView(nullptr); @@ -524,7 +528,7 @@ void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, } } -void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, +void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData, uint32_t dwEvent, void* pParam, @@ -536,7 +540,7 @@ void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, if (!pEnv) return; - IXFA_PageView* pPageView = + CXFA_FFPageView* pPageView = m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); if (pPageView == NULL) return; @@ -557,13 +561,13 @@ void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, } } -int32_t CPDFXFA_Document::CountPages(IXFA_Doc* hDoc) { +int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) { if (hDoc == m_pXFADoc && m_pSDKDoc) { return GetPageCount(); } return 0; } -int32_t CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) { +int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) { if (hDoc != m_pXFADoc || !m_pSDKDoc) return -1; if (m_iDocType != DOCTYPE_DYNAMIC_XFA) @@ -575,7 +579,7 @@ int32_t CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) { return pEnv->FFI_GetCurrentPageIndex(this); } -void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) { +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()) { return; @@ -585,7 +589,7 @@ void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) { return; pEnv->FFI_SetCurrentPage(this, iCurPage); } -FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) { +FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { if (hDoc != m_pXFADoc || !m_pSDKDoc) return FALSE; if (m_pSDKDoc->GetInterForm()) @@ -593,7 +597,7 @@ FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) { return FALSE; } -void CPDFXFA_Document::SetCalculationsEnabled(IXFA_Doc* hDoc, +void CPDFXFA_Document::SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) { if (hDoc != m_pXFADoc || !m_pSDKDoc) return; @@ -601,7 +605,7 @@ void CPDFXFA_Document::SetCalculationsEnabled(IXFA_Doc* hDoc, m_pSDKDoc->GetInterForm()->XfaEnableCalculate(bEnabled); } -void CPDFXFA_Document::GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) { +void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) { if (hDoc != m_pXFADoc) return; if (m_pPDFDoc == NULL) @@ -615,7 +619,7 @@ void CPDFXFA_Document::GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) { wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); csTitle.ReleaseBuffer(csTitle.GetLength()); } -void CPDFXFA_Document::SetTitle(IXFA_Doc* hDoc, +void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle) { if (hDoc != m_pXFADoc) return; @@ -627,7 +631,7 @@ void CPDFXFA_Document::SetTitle(IXFA_Doc* hDoc, return; pInfoDict->SetAt("Title", new CPDF_String(wsTitle)); } -void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, +void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath, FX_BOOL bXDP) { if (hDoc != m_pXFADoc) @@ -658,7 +662,7 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, CFPDF_FileStream fileWrite(pFileHandler); - IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); + CXFA_FFDocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); CFX_ByteString content; if (fileType == FXFA_SAVEAS_XML) { content = "\r\n"; @@ -729,10 +733,10 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, // Ignoring flush error. } } -void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc, +void CPDFXFA_Document::ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath) {} -void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, +void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, const CFX_WideStringC& bsURL, FX_BOOL bAppend) { if (hDoc != m_pXFADoc) @@ -750,7 +754,7 @@ void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, pEnv->FFI_GotoURL(this, str, bAppend); } -FX_BOOL CPDFXFA_Document::IsValidationsEnabled(IXFA_Doc* hDoc) { +FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) { if (hDoc != m_pXFADoc || !m_pSDKDoc) return FALSE; if (m_pSDKDoc->GetInterForm()) @@ -758,13 +762,15 @@ FX_BOOL CPDFXFA_Document::IsValidationsEnabled(IXFA_Doc* hDoc) { return TRUE; } -void CPDFXFA_Document::SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) { +void CPDFXFA_Document::SetValidationsEnabled(CXFA_FFDoc* hDoc, + FX_BOOL bEnabled) { if (hDoc != m_pXFADoc || !m_pSDKDoc) return; if (m_pSDKDoc->GetInterForm()) m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled); } -void CPDFXFA_Document::SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) { +void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc, + CXFA_FFWidget* hWidget) { if (hDoc != m_pXFADoc) return; @@ -785,7 +791,7 @@ void CPDFXFA_Document::SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) { } } } -void CPDFXFA_Document::Print(IXFA_Doc* hDoc, +void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, int32_t nStartPage, int32_t nEndPage, uint32_t dwOptions) { @@ -809,7 +815,7 @@ void CPDFXFA_Document::Print(IXFA_Doc* hDoc, dwOptions & XFA_PRINTOPT_PrintAnnot); } -void CPDFXFA_Document::GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL) { +void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) { if (hDoc != m_pXFADoc) return; @@ -820,7 +826,7 @@ void CPDFXFA_Document::GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL) { pEnv->FFI_GetURL(this, wsDocURL); } -FX_ARGB CPDFXFA_Document::GetHighlightColor(IXFA_Doc* hDoc) { +FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) { if (hDoc != m_pXFADoc) return 0; if (m_pSDKDoc) { @@ -848,10 +854,10 @@ FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { return TRUE; if (m_pXFADocView == NULL) return TRUE; - IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); if (pWidgetHandler == NULL) return TRUE; - IXFA_WidgetAccIterator* pWidgetAccIterator = + CXFA_WidgetAccIterator* pWidgetAccIterator = m_pXFADocView->CreateWidgetAccIterator(); if (pWidgetAccIterator) { CXFA_EventParam Param; @@ -897,10 +903,10 @@ void CPDFXFA_Document::_OnAfterNotifySumbit() { return; if (m_pXFADocView == NULL) return; - IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); if (pWidgetHandler == NULL) return; - IXFA_WidgetAccIterator* pWidgetAccIterator = + CXFA_WidgetAccIterator* pWidgetAccIterator = m_pXFADocView->CreateWidgetAccIterator(); if (pWidgetAccIterator == NULL) return; @@ -916,7 +922,7 @@ void CPDFXFA_Document::_OnAfterNotifySumbit() { m_pXFADocView->UpdateDocView(); } -FX_BOOL CPDFXFA_Document::SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { +FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { if (!_NotifySubmit(TRUE)) return FALSE; if (NULL == m_pXFADocView) @@ -928,7 +934,7 @@ FX_BOOL CPDFXFA_Document::SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { return ret; } -IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(IXFA_Doc* hDoc, +IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); if (pEnv == NULL) @@ -949,7 +955,7 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, FPDF_DWORD flag) { if (NULL == m_pXFADocView) return FALSE; - IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); + CXFA_FFDocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); CFX_ByteString content; CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); @@ -1135,7 +1141,7 @@ FX_BOOL CPDFXFA_Document::_MailToInfo(CFX_WideString& csURL, return TRUE; } -FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { +FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { #ifdef PDF_ENABLE_XFA CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); if (!pEnv) @@ -1236,7 +1242,7 @@ FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { #endif } -FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc, +FX_BOOL CPDFXFA_Document::SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue) { if (hDoc != m_pXFADoc) @@ -1247,7 +1253,7 @@ FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc, hValue); return FALSE; } -FX_BOOL CPDFXFA_Document::GetPDFScriptObject(IXFA_Doc* hDoc, +FX_BOOL CPDFXFA_Document::GetPDFScriptObject(CXFA_FFDoc* hDoc, const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) { if (hDoc != m_pXFADoc) @@ -1264,7 +1270,7 @@ FX_BOOL CPDFXFA_Document::GetPDFScriptObject(IXFA_Doc* hDoc, return _GetHValueByName(utf8Name, hValue, m_pSDKDoc->GetEnv()->GetJSRuntime()); } -FX_BOOL CPDFXFA_Document::GetGlobalProperty(IXFA_Doc* hDoc, +FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue) { if (hDoc != m_pXFADoc) diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index 8c977635e7..dc4185af2d 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -12,6 +12,8 @@ #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index) : m_pPDFPage(NULL), @@ -66,15 +68,15 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage() { FX_BOOL CPDFXFA_Page::LoadXFAPageView() { if (!m_pDocument) return FALSE; - IXFA_Doc* pXFADoc = m_pDocument->GetXFADoc(); + CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc(); if (!pXFADoc) return FALSE; - IXFA_DocView* pXFADocView = m_pDocument->GetXFADocView(); + CXFA_FFDocView* pXFADocView = m_pDocument->GetXFADocView(); if (!pXFADocView) return FALSE; - IXFA_PageView* pPageView = pXFADocView->GetPageView(m_iPageIndex); + CXFA_FFPageView* pPageView = pXFADocView->GetPageView(m_iPageIndex); if (!pPageView) return FALSE; diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index f32c87cf1f..b89a63696c 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -76,7 +76,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, } #ifdef PDF_ENABLE_XFA -CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, +CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView) { ASSERT(pAnnot); ASSERT(pPageView); @@ -383,7 +383,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, return NULL; if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); - IXFA_Widget* hNextFocus = NULL; + CXFA_FFWidget* hNextFocus = NULL; hNextFocus = bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); if (!hNextFocus && pSDKAnnot) @@ -439,7 +439,7 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, } #ifdef PDF_ENABLE_XFA -CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, +CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget, CPDFSDK_PageView* pPage) { return NULL; } @@ -734,7 +734,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) : m_pApp(pApp) {} -CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(IXFA_Widget* pAnnot, +CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPage) { CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); @@ -756,7 +756,7 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, ASSERT(pAnnot != NULL); CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); CFX_Graphics gs; gs.Create(pDevice); @@ -785,7 +785,7 @@ CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot); - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); CFX_RectF rcBBox; XFA_ELEMENT eType = pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); @@ -819,11 +819,11 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, if (!pDoc) return FALSE; - IXFA_DocView* pDocView = pDoc->GetXFADocView(); + CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); if (!pDocView) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); if (!pWidgetHandler) return FALSE; @@ -837,7 +837,7 @@ void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, uint32_t nFlag) { if (!pPageView || !pAnnot) return; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget()); } @@ -847,7 +847,7 @@ void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); } @@ -858,7 +858,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -870,7 +870,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -882,7 +882,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -894,7 +894,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -907,7 +907,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnMouseWheel( pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); } @@ -919,7 +919,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -931,7 +931,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -943,7 +943,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, if (!pPageView || !pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } @@ -954,7 +954,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, if (!pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, GetFWLFlags(nFlags)); } @@ -965,7 +965,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, if (!pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFlags(nFlag)); } @@ -976,7 +976,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, if (!pAnnot) return FALSE; - IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); + CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFlags(nFlag)); } @@ -993,7 +993,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot) { - IXFA_WidgetHandler* pWidgetHandler = NULL; + CXFA_FFWidgetHandler* pWidgetHandler = NULL; if (pOldAnnot) pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); @@ -1002,9 +1002,9 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, if (pWidgetHandler) { FX_BOOL bRet = TRUE; - IXFA_Widget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; + CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; if (hWidget) { - IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); + CXFA_FFPageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); if (pXFAPageView) { bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) @@ -1017,7 +1017,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, return TRUE; } -IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( +CXFA_FFWidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( CPDFSDK_Annot* pAnnot) { if (!pAnnot) return NULL; @@ -1034,7 +1034,7 @@ IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler( if (!pDoc) return NULL; - IXFA_DocView* pDocView = pDoc->GetXFADocView(); + CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); if (!pDocView) return NULL; diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index 9b21880d05..f22111ce73 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -52,12 +52,12 @@ CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_Widget::~CPDFSDK_Widget() {} #ifdef PDF_ENABLE_XFA -IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { +CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { if (!m_hMixXFAWidget) { - if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { + if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { CFX_WideString sName; if (GetFieldType() == FIELDTYPE_RADIOBUTTON) { sName = GetAnnotName(); @@ -77,11 +77,11 @@ IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { return NULL; } -IXFA_Widget* CPDFSDK_Widget::GetGroupMixXFAWidget() { +CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { - if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { + if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { CFX_WideString sName = GetName(); if (!sName.IsEmpty()) return pDocView->GetWidgetByName(sName); @@ -91,12 +91,12 @@ IXFA_Widget* CPDFSDK_Widget::GetGroupMixXFAWidget() { return nullptr; } -IXFA_WidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { +CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { if (!m_pWidgetHandler) { - if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { + if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { m_pWidgetHandler = pDocView->GetWidgetHandler(); } } @@ -182,13 +182,13 @@ static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT, } FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && GetFieldType() == FIELDTYPE_RADIOBUTTON) { - if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) { + if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget); if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) return TRUE; @@ -210,11 +210,11 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, CPDFSDK_PageView* pPageView) { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); if (eEventType != XFA_EVENT_Unknown) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { CXFA_EventParam param; param.m_eType = eEventType; param.m_wsChange = data.sChange; @@ -235,7 +235,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && GetFieldType() == FIELDTYPE_RADIOBUTTON) { - if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) { + if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget); param.m_pTarget = pAcc; if (pXFAWidgetHandler->ProcessEvent(pAcc, ¶m) != @@ -248,7 +248,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, param.m_pTarget = pAcc; int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); - if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { + if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { pDocView->UpdateDocView(); } return nRet == XFA_EVENTERROR_Success; @@ -260,8 +260,8 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, } void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { CPDF_FormField* pFormField = GetFormField(); if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { switch (GetFieldType()) { @@ -310,11 +310,11 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { void CPDFSDK_Widget::SynchronizeXFAValue() { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); - IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); + CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView(); if (!pXFADocView) return; - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (GetXFAWidgetHandler()) { CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(), GetFormControl()); @@ -325,23 +325,24 @@ void CPDFSDK_Widget::SynchronizeXFAValue() { void CPDFSDK_Widget::SynchronizeXFAItems() { CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); - IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); + CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView(); if (!pXFADocView) return; - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (GetXFAWidgetHandler()) SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr); } } -void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView, - IXFA_Widget* hWidget, +void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, + CXFA_FFWidget* hWidget, CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) { ASSERT(hWidget); - if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = + pXFADocView->GetWidgetHandler()) { ASSERT(pFormControl); switch (pFormField->GetFieldType()) { @@ -407,13 +408,14 @@ void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView, } } -void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView, - IXFA_Widget* hWidget, +void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, + CXFA_FFWidget* hWidget, CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) { ASSERT(hWidget); - if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = + pXFADocView->GetWidgetHandler()) { switch (pFormField->GetFieldType()) { case FIELDTYPE_LISTBOX: { pFormField->ClearSelection(FALSE); @@ -592,8 +594,8 @@ FX_FLOAT CPDFSDK_Widget::GetFontSize() const { int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { #ifdef PDF_ENABLE_XFA - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + 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); @@ -607,8 +609,8 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { #ifdef PDF_ENABLE_XFA CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + 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 @@ -641,8 +643,8 @@ int CPDFSDK_Widget::CountOptions() const { FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { #ifdef PDF_ENABLE_XFA - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + 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); @@ -663,8 +665,8 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const { bool CPDFSDK_Widget::IsChecked() const { #ifdef PDF_ENABLE_XFA - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; } @@ -1875,11 +1877,11 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, #ifdef PDF_ENABLE_XFA CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); - if (IXFA_Widget* hWidget = GetMixXFAWidget()) { + if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); if (eEventType != XFA_EVENT_Unknown) { - if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { + if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { CXFA_EventParam param; param.m_eType = eEventType; param.m_wsChange = data.sChange; @@ -1902,7 +1904,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, param.m_pTarget = pAcc; int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); - if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { + if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { pDocView->UpdateDocView(); } @@ -1983,7 +1985,7 @@ FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { } #ifdef PDF_ENABLE_XFA -CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, +CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm) : CPDFSDK_Annot(pPageView), @@ -2002,8 +2004,8 @@ CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const { CPDFSDK_PageView* pPageView = GetPageView(); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); - IXFA_DocView* pDocView = pDoc->GetXFADocView(); - IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); + CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); + CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); CFX_RectF rcBBox; pWidgetHandler->GetRect(GetXFAWidget(), rcBBox); @@ -2150,16 +2152,16 @@ FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const { } #ifdef PDF_ENABLE_XFA -void CPDFSDK_InterForm::AddXFAMap(IXFA_Widget* hWidget, +void CPDFSDK_InterForm::AddXFAMap(CXFA_FFWidget* hWidget, CPDFSDK_XFAWidget* pWidget) { m_XFAMap.SetAt(hWidget, pWidget); } -void CPDFSDK_InterForm::RemoveXFAMap(IXFA_Widget* hWidget) { +void CPDFSDK_InterForm::RemoveXFAMap(CXFA_FFWidget* hWidget) { m_XFAMap.RemoveKey(hWidget); } -CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) { +CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(CXFA_FFWidget* hWidget) { CPDFSDK_XFAWidget* pWidget = NULL; m_XFAMap.Lookup(hWidget, pWidget); diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index b318b0a9db..323128c9fe 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -24,6 +24,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_rendercontext.h" #endif // PDF_ENABLE_XFA #if _FX_OS_ == _FX_ANDROID_ @@ -702,17 +703,15 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, static_cast(pClip.Width()), static_cast(pClip.Height())); gs.SetClipRect(rectClip); - IXFA_RenderContext* pRenderContext = XFA_RenderContext_Create(); - if (!pRenderContext) - return; + CXFA_RenderContext* pRenderContext = new CXFA_RenderContext; CXFA_RenderOptions renderOptions; renderOptions.m_bHighlight = TRUE; - IXFA_PageView* xfaView = pPage->GetXFAPageView(); + CXFA_FFPageView* xfaView = pPage->GetXFAPageView(); pRenderContext->StartRender(xfaView, &gs, *pUser2Device, renderOptions); pRenderContext->DoRender(); pRenderContext->StopRender(); pRenderContext->Release(); - IXFA_DocView* docView = xfaView->GetDocView(); + CXFA_FFDocView* docView = xfaView->GetDocView(); if (!docView) return; CPDFSDK_Annot* annot = GetFocusAnnot(); @@ -821,7 +820,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot* pPDFAnnot) { } #ifdef PDF_ENABLE_XFA -CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(IXFA_Widget* pPDFAnnot) { +CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { if (!pPDFAnnot) return nullptr; @@ -914,7 +913,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary* pDict) { } #ifdef PDF_ENABLE_XFA -CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(IXFA_Widget* hWidget) { +CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { if (!hWidget) return nullptr; @@ -1087,7 +1086,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { #ifdef PDF_ENABLE_XFA m_page->AddRef(); if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { - IXFA_PageView* pageView = m_page->GetXFAPageView(); + CXFA_FFPageView* pageView = m_page->GetXFAPageView(); IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | XFA_WIDGETFILTER_Viewable | @@ -1098,7 +1097,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { return; } - while (IXFA_Widget* pXFAAnnot = pWidgetHander->MoveToNext()) { + while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); if (!pAnnot) continue; diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h index f96ed3b177..ed626716f7 100644 --- a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h +++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h @@ -21,7 +21,7 @@ class CPDFXFA_App : public IXFA_AppProvider { ~CPDFXFA_App() override; FX_BOOL Initialize(FXJSE_HRUNTIME hRuntime); - IXFA_App* GetXFAApp() { return m_pXFAApp; } + CXFA_FFApp* GetXFAApp() { return m_pXFAApp; } FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv); FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv); @@ -88,8 +88,7 @@ class CPDFXFA_App : public IXFA_AppProvider { static CPDFXFA_App* g_pApp; FX_BOOL m_bJavaScriptInitialized; - IXFA_App* m_pXFAApp; - IXFA_FontMgr* m_pFontMgr; + CXFA_FFApp* m_pXFAApp; FXJSE_HRUNTIME m_hJSERuntime; IFXJS_Runtime* m_pJSRuntime; CFX_WideString m_csAppType; diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h index 98ed6fdbe4..6d501317d6 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_ffdochandler.h" class CPDFXFA_App; class CPDFXFA_Document; @@ -19,7 +20,7 @@ class CPDFSDK_Document; class CPDFDoc_Environment; class IJS_Runtime; class IJS_Context; -class IXFA_DocHandler; +class CXFA_FFDocHandler; class CPDFXFA_Document : public IXFA_DocProvider { public: @@ -29,12 +30,12 @@ class CPDFXFA_Document : public IXFA_DocProvider { FX_BOOL LoadXFADoc(); CPDFXFA_App* GetApp() { return m_pApp; } CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } - IXFA_Doc* GetXFADoc() { return m_pXFADoc; } - IXFA_DocView* GetXFADocView() { return m_pXFADocView; } + CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; } + CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } int GetPageCount(); CPDFXFA_Page* GetPage(int page_index); - CPDFXFA_Page* GetPage(IXFA_PageView* pPage); + CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); void DeletePage(int page_index); void RemovePage(CPDFXFA_Page* page); @@ -44,39 +45,39 @@ class CPDFXFA_Document : public IXFA_DocProvider { void FXRect2PDFRect(const CFX_RectF& fxRectF, CFX_FloatRect& pdfRect); - virtual void SetChangeMark(IXFA_Doc* hDoc); - virtual FX_BOOL GetChangeMark(IXFA_Doc* hDoc); + virtual void SetChangeMark(CXFA_FFDoc* hDoc); + virtual FX_BOOL GetChangeMark(CXFA_FFDoc* hDoc); // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. - virtual void InvalidateRect(IXFA_PageView* pPageView, + virtual void InvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rt, uint32_t dwFlags = 0); // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. - virtual void InvalidateRect(IXFA_Widget* hWidget, uint32_t dwFlags = 0); + virtual void InvalidateRect(CXFA_FFWidget* hWidget, uint32_t dwFlags = 0); // show or hide caret - virtual void DisplayCaret(IXFA_Widget* hWidget, + virtual void DisplayCaret(CXFA_FFWidget* hWidget, FX_BOOL bVisible, const CFX_RectF* pRtAnchor); // dwPos: (0:bottom 1:top) - virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget, + virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, FX_FLOAT fMinPopup, FX_FLOAT fMaxPopup, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); - virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget, + virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup, const CFX_RectF* pRectExclude = NULL); // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing - virtual void PageViewEvent(IXFA_PageView* pPageView, uint32_t dwFlags); + virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags); // dwEvent refer to XFA_WIDGETEVENT_XXX - virtual void WidgetEvent(IXFA_Widget* hWidget, + virtual void WidgetEvent(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData, uint32_t dwEvent, void* pParam = NULL, void* pAdditional = NULL); // return true if render it. - virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget, + virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, const CFX_RectF& rtUI) { @@ -84,44 +85,44 @@ class CPDFXFA_Document : public IXFA_DocProvider { } // host method - virtual int32_t CountPages(IXFA_Doc* hDoc); - virtual int32_t GetCurrentPage(IXFA_Doc* hDoc); - virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage); - virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc); - virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled); - virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle); - virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle); - virtual void ExportData(IXFA_Doc* hDoc, + virtual int32_t CountPages(CXFA_FFDoc* hDoc); + virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc); + virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage); + virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc); + virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled); + virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle); + virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle); + virtual void ExportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath, FX_BOOL bXDP = TRUE); - virtual void ImportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath); - virtual void GotoURL(IXFA_Doc* hDoc, + virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath); + virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideStringC& bsURL, FX_BOOL bAppend = TRUE); - virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc); - virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled); - virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget); - virtual void Print(IXFA_Doc* hDoc, + virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc); + virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled); + virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget); + virtual void Print(CXFA_FFDoc* hDoc, int32_t nStartPage, int32_t nEndPage, uint32_t dwOptions); // LayoutPseudo method - virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc) { return 0; } - virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) { + virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) { return 0; } + virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { return 0; } - virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc) { return 0; } - virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) { + virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) { return 0; } + virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { return 0; } - virtual int32_t Verify(IXFA_Doc* hDoc, + virtual int32_t Verify(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, FX_BOOL bUsed = TRUE) { return 0; } - virtual FX_BOOL Sign(IXFA_Doc* hDoc, + virtual FX_BOOL Sign(CXFA_FFDoc* hDoc, CXFA_NodeList* pNodeList, const CFX_WideStringC& wsExpression, const CFX_WideStringC& wsXMLIdent, @@ -129,16 +130,16 @@ class CPDFXFA_Document : public IXFA_DocProvider { FX_BOOL bUsed = TRUE) { return 0; } - virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) { return 0; } - virtual FX_BOOL Clear(IXFA_Doc* hDoc, + virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; } + virtual FX_BOOL Clear(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, FX_BOOL bCleared = TRUE) { return 0; } // Get document path - virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL); - virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc); + virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL); + virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc); /** *Submit data to email, http, ftp. @@ -152,35 +153,35 @@ class CPDFXFA_Document : public IXFA_DocProvider { * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted *content or not. */ - virtual FX_BOOL SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit); + virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); - virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord) { + virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) { return FALSE; } - virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc, + virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord, std::vector& sSuggest) { return FALSE; } // Get PDF javascript object, set the object to hValue. - virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc, + virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue); - virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc, + virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue); - virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc, + virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue); - virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc, + virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, IFX_FileRead* pFile, FX_BOOL bTakeOverFile) { return NULL; } - virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc, + virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink); FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name, @@ -189,7 +190,7 @@ class CPDFXFA_Document : public IXFA_DocProvider { FX_BOOL _OnBeforeNotifySumbit(); void _OnAfterNotifySumbit(); FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost); - FX_BOOL _SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit); + FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); FX_BOOL _MailToInfo(CFX_WideString& csURL, CFX_WideString& csToAddress, CFX_WideString& csCCAddress, @@ -211,7 +212,7 @@ class CPDFXFA_Document : public IXFA_DocProvider { FXFA_LOADSTATUS_CLOSING, FXFA_LOADSTATUS_CLOSED }; - void CloseXFADoc(IXFA_DocHandler* pDoc) { + void CloseXFADoc(CXFA_FFDocHandler* pDoc) { if (pDoc) { pDoc->CloseDoc(m_pXFADoc); pDoc->ReleaseDoc(m_pXFADoc); @@ -223,8 +224,8 @@ class CPDFXFA_Document : public IXFA_DocProvider { int m_iDocType; CPDF_Document* m_pPDFDoc; CPDFSDK_Document* m_pSDKDoc; - IXFA_Doc* m_pXFADoc; - IXFA_DocView* m_pXFADocView; + CXFA_FFDoc* m_pXFADoc; + CXFA_FFDocView* m_pXFADocView; CPDFXFA_App* m_pApp; IJS_Context* m_pJSContext; CFX_ArrayTemplate m_XFAPageList; diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h index d686fe9bae..20da040a23 100644 --- a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h +++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h @@ -14,7 +14,7 @@ class CPDFXFA_Document; class CPDF_Page; -class IXFA_PageView; +class CXFA_FFPageView; class CPDFXFA_Page { public: @@ -28,8 +28,10 @@ class CPDFXFA_Page { CPDFXFA_Document* GetDocument() { return m_pDocument; } int GetPageIndex() { return m_iPageIndex; } CPDF_Page* GetPDFPage() { return m_pPDFPage; } - IXFA_PageView* GetXFAPageView() { return m_pXFAPageView; } - void SetXFAPageView(IXFA_PageView* pPageView) { m_pXFAPageView = pPageView; } + CXFA_FFPageView* GetXFAPageView() { return m_pXFAPageView; } + void SetXFAPageView(CXFA_FFPageView* pPageView) { + m_pXFAPageView = pPageView; + } FX_FLOAT GetPageWidth(); FX_FLOAT GetPageHeight(); @@ -66,7 +68,7 @@ class CPDFXFA_Page { private: CPDF_Page* m_pPDFPage; - IXFA_PageView* m_pXFAPageView; + CXFA_FFPageView* m_pXFAPageView; int m_iPageIndex; CPDFXFA_Document* m_pDocument; int m_iRef; diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h index 637fdfc387..e810a7e504 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -15,6 +15,9 @@ #ifdef PDF_ENABLE_XFA #include "xfa/include/fxfa/fxfa.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" #endif // PDF_ENABLE_XFA @@ -42,7 +45,7 @@ class IPDFSDK_AnnotHandler { CPDFSDK_PageView* pPage) = 0; #ifdef PDF_ENABLE_XFA - virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, + virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, CPDFSDK_PageView* pPage) = 0; #endif // PDF_ENABLE_XFA @@ -148,7 +151,7 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; #ifdef PDF_ENABLE_XFA - CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, + CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, CPDFSDK_PageView* pPage) override; #endif // PDF_ENABLE_XFA void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; @@ -255,7 +258,8 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { return NULL; } - virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPage); + virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, + CPDFSDK_PageView* pPage); virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); @@ -345,7 +349,7 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { CPDFSDK_Annot* pNewAnnot); private: - IXFA_WidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); + CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); uint32_t GetFWLFlags(uint32_t dwFlag); private: @@ -367,7 +371,7 @@ class CPDFSDK_AnnotHandlerMgr { virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); #ifdef PDF_ENABLE_XFA - virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, + virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView); #endif // PDF_ENABLE_XFA virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index dc2c1a9691..a8f4a67381 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -83,7 +83,7 @@ class CPDFSDK_Annot { virtual CPDF_Annot* GetPDFAnnot() const { return nullptr; } #ifdef PDF_ENABLE_XFA - virtual IXFA_Widget* GetXFAWidget() const { return nullptr; } + virtual CXFA_FFWidget* GetXFAWidget() const { return nullptr; } #endif // PDF_ENABLE_XFA virtual CFX_ByteString GetType() const { return ""; } diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index aa96215d1c..06f0666c81 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -15,6 +15,10 @@ #include "core/include/fxge/fx_dib.h" #include "fpdfsdk/include/fsdk_baseannot.h" +#ifdef PDF_ENABLE_XFA +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" +#endif // PDF_ENABLE_XFA + #if _FX_OS_ == _FX_ANDROID_ #include "time.h" #else @@ -67,9 +71,9 @@ struct PDFSDK_FieldAction { class CPDFSDK_Widget : public CPDFSDK_BAAnnot { public: #ifdef PDF_ENABLE_XFA - IXFA_Widget* GetMixXFAWidget() const; - IXFA_Widget* GetGroupMixXFAWidget(); - IXFA_WidgetHandler* GetXFAWidgetHandler() const; + CXFA_FFWidget* GetMixXFAWidget() const; + CXFA_FFWidget* GetGroupMixXFAWidget(); + CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, @@ -80,12 +84,12 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { void SynchronizeXFAValue(); void SynchronizeXFAItems(); - static void SynchronizeXFAValue(IXFA_DocView* pXFADocView, - IXFA_Widget* hWidget, + static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, + CXFA_FFWidget* hWidget, CPDF_FormField* pFormField, CPDF_FormControl* pFormControl); - static void SynchronizeXFAItems(IXFA_DocView* pXFADocView, - IXFA_Widget* hWidget, + static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, + CXFA_FFWidget* hWidget, CPDF_FormField* pFormField, CPDF_FormControl* pFormControl); #endif // PDF_ENABLE_XFA @@ -214,21 +218,21 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { int32_t m_nValueAge; #ifdef PDF_ENABLE_XFA - mutable IXFA_Widget* m_hMixXFAWidget; - mutable IXFA_WidgetHandler* m_pWidgetHandler; + mutable CXFA_FFWidget* m_hMixXFAWidget; + mutable CXFA_FFWidgetHandler* m_pWidgetHandler; #endif // PDF_ENABLE_XFA }; #ifdef PDF_ENABLE_XFA class CPDFSDK_XFAWidget : public CPDFSDK_Annot { public: - CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, + CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm); ~CPDFSDK_XFAWidget() override {} FX_BOOL IsXFAField() override; - IXFA_Widget* GetXFAWidget() const override { return m_hXFAWidget; } + CXFA_FFWidget* GetXFAWidget() const override { return m_hXFAWidget; } CFX_ByteString GetType() const override; CFX_ByteString GetSubType() const override { return ""; } CFX_FloatRect GetRect() const override; @@ -237,10 +241,10 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot { private: CPDFSDK_InterForm* m_pInterForm; - IXFA_Widget* m_hXFAWidget; + CXFA_FFWidget* m_hXFAWidget; }; #define CPDFSDK_XFAWidgetMap \ - CFX_MapPtrTemplate + CFX_MapPtrTemplate #define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate #endif // PDF_ENABLE_XFA @@ -268,9 +272,9 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { FX_BOOL IsCalculateEnabled() const; #ifdef PDF_ENABLE_XFA - void AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget); - void RemoveXFAMap(IXFA_Widget* hWidget); - CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget); + void AddXFAMap(CXFA_FFWidget* hWidget, CPDFSDK_XFAWidget* pWidget); + void RemoveXFAMap(CXFA_FFWidget* hWidget); + CPDFSDK_XFAWidget* GetXFAWidget(CXFA_FFWidget* hWidget); void XfaEnableCalculate(FX_BOOL bEnabled); FX_BOOL IsXfaCalculateEnabled() const; FX_BOOL IsXfaValidationsEnabled(); diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 4bc5a7f916..39edc38f57 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -587,8 +587,8 @@ class CPDFSDK_PageView final { CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); #ifdef PDF_ENABLE_XFA - CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot); - CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget); + CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot); + CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget); CPDFXFA_Page* GetPDFXFAPage() { return m_page; } CPDF_Page* GetPDFPage(); #else diff --git a/xfa.gyp b/xfa.gyp index 997ac88331..ed42d7d3e0 100644 --- a/xfa.gyp +++ b/xfa.gyp @@ -39,6 +39,15 @@ "xfa/include/fxfa/fxfa_basic.h", "xfa/include/fxfa/fxfa_objectacc.h", "xfa/include/fxfa/fxfa_widget.h", + "xfa/include/fxfa/xfa_checksum.h", + "xfa/include/fxfa/xfa_ffapp.h", + "xfa/include/fxfa/xfa_ffdoc.h", + "xfa/include/fxfa/xfa_ffdochandler.h", + "xfa/include/fxfa/xfa_ffdocview.h", + "xfa/include/fxfa/xfa_ffpageview.h", + "xfa/include/fxfa/xfa_ffwidgethandler.h", + "xfa/include/fxfa/xfa_fontmgr.h", + "xfa/include/fxfa/xfa_rendercontext.h", "xfa/fde/css/fde_css.h", "xfa/fde/css/fde_csscache.cpp", "xfa/fde/css/fde_csscache.h", @@ -548,9 +557,7 @@ "xfa/fxbarcode/BC_Writer.h", "xfa/fxbarcode/utils.h", "xfa/fxfa/app/xfa_checksum.cpp", - "xfa/fxfa/app/xfa_checksum.h", "xfa/fxfa/app/xfa_ffapp.cpp", - "xfa/fxfa/app/xfa_ffapp.h", "xfa/fxfa/app/xfa_ffbarcode.cpp", "xfa/fxfa/app/xfa_ffbarcode.h", "xfa/fxfa/app/xfa_ffcheckbutton.cpp", @@ -558,11 +565,8 @@ "xfa/fxfa/app/xfa_ffchoicelist.cpp", "xfa/fxfa/app/xfa_ffchoicelist.h", "xfa/fxfa/app/xfa_ffdoc.cpp", - "xfa/fxfa/app/xfa_ffdoc.h", "xfa/fxfa/app/xfa_ffdochandler.cpp", - "xfa/fxfa/app/xfa_ffdochandler.h", "xfa/fxfa/app/xfa_ffdocview.cpp", - "xfa/fxfa/app/xfa_ffdocview.h", "xfa/fxfa/app/xfa_ffdraw.cpp", "xfa/fxfa/app/xfa_ffdraw.h", "xfa/fxfa/app/xfa_ffexclgroup.cpp", @@ -576,7 +580,6 @@ "xfa/fxfa/app/xfa_ffnotify.cpp", "xfa/fxfa/app/xfa_ffnotify.h", "xfa/fxfa/app/xfa_ffpageview.cpp", - "xfa/fxfa/app/xfa_ffpageview.h", "xfa/fxfa/app/xfa_ffpath.cpp", "xfa/fxfa/app/xfa_ffpath.h", "xfa/fxfa/app/xfa_ffpushbutton.cpp", @@ -594,15 +597,12 @@ "xfa/fxfa/app/xfa_ffwidgetacc.cpp", "xfa/fxfa/app/xfa_ffwidgetacc.h", "xfa/fxfa/app/xfa_ffwidgethandler.cpp", - "xfa/fxfa/app/xfa_ffwidgethandler.h", "xfa/fxfa/app/xfa_fontmgr.cpp", - "xfa/fxfa/app/xfa_fontmgr.h", "xfa/fxfa/app/xfa_fwladapter.cpp", "xfa/fxfa/app/xfa_fwladapter.h", "xfa/fxfa/app/xfa_fwltheme.cpp", "xfa/fxfa/app/xfa_fwltheme.h", "xfa/fxfa/app/xfa_rendercontext.cpp", - "xfa/fxfa/app/xfa_rendercontext.h", "xfa/fxfa/app/xfa_textlayout.cpp", "xfa/fxfa/app/xfa_textlayout.h", "xfa/fxfa/fm2js/xfa_error.cpp", diff --git a/xfa/DEPS b/xfa/DEPS index 560dfc9733..ef5e5b9d06 100644 --- a/xfa/DEPS +++ b/xfa/DEPS @@ -1,5 +1,6 @@ include_rules = [ '+core/include', '+core/fxcrt/include', + '+core/fpdfapi/fpdf_parser/include', '+third_party/bigint' ] diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index e60650f450..08e44f13dd 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -27,9 +27,9 @@ #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/fwl_widgetmgrimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" // static IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties, diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 4d2bdfc401..aac5456b63 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_checksum.h" #include "core/fdrm/crypto/include/fx_crypt.h" #include "xfa/fgas/crt/fgas_algorithm.h" @@ -124,9 +124,7 @@ void CXFA_SAXReaderHandler::UpdateChecksum(FX_BOOL bCheckSpace) { } m_SAXContext.m_TextBuf.Clear(); } -IXFA_ChecksumContext* XFA_Checksum_Create() { - return new CXFA_ChecksumContext; -} + CXFA_ChecksumContext::CXFA_ChecksumContext() : m_pSAXReader(NULL), m_pByteContext(NULL) {} CXFA_ChecksumContext::~CXFA_ChecksumContext() { diff --git a/xfa/fxfa/app/xfa_checksum.h b/xfa/fxfa/app/xfa_checksum.h deleted file mode 100644 index c997dc76fa..0000000000 --- a/xfa/fxfa/app/xfa_checksum.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_CHECKSUM_H_ -#define XFA_FXFA_APP_XFA_CHECKSUM_H_ - -#include "xfa/fgas/xml/fgas_sax.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_SAXReaderHandler; -class CXFA_ChecksumContext; - -class CXFA_SAXContext { - public: - CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {} - CFX_ByteTextBuf m_TextBuf; - CFX_ByteString m_bsTagName; - FX_SAXNODE m_eNode; -}; -class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler { - public: - CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext); - virtual ~CXFA_SAXReaderHandler(); - virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName, - FX_SAXNODE eType, - uint32_t dwStartPos); - virtual void OnTagAttribute(void* pTag, - const CFX_ByteStringC& bsAttri, - const CFX_ByteStringC& bsValue); - virtual void OnTagBreak(void* pTag); - virtual void OnTagData(void* pTag, - FX_SAXNODE eType, - const CFX_ByteStringC& bsData, - uint32_t dwStartPos); - virtual void OnTagClose(void* pTag, uint32_t dwEndPos); - virtual void OnTagEnd(void* pTag, - const CFX_ByteStringC& bsTagName, - uint32_t dwEndPos); - - virtual void OnTargetData(void* pTag, - FX_SAXNODE eType, - const CFX_ByteStringC& bsData, - uint32_t dwStartPos); - - protected: - void UpdateChecksum(FX_BOOL bCheckSpace); - CXFA_ChecksumContext* m_pContext; - CXFA_SAXContext m_SAXContext; -}; - -class CXFA_ChecksumContext : public IXFA_ChecksumContext { - public: - CXFA_ChecksumContext(); - virtual ~CXFA_ChecksumContext(); - virtual void Release() { delete this; } - virtual FX_BOOL StartChecksum(); - virtual FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, - FX_FILESIZE offset = 0, - size_t size = 0); - virtual void FinishChecksum(); - virtual void GetChecksum(CFX_ByteString& bsChecksum); - void Update(const CFX_ByteStringC& bsText); - - protected: - IFX_SAXReader* m_pSAXReader; - uint8_t* m_pByteContext; - CFX_ByteString m_bsChecksum; -}; - -#endif // XFA_FXFA_APP_XFA_CHECKSUM_H_ diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 1fdcc25563..4d3d707998 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -4,17 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" #include #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdochandler.h" -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_fwltheme.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdochandler.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate& streams) { int32_t iCount = streams.GetSize(); @@ -61,12 +61,7 @@ FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, } return FALSE; } -// static -IXFA_App* IXFA_App::Create(IXFA_AppProvider* pProvider) { - return new CXFA_FFApp(pProvider); -} -// virtual -IXFA_App::~IXFA_App() {} + CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pDocHandler(nullptr), m_pFWLTheme(nullptr), @@ -83,7 +78,7 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) m_pFWLApp = IFWL_App::Create(this); FWL_SetApp(m_pFWLApp); m_pFWLApp->Initialize(); - IXFA_TimeZoneProvider::Create(); + CXFA_TimeZoneProvider::Create(); } CXFA_FFApp::~CXFA_FFApp() { delete m_pDocHandler; @@ -97,7 +92,7 @@ CXFA_FFApp::~CXFA_FFApp() { delete m_pAdapterWidgetMgr; delete m_pAdapterThreadMgr; delete m_pMenuHandler; - IXFA_TimeZoneProvider::Destroy(); + CXFA_TimeZoneProvider::Destroy(); delete m_pFontMgr; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (m_pFontSource) @@ -106,21 +101,21 @@ CXFA_FFApp::~CXFA_FFApp() { if (m_pFDEFontMgr) m_pFDEFontMgr->Release(); } -IXFA_MenuHandler* CXFA_FFApp::GetMenuHandler() { +CXFA_FFMenuHandler* CXFA_FFApp::GetMenuHandler() { if (!m_pMenuHandler) { m_pMenuHandler = new CXFA_FFMenuHandler; } return m_pMenuHandler; } -IXFA_DocHandler* CXFA_FFApp::GetDocHandler() { +CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { if (!m_pDocHandler) { m_pDocHandler = new CXFA_FFDocHandler; } return m_pDocHandler; } -IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, - IFX_FileRead* pStream, - FX_BOOL bTakeOverFile) { +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, + IFX_FileRead* pStream, + FX_BOOL bTakeOverFile) { CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); if (!bSuccess) { @@ -129,8 +124,8 @@ IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, } return pDoc; } -IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, - CPDF_Document* pPDFDoc) { +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, + CPDF_Document* pPDFDoc) { if (pPDFDoc == NULL) { return NULL; } @@ -143,7 +138,7 @@ IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, return pDoc; } -void CXFA_FFApp::SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) { +void CXFA_FFApp::SetDefaultFontMgr(CXFA_DefFontMgr* pFontMgr) { if (!m_pFontMgr) { m_pFontMgr = new CXFA_FontMgr(); } diff --git a/xfa/fxfa/app/xfa_ffapp.h b/xfa/fxfa/app/xfa_ffapp.h deleted file mode 100644 index c6c32868b4..0000000000 --- a/xfa/fxfa/app/xfa_ffapp.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFAPP_H_ -#define XFA_FXFA_APP_XFA_FFAPP_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "xfa/fgas/font/fgas_font.h" -#include "xfa/fwl/core/fwl_sdadapterimp.h" -#include "xfa/fwl/core/ifwl_adapternative.h" -#include "xfa/fwl/core/ifwl_app.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FWLAdapterWidgetMgr; -class CXFA_FWLTheme; -class CXFA_FFDocHandler; -class CXFA_FFMenuHandler; -class CXFA_FontMgr; - -class CXFA_FileRead : public IFX_FileRead { - public: - explicit CXFA_FileRead(const CFX_ArrayTemplate& streams); - - virtual FX_FILESIZE GetSize(); - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); - - virtual void Release() { delete this; } - - protected: - CFX_ObjectArray m_Data; -}; - -class CXFA_FFApp : public IXFA_App, public IFWL_AdapterNative { - public: - CXFA_FFApp(IXFA_AppProvider* pProvider); - ~CXFA_FFApp() override; - - // IFXFA_App: - IXFA_DocHandler* GetDocHandler() override; - IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - IFX_FileRead* pStream, - FX_BOOL bTakeOverFile) override; - IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - CPDF_Document* pPDFDoc) override; - IXFA_AppProvider* GetAppProvider() override { return m_pProvider; } - void SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) override; - IXFA_MenuHandler* GetMenuHandler() override; - - // IFWL_AdapterNative: - IFWL_AdapterWidgetMgr* GetWidgetMgr( - IFWL_WidgetMgrDelegate* pDelegate) override; - IFWL_AdapterThreadMgr* GetThreadMgr() override; - IFWL_AdapterTimerMgr* GetTimerMgr() override; - - CXFA_FontMgr* GetXFAFontMgr(); - IFX_FontMgr* GetFDEFontMgr(); - CXFA_FWLTheme* GetFWLTheme(); - IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() { - return m_pWidgetMgrDelegate; - } - - protected: - CXFA_FFDocHandler* m_pDocHandler; - IFWL_App* m_pFWLApp; - CXFA_FWLTheme* m_pFWLTheme; - IXFA_AppProvider* m_pProvider; - CXFA_FontMgr* m_pFontMgr; -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - IFX_FontSourceEnum* m_pFontSource; -#endif - CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr; - IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; - IFX_FontMgr* m_pFDEFontMgr; - CXFA_FFMenuHandler* m_pMenuHandler; - CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr; -}; - -#endif // XFA_FXFA_APP_XFA_FFAPP_H_ diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index daa94912fc..80def6c334 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -11,10 +11,10 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_barcode.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" namespace { diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index 77d8ba840a..8a32e8df51 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -8,8 +8,8 @@ #define XFA_FXFA_APP_XFA_FFBARCODE_H_ #include "xfa/fxbarcode/include/BC_Library.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_fftextedit.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFBarcode : public CXFA_FFTextEdit { public: diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index fdf7d7829d..0e56ca612c 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -10,13 +10,13 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_checkbox.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index 5eeb3e86a8..2e169041d7 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -8,7 +8,7 @@ #define XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_ #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFCheckButton : public CXFA_FFField { public: diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 9017f68597..bba1a7ec64 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -11,12 +11,12 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_combobox.h" #include "xfa/fwl/lightwidget/cfwl_listbox.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index 3d8863c066..580bb8f647 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -8,7 +8,7 @@ #define XFA_FXFA_APP_XFA_FFCHOICELIST_H_ #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFListBox : public CXFA_FFField { public: diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 01d40ee8cc..94f035251e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -4,22 +4,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fxcrt/include/fx_ext.h" +#include "core/fxcrt/include/fx_memory.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fwl/core/ifwl_notedriver.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/app/xfa_ffwidget.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" #include "xfa/fxfa/parser/xfa_docdata.h" +#include "xfa/fxfa/parser/xfa_document_serialize.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/include/fxfa/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider) : m_pDocProvider(pDocProvider), @@ -38,7 +43,7 @@ uint32_t CXFA_FFDoc::GetDocType() { } int32_t CXFA_FFDoc::StartLoad() { m_pNotify = new CXFA_FFNotify(this); - IXFA_DocParser* pDocParser = IXFA_DocParser::Create(m_pNotify); + CXFA_DocumentParser* pDocParser = new CXFA_DocumentParser(m_pNotify); int32_t iStatus = pDocParser->StartParse(m_pStream); m_pDocument = pDocParser->GetDocument(); return iStatus; @@ -182,7 +187,7 @@ void CXFA_FFDoc::StopLoad() { m_dwDocType = XFA_DOCTYPE_Dynamic; } } -IXFA_DocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { +CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { CXFA_FFDocView* pDocView = (CXFA_FFDocView*)m_mapTypeToDocView.GetValueAt((void*)(uintptr_t)dwView); if (!pDocView) { @@ -191,7 +196,7 @@ IXFA_DocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { } return pDocView; } -CXFA_FFDocView* CXFA_FFDoc::GetDocView(IXFA_DocLayout* pLayout) { +CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) { FX_POSITION ps = m_mapTypeToDocView.GetStartPosition(); while (ps) { void* pType; @@ -393,11 +398,8 @@ CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { } FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext) { - IXFA_PacketExport* pExport = IXFA_PacketExport::Create(m_pDocument); - if (!pExport) { - return FALSE; - } + CXFA_ChecksumContext* pCSContext) { + CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument); uint32_t packetHash = FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); CXFA_Node* pNode = NULL; @@ -422,11 +424,8 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, return bFlags; } FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { - FX_BOOL bRet = FALSE; - IXFA_PacketImport* pImport = IXFA_PacketImport::Create(m_pDocument); - if (pImport) { - bRet = pImport->ImportData(pStream); - pImport->Release(); - } - return bRet; + std::unique_ptr> + importer(new CXFA_DataImporter(m_pDocument)); + + return importer->ImportData(pStream); } diff --git a/xfa/fxfa/app/xfa_ffdoc.h b/xfa/fxfa/app/xfa_ffdoc.h deleted file mode 100644 index 31d5d0fc41..0000000000 --- a/xfa/fxfa/app/xfa_ffdoc.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOC_H_ -#define XFA_FXFA_APP_XFA_FFDOC_H_ - -#include "xfa/fxfa/parser/xfa_document.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FFApp; -class CXFA_FFNotify; -class CXFA_FFDocView; - -struct FX_IMAGEDIB_AND_DPI { - CFX_DIBSource* pDibSource; - int32_t iImageXDpi; - int32_t iImageYDpi; -}; - -class CXFA_FFDoc : public IXFA_Doc { - public: - CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider); - ~CXFA_FFDoc(); - IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } - uint32_t GetDocType(); - int32_t StartLoad(); - int32_t DoLoad(IFX_Pause* pPause = NULL); - void StopLoad(); - IXFA_DocView* CreateDocView(uint32_t dwView = 0); - FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); - FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); - FX_BOOL CloseDoc(); - void SetDocType(uint32_t dwType); - CXFA_Document* GetXFADoc() { return m_pDocument; } - CXFA_FFApp* GetApp() { return m_pApp; } - CXFA_FFDocView* GetDocView(IXFA_DocLayout* pLayout); - CXFA_FFDocView* GetDocView(); - CPDF_Document* GetPDFDoc(); - CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, - int32_t& iImageXDpi, - int32_t& iImageYDpi); - CFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage); - FX_BOOL SavePackage(const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext = NULL); - FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); - - protected: - IXFA_DocProvider* m_pDocProvider; - CXFA_Document* m_pDocument; - IFX_FileRead* m_pStream; - CXFA_FFApp* m_pApp; - CXFA_FFNotify* m_pNotify; - CPDF_Document* m_pPDFDoc; - CFX_MapPtrToPtr m_mapNamedImages; - CFX_MapPtrToPtr m_mapTypeToDocView; - uint32_t m_dwDocType; - FX_BOOL m_bOwnStream; -}; - -#endif // XFA_FXFA_APP_XFA_FFDOC_H_ diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp index 036fc67ebd..949dae4a8b 100644 --- a/xfa/fxfa/app/xfa_ffdochandler.cpp +++ b/xfa/fxfa/app/xfa_ffdochandler.cpp @@ -4,79 +4,83 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdochandler.h" +#include "xfa/include/fxfa/xfa_ffdochandler.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" CXFA_FFDocHandler::CXFA_FFDocHandler() {} + CXFA_FFDocHandler::~CXFA_FFDocHandler() {} -void CXFA_FFDocHandler::ReleaseDoc(IXFA_Doc* hDoc) { + +void CXFA_FFDocHandler::ReleaseDoc(CXFA_FFDoc* hDoc) { delete hDoc; // virtual dtor. } -IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(IXFA_Doc* hDoc) { - return static_cast(hDoc)->GetDocProvider(); +IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(CXFA_FFDoc* hDoc) { + return hDoc->GetDocProvider(); } -uint32_t CXFA_FFDocHandler::GetDocType(IXFA_Doc* hDoc) { - return static_cast(hDoc)->GetDocType(); +uint32_t CXFA_FFDocHandler::GetDocType(CXFA_FFDoc* hDoc) { + return hDoc->GetDocType(); } -int32_t CXFA_FFDocHandler::StartLoad(IXFA_Doc* hDoc) { - return static_cast(hDoc)->StartLoad(); +int32_t CXFA_FFDocHandler::StartLoad(CXFA_FFDoc* hDoc) { + return hDoc->StartLoad(); } -int32_t CXFA_FFDocHandler::DoLoad(IXFA_Doc* hDoc, IFX_Pause* pPause) { - return static_cast(hDoc)->DoLoad(pPause); +int32_t CXFA_FFDocHandler::DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause) { + return hDoc->DoLoad(pPause); } -void CXFA_FFDocHandler::StopLoad(IXFA_Doc* hDoc) { - static_cast(hDoc)->StopLoad(); +void CXFA_FFDocHandler::StopLoad(CXFA_FFDoc* hDoc) { + hDoc->StopLoad(); } -IXFA_DocView* CXFA_FFDocHandler::CreateDocView(IXFA_Doc* hDoc, - uint32_t dwView) { - return static_cast(hDoc)->CreateDocView(dwView); +CXFA_FFDocView* CXFA_FFDocHandler::CreateDocView(CXFA_FFDoc* hDoc, + uint32_t dwView) { + return hDoc->CreateDocView(dwView); } -int32_t CXFA_FFDocHandler::CountPackages(IXFA_Doc* hDoc) { +int32_t CXFA_FFDocHandler::CountPackages(CXFA_FFDoc* hDoc) { return 0; } -void CXFA_FFDocHandler::GetPackageName(IXFA_Doc* hDoc, +void CXFA_FFDocHandler::GetPackageName(CXFA_FFDoc* hDoc, int32_t iPackage, CFX_WideStringC& wsPackage) {} CFDE_XMLElement* CXFA_FFDocHandler::GetPackageData( - IXFA_Doc* hDoc, + CXFA_FFDoc* hDoc, const CFX_WideStringC& wsPackage) { - return static_cast(hDoc)->GetPackageData(wsPackage); + return hDoc->GetPackageData(wsPackage); } -FX_BOOL CXFA_FFDocHandler::SavePackage(IXFA_Doc* hDoc, +FX_BOOL CXFA_FFDocHandler::SavePackage(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsPackage, IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext) { - return static_cast(hDoc) - ->SavePackage(wsPackage, pFile, pCSContext); + CXFA_ChecksumContext* pCSContext) { + return hDoc->SavePackage(wsPackage, pFile, pCSContext); } -FX_BOOL CXFA_FFDocHandler::CloseDoc(IXFA_Doc* hDoc) { - return static_cast(hDoc)->CloseDoc(); +FX_BOOL CXFA_FFDocHandler::CloseDoc(CXFA_FFDoc* hDoc) { + return hDoc->CloseDoc(); } -FX_BOOL CXFA_FFDocHandler::ImportData(IXFA_Doc* hDoc, +FX_BOOL CXFA_FFDocHandler::ImportData(CXFA_FFDoc* hDoc, IFX_FileRead* pStream, FX_BOOL bXDP) { - return static_cast(hDoc)->ImportData(pStream, bXDP); + return hDoc->ImportData(pStream, bXDP); } -void CXFA_FFDocHandler::SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) { - static_cast(hDoc)->GetXFADoc()->InitScriptContext(hRuntime); +void CXFA_FFDocHandler::SetJSERuntime(CXFA_FFDoc* hDoc, + FXJSE_HRUNTIME hRuntime) { + hDoc->GetXFADoc()->InitScriptContext(hRuntime); } -FXJSE_HVALUE CXFA_FFDocHandler::GetXFAScriptObject(IXFA_Doc* hDoc) { - CXFA_Document* pXFADoc = static_cast(hDoc)->GetXFADoc(); +FXJSE_HVALUE CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) { + CXFA_Document* pXFADoc = hDoc->GetXFADoc(); if (!pXFADoc) { return NULL; } - IXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); if (!pScriptContext) { return NULL; } return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); } -XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { - CXFA_Document* pXFADoc = static_cast(hDoc)->GetXFADoc(); +XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) { + CXFA_Document* pXFADoc = hDoc->GetXFADoc(); if (!pXFADoc) { return XFA_ATTRIBUTEENUM_Unknown; } @@ -90,16 +94,16 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { } return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); } -FX_BOOL CXFA_FFDocHandler::RunDocScript(IXFA_Doc* hDoc, +FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, const CFX_WideStringC& wsScript, FXJSE_HVALUE hRetValue, FXJSE_HVALUE hThisObject) { - CXFA_Document* pXFADoc = static_cast(hDoc)->GetXFADoc(); + CXFA_Document* pXFADoc = hDoc->GetXFADoc(); if (!pXFADoc) { return FALSE; } - IXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); if (!pScriptContext) { return FALSE; } diff --git a/xfa/fxfa/app/xfa_ffdochandler.h b/xfa/fxfa/app/xfa_ffdochandler.h deleted file mode 100644 index 695f6a819d..0000000000 --- a/xfa/fxfa/app/xfa_ffdochandler.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ -#define XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ - -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FFDocHandler : public IXFA_DocHandler { - public: - CXFA_FFDocHandler(); - ~CXFA_FFDocHandler(); - - void ReleaseDoc(IXFA_Doc* hDoc) override; - IXFA_DocProvider* GetDocProvider(IXFA_Doc* hDoc) override; - uint32_t GetDocType(IXFA_Doc* hDoc) override; - int32_t StartLoad(IXFA_Doc* hDoc) override; - int32_t DoLoad(IXFA_Doc* hDoc, IFX_Pause* pPause = NULL) override; - void StopLoad(IXFA_Doc* hDoc) override; - - IXFA_DocView* CreateDocView(IXFA_Doc* hDoc, uint32_t dwView = 0) override; - int32_t CountPackages(IXFA_Doc* hDoc) override; - void GetPackageName(IXFA_Doc* hDoc, - int32_t iPackage, - CFX_WideStringC& wsPackage) override; - CFDE_XMLElement* GetPackageData(IXFA_Doc* hDoc, - const CFX_WideStringC& wsPackage); - FX_BOOL SavePackage(IXFA_Doc* hDoc, - const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext = NULL) override; - FX_BOOL CloseDoc(IXFA_Doc* hDoc) override; - FX_BOOL ImportData(IXFA_Doc* hDoc, - IFX_FileRead* pStream, - FX_BOOL bXDP = TRUE) override; - void SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) override; - FXJSE_HVALUE GetXFAScriptObject(IXFA_Doc* hDoc) override; - XFA_ATTRIBUTEENUM GetRestoreState(IXFA_Doc* hDoc) override; - FX_BOOL RunDocScript(IXFA_Doc* hDoc, - XFA_SCRIPTTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - FXJSE_HVALUE hThisObject) override; - - protected: -}; - -#endif // XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 5e814475db..907e2b5d22 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -4,20 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" #include "core/fxcrt/include/fx_ext.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimage.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffpath.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_ffsignature.h" @@ -26,10 +23,15 @@ #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, @@ -195,20 +197,14 @@ int32_t CXFA_FFDocView::CountPageViews() { } return m_pXFADocLayout->CountPages(); } -IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { +CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { if (!m_pXFADocLayout) { return NULL; } return static_cast(m_pXFADocLayout->GetPage(nIndex)); } -IXFA_Widget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName) { - return GetWidgetByName(wsName, NULL); -} -CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( - const CFX_WideStringC& wsName) { - return GetWidgetAccByName(wsName, NULL); -} -IXFA_DocLayout* CXFA_FFDocView::GetXFALayout() const { + +CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const { return m_pDoc->GetXFADoc()->GetDocLayout(); } FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { @@ -312,7 +308,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); return XFA_EVENTERROR_Success; } -IXFA_WidgetHandler* CXFA_FFDocView::GetWidgetHandler() { +CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { if (!m_pWidgetHandler) { m_pWidgetHandler = new CXFA_FFWidgetHandler(this); } @@ -325,7 +321,7 @@ IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { } return new CXFA_FFDocWidgetIterator(this, pFormRoot); } -IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( +CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( XFA_WIDGETORDER eOrder) { CXFA_Node* pFormRoot = GetRootSubform(); if (!pFormRoot) { @@ -333,7 +329,7 @@ IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( } return new CXFA_WidgetAccIterator(this, pFormRoot); } -IXFA_Widget* CXFA_FFDocView::GetFocusWidget() { +CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { return m_pFocusWidget; } void CXFA_FFDocView::KillFocus() { @@ -345,8 +341,8 @@ void CXFA_FFDocView::KillFocus() { m_pFocusWidget = NULL; m_pOldFocusWidget = NULL; } -FX_BOOL CXFA_FFDocView::SetFocus(IXFA_Widget* hWidget) { - CXFA_FFWidget* pNewFocus = (CXFA_FFWidget*)hWidget; +FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { + CXFA_FFWidget* pNewFocus = hWidget; if (m_pOldFocusWidget == pNewFocus) { return FALSE; } @@ -507,7 +503,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( CFX_WideString wsExpression; uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; - IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); if (!pScriptContext) { return NULL; } @@ -532,7 +528,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( } return NULL; } -void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender, +void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, XFA_PAGEEVENT eEvent, int32_t iPageIndex) { CXFA_FFPageView* pFFPageView = static_cast(pSender); @@ -568,7 +564,7 @@ void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate) { AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); } -void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, +void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rtInvalidate) { CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); if (!pRect) { @@ -583,7 +579,7 @@ void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, void CXFA_FFDocView::RunInvalidate() { FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); while (ps) { - IXFA_PageView* pPageView = NULL; + CXFA_FFPageView* pPageView = NULL; CFX_RectF* pRect = NULL; m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); @@ -770,7 +766,7 @@ void CXFA_FFDocView::RunBindItems() { continue; } CXFA_BindItems binditems(reinterpret_cast(m_bindItems[i])); - IXFA_ScriptContext* pScriptContext = + CXFA_ScriptContext* pScriptContext = pWidgetNode->GetDocument()->GetScriptContext(); CFX_WideStringC wsRef; binditems.GetRef(wsRef); @@ -852,13 +848,13 @@ void CXFA_FFDocWidgetIterator::Reset() { m_ContentIterator.Reset(); m_pCurWidget = NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToFirst() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToLast() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToNext() { CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() : m_ContentIterator.GetCurrent(); while (pItem) { @@ -875,24 +871,16 @@ IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { } return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToPrevious() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { return NULL; } -FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { +FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { return FALSE; } -IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create( - CXFA_WidgetAcc* pTravelRoot, - XFA_WIDGETORDER eOrder) { - if (!pTravelRoot) { - return NULL; - } - return new CXFA_WidgetAccIterator(pTravelRoot->GetDocView(), - pTravelRoot->GetNode()); -} + CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot) : m_ContentIterator(pTravelRoot) { diff --git a/xfa/fxfa/app/xfa_ffdocview.h b/xfa/fxfa/app/xfa_ffdocview.h deleted file mode 100644 index 284a32fdc3..0000000000 --- a/xfa/fxfa/app/xfa_ffdocview.h +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOCVIEW_H_ -#define XFA_FXFA_APP_XFA_FFDOCVIEW_H_ - -#include "xfa/fxfa/app/xfa_ffdoc.h" - -class CXFA_FFWidgetHandler; -class CXFA_FFDoc; -class CXFA_FFWidget; -extern const XFA_ATTRIBUTEENUM gs_EventActivity[]; -enum XFA_DOCVIEW_LAYOUTSTATUS { - XFA_DOCVIEW_LAYOUTSTATUS_None, - XFA_DOCVIEW_LAYOUTSTATUS_Start, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate, - XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady, - XFA_DOCVIEW_LAYOUTSTATUS_Doing, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady, - XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady, - XFA_DOCVIEW_LAYOUTSTATUS_DocReady, - XFA_DOCVIEW_LAYOUTSTATUS_End -}; -class CXFA_FFDocView : public IXFA_DocView { - public: - CXFA_FFDocView(CXFA_FFDoc* pDoc); - ~CXFA_FFDocView(); - - virtual IXFA_Doc* GetDoc() { return m_pDoc; } - virtual int32_t StartLayout(int32_t iStartPage = 0); - virtual int32_t DoLayout(IFX_Pause* pPause = NULL); - virtual void StopLayout(); - virtual int32_t GetLayoutStatus(); - virtual void UpdateDocView(); - virtual int32_t CountPageViews(); - virtual IXFA_PageView* GetPageView(int32_t nIndex); - virtual IXFA_Widget* GetWidgetByName(const CFX_WideStringC& wsName); - virtual CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName); - virtual void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL); - virtual int32_t ProcessWidgetEvent(CXFA_EventParam* pParam, - CXFA_WidgetAcc* pWidgetAcc = NULL); - virtual IXFA_WidgetHandler* GetWidgetHandler(); - virtual IXFA_WidgetIterator* CreateWidgetIterator(); - virtual IXFA_WidgetAccIterator* CreateWidgetAccIterator( - XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder); - virtual IXFA_Widget* GetFocusWidget(); - virtual void KillFocus(); - virtual FX_BOOL SetFocus(IXFA_Widget* hWidget); - CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName, - CXFA_FFWidget* pRefWidget = NULL); - CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName, - CXFA_WidgetAcc* pRefWidgetAcc = NULL); - IXFA_DocLayout* GetXFALayout() const; - void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - int32_t iPageIndex); - void LockUpdate(); - void UnlockUpdate(); - FX_BOOL IsUpdateLocked(); - void ClearInvalidateList(); - void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate); - void AddInvalidateRect(IXFA_PageView* pPageView, - const CFX_RectF& rtInvalidate); - void RunInvalidate(); - void RunDocClose(); - void DestroyDocView(); - - FX_BOOL InitValidate(CXFA_Node* pNode); - FX_BOOL RunValidate(); - - void SetChangeMark(); - - void AddValidateWidget(CXFA_WidgetAcc* pWidget); - void AddCalculateNodeNotify(CXFA_Node* pNodeChange); - void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); - int32_t RunCalculateWidgets(); - FX_BOOL IsStaticNotify(); - FX_BOOL RunLayout(); - void RunSubformIndexChange(); - void AddNewFormNode(CXFA_Node* pNode); - void AddIndexChangedSubform(CXFA_Node* pNode); - CXFA_WidgetAcc* GetFocusWidgetAcc(); - void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); - void DeleteLayoutItem(CXFA_FFWidget* pWidget); - int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_Node* pExclude = NULL); - FX_BOOL m_bLayoutEvent; - CFX_WideStringArray m_arrNullTestMsg; - CXFA_FFWidget* m_pListFocusWidget; - FX_BOOL m_bInLayoutStatus; - - protected: - FX_BOOL RunEventLayoutReady(); - void RunBindItems(); - FX_BOOL InitCalculate(CXFA_Node* pNode); - void InitLayout(CXFA_Node* pNode); - void RunCalculateRecursive(int32_t& iIndex); - void ShowNullTestMsg(); - FX_BOOL ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc); - CXFA_Node* GetRootSubform(); - - CXFA_FFDoc* m_pDoc; - CXFA_FFWidgetHandler* m_pWidgetHandler; - IXFA_DocLayout* m_pXFADocLayout; - CXFA_WidgetAcc* m_pFocusAcc; - CXFA_FFWidget* m_pFocusWidget; - CXFA_FFWidget* m_pOldFocusWidget; - CFX_MapPtrToPtr m_mapPageInvalidate; - CFX_PtrArray m_ValidateAccs; - CFX_PtrArray m_bindItems; - CFX_PtrArray m_CalculateAccs; - - CFX_PtrArray m_NewAddedNodes; - CFX_PtrArray m_IndexChangedSubforms; - XFA_DOCVIEW_LAYOUTSTATUS m_iStatus; - int32_t m_iLock; - friend class CXFA_FFNotify; -}; -class CXFA_FFDocWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); - virtual ~CXFA_FFDocWidgetIterator(); - - virtual void Release() { delete this; } - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - CXFA_ContainerIterator m_ContentIterator; - CXFA_FFDocView* m_pDocView; - CXFA_FFWidget* m_pCurWidget; -}; -class CXFA_WidgetAccIterator : public IXFA_WidgetAccIterator { - public: - CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); - virtual ~CXFA_WidgetAccIterator(); - virtual void Release() { delete this; } - virtual void Reset(); - virtual CXFA_WidgetAcc* MoveToFirst(); - virtual CXFA_WidgetAcc* MoveToLast(); - virtual CXFA_WidgetAcc* MoveToNext(); - virtual CXFA_WidgetAcc* MoveToPrevious(); - virtual CXFA_WidgetAcc* GetCurrentWidgetAcc(); - virtual FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget); - virtual void SkipTree(); - - protected: - CXFA_ContainerIterator m_ContentIterator; - CXFA_FFDocView* m_pDocView; - CXFA_WidgetAcc* m_pCurWidgetAcc; -}; - -#endif // XFA_FXFA_APP_XFA_FFDOCVIEW_H_ diff --git a/xfa/fxfa/app/xfa_ffdraw.cpp b/xfa/fxfa/app/xfa_ffdraw.cpp index 06cfdfec52..06fc85b893 100644 --- a/xfa/fxfa/app/xfa_ffdraw.cpp +++ b/xfa/fxfa/app/xfa_ffdraw.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFDraw::CXFA_FFDraw(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffdraw.h b/xfa/fxfa/app/xfa_ffdraw.h index a5db5982a5..fb2d11e1f6 100644 --- a/xfa/fxfa/app/xfa_ffdraw.h +++ b/xfa/fxfa/app/xfa_ffdraw.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFDRAW_H_ #define XFA_FXFA_APP_XFA_FFDRAW_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFDraw : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp index 6705ea6c0e..47cc455962 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.cpp +++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffexclgroup.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffexclgroup.h b/xfa/fxfa/app/xfa_ffexclgroup.h index cdda4d0417..e492cf1817 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.h +++ b/xfa/fxfa/app/xfa_ffexclgroup.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ #define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFExclGroup : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 7aac2add61..90bb5f39e5 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -11,15 +11,15 @@ #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwltheme.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(NULL) { diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 64bdfa3470..51fe56be09 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -10,8 +10,8 @@ #include "xfa/fwl/core/fwl_sdadapterimp.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" #include "xfa/fwl/lightwidget/cfwl_widget.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #define XFA_MINUI_HEIGHT 4.32f #define XFA_DEFAULTUI_HEIGHT 2.0f diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp index 306c4677d2..f7f6ebbf1b 100644 --- a/xfa/fxfa/app/xfa_ffimage.cpp +++ b/xfa/fxfa/app/xfa_ffimage.cpp @@ -6,11 +6,11 @@ #include "xfa/fxfa/app/xfa_ffimage.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFImage::CXFA_FFImage(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index c0b371afcf..ba16d4d352 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -10,11 +10,11 @@ #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 25e0d7d7a9..7cb9f40b63 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -6,18 +6,14 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffdraw.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimage.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffpath.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_ffsignature.h" @@ -26,18 +22,24 @@ #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#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_ffwidgethandler.h" static void XFA_FFDeleteWidgetAcc(void* pData) { delete static_cast(pData); } + static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = { - XFA_FFDeleteWidgetAcc, NULL}; + XFA_FFDeleteWidgetAcc, nullptr}; + CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {} CXFA_FFNotify::~CXFA_FFNotify() {} -void CXFA_FFNotify::OnPageEvent(IXFA_LayoutPage* pSender, +void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender, XFA_PAGEEVENT eEvent, void* pParam) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout()); @@ -146,7 +148,7 @@ void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender, } } CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { - IXFA_DocLayout* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); + CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); XFA_ELEMENT eType = pNode->GetClassID(); if (eType == XFA_ELEMENT_PageArea) { @@ -231,7 +233,7 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { pWidget->SetDocView(pDocView); return pWidget; } -void CXFA_FFNotify::OnLayoutEvent(IXFA_DocLayout* pLayout, +void CXFA_FFNotify::OnLayoutEvent(CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, XFA_LAYOUTEVENT eEvent, void* pParam, @@ -321,7 +323,7 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { pDocView->AddCalculateWidgetAcc(pWidgetAcc); pDocView->AddValidateWidget(pWidgetAcc); } -IXFA_Doc* CXFA_FFNotify::GetHDOC() { +CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { return m_pDoc; } IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { @@ -330,21 +332,20 @@ IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { return m_pDoc->GetApp()->GetAppProvider(); } -IXFA_WidgetHandler* CXFA_FFNotify::GetWidgetHandler() { +CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); return pDocView ? pDocView->GetWidgetHandler() : NULL; } -IXFA_Widget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { +CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { return XFA_GetWidgetFromLayoutItem(pLayoutItem); } -void CXFA_FFNotify::OpenDropDownList(IXFA_Widget* hWidget) { - CXFA_FFWidget* pWidget = static_cast(hWidget); - if (pWidget->GetDataAcc()->GetUIType() != XFA_ELEMENT_ChoiceList) { +void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { + if (hWidget->GetDataAcc()->GetUIType() != XFA_ELEMENT_ChoiceList) { return; } CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); pDocView->LockUpdate(); - static_cast(pWidget)->OpenDropDownList(); + static_cast(hWidget)->OpenDropDownList(); pDocView->UnlockUpdate(); pDocView->UpdateDocView(); } @@ -406,8 +407,7 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { } XFA_ELEMENT iType = pNode->GetClassID(); if (XFA_IsCreateWidget(iType)) { - CXFA_WidgetAcc* pAcc = - new CXFA_WidgetAcc(pDocView, static_cast(pNode)); + CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); return; } @@ -568,18 +568,18 @@ void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender, } } void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { CXFA_FFWidget* pWidget = static_cast(pSender); int32_t iPageIdx = (int32_t)(uintptr_t)pParam; - IXFA_PageView* pNewPageView = pDocView->GetPageView(iPageIdx); + CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx); uint32_t dwStatus = (uint32_t)(uintptr_t)pParam2; uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable | XFA_WIDGETSTATUS_Printable; pWidget->ModifyStatus(dwStatus, dwFilter); - IXFA_PageView* pPrePageView = pWidget->GetPageView(); + CXFA_FFPageView* pPrePageView = pWidget->GetPageView(); if (pPrePageView != pNewPageView || (dwStatus & (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) == (XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) { @@ -603,7 +603,7 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, pWidget->AddInvalidateRect(nullptr); } void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { @@ -615,12 +615,12 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, pWidget->AddInvalidateRect(nullptr); } void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) {} void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index 30c8f0d107..6bf39ee6d2 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -9,59 +9,61 @@ #include "xfa/fxfa/parser/xfa_document.h" -class CXFA_FFNotify : public IXFA_Notify { +class CXFA_FFWidgetHandler; + +class CXFA_FFNotify { public: CXFA_FFNotify(CXFA_FFDoc* pDoc); ~CXFA_FFNotify(); - virtual void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - void* pParam = NULL); + void OnPageEvent(CXFA_ContainerLayoutItem* pSender, + XFA_PAGEEVENT eEvent, + void* pParam = NULL); - virtual void OnNodeEvent(CXFA_Node* pSender, - XFA_NODEEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL, - void* pParam3 = NULL, - void* pParam4 = NULL); - virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, - uint32_t dwEvent, - void* pParam = NULL, - void* pAdditional = NULL, - void* pAdditional2 = NULL); - virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode); - virtual void OnLayoutEvent(IXFA_DocLayout* pLayout, - CXFA_LayoutItem* pSender, - XFA_LAYOUTEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL); + void OnNodeEvent(CXFA_Node* pSender, + XFA_NODEEVENT eEvent, + void* pParam = NULL, + void* pParam2 = NULL, + void* pParam3 = NULL, + void* pParam4 = NULL); + void OnWidgetDataEvent(CXFA_WidgetData* pSender, + uint32_t dwEvent, + void* pParam = NULL, + void* pAdditional = NULL, + void* pAdditional2 = NULL); + CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode); + void OnLayoutEvent(CXFA_LayoutProcessor* pLayout, + CXFA_LayoutItem* pSender, + XFA_LAYOUTEVENT eEvent, + void* pParam = NULL, + void* pParam2 = NULL); - virtual void StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight); - virtual FX_BOOL FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos); - virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem); - virtual int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_WidgetAcc* pExclude = NULL); - virtual void AddCalcValidate(CXFA_Node* pNode); - virtual IXFA_Doc* GetHDOC(); - virtual IXFA_DocProvider* GetDocProvider(); - virtual IXFA_AppProvider* GetAppProvider(); - virtual IXFA_WidgetHandler* GetWidgetHandler(); - virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem); - virtual void OpenDropDownList(IXFA_Widget* hWidget); - virtual CFX_WideString GetCurrentDateTime(); - virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL); - virtual int32_t GetLayoutStatus(); - virtual void RunNodeInitialize(CXFA_Node* pNode); - virtual void RunSubformIndexChange(CXFA_Node* pSubformNode); - virtual CXFA_Node* GetFocusWidgetNode(); - virtual void SetFocusWidgetNode(CXFA_Node* pNode); + void StartFieldDrawLayout(CXFA_Node* pItem, + FX_FLOAT& fCalcWidth, + FX_FLOAT& fCalcHeight); + FX_BOOL FindSplitPos(CXFA_Node* pItem, + int32_t iBlockIndex, + FX_FLOAT& fCalcHeightPos); + FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem); + int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, + XFA_EVENTTYPE eEventType, + FX_BOOL bIsFormReady = FALSE, + FX_BOOL bRecursive = TRUE, + CXFA_WidgetAcc* pExclude = NULL); + void AddCalcValidate(CXFA_Node* pNode); + CXFA_FFDoc* GetHDOC(); + IXFA_DocProvider* GetDocProvider(); + IXFA_AppProvider* GetAppProvider(); + CXFA_FFWidgetHandler* GetWidgetHandler(); + CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); + void OpenDropDownList(CXFA_FFWidget* hWidget); + CFX_WideString GetCurrentDateTime(); + void ResetData(CXFA_WidgetData* pWidgetData = NULL); + int32_t GetLayoutStatus(); + void RunNodeInitialize(CXFA_Node* pNode); + void RunSubformIndexChange(CXFA_Node* pSubformNode); + CXFA_Node* GetFocusWidgetNode(); + void SetFocusWidgetNode(CXFA_Node* pNode); protected: void OnNodeReady(CXFA_Node* pNode); @@ -74,22 +76,22 @@ class CXFA_FFNotify : public IXFA_Notify { void OnChildAdded(CXFA_Node* pSender, void* pParam, void* pParam2); void OnChildRemoved(CXFA_Node* pSender, void* pParam, void* pParam2); void OnLayoutItemAdd(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemRemoving(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index e4841f17b2..584832ed2c 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -4,26 +4,26 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #include "xfa/fde/fde_render.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView), m_bLoaded(FALSE) {} CXFA_FFPageView::~CXFA_FFPageView() {} -IXFA_DocView* CXFA_FFPageView::GetDocView() { +CXFA_FFDocView* CXFA_FFPageView::GetDocView() { return m_pDocView; } int32_t CXFA_FFPageView::GetPageViewIndex() { @@ -58,7 +58,7 @@ void CXFA_FFPageView::UnloadPageView() { FX_BOOL CXFA_FFPageView::IsPageViewLoaded() { return m_bLoaded; } -IXFA_Widget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { +CXFA_FFWidget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { if (!m_bLoaded) { return nullptr; } @@ -130,47 +130,46 @@ CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {} void CXFA_FFPageWidgetIterator::Reset() { m_sIterator.Reset(); } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() { m_sIterator.Reset(); for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() { m_sIterator.SetCurrent(NULL); return MoveToPrevious(); } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem; pLayoutItem = m_sIterator.MoveToPrev()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : NULL; } -FX_BOOL CXFA_FFPageWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { - CXFA_FFWidget* pWidget = static_cast(hWidget); - return pWidget && m_sIterator.SetCurrent(pWidget); +FX_BOOL CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { + return hWidget && m_sIterator.SetCurrent(hWidget); } -IXFA_Widget* CXFA_FFPageWidgetIterator::GetWidget( +CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget( CXFA_LayoutItem* pLayoutItem) { if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { if (!XFA_PageWidgetFilter(pWidget, m_dwFilter, FALSE, m_bIgnorerelevant)) { @@ -201,7 +200,7 @@ void CXFA_FFTabOrderPageWidgetIterator::Reset() { CreateTabOrderWidgetArray(); m_iCurWidget = -1; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { if (m_TabOrderWidgetArray.GetSize() > 0) { for (int32_t i = 0; i < m_TabOrderWidgetArray.GetSize(); i++) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, @@ -213,7 +212,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { } return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { if (m_TabOrderWidgetArray.GetSize() > 0) { for (int32_t i = m_TabOrderWidgetArray.GetSize() - 1; i >= 0; i--) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, @@ -225,7 +224,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { } return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { for (int32_t i = m_iCurWidget + 1; i < m_TabOrderWidgetArray.GetSize(); i++) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, m_bIgnorerelevant)) { @@ -236,7 +235,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { m_iCurWidget = -1; return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { for (int32_t i = m_iCurWidget - 1; i >= 0; i--) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, m_bIgnorerelevant)) { @@ -247,16 +246,15 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { m_iCurWidget = -1; return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { if (m_iCurWidget >= 0) { return m_TabOrderWidgetArray[m_iCurWidget]; } return NULL; } FX_BOOL CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( - IXFA_Widget* hWidget) { - int32_t iWidgetIndex = - m_TabOrderWidgetArray.Find(static_cast(hWidget)); + CXFA_FFWidget* hWidget) { + int32_t iWidgetIndex = m_TabOrderWidgetArray.Find(hWidget); if (iWidgetIndex >= 0) { m_iCurWidget = iWidgetIndex; return TRUE; diff --git a/xfa/fxfa/app/xfa_ffpageview.h b/xfa/fxfa/app/xfa_ffpageview.h deleted file mode 100644 index 20818e7107..0000000000 --- a/xfa/fxfa/app/xfa_ffpageview.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ -#define XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ - -#include "xfa/fxfa/parser/xfa_doclayout.h" - -class CXFA_FFWidget; -class CXFA_FFDocView; -class CXFA_FFPageView : public CXFA_ContainerLayoutItem, public IXFA_PageView { - public: - CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); - ~CXFA_FFPageView() override; - - // IFXA_PageView: - IXFA_DocView* GetDocView() override; - int32_t GetPageViewIndex() override; - void GetPageViewRect(CFX_RectF& rtPage) override; - void GetDisplayMatrix(CFX_Matrix& mt, - const CFX_Rect& rtDisp, - int32_t iRotate) override; - int32_t LoadPageView(IFX_Pause* pPause = NULL) override; - void UnloadPageView() override; - IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) override; - IXFA_WidgetIterator* CreateWidgetIterator( - uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form, - uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible | - XFA_WIDGETFILTER_Viewable | - XFA_WIDGETFILTER_AllType) override; - - FX_BOOL IsPageViewLoaded(); - - protected: - CXFA_FFDocView* m_pDocView; - FX_BOOL m_bLoaded; -}; -typedef CXFA_NodeIteratorTemplate - CXFA_LayoutItemIterator; -class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter); - virtual ~CXFA_FFPageWidgetIterator(); - virtual void Release() { delete this; } - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - IXFA_Widget* GetWidget(CXFA_LayoutItem* pLayoutItem); - CXFA_FFPageView* m_pPageView; - IXFA_Widget* m_hCurWidget; - uint32_t m_dwFilter; - FX_BOOL m_bIgnorerelevant; - CXFA_LayoutItemIterator m_sIterator; -}; -typedef CFX_ArrayTemplate CXFA_WidgetArray; -class CXFA_TabParam { - public: - CXFA_TabParam() : m_pWidget(NULL) {} - ~CXFA_TabParam() {} - - CXFA_FFWidget* m_pWidget; - CXFA_WidgetArray m_Children; -}; -class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, - uint32_t dwFilter); - virtual ~CXFA_FFTabOrderPageWidgetIterator(); - - virtual void Release(); - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - CXFA_WidgetArray m_TabOrderWidgetArray; - CXFA_FFPageView* m_pPageView; - uint32_t m_dwFilter; - int32_t m_iCurWidget; - FX_BOOL m_bIgnorerelevant; - CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); - CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName, - CXFA_FFWidget* pRefWidget); - void CreateTabOrderWidgetArray(); - void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray); - CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); - void OrderContainer(CXFA_LayoutItemIterator* sIterator, - CXFA_LayoutItem* pContainerItem, - CXFA_TabParam* pContainer, - FX_BOOL& bCurrentItem, - FX_BOOL& bContentArea, - FX_BOOL bMarsterPage = FALSE); -}; - -#endif // XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp index d8ece72bb0..eddc41f471 100644 --- a/xfa/fxfa/app/xfa_ffpath.cpp +++ b/xfa/fxfa/app/xfa_ffpath.cpp @@ -6,13 +6,13 @@ #include "xfa/fxfa/app/xfa_ffpath.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFLine::CXFA_FFLine(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 89d0bfdb82..85843755b6 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -9,14 +9,14 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_pushbutton.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFPushButton::CXFA_FFPushButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index ca933f8cdc..65a7be2f5c 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffsignature.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.cpp b/xfa/fxfa/app/xfa_ffsubform.cpp index aebbb08684..fd718f8158 100644 --- a/xfa/fxfa/app/xfa_ffsubform.cpp +++ b/xfa/fxfa/app/xfa_ffsubform.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffsubform.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFSubForm::CXFA_FFSubForm(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.h b/xfa/fxfa/app/xfa_ffsubform.h index e4369113de..bae6df6ee4 100644 --- a/xfa/fxfa/app/xfa_ffsubform.h +++ b/xfa/fxfa/app/xfa_ffsubform.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_ #define XFA_FXFA_APP_XFA_FFSUBFORM_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFSubForm : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index 333f9f7f14..d93c23fcec 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -7,13 +7,13 @@ #include "xfa/fxfa/app/xfa_fftext.h" #include "xfa/fwl/core/fwl_widgetdef.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index d6d292b96f..e11585fab0 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -14,15 +14,15 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_datetimepicker.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxfa/parser/xfa_localevalue.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 027d07a9f5..4bf5de56c7 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -10,16 +10,16 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/include/fxcodec/fx_codec.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" #include "xfa/fxgraphics/cfx_pattern.h" #include "xfa/fxgraphics/cfx_shading.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFWidget::CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) @@ -29,11 +29,11 @@ CXFA_FFWidget::CXFA_FFWidget(CXFA_FFPageView* pPageView, m_rtWidget.Set(0, 0, 0, 0); } CXFA_FFWidget::~CXFA_FFWidget() {} -IXFA_PageView* CXFA_FFWidget::GetPageView() { +CXFA_FFPageView* CXFA_FFWidget::GetPageView() { return m_pPageView; } -void CXFA_FFWidget::SetPageView(IXFA_PageView* pPageView) { - m_pPageView = static_cast(pPageView); +void CXFA_FFWidget::SetPageView(CXFA_FFPageView* pPageView) { + m_pPageView = pPageView; } void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) { if ((m_dwStatus & XFA_WIDGETSTATUS_RectCached) == 0) { diff --git a/xfa/fxfa/app/xfa_ffwidget.h b/xfa/fxfa/app/xfa_ffwidget.h index 4cc6c0bbbb..84ab926a39 100644 --- a/xfa/fxfa/app/xfa_ffwidget.h +++ b/xfa/fxfa/app/xfa_ffwidget.h @@ -36,14 +36,12 @@ class CXFA_CalcData { CFX_PtrArray m_Globals; int32_t m_iRefCount; }; -class CXFA_FFWidget : public IXFA_Widget, - public CFX_PrivateData, - public CXFA_ContentLayoutItem { +class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem { public: CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); virtual ~CXFA_FFWidget(); - IXFA_PageView* GetPageView(); - void SetPageView(IXFA_PageView* pPageView); + CXFA_FFPageView* GetPageView(); + void SetPageView(CXFA_FFPageView* pPageView); void GetWidgetRect(CFX_RectF& rtWidget); CFX_RectF ReCacheWidgetRect(); uint32_t GetStatus(); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index c50786a3dc..fc8b38f458 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -10,19 +10,21 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fde/xml/fde_xml_imp.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#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_fontmgr.h" static void XFA_FFDeleteCalcData(void* pData) { if (pData) { @@ -659,7 +661,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, return XFA_EVENTERROR_Success; } CXFA_FFDoc* pDoc = GetDoc(); - IXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext(); + CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext(); pContext->SetEventParam(*pEventParam); pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt()); CXFA_NodeArray refNodes; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/xfa_ffwidgetacc.h index 722256a6f7..6d4303d72a 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.h +++ b/xfa/fxfa/app/xfa_ffwidgetacc.h @@ -16,7 +16,7 @@ enum XFA_TEXTPROVIDERTYPE { XFA_TEXTPROVIDERTYPE_Rollover, XFA_TEXTPROVIDERTYPE_Down, }; -class CXFA_TextProvider : public IXFA_TextProvider { +class CXFA_TextProvider { public: CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc, XFA_TEXTPROVIDERTYPE eType, @@ -24,16 +24,17 @@ class CXFA_TextProvider : public IXFA_TextProvider { : m_pWidgetAcc(pWidgetAcc), m_eType(eType), m_pTextNode(pTextNode) { FXSYS_assert(m_pWidgetAcc); } - virtual ~CXFA_TextProvider() {} - virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText); - virtual CXFA_Para GetParaNode(); - virtual CXFA_Font GetFontNode(); - virtual FX_BOOL IsCheckButtonAndAutoWidth(); - virtual CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } - virtual FX_BOOL GetEmbbedObj(FX_BOOL bURI, - FX_BOOL bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue); + ~CXFA_TextProvider() {} + + CXFA_Node* GetTextNode(FX_BOOL& bRichText); + CXFA_Para GetParaNode(); + CXFA_Font GetFontNode(); + FX_BOOL IsCheckButtonAndAutoWidth(); + CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } + FX_BOOL GetEmbbedObj(FX_BOOL bURI, + FX_BOOL bRaw, + const CFX_WideString& wsAttr, + CFX_WideString& wsValue); protected: CXFA_WidgetAcc* m_pWidgetAcc; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 80d2e5acc5..711d29abc2 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -4,217 +4,207 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" #include #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) : m_pDocView(pDocView) {} + CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} -IXFA_PageView* CXFA_FFWidgetHandler::GetPageView(IXFA_Widget* hWidget) { - return static_cast(hWidget)->GetPageView(); + +CXFA_FFPageView* CXFA_FFWidgetHandler::GetPageView(CXFA_FFWidget* hWidget) { + return hWidget->GetPageView(); } -void CXFA_FFWidgetHandler::GetRect(IXFA_Widget* hWidget, CFX_RectF& rt) { - static_cast(hWidget)->GetWidgetRect(rt); +void CXFA_FFWidgetHandler::GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt) { + hWidget->GetWidgetRect(rt); } -uint32_t CXFA_FFWidgetHandler::GetStatus(IXFA_Widget* hWidget) { - return static_cast(hWidget)->GetStatus(); +uint32_t CXFA_FFWidgetHandler::GetStatus(CXFA_FFWidget* hWidget) { + return hWidget->GetStatus(); } -FX_BOOL CXFA_FFWidgetHandler::GetBBox(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::GetBBox(CXFA_FFWidget* hWidget, CFX_RectF& rtBox, uint32_t dwStatus, FX_BOOL bDrawFocus) { - return static_cast(hWidget) - ->GetBBox(rtBox, dwStatus, bDrawFocus); + return hWidget->GetBBox(rtBox, dwStatus, bDrawFocus); } -CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(IXFA_Widget* hWidget) { - return static_cast(hWidget)->GetDataAcc(); +CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(CXFA_FFWidget* hWidget) { + return hWidget->GetDataAcc(); } -void CXFA_FFWidgetHandler::GetName(IXFA_Widget* hWidget, +void CXFA_FFWidgetHandler::GetName(CXFA_FFWidget* hWidget, CFX_WideString& wsName, int32_t iNameType) { - static_cast(hWidget)->GetDataAcc()->GetName(wsName, - iNameType); + hWidget->GetDataAcc()->GetName(wsName, iNameType); } -FX_BOOL CXFA_FFWidgetHandler::GetToolTip(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::GetToolTip(CXFA_FFWidget* hWidget, CFX_WideString& wsToolTip) { - return static_cast(hWidget)->GetToolTip(wsToolTip); + return hWidget->GetToolTip(wsToolTip); } -void CXFA_FFWidgetHandler::SetPrivateData(IXFA_Widget* hWidget, +void CXFA_FFWidgetHandler::SetPrivateData(CXFA_FFWidget* hWidget, void* module_id, void* pData, PD_CALLBACK_FREEDATA callback) { - static_cast(hWidget) - ->SetPrivateData(module_id, pData, callback); + hWidget->SetPrivateData(module_id, pData, callback); } -void* CXFA_FFWidgetHandler::GetPrivateData(IXFA_Widget* hWidget, +void* CXFA_FFWidgetHandler::GetPrivateData(CXFA_FFWidget* hWidget, void* module_id) { - return static_cast(hWidget)->GetPrivateData(module_id); + return hWidget->GetPrivateData(module_id); } -FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(IXFA_Widget* hWidget) { +FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { m_pDocView->LockUpdate(); - FX_BOOL bRet = static_cast(hWidget)->OnMouseEnter(); + FX_BOOL bRet = hWidget->OnMouseEnter(); m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(IXFA_Widget* hWidget) { +FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { m_pDocView->LockUpdate(); - FX_BOOL bRet = static_cast(hWidget)->OnMouseExit(); + FX_BOOL bRet = hWidget->OnMouseExit(); m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { m_pDocView->LockUpdate(); - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnLButtonDown(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); if (bRet && m_pDocView->SetFocus(hWidget)) { ((CXFA_FFDoc*)m_pDocView->GetDoc()) ->GetDocProvider() - ->SetFocusWidget(m_pDocView->GetDoc(), (IXFA_Widget*)hWidget); + ->SetFocusWidget(m_pDocView->GetDoc(), (CXFA_FFWidget*)hWidget); } m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { m_pDocView->LockUpdate(); - static_cast(hWidget)->Rotate2Normal(fx, fy); + hWidget->Rotate2Normal(fx, fy); m_pDocView->m_bLayoutEvent = TRUE; - FX_BOOL bRet = - static_cast(hWidget)->OnLButtonUp(dwFlags, fx, fy); + FX_BOOL bRet = hWidget->OnLButtonUp(dwFlags, fx, fy); m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnLButtonDblClk(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnMouseMove(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnMouseMove(dwFlags, fx, fy); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, uint32_t dwFlags, int16_t zDelta, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = static_cast(hWidget) - ->OnMouseWheel(dwFlags, zDelta, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnRButtonDown(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); if (bRet && m_pDocView->SetFocus(hWidget)) { ((CXFA_FFDoc*)m_pDocView->GetDoc()) ->GetDocProvider() - ->SetFocusWidget(m_pDocView->GetDoc(), (IXFA_Widget*)hWidget); + ->SetFocusWidget(m_pDocView->GetDoc(), (CXFA_FFWidget*)hWidget); } m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnRButtonUp(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnRButtonUp(dwFlags, fx, fy); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - FX_BOOL bRet = - static_cast(hWidget)->OnRButtonDblClk(dwFlags, fx, fy); + hWidget->Rotate2Normal(fx, fy); + FX_BOOL bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags) { - FX_BOOL bRet = - static_cast(hWidget)->OnKeyDown(dwKeyCode, dwFlags); + FX_BOOL bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags); m_pDocView->RunInvalidate(); m_pDocView->UpdateDocView(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags) { - FX_BOOL bRet = - static_cast(hWidget)->OnKeyUp(dwKeyCode, dwFlags); + FX_BOOL bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags); m_pDocView->RunInvalidate(); return bRet; } -FX_BOOL CXFA_FFWidgetHandler::OnChar(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags) { - FX_BOOL bRet = static_cast(hWidget)->OnChar(dwChar, dwFlags); + FX_BOOL bRet = hWidget->OnChar(dwChar, dwFlags); m_pDocView->RunInvalidate(); return bRet; } -uint32_t CXFA_FFWidgetHandler::OnHitTest(IXFA_Widget* hWidget, +uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { - if (!(static_cast(hWidget)->GetStatus() & - XFA_WIDGETSTATUS_Visible)) { + if (!(hWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) return FWL_WGTHITTEST_Unknown; - } - static_cast(hWidget)->Rotate2Normal(fx, fy); - return static_cast(hWidget)->OnHitTest(fx, fy); + + hWidget->Rotate2Normal(fx, fy); + return hWidget->OnHitTest(fx, fy); } -FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { - static_cast(hWidget)->Rotate2Normal(fx, fy); - return static_cast(hWidget)->OnSetCursor(fx, fy); + hWidget->Rotate2Normal(fx, fy); + return hWidget->OnSetCursor(fx, fy); } -void CXFA_FFWidgetHandler::RenderWidget(IXFA_Widget* hWidget, +void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, FX_BOOL bHighlight) { - static_cast(hWidget)->RenderWidget( - pGS, pMatrix, bHighlight ? XFA_WIDGETSTATUS_Highlight : 0, 0); + hWidget->RenderWidget(pGS, pMatrix, + bHighlight ? XFA_WIDGETSTATUS_Highlight : 0, 0); } FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType) { @@ -288,15 +278,13 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); return iRet; } -IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent, - XFA_WIDGETTYPE eType, - IXFA_Widget* hBefore) { +CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, + XFA_WIDGETTYPE eType, + CXFA_FFWidget* hBefore) { CXFA_Node* pParentFormItem = - hParent ? static_cast(hParent)->GetDataAcc()->GetNode() - : NULL; + hParent ? hParent->GetDataAcc()->GetNode() : nullptr; CXFA_Node* pBeforeFormItem = - hBefore ? static_cast(hBefore)->GetDataAcc()->GetNode() - : NULL; + hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr; CXFA_Node* pNewFormItem = CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); if (pNewFormItem == NULL) { @@ -307,7 +295,7 @@ IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent, m_pDocView->RunLayout(); CXFA_LayoutItem* pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); - return (IXFA_Widget*)pLayout; + return (CXFA_FFWidget*)pLayout; } CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( XFA_WIDGETTYPE eType, @@ -561,74 +549,77 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue, CreateCopyNode(eValue, pValue); return pValue; } -IXFA_ObjFactory* CXFA_FFWidgetHandler::GetObjFactory() const { +CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { return GetXFADoc()->GetParser()->GetFactory(); } CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); } + CXFA_FFMenuHandler::CXFA_FFMenuHandler() {} + CXFA_FFMenuHandler::~CXFA_FFMenuHandler() {} -FX_BOOL CXFA_FFMenuHandler::CanCopy(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanCopy(); + +FX_BOOL CXFA_FFMenuHandler::CanCopy(CXFA_FFWidget* hWidget) { + return hWidget->CanCopy(); } -FX_BOOL CXFA_FFMenuHandler::CanCut(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanCut(); +FX_BOOL CXFA_FFMenuHandler::CanCut(CXFA_FFWidget* hWidget) { + return hWidget->CanCut(); } -FX_BOOL CXFA_FFMenuHandler::CanPaste(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanPaste(); +FX_BOOL CXFA_FFMenuHandler::CanPaste(CXFA_FFWidget* hWidget) { + return hWidget->CanPaste(); } -FX_BOOL CXFA_FFMenuHandler::CanSelectAll(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanSelectAll(); +FX_BOOL CXFA_FFMenuHandler::CanSelectAll(CXFA_FFWidget* hWidget) { + return hWidget->CanSelectAll(); } -FX_BOOL CXFA_FFMenuHandler::CanDelete(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanDelete(); +FX_BOOL CXFA_FFMenuHandler::CanDelete(CXFA_FFWidget* hWidget) { + return hWidget->CanDelete(); } -FX_BOOL CXFA_FFMenuHandler::CanDeSelect(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanDeSelect(); +FX_BOOL CXFA_FFMenuHandler::CanDeSelect(CXFA_FFWidget* hWidget) { + return hWidget->CanDeSelect(); } -FX_BOOL CXFA_FFMenuHandler::Copy(IXFA_Widget* hWidget, CFX_WideString& wsText) { - return static_cast(hWidget)->Copy(wsText); +FX_BOOL CXFA_FFMenuHandler::Copy(CXFA_FFWidget* hWidget, + CFX_WideString& wsText) { + return hWidget->Copy(wsText); } -FX_BOOL CXFA_FFMenuHandler::Cut(IXFA_Widget* hWidget, CFX_WideString& wsText) { - return static_cast(hWidget)->Cut(wsText); +FX_BOOL CXFA_FFMenuHandler::Cut(CXFA_FFWidget* hWidget, + CFX_WideString& wsText) { + return hWidget->Cut(wsText); } -FX_BOOL CXFA_FFMenuHandler::Paste(IXFA_Widget* hWidget, +FX_BOOL CXFA_FFMenuHandler::Paste(CXFA_FFWidget* hWidget, const CFX_WideString& wsText) { - return static_cast(hWidget)->Paste(wsText); + return hWidget->Paste(wsText); } -FX_BOOL CXFA_FFMenuHandler::SelectAll(IXFA_Widget* hWidget) { - return static_cast(hWidget)->SelectAll(); +FX_BOOL CXFA_FFMenuHandler::SelectAll(CXFA_FFWidget* hWidget) { + return hWidget->SelectAll(); } -FX_BOOL CXFA_FFMenuHandler::Delete(IXFA_Widget* hWidget) { - return static_cast(hWidget)->Delete(); +FX_BOOL CXFA_FFMenuHandler::Delete(CXFA_FFWidget* hWidget) { + return hWidget->Delete(); } -FX_BOOL CXFA_FFMenuHandler::DeSelect(IXFA_Widget* hWidget) { - return static_cast(hWidget)->DeSelect(); +FX_BOOL CXFA_FFMenuHandler::DeSelect(CXFA_FFWidget* hWidget) { + return hWidget->DeSelect(); } -FX_BOOL CXFA_FFMenuHandler::CanUndo(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanUndo(); +FX_BOOL CXFA_FFMenuHandler::CanUndo(CXFA_FFWidget* hWidget) { + return hWidget->CanUndo(); } -FX_BOOL CXFA_FFMenuHandler::CanRedo(IXFA_Widget* hWidget) { - return static_cast(hWidget)->CanRedo(); +FX_BOOL CXFA_FFMenuHandler::CanRedo(CXFA_FFWidget* hWidget) { + return hWidget->CanRedo(); } -FX_BOOL CXFA_FFMenuHandler::Undo(IXFA_Widget* hWidget) { - return static_cast(hWidget)->Undo(); +FX_BOOL CXFA_FFMenuHandler::Undo(CXFA_FFWidget* hWidget) { + return hWidget->Undo(); } -FX_BOOL CXFA_FFMenuHandler::Redo(IXFA_Widget* hWidget) { - return static_cast(hWidget)->Redo(); +FX_BOOL CXFA_FFMenuHandler::Redo(CXFA_FFWidget* hWidget) { + return hWidget->Redo(); } FX_BOOL CXFA_FFMenuHandler::GetSuggestWords( - IXFA_Widget* hWidget, + CXFA_FFWidget* hWidget, CFX_PointF pointf, std::vector& sSuggest) { - return static_cast(hWidget) - ->GetSuggestWords(pointf, sSuggest); + return hWidget->GetSuggestWords(pointf, sSuggest); } FX_BOOL CXFA_FFMenuHandler::ReplaceSpellCheckWord( - IXFA_Widget* hWidget, + CXFA_FFWidget* hWidget, CFX_PointF pointf, const CFX_ByteStringC& bsReplace) { - return static_cast(hWidget) - ->ReplaceSpellCheckWord(pointf, bsReplace); + return hWidget->ReplaceSpellCheckWord(pointf, bsReplace); } diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.h b/xfa/fxfa/app/xfa_ffwidgethandler.h deleted file mode 100644 index 931eb28437..0000000000 --- a/xfa/fxfa/app/xfa_ffwidgethandler.h +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ -#define XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ - -#include - -#include "xfa/fxfa/parser/xfa_document.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FFDocView; - -class CXFA_FFWidgetHandler : public IXFA_WidgetHandler { - public: - CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); - ~CXFA_FFWidgetHandler(); - virtual IXFA_Widget* CreateWidget(IXFA_Widget* hParent, - XFA_WIDGETTYPE eType, - IXFA_Widget* hBefore = NULL); - virtual IXFA_PageView* GetPageView(IXFA_Widget* hWidget); - virtual void GetRect(IXFA_Widget* hWidget, CFX_RectF& rt); - virtual uint32_t GetStatus(IXFA_Widget* hWidget); - virtual FX_BOOL GetBBox(IXFA_Widget* hWidget, - CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus = FALSE); - virtual CXFA_WidgetAcc* GetDataAcc(IXFA_Widget* hWidget); - virtual void GetName(IXFA_Widget* hWidget, - CFX_WideString& wsName, - int32_t iNameType = 0); - virtual FX_BOOL GetToolTip(IXFA_Widget* hWidget, CFX_WideString& wsToolTip); - virtual void SetPrivateData(IXFA_Widget* hWidget, - void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); - virtual void* GetPrivateData(IXFA_Widget* hWidget, void* module_id); - virtual FX_BOOL OnMouseEnter(IXFA_Widget* hWidget); - virtual FX_BOOL OnMouseExit(IXFA_Widget* hWidget); - virtual FX_BOOL OnLButtonDown(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnLButtonUp(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnLButtonDblClk(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnMouseMove(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnMouseWheel(IXFA_Widget* hWidget, - uint32_t dwFlags, - int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnRButtonDown(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnRButtonUp(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnRButtonDblClk(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy); - - virtual FX_BOOL OnKeyDown(IXFA_Widget* hWidget, - uint32_t dwKeyCode, - uint32_t dwFlags); - virtual FX_BOOL OnKeyUp(IXFA_Widget* hWidget, - uint32_t dwKeyCode, - uint32_t dwFlags); - virtual FX_BOOL OnChar(IXFA_Widget* hWidget, - uint32_t dwChar, - uint32_t dwFlags); - virtual uint32_t OnHitTest(IXFA_Widget* hWidget, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnSetCursor(IXFA_Widget* hWidget, FX_FLOAT fx, FX_FLOAT fy); - virtual void RenderWidget(IXFA_Widget* hWidget, - CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - FX_BOOL bHighlight = FALSE); - virtual FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, - XFA_EVENTTYPE eEventType); - virtual int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, - CXFA_EventParam* pParam); - - protected: - CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType, - CXFA_Node* pParent, - CXFA_Node* pBefore) const; - - CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateField(XFA_ELEMENT eElement, - CXFA_Node* pParent, - CXFA_Node* pBefore) const; - CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateDraw(XFA_ELEMENT eElement, - CXFA_Node* pParent, - CXFA_Node* pBefore) const; - - CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const; - CXFA_Node* CreateFormItem(XFA_ELEMENT eElement, - CXFA_Node* pParent, - CXFA_Node* pBefore) const; - CXFA_Node* CreateCopyNode(XFA_ELEMENT eElement, - CXFA_Node* pParent, - CXFA_Node* pBefore = NULL) const; - CXFA_Node* CreateTemplateNode(XFA_ELEMENT eElement, - CXFA_Node* pParent, - CXFA_Node* pBefore) const; - CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; - CXFA_Node* CreateMarginNode(CXFA_Node* pParent, - uint32_t dwFlags, - FX_FLOAT fInsets[4]) const; - CXFA_Node* CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const; - IXFA_ObjFactory* GetObjFactory() const; - CXFA_Document* GetXFADoc() const; - - CXFA_FFDocView* m_pDocView; -}; - -class CXFA_FFMenuHandler : public IXFA_MenuHandler { - public: - CXFA_FFMenuHandler(); - ~CXFA_FFMenuHandler(); - virtual FX_BOOL CanCopy(IXFA_Widget* hWidget); - virtual FX_BOOL CanCut(IXFA_Widget* hWidget); - virtual FX_BOOL CanPaste(IXFA_Widget* hWidget); - virtual FX_BOOL CanSelectAll(IXFA_Widget* hWidget); - virtual FX_BOOL CanDelete(IXFA_Widget* hWidget); - virtual FX_BOOL CanDeSelect(IXFA_Widget* hWidget); - virtual FX_BOOL Copy(IXFA_Widget* hWidget, CFX_WideString& wsText); - virtual FX_BOOL Cut(IXFA_Widget* hWidget, CFX_WideString& wsText); - virtual FX_BOOL Paste(IXFA_Widget* hWidget, const CFX_WideString& wsText); - virtual FX_BOOL SelectAll(IXFA_Widget* hWidget); - virtual FX_BOOL Delete(IXFA_Widget* hWidget); - virtual FX_BOOL DeSelect(IXFA_Widget* hWidget); - virtual FX_BOOL CanUndo(IXFA_Widget* hWidget); - virtual FX_BOOL CanRedo(IXFA_Widget* hWidget); - virtual FX_BOOL Undo(IXFA_Widget* hWidget); - virtual FX_BOOL Redo(IXFA_Widget* hWidget); - virtual FX_BOOL GetSuggestWords(IXFA_Widget* hWidget, - CFX_PointF pointf, - std::vector& sSuggest); - virtual FX_BOOL ReplaceSpellCheckWord(IXFA_Widget* hWidget, - CFX_PointF pointf, - const CFX_ByteStringC& bsReplace); -}; - -#endif // XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 256af6cf21..fb6fd39249 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_fontmgr.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" #include #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ static const XFA_FONTINFO g_XFAFontsMap[] = { @@ -1748,12 +1748,7 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( return NULL; #endif } -// static -IXFA_FontMgr* IXFA_FontMgr::CreateDefault() { - return new CXFA_DefFontMgr; -} -// virtual -IXFA_FontMgr::~IXFA_FontMgr() {} + CXFA_DefFontMgr::~CXFA_DefFontMgr() { int32_t iCounts = m_CacheFonts.GetSize(); for (int32_t i = 0; i < iCounts; i++) { @@ -1762,13 +1757,12 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { m_CacheFonts.RemoveAll(); } -IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { CFX_WideString wsFontName = wsFontFamily; - IFX_FontMgr* pFDEFontMgr = - static_cast(hDoc)->GetApp()->GetFDEFontMgr(); + IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); @@ -1806,11 +1800,11 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, return pFont; } -IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_DefFontMgr::GetDefaultFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr(); + IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) @@ -2018,7 +2012,7 @@ CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(NULL) {} CXFA_FontMgr::~CXFA_FontMgr() { DelAllMgrMap(); } -IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { @@ -2061,12 +2055,12 @@ IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, } return pFont; } -void CXFA_FontMgr::LoadDocFonts(IXFA_Doc* hDoc) { +void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) { if (!m_PDFFontMgrArray.GetValueAt(hDoc)) { - m_PDFFontMgrArray.SetAt(hDoc, new CXFA_PDFFontMgr((CXFA_FFDoc*)hDoc)); + m_PDFFontMgrArray.SetAt(hDoc, new CXFA_PDFFontMgr(hDoc)); } } -void CXFA_FontMgr::ReleaseDocFonts(IXFA_Doc* hDoc) { +void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { CXFA_PDFFontMgr* pMgr = NULL; if (m_PDFFontMgrArray.Lookup(hDoc, (void*&)pMgr)) { delete pMgr; @@ -2076,7 +2070,7 @@ void CXFA_FontMgr::ReleaseDocFonts(IXFA_Doc* hDoc) { void CXFA_FontMgr::DelAllMgrMap() { FX_POSITION ps = m_PDFFontMgrArray.GetStartPosition(); while (ps) { - IXFA_Doc* hDoc = NULL; + CXFA_FFDoc* hDoc = NULL; CXFA_PDFFontMgr* pMgr = NULL; m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); delete pMgr; @@ -2084,6 +2078,6 @@ void CXFA_FontMgr::DelAllMgrMap() { m_PDFFontMgrArray.RemoveAll(); m_FontMap.clear(); } -void CXFA_FontMgr::SetDefFontMgr(IXFA_FontMgr* pFontMgr) { +void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { m_pDefFontMgr = pFontMgr; } diff --git a/xfa/fxfa/app/xfa_fontmgr.h b/xfa/fxfa/app/xfa_fontmgr.h deleted file mode 100644 index 20d3e5656c..0000000000 --- a/xfa/fxfa/app/xfa_fontmgr.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FONTMGR_H_ -#define XFA_FXFA_APP_XFA_FONTMGR_H_ - -#include - -#include "core/fxcrt/include/fx_ext.h" -#include "core/fxcrt/include/fx_system.h" -#include "xfa/fgas/font/fgas_font.h" -#include "xfa/include/fxfa/fxfa.h" - -class CPDF_Font; - -struct XFA_FONTINFO { - uint32_t dwFontNameHash; - const FX_WCHAR* pPsName; - const FX_WCHAR* pReplaceFont; - uint16_t dwStyles; - uint16_t wCodePage; -}; - -class CXFA_DefFontMgr : public IXFA_FontMgr { - public: - CXFA_DefFontMgr() {} - ~CXFA_DefFontMgr() override; - - // IXFA_FontMgr: - IFX_Font* GetFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; - IFX_Font* GetDefaultFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; - - protected: - CFX_PtrArray m_CacheFonts; -}; - -class CXFA_PDFFontMgr : public IFX_FontProvider { - public: - CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); - ~CXFA_PDFFontMgr(); - IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch = TRUE); - FX_BOOL GetCharWidth(IFX_Font* pFont, - FX_WCHAR wUnicode, - int32_t& iWidth, - FX_BOOL bCharCode); - CFX_MapPtrToPtr m_FDE2PDFFont; - - protected: - IFX_Font* FindFont(CFX_ByteString strFamilyName, - FX_BOOL bBold, - FX_BOOL bItalic, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch = TRUE); - CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, - FX_BOOL bBold, - FX_BOOL bItalic); - FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, - FX_BOOL bBold, - FX_BOOL bItalic, - const CFX_ByteString& bsDRFontName, - FX_BOOL bStrictMatch = TRUE); - - CXFA_FFDoc* m_pDoc; - std::map m_FontMap; -}; - -class CXFA_FontMgr { - public: - CXFA_FontMgr(); - ~CXFA_FontMgr(); - IFX_Font* GetFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); - void LoadDocFonts(IXFA_Doc* hDoc); - void ReleaseDocFonts(IXFA_Doc* hDoc); - - void SetDefFontMgr(IXFA_FontMgr* pFontMgr); - - protected: - void DelAllMgrMap(); - - CFX_MapPtrToPtr m_PDFFontMgrArray; - IXFA_FontMgr* m_pDefFontMgr; - std::map m_FontMap; -}; - -#endif // XFA_FXFA_APP_XFA_FONTMGR_H_ diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index 78d4918a9c..c1732776b2 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/app/xfa_fwladapter.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_fffield.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect) { diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 9c55b27652..4c3d4de801 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -21,9 +21,9 @@ #include "xfa/fwl/basewidget/ifwl_scrollbar.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" +#include "xfa/include/fxfa/xfa_ffapp.h" namespace { diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 33ceb477cf..72a516b755 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -21,7 +21,7 @@ #include "xfa/fwl/theme/cfwl_pushbuttontp.h" #include "xfa/fwl/theme/cfwl_scrollbartp.h" #include "xfa/fwl/theme/cfwl_widgettp.h" -#include "xfa/fxfa/app/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" class CXFA_FWLTheme : public IFWL_ThemeProvider { public: diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp index ec9a3f88f4..a454ec0e5d 100644 --- a/xfa/fxfa/app/xfa_rendercontext.cpp +++ b/xfa/fxfa/app/xfa_rendercontext.cpp @@ -4,16 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_rendercontext.h" +#include "xfa/include/fxfa/xfa_rendercontext.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #define XFA_RENDERCONTEXT_MaxCount 30 -IXFA_RenderContext* XFA_RenderContext_Create() { - return new CXFA_RenderContext; -} CXFA_RenderContext::CXFA_RenderContext() { m_pWidgetIterator = NULL; m_pWidget = NULL; @@ -26,7 +24,7 @@ CXFA_RenderContext::CXFA_RenderContext() { CXFA_RenderContext::~CXFA_RenderContext() { StopRender(); } -int32_t CXFA_RenderContext::StartRender(IXFA_PageView* pPageView, +int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView, CFX_Graphics* pGS, const CFX_Matrix& matrix, const CXFA_RenderOptions& options) { diff --git a/xfa/fxfa/app/xfa_rendercontext.h b/xfa/fxfa/app/xfa_rendercontext.h deleted file mode 100644 index c19adeddfa..0000000000 --- a/xfa/fxfa/app/xfa_rendercontext.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ -#define XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ - -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_RenderContext : public IXFA_RenderContext { - public: - CXFA_RenderContext(); - virtual ~CXFA_RenderContext(); - virtual void Release() { delete this; } - virtual int32_t StartRender(IXFA_PageView* pPageView, - CFX_Graphics* pGS, - const CFX_Matrix& matrix, - const CXFA_RenderOptions& options); - virtual int32_t DoRender(IFX_Pause* pPause = NULL); - virtual void StopRender(); - - protected: - IXFA_WidgetIterator* m_pWidgetIterator; - IXFA_Widget* m_pWidget; - IXFA_PageView* m_pPageView; - CFX_Graphics* m_pGS; - CFX_Matrix m_matrix; - CXFA_RenderOptions m_options; - uint32_t m_dwStatus; - CFX_RectF m_rtClipRect; -}; - -#endif // XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index ced7acbb32..f60ed26c64 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -13,9 +13,10 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fgas/crt/fgas_codepage.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" +#include "xfa/fxfa/app/xfa_ffwidgetacc.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_CSSTagProvider::~CXFA_CSSTagProvider() { FX_POSITION pos = m_Attributes.GetStartPosition(); @@ -88,7 +89,7 @@ void CXFA_TextParser::Reset() { m_pAllocator = NULL; } } -void CXFA_TextParser::InitCSSData(IXFA_TextProvider* pTextProvider) { +void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { if (pTextProvider == NULL) { return; } @@ -125,7 +126,7 @@ IFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() { CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); } IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( - IXFA_TextProvider* pTextProvider) { + CXFA_TextProvider* pTextProvider) { CXFA_Font font = pTextProvider->GetFontNode(); CXFA_Para para = pTextProvider->GetParaNode(); IFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(NULL); @@ -232,7 +233,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( return pStyle; } void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, - IXFA_TextProvider* pTextProvider) { + CXFA_TextProvider* pTextProvider) { if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { return; } @@ -316,7 +317,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, tagProvider.m_bContent = TRUE; } } -int32_t CXFA_TextParser::GetVAlgin(IXFA_TextProvider* pTextProvider) const { +int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { int32_t iAlign = XFA_ATTRIBUTEENUM_Top; CXFA_Para para = pTextProvider->GetParaNode(); if (para) { @@ -347,7 +348,7 @@ FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { } return FALSE; } -IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, +IFX_Font* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { CFX_WideStringC wsFamily = FX_WSTRC(L"Courier"); uint32_t dwStyle = 0; @@ -379,7 +380,7 @@ IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, CXFA_FontMgr* pFontMgr = pDoc->GetApp()->GetXFAFontMgr(); return pFontMgr->GetFont(pDoc, wsFamily, dwStyle); } -FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) return pStyle->GetFontStyles()->GetFontSize(); @@ -390,7 +391,7 @@ FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, } return 10; } -int32_t CXFA_TextParser::GetHorScale(IXFA_TextProvider* pTextProvider, +int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, CFDE_XMLNode* pXMLNode) const { if (pStyle) { @@ -415,7 +416,7 @@ int32_t CXFA_TextParser::GetHorScale(IXFA_TextProvider* pTextProvider, } return 100; } -int32_t CXFA_TextParser::GetVerScale(IXFA_TextProvider* pTextProvider, +int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) { CFX_WideString wsValue; @@ -428,7 +429,7 @@ int32_t CXFA_TextParser::GetVerScale(IXFA_TextProvider* pTextProvider, } return 100; } -void CXFA_TextParser::GetUnderline(IXFA_TextProvider* pTextProvider, +void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iUnderline, int32_t& iPeriod) const { @@ -457,7 +458,7 @@ void CXFA_TextParser::GetUnderline(IXFA_TextProvider* pTextProvider, } } } -void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, +void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iLinethrough) const { if (pStyle) { @@ -470,7 +471,7 @@ void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, } } } -FX_ARGB CXFA_TextParser::GetColor(IXFA_TextProvider* pTextProvider, +FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) return pStyle->GetFontStyles()->GetColor(); @@ -480,7 +481,7 @@ FX_ARGB CXFA_TextParser::GetColor(IXFA_TextProvider* pTextProvider, return 0xFF000000; } -FX_FLOAT CXFA_TextParser::GetBaseline(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) { IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles(); @@ -492,7 +493,7 @@ FX_FLOAT CXFA_TextParser::GetBaseline(IXFA_TextProvider* pTextProvider, } return 0; } -FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, FX_BOOL bFirst, FX_FLOAT fVerScale) const { @@ -515,7 +516,7 @@ FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, fLineHeight *= fVerScale; return fLineHeight; } -FX_BOOL CXFA_TextParser::GetEmbbedObj(IXFA_TextProvider* pTextProvider, +FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, CFX_WideString& wsValue) { wsValue.Empty(); @@ -664,7 +665,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( } return TRUE; } -CXFA_TextLayout::CXFA_TextLayout(IXFA_TextProvider* pTextProvider) +CXFA_TextLayout::CXFA_TextLayout(CXFA_TextProvider* pTextProvider) : m_bHasBlock(FALSE), m_pTextProvider(pTextProvider), m_pTextDataNode(nullptr), diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 1d2db21652..9b92e1796a 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -11,29 +11,16 @@ #include "xfa/fde/fde_brush.h" #include "xfa/fde/fde_renderdevice.h" #include "xfa/fgas/layout/fgas_rtfbreak.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 class CXFA_Para; class CXFA_Font; +class CXFA_TextProvider; class CXFA_TextTabstopsContext; -class IXFA_TextProvider { - public: - virtual ~IXFA_TextProvider() {} - virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText) = 0; - virtual CXFA_Para GetParaNode() = 0; - virtual CXFA_Font GetFontNode() = 0; - virtual FX_BOOL IsCheckButtonAndAutoWidth() = 0; - virtual CXFA_FFDoc* GetDocNode() = 0; - virtual FX_BOOL GetEmbbedObj(FX_BOOL bURI, - FX_BOOL bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue) = 0; -}; - class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { public: CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} @@ -88,49 +75,49 @@ class CXFA_TextParser { CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} virtual ~CXFA_TextParser(); void Reset(); - void DoParse(CFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); - IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); + void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); + IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider); IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle); FX_BOOL IsParsed() const { return m_pAllocator != NULL; } - int32_t GetVAlgin(IXFA_TextProvider* pTextProvider) const; + int32_t GetVAlgin(CXFA_TextProvider* pTextProvider) const; FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_TextTabstopsContext* pTabstopContext); - IFX_Font* GetFont(IXFA_TextProvider* pTextProvider, + IFX_Font* GetFont(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetFontSize(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - int32_t GetHorScale(IXFA_TextProvider* pTextProvider, + int32_t GetHorScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, CFDE_XMLNode* pXMLNode) const; - int32_t GetVerScale(IXFA_TextProvider* pTextProvider, + int32_t GetVerScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - void GetUnderline(IXFA_TextProvider* pTextProvider, + void GetUnderline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iUnderline, int32_t& iPeriod) const; - void GetLinethrough(IXFA_TextProvider* pTextProvider, + void GetLinethrough(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iLinethrough) const; - FX_ARGB GetColor(IXFA_TextProvider* pTextProvider, + FX_ARGB GetColor(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetBaseline(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetLineHeight(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, FX_BOOL bFirst, FX_FLOAT fVerScale) const; - FX_BOOL GetEmbbedObj(IXFA_TextProvider* pTextProvider, + FX_BOOL GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, CFX_WideString& wsValue); CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); private: - void InitCSSData(IXFA_TextProvider* pTextProvider); + void InitCSSData(CXFA_TextProvider* pTextProvider); void ParseRichText(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle); void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); @@ -324,7 +311,7 @@ class CXFA_TextTabstopsContext { class CXFA_TextLayout { public: - CXFA_TextLayout(IXFA_TextProvider* pTextProvider); + CXFA_TextLayout(CXFA_TextProvider* pTextProvider); virtual ~CXFA_TextLayout(); int32_t GetText(CFX_WideString& wsText); FX_FLOAT GetLayoutHeight(); @@ -408,7 +395,7 @@ class CXFA_TextLayout { FX_BOOL Layout(int32_t iBlock); int32_t CountBlocks() const; - IXFA_TextProvider* m_pTextProvider; + CXFA_TextProvider* m_pTextProvider; CXFA_Node* m_pTextDataNode; FX_BOOL m_bRichText; IFX_MEMAllocator* m_pAllocator; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 3acae67bc3..971c09d6f3 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -10,10 +10,13 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxjse/cfxjse_arguments.h" #define FINANCIAL_PRECISION 0.00000001 @@ -1596,7 +1599,7 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, int32_t second = uniTime.GetSecond(); int32_t milSecond = uniTime.GetMillisecond(); int32_t mins = hour * 60 + min; - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); + CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get(); if (pProvider) { FX_TIMEZONE tz; pProvider->GetTimeZone(tz); @@ -6835,7 +6838,7 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( if (!pDoc) { return bFlags; } - IXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); XFA_RESOLVENODE_RS resoveNodeRS; uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; @@ -6866,7 +6869,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, if (!pDoc) { return iRet; } - IXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); CXFA_Object* pNode = NULL; uint32_t dFlags = 0UL; if (bdotAccessor) { diff --git a/xfa/fxfa/parser/xfa_docdata.h b/xfa/fxfa/parser/xfa_docdata.h index b57b8da552..690ff3334f 100644 --- a/xfa/fxfa/parser/xfa_docdata.h +++ b/xfa/fxfa/parser/xfa_docdata.h @@ -13,24 +13,4 @@ enum XFA_DATAFORMAT { XFA_DATAFORMAT_XDP, }; -class IXFA_PacketExport { - public: - static IXFA_PacketExport* Create(CXFA_Document* pDocument, - XFA_DATAFORMAT eFormat = XFA_DATAFORMAT_XDP); - virtual ~IXFA_PacketExport() {} - virtual void Release() = 0; - virtual FX_BOOL Export(IFX_FileWrite* pWrite) = 0; - virtual FX_BOOL Export(IFX_FileWrite* pWrite, - CXFA_Node* pNode, - uint32_t dwFlag = 0, - const FX_CHAR* pChecksum = NULL) = 0; -}; -class IXFA_PacketImport { - public: - static IXFA_PacketImport* Create(CXFA_Document* pDstDoc); - virtual ~IXFA_PacketImport() {} - virtual void Release() = 0; - virtual FX_BOOL ImportData(IFX_FileRead* pDataDocument) = 0; -}; - #endif // XFA_FXFA_PARSER_XFA_DOCDATA_H_ diff --git a/xfa/fxfa/parser/xfa_doclayout.h b/xfa/fxfa/parser/xfa_doclayout.h index 8558cd0992..0bae0184ec 100644 --- a/xfa/fxfa/parser/xfa_doclayout.h +++ b/xfa/fxfa/parser/xfa_doclayout.h @@ -11,16 +11,7 @@ class CXFA_ContainerLayoutItem; class CXFA_ContentLayoutItem; -class IXFA_DocLayout; - -class IXFA_LayoutPage { - public: - virtual ~IXFA_LayoutPage() {} - virtual IXFA_DocLayout* GetLayout() const = 0; - virtual int32_t GetPageIndex() const = 0; - virtual void GetPageSize(CFX_SizeF& size) = 0; - virtual CXFA_Node* GetMasterPage() const = 0; -}; +class CXFA_LayoutProcessor; class CXFA_LayoutItem { public: @@ -31,7 +22,7 @@ class CXFA_LayoutItem { inline CXFA_ContainerLayoutItem* AsContainerLayoutItem(); inline CXFA_ContentLayoutItem* AsContentLayoutItem(); - IXFA_LayoutPage* GetPage() const; + CXFA_ContainerLayoutItem* GetPage() const; CXFA_Node* GetFormNode() const; void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const; int32_t GetIndex() const; @@ -60,16 +51,14 @@ class CXFA_LayoutItem { FX_BOOL m_bIsContentLayoutItem; }; -class CXFA_ContainerLayoutItem : public CXFA_LayoutItem, - public IXFA_LayoutPage { +class CXFA_ContainerLayoutItem : public CXFA_LayoutItem { public: CXFA_ContainerLayoutItem(CXFA_Node* pNode); - // IXFA_LayoutPage: - IXFA_DocLayout* GetLayout() const override; - int32_t GetPageIndex() const override; - void GetPageSize(CFX_SizeF& size) override; - CXFA_Node* GetMasterPage() const override; + CXFA_LayoutProcessor* GetLayout() const; + int32_t GetPageIndex() const; + void GetPageSize(CFX_SizeF& size); + CXFA_Node* GetMasterPage() const; CXFA_Node* m_pOldSubform; }; @@ -121,16 +110,4 @@ class CXFA_TraverseStrategy_LayoutItem { } }; -class IXFA_DocLayout { - public: - virtual ~IXFA_DocLayout() {} - virtual CXFA_Document* GetDocument() const = 0; - virtual int32_t StartLayout(FX_BOOL bForceRestart = FALSE) = 0; - virtual int32_t DoLayout(IFX_Pause* pPause = NULL) = 0; - virtual FX_BOOL IncrementLayout() = 0; - virtual int32_t CountPages() const = 0; - virtual IXFA_LayoutPage* GetPage(int32_t index) const = 0; - virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem) = 0; -}; - #endif // XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index 5938f2da56..3c96e9a711 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -15,12 +15,11 @@ class CXFA_Document; class CXFA_LayoutItem; class CXFA_LayoutProcessor; class CXFA_Node; -class IXFA_DocLayout; -class IXFA_DocParser; -class IXFA_LayoutPage; -class IXFA_Notify; -class IXFA_ObjFactory; -class IXFA_ScriptContext; +class CXFA_LayoutProcessor; +class CXFA_DocumentParser; +class CXFA_ContainerLayoutItem; +class CXFA_FFNotify; +class CXFA_ScriptContext; enum XFA_VERSION { XFA_VERSION_UNKNOWN = 0, @@ -68,65 +67,6 @@ enum XFA_LAYOUTRESULT { #define XFA_LAYOUTNOTIFY_StrictHeight 0x0001 #define XFA_LAYOUTNOTIFY_NoParentBreak 0x0002 -class IXFA_Notify { - public: - virtual ~IXFA_Notify() {} - virtual void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - void* pParam = NULL) = 0; - - virtual void OnNodeEvent(CXFA_Node* pSender, - XFA_NODEEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL, - void* pParam3 = NULL, - void* pParam4 = NULL) = 0; - virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, - uint32_t dwEvent, - void* pParam = NULL, - void* pAdditional = NULL, - void* pAdditional2 = NULL) = 0; - - virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode) = 0; - virtual void OnLayoutEvent(IXFA_DocLayout* pLayout, - CXFA_LayoutItem* pSender, - XFA_LAYOUTEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL) = 0; - virtual void StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight) = 0; - virtual FX_BOOL FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos) = 0; - virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) = 0; - virtual int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_WidgetAcc* pExclude = NULL) = 0; - virtual void AddCalcValidate(CXFA_Node* pNode) = 0; - virtual IXFA_Doc* GetHDOC() = 0; - virtual IXFA_DocProvider* GetDocProvider() = 0; - virtual IXFA_AppProvider* GetAppProvider() = 0; - virtual IXFA_WidgetHandler* GetWidgetHandler() = 0; - virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem) = 0; - virtual void OpenDropDownList(IXFA_Widget* hWidget) = 0; - virtual CFX_WideString GetCurrentDateTime() = 0; - virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL) = 0; - virtual int32_t GetLayoutStatus() = 0; - virtual void RunNodeInitialize(CXFA_Node* pNode) = 0; - virtual void RunSubformIndexChange(CXFA_Node* pSubformNode) = 0; - virtual CXFA_Node* GetFocusWidgetNode() = 0; - virtual void SetFocusWidgetNode(CXFA_Node* pNode) = 0; -}; -class IXFA_ObjFactory { - public: - virtual ~IXFA_ObjFactory() {} - virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement) = 0; - virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, - XFA_ELEMENT eElement) = 0; -}; #define XFA_DOCFLAG_StrictScoping 0x0001 #define XFA_DOCFLAG_HasInteractive 0x0002 #define XFA_DOCFLAG_Interactive 0x0004 @@ -137,13 +77,13 @@ class CScript_HostPseudoModel; class CScript_LogPseudoModel; class CScript_LayoutPseudoModel; class CScript_SignaturePseudoModel; -class CXFA_Document : public IXFA_ObjFactory { +class CXFA_Document { public: - CXFA_Document(IXFA_DocParser* pParser); + CXFA_Document(CXFA_DocumentParser* pParser); ~CXFA_Document(); CXFA_Node* GetRoot() const { return m_pRootNode; } - IXFA_DocParser* GetParser() const { return m_pParser; } - IXFA_Notify* GetNotify() const; + CXFA_DocumentParser* GetParser() const { return m_pParser; } + CXFA_FFNotify* GetNotify() const; void SetRoot(CXFA_Node* pNewRoot); CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName); CXFA_Object* GetXFAObject(uint32_t wsNodeNameHash); @@ -156,9 +96,8 @@ class CXFA_Document : public IXFA_ObjFactory { XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); CXFA_LocaleMgr* GetLocalMgr(); - virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); - virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, - XFA_ELEMENT eElement); + CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); + CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement); void DoProtoMerge(); CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); void DoDataMerge(); @@ -172,17 +111,17 @@ class CXFA_Document : public IXFA_ObjFactory { void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); - IXFA_DocLayout* GetDocLayout(); - IXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); - IXFA_ScriptContext* GetScriptContext(); + CXFA_LayoutProcessor* GetDocLayout(); + CXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); + CXFA_ScriptContext* GetScriptContext(); void ClearLayoutData(); CFX_MapPtrTemplate m_rgGlobalBinding; CXFA_NodeArray m_pPendingPageSet; protected: - IXFA_DocParser* m_pParser; - IXFA_ScriptContext* m_pScriptContext; + CXFA_DocumentParser* m_pParser; + CXFA_ScriptContext* m_pScriptContext; CXFA_LayoutProcessor* m_pLayoutProcessor; CXFA_Node* m_pRootNode; CXFA_LocaleMgr* m_pLocalMgr; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 476dde4104..e525532f7c 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -18,7 +18,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" static FX_BOOL XFA_GetOccurInfo(CXFA_Node* pOccurNode, diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 6f08489c17..d56e57c99d 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -5,6 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -14,16 +15,18 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_datawindow.h" #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_logpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" #include "xfa/fxfa/parser/xfa_utils.h" -CXFA_Document::CXFA_Document(IXFA_DocParser* pParser) +CXFA_Document::CXFA_Document(CXFA_DocumentParser* pParser) : m_pParser(pParser), m_pScriptContext(nullptr), m_pLayoutProcessor(nullptr), @@ -88,7 +91,7 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { m_pRootNode = pNewRoot; RemovePurgeNode(pNewRoot); } -IXFA_Notify* CXFA_Document::GetNotify() const { +CXFA_FFNotify* CXFA_Document::GetNotify() const { return m_pParser->GetNotify(); } CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { @@ -245,17 +248,15 @@ CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { } return m_pLocalMgr; } -IXFA_ScriptContext* CXFA_Document::InitScriptContext(FXJSE_HRUNTIME hRuntime) { - if (!m_pScriptContext) { - m_pScriptContext = XFA_ScriptContext_Create(this); - } +CXFA_ScriptContext* CXFA_Document::InitScriptContext(FXJSE_HRUNTIME hRuntime) { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); m_pScriptContext->Initialize(hRuntime); return m_pScriptContext; } -IXFA_ScriptContext* CXFA_Document::GetScriptContext() { - if (!m_pScriptContext) { - m_pScriptContext = XFA_ScriptContext_Create(this); - } +CXFA_ScriptContext* CXFA_Document::GetScriptContext() { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); return m_pScriptContext; } XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp index dbaa6e4df7..79037d7ec7 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp @@ -28,7 +28,7 @@ CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() { } return m_pLayoutProcessor; } -IXFA_DocLayout* CXFA_Document::GetDocLayout() { +CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() { return GetLayoutProcessor(); } CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) @@ -133,7 +133,7 @@ FX_BOOL CXFA_LayoutProcessor::IncrementLayout() { int32_t CXFA_LayoutProcessor::CountPages() const { return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0; } -IXFA_LayoutPage* CXFA_LayoutProcessor::GetPage(int32_t index) const { +CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL; } CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { @@ -171,7 +171,7 @@ CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem) CXFA_LayoutItem::~CXFA_LayoutItem() {} CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {} -IXFA_DocLayout* CXFA_ContainerLayoutItem::GetLayout() const { +CXFA_LayoutProcessor* CXFA_ContainerLayoutItem::GetLayout() const { return m_pFormNode->GetDocument()->GetLayoutProcessor(); } int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.h b/xfa/fxfa/parser/xfa_document_layout_imp.h index 7f6c14e73f..4da405fc6c 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.h +++ b/xfa/fxfa/parser/xfa_document_layout_imp.h @@ -13,17 +13,18 @@ class CXFA_ItemLayoutProcessor; class CXFA_LayoutPageMgr; class CXFA_ContainerLayoutItem; -class CXFA_LayoutProcessor : public IXFA_DocLayout { +class CXFA_LayoutProcessor { public: CXFA_LayoutProcessor(CXFA_Document* pDocument); ~CXFA_LayoutProcessor(); - virtual CXFA_Document* GetDocument() const; - virtual int32_t StartLayout(FX_BOOL bForceRestart = FALSE); - virtual int32_t DoLayout(IFX_Pause* pPause = NULL); - virtual FX_BOOL IncrementLayout(); - virtual int32_t CountPages() const; - virtual IXFA_LayoutPage* GetPage(int32_t index) const; - virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); + + CXFA_Document* GetDocument() const; + int32_t StartLayout(FX_BOOL bForceRestart = FALSE); + int32_t DoLayout(IFX_Pause* pPause = NULL); + FX_BOOL IncrementLayout(); + int32_t CountPages() const; + CXFA_ContainerLayoutItem* GetPage(int32_t index) const; + CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); void AddChangedContainer(CXFA_Node* pContainer); void SetForceReLayout(FX_BOOL bForceRestart) { m_bNeeLayout = bForceRestart; } diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 289581ecae..f207b32263 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -15,12 +15,10 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" -IXFA_PacketImport* IXFA_PacketImport::Create(CXFA_Document* pDocument) { - return new CXFA_DataImporter(pDocument); -} CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { ASSERT(m_pDocument); @@ -465,10 +463,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML); } } -IXFA_PacketExport* IXFA_PacketExport::Create(CXFA_Document* pDocument, - XFA_DATAFORMAT eFormat) { - return new CXFA_DataExporter(pDocument); -} + CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { ASSERT(m_pDocument); diff --git a/xfa/fxfa/parser/xfa_document_serialize.h b/xfa/fxfa/parser/xfa_document_serialize.h index f18e163a8d..9bde4b038e 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.h +++ b/xfa/fxfa/parser/xfa_document_serialize.h @@ -9,32 +9,34 @@ #include "xfa/fxfa/parser/xfa_docdata.h" -class CXFA_DataImporter : public IXFA_PacketImport { +class CXFA_DataImporter { public: - CXFA_DataImporter(CXFA_Document* pDocument); - virtual void Release() { delete this; } - virtual FX_BOOL ImportData(IFX_FileRead* pDataDocument); + explicit CXFA_DataImporter(CXFA_Document* pDocument); + + void Release() { delete this; } + FX_BOOL ImportData(IFX_FileRead* pDataDocument); protected: - CXFA_Document* m_pDocument; + CXFA_Document* const m_pDocument; }; -class CXFA_DataExporter : public IXFA_PacketExport { +class CXFA_DataExporter { public: - CXFA_DataExporter(CXFA_Document* pDocument); - virtual void Release() { delete this; } - virtual FX_BOOL Export(IFX_FileWrite* pWrite); - virtual FX_BOOL Export(IFX_FileWrite* pWrite, - CXFA_Node* pNode, - uint32_t dwFlag = 0, - const FX_CHAR* pChecksum = NULL); + explicit CXFA_DataExporter(CXFA_Document* pDocument); + + void Release() { delete this; } + FX_BOOL Export(IFX_FileWrite* pWrite); + FX_BOOL Export(IFX_FileWrite* pWrite, + CXFA_Node* pNode, + uint32_t dwFlag = 0, + const FX_CHAR* pChecksum = NULL); protected: FX_BOOL Export(IFX_Stream* pStream, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum); - CXFA_Document* m_pDocument; + CXFA_Document* const m_pDocument; }; #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_SERIALIZE_H_ diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp index b175cad9c6..e223ab8ce7 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp +++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_layout_appadapter.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -16,6 +17,7 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -41,9 +43,9 @@ uint32_t XFA_GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) { } void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { CXFA_LayoutItem* pNext = pNode->m_pNextSibling; diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 2924fad922..0f22a27bd7 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -10,6 +10,7 @@ #include #include "xfa/fgas/crt/fgas_algorithm.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -20,6 +21,7 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -91,7 +93,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( case XFA_ATTRIBUTEENUM_None: { FX_BOOL bAnyChanged = FALSE; CXFA_Document* pDocument = pFormNode->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); @@ -353,7 +355,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); } -IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const { +CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { for (CXFA_LayoutItem* pCurNode = const_cast(this); pCurNode; pCurNode = pCurNode->m_pParent) { if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) @@ -551,9 +553,9 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { if (m_pOldLayoutItem->m_pPrev) { m_pOldLayoutItem->m_pPrev->m_pNext = NULL; } - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; while (pOldLayoutItem) { @@ -614,8 +616,10 @@ static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( return bFindRs; } static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { - IXFA_Notify* pNotify = pGenerateNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = pGenerateNode->GetDocument()->GetDocLayout(); + CXFA_FFNotify* pNotify = + pGenerateNode->GetDocument()->GetParser()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = + pGenerateNode->GetDocument()->GetDocLayout(); CXFA_NodeIteratorTemplate sIterator( pGenerateNode); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; @@ -2863,7 +2867,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { return; } CXFA_Document* pDocument = m_pFormNode->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); FX_FLOAT fHeight = -1; FX_FLOAT fWidth = -1; pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight); diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 61c0715f1a..888cf4fe5b 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -17,7 +18,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" CXFA_LayoutPageMgr::CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor) @@ -82,7 +85,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return FALSE; } CXFA_Document* pDocument = pTemplateNode->GetDocument(); - IXFA_ObjFactory* pObjFactory = pDocument->GetParser()->GetFactory(); + CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); if (!pPageArea) { pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), @@ -406,7 +409,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, m_nAvailPages++; pNewPageAreaLayoutItem = pContainerItem; } else { - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetParser()->GetNotify(); CXFA_ContainerLayoutItem* pContainerItem = (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); @@ -599,15 +602,15 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { int32_t CXFA_LayoutPageMgr::GetPageCount() const { return m_PageArray.GetSize(); } -IXFA_LayoutPage* CXFA_LayoutPageMgr::GetPage(int32_t index) const { +CXFA_ContainerLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const { if (index < 0 || index >= m_PageArray.GetSize()) return nullptr; return m_PageArray[index]; } -int32_t CXFA_LayoutPageMgr::GetPageIndex(const IXFA_LayoutPage* pPage) const { +int32_t CXFA_LayoutPageMgr::GetPageIndex( + const CXFA_ContainerLayoutItem* pPage) const { // FIXME: Find() method should take const. - return m_PageArray.Find(static_cast( - const_cast(pPage))); + return m_PageArray.Find(const_cast(pPage)); } FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType, XFA_ATTRIBUTEENUM eTargetType, @@ -1495,8 +1498,8 @@ CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( pFormNode); } static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, - IXFA_Notify* pNotify, - IXFA_DocLayout* pDocLayout) { + CXFA_FFNotify* pNotify, + CXFA_LayoutProcessor* pDocLayout) { CXFA_LayoutItem* pNextLayoutItem; CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; while (pCurLayoutItem) { @@ -1518,9 +1521,9 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { if (pCurLayoutItem->IsContentLayoutItem()) { uint32_t dwFlag = pCurLayoutItem->m_pFormNode->GetFlag(); if (dwFlag & (XFA_NODEFLAG_HasRemoved)) { - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); if (pCurLayoutItem->m_pFirstChild) { XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); @@ -1578,8 +1581,8 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( } void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = pDocument->GetDocLayout(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); { for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); @@ -1790,8 +1793,8 @@ void CXFA_LayoutPageMgr::LayoutPageSetContents() { } } } -void XFA_SyncContainer(IXFA_Notify* pNotify, - IXFA_DocLayout* pDocLayout, +void XFA_SyncContainer(CXFA_FFNotify* pNotify, + CXFA_LayoutProcessor* pDocLayout, CXFA_LayoutItem* pContainerItem, uint32_t dwRelevant, FX_BOOL bVisible, @@ -1825,7 +1828,7 @@ void XFA_SyncContainer(IXFA_Notify* pNotify, void CXFA_LayoutPageMgr::SyncLayoutData() { MergePageSetContents(); LayoutPageSetContents(); - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); int32_t nPageIdx = -1; CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h index 354daa5e31..a82c152df9 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h @@ -35,8 +35,8 @@ class CXFA_LayoutPageMgr { void FinishPaginatedPageSets(); void SyncLayoutData(); int32_t GetPageCount() const; - IXFA_LayoutPage* GetPage(int32_t index) const; - int32_t GetPageIndex(const IXFA_LayoutPage* pPage) const; + CXFA_ContainerLayoutItem* GetPage(int32_t index) const; + int32_t GetPageIndex(const CXFA_ContainerLayoutItem* pPage) const; inline CXFA_ContainerLayoutItem* GetRootLayoutItem() const { return m_pPageSetLayoutItemRoot; } diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index c721d7da17..35d8c36fa2 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -107,8 +107,7 @@ void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, FALSE); } void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE& tz) const { - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); - pProvider->GetTimeZone(tz); + CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); } void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE); @@ -278,8 +277,7 @@ void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, GetCalendarSymbol(XFA_ELEMENT_MeridiemNames, bAM ? 0 : 1, FALSE); } void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE& tz) const { - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); - pProvider->GetTimeZone(tz); + CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); } void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { wsEraName = GetCalendarSymbol(XFA_ELEMENT_EraNames, bAD ? 1 : 0, FALSE); diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index ce638a3b97..7ccf228177 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1269,21 +1269,28 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { return m_wsConfigLocale; } static CXFA_TimeZoneProvider* g_pProvider = NULL; -IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Create() { + +// Static. +CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { FXSYS_assert(!g_pProvider); g_pProvider = new CXFA_TimeZoneProvider(); return g_pProvider; } -IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Get() { + +// Static. +CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Get() { if (!g_pProvider) { g_pProvider = new CXFA_TimeZoneProvider(); } return g_pProvider; } -void IXFA_TimeZoneProvider::Destroy() { + +// Static. +void CXFA_TimeZoneProvider::Destroy() { delete g_pProvider; g_pProvider = NULL; } + #include CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h index a30d0cc1ad..62b8c67924 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -52,24 +52,17 @@ class CXFA_LocaleMgr : public IFX_LocaleMgr { uint16_t m_dwLocaleFlags; }; -class IXFA_TimeZoneProvider { +class CXFA_TimeZoneProvider { public: - static IXFA_TimeZoneProvider* Create(); - static IXFA_TimeZoneProvider* Get(); - static void Destroy(); - - virtual ~IXFA_TimeZoneProvider() {} + CXFA_TimeZoneProvider(); + ~CXFA_TimeZoneProvider(); - virtual void SetTimeZone(FX_TIMEZONE& tz) = 0; + static CXFA_TimeZoneProvider* Create(); + static CXFA_TimeZoneProvider* Get(); + static void Destroy(); - virtual void GetTimeZone(FX_TIMEZONE& tz) = 0; -}; -class CXFA_TimeZoneProvider : public IXFA_TimeZoneProvider { - public: - CXFA_TimeZoneProvider(); - virtual ~CXFA_TimeZoneProvider(); - virtual void SetTimeZone(FX_TIMEZONE& tz); - virtual void GetTimeZone(FX_TIMEZONE& tz); + void SetTimeZone(FX_TIMEZONE& tz); + void GetTimeZone(FX_TIMEZONE& tz); private: FX_TIMEZONE m_tz; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index eed5323ab8..0bd114b6c4 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -10,6 +10,7 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/crt/fgas_system.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -18,7 +19,9 @@ #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -117,7 +120,7 @@ CXFA_Node::~CXFA_Node() { } } CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); if (!pClone) { return NULL; @@ -286,7 +289,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, } for (int32_t i = 0; i < iProperties; i++) { if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); CXFA_Node* pNewNode = pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); @@ -305,14 +308,14 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, } CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, uint32_t dwFlags) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); pNode->SetFlag(dwFlags); return pNode; } CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template); - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); if (!pClone) { return NULL; @@ -631,7 +634,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { CFX_ByteString bsExpression = pArguments->GetUTF8String(0); wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -695,7 +698,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, CFX_WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -740,7 +743,7 @@ void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -1309,7 +1312,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pLayoutPro) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -1604,7 +1607,7 @@ void CXFA_Node::Script_Som_Message(FXJSE_HVALUE hValue, break; } if (!bNew) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2185,7 +2188,7 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2278,7 +2281,7 @@ void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2360,7 +2363,7 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -2450,7 +2453,7 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2463,7 +2466,7 @@ void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2476,7 +2479,7 @@ void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -2539,7 +2542,7 @@ void CXFA_Node::Script_Som_InstanceIndex(FXJSE_HVALUE hValue, } if (pManagerNode) { pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2616,7 +2619,7 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2629,7 +2632,7 @@ void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2642,7 +2645,7 @@ void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -3134,7 +3137,7 @@ void CXFA_Node::Script_InstanceManager_MoveInstance( int32_t iFrom = pArguments->GetInt32(0); int32_t iTo = pArguments->GetInt32(1); InstanceManager_MoveInstance(iTo, iFrom); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3168,7 +3171,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( } CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { for (int32_t i = iIndex; i < iCount - 1; i++) { CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); @@ -3220,7 +3223,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( FXJSE_Value_Set( pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3263,7 +3266,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( FXJSE_Value_Set( pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3326,7 +3329,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount, FALSE); iCount++; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return 0; } @@ -3419,7 +3422,7 @@ void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3439,7 +3442,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 1) { const bool bScriptFlags = pArguments->GetInt32(0) != 0; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3456,7 +3459,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3469,7 +3472,7 @@ void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -4429,7 +4432,7 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, } if (pNode) { if (bScriptModify) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (pScriptContext) { m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); } @@ -4526,7 +4529,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, } } } - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); CXFA_Node* pNewNode; for (; iCount <= index; iCount++) { @@ -4614,7 +4617,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { ASSERT(m_pLastChild); ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } @@ -4660,7 +4663,7 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { ASSERT(m_pLastChild); ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } @@ -4784,21 +4787,21 @@ CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { return NULL; } int32_t CXFA_Node::GetNodeSameNameIndex() const { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return -1; } return pScriptContext->GetIndexByName(const_cast(this)); } int32_t CXFA_Node::GetNodeSameClassIndex() const { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return -1; } return pScriptContext->GetIndexByClassName(const_cast(this)); } void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -4851,7 +4854,7 @@ void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { switch (dwFlag) { case XFA_NODEFLAG_Initialized: if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready); } @@ -4872,7 +4875,7 @@ void CXFA_Node::OnRemoved(CXFA_Node* pParent, CXFA_Node* pRemoved, FX_BOOL bNotify) { if (bNotify && pParent) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved); } @@ -4882,7 +4885,7 @@ void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, void* pNewValue, FX_BOOL bNotify) { if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanging, (void*)(uintptr_t)eAttr, pNewValue); @@ -4905,7 +4908,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, GetEventParaInfoByName(wsEventName); if (eventParaInfo) { uint32_t validFlags = eventParaInfo->m_validFlags; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return iRet; } diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index 72a18bcd3a..b634746ef4 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -6,6 +6,7 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fxbarcode/include/BC_Library.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h index 86a0d9d94f..5ccc1af199 100644 --- a/xfa/fxfa/parser/xfa_parser.h +++ b/xfa/fxfa/parser/xfa_parser.h @@ -13,7 +13,7 @@ class CFDE_XMLDoc; class IXFA_Parser { public: - static IXFA_Parser* Create(IXFA_ObjFactory* pFactory, + static IXFA_Parser* Create(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); virtual ~IXFA_Parser() {} virtual void Release() = 0; @@ -25,16 +25,10 @@ class IXFA_Parser { IFX_Pause* pPause = NULL) = 0; virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) = 0; - virtual IXFA_ObjFactory* GetFactory() const = 0; + virtual CXFA_Document* GetFactory() const = 0; virtual CXFA_Node* GetRootNode() const = 0; virtual CFDE_XMLDoc* GetXMLDoc() const = 0; virtual void CloseParser() = 0; }; -class IXFA_DocParser : public IXFA_Parser { - public: - static IXFA_DocParser* Create(IXFA_Notify* pNotify); - virtual CXFA_Document* GetDocument() const = 0; - virtual IXFA_Notify* GetNotify() const = 0; -}; #endif // XFA_FXFA_PARSER_XFA_PARSER_H_ diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 75198dc443..a2c2ae7909 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -18,12 +18,13 @@ #include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" +#include "xfa/include/fxfa/xfa_checksum.h" -IXFA_Parser* IXFA_Parser::Create(IXFA_ObjFactory* pFactory, +IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory, FX_BOOL bDocumentParser) { return new CXFA_SimpleParser(pFactory, bDocumentParser); } -CXFA_SimpleParser::CXFA_SimpleParser(IXFA_ObjFactory* pFactory, +CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser) : m_pXMLParser(nullptr), m_pXMLDoc(nullptr), @@ -36,7 +37,7 @@ CXFA_SimpleParser::CXFA_SimpleParser(IXFA_ObjFactory* pFactory, CXFA_SimpleParser::~CXFA_SimpleParser() { CloseParser(); } -void CXFA_SimpleParser::SetFactory(IXFA_ObjFactory* pFactory) { +void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( @@ -564,7 +565,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( m_pXMLParser->m_dwCheckStatus != 0x03) { return NULL; } - IXFA_ChecksumContext* pChecksum = XFA_Checksum_Create(); + CXFA_ChecksumContext* pChecksum = new CXFA_ChecksumContext; pChecksum->StartChecksum(); pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], m_pXMLParser->m_nSize[0]); @@ -1342,10 +1343,8 @@ void CXFA_SimpleParser::CloseParser() { m_pStream = NULL; } } -IXFA_DocParser* IXFA_DocParser::Create(IXFA_Notify* pNotify) { - return new CXFA_DocumentParser(pNotify); -} -CXFA_DocumentParser::CXFA_DocumentParser(IXFA_Notify* pNotify) + +CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) : m_nodeParser(NULL, TRUE), m_pNotify(pNotify), m_pDocument(NULL) {} CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 308de7e587..d81637516d 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -14,21 +14,22 @@ class CXFA_XMLParser; class CXFA_SimpleParser : public IXFA_Parser { public: - CXFA_SimpleParser(IXFA_ObjFactory* pFactory, FX_BOOL bDocumentParser = FALSE); - ~CXFA_SimpleParser(); - virtual void Release() { delete this; } + CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); + ~CXFA_SimpleParser() override; + + void Release() override { delete this; } - virtual int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); - virtual int32_t DoParse(IFX_Pause* pPause = NULL); - virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); - virtual IXFA_ObjFactory* GetFactory() const { return m_pFactory; } - virtual CXFA_Node* GetRootNode() const { return m_pRootNode; } - virtual CFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } - virtual void CloseParser(); + int32_t StartParse(IFX_FileRead* pStream, + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; + int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t ParseXMLData(const CFX_WideString& wsXML, + CFDE_XMLNode*& pXMLNode, + IFX_Pause* pPause = NULL) override; + void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; + CXFA_Document* GetFactory() const override { return m_pFactory; } + CXFA_Node* GetRootNode() const override { return m_pRootNode; } + CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } + void CloseParser() override; protected: CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, @@ -68,43 +69,44 @@ class CXFA_SimpleParser : public IXFA_Parser { void ParseInstruction(CXFA_Node* pXFANode, CFDE_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID); - void SetFactory(IXFA_ObjFactory* pFactory); + void SetFactory(CXFA_Document* pFactory); CXFA_XMLParser* m_pXMLParser; CFDE_XMLDoc* m_pXMLDoc; IFX_Stream* m_pStream; IFX_FileRead* m_pFileRead; - IXFA_ObjFactory* m_pFactory; + CXFA_Document* m_pFactory; CXFA_Node* m_pRootNode; XFA_XDPPACKET m_ePacketID; FX_BOOL m_bDocumentParser; friend class CXFA_DocumentParser; }; -class CXFA_DocumentParser : public IXFA_DocParser { +class CXFA_DocumentParser : public IXFA_Parser { public: - CXFA_DocumentParser(IXFA_Notify* pNotify); - ~CXFA_DocumentParser(); - virtual void Release() { delete this; } - virtual int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); - virtual int32_t DoParse(IFX_Pause* pPause = NULL); - virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); - virtual IXFA_ObjFactory* GetFactory() const { + CXFA_DocumentParser(CXFA_FFNotify* pNotify); + ~CXFA_DocumentParser() override; + + void Release() override { delete this; } + int32_t StartParse(IFX_FileRead* pStream, + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; + int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t ParseXMLData(const CFX_WideString& wsXML, + CFDE_XMLNode*& pXMLNode, + IFX_Pause* pPause = NULL) override; + void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; + CXFA_Document* GetFactory() const override { return m_nodeParser.GetFactory(); } - virtual CXFA_Node* GetRootNode() const { return m_nodeParser.GetRootNode(); } - virtual CFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } - virtual IXFA_Notify* GetNotify() const { return m_pNotify; } - virtual CXFA_Document* GetDocument() const { return m_pDocument; } - virtual void CloseParser(); + CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } + CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } + CXFA_FFNotify* GetNotify() const { return m_pNotify; } + CXFA_Document* GetDocument() const { return m_pDocument; } + void CloseParser() override; protected: CXFA_SimpleParser m_nodeParser; - IXFA_Notify* m_pNotify; + CXFA_FFNotify* m_pNotify; CXFA_Document* m_pDocument; }; typedef CFX_StackTemplate CXFA_XMLNodeStack; diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index fb2960d09b..80601c5b97 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -82,40 +82,4 @@ struct XFA_JSBUILTININFO { const XFA_JSBUILTININFO* XFA_GetJSBuiltinByHash(uint32_t uHashCode); -class IXFA_ScriptContext { - public: - virtual ~IXFA_ScriptContext() {} - virtual void Release() = 0; - virtual void Initialize(FXJSE_HRUNTIME hRuntime) = 0; - - virtual void SetEventParam(CXFA_EventParam param) = 0; - virtual CXFA_EventParam* GetEventParam() = 0; - virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - CXFA_Object* pThisObject = NULL) = 0; - virtual int32_t ResolveObjects(CXFA_Object* refNode, - const CFX_WideStringC& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = NULL) = 0; - virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject) = 0; - virtual void CacheList(CXFA_NodeList* pList) = 0; - virtual CXFA_Object* GetThisObject() const = 0; - virtual FXJSE_HRUNTIME GetRuntime() const = 0; - virtual int32_t GetIndexByName(CXFA_Node* refNode) = 0; - virtual int32_t GetIndexByClassName(CXFA_Node* refNode) = 0; - virtual void GetSomExpression(CXFA_Node* refNode, - CFX_WideString& wsExpression) = 0; - - virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray) = 0; - virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes) = 0; - virtual void AddNodesOfRunScript(CXFA_Node* pNode) = 0; - virtual FXJSE_HCLASS GetJseNormalClass() = 0; - virtual XFA_SCRIPTLANGTYPE GetType() = 0; - virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) = 0; - virtual FX_BOOL IsRunAtClient() = 0; -}; -IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument); - #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index 3f415e2a75..f616596a7f 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -13,9 +14,12 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { @@ -55,7 +59,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Property( FXJSE_HVALUE hValue, uint32_t dwFlag, FX_BOOL bSetting) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -238,7 +242,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Target( } void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( CFXJSE_Arguments* pArguments) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -246,11 +250,11 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( if (!pEventParam) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_WidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); if (!pWidgetHandler) { return; } @@ -258,7 +262,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( } void CScript_EventPseudoModel::Script_EventPseudoModel_Reset( CFXJSE_Arguments* pArguments) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index e2bc9dc857..ad20b76380 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -6,14 +6,18 @@ #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" #include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -24,7 +28,7 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) CScript_HostPseudoModel::~CScript_HostPseudoModel() {} void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( FXJSE_HVALUE hValue, - IXFA_Notify* pNotify, + CXFA_FFNotify* pNotify, uint32_t dwFlag) { CFX_WideString wsValue; pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); @@ -34,7 +38,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -50,7 +54,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -66,11 +70,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetCalculationsEnabled( hDoc, FXJSE_Value_ToBoolean(hValue)); @@ -83,11 +87,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetCurrentPage(hDoc, FXJSE_Value_ToInteger(hValue)); @@ -100,7 +104,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Language( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -116,11 +120,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); return; @@ -132,7 +136,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -151,11 +155,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); @@ -171,11 +175,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetValidationsEnabled( hDoc, FXJSE_Value_ToBoolean(hValue)); @@ -191,7 +195,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -207,7 +211,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Version( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -223,7 +227,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -239,7 +243,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Name( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -255,7 +259,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -277,11 +281,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CFX_WideString wsURL; if (iLength >= 1) { CFX_ByteString bsURL = pArguments->GetUTF8String(0); @@ -299,7 +303,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -313,7 +317,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( FXJSE_Value_ToUTF8String(hValue, bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString, bsString.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { FXJSE_Value_Release(hValue); return; @@ -336,11 +340,12 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( } FXJSE_Value_Release(hValue); } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } @@ -354,7 +359,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -388,7 +393,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( } void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -429,7 +434,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -449,7 +454,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { iStart = XFA_FilterName(wsExpression, iStart, wsName); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -482,7 +487,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -502,7 +507,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -516,7 +521,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( FXJSE_Value_ToUTF8String(hValue, bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString, bsString.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { FXJSE_Value_Release(hValue); return; @@ -543,7 +548,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( } void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -564,7 +569,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -631,7 +636,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( } void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -651,11 +656,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Print( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); uint32_t dwOptions = 0; FX_BOOL bShowDialog = TRUE; if (iLength >= 1) { @@ -717,7 +722,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -726,7 +731,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( @@ -736,11 +741,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CFX_WideString wsFilePath; FX_BOOL bXDP = TRUE; if (iLength >= 1) { @@ -754,11 +759,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) { @@ -769,11 +774,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( } void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) { @@ -789,7 +794,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( } void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h index 5718074b2f..1f456ffe7c 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h @@ -79,7 +79,7 @@ class CScript_HostPseudoModel : public CXFA_OrdinaryObject { protected: void Script_HostPseudoModel_LoadString(FXJSE_HVALUE hValue, - IXFA_Notify* pNotify, + CXFA_FFNotify* pNotify, uint32_t dwFlag); FX_BOOL Script_HostPseudoModel_ValidateArgsForMsg( CFXJSE_Arguments* pArguments, diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index e20a4e0b2a..ce3931149b 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/xfa_script_imp.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -133,7 +134,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, return; } } - IXFA_Notify* pNotify = pDoc->GetNotify(); + CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } @@ -213,7 +214,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, hValue, TRUE)) { return; } - IXFA_Notify* pNotify = pDoc->GetNotify(); + CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } @@ -777,6 +778,3 @@ void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { m_pScriptNodeArray->Add(pNode); } } -IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument) { - return new CXFA_ScriptContext(pDocument); -} diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h index 237192e855..414e403d19 100644 --- a/xfa/fxfa/parser/xfa_script_imp.h +++ b/xfa/fxfa/parser/xfa_script_imp.h @@ -18,44 +18,41 @@ class CXFA_ResolveProcessor; -class CXFA_ScriptContext : public IXFA_ScriptContext { +class CXFA_ScriptContext { public: explicit CXFA_ScriptContext(CXFA_Document* pDocument); ~CXFA_ScriptContext(); - virtual void Release(); - virtual void Initialize(FXJSE_HRUNTIME hRuntime); - virtual void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } - virtual CXFA_EventParam* GetEventParam() { return &m_eventParam; } - virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - CXFA_Object* pThisObject = NULL); + void Release(); + void Initialize(FXJSE_HRUNTIME hRuntime); + void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } + CXFA_EventParam* GetEventParam() { return &m_eventParam; } + FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, + const CFX_WideStringC& wsScript, + FXJSE_HVALUE hRetValue, + CXFA_Object* pThisObject = NULL); - virtual int32_t ResolveObjects(CXFA_Object* refNode, - const CFX_WideStringC& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = NULL); - virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); - virtual void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } - virtual CXFA_Object* GetThisObject() const { return m_pThisObject; } - virtual FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } + int32_t ResolveObjects(CXFA_Object* refNode, + const CFX_WideStringC& wsExpression, + XFA_RESOLVENODE_RS& resolveNodeRS, + uint32_t dwStyles = XFA_RESOLVENODE_Children, + CXFA_Node* bindNode = NULL); + FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); + void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } + CXFA_Object* GetThisObject() const { return m_pThisObject; } + FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } - virtual int32_t GetIndexByName(CXFA_Node* refNode); - virtual int32_t GetIndexByClassName(CXFA_Node* refNode); - virtual void GetSomExpression(CXFA_Node* refNode, - CFX_WideString& wsExpression); + int32_t GetIndexByName(CXFA_Node* refNode); + int32_t GetIndexByClassName(CXFA_Node* refNode); + void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression); - virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray); - virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes); - virtual void AddNodesOfRunScript(CXFA_Node* pNode); - virtual FXJSE_HCLASS GetJseNormalClass(); + void SetNodesOfRunScript(CXFA_NodeArray* pArray); + void AddNodesOfRunScript(const CXFA_NodeArray& nodes); + void AddNodesOfRunScript(CXFA_Node* pNode); + FXJSE_HCLASS GetJseNormalClass(); - virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } - virtual FX_BOOL IsRunAtClient() { - return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; - } + void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } + FX_BOOL IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; } FX_BOOL QueryNodeByFlag(CXFA_Node* refNode, const CFX_WideStringC& propname, FXJSE_HVALUE hValue, diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 97f2c8b45d..922b0d6bb6 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -15,7 +16,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -28,7 +31,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -80,7 +83,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( if (!pNode) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -140,7 +143,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Y( void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( CFXJSE_Arguments* pArguments, FX_BOOL bNumbered) { - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -148,7 +151,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( int32_t iPageNum = pDocLayout->CountPages(); if (bNumbered) { for (int32_t i = 0; i < iPageNum; i++) { - IXFA_LayoutPage* pLayoutPage = pDocLayout->GetPage(i); + CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(i); if (!pLayoutPage) { continue; } @@ -183,7 +186,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( if (!pNode) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -205,7 +208,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( Script_LayoutPseudoModel_PageImp(pArguments, FALSE); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( - IXFA_DocLayout* pDocLayout, + CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const CFX_WideString& wsType, FX_BOOL bOnPageArea, @@ -369,11 +372,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( if (iLength >= 3) { bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -392,11 +395,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -405,11 +408,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -447,19 +450,20 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( if (!pNode) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -481,19 +485,20 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( if (!pNode) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -537,7 +542,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( if (!pNode && hValue) { FXJSE_Value_SetInteger(hValue, iPage); } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h index 56d9894284..7473bc0fe1 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h @@ -53,7 +53,7 @@ class CScript_LayoutPseudoModel : public CXFA_OrdinaryObject { void Script_LayoutPseudoModel_AbsPage(CFXJSE_Arguments* pArguments); protected: - void Script_LayoutPseudoModel_GetObjArray(IXFA_DocLayout* pDocLayout, + void Script_LayoutPseudoModel_GetObjArray(CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const CFX_WideString& wsType, FX_BOOL bOnPageArea, diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 3467471c5f..6311314d82 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -694,7 +694,6 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; FXSYS_assert(iFoundCount == findNodes.GetSize()); CFX_WideString wsExpression; - IXFA_ScriptContext* pContext = NULL; XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown; if (wsCondition.Left(2) == FX_WSTRC(L".[") && wsCondition.Right(1) == FX_WSTRC(L"]")) { @@ -705,7 +704,8 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( } else { return; } - pContext = rnd.m_pSC; + + CXFA_ScriptContext* pContext = rnd.m_pSC; wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3); for (int32_t i = iFoundCount - 1; i >= 0; i--) { CXFA_Object* node = findNodes[i]; diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 15328b0ce3..2919664b52 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -13,7 +14,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -30,11 +33,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); @@ -52,11 +55,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pNodeList = NULL; CFX_WideString wsExpression; CFX_WideString wsXMLIdent; @@ -86,11 +89,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); if (!pList) return; @@ -104,11 +107,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; FX_BOOL bClear = TRUE; if (iLength >= 1) { diff --git a/xfa/include/fxfa/fxfa.h b/xfa/include/fxfa/fxfa.h index c55ddf25f0..624502aa83 100644 --- a/xfa/include/fxfa/fxfa.h +++ b/xfa/include/fxfa/fxfa.h @@ -14,40 +14,17 @@ class CFX_Graphics; class CPDF_Document; +class CXFA_FFPageView; class CXFA_Node; class CXFA_NodeList; class CXFA_WidgetAcc; class IFWL_AdapterTimerMgr; class IFX_Font; -class IXFA_App; class IXFA_AppProvider; -class IXFA_ChecksumContext; -class IXFA_DocHandler; class IXFA_DocProvider; -class IXFA_DocView; -class IXFA_FontMgr; -class IXFA_MenuHandler; -class IXFA_PageView; class IXFA_WidgetAccIterator; -class IXFA_WidgetHandler; class IXFA_WidgetIterator; -class IXFA_Doc { - public: - virtual ~IXFA_Doc() {} - - protected: - IXFA_Doc() {} -}; - -class IXFA_Widget { - public: - virtual ~IXFA_Widget() {} - - protected: - IXFA_Widget() {} -}; - #define XFA_MBICON_Error 0 #define XFA_MBICON_Warning 1 #define XFA_MBICON_Question 2 @@ -288,62 +265,7 @@ class IXFA_AppProvider { FX_BOOL bOpen = TRUE) = 0; virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; }; -class IXFA_FontMgr { - public: - static IXFA_FontMgr* CreateDefault(); - virtual ~IXFA_FontMgr(); - - virtual IFX_Font* GetFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) = 0; - virtual IFX_Font* GetDefaultFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) = 0; -}; -class IXFA_App { - public: - static IXFA_App* Create(IXFA_AppProvider* pProvider); - virtual ~IXFA_App(); - virtual IXFA_DocHandler* GetDocHandler() = 0; - virtual IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - IFX_FileRead* pStream, - FX_BOOL bTakeOverFile = TRUE) = 0; - virtual IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - CPDF_Document* pPDFDoc) = 0; - virtual IXFA_AppProvider* GetAppProvider() = 0; - virtual void SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) = 0; - virtual IXFA_MenuHandler* GetMenuHandler() = 0; -}; -class IXFA_MenuHandler { - public: - virtual ~IXFA_MenuHandler() {} - - virtual FX_BOOL CanCopy(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanCut(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanPaste(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanSelectAll(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanDelete(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanDeSelect(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL Copy(IXFA_Widget* hWidget, CFX_WideString& wsText) = 0; - virtual FX_BOOL Cut(IXFA_Widget* hWidget, CFX_WideString& wsText) = 0; - virtual FX_BOOL Paste(IXFA_Widget* hWidget, const CFX_WideString& wsText) = 0; - virtual FX_BOOL SelectAll(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL Delete(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL DeSelect(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanUndo(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL CanRedo(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL Undo(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL Redo(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL GetSuggestWords(IXFA_Widget* hWidget, - CFX_PointF pointf, - std::vector& sSuggest) = 0; - virtual FX_BOOL ReplaceSpellCheckWord(IXFA_Widget* hWidget, - CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) = 0; -}; #define XFA_INVALIDATE_AllPages 0x00000000 #define XFA_INVALIDATE_CurrentPage 0x00000001 #define XFA_PRINTOPT_ShowDialog 0x00000001 @@ -365,65 +287,65 @@ class IXFA_DocProvider { public: virtual ~IXFA_DocProvider() {} - virtual void SetChangeMark(IXFA_Doc* hDoc) = 0; - virtual void InvalidateRect(IXFA_PageView* pPageView, + virtual void SetChangeMark(CXFA_FFDoc* hDoc) = 0; + virtual void InvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rt, uint32_t dwFlags = 0) = 0; - virtual void DisplayCaret(IXFA_Widget* hWidget, + virtual void DisplayCaret(CXFA_FFWidget* hWidget, FX_BOOL bVisible, const CFX_RectF* pRtAnchor) = 0; - virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget, + virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, FX_FLOAT fMinPopup, FX_FLOAT fMaxPopup, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) = 0; - virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget, + virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup, const CFX_RectF* pRectExclude = NULL) = 0; - virtual void PageViewEvent(IXFA_PageView* pPageView, uint32_t dwFlags) = 0; - virtual void WidgetEvent(IXFA_Widget* hWidget, + virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) = 0; + virtual void WidgetEvent(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData, uint32_t dwEvent, void* pParam = NULL, void* pAdditional = NULL) = 0; - virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget, + virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, const CFX_RectF& rtUI) { return FALSE; } - virtual int32_t CountPages(IXFA_Doc* hDoc) = 0; - virtual int32_t GetCurrentPage(IXFA_Doc* hDoc) = 0; - virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) = 0; - virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc) = 0; - virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) = 0; - virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) = 0; - virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle) = 0; - virtual void ExportData(IXFA_Doc* hDoc, + virtual int32_t CountPages(CXFA_FFDoc* hDoc) = 0; + virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc) = 0; + virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0; + virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) = 0; + virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0; + virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0; + virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle) = 0; + virtual void ExportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath, FX_BOOL bXDP = TRUE) = 0; - virtual void ImportData(IXFA_Doc* hDoc, + virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath) = 0; - virtual void GotoURL(IXFA_Doc* hDoc, + virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideStringC& bsURL, FX_BOOL bAppend = TRUE) = 0; - virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc) = 0; - virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) = 0; - virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0; - virtual void Print(IXFA_Doc* hDoc, + virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0; + virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0; + virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; + virtual void Print(CXFA_FFDoc* hDoc, int32_t nStartPage, int32_t nEndPage, uint32_t dwOptions) = 0; - virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc) = 0; - virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0; - virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc) = 0; - virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) = 0; - virtual int32_t Verify(IXFA_Doc* hDoc, + virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) = 0; + virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; + virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) = 0; + virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; + virtual int32_t Verify(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, FX_BOOL bUsed = TRUE) { return 0; } - virtual FX_BOOL Sign(IXFA_Doc* hDoc, + virtual FX_BOOL Sign(CXFA_FFDoc* hDoc, CXFA_NodeList* pNodeList, const CFX_WideStringC& wsExpression, const CFX_WideStringC& wsXMLIdent, @@ -431,33 +353,33 @@ class IXFA_DocProvider { FX_BOOL bUsed = TRUE) { return 0; } - virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) { return 0; } - virtual FX_BOOL Clear(IXFA_Doc* hDoc, + virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; } + virtual FX_BOOL Clear(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, FX_BOOL bCleared = TRUE) { return 0; } - virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL) = 0; - virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc) = 0; + virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) = 0; + virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) = 0; - virtual FX_BOOL SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) = 0; - virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord) = 0; - virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc, + virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0; + virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) = 0; + virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord, std::vector& sSuggest) = 0; - virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc, + virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0; - virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc, + virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue) = 0; - virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc, + virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue) = 0; - virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc, + virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, IFX_FileRead* pFile, FX_BOOL bTakeOverFile) = 0; - virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc, + virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) = 0; }; #define XFA_DOCVIEW_View 0x00000000 @@ -471,43 +393,7 @@ class IXFA_DocProvider { #define XFA_PARSESTATUS_SyntaxErr -1 #define XFA_PARSESTATUS_Ready 0 #define XFA_PARSESTATUS_Done 100 -class IXFA_DocHandler { - public: - virtual ~IXFA_DocHandler() {} - - virtual void ReleaseDoc(IXFA_Doc* hDoc) = 0; - virtual IXFA_DocProvider* GetDocProvider(IXFA_Doc* hDoc) = 0; - virtual uint32_t GetDocType(IXFA_Doc* hDoc) = 0; - virtual int32_t StartLoad(IXFA_Doc* hDoc) = 0; - virtual int32_t DoLoad(IXFA_Doc* hDoc, IFX_Pause* pPause = NULL) = 0; - virtual void StopLoad(IXFA_Doc* hDoc) = 0; - - virtual IXFA_DocView* CreateDocView(IXFA_Doc* hDoc, uint32_t dwView = 0) = 0; - - virtual int32_t CountPackages(IXFA_Doc* hDoc) = 0; - virtual void GetPackageName(IXFA_Doc* hDoc, - int32_t iPackage, - CFX_WideStringC& wsPackage) = 0; - - virtual FX_BOOL SavePackage(IXFA_Doc* hDoc, - const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext = NULL) = 0; - virtual FX_BOOL CloseDoc(IXFA_Doc* hDoc) = 0; - - virtual FX_BOOL ImportData(IXFA_Doc* hDoc, - IFX_FileRead* pStream, - FX_BOOL bXDP = TRUE) = 0; - virtual void SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) = 0; - virtual FXJSE_HVALUE GetXFAScriptObject(IXFA_Doc* hDoc) = 0; - virtual XFA_ATTRIBUTEENUM GetRestoreState(IXFA_Doc* hDoc) = 0; - virtual FX_BOOL RunDocScript(IXFA_Doc* hDoc, - XFA_SCRIPTTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - FXJSE_HVALUE hThisObject) = 0; -}; enum XFA_EVENTTYPE { XFA_EVENT_Click, XFA_EVENT_Change, @@ -601,32 +487,7 @@ class CXFA_EventParam { enum XFA_WIDGETORDER { XFA_WIDGETORDER_PreOrder, }; -class IXFA_DocView { - public: - virtual ~IXFA_DocView() {} - virtual IXFA_Doc* GetDoc() = 0; - virtual int32_t StartLayout(int32_t iStartPage = 0) = 0; - virtual int32_t DoLayout(IFX_Pause* pPause = NULL) = 0; - virtual void StopLayout() = 0; - - virtual int32_t GetLayoutStatus() = 0; - virtual void UpdateDocView() = 0; - virtual int32_t CountPageViews() = 0; - virtual IXFA_PageView* GetPageView(int32_t nIndex) = 0; - virtual IXFA_Widget* GetWidgetByName(const CFX_WideStringC& wsName) = 0; - virtual CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName) = 0; - virtual void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL) = 0; - virtual int32_t ProcessWidgetEvent(CXFA_EventParam* pParam, - CXFA_WidgetAcc* pWidgetAcc = NULL) = 0; - virtual IXFA_WidgetHandler* GetWidgetHandler() = 0; - virtual IXFA_WidgetIterator* CreateWidgetIterator() = 0; - virtual IXFA_WidgetAccIterator* CreateWidgetAccIterator( - XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder) = 0; - virtual IXFA_Widget* GetFocusWidget() = 0; - virtual void KillFocus() = 0; - virtual FX_BOOL SetFocus(IXFA_Widget* hWidget) = 0; -}; #define XFA_TRAVERSEWAY_Tranvalse 0x0001 #define XFA_TRAVERSEWAY_Form 0x0002 #define XFA_WIDGETFILTER_Visible 0x0001 @@ -634,27 +495,7 @@ class IXFA_DocView { #define XFA_WIDGETFILTER_Printable 0x0020 #define XFA_WIDGETFILTER_Field 0x0100 #define XFA_WIDGETFILTER_AllType 0x0F00 -class IXFA_PageView { - public: - virtual ~IXFA_PageView() {} - - virtual IXFA_DocView* GetDocView() = 0; - virtual int32_t GetPageViewIndex() = 0; - virtual void GetPageViewRect(CFX_RectF& rtPage) = 0; - virtual void GetDisplayMatrix(CFX_Matrix& mt, - const CFX_Rect& rtDisp, - int32_t iRotate) = 0; - - virtual int32_t LoadPageView(IFX_Pause* pPause = NULL) = 0; - virtual void UnloadPageView() = 0; - virtual IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) = 0; - virtual IXFA_WidgetIterator* CreateWidgetIterator( - uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form, - uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible | - XFA_WIDGETFILTER_Viewable | - XFA_WIDGETFILTER_AllType) = 0; -}; class CXFA_RenderOptions { public: CXFA_RenderOptions() : m_bPrint(FALSE), m_bHighlight(TRUE) {} @@ -665,20 +506,7 @@ class CXFA_RenderOptions { #define XFA_RENDERSTATUS_ToBeContinued 2 #define XFA_RENDERSTATUS_Done 3 #define XFA_RENDERSTATUS_Failed -1 -class IXFA_RenderContext { - public: - virtual void Release() = 0; - virtual int32_t StartRender(IXFA_PageView* pPageView, - CFX_Graphics* pGS, - const CFX_Matrix& pMatrix, - const CXFA_RenderOptions& options) = 0; - virtual int32_t DoRender(IFX_Pause* pPause = NULL) = 0; - virtual void StopRender() = 0; - protected: - ~IXFA_RenderContext() {} -}; -IXFA_RenderContext* XFA_RenderContext_Create(); enum XFA_WIDGETTYPE { XFA_WIDGETTYPE_Barcode, XFA_WIDGETTYPE_PushButton, @@ -708,139 +536,20 @@ enum XFA_WIDGETTYPE { #define XFA_WIDGETSTATUS_Viewable 0x00000010 #define XFA_WIDGETSTATUS_Printable 0x00000020 #define XFA_WIDGETSTATUS_Focused 0x00000100 -class IXFA_WidgetHandler { - public: - virtual ~IXFA_WidgetHandler() {} - - virtual IXFA_Widget* CreateWidget(IXFA_Widget* hParent, - XFA_WIDGETTYPE eType, - IXFA_Widget* hBefore = NULL) = 0; - virtual IXFA_PageView* GetPageView(IXFA_Widget* hWidget) = 0; - virtual void GetRect(IXFA_Widget* hWidget, CFX_RectF& rt) = 0; - virtual uint32_t GetStatus(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL GetBBox(IXFA_Widget* hWidget, - CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus = FALSE) = 0; - virtual CXFA_WidgetAcc* GetDataAcc(IXFA_Widget* hWidget) = 0; - - virtual void GetName(IXFA_Widget* hWidget, - CFX_WideString& wsName, - int32_t iNameType = 0) = 0; - virtual FX_BOOL GetToolTip(IXFA_Widget* hWidget, - CFX_WideString& wsToolTip) = 0; - virtual void SetPrivateData(IXFA_Widget* hWidget, - void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) = 0; - virtual void* GetPrivateData(IXFA_Widget* hWidget, void* module_id) = 0; - virtual FX_BOOL OnMouseEnter(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL OnMouseExit(IXFA_Widget* hWidget) = 0; - virtual FX_BOOL OnLButtonDown(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnLButtonUp(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnLButtonDblClk(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnMouseMove(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnMouseWheel(IXFA_Widget* hWidget, - uint32_t dwFlags, - int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnRButtonDown(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnRButtonUp(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnRButtonDblClk(IXFA_Widget* hWidget, - uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - - virtual FX_BOOL OnKeyDown(IXFA_Widget* hWidget, - uint32_t dwKeyCode, - uint32_t dwFlags) = 0; - virtual FX_BOOL OnKeyUp(IXFA_Widget* hWidget, - uint32_t dwKeyCode, - uint32_t dwFlags) = 0; - virtual FX_BOOL OnChar(IXFA_Widget* hWidget, - uint32_t dwChar, - uint32_t dwFlags) = 0; - virtual uint32_t OnHitTest(IXFA_Widget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual FX_BOOL OnSetCursor(IXFA_Widget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) = 0; - virtual void RenderWidget(IXFA_Widget* hWidget, - CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - FX_BOOL bHighlight = FALSE) = 0; - virtual FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, - XFA_EVENTTYPE eEventType) = 0; - virtual int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, - CXFA_EventParam* pParam) = 0; -}; class IXFA_WidgetIterator { public: virtual void Release() = 0; virtual void Reset() = 0; - virtual IXFA_Widget* MoveToFirst() = 0; - virtual IXFA_Widget* MoveToLast() = 0; - virtual IXFA_Widget* MoveToNext() = 0; - virtual IXFA_Widget* MoveToPrevious() = 0; - virtual IXFA_Widget* GetCurrentWidget() = 0; - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget) = 0; + virtual CXFA_FFWidget* MoveToFirst() = 0; + virtual CXFA_FFWidget* MoveToLast() = 0; + virtual CXFA_FFWidget* MoveToNext() = 0; + virtual CXFA_FFWidget* MoveToPrevious() = 0; + virtual CXFA_FFWidget* GetCurrentWidget() = 0; + virtual FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) = 0; protected: ~IXFA_WidgetIterator() {} }; -class IXFA_WidgetAccIterator { - public: - virtual void Release() = 0; - virtual void Reset() = 0; - virtual CXFA_WidgetAcc* MoveToFirst() = 0; - virtual CXFA_WidgetAcc* MoveToLast() = 0; - virtual CXFA_WidgetAcc* MoveToNext() = 0; - virtual CXFA_WidgetAcc* MoveToPrevious() = 0; - virtual CXFA_WidgetAcc* GetCurrentWidgetAcc() = 0; - virtual FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) = 0; - virtual void SkipTree() = 0; - - protected: - ~IXFA_WidgetAccIterator() {} -}; -IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create( - CXFA_WidgetAcc* pTravelRoot, - XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder); -class IXFA_ChecksumContext { - public: - virtual void Release() = 0; - - virtual FX_BOOL StartChecksum() = 0; - virtual FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, - FX_FILESIZE offset = 0, - size_t size = 0) = 0; - virtual void FinishChecksum() = 0; - virtual void GetChecksum(CFX_ByteString& bsChecksum) = 0; - - protected: - ~IXFA_ChecksumContext() {} -}; -IXFA_ChecksumContext* XFA_Checksum_Create(); #endif // XFA_INCLUDE_FXFA_FXFA_H_ diff --git a/xfa/include/fxfa/xfa_checksum.h b/xfa/include/fxfa/xfa_checksum.h new file mode 100644 index 0000000000..3ca79efe58 --- /dev/null +++ b/xfa/include/fxfa/xfa_checksum.h @@ -0,0 +1,74 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_ +#define XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_ + +#include "xfa/fgas/xml/fgas_sax.h" +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_SAXReaderHandler; +class CXFA_ChecksumContext; + +class CXFA_SAXContext { + public: + CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {} + CFX_ByteTextBuf m_TextBuf; + CFX_ByteString m_bsTagName; + FX_SAXNODE m_eNode; +}; +class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler { + public: + CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext); + virtual ~CXFA_SAXReaderHandler(); + virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName, + FX_SAXNODE eType, + uint32_t dwStartPos); + virtual void OnTagAttribute(void* pTag, + const CFX_ByteStringC& bsAttri, + const CFX_ByteStringC& bsValue); + virtual void OnTagBreak(void* pTag); + virtual void OnTagData(void* pTag, + FX_SAXNODE eType, + const CFX_ByteStringC& bsData, + uint32_t dwStartPos); + virtual void OnTagClose(void* pTag, uint32_t dwEndPos); + virtual void OnTagEnd(void* pTag, + const CFX_ByteStringC& bsTagName, + uint32_t dwEndPos); + + virtual void OnTargetData(void* pTag, + FX_SAXNODE eType, + const CFX_ByteStringC& bsData, + uint32_t dwStartPos); + + protected: + void UpdateChecksum(FX_BOOL bCheckSpace); + CXFA_ChecksumContext* m_pContext; + CXFA_SAXContext m_SAXContext; +}; + +class CXFA_ChecksumContext { + public: + CXFA_ChecksumContext(); + ~CXFA_ChecksumContext(); + + void Release() { delete this; } + FX_BOOL StartChecksum(); + FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, + FX_FILESIZE offset = 0, + size_t size = 0); + void FinishChecksum(); + void GetChecksum(CFX_ByteString& bsChecksum); + void Update(const CFX_ByteStringC& bsText); + + protected: + IFX_SAXReader* m_pSAXReader; + uint8_t* m_pByteContext; + CFX_ByteString m_bsChecksum; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_ diff --git a/xfa/include/fxfa/xfa_ffapp.h b/xfa/include/fxfa/xfa_ffapp.h new file mode 100644 index 0000000000..c3bae4874c --- /dev/null +++ b/xfa/include/fxfa/xfa_ffapp.h @@ -0,0 +1,81 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFAPP_H_ +#define XFA_INCLUDE_FXFA_XFA_FFAPP_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "xfa/fgas/font/fgas_font.h" +#include "xfa/fwl/core/fwl_sdadapterimp.h" +#include "xfa/fwl/core/ifwl_adapternative.h" +#include "xfa/fwl/core/ifwl_app.h" +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_DefFontMgr; +class CXFA_FWLAdapterWidgetMgr; +class CXFA_FWLTheme; +class CXFA_FFDocHandler; +class CXFA_FFMenuHandler; +class CXFA_FontMgr; + +class CXFA_FileRead : public IFX_FileRead { + public: + explicit CXFA_FileRead(const CFX_ArrayTemplate& streams); + + virtual FX_FILESIZE GetSize(); + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); + + virtual void Release() { delete this; } + + protected: + CFX_ObjectArray m_Data; +}; + +class CXFA_FFApp : public IFWL_AdapterNative { + public: + CXFA_FFApp(IXFA_AppProvider* pProvider); + ~CXFA_FFApp() override; + + CXFA_FFDocHandler* GetDocHandler(); + CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, + IFX_FileRead* pStream, + FX_BOOL bTakeOverFile); + CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc); + IXFA_AppProvider* GetAppProvider() { return m_pProvider; } + void SetDefaultFontMgr(CXFA_DefFontMgr* pFontMgr); + CXFA_FFMenuHandler* GetMenuHandler(); + + // IFWL_AdapterNative: + IFWL_AdapterWidgetMgr* GetWidgetMgr( + IFWL_WidgetMgrDelegate* pDelegate) override; + IFWL_AdapterThreadMgr* GetThreadMgr() override; + IFWL_AdapterTimerMgr* GetTimerMgr() override; + + CXFA_FontMgr* GetXFAFontMgr(); + IFX_FontMgr* GetFDEFontMgr(); + CXFA_FWLTheme* GetFWLTheme(); + IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() { + return m_pWidgetMgrDelegate; + } + + protected: + CXFA_FFDocHandler* m_pDocHandler; + IFWL_App* m_pFWLApp; + CXFA_FWLTheme* m_pFWLTheme; + IXFA_AppProvider* m_pProvider; + CXFA_FontMgr* m_pFontMgr; +#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + IFX_FontSourceEnum* m_pFontSource; +#endif + CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr; + IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; + IFX_FontMgr* m_pFDEFontMgr; + CXFA_FFMenuHandler* m_pMenuHandler; + CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFAPP_H_ diff --git a/xfa/include/fxfa/xfa_ffdoc.h b/xfa/include/fxfa/xfa_ffdoc.h new file mode 100644 index 0000000000..ebae04b791 --- /dev/null +++ b/xfa/include/fxfa/xfa_ffdoc.h @@ -0,0 +1,65 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFDOC_H_ +#define XFA_INCLUDE_FXFA_XFA_FFDOC_H_ + +#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_ChecksumContext; +class CXFA_FFApp; +class CXFA_FFNotify; +class CXFA_FFDocView; + +struct FX_IMAGEDIB_AND_DPI { + CFX_DIBSource* pDibSource; + int32_t iImageXDpi; + int32_t iImageYDpi; +}; + +class CXFA_FFDoc { + public: + CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider); + ~CXFA_FFDoc(); + IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } + uint32_t GetDocType(); + int32_t StartLoad(); + int32_t DoLoad(IFX_Pause* pPause = NULL); + void StopLoad(); + CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); + FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); + FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); + FX_BOOL CloseDoc(); + void SetDocType(uint32_t dwType); + CXFA_Document* GetXFADoc() { return m_pDocument; } + CXFA_FFApp* GetApp() { return m_pApp; } + CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); + CXFA_FFDocView* GetDocView(); + CPDF_Document* GetPDFDoc(); + CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, + int32_t& iImageXDpi, + int32_t& iImageYDpi); + CFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage); + FX_BOOL SavePackage(const CFX_WideStringC& wsPackage, + IFX_FileWrite* pFile, + CXFA_ChecksumContext* pCSContext = NULL); + FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); + + protected: + IXFA_DocProvider* m_pDocProvider; + CXFA_Document* m_pDocument; + IFX_FileRead* m_pStream; + CXFA_FFApp* m_pApp; + CXFA_FFNotify* m_pNotify; + CPDF_Document* m_pPDFDoc; + CFX_MapPtrToPtr m_mapNamedImages; + CFX_MapPtrToPtr m_mapTypeToDocView; + uint32_t m_dwDocType; + FX_BOOL m_bOwnStream; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFDOC_H_ diff --git a/xfa/include/fxfa/xfa_ffdochandler.h b/xfa/include/fxfa/xfa_ffdochandler.h new file mode 100644 index 0000000000..7eaa20b4cc --- /dev/null +++ b/xfa/include/fxfa/xfa_ffdochandler.h @@ -0,0 +1,53 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_ +#define XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_ + +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_ChecksumContext; + +class CXFA_FFDocHandler { + public: + CXFA_FFDocHandler(); + ~CXFA_FFDocHandler(); + + void ReleaseDoc(CXFA_FFDoc* hDoc); + IXFA_DocProvider* GetDocProvider(CXFA_FFDoc* hDoc); + uint32_t GetDocType(CXFA_FFDoc* hDoc); + int32_t StartLoad(CXFA_FFDoc* hDoc); + int32_t DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause = NULL); + void StopLoad(CXFA_FFDoc* hDoc); + + CXFA_FFDocView* CreateDocView(CXFA_FFDoc* hDoc, uint32_t dwView = 0); + int32_t CountPackages(CXFA_FFDoc* hDoc); + void GetPackageName(CXFA_FFDoc* hDoc, + int32_t iPackage, + CFX_WideStringC& wsPackage); + CFDE_XMLElement* GetPackageData(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsPackage); + FX_BOOL SavePackage(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsPackage, + IFX_FileWrite* pFile, + CXFA_ChecksumContext* pCSContext = NULL); + FX_BOOL CloseDoc(CXFA_FFDoc* hDoc); + FX_BOOL ImportData(CXFA_FFDoc* hDoc, + IFX_FileRead* pStream, + FX_BOOL bXDP = TRUE); + void SetJSERuntime(CXFA_FFDoc* hDoc, FXJSE_HRUNTIME hRuntime); + FXJSE_HVALUE GetXFAScriptObject(CXFA_FFDoc* hDoc); + XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc); + FX_BOOL RunDocScript(CXFA_FFDoc* hDoc, + XFA_SCRIPTTYPE eScriptType, + const CFX_WideStringC& wsScript, + FXJSE_HVALUE hRetValue, + FXJSE_HVALUE hThisObject); + + protected: +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFDOCHANDLER_H_ diff --git a/xfa/include/fxfa/xfa_ffdocview.h b/xfa/include/fxfa/xfa_ffdocview.h new file mode 100644 index 0000000000..e8a29111a7 --- /dev/null +++ b/xfa/include/fxfa/xfa_ffdocview.h @@ -0,0 +1,172 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_ +#define XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_ + +#include "xfa/include/fxfa/xfa_ffdoc.h" + +class CXFA_FFWidgetHandler; +class CXFA_FFDoc; +class CXFA_FFWidget; +class CXFA_WidgetAccIterator; + +extern const XFA_ATTRIBUTEENUM gs_EventActivity[]; +enum XFA_DOCVIEW_LAYOUTSTATUS { + XFA_DOCVIEW_LAYOUTSTATUS_None, + XFA_DOCVIEW_LAYOUTSTATUS_Start, + XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize, + XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate, + XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate, + XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady, + XFA_DOCVIEW_LAYOUTSTATUS_Doing, + XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize, + XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate, + XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate, + XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady, + XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady, + XFA_DOCVIEW_LAYOUTSTATUS_DocReady, + XFA_DOCVIEW_LAYOUTSTATUS_End +}; +class CXFA_FFDocView { + public: + CXFA_FFDocView(CXFA_FFDoc* pDoc); + ~CXFA_FFDocView(); + + CXFA_FFDoc* GetDoc() { return m_pDoc; } + int32_t StartLayout(int32_t iStartPage = 0); + int32_t DoLayout(IFX_Pause* pPause = NULL); + void StopLayout(); + int32_t GetLayoutStatus(); + void UpdateDocView(); + int32_t CountPageViews(); + CXFA_FFPageView* GetPageView(int32_t nIndex); + + void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL); + int32_t ProcessWidgetEvent(CXFA_EventParam* pParam, + CXFA_WidgetAcc* pWidgetAcc = NULL); + CXFA_FFWidgetHandler* GetWidgetHandler(); + IXFA_WidgetIterator* CreateWidgetIterator(); + CXFA_WidgetAccIterator* CreateWidgetAccIterator( + XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder); + CXFA_FFWidget* GetFocusWidget(); + void KillFocus(); + FX_BOOL SetFocus(CXFA_FFWidget* hWidget); + CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName, + CXFA_FFWidget* pRefWidget = NULL); + CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName, + CXFA_WidgetAcc* pRefWidgetAcc = NULL); + CXFA_LayoutProcessor* GetXFALayout() const; + void OnPageEvent(CXFA_ContainerLayoutItem* pSender, + XFA_PAGEEVENT eEvent, + int32_t iPageIndex); + void LockUpdate(); + void UnlockUpdate(); + FX_BOOL IsUpdateLocked(); + void ClearInvalidateList(); + void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate); + void AddInvalidateRect(CXFA_FFPageView* pPageView, + const CFX_RectF& rtInvalidate); + void RunInvalidate(); + void RunDocClose(); + void DestroyDocView(); + + FX_BOOL InitValidate(CXFA_Node* pNode); + FX_BOOL RunValidate(); + + void SetChangeMark(); + + void AddValidateWidget(CXFA_WidgetAcc* pWidget); + void AddCalculateNodeNotify(CXFA_Node* pNodeChange); + void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); + int32_t RunCalculateWidgets(); + FX_BOOL IsStaticNotify(); + FX_BOOL RunLayout(); + void RunSubformIndexChange(); + void AddNewFormNode(CXFA_Node* pNode); + void AddIndexChangedSubform(CXFA_Node* pNode); + CXFA_WidgetAcc* GetFocusWidgetAcc(); + void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); + void DeleteLayoutItem(CXFA_FFWidget* pWidget); + int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, + XFA_EVENTTYPE eEventType, + FX_BOOL bIsFormReady = FALSE, + FX_BOOL bRecursive = TRUE, + CXFA_Node* pExclude = NULL); + FX_BOOL m_bLayoutEvent; + CFX_WideStringArray m_arrNullTestMsg; + CXFA_FFWidget* m_pListFocusWidget; + FX_BOOL m_bInLayoutStatus; + + protected: + FX_BOOL RunEventLayoutReady(); + void RunBindItems(); + FX_BOOL InitCalculate(CXFA_Node* pNode); + void InitLayout(CXFA_Node* pNode); + void RunCalculateRecursive(int32_t& iIndex); + void ShowNullTestMsg(); + FX_BOOL ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc); + CXFA_Node* GetRootSubform(); + + CXFA_FFDoc* m_pDoc; + CXFA_FFWidgetHandler* m_pWidgetHandler; + CXFA_LayoutProcessor* m_pXFADocLayout; + CXFA_WidgetAcc* m_pFocusAcc; + CXFA_FFWidget* m_pFocusWidget; + CXFA_FFWidget* m_pOldFocusWidget; + CFX_MapPtrToPtr m_mapPageInvalidate; + CFX_PtrArray m_ValidateAccs; + CFX_PtrArray m_bindItems; + CFX_PtrArray m_CalculateAccs; + + CFX_PtrArray m_NewAddedNodes; + CFX_PtrArray m_IndexChangedSubforms; + XFA_DOCVIEW_LAYOUTSTATUS m_iStatus; + int32_t m_iLock; + friend class CXFA_FFNotify; +}; +class CXFA_FFDocWidgetIterator : public IXFA_WidgetIterator { + public: + CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); + virtual ~CXFA_FFDocWidgetIterator(); + + virtual void Release() { delete this; } + + virtual void Reset(); + virtual CXFA_FFWidget* MoveToFirst(); + virtual CXFA_FFWidget* MoveToLast(); + virtual CXFA_FFWidget* MoveToNext(); + virtual CXFA_FFWidget* MoveToPrevious(); + virtual CXFA_FFWidget* GetCurrentWidget(); + virtual FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget); + + protected: + CXFA_ContainerIterator m_ContentIterator; + CXFA_FFDocView* m_pDocView; + CXFA_FFWidget* m_pCurWidget; +}; +class CXFA_WidgetAccIterator { + public: + CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); + ~CXFA_WidgetAccIterator(); + + void Release() { delete this; } + void Reset(); + CXFA_WidgetAcc* MoveToFirst(); + CXFA_WidgetAcc* MoveToLast(); + CXFA_WidgetAcc* MoveToNext(); + CXFA_WidgetAcc* MoveToPrevious(); + CXFA_WidgetAcc* GetCurrentWidgetAcc(); + FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget); + void SkipTree(); + + protected: + CXFA_ContainerIterator m_ContentIterator; + CXFA_FFDocView* m_pDocView; + CXFA_WidgetAcc* m_pCurWidgetAcc; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_ diff --git a/xfa/include/fxfa/xfa_ffpageview.h b/xfa/include/fxfa/xfa_ffpageview.h new file mode 100644 index 0000000000..cce1cc13e1 --- /dev/null +++ b/xfa/include/fxfa/xfa_ffpageview.h @@ -0,0 +1,113 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_ +#define XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_ + +#include "xfa/fxfa/parser/xfa_doclayout.h" + +class CXFA_FFWidget; +class CXFA_FFDocView; +class CXFA_FFPageView : public CXFA_ContainerLayoutItem { + public: + CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); + ~CXFA_FFPageView() override; + + CXFA_FFDocView* GetDocView(); + int32_t GetPageViewIndex(); + void GetPageViewRect(CFX_RectF& rtPage); + void GetDisplayMatrix(CFX_Matrix& mt, + const CFX_Rect& rtDisp, + int32_t iRotate); + int32_t LoadPageView(IFX_Pause* pPause = NULL); + void UnloadPageView(); + CXFA_FFWidget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy); + IXFA_WidgetIterator* CreateWidgetIterator( + uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form, + uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible | + XFA_WIDGETFILTER_Viewable | + XFA_WIDGETFILTER_AllType); + + FX_BOOL IsPageViewLoaded(); + + protected: + CXFA_FFDocView* m_pDocView; + FX_BOOL m_bLoaded; +}; +typedef CXFA_NodeIteratorTemplate + CXFA_LayoutItemIterator; +class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { + public: + CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter); + virtual ~CXFA_FFPageWidgetIterator(); + + void Release() override { delete this; } + + void Reset() override; + CXFA_FFWidget* MoveToFirst() override; + CXFA_FFWidget* MoveToLast() override; + CXFA_FFWidget* MoveToNext() override; + CXFA_FFWidget* MoveToPrevious() override; + CXFA_FFWidget* GetCurrentWidget() override; + FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override; + + protected: + CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); + + CXFA_FFPageView* m_pPageView; + CXFA_FFWidget* m_hCurWidget; + uint32_t m_dwFilter; + FX_BOOL m_bIgnorerelevant; + CXFA_LayoutItemIterator m_sIterator; +}; +typedef CFX_ArrayTemplate CXFA_WidgetArray; +class CXFA_TabParam { + public: + CXFA_TabParam() : m_pWidget(NULL) {} + ~CXFA_TabParam() {} + + CXFA_FFWidget* m_pWidget; + CXFA_WidgetArray m_Children; +}; +class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { + public: + CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, + uint32_t dwFilter); + virtual ~CXFA_FFTabOrderPageWidgetIterator(); + + void Release() override; + + void Reset() override; + CXFA_FFWidget* MoveToFirst() override; + CXFA_FFWidget* MoveToLast() override; + CXFA_FFWidget* MoveToNext() override; + CXFA_FFWidget* MoveToPrevious() override; + CXFA_FFWidget* GetCurrentWidget() override; + FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override; + + protected: + CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); + CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName, + CXFA_FFWidget* pRefWidget); + void CreateTabOrderWidgetArray(); + void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray); + CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); + void OrderContainer(CXFA_LayoutItemIterator* sIterator, + CXFA_LayoutItem* pContainerItem, + CXFA_TabParam* pContainer, + FX_BOOL& bCurrentItem, + FX_BOOL& bContentArea, + FX_BOOL bMarsterPage = FALSE); + + CXFA_WidgetArray m_TabOrderWidgetArray; + CXFA_FFPageView* m_pPageView; + uint32_t m_dwFilter; + int32_t m_iCurWidget; + FX_BOOL m_bIgnorerelevant; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFPAGEVIEW_H_ diff --git a/xfa/include/fxfa/xfa_ffwidgethandler.h b/xfa/include/fxfa/xfa_ffwidgethandler.h new file mode 100644 index 0000000000..28c6b4b20b --- /dev/null +++ b/xfa/include/fxfa/xfa_ffwidgethandler.h @@ -0,0 +1,171 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ +#define XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ + +#include + +#include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_FFDocView; + +class CXFA_FFWidgetHandler { + public: + CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); + ~CXFA_FFWidgetHandler(); + CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent, + XFA_WIDGETTYPE eType, + CXFA_FFWidget* hBefore = NULL); + CXFA_FFPageView* GetPageView(CXFA_FFWidget* hWidget); + void GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt); + uint32_t GetStatus(CXFA_FFWidget* hWidget); + FX_BOOL GetBBox(CXFA_FFWidget* hWidget, + CFX_RectF& rtBox, + uint32_t dwStatus, + FX_BOOL bDrawFocus = FALSE); + CXFA_WidgetAcc* GetDataAcc(CXFA_FFWidget* hWidget); + void GetName(CXFA_FFWidget* hWidget, + CFX_WideString& wsName, + int32_t iNameType = 0); + FX_BOOL GetToolTip(CXFA_FFWidget* hWidget, CFX_WideString& wsToolTip); + void SetPrivateData(CXFA_FFWidget* hWidget, + void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); + void* GetPrivateData(CXFA_FFWidget* hWidget, void* module_id); + FX_BOOL OnMouseEnter(CXFA_FFWidget* hWidget); + FX_BOOL OnMouseExit(CXFA_FFWidget* hWidget); + FX_BOOL OnLButtonDown(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnLButtonUp(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnLButtonDblClk(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnMouseMove(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnMouseWheel(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + int16_t zDelta, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnRButtonDown(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnRButtonUp(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + FX_BOOL OnRButtonDblClk(CXFA_FFWidget* hWidget, + uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy); + + FX_BOOL OnKeyDown(CXFA_FFWidget* hWidget, + uint32_t dwKeyCode, + uint32_t dwFlags); + FX_BOOL OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags); + FX_BOOL OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags); + uint32_t OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); + FX_BOOL OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); + void RenderWidget(CXFA_FFWidget* hWidget, + CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + FX_BOOL bHighlight = FALSE); + FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType); + int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam); + + protected: + CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType, + CXFA_Node* pParent, + CXFA_Node* pBefore) const; + + CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateField(XFA_ELEMENT eElement, + CXFA_Node* pParent, + CXFA_Node* pBefore) const; + CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateDraw(XFA_ELEMENT eElement, + CXFA_Node* pParent, + CXFA_Node* pBefore) const; + + CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const; + CXFA_Node* CreateFormItem(XFA_ELEMENT eElement, + CXFA_Node* pParent, + CXFA_Node* pBefore) const; + CXFA_Node* CreateCopyNode(XFA_ELEMENT eElement, + CXFA_Node* pParent, + CXFA_Node* pBefore = NULL) const; + CXFA_Node* CreateTemplateNode(XFA_ELEMENT eElement, + CXFA_Node* pParent, + CXFA_Node* pBefore) const; + CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; + CXFA_Node* CreateMarginNode(CXFA_Node* pParent, + uint32_t dwFlags, + FX_FLOAT fInsets[4]) const; + CXFA_Node* CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const; + CXFA_Document* GetObjFactory() const; + CXFA_Document* GetXFADoc() const; + + CXFA_FFDocView* m_pDocView; +}; + +class CXFA_FFMenuHandler { + public: + CXFA_FFMenuHandler(); + ~CXFA_FFMenuHandler(); + + FX_BOOL CanCopy(CXFA_FFWidget* hWidget); + FX_BOOL CanCut(CXFA_FFWidget* hWidget); + FX_BOOL CanPaste(CXFA_FFWidget* hWidget); + FX_BOOL CanSelectAll(CXFA_FFWidget* hWidget); + FX_BOOL CanDelete(CXFA_FFWidget* hWidget); + FX_BOOL CanDeSelect(CXFA_FFWidget* hWidget); + FX_BOOL Copy(CXFA_FFWidget* hWidget, CFX_WideString& wsText); + FX_BOOL Cut(CXFA_FFWidget* hWidget, CFX_WideString& wsText); + FX_BOOL Paste(CXFA_FFWidget* hWidget, const CFX_WideString& wsText); + FX_BOOL SelectAll(CXFA_FFWidget* hWidget); + FX_BOOL Delete(CXFA_FFWidget* hWidget); + FX_BOOL DeSelect(CXFA_FFWidget* hWidget); + FX_BOOL CanUndo(CXFA_FFWidget* hWidget); + FX_BOOL CanRedo(CXFA_FFWidget* hWidget); + FX_BOOL Undo(CXFA_FFWidget* hWidget); + FX_BOOL Redo(CXFA_FFWidget* hWidget); + FX_BOOL GetSuggestWords(CXFA_FFWidget* hWidget, + CFX_PointF pointf, + std::vector& sSuggest); + FX_BOOL ReplaceSpellCheckWord(CXFA_FFWidget* hWidget, + CFX_PointF pointf, + const CFX_ByteStringC& bsReplace); +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ diff --git a/xfa/include/fxfa/xfa_fontmgr.h b/xfa/include/fxfa/xfa_fontmgr.h new file mode 100644 index 0000000000..082c672805 --- /dev/null +++ b/xfa/include/fxfa/xfa_fontmgr.h @@ -0,0 +1,99 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ +#define XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ + +#include + +#include "core/fxcrt/include/fx_ext.h" +#include "core/fxcrt/include/fx_system.h" +#include "xfa/fgas/font/fgas_font.h" +#include "xfa/include/fxfa/fxfa.h" + +class CPDF_Font; + +struct XFA_FONTINFO { + uint32_t dwFontNameHash; + const FX_WCHAR* pPsName; + const FX_WCHAR* pReplaceFont; + uint16_t dwStyles; + uint16_t wCodePage; +}; + +class CXFA_DefFontMgr { + public: + CXFA_DefFontMgr() {} + ~CXFA_DefFontMgr(); + + IFX_Font* GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + IFX_Font* GetDefaultFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + + protected: + CFX_PtrArray m_CacheFonts; +}; + +class CXFA_PDFFontMgr : public IFX_FontProvider { + public: + CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); + ~CXFA_PDFFontMgr(); + IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch = TRUE); + FX_BOOL GetCharWidth(IFX_Font* pFont, + FX_WCHAR wUnicode, + int32_t& iWidth, + FX_BOOL bCharCode); + CFX_MapPtrToPtr m_FDE2PDFFont; + + protected: + IFX_Font* FindFont(CFX_ByteString strFamilyName, + FX_BOOL bBold, + FX_BOOL bItalic, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch = TRUE); + CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, + FX_BOOL bBold, + FX_BOOL bItalic); + FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, + FX_BOOL bBold, + FX_BOOL bItalic, + const CFX_ByteString& bsDRFontName, + FX_BOOL bStrictMatch = TRUE); + + CXFA_FFDoc* m_pDoc; + std::map m_FontMap; +}; + +class CXFA_FontMgr { + public: + CXFA_FontMgr(); + ~CXFA_FontMgr(); + IFX_Font* GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + void LoadDocFonts(CXFA_FFDoc* hDoc); + void ReleaseDocFonts(CXFA_FFDoc* hDoc); + + void SetDefFontMgr(CXFA_DefFontMgr* pFontMgr); + + protected: + void DelAllMgrMap(); + + CFX_MapPtrToPtr m_PDFFontMgrArray; + CXFA_DefFontMgr* m_pDefFontMgr; + std::map m_FontMap; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ diff --git a/xfa/include/fxfa/xfa_rendercontext.h b/xfa/include/fxfa/xfa_rendercontext.h new file mode 100644 index 0000000000..d6205275df --- /dev/null +++ b/xfa/include/fxfa/xfa_rendercontext.h @@ -0,0 +1,36 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_ +#define XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_ + +#include "xfa/include/fxfa/fxfa.h" + +class CXFA_RenderContext { + public: + CXFA_RenderContext(); + ~CXFA_RenderContext(); + + void Release() { delete this; } + int32_t StartRender(CXFA_FFPageView* pPageView, + CFX_Graphics* pGS, + const CFX_Matrix& matrix, + const CXFA_RenderOptions& options); + int32_t DoRender(IFX_Pause* pPause = NULL); + void StopRender(); + + protected: + IXFA_WidgetIterator* m_pWidgetIterator; + CXFA_FFWidget* m_pWidget; + CXFA_FFPageView* m_pPageView; + CFX_Graphics* m_pGS; + CFX_Matrix m_matrix; + CXFA_RenderOptions m_options; + uint32_t m_dwStatus; + CFX_RectF m_rtClipRect; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_RENDERCONTEXT_H_ -- cgit v1.2.3