Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h
index 4950f81..ed0370f 100644
--- a/core/include/fxcrt/fx_arb.h
+++ b/core/include/fxcrt/fx_arb.h
@@ -6,6 +6,54 @@
 
 #ifndef _FX_ARABIC_
 #define _FX_ARABIC_
+class IFX_ArabicChar;
+class IFX_BidiChar;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+typedef struct _FX_ARBFORMTABLE {
+    FX_WCHAR	wIsolated;
+    FX_WCHAR	wFinal;
+    FX_WCHAR	wInitial;
+    FX_WCHAR	wMedial;
+} FX_ARBFORMTABLE, * FX_LPARBFORMTABLE;
+typedef FX_ARBFORMTABLE const * FX_LPCARBFORMTABLE;
+typedef struct _FX_ARAALEF {
+    FX_WCHAR	wAlef;
+    FX_WCHAR	wIsolated;
+} FX_ARAALEF, * FX_LPARAALEF;
+typedef FX_ARAALEF const * FX_LPCARAALEF;
+typedef struct _FX_ARASHADDA {
+    FX_WCHAR	wShadda;
+    FX_WCHAR	wIsolated;
+} FX_ARASHADDA, * FX_LPARASHADDA;
+typedef FX_ARASHADDA const * FX_LPCARASHADDA;
+FX_LPCARBFORMTABLE FX_GetArabicFormTable(FX_WCHAR unicode);
+FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef);
+FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda);
+#ifdef __cplusplus
+};
+#endif
+enum FX_ARBPOSITION {
+    FX_ARBPOSITION_Isolated = 0,
+    FX_ARBPOSITION_Final,
+    FX_ARBPOSITION_Initial,
+    FX_ARBPOSITION_Medial,
+};
+class IFX_ArabicChar
+{
+public:
+    static IFX_ArabicChar*		Create();
+    virtual void				Release() = 0;
+    virtual FX_BOOL				IsArabicChar(FX_WCHAR wch) const = 0;
+    virtual FX_BOOL				IsArabicFormChar(FX_WCHAR wch) const = 0;
+    virtual FX_WCHAR			GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR next = 0) const = 0;
+    virtual FX_WCHAR			GetFormChar(const CFX_Char *cur, const CFX_Char *prev, const CFX_Char *next) const = 0;
+};
+void FX_BidiLine(CFX_WideString &wsText, FX_INT32 iBaseLevel = 0);
+void FX_BidiLine(CFX_TxtCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0);
+void FX_BidiLine(CFX_RTFCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0);
 class IFX_BidiChar
 {
 public:
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 22ba611..0c84f54 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -1578,6 +1578,13 @@
 } FX_ProgressiveStatus;
 #define ProgressiveStatus	FX_ProgressiveStatus
 #define FX_NAMESPACE_DECLARE(namespace, type)       namespace::type
+class IFX_Unknown
+{
+public:
+    virtual FX_DWORD	Release() = 0;
+    virtual FX_DWORD	AddRef() = 0;
+};
+#define FX_IsOdd(a)	((a) & 1)
 
 class CFX_Vector_3by1 : public CFX_Object
 {
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h
index 03ec488..ceba015 100644
--- a/core/include/fxcrt/fx_ext.h
+++ b/core/include/fxcrt/fx_ext.h
@@ -76,6 +76,24 @@
 #ifdef __cplusplus
 }
 #endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct FX_GUID {
+    FX_DWORD	data1;
+    FX_WORD		data2;
+    FX_WORD		data3;
+    FX_BYTE		data4[8];
+} FX_GUID, * FX_LPGUID;
+typedef FX_GUID const * FX_LPCGUID;
+
+void	FX_GUID_CreateV4(FX_LPGUID pGUID);
+
+void	FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSeparator = TRUE);
+#ifdef __cplusplus
+}
+#endif
 template<class baseType>
 class CFX_SSortTemplate
 {
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index 8e298f7..0a3d1c4 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -162,6 +162,15 @@
 };
 IFX_FileStream*		FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes);
 IFX_FileStream*		FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes);
+class IFX_FileAccess
+{
+public:
+	virtual void				Release() = 0;	
+	virtual IFX_FileAccess*		Retain() = 0;
+	virtual void				GetPath(CFX_WideString& wsPath) = 0;
+	virtual IFX_FileStream*		CreateFileStream(FX_DWORD dwModes) = 0;
+};
+IFX_FileAccess* FX_CreateDefaultFileAccess(FX_WSTR wsPath);
 class IFX_MemoryStream : public IFX_FileStream
 {
 public:
diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h
index 9e1862a..c87e459 100644
--- a/core/include/fxcrt/fx_ucd.h
+++ b/core/include/fxcrt/fx_ucd.h
@@ -88,6 +88,20 @@
     FX_CHARTYPE_ArabicForm			= (11 << FX_CHARTYPEBITS),
     FX_CHARTYPE_Arabic				= (12 << FX_CHARTYPEBITS),
 };
