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
diff --git a/BUILD.gn b/BUILD.gn
index aa8c58f..b5d8950 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -42,9 +42,7 @@
   }
 
   if (is_win) {
-    cflags += [
-      "/wd4267",
-    ]
+    cflags += [ "/wd4267" ]
   }
 
   if (is_clang || is_posix) {
@@ -1392,9 +1390,7 @@
       "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 @@
       "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 @@
       "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 @@
       "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 @@
       "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 ed6279a..ea36c78 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 @@
   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 @@
   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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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 @@
   ptPopup.x = x;
   ptPopup.y = y;
   CFX_ByteStringC bs(bsText);
-  pXFAMenuHander->ReplaceSpellCheckWord((IXFA_Widget*)hWidget, ptPopup, bs);
+  pXFAMenuHander->ReplaceSpellCheckWord(
+      reinterpret_cast<CXFA_FFWidget*>(hWidget), ptPopup, bs);
 }
 
 DLLEXPORT void STDCALL
@@ -593,7 +597,7 @@
       pDocument->GetDocType() != XFA_DOCTYPE_Static)
     return;
 
-  IXFA_MenuHandler* pXFAMenuHander =
+  CXFA_FFMenuHandler* pXFAMenuHander =
       CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
   if (!pXFAMenuHander)
     return;
@@ -602,7 +606,7 @@
   CFX_PointF ptPopup;
   ptPopup.x = x;
   ptPopup.y = y;
-  pXFAMenuHander->GetSuggestWords(reinterpret_cast<IXFA_Widget*>(hWidget),
+  pXFAMenuHander->GetSuggestWords(reinterpret_cast<CXFA_FFWidget*>(hWidget),
                                   ptPopup, *sSuggestWords);
   *stringHandle = ToFPDFStringHandle(sSuggestWords);
 }
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index e11e1f2..b9d393e 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 @@
   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 @@
     else if (pPDFObj->GetString() == "template")
       iTemplate = i + 1;
   }
-  std::unique_ptr<IXFA_ChecksumContext, ReleaseDeleter<IXFA_ChecksumContext>>
-      pContext(XFA_Checksum_Create());
+  std::unique_ptr<CXFA_ChecksumContext, ReleaseDeleter<CXFA_ChecksumContext>>
+      pContext(new CXFA_ChecksumContext);
   pContext->StartChecksum();
 
   // template
@@ -228,13 +232,13 @@
       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 @@
       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 b52879a..4e1b95e 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 @@
 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() {
-  delete m_pFontMgr;
-  m_pFontMgr = NULL;
-
   delete m_pXFAApp;
   m_pXFAApp = NULL;
 
@@ -62,15 +60,8 @@
   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 23efc33..11434ae 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 @@
   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 @@
 
   m_XFAPageList.RemoveAll();
 
-  IXFA_App* pApp = m_pApp->GetXFAApp();
+  CXFA_FFApp* pApp = m_pApp->GetXFAApp();
   if (!pApp)
     return FALSE;
 
@@ -94,7 +98,7 @@
     return FALSE;
   }
 
-  IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
+  CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
   if (!pDocHandler) {
     SetLastError(FPDF_ERR_XFALOAD);
     return FALSE;
@@ -170,7 +174,7 @@
   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 @@
   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 @@
                        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 @@
   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 @@
   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 @@
   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 @@
                          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 @@
   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 @@
   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 @@
 
   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 @@
   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 @@
     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 @@
       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::WidgetEvent(IXFA_Widget* hWidget,
+void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget,
                                    CXFA_WidgetAcc* pWidgetData,
                                    uint32_t dwEvent,
                                    void* pParam,
@@ -536,7 +540,7 @@
   if (!pEnv)
     return;
 
-  IXFA_PageView* pPageView =
+  CXFA_FFPageView* pPageView =
       m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
   if (pPageView == NULL)
     return;
@@ -557,13 +561,13 @@
   }
 }
 
-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 @@
 
   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 @@
     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 @@
 
   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 @@
     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 @@
   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 @@
     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 @@
 
   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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
@@ -729,10 +733,10 @@
     // 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 @@
   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 @@
 
   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::Print(IXFA_Doc* hDoc,
+void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc,
                              int32_t nStartPage,
                              int32_t nEndPage,
                              uint32_t dwOptions) {
@@ -809,7 +815,7 @@
       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 @@
   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 @@
     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 @@
     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 @@
   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 @@
   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 @@
                                             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 @@
   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 @@
 #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 @@
                                                                 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 @@
   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 8c97763..dc4185a 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::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 f32c87c..b89a636 100644
--- a/fpdfsdk/fsdk_annothandler.cpp
+++ b/fpdfsdk/fsdk_annothandler.cpp
@@ -76,7 +76,7 @@
 }
 
 #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 @@
     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 @@
 }
 
 #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 @@
 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 @@
   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 @@
                                                    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 @@
   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 @@
                                            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 @@
   if (!pPageView || !pAnnot)
     return;
 
