diff options
Diffstat (limited to 'xfa/src/fxfa/src/common')
-rw-r--r-- | xfa/src/fxfa/src/common/fxfa_localevalue.h | 81 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_common.h | 19 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_debug.h | 9 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_docdata.h | 27 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_doclayout.h | 107 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_document.h | 177 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_fm2jsapi.h | 25 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_localemgr.h | 69 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_object.h | 588 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_parser.h | 37 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_script.h | 107 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_utils.h | 237 |
12 files changed, 1483 insertions, 0 deletions
diff --git a/xfa/src/fxfa/src/common/fxfa_localevalue.h b/xfa/src/fxfa/src/common/fxfa_localevalue.h new file mode 100644 index 0000000000..7e4ceed134 --- /dev/null +++ b/xfa/src/fxfa/src/common/fxfa_localevalue.h @@ -0,0 +1,81 @@ +// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FXFA_WIDGETVALUE_H
+#define _FXFA_WIDGETVALUE_H
+class IFX_Locale;
+class CFX_Unitime;
+class CXFA_LocaleMgr;
+#define XFA_VT_NULL 0
+#define XFA_VT_BOOLEAN 1
+#define XFA_VT_INTEGER 2
+#define XFA_VT_DECIMAL 4
+#define XFA_VT_FLOAT 8
+#define XFA_VT_TEXT 16
+#define XFA_VT_DATE 32
+#define XFA_VT_TIME 64
+#define XFA_VT_DATETIME 128
+class CXFA_LocaleValue : public CFX_Object
+{
+public:
+ CXFA_LocaleValue();
+ CXFA_LocaleValue(const CXFA_LocaleValue& value);
+ CXFA_LocaleValue(FX_DWORD dwType, CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(FX_DWORD dwType, const CFX_WideString& wsValue, CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(FX_DWORD dwType, const CFX_WideString& wsValue,
+ const CFX_WideString& wsFormat, IFX_Locale* pLocale, CXFA_LocaleMgr* pLocaleMgr);
+ ~CXFA_LocaleValue();
+ CXFA_LocaleValue& operator = (const CXFA_LocaleValue& value);
+
+ FX_BOOL ValidateValue(const CFX_WideString& wsValue, const CFX_WideString& wsPattern, IFX_Locale* pLocale, CFX_WideString* pMatchFormat = NULL);
+ FX_BOOL FormatPatterns(CFX_WideString& wsResult, const CFX_WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const;
+ FX_BOOL FormatSinglePattern(CFX_WideString& wsResult, const CFX_WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const;
+ FX_BOOL ValidateCanonicalValue(const CFX_WideString& wsValue, FX_DWORD dwVType);
+ FX_BOOL ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime& unDate);
+ FX_BOOL ValidateCanonicalTime(const CFX_WideString& wsTime);
+ FX_BOOL ValidateCanonicalDateTime(const CFX_WideString& wsDateTime);
+ void GetNumbericFormat(CFX_WideString &wsFormat, FX_INT32 nIntLen, FX_INT32 nDecLen, FX_BOOL bSign = TRUE);
+ FX_BOOL ValidateNumericTemp(CFX_WideString& wsNumeric, CFX_WideString& wsFormat, IFX_Locale* pLocale = NULL, FX_INT32* pos = NULL);
+
+ CFX_WideString GetValue() const;
+ FX_DWORD GetType() const;
+ void SetValue(const CFX_WideString& wsValue, FX_DWORD dwType);
+ CFX_WideString GetText() const;
+ FX_FLOAT GetNum() const;
+ FX_DOUBLE GetDoubleNum() const;
+ CFX_Unitime GetDate() const;
+ CFX_Unitime GetTime() const;
+ CFX_Unitime GetDateTime() const;
+ FX_BOOL SetText(const CFX_WideString& wsText);
+ FX_BOOL SetText(const CFX_WideString& wsText, const CFX_WideString& wsFormat, IFX_Locale* pLocale);
+ FX_BOOL SetNum(FX_FLOAT fNum);
+ FX_BOOL SetNum(const CFX_WideString& wsNum, const CFX_WideString& wsFormat, IFX_Locale* pLocale);
+ FX_BOOL SetDate(const CFX_Unitime& d);
+ FX_BOOL SetDate(const CFX_WideString& wsDate, const CFX_WideString& wsFormat, IFX_Locale* pLocale);
+ FX_BOOL SetTime(const CFX_Unitime& t);
+ FX_BOOL SetTime(const CFX_WideString& wsTime, const CFX_WideString& wsFormat, IFX_Locale* pLocale);
+ FX_BOOL SetDateTime(const CFX_Unitime& dt);
+ FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, const CFX_WideString& wsFormat, IFX_Locale* pLocale);
+ inline FX_BOOL IsNull() const
+ {
+ return m_dwType == XFA_VT_NULL;
+ }
+ inline FX_BOOL IsEmpty() const
+ {
+ return m_wsValue.IsEmpty();
+ }
+ inline FX_BOOL IsValid() const
+ {
+ return m_bValid;
+ }
+protected:
+ FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, const CFX_WideString& wsPattern, IFX_Locale* pLocale);
+ CXFA_LocaleMgr* m_pLocaleMgr;
+ CFX_WideString m_wsValue;
+ FX_DWORD m_dwType;
+ FX_BOOL m_bValid;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_common.h b/xfa/src/fxfa/src/common/xfa_common.h new file mode 100644 index 0000000000..b7bafa7505 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_common.h @@ -0,0 +1,19 @@ +// 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_COMMON_H_
+#define _XFA_COMMON_H_
+#include "xfa_utils.h"
+#include "xfa_object.h"
+#include "xfa_document.h"
+#include "xfa_parser.h"
+#include "xfa_script.h"
+#include "xfa_docdata.h"
+#include "xfa_doclayout.h"
+#include "xfa_debug.h"
+#include "xfa_localemgr.h"
+#include "xfa_fm2jsapi.h"
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_debug.h b/xfa/src/fxfa/src/common/xfa_debug.h new file mode 100644 index 0000000000..dee70a688e --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_debug.h @@ -0,0 +1,9 @@ +// 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_COMMON_DEBUG_H_
+#define _XFA_COMMON_DEBUG_H_
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_docdata.h b/xfa/src/fxfa/src/common/xfa_docdata.h new file mode 100644 index 0000000000..9e9c8d1a12 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_docdata.h @@ -0,0 +1,27 @@ +// 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_DOCDATA_H
+#define _XFA_DOCDATA_H
+enum XFA_DATAFORMAT {
+ XFA_DATAFORMAT_XDP,
+};
+class IXFA_PacketExport
+{
+public:
+ static IXFA_PacketExport* Create(CXFA_Document *pDocument, XFA_DATAFORMAT eFormat = XFA_DATAFORMAT_XDP);
+ virtual void Release() = 0;
+ virtual FX_BOOL Export(IFX_FileWrite *pWrite) = 0;
+ virtual FX_BOOL Export(IFX_FileWrite *pWrite, CXFA_Node *pNode, FX_DWORD dwFlag = 0, FX_LPCSTR pChecksum = NULL) = 0;
+};
+class IXFA_PacketImport
+{
+public:
+ static IXFA_PacketImport* Create(CXFA_Document *pDstDoc);
+ virtual void Release() = 0;
+ virtual FX_BOOL ImportData(IFX_FileRead* pDataDocument) = 0;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_doclayout.h b/xfa/src/fxfa/src/common/xfa_doclayout.h new file mode 100644 index 0000000000..3d6df9f199 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_doclayout.h @@ -0,0 +1,107 @@ +// 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_DOCLAYOUT_H_
+#define _XFA_DOCLAYOUT_H_
+#define _XFA_LAYOUTITEM_ProcessCACHE_
+class CXFA_LayoutItem;
+class IXFA_LayoutPage;
+class CXFA_LayoutItem
+{
+public:
+ IXFA_LayoutPage* GetPage() const;
+ CXFA_Node* GetFormNode() const;
+ void GetRect(CFX_RectF &rtLayout, FX_BOOL bRelative = FALSE) const;
+ FX_INT32 GetIndex() const;
+ FX_INT32 GetCount() const;
+ CXFA_LayoutItem* GetParent() const;
+ CXFA_LayoutItem* GetFirst() const;
+ CXFA_LayoutItem* GetPrev() const;
+ CXFA_LayoutItem* GetNext() const;
+ CXFA_LayoutItem* GetLast() const;
+};
+class CXFA_LayoutItemImpl : public CFX_Object
+{
+public:
+ CXFA_LayoutItemImpl(CXFA_Node *pNode, FX_BOOL bIsContentLayoutItem);
+ virtual ~CXFA_LayoutItemImpl();
+ FX_BOOL IsContentLayoutItem()
+ {
+ return m_bIsContentLayoutItem;
+ }
+ void AddChild(CXFA_LayoutItemImpl *pChildItem);
+ void AddHeadChild(CXFA_LayoutItemImpl *pChildItem);
+ void RemoveChild(CXFA_LayoutItemImpl *pChildItem);
+ void InsertChild(CXFA_LayoutItemImpl *pBeforeItem, CXFA_LayoutItemImpl *pChildItem);
+public:
+ CXFA_Node* m_pFormNode;
+ CXFA_LayoutItemImpl* m_pParent;
+ CXFA_LayoutItemImpl* m_pNextSibling;
+ CXFA_LayoutItemImpl* m_pFirstChild;
+ FX_BOOL m_bIsContentLayoutItem;
+};
+class CXFA_ContainerLayoutItemImpl : public CXFA_LayoutItemImpl
+{
+public:
+ CXFA_ContainerLayoutItemImpl(CXFA_Node *pNode);
+public:
+ CXFA_Node* m_pOldSubform;
+};
+#define XFA_WIDGETSTATUS_Access 0x80000000
+#define XFA_WIDGETSTATUS_Disabled 0x40000000
+#define XFA_WIDGETSTATUS_RectCached 0x20000000
+#define XFA_WIDGETSTATUS_ButtonDown 0x10000000
+#define XFA_WIDGETSTATUS_Highlight 0x08000000
+#define XFA_WIDGETSTATUS_TextEditValueChanged 0x04000000
+class CXFA_ContentLayoutItemImpl : public CXFA_LayoutItemImpl
+{
+public:
+ CXFA_ContentLayoutItemImpl(CXFA_Node *pNode);
+ virtual ~CXFA_ContentLayoutItemImpl();
+public:
+ CXFA_ContentLayoutItemImpl* m_pPrev;
+ CXFA_ContentLayoutItemImpl* m_pNext;
+ CFX_PointF m_sPos;
+ CFX_SizeF m_sSize;
+ FX_DWORD m_dwStatus;
+};
+class CXFA_TraverseStrategy_LayoutItem
+{
+public:
+ static inline CXFA_LayoutItem* GetFirstChild(CXFA_LayoutItem* pLayoutItem)
+ {
+ return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)->m_pFirstChild;
+ }
+ static inline CXFA_LayoutItem* GetNextSibling(CXFA_LayoutItem* pLayoutItem)
+ {
+ return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)->m_pNextSibling;
+ }
+ static inline CXFA_LayoutItem* GetParent(CXFA_LayoutItem* pLayoutItem)
+ {
+ return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)->m_pParent;
+ }
+};
+class IXFA_LayoutPage
+{
+public:
+ IXFA_DocLayout* GetLayout() const;
+ FX_INT32 GetPageIndex() const;
+ void GetPageSize(CFX_SizeF &size);
+ CXFA_Node* GetMasterPage() const;
+};
+class IXFA_DocLayout
+{
+public:
+ virtual CXFA_Document* GetDocument() const = 0;
+ virtual FX_INT32 StartLayout(FX_BOOL bForceRestart = FALSE) = 0;
+ virtual FX_INT32 DoLayout(IFX_Pause *pPause = NULL) = 0;
+ virtual FX_BOOL IncrementLayout() = 0;
+ virtual FX_INT32 CountPages() const = 0;
+ virtual IXFA_LayoutPage* GetPage(FX_INT32 index) const = 0;
+
+ virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node *pFormItem) = 0;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h new file mode 100644 index 0000000000..502aa2591a --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_document.h @@ -0,0 +1,177 @@ +// 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_DOCUMENT_H
+#define _XFA_DOCUMENT_H
+class IXFA_DocParser;
+class CXFA_LayoutProcessor;
+class IXFA_DocLayout;
+class IXFA_LayoutPage;
+class CXFA_LayoutItem;
+class IXFA_PageContent;
+class IXFA_ScriptContext;
+class CXFA_Node;
+class IXFA_Notify;
+class IXFA_ObjFactory;
+class CXFA_Document;
+enum XFA_VERSION {
+ XFA_VERSION_UNKNOWN = 0,
+ XFA_VERSION_200 = 200,
+ XFA_VERSION_202 = 202,
+ XFA_VERSION_204 = 204,
+ XFA_VERSION_205 = 205,
+ XFA_VERSION_206 = 206,
+ XFA_VERSION_207 = 207,
+ XFA_VERSION_208 = 208,
+ XFA_VERSION_300 = 300,
+ XFA_VERSION_301 = 301,
+ XFA_VERSION_303 = 303,
+ XFA_VERSION_306 = 306,
+ XFA_VERSION_DEFAULT = XFA_VERSION_303,
+ XFA_VERSION_MIN = 200,
+ XFA_VERSION_MAX = 400,
+};
+#define XFA_LAYOUTSTATUS_Visible 0x0001
+#define XFA_LAYOUTSTATUS_Viewable 0x0010
+#define XFA_LAYOUTSTATUS_Printable 0x0020
+enum XFA_NODEEVENT {
+ XFA_NODEEVENT_Ready,
+ XFA_NODEEVENT_ValueChanging,
+ XFA_NODEEVENT_ValueChanged,
+ XFA_NODEEVENT_ChildAdded,
+ XFA_NODEEVENT_ChildRemoved,
+};
+enum XFA_PAGEEVENT {
+ XFA_PAGEEVENT_PageAdded,
+ XFA_PAGEEVENT_PageRemoved,
+};
+enum XFA_LAYOUTEVENT {
+ XFA_LAYOUTEVENT_ItemAdded,
+ XFA_LAYOUTEVENT_ItemRemoving,
+ XFA_LAYOUTEVENT_RectChanged,
+ XFA_LAYOUTEVENT_StatusChanged,
+};
+enum XFA_LAYOUTRESULT {
+ XFA_LAYOUTRESULT_Continue,
+ XFA_LAYOUTRESULT_Done,
+ XFA_LAYOUTRESULT_NextContent,
+};
+#define XFA_LAYOUTNOTIFY_StrictHeight 0x0001
+#define XFA_LAYOUTNOTIFY_NoParentBreak 0x0002
+class IXFA_Notify
+{
+public:
+ virtual void OnPageEvent(IXFA_LayoutPage *pSender, XFA_PAGEEVENT eEvent, FX_LPVOID pParam = NULL) = 0;
+
+ virtual void OnNodeEvent(CXFA_Node *pSender, XFA_NODEEVENT eEvent, FX_LPVOID pParam = NULL, FX_LPVOID pParam2 = NULL, FX_LPVOID pParam3 = NULL, FX_LPVOID pParam4 = NULL) = 0;
+ virtual void OnWidgetDataEvent(CXFA_WidgetData* pSender, FX_DWORD dwEvent, FX_LPVOID pParam = NULL, FX_LPVOID pAdditional = NULL, FX_LPVOID pAdditional2 = NULL) = 0;
+
+ virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node *pNode) = 0;
+ virtual void OnLayoutEvent(IXFA_DocLayout *pLayout, CXFA_LayoutItem *pSender, XFA_LAYOUTEVENT eEvent, FX_LPVOID pParam = NULL, FX_LPVOID pParam2 = NULL) = 0;
+ virtual void StartFieldDrawLayout(CXFA_Node *pItem, FX_FLOAT &fCalcWidth, FX_FLOAT &fCalcHeight) = 0;
+ virtual FX_BOOL FindSplitPos(CXFA_Node *pItem, FX_INT32 iBlockIndex, FX_FLOAT &fCalcHeightPos) = 0;
+ virtual FX_BOOL RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) = 0;
+ virtual FX_INT32 ExecEventByDeepFirst(CXFA_Node* pFormNode, XFA_EVENTTYPE eEventType, FX_BOOL bIsFormReady = FALSE, FX_BOOL bRecursive = TRUE, CXFA_WidgetAcc* pExclude = NULL) = 0;
+ virtual void AddCalcValidate(CXFA_Node* pNode) = 0;
+ virtual XFA_HDOC GetHDOC() = 0;
+ virtual IXFA_DocProvider* GetDocProvider() = 0;
+ virtual IXFA_AppProvider* GetAppProvider() = 0;
+ virtual IXFA_WidgetHandler* GetWidgetHandler() = 0;
+ virtual XFA_HWIDGET GetHWidget(CXFA_LayoutItem* pLayoutItem) = 0;
+ virtual void OpenDropDownList(XFA_HWIDGET hWidget) = 0;
+ virtual CFX_WideString GetCurrentDateTime() = 0;
+ virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL) = 0;
+ virtual FX_INT32 GetLayoutStatus() = 0;
+ virtual void RunNodeInitialize(CXFA_Node* pNode) = 0;
+ virtual void RunSubformIndexChange(CXFA_Node* pSubformNode) = 0;
+ virtual CXFA_Node* GetFocusWidgetNode() = 0;
+ virtual void SetFocusWidgetNode(CXFA_Node* pNode) = 0;
+};
+class IXFA_ObjFactory
+{
+public:
+ virtual CXFA_Node* CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement) = 0;
+ virtual CXFA_Node* CreateNode(XFA_LPCPACKETINFO pPacket, XFA_ELEMENT eElement) = 0;
+};
+#define XFA_DOCFLAG_StrictScoping 0x0001
+#define XFA_DOCFLAG_HasInteractive 0x0002
+#define XFA_DOCFLAG_Interactive 0x0004
+#define XFA_DOCFLAG_Scripting 0x0008
+class CScript_DataWindow;
+class CScript_EventPseudoModel;
+class CScript_HostPseudoModel;
+class CScript_LogPseudoModel;
+class CScript_LayoutPseudoModel;
+class CScript_SignaturePseudoModel;
+class CXFA_Document : public IXFA_ObjFactory, public CFX_Object
+{
+public:
+ CXFA_Document(IXFA_DocParser *pParser);
+ ~CXFA_Document();
+ CXFA_Node* GetRoot() const
+ {
+ return m_pRootNode;
+ }
+ IXFA_DocParser* GetParser() const
+ {
+ return m_pParser;
+ }
+ IXFA_Notify* GetNotify() const;
+ void SetRoot(CXFA_Node* pNewRoot);
+ CXFA_Object* GetXFANode(FX_WSTR wsNodeName);
+ CXFA_Object* GetXFANode(FX_DWORD wsNodeNameHash);
+ void AddPurgeNode(CXFA_Node *pNode);
+ FX_BOOL RemovePurgeNode(CXFA_Node *pNode);
+ void PurgeNodes();
+ FX_BOOL HasFlag(FX_DWORD dwFlag)
+ {
+ return (m_dwDocFlags & dwFlag) == dwFlag;
+ }
+ void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE);
+ FX_BOOL IsInteractive();
+ XFA_VERSION GetCurVersionMode()
+ {
+ return m_eCurVersionMode;
+ }
+ XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS);
+ CXFA_LocaleMgr* GetLocalMgr();
+ virtual CXFA_Node* CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement);
+ virtual CXFA_Node* CreateNode(XFA_LPCPACKETINFO pPacket, XFA_ELEMENT eElement);
+ void DoProtoMerge();
+ CXFA_Node* GetNodeByID(CXFA_Node* pRoot, FX_WSTR wsID);
+
+ void DoDataMerge();
+ void DoDataRemerge(FX_BOOL bDoDataMerge);
+ CXFA_Node* DataMerge_CopyContainer(CXFA_Node* pTemplateNode, CXFA_Node* pFormNode, CXFA_Node* pDataScope, FX_BOOL bOneInstance = FALSE, FX_BOOL bDataMerge = TRUE, FX_BOOL bUpLevel = TRUE);
+ void DataMerge_UpdateBindingRelations(CXFA_Node* pFormUpdateRoot);
+ CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes);
+ CXFA_LayoutProcessor* GetLayoutProcessor();
+ IXFA_DocLayout* GetDocLayout();
+ IXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime);
+ IXFA_ScriptContext* GetScriptContext();
+ void ClearLayoutData();
+public:
+ CFX_MapPtrTemplate<FX_DWORD, CXFA_Node*> m_rgGlobalBinding;
+ CXFA_NodeArray m_pPendingPageSet;
+protected:
+ IXFA_DocParser* m_pParser;
+ IXFA_ScriptContext* m_pScriptContext;
+ CXFA_LayoutProcessor* m_pLayoutProcessor;
+ CXFA_Node* m_pRootNode;
+
+ CXFA_LocaleMgr* m_pLocalMgr;
+ CScript_DataWindow* m_pScriptDataWindow;
+ CScript_EventPseudoModel* m_pScriptEvent;
+ CScript_HostPseudoModel* m_pScriptHost;
+ CScript_LogPseudoModel* m_pScriptLog;
+ CScript_LayoutPseudoModel* m_pScriptLayout;
+ CScript_SignaturePseudoModel* m_pScriptSignature;
+ CXFA_NodeSet m_rgPurgeNodes;
+ XFA_VERSION m_eCurVersionMode;
+ FX_DWORD m_dwDocFlags;
+ friend class CXFA_SimpleParser;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_fm2jsapi.h b/xfa/src/fxfa/src/common/xfa_fm2jsapi.h new file mode 100644 index 0000000000..499ceca4e3 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_fm2jsapi.h @@ -0,0 +1,25 @@ +// 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_FM2JS_API_H
+#define _XFA_FM2JS_API_H
+#define FOXIT_XFA_FM2JS_FORMCALC_RUNTIME "foxit_xfa_formcalc_runtime"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+FX_DEFINEHANDLE(XFA_HFM2JSCONTEXT)
+FX_INT32 XFA_FM2JS_Translate(FX_WSTR wsFormcalc, CFX_WideTextBuf& wsJavascript, CFX_WideString& wsError);
+XFA_HFM2JSCONTEXT XFA_FM2JS_ContextCreate();
+void XFA_FM2JS_ContextInitialize(XFA_HFM2JSCONTEXT hFM2JSContext, FXJSE_HRUNTIME hScriptRuntime,
+ FXJSE_HCONTEXT hScriptContext,
+ CXFA_Document* pDocument);
+void XFA_FM2JS_GlobalPropertyGetter(XFA_HFM2JSCONTEXT hFM2JSContext, FXJSE_HVALUE hValue);
+void XFA_FM2JS_ContextRelease(XFA_HFM2JSCONTEXT hFM2JSContext);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_localemgr.h b/xfa/src/fxfa/src/common/xfa_localemgr.h new file mode 100644 index 0000000000..f425a903fc --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_localemgr.h @@ -0,0 +1,69 @@ +// 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 _FXFA_LOCALEMGR_H
+#define _FXFA_LOCALEMGR_H
+class CXFA_Node;
+class IFX_Locale;
+class IFX_LocaleMgr;
+class CXFA_LocaleMgr;
+#define XFA_LANGID_zh_CN 0x0804
+#define XFA_LANGID_zh_TW 0x0404
+#define XFA_LANGID_zh_HK 0x0c04
+#define XFA_LANGID_ja_JP 0x0411
+#define XFA_LANGID_ko_KR 0x0412
+#define XFA_LANGID_en_US 0x0409
+#define XFA_LANGID_en_GB 0x0809
+#define XFA_LANGID_es_ES 0x0c0a
+#define XFA_LANGID_es_LA 0x080a
+#define XFA_LANGID_de_DE 0x0407
+#define XFA_LANGID_fr_FR 0x040c
+#define XFA_LANGID_it_IT 0x0410
+#define XFA_LANGID_pt_BR 0x0416
+#define XFA_LANGID_nl_NL 0x0413
+#define XFA_LANGID_ru_RU 0x0419
+class CXFA_LocaleMgr : public IFX_LocaleMgr, public CFX_Object
+{
+public:
+ CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
+ virtual void Release();
+ virtual FX_WORD GetDefLocaleID();
+ virtual IFX_Locale* GetDefLocale();
+ virtual IFX_Locale* GetLocale(FX_WORD lcid);
+ virtual IFX_Locale* GetLocaleByName(FX_WSTR wsLocaleName);
+ ~CXFA_LocaleMgr();
+ void SetDefLocale(IFX_Locale* pLocale);
+ CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
+protected:
+ CFX_PtrArray m_LocaleArray;
+ CFX_PtrArray m_XMLLocaleArray;
+ IFX_Locale* m_pDefLocale;
+ CFX_WideString m_wsConfigLocale;
+ FX_WORD m_dwDeflcid;
+ FX_WORD m_dwLocaleFlags;
+};
+class IXFA_TimeZoneProvider
+{
+public:
+ static IXFA_TimeZoneProvider* Create();
+ static IXFA_TimeZoneProvider* Get();
+ static void Destroy();
+
+ virtual void SetTimeZone(FX_TIMEZONE& tz) = 0;
+
+ virtual void GetTimeZone(FX_TIMEZONE& tz) = 0;
+};
+class CXFA_TimeZoneProvider : public IXFA_TimeZoneProvider, public CFX_Object
+{
+public:
+ CXFA_TimeZoneProvider();
+ ~CXFA_TimeZoneProvider();
+ virtual void SetTimeZone(FX_TIMEZONE& tz);
+ virtual void GetTimeZone(FX_TIMEZONE& tz);
+private:
+ FX_TIMEZONE m_tz;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_object.h b/xfa/src/fxfa/src/common/xfa_object.h new file mode 100644 index 0000000000..c285b9d902 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_object.h @@ -0,0 +1,588 @@ +// 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_OBJECT_H_
+#define _XFA_OBJECT_H_
+class CXFA_Document;
+class IXFA_ObjFactory;
+class IXFA_Notify;
+class CXFA_Object;
+class CXFA_OrdinaryObject;
+class CXFA_Node;
+class CXFA_NodeList;
+class CXFA_ArrayNodeList;
+class CXFA_AttachNodeList;
+enum XFA_OBJECTTYPE {
+ XFA_OBJECTTYPE_OrdinaryObject = 0x0,
+ XFA_OBJECTTYPE_OrdinaryList = 0x1,
+ XFA_OBJECTTYPE_NodeList = 0x2,
+ XFA_OBJECTTYPE_Node = 0x4,
+ XFA_OBJECTTYPE_NodeC = 0x5,
+ XFA_OBJECTTYPE_NodeV = 0x6,
+ XFA_OBJECTTYPE_ModelNode = 0x8,
+ XFA_OBJECTTYPE_TextNode = 0x9,
+ XFA_OBJECTTYPE_ContainerNode = 0xA,
+ XFA_OBJECTTYPE_ContentNode = 0xB,
+ XFA_OBJECTTYPE_VariablesThis = 0xC,
+ XFA_OBJECTTYPEMASK = 0xF,
+ XFA_NODEFLAG_Initialized = 0x00020,
+ XFA_NODEFLAG_HasRemoved = 0x00200,
+ XFA_NODEFLAG_NeedsInitApp = 0x00400,
+ XFA_NODEFLAG_BindFormItems = 0x00800,
+ XFA_NODEFLAG_UserInteractive = 0x01000,
+ XFA_NODEFLAG_SkipDataBinding = 0x02000,
+ XFA_NODEFLAG_OwnXMLNode = 0x04000,
+ XFA_NODEFLAG_UnusedNode = 0x08000,
+ XFA_NODEFLAG_LayoutGeneratedNode = 0x10000,
+};
+class CXFA_Object : public CFX_Object
+{
+public:
+ CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags);
+ inline CXFA_Document* GetDocument() const
+ {
+ return m_pDocument;
+ }
+ inline FX_DWORD GetFlag() const
+ {
+ return m_uFlags;
+ }
+ inline XFA_OBJECTTYPE GetObjectType() const
+ {
+ return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK);
+ }
+ inline FX_BOOL IsNode() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node;
+ }
+ inline FX_BOOL IsOrdinaryObject() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject;
+ }
+ inline FX_BOOL IsNodeList() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_NodeList;
+ }
+ inline FX_BOOL IsOrdinaryList() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryList;
+ }
+ FX_BOOL IsContentNode() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContentNode;
+ }
+ FX_BOOL IsContainerNode() const
+ {
+ return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContainerNode;
+ }
+ XFA_ELEMENT GetClassID() const;
+ void GetClassName(CFX_WideStringC &wsName) const;
+ FX_UINT32 GetClassHashCode() const;
+ void Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void ThrowScriptErrorMessage(FX_INT32 iStringID, ...);
+protected:
+ CXFA_Document *m_pDocument;
+ FX_DWORD m_uFlags;
+};
+#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 CFX_StackTemplate<CXFA_Node*> CXFA_NodeStack;
+typedef CXFA_PtrSetTemplate<CXFA_Node*> CXFA_NodeSet;
+typedef void (*PD_CALLBACK_DUPLICATEDATA)(FX_LPVOID& pData);
+typedef struct _XFA_MAPDATABLOCKCALLBACKINFO {
+ PD_CALLBACK_FREEDATA pFree;
+ PD_CALLBACK_DUPLICATEDATA pCopy;
+} XFA_MAPDATABLOCKCALLBACKINFO;
+typedef struct _XFA_MAPDATABLOCK : public CFX_Object {
+ FX_LPBYTE GetData() const
+ {
+ return (FX_LPBYTE)this + sizeof(_XFA_MAPDATABLOCK);
+ }
+ XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo;
+ FX_INT32 iBytes;
+} XFA_MAPDATABLOCK, * XFA_LPMAPDATABLOCK;
+typedef struct _XFA_MAPMODULEDATA : public CFX_Object {
+ CFX_MapPtrToPtr m_ValueMap;
+ CFX_MapPtrTemplate<FX_LPVOID, XFA_LPMAPDATABLOCK> m_BufferMap;
+} XFA_MAPMODULEDATA, * XFA_LPMAPMODULEDATA;
+#define XFA_CalcRefCount (FX_LPVOID)(FX_UINTPTR)FXBSTR_ID('X', 'F', 'A', 'R')
+#define XFA_CalcData (FX_LPVOID)(FX_UINTPTR)FXBSTR_ID('X', 'F', 'A', 'C')
+#define XFA_LAYOUTITEMKEY (FX_LPVOID)(FX_UINTPTR)FXBSTR_ID('L', 'Y', 'I', 'M')
+class CXFA_Node : public CXFA_Object
+{
+public:
+ XFA_ELEMENT GetClassID() const
+ {
+ return (XFA_ELEMENT)m_eNodeClass;
+ }
+ FX_DWORD GetPacketID() const
+ {
+ return m_ePacket;
+ }
+ FX_BOOL HasFlag(FX_DWORD dwFlag) const;
+ void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE, FX_BOOL bNotify = TRUE);
+ FX_BOOL IsAttributeInXML();
+ FX_BOOL IsFormContainer()
+ {
+ return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
+ }
+ void SetXMLMappingNode(IFDE_XMLNode* pXMLNode)
+ {
+ m_pXMLNode = pXMLNode;
+ }
+ IFDE_XMLNode* GetXMLMappingNode() const
+ {
+ return m_pXMLNode;
+ }
+ IFDE_XMLNode* CreateXMLMappingNode();
+ FX_BOOL IsNeedSavingXMLNode();
+ inline FX_DWORD GetNameHash() const
+ {
+ return m_dwNameHash;
+ }
+ inline FX_BOOL IsUnnamed() const
+ {
+ return m_dwNameHash == 0;
+ }
+ CXFA_Node* GetModelNode();
+ void UpdateNameHash();
+ FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE);
+ FX_BOOL SetAttribute(XFA_ATTRIBUTE eAttr, FX_WSTR wsValue, FX_BOOL bNotify = FALSE);
+ FX_BOOL GetAttribute(XFA_ATTRIBUTE eAttr, CFX_WideString &wsValue, FX_BOOL bUseDefault = TRUE);
+ FX_BOOL SetAttribute(FX_WSTR wsAttr, FX_WSTR wsValue, FX_BOOL bNotify = FALSE);
+ FX_BOOL GetAttribute(FX_WSTR wsAttr, CFX_WideString &wsValue, FX_BOOL bUseDefault = TRUE);
+ FX_BOOL RemoveAttribute(FX_WSTR wsAttr);
+ FX_BOOL SetContent(const CFX_WideString& wsContent, const CFX_WideString& wsXMLValue, FX_BOOL bNotify = FALSE, FX_BOOL bScriptModify = FALSE, FX_BOOL bSyncData = TRUE);
+ FX_BOOL TryContent(CFX_WideString& wsContent, FX_BOOL bScriptModify = FALSE, FX_BOOL bProto = TRUE);
+ CFX_WideString GetContent();
+
+ FX_BOOL TryNamespace(CFX_WideString& wsNamespace);
+
+ FX_BOOL SetBoolean(XFA_ATTRIBUTE eAttr, FX_BOOL bValue, FX_BOOL bNotify = FALSE)
+ {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (FX_LPVOID)(FX_UINTPTR)bValue, bNotify);
+ }
+ FX_BOOL TryBoolean(XFA_ATTRIBUTE eAttr, FX_BOOL &bValue, FX_BOOL bUseDefault = TRUE);
+ FX_BOOL GetBoolean(XFA_ATTRIBUTE eAttr)
+ {
+ FX_BOOL bValue;
+ return TryBoolean(eAttr, bValue, TRUE) ? bValue : FALSE;
+ }
+ FX_BOOL SetInteger(XFA_ATTRIBUTE eAttr, FX_INT32 iValue, FX_BOOL bNotify = FALSE)
+ {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (FX_LPVOID)(FX_UINTPTR)iValue, bNotify);
+ }
+ FX_BOOL TryInteger(XFA_ATTRIBUTE eAttr, FX_INT32 &iValue, FX_BOOL bUseDefault = TRUE);
+ FX_INT32 GetInteger(XFA_ATTRIBUTE eAttr)
+ {
+ FX_INT32 iValue;
+ return TryInteger(eAttr, iValue, TRUE) ? iValue : 0;
+ }
+ FX_BOOL SetEnum(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTEENUM eValue, FX_BOOL bNotify = FALSE)
+ {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (FX_LPVOID)(FX_UINTPTR)eValue, bNotify);
+ }
+ FX_BOOL TryEnum(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTEENUM &eValue, FX_BOOL bUseDefault = TRUE);
+ XFA_ATTRIBUTEENUM GetEnum(XFA_ATTRIBUTE eAttr)
+ {
+ XFA_ATTRIBUTEENUM eValue;
+ return TryEnum(eAttr, eValue, TRUE) ? eValue : XFA_ATTRIBUTEENUM_Unknown;
+ }
+ FX_BOOL SetCData(XFA_ATTRIBUTE eAttr, const CFX_WideString& wsValue, FX_BOOL bNotify = FALSE, FX_BOOL bScriptModify = FALSE);
+ FX_BOOL SetAttributeValue(const CFX_WideString& wsValue, const CFX_WideString& wsXMLValue, FX_BOOL bNotify = FALSE, FX_BOOL bScriptModify = FALSE);
+ FX_BOOL TryCData(XFA_ATTRIBUTE eAttr, CFX_WideString &wsValue, FX_BOOL bUseDefault = TRUE, FX_BOOL bProto = TRUE);
+ FX_BOOL TryCData(XFA_ATTRIBUTE eAttr, CFX_WideStringC &wsValue, FX_BOOL bUseDefault = TRUE, FX_BOOL bProto = TRUE);
+ CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr)
+ {
+ CFX_WideStringC wsValue;
+ return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC();
+ }
+ FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement mValue, FX_BOOL bNotify = FALSE);
+ FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement &mValue, FX_BOOL bUseDefault = TRUE);
+ CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr)
+ {
+ CXFA_Measurement mValue;
+ return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement();
+ }
+ FX_BOOL SetObject(XFA_ATTRIBUTE eAttr, FX_LPVOID pData, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
+ FX_BOOL TryObject(XFA_ATTRIBUTE eAttr, FX_LPVOID &pData);
+ FX_LPVOID GetObject(XFA_ATTRIBUTE eAttr)
+ {
+ FX_LPVOID pData;
+ return TryObject(eAttr, pData) ? pData : NULL;
+ }
+ FX_BOOL SetUserData(FX_LPVOID pKey, FX_LPVOID pData, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
+ FX_BOOL TryUserData(FX_LPVOID pKey, FX_LPVOID &pData, FX_BOOL bProtoAlso = FALSE);
+ FX_LPVOID GetUserData(FX_LPVOID pKey, FX_BOOL bProtoAlso = FALSE)
+ {
+ FX_LPVOID pData;
+ return TryUserData(pKey, pData, bProtoAlso) ? pData : NULL;
+ }
+ CXFA_Node* GetProperty(FX_INT32 index, XFA_ELEMENT eProperty, FX_BOOL bCreateProperty = TRUE);
+ FX_INT32 CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE);
+ CXFA_Node* GetChild(FX_INT32 index, XFA_ELEMENT eElement, FX_BOOL bOnlyChild = FALSE);
+ FX_INT32 InsertChild(FX_INT32 index, CXFA_Node *pNode);
+ FX_BOOL InsertChild(CXFA_Node *pNode, CXFA_Node* pBeforeNode = NULL);
+ FX_BOOL RemoveChild(CXFA_Node *pNode, FX_BOOL bNotify = TRUE);
+ CXFA_Node* Clone(FX_BOOL bRecursive);
+ CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
+ CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const;
+ FX_INT32 GetNodeList(CXFA_NodeArray &nodes, FX_DWORD dwTypeFilter = XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties, XFA_ELEMENT eElementFilter = XFA_ELEMENT_UNKNOWN, FX_INT32 iLevel = 1);
+ CXFA_Node* CreateSamePacketNode(XFA_ELEMENT eElement, FX_DWORD dwFlags = XFA_NODEFLAG_Initialized);
+ CXFA_Node* CloneTemplateToForm(FX_BOOL bRecursive);
+ CXFA_Node* GetTemplateNode();
+ void SetTemplateNode(CXFA_Node* pTemplateNode);
+ CXFA_Node* GetDataDescriptionNode();
+ void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode);
+ CXFA_Node* GetBindData();
+ FX_INT32 GetBindItems(CXFA_NodeArray& formItems);
+ FX_INT32 AddBindItem(CXFA_Node* pFormNode);
+ FX_INT32 RemoveBindItem(CXFA_Node* pFormNode);
+ FX_BOOL HasBindItem();
+ CXFA_WidgetData* GetWidgetData();
+ CXFA_WidgetData* GetContainerWidgetData();
+ FX_BOOL GetLocaleName(CFX_WideString& wsLocaleName);
+ XFA_ATTRIBUTEENUM GetIntact();
+ CXFA_Node* GetFirstChildByName(FX_WSTR wsNodeName) const;
+ CXFA_Node* GetFirstChildByName(FX_DWORD dwNodeNameHash) const;
+ CXFA_Node* GetFirstChildByClass(XFA_ELEMENT eNodeClass) const;
+ CXFA_Node* GetNextSameNameSibling(FX_DWORD dwNodeNameHash) const;
+ CXFA_Node* GetNextSameNameSibling(FX_WSTR wsNodeName) const;
+ CXFA_Node* GetNextSameClassSibling(XFA_ELEMENT eNodeClass) const;
+ FX_INT32 GetNodeSameNameIndex() const;
+ FX_INT32 GetNodeSameClassIndex() const;
+ void GetSOMExpression(CFX_WideString& wsSOMExpression);
+ CXFA_Node* GetInstanceMgrOfSubform();
+
+
+ CXFA_Node* GetOccurNode();
+ void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
+ void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
+ void Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, CFX_WideString wsExpression, FX_DWORD dwFlag, CXFA_Node* refNode = NULL);
+ void Script_TreeClass_All(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Nodes(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Parent(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Index(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_ClassIndex(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_SomExpression(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_Clone(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_IsPropertySpecified(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_Ns(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_Model(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_IsContainer(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_IsNull(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_OneOfChild(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments);
+ void Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_Context(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_ModelClass_AliasNode(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments);
+ void Script_Delta_Restore(CFXJSE_Arguments* pArguments);
+ void Script_Delta_CurrentValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Delta_SavedValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Delta_Target(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_SendAttributeChangeMessage(FX_LPVOID eAttribute, FX_LPVOID eValue, FX_BOOL bScriptModify);
+ void Script_Attribute_Integer(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_IntegerRead(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_BOOL(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_BOOLRead(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_String(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_StringRead(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_ValidationMessage(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_Length(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DefaultValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Boolean_Value(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_Message(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_SOM_MESSAGETYPE iMessageType);
+ void Script_Som_BorderColor(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_BorderWidth(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_FillColor(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DataNode(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_FontColor(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_Mandatory(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_MandatoryMessage(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Som_InstanceIndex(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Draw_DefaultValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_DefaultValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_EditValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_FormatMessage(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_FormattedValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_ParentSubform(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_SelectedIndex(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Field_ClearItems(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Field_DeleteItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_BoundItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetItemState(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Field_SetItems(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_SetItemState(CFXJSE_Arguments* pArguments);
+ void Script_Field_AddItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_DefaultAndRawValue(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_ErrorText(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_Transient(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_InstanceManager(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Subform_Locale(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments);
+
+ FX_INT32 Subform_and_SubformSet_InstanceIndex();
+ void Script_Template_FormNodes(CFXJSE_Arguments* pArguments);
+ void Script_Template_Remerge(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Template_CreateNode(CFXJSE_Arguments* pArguments);
+ void Script_Template_Recalculate(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_Count(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_Max(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_Min(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_MoveInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_RemoveInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_SetInstances(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_AddInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_InsertInstance(CFXJSE_Arguments* pArguments);
+ FX_INT32 InstanceManager_SetInstances(FX_INT32 iCount);
+ FX_INT32 InstanceManager_MoveInstance(FX_INT32 iTo, FX_INT32 iFrom);
+ void Script_Occur_Max(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Occur_Min(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Desc_Metadata(CFXJSE_Arguments* pArguments);
+ void Script_Form_FormNodes(CFXJSE_Arguments* pArguments);
+ void Script_Form_Remerge(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Form_Recalculate(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Form_Checksum(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_Content(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Source_Next(CFXJSE_Arguments* pArguments);
+ void Script_Source_CancelBatch(CFXJSE_Arguments* pArguments);
+ void Script_Source_First(CFXJSE_Arguments* pArguments);
+ void Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments);
+ void Script_Source_Previous(CFXJSE_Arguments* pArguments);
+ void Script_Source_IsBOF(CFXJSE_Arguments* pArguments);
+ void Script_Source_IsEOF(CFXJSE_Arguments* pArguments);
+ void Script_Source_Cancel(CFXJSE_Arguments* pArguments);
+ void Script_Source_Update(CFXJSE_Arguments* pArguments);
+ void Script_Source_Open(CFXJSE_Arguments* pArguments);
+ void Script_Source_Delete(CFXJSE_Arguments* pArguments);
+ void Script_Source_AddNew(CFXJSE_Arguments* pArguments);
+ void Script_Source_Requery(CFXJSE_Arguments* pArguments);
+ void Script_Source_Resync(CFXJSE_Arguments* pArguments);
+ void Script_Source_Close(CFXJSE_Arguments* pArguments);
+ void Script_Source_Last(CFXJSE_Arguments* pArguments);
+ void Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments);
+ void Script_Source_Db(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Xfa_This(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Handler_Version(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_SubmitFormat_Mode(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Extras_Type(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Encrypt_Format(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+ void Script_Script_Stateless(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+protected:
+ CXFA_Node(CXFA_Document *pDoc, FX_WORD ePacket, XFA_ELEMENT eElement);
+ ~CXFA_Node();
+ friend class CXFA_Document;
+ CXFA_Node* Deprecated_GetPrevSibling();
+ FX_BOOL SetValue(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType, FX_LPVOID pValue, FX_BOOL bNotify);
+ FX_BOOL GetValue(XFA_ATTRIBUTE eAttr, XFA_ATTRIBUTETYPE eType, FX_BOOL bUseDefault, FX_LPVOID &pValue);
+ void OnRemoved(CXFA_Node *pParent, CXFA_Node *pRemoved, FX_BOOL bNotify);
+ void OnChanging(XFA_ATTRIBUTE eAttr, FX_LPVOID pNewValue, FX_BOOL bNotify);
+ void OnChanged(XFA_ATTRIBUTE eAttr, FX_LPVOID pNewValue, FX_BOOL bNotify, FX_BOOL bScriptModify = FALSE);
+ FX_INT32 execSingleEventByName(FX_WSTR wsEventName, XFA_ELEMENT eElementType);
+ FX_BOOL SetScriptContent(const CFX_WideString& wsContent, const CFX_WideString& wsXMLValue, FX_BOOL bNotify = TRUE, FX_BOOL bScriptModify = FALSE, FX_BOOL bSyncData = TRUE);
+ CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE);
+ XFA_LPMAPMODULEDATA GetMapModuleData(FX_BOOL bCreateNew);
+ void SetMapModuleValue(FX_LPVOID pKey, FX_LPVOID pValue);
+ FX_BOOL GetMapModuleValue(FX_LPVOID pKey, FX_LPVOID &pValue);
+ void SetMapModuleString(FX_LPVOID pKey, FX_WSTR wsValue);
+ FX_BOOL GetMapModuleString(FX_LPVOID pKey, CFX_WideStringC &wsValue);
+ void SetMapModuleBuffer(FX_LPVOID pKey, FX_LPVOID pValue, FX_INT32 iBytes, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = NULL);
+ FX_BOOL GetMapModuleBuffer(FX_LPVOID pKey, FX_LPVOID &pValue, FX_INT32 &iBytes, FX_BOOL bProtoAlso = TRUE);
+ FX_BOOL HasMapModuleKey(FX_LPVOID pKey, FX_BOOL bProtoAlso = FALSE);
+ void RemoveMapModuleKey(FX_LPVOID pKey = NULL);
+ void MergeAllData(FX_LPVOID pDstModule, FX_BOOL bUseSrcAttr = TRUE);
+ void MoveBufferMapData(CXFA_Node* pDstModule, FX_LPVOID pKey);
+ void MoveBufferMapData(CXFA_Node* pSrcModule, CXFA_Node* pDstModule, FX_LPVOID pKey, FX_BOOL bRecursive = FALSE);
+protected:
+ CXFA_Node *m_pNext;
+ CXFA_Node *m_pChild;
+ CXFA_Node *m_pLastChild;
+ CXFA_Node *m_pParent;
+ IFDE_XMLNode *m_pXMLNode;
+ XFA_ELEMENT m_eNodeClass;
+ FX_WORD m_ePacket;
+ FX_DWORD m_dwNameHash;
+ CXFA_Node *m_pAuxNode;
+ XFA_LPMAPMODULEDATA m_pMapModuleData;
+};
+class CXFA_OrdinaryObject : public CXFA_Object
+{
+public:
+ CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), m_uScriptHash(0)
+ {
+ m_eNodeClass = eElement;
+ }
+ XFA_ELEMENT GetClassID() const
+ {
+ return (XFA_ELEMENT)m_eNodeClass;
+ }
+ FX_UINT32 GetScriptObjHash()
+ {
+ return m_uScriptHash;
+ }
+protected:
+ XFA_ELEMENT m_eNodeClass;
+ FX_UINT32 m_uScriptHash;
+};
+class CXFA_ThisProxy : public CXFA_Object
+{
+public :
+ CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode): CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), m_pThisNode(NULL), m_pScriptNode(NULL)
+ {
+ m_pThisNode = pThisNode;
+ m_pScriptNode = pScriptNode;
+ }
+ virtual ~CXFA_ThisProxy() {}
+ CXFA_Node* GetThisNode()
+ {
+ return m_pThisNode;
+ }
+ CXFA_Node* GetScriptNode()
+ {
+ return m_pScriptNode;
+ }
+private:
+ CXFA_Node* m_pThisNode;
+ CXFA_Node* m_pScriptNode;
+};
+class CXFA_NodeList : public CXFA_Object
+{
+public:
+ CXFA_NodeList(CXFA_Document* pDocument);
+ virtual ~CXFA_NodeList() {}
+ XFA_ELEMENT GetClassID() const
+ {
+ return XFA_ELEMENT_NodeList;
+ }
+ CXFA_Node* NamedItem(FX_WSTR wsName);
+ virtual FX_INT32 GetLength() = 0;
+ virtual FX_BOOL Append(CXFA_Node* pNode) = 0;
+ virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
+ virtual FX_BOOL Remove(CXFA_Node* pNode) = 0;
+ virtual CXFA_Node* Item(FX_INT32 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(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute);
+};
+class CXFA_ArrayNodeList : public CXFA_NodeList
+{
+public:
+ CXFA_ArrayNodeList(CXFA_Document* pDocument);
+ void SetArrayNodeList(const CXFA_NodeArray &srcArray);
+ virtual FX_INT32 GetLength();
+ virtual FX_BOOL Append(CXFA_Node* pNode);
+ virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode);
+ virtual FX_BOOL Remove(CXFA_Node* pNode);
+ virtual CXFA_Node* Item(FX_INT32 iIndex);
+protected:
+ CXFA_NodeArray m_array;
+};
+class CXFA_AttachNodeList : public CXFA_NodeList
+{
+public:
+ CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
+
+ virtual FX_INT32 GetLength();
+ virtual FX_BOOL Append(CXFA_Node* pNode);
+ virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode);
+ virtual FX_BOOL Remove(CXFA_Node* pNode);
+ virtual CXFA_Node* Item(FX_INT32 iIndex);
+protected:
+ CXFA_Node* m_pAttachNode;
+};
+class CXFA_TraverseStrategy_XFAContainerNode
+{
+public:
+ static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode, FX_LPVOID pUserData = NULL)
+ {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode);
+ }
+ static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode, FX_LPVOID pUserData = NULL)
+ {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling, XFA_OBJECTTYPE_ContainerNode);
+ }
+ static CXFA_Node* GetParent(CXFA_Node* pTemplateNode, FX_LPVOID pUserData = NULL)
+ {
+ 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;
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_parser.h b/xfa/src/fxfa/src/common/xfa_parser.h new file mode 100644 index 0000000000..2b1f1e62a8 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_parser.h @@ -0,0 +1,37 @@ +// 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_PARSER_H
+#define _XFA_PARSER_H
+class IFX_Stream;
+class IXFA_Parser
+{
+public:
+ static IXFA_Parser* Create(IXFA_ObjFactory *pFactory, FX_BOOL bDocumentParser = FALSE);
+ virtual void Release() = 0;
+ virtual FX_INT32 StartParse(IFX_FileRead *pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) = 0;
+ virtual FX_INT32 DoParse(IFX_Pause *pPause = NULL) = 0;
+ virtual FX_INT32 ParseXMLData(const CFX_WideString &wsXML, IFDE_XMLNode* &pXMLNode, IFX_Pause *pPause = NULL) = 0;
+ virtual void ConstructXFANode(CXFA_Node* pXFANode, IFDE_XMLNode* pXMLNode) = 0;
+ virtual IXFA_ObjFactory* GetFactory() const = 0;
+ virtual CXFA_Node* GetRootNode() const = 0;
+ virtual IFDE_XMLDoc* GetXMLDoc() const = 0;
+ virtual void CloseParser() = 0;
+};
+class IXFA_DocParser : public IXFA_Parser
+{
+public:
+ static IXFA_DocParser* Create(IXFA_Notify *pNotify);
+ virtual CXFA_Document* GetDocument() const = 0;
+ virtual IXFA_Notify* GetNotify() const = 0;
+};
+class IXFA_DataLoaderOptionsProvider
+{
+public:
+ static IXFA_DataLoaderOptionsProvider* Create(CXFA_Node* pConfigurationDOM);
+ virtual void Release() = 0;
+};
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_script.h b/xfa/src/fxfa/src/common/xfa_script.h new file mode 100644 index 0000000000..eb3b8472d4 --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_script.h @@ -0,0 +1,107 @@ +// 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 _FXFA_SCRIPT_H
+#define _FXFA_SCRIPT_H
+#define XFA_RESOLVENODE_Children 0x0001
+#define XFA_RESOLVENODE_Attributes 0x0004
+#define XFA_RESOLVENODE_Properties 0x0008
+#define XFA_RESOLVENODE_Siblings 0x0020
+#define XFA_RESOLVENODE_Parent 0x0040
+#define XFA_RESOLVENODE_AnyChild 0x0080
+#define XFA_RESOLVENODE_ALL 0x0100
+#define XFA_RESOLVENODE_CreateNode 0x0400
+#define XFA_RESOLVENODE_Bind 0x0800
+#define XFA_RESOLVENODE_BindNew 0x1000
+enum XFA_SCRIPTLANGTYPE {
+ XFA_SCRIPTLANGTYPE_Formcalc = XFA_SCRIPTTYPE_Formcalc,
+ XFA_SCRIPTLANGTYPE_Javascript = XFA_SCRIPTTYPE_Javascript,
+ XFA_SCRIPTLANGTYPE_Unkown = XFA_SCRIPTTYPE_Unkown,
+};
+enum XFA_RESOVENODE_RSTYPE {
+ XFA_RESOVENODE_RSTYPE_Nodes,
+ XFA_RESOVENODE_RSTYPE_Attribute,
+ XFA_RESOLVENODE_RSTYPE_CreateNodeOne,
+ XFA_RESOLVENODE_RSTYPE_CreateNodeAll,
+ XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll,
+ XFA_RESOVENODE_RSTYPE_ExistNodes,
+};
+class CXFA_HVALUEArray : public CFX_ArrayTemplate<FXJSE_HVALUE>
+{
+public:
+ CXFA_HVALUEArray(FXJSE_HRUNTIME hRunTime) : m_hRunTime(hRunTime) {};
+ ~CXFA_HVALUEArray()
+ {
+ for (FX_INT32 i = 0; i < GetSize(); i++) {
+ FXJSE_Value_Release(GetAt(i));
+ }
+ }
+ void GetAttributeObject(CXFA_ObjArray& objArray)
+ {
+ for (FX_INT32 i = 0; i < GetSize(); i++) {
+ CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL);
+ objArray.Add(pObject);
+ }
+ }
+ FXJSE_HRUNTIME m_hRunTime;
+};
+typedef struct _XFA_RESOLVENODE_RS : public CFX_Object {
+ _XFA_RESOLVENODE_RS() : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) { }
+ ~_XFA_RESOLVENODE_RS()
+ {
+ nodes.RemoveAll();
+ }
+ FX_INT32 GetAttributeResult(CXFA_HVALUEArray& hValueArray) const
+ {
+ if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) {
+ FXJSE_HRUNTIME hRunTime = hValueArray.m_hRunTime;
+ for (FX_INT32 i = 0; i < nodes.GetSize(); i++) {
+ FXJSE_HVALUE hValue = FXJSE_Value_Create(hRunTime);
+ (nodes[i]->*(pScriptAttribute->lpfnCallback))(hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute);
+ hValueArray.Add(hValue);
+ }
+ }
+ return hValueArray.GetSize();
+ }
+ CXFA_ObjArray nodes;
+ XFA_LPCSCRIPTATTRIBUTEINFO pScriptAttribute;
+ XFA_RESOVENODE_RSTYPE dwFlags;
+} XFA_RESOLVENODE_RS, * XFA_LPRESOLVENODE_RS;
+typedef struct _XFA_JSBUILTININFO {
+ FX_UINT32 uUnicodeHash;
+ FX_LPCSTR pName;
+} XFA_JSBUILTININFO, * XFA_LPJSBUILTININFO;
+typedef XFA_JSBUILTININFO const * XFA_LPCJSBUILTININFO;
+XFA_LPCJSBUILTININFO XFA_GetJSBuiltinByHash(FX_UINT32 uHashCode);
+class IXFA_ScriptContext
+{
+public:
+ virtual void Release() = 0;
+ virtual void Initialize(FXJSE_HRUNTIME hRuntime) = 0;
+
+ virtual void SetEventParam(CXFA_EventParam* pEventParam) = 0;
+ virtual CXFA_EventParam* GetEventParam() = 0;
+ virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, FX_WSTR wsScript, FXJSE_HVALUE hRetValue, CXFA_Object* pThisObject = NULL) = 0;
+ virtual FX_INT32 ResolveObjects(CXFA_Object* refNode, FX_WSTR wsExpression, XFA_RESOLVENODE_RS& resolveNodeRS, FX_DWORD dwStyles = XFA_RESOLVENODE_Children, CXFA_Node* bindNode = NULL) = 0;
+ virtual FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject) = 0;
+ virtual void CacheList(CXFA_NodeList* pList) = 0;
+ virtual CXFA_Object* GetThisObject() const = 0;
+ virtual FXJSE_HRUNTIME GetRuntime() const = 0;
+ virtual FX_INT32 GetIndexByName(CXFA_Node* refNode) = 0;
+ virtual FX_INT32 GetIndexByClassName(CXFA_Node* refNode) = 0;
+ virtual void GetSomExpression(CXFA_Node* refNode, CFX_WideString &wsExpression) = 0;
+
+ virtual void SetNodesOfRunScript(CXFA_NodeArray *pArray) = 0;
+ virtual void AddNodesOfRunScript(const CXFA_NodeArray& nodes) = 0;
+ virtual void AddNodesOfRunScript(CXFA_Node* pNode) = 0;
+ virtual FXJSE_HCLASS GetJseNormalClass() = 0;
+ virtual XFA_SCRIPTLANGTYPE GetType() = 0;
+ virtual void AddJSBuiltinObject(XFA_LPCJSBUILTININFO pBuitinObject) = 0;
+ virtual void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) = 0;
+ virtual FX_BOOL IsRunAtClient() = 0;
+};
+IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument);
+#endif
diff --git a/xfa/src/fxfa/src/common/xfa_utils.h b/xfa/src/fxfa/src/common/xfa_utils.h new file mode 100644 index 0000000000..df51ff6baa --- /dev/null +++ b/xfa/src/fxfa/src/common/xfa_utils.h @@ -0,0 +1,237 @@ +// 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_UTILS_H_
+#define _XFA_UTILS_H_
+FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier(IFDE_XMLElement* pNode, FX_WSTR wsQualifier, CFX_WideString& wsNamespaceURI);
+template <class NodeType, class TraverseStrategy>
+class CXFA_NodeIteratorTemplate : public CFX_Object
+{
+public:
+ CXFA_NodeIteratorTemplate(NodeType* pRootNode = NULL)
+ : m_pRoot(pRootNode)
+ {
+ if(pRootNode) {
+ m_NodeStack.Push(pRootNode);
+ }
+ }
+ FX_BOOL Init(NodeType* pRootNode)
+ {
+ if(!pRootNode) {
+ return FALSE;
+ }
+ m_pRoot = pRootNode;
+ m_NodeStack.RemoveAll();
+ m_NodeStack.Push(pRootNode);
+ return TRUE;
+ }
+ void Clear()
+ {
+ m_NodeStack.RemoveAll();
+ }
+ void Reset()
+ {
+ Clear();
+ if (m_pRoot) {
+ m_NodeStack.Push(m_pRoot);
+ }
+ }
+ FX_BOOL SetCurrent(NodeType* pCurNode)
+ {
+ m_NodeStack.RemoveAll();
+ if(pCurNode) {
+ CFX_StackTemplate<NodeType*> revStack;
+ NodeType* pNode;
+ for(pNode = pCurNode; pNode && pNode != m_pRoot; pNode = TraverseStrategy::GetParent(pNode)) {
+ revStack.Push(pNode);
+ }
+ if(!pNode) {
+ return FALSE;
+ }
+ revStack.Push(m_pRoot);
+ while(revStack.GetSize()) {
+ m_NodeStack.Push(*revStack.GetTopElement());
+ revStack.Pop();
+ }
+ }
+ return TRUE;
+ }
+ NodeType* GetCurrent()
+ {
+ return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : NULL;
+ }
+ NodeType* GetRoot()
+ {
+ return m_pRoot;
+ }
+ NodeType* MoveToPrev()
+ {
+ NodeType *pCurrent = GetCurrent();
+ FX_INT32 nStackLength = m_NodeStack.GetSize();
+ if(nStackLength == 1) {
+ return NULL;
+ } else if(nStackLength > 1) {
+ NodeType *pCurItem = *m_NodeStack.GetTopElement();
+ m_NodeStack.Pop();
+ NodeType *pParentItem = *m_NodeStack.GetTopElement();
+ NodeType *pParentFirstChildItem = TraverseStrategy::GetFirstChild(pParentItem);
+ if(pCurItem == pParentFirstChildItem) {
+ return pParentItem;
+ }
+ NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = NULL;
+ for(; pPrevItem; pPrevItem = pPrevItemNext) {
+ pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem);
+ if(!pPrevItemNext || pPrevItemNext == pCurItem) {
+ break;
+ }
+ }
+ m_NodeStack.Push(pPrevItem);
+ } else {
+ m_NodeStack.RemoveAll();
+ if(m_pRoot) {
+ m_NodeStack.Push(m_pRoot);
+ }
+ }
+ if(m_NodeStack.GetSize() > 0) {
+ NodeType *pChildItem = *m_NodeStack.GetTopElement();
+ while((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) != NULL) {
+ while(NodeType *pNextItem = TraverseStrategy::GetNextSibling(pChildItem)) {
+ pChildItem = pNextItem;
+ }
+ m_NodeStack.Push(pChildItem);
+ }
+ return *m_NodeStack.GetTopElement();
+ }
+ return NULL;
+ }
+ NodeType* MoveToNext()
+ {
+ NodeType **ppNode = NULL;
+ NodeType *pCurrent = GetCurrent();
+ while (m_NodeStack.GetSize() > 0) {
+ while ((ppNode = m_NodeStack.GetTopElement()) != NULL) {
+ if (pCurrent != *ppNode) {
+ return *ppNode;
+ }
+ NodeType *pChild = TraverseStrategy::GetFirstChild(*ppNode);
+ if (pChild == NULL) {
+ break;
+ }
+ m_NodeStack.Push(pChild);
+ }
+ while ((ppNode = m_NodeStack.GetTopElement()) != NULL) {
+ NodeType *pNext = TraverseStrategy::GetNextSibling(*ppNode);
+ m_NodeStack.Pop();
+ if (m_NodeStack.GetSize() == 0) {
+ break;
+ }
+ if (pNext) {
+ m_NodeStack.Push(pNext);
+ break;
+ }
+ }
+ }
+ return NULL;
+ }
+ NodeType* SkipChildrenAndMoveToNext()
+ {
+ NodeType **ppNode = NULL;
+ while ((ppNode = m_NodeStack.GetTopElement()) != NULL) {
+ NodeType *pNext = TraverseStrategy::GetNextSibling(*ppNode);
+ m_NodeStack.Pop();
+ if (m_NodeStack.GetSize() == 0) {
+ break;
+ }
+ if (pNext) {
+ m_NodeStack.Push(pNext);
+ break;
+ }
+ }
+ return GetCurrent();
+ }
+protected:
+ NodeType *m_pRoot;
+ CFX_StackTemplate<NodeType*> m_NodeStack;
+};
+template <class KeyType>
+class CXFA_PtrSetTemplate : private CFX_MapPtrToPtr
+{
+public:
+
+ CXFA_PtrSetTemplate() : CFX_MapPtrToPtr(10) {}
+
+ int GetCount() const
+ {
+ return CFX_MapPtrToPtr::GetCount();
+ }
+
+
+ FX_BOOL IsEmpty() const
+ {
+ return CFX_MapPtrToPtr::IsEmpty();
+ }
+
+ FX_BOOL Lookup(KeyType key) const
+ {
+ FX_LPVOID pValue = NULL;
+ return CFX_MapPtrToPtr::Lookup((void*)key, pValue);
+ }
+
+ FX_BOOL operator[](KeyType key)
+ {
+ return Lookup(key);
+ }
+
+ void Add(KeyType key)
+ {
+ CFX_MapPtrToPtr::SetAt((void*)key, (void*)key);
+ }
+
+ FX_BOOL RemoveKey(KeyType key)
+ {
+ return CFX_MapPtrToPtr::RemoveKey((void*)key);
+ }
+
+ void RemoveAll()
+ {
+ CFX_MapPtrToPtr::RemoveAll();
+ }
+
+ FX_POSITION GetStartPosition() const
+ {
+ return CFX_MapPtrToPtr::GetStartPosition();
+ }
+
+ void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey) const
+ {
+ void* pKey = NULL;
+ void* pValue = NULL;
+ CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue);
+ rKey = (KeyType)(FX_UINTPTR)pKey;
+ }
+};
+class CXFA_Node;
+class CXFA_WidgetData;
+#include "fxfa_localevalue.h"
+CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType);
+CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
+CFX_WideString XFA_NumericLimit(const CFX_WideString &wsValue, FX_INT32 iLead, FX_INT32 iTread);
+FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString &wsStringVal);
+FX_DOUBLE XFA_ByteStringToDouble(FX_BSTR szStringVal);
+#ifndef XFA_PARSE_HAS_LINEIDENTIFIER
+#define XFA_PARSE_HAS_LINEIDENTIFIER
+#endif
+FX_BOOL XFA_RecognizeRichText(IFDE_XMLElement* pRichTextXMLNode);
+void XFA_GetPlainTextFromRichText(IFDE_XMLNode *pXMLNode, CFX_WideString &wsPlainText);
+FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);
+IFX_Stream* XFA_CreateWideTextRead(const CFX_WideString &wsBuffer);
+FX_BOOL XFA_IsLayoutElement(XFA_ELEMENT eElement, FX_BOOL bLayoutContainer = FALSE);
+FX_BOOL XFA_IsTakingupSpace(XFA_ATTRIBUTEENUM ePresence);
+FX_BOOL XFA_IsFlowingLayout(XFA_ATTRIBUTEENUM eLayout);
+FX_BOOL XFA_IsHorizontalFlow(XFA_ATTRIBUTEENUM eLayout);
+void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node *pDataNode);
+void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, IFX_Stream* pStream, FX_LPCSTR pChecksum = NULL, FX_BOOL bSaveXML = FALSE);
+#endif
|