+typedef struct _FX_CHARPROPERTIES {

+    union FX_CHARPROPERTIES_UNION{

+        struct FX_CHARPROPERTIES_BIT{

+            FX_DWORD	dwBreakType		: 6;

+            FX_DWORD	dwBidiClass		: 5;

+            FX_DWORD	dwCharType		: 4;

+            FX_DWORD	dwRotation		: 1;

+            FX_DWORD	dwCJKSpecial	: 1;

+            FX_DWORD	dwVertIndex		: 6;

+            FX_DWORD	dwBidiIndex		: 9;

+        };

+        FX_DWORD	dwCharProps;

+    };

+} FX_CHARPROPERTIES;

 FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch);
 FX_BOOL	FX_IsCtrlCode(FX_WCHAR ch);
 FX_BOOL	FX_IsRotationCode(FX_WCHAR ch);
@@ -95,4 +109,89 @@
 FX_BOOL	FX_IsBidiChar(FX_WCHAR wch);
 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical);
 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, FX_BOOL bRTL, FX_BOOL bVertical);
+class CFX_Char : public CFX_Object

+{

+public:

+    CFX_Char() : m_wCharCode(0)

+        , m_nBreakType(0)

+        , m_nRotation(0)

+        , m_dwCharProps(0)

+        , m_dwCharStyles(0)

+        , m_iCharWidth(0)

+        , m_iHorizontalScale(100)

+        , m_iVertialScale(100)

+    {

+    }

+    CFX_Char(FX_WORD wCharCode, FX_DWORD dwCharProps)

+        : m_wCharCode(wCharCode)

+        , m_nBreakType(0)

+        , m_nRotation(0)

+        , m_dwCharProps(dwCharProps)

+        , m_dwCharStyles(0)

+        , m_iCharWidth(0)

+        , m_iHorizontalScale(100)

+        , m_iVertialScale(100)

+    {

+    }

+    FX_DWORD	GetCharType() const

+    {

+        return m_dwCharProps & FX_CHARTYPEBITSMASK;

+    }

+    FX_WORD		m_wCharCode;

+    FX_BYTE		m_nBreakType;

+    FX_INT8		m_nRotation;

+    FX_DWORD	m_dwCharProps;

+    FX_DWORD	m_dwCharStyles;

+    FX_INT32	m_iCharWidth;

+    FX_INT32	m_iHorizontalScale;

+    FX_INT32	m_iVertialScale;

+};

+typedef CFX_ArrayTemplate<CFX_Char>	CFX_CharArray;

+class CFX_TxtChar : public CFX_Char

+{

+public:

+    CFX_TxtChar() : CFX_Char()

+        , m_dwStatus(0)

+        , m_iBidiClass(0)

+        , m_iBidiLevel(0)

+        , m_iBidiPos(0)

+        , m_iBidiOrder(0)

+        , m_pUserData(NULL)

+    {

+    }

+    FX_DWORD			m_dwStatus;

+    FX_INT16			m_iBidiClass;

+    FX_INT16			m_iBidiLevel;

+    FX_INT16			m_iBidiPos;

+    FX_INT16			m_iBidiOrder;

+    FX_LPVOID			m_pUserData;

+};

+typedef CFX_ArrayTemplate<CFX_TxtChar>	CFX_TxtCharArray;

+class CFX_RTFChar : public CFX_Char

+{

+public:

+    CFX_RTFChar() : CFX_Char()

+        , m_dwStatus(0)

+        , m_iFontSize(0)

+        , m_iFontHeight(0)

+        , m_iBidiClass(0)

+        , m_iBidiLevel(0)

+        , m_iBidiPos(0)

+        , m_dwLayoutStyles(0)

+        , m_dwIdentity(0)

+        , m_pUserData(NULL)

+    {

+    }

+    FX_DWORD			m_dwStatus;

+    FX_INT32			m_iFontSize;

+    FX_INT32			m_iFontHeight;

+    FX_INT16			m_iBidiClass;

+    FX_INT16			m_iBidiLevel;

+    FX_INT16			m_iBidiPos;

+    FX_INT16			m_iBidiOrder;

+    FX_DWORD			m_dwLayoutStyles;

+    FX_DWORD			m_dwIdentity;

+    IFX_Unknown			*m_pUserData;

+};

+typedef CFX_ArrayTemplate<CFX_RTFChar>	CFX_RTFCharArray;

 #endif