-  IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
+  CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
   pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget());
 }
 
@@ -858,7 +858,7 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
                                                    CPDFSDK_Annot* pNewAnnot) {
-  IXFA_WidgetHandler* pWidgetHandler = NULL;
+  CXFA_FFWidgetHandler* pWidgetHandler = NULL;
 
   if (pOldAnnot)
     pWidgetHandler = GetXFAWidgetHandler(pOldAnnot);
@@ -1002,9 +1002,9 @@
 
   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 @@
   return TRUE;
 }
 
-IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
+CXFA_FFWidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
     CPDFSDK_Annot* pAnnot) {
   if (!pAnnot)
     return NULL;
@@ -1034,7 +1034,7 @@
   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 9b21880..f22111c 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -52,12 +52,12 @@
 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 @@
   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 @@
   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 @@
 }
 
 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 @@
                                      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 @@
 
         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, &param) !=
@@ -248,7 +248,7 @@
         param.m_pTarget = pAcc;
         int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
 
-        if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) {
+        if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
           pDocView->UpdateDocView();
         }
         return nRet == XFA_EVENTERROR_Success;
@@ -260,8 +260,8 @@
 }
 
 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::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::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::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 @@
 
 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 @@
 
 #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 @@
 
 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 @@
 
 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 @@
 
 #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 @@
         param.m_pTarget = pAcc;
         int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
 
-        if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) {
+        if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
           pDocView->UpdateDocView();
         }
 
@@ -1983,7 +1985,7 @@
 }
 
 #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 @@
   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 @@
 }
 
 #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 b318b0a..323128c 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 @@
                  static_cast<FX_FLOAT>(pClip.Width()),
                  static_cast<FX_FLOAT>(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 @@
 }
 
 #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 @@
 }
 
 #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 @@
 #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 @@
       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 f96ed3b..ed62671 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
@@ -21,7 +21,7 @@
   ~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 @@
   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 98ed6fd..6d50131 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 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 @@
   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 @@
 
   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 @@
   }
 
   // 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 @@
                        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 @@
    * @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<CFX_ByteString>& 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 @@
   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 @@
     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 @@
   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<CPDFXFA_Page*> m_XFAPageList;
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
index d686fe9..20da040 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 @@
   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 @@
 
  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 637fdfc..e810a7e 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 @@
                                   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 @@
   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 @@
     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 @@
                                     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 @@
   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 dc2c1a9..a8f4a67 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -83,7 +83,7 @@
   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 aa96215..06f0666 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 @@
 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 @@
   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 @@
   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 @@
 
  private:
   CPDFSDK_InterForm* m_pInterForm;
-  IXFA_Widget* m_hXFAWidget;
+  CXFA_FFWidget* m_hXFAWidget;
 };
 #define CPDFSDK_XFAWidgetMap \
-  CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*>
+  CFX_MapPtrTemplate<CXFA_FFWidget*, CPDFSDK_XFAWidget*>
 #define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int>
 #endif  // PDF_ENABLE_XFA
 
@@ -268,9 +272,9 @@
   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 4bc5a7f..39edc38 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -587,8 +587,8 @@
   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 997ac88..ed42d7d 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 560dfc9..ef5e5b9 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 e60650f..08e44f1 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 4d2bdfc..aac5456 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 @@
   }
   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_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 1fdcc25..4d3d707 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 <algorithm>
 
 #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<CPDF_Stream*>& streams) {
   int32_t iCount = streams.GetSize();
@@ -61,12 +61,7 @@
   }
   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 @@
   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 @@
   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 @@
   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 @@
   }
   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 @@
   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_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index daa9491..80def6c 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 77d8ba8..8a32e8d 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 fdf7d78..0e56ca6 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 5eeb3e8..2e16904 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 9017f68..bba1a7e 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 3d8863c..580bb8f 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 01d40ee..94f0352 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 @@
 }
 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 @@
     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 @@
   }
   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 @@
 }
 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 @@
   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<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>>
+      importer(new CXFA_DataImporter(m_pDocument));
+
+  return importer->ImportData(pStream);
 }
diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp
index 036fc67..949dae4 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<CXFA_FFDoc*>(hDoc)->GetDocProvider();
+IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(CXFA_FFDoc* hDoc) {
+  return hDoc->GetDocProvider();
 }
