diff options
Diffstat (limited to 'xfa/fxfa')
82 files changed, 807 insertions, 1831 deletions
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 4d2bdfc401..aac5456b63 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_checksum.h" #include "core/fdrm/crypto/include/fx_crypt.h" #include "xfa/fgas/crt/fgas_algorithm.h" @@ -124,9 +124,7 @@ void CXFA_SAXReaderHandler::UpdateChecksum(FX_BOOL bCheckSpace) { } m_SAXContext.m_TextBuf.Clear(); } -IXFA_ChecksumContext* XFA_Checksum_Create() { - return new CXFA_ChecksumContext; -} + CXFA_ChecksumContext::CXFA_ChecksumContext() : m_pSAXReader(NULL), m_pByteContext(NULL) {} CXFA_ChecksumContext::~CXFA_ChecksumContext() { diff --git a/xfa/fxfa/app/xfa_checksum.h b/xfa/fxfa/app/xfa_checksum.h deleted file mode 100644 index c997dc76fa..0000000000 --- a/xfa/fxfa/app/xfa_checksum.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_CHECKSUM_H_ -#define XFA_FXFA_APP_XFA_CHECKSUM_H_ - -#include "xfa/fgas/xml/fgas_sax.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_SAXReaderHandler; -class CXFA_ChecksumContext; - -class CXFA_SAXContext { - public: - CXFA_SAXContext() : m_eNode(FX_SAXNODE_Unknown) {} - CFX_ByteTextBuf m_TextBuf; - CFX_ByteString m_bsTagName; - FX_SAXNODE m_eNode; -}; -class CXFA_SAXReaderHandler : public IFX_SAXReaderHandler { - public: - CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext); - virtual ~CXFA_SAXReaderHandler(); - virtual void* OnTagEnter(const CFX_ByteStringC& bsTagName, - FX_SAXNODE eType, - uint32_t dwStartPos); - virtual void OnTagAttribute(void* pTag, - const CFX_ByteStringC& bsAttri, - const CFX_ByteStringC& bsValue); - virtual void OnTagBreak(void* pTag); - virtual void OnTagData(void* pTag, - FX_SAXNODE eType, - const CFX_ByteStringC& bsData, - uint32_t dwStartPos); - virtual void OnTagClose(void* pTag, uint32_t dwEndPos); - virtual void OnTagEnd(void* pTag, - const CFX_ByteStringC& bsTagName, - uint32_t dwEndPos); - - virtual void OnTargetData(void* pTag, - FX_SAXNODE eType, - const CFX_ByteStringC& bsData, - uint32_t dwStartPos); - - protected: - void UpdateChecksum(FX_BOOL bCheckSpace); - CXFA_ChecksumContext* m_pContext; - CXFA_SAXContext m_SAXContext; -}; - -class CXFA_ChecksumContext : public IXFA_ChecksumContext { - public: - CXFA_ChecksumContext(); - virtual ~CXFA_ChecksumContext(); - virtual void Release() { delete this; } - virtual FX_BOOL StartChecksum(); - virtual FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, - FX_FILESIZE offset = 0, - size_t size = 0); - virtual void FinishChecksum(); - virtual void GetChecksum(CFX_ByteString& bsChecksum); - void Update(const CFX_ByteStringC& bsText); - - protected: - IFX_SAXReader* m_pSAXReader; - uint8_t* m_pByteContext; - CFX_ByteString m_bsChecksum; -}; - -#endif // XFA_FXFA_APP_XFA_CHECKSUM_H_ diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 1fdcc25563..4d3d707998 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -4,17 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" #include <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 @@ FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, } return FALSE; } -// static -IXFA_App* IXFA_App::Create(IXFA_AppProvider* pProvider) { - return new CXFA_FFApp(pProvider); -} -// virtual -IXFA_App::~IXFA_App() {} + CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pDocHandler(nullptr), m_pFWLTheme(nullptr), @@ -83,7 +78,7 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) m_pFWLApp = IFWL_App::Create(this); FWL_SetApp(m_pFWLApp); m_pFWLApp->Initialize(); - IXFA_TimeZoneProvider::Create(); + CXFA_TimeZoneProvider::Create(); } CXFA_FFApp::~CXFA_FFApp() { delete m_pDocHandler; @@ -97,7 +92,7 @@ CXFA_FFApp::~CXFA_FFApp() { delete m_pAdapterWidgetMgr; delete m_pAdapterThreadMgr; delete m_pMenuHandler; - IXFA_TimeZoneProvider::Destroy(); + CXFA_TimeZoneProvider::Destroy(); delete m_pFontMgr; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (m_pFontSource) @@ -106,21 +101,21 @@ CXFA_FFApp::~CXFA_FFApp() { if (m_pFDEFontMgr) m_pFDEFontMgr->Release(); } -IXFA_MenuHandler* CXFA_FFApp::GetMenuHandler() { +CXFA_FFMenuHandler* CXFA_FFApp::GetMenuHandler() { if (!m_pMenuHandler) { m_pMenuHandler = new CXFA_FFMenuHandler; } return m_pMenuHandler; } -IXFA_DocHandler* CXFA_FFApp::GetDocHandler() { +CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { if (!m_pDocHandler) { m_pDocHandler = new CXFA_FFDocHandler; } return m_pDocHandler; } -IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, - IFX_FileRead* pStream, - FX_BOOL bTakeOverFile) { +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, + IFX_FileRead* pStream, + FX_BOOL bTakeOverFile) { CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); if (!bSuccess) { @@ -129,8 +124,8 @@ IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, } return pDoc; } -IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, - CPDF_Document* pPDFDoc) { +CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, + CPDF_Document* pPDFDoc) { if (pPDFDoc == NULL) { return NULL; } @@ -143,7 +138,7 @@ IXFA_Doc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, return pDoc; } -void CXFA_FFApp::SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) { +void CXFA_FFApp::SetDefaultFontMgr(CXFA_DefFontMgr* pFontMgr) { if (!m_pFontMgr) { m_pFontMgr = new CXFA_FontMgr(); } diff --git a/xfa/fxfa/app/xfa_ffapp.h b/xfa/fxfa/app/xfa_ffapp.h deleted file mode 100644 index c6c32868b4..0000000000 --- a/xfa/fxfa/app/xfa_ffapp.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFAPP_H_ -#define XFA_FXFA_APP_XFA_FFAPP_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "xfa/fgas/font/fgas_font.h" -#include "xfa/fwl/core/fwl_sdadapterimp.h" -#include "xfa/fwl/core/ifwl_adapternative.h" -#include "xfa/fwl/core/ifwl_app.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FWLAdapterWidgetMgr; -class CXFA_FWLTheme; -class CXFA_FFDocHandler; -class CXFA_FFMenuHandler; -class CXFA_FontMgr; - -class CXFA_FileRead : public IFX_FileRead { - public: - explicit CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams); - - virtual FX_FILESIZE GetSize(); - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); - - virtual void Release() { delete this; } - - protected: - CFX_ObjectArray<CPDF_StreamAcc> m_Data; -}; - -class CXFA_FFApp : public IXFA_App, public IFWL_AdapterNative { - public: - CXFA_FFApp(IXFA_AppProvider* pProvider); - ~CXFA_FFApp() override; - - // IFXFA_App: - IXFA_DocHandler* GetDocHandler() override; - IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - IFX_FileRead* pStream, - FX_BOOL bTakeOverFile) override; - IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider, - CPDF_Document* pPDFDoc) override; - IXFA_AppProvider* GetAppProvider() override { return m_pProvider; } - void SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) override; - IXFA_MenuHandler* GetMenuHandler() override; - - // IFWL_AdapterNative: - IFWL_AdapterWidgetMgr* GetWidgetMgr( - IFWL_WidgetMgrDelegate* pDelegate) override; - IFWL_AdapterThreadMgr* GetThreadMgr() override; - IFWL_AdapterTimerMgr* GetTimerMgr() override; - - CXFA_FontMgr* GetXFAFontMgr(); - IFX_FontMgr* GetFDEFontMgr(); - CXFA_FWLTheme* GetFWLTheme(); - IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() { - return m_pWidgetMgrDelegate; - } - - protected: - CXFA_FFDocHandler* m_pDocHandler; - IFWL_App* m_pFWLApp; - CXFA_FWLTheme* m_pFWLTheme; - IXFA_AppProvider* m_pProvider; - CXFA_FontMgr* m_pFontMgr; -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - IFX_FontSourceEnum* m_pFontSource; -#endif - CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr; - IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; - IFX_FontMgr* m_pFDEFontMgr; - CXFA_FFMenuHandler* m_pMenuHandler; - CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr; -}; - -#endif // XFA_FXFA_APP_XFA_FFAPP_H_ diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index daa94912fc..80def6c334 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -11,10 +11,10 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_barcode.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" namespace { diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index 77d8ba840a..8a32e8df51 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -8,8 +8,8 @@ #define XFA_FXFA_APP_XFA_FFBARCODE_H_ #include "xfa/fxbarcode/include/BC_Library.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_fftextedit.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFBarcode : public CXFA_FFTextEdit { public: diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index fdf7d7829d..0e56ca612c 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -10,13 +10,13 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_checkbox.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index 5eeb3e86a8..2e169041d7 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -8,7 +8,7 @@ #define XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_ #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFCheckButton : public CXFA_FFField { public: diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 9017f68597..bba1a7ec64 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -11,12 +11,12 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_combobox.h" #include "xfa/fwl/lightwidget/cfwl_listbox.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index 3d8863c066..580bb8f647 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -8,7 +8,7 @@ #define XFA_FXFA_APP_XFA_FFCHOICELIST_H_ #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFListBox : public CXFA_FFField { public: diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 01d40ee8cc..94f035251e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -4,22 +4,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fxcrt/include/fx_ext.h" +#include "core/fxcrt/include/fx_memory.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fwl/core/ifwl_notedriver.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/app/xfa_ffwidget.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" #include "xfa/fxfa/parser/xfa_docdata.h" +#include "xfa/fxfa/parser/xfa_document_serialize.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/include/fxfa/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider) : m_pDocProvider(pDocProvider), @@ -38,7 +43,7 @@ uint32_t CXFA_FFDoc::GetDocType() { } int32_t CXFA_FFDoc::StartLoad() { m_pNotify = new CXFA_FFNotify(this); - IXFA_DocParser* pDocParser = IXFA_DocParser::Create(m_pNotify); + CXFA_DocumentParser* pDocParser = new CXFA_DocumentParser(m_pNotify); int32_t iStatus = pDocParser->StartParse(m_pStream); m_pDocument = pDocParser->GetDocument(); return iStatus; @@ -182,7 +187,7 @@ void CXFA_FFDoc::StopLoad() { m_dwDocType = XFA_DOCTYPE_Dynamic; } } -IXFA_DocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { +CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { CXFA_FFDocView* pDocView = (CXFA_FFDocView*)m_mapTypeToDocView.GetValueAt((void*)(uintptr_t)dwView); if (!pDocView) { @@ -191,7 +196,7 @@ IXFA_DocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { } return pDocView; } -CXFA_FFDocView* CXFA_FFDoc::GetDocView(IXFA_DocLayout* pLayout) { +CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) { FX_POSITION ps = m_mapTypeToDocView.GetStartPosition(); while (ps) { void* pType; @@ -393,11 +398,8 @@ CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { } FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext) { - IXFA_PacketExport* pExport = IXFA_PacketExport::Create(m_pDocument); - if (!pExport) { - return FALSE; - } + CXFA_ChecksumContext* pCSContext) { + CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument); uint32_t packetHash = FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); CXFA_Node* pNode = NULL; @@ -422,11 +424,8 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, return bFlags; } FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { - FX_BOOL bRet = FALSE; - IXFA_PacketImport* pImport = IXFA_PacketImport::Create(m_pDocument); - if (pImport) { - bRet = pImport->ImportData(pStream); - pImport->Release(); - } - return bRet; + std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>> + importer(new CXFA_DataImporter(m_pDocument)); + + return importer->ImportData(pStream); } diff --git a/xfa/fxfa/app/xfa_ffdoc.h b/xfa/fxfa/app/xfa_ffdoc.h deleted file mode 100644 index 31d5d0fc41..0000000000 --- a/xfa/fxfa/app/xfa_ffdoc.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOC_H_ -#define XFA_FXFA_APP_XFA_FFDOC_H_ - -#include "xfa/fxfa/parser/xfa_document.h" -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FFApp; -class CXFA_FFNotify; -class CXFA_FFDocView; - -struct FX_IMAGEDIB_AND_DPI { - CFX_DIBSource* pDibSource; - int32_t iImageXDpi; - int32_t iImageYDpi; -}; - -class CXFA_FFDoc : public IXFA_Doc { - public: - CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider); - ~CXFA_FFDoc(); - IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } - uint32_t GetDocType(); - int32_t StartLoad(); - int32_t DoLoad(IFX_Pause* pPause = NULL); - void StopLoad(); - IXFA_DocView* CreateDocView(uint32_t dwView = 0); - FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); - FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); - FX_BOOL CloseDoc(); - void SetDocType(uint32_t dwType); - CXFA_Document* GetXFADoc() { return m_pDocument; } - CXFA_FFApp* GetApp() { return m_pApp; } - CXFA_FFDocView* GetDocView(IXFA_DocLayout* pLayout); - CXFA_FFDocView* GetDocView(); - CPDF_Document* GetPDFDoc(); - CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, - int32_t& iImageXDpi, - int32_t& iImageYDpi); - CFDE_XMLElement* GetPackageData(const CFX_WideStringC& wsPackage); - FX_BOOL SavePackage(const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext = NULL); - FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); - - protected: - IXFA_DocProvider* m_pDocProvider; - CXFA_Document* m_pDocument; - IFX_FileRead* m_pStream; - CXFA_FFApp* m_pApp; - CXFA_FFNotify* m_pNotify; - CPDF_Document* m_pPDFDoc; - CFX_MapPtrToPtr m_mapNamedImages; - CFX_MapPtrToPtr m_mapTypeToDocView; - uint32_t m_dwDocType; - FX_BOOL m_bOwnStream; -}; - -#endif // XFA_FXFA_APP_XFA_FFDOC_H_ diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp index 036fc67ebd..949dae4a8b 100644 --- a/xfa/fxfa/app/xfa_ffdochandler.cpp +++ b/xfa/fxfa/app/xfa_ffdochandler.cpp @@ -4,79 +4,83 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdochandler.h" +#include "xfa/include/fxfa/xfa_ffdochandler.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_checksum.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" CXFA_FFDocHandler::CXFA_FFDocHandler() {} + CXFA_FFDocHandler::~CXFA_FFDocHandler() {} -void CXFA_FFDocHandler::ReleaseDoc(IXFA_Doc* hDoc) { + +void CXFA_FFDocHandler::ReleaseDoc(CXFA_FFDoc* hDoc) { delete hDoc; // virtual dtor. } -IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(IXFA_Doc* hDoc) { - return static_cast<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 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { } return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); } -FX_BOOL CXFA_FFDocHandler::RunDocScript(IXFA_Doc* hDoc, +FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, const CFX_WideStringC& wsScript, FXJSE_HVALUE hRetValue, FXJSE_HVALUE hThisObject) { - CXFA_Document* pXFADoc = static_cast<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 695f6a819d..0000000000 --- a/xfa/fxfa/app/xfa_ffdochandler.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ -#define XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ - -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_FFDocHandler : public IXFA_DocHandler { - public: - CXFA_FFDocHandler(); - ~CXFA_FFDocHandler(); - - void ReleaseDoc(IXFA_Doc* hDoc) override; - IXFA_DocProvider* GetDocProvider(IXFA_Doc* hDoc) override; - uint32_t GetDocType(IXFA_Doc* hDoc) override; - int32_t StartLoad(IXFA_Doc* hDoc) override; - int32_t DoLoad(IXFA_Doc* hDoc, IFX_Pause* pPause = NULL) override; - void StopLoad(IXFA_Doc* hDoc) override; - - IXFA_DocView* CreateDocView(IXFA_Doc* hDoc, uint32_t dwView = 0) override; - int32_t CountPackages(IXFA_Doc* hDoc) override; - void GetPackageName(IXFA_Doc* hDoc, - int32_t iPackage, - CFX_WideStringC& wsPackage) override; - CFDE_XMLElement* GetPackageData(IXFA_Doc* hDoc, - const CFX_WideStringC& wsPackage); - FX_BOOL SavePackage(IXFA_Doc* hDoc, - const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - IXFA_ChecksumContext* pCSContext = NULL) override; - FX_BOOL CloseDoc(IXFA_Doc* hDoc) override; - FX_BOOL ImportData(IXFA_Doc* hDoc, - IFX_FileRead* pStream, - FX_BOOL bXDP = TRUE) override; - void SetJSERuntime(IXFA_Doc* hDoc, FXJSE_HRUNTIME hRuntime) override; - FXJSE_HVALUE GetXFAScriptObject(IXFA_Doc* hDoc) override; - XFA_ATTRIBUTEENUM GetRestoreState(IXFA_Doc* hDoc) override; - FX_BOOL RunDocScript(IXFA_Doc* hDoc, - XFA_SCRIPTTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - FXJSE_HVALUE hThisObject) override; - - protected: -}; - -#endif // XFA_FXFA_APP_XFA_FFDOCHANDLER_H_ diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 5e814475db..907e2b5d22 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -4,20 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" #include "core/fxcrt/include/fx_ext.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimage.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffpath.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_ffsignature.h" @@ -26,10 +23,15 @@ #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, @@ -195,20 +197,14 @@ int32_t CXFA_FFDocView::CountPageViews() { } return m_pXFADocLayout->CountPages(); } -IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { +CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) { if (!m_pXFADocLayout) { return NULL; } return static_cast<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 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady); return XFA_EVENTERROR_Success; } -IXFA_WidgetHandler* CXFA_FFDocView::GetWidgetHandler() { +CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { if (!m_pWidgetHandler) { m_pWidgetHandler = new CXFA_FFWidgetHandler(this); } @@ -325,7 +321,7 @@ IXFA_WidgetIterator* CXFA_FFDocView::CreateWidgetIterator() { } return new CXFA_FFDocWidgetIterator(this, pFormRoot); } -IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( +CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( XFA_WIDGETORDER eOrder) { CXFA_Node* pFormRoot = GetRootSubform(); if (!pFormRoot) { @@ -333,7 +329,7 @@ IXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator( } return new CXFA_WidgetAccIterator(this, pFormRoot); } -IXFA_Widget* CXFA_FFDocView::GetFocusWidget() { +CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() { return m_pFocusWidget; } void CXFA_FFDocView::KillFocus() { @@ -345,8 +341,8 @@ void CXFA_FFDocView::KillFocus() { m_pFocusWidget = NULL; m_pOldFocusWidget = NULL; } -FX_BOOL CXFA_FFDocView::SetFocus(IXFA_Widget* hWidget) { - CXFA_FFWidget* pNewFocus = (CXFA_FFWidget*)hWidget; +FX_BOOL CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { + CXFA_FFWidget* pNewFocus = hWidget; if (m_pOldFocusWidget == pNewFocus) { return FALSE; } @@ -507,7 +503,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( CFX_WideString wsExpression; uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; - IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); if (!pScriptContext) { return NULL; } @@ -532,7 +528,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( } return NULL; } -void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender, +void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, XFA_PAGEEVENT eEvent, int32_t iPageIndex) { CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); @@ -568,7 +564,7 @@ void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate) { AddInvalidateRect(pWidget->GetPageView(), rtInvalidate); } -void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, +void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rtInvalidate) { CFX_RectF* pRect = (CFX_RectF*)m_mapPageInvalidate.GetValueAt(pPageView); if (!pRect) { @@ -583,7 +579,7 @@ void CXFA_FFDocView::AddInvalidateRect(IXFA_PageView* pPageView, void CXFA_FFDocView::RunInvalidate() { FX_POSITION ps = m_mapPageInvalidate.GetStartPosition(); while (ps) { - IXFA_PageView* pPageView = NULL; + CXFA_FFPageView* pPageView = NULL; CFX_RectF* pRect = NULL; m_mapPageInvalidate.GetNextAssoc(ps, (void*&)pPageView, (void*&)pRect); m_pDoc->GetDocProvider()->InvalidateRect(pPageView, *pRect); @@ -770,7 +766,7 @@ void CXFA_FFDocView::RunBindItems() { continue; } CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); - IXFA_ScriptContext* pScriptContext = + CXFA_ScriptContext* pScriptContext = pWidgetNode->GetDocument()->GetScriptContext(); CFX_WideStringC wsRef; binditems.GetRef(wsRef); @@ -852,13 +848,13 @@ void CXFA_FFDocWidgetIterator::Reset() { m_ContentIterator.Reset(); m_pCurWidget = NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToFirst() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToLast() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToNext() { CXFA_Node* pItem = m_pCurWidget ? m_ContentIterator.MoveToNext() : m_ContentIterator.GetCurrent(); while (pItem) { @@ -875,24 +871,16 @@ IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToNext() { } return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::MoveToPrevious() { return NULL; } -IXFA_Widget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFDocWidgetIterator::GetCurrentWidget() { return NULL; } -FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { +FX_BOOL CXFA_FFDocWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { return FALSE; } -IXFA_WidgetAccIterator* XFA_WidgetAccIterator_Create( - CXFA_WidgetAcc* pTravelRoot, - XFA_WIDGETORDER eOrder) { - if (!pTravelRoot) { - return NULL; - } - return new CXFA_WidgetAccIterator(pTravelRoot->GetDocView(), - pTravelRoot->GetNode()); -} + CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot) : m_ContentIterator(pTravelRoot) { diff --git a/xfa/fxfa/app/xfa_ffdocview.h b/xfa/fxfa/app/xfa_ffdocview.h deleted file mode 100644 index 284a32fdc3..0000000000 --- a/xfa/fxfa/app/xfa_ffdocview.h +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFDOCVIEW_H_ -#define XFA_FXFA_APP_XFA_FFDOCVIEW_H_ - -#include "xfa/fxfa/app/xfa_ffdoc.h" - -class CXFA_FFWidgetHandler; -class CXFA_FFDoc; -class CXFA_FFWidget; -extern const XFA_ATTRIBUTEENUM gs_EventActivity[]; -enum XFA_DOCVIEW_LAYOUTSTATUS { - XFA_DOCVIEW_LAYOUTSTATUS_None, - XFA_DOCVIEW_LAYOUTSTATUS_Start, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate, - XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate, - XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady, - XFA_DOCVIEW_LAYOUTSTATUS_Doing, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate, - XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady, - XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady, - XFA_DOCVIEW_LAYOUTSTATUS_DocReady, - XFA_DOCVIEW_LAYOUTSTATUS_End -}; -class CXFA_FFDocView : public IXFA_DocView { - public: - CXFA_FFDocView(CXFA_FFDoc* pDoc); - ~CXFA_FFDocView(); - - virtual IXFA_Doc* GetDoc() { return m_pDoc; } - virtual int32_t StartLayout(int32_t iStartPage = 0); - virtual int32_t DoLayout(IFX_Pause* pPause = NULL); - virtual void StopLayout(); - virtual int32_t GetLayoutStatus(); - virtual void UpdateDocView(); - virtual int32_t CountPageViews(); - virtual IXFA_PageView* GetPageView(int32_t nIndex); - virtual IXFA_Widget* GetWidgetByName(const CFX_WideStringC& wsName); - virtual CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName); - virtual void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL); - virtual int32_t ProcessWidgetEvent(CXFA_EventParam* pParam, - CXFA_WidgetAcc* pWidgetAcc = NULL); - virtual IXFA_WidgetHandler* GetWidgetHandler(); - virtual IXFA_WidgetIterator* CreateWidgetIterator(); - virtual IXFA_WidgetAccIterator* CreateWidgetAccIterator( - XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder); - virtual IXFA_Widget* GetFocusWidget(); - virtual void KillFocus(); - virtual FX_BOOL SetFocus(IXFA_Widget* hWidget); - CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName, - CXFA_FFWidget* pRefWidget = NULL); - CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName, - CXFA_WidgetAcc* pRefWidgetAcc = NULL); - IXFA_DocLayout* GetXFALayout() const; - void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - int32_t iPageIndex); - void LockUpdate(); - void UnlockUpdate(); - FX_BOOL IsUpdateLocked(); - void ClearInvalidateList(); - void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate); - void AddInvalidateRect(IXFA_PageView* pPageView, - const CFX_RectF& rtInvalidate); - void RunInvalidate(); - void RunDocClose(); - void DestroyDocView(); - - FX_BOOL InitValidate(CXFA_Node* pNode); - FX_BOOL RunValidate(); - - void SetChangeMark(); - - void AddValidateWidget(CXFA_WidgetAcc* pWidget); - void AddCalculateNodeNotify(CXFA_Node* pNodeChange); - void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); - int32_t RunCalculateWidgets(); - FX_BOOL IsStaticNotify(); - FX_BOOL RunLayout(); - void RunSubformIndexChange(); - void AddNewFormNode(CXFA_Node* pNode); - void AddIndexChangedSubform(CXFA_Node* pNode); - CXFA_WidgetAcc* GetFocusWidgetAcc(); - void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); - void DeleteLayoutItem(CXFA_FFWidget* pWidget); - int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_Node* pExclude = NULL); - FX_BOOL m_bLayoutEvent; - CFX_WideStringArray m_arrNullTestMsg; - CXFA_FFWidget* m_pListFocusWidget; - FX_BOOL m_bInLayoutStatus; - - protected: - FX_BOOL RunEventLayoutReady(); - void RunBindItems(); - FX_BOOL InitCalculate(CXFA_Node* pNode); - void InitLayout(CXFA_Node* pNode); - void RunCalculateRecursive(int32_t& iIndex); - void ShowNullTestMsg(); - FX_BOOL ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc); - CXFA_Node* GetRootSubform(); - - CXFA_FFDoc* m_pDoc; - CXFA_FFWidgetHandler* m_pWidgetHandler; - IXFA_DocLayout* m_pXFADocLayout; - CXFA_WidgetAcc* m_pFocusAcc; - CXFA_FFWidget* m_pFocusWidget; - CXFA_FFWidget* m_pOldFocusWidget; - CFX_MapPtrToPtr m_mapPageInvalidate; - CFX_PtrArray m_ValidateAccs; - CFX_PtrArray m_bindItems; - CFX_PtrArray m_CalculateAccs; - - CFX_PtrArray m_NewAddedNodes; - CFX_PtrArray m_IndexChangedSubforms; - XFA_DOCVIEW_LAYOUTSTATUS m_iStatus; - int32_t m_iLock; - friend class CXFA_FFNotify; -}; -class CXFA_FFDocWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); - virtual ~CXFA_FFDocWidgetIterator(); - - virtual void Release() { delete this; } - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - CXFA_ContainerIterator m_ContentIterator; - CXFA_FFDocView* m_pDocView; - CXFA_FFWidget* m_pCurWidget; -}; -class CXFA_WidgetAccIterator : public IXFA_WidgetAccIterator { - public: - CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); - virtual ~CXFA_WidgetAccIterator(); - virtual void Release() { delete this; } - virtual void Reset(); - virtual CXFA_WidgetAcc* MoveToFirst(); - virtual CXFA_WidgetAcc* MoveToLast(); - virtual CXFA_WidgetAcc* MoveToNext(); - virtual CXFA_WidgetAcc* MoveToPrevious(); - virtual CXFA_WidgetAcc* GetCurrentWidgetAcc(); - virtual FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget); - virtual void SkipTree(); - - protected: - CXFA_ContainerIterator m_ContentIterator; - CXFA_FFDocView* m_pDocView; - CXFA_WidgetAcc* m_pCurWidgetAcc; -}; - -#endif // XFA_FXFA_APP_XFA_FFDOCVIEW_H_ diff --git a/xfa/fxfa/app/xfa_ffdraw.cpp b/xfa/fxfa/app/xfa_ffdraw.cpp index 06cfdfec52..06fc85b893 100644 --- a/xfa/fxfa/app/xfa_ffdraw.cpp +++ b/xfa/fxfa/app/xfa_ffdraw.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFDraw::CXFA_FFDraw(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffdraw.h b/xfa/fxfa/app/xfa_ffdraw.h index a5db5982a5..fb2d11e1f6 100644 --- a/xfa/fxfa/app/xfa_ffdraw.h +++ b/xfa/fxfa/app/xfa_ffdraw.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFDRAW_H_ #define XFA_FXFA_APP_XFA_FFDRAW_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFDraw : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp index 6705ea6c0e..47cc455962 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.cpp +++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffexclgroup.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffexclgroup.h b/xfa/fxfa/app/xfa_ffexclgroup.h index cdda4d0417..e492cf1817 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.h +++ b/xfa/fxfa/app/xfa_ffexclgroup.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ #define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFExclGroup : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 7aac2add61..90bb5f39e5 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -11,15 +11,15 @@ #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwltheme.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(NULL) { diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 64bdfa3470..51fe56be09 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -10,8 +10,8 @@ #include "xfa/fwl/core/fwl_sdadapterimp.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" #include "xfa/fwl/lightwidget/cfwl_widget.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #define XFA_MINUI_HEIGHT 4.32f #define XFA_DEFAULTUI_HEIGHT 2.0f diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp index 306c4677d2..f7f6ebbf1b 100644 --- a/xfa/fxfa/app/xfa_ffimage.cpp +++ b/xfa/fxfa/app/xfa_ffimage.cpp @@ -6,11 +6,11 @@ #include "xfa/fxfa/app/xfa_ffimage.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFImage::CXFA_FFImage(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index c0b371afcf..ba16d4d352 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -10,11 +10,11 @@ #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 25e0d7d7a9..7cb9f40b63 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -6,18 +6,14 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_ffdraw.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimage.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffpath.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_ffsignature.h" @@ -26,18 +22,24 @@ #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" static void XFA_FFDeleteWidgetAcc(void* pData) { delete static_cast<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 @@ void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender, } } CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { - IXFA_DocLayout* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); + CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); XFA_ELEMENT eType = pNode->GetClassID(); if (eType == XFA_ELEMENT_PageArea) { @@ -231,7 +233,7 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { pWidget->SetDocView(pDocView); return pWidget; } -void CXFA_FFNotify::OnLayoutEvent(IXFA_DocLayout* pLayout, +void CXFA_FFNotify::OnLayoutEvent(CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, XFA_LAYOUTEVENT eEvent, void* pParam, @@ -321,7 +323,7 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) { pDocView->AddCalculateWidgetAcc(pWidgetAcc); pDocView->AddValidateWidget(pWidgetAcc); } -IXFA_Doc* CXFA_FFNotify::GetHDOC() { +CXFA_FFDoc* CXFA_FFNotify::GetHDOC() { return m_pDoc; } IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { @@ -330,21 +332,20 @@ IXFA_DocProvider* CXFA_FFNotify::GetDocProvider() { IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() { return m_pDoc->GetApp()->GetAppProvider(); } -IXFA_WidgetHandler* CXFA_FFNotify::GetWidgetHandler() { +CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); return pDocView ? pDocView->GetWidgetHandler() : NULL; } -IXFA_Widget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { +CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) { return XFA_GetWidgetFromLayoutItem(pLayoutItem); } -void CXFA_FFNotify::OpenDropDownList(IXFA_Widget* hWidget) { - CXFA_FFWidget* pWidget = static_cast<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 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { } XFA_ELEMENT iType = pNode->GetClassID(); if (XFA_IsCreateWidget(iType)) { - CXFA_WidgetAcc* pAcc = - new CXFA_WidgetAcc(pDocView, static_cast<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::OnChildRemoved(CXFA_Node* pSender, } } void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { CXFA_FFWidget* pWidget = static_cast<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 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView, pWidget->AddInvalidateRect(nullptr); } void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { @@ -615,12 +615,12 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView, pWidget->AddInvalidateRect(nullptr); } void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) {} void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2) { diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index 30c8f0d107..6bf39ee6d2 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -9,59 +9,61 @@ #include "xfa/fxfa/parser/xfa_document.h" -class CXFA_FFNotify : public IXFA_Notify { +class CXFA_FFWidgetHandler; + +class CXFA_FFNotify { public: CXFA_FFNotify(CXFA_FFDoc* pDoc); ~CXFA_FFNotify(); - virtual void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - void* pParam = NULL); + void OnPageEvent(CXFA_ContainerLayoutItem* pSender, + XFA_PAGEEVENT eEvent, + void* pParam = NULL); - virtual void OnNodeEvent(CXFA_Node* pSender, - XFA_NODEEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL, - void* pParam3 = NULL, - void* pParam4 = NULL); - virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, - uint32_t dwEvent, - void* pParam = NULL, - void* pAdditional = NULL, - void* pAdditional2 = NULL); - virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode); - virtual void OnLayoutEvent(IXFA_DocLayout* pLayout, - CXFA_LayoutItem* pSender, - XFA_LAYOUTEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL); + void OnNodeEvent(CXFA_Node* pSender, + XFA_NODEEVENT eEvent, + void* pParam = NULL, + void* pParam2 = NULL, + void* pParam3 = NULL, + void* pParam4 = NULL); + void OnWidgetDataEvent(CXFA_WidgetData* pSender, + uint32_t dwEvent, + void* pParam = NULL, + void* pAdditional = NULL, + void* pAdditional2 = NULL); + CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode); + void OnLayoutEvent(CXFA_LayoutProcessor* pLayout, + CXFA_LayoutItem* pSender, + XFA_LAYOUTEVENT eEvent, + void* pParam = NULL, + void* pParam2 = NULL); - virtual void StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight); - virtual FX_BOOL FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos); - virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem); - virtual int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_WidgetAcc* pExclude = NULL); - virtual void AddCalcValidate(CXFA_Node* pNode); - virtual IXFA_Doc* GetHDOC(); - virtual IXFA_DocProvider* GetDocProvider(); - virtual IXFA_AppProvider* GetAppProvider(); - virtual IXFA_WidgetHandler* GetWidgetHandler(); - virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem); - virtual void OpenDropDownList(IXFA_Widget* hWidget); - virtual CFX_WideString GetCurrentDateTime(); - virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL); - virtual int32_t GetLayoutStatus(); - virtual void RunNodeInitialize(CXFA_Node* pNode); - virtual void RunSubformIndexChange(CXFA_Node* pSubformNode); - virtual CXFA_Node* GetFocusWidgetNode(); - virtual void SetFocusWidgetNode(CXFA_Node* pNode); + void StartFieldDrawLayout(CXFA_Node* pItem, + FX_FLOAT& fCalcWidth, + FX_FLOAT& fCalcHeight); + FX_BOOL FindSplitPos(CXFA_Node* pItem, + int32_t iBlockIndex, + FX_FLOAT& fCalcHeightPos); + FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem); + int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, + XFA_EVENTTYPE eEventType, + FX_BOOL bIsFormReady = FALSE, + FX_BOOL bRecursive = TRUE, + CXFA_WidgetAcc* pExclude = NULL); + void AddCalcValidate(CXFA_Node* pNode); + CXFA_FFDoc* GetHDOC(); + IXFA_DocProvider* GetDocProvider(); + IXFA_AppProvider* GetAppProvider(); + CXFA_FFWidgetHandler* GetWidgetHandler(); + CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); + void OpenDropDownList(CXFA_FFWidget* hWidget); + CFX_WideString GetCurrentDateTime(); + void ResetData(CXFA_WidgetData* pWidgetData = NULL); + int32_t GetLayoutStatus(); + void RunNodeInitialize(CXFA_Node* pNode); + void RunSubformIndexChange(CXFA_Node* pSubformNode); + CXFA_Node* GetFocusWidgetNode(); + void SetFocusWidgetNode(CXFA_Node* pNode); protected: void OnNodeReady(CXFA_Node* pNode); @@ -74,22 +76,22 @@ class CXFA_FFNotify : public IXFA_Notify { void OnChildAdded(CXFA_Node* pSender, void* pParam, void* pParam2); void OnChildRemoved(CXFA_Node* pSender, void* pParam, void* pParam2); void OnLayoutItemAdd(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemRemoving(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemRectChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); void OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView, - IXFA_DocLayout* pLayout, + CXFA_LayoutProcessor* pLayout, CXFA_LayoutItem* pSender, void* pParam, void* pParam2); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index e4841f17b2..584832ed2c 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -4,26 +4,26 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #include "xfa/fde/fde_render.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_ffimageedit.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_fftextedit.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView), m_bLoaded(FALSE) {} CXFA_FFPageView::~CXFA_FFPageView() {} -IXFA_DocView* CXFA_FFPageView::GetDocView() { +CXFA_FFDocView* CXFA_FFPageView::GetDocView() { return m_pDocView; } int32_t CXFA_FFPageView::GetPageViewIndex() { @@ -58,7 +58,7 @@ void CXFA_FFPageView::UnloadPageView() { FX_BOOL CXFA_FFPageView::IsPageViewLoaded() { return m_bLoaded; } -IXFA_Widget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { +CXFA_FFWidget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { if (!m_bLoaded) { return nullptr; } @@ -130,47 +130,46 @@ CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {} void CXFA_FFPageWidgetIterator::Reset() { m_sIterator.Reset(); } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() { m_sIterator.Reset(); for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() { m_sIterator.SetCurrent(NULL); return MoveToPrevious(); } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem; pLayoutItem = m_sIterator.MoveToPrev()) { - if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) { + if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return NULL; } -IXFA_Widget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : NULL; } -FX_BOOL CXFA_FFPageWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) { - CXFA_FFWidget* pWidget = static_cast<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 @@ void CXFA_FFTabOrderPageWidgetIterator::Reset() { CreateTabOrderWidgetArray(); m_iCurWidget = -1; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { if (m_TabOrderWidgetArray.GetSize() > 0) { for (int32_t i = 0; i < m_TabOrderWidgetArray.GetSize(); i++) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, @@ -213,7 +212,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { } return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { if (m_TabOrderWidgetArray.GetSize() > 0) { for (int32_t i = m_TabOrderWidgetArray.GetSize() - 1; i >= 0; i--) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, @@ -225,7 +224,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { } return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { for (int32_t i = m_iCurWidget + 1; i < m_TabOrderWidgetArray.GetSize(); i++) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, m_bIgnorerelevant)) { @@ -236,7 +235,7 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { m_iCurWidget = -1; return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { for (int32_t i = m_iCurWidget - 1; i >= 0; i--) { if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, m_bIgnorerelevant)) { @@ -247,16 +246,15 @@ IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { m_iCurWidget = -1; return NULL; } -IXFA_Widget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { +CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { if (m_iCurWidget >= 0) { return m_TabOrderWidgetArray[m_iCurWidget]; } return NULL; } FX_BOOL CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( - IXFA_Widget* hWidget) { - int32_t iWidgetIndex = - m_TabOrderWidgetArray.Find(static_cast<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_ffpageview.h b/xfa/fxfa/app/xfa_ffpageview.h deleted file mode 100644 index 20818e7107..0000000000 --- a/xfa/fxfa/app/xfa_ffpageview.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ -#define XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ - -#include "xfa/fxfa/parser/xfa_doclayout.h" - -class CXFA_FFWidget; -class CXFA_FFDocView; -class CXFA_FFPageView : public CXFA_ContainerLayoutItem, public IXFA_PageView { - public: - CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); - ~CXFA_FFPageView() override; - - // IFXA_PageView: - IXFA_DocView* GetDocView() override; - int32_t GetPageViewIndex() override; - void GetPageViewRect(CFX_RectF& rtPage) override; - void GetDisplayMatrix(CFX_Matrix& mt, - const CFX_Rect& rtDisp, - int32_t iRotate) override; - int32_t LoadPageView(IFX_Pause* pPause = NULL) override; - void UnloadPageView() override; - IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) override; - IXFA_WidgetIterator* CreateWidgetIterator( - uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form, - uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible | - XFA_WIDGETFILTER_Viewable | - XFA_WIDGETFILTER_AllType) override; - - FX_BOOL IsPageViewLoaded(); - - protected: - CXFA_FFDocView* m_pDocView; - FX_BOOL m_bLoaded; -}; -typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem, - CXFA_TraverseStrategy_LayoutItem> - CXFA_LayoutItemIterator; -class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter); - virtual ~CXFA_FFPageWidgetIterator(); - virtual void Release() { delete this; } - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - IXFA_Widget* GetWidget(CXFA_LayoutItem* pLayoutItem); - CXFA_FFPageView* m_pPageView; - IXFA_Widget* m_hCurWidget; - uint32_t m_dwFilter; - FX_BOOL m_bIgnorerelevant; - CXFA_LayoutItemIterator m_sIterator; -}; -typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray; -class CXFA_TabParam { - public: - CXFA_TabParam() : m_pWidget(NULL) {} - ~CXFA_TabParam() {} - - CXFA_FFWidget* m_pWidget; - CXFA_WidgetArray m_Children; -}; -class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { - public: - CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, - uint32_t dwFilter); - virtual ~CXFA_FFTabOrderPageWidgetIterator(); - - virtual void Release(); - - virtual void Reset(); - virtual IXFA_Widget* MoveToFirst(); - virtual IXFA_Widget* MoveToLast(); - virtual IXFA_Widget* MoveToNext(); - virtual IXFA_Widget* MoveToPrevious(); - virtual IXFA_Widget* GetCurrentWidget(); - virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); - - protected: - CXFA_WidgetArray m_TabOrderWidgetArray; - CXFA_FFPageView* m_pPageView; - uint32_t m_dwFilter; - int32_t m_iCurWidget; - FX_BOOL m_bIgnorerelevant; - CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); - CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName, - CXFA_FFWidget* pRefWidget); - void CreateTabOrderWidgetArray(); - void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray); - CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); - void OrderContainer(CXFA_LayoutItemIterator* sIterator, - CXFA_LayoutItem* pContainerItem, - CXFA_TabParam* pContainer, - FX_BOOL& bCurrentItem, - FX_BOOL& bContentArea, - FX_BOOL bMarsterPage = FALSE); -}; - -#endif // XFA_FXFA_APP_XFA_FFPAGEVIEW_H_ diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp index d8ece72bb0..eddc41f471 100644 --- a/xfa/fxfa/app/xfa_ffpath.cpp +++ b/xfa/fxfa/app/xfa_ffpath.cpp @@ -6,13 +6,13 @@ #include "xfa/fxfa/app/xfa_ffpath.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFLine::CXFA_FFLine(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 89d0bfdb82..85843755b6 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -9,14 +9,14 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_pushbutton.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFPushButton::CXFA_FFPushButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index ca933f8cdc..65a7be2f5c 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffsignature.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.cpp b/xfa/fxfa/app/xfa_ffsubform.cpp index aebbb08684..fd718f8158 100644 --- a/xfa/fxfa/app/xfa_ffsubform.cpp +++ b/xfa/fxfa/app/xfa_ffsubform.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffsubform.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFSubForm::CXFA_FFSubForm(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.h b/xfa/fxfa/app/xfa_ffsubform.h index e4369113de..bae6df6ee4 100644 --- a/xfa/fxfa/app/xfa_ffsubform.h +++ b/xfa/fxfa/app/xfa_ffsubform.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_ #define XFA_FXFA_APP_XFA_FFSUBFORM_H_ -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" class CXFA_FFSubForm : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index 333f9f7f14..d93c23fcec 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -7,13 +7,13 @@ #include "xfa/fxfa/app/xfa_fftext.h" #include "xfa/fwl/core/fwl_widgetdef.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index d6d292b96f..e11585fab0 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -14,15 +14,15 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_datetimepicker.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxfa/parser/xfa_localevalue.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 027d07a9f5..4bf5de56c7 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -10,16 +10,16 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/include/fxcodec/fx_codec.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" #include "xfa/fxgraphics/cfx_pattern.h" #include "xfa/fxgraphics/cfx_shading.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" CXFA_FFWidget::CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) @@ -29,11 +29,11 @@ CXFA_FFWidget::CXFA_FFWidget(CXFA_FFPageView* pPageView, m_rtWidget.Set(0, 0, 0, 0); } CXFA_FFWidget::~CXFA_FFWidget() {} -IXFA_PageView* CXFA_FFWidget::GetPageView() { +CXFA_FFPageView* CXFA_FFWidget::GetPageView() { return m_pPageView; } -void CXFA_FFWidget::SetPageView(IXFA_PageView* pPageView) { - m_pPageView = static_cast<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 4cc6c0bbbb..84ab926a39 100644 --- a/xfa/fxfa/app/xfa_ffwidget.h +++ b/xfa/fxfa/app/xfa_ffwidget.h @@ -36,14 +36,12 @@ class CXFA_CalcData { CFX_PtrArray m_Globals; int32_t m_iRefCount; }; -class CXFA_FFWidget : public IXFA_Widget, - public CFX_PrivateData, - public CXFA_ContentLayoutItem { +class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem { public: CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); virtual ~CXFA_FFWidget(); - IXFA_PageView* GetPageView(); - void SetPageView(IXFA_PageView* pPageView); + CXFA_FFPageView* GetPageView(); + void SetPageView(CXFA_FFPageView* pPageView); void GetWidgetRect(CFX_RectF& rtWidget); CFX_RectF ReCacheWidgetRect(); uint32_t GetStatus(); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index c50786a3dc..fc8b38f458 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -10,19 +10,21 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fde/xml/fde_xml_imp.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_ffdocview.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffpageview.h" #include "xfa/fxfa/app/xfa_ffwidget.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" static void XFA_FFDeleteCalcData(void* pData) { if (pData) { @@ -659,7 +661,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, return XFA_EVENTERROR_Success; } CXFA_FFDoc* pDoc = GetDoc(); - IXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext(); + CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext(); pContext->SetEventParam(*pEventParam); pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt()); CXFA_NodeArray refNodes; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/xfa_ffwidgetacc.h index 722256a6f7..6d4303d72a 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.h +++ b/xfa/fxfa/app/xfa_ffwidgetacc.h @@ -16,7 +16,7 @@ enum XFA_TEXTPROVIDERTYPE { XFA_TEXTPROVIDERTYPE_Rollover, XFA_TEXTPROVIDERTYPE_Down, }; -class CXFA_TextProvider : public IXFA_TextProvider { +class CXFA_TextProvider { public: CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc, XFA_TEXTPROVIDERTYPE eType, @@ -24,16 +24,17 @@ class CXFA_TextProvider : public IXFA_TextProvider { : m_pWidgetAcc(pWidgetAcc), m_eType(eType), m_pTextNode(pTextNode) { FXSYS_assert(m_pWidgetAcc); } - virtual ~CXFA_TextProvider() {} - virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText); - virtual CXFA_Para GetParaNode(); - virtual CXFA_Font GetFontNode(); - virtual FX_BOOL IsCheckButtonAndAutoWidth(); - virtual CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } - virtual FX_BOOL GetEmbbedObj(FX_BOOL bURI, - FX_BOOL bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue); + ~CXFA_TextProvider() {} + + CXFA_Node* GetTextNode(FX_BOOL& bRichText); + CXFA_Para GetParaNode(); + CXFA_Font GetFontNode(); + FX_BOOL IsCheckButtonAndAutoWidth(); + CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } + FX_BOOL GetEmbbedObj(FX_BOOL bURI, + FX_BOOL bRaw, + const CFX_WideString& wsAttr, + CFX_WideString& wsValue); protected: CXFA_WidgetAcc* m_pWidgetAcc; diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 80d2e5acc5..711d29abc2 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -4,217 +4,207 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffwidgethandler.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" #include <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 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); return iRet; } -IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent, - XFA_WIDGETTYPE eType, - IXFA_Widget* hBefore) { +CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, + XFA_WIDGETTYPE eType, + CXFA_FFWidget* hBefore) { CXFA_Node* pParentFormItem = - hParent ? static_cast<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 @@ IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent, m_pDocView->RunLayout(); CXFA_LayoutItem* pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); - return (IXFA_Widget*)pLayout; + return (CXFA_FFWidget*)pLayout; } CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( XFA_WIDGETTYPE eType, @@ -561,74 +549,77 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue, CreateCopyNode(eValue, pValue); return pValue; } -IXFA_ObjFactory* CXFA_FFWidgetHandler::GetObjFactory() const { +CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { return GetXFADoc()->GetParser()->GetFactory(); } CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); } + CXFA_FFMenuHandler::CXFA_FFMenuHandler() {} + CXFA_FFMenuHandler::~CXFA_FFMenuHandler() {} -FX_BOOL CXFA_FFMenuHandler::CanCopy(IXFA_Widget* hWidget) { - return static_cast<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 931eb28437..0000000000 --- a/xfa/fxfa/app/xfa_ffwidgethandler.h +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ -#define XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ - -#include <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 256af6cf21..fb6fd39249 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_fontmgr.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" #include <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 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( return NULL; #endif } -// static -IXFA_FontMgr* IXFA_FontMgr::CreateDefault() { - return new CXFA_DefFontMgr; -} -// virtual -IXFA_FontMgr::~IXFA_FontMgr() {} + CXFA_DefFontMgr::~CXFA_DefFontMgr() { int32_t iCounts = m_CacheFonts.GetSize(); for (int32_t i = 0; i < iCounts; i++) { @@ -1762,13 +1757,12 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { m_CacheFonts.RemoveAll(); } -IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { CFX_WideString wsFontName = wsFontFamily; - IFX_FontMgr* pFDEFontMgr = - static_cast<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 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, return pFont; } -IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_DefFontMgr::GetDefaultFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr(); + IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) @@ -2018,7 +2012,7 @@ CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(NULL) {} CXFA_FontMgr::~CXFA_FontMgr() { DelAllMgrMap(); } -IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, +IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { @@ -2061,12 +2055,12 @@ IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, } return pFont; } -void CXFA_FontMgr::LoadDocFonts(IXFA_Doc* hDoc) { +void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) { if (!m_PDFFontMgrArray.GetValueAt(hDoc)) { - m_PDFFontMgrArray.SetAt(hDoc, new CXFA_PDFFontMgr((CXFA_FFDoc*)hDoc)); + m_PDFFontMgrArray.SetAt(hDoc, new CXFA_PDFFontMgr(hDoc)); } } -void CXFA_FontMgr::ReleaseDocFonts(IXFA_Doc* hDoc) { +void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { CXFA_PDFFontMgr* pMgr = NULL; if (m_PDFFontMgrArray.Lookup(hDoc, (void*&)pMgr)) { delete pMgr; @@ -2076,7 +2070,7 @@ void CXFA_FontMgr::ReleaseDocFonts(IXFA_Doc* hDoc) { void CXFA_FontMgr::DelAllMgrMap() { FX_POSITION ps = m_PDFFontMgrArray.GetStartPosition(); while (ps) { - IXFA_Doc* hDoc = NULL; + CXFA_FFDoc* hDoc = NULL; CXFA_PDFFontMgr* pMgr = NULL; m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); delete pMgr; @@ -2084,6 +2078,6 @@ void CXFA_FontMgr::DelAllMgrMap() { m_PDFFontMgrArray.RemoveAll(); m_FontMap.clear(); } -void CXFA_FontMgr::SetDefFontMgr(IXFA_FontMgr* pFontMgr) { +void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { m_pDefFontMgr = pFontMgr; } diff --git a/xfa/fxfa/app/xfa_fontmgr.h b/xfa/fxfa/app/xfa_fontmgr.h deleted file mode 100644 index 20d3e5656c..0000000000 --- a/xfa/fxfa/app/xfa_fontmgr.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_FONTMGR_H_ -#define XFA_FXFA_APP_XFA_FONTMGR_H_ - -#include <map> - -#include "core/fxcrt/include/fx_ext.h" -#include "core/fxcrt/include/fx_system.h" -#include "xfa/fgas/font/fgas_font.h" -#include "xfa/include/fxfa/fxfa.h" - -class CPDF_Font; - -struct XFA_FONTINFO { - uint32_t dwFontNameHash; - const FX_WCHAR* pPsName; - const FX_WCHAR* pReplaceFont; - uint16_t dwStyles; - uint16_t wCodePage; -}; - -class CXFA_DefFontMgr : public IXFA_FontMgr { - public: - CXFA_DefFontMgr() {} - ~CXFA_DefFontMgr() override; - - // IXFA_FontMgr: - IFX_Font* GetFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; - IFX_Font* GetDefaultFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; - - protected: - CFX_PtrArray m_CacheFonts; -}; - -class CXFA_PDFFontMgr : public IFX_FontProvider { - public: - CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); - ~CXFA_PDFFontMgr(); - IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch = TRUE); - FX_BOOL GetCharWidth(IFX_Font* pFont, - FX_WCHAR wUnicode, - int32_t& iWidth, - FX_BOOL bCharCode); - CFX_MapPtrToPtr m_FDE2PDFFont; - - protected: - IFX_Font* FindFont(CFX_ByteString strFamilyName, - FX_BOOL bBold, - FX_BOOL bItalic, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch = TRUE); - CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, - FX_BOOL bBold, - FX_BOOL bItalic); - FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, - FX_BOOL bBold, - FX_BOOL bItalic, - const CFX_ByteString& bsDRFontName, - FX_BOOL bStrictMatch = TRUE); - - CXFA_FFDoc* m_pDoc; - std::map<CFX_ByteString, IFX_Font*> m_FontMap; -}; - -class CXFA_FontMgr { - public: - CXFA_FontMgr(); - ~CXFA_FontMgr(); - IFX_Font* GetFont(IXFA_Doc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); - void LoadDocFonts(IXFA_Doc* hDoc); - void ReleaseDocFonts(IXFA_Doc* hDoc); - - void SetDefFontMgr(IXFA_FontMgr* pFontMgr); - - protected: - void DelAllMgrMap(); - - CFX_MapPtrToPtr m_PDFFontMgrArray; - IXFA_FontMgr* m_pDefFontMgr; - std::map<CFX_ByteString, IFX_Font*> m_FontMap; -}; - -#endif // XFA_FXFA_APP_XFA_FONTMGR_H_ diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index 78d4918a9c..c1732776b2 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/app/xfa_fwladapter.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/app/xfa_fffield.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect) { diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 9c55b27652..4c3d4de801 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -21,9 +21,9 @@ #include "xfa/fwl/basewidget/ifwl_scrollbar.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" +#include "xfa/include/fxfa/xfa_ffapp.h" namespace { diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 33ceb477cf..72a516b755 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -21,7 +21,7 @@ #include "xfa/fwl/theme/cfwl_pushbuttontp.h" #include "xfa/fwl/theme/cfwl_scrollbartp.h" #include "xfa/fwl/theme/cfwl_widgettp.h" -#include "xfa/fxfa/app/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffapp.h" class CXFA_FWLTheme : public IFWL_ThemeProvider { public: diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp index ec9a3f88f4..a454ec0e5d 100644 --- a/xfa/fxfa/app/xfa_rendercontext.cpp +++ b/xfa/fxfa/app/xfa_rendercontext.cpp @@ -4,16 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_rendercontext.h" +#include "xfa/include/fxfa/xfa_rendercontext.h" #include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/include/cfx_graphics.h" +#include "xfa/include/fxfa/xfa_ffpageview.h" #define XFA_RENDERCONTEXT_MaxCount 30 -IXFA_RenderContext* XFA_RenderContext_Create() { - return new CXFA_RenderContext; -} CXFA_RenderContext::CXFA_RenderContext() { m_pWidgetIterator = NULL; m_pWidget = NULL; @@ -26,7 +24,7 @@ CXFA_RenderContext::CXFA_RenderContext() { CXFA_RenderContext::~CXFA_RenderContext() { StopRender(); } -int32_t CXFA_RenderContext::StartRender(IXFA_PageView* pPageView, +int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView, CFX_Graphics* pGS, const CFX_Matrix& matrix, const CXFA_RenderOptions& options) { diff --git a/xfa/fxfa/app/xfa_rendercontext.h b/xfa/fxfa/app/xfa_rendercontext.h deleted file mode 100644 index c19adeddfa..0000000000 --- a/xfa/fxfa/app/xfa_rendercontext.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ -#define XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ - -#include "xfa/include/fxfa/fxfa.h" - -class CXFA_RenderContext : public IXFA_RenderContext { - public: - CXFA_RenderContext(); - virtual ~CXFA_RenderContext(); - virtual void Release() { delete this; } - virtual int32_t StartRender(IXFA_PageView* pPageView, - CFX_Graphics* pGS, - const CFX_Matrix& matrix, - const CXFA_RenderOptions& options); - virtual int32_t DoRender(IFX_Pause* pPause = NULL); - virtual void StopRender(); - - protected: - IXFA_WidgetIterator* m_pWidgetIterator; - IXFA_Widget* m_pWidget; - IXFA_PageView* m_pPageView; - CFX_Graphics* m_pGS; - CFX_Matrix m_matrix; - CXFA_RenderOptions m_options; - uint32_t m_dwStatus; - CFX_RectF m_rtClipRect; -}; - -#endif // XFA_FXFA_APP_XFA_RENDERCONTEXT_H_ diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index ced7acbb32..f60ed26c64 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -13,9 +13,10 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fgas/crt/fgas_codepage.h" -#include "xfa/fxfa/app/xfa_ffapp.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" -#include "xfa/fxfa/app/xfa_fontmgr.h" +#include "xfa/fxfa/app/xfa_ffwidgetacc.h" +#include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" +#include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_CSSTagProvider::~CXFA_CSSTagProvider() { FX_POSITION pos = m_Attributes.GetStartPosition(); @@ -88,7 +89,7 @@ void CXFA_TextParser::Reset() { m_pAllocator = NULL; } } -void CXFA_TextParser::InitCSSData(IXFA_TextProvider* pTextProvider) { +void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { if (pTextProvider == NULL) { return; } @@ -125,7 +126,7 @@ IFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() { CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); } IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( - IXFA_TextProvider* pTextProvider) { + CXFA_TextProvider* pTextProvider) { CXFA_Font font = pTextProvider->GetFontNode(); CXFA_Para para = pTextProvider->GetParaNode(); IFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(NULL); @@ -232,7 +233,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( return pStyle; } void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, - IXFA_TextProvider* pTextProvider) { + CXFA_TextProvider* pTextProvider) { if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { return; } @@ -316,7 +317,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, tagProvider.m_bContent = TRUE; } } -int32_t CXFA_TextParser::GetVAlgin(IXFA_TextProvider* pTextProvider) const { +int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { int32_t iAlign = XFA_ATTRIBUTEENUM_Top; CXFA_Para para = pTextProvider->GetParaNode(); if (para) { @@ -347,7 +348,7 @@ FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { } return FALSE; } -IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, +IFX_Font* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { CFX_WideStringC wsFamily = FX_WSTRC(L"Courier"); uint32_t dwStyle = 0; @@ -379,7 +380,7 @@ IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, CXFA_FontMgr* pFontMgr = pDoc->GetApp()->GetXFAFontMgr(); return pFontMgr->GetFont(pDoc, wsFamily, dwStyle); } -FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) return pStyle->GetFontStyles()->GetFontSize(); @@ -390,7 +391,7 @@ FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, } return 10; } -int32_t CXFA_TextParser::GetHorScale(IXFA_TextProvider* pTextProvider, +int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, CFDE_XMLNode* pXMLNode) const { if (pStyle) { @@ -415,7 +416,7 @@ int32_t CXFA_TextParser::GetHorScale(IXFA_TextProvider* pTextProvider, } return 100; } -int32_t CXFA_TextParser::GetVerScale(IXFA_TextProvider* pTextProvider, +int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) { CFX_WideString wsValue; @@ -428,7 +429,7 @@ int32_t CXFA_TextParser::GetVerScale(IXFA_TextProvider* pTextProvider, } return 100; } -void CXFA_TextParser::GetUnderline(IXFA_TextProvider* pTextProvider, +void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iUnderline, int32_t& iPeriod) const { @@ -457,7 +458,7 @@ void CXFA_TextParser::GetUnderline(IXFA_TextProvider* pTextProvider, } } } -void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, +void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iLinethrough) const { if (pStyle) { @@ -470,7 +471,7 @@ void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, } } } -FX_ARGB CXFA_TextParser::GetColor(IXFA_TextProvider* pTextProvider, +FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) return pStyle->GetFontStyles()->GetColor(); @@ -480,7 +481,7 @@ FX_ARGB CXFA_TextParser::GetColor(IXFA_TextProvider* pTextProvider, return 0xFF000000; } -FX_FLOAT CXFA_TextParser::GetBaseline(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const { if (pStyle) { IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles(); @@ -492,7 +493,7 @@ FX_FLOAT CXFA_TextParser::GetBaseline(IXFA_TextProvider* pTextProvider, } return 0; } -FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, +FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, FX_BOOL bFirst, FX_FLOAT fVerScale) const { @@ -515,7 +516,7 @@ FX_FLOAT CXFA_TextParser::GetLineHeight(IXFA_TextProvider* pTextProvider, fLineHeight *= fVerScale; return fLineHeight; } -FX_BOOL CXFA_TextParser::GetEmbbedObj(IXFA_TextProvider* pTextProvider, +FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, CFX_WideString& wsValue) { wsValue.Empty(); @@ -664,7 +665,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( } return TRUE; } -CXFA_TextLayout::CXFA_TextLayout(IXFA_TextProvider* pTextProvider) +CXFA_TextLayout::CXFA_TextLayout(CXFA_TextProvider* pTextProvider) : m_bHasBlock(FALSE), m_pTextProvider(pTextProvider), m_pTextDataNode(nullptr), diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 1d2db21652..9b92e1796a 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -11,29 +11,16 @@ #include "xfa/fde/fde_brush.h" #include "xfa/fde/fde_renderdevice.h" #include "xfa/fgas/layout/fgas_rtfbreak.h" -#include "xfa/fxfa/app/xfa_ffdoc.h" #include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/include/fxfa/xfa_ffdoc.h" #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 class CXFA_Para; class CXFA_Font; +class CXFA_TextProvider; class CXFA_TextTabstopsContext; -class IXFA_TextProvider { - public: - virtual ~IXFA_TextProvider() {} - virtual CXFA_Node* GetTextNode(FX_BOOL& bRichText) = 0; - virtual CXFA_Para GetParaNode() = 0; - virtual CXFA_Font GetFontNode() = 0; - virtual FX_BOOL IsCheckButtonAndAutoWidth() = 0; - virtual CXFA_FFDoc* GetDocNode() = 0; - virtual FX_BOOL GetEmbbedObj(FX_BOOL bURI, - FX_BOOL bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue) = 0; -}; - class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { public: CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} @@ -88,49 +75,49 @@ class CXFA_TextParser { CXFA_TextParser() : m_pAllocator(NULL), m_pSelector(NULL), m_pUASheet(NULL) {} virtual ~CXFA_TextParser(); void Reset(); - void DoParse(CFDE_XMLNode* pXMLContainer, IXFA_TextProvider* pTextProvider); - IFDE_CSSComputedStyle* CreateRootStyle(IXFA_TextProvider* pTextProvider); + void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); + IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider); IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle); FX_BOOL IsParsed() const { return m_pAllocator != NULL; } - int32_t GetVAlgin(IXFA_TextProvider* pTextProvider) const; + int32_t GetVAlgin(CXFA_TextProvider* pTextProvider) const; FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const; int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_TextTabstopsContext* pTabstopContext); - IFX_Font* GetFont(IXFA_TextProvider* pTextProvider, + IFX_Font* GetFont(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetFontSize(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - int32_t GetHorScale(IXFA_TextProvider* pTextProvider, + int32_t GetHorScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, CFDE_XMLNode* pXMLNode) const; - int32_t GetVerScale(IXFA_TextProvider* pTextProvider, + int32_t GetVerScale(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - void GetUnderline(IXFA_TextProvider* pTextProvider, + void GetUnderline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iUnderline, int32_t& iPeriod) const; - void GetLinethrough(IXFA_TextProvider* pTextProvider, + void GetLinethrough(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, int32_t& iLinethrough) const; - FX_ARGB GetColor(IXFA_TextProvider* pTextProvider, + FX_ARGB GetColor(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetBaseline(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; - FX_FLOAT GetLineHeight(IXFA_TextProvider* pTextProvider, + FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle, FX_BOOL bFirst, FX_FLOAT fVerScale) const; - FX_BOOL GetEmbbedObj(IXFA_TextProvider* pTextProvider, + FX_BOOL GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFDE_XMLNode* pXMLNode, CFX_WideString& wsValue); CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode); private: - void InitCSSData(IXFA_TextProvider* pTextProvider); + void InitCSSData(CXFA_TextProvider* pTextProvider); void ParseRichText(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle); void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider); @@ -324,7 +311,7 @@ class CXFA_TextTabstopsContext { class CXFA_TextLayout { public: - CXFA_TextLayout(IXFA_TextProvider* pTextProvider); + CXFA_TextLayout(CXFA_TextProvider* pTextProvider); virtual ~CXFA_TextLayout(); int32_t GetText(CFX_WideString& wsText); FX_FLOAT GetLayoutHeight(); @@ -408,7 +395,7 @@ class CXFA_TextLayout { FX_BOOL Layout(int32_t iBlock); int32_t CountBlocks() const; - IXFA_TextProvider* m_pTextProvider; + CXFA_TextProvider* m_pTextProvider; CXFA_Node* m_pTextDataNode; FX_BOOL m_bRichText; IFX_MEMAllocator* m_pAllocator; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 3acae67bc3..971c09d6f3 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -10,10 +10,13 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fgas/localization/fgas_locale.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_document.h" #include "xfa/fxfa/parser/xfa_localevalue.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxjse/cfxjse_arguments.h" #define FINANCIAL_PRECISION 0.00000001 @@ -1596,7 +1599,7 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, int32_t second = uniTime.GetSecond(); int32_t milSecond = uniTime.GetMillisecond(); int32_t mins = hour * 60 + min; - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); + CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get(); if (pProvider) { FX_TIMEZONE tz; pProvider->GetTimeZone(tz); @@ -6835,7 +6838,7 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( if (!pDoc) { return bFlags; } - IXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); XFA_RESOLVENODE_RS resoveNodeRS; uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; @@ -6866,7 +6869,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, if (!pDoc) { return iRet; } - IXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); CXFA_Object* pNode = NULL; uint32_t dFlags = 0UL; if (bdotAccessor) { diff --git a/xfa/fxfa/parser/xfa_docdata.h b/xfa/fxfa/parser/xfa_docdata.h index b57b8da552..690ff3334f 100644 --- a/xfa/fxfa/parser/xfa_docdata.h +++ b/xfa/fxfa/parser/xfa_docdata.h @@ -13,24 +13,4 @@ enum XFA_DATAFORMAT { XFA_DATAFORMAT_XDP, }; -class IXFA_PacketExport { - public: - static IXFA_PacketExport* Create(CXFA_Document* pDocument, - XFA_DATAFORMAT eFormat = XFA_DATAFORMAT_XDP); - virtual ~IXFA_PacketExport() {} - virtual void Release() = 0; - virtual FX_BOOL Export(IFX_FileWrite* pWrite) = 0; - virtual FX_BOOL Export(IFX_FileWrite* pWrite, - CXFA_Node* pNode, - uint32_t dwFlag = 0, - const FX_CHAR* pChecksum = NULL) = 0; -}; -class IXFA_PacketImport { - public: - static IXFA_PacketImport* Create(CXFA_Document* pDstDoc); - virtual ~IXFA_PacketImport() {} - virtual void Release() = 0; - virtual FX_BOOL ImportData(IFX_FileRead* pDataDocument) = 0; -}; - #endif // XFA_FXFA_PARSER_XFA_DOCDATA_H_ diff --git a/xfa/fxfa/parser/xfa_doclayout.h b/xfa/fxfa/parser/xfa_doclayout.h index 8558cd0992..0bae0184ec 100644 --- a/xfa/fxfa/parser/xfa_doclayout.h +++ b/xfa/fxfa/parser/xfa_doclayout.h @@ -11,16 +11,7 @@ class CXFA_ContainerLayoutItem; class CXFA_ContentLayoutItem; -class IXFA_DocLayout; - -class IXFA_LayoutPage { - public: - virtual ~IXFA_LayoutPage() {} - virtual IXFA_DocLayout* GetLayout() const = 0; - virtual int32_t GetPageIndex() const = 0; - virtual void GetPageSize(CFX_SizeF& size) = 0; - virtual CXFA_Node* GetMasterPage() const = 0; -}; +class CXFA_LayoutProcessor; class CXFA_LayoutItem { public: @@ -31,7 +22,7 @@ class CXFA_LayoutItem { inline CXFA_ContainerLayoutItem* AsContainerLayoutItem(); inline CXFA_ContentLayoutItem* AsContentLayoutItem(); - IXFA_LayoutPage* GetPage() const; + CXFA_ContainerLayoutItem* GetPage() const; CXFA_Node* GetFormNode() const; void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const; int32_t GetIndex() const; @@ -60,16 +51,14 @@ class CXFA_LayoutItem { FX_BOOL m_bIsContentLayoutItem; }; -class CXFA_ContainerLayoutItem : public CXFA_LayoutItem, - public IXFA_LayoutPage { +class CXFA_ContainerLayoutItem : public CXFA_LayoutItem { public: CXFA_ContainerLayoutItem(CXFA_Node* pNode); - // IXFA_LayoutPage: - IXFA_DocLayout* GetLayout() const override; - int32_t GetPageIndex() const override; - void GetPageSize(CFX_SizeF& size) override; - CXFA_Node* GetMasterPage() const override; + CXFA_LayoutProcessor* GetLayout() const; + int32_t GetPageIndex() const; + void GetPageSize(CFX_SizeF& size); + CXFA_Node* GetMasterPage() const; CXFA_Node* m_pOldSubform; }; @@ -121,16 +110,4 @@ class CXFA_TraverseStrategy_LayoutItem { } }; -class IXFA_DocLayout { - public: - virtual ~IXFA_DocLayout() {} - virtual CXFA_Document* GetDocument() const = 0; - virtual int32_t StartLayout(FX_BOOL bForceRestart = FALSE) = 0; - virtual int32_t DoLayout(IFX_Pause* pPause = NULL) = 0; - virtual FX_BOOL IncrementLayout() = 0; - virtual int32_t CountPages() const = 0; - virtual IXFA_LayoutPage* GetPage(int32_t index) const = 0; - virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem) = 0; -}; - #endif // XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index 5938f2da56..3c96e9a711 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -15,12 +15,11 @@ class CXFA_Document; class CXFA_LayoutItem; class CXFA_LayoutProcessor; class CXFA_Node; -class IXFA_DocLayout; -class IXFA_DocParser; -class IXFA_LayoutPage; -class IXFA_Notify; -class IXFA_ObjFactory; -class IXFA_ScriptContext; +class CXFA_LayoutProcessor; +class CXFA_DocumentParser; +class CXFA_ContainerLayoutItem; +class CXFA_FFNotify; +class CXFA_ScriptContext; enum XFA_VERSION { XFA_VERSION_UNKNOWN = 0, @@ -68,65 +67,6 @@ enum XFA_LAYOUTRESULT { #define XFA_LAYOUTNOTIFY_StrictHeight 0x0001 #define XFA_LAYOUTNOTIFY_NoParentBreak 0x0002 -class IXFA_Notify { - public: - virtual ~IXFA_Notify() {} - virtual void OnPageEvent(IXFA_LayoutPage* pSender, - XFA_PAGEEVENT eEvent, - void* pParam = NULL) = 0; - - virtual void OnNodeEvent(CXFA_Node* pSender, - XFA_NODEEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL, - void* pParam3 = NULL, - void* pParam4 = NULL) = 0; - virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, - uint32_t dwEvent, - void* pParam = NULL, - void* pAdditional = NULL, - void* pAdditional2 = NULL) = 0; - - virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode) = 0; - virtual void OnLayoutEvent(IXFA_DocLayout* pLayout, - CXFA_LayoutItem* pSender, - XFA_LAYOUTEVENT eEvent, - void* pParam = NULL, - void* pParam2 = NULL) = 0; - virtual void StartFieldDrawLayout(CXFA_Node* pItem, - FX_FLOAT& fCalcWidth, - FX_FLOAT& fCalcHeight) = 0; - virtual FX_BOOL FindSplitPos(CXFA_Node* pItem, - int32_t iBlockIndex, - FX_FLOAT& fCalcHeightPos) = 0; - virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) = 0; - virtual int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode, - XFA_EVENTTYPE eEventType, - FX_BOOL bIsFormReady = FALSE, - FX_BOOL bRecursive = TRUE, - CXFA_WidgetAcc* pExclude = NULL) = 0; - virtual void AddCalcValidate(CXFA_Node* pNode) = 0; - virtual IXFA_Doc* GetHDOC() = 0; - virtual IXFA_DocProvider* GetDocProvider() = 0; - virtual IXFA_AppProvider* GetAppProvider() = 0; - virtual IXFA_WidgetHandler* GetWidgetHandler() = 0; - virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem) = 0; - virtual void OpenDropDownList(IXFA_Widget* hWidget) = 0; - virtual CFX_WideString GetCurrentDateTime() = 0; - virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL) = 0; - virtual int32_t GetLayoutStatus() = 0; - virtual void RunNodeInitialize(CXFA_Node* pNode) = 0; - virtual void RunSubformIndexChange(CXFA_Node* pSubformNode) = 0; - virtual CXFA_Node* GetFocusWidgetNode() = 0; - virtual void SetFocusWidgetNode(CXFA_Node* pNode) = 0; -}; -class IXFA_ObjFactory { - public: - virtual ~IXFA_ObjFactory() {} - virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement) = 0; - virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, - XFA_ELEMENT eElement) = 0; -}; #define XFA_DOCFLAG_StrictScoping 0x0001 #define XFA_DOCFLAG_HasInteractive 0x0002 #define XFA_DOCFLAG_Interactive 0x0004 @@ -137,13 +77,13 @@ class CScript_HostPseudoModel; class CScript_LogPseudoModel; class CScript_LayoutPseudoModel; class CScript_SignaturePseudoModel; -class CXFA_Document : public IXFA_ObjFactory { +class CXFA_Document { public: - CXFA_Document(IXFA_DocParser* pParser); + CXFA_Document(CXFA_DocumentParser* pParser); ~CXFA_Document(); CXFA_Node* GetRoot() const { return m_pRootNode; } - IXFA_DocParser* GetParser() const { return m_pParser; } - IXFA_Notify* GetNotify() const; + CXFA_DocumentParser* GetParser() const { return m_pParser; } + CXFA_FFNotify* GetNotify() const; void SetRoot(CXFA_Node* pNewRoot); CXFA_Object* GetXFAObject(const CFX_WideStringC& wsNodeName); CXFA_Object* GetXFAObject(uint32_t wsNodeNameHash); @@ -156,9 +96,8 @@ class CXFA_Document : public IXFA_ObjFactory { XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); CXFA_LocaleMgr* GetLocalMgr(); - virtual CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); - virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, - XFA_ELEMENT eElement); + CXFA_Node* CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement); + CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement); void DoProtoMerge(); CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); void DoDataMerge(); @@ -172,17 +111,17 @@ class CXFA_Document : public IXFA_ObjFactory { void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot); CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); - IXFA_DocLayout* GetDocLayout(); - IXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); - IXFA_ScriptContext* GetScriptContext(); + CXFA_LayoutProcessor* GetDocLayout(); + CXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); + CXFA_ScriptContext* GetScriptContext(); void ClearLayoutData(); CFX_MapPtrTemplate<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 476dde4104..e525532f7c 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -18,7 +18,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" static FX_BOOL XFA_GetOccurInfo(CXFA_Node* pOccurNode, diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 6f08489c17..d56e57c99d 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -5,6 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -14,16 +15,18 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_script_datawindow.h" #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_logpseudomodel.h" #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" #include "xfa/fxfa/parser/xfa_utils.h" -CXFA_Document::CXFA_Document(IXFA_DocParser* pParser) +CXFA_Document::CXFA_Document(CXFA_DocumentParser* pParser) : m_pParser(pParser), m_pScriptContext(nullptr), m_pLayoutProcessor(nullptr), @@ -88,7 +91,7 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { m_pRootNode = pNewRoot; RemovePurgeNode(pNewRoot); } -IXFA_Notify* CXFA_Document::GetNotify() const { +CXFA_FFNotify* CXFA_Document::GetNotify() const { return m_pParser->GetNotify(); } CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { @@ -245,17 +248,15 @@ CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { } return m_pLocalMgr; } -IXFA_ScriptContext* CXFA_Document::InitScriptContext(FXJSE_HRUNTIME hRuntime) { - if (!m_pScriptContext) { - m_pScriptContext = XFA_ScriptContext_Create(this); - } +CXFA_ScriptContext* CXFA_Document::InitScriptContext(FXJSE_HRUNTIME hRuntime) { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); m_pScriptContext->Initialize(hRuntime); return m_pScriptContext; } -IXFA_ScriptContext* CXFA_Document::GetScriptContext() { - if (!m_pScriptContext) { - m_pScriptContext = XFA_ScriptContext_Create(this); - } +CXFA_ScriptContext* CXFA_Document::GetScriptContext() { + if (!m_pScriptContext) + m_pScriptContext = new CXFA_ScriptContext(this); return m_pScriptContext; } XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp index dbaa6e4df7..79037d7ec7 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp @@ -28,7 +28,7 @@ CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() { } return m_pLayoutProcessor; } -IXFA_DocLayout* CXFA_Document::GetDocLayout() { +CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() { return GetLayoutProcessor(); } CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) @@ -133,7 +133,7 @@ FX_BOOL CXFA_LayoutProcessor::IncrementLayout() { int32_t CXFA_LayoutProcessor::CountPages() const { return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0; } -IXFA_LayoutPage* CXFA_LayoutProcessor::GetPage(int32_t index) const { +CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL; } CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { @@ -171,7 +171,7 @@ CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem) CXFA_LayoutItem::~CXFA_LayoutItem() {} CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {} -IXFA_DocLayout* CXFA_ContainerLayoutItem::GetLayout() const { +CXFA_LayoutProcessor* CXFA_ContainerLayoutItem::GetLayout() const { return m_pFormNode->GetDocument()->GetLayoutProcessor(); } int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.h b/xfa/fxfa/parser/xfa_document_layout_imp.h index 7f6c14e73f..4da405fc6c 100644 --- a/xfa/fxfa/parser/xfa_document_layout_imp.h +++ b/xfa/fxfa/parser/xfa_document_layout_imp.h @@ -13,17 +13,18 @@ class CXFA_ItemLayoutProcessor; class CXFA_LayoutPageMgr; class CXFA_ContainerLayoutItem; -class CXFA_LayoutProcessor : public IXFA_DocLayout { +class CXFA_LayoutProcessor { public: CXFA_LayoutProcessor(CXFA_Document* pDocument); ~CXFA_LayoutProcessor(); - virtual CXFA_Document* GetDocument() const; - virtual int32_t StartLayout(FX_BOOL bForceRestart = FALSE); - virtual int32_t DoLayout(IFX_Pause* pPause = NULL); - virtual FX_BOOL IncrementLayout(); - virtual int32_t CountPages() const; - virtual IXFA_LayoutPage* GetPage(int32_t index) const; - virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); + + CXFA_Document* GetDocument() const; + int32_t StartLayout(FX_BOOL bForceRestart = FALSE); + int32_t DoLayout(IFX_Pause* pPause = NULL); + FX_BOOL IncrementLayout(); + int32_t CountPages() const; + CXFA_ContainerLayoutItem* GetPage(int32_t index) const; + CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); void AddChangedContainer(CXFA_Node* pContainer); void SetForceReLayout(FX_BOOL bForceRestart) { m_bNeeLayout = bForceRestart; } diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 289581ecae..f207b32263 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -15,12 +15,10 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" -IXFA_PacketImport* IXFA_PacketImport::Create(CXFA_Document* pDocument) { - return new CXFA_DataImporter(pDocument); -} CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { ASSERT(m_pDocument); @@ -465,10 +463,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML); } } -IXFA_PacketExport* IXFA_PacketExport::Create(CXFA_Document* pDocument, - XFA_DATAFORMAT eFormat) { - return new CXFA_DataExporter(pDocument); -} + CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { ASSERT(m_pDocument); diff --git a/xfa/fxfa/parser/xfa_document_serialize.h b/xfa/fxfa/parser/xfa_document_serialize.h index f18e163a8d..9bde4b038e 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.h +++ b/xfa/fxfa/parser/xfa_document_serialize.h @@ -9,32 +9,34 @@ #include "xfa/fxfa/parser/xfa_docdata.h" -class CXFA_DataImporter : public IXFA_PacketImport { +class CXFA_DataImporter { public: - CXFA_DataImporter(CXFA_Document* pDocument); - virtual void Release() { delete this; } - virtual FX_BOOL ImportData(IFX_FileRead* pDataDocument); + explicit CXFA_DataImporter(CXFA_Document* pDocument); + + void Release() { delete this; } + FX_BOOL ImportData(IFX_FileRead* pDataDocument); protected: - CXFA_Document* m_pDocument; + CXFA_Document* const m_pDocument; }; -class CXFA_DataExporter : public IXFA_PacketExport { +class CXFA_DataExporter { public: - CXFA_DataExporter(CXFA_Document* pDocument); - virtual void Release() { delete this; } - virtual FX_BOOL Export(IFX_FileWrite* pWrite); - virtual FX_BOOL Export(IFX_FileWrite* pWrite, - CXFA_Node* pNode, - uint32_t dwFlag = 0, - const FX_CHAR* pChecksum = NULL); + explicit CXFA_DataExporter(CXFA_Document* pDocument); + + void Release() { delete this; } + FX_BOOL Export(IFX_FileWrite* pWrite); + FX_BOOL Export(IFX_FileWrite* pWrite, + CXFA_Node* pNode, + uint32_t dwFlag = 0, + const FX_CHAR* pChecksum = NULL); protected: FX_BOOL Export(IFX_Stream* pStream, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum); - CXFA_Document* m_pDocument; + CXFA_Document* const m_pDocument; }; #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_SERIALIZE_H_ diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp index b175cad9c6..e223ab8ce7 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp +++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_layout_appadapter.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -16,6 +17,7 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -41,9 +43,9 @@ uint32_t XFA_GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) { } void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { CXFA_LayoutItem* pNext = pNode->m_pNextSibling; diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 2924fad922..0f22a27bd7 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -10,6 +10,7 @@ #include <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 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( case XFA_ATTRIBUTEENUM_None: { FX_BOOL bAnyChanged = FALSE; CXFA_Document* pDocument = pFormNode->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); @@ -353,7 +355,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); } -IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const { +CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const { for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; pCurNode = pCurNode->m_pParent) { if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) @@ -551,9 +553,9 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() { if (m_pOldLayoutItem->m_pPrev) { m_pOldLayoutItem->m_pPrev->m_pNext = NULL; } - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; while (pOldLayoutItem) { @@ -614,8 +616,10 @@ static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( return bFindRs; } static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { - IXFA_Notify* pNotify = pGenerateNode->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = pGenerateNode->GetDocument()->GetDocLayout(); + CXFA_FFNotify* pNotify = + pGenerateNode->GetDocument()->GetParser()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = + pGenerateNode->GetDocument()->GetDocLayout(); CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( pGenerateNode); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; @@ -2863,7 +2867,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { return; } CXFA_Document* pDocument = m_pFormNode->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); FX_FLOAT fHeight = -1; FX_FLOAT fWidth = -1; pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight); diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 61c0715f1a..888cf4fe5b 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -17,7 +18,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" CXFA_LayoutPageMgr::CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor) @@ -82,7 +85,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return FALSE; } CXFA_Document* pDocument = pTemplateNode->GetDocument(); - IXFA_ObjFactory* pObjFactory = pDocument->GetParser()->GetFactory(); + CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); if (!pPageArea) { pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), @@ -406,7 +409,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, m_nAvailPages++; pNewPageAreaLayoutItem = pContainerItem; } else { - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetParser()->GetNotify(); CXFA_ContainerLayoutItem* pContainerItem = (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea); @@ -599,15 +602,15 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { int32_t CXFA_LayoutPageMgr::GetPageCount() const { return m_PageArray.GetSize(); } -IXFA_LayoutPage* CXFA_LayoutPageMgr::GetPage(int32_t index) const { +CXFA_ContainerLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const { if (index < 0 || index >= m_PageArray.GetSize()) return nullptr; return m_PageArray[index]; } -int32_t CXFA_LayoutPageMgr::GetPageIndex(const IXFA_LayoutPage* pPage) const { +int32_t CXFA_LayoutPageMgr::GetPageIndex( + const CXFA_ContainerLayoutItem* pPage) const { // FIXME: Find() method should take const. - return m_PageArray.Find(static_cast<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 @@ CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem( pFormNode); } static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem, - IXFA_Notify* pNotify, - IXFA_DocLayout* pDocLayout) { + CXFA_FFNotify* pNotify, + CXFA_LayoutProcessor* pDocLayout) { CXFA_LayoutItem* pNextLayoutItem; CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; while (pCurLayoutItem) { @@ -1518,9 +1521,9 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { if (pCurLayoutItem->IsContentLayoutItem()) { uint32_t dwFlag = pCurLayoutItem->m_pFormNode->GetFlag(); if (dwFlag & (XFA_NODEFLAG_HasRemoved)) { - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = + CXFA_LayoutProcessor* pDocLayout = m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); if (pCurLayoutItem->m_pFirstChild) { XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); @@ -1578,8 +1581,8 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow( } void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument(); - IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); - IXFA_DocLayout* pDocLayout = pDocument->GetDocLayout(); + CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify(); + CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); { for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); @@ -1790,8 +1793,8 @@ void CXFA_LayoutPageMgr::LayoutPageSetContents() { } } } -void XFA_SyncContainer(IXFA_Notify* pNotify, - IXFA_DocLayout* pDocLayout, +void XFA_SyncContainer(CXFA_FFNotify* pNotify, + CXFA_LayoutProcessor* pDocLayout, CXFA_LayoutItem* pContainerItem, uint32_t dwRelevant, FX_BOOL bVisible, @@ -1825,7 +1828,7 @@ void XFA_SyncContainer(IXFA_Notify* pNotify, void CXFA_LayoutPageMgr::SyncLayoutData() { MergePageSetContents(); LayoutPageSetContents(); - IXFA_Notify* pNotify = + CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); int32_t nPageIdx = -1; CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h index 354daa5e31..a82c152df9 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h @@ -35,8 +35,8 @@ class CXFA_LayoutPageMgr { void FinishPaginatedPageSets(); void SyncLayoutData(); int32_t GetPageCount() const; - IXFA_LayoutPage* GetPage(int32_t index) const; - int32_t GetPageIndex(const IXFA_LayoutPage* pPage) const; + CXFA_ContainerLayoutItem* GetPage(int32_t index) const; + int32_t GetPageIndex(const CXFA_ContainerLayoutItem* pPage) const; inline CXFA_ContainerLayoutItem* GetRootLayoutItem() const { return m_pPageSetLayoutItemRoot; } diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index c721d7da17..35d8c36fa2 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -107,8 +107,7 @@ void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, FALSE); } void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE& tz) const { - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); - pProvider->GetTimeZone(tz); + CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); } void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, FALSE); @@ -278,8 +277,7 @@ void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName, GetCalendarSymbol(XFA_ELEMENT_MeridiemNames, bAM ? 0 : 1, FALSE); } void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE& tz) const { - IXFA_TimeZoneProvider* pProvider = IXFA_TimeZoneProvider::Get(); - pProvider->GetTimeZone(tz); + CXFA_TimeZoneProvider::Get()->GetTimeZone(tz); } void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { wsEraName = GetCalendarSymbol(XFA_ELEMENT_EraNames, bAD ? 1 : 0, FALSE); diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index ce638a3b97..7ccf228177 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1269,21 +1269,28 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { return m_wsConfigLocale; } static CXFA_TimeZoneProvider* g_pProvider = NULL; -IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Create() { + +// Static. +CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { FXSYS_assert(!g_pProvider); g_pProvider = new CXFA_TimeZoneProvider(); return g_pProvider; } -IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Get() { + +// Static. +CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Get() { if (!g_pProvider) { g_pProvider = new CXFA_TimeZoneProvider(); } return g_pProvider; } -void IXFA_TimeZoneProvider::Destroy() { + +// Static. +void CXFA_TimeZoneProvider::Destroy() { delete g_pProvider; g_pProvider = NULL; } + #include <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 a30d0cc1ad..62b8c67924 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -52,24 +52,17 @@ class CXFA_LocaleMgr : public IFX_LocaleMgr { uint16_t m_dwLocaleFlags; }; -class IXFA_TimeZoneProvider { +class CXFA_TimeZoneProvider { public: - static IXFA_TimeZoneProvider* Create(); - static IXFA_TimeZoneProvider* Get(); - static void Destroy(); - - virtual ~IXFA_TimeZoneProvider() {} + CXFA_TimeZoneProvider(); + ~CXFA_TimeZoneProvider(); - virtual void SetTimeZone(FX_TIMEZONE& tz) = 0; + static CXFA_TimeZoneProvider* Create(); + static CXFA_TimeZoneProvider* Get(); + static void Destroy(); - virtual void GetTimeZone(FX_TIMEZONE& tz) = 0; -}; -class CXFA_TimeZoneProvider : public IXFA_TimeZoneProvider { - public: - CXFA_TimeZoneProvider(); - virtual ~CXFA_TimeZoneProvider(); - virtual void SetTimeZone(FX_TIMEZONE& tz); - virtual void GetTimeZone(FX_TIMEZONE& tz); + void SetTimeZone(FX_TIMEZONE& tz); + void GetTimeZone(FX_TIMEZONE& tz); private: FX_TIMEZONE m_tz; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index eed5323ab8..0bd114b6c4 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -10,6 +10,7 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/crt/fgas_system.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_basic_imp.h" #include "xfa/fxfa/parser/xfa_docdata.h" @@ -18,7 +19,9 @@ #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -117,7 +120,7 @@ CXFA_Node::~CXFA_Node() { } } CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); if (!pClone) { return NULL; @@ -286,7 +289,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, } for (int32_t i = 0; i < iProperties; i++) { if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); CXFA_Node* pNewNode = pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); @@ -305,14 +308,14 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, } CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, uint32_t dwFlags) { - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); pNode->SetFlag(dwFlags); return pNode; } CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template); - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); if (!pClone) { return NULL; @@ -631,7 +634,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { CFX_ByteString bsExpression = pArguments->GetUTF8String(0); wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -695,7 +698,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, CFX_WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -740,7 +743,7 @@ void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -1309,7 +1312,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( if (!pLayoutPro) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -1604,7 +1607,7 @@ void CXFA_Node::Script_Som_Message(FXJSE_HVALUE hValue, break; } if (!bNew) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2185,7 +2188,7 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2278,7 +2281,7 @@ void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2360,7 +2363,7 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -2450,7 +2453,7 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2463,7 +2466,7 @@ void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2476,7 +2479,7 @@ void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -2539,7 +2542,7 @@ void CXFA_Node::Script_Som_InstanceIndex(FXJSE_HVALUE hValue, } if (pManagerNode) { pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2616,7 +2619,7 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2629,7 +2632,7 @@ void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -2642,7 +2645,7 @@ void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -3134,7 +3137,7 @@ void CXFA_Node::Script_InstanceManager_MoveInstance( int32_t iFrom = pArguments->GetInt32(0); int32_t iTo = pArguments->GetInt32(1); InstanceManager_MoveInstance(iTo, iFrom); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3168,7 +3171,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( } CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { for (int32_t i = iIndex; i < iCount - 1; i++) { CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); @@ -3220,7 +3223,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( FXJSE_Value_Set( pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3263,7 +3266,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( FXJSE_Value_Set( pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3326,7 +3329,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount, FALSE); iCount++; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return 0; } @@ -3419,7 +3422,7 @@ void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3439,7 +3442,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 1) { const bool bScriptFlags = pArguments->GetInt32(0) != 0; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3456,7 +3459,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -3469,7 +3472,7 @@ void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 0) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); } else { @@ -4429,7 +4432,7 @@ FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, } if (pNode) { if (bScriptModify) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (pScriptContext) { m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); } @@ -4526,7 +4529,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, } } } - IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); + CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); CXFA_Node* pNewNode; for (; iCount <= index; iCount++) { @@ -4614,7 +4617,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { ASSERT(m_pLastChild); ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } @@ -4660,7 +4663,7 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { ASSERT(m_pLastChild); ASSERT(m_pLastChild->m_pNext == NULL); pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); } @@ -4784,21 +4787,21 @@ CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { return NULL; } int32_t CXFA_Node::GetNodeSameNameIndex() const { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return -1; } return pScriptContext->GetIndexByName(const_cast<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 @@ void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { switch (dwFlag) { case XFA_NODEFLAG_Initialized: if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready); } @@ -4872,7 +4875,7 @@ void CXFA_Node::OnRemoved(CXFA_Node* pParent, CXFA_Node* pRemoved, FX_BOOL bNotify) { if (bNotify && pParent) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved); } @@ -4882,7 +4885,7 @@ void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, void* pNewValue, FX_BOOL bNotify) { if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (pNotify) { pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanging, (void*)(uintptr_t)eAttr, pNewValue); @@ -4905,7 +4908,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, GetEventParaInfoByName(wsEventName); if (eventParaInfo) { uint32_t validFlags = eventParaInfo->m_validFlags; - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return iRet; } diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index 72a18bcd3a..b634746ef4 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -6,6 +6,7 @@ #include "core/fxcrt/include/fx_ext.h" #include "xfa/fxbarcode/include/BC_Library.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h index 86a0d9d94f..5ccc1af199 100644 --- a/xfa/fxfa/parser/xfa_parser.h +++ b/xfa/fxfa/parser/xfa_parser.h @@ -13,7 +13,7 @@ class CFDE_XMLDoc; class IXFA_Parser { public: - static IXFA_Parser* Create(IXFA_ObjFactory* pFactory, + static IXFA_Parser* Create(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); virtual ~IXFA_Parser() {} virtual void Release() = 0; @@ -25,16 +25,10 @@ class IXFA_Parser { IFX_Pause* pPause = NULL) = 0; virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) = 0; - virtual IXFA_ObjFactory* GetFactory() const = 0; + virtual CXFA_Document* GetFactory() const = 0; virtual CXFA_Node* GetRootNode() const = 0; virtual CFDE_XMLDoc* GetXMLDoc() const = 0; virtual void CloseParser() = 0; }; -class IXFA_DocParser : public IXFA_Parser { - public: - static IXFA_DocParser* Create(IXFA_Notify* pNotify); - virtual CXFA_Document* GetDocument() const = 0; - virtual IXFA_Notify* GetNotify() const = 0; -}; #endif // XFA_FXFA_PARSER_XFA_PARSER_H_ diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 75198dc443..a2c2ae7909 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -18,12 +18,13 @@ #include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.h" #include "xfa/fxfa/parser/xfa_utils.h" +#include "xfa/include/fxfa/xfa_checksum.h" -IXFA_Parser* IXFA_Parser::Create(IXFA_ObjFactory* pFactory, +IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory, FX_BOOL bDocumentParser) { return new CXFA_SimpleParser(pFactory, bDocumentParser); } -CXFA_SimpleParser::CXFA_SimpleParser(IXFA_ObjFactory* pFactory, +CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser) : m_pXMLParser(nullptr), m_pXMLDoc(nullptr), @@ -36,7 +37,7 @@ CXFA_SimpleParser::CXFA_SimpleParser(IXFA_ObjFactory* pFactory, CXFA_SimpleParser::~CXFA_SimpleParser() { CloseParser(); } -void CXFA_SimpleParser::SetFactory(IXFA_ObjFactory* pFactory) { +void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( @@ -564,7 +565,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( m_pXMLParser->m_dwCheckStatus != 0x03) { return NULL; } - IXFA_ChecksumContext* pChecksum = XFA_Checksum_Create(); + CXFA_ChecksumContext* pChecksum = new CXFA_ChecksumContext; pChecksum->StartChecksum(); pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], m_pXMLParser->m_nSize[0]); @@ -1342,10 +1343,8 @@ void CXFA_SimpleParser::CloseParser() { m_pStream = NULL; } } -IXFA_DocParser* IXFA_DocParser::Create(IXFA_Notify* pNotify) { - return new CXFA_DocumentParser(pNotify); -} -CXFA_DocumentParser::CXFA_DocumentParser(IXFA_Notify* pNotify) + +CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) : m_nodeParser(NULL, TRUE), m_pNotify(pNotify), m_pDocument(NULL) {} CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 308de7e587..d81637516d 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -14,21 +14,22 @@ class CXFA_XMLParser; class CXFA_SimpleParser : public IXFA_Parser { public: - CXFA_SimpleParser(IXFA_ObjFactory* pFactory, FX_BOOL bDocumentParser = FALSE); - ~CXFA_SimpleParser(); - virtual void Release() { delete this; } + CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); + ~CXFA_SimpleParser() override; + + void Release() override { delete this; } - virtual int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); - virtual int32_t DoParse(IFX_Pause* pPause = NULL); - virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); - virtual IXFA_ObjFactory* GetFactory() const { return m_pFactory; } - virtual CXFA_Node* GetRootNode() const { return m_pRootNode; } - virtual CFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } - virtual void CloseParser(); + int32_t StartParse(IFX_FileRead* pStream, + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; + int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t ParseXMLData(const CFX_WideString& wsXML, + CFDE_XMLNode*& pXMLNode, + IFX_Pause* pPause = NULL) override; + void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; + CXFA_Document* GetFactory() const override { return m_pFactory; } + CXFA_Node* GetRootNode() const override { return m_pRootNode; } + CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } + void CloseParser() override; protected: CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, @@ -68,43 +69,44 @@ class CXFA_SimpleParser : public IXFA_Parser { void ParseInstruction(CXFA_Node* pXFANode, CFDE_XMLInstruction* pXMLInstruction, XFA_XDPPACKET ePacketID); - void SetFactory(IXFA_ObjFactory* pFactory); + void SetFactory(CXFA_Document* pFactory); CXFA_XMLParser* m_pXMLParser; CFDE_XMLDoc* m_pXMLDoc; IFX_Stream* m_pStream; IFX_FileRead* m_pFileRead; - IXFA_ObjFactory* m_pFactory; + CXFA_Document* m_pFactory; CXFA_Node* m_pRootNode; XFA_XDPPACKET m_ePacketID; FX_BOOL m_bDocumentParser; friend class CXFA_DocumentParser; }; -class CXFA_DocumentParser : public IXFA_DocParser { +class CXFA_DocumentParser : public IXFA_Parser { public: - CXFA_DocumentParser(IXFA_Notify* pNotify); - ~CXFA_DocumentParser(); - virtual void Release() { delete this; } - virtual int32_t StartParse(IFX_FileRead* pStream, - XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); - virtual int32_t DoParse(IFX_Pause* pPause = NULL); - virtual int32_t ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause = NULL); - virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); - virtual IXFA_ObjFactory* GetFactory() const { + CXFA_DocumentParser(CXFA_FFNotify* pNotify); + ~CXFA_DocumentParser() override; + + void Release() override { delete this; } + int32_t StartParse(IFX_FileRead* pStream, + XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; + int32_t DoParse(IFX_Pause* pPause = NULL) override; + int32_t ParseXMLData(const CFX_WideString& wsXML, + CFDE_XMLNode*& pXMLNode, + IFX_Pause* pPause = NULL) override; + void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; + CXFA_Document* GetFactory() const override { return m_nodeParser.GetFactory(); } - virtual CXFA_Node* GetRootNode() const { return m_nodeParser.GetRootNode(); } - virtual CFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } - virtual IXFA_Notify* GetNotify() const { return m_pNotify; } - virtual CXFA_Document* GetDocument() const { return m_pDocument; } - virtual void CloseParser(); + CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } + CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } + CXFA_FFNotify* GetNotify() const { return m_pNotify; } + CXFA_Document* GetDocument() const { return m_pDocument; } + void CloseParser() override; protected: CXFA_SimpleParser m_nodeParser; - IXFA_Notify* m_pNotify; + CXFA_FFNotify* m_pNotify; CXFA_Document* m_pDocument; }; typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index fb2960d09b..80601c5b97 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -82,40 +82,4 @@ struct XFA_JSBUILTININFO { const XFA_JSBUILTININFO* XFA_GetJSBuiltinByHash(uint32_t uHashCode); -class IXFA_ScriptContext { - public: - virtual ~IXFA_ScriptContext() {} - virtual void Release() = 0; - virtual void Initialize(FXJSE_HRUNTIME hRuntime) = 0; - - virtual void SetEventParam(CXFA_EventParam param) = 0; - virtual CXFA_EventParam* GetEventParam() = 0; - virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - CXFA_Object* pThisObject = NULL) = 0; - virtual int32_t ResolveObjects(CXFA_Object* refNode, - const CFX_WideStringC& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = NULL) = 0; - virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject) = 0; - virtual void CacheList(CXFA_NodeList* pList) = 0; - virtual CXFA_Object* GetThisObject() const = 0; - virtual FXJSE_HRUNTIME GetRuntime() const = 0; - virtual int32_t GetIndexByName(CXFA_Node* refNode) = 0; - virtual int32_t GetIndexByClassName(CXFA_Node* refNode) = 0; - virtual void GetSomExpression(CXFA_Node* refNode, - CFX_WideString& wsExpression) = 0; - - virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray) = 0; - virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes) = 0; - virtual void AddNodesOfRunScript(CXFA_Node* pNode) = 0; - virtual FXJSE_HCLASS GetJseNormalClass() = 0; - virtual XFA_SCRIPTLANGTYPE GetType() = 0; - virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) = 0; - virtual FX_BOOL IsRunAtClient() = 0; -}; -IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument); - #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index 3f415e2a75..f616596a7f 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -13,9 +14,12 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" +#include "xfa/include/fxfa/xfa_ffwidgethandler.h" CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { @@ -55,7 +59,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Property( FXJSE_HVALUE hValue, uint32_t dwFlag, FX_BOOL bSetting) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -238,7 +242,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Target( } void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( CFXJSE_Arguments* pArguments) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -246,11 +250,11 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( if (!pEventParam) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_WidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); + CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); if (!pWidgetHandler) { return; } @@ -258,7 +262,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( } void CScript_EventPseudoModel::Script_EventPseudoModel_Reset( CFXJSE_Arguments* pArguments) { - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index e2bc9dc857..ad20b76380 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -6,14 +6,18 @@ #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" #include "xfa/fxfa/parser/xfa_document.h" +#include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -24,7 +28,7 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) CScript_HostPseudoModel::~CScript_HostPseudoModel() {} void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( FXJSE_HVALUE hValue, - IXFA_Notify* pNotify, + CXFA_FFNotify* pNotify, uint32_t dwFlag) { CFX_WideString wsValue; pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); @@ -34,7 +38,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -50,7 +54,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -66,11 +70,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetCalculationsEnabled( hDoc, FXJSE_Value_ToBoolean(hValue)); @@ -83,11 +87,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetCurrentPage(hDoc, FXJSE_Value_ToInteger(hValue)); @@ -100,7 +104,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Language( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -116,11 +120,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); return; @@ -132,7 +136,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -151,11 +155,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); @@ -171,11 +175,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetValidationsEnabled( hDoc, FXJSE_Value_ToBoolean(hValue)); @@ -191,7 +195,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -207,7 +211,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Version( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -223,7 +227,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -239,7 +243,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Name( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -255,7 +259,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -277,11 +281,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CFX_WideString wsURL; if (iLength >= 1) { CFX_ByteString bsURL = pArguments->GetUTF8String(0); @@ -299,7 +303,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -313,7 +317,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( FXJSE_Value_ToUTF8String(hValue, bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString, bsString.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { FXJSE_Value_Release(hValue); return; @@ -336,11 +340,12 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( } FXJSE_Value_Release(hValue); } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } @@ -354,7 +359,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -388,7 +393,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( } void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -429,7 +434,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -449,7 +454,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { iStart = XFA_FilterName(wsExpression, iStart, wsName); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -482,7 +487,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -502,7 +507,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -516,7 +521,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( FXJSE_Value_ToUTF8String(hValue, bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString, bsString.GetLength()); - IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { FXJSE_Value_Release(hValue); return; @@ -543,7 +548,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( } void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -564,7 +569,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -631,7 +636,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( } void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -651,11 +656,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Print( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); uint32_t dwOptions = 0; FX_BOOL bShowDialog = TRUE; if (iLength >= 1) { @@ -717,7 +722,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -726,7 +731,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( @@ -736,11 +741,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CFX_WideString wsFilePath; FX_BOOL bXDP = TRUE; if (iLength >= 1) { @@ -754,11 +759,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) { @@ -769,11 +774,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( } void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) { @@ -789,7 +794,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( } void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h index 5718074b2f..1f456ffe7c 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h @@ -79,7 +79,7 @@ class CScript_HostPseudoModel : public CXFA_OrdinaryObject { protected: void Script_HostPseudoModel_LoadString(FXJSE_HVALUE hValue, - IXFA_Notify* pNotify, + CXFA_FFNotify* pNotify, uint32_t dwFlag); FX_BOOL Script_HostPseudoModel_ValidateArgsForMsg( CFXJSE_Arguments* pArguments, diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index e20a4e0b2a..ce3931149b 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/xfa_script_imp.h" #include "core/fxcrt/include/fx_ext.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -133,7 +134,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, return; } } - IXFA_Notify* pNotify = pDoc->GetNotify(); + CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } @@ -213,7 +214,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, hValue, TRUE)) { return; } - IXFA_Notify* pNotify = pDoc->GetNotify(); + CXFA_FFNotify* pNotify = pDoc->GetNotify(); if (!pNotify) { return; } @@ -777,6 +778,3 @@ void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { m_pScriptNodeArray->Add(pNode); } } -IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument) { - return new CXFA_ScriptContext(pDocument); -} diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h index 237192e855..414e403d19 100644 --- a/xfa/fxfa/parser/xfa_script_imp.h +++ b/xfa/fxfa/parser/xfa_script_imp.h @@ -18,44 +18,41 @@ class CXFA_ResolveProcessor; -class CXFA_ScriptContext : public IXFA_ScriptContext { +class CXFA_ScriptContext { public: explicit CXFA_ScriptContext(CXFA_Document* pDocument); ~CXFA_ScriptContext(); - virtual void Release(); - virtual void Initialize(FXJSE_HRUNTIME hRuntime); - virtual void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } - virtual CXFA_EventParam* GetEventParam() { return &m_eventParam; } - virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, - FXJSE_HVALUE hRetValue, - CXFA_Object* pThisObject = NULL); + void Release(); + void Initialize(FXJSE_HRUNTIME hRuntime); + void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } + CXFA_EventParam* GetEventParam() { return &m_eventParam; } + FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, + const CFX_WideStringC& wsScript, + FXJSE_HVALUE hRetValue, + CXFA_Object* pThisObject = NULL); - virtual int32_t ResolveObjects(CXFA_Object* refNode, - const CFX_WideStringC& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = NULL); - virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); - virtual void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } - virtual CXFA_Object* GetThisObject() const { return m_pThisObject; } - virtual FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } + int32_t ResolveObjects(CXFA_Object* refNode, + const CFX_WideStringC& wsExpression, + XFA_RESOLVENODE_RS& resolveNodeRS, + uint32_t dwStyles = XFA_RESOLVENODE_Children, + CXFA_Node* bindNode = NULL); + FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); + void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } + CXFA_Object* GetThisObject() const { return m_pThisObject; } + FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } - virtual int32_t GetIndexByName(CXFA_Node* refNode); - virtual int32_t GetIndexByClassName(CXFA_Node* refNode); - virtual void GetSomExpression(CXFA_Node* refNode, - CFX_WideString& wsExpression); + int32_t GetIndexByName(CXFA_Node* refNode); + int32_t GetIndexByClassName(CXFA_Node* refNode); + void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression); - virtual void SetNodesOfRunScript(CXFA_NodeArray* pArray); - virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes); - virtual void AddNodesOfRunScript(CXFA_Node* pNode); - virtual FXJSE_HCLASS GetJseNormalClass(); + void SetNodesOfRunScript(CXFA_NodeArray* pArray); + void AddNodesOfRunScript(const CXFA_NodeArray& nodes); + void AddNodesOfRunScript(CXFA_Node* pNode); + FXJSE_HCLASS GetJseNormalClass(); - virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } - virtual FX_BOOL IsRunAtClient() { - return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; - } + void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } + FX_BOOL IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; } FX_BOOL QueryNodeByFlag(CXFA_Node* refNode, const CFX_WideStringC& propname, FXJSE_HVALUE hValue, diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 97f2c8b45d..922b0d6bb6 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -15,7 +16,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -28,7 +31,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } @@ -80,7 +83,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( if (!pNode) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -140,7 +143,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Y( void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( CFXJSE_Arguments* pArguments, FX_BOOL bNumbered) { - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -148,7 +151,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( int32_t iPageNum = pDocLayout->CountPages(); if (bNumbered) { for (int32_t i = 0; i < iPageNum; i++) { - IXFA_LayoutPage* pLayoutPage = pDocLayout->GetPage(i); + CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(i); if (!pLayoutPage) { continue; } @@ -183,7 +186,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( if (!pNode) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -205,7 +208,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( Script_LayoutPseudoModel_PageImp(pArguments, FALSE); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( - IXFA_DocLayout* pDocLayout, + CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const CFX_WideString& wsType, FX_BOOL bOnPageArea, @@ -369,11 +372,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( if (iLength >= 3) { bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } @@ -392,11 +395,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -405,11 +408,11 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( CFXJSE_Arguments* pArguments) { - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -447,19 +450,20 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( if (!pNode) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -481,19 +485,20 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( if (!pNode) { return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } - IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); + CXFA_FFWidget* hWidget = + pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { @@ -537,7 +542,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( if (!pNode && hValue) { FXJSE_Value_SetInteger(hValue, iPage); } - IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h index 56d9894284..7473bc0fe1 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h @@ -53,7 +53,7 @@ class CScript_LayoutPseudoModel : public CXFA_OrdinaryObject { void Script_LayoutPseudoModel_AbsPage(CFXJSE_Arguments* pArguments); protected: - void Script_LayoutPseudoModel_GetObjArray(IXFA_DocLayout* pDocLayout, + void Script_LayoutPseudoModel_GetObjArray(CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const CFX_WideString& wsType, FX_BOOL bOnPageArea, diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 3467471c5f..6311314d82 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -694,7 +694,6 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; FXSYS_assert(iFoundCount == findNodes.GetSize()); CFX_WideString wsExpression; - IXFA_ScriptContext* pContext = NULL; XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown; if (wsCondition.Left(2) == FX_WSTRC(L".[") && wsCondition.Right(1) == FX_WSTRC(L"]")) { @@ -705,7 +704,8 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( } else { return; } - pContext = rnd.m_pSC; + + CXFA_ScriptContext* pContext = rnd.m_pSC; wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3); for (int32_t i = iFoundCount - 1; i >= 0; i--) { CXFA_Object* node = findNodes[i]; diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 15328b0ce3..2919664b52 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" +#include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -13,7 +14,9 @@ #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_parser.h" +#include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/fxfa/parser/xfa_script.h" +#include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" #include "xfa/fxjse/cfxjse_arguments.h" @@ -30,11 +33,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); @@ -52,11 +55,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pNodeList = NULL; CFX_WideString wsExpression; CFX_WideString wsXMLIdent; @@ -86,11 +89,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); if (!pList) return; @@ -104,11 +107,11 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); return; } - IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); + CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } - IXFA_Doc* hDoc = pNotify->GetHDOC(); + CXFA_FFDoc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; FX_BOOL bClear = TRUE; if (iLength >= 1) { |