diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-29 14:47:46 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-29 19:25:17 +0000 |
commit | efcae5d85f829618749461617521a076881cc493 (patch) | |
tree | c04c722da050231e410e7a79d4562bb6789910c4 /xfa/fxfa | |
parent | 47b8f070dc11308e0bef3a157f6c70fbcad4093a (diff) | |
download | pdfium-efcae5d85f829618749461617521a076881cc493.tar.xz |
Split xfa_object.h apart.
This Cl splits the xfa_object.h into individual class header files and
fixes the needed includes.
Change-Id: Ia011ee9bc5deee5e44b8a956fa54bc2c3849cff0
Reviewed-on: https://pdfium-review.googlesource.com/3254
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
97 files changed, 462 insertions, 325 deletions
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 0fab077812..c5471971b6 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -26,8 +26,8 @@ #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_textpiece.h" #include "xfa/fxfa/parser/cxfa_font.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_para.h" -#include "xfa/fxfa/parser/xfa_object.h" #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 39109f5f28..4193af82b4 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -22,6 +22,7 @@ #include "xfa/fxfa/cxfa_ffdocview.h" #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 90648012c6..56562c9403 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -30,6 +30,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" +#include "xfa/fxfa/parser/cxfa_node.h" static void XFA_FFDeleteWidgetAcc(void* pData) { delete static_cast<CXFA_WidgetAcc*>(pData); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index a8f5a3bcd0..e99fefbd73 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -27,6 +27,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc) : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {} diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 98dee06728..ada78921ef 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -28,6 +28,7 @@ #include "xfa/fxfa/cxfa_fontmgr.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index e14500a725..43551008db 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -28,6 +28,7 @@ #include "xfa/fxfa/parser/cxfa_dataexporter.h" #include "xfa/fxfa/parser/cxfa_dataimporter.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" namespace { diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp index a71bb208fa..f926638406 100644 --- a/xfa/fxfa/cxfa_ffdochandler.cpp +++ b/xfa/fxfa/cxfa_ffdochandler.cpp @@ -8,6 +8,7 @@ #include "xfa/fxfa/cxfa_checksumcontext.h" #include "xfa/fxfa/cxfa_ffdoc.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 9708e34562..488a31f299 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -36,6 +36,8 @@ #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" +#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') + const XFA_ATTRIBUTEENUM gs_EventActivity[] = { XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change, XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady, diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index 4c0b3cf638..0066086d94 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -23,6 +23,7 @@ #include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffdocview.h" #include "xfa/fxfa/cxfa_ffwidget.h" +#include "xfa/fxfa/parser/cxfa_node.h" namespace { diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h index a0aa5227c1..df4fc6d2c1 100644 --- a/xfa/fxfa/cxfa_ffpageview.h +++ b/xfa/fxfa/cxfa_ffpageview.h @@ -12,6 +12,7 @@ #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" +#include "xfa/fxfa/parser/xfa_utils.h" class CXFA_FFWidget; class CXFA_FFDocView; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index a74c6d7057..c815e1ccdc 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -26,6 +26,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_widgetacc.h" #include "xfa/fxfa/parser/cxfa_corner.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_graphics.h" #include "xfa/fxgraphics/cfx_path.h" diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index ef3d908221..35a36002c7 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -26,6 +26,7 @@ inline float XFA_UnitPx2Pt(float fPx, float fDpi) { } #define XFA_FLOAT_PERCISION 0.001f +#define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') enum XFA_WIDGETITEM { XFA_WIDGETITEM_Parent, diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index 0af69da016..ffc1c27070 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -16,6 +16,7 @@ #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) : m_pDocView(pDocView) {} diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 1db2bcef0f..863ab83e73 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -21,6 +21,7 @@ #include "xfa/fxfa/cxfa_fontmgr.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/cxfa_widgetacciterator.h b/xfa/fxfa/cxfa_widgetacciterator.h index 6e9da72941..ab18e833c2 100644 --- a/xfa/fxfa/cxfa_widgetacciterator.h +++ b/xfa/fxfa/cxfa_widgetacciterator.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_CXFA_WIDGETACCITERATOR_H_ #define XFA_FXFA_CXFA_WIDGETACCITERATOR_H_ -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" class CXFA_Node; class CXFA_WidgetAcc; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 83f65edd4a..5ec6215336 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -21,8 +21,10 @@ #include "xfa/fxfa/fm2js/xfa_program.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_timezoneprovider.h" +#include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 29591f4352..d7f00091ed 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -14,6 +14,8 @@ #include "fxjs/cfxjse_context.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" +class CXFA_Document; + class CXFA_FM2JSContext : public CFXJSE_HostObject { public: CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index e7b4d2c56c..e2d9f043d1 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -9,7 +9,6 @@ #include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument) diff --git a/xfa/fxfa/parser/cscript_datawindow.h b/xfa/fxfa/parser/cscript_datawindow.h index e41b7fe17d..ae12316891 100644 --- a/xfa/fxfa/parser/cscript_datawindow.h +++ b/xfa/fxfa/parser/cscript_datawindow.h @@ -7,8 +7,9 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_ #define XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_ -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" + +class CFXJSE_Arguments; class CScript_DataWindow : public CXFA_Object { public: diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index 6ce8114a02..c57b0bdc78 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.h b/xfa/fxfa/parser/cscript_eventpseudomodel.h index e50c5ac187..dfad255d7e 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.h +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.h @@ -8,7 +8,7 @@ #define XFA_FXFA_PARSER_CSCRIPT_EVENTPSEUDOMODEL_H_ #include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" enum class XFA_Event { Change = 0, diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index 2bc6787ae3..d2633ec4ae 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -13,8 +13,8 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h index c64ad2ed7d..821f88d137 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -7,9 +7,10 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" + +class CFXJSE_Arguments; +class CXFA_Document; class CScript_HostPseudoModel : public CXFA_Object { public: diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 842617e6e6..693d4029a3 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -11,6 +11,7 @@ #include "fxjs/cfxjse_arguments.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_arraynodelist.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -18,9 +19,9 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/xfa/fxfa/parser/cscript_layoutpseudomodel.h index a61f927299..ea31a4205e 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h @@ -9,8 +9,7 @@ #include <vector> -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" enum XFA_LAYOUTMODEL_HWXY { XFA_LAYOUTMODEL_H, @@ -19,6 +18,7 @@ enum XFA_LAYOUTMODEL_HWXY { XFA_LAYOUTMODEL_Y }; +class CFXJSE_Arguments; class CXFA_LayoutProcessor; class CScript_LayoutPseudoModel : public CXFA_Object { diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index f9430f5d75..d9563ac93e 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -9,7 +9,6 @@ #include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument) diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.h b/xfa/fxfa/parser/cscript_logpseudomodel.h index 18f9f51ae7..2e465e851b 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.h +++ b/xfa/fxfa/parser/cscript_logpseudomodel.h @@ -7,8 +7,9 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_ -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" + +class CFXJSE_Arguments; class CScript_LogPseudoModel : public CXFA_Object { public: diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index 609b5bd318..0886809db1 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -11,7 +11,6 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.h b/xfa/fxfa/parser/cscript_signaturepseudomodel.h index 4f9ded0663..ee52744320 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.h +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.h @@ -7,8 +7,9 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_ -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" + +class CFXJSE_Arguments; class CScript_SignaturePseudoModel : public CXFA_Object { public: diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.cpp b/xfa/fxfa/parser/cxfa_arraynodelist.cpp index ff1d1d916b..03966c3c6c 100644 --- a/xfa/fxfa/parser/cxfa_arraynodelist.cpp +++ b/xfa/fxfa/parser/cxfa_arraynodelist.cpp @@ -4,10 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/fxfa/parser/cxfa_arraynodelist.h" + #include <vector> #include "third_party/base/stl_util.h" -#include "xfa/fxfa/parser/xfa_object.h" CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument) : CXFA_NodeList(pDocument) {} diff --git a/xfa/fxfa/parser/cxfa_arraynodelist.h b/xfa/fxfa/parser/cxfa_arraynodelist.h new file mode 100644 index 0000000000..ba00f3045e --- /dev/null +++ b/xfa/fxfa/parser/cxfa_arraynodelist.h @@ -0,0 +1,35 @@ +// Copyright 2017 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_PARSER_CXFA_ARRAYNODELIST_H_ +#define XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_ + +#include <vector> + +#include "xfa/fxfa/parser/cxfa_nodelist.h" + +class CXFA_Document; +class CXFA_Node; + +class CXFA_ArrayNodeList : public CXFA_NodeList { + public: + explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); + ~CXFA_ArrayNodeList() override; + + // From CXFA_NodeList. + int32_t GetLength() override; + bool Append(CXFA_Node* pNode) override; + bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + bool Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; + + void SetArrayNodeList(const std::vector<CXFA_Node*>& srcArray); + + private: + std::vector<CXFA_Node*> m_array; +}; + +#endif // XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_ diff --git a/xfa/fxfa/parser/cxfa_assist.cpp b/xfa/fxfa/parser/cxfa_assist.cpp index 894e729d6d..809081d960 100644 --- a/xfa/fxfa/parser/cxfa_assist.cpp +++ b/xfa/fxfa/parser/cxfa_assist.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_assist.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp index c23b900af6..9c0b0fd18e 100644 --- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp +++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp @@ -4,7 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_attachnodelist.h" + +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode) @@ -20,17 +22,17 @@ int32_t CXFA_AttachNodeList::GetLength() { bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) { CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); - if (pParent) { + if (pParent) pParent->RemoveChild(pNode); - } + return m_pAttachNode->InsertChild(pNode); } bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) { CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent); - if (pParent) { + if (pParent) pParent->RemoveChild(pNewNode); - } + return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); } diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.h b/xfa/fxfa/parser/cxfa_attachnodelist.h new file mode 100644 index 0000000000..3bb771a476 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_attachnodelist.h @@ -0,0 +1,30 @@ +// Copyright 2017 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_PARSER_CXFA_ATTACHNODELIST_H_ +#define XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_ + +#include "xfa/fxfa/parser/cxfa_nodelist.h" + +class CXFA_Document; +class CXFA_Node; + +class CXFA_AttachNodeList : public CXFA_NodeList { + public: + CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); + + // From CXFA_NodeList. + int32_t GetLength() override; + bool Append(CXFA_Node* pNode) override; + bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + bool Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; + + private: + CXFA_Node* m_pAttachNode; +}; + +#endif // XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_ diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp index 16efd1f440..aac2c18321 100644 --- a/xfa/fxfa/parser/cxfa_bind.cpp +++ b/xfa/fxfa/parser/cxfa_bind.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_bind.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp index fdb4f0c376..c3c5cabe4e 100644 --- a/xfa/fxfa/parser/cxfa_binditems.cpp +++ b/xfa/fxfa/parser/cxfa_binditems.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_binditems.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index a6cced5426..300edd01ad 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -8,7 +8,7 @@ #include "xfa/fxfa/parser/cxfa_corner.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp index d7b1f71caa..bc89d81777 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/parser/cxfa_calculate.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_text.h" -#include "xfa/fxfa/parser/xfa_object.h" CXFA_Calculate::CXFA_Calculate(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp index 5b9365ab16..1be4a206e7 100644 --- a/xfa/fxfa/parser/cxfa_caption.cpp +++ b/xfa/fxfa/parser/cxfa_caption.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cxfa_caption.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Caption::CXFA_Caption(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp index 5ef29f14cf..cf4e1ce3f3 100644 --- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp @@ -9,6 +9,7 @@ #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) : CXFA_LayoutItem(pNode, false), m_pOldSubform(nullptr) {} diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp index a10a678279..c8acff2b1c 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp @@ -6,6 +6,8 @@ #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" +#include "xfa/fxfa/parser/cxfa_node.h" + CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) : CXFA_LayoutItem(pNode, true), m_pPrev(nullptr), diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.h b/xfa/fxfa/parser/cxfa_contentlayoutitem.h index 500d3e4959..9d1fc2abcf 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.h +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.h @@ -9,6 +9,8 @@ #include "xfa/fxfa/parser/cxfa_layoutitem.h" +#define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') + class CXFA_ContentLayoutItem : public CXFA_LayoutItem { public: explicit CXFA_ContentLayoutItem(CXFA_Node* pNode); diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 456cc7f223..9f265b41be 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -8,7 +8,7 @@ #include "core/fxcrt/fx_ext.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" // Static. FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 4d3b039b33..f9553c413f 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -13,8 +13,9 @@ #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_widgetdata.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index 0199028ecd..3ba304d550 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -14,8 +14,8 @@ #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/fxfa_basic.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" -#include "xfa/fxfa/parser/xfa_object.h" CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) : m_pDocument(pDocument) { diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 0a4e597c93..165c0a3ee5 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -16,8 +16,9 @@ #include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index 80cdc1bb0c..5d9ec1b430 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -14,7 +14,6 @@ #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" enum XFA_VERSION { XFA_VERSION_UNKNOWN = 0, diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index 1fe03a4935..d7534289b3 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_event.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Event::CXFA_Event(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_exdata.cpp b/xfa/fxfa/parser/cxfa_exdata.cpp index bf1e930330..ac82b3043c 100644 --- a/xfa/fxfa/parser/cxfa_exdata.cpp +++ b/xfa/fxfa/parser/cxfa_exdata.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_exdata.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index 63949c193d..8621c3c961 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_fill.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Fill::CXFA_Fill(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index f310f76bc6..56e04b75f7 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -9,7 +9,7 @@ #include "core/fxge/fx_dib.h" #include "xfa/fxfa/parser/cxfa_fill.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Font::CXFA_Font(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp index 8cf7fc1e23..8d14d62960 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_image.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_image.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Image::CXFA_Image(CXFA_Node* pNode, bool bDefValue) : CXFA_Data(pNode), m_bDefValue(bDefValue) {} diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 50be211bb6..8911227f3d 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -21,8 +21,9 @@ #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp index 5409c4e0c1..b227be9e85 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp @@ -10,6 +10,7 @@ #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index bee4fe9ae6..b88dca9009 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -15,11 +15,14 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_object.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index 10ae66739b..2e919dbc84 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -14,8 +14,8 @@ #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.h b/xfa/fxfa/parser/cxfa_layoutprocessor.h index c6950052a9..75bf2597c5 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.h +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.h @@ -11,7 +11,6 @@ #include <vector> #include "core/fxcrt/fx_system.h" -#include "xfa/fxfa/parser/xfa_object.h" class CXFA_ContainerLayoutItem; class CXFA_Document; diff --git a/xfa/fxfa/parser/cxfa_line.cpp b/xfa/fxfa/parser/cxfa_line.cpp index 38de0d8ca8..8be1d25a46 100644 --- a/xfa/fxfa/parser/cxfa_line.cpp +++ b/xfa/fxfa/parser/cxfa_line.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_line.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" int32_t CXFA_Line::GetHand() { return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand); diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp index b9f2615f41..ddcee39b0d 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -15,9 +15,9 @@ #include "core/fxcrt/fx_xml.h" #include "core/fxge/cfx_gemodule.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_nodelocale.h" #include "xfa/fxfa/parser/cxfa_xmllocale.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" const uint8_t g_enUS_Locale[] = { diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp index a5238d2c3f..1fd7ac197c 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.cpp +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -14,7 +14,6 @@ #include "xfa/fgas/localization/cfx_formatstring.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CXFA_LocaleValue::CXFA_LocaleValue() { diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp index fc4a0f1a63..e3153f2671 100644 --- a/xfa/fxfa/parser/cxfa_margin.cpp +++ b/xfa/fxfa/parser/cxfa_margin.cpp @@ -6,8 +6,6 @@ #include "xfa/fxfa/parser/cxfa_margin.h" -#include "xfa/fxfa/parser/xfa_object.h" - CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {} bool CXFA_Margin::GetLeftInset(float& fInset, float fDefInset) const { diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index a1074b9ef2..86249c0718 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include <map> #include <memory> @@ -20,12 +20,16 @@ #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_eventparam.h" +#include "xfa/fxfa/cxfa_ffwidget.h" +#include "xfa/fxfa/parser/cxfa_arraynodelist.h" +#include "xfa/fxfa/parser/cxfa_attachnodelist.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" #include "xfa/fxfa/parser/xfa_basic_data.h" namespace { diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/cxfa_node.h index 3e98a4747c..970d267ff3 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -1,37 +1,25 @@ -// Copyright 2014 PDFium Authors. All rights reserved. +// Copyright 2017 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_PARSER_XFA_OBJECT_H_ -#define XFA_FXFA_PARSER_XFA_OBJECT_H_ +#ifndef XFA_FXFA_PARSER_CXFA_NODE_H_ +#define XFA_FXFA_PARSER_CXFA_NODE_H_ #include <map> #include <vector> -#include "core/fxcrt/fx_basic.h" -#include "fxjs/cfxjse_arguments.h" -#include "xfa/fde/xml/fde_xml.h" -#include "xfa/fxfa/parser/xfa_utils.h" +#include "core/fxcrt/fx_string.h" +#include "xfa/fxfa/parser/cxfa_object.h" -class CXFA_Document; -class CXFA_Node; -class CXFA_NodeList; +class CFDE_XMLNode; +class CFXJSE_Argument; +class CXFA_WidgetData; -enum class XFA_ObjectType { - Object, - List, - NodeList, - Node, - NodeC, - NodeV, - ModelNode, - TextNode, - ContainerNode, - ContentNode, - VariablesThis -}; +#define XFA_NODEFILTER_Children 0x01 +#define XFA_NODEFILTER_Properties 0x02 +#define XFA_NODEFILTER_OneOfProperty 0x04 enum XFA_NodeFlag { XFA_NodeFlag_None = 0, @@ -46,84 +34,18 @@ enum XFA_NodeFlag { XFA_NodeFlag_LayoutGeneratedNode = 1 << 8 }; -class CXFA_Object : public CFXJSE_HostObject { - public: - CXFA_Object(CXFA_Document* pDocument, - XFA_ObjectType objectType, - XFA_Element eType, - const CFX_WideStringC& elementName); - ~CXFA_Object() override; - - CXFA_Document* GetDocument() const { return m_pDocument; } - XFA_ObjectType GetObjectType() const { return m_objectType; } - - bool IsNode() const { - return m_objectType == XFA_ObjectType::Node || - m_objectType == XFA_ObjectType::NodeC || - m_objectType == XFA_ObjectType::NodeV || - m_objectType == XFA_ObjectType::ModelNode || - m_objectType == XFA_ObjectType::TextNode || - m_objectType == XFA_ObjectType::ContainerNode || - m_objectType == XFA_ObjectType::ContentNode || - m_objectType == XFA_ObjectType::VariablesThis; - } - bool IsNodeList() const { return m_objectType == XFA_ObjectType::NodeList; } - bool IsContentNode() const { - return m_objectType == XFA_ObjectType::ContentNode; - } - bool IsContainerNode() const { - return m_objectType == XFA_ObjectType::ContainerNode; - } - bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; } - bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; } - bool IsVariablesThis() const { - return m_objectType == XFA_ObjectType::VariablesThis; - } - - CXFA_Node* AsNode(); - CXFA_NodeList* AsNodeList(); - - const CXFA_Node* AsNode() const; - const CXFA_NodeList* AsNodeList() const; - - XFA_Element GetElementType() const; - CFX_WideStringC GetClassName() const; - uint32_t GetClassHashCode() const; - void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, - bool bSetting, - XFA_ATTRIBUTE eAttribute); - - void ThrowInvalidPropertyException() const; - void ThrowArgumentMismatchException() const; - void ThrowIndexOutOfBoundsException() const; - void ThrowParamCountMismatchException(const CFX_WideString& method) const; - - protected: - void ThrowException(const wchar_t* str, ...) const; - - CXFA_Document* const m_pDocument; - const XFA_ObjectType m_objectType; - const XFA_Element m_elementType; - - const uint32_t m_elementNameHash; - const CFX_WideStringC m_elementName; +enum XFA_SOM_MESSAGETYPE { + XFA_SOM_ValidationMessage, + XFA_SOM_FormatMessage, + XFA_SOM_MandatoryMessage }; -#define XFA_NODEFILTER_Children 0x01 -#define XFA_NODEFILTER_Properties 0x02 -#define XFA_NODEFILTER_OneOfProperty 0x04 -#define XFA_CLONEFLAG_Content 0x01 enum XFA_NODEITEM { XFA_NODEITEM_Parent, XFA_NODEITEM_FirstChild, XFA_NODEITEM_NextSibling, XFA_NODEITEM_PrevSibling, }; -enum XFA_SOM_MESSAGETYPE { - XFA_SOM_ValidationMessage, - XFA_SOM_FormatMessage, - XFA_SOM_MandatoryMessage -}; typedef void (*PD_CALLBACK_FREEDATA)(void* pData); typedef void (*PD_CALLBACK_DUPLICATEDATA)(void*& pData); @@ -147,10 +69,6 @@ struct XFA_MAPMODULEDATA { std::map<void*, XFA_MAPDATABLOCK*> m_BufferMap; }; -#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') -#define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') -#define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') - class CXFA_Node : public CXFA_Object { public: uint32_t GetPacketID() const { return m_ePacket; } @@ -687,132 +605,4 @@ class CXFA_Node : public CXFA_Object { void ThrowTooManyOccurancesException(const CFX_WideString& obj) const; }; -class CXFA_ThisProxy : public CXFA_Object { - public: - CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); - ~CXFA_ThisProxy() override; - - CXFA_Node* GetThisNode() const; - CXFA_Node* GetScriptNode() const; - - private: - CXFA_Node* m_pThisNode; - CXFA_Node* m_pScriptNode; -}; - -class CXFA_NodeList : public CXFA_Object { - public: - explicit CXFA_NodeList(CXFA_Document* pDocument); - ~CXFA_NodeList() override; - - CXFA_Node* NamedItem(const CFX_WideStringC& wsName); - virtual int32_t GetLength() = 0; - virtual bool Append(CXFA_Node* pNode) = 0; - virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; - virtual bool Remove(CXFA_Node* pNode) = 0; - virtual CXFA_Node* Item(int32_t iIndex) = 0; - - void Script_ListClass_Append(CFXJSE_Arguments* pArguments); - void Script_ListClass_Insert(CFXJSE_Arguments* pArguments); - void Script_ListClass_Remove(CFXJSE_Arguments* pArguments); - void Script_ListClass_Item(CFXJSE_Arguments* pArguments); - - void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments); - void Script_ListClass_Length(CFXJSE_Value* pValue, - bool bSetting, - XFA_ATTRIBUTE eAttribute); -}; - -class CXFA_ArrayNodeList : public CXFA_NodeList { - public: - explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); - ~CXFA_ArrayNodeList() override; - - // From CXFA_NodeList. - int32_t GetLength() override; - bool Append(CXFA_Node* pNode) override; - bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; - bool Remove(CXFA_Node* pNode) override; - CXFA_Node* Item(int32_t iIndex) override; - - void SetArrayNodeList(const std::vector<CXFA_Node*>& srcArray); - - private: - std::vector<CXFA_Node*> m_array; -}; - -class CXFA_AttachNodeList : public CXFA_NodeList { - public: - CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); - - // From CXFA_NodeList. - int32_t GetLength() override; - bool Append(CXFA_Node* pNode) override; - bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; - bool Remove(CXFA_Node* pNode) override; - CXFA_Node* Item(int32_t iIndex) override; - - private: - CXFA_Node* m_pAttachNode; -}; -class CXFA_TraverseStrategy_XFAContainerNode { - public: - static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, - void* pUserData = nullptr) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, - XFA_ObjectType::ContainerNode); - } - static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, - void* pUserData = nullptr) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, - XFA_ObjectType::ContainerNode); - } - static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, - void* pUserData = nullptr) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, - XFA_ObjectType::ContainerNode); - } -}; -typedef CXFA_NodeIteratorTemplate<CXFA_Node, - CXFA_TraverseStrategy_XFAContainerNode> - CXFA_ContainerIterator; -class CXFA_TraverseStrategy_XFANode { - public: - static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); - } - static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling); - } - static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) { - return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent); - } -}; -typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> - CXFA_NodeIterator; - -inline CXFA_Node* CXFA_Object::AsNode() { - return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr; -} - -inline CXFA_NodeList* CXFA_Object::AsNodeList() { - return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr; -} - -inline const CXFA_Node* CXFA_Object::AsNode() const { - return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr; -} - -inline const CXFA_NodeList* CXFA_Object::AsNodeList() const { - return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr; -} - -inline CXFA_Node* ToNode(CXFA_Object* pObj) { - return pObj ? pObj->AsNode() : nullptr; -} - -inline const CXFA_Node* ToNode(const CXFA_Object* pObj) { - return pObj ? pObj->AsNode() : nullptr; -} - -#endif // XFA_FXFA_PARSER_XFA_OBJECT_H_ +#endif // XFA_FXFA_PARSER_CXFA_NODE_H_ diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 6a9904af04..abfca84609 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -9,8 +9,8 @@ #include "core/fxcrt/fx_ext.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h index d26ccf64e9..cf6c2f17a0 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -9,7 +9,6 @@ #include <vector> -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" class CXFA_ScriptContext; diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index 97c531f33b..86efb29eba 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -4,12 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_nodelist.h" #include <memory> #include "core/fxcrt/fx_ext.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) diff --git a/xfa/fxfa/parser/cxfa_nodelist.h b/xfa/fxfa/parser/cxfa_nodelist.h new file mode 100644 index 0000000000..6fffb7bb67 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_nodelist.h @@ -0,0 +1,40 @@ +// Copyright 2017 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_PARSER_CXFA_NODELIST_H_ +#define XFA_FXFA_PARSER_CXFA_NODELIST_H_ + +#include "xfa/fxfa/fxfa_basic.h" +#include "xfa/fxfa/parser/cxfa_object.h" + +class CXFA_Node; +class CFXJSE_Arguments; +class CFXJSE_Value; + +class CXFA_NodeList : public CXFA_Object { + public: + explicit CXFA_NodeList(CXFA_Document* pDocument); + ~CXFA_NodeList() override; + + CXFA_Node* NamedItem(const CFX_WideStringC& wsName); + virtual int32_t GetLength() = 0; + virtual bool Append(CXFA_Node* pNode) = 0; + virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; + virtual bool Remove(CXFA_Node* pNode) = 0; + virtual CXFA_Node* Item(int32_t iIndex) = 0; + + void Script_ListClass_Append(CFXJSE_Arguments* pArguments); + void Script_ListClass_Insert(CFXJSE_Arguments* pArguments); + void Script_ListClass_Remove(CFXJSE_Arguments* pArguments); + void Script_ListClass_Item(CFXJSE_Arguments* pArguments); + + void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments); + void Script_ListClass_Length(CFXJSE_Value* pValue, + bool bSetting, + XFA_ATTRIBUTE eAttribute); +}; + +#endif // XFA_FXFA_PARSER_CXFA_NODELIST_H_ diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp index fac3cc3335..1280b61c76 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -11,8 +11,8 @@ #include "core/fxcrt/fx_xml.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_timezoneprovider.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h index 0059d19888..6758ad4eb3 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.h +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -10,7 +10,9 @@ #include <memory> #include "xfa/fgas/localization/fgas_locale.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/fxfa_basic.h" + +class CXFA_Node; CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category); diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 4964265b4d..9bbee4ec75 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -4,12 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" #include "core/fxcrt/fx_ext.h" #include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_nodelist.h" CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, @@ -23,18 +25,6 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, CXFA_Object::~CXFA_Object() {} -CFX_WideStringC CXFA_Object::GetClassName() const { - return m_elementName; -} - -uint32_t CXFA_Object::GetClassHashCode() const { - return m_elementNameHash; -} - -XFA_Element CXFA_Object::GetElementType() const { - return m_elementType; -} - void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { @@ -71,3 +61,27 @@ void CXFA_Object::ThrowException(const wchar_t* str, ...) const { va_end(arg_ptr); FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); } + +CXFA_Node* CXFA_Object::AsNode() { + return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr; +} + +CXFA_NodeList* CXFA_Object::AsNodeList() { + return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr; +} + +const CXFA_Node* CXFA_Object::AsNode() const { + return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr; +} + +const CXFA_NodeList* CXFA_Object::AsNodeList() const { + return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr; +} + +CXFA_Node* ToNode(CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} + +const CXFA_Node* ToNode(const CXFA_Object* pObj) { + return pObj ? pObj->AsNode() : nullptr; +} diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h new file mode 100644 index 0000000000..9596453712 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_object.h @@ -0,0 +1,100 @@ +// Copyright 2017 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_PARSER_CXFA_OBJECT_H_ +#define XFA_FXFA_PARSER_CXFA_OBJECT_H_ + +#include "core/fxcrt/fx_string.h" +#include "fxjs/fxjse.h" +#include "xfa/fxfa/fxfa_basic.h" + +enum class XFA_ObjectType { + Object, + List, + NodeList, + Node, + NodeC, + NodeV, + ModelNode, + TextNode, + ContainerNode, + ContentNode, + VariablesThis +}; + +class CFXJSE_Value; +class CXFA_Document; +class CXFA_Node; +class CXFA_NodeList; + +class CXFA_Object : public CFXJSE_HostObject { + public: + CXFA_Object(CXFA_Document* pDocument, + XFA_ObjectType objectType, + XFA_Element eType, + const CFX_WideStringC& elementName); + ~CXFA_Object() override; + + CXFA_Document* GetDocument() const { return m_pDocument; } + XFA_ObjectType GetObjectType() const { return m_objectType; } + + bool IsNode() const { + return m_objectType == XFA_ObjectType::Node || + m_objectType == XFA_ObjectType::NodeC || + m_objectType == XFA_ObjectType::NodeV || + m_objectType == XFA_ObjectType::ModelNode || + m_objectType == XFA_ObjectType::TextNode || + m_objectType == XFA_ObjectType::ContainerNode || + m_objectType == XFA_ObjectType::ContentNode || + m_objectType == XFA_ObjectType::VariablesThis; + } + bool IsNodeList() const { return m_objectType == XFA_ObjectType::NodeList; } + bool IsContentNode() const { + return m_objectType == XFA_ObjectType::ContentNode; + } + bool IsContainerNode() const { + return m_objectType == XFA_ObjectType::ContainerNode; + } + bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; } + bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; } + bool IsVariablesThis() const { + return m_objectType == XFA_ObjectType::VariablesThis; + } + + CXFA_Node* AsNode(); + CXFA_NodeList* AsNodeList(); + + const CXFA_Node* AsNode() const; + const CXFA_NodeList* AsNodeList() const; + + XFA_Element GetElementType() const { return m_elementType; } + CFX_WideStringC GetClassName() const { return m_elementName; } + uint32_t GetClassHashCode() const { return m_elementNameHash; } + + void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, + bool bSetting, + XFA_ATTRIBUTE eAttribute); + + void ThrowInvalidPropertyException() const; + void ThrowArgumentMismatchException() const; + void ThrowIndexOutOfBoundsException() const; + void ThrowParamCountMismatchException(const CFX_WideString& method) const; + + protected: + void ThrowException(const wchar_t* str, ...) const; + + CXFA_Document* const m_pDocument; + const XFA_ObjectType m_objectType; + const XFA_Element m_elementType; + + const uint32_t m_elementNameHash; + const CFX_WideStringC m_elementName; +}; + +CXFA_Node* ToNode(CXFA_Object* pObj); +const CXFA_Node* ToNode(const CXFA_Object* pObj); + +#endif // XFA_FXFA_PARSER_CXFA_OBJECT_H_ diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occur.cpp index a8994223f9..ddce8d6422 100644 --- a/xfa/fxfa/parser/cxfa_occur.cpp +++ b/xfa/fxfa/parser/cxfa_occur.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp index 3fe4b68f05..c3d55f2164 100644 --- a/xfa/fxfa/parser/cxfa_para.cpp +++ b/xfa/fxfa/parser/cxfa_para.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 391e63aac5..51487a1e2b 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -15,9 +15,10 @@ #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" +#include "xfa/fxfa/parser/cxfa_object.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.h b/xfa/fxfa/parser/cxfa_resolveprocessor.h index a44282a43d..f4eafea023 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.h +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h @@ -10,7 +10,6 @@ #include <memory> #include <vector> -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" class CXFA_NodeHelper; diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp index 16f65f99f4..ccd1997c47 100644 --- a/xfa/fxfa/parser/cxfa_script.cpp +++ b/xfa/fxfa/parser/cxfa_script.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_script.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index d62027ef03..37f59bd71b 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -18,10 +18,13 @@ #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" +#include "xfa/fxfa/parser/cxfa_nodelist.h" +#include "xfa/fxfa/parser/cxfa_object.h" #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" +#include "xfa/fxfa/parser/cxfa_thisproxy.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 70791b6932..a4a785c98e 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -14,6 +14,7 @@ #include "xfa/fxfa/cxfa_checksumcontext.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_widetextread.h" #include "xfa/fxfa/parser/cxfa_xml_parser.h" #include "xfa/fxfa/parser/xfa_basic_data.h" diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 2faad24a97..2e1ef12ce5 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -7,7 +7,8 @@ #include "xfa/fxfa/parser/cxfa_stroke.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/xfa_utils.h" int32_t CXFA_Stroke::GetPresence() const { return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Presence) diff --git a/xfa/fxfa/parser/cxfa_submit.cpp b/xfa/fxfa/parser/cxfa_submit.cpp index 50bef1e811..e390e6314b 100644 --- a/xfa/fxfa/parser/cxfa_submit.cpp +++ b/xfa/fxfa/parser/cxfa_submit.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_submit.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Submit::CXFA_Submit(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_text.cpp b/xfa/fxfa/parser/cxfa_text.cpp index fc7d7aa280..192a4deac4 100644 --- a/xfa/fxfa/parser/cxfa_text.cpp +++ b/xfa/fxfa/parser/cxfa_text.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_text.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp index bf6f12c804..2938c1fb3f 100644 --- a/xfa/fxfa/parser/cxfa_thisproxy.cpp +++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp @@ -4,7 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_thisproxy.h" + +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) : CXFA_Object(pThisNode->GetDocument(), @@ -18,11 +20,3 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) } CXFA_ThisProxy::~CXFA_ThisProxy() {} - -CXFA_Node* CXFA_ThisProxy::GetThisNode() const { - return m_pThisNode; -} - -CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { - return m_pScriptNode; -} diff --git a/xfa/fxfa/parser/cxfa_thisproxy.h b/xfa/fxfa/parser/cxfa_thisproxy.h new file mode 100644 index 0000000000..4bb0f5a1b5 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_thisproxy.h @@ -0,0 +1,27 @@ +// Copyright 2017 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_PARSER_CXFA_THISPROXY_H_ +#define XFA_FXFA_PARSER_CXFA_THISPROXY_H_ + +#include "xfa/fxfa/parser/cxfa_object.h" + +class CXFA_Node; + +class CXFA_ThisProxy : public CXFA_Object { + public: + CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); + ~CXFA_ThisProxy() override; + + CXFA_Node* GetThisNode() const { return m_pThisNode; } + CXFA_Node* GetScriptNode() const { return m_pScriptNode; } + + private: + CXFA_Node* m_pThisNode; + CXFA_Node* m_pScriptNode; +}; + +#endif // XFA_FXFA_PARSER_CXFA_THISPROXY_H_ diff --git a/xfa/fxfa/parser/cxfa_tooltip.cpp b/xfa/fxfa/parser/cxfa_tooltip.cpp index afe0e224af..f3de7aa591 100644 --- a/xfa/fxfa/parser/cxfa_tooltip.cpp +++ b/xfa/fxfa/parser/cxfa_tooltip.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_tooltip.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h b/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h new file mode 100644 index 0000000000..d507c262fe --- /dev/null +++ b/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h @@ -0,0 +1,33 @@ +// Copyright 2017 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_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_ +#define XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_ + +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/xfa_utils.h" + +class CXFA_TraverseStrategy_XFAContainerNode { + public: + static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, + XFA_ObjectType::ContainerNode); + } + static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, + XFA_ObjectType::ContainerNode); + } + static CXFA_Node* GetParent(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent, + XFA_ObjectType::ContainerNode); + } +}; + +typedef CXFA_NodeIteratorTemplate<CXFA_Node, + CXFA_TraverseStrategy_XFAContainerNode> + CXFA_ContainerIterator; + +#endif // XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_ diff --git a/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h b/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h new file mode 100644 index 0000000000..b6fb156cb9 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h @@ -0,0 +1,28 @@ +// Copyright 2017 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_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_ +#define XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_ + +#include "xfa/fxfa/parser/xfa_utils.h" + +class CXFA_TraverseStrategy_XFANode { + public: + static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); + } + static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling); + } + static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) { + return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent); + } +}; + +typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> + CXFA_NodeIterator; + +#endif // XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_ diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index 5706d96aaa..712d0f2829 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -6,7 +6,8 @@ #include "xfa/fxfa/parser/cxfa_validate.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/xfa_utils.h" CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index 4d467aee2c..4f166d5d42 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_value.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" XFA_Element CXFA_Value::GetChildValueClassID() { if (!m_pNode) diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 6da501b4a3..d98b86c086 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -14,7 +14,8 @@ #include "xfa/fxfa/parser/cxfa_event.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/xfa_utils.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 1caecea2b2..fb940f4e20 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -21,7 +21,6 @@ #include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_validate.h" -#include "xfa/fxfa/parser/xfa_object.h" enum XFA_CHECKSTATE { XFA_CHECKSTATE_On = 0, diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp index cbac7772a2..aa5c942ef3 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.cpp +++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_nodelocale.h" #include "xfa/fxfa/parser/cxfa_timezoneprovider.h" -#include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData) diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h index 7616c115a1..592b0b5bab 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.h +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -10,7 +10,6 @@ #include <memory> #include "xfa/fgas/localization/fgas_locale.h" -#include "xfa/fxfa/parser/xfa_object.h" class CXFA_XMLLocale : public IFX_Locale { public: diff --git a/xfa/fxfa/parser/xfa_basic_data.cpp b/xfa/fxfa/parser/xfa_basic_data.cpp index fecc942c7d..8e2986fecf 100644 --- a/xfa/fxfa/parser/xfa_basic_data.cpp +++ b/xfa/fxfa/parser/xfa_basic_data.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/xfa_basic_data.h" #include "xfa/fxfa/fxfa_basic.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_object.h" const XFA_ELEMENTINFO g_XFAElementData[] = { {0x23ee3, L"ps", XFA_Element::Ps, XFA_XDPPACKET_Config, diff --git a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp index 675fb8a39a..bb8a985740 100644 --- a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp +++ b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp @@ -13,6 +13,8 @@ #include "xfa/fxfa/parser/cscript_layoutpseudomodel.h" #include "xfa/fxfa/parser/cscript_logpseudomodel.h" #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_nodelist.h" const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = { {0, 0, 0, 2, 316}, {0, 0, 2, 2, 316}, {0, 0, 4, 2, 316}, diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 7ee11beb01..e54bf4a05f 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -15,9 +15,11 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" +#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.h b/xfa/fxfa/parser/xfa_document_datamerger_imp.h index 2337502a4f..9e58678867 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.h +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.h @@ -9,7 +9,10 @@ #include <vector> -#include "xfa/fxfa/parser/xfa_object.h" +#include "xfa/fxfa/fxfa_basic.h" + +class CXFA_Document; +class CXFA_Node; CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer( CXFA_Document* pDocument, diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index fd5728e5f6..1323232f9f 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -12,8 +12,8 @@ #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/xfa_basic_data.h" -#include "xfa/fxfa/parser/xfa_object.h" namespace { |