-uint32_t CXFA_FFDocHandler::GetDocType(IXFA_Doc* hDoc) {
-  return static_cast<CXFA_FFDoc*>(hDoc)->GetDocType();
+uint32_t CXFA_FFDocHandler::GetDocType(CXFA_FFDoc* hDoc) {
+  return hDoc->GetDocType();
 }
-int32_t CXFA_FFDocHandler::StartLoad(IXFA_Doc* hDoc) {
-  return static_cast<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(hDoc)->ImportData(pStream, bXDP);
+  return hDoc->ImportData(pStream, bXDP);
 }
-void CXFA_FFDocHandler::SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) {
-  static_cast<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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<CXFA_FFDoc*>(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 @@
   }
   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<CXFA_FFDoc*>(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 695f6a8..0000000
--- 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 5e81447..907e2b5 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 @@
   }
   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<CXFA_FFPageView*>(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 @@
   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 @@
   }
   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 @@
   }
   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 @@
   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 @@
   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 @@
   }
   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<CXFA_FFPageView*>(pSender);
@@ -568,7 +564,7 @@
                                        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::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 @@
       continue;
     }
     CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i]));
-    IXFA_ScriptContext* pScriptContext =
+    CXFA_ScriptContext* pScriptContext =
         pWidgetNode->GetDocument()->GetScriptContext();
     CFX_WideStringC wsRef;
     binditems.GetRef(wsRef);
@@ -852,13 +848,13 @@
   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 @@
   }
   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_ffdraw.cpp b/xfa/fxfa/app/xfa_ffdraw.cpp
index 06cfdfe..06fc85b 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 a5db598..fb2d11e 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 6705ea6..47cc455 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 cdda4d0..e492cf1 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 7aac2ad..90bb5f3 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 64bdfa3..51fe56b 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 306c467..f7f6ebb 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 c0b371a..ba16d4d 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 25e0d7d..7cb9f40 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<CXFA_WidgetAcc*>(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 @@
   }
 }
 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 @@
   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 @@
   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_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<CXFA_FFWidget*>(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<CXFA_FFComboBox*>(pWidget)->OpenDropDownList();
+  static_cast<CXFA_FFComboBox*>(hWidget)->OpenDropDownList();
   pDocView->UnlockUpdate();
   pDocView->UpdateDocView();
 }
