diff options
Diffstat (limited to 'xfa/fxfa/app')
50 files changed, 460 insertions, 1366 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; |