@@ -406,8 +407,7 @@
   }
   XFA_ELEMENT iType = pNode->GetClassID();
   if (XFA_IsCreateWidget(iType)) {
-    CXFA_WidgetAcc* pAcc =
-        new CXFA_WidgetAcc(pDocView, static_cast<CXFA_Node*>(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::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
-                                    IXFA_DocLayout* pLayout,
+                                    CXFA_LayoutProcessor* pLayout,
                                     CXFA_LayoutItem* pSender,
                                     void* pParam,
                                     void* pParam2) {
   CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(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 @@
   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 @@
   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 30c8f0d..6bf39ee 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 @@
   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 e4841f1..584832e 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 @@
 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 @@
 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<CXFA_FFWidget*>(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 @@
   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 @@
   }
   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 @@
   }
   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 @@
   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 @@
   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<CXFA_FFWidget*>(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_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp
index d8ece72..eddc41f 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 89d0bfd..8584375 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 ca933f8..65a7be2 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 aebbb08..fd718f8 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 e436911..bae6df6 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 333f9f7..d93c23f 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 d6d292b..e11585f 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 027d07a..4bf5de5 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 @@
   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<CXFA_FFPageView*>(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 4cc6c0b..84ab926 100644
--- a/xfa/fxfa/app/xfa_ffwidget.h
+++ b/xfa/fxfa/app/xfa_ffwidget.h
@@ -36,14 +36,12 @@
   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 c50786a..fc8b38f 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 @@
     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 722256a..6d4303d 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.h
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.h
@@ -16,7 +16,7 @@
   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 @@
       : 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 80d2e5a..711d29a 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 <vector>
 
 #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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)
-      ->GetBBox(rtBox, dwStatus, bDrawFocus);
+  return hWidget->GetBBox(rtBox, dwStatus, bDrawFocus);
 }
-CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
+  hWidget->Rotate2Normal(fx, fy);
   m_pDocView->m_bLayoutEvent = TRUE;
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet = static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  FX_BOOL bRet =
-      static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->GetStatus() &
-        XFA_WIDGETSTATUS_Visible)) {
+  if (!(hWidget->GetStatus() & XFA_WIDGETSTATUS_Visible))
     return FWL_WGTHITTEST_Unknown;
-  }
-  static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  return static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy);
-  return static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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 @@
       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<CXFA_FFWidget*>(hParent)->GetDataAcc()->GetNode()
-              : NULL;
+      hParent ? hParent->GetDataAcc()->GetNode() : nullptr;
   CXFA_Node* pBeforeFormItem =
-      hBefore ? static_cast<CXFA_FFWidget*>(hBefore)->GetDataAcc()->GetNode()
-              : NULL;
+      hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr;
   CXFA_Node* pNewFormItem =
       CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem);
   if (pNewFormItem == NULL) {
@@ -307,7 +295,7 @@
   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 @@
   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<CXFA_FFWidget*>(hWidget)->CanCopy();
+
+FX_BOOL CXFA_FFMenuHandler::CanCopy(CXFA_FFWidget* hWidget) {
+  return hWidget->CanCopy();
 }
-FX_BOOL CXFA_FFMenuHandler::CanCut(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanCut();
+FX_BOOL CXFA_FFMenuHandler::CanCut(CXFA_FFWidget* hWidget) {
+  return hWidget->CanCut();
 }
-FX_BOOL CXFA_FFMenuHandler::CanPaste(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanPaste();
+FX_BOOL CXFA_FFMenuHandler::CanPaste(CXFA_FFWidget* hWidget) {
+  return hWidget->CanPaste();
 }
-FX_BOOL CXFA_FFMenuHandler::CanSelectAll(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanSelectAll();
+FX_BOOL CXFA_FFMenuHandler::CanSelectAll(CXFA_FFWidget* hWidget) {
+  return hWidget->CanSelectAll();
 }
-FX_BOOL CXFA_FFMenuHandler::CanDelete(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanDelete();
+FX_BOOL CXFA_FFMenuHandler::CanDelete(CXFA_FFWidget* hWidget) {
+  return hWidget->CanDelete();
 }
-FX_BOOL CXFA_FFMenuHandler::CanDeSelect(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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<CXFA_FFWidget*>(hWidget)->Paste(wsText);
+  return hWidget->Paste(wsText);
 }
-FX_BOOL CXFA_FFMenuHandler::SelectAll(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->SelectAll();
+FX_BOOL CXFA_FFMenuHandler::SelectAll(CXFA_FFWidget* hWidget) {
+  return hWidget->SelectAll();
 }
-FX_BOOL CXFA_FFMenuHandler::Delete(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->Delete();
+FX_BOOL CXFA_FFMenuHandler::Delete(CXFA_FFWidget* hWidget) {
+  return hWidget->Delete();
 }
-FX_BOOL CXFA_FFMenuHandler::DeSelect(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->DeSelect();
+FX_BOOL CXFA_FFMenuHandler::DeSelect(CXFA_FFWidget* hWidget) {
+  return hWidget->DeSelect();
 }
-FX_BOOL CXFA_FFMenuHandler::CanUndo(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanUndo();
+FX_BOOL CXFA_FFMenuHandler::CanUndo(CXFA_FFWidget* hWidget) {
+  return hWidget->CanUndo();
 }
-FX_BOOL CXFA_FFMenuHandler::CanRedo(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->CanRedo();
+FX_BOOL CXFA_FFMenuHandler::CanRedo(CXFA_FFWidget* hWidget) {
+  return hWidget->CanRedo();
 }
-FX_BOOL CXFA_FFMenuHandler::Undo(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(hWidget)->Undo();
+FX_BOOL CXFA_FFMenuHandler::Undo(CXFA_FFWidget* hWidget) {
+  return hWidget->Undo();
 }
-FX_BOOL CXFA_FFMenuHandler::Redo(IXFA_Widget* hWidget) {
-  return static_cast<CXFA_FFWidget*>(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<CFX_ByteString>& sSuggest) {
-  return static_cast<CXFA_FFWidget*>(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<CXFA_FFWidget*>(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 931eb28..0000000
--- 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 <vector>
-
-#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<CFX_ByteString>& 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 256af6c..fb6fd39 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 <algorithm>
 
 #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 @@
   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 @@
   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<CXFA_FFDoc*>(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 @@
   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() {
   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 @@
   }
   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::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 @@
   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_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp
index 78d4918..c173277 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 9c55b27..4c3d4de 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 33ceb47..72a516b 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 ec9a3f8..a454ec0 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() {
   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 c19aded..0000000
--- 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 ced7acb..f60ed26 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 @@
     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 @@
       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 @@
   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 @@
     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 @@
   }
   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 @@
   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 @@
   }
   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 @@
   }
   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 @@
   }
   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::GetLinethrough(IXFA_TextProvider* pTextProvider,
+void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
                                      IFDE_CSSComputedStyle* pStyle,
                                      int32_t& iLinethrough) const {
   if (pStyle) {
@@ -470,7 +471,7 @@
     }
   }
 }
-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 @@
 
   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 @@
   }
   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 @@
   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 @@
   }
   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 1d2db21..9b92e17 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 @@
   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_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 @@
   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 3acae67..971c09d 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 @@
         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 @@
   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 @@
   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 b57b8da..690ff33 100644
--- a/xfa/fxfa/parser/xfa_docdata.h
+++ b/xfa/fxfa/parser/xfa_docdata.h
@@ -13,24 +13,4 @@
   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 8558cd0..0bae018 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 @@
   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 @@
   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 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 5938f2d..3c96e9a 100644
--- a/xfa/fxfa/parser/xfa_document.h
+++ b/xfa/fxfa/parser/xfa_document.h
@@ -15,12 +15,11 @@
 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 @@
 #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_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 @@
   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 @@
   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<uint32_t, CXFA_Node*> 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 476dde4..e525532 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 6f08489..d56e57c 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 @@
   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 @@
   }
   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 dbaa6e4..79037d7 100644
--- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp
@@ -28,7 +28,7 @@
   }
   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 @@
 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_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 7f6c14e..4da405f 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_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 289581e..f207b32 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 @@
     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 f18e163..9bde4b0 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 b175cad..e223ab8 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 @@
 }
 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 2924fad..0f22a27 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -10,6 +10,7 @@
 #include <memory>
 
 #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 @@
       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 @@
   SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos);
 }
 
-IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const {
+CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const {
   for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode;
        pCurNode = pCurNode->m_pParent) {
     if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea)
@@ -551,9 +553,9 @@
     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 @@
   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<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
       pGenerateNode);
   for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
@@ -2863,7 +2867,7 @@
     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 61c0715..888cf4f 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 @@
     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 @@
     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 @@
 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<CXFA_ContainerLayoutItem*>(
-      const_cast<IXFA_LayoutPage*>(pPage)));
+  return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage));
 }
 FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType,
                                      XFA_ATTRIBUTEENUM eTargetType,
@@ -1495,8 +1498,8 @@
       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 @@
     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 @@
 }
 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 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 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 354daa5..a82c152 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h
@@ -35,8 +35,8 @@
   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 c721d7d..35d8c36 100644
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ b/xfa/fxfa/parser/xfa_locale.cpp
@@ -107,8 +107,7 @@
   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 @@
       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 ce638a3..7ccf228 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -1269,21 +1269,28 @@
   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 <time.h>
 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 a30d0cc..62b8c67 100644
--- a/xfa/fxfa/parser/xfa_localemgr.h
+++ b/xfa/fxfa/parser/xfa_localemgr.h
@@ -52,24 +52,17 @@
   uint16_t m_dwLocaleFlags;
 };
 
-class IXFA_TimeZoneProvider {
- public:
-  static IXFA_TimeZoneProvider* Create();
-  static IXFA_TimeZoneProvider* Get();
-  static void Destroy();
-
-  virtual ~IXFA_TimeZoneProvider() {}
-
-  virtual void SetTimeZone(FX_TIMEZONE& tz) = 0;
-
-  virtual void GetTimeZone(FX_TIMEZONE& tz) = 0;
-};
-class CXFA_TimeZoneProvider : public IXFA_TimeZoneProvider {
+class CXFA_TimeZoneProvider {
  public:
   CXFA_TimeZoneProvider();
-  virtual ~CXFA_TimeZoneProvider();
-  virtual void SetTimeZone(FX_TIMEZONE& tz);
-  virtual void GetTimeZone(FX_TIMEZONE& tz);
+  ~CXFA_TimeZoneProvider();
+
+  static CXFA_TimeZoneProvider* Create();
+  static CXFA_TimeZoneProvider* Get();
+  static void Destroy();
+
+  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 eed5323..0bd114b 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::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 @@
       }
       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 @@
 }
 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 @@
   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 @@
                                            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_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 @@
   if (!pLayoutPro) {
     return;
   }
-  IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -1604,7 +1607,7 @@
         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_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_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_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_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_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_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 @@
     }
     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_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_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_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 @@
   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 @@
   }
   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 @@
   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 @@
   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 @@
       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_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 @@
   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_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_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 @@
   }
   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 @@
       }
     }
   }
-  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 @@
   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 @@
   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 @@
   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<CXFA_Node*>(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<CXFA_Node*>(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 @@
     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 @@
                           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* 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 @@
       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 72a18bc..b634746 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 86a0d9d..5ccc1af 100644
--- a/xfa/fxfa/parser/xfa_parser.h
+++ b/xfa/fxfa/parser/xfa_parser.h
@@ -13,7 +13,7 @@
 
 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 @@
                                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 75198dc..a2c2ae7 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() {
   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 @@
           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 @@
     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 308de7e..d816375 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.h
+++ b/xfa/fxfa/parser/xfa_parser_imp.h
@@ -14,21 +14,22 @@
 
 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;
 
-  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();
+  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_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 @@
   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<CFDE_XMLNode*> CXFA_XMLNodeStack;
diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h
index fb2960d..80601c5 100644
--- a/xfa/fxfa/parser/xfa_script.h
+++ b/xfa/fxfa/parser/xfa_script.h
@@ -82,40 +82,4 @@
 
 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 3f415e2..f616596 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 @@
     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_Emit(
     CFXJSE_Arguments* pArguments) {
-  IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
+  CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
   if (!pScriptContext) {
     return;
   }
@@ -246,11 +250,11 @@
   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_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 e2bc9dc..ad20b76 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() {}
 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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
   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 @@
     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 @@
   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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
       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 @@
     }
     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 @@
     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_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 @@
     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 @@
   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 @@
     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 @@
     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 @@
       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_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 @@
     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 @@
 }
 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 @@
     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 @@
     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 @@
     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 @@
     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_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_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_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 5718074..1f456ff 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h
@@ -79,7 +79,7 @@
 
  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 e20a4e0..ce39311 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 @@
       return;
     }
   }
-  IXFA_Notify* pNotify = pDoc->GetNotify();
+  CXFA_FFNotify* pNotify = pDoc->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -213,7 +214,7 @@
                                            hValue, TRUE)) {
     return;
   }
-  IXFA_Notify* pNotify = pDoc->GetNotify();
+  CXFA_FFNotify* pNotify = pDoc->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -777,6 +778,3 @@
     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 237192e..414e403 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 97f2c8b..922b0d6 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 @@
     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 @@
   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_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 @@
   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 @@
   if (!pNode) {
     return;
   }
-  IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout();
+  CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
   if (!pDocLayout) {
     return;
   }
@@ -205,7 +208,7 @@
   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 @@
   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_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_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 @@
   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 @@
   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 @@
   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 56d9894..7473bc0 100644
--- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h
+++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h
@@ -53,7 +53,7 @@
   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 3467471..6311314 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
@@ -694,7 +694,6 @@
   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 @@
   } 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 15328b0..2919664 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 @@
     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<CXFA_Node*>(pArguments->GetObject(0));
@@ -52,11 +55,11 @@
     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 @@
     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 @@
     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 c55ddf2..624502a 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 @@
                                  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<CFX_ByteString>& 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 @@
  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 @@
                        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<CFX_ByteString>& 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 @@
 #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 @@
 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 @@
 #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 @@
 #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 @@
 #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/fxfa/app/xfa_checksum.h b/xfa/include/fxfa/xfa_checksum.h
similarity index 78%
rename from xfa/fxfa/app/xfa_checksum.h
rename to xfa/include/fxfa/xfa_checksum.h
index c997dc7..3ca79ef 100644
--- a/xfa/fxfa/app/xfa_checksum.h
+++ b/xfa/include/fxfa/xfa_checksum.h
@@ -4,8 +4,8 @@
 
 // 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_
+#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"
@@ -51,17 +51,18 @@
   CXFA_SAXContext m_SAXContext;
 };
 
-class CXFA_ChecksumContext : public IXFA_ChecksumContext {
+class CXFA_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);
+  ~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:
@@ -70,4 +71,4 @@
   CFX_ByteString m_bsChecksum;
 };
 
-#endif  // XFA_FXFA_APP_XFA_CHECKSUM_H_
+#endif  // XFA_INCLUDE_FXFA_XFA_CHECKSUM_H_
diff --git a/xfa/fxfa/app/xfa_ffapp.h b/xfa/include/fxfa/xfa_ffapp.h
similarity index 74%
rename from xfa/fxfa/app/xfa_ffapp.h
rename to xfa/include/fxfa/xfa_ffapp.h
index c6c3286..c3bae48 100644
--- a/xfa/fxfa/app/xfa_ffapp.h
+++ b/xfa/include/fxfa/xfa_ffapp.h
@@ -4,8 +4,8 @@
 
 // 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_
+#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"
@@ -15,6 +15,7 @@
 #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;
@@ -34,21 +35,19 @@
   CFX_ObjectArray<CPDF_StreamAcc> m_Data;
 };
 
-class CXFA_FFApp : public IXFA_App, public IFWL_AdapterNative {
+class CXFA_FFApp : 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;
+  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(
@@ -79,4 +78,4 @@
   CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr;
 };
 
-#endif  // XFA_FXFA_APP_XFA_FFAPP_H_
+#endif  // XFA_INCLUDE_FXFA_XFA_FFAPP_H_
diff --git a/xfa/fxfa/app/xfa_ffdoc.h b/xfa/include/fxfa/xfa_ffdoc.h
similarity index 83%
rename from xfa/fxfa/app/xfa_ffdoc.h
rename to xfa/include/fxfa/xfa_ffdoc.h
index 31d5d0f..ebae04b 100644
--- a/xfa/fxfa/app/xfa_ffdoc.h
+++ b/xfa/include/fxfa/xfa_ffdoc.h
@@ -4,12 +4,13 @@
 
 // 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_
+#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;
@@ -20,7 +21,7 @@
   int32_t iImageYDpi;
 };
 
-class CXFA_FFDoc : public IXFA_Doc {
+class CXFA_FFDoc {
  public:
   CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider);
   ~CXFA_FFDoc();
@@ -29,14 +30,14 @@
   int32_t StartLoad();
   int32_t DoLoad(IFX_Pause* pPause = NULL);
   void StopLoad();
-  IXFA_DocView* CreateDocView(uint32_t dwView = 0);
+  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(IXFA_DocLayout* pLayout);
+  CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
   CXFA_FFDocView* GetDocView();
   CPDF_Document* GetPDFDoc();
   CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName,
@@ -45,7 +46,7 @@
   CFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage);
   FX_BOOL SavePackage(const CFX_WideStringC& wsPackage,
                       IFX_FileWrite* pFile,
-                      IXFA_ChecksumContext* pCSContext = NULL);
+                      CXFA_ChecksumContext* pCSContext = NULL);
   FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE);
 
  protected:
@@ -61,4 +62,4 @@
   FX_BOOL m_bOwnStream;
 };
 
-#endif  // XFA_FXFA_APP_XFA_FFDOC_H_
+#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 0000000..7eaa20b
--- /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/fxfa/app/xfa_ffdocview.h b/xfa/include/fxfa/xfa_ffdocview.h
similarity index 66%
rename from xfa/fxfa/app/xfa_ffdocview.h
rename to xfa/include/fxfa/xfa_ffdocview.h
index 284a32f..e8a29111 100644
--- a/xfa/fxfa/app/xfa_ffdocview.h
+++ b/xfa/include/fxfa/xfa_ffdocview.h
@@ -4,14 +4,16 @@
 
 // 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_
+#ifndef XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
+#define XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
 
-#include "xfa/fxfa/app/xfa_ffdoc.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,
@@ -29,37 +31,36 @@
   XFA_DOCVIEW_LAYOUTSTATUS_DocReady,
   XFA_DOCVIEW_LAYOUTSTATUS_End
 };
-class CXFA_FFDocView : public IXFA_DocView {
+class CXFA_FFDocView {
  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(
+  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);
-  virtual IXFA_Widget* GetFocusWidget();
-  virtual void KillFocus();
-  virtual FX_BOOL SetFocus(IXFA_Widget* hWidget);
+  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);
-  IXFA_DocLayout* GetXFALayout() const;
-  void OnPageEvent(IXFA_LayoutPage* pSender,
+  CXFA_LayoutProcessor* GetXFALayout() const;
+  void OnPageEvent(CXFA_ContainerLayoutItem* pSender,
                    XFA_PAGEEVENT eEvent,
                    int32_t iPageIndex);
   void LockUpdate();
@@ -67,7 +68,7 @@
   FX_BOOL IsUpdateLocked();
   void ClearInvalidateList();
   void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate);
-  void AddInvalidateRect(IXFA_PageView* pPageView,
+  void AddInvalidateRect(CXFA_FFPageView* pPageView,
                          const CFX_RectF& rtInvalidate);
   void RunInvalidate();
   void RunDocClose();
@@ -112,7 +113,7 @@
 
   CXFA_FFDoc* m_pDoc;
   CXFA_FFWidgetHandler* m_pWidgetHandler;
-  IXFA_DocLayout* m_pXFADocLayout;
+  CXFA_LayoutProcessor* m_pXFADocLayout;
   CXFA_WidgetAcc* m_pFocusAcc;
   CXFA_FFWidget* m_pFocusWidget;
   CXFA_FFWidget* m_pOldFocusWidget;
@@ -135,31 +136,32 @@
   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);
+  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 IXFA_WidgetAccIterator {
+class CXFA_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();
+  ~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;
@@ -167,4 +169,4 @@
   CXFA_WidgetAcc* m_pCurWidgetAcc;
 };
 
-#endif  // XFA_FXFA_APP_XFA_FFDOCVIEW_H_
+#endif  // XFA_INCLUDE_FXFA_XFA_FFDOCVIEW_H_
diff --git a/xfa/fxfa/app/xfa_ffpageview.h b/xfa/include/fxfa/xfa_ffpageview.h
similarity index 66%
rename from xfa/fxfa/app/xfa_ffpageview.h
rename to xfa/include/fxfa/xfa_ffpageview.h
index 20818e7..cce1cc1 100644
--- a/xfa/fxfa/app/xfa_ffpageview.h
+++ b/xfa/include/fxfa/xfa_ffpageview.h
@@ -4,33 +4,32 @@
 
 // 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_
+#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 IXFA_PageView {
+class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
  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;
+  CXFA_FFDocView* GetDocView();
+  int32_t GetPageViewIndex();
+  void GetPageViewRect(CFX_RectF& rtPage);
   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;
+                        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) override;
+                                XFA_WIDGETFILTER_AllType);
 
   FX_BOOL IsPageViewLoaded();
 
@@ -45,20 +44,22 @@
  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);
+  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:
-  IXFA_Widget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+  CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+
   CXFA_FFPageView* m_pPageView;
-  IXFA_Widget* m_hCurWidget;
+  CXFA_FFWidget* m_hCurWidget;
   uint32_t m_dwFilter;
   FX_BOOL m_bIgnorerelevant;
   CXFA_LayoutItemIterator m_sIterator;
@@ -78,22 +79,17 @@
                                     uint32_t dwFilter);
   virtual ~CXFA_FFTabOrderPageWidgetIterator();
 
-  virtual void Release();
+  void Release() override;
 
-  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);
+  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_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);
@@ -106,6 +102,12 @@
                       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_FXFA_APP_XFA_FFPAGEVIEW_H_
+#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 0000000..28c6b4b
--- /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 <vector>
+
+#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<CFX_ByteString>& 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/fxfa/app/xfa_fontmgr.h b/xfa/include/fxfa/xfa_fontmgr.h
similarity index 80%
rename from xfa/fxfa/app/xfa_fontmgr.h
rename to xfa/include/fxfa/xfa_fontmgr.h
index 20d3e56..082c672 100644
--- a/xfa/fxfa/app/xfa_fontmgr.h
+++ b/xfa/include/fxfa/xfa_fontmgr.h
@@ -4,8 +4,8 @@
 
 // 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_
+#ifndef XFA_INCLUDE_FXFA_XFA_FONTMGR_H_
+#define XFA_INCLUDE_FXFA_XFA_FONTMGR_H_
 
 #include <map>
 
@@ -24,20 +24,19 @@
   uint16_t wCodePage;
 };
 
-class CXFA_DefFontMgr : public IXFA_FontMgr {
+class CXFA_DefFontMgr {
  public:
   CXFA_DefFontMgr() {}
-  ~CXFA_DefFontMgr() override;
+  ~CXFA_DefFontMgr();
 
-  // IXFA_FontMgr:
-  IFX_Font* GetFont(IXFA_Doc* hDoc,
+  IFX_Font* GetFont(CXFA_FFDoc* hDoc,
                     const CFX_WideStringC& wsFontFamily,
                     uint32_t dwFontStyles,
-                    uint16_t wCodePage = 0xFFFF) override;
-  IFX_Font* GetDefaultFont(IXFA_Doc* hDoc,
+                    uint16_t wCodePage = 0xFFFF);
+  IFX_Font* GetDefaultFont(CXFA_FFDoc* hDoc,
                            const CFX_WideStringC& wsFontFamily,
                            uint32_t dwFontStyles,
-                           uint16_t wCodePage = 0xFFFF) override;
+                           uint16_t wCodePage = 0xFFFF);
 
  protected:
   CFX_PtrArray m_CacheFonts;
@@ -80,21 +79,21 @@
  public:
   CXFA_FontMgr();
   ~CXFA_FontMgr();
-  IFX_Font* GetFont(IXFA_Doc* hDoc,
+  IFX_Font* GetFont(CXFA_FFDoc* hDoc,
                     const CFX_WideStringC& wsFontFamily,
                     uint32_t dwFontStyles,
                     uint16_t wCodePage = 0xFFFF);
-  void LoadDocFonts(IXFA_Doc* hDoc);
-  void ReleaseDocFonts(IXFA_Doc* hDoc);
+  void LoadDocFonts(CXFA_FFDoc* hDoc);
+  void ReleaseDocFonts(CXFA_FFDoc* hDoc);
 
-  void SetDefFontMgr(IXFA_FontMgr* pFontMgr);
+  void SetDefFontMgr(CXFA_DefFontMgr* pFontMgr);
 
  protected:
   void DelAllMgrMap();
 
   CFX_MapPtrToPtr m_PDFFontMgrArray;
-  IXFA_FontMgr* m_pDefFontMgr;
+  CXFA_DefFontMgr* m_pDefFontMgr;
   std::map<CFX_ByteString, IFX_Font*> m_FontMap;
 };
 
-#endif  //  XFA_FXFA_APP_XFA_FONTMGR_H_
+#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 0000000..d620527
--- /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_