Convert all line endings to LF.
diff --git a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
index 7624596..50f5160 100644
--- a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
+++ b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
@@ -1,51 +1,51 @@
-// 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 _RAO_FONTMAP_H_

-#define _RAO_FONTMAP_H_

-

-#if _MSC_VER > 1000

-#pragma once

-#endif // _MSC_VER > 1000

-

-class CPDFSDK_Annot;

-

-class CBA_FontMap : public CPWL_FontMap

-{

-public:

-	CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);

-	CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);

-

-	virtual ~CBA_FontMap();

-

-	virtual void				Initial(FX_LPCSTR fontname = NULL);

-

-public:

-	void						SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);

-

-	void						Reset();

-	void						SetAPType(const CFX_ByteString& sAPType);

-

-protected:

-	virtual CPDF_Font*			FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);

-	virtual void				AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);

-	virtual CPDF_Document*		GetDocument();

-private:

-	CPDF_Font*					FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,

-									FX_INT32 nCharset);

-	CPDF_Font*					GetAnnotDefaultFont(CFX_ByteString &csNameTag);

-	void						AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);

-

-private:

-	CPDF_Document*				m_pDocument;

-	CPDF_Dictionary*			m_pAnnotDict;

-	CPDF_Font*					m_pDefaultFont;

-	CFX_ByteString				m_sDefaultFontName;

-	

-	CFX_ByteString				m_sAPType;

-};

-

-#endif // _RAO_FONTMAP_H_

+// 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 _RAO_FONTMAP_H_
+#define _RAO_FONTMAP_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CPDFSDK_Annot;
+
+class CBA_FontMap : public CPWL_FontMap
+{
+public:
+	CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
+	CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);
+
+	virtual ~CBA_FontMap();
+
+	virtual void				Initial(FX_LPCSTR fontname = NULL);
+
+public:
+	void						SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);
+
+	void						Reset();
+	void						SetAPType(const CFX_ByteString& sAPType);
+
+protected:
+	virtual CPDF_Font*			FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
+	virtual void				AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+	virtual CPDF_Document*		GetDocument();
+private:
+	CPDF_Font*					FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
+									FX_INT32 nCharset);
+	CPDF_Font*					GetAnnotDefaultFont(CFX_ByteString &csNameTag);
+	void						AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
+
+private:
+	CPDF_Document*				m_pDocument;
+	CPDF_Dictionary*			m_pAnnotDict;
+	CPDF_Font*					m_pDefaultFont;
+	CFX_ByteString				m_sDefaultFontName;
+	
+	CFX_ByteString				m_sAPType;
+};
+
+#endif // _RAO_FONTMAP_H_
diff --git a/fpdfsdk/include/formfiller/FFL_CheckBox.h b/fpdfsdk/include/formfiller/FFL_CheckBox.h
index f8ee370..9aaf7fe 100644
--- a/fpdfsdk/include/formfiller/FFL_CheckBox.h
+++ b/fpdfsdk/include/formfiller/FFL_CheckBox.h
@@ -1,27 +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 _FFL_CHECKBOX_H_

-#define _FFL_CHECKBOX_H_

-

-class CFFL_CheckBox : public CFFL_Button

-{

-public:

-	CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);

-	virtual ~CFFL_CheckBox();

-

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-

-	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-};

-

-#endif //_FFL_CHECKBOX_H_

-

+// 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 _FFL_CHECKBOX_H_
+#define _FFL_CHECKBOX_H_
+
+class CFFL_CheckBox : public CFFL_Button
+{
+public:
+	CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);
+	virtual ~CFFL_CheckBox();
+
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+};
+
+#endif //_FFL_CHECKBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h
index f116acf..6df8347 100644
--- a/fpdfsdk/include/formfiller/FFL_ComboBox.h
+++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h
@@ -1,69 +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 _FFL_COMBOBOX_H_

- #define _FFL_COMBOBOX_H_

-

-struct FFL_ComboBoxState

-{

-	int nIndex;

-	int nStart;

-	int nEnd;

-	CFX_WideString sValue;

-};

-class CBA_FontMap;

-

-class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify

-{

-public:

-	CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);

-	virtual ~CFFL_ComboBox();

-	

-	virtual	PWL_CREATEPARAM		GetCreateParam();

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-

-	

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-	

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-	

- 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa);

- 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa);

- 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew);

-	virtual void				SaveState(CPDFSDK_PageView* pPageView);

-	virtual void				RestoreState(CPDFSDK_PageView* pPageView);

-	

-	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);

-	virtual void				OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);

-	

-public:

-	virtual void				OnSetFocus(CPWL_Wnd* pWnd);

-	virtual void				OnKillFocus(CPWL_Wnd* pWnd);

-	

-public:

-	virtual void				OnAddUndo(CPWL_Edit* pEdit);

-	

-public:

-	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 

-	

-	virtual void				DoCopy(CPDFSDK_Document* pDocument); 

-	virtual void				DoCut(CPDFSDK_Document* pDocument); 

-	virtual void				DoPaste(CPDFSDK_Document* pDocument); 

-	

-private:

-	CFX_WideString				GetSelectExportText();

-

-private:

-	CBA_FontMap*				m_pFontMap;

-	FFL_ComboBoxState				m_State;

-	//CFFL_IM_BOX					m_IMBox;

-};

-

-#endif //_FFL_COMBOBOX_H_

-

+// 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 _FFL_COMBOBOX_H_
+ #define _FFL_COMBOBOX_H_
+
+struct FFL_ComboBoxState
+{
+	int nIndex;
+	int nStart;
+	int nEnd;
+	CFX_WideString sValue;
+};
+class CBA_FontMap;
+
+class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
+{
+public:
+	CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+	virtual ~CFFL_ComboBox();
+	
+	virtual	PWL_CREATEPARAM		GetCreateParam();
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+	
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+	
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+	
+ 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa);
+ 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa);
+ 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew);
+	virtual void				SaveState(CPDFSDK_PageView* pPageView);
+	virtual void				RestoreState(CPDFSDK_PageView* pPageView);
+	
+	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+	virtual void				OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);
+	
+public:
+	virtual void				OnSetFocus(CPWL_Wnd* pWnd);
+	virtual void				OnKillFocus(CPWL_Wnd* pWnd);
+	
+public:
+	virtual void				OnAddUndo(CPWL_Edit* pEdit);
+	
+public:
+	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 
+	
+	virtual void				DoCopy(CPDFSDK_Document* pDocument); 
+	virtual void				DoCut(CPDFSDK_Document* pDocument); 
+	virtual void				DoPaste(CPDFSDK_Document* pDocument); 
+	
+private:
+	CFX_WideString				GetSelectExportText();
+
+private:
+	CBA_FontMap*				m_pFontMap;
+	FFL_ComboBoxState				m_State;
+	//CFFL_IM_BOX					m_IMBox;
+};
+
+#endif //_FFL_COMBOBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h
index eb81675..7a3402a 100644
--- a/fpdfsdk/include/formfiller/FFL_FormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h
@@ -1,178 +1,178 @@
-// 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 _FFL_FORMFILLER_H_

-#define _FFL_FORMFILLER_H_

-

-#include "FFL_IFormFiller.h"

-#include "FFL_CBA_Fontmap.h"

-

-class CPDFSDK_Annot;

-class CFFL_FormFiller;

-class CFFL_Notify;

-class CPDFDoc_Environment;

-class CPDFSDK_PageView;

-class CPDFSDK_Document;

-class CPDFSDK_Widget;

-

-

-#define CFFL_PageView2PDFWindow		CFX_MapPtrTemplate<CPDFSDK_PageView*, CPWL_Wnd*>

-

-struct FFL_KeyStrokeData

-{

-	CFX_WideString		swValue;

-	FX_BOOL				bFull;

-	int					nSelStart;

-	int					nSelEnd;

-};

-

-

-

-class CFFL_FormFiller : /*public IBA_AnnotFiller,*/ public IPWL_Provider, public CPWL_TimerHandler

-{

-public:

-	CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);

-	virtual ~CFFL_FormFiller();

-

-	virtual FX_RECT				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 

-									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-									/*const CRect& rcWindow, */FX_DWORD dwFlags);

-	virtual void				OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 

-								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-								/*const CRect& rcWindow, */FX_DWORD dwFlags);

-

-	virtual void				OnCreate(CPDFSDK_Annot* pAnnot);

-	virtual void				OnLoad(CPDFSDK_Annot* pAnnot);

-	virtual void				OnDelete(CPDFSDK_Annot* pAnnot);

-

-	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-

-	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-

-	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-

-	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot);

-	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot);

-

-	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);

-	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);

-

-	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 

-

-	virtual void				DoCopy(CPDFSDK_Document* pDocument); 

-	virtual void				DoCut(CPDFSDK_Document* pDocument); 

-	virtual void				DoPaste(CPDFSDK_Document* pDocument); 

-

-public: //CPWL_TimerHandler

-	virtual void				TimerProc();

-	virtual IFX_SystemHandler*	GetSystemHandler() const;

-

-public:

-	virtual CPDF_Matrix			GetWindowMatrix(void* pAttachedData);

-	virtual CFX_WideString		LoadPopupMenuString(int nIndex);

-

- 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,

- 									PDFSDK_FieldAction& fa);

- 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 

- 									const PDFSDK_FieldAction& fa);

- 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 

- 									const PDFSDK_FieldAction& faNew);

-

-	virtual void				SaveState(CPDFSDK_PageView* pPageView);

-	virtual void				RestoreState(CPDFSDK_PageView* pPageView);

-

-	virtual CPWL_Wnd* 			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);

-

-	virtual void				OnKeyStroke(FX_BOOL bKeyDown);

-

-	CPDF_Matrix					GetCurMatrix();

-

-	CPDF_Rect					FFLtoPWL(const CPDF_Rect& rect);

-	CPDF_Rect					PWLtoFFL(const CPDF_Rect& rect);

-	CPDF_Point					FFLtoPWL(const CPDF_Point& point);

-	CPDF_Point					PWLtoFFL(const CPDF_Point& point);

-

-	CPDF_Point					WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);

-	CPDF_Rect					FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);

-

-	void						SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);

-	CPDF_Rect					GetWindowRect(CPDFSDK_PageView* pPageView);

-

-	static void					FFL_FreeData(void* pData);

-

-	FX_BOOL						CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-

-	virtual void				GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrokeData& data);

-

-public:

-	CPWL_Wnd*					GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);

-	void						DestroyPDFWindow(CPDFSDK_PageView* pPageView);

-	void						EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);

-

-	virtual	PWL_CREATEPARAM		GetCreateParam();

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0;

-	virtual CPDF_Rect			GetFocusBox(CPDFSDK_PageView* pPageView);

-

-public:

-	FX_BOOL						IsValid() const;

-	CPDF_Rect					GetPDFWindowRect() const;

-

-	CPDFSDK_PageView*			GetCurPageView();

-	void						SetChangeMark();

-

-	virtual void				InvalidateRect(double left, double top, double right, double bottom);

-	CPDFDoc_Environment*		GetApp(){return m_pApp;}

-	CPDFSDK_Annot*				GetSDKAnnot() {return m_pAnnot;}	

-protected:

-	CPDFDoc_Environment*		m_pApp;

-	CPDFSDK_Widget*				m_pWidget;

-	CPDFSDK_Annot*				m_pAnnot;

-

-	FX_BOOL						m_bValid;

-	CFFL_PageView2PDFWindow		m_Maps;

-	CPDF_Point					m_ptOldPos;

-};

-

-class CFFL_Button : public CFFL_FormFiller

-{

-public:

-	CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);

-	virtual ~CFFL_Button();

-

-	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView/*, HDC hDC*/, CPDFSDK_Annot* pAnnot, 

-								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-								/*const CRect& rcWindow,*/ FX_DWORD dwFlags);

-

-	virtual	void				OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 

-								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-								/*const CRect& rcWindow, */FX_DWORD dwFlags);

-protected:

-	FX_BOOL						m_bMouseIn;

-	FX_BOOL						m_bMouseDown;

-};

-

-//#define CFFL_IM_BOX				CFX_ArrayTemplate<CBA_EditInput*>

-

-#endif

+// 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 _FFL_FORMFILLER_H_
+#define _FFL_FORMFILLER_H_
+
+#include "FFL_IFormFiller.h"
+#include "FFL_CBA_Fontmap.h"
+
+class CPDFSDK_Annot;
+class CFFL_FormFiller;
+class CFFL_Notify;
+class CPDFDoc_Environment;
+class CPDFSDK_PageView;
+class CPDFSDK_Document;
+class CPDFSDK_Widget;
+
+
+#define CFFL_PageView2PDFWindow		CFX_MapPtrTemplate<CPDFSDK_PageView*, CPWL_Wnd*>
+
+struct FFL_KeyStrokeData
+{
+	CFX_WideString		swValue;
+	FX_BOOL				bFull;
+	int					nSelStart;
+	int					nSelEnd;
+};
+
+
+
+class CFFL_FormFiller : /*public IBA_AnnotFiller,*/ public IPWL_Provider, public CPWL_TimerHandler
+{
+public:
+	CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+	virtual ~CFFL_FormFiller();
+
+	virtual FX_RECT				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 
+									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+									/*const CRect& rcWindow, */FX_DWORD dwFlags);
+	virtual void				OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 
+								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+								/*const CRect& rcWindow, */FX_DWORD dwFlags);
+
+	virtual void				OnCreate(CPDFSDK_Annot* pAnnot);
+	virtual void				OnLoad(CPDFSDK_Annot* pAnnot);
+	virtual void				OnDelete(CPDFSDK_Annot* pAnnot);
+
+	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+
+	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot);
+	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot);
+
+	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 
+
+	virtual void				DoCopy(CPDFSDK_Document* pDocument); 
+	virtual void				DoCut(CPDFSDK_Document* pDocument); 
+	virtual void				DoPaste(CPDFSDK_Document* pDocument); 
+
+public: //CPWL_TimerHandler
+	virtual void				TimerProc();
+	virtual IFX_SystemHandler*	GetSystemHandler() const;
+
+public:
+	virtual CPDF_Matrix			GetWindowMatrix(void* pAttachedData);
+	virtual CFX_WideString		LoadPopupMenuString(int nIndex);
+
+ 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ 									PDFSDK_FieldAction& fa);
+ 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 
+ 									const PDFSDK_FieldAction& fa);
+ 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 
+ 									const PDFSDK_FieldAction& faNew);
+
+	virtual void				SaveState(CPDFSDK_PageView* pPageView);
+	virtual void				RestoreState(CPDFSDK_PageView* pPageView);
+
+	virtual CPWL_Wnd* 			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+
+	virtual void				OnKeyStroke(FX_BOOL bKeyDown);
+
+	CPDF_Matrix					GetCurMatrix();
+
+	CPDF_Rect					FFLtoPWL(const CPDF_Rect& rect);
+	CPDF_Rect					PWLtoFFL(const CPDF_Rect& rect);
+	CPDF_Point					FFLtoPWL(const CPDF_Point& point);
+	CPDF_Point					PWLtoFFL(const CPDF_Point& point);
+
+	CPDF_Point					WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);
+	CPDF_Rect					FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);
+
+	void						SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);
+	CPDF_Rect					GetWindowRect(CPDFSDK_PageView* pPageView);
+
+	static void					FFL_FreeData(void* pData);
+
+	FX_BOOL						CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+
+	virtual void				GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrokeData& data);
+
+public:
+	CPWL_Wnd*					GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);
+	void						DestroyPDFWindow(CPDFSDK_PageView* pPageView);
+	void						EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);
+
+	virtual	PWL_CREATEPARAM		GetCreateParam();
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0;
+	virtual CPDF_Rect			GetFocusBox(CPDFSDK_PageView* pPageView);
+
+public:
+	FX_BOOL						IsValid() const;
+	CPDF_Rect					GetPDFWindowRect() const;
+
+	CPDFSDK_PageView*			GetCurPageView();
+	void						SetChangeMark();
+
+	virtual void				InvalidateRect(double left, double top, double right, double bottom);
+	CPDFDoc_Environment*		GetApp(){return m_pApp;}
+	CPDFSDK_Annot*				GetSDKAnnot() {return m_pAnnot;}	
+protected:
+	CPDFDoc_Environment*		m_pApp;
+	CPDFSDK_Widget*				m_pWidget;
+	CPDFSDK_Annot*				m_pAnnot;
+
+	FX_BOOL						m_bValid;
+	CFFL_PageView2PDFWindow		m_Maps;
+	CPDF_Point					m_ptOldPos;
+};
+
+class CFFL_Button : public CFFL_FormFiller
+{
+public:
+	CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+	virtual ~CFFL_Button();
+
+	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView/*, HDC hDC*/, CPDFSDK_Annot* pAnnot, 
+								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+								/*const CRect& rcWindow,*/ FX_DWORD dwFlags);
+
+	virtual	void				OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 
+								CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+								/*const CRect& rcWindow, */FX_DWORD dwFlags);
+protected:
+	FX_BOOL						m_bMouseIn;
+	FX_BOOL						m_bMouseDown;
+};
+
+//#define CFFL_IM_BOX				CFX_ArrayTemplate<CBA_EditInput*>
+
+#endif
diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h
index 79b4b8e..393f0be 100644
--- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h
@@ -1,144 +1,144 @@
-// 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 _FFL_IFORMFILLER_H_

-#define _FFL_IFORMFILLER_H_

-

-#include "FormFiller.h"

-class CFFL_FormFiller;

-class CFFL_PrivateData;

-

-#define CFFL_Widget2Filler		CFX_MapPtrTemplate<CPDFSDK_Annot*, CFFL_FormFiller*>

-

-// #define IsALTpressed()			(GetKeyState(VK_MENU) < 0)

-// #define IsCTRLpressed()			(GetKeyState(VK_CONTROL) < 0)

-// #define IsSHIFTpressed()		(GetKeyState(VK_SHIFT)&0x8000)

-// #define IsINSERTpressed()		(GetKeyState(VK_INSERT) & 0x01)	

-// #define VK_SHIFT          0x10

-// #define VK_CONTROL        0x11

-// #define VK_MENU           0x12

-// #define VK_RETURN         0x0D

-// #define VK_SPACE          0x20

-// #define VK_ESCAPE         0x1B

-

-

-

-class CFFL_IFormFiller :/* public IBA_AnnotFiller, */public IPWL_Filler_Notify//, 

-//	public IUndo_EventHandler, public IClipboard_Handler

-{

-public:

-	CFFL_IFormFiller(CPDFDoc_Environment* pApp);

-	virtual ~CFFL_IFormFiller();

-

-	virtual FX_BOOL				Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);

-	virtual FX_RECT				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 

-									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-									/*const CRect& rcWindow,*/ FX_DWORD dwFlags);

-

-

-	virtual void				OnCreate(CPDFSDK_Annot* pAnnot);

-	virtual void				OnLoad(CPDFSDK_Annot* pAnnot);

-	virtual void				OnDelete(CPDFSDK_Annot* pAnnot);

-

-	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);

-	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);

-

-	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-

-	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-

-	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot);

-	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot);

-

-	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);

-	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);

-

-public:

-	virtual void				QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet);

-	virtual void				OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,

-										CFX_WideString & strChange, const CFX_WideString& strChangeEx, 

-										int nSelStart, int nSelEnd,

-										FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);

-	virtual void				OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;

-

-	virtual void				OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);

-	virtual void				OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange, 

-									const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);

-

-public:

-	virtual void				BeforeUndo(CPDFSDK_Document* pDocument);

-	virtual void				BeforeRedo(CPDFSDK_Document* pDocument);

-	virtual void				AfterUndo(CPDFSDK_Document* pDocument);

-	virtual void				AfterRedo(CPDFSDK_Document* pDocument);

-

-public:

-	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 

-

-	virtual void				DoCopy(CPDFSDK_Document* pDocument); 

-	virtual void				DoCut(CPDFSDK_Document* pDocument); 

-	virtual void				DoPaste(CPDFSDK_Document* pDocument); 

-

-public:

-	CFFL_FormFiller*			GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);

-	void						RemoveFormFiller(CPDFSDK_Annot* pAnnot);

-

-	static FX_BOOL				IsVisible(CPDFSDK_Widget* pWidget);

-	static FX_BOOL				IsReadOnly(CPDFSDK_Widget* pWidget);

-	static FX_BOOL				IsFillingAllowed(CPDFSDK_Widget* pWidget);

- 	static FX_BOOL				IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);

-

-	void						OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);

-	void						OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);

-

-	void						OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);

-	void						OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);

-	void						OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);

-// 	static LRESULT CALLBACK		FFL_WndProc(

-// 									  int code,       // hook code

-// 									  WPARAM wParam,  // virtual-key code

-// 									  LPARAM lParam   // keystroke-message information

-// 										);

-// 	static MSG					GetLastMessage();

-	static int					GetCommitKey();

-	static FX_BOOL				GetKeyDown();

-

-

-public:

-// 	static MSG					g_Msg;

-// 	static HHOOK				m_hookSheet;

-

-private:

-	void						UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);

-	void						SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext);

-

-private:

-	CPDFDoc_Environment*				m_pApp;

-	CFFL_Widget2Filler			m_Maps;

-	FX_BOOL						m_bNotifying;

-};

-

-class CFFL_PrivateData

-{

-public:

-	CPDFSDK_Widget*			pWidget;

-	CPDFSDK_PageView*	pPageView;

-	int					nWidgetAge;

-	int					nValueAge;

-};

-

-#endif //_FFL_IFORMFILLER_H_

-

+// 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 _FFL_IFORMFILLER_H_
+#define _FFL_IFORMFILLER_H_
+
+#include "FormFiller.h"
+class CFFL_FormFiller;
+class CFFL_PrivateData;
+
+#define CFFL_Widget2Filler		CFX_MapPtrTemplate<CPDFSDK_Annot*, CFFL_FormFiller*>
+
+// #define IsALTpressed()			(GetKeyState(VK_MENU) < 0)
+// #define IsCTRLpressed()			(GetKeyState(VK_CONTROL) < 0)
+// #define IsSHIFTpressed()		(GetKeyState(VK_SHIFT)&0x8000)
+// #define IsINSERTpressed()		(GetKeyState(VK_INSERT) & 0x01)	
+// #define VK_SHIFT          0x10
+// #define VK_CONTROL        0x11
+// #define VK_MENU           0x12
+// #define VK_RETURN         0x0D
+// #define VK_SPACE          0x20
+// #define VK_ESCAPE         0x1B
+
+
+
+class CFFL_IFormFiller :/* public IBA_AnnotFiller, */public IPWL_Filler_Notify//, 
+//	public IUndo_EventHandler, public IClipboard_Handler
+{
+public:
+	CFFL_IFormFiller(CPDFDoc_Environment* pApp);
+	virtual ~CFFL_IFormFiller();
+
+	virtual FX_BOOL				Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);
+	virtual FX_RECT				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, 
+									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+									/*const CRect& rcWindow,*/ FX_DWORD dwFlags);
+
+
+	virtual void				OnCreate(CPDFSDK_Annot* pAnnot);
+	virtual void				OnLoad(CPDFSDK_Annot* pAnnot);
+	virtual void				OnDelete(CPDFSDK_Annot* pAnnot);
+
+	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot);
+	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot);
+
+	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);
+	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+public:
+	virtual void				QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet);
+	virtual void				OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
+										CFX_WideString & strChange, const CFX_WideString& strChangeEx, 
+										int nSelStart, int nSelEnd,
+										FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);
+	virtual void				OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;
+
+	virtual void				OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);
+	virtual void				OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange, 
+									const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);
+
+public:
+	virtual void				BeforeUndo(CPDFSDK_Document* pDocument);
+	virtual void				BeforeRedo(CPDFSDK_Document* pDocument);
+	virtual void				AfterUndo(CPDFSDK_Document* pDocument);
+	virtual void				AfterRedo(CPDFSDK_Document* pDocument);
+
+public:
+	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 
+
+	virtual void				DoCopy(CPDFSDK_Document* pDocument); 
+	virtual void				DoCut(CPDFSDK_Document* pDocument); 
+	virtual void				DoPaste(CPDFSDK_Document* pDocument); 
+
+public:
+	CFFL_FormFiller*			GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
+	void						RemoveFormFiller(CPDFSDK_Annot* pAnnot);
+
+	static FX_BOOL				IsVisible(CPDFSDK_Widget* pWidget);
+	static FX_BOOL				IsReadOnly(CPDFSDK_Widget* pWidget);
+	static FX_BOOL				IsFillingAllowed(CPDFSDK_Widget* pWidget);
+ 	static FX_BOOL				IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+
+	void						OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
+	void						OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
+
+	void						OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
+	void						OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
+	void						OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);
+// 	static LRESULT CALLBACK		FFL_WndProc(
+// 									  int code,       // hook code
+// 									  WPARAM wParam,  // virtual-key code
+// 									  LPARAM lParam   // keystroke-message information
+// 										);
+// 	static MSG					GetLastMessage();
+	static int					GetCommitKey();
+	static FX_BOOL				GetKeyDown();
+
+
+public:
+// 	static MSG					g_Msg;
+// 	static HHOOK				m_hookSheet;
+
+private:
+	void						UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
+	void						SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext);
+
+private:
+	CPDFDoc_Environment*				m_pApp;
+	CFFL_Widget2Filler			m_Maps;
+	FX_BOOL						m_bNotifying;
+};
+
+class CFFL_PrivateData
+{
+public:
+	CPDFSDK_Widget*			pWidget;
+	CPDFSDK_PageView*	pPageView;
+	int					nWidgetAge;
+	int					nValueAge;
+};
+
+#endif //_FFL_IFORMFILLER_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_ListBox.h b/fpdfsdk/include/formfiller/FFL_ListBox.h
index 899c44d..43f5fce 100644
--- a/fpdfsdk/include/formfiller/FFL_ListBox.h
+++ b/fpdfsdk/include/formfiller/FFL_ListBox.h
@@ -1,44 +1,44 @@
-// 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 _FFL_LISTBOX_H_

-#define _FFL_LISTBOX_H_

-

-class  CBA_FontMap;

-class CFFL_ListBox : public CFFL_FormFiller

-{

-public:

-	CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);

-	virtual ~CFFL_ListBox();

-

-	virtual	PWL_CREATEPARAM		GetCreateParam();

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-

- 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,

- 									PDFSDK_FieldAction& fa);

- 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 

- 									const PDFSDK_FieldAction& fa);

-

-	virtual void				SaveState(CPDFSDK_PageView* pPageView);

-	virtual void				RestoreState(CPDFSDK_PageView* pPageView);

-

-	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);

-	virtual void				OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);

-

-private:

-	CBA_FontMap*					m_pFontMap;

-	CFX_MapPtrTemplate<int, void*>	m_OriginSelections;

-	CFX_ArrayTemplate<int>			m_State;

-};

-

-

-#endif //_FFL_LISTBOX_H_

-

+// 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 _FFL_LISTBOX_H_
+#define _FFL_LISTBOX_H_
+
+class  CBA_FontMap;
+class CFFL_ListBox : public CFFL_FormFiller
+{
+public:
+	CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+	virtual ~CFFL_ListBox();
+
+	virtual	PWL_CREATEPARAM		GetCreateParam();
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+
+ 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ 									PDFSDK_FieldAction& fa);
+ 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 
+ 									const PDFSDK_FieldAction& fa);
+
+	virtual void				SaveState(CPDFSDK_PageView* pPageView);
+	virtual void				RestoreState(CPDFSDK_PageView* pPageView);
+
+	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+	virtual void				OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);
+
+private:
+	CBA_FontMap*					m_pFontMap;
+	CFX_MapPtrTemplate<int, void*>	m_OriginSelections;
+	CFX_ArrayTemplate<int>			m_State;
+};
+
+
+#endif //_FFL_LISTBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_Notify.h b/fpdfsdk/include/formfiller/FFL_Notify.h
index 8a0b7a3..c729b74 100644
--- a/fpdfsdk/include/formfiller/FFL_Notify.h
+++ b/fpdfsdk/include/formfiller/FFL_Notify.h
@@ -1,54 +1,54 @@
-// 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

-

-#if !defined(_FFL_NOTIFY_H_)

-#define _FFL_NOTIFY_H_

-

-class CFFL_FormFiller;

-

-class CFFL_Notify

-{

-public:

-	CFFL_Notify(CFFL_FormFiller * pFormFiller);	

-	virtual ~CFFL_Notify();

-

-public:

-	FX_BOOL									OnSetFocus(FX_BOOL & bExit);

-	FX_BOOL									OnMouseEnter(FX_BOOL & bExit);

-	FX_BOOL									OnMouseDown(FX_BOOL & bExit);

-	FX_BOOL									OnMouseUp(FX_BOOL & bExit);	

-	FX_BOOL									OnMouseExit(FX_BOOL & bExit);	

-	FX_BOOL									OnKillFocus(FX_BOOL & bExit);

-

-	FX_BOOL									OnCalculate();

-	FX_BOOL									OnFormat(int iCommitKey);

-	FX_BOOL									OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, 

-											   const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,

-											   FX_BOOL bShift, FX_BOOL & bRC);

-	FX_BOOL									OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, 

-											   const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,

-											   FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, 

-											   int& nSelStart, int& nSelEnd, FX_BOOL& bRC);

-

-	void									BeforeNotify();

-	void									AfterNotify();

-	FX_BOOL									IsNotifying() const {return m_nNotifyFlag > 0;}

-

-private:

-//	CReader_InterForm *						GetReaderInterForm();

- 	FX_BOOL									DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit);

- 	FX_BOOL									FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action);

- 	FX_BOOL									FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action);

- 	FX_BOOL									ExecuteActionTree(CPDF_AAction::AActionType eAAT, CPDF_Action & action, FX_BOOL& bExit);

- 	FX_BOOL									ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit);

-

-	CFFL_FormFiller *						m_pFormFiller;

-	FX_BOOL									m_bDoActioning;

-	FX_INT32								m_nNotifyFlag;

-};

-

-#endif

-

+// 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
+
+#if !defined(_FFL_NOTIFY_H_)
+#define _FFL_NOTIFY_H_
+
+class CFFL_FormFiller;
+
+class CFFL_Notify
+{
+public:
+	CFFL_Notify(CFFL_FormFiller * pFormFiller);	
+	virtual ~CFFL_Notify();
+
+public:
+	FX_BOOL									OnSetFocus(FX_BOOL & bExit);
+	FX_BOOL									OnMouseEnter(FX_BOOL & bExit);
+	FX_BOOL									OnMouseDown(FX_BOOL & bExit);
+	FX_BOOL									OnMouseUp(FX_BOOL & bExit);	
+	FX_BOOL									OnMouseExit(FX_BOOL & bExit);	
+	FX_BOOL									OnKillFocus(FX_BOOL & bExit);
+
+	FX_BOOL									OnCalculate();
+	FX_BOOL									OnFormat(int iCommitKey);
+	FX_BOOL									OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, 
+											   const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
+											   FX_BOOL bShift, FX_BOOL & bRC);
+	FX_BOOL									OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, 
+											   const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
+											   FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, 
+											   int& nSelStart, int& nSelEnd, FX_BOOL& bRC);
+
+	void									BeforeNotify();
+	void									AfterNotify();
+	FX_BOOL									IsNotifying() const {return m_nNotifyFlag > 0;}
+
+private:
+//	CReader_InterForm *						GetReaderInterForm();
+ 	FX_BOOL									DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit);
+ 	FX_BOOL									FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action);
+ 	FX_BOOL									FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action);
+ 	FX_BOOL									ExecuteActionTree(CPDF_AAction::AActionType eAAT, CPDF_Action & action, FX_BOOL& bExit);
+ 	FX_BOOL									ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit);
+
+	CFFL_FormFiller *						m_pFormFiller;
+	FX_BOOL									m_bDoActioning;
+	FX_INT32								m_nNotifyFlag;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/formfiller/FFL_PushButton.h b/fpdfsdk/include/formfiller/FFL_PushButton.h
index 4dcff14..be5e735 100644
--- a/fpdfsdk/include/formfiller/FFL_PushButton.h
+++ b/fpdfsdk/include/formfiller/FFL_PushButton.h
@@ -1,25 +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 _FFL_PUSHBUTTON_H_

-#define _FFL_PUSHBUTTON_H_

-

-class CFFL_PushButton : public CFFL_Button

-{

-public:

-	CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);

-	virtual ~CFFL_PushButton();

-

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView,  CPDFSDK_Annot* pAnnot, 

-									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-									FX_DWORD dwFlags);

-};

-

-#endif //_FFL_PUSHBUTTON_H_

-

+// 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 _FFL_PUSHBUTTON_H_
+#define _FFL_PUSHBUTTON_H_
+
+class CFFL_PushButton : public CFFL_Button
+{
+public:
+	CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+	virtual ~CFFL_PushButton();
+
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView,  CPDFSDK_Annot* pAnnot, 
+									CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+									FX_DWORD dwFlags);
+};
+
+#endif //_FFL_PUSHBUTTON_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_RadioButton.h b/fpdfsdk/include/formfiller/FFL_RadioButton.h
index bab8584..037e563 100644
--- a/fpdfsdk/include/formfiller/FFL_RadioButton.h
+++ b/fpdfsdk/include/formfiller/FFL_RadioButton.h
@@ -1,25 +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 _FFL_RADIOBUTTON_H_

-#define _FFL_RADIOBUTTON_H_

-

-class CFFL_RadioButton : public CFFL_Button

-{

-public:

-	CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);

-	virtual ~CFFL_RadioButton();

-	

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-  	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-};

-

-#endif //_FFL_RADIOBUTTON_H_

-

+// 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 _FFL_RADIOBUTTON_H_
+#define _FFL_RADIOBUTTON_H_
+
+class CFFL_RadioButton : public CFFL_Button
+{
+public:
+	CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+	virtual ~CFFL_RadioButton();
+	
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+  	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+};
+
+#endif //_FFL_RADIOBUTTON_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_TextField.h b/fpdfsdk/include/formfiller/FFL_TextField.h
index 2b6f069..d2808e9 100644
--- a/fpdfsdk/include/formfiller/FFL_TextField.h
+++ b/fpdfsdk/include/formfiller/FFL_TextField.h
@@ -1,89 +1,89 @@
-// 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

-

-#if !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)

-#define AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_

-

-#include "FFL_FormFiller.h"

-

-#define BF_ALIGN_LEFT			0

-#define BF_ALIGN_MIDDLE			1

-#define BF_ALIGN_RIGHT			2

-

-class CBA_FontMap;

-

-class CFFL_EditUndoItem //: public IUndoItem

-{

-public:

-	CFFL_EditUndoItem(CPWL_Edit* pEdit);

-	virtual ~CFFL_EditUndoItem();

-	

-	virtual void					Undo();

-	virtual void					Redo();

-	virtual CFX_WideString			GetDescr();

-	virtual void					Release();

-	

-private:

-	CPWL_Edit*						m_pEdit;

-};

-

-struct FFL_TextFieldState

-{

-	int nStart;

-	int nEnd;

-	CFX_WideString sValue;

-};

-

-class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify

-{

-public:

-	CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);

-	virtual ~CFFL_TextField();

-	

-	virtual	PWL_CREATEPARAM		GetCreateParam();

-	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);

-

-	

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);

-	

-	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);

-	virtual void				SaveData(CPDFSDK_PageView* pPageView);

-	

- 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,

- 												PDFSDK_FieldAction& fa);

- 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 

-									const PDFSDK_FieldAction& fa);

- 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 

- 												const PDFSDK_FieldAction& faNew);

-	virtual void				SaveState(CPDFSDK_PageView* pPageView);

-	virtual void				RestoreState(CPDFSDK_PageView* pPageView);

-	

-	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);

-	

-public:

-	virtual void				OnSetFocus(CPWL_Wnd* pWnd);

-	virtual void				OnKillFocus(CPWL_Wnd* pWnd);

-	

-public:

-	virtual void				OnAddUndo(CPWL_Edit* pEdit);

-	

-public:

-	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 

-	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 

-	

-	virtual void				DoCopy(CPDFSDK_Document* pDocument); 

-	virtual void				DoCut(CPDFSDK_Document* pDocument); 

-	virtual void				DoPaste(CPDFSDK_Document* pDocument); 

-	

-private:

-	CBA_FontMap*				m_pFontMap;

-//	CBA_SpellCheck*				m_pSpellCheck;

-	FFL_TextFieldState			m_State;

-//	CFFL_IM_BOX					m_IMBox;

-};

-

-#endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)

+// 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
+
+#if !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
+#define AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_
+
+#include "FFL_FormFiller.h"
+
+#define BF_ALIGN_LEFT			0
+#define BF_ALIGN_MIDDLE			1
+#define BF_ALIGN_RIGHT			2
+
+class CBA_FontMap;
+
+class CFFL_EditUndoItem //: public IUndoItem
+{
+public:
+	CFFL_EditUndoItem(CPWL_Edit* pEdit);
+	virtual ~CFFL_EditUndoItem();
+	
+	virtual void					Undo();
+	virtual void					Redo();
+	virtual CFX_WideString			GetDescr();
+	virtual void					Release();
+	
+private:
+	CPWL_Edit*						m_pEdit;
+};
+
+struct FFL_TextFieldState
+{
+	int nStart;
+	int nEnd;
+	CFX_WideString sValue;
+};
+
+class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
+{
+public:
+	CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+	virtual ~CFFL_TextField();
+	
+	virtual	PWL_CREATEPARAM		GetCreateParam();
+	virtual CPWL_Wnd*			NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+	
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+	
+	virtual FX_BOOL				IsDataChanged(CPDFSDK_PageView* pPageView);
+	virtual void				SaveData(CPDFSDK_PageView* pPageView);
+	
+ 	virtual void				GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ 												PDFSDK_FieldAction& fa);
+ 	virtual void				SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 
+									const PDFSDK_FieldAction& fa);
+ 	virtual FX_BOOL				IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 
+ 												const PDFSDK_FieldAction& faNew);
+	virtual void				SaveState(CPDFSDK_PageView* pPageView);
+	virtual void				RestoreState(CPDFSDK_PageView* pPageView);
+	
+	virtual CPWL_Wnd*			ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+	
+public:
+	virtual void				OnSetFocus(CPWL_Wnd* pWnd);
+	virtual void				OnKillFocus(CPWL_Wnd* pWnd);
+	
+public:
+	virtual void				OnAddUndo(CPWL_Edit* pEdit);
+	
+public:
+	virtual FX_BOOL				CanCopy(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanCut(CPDFSDK_Document* pDocument); 
+	virtual FX_BOOL				CanPaste(CPDFSDK_Document* pDocument); 
+	
+	virtual void				DoCopy(CPDFSDK_Document* pDocument); 
+	virtual void				DoCut(CPDFSDK_Document* pDocument); 
+	virtual void				DoPaste(CPDFSDK_Document* pDocument); 
+	
+private:
+	CBA_FontMap*				m_pFontMap;
+//	CBA_SpellCheck*				m_pSpellCheck;
+	FFL_TextFieldState			m_State;
+//	CFFL_IM_BOX					m_IMBox;
+};
+
+#endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
diff --git a/fpdfsdk/include/formfiller/FFL_Utils.h b/fpdfsdk/include/formfiller/FFL_Utils.h
index 07f2bee..2fdc7b1 100644
--- a/fpdfsdk/include/formfiller/FFL_Utils.h
+++ b/fpdfsdk/include/formfiller/FFL_Utils.h
@@ -1,20 +1,20 @@
-// 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

-

-#define FFL_BASE_USERUNIT			1.0f / 72.0f

-

-template<class T> T FFL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }

-template<class T> T FFL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }

-

-class CFFL_Utils

-{

-public:

-	static CPDF_Rect				MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);

-	static CPDF_Rect				InflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);

-	static CPDF_Rect				DeflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);

-	static FX_BOOL					TraceObject(CPDF_Object* pObj);

-};

-

+// 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
+
+#define FFL_BASE_USERUNIT			1.0f / 72.0f
+
+template<class T> T FFL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
+template<class T> T FFL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+
+class CFFL_Utils
+{
+public:
+	static CPDF_Rect				MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
+	static CPDF_Rect				InflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
+	static CPDF_Rect				DeflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
+	static FX_BOOL					TraceObject(CPDF_Object* pObj);
+};
+
diff --git a/fpdfsdk/include/formfiller/FormFiller.h b/fpdfsdk/include/formfiller/FormFiller.h
index e7a22a0..8e45d5e 100644
--- a/fpdfsdk/include/formfiller/FormFiller.h
+++ b/fpdfsdk/include/formfiller/FormFiller.h
@@ -1,30 +1,30 @@
-// 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 _FORMFILLER_H_

-#define _FORMFILLER_H_

-

-

-

-#ifndef _INC_PDFAPI

-	#define _INC_PDFAPI

-

-	#include "../../../core/include/fpdfapi/fpdf_module.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 

-	#include "../../../core/include/fxcrt/fx_xml.h" 

-

-#endif

-

-#include "../fsdk_mgr.h"

-

-#include "../fxedit/fx_edit.h"

-#include "../pdfwindow/IPDFWindow.h"

-

-

-

-#endif //_FORMFILLER_H_

-

+// 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 _FORMFILLER_H_
+#define _FORMFILLER_H_
+
+
+
+#ifndef _INC_PDFAPI
+	#define _INC_PDFAPI
+
+	#include "../../../core/include/fpdfapi/fpdf_module.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 
+	#include "../../../core/include/fxcrt/fx_xml.h" 
+
+#endif
+
+#include "../fsdk_mgr.h"
+
+#include "../fxedit/fx_edit.h"
+#include "../pdfwindow/IPDFWindow.h"
+
+
+
+#endif //_FORMFILLER_H_
+
diff --git a/fpdfsdk/include/fpdf_dataavail.h b/fpdfsdk/include/fpdf_dataavail.h
index 9d373fc..971ab25 100644
--- a/fpdfsdk/include/fpdf_dataavail.h
+++ b/fpdfsdk/include/fpdf_dataavail.h
@@ -1,222 +1,222 @@
-// 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 _FPDF_DATAAVAIL_H_

-#define _FPDF_DATAAVAIL_H_

-

-#ifndef _FPDFVIEW_H_

-#include "fpdfview.h"

-#endif

-

-

-/** The result of the process which check linearized PDF. */

-#define FSDK_IS_LINEARIZED			1

-#define FSDK_NOT_LINEARIZED			0

-#define FSDK_UNKNOW_LINEARIZED		-1

-

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-/**

- * Interface: FX_FILEAVAIL

- *			Interface for checking whether the section of the file is available. 

- */

-typedef struct _FX_FILEAVAIL {

-	/**

-	 * Version number of the interface. Currently must be 1.

-	 */

-	int version;

-

-	/**

-	 * Method: IsDataAvail

-	 *		Report whether the specified data section is available. A section is available only if all bytes in the section is available. 

-	 * Interface Version:

-	 *		1

-	 * Implementation Required:

-	 *		Yes

-	 * Parameters:

-	 *		pThis		-	Pointer to the interface structure itself.

-	 *		offset		-	The offset of the data section in the file.

-	 *		size		-	The size of the data section

-	 * Return Value:

-	 *		true means the specified data section is available.

-	 * Comments:

-	 *		Called by Foxit SDK to check whether the data section is ready.

-	 */

-	bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);

-} FX_FILEAVAIL;

-

-typedef void* FPDF_AVAIL;

-

-/**

-* Function: FPDFAvail_Create

-*			Create a document availability provider.

-*

-* Parameters: 

-*			file_avail	-	Pointer to file availability interface to check availability of file data.

-*			file		-	Pointer to a file access interface for reading data from file.

-* Return value:

-*			A handle to the document availability provider. NULL for error.

-* Comments:

-*			Application must call FPDFAvail_Destroy when done with the availability provider.

-*/

-DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file);

-

-/**

-* Function: FPDFAvail_Destroy

-*			Destroy a document availibity provider.

-*

-* Parameters: 

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-* Return Value:

-*			None.

-*/

-DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);

-

-/**

- * Interface: FX_DOWNLOADHINTS

- *			Download hints interface. Used to receive hints for further downloading.

- */

-typedef struct _FX_DOWNLOADHINTS {

-	/**

-	 * Version number of the interface. Currently must be 1.

-	 */

-	int version;

-

-	/**

-	 * Method: AddSegment

-	 *		Add a section to be downloaded.

-	 * Interface Version:

-	 *		1

-	 * Implementation Required:

-	 *		Yes

-	 * Parameters:

-	 *		pThis		-	Pointer to the interface structure itself.

-	 *		offset		-	The offset of the hint reported to be downloaded.

-	 *		size		-	The size of the hint reported to be downloaded.

-	 * Return Value:

-	 *		None.

-	 * Comments:

-	 *		Called by Foxit SDK to report some downloading hints for download manager.

-	 *		The position and size of section may be not accurate, part of the section might be already available. 

-	 *		The download manager must deal with that to maximize download efficiency.

-	 */

-	void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size);

-} FX_DOWNLOADHINTS;

-

-/**

-* Function: FPDFAvail_IsDocAvail

-*			Check whether the document is ready for loading, if not, get download hints.

-*

-* Parameters: 

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-*			hints		-	Pointer to a download hints interface, receiving generated hints

-* Return value:

-*			Non-zero for page is fully available, 0 for page not yet available.

-* Comments:

-*			The application should call this function whenever new data arrived, and process all the

-*			generated download hints if any, until the function returns non-zero value. Then the 

-*			application can call FPDFAvail_GetDocument() to get a document handle.

-*/

-DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);

-

-/**

-* Function: FPDFAvail_GetDocument

-*			Get document from the availability provider.

-*

-* Parameters:

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-*     password	-	Optional password for decrypting the PDF file.

-* Return value:

-*			Handle to the document.

-* Comments:

-*			After FPDFAvail_IsDocAvail() returns TRUE, the application should call this function to

-*			get the document handle. To close the document, use FPDF_CloseDocument function.

-*/

-DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,

-                                                      FPDF_BYTESTRING password);

-

-/**

-* Function: FPDFAvail_GetFirstPageNum

-*			Get page number for the first available page in a linearized PDF

-*

-* Parameters:

-*			doc			-	A document handle returned by FPDFAvail_GetDocument

-* Return Value:

-*			Zero-based index for the first available page.

-* Comments:

-*			For most linearized PDFs, the first available page would be just the first page, however,

-*			some PDFs might make other page to be the first available page.

-*			For non-linearized PDF, this function will always return zero.

-*/

-DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);

-

-/**

-* Function: FPDFAvail_IsPageAvail

-*			Check whether a page is ready for loading, if not, get download hints.

-*

-* Parameters: 

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-*			page_index	-	Index number of the page. 0 for the first page.

-*			hints		-	Pointer to a download hints interface, receiving generated hints

-* Return value:

-*			Non-zero for page is fully available, 0 for page not yet available.

-* Comments:

-*			This function call be called only after FPDFAvail_GetDocument if called.

-*			The application should call this function whenever new data arrived, and process all the

-*			generated download hints if any, until the function returns non-zero value. Then the 

-*			application can perform page loading.

-*/

-DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, int page_index, FX_DOWNLOADHINTS* hints);

-

-/**

-* Function: FPDFAvail_ISFormAvail

-*			Check whether Form data is ready for init, if not, get download hints.

-*

-* Parameters: 

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-*			hints		-	Pointer to a download hints interface, receiving generated hints

-* Return value:

-*			Non-zero for Form data is fully available, 0 for Form data not yet available.

-*			Details: -1 - error, the input parameter not correct, such as hints is null.

-*					 0  - data not available

-*					 1  - data available

-*					 2  - no form data.				

-* Comments:

-*			This function call be called only after FPDFAvail_GetDocument if called. 

-*			The application should call this function whenever new data arrived, and process all the

-*			generated download hints if any, until the function returns non-zero value. Then the 

-*			application can perform page loading. Recommend to call FPDFDOC_InitFormFillEnviroument

-*			after the function returns non-zero value.

-*/

-DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);

-

-/**

-* Function: FPDFAvail_IsLinearized

-*			To check whether a document is Linearized PDF file.

-*

-* Parameters:

-*			avail		-	Handle to document availability provider returned by FPDFAvail_Create

-* Return value:

-*			return TRUE means the document is linearized PDF else not.

-*			FSDK_IS_LINEARIZED is a linearize file.

-*			FSDK_NOT_LINEARIZED is not a linearize file.

-*			FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize file.

-* Comments:

-*			It return TRUE/FALSE as soon as we have first 1K data. 	If the file's size less than

-*			1K,we don't known whether the PDF is a linearized file.

-*

-*/

-DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif

-

+// 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 _FPDF_DATAAVAIL_H_
+#define _FPDF_DATAAVAIL_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+
+/** The result of the process which check linearized PDF. */
+#define FSDK_IS_LINEARIZED			1
+#define FSDK_NOT_LINEARIZED			0
+#define FSDK_UNKNOW_LINEARIZED		-1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Interface: FX_FILEAVAIL
+ *			Interface for checking whether the section of the file is available. 
+ */
+typedef struct _FX_FILEAVAIL {
+	/**
+	 * Version number of the interface. Currently must be 1.
+	 */
+	int version;
+
+	/**
+	 * Method: IsDataAvail
+	 *		Report whether the specified data section is available. A section is available only if all bytes in the section is available. 
+	 * Interface Version:
+	 *		1
+	 * Implementation Required:
+	 *		Yes
+	 * Parameters:
+	 *		pThis		-	Pointer to the interface structure itself.
+	 *		offset		-	The offset of the data section in the file.
+	 *		size		-	The size of the data section
+	 * Return Value:
+	 *		true means the specified data section is available.
+	 * Comments:
+	 *		Called by Foxit SDK to check whether the data section is ready.
+	 */
+	bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);
+} FX_FILEAVAIL;
+
+typedef void* FPDF_AVAIL;
+
+/**
+* Function: FPDFAvail_Create
+*			Create a document availability provider.
+*
+* Parameters: 
+*			file_avail	-	Pointer to file availability interface to check availability of file data.
+*			file		-	Pointer to a file access interface for reading data from file.
+* Return value:
+*			A handle to the document availability provider. NULL for error.
+* Comments:
+*			Application must call FPDFAvail_Destroy when done with the availability provider.
+*/
+DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file);
+
+/**
+* Function: FPDFAvail_Destroy
+*			Destroy a document availibity provider.
+*
+* Parameters: 
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+* Return Value:
+*			None.
+*/
+DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
+
+/**
+ * Interface: FX_DOWNLOADHINTS
+ *			Download hints interface. Used to receive hints for further downloading.
+ */
+typedef struct _FX_DOWNLOADHINTS {
+	/**
+	 * Version number of the interface. Currently must be 1.
+	 */
+	int version;
+
+	/**
+	 * Method: AddSegment
+	 *		Add a section to be downloaded.
+	 * Interface Version:
+	 *		1
+	 * Implementation Required:
+	 *		Yes
+	 * Parameters:
+	 *		pThis		-	Pointer to the interface structure itself.
+	 *		offset		-	The offset of the hint reported to be downloaded.
+	 *		size		-	The size of the hint reported to be downloaded.
+	 * Return Value:
+	 *		None.
+	 * Comments:
+	 *		Called by Foxit SDK to report some downloading hints for download manager.
+	 *		The position and size of section may be not accurate, part of the section might be already available. 
+	 *		The download manager must deal with that to maximize download efficiency.
+	 */
+	void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size);
+} FX_DOWNLOADHINTS;
+
+/**
+* Function: FPDFAvail_IsDocAvail
+*			Check whether the document is ready for loading, if not, get download hints.
+*
+* Parameters: 
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+*			hints		-	Pointer to a download hints interface, receiving generated hints
+* Return value:
+*			Non-zero for page is fully available, 0 for page not yet available.
+* Comments:
+*			The application should call this function whenever new data arrived, and process all the
+*			generated download hints if any, until the function returns non-zero value. Then the 
+*			application can call FPDFAvail_GetDocument() to get a document handle.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_GetDocument
+*			Get document from the availability provider.
+*
+* Parameters:
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+*     password	-	Optional password for decrypting the PDF file.
+* Return value:
+*			Handle to the document.
+* Comments:
+*			After FPDFAvail_IsDocAvail() returns TRUE, the application should call this function to
+*			get the document handle. To close the document, use FPDF_CloseDocument function.
+*/
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,
+                                                      FPDF_BYTESTRING password);
+
+/**
+* Function: FPDFAvail_GetFirstPageNum
+*			Get page number for the first available page in a linearized PDF
+*
+* Parameters:
+*			doc			-	A document handle returned by FPDFAvail_GetDocument
+* Return Value:
+*			Zero-based index for the first available page.
+* Comments:
+*			For most linearized PDFs, the first available page would be just the first page, however,
+*			some PDFs might make other page to be the first available page.
+*			For non-linearized PDF, this function will always return zero.
+*/
+DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
+
+/**
+* Function: FPDFAvail_IsPageAvail
+*			Check whether a page is ready for loading, if not, get download hints.
+*
+* Parameters: 
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+*			page_index	-	Index number of the page. 0 for the first page.
+*			hints		-	Pointer to a download hints interface, receiving generated hints
+* Return value:
+*			Non-zero for page is fully available, 0 for page not yet available.
+* Comments:
+*			This function call be called only after FPDFAvail_GetDocument if called.
+*			The application should call this function whenever new data arrived, and process all the
+*			generated download hints if any, until the function returns non-zero value. Then the 
+*			application can perform page loading.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, int page_index, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_ISFormAvail
+*			Check whether Form data is ready for init, if not, get download hints.
+*
+* Parameters: 
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+*			hints		-	Pointer to a download hints interface, receiving generated hints
+* Return value:
+*			Non-zero for Form data is fully available, 0 for Form data not yet available.
+*			Details: -1 - error, the input parameter not correct, such as hints is null.
+*					 0  - data not available
+*					 1  - data available
+*					 2  - no form data.				
+* Comments:
+*			This function call be called only after FPDFAvail_GetDocument if called. 
+*			The application should call this function whenever new data arrived, and process all the
+*			generated download hints if any, until the function returns non-zero value. Then the 
+*			application can perform page loading. Recommend to call FPDFDOC_InitFormFillEnviroument
+*			after the function returns non-zero value.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_IsLinearized
+*			To check whether a document is Linearized PDF file.
+*
+* Parameters:
+*			avail		-	Handle to document availability provider returned by FPDFAvail_Create
+* Return value:
+*			return TRUE means the document is linearized PDF else not.
+*			FSDK_IS_LINEARIZED is a linearize file.
+*			FSDK_NOT_LINEARIZED is not a linearize file.
+*			FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize file.
+* Comments:
+*			It return TRUE/FALSE as soon as we have first 1K data. 	If the file's size less than
+*			1K,we don't known whether the PDF is a linearized file.
+*
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/fpdfsdk/include/fpdf_ext.h b/fpdfsdk/include/fpdf_ext.h
index a8f268a..5efe0e6 100644
--- a/fpdfsdk/include/fpdf_ext.h
+++ b/fpdfsdk/include/fpdf_ext.h
@@ -1,108 +1,108 @@
-// 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 _FPDF_EXT_H_

-#define _FPDF_EXT_H_

-

-#ifndef _FPDFVIEW_H_

-#include "fpdfview.h"

-#endif

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-//flags for type of unsupport object.

-#define FPDF_UNSP_DOC_XFAFORM				1

-#define FPDF_UNSP_DOC_PORTABLECOLLECTION	2

-#define FPDF_UNSP_DOC_ATTACHMENT			3

-#define FPDF_UNSP_DOC_SECURITY				4

-#define FPDF_UNSP_DOC_SHAREDREVIEW			5

-#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT	6

-#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM	7

-#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL		8

-#define FPDF_UNSP_ANNOT_3DANNOT				11

-#define FPDF_UNSP_ANNOT_MOVIE				12

-#define FPDF_UNSP_ANNOT_SOUND				13

-#define FPDF_UNSP_ANNOT_SCREEN_MEDIA		14

-#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA	15

-#define FPDF_UNSP_ANNOT_ATTACHMENT			16

-#define FPDF_UNSP_ANNOT_SIG					17

-

-typedef	struct _UNSUPPORT_INFO

-{

-	/**

-	* Version number of the interface. Currently must be 1.

-	**/

-	int version;

-	

-	/** 

-	* Method: FSDK_UnSupport_Handler

-	*			 UnSupport Object process handling function.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			Yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	*		nType		-	The type of unsupportObject

-	* 	Return value:

-	* 		None.

-	* */

-

-	void(*FSDK_UnSupport_Handler)(_UNSUPPORT_INFO* pThis,int nType);

-}UNSUPPORT_INFO;

-

-

-/**

- * Function: FSDK_SetUnSpObjProcessHandler

- *			 Setup A UnSupport Object process handler for foxit sdk. 

- * Parameters:

- *			unsp_info		-	Pointer to a UNSUPPORT_INFO structure.

- * Return Value:

- *			TRUE means successful. FALSE means fails. 

- **/

-

-DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);

-

-//flags for page mode. 

-

-//Unknown value

-#define PAGEMODE_UNKONOWN		-1

-

-//Neither document outline nor thumbnail images visible

-#define PAGEMODE_USENONE		0

-

-//Document outline visible

-#define PAGEMODE_USEOUTLINES	1

-

-//Thumbnial images visible

-#define PAGEMODE_USETHUMBS		2

-

-//Full-screen mode, with no menu bar, window controls, or any other window visible

-#define PAGEMODE_FULLSCREEN		3

-

-//Optional content group panel visible

-#define PAGEMODE_USEOC			4

-

-//Attachments panel visible

-#define PAGEMODE_USEATTACHMENTS	5

-

-

-/**

- * Function: FPDFDoc_GetPageMode

- *			 Get the document's PageMode(How the document should be displayed when opened) 

- * Parameters:

- *			doc		-	Handle to document. Returned by FPDF_LoadDocument function.

- * Return Value:

- *			The flags for page mode.

- **/

-DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);

-

-#ifdef __cplusplus

-};

-#endif

-#endif

+// 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 _FPDF_EXT_H_
+#define _FPDF_EXT_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//flags for type of unsupport object.
+#define FPDF_UNSP_DOC_XFAFORM				1
+#define FPDF_UNSP_DOC_PORTABLECOLLECTION	2
+#define FPDF_UNSP_DOC_ATTACHMENT			3
+#define FPDF_UNSP_DOC_SECURITY				4
+#define FPDF_UNSP_DOC_SHAREDREVIEW			5
+#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT	6
+#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM	7
+#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL		8
+#define FPDF_UNSP_ANNOT_3DANNOT				11
+#define FPDF_UNSP_ANNOT_MOVIE				12
+#define FPDF_UNSP_ANNOT_SOUND				13
+#define FPDF_UNSP_ANNOT_SCREEN_MEDIA		14
+#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA	15
+#define FPDF_UNSP_ANNOT_ATTACHMENT			16
+#define FPDF_UNSP_ANNOT_SIG					17
+
+typedef	struct _UNSUPPORT_INFO
+{
+	/**
+	* Version number of the interface. Currently must be 1.
+	**/
+	int version;
+	
+	/** 
+	* Method: FSDK_UnSupport_Handler
+	*			 UnSupport Object process handling function.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			Yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	*		nType		-	The type of unsupportObject
+	* 	Return value:
+	* 		None.
+	* */
+
+	void(*FSDK_UnSupport_Handler)(_UNSUPPORT_INFO* pThis,int nType);
+}UNSUPPORT_INFO;
+
+
+/**
+ * Function: FSDK_SetUnSpObjProcessHandler
+ *			 Setup A UnSupport Object process handler for foxit sdk. 
+ * Parameters:
+ *			unsp_info		-	Pointer to a UNSUPPORT_INFO structure.
+ * Return Value:
+ *			TRUE means successful. FALSE means fails. 
+ **/
+
+DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
+
+//flags for page mode. 
+
+//Unknown value
+#define PAGEMODE_UNKONOWN		-1
+
+//Neither document outline nor thumbnail images visible
+#define PAGEMODE_USENONE		0
+
+//Document outline visible
+#define PAGEMODE_USEOUTLINES	1
+
+//Thumbnial images visible
+#define PAGEMODE_USETHUMBS		2
+
+//Full-screen mode, with no menu bar, window controls, or any other window visible
+#define PAGEMODE_FULLSCREEN		3
+
+//Optional content group panel visible
+#define PAGEMODE_USEOC			4
+
+//Attachments panel visible
+#define PAGEMODE_USEATTACHMENTS	5
+
+
+/**
+ * Function: FPDFDoc_GetPageMode
+ *			 Get the document's PageMode(How the document should be displayed when opened) 
+ * Parameters:
+ *			doc		-	Handle to document. Returned by FPDF_LoadDocument function.
+ * Return Value:
+ *			The flags for page mode.
+ **/
+DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
+
+#ifdef __cplusplus
+};
+#endif
+#endif
diff --git a/fpdfsdk/include/fpdf_flatten.h b/fpdfsdk/include/fpdf_flatten.h
index 26e324d..2e9e509 100644
--- a/fpdfsdk/include/fpdf_flatten.h
+++ b/fpdfsdk/include/fpdf_flatten.h
@@ -1,42 +1,42 @@
-// 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 _FPDF_FLATTEN_H_

-#define _FPDF_FLATTEN_H_

-	

-#include "fpdfview.h"

-

-#define FLATTEN_FAIL			0	// Flatten operation failed.

-#define FLATTEN_SUCCESS			1	// Flatten operation succeed.

-#define FLATTEN_NOTINGTODO		2	// There is nothing can be flatten.

-	

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-#define FLAT_NORMALDISPLAY     0

-#define FLAT_PRINT             1    

-	//Function: FPDFPage_Flatten

-

-	//			Flat a pdf page,annotations or form fields will become part of the page contents.

-	//Parameters:

-

-	//			page  - Handle to the page. Returned by FPDF_LoadPage function.

-	//			nFlag - the flag for the use of flatten result. Zero for normal display, 1 for print.

-	//Return value:

-	//			The result flag of the function, See flags above ( FLATTEN_FAIL, FLATTEN_SUCCESS, FLATTEN_NOTINGTODO ).

-	//

-	// Comments: Current version all fails return zero. If necessary we will assign different value

-	//			to indicate different fail reason.

-	// 

-	DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag);

-		

-		

-#ifdef __cplusplus

-};

-#endif

-

-#endif //_FPDF_FLATTEN_H_

+// 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 _FPDF_FLATTEN_H_
+#define _FPDF_FLATTEN_H_
+	
+#include "fpdfview.h"
+
+#define FLATTEN_FAIL			0	// Flatten operation failed.
+#define FLATTEN_SUCCESS			1	// Flatten operation succeed.
+#define FLATTEN_NOTINGTODO		2	// There is nothing can be flatten.
+	
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FLAT_NORMALDISPLAY     0
+#define FLAT_PRINT             1    
+	//Function: FPDFPage_Flatten
+
+	//			Flat a pdf page,annotations or form fields will become part of the page contents.
+	//Parameters:
+
+	//			page  - Handle to the page. Returned by FPDF_LoadPage function.
+	//			nFlag - the flag for the use of flatten result. Zero for normal display, 1 for print.
+	//Return value:
+	//			The result flag of the function, See flags above ( FLATTEN_FAIL, FLATTEN_SUCCESS, FLATTEN_NOTINGTODO ).
+	//
+	// Comments: Current version all fails return zero. If necessary we will assign different value
+	//			to indicate different fail reason.
+	// 
+	DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag);
+		
+		
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDF_FLATTEN_H_
diff --git a/fpdfsdk/include/fpdf_fwlevent.h b/fpdfsdk/include/fpdf_fwlevent.h
index cf34c21..f77e7e3 100644
--- a/fpdfsdk/include/fpdf_fwlevent.h
+++ b/fpdfsdk/include/fpdf_fwlevent.h
@@ -1,286 +1,286 @@
-// 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 _FWL_EVENT_H

-#define _FWL_EVENT_H

-

-#include "fpdfview.h"

-

-typedef int			FPDF_INT32;

-typedef unsigned int FPDF_UINT32;

-typedef float		FPDF_FLOAT;

-//event type

-typedef enum

-{

-	FWL_EVENTTYPE_Mouse = 0	,

-	FWL_EVENTTYPE_MouseWheel,	

-	FWL_EVENTTYPE_Key		,

-} FWL_EVENTTYPE;

-

-//key flag

-typedef enum

-{    

-	FWL_EVENTFLAG_ShiftKey			= 1 << 0,    

-	FWL_EVENTFLAG_ControlKey		= 1 << 1,

-    FWL_EVENTFLAG_AltKey			= 1 << 2,

-    FWL_EVENTFLAG_MetaKey			= 1 << 3,

-    FWL_EVENTFLAG_KeyPad			= 1 << 4,

-    FWL_EVENTFLAG_AutoRepeat		= 1 << 5,

-    FWL_EVENTFLAG_LeftButtonDown	= 1 << 6,

-    FWL_EVENTFLAG_MiddleButtonDown	= 1 << 7,

-    FWL_EVENTFLAG_RightButtonDown	= 1 << 8, 

-} FWL_EVENTFLAG;  

-

-// Mouse message command

-typedef enum

-{

-	FWL_EVENTMOUSECMD_LButtonDown =	1	,	

-	FWL_EVENTMOUSECMD_LButtonUp			,

-	FWL_EVENTMOUSECMD_LButtonDblClk		,

-	FWL_EVENTMOUSECMD_RButtonDown		,

-	FWL_EVENTMOUSECMD_RButtonUp			,

-	FWL_EVENTMOUSECMD_RButtonDblClk		,

-	FWL_EVENTMOUSECMD_MButtonDown		,

-	FWL_EVENTMOUSECMD_MButtonUp			,

-	FWL_EVENTMOUSECMD_MButtonDblClk		,

-	FWL_EVENTMOUSECMD_MouseMove			,

-	FWL_EVENTMOUSECMD_MouseEnter		,

-	FWL_EVENTMOUSECMD_MouseHover		,

-	FWL_EVENTMOUSECMD_MouseLeave		,

-} FWL_EVENT_MOUSECMD;

-

-//mouse event

-struct FWL_EVENT_MOUSE 

-{

-	FPDF_UINT32 command;

-	FPDF_DWORD flag;

-	FPDF_FLOAT x;

-	FPDF_FLOAT y;

-};

-

-//mouse wheel

-struct FWL_EVENT_MOUSEWHEEL 

-{	

-	FPDF_DWORD flag;

-	FPDF_FLOAT x;

-	FPDF_FLOAT y;

-	FPDF_FLOAT deltaX;

-    FPDF_FLOAT deltaY;  

-};

-

-//virtual keycode

-typedef enum 

-{

-  FWL_VKEY_Back		= 0x08,

-  FWL_VKEY_Tab		= 0x09,

-  FWL_VKEY_Clear	= 0x0C,

-  FWL_VKEY_Return	= 0x0D,

-  FWL_VKEY_Shift	= 0x10,

-  FWL_VKEY_Control	= 0x11,

-  FWL_VKEY_Menu		= 0x12,

-  FWL_VKEY_Pause	= 0x13,

-  FWL_VKEY_Capital	= 0x14,

-  FWL_VKEY_Kana		= 0x15,

-  FWL_VKEY_Hangul	= 0x15,

-  FWL_VKEY_Junja	= 0x17,

-  FWL_VKEY_Final	= 0x18,

-  FWL_VKEY_Hanja	= 0x19,

-  FWL_VKEY_Kanji	= 0x19,

-  FWL_VKEY_Escape	= 0x1B,

-  FWL_VKEY_Convert	= 0x1C,

-  FWL_VKEY_NonConvert = 0x1D,

-  FWL_VKEY_Accept	 = 0x1E,

-  FWL_VKEY_ModeChange = 0x1F,

-  FWL_VKEY_Space = 0x20,

-  FWL_VKEY_Prior = 0x21,

-  FWL_VKEY_Next = 0x22,

-  FWL_VKEY_End = 0x23,

-  FWL_VKEY_Home = 0x24,

-  FWL_VKEY_Left = 0x25,

-  FWL_VKEY_Up = 0x26,

-  FWL_VKEY_Right = 0x27,

-  FWL_VKEY_Down = 0x28,

-  FWL_VKEY_Select = 0x29,

-  FWL_VKEY_Print = 0x2A,

-  FWL_VKEY_Execute = 0x2B,

-  FWL_VKEY_Snapshot = 0x2C,

-  FWL_VKEY_Insert = 0x2D,

-  FWL_VKEY_Delete = 0x2E,

-  FWL_VKEY_Help = 0x2F,

-  FWL_VKEY_0 = 0x30,

-  FWL_VKEY_1 = 0x31,

-  FWL_VKEY_2 = 0x32,

-  FWL_VKEY_3 = 0x33,

-  FWL_VKEY_4 = 0x34,

-  FWL_VKEY_5 = 0x35,

-  FWL_VKEY_6 = 0x36,

-  FWL_VKEY_7 = 0x37,

-  FWL_VKEY_8 = 0x38,

-  FWL_VKEY_9 = 0x39,

-  FWL_VKEY_A = 0x41,

-  FWL_VKEY_B = 0x42,

-  FWL_VKEY_C = 0x43,

-  FWL_VKEY_D = 0x44,

-  FWL_VKEY_E = 0x45,

-  FWL_VKEY_F = 0x46,

-  FWL_VKEY_G = 0x47,

-  FWL_VKEY_H = 0x48,

-  FWL_VKEY_I = 0x49,

-  FWL_VKEY_J = 0x4A,

-  FWL_VKEY_K = 0x4B,

-  FWL_VKEY_L = 0x4C,

-  FWL_VKEY_M = 0x4D,

-  FWL_VKEY_N = 0x4E,

-  FWL_VKEY_O = 0x4F,

-  FWL_VKEY_P = 0x50,

-  FWL_VKEY_Q = 0x51,

-  FWL_VKEY_R = 0x52,

-  FWL_VKEY_S = 0x53,

-  FWL_VKEY_T = 0x54,

-  FWL_VKEY_U = 0x55,

-  FWL_VKEY_V = 0x56,

-  FWL_VKEY_W = 0x57,

-  FWL_VKEY_X = 0x58,

-  FWL_VKEY_Y = 0x59,

-  FWL_VKEY_Z = 0x5A,

-  FWL_VKEY_LWin = 0x5B,

-  FWL_VKEY_Command = 0x5B,

-  FWL_VKEY_RWin = 0x5C,

-  FWL_VKEY_Apps = 0x5D,

-  FWL_VKEY_Sleep = 0x5F,

-  FWL_VKEY_NumPad0 = 0x60,

-  FWL_VKEY_NumPad1 = 0x61,

-  FWL_VKEY_NumPad2 = 0x62,

-  FWL_VKEY_NumPad3 = 0x63,

-  FWL_VKEY_NumPad4 = 0x64,

-  FWL_VKEY_NumPad5 = 0x65,

-  FWL_VKEY_NumPad6 = 0x66,

-  FWL_VKEY_NumPad7 = 0x67,

-  FWL_VKEY_NumPad8 = 0x68,

-  FWL_VKEY_NumPad9 = 0x69,

-  FWL_VKEY_Multiply = 0x6A,

-  FWL_VKEY_Add = 0x6B,

-  FWL_VKEY_Separator = 0x6C,

-  FWL_VKEY_Subtract = 0x6D,

-  FWL_VKEY_Decimal = 0x6E,

-  FWL_VKEY_Divide = 0x6F,

-  FWL_VKEY_F1 = 0x70,

-  FWL_VKEY_F2 = 0x71,

-  FWL_VKEY_F3 = 0x72,

-  FWL_VKEY_F4 = 0x73,

-  FWL_VKEY_F5 = 0x74,

-  FWL_VKEY_F6 = 0x75,

-  FWL_VKEY_F7 = 0x76,

-  FWL_VKEY_F8 = 0x77,

-  FWL_VKEY_F9 = 0x78,

-  FWL_VKEY_F10 = 0x79,

-  FWL_VKEY_F11 = 0x7A,

-  FWL_VKEY_F12 = 0x7B,

-  FWL_VKEY_F13 = 0x7C,

-  FWL_VKEY_F14 = 0x7D,

-  FWL_VKEY_F15 = 0x7E,

-  FWL_VKEY_F16 = 0x7F,

-  FWL_VKEY_F17 = 0x80,

-  FWL_VKEY_F18 = 0x81,

-  FWL_VKEY_F19 = 0x82,

-  FWL_VKEY_F20 = 0x83,

-  FWL_VKEY_F21 = 0x84,

-  FWL_VKEY_F22 = 0x85,

-  FWL_VKEY_F23 = 0x86,

-  FWL_VKEY_F24 = 0x87,

-  FWL_VKEY_NunLock = 0x90,

-  FWL_VKEY_Scroll = 0x91,

-  FWL_VKEY_LShift = 0xA0,

-  FWL_VKEY_RShift = 0xA1,

-  FWL_VKEY_LControl = 0xA2,

-  FWL_VKEY_RControl = 0xA3,

-  FWL_VKEY_LMenu = 0xA4,

-  FWL_VKEY_RMenu = 0xA5,

-  FWL_VKEY_BROWSER_Back = 0xA6,

-  FWL_VKEY_BROWSER_Forward = 0xA7,

-  FWL_VKEY_BROWSER_Refresh = 0xA8,

-  FWL_VKEY_BROWSER_Stop = 0xA9,

-  FWL_VKEY_BROWSER_Search = 0xAA,

-  FWL_VKEY_BROWSER_Favorites = 0xAB,

-  FWL_VKEY_BROWSER_Home = 0xAC,

-  FWL_VKEY_VOLUME_Mute = 0xAD,

-  FWL_VKEY_VOLUME_Down = 0xAE,

-  FWL_VKEY_VOLUME_Up = 0xAF,

-  FWL_VKEY_MEDIA_NEXT_Track = 0xB0,

-  FWL_VKEY_MEDIA_PREV_Track = 0xB1,

-  FWL_VKEY_MEDIA_Stop = 0xB2,

-  FWL_VKEY_MEDIA_PLAY_Pause = 0xB3,

-  FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4,

-  FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5,

-  FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6,

-  FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7,

-  FWL_VKEY_OEM_1 = 0xBA,

-  FWL_VKEY_OEM_Plus = 0xBB,

-  FWL_VKEY_OEM_Comma = 0xBC,

-  FWL_VKEY_OEM_Minus = 0xBD,

-  FWL_VKEY_OEM_Period = 0xBE,

-  FWL_VKEY_OEM_2 = 0xBF,

-  FWL_VKEY_OEM_3 = 0xC0,

-  FWL_VKEY_OEM_4 = 0xDB,

-  FWL_VKEY_OEM_5 = 0xDC,

-  FWL_VKEY_OEM_6 = 0xDD,

-  FWL_VKEY_OEM_7 = 0xDE,

-  FWL_VKEY_OEM_8 = 0xDF,

-  FWL_VKEY_OEM_102 = 0xE2,

-  FWL_VKEY_ProcessKey = 0xE5,

-  FWL_VKEY_Packet = 0xE7,

-  FWL_VKEY_Attn = 0xF6,

-  FWL_VKEY_Crsel = 0xF7,

-  FWL_VKEY_Exsel = 0xF8,

-  FWL_VKEY_Ereof = 0xF9,

-  FWL_VKEY_Play = 0xFA,

-  FWL_VKEY_Zoom = 0xFB,

-  FWL_VKEY_NoName = 0xFC,

-  FWL_VKEY_PA1 = 0xFD,

-  FWL_VKEY_OEM_Clear = 0xFE,

-  FWL_VKEY_Unknown = 0,

-} FWL_VKEYCODE;

-

-//key event command

-typedef enum

-{

-	FWL_EVENTKEYCMD_KeyDown = 1	,

-	FWL_EVENTKEYCMD_KeyUp		,

-	FWL_EVENTKEYCMD_Char		,

-} FWL_EVENTKEYCMD;

-

-//key event

-struct FWL_EVENT_KEY

-{

-	FPDF_UINT32 command;

-	FPDF_DWORD flag;

-	union

-	{

-		//Virtual key code.

-		FPDF_UINT32 vkcode;

-		//Character code.

-		FPDF_DWORD charcode;

-	}code;

-};

-

-//event type

-struct FWL_EVENT 

-{

-	//structure size.

-	FPDF_UINT32 size;

-	//FWL_EVENTTYPE.

-    FPDF_UINT32 type;

-	union

-	{

-		struct FWL_EVENT_MOUSE mouse;

-		struct FWL_EVENT_MOUSEWHEEL wheel;

-		struct FWL_EVENT_KEY key;

-	}s;

-};  

-

-#endif //_FWL_EVENT_H

-

-

+// 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 _FWL_EVENT_H
+#define _FWL_EVENT_H
+
+#include "fpdfview.h"
+
+typedef int			FPDF_INT32;
+typedef unsigned int FPDF_UINT32;
+typedef float		FPDF_FLOAT;
+//event type
+typedef enum
+{
+	FWL_EVENTTYPE_Mouse = 0	,
+	FWL_EVENTTYPE_MouseWheel,	
+	FWL_EVENTTYPE_Key		,
+} FWL_EVENTTYPE;
+
+//key flag
+typedef enum
+{    
+	FWL_EVENTFLAG_ShiftKey			= 1 << 0,    
+	FWL_EVENTFLAG_ControlKey		= 1 << 1,
+    FWL_EVENTFLAG_AltKey			= 1 << 2,
+    FWL_EVENTFLAG_MetaKey			= 1 << 3,
+    FWL_EVENTFLAG_KeyPad			= 1 << 4,
+    FWL_EVENTFLAG_AutoRepeat		= 1 << 5,
+    FWL_EVENTFLAG_LeftButtonDown	= 1 << 6,
+    FWL_EVENTFLAG_MiddleButtonDown	= 1 << 7,
+    FWL_EVENTFLAG_RightButtonDown	= 1 << 8, 
+} FWL_EVENTFLAG;  
+
+// Mouse message command
+typedef enum
+{
+	FWL_EVENTMOUSECMD_LButtonDown =	1	,	
+	FWL_EVENTMOUSECMD_LButtonUp			,
+	FWL_EVENTMOUSECMD_LButtonDblClk		,
+	FWL_EVENTMOUSECMD_RButtonDown		,
+	FWL_EVENTMOUSECMD_RButtonUp			,
+	FWL_EVENTMOUSECMD_RButtonDblClk		,
+	FWL_EVENTMOUSECMD_MButtonDown		,
+	FWL_EVENTMOUSECMD_MButtonUp			,
+	FWL_EVENTMOUSECMD_MButtonDblClk		,
+	FWL_EVENTMOUSECMD_MouseMove			,
+	FWL_EVENTMOUSECMD_MouseEnter		,
+	FWL_EVENTMOUSECMD_MouseHover		,
+	FWL_EVENTMOUSECMD_MouseLeave		,
+} FWL_EVENT_MOUSECMD;
+
+//mouse event
+struct FWL_EVENT_MOUSE 
+{
+	FPDF_UINT32 command;
+	FPDF_DWORD flag;
+	FPDF_FLOAT x;
+	FPDF_FLOAT y;
+};
+
+//mouse wheel
+struct FWL_EVENT_MOUSEWHEEL 
+{	
+	FPDF_DWORD flag;
+	FPDF_FLOAT x;
+	FPDF_FLOAT y;
+	FPDF_FLOAT deltaX;
+    FPDF_FLOAT deltaY;  
+};
+
+//virtual keycode
+typedef enum 
+{
+  FWL_VKEY_Back		= 0x08,
+  FWL_VKEY_Tab		= 0x09,
+  FWL_VKEY_Clear	= 0x0C,
+  FWL_VKEY_Return	= 0x0D,
+  FWL_VKEY_Shift	= 0x10,
+  FWL_VKEY_Control	= 0x11,
+  FWL_VKEY_Menu		= 0x12,
+  FWL_VKEY_Pause	= 0x13,
+  FWL_VKEY_Capital	= 0x14,
+  FWL_VKEY_Kana		= 0x15,
+  FWL_VKEY_Hangul	= 0x15,
+  FWL_VKEY_Junja	= 0x17,
+  FWL_VKEY_Final	= 0x18,
+  FWL_VKEY_Hanja	= 0x19,
+  FWL_VKEY_Kanji	= 0x19,
+  FWL_VKEY_Escape	= 0x1B,
+  FWL_VKEY_Convert	= 0x1C,
+  FWL_VKEY_NonConvert = 0x1D,
+  FWL_VKEY_Accept	 = 0x1E,
+  FWL_VKEY_ModeChange = 0x1F,
+  FWL_VKEY_Space = 0x20,
+  FWL_VKEY_Prior = 0x21,
+  FWL_VKEY_Next = 0x22,
+  FWL_VKEY_End = 0x23,
+  FWL_VKEY_Home = 0x24,
+  FWL_VKEY_Left = 0x25,
+  FWL_VKEY_Up = 0x26,
+  FWL_VKEY_Right = 0x27,
+  FWL_VKEY_Down = 0x28,
+  FWL_VKEY_Select = 0x29,
+  FWL_VKEY_Print = 0x2A,
+  FWL_VKEY_Execute = 0x2B,
+  FWL_VKEY_Snapshot = 0x2C,
+  FWL_VKEY_Insert = 0x2D,
+  FWL_VKEY_Delete = 0x2E,
+  FWL_VKEY_Help = 0x2F,
+  FWL_VKEY_0 = 0x30,
+  FWL_VKEY_1 = 0x31,
+  FWL_VKEY_2 = 0x32,
+  FWL_VKEY_3 = 0x33,
+  FWL_VKEY_4 = 0x34,
+  FWL_VKEY_5 = 0x35,
+  FWL_VKEY_6 = 0x36,
+  FWL_VKEY_7 = 0x37,
+  FWL_VKEY_8 = 0x38,
+  FWL_VKEY_9 = 0x39,
+  FWL_VKEY_A = 0x41,
+  FWL_VKEY_B = 0x42,
+  FWL_VKEY_C = 0x43,
+  FWL_VKEY_D = 0x44,
+  FWL_VKEY_E = 0x45,
+  FWL_VKEY_F = 0x46,
+  FWL_VKEY_G = 0x47,
+  FWL_VKEY_H = 0x48,
+  FWL_VKEY_I = 0x49,
+  FWL_VKEY_J = 0x4A,
+  FWL_VKEY_K = 0x4B,
+  FWL_VKEY_L = 0x4C,
+  FWL_VKEY_M = 0x4D,
+  FWL_VKEY_N = 0x4E,
+  FWL_VKEY_O = 0x4F,
+  FWL_VKEY_P = 0x50,
+  FWL_VKEY_Q = 0x51,
+  FWL_VKEY_R = 0x52,
+  FWL_VKEY_S = 0x53,
+  FWL_VKEY_T = 0x54,
+  FWL_VKEY_U = 0x55,
+  FWL_VKEY_V = 0x56,
+  FWL_VKEY_W = 0x57,
+  FWL_VKEY_X = 0x58,
+  FWL_VKEY_Y = 0x59,
+  FWL_VKEY_Z = 0x5A,
+  FWL_VKEY_LWin = 0x5B,
+  FWL_VKEY_Command = 0x5B,
+  FWL_VKEY_RWin = 0x5C,
+  FWL_VKEY_Apps = 0x5D,
+  FWL_VKEY_Sleep = 0x5F,
+  FWL_VKEY_NumPad0 = 0x60,
+  FWL_VKEY_NumPad1 = 0x61,
+  FWL_VKEY_NumPad2 = 0x62,
+  FWL_VKEY_NumPad3 = 0x63,
+  FWL_VKEY_NumPad4 = 0x64,
+  FWL_VKEY_NumPad5 = 0x65,
+  FWL_VKEY_NumPad6 = 0x66,
+  FWL_VKEY_NumPad7 = 0x67,
+  FWL_VKEY_NumPad8 = 0x68,
+  FWL_VKEY_NumPad9 = 0x69,
+  FWL_VKEY_Multiply = 0x6A,
+  FWL_VKEY_Add = 0x6B,
+  FWL_VKEY_Separator = 0x6C,
+  FWL_VKEY_Subtract = 0x6D,
+  FWL_VKEY_Decimal = 0x6E,
+  FWL_VKEY_Divide = 0x6F,
+  FWL_VKEY_F1 = 0x70,
+  FWL_VKEY_F2 = 0x71,
+  FWL_VKEY_F3 = 0x72,
+  FWL_VKEY_F4 = 0x73,
+  FWL_VKEY_F5 = 0x74,
+  FWL_VKEY_F6 = 0x75,
+  FWL_VKEY_F7 = 0x76,
+  FWL_VKEY_F8 = 0x77,
+  FWL_VKEY_F9 = 0x78,
+  FWL_VKEY_F10 = 0x79,
+  FWL_VKEY_F11 = 0x7A,
+  FWL_VKEY_F12 = 0x7B,
+  FWL_VKEY_F13 = 0x7C,
+  FWL_VKEY_F14 = 0x7D,
+  FWL_VKEY_F15 = 0x7E,
+  FWL_VKEY_F16 = 0x7F,
+  FWL_VKEY_F17 = 0x80,
+  FWL_VKEY_F18 = 0x81,
+  FWL_VKEY_F19 = 0x82,
+  FWL_VKEY_F20 = 0x83,
+  FWL_VKEY_F21 = 0x84,
+  FWL_VKEY_F22 = 0x85,
+  FWL_VKEY_F23 = 0x86,
+  FWL_VKEY_F24 = 0x87,
+  FWL_VKEY_NunLock = 0x90,
+  FWL_VKEY_Scroll = 0x91,
+  FWL_VKEY_LShift = 0xA0,
+  FWL_VKEY_RShift = 0xA1,
+  FWL_VKEY_LControl = 0xA2,
+  FWL_VKEY_RControl = 0xA3,
+  FWL_VKEY_LMenu = 0xA4,
+  FWL_VKEY_RMenu = 0xA5,
+  FWL_VKEY_BROWSER_Back = 0xA6,
+  FWL_VKEY_BROWSER_Forward = 0xA7,
+  FWL_VKEY_BROWSER_Refresh = 0xA8,
+  FWL_VKEY_BROWSER_Stop = 0xA9,
+  FWL_VKEY_BROWSER_Search = 0xAA,
+  FWL_VKEY_BROWSER_Favorites = 0xAB,
+  FWL_VKEY_BROWSER_Home = 0xAC,
+  FWL_VKEY_VOLUME_Mute = 0xAD,
+  FWL_VKEY_VOLUME_Down = 0xAE,
+  FWL_VKEY_VOLUME_Up = 0xAF,
+  FWL_VKEY_MEDIA_NEXT_Track = 0xB0,
+  FWL_VKEY_MEDIA_PREV_Track = 0xB1,
+  FWL_VKEY_MEDIA_Stop = 0xB2,
+  FWL_VKEY_MEDIA_PLAY_Pause = 0xB3,
+  FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4,
+  FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5,
+  FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
+  FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
+  FWL_VKEY_OEM_1 = 0xBA,
+  FWL_VKEY_OEM_Plus = 0xBB,
+  FWL_VKEY_OEM_Comma = 0xBC,
+  FWL_VKEY_OEM_Minus = 0xBD,
+  FWL_VKEY_OEM_Period = 0xBE,
+  FWL_VKEY_OEM_2 = 0xBF,
+  FWL_VKEY_OEM_3 = 0xC0,
+  FWL_VKEY_OEM_4 = 0xDB,
+  FWL_VKEY_OEM_5 = 0xDC,
+  FWL_VKEY_OEM_6 = 0xDD,
+  FWL_VKEY_OEM_7 = 0xDE,
+  FWL_VKEY_OEM_8 = 0xDF,
+  FWL_VKEY_OEM_102 = 0xE2,
+  FWL_VKEY_ProcessKey = 0xE5,
+  FWL_VKEY_Packet = 0xE7,
+  FWL_VKEY_Attn = 0xF6,
+  FWL_VKEY_Crsel = 0xF7,
+  FWL_VKEY_Exsel = 0xF8,
+  FWL_VKEY_Ereof = 0xF9,
+  FWL_VKEY_Play = 0xFA,
+  FWL_VKEY_Zoom = 0xFB,
+  FWL_VKEY_NoName = 0xFC,
+  FWL_VKEY_PA1 = 0xFD,
+  FWL_VKEY_OEM_Clear = 0xFE,
+  FWL_VKEY_Unknown = 0,
+} FWL_VKEYCODE;
+
+//key event command
+typedef enum
+{
+	FWL_EVENTKEYCMD_KeyDown = 1	,
+	FWL_EVENTKEYCMD_KeyUp		,
+	FWL_EVENTKEYCMD_Char		,
+} FWL_EVENTKEYCMD;
+
+//key event
+struct FWL_EVENT_KEY
+{
+	FPDF_UINT32 command;
+	FPDF_DWORD flag;
+	union
+	{
+		//Virtual key code.
+		FPDF_UINT32 vkcode;
+		//Character code.
+		FPDF_DWORD charcode;
+	}code;
+};
+
+//event type
+struct FWL_EVENT 
+{
+	//structure size.
+	FPDF_UINT32 size;
+	//FWL_EVENTTYPE.
+    FPDF_UINT32 type;
+	union
+	{
+		struct FWL_EVENT_MOUSE mouse;
+		struct FWL_EVENT_MOUSEWHEEL wheel;
+		struct FWL_EVENT_KEY key;
+	}s;
+};  
+
+#endif //_FWL_EVENT_H
+
+
diff --git a/fpdfsdk/include/fpdf_progressive.h b/fpdfsdk/include/fpdf_progressive.h
index d590f78..029264e 100644
--- a/fpdfsdk/include/fpdf_progressive.h
+++ b/fpdfsdk/include/fpdf_progressive.h
@@ -1,94 +1,94 @@
-// 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 _FPDF_PROGRESSIVE_H_

-#define _FPDF_PROGRESSIVE_H_

-

-#include "fpdfview.h"

-

-//Flags for progressive process status.

-#define FPDF_RENDER_READER			0

-#define FPDF_RENDER_TOBECOUNTINUED	1

-#define FPDF_RENDER_DONE			2

-#define FPDF_RENDER_FAILED			3

-

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-

-//IFPDF_RENDERINFO interface.

-typedef struct _IFSDK_PAUSE

-{

-	/**

-	* Version number of the interface. Currently must be 1.

-	**/

-	int version;

-

-	/*

-	* Method: NeedToPauseNow

-	*			Check if we need to pause a progressive process now.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	* Return Value:

-	*			 Non-zero for pause now, 0 for continue.

-	*

-	*/

-	FPDF_BOOL (*NeedToPauseNow) (struct _IFSDK_PAUSE* pThis);

-	

-	//A user defined data pointer, used by user's application. Can be NULL.

-	void*		user;

-} IFSDK_PAUSE;

-

-// Function: FPDF_RenderPageBitmap_Start

-//			Start to render page contents to a device independent bitmap progressively.

-// Parameters: 

-//			bitmap		-	Handle to the device independent bitmap (as the output buffer).

-//							Bitmap handle can be created by FPDFBitmap_Create function.

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			start_x		-	Left pixel position of the display area in the bitmap coordinate.

-//			start_y		-	Top pixel position of the display area in the bitmap coordinate.

-//			size_x		-	Horizontal size (in pixels) for displaying the page.

-//			size_y		-	Vertical size (in pixels) for displaying the page.

-//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-//			flags		-	0 for normal display, or combination of flags defined above.

-//			pause		-	The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process

-// Return value:

-//			Rendering Status. See flags for progressive process status for the details.

-//

-DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x,

-												   int size_y, int rotate, int flags,IFSDK_PAUSE * pause);

-

-// Function: FPDF_RenderPage_Continue

-//			Continue rendering a PDF page.

-// Parameters: 

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			pause		-	The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process

-//							to be paused before it's finished. This can be NULL if you don't want to pause.

-// Return value:

-//			The rendering status. See flags for progressive process status for the details.

-DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause);

-

-// Function: FPDF_RenderPage_Close

-//			Release the resource allocate during page rendering. Need to be called after finishing rendering or

-//			cancel the rendering.

-// Parameters: 

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-// Return value:

-//			NULL

-DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);

-

-#ifdef __cplusplus

-}

-#endif

-

-#endif	//_FPDF_PROGRESSIVE_H_

+// 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 _FPDF_PROGRESSIVE_H_
+#define _FPDF_PROGRESSIVE_H_
+
+#include "fpdfview.h"
+
+//Flags for progressive process status.
+#define FPDF_RENDER_READER			0
+#define FPDF_RENDER_TOBECOUNTINUED	1
+#define FPDF_RENDER_DONE			2
+#define FPDF_RENDER_FAILED			3
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//IFPDF_RENDERINFO interface.
+typedef struct _IFSDK_PAUSE
+{
+	/**
+	* Version number of the interface. Currently must be 1.
+	**/
+	int version;
+
+	/*
+	* Method: NeedToPauseNow
+	*			Check if we need to pause a progressive process now.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	* Return Value:
+	*			 Non-zero for pause now, 0 for continue.
+	*
+	*/
+	FPDF_BOOL (*NeedToPauseNow) (struct _IFSDK_PAUSE* pThis);
+	
+	//A user defined data pointer, used by user's application. Can be NULL.
+	void*		user;
+} IFSDK_PAUSE;
+
+// Function: FPDF_RenderPageBitmap_Start
+//			Start to render page contents to a device independent bitmap progressively.
+// Parameters: 
+//			bitmap		-	Handle to the device independent bitmap (as the output buffer).
+//							Bitmap handle can be created by FPDFBitmap_Create function.
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			start_x		-	Left pixel position of the display area in the bitmap coordinate.
+//			start_y		-	Top pixel position of the display area in the bitmap coordinate.
+//			size_x		-	Horizontal size (in pixels) for displaying the page.
+//			size_y		-	Vertical size (in pixels) for displaying the page.
+//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+//			flags		-	0 for normal display, or combination of flags defined above.
+//			pause		-	The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
+// Return value:
+//			Rendering Status. See flags for progressive process status for the details.
+//
+DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x,
+												   int size_y, int rotate, int flags,IFSDK_PAUSE * pause);
+
+// Function: FPDF_RenderPage_Continue
+//			Continue rendering a PDF page.
+// Parameters: 
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			pause		-	The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
+//							to be paused before it's finished. This can be NULL if you don't want to pause.
+// Return value:
+//			The rendering status. See flags for progressive process status for the details.
+DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause);
+
+// Function: FPDF_RenderPage_Close
+//			Release the resource allocate during page rendering. Need to be called after finishing rendering or
+//			cancel the rendering.
+// Parameters: 
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+//			NULL
+DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	//_FPDF_PROGRESSIVE_H_
diff --git a/fpdfsdk/include/fpdf_searchex.h b/fpdfsdk/include/fpdf_searchex.h
index c291c0c..d70dddc 100644
--- a/fpdfsdk/include/fpdf_searchex.h
+++ b/fpdfsdk/include/fpdf_searchex.h
@@ -1,33 +1,33 @@
-// 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 _FPDF_SEARCH_EX_H

-#define _FPDF_SEARCH_EX_H

-	

-#ifndef _FPDFVIEW_H_

-#include "fpdfview.h"

-#endif

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-// Function: FPDFText_GetCharIndexFromTextIndex

-//		Get the actually char index in text_page's internal char list.

-// Parameters:

-//			text_page	- 	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			nTextIndex	-	The index of the text in the string get from FPDFText_GetText.

-//	Return value:

-//			The index of the character in internal charlist. -1 for error.

-DLLEXPORT int STDCALL  FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);

-

-#ifdef __cplusplus

-};

-#endif

-

-

-#endif

-

+// 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 _FPDF_SEARCH_EX_H
+#define _FPDF_SEARCH_EX_H
+	
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFText_GetCharIndexFromTextIndex
+//		Get the actually char index in text_page's internal char list.
+// Parameters:
+//			text_page	- 	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			nTextIndex	-	The index of the text in the string get from FPDFText_GetText.
+//	Return value:
+//			The index of the character in internal charlist. -1 for error.
+DLLEXPORT int STDCALL  FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif
+
diff --git a/fpdfsdk/include/fpdf_transformpage.h b/fpdfsdk/include/fpdf_transformpage.h
index caafeda..69ffe24 100644
--- a/fpdfsdk/include/fpdf_transformpage.h
+++ b/fpdfsdk/include/fpdf_transformpage.h
@@ -1,113 +1,113 @@
-// 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 _TRANSFORMPAGE_H_

-#define _TRANSFORMPAGE_H_

-

-#ifndef _FPDFVIEW_H_

-#include "fpdfview.h"

-#endif

-

-typedef void* FPDF_PAGEARCSAVER;

-typedef void* FPDF_PAGEARCLOADER;

-/**

-*  Set "MediaBox" entry to the page dictionary.						   

-* @param[in] page	- Handle to a page.

-* @param[in] left	- The left of the rectangle.

-* @param[in] bottom	- The bottom of the rectangle.

-* @param[in] right	- The right of the rectangle.

-* @param[in] top	- The top of the rectangle.

-* @retval None.

-*/

-DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);

-

-/**

-*  Set "CropBox" entry to the page dictionary.						   

-* @param[in] page	- Handle to a page.

-* @param[in] left	- The left of the rectangle.

-* @param[in] bottom	- The bottom of the rectangle.

-* @param[in] right	- The right of the rectangle.

-* @param[in] top	- The top of the rectangle.

-* @retval None.

-*/

-DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);

-

-

-/**  Get "MediaBox" entry from the page dictionary.						   

-* @param[in] page	- Handle to a page.

-* @param[in] left	- Pointer to a double value receiving the left of the rectangle.

-* @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.

-* @param[in] right	- Pointer to a double value receiving the right of the rectangle.

-* @param[in] top	- Pointer to a double value receiving the top of the rectangle.

-* @retval True if success,else fail.

-*/

-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);

-

-/**  Get "CropBox" entry from the page dictionary.						   

-* @param[in] page	- Handle to a page.

-* @param[in] left	- Pointer to a double value receiving the left of the rectangle.

-* @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.

-* @param[in] right	- Pointer to a double value receiving the right of the rectangle.

-* @param[in] top	- Pointer to a double value receiving the top of the rectangle.

-* @retval True if success,else fail.

-*/

-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);

-

-/**

-* Transform the whole page with a specified matrix, then clip the page content region.

-*

-* @param[in] page		 - A page handle.

-* @param[in] matrix		 - The transform matrix.

-* @param[in] clipRect	 - A rectangle page area to be clipped.

-* @Note. This function will transform the whole page, and would take effect to all the objects in the page.

-*/

-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);

-

-/**

-* Transform (scale, rotate, shear, move) the clip path of page object.

-* @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.

-* @param[in] a	- The coefficient "a" of the matrix.

-* @param[in] b	- The coefficient "b" of the matrix.

-* @param[in] c	- The coefficient "c" of the matrix.

-* @param[in] d	- The coefficient "d" of the matrix.

-* @param[in] e	- The coefficient "e" of the matrix.

-* @param[in] f	- The coefficient "f" of the matrix.

-* @retval None.

-*/

-DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);

-

-/**

-* Create a new clip path, with a rectangle inserted.

-* 

-* @param[in] left	- The left of the clip box.

-* @param[in] bottom - The bottom of the clip box.

-* @param[in] right	- The right of the clip box.

-* @param[in] top	- The top of the clip box.

-* @retval a handle to the clip path.

-*/

-DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);

-

-/**

-* Destroy the clip path.

-*

-* @param[in] clipPath - A handle to the clip path.

-* Destroy the clip path.

-* @retval None.

-*/

-DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);

-

-/**

-* Clip the page content, the page content that outside the clipping region become invisible.

-*

-* @param[in] page		 - A page handle.

-* @param[in] clipPath	 - A handle to the clip path.

-* @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped

-* by this clip path. 

-*/

-DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);

-

-#endif

-

+// 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 _TRANSFORMPAGE_H_
+#define _TRANSFORMPAGE_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+typedef void* FPDF_PAGEARCSAVER;
+typedef void* FPDF_PAGEARCLOADER;
+/**
+*  Set "MediaBox" entry to the page dictionary.						   
+* @param[in] page	- Handle to a page.
+* @param[in] left	- The left of the rectangle.
+* @param[in] bottom	- The bottom of the rectangle.
+* @param[in] right	- The right of the rectangle.
+* @param[in] top	- The top of the rectangle.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
+
+/**
+*  Set "CropBox" entry to the page dictionary.						   
+* @param[in] page	- Handle to a page.
+* @param[in] left	- The left of the rectangle.
+* @param[in] bottom	- The bottom of the rectangle.
+* @param[in] right	- The right of the rectangle.
+* @param[in] top	- The top of the rectangle.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
+
+
+/**  Get "MediaBox" entry from the page dictionary.						   
+* @param[in] page	- Handle to a page.
+* @param[in] left	- Pointer to a double value receiving the left of the rectangle.
+* @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.
+* @param[in] right	- Pointer to a double value receiving the right of the rectangle.
+* @param[in] top	- Pointer to a double value receiving the top of the rectangle.
+* @retval True if success,else fail.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
+
+/**  Get "CropBox" entry from the page dictionary.						   
+* @param[in] page	- Handle to a page.
+* @param[in] left	- Pointer to a double value receiving the left of the rectangle.
+* @param[in] bottom	- Pointer to a double value receiving the bottom of the rectangle.
+* @param[in] right	- Pointer to a double value receiving the right of the rectangle.
+* @param[in] top	- Pointer to a double value receiving the top of the rectangle.
+* @retval True if success,else fail.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
+
+/**
+* Transform the whole page with a specified matrix, then clip the page content region.
+*
+* @param[in] page		 - A page handle.
+* @param[in] matrix		 - The transform matrix.
+* @param[in] clipRect	 - A rectangle page area to be clipped.
+* @Note. This function will transform the whole page, and would take effect to all the objects in the page.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
+
+/**
+* Transform (scale, rotate, shear, move) the clip path of page object.
+* @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
+* @param[in] a	- The coefficient "a" of the matrix.
+* @param[in] b	- The coefficient "b" of the matrix.
+* @param[in] c	- The coefficient "c" of the matrix.
+* @param[in] d	- The coefficient "d" of the matrix.
+* @param[in] e	- The coefficient "e" of the matrix.
+* @param[in] f	- The coefficient "f" of the matrix.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
+
+/**
+* Create a new clip path, with a rectangle inserted.
+* 
+* @param[in] left	- The left of the clip box.
+* @param[in] bottom - The bottom of the clip box.
+* @param[in] right	- The right of the clip box.
+* @param[in] top	- The top of the clip box.
+* @retval a handle to the clip path.
+*/
+DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
+
+/**
+* Destroy the clip path.
+*
+* @param[in] clipPath - A handle to the clip path.
+* Destroy the clip path.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
+
+/**
+* Clip the page content, the page content that outside the clipping region become invisible.
+*
+* @param[in] page		 - A page handle.
+* @param[in] clipPath	 - A handle to the clip path.
+* @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
+* by this clip path. 
+*/
+DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);
+
+#endif
+
diff --git a/fpdfsdk/include/fpdfdoc.h b/fpdfsdk/include/fpdfdoc.h
index 35c2c96..54ede40 100644
--- a/fpdfsdk/include/fpdfdoc.h
+++ b/fpdfsdk/include/fpdfdoc.h
@@ -1,230 +1,230 @@
-// 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 _FPDFDOC_H_

-#define _FPDFDOC_H_

-

-#include "fpdfview.h"

-

-// Exported Functions

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-// Function: FPDFBookmark_Find

-//			Find a bookmark in the document, using the bookmark title.

-// Parameters: 

-//			document	-	Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.

-//			title		-	The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.

-// Return value:

-//			Handle to the found bookmark item. NULL if the title can't be found.

-// Comments:

-//			It always returns the first found bookmark if more than one bookmarks have the same title.

-//

-DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);

-

-// Function: FPDFBookmark_GetDest

-//			Get the destination associated with a bookmark item.

-// Parameters:

-//			document	-	Handle to the document.

-//			bookmark	-	Handle to the bookmark.

-// Return value:

-//			Handle to the destination data. NULL if no destination is associated with this bookmark.

-//

-DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);

-

-// Function: FPDFBookmark_GetAction

-//			Get the action associated with a bookmark item.

-// Parameters:

-//			bookmark	-	Handle to the bookmark.

-// Return value:

-//			Handle to the action data. NULL if no action is associated with this bookmark. In this case, the 

-//			application should try FPDFBookmark_GetDest.

-//

-DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);

-

-#define PDFACTION_UNSUPPORTED		0		// Unsupported action type.

-#define PDFACTION_GOTO				1		// Go to a destination within current document.

-#define PDFACTION_REMOTEGOTO		2		// Go to a destination within another document.

-#define PDFACTION_URI				3		// Universal Resource Identifier, including web pages and 

-											// other Internet based resources.

-#define PDFACTION_LAUNCH			4		// Launch an application or open a file.

-

-// Function: FPDFAction_GetType

-//			Get type of an action.

-// Parameters:

-//			action		-	Handle to the action.

-// Return value:

-//			A type number as defined above.

-//

-DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);

-

-// Function: FPDFAction_GetDest

-//			Get destination of an action.

-// Parameters:

-//			document	-	Handle to the document.

-//			action		-	Handle to the action. It must be a GOTO or REMOTEGOTO action.

-// Return value:

-//			Handle to the destination data.

-// Comments:

-//			In case of remote goto action, the application should first use FPDFAction_GetFilePath to

-//			get file path, then load that particular document, and use its document handle to call this

-//			function.

-//

-DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);

-

-// Function: FPDFAction_GetURIPath

-//			Get URI path of a URI action.

-// Parameters:

-//			document	-	Handle to the document.

-//			action		-	Handle to the action. Must be a URI action.

-//			buffer		-	A buffer for output the path string. Can be NULL.

-//			buflen		-	The length of the buffer, number of bytes. Can be 0.

-// Return value:

-//			Number of bytes the URI path consumes, including trailing zeros.

-// Comments:

-//			The URI path is always encoded in 7-bit ASCII.

-// 

-//			The return value always indicated number of bytes required for the buffer, even when there is

-//			no buffer specified, or the buffer size is less then required. In this case, the buffer will not

-//			be modified.

-//

-DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action, 

-													  void* buffer, unsigned long buflen);

-

-// Function: FPDFDest_GetPageIndex

-//			Get page index of a destination.

-// Parameters:

-//			document	-	Handle to the document.

-//			dest		-	Handle to the destination.

-// Return value:

-//			The page index. Starting from 0 for the first page.

-//

-DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest);

-

-// Function: FPDFLink_GetLinkAtPoint

-//			Find a link at specified point on a document page.

-// Parameters:

-//			page		-	Handle to the document page.

-//			x			-	The x coordinate of the point, specified in page coordinate system.

-//			y			-	The y coordinate of the point, specified in page coordinate system.

-// Return value:

-//			Handle to the link. NULL if no link found at that point.

-// Comments:

-//			The point coordinates are specified in page coordinate system. You can convert coordinates 

-//			from screen system to page system using FPDF_DeviceToPage functions.

-//

-DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y);

-

-// Function: FPDFLink_GetDest

-//			Get destination info of a link.

-// Parameters:

-//			document	-	Handle to the document.

-//			link		-	Handle to the link. Returned by FPDFLink_GetLinkAtPoint.

-// Return value:

-//			Handle to the destination. NULL if there is no destination associated with the link, in this case

-//			the application should try FPDFLink_GetAction.

-//

-DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link);

-

-// Function: FPDFLink_GetAction

-//			Get action info of a link.

-// Parameters:

-//			link		-	Handle to the link.

-// Return value:

-//			Handle to the action. NULL if there is no action associated with the link.

-//

-DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);

-

-// Function: FPDFLink_Enumerate

-//			This function would enumerate all the link annotations in a single PDF page.

-// Parameters:

-//			page[in]			-	Handle to the page.

-//			startPos[in,out]	-	The start position to enumerate the link annotations, which should be specified to start from 

-//								-	0 for the first call, and would receive the next position for enumerating to start from.

-//			linkAnnot[out]		-	Receive the link handle.

-// Return value:

-//			TRUE if succceed, else False;

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot);

-

-// Function: FPDFLink_GetAnnotRect

-//			Get the annotation rectangle. (Specified by the ¡°Rect¡± entry of annotation dictionary).

-// Parameters:

-//			linkAnnot[in]		-	Handle to the link annotation.

-//			rect[out]			-	The annotation rect.

-// Return value:

-//			TRUE if succceed, else False;

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect);

-

-// Function: FPDFLink_CountQuadPoints

-//			Get the count of quadrilateral points to the link annotation.

-// Parameters:

-//			linkAnnot[in]		-	Handle to the link annotation.

-// Return value:

-//			The count of quadrilateral points.

-//

-DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);

-

-/* _FS_DEF_STRUCTURE_QUADPOINTSF_ */

-#ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_

-#define _FS_DEF_STRUCTURE_QUADPOINTSF_

-typedef struct _FS_QUADPOINTSF

-{

-	FS_FLOAT  x1;

-	FS_FLOAT  y1;

-	FS_FLOAT  x2;

-	FS_FLOAT  y2;

-	FS_FLOAT  x3;

-	FS_FLOAT  y3;

-	FS_FLOAT  x4;

-	FS_FLOAT  y4;

-} FS_QUADPOINTSF;

-#endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */

-

-// Function: FPDFLink_GetQuadPoints

-//			Get the quadrilateral points for the specified index in the link annotation.

-// Parameters:

-//			linkAnnot[in]		-	Handle to the link annotation.

-//			quadIndex[in]		-	The specified quad points index.

-//			quadPoints[out]		-	Receive the quadrilateral points.

-// Return value:

-//			True if succeed, else False.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints);

-

-// Function: FPDF_GetMetaText

-//			Get a text from meta data of the document. Result is encoded in UTF-16LE.

-// Parameters:

-//			doc			-	Handle to a document

-//			tag			-	The tag for the meta data. Currently, It can be "Title", "Author", 

-//							"Subject", "Keywords", "Creator", "Producer", "CreationDate", or "ModDate".

-//							For detailed explanation of these tags and their respective values,

-//							please refer to PDF Reference 1.6, section 10.2.1, "Document Information Dictionary".

-//			buffer		-	A buffer for output the title. Can be NULL.

-//			buflen		-	The length of the buffer, number of bytes. Can be 0.

-// Return value:

-//			Number of bytes the title consumes, including trailing zeros.

-// Comments:

-//			No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer 

-//			can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of 

-//			a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero 

-//			indicating end of the string.

-//

-//			The return value always indicated number of bytes required for the buffer, even when there is

-//			no buffer specified, or the buffer size is less then required. In this case, the buffer will not

-//			be modified.

-//

-DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,

-												 void* buffer, unsigned long buflen);

-

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif	// _FPDFDOC_H_

+// 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 _FPDFDOC_H_
+#define _FPDFDOC_H_
+
+#include "fpdfview.h"
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFBookmark_Find
+//			Find a bookmark in the document, using the bookmark title.
+// Parameters: 
+//			document	-	Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
+//			title		-	The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.
+// Return value:
+//			Handle to the found bookmark item. NULL if the title can't be found.
+// Comments:
+//			It always returns the first found bookmark if more than one bookmarks have the same title.
+//
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
+
+// Function: FPDFBookmark_GetDest
+//			Get the destination associated with a bookmark item.
+// Parameters:
+//			document	-	Handle to the document.
+//			bookmark	-	Handle to the bookmark.
+// Return value:
+//			Handle to the destination data. NULL if no destination is associated with this bookmark.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Function: FPDFBookmark_GetAction
+//			Get the action associated with a bookmark item.
+// Parameters:
+//			bookmark	-	Handle to the bookmark.
+// Return value:
+//			Handle to the action data. NULL if no action is associated with this bookmark. In this case, the 
+//			application should try FPDFBookmark_GetDest.
+//
+DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
+
+#define PDFACTION_UNSUPPORTED		0		// Unsupported action type.
+#define PDFACTION_GOTO				1		// Go to a destination within current document.
+#define PDFACTION_REMOTEGOTO		2		// Go to a destination within another document.
+#define PDFACTION_URI				3		// Universal Resource Identifier, including web pages and 
+											// other Internet based resources.
+#define PDFACTION_LAUNCH			4		// Launch an application or open a file.
+
+// Function: FPDFAction_GetType
+//			Get type of an action.
+// Parameters:
+//			action		-	Handle to the action.
+// Return value:
+//			A type number as defined above.
+//
+DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
+
+// Function: FPDFAction_GetDest
+//			Get destination of an action.
+// Parameters:
+//			document	-	Handle to the document.
+//			action		-	Handle to the action. It must be a GOTO or REMOTEGOTO action.
+// Return value:
+//			Handle to the destination data.
+// Comments:
+//			In case of remote goto action, the application should first use FPDFAction_GetFilePath to
+//			get file path, then load that particular document, and use its document handle to call this
+//			function.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);
+
+// Function: FPDFAction_GetURIPath
+//			Get URI path of a URI action.
+// Parameters:
+//			document	-	Handle to the document.
+//			action		-	Handle to the action. Must be a URI action.
+//			buffer		-	A buffer for output the path string. Can be NULL.
+//			buflen		-	The length of the buffer, number of bytes. Can be 0.
+// Return value:
+//			Number of bytes the URI path consumes, including trailing zeros.
+// Comments:
+//			The URI path is always encoded in 7-bit ASCII.
+// 
+//			The return value always indicated number of bytes required for the buffer, even when there is
+//			no buffer specified, or the buffer size is less then required. In this case, the buffer will not
+//			be modified.
+//
+DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action, 
+													  void* buffer, unsigned long buflen);
+
+// Function: FPDFDest_GetPageIndex
+//			Get page index of a destination.
+// Parameters:
+//			document	-	Handle to the document.
+//			dest		-	Handle to the destination.
+// Return value:
+//			The page index. Starting from 0 for the first page.
+//
+DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest);
+
+// Function: FPDFLink_GetLinkAtPoint
+//			Find a link at specified point on a document page.
+// Parameters:
+//			page		-	Handle to the document page.
+//			x			-	The x coordinate of the point, specified in page coordinate system.
+//			y			-	The y coordinate of the point, specified in page coordinate system.
+// Return value:
+//			Handle to the link. NULL if no link found at that point.
+// Comments:
+//			The point coordinates are specified in page coordinate system. You can convert coordinates 
+//			from screen system to page system using FPDF_DeviceToPage functions.
+//
+DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y);
+
+// Function: FPDFLink_GetDest
+//			Get destination info of a link.
+// Parameters:
+//			document	-	Handle to the document.
+//			link		-	Handle to the link. Returned by FPDFLink_GetLinkAtPoint.
+// Return value:
+//			Handle to the destination. NULL if there is no destination associated with the link, in this case
+//			the application should try FPDFLink_GetAction.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link);
+
+// Function: FPDFLink_GetAction
+//			Get action info of a link.
+// Parameters:
+//			link		-	Handle to the link.
+// Return value:
+//			Handle to the action. NULL if there is no action associated with the link.
+//
+DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
+
+// Function: FPDFLink_Enumerate
+//			This function would enumerate all the link annotations in a single PDF page.
+// Parameters:
+//			page[in]			-	Handle to the page.
+//			startPos[in,out]	-	The start position to enumerate the link annotations, which should be specified to start from 
+//								-	0 for the first call, and would receive the next position for enumerating to start from.
+//			linkAnnot[out]		-	Receive the link handle.
+// Return value:
+//			TRUE if succceed, else False;
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot);
+
+// Function: FPDFLink_GetAnnotRect
+//			Get the annotation rectangle. (Specified by the ¡°Rect¡± entry of annotation dictionary).
+// Parameters:
+//			linkAnnot[in]		-	Handle to the link annotation.
+//			rect[out]			-	The annotation rect.
+// Return value:
+//			TRUE if succceed, else False;
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect);
+
+// Function: FPDFLink_CountQuadPoints
+//			Get the count of quadrilateral points to the link annotation.
+// Parameters:
+//			linkAnnot[in]		-	Handle to the link annotation.
+// Return value:
+//			The count of quadrilateral points.
+//
+DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
+
+/* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
+#ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_
+#define _FS_DEF_STRUCTURE_QUADPOINTSF_
+typedef struct _FS_QUADPOINTSF
+{
+	FS_FLOAT  x1;
+	FS_FLOAT  y1;
+	FS_FLOAT  x2;
+	FS_FLOAT  y2;
+	FS_FLOAT  x3;
+	FS_FLOAT  y3;
+	FS_FLOAT  x4;
+	FS_FLOAT  y4;
+} FS_QUADPOINTSF;
+#endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
+
+// Function: FPDFLink_GetQuadPoints
+//			Get the quadrilateral points for the specified index in the link annotation.
+// Parameters:
+//			linkAnnot[in]		-	Handle to the link annotation.
+//			quadIndex[in]		-	The specified quad points index.
+//			quadPoints[out]		-	Receive the quadrilateral points.
+// Return value:
+//			True if succeed, else False.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints);
+
+// Function: FPDF_GetMetaText
+//			Get a text from meta data of the document. Result is encoded in UTF-16LE.
+// Parameters:
+//			doc			-	Handle to a document
+//			tag			-	The tag for the meta data. Currently, It can be "Title", "Author", 
+//							"Subject", "Keywords", "Creator", "Producer", "CreationDate", or "ModDate".
+//							For detailed explanation of these tags and their respective values,
+//							please refer to PDF Reference 1.6, section 10.2.1, "Document Information Dictionary".
+//			buffer		-	A buffer for output the title. Can be NULL.
+//			buflen		-	The length of the buffer, number of bytes. Can be 0.
+// Return value:
+//			Number of bytes the title consumes, including trailing zeros.
+// Comments:
+//			No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer 
+//			can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of 
+//			a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero 
+//			indicating end of the string.
+//
+//			The return value always indicated number of bytes required for the buffer, even when there is
+//			no buffer specified, or the buffer size is less then required. In this case, the buffer will not
+//			be modified.
+//
+DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,
+												 void* buffer, unsigned long buflen);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif	// _FPDFDOC_H_
diff --git a/fpdfsdk/include/fpdfedit.h b/fpdfsdk/include/fpdfedit.h
index 52fb148..c7d8b01 100644
--- a/fpdfsdk/include/fpdfedit.h
+++ b/fpdfsdk/include/fpdfedit.h
@@ -1,235 +1,235 @@
-// 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	_FPDFEDIT_H_

-#define	_FPDFEDIT_H_

-

-#include "fpdfview.h"

-

-// Define all types used in the SDK. Note they can be simply regarded as opaque pointers

-// or long integer numbers.

-

-#define FPDF_ARGB(a,r,g,b)		((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<<24))

-#define FPDF_GetBValue(argb)    ((FX_BYTE)(argb))

-#define FPDF_GetGValue(argb)    ((FX_BYTE)(((FX_WORD)(argb)) >> 8))

-#define FPDF_GetRValue(argb)    ((FX_BYTE)((argb)>>16))

-#define FPDF_GetAValue(argb)    ((FX_BYTE)((argb)>>24))

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-//////////////////////////////////////////////////////////////////////

-//

-// Document functions

-//

-//////////////////////////////////////////////////////////////////////

-

-// Function: FPDF_CreateNewDocument

-//			Create a new PDF document.

-// Parameters:	

-//			None.

-// Return value:

-//			A handle to a document. If failed, NULL is returned.

-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();

-

-//////////////////////////////////////////////////////////////////////

-//

-// Page functions

-//

-//////////////////////////////////////////////////////////////////////

-

-// Function: FPDFPage_New

-//			Construct an empty page.

-// Parameters:	

-//			document	-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.

-//			page_index	-	The index of a page.

-//			width		-	The page width.

-//			height		-	The page height.

-// Return value:

-//			The handle to the page.

-// Comments:

-//			Loaded page can be deleted by FPDFPage_Delete.

-DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height);

-

-// Function: FPDFPage_Delete

-//			Delete a PDF page.

-// Parameters:	

-//			document	-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.

-//			page_index	-	The index of a page.

-// Return value:

-//			None.

-DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);

-

-// Function: FPDFPage_GetRotation

-//			Get the page rotation. One of following values will be returned: 0(0), 1(90), 2(180), 3(270).

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New.

-// Return value:

-//			The PDF page rotation.

-// Comment:

-//			The PDF page rotation is rotated clockwise.

-DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);

-

-// Function: FPDFPage_InsertObject

-//			Insert an object to the page. The page object is automatically freed.

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New.

-//			page_obj	-	Handle to a page object. Returned by FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and

-//							FPDFPageObj_NewPathObj.

-// Return value:

-//			None.

-DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj);

-

-// Function: FPDFPage_CountObject

-//			Get number of page objects inside the page.

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New.

-// Return value:

-//			The number of the page object.

-DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);

-

-// Function: FPDFPage_GetObject

-//			Get page object by index.

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New.

-//			index		-	The index of a page object.

-// Return value:

-//			The handle of the page object. Null for failed.

-DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);

-

-// Function: FPDFPage_HasTransparency

-//			Check that whether the content of specified PDF page contains transparency.

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.

-// Return value:

-//			TRUE means that the PDF page does contains transparency.

-//			Otherwise, returns FALSE.

-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);

-

-// Function: FPDFPage_GenerateContent

-//			Generate PDF Page content.

-// Parameters:	

-//			page		-	Handle to a page. Returned by FPDFPage_New.

-// Return value:

-//			True if successful, false otherwise.

-// Comment:

-//			Before you save the page to a file, or reload the page, you must call the FPDFPage_GenerateContent function.

-//			Or the changed information will be lost.

-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);

-

-//////////////////////////////////////////////////////////////////////

-//

-// Page Object functions

-//

-//////////////////////////////////////////////////////////////////////

-

-// Function: FPDFPageObj_HasTransparency

-//			Check that whether the specified PDF page object contains transparency.

-// Parameters:	

-//			pageObject	-	Handle to a page object.

-// Return value:

-//			TRUE means that the PDF page object does contains transparency.

-//			Otherwise, returns FALSE.

-DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);

-

-// Function: FPDFPageObj_Transform

-//			Transform (scale, rotate, shear, move) page object.

-// Parameters:	

-//			page_object	-	Handle to a page object. Returned by FPDFPageObj_NewImageObj.

-//			a			-	The coefficient "a" of the matrix.

-//			b			-	The	coefficient "b" of the matrix.

-//			c			-	The coefficient "c" of the matrix.

-//			d			-	The coefficient "d" of the matrix.

-//			e			-	The coefficient "e" of the matrix.

-//			f			-	The coefficient "f" of the matrix.

-// Return value:

-//			None.

-DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,

-							double a, double b, double c, double d, double e, double f);

-

-// Function: FPDFPage_TransformAnnots

-//			Transform (scale, rotate, shear, move) all annots in a page.

-// Parameters:	

-//			page		-	Handle to a page.

-//			a			-	The coefficient "a" of the matrix.

-//			b			-	The	coefficient "b" of the matrix.

-//			c			-	The coefficient "c" of the matrix.

-//			d			-	The coefficient "d" of the matrix.

-//			e			-	The coefficient "e" of the matrix.

-//			f			-	The coefficient "f" of the matrix.

-// Return value:

-//			None.

-DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,

-											 double a, double b, double c, double d, double e, double f);

-

-// The page object constants.

-#define FPDF_PAGEOBJ_TEXT		1

-#define FPDF_PAGEOBJ_PATH		2

-#define FPDF_PAGEOBJ_IMAGE		3

-#define FPDF_PAGEOBJ_SHADING	4

-#define FPDF_PAGEOBJ_FORM		5

-

-//////////////////////////////////////////////////////////////////////

-//

-// Image functions

-//

-//////////////////////////////////////////////////////////////////////

-

-// Function: FPDFPageObj_NewImgeObj

-//			Create a new Image Object.

-// Parameters:

-//			document		-	Handle to document. Returned by FPDF_LoadDocument or FPDF_CreateNewDocument function.

-// Return Value:

-//			Handle of image object.

-DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);

-

-

-// Function: FPDFImageObj_LoadJpegFile

-//			Load Image from a JPEG image file and then set it to an image object.

-// Parameters:

-//			pages			-	Pointers to the start of all loaded pages, could be NULL.

-//			nCount			-	Number of pages, could be 0.

-//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.

-//			fileAccess		-	The custom file access handler, which specifies the JPEG image file.

-//	Return Value:

-//			TRUE if successful, FALSE otherwise.

-//  Note: 

-//			The image object might already has an associated image, which is shared and cached by the loaded pages, In this case, we need to clear the cache of image for all the loaded pages.

-//			Pass pages and count to this API to clear the image cache. 

-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess);

-

-

-// Function: FPDFImageObj_SetMatrix

-//			Set the matrix of an image object.

-// Parameters:

-//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.

-//			a				-	The coefficient "a" of the matrix.

-//			b				-	The coefficient "b" of the matrix.

-//			c				-	The coefficient "c" of the matrix.

-//			d				-	The coefficient "d" of the matrix.

-//			e				-	The coefficient "e" of the matrix.

-//			f				-	The coefficient "f" of the matrix.

-// Return value:

-//			TRUE if successful, FALSE otherwise. 

-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,

-											 double a, double b, double c, double d, double e, double f);

-

-// Function: FPDFImageObj_SetBitmap

-//			Set the bitmap to an image object.

-// Parameters:

-//			pages			-	Pointer's to the start of all loaded pages.

-//			nCount			-	Number of pages.

-//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.

-//			bitmap			-	The handle of the bitmap which you want to set it to the image object.

-// Return value:

-//			TRUE if successful, FALSE otherwise. 

-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap);

-

-#ifdef __cplusplus

-}

-#endif

-#endif // _FPDFEDIT_H_

+// 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	_FPDFEDIT_H_
+#define	_FPDFEDIT_H_
+
+#include "fpdfview.h"
+
+// Define all types used in the SDK. Note they can be simply regarded as opaque pointers
+// or long integer numbers.
+
+#define FPDF_ARGB(a,r,g,b)		((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<<24))
+#define FPDF_GetBValue(argb)    ((FX_BYTE)(argb))
+#define FPDF_GetGValue(argb)    ((FX_BYTE)(((FX_WORD)(argb)) >> 8))
+#define FPDF_GetRValue(argb)    ((FX_BYTE)((argb)>>16))
+#define FPDF_GetAValue(argb)    ((FX_BYTE)((argb)>>24))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////////////////////
+//
+// Document functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDF_CreateNewDocument
+//			Create a new PDF document.
+// Parameters:	
+//			None.
+// Return value:
+//			A handle to a document. If failed, NULL is returned.
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();
+
+//////////////////////////////////////////////////////////////////////
+//
+// Page functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPage_New
+//			Construct an empty page.
+// Parameters:	
+//			document	-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+//			page_index	-	The index of a page.
+//			width		-	The page width.
+//			height		-	The page height.
+// Return value:
+//			The handle to the page.
+// Comments:
+//			Loaded page can be deleted by FPDFPage_Delete.
+DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height);
+
+// Function: FPDFPage_Delete
+//			Delete a PDF page.
+// Parameters:	
+//			document	-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+//			page_index	-	The index of a page.
+// Return value:
+//			None.
+DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);
+
+// Function: FPDFPage_GetRotation
+//			Get the page rotation. One of following values will be returned: 0(0), 1(90), 2(180), 3(270).
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New.
+// Return value:
+//			The PDF page rotation.
+// Comment:
+//			The PDF page rotation is rotated clockwise.
+DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);
+
+// Function: FPDFPage_InsertObject
+//			Insert an object to the page. The page object is automatically freed.
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New.
+//			page_obj	-	Handle to a page object. Returned by FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and
+//							FPDFPageObj_NewPathObj.
+// Return value:
+//			None.
+DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj);
+
+// Function: FPDFPage_CountObject
+//			Get number of page objects inside the page.
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New.
+// Return value:
+//			The number of the page object.
+DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);
+
+// Function: FPDFPage_GetObject
+//			Get page object by index.
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New.
+//			index		-	The index of a page object.
+// Return value:
+//			The handle of the page object. Null for failed.
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);
+
+// Function: FPDFPage_HasTransparency
+//			Check that whether the content of specified PDF page contains transparency.
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// Return value:
+//			TRUE means that the PDF page does contains transparency.
+//			Otherwise, returns FALSE.
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);
+
+// Function: FPDFPage_GenerateContent
+//			Generate PDF Page content.
+// Parameters:	
+//			page		-	Handle to a page. Returned by FPDFPage_New.
+// Return value:
+//			True if successful, false otherwise.
+// Comment:
+//			Before you save the page to a file, or reload the page, you must call the FPDFPage_GenerateContent function.
+//			Or the changed information will be lost.
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
+
+//////////////////////////////////////////////////////////////////////
+//
+// Page Object functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPageObj_HasTransparency
+//			Check that whether the specified PDF page object contains transparency.
+// Parameters:	
+//			pageObject	-	Handle to a page object.
+// Return value:
+//			TRUE means that the PDF page object does contains transparency.
+//			Otherwise, returns FALSE.
+DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
+
+// Function: FPDFPageObj_Transform
+//			Transform (scale, rotate, shear, move) page object.
+// Parameters:	
+//			page_object	-	Handle to a page object. Returned by FPDFPageObj_NewImageObj.
+//			a			-	The coefficient "a" of the matrix.
+//			b			-	The	coefficient "b" of the matrix.
+//			c			-	The coefficient "c" of the matrix.
+//			d			-	The coefficient "d" of the matrix.
+//			e			-	The coefficient "e" of the matrix.
+//			f			-	The coefficient "f" of the matrix.
+// Return value:
+//			None.
+DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+							double a, double b, double c, double d, double e, double f);
+
+// Function: FPDFPage_TransformAnnots
+//			Transform (scale, rotate, shear, move) all annots in a page.
+// Parameters:	
+//			page		-	Handle to a page.
+//			a			-	The coefficient "a" of the matrix.
+//			b			-	The	coefficient "b" of the matrix.
+//			c			-	The coefficient "c" of the matrix.
+//			d			-	The coefficient "d" of the matrix.
+//			e			-	The coefficient "e" of the matrix.
+//			f			-	The coefficient "f" of the matrix.
+// Return value:
+//			None.
+DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
+											 double a, double b, double c, double d, double e, double f);
+
+// The page object constants.
+#define FPDF_PAGEOBJ_TEXT		1
+#define FPDF_PAGEOBJ_PATH		2
+#define FPDF_PAGEOBJ_IMAGE		3
+#define FPDF_PAGEOBJ_SHADING	4
+#define FPDF_PAGEOBJ_FORM		5
+
+//////////////////////////////////////////////////////////////////////
+//
+// Image functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPageObj_NewImgeObj
+//			Create a new Image Object.
+// Parameters:
+//			document		-	Handle to document. Returned by FPDF_LoadDocument or FPDF_CreateNewDocument function.
+// Return Value:
+//			Handle of image object.
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
+
+
+// Function: FPDFImageObj_LoadJpegFile
+//			Load Image from a JPEG image file and then set it to an image object.
+// Parameters:
+//			pages			-	Pointers to the start of all loaded pages, could be NULL.
+//			nCount			-	Number of pages, could be 0.
+//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.
+//			fileAccess		-	The custom file access handler, which specifies the JPEG image file.
+//	Return Value:
+//			TRUE if successful, FALSE otherwise.
+//  Note: 
+//			The image object might already has an associated image, which is shared and cached by the loaded pages, In this case, we need to clear the cache of image for all the loaded pages.
+//			Pass pages and count to this API to clear the image cache. 
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess);
+
+
+// Function: FPDFImageObj_SetMatrix
+//			Set the matrix of an image object.
+// Parameters:
+//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.
+//			a				-	The coefficient "a" of the matrix.
+//			b				-	The coefficient "b" of the matrix.
+//			c				-	The coefficient "c" of the matrix.
+//			d				-	The coefficient "d" of the matrix.
+//			e				-	The coefficient "e" of the matrix.
+//			f				-	The coefficient "f" of the matrix.
+// Return value:
+//			TRUE if successful, FALSE otherwise. 
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
+											 double a, double b, double c, double d, double e, double f);
+
+// Function: FPDFImageObj_SetBitmap
+//			Set the bitmap to an image object.
+// Parameters:
+//			pages			-	Pointer's to the start of all loaded pages.
+//			nCount			-	Number of pages.
+//			image_object	-	Handle of image object returned by FPDFPageObj_NewImgeObj.
+//			bitmap			-	The handle of the bitmap which you want to set it to the image object.
+// Return value:
+//			TRUE if successful, FALSE otherwise. 
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _FPDFEDIT_H_
diff --git a/fpdfsdk/include/fpdfformfill.h b/fpdfsdk/include/fpdfformfill.h
index 0e7556e..50a2dff 100644
--- a/fpdfsdk/include/fpdfformfill.h
+++ b/fpdfsdk/include/fpdfformfill.h
@@ -1,841 +1,841 @@
-// 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 _FPDFORMFILL_H

-#define _FPDFORMFILL_H

-#include "fpdfview.h"

-

-typedef void* FPDF_FORMHANDLE;

-

-// Exported Functions

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-typedef struct _IPDF_JsPlatform

-{

-/**

-* Version number of the interface. Currently must be 1.

-	**/

-	int version;

-	

-	/** 

-	* Method: app_alert

-	*			pop up a dialog to show warning or hint.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			Msg			-	A string containing the message to be displayed.

-	*			Title		-   The title of the dialog.

-	*			Type		-	The stype of button group. 

-	*							0-OK(default);

-	*							1-OK,Cancel;

-	*							2-Yes,NO; 

-	*							3-Yes, NO, Cancel.

-	*           nIcon		-   The Icon type. 

-	*							0-Error(default);

-	*							1-Warning;

-	*							2-Question;

-	*							3-Status.

-	* Return Value:

-	*			The return value could be the folowing type:

-	*							1-OK;

-	*							2-Cancel; 

-	*							3-NO;

-	*							4-Yes;

-	*/

-	int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon);

-	

-	/** 

-	* Method: app_beep

-	*			Causes the system to play a sound. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			nType		-	The sound type.

-	*							0 - Error

-	*							1 - Warning

-	*							2 - Question

-	*							3 - Status

-	*							4 - Default (default value)

-	* Return Value:

-	*			None

-	*/

-	void (*app_beep)(struct _IPDF_JsPlatform* pThis,  int nType);

-	

-	

-	/** 

-	* Method: app_response

-	*			Displays a dialog box containing a question and an entry field for the user to reply to the question.  

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			Question	-	The question to be posed to the user.

-	*			Title		-	The title of the dialog box.

-	*			Default		-	A default value for the answer to the question. If not specified, no default value is presented.

-	*			cLabel		-	A short string to appear in front of and on the same line as the edit text field. 

-	*			bPassword	-	If true, indicates that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information. The default is false.		

-	*			response	-	A string buffer allocated by SDK, to receive the user's response. 

-	*			length		-   The length of the buffer, number of bytes. Currently, It's always be 2048.

-	* Return Value:

-	*			Number of bytes the user input text consumes, not including trailing zeros. If the text exceed 2048 bytes,

-	*			the exceeded part will be ignored.

-	* Comments:

-	*			No matter on what platform, the response should be always input in UTF-16LE encoding.

-	*			The return value always indicated number of bytes required for the buffer, even when there is

-	*			no buffer specified, or the buffer size is less then required. In this case, the buffer will not

-	*			be modified.

-	*/

-	int (*app_response)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title, FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length);

-	

-	

-	

-	/*

-	* Method: Doc_getFilePath

-	*			Get the file path of the current document. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			filePath	-	The string buffer to receive the file path. Can be NULL.

-	*			length		-   The length of the buffer, number of bytes. Can be 0.

-	* Return Value:

-	*		Number of bytes the filePath consumes, including trailing zeros.

-	* Comments:

-	*		The filePath should be always input in local encoding.

-	*

-	*		The return value always indicated number of bytes required for the buffer, even when there is

-	*		no buffer specified, or the buffer size is less then required. In this case, the buffer will not

-	*		be modified.

-	*/

-	int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);

-	

-	

-	/*

-	* Method: Doc_mail

-	*			Mails the data buffer as an attachment to all recipients, with or without user interaction. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			mailData	-	Pointer to the data buffer to be sent.Can be NULL.

-	*			length		-	The size,in bytes, of the buffer pointed by mailData parameter.Can be 0.

-	*			bUI			-   If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.

-	*			To			-	A semicolon-delimited list of recipients for the message.

-	*			Subject		-   The subject of the message. The length limit is 64 KB.

-	*			CC			-	A semicolon-delimited list of CC recipients for the message. 

-	*			BCC			-   A semicolon-delimited list of BCC recipients for the message. 

-	*			Msg			-   The content of the message. The length limit is 64 KB.

-	* Return Value:

-	*			None.

-	* Comments:

-	*			If the parameter mailData is NULL or length is 0, the current document will be mailed as an attachment to all recipients.

-	*/

-	void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,void* mailData, int length,FPDF_BOOL bUI, FPDF_WIDESTRING To, FPDF_WIDESTRING Subject, FPDF_WIDESTRING CC, FPDF_WIDESTRING BCC, FPDF_WIDESTRING Msg); 

-	

-

-	/*

-	* Method: Doc_print

-	*			Prints all or a specific number of pages of the document.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself.

-	*			bUI			-	If true, will cause a UI to be presented to the user to obtain printing information and confirm the action.

-	*			nStart		-	A 0-based index that defines the start of an inclusive range of pages.

-	*			nEnd		-   A 0-based index that defines the end of an inclusive page range.

-	*			bSilent		-   If true, suppresses the cancel dialog box while the document is printing. The default is false.

-	*			bShrinkToFit	-	If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page.

-	*			bPrintAsImage	-	If true, print pages as an image.

-	*			bReverse	-	If true, print from nEnd to nStart.

-	*			bAnnotations	-	If true (the default), annotations are printed.

-	*/

-	void (*Doc_print)(struct _IPDF_JsPlatform* pThis, FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations);

-

-	/*

-	* Method: Doc_submitForm

-	*			Send the form data to a specified URL.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			formData	-	Pointer to the data buffer to be sent.

-	*			length		-	The size,in bytes, of the buffer pointed by formData parameter.

-	*			URL			-	The URL to send to.

-	* Return Value:

-	*			None.

-	*

-	*/

-	void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL);

-	

-	/*

-	* Method: Doc_gotoPage

-	*			Jump to a specified page.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself

-	*			nPageNum	-	The specified page number, zero for the first page.

-	* Return Value:

-	*			None.

-	*

-	*/

-	void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);

-	/*

-	* Method: Field_browse

-	*			Show a file selection dialog, and return the selected file path.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*			pThis		-	Pointer to the interface structure itself.

-	*			filePath	-	Pointer to the data buffer to receive the file path.Can be NULL.

-	*			length		-   The length of the buffer, number of bytes. Can be 0.

-	* Return Value:

-	*		Number of bytes the filePath consumes, including trailing zeros.

-	* Comments:

-	*		The filePath shoule be always input in local encoding.

-	*/

-	int  (*Field_browse)(struct _IPDF_JsPlatform* pThis,void* filePath, int length);

-

-	/**

-	*	pointer to FPDF_FORMFILLINFO interface.

-	**/

-	void*	m_pFormfillinfo;

-} IPDF_JSPLATFORM;

-

-// Flags for Cursor type

-#define FXCT_ARROW	0

-#define FXCT_NESW	1		

-#define FXCT_NWSE	2		

-#define FXCT_VBEAM	3		

-#define FXCT_HBEAM	4	

-#define FXCT_HAND	5

-

-/**

- * Declares of a pointer type to the callback function for the FFI_SetTimer method.

- * Parameters:

- *			idEvent		-	Identifier of the timer. 

- * Return value:

- *			None. 

- **/	

-typedef void	(*TimerCallback)(int idEvent);

-

-/**

- * Declares of a struct type to the local system time.

-**/

-typedef struct _FPDF_SYSTEMTIME 

-{

-    unsigned short wYear;			/* years since 1900 */

-    unsigned short wMonth;			/* months since January - [0,11] */

-    unsigned short wDayOfWeek;		/* days since Sunday - [0,6] */

-    unsigned short wDay;			/* day of the month - [1,31] */

-    unsigned short wHour;			/* hours since midnight - [0,23] */

-    unsigned short wMinute;			/* minutes after the hour - [0,59] */

-    unsigned short wSecond;			/* seconds after the minute - [0,59] */

-    unsigned short wMilliseconds;	/* milliseconds after the second - [0,999] */

-}FPDF_SYSTEMTIME;

-

-

-typedef struct  _FPDF_FORMFILLINFO

-{

-	/**

-	 * Version number of the interface. Currently must be 1.

-	 **/

-	int	version;

-

-		/** 

-	 * Method: Release

-	 *			Give implementation a chance to release any data after the interface is no longer used

-	 * Interface Version:

-	 *			1

-	 * Implementation Required:

-	 *			No

-	 * Comments:

-	 *			Called by Foxit SDK during the final cleanup process.

-	 * Parameters:

-	 *			pThis		-	Pointer to the interface structure itself

-	 * Return Value:

-	 *			None

-	 */

-

-	void (*Release)(struct _FPDF_FORMFILLINFO* pThis);

-

-	/** 

-	 * Method: FFI_Invalidate

-	 *			Invalidate the client area within the specified rectangle.

-	 * Interface Version:

-	 *			1

-	 * Implementation Required:

-		*			yes

-	 * Parameters:

-	 *			pThis		-	Pointer to the interface structure itself.

-	 *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-	 *			left		-	Left position of the client area in PDF page coordinate.

-	 *			top			-	Top  position of the client area in PDF page coordinate.

-	 *			right		-	Right position of the client area in PDF page  coordinate.

-	 *			bottom		-	Bottom position of the client area in PDF page coordinate.

-	 * Return Value:

-	 *			None.

-	 *

-	 *comments:

-	 *			All positions are measured in PDF "user space".

-	 *			Implementation should call FPDF_RenderPageBitmap() function for repainting a specified page area.

-	*/

-	void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);

-	

-	/** 

-	 * Method: FFI_OutputSelectedRect

-	 *			When user is taking the mouse to select texts on a form field, this callback function will keep 

-	 *			returning the selected areas to the implementation.

-	 *

-	 * Interface Version:

-	 *			1

-	 * Implementation Required:

-	 *			No

-	 * Parameters:

-	 *			pThis		-	Pointer to the interface structure itself.

-	 *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-	 *			left		-	Left position of the client area in PDF page coordinate.

-	 *			top			-	Top  position of the client area in PDF page coordinate.

-	 *			right		-	Right position of the client area in PDF page  coordinate.

-	 *			bottom		-	Bottom position of the client area in PDF page coordinate.

-	 * Return Value:

-	 *			None.

-	 *

-	 * comments:

-	 *			This CALLBACK function is useful for implementing special text selection effect. Implementation should

-	 *			first records the returned rectangles, then draw them one by one at the painting period, last,remove all 

-	 *			the recorded rectangles when finish painting.

-	*/

-	void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);

-

-	/** 

-	* Method: FFI_SetCursor

-	*			Set the Cursor shape.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 		nCursorType	-	Cursor type. see Flags for Cursor type for the details.

-	* 	Return value:

-	* 		None.

-	* */

-	void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);

-

-	/** 

-	* Method: FFI_SetTimer

-	*			This method installs a system timer. A time-out value is specified, 

-	*			and every time a time-out occurs, the system passes a message to

-	*			the TimerProc callback function. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 		uElapse		-	Specifies the time-out value, in milliseconds.

-	* 		lpTimerFunc	-	A pointer to the callback function-TimerCallback.

-	* 	Return value:

-	* 		The timer identifier of the new timer if the function is successful.

-	*		An application passes this value to the FFI_KillTimer method to kill 

-	*		the timer. Nonzero if it is successful; otherwise, it is zero.

-	* */

-	int  (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);

-

-	/** 

-	* Method: FFI_KillTimer

-	*			This method kills the timer event identified by nIDEvent, set by an earlier call to FFI_SetTimer. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 		nTimerID	-	The timer ID return by FFI_SetTimer function.

-	* 	Return value:

-	* 		None.

-	* */

-	void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);

-

-

-	/** 

-	* Method: FFI_GetLocalTime

-	*			This method receives the current local time on the system. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 	Return value:

-	* 		None.

-	* */

-	FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);

-

-	/** 

-	* Method: FFI_OnChange

-	*			This method will be invoked to notify implementation when the value of any FormField on the document had been changed.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			no

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 	Return value:

-	* 		None.

-	* */

-	void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);

-

-	/** 

-	* Method: FFI_GetPage

-	*			This method receives the page pointer associated with a specified page index.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	*		document	-	Handle to document. Returned by FPDF_LoadDocument function.

-	*		nPageIndex  -	Index number of the page. 0 for the first page.

-	* Return value:

-	* 		Handle to the page. Returned by FPDF_LoadPage function.

-	* Comments:

-	*		In some cases, the document-level JavaScript action may refer to a page which hadn't been loaded yet.

-	*		To successfully run the javascript action, implementation need to load the page for SDK.

-	* */

-	FPDF_PAGE	(*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int nPageIndex);

-

-	/** 

-	* Method: FFI_GetCurrentPage

-	*		This method receives the current page pointer.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	*		document	-	Handle to document. Returned by FPDF_LoadDocument function.

-	* Return value:

-	* 		Handle to the page. Returned by FPDF_LoadPage function.

-	* */

-	FPDF_PAGE	(*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);

-

-	/** 

-	* Method: FFI_GetRotation

-	*			This method receives currently rotation of the page view.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	*		page		-	Handle to page. Returned by FPDF_LoadPage function.

-	* Return value:

-	* 		The page rotation. Should be 0(0 degree),1(90 degree),2(180 degree),3(270 degree), in a clockwise direction.

-	* */

-	int 	(*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);

-

-	/** 

-	* Method: FFI_ExecuteNamedAction

-	*			This method will execute an named action.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			yes

-	* Parameters:

-	*		pThis			-	Pointer to the interface structure itself.

-	*		namedAction		-	A byte string which indicates the named action, terminated by 0.

-	* Return value:

-	* 		None.

-	* Comments:

-	*		See the named actions description of <<PDF Reference, version 1.7>> for more details.  

-	* */

-	void 	(*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction);

-	/** 

-	* @brief This method will be called when a text field is getting or losing a focus.

-	*

-	* @param[in] pThis		Pointer to the interface structure itself.

-	* @param[in] value		The string value of the form field, in UTF-16LE format.

-	* @param[in] valueLen	The length of the string value, number of characters (not bytes).

-	* @param[in] is_focus	True if the form field is getting a focus, False for losing a focus.

-	*

-	* @return None.

-	*

-	* @note Currently,only support text field and combobox field.

-	* */

-	void	(*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING value, FPDF_DWORD valueLen, FPDF_BOOL is_focus);

-

-	

-	/** 

-	* Method: FFI_DoURIAction

-	*			This action resolves to a uniform resource identifier. 

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			No

-	* Parameters:

-	*		pThis			-	Pointer to the interface structure itself.

-	*		bsURI			-	A byte string which indicates the uniform resource identifier, terminated by 0.

-	* Return value:

-	* 		None.

-	* Comments:

-	*		See the URI actions description of <<PDF Reference, version 1.7>> for more details.  

-	* */

-	void	(*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING bsURI);

-	

-	/** 

-	* Method: FFI_DoGoToAction

-	*			This action changes the view to a specified destination.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			No

-	* Parameters:

-	*		pThis			-	Pointer to the interface structure itself.

-	*		nPageIndex		-	The index of the PDF page.

-	*		zoomMode		-	The zoom mode for viewing page.See Macros "PDFZOOM_XXX" defined in "fpdfdoc.h". 

-	*		fPosArray		-	The float array which carries the position info.

-	*		sizeofArray		-	The size of float array.

-	* Return value:

-	* 		None.

-	* Comments:

-	*		See the Destinations description of <<PDF Reference, version 1.7>> in 8.2.1 for more details.  

-	**/

-	void	(*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, float* fPosArray, int sizeofArray);

-	/**

-	*	pointer to IPDF_JSPLATFORM interface

-	**/

-	IPDF_JSPLATFORM*	m_pJsPlatform;

-

-} FPDF_FORMFILLINFO;

-

-

-

-/**

- * Function: FPDFDOC_InitFormFillEnviroument

- *			Init form fill environment. 

- * Comments:

- *			This function should be called before any form fill operation.

- * Parameters:

- *			document		-	Handle to document. Returned by FPDF_LoadDocument function.

- *			pFormFillInfo	-	Pointer to a FPDF_FORMFILLINFO structure.

- * Return Value:

- *			Return handler to the form fill module. NULL means fails. 

- **/

-DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnviroument(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);

-

-/**

- * Function: FPDFDOC_ExitFormFillEnviroument

- *			Exit form fill environment. 

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- * Return Value:

- *			NULL.

- **/

-DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnviroument(FPDF_FORMHANDLE hHandle);

-

-/**

- * Function: FORM_OnAfterLoadPage

- *			This method is required for implementing all the form related functions. Should be invoked after user 

- *			successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnviroument had been invoked.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- * Return Value:

- *			NONE.

- **/

-DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);

-

-/**

- * Function: FORM_OnBeforeClosePage

- *			This method is required for implementing all the form related functions. Should be invoked before user 

- *			close the PDF page.

- * Parameters:

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- * Return Value:

- *			NONE.

- **/

-DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);

-

-/**

-* Function: FORM_DoDocumentJSAction

-*			This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document

-*			had been loaded.

-* Parameters:

-*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

-* Return Value:

-*			NONE

-* Comments:

-*			If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;

-*			otherwise, the method will do nothing.

-**/

-DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);

-

-

-/**

-* Function: FORM_DoDocumentOpenAction

-*			This method is required for performing open-action when the document is opened.

-* Parameters:

-*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

-* Return Value:

-*			NONE

-* Comments:

-*			This method will do nothing if there is no open-actions embedded in the document. 

-**/

-DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);

-

-

-// additional actions type of document.

-#define FPDFDOC_AACTION_WC		0x10		//WC, before closing document, JavaScript action.

-#define FPDFDOC_AACTION_WS		0x11		//WS, before saving document, JavaScript action.

-#define FPDFDOC_AACTION_DS		0x12		//DS, after saving document, JavaScript action.

-#define FPDFDOC_AACTION_WP		0x13		//WP, before printing document, JavaScript action.

-#define FPDFDOC_AACTION_DP		0x14		//DP, after printing document, JavaScript action. 

-/**

-* Function: FORM_DoDocumentAAction

-*			This method is required for performing the document's additional-action.

-* Parameters:

-*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

-*			aaType	    -   The type of the additional-actions which defined above.

-* Return Value:

-*			NONE

-* Comments:

-*			This method will do nothing if there is no document additional-action corresponding to the specified aaType.

-**/

-

-DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);

-

-// Additional-action types of page object

-#define FPDFPAGE_AACTION_OPEN		0		// /O -- An action to be performed when the page is opened

-#define FPDFPAGE_AACTION_CLOSE		1		// /C -- An action to be performed when the page is closed

-

-/**

-* Function: FORM_DoPageAAction

-*			This method is required for performing the page object's additional-action when opened or closed.

-* Parameters:

-*			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

-*			aaType	    -   The type of the page object's additional-actions which defined above.

-* Return Value:

-*			NONE

-* Comments:

-*			This method will do nothing if no additional-action corresponding to the specified aaType exists.

-**/

-DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);

-

-/**

- * Function: FORM_OnMouseMove

- *			You can call this member function when the mouse cursor moves. 

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			modifier		-	Indicates whether various virtual keys are down. 

- *			page_x		-	Specifies the x-coordinate of the cursor in PDF user space. 

- *			page_y		-	Specifies the y-coordinate of the cursor in PDF user space.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);

-

-/**

- * Function: FORM_OnLButtonDown

- *			You can call this member function when the user presses the left mouse button.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			modifier		-	Indicates whether various virtual keys are down. 

- *			page_x		-	Specifies the x-coordinate of the cursor in PDF user space. 

- *			page_y		-	Specifies the y-coordinate of the cursor in PDF user space.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);

-

-/**

- * Function: FORM_OnLButtonUp

- *			You can call this member function when the user releases the left mouse button.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			modifier	-	Indicates whether various virtual keys are down. 

- *			page_x		-	Specifies the x-coordinate of the cursor in device. 

- *			page_y		-	Specifies the y-coordinate of the cursor in device.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);

-

-/**

- * Function: FORM_OnKeyDown

- *			You can call this member function when a nonsystem key is pressed. 

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			nKeyCode	-	Indicates whether various virtual keys are down. 

- *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);

-

-/**

- * Function: FORM_OnKeyUp

- *			You can call this member function when a nonsystem key is released. 

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			nKeyCode	-	The virtual-key code of the given key.

- *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);

-

-/**

- * Function: FORM_OnChar

- *			You can call this member function when a keystroke translates to a nonsystem character.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			nChar		-	The character code value of the key.  

- *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);

-

-/**

- * Function: FORM_ForceToKillFocus.

- *			You can call this member function to force to kill the focus of the form field which got focus.

- *			It would kill the focus on the form field, save the value of form field if it's changed by user.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- * Return Value:

- *			TRUE indicates success; otherwise false.

- **/

-DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);

-

-// Field Types

-#define FPDF_FORMFIELD_UNKNOWN		0		// Unknown.

-#define FPDF_FORMFIELD_PUSHBUTTON	1		// push button type.

-#define FPDF_FORMFIELD_CHECKBOX		2		// check box type.

-#define FPDF_FORMFIELD_RADIOBUTTON	3		// radio button type.

-#define FPDF_FORMFIELD_COMBOBOX		4		// combo box type.

-#define FPDF_FORMFIELD_LISTBOX		5		// list box type.

-#define FPDF_FORMFIELD_TEXTFIELD	6		// text field type.

-

-/**

- * Function: FPDPage_HasFormFieldAtPoint

- *			Check the form filed position by point.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			page		-	Handle to the page. Returned by FPDF_LoadPage function.

- *			page_x		-	X position in PDF "user space".

- *			page_y		-	Y position in PDF "user space".

- * Return Value:

- *			Return the type of the formfiled; -1 indicates no fields.

- **/

-DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);

-

-/**

- * Function: FPDF_SetFormFieldHighlightColor

- *			Set the highlight color of specified or all the form fields in the document.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			doc			-	Handle to the document. Returned by FPDF_LoadDocument function.

- *			fieldType	-	A 32-bit integer indicating the type of a form field(defined above).

- *			color		-	The highlight color of the form field.Constructed by 0xxxrrggbb.

- * Return Value:

- *			NONE.

- * Comments:

- *			When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the 

- *			document.

- *			Please refresh the client window to show the highlight immediately if necessary.

- **/

-DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);

-

-/**

- * Function: FPDF_SetFormFieldHighlightAlpha

- *			Set the transparency of the form field highlight color in the document.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- *			doc			-	Handle to the document. Returned by FPDF_LoadDocument function.

- *			alpha		-	The transparency of the form field highlight color. between 0-255.

- * Return Value:

- *			NONE.

- **/

-DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);

-

-

-/**

- * Function: FPDF_RemoveFormFieldHighlight

- *			Remove the form field highlight color in the document.

- * Parameters:

- *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

- * Return Value:

- *			NONE.

- * Comments:

- *			Please refresh the client window to remove the highlight immediately if necessary.

- **/

-DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);

-

-/**

-* Function: FPDF_FFLDraw

-*			Render FormFeilds on a page to a device independent bitmap. 			

-* Parameters:

-*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.

-*			bitmap		-	Handle to the device independent bitmap (as the output buffer).

-*							Bitmap handle can be created by FPDFBitmap_Create function.

-*			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-*			start_x		-	Left pixel position of the display area in the device coordinate.

-*			start_y		-	Top pixel position of the display area in the device coordinate.

-*			size_x		-	Horizontal size (in pixels) for displaying the page.

-*			size_y		-	Vertical size (in pixels) for displaying the page.

-*			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-*								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-*			flags		-	0 for normal display, or combination of flags defined above. 

-* Return Value:

-*			None.

-* Comments: 

-*			This method is designed to only render annotations and FormFields on the page. 

-*			Without FPDF_ANNOT specified for flags, Rendering functions such as FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page contents(without annotations) to a bitmap.

-*			In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.

-**/

-DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 

-						int size_x, int size_y, int rotate, int flags);

-

-

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif //_FPDFORMFILL_H

-

+// 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 _FPDFORMFILL_H
+#define _FPDFORMFILL_H
+#include "fpdfview.h"
+
+typedef void* FPDF_FORMHANDLE;
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _IPDF_JsPlatform
+{
+/**
+* Version number of the interface. Currently must be 1.
+	**/
+	int version;
+	
+	/** 
+	* Method: app_alert
+	*			pop up a dialog to show warning or hint.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			Msg			-	A string containing the message to be displayed.
+	*			Title		-   The title of the dialog.
+	*			Type		-	The stype of button group. 
+	*							0-OK(default);
+	*							1-OK,Cancel;
+	*							2-Yes,NO; 
+	*							3-Yes, NO, Cancel.
+	*           nIcon		-   The Icon type. 
+	*							0-Error(default);
+	*							1-Warning;
+	*							2-Question;
+	*							3-Status.
+	* Return Value:
+	*			The return value could be the folowing type:
+	*							1-OK;
+	*							2-Cancel; 
+	*							3-NO;
+	*							4-Yes;
+	*/
+	int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon);
+	
+	/** 
+	* Method: app_beep
+	*			Causes the system to play a sound. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			nType		-	The sound type.
+	*							0 - Error
+	*							1 - Warning
+	*							2 - Question
+	*							3 - Status
+	*							4 - Default (default value)
+	* Return Value:
+	*			None
+	*/
+	void (*app_beep)(struct _IPDF_JsPlatform* pThis,  int nType);
+	
+	
+	/** 
+	* Method: app_response
+	*			Displays a dialog box containing a question and an entry field for the user to reply to the question.  
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			Question	-	The question to be posed to the user.
+	*			Title		-	The title of the dialog box.
+	*			Default		-	A default value for the answer to the question. If not specified, no default value is presented.
+	*			cLabel		-	A short string to appear in front of and on the same line as the edit text field. 
+	*			bPassword	-	If true, indicates that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information. The default is false.		
+	*			response	-	A string buffer allocated by SDK, to receive the user's response. 
+	*			length		-   The length of the buffer, number of bytes. Currently, It's always be 2048.
+	* Return Value:
+	*			Number of bytes the user input text consumes, not including trailing zeros. If the text exceed 2048 bytes,
+	*			the exceeded part will be ignored.
+	* Comments:
+	*			No matter on what platform, the response should be always input in UTF-16LE encoding.
+	*			The return value always indicated number of bytes required for the buffer, even when there is
+	*			no buffer specified, or the buffer size is less then required. In this case, the buffer will not
+	*			be modified.
+	*/
+	int (*app_response)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title, FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length);
+	
+	
+	
+	/*
+	* Method: Doc_getFilePath
+	*			Get the file path of the current document. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			filePath	-	The string buffer to receive the file path. Can be NULL.
+	*			length		-   The length of the buffer, number of bytes. Can be 0.
+	* Return Value:
+	*		Number of bytes the filePath consumes, including trailing zeros.
+	* Comments:
+	*		The filePath should be always input in local encoding.
+	*
+	*		The return value always indicated number of bytes required for the buffer, even when there is
+	*		no buffer specified, or the buffer size is less then required. In this case, the buffer will not
+	*		be modified.
+	*/
+	int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
+	
+	
+	/*
+	* Method: Doc_mail
+	*			Mails the data buffer as an attachment to all recipients, with or without user interaction. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			mailData	-	Pointer to the data buffer to be sent.Can be NULL.
+	*			length		-	The size,in bytes, of the buffer pointed by mailData parameter.Can be 0.
+	*			bUI			-   If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.
+	*			To			-	A semicolon-delimited list of recipients for the message.
+	*			Subject		-   The subject of the message. The length limit is 64 KB.
+	*			CC			-	A semicolon-delimited list of CC recipients for the message. 
+	*			BCC			-   A semicolon-delimited list of BCC recipients for the message. 
+	*			Msg			-   The content of the message. The length limit is 64 KB.
+	* Return Value:
+	*			None.
+	* Comments:
+	*			If the parameter mailData is NULL or length is 0, the current document will be mailed as an attachment to all recipients.
+	*/
+	void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,void* mailData, int length,FPDF_BOOL bUI, FPDF_WIDESTRING To, FPDF_WIDESTRING Subject, FPDF_WIDESTRING CC, FPDF_WIDESTRING BCC, FPDF_WIDESTRING Msg); 
+	
+
+	/*
+	* Method: Doc_print
+	*			Prints all or a specific number of pages of the document.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself.
+	*			bUI			-	If true, will cause a UI to be presented to the user to obtain printing information and confirm the action.
+	*			nStart		-	A 0-based index that defines the start of an inclusive range of pages.
+	*			nEnd		-   A 0-based index that defines the end of an inclusive page range.
+	*			bSilent		-   If true, suppresses the cancel dialog box while the document is printing. The default is false.
+	*			bShrinkToFit	-	If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page.
+	*			bPrintAsImage	-	If true, print pages as an image.
+	*			bReverse	-	If true, print from nEnd to nStart.
+	*			bAnnotations	-	If true (the default), annotations are printed.
+	*/
+	void (*Doc_print)(struct _IPDF_JsPlatform* pThis, FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations);
+
+	/*
+	* Method: Doc_submitForm
+	*			Send the form data to a specified URL.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			formData	-	Pointer to the data buffer to be sent.
+	*			length		-	The size,in bytes, of the buffer pointed by formData parameter.
+	*			URL			-	The URL to send to.
+	* Return Value:
+	*			None.
+	*
+	*/
+	void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL);
+	
+	/*
+	* Method: Doc_gotoPage
+	*			Jump to a specified page.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself
+	*			nPageNum	-	The specified page number, zero for the first page.
+	* Return Value:
+	*			None.
+	*
+	*/
+	void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
+	/*
+	* Method: Field_browse
+	*			Show a file selection dialog, and return the selected file path.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*			pThis		-	Pointer to the interface structure itself.
+	*			filePath	-	Pointer to the data buffer to receive the file path.Can be NULL.
+	*			length		-   The length of the buffer, number of bytes. Can be 0.
+	* Return Value:
+	*		Number of bytes the filePath consumes, including trailing zeros.
+	* Comments:
+	*		The filePath shoule be always input in local encoding.
+	*/
+	int  (*Field_browse)(struct _IPDF_JsPlatform* pThis,void* filePath, int length);
+
+	/**
+	*	pointer to FPDF_FORMFILLINFO interface.
+	**/
+	void*	m_pFormfillinfo;
+} IPDF_JSPLATFORM;
+
+// Flags for Cursor type
+#define FXCT_ARROW	0
+#define FXCT_NESW	1		
+#define FXCT_NWSE	2		
+#define FXCT_VBEAM	3		
+#define FXCT_HBEAM	4	
+#define FXCT_HAND	5
+
+/**
+ * Declares of a pointer type to the callback function for the FFI_SetTimer method.
+ * Parameters:
+ *			idEvent		-	Identifier of the timer. 
+ * Return value:
+ *			None. 
+ **/	
+typedef void	(*TimerCallback)(int idEvent);
+
+/**
+ * Declares of a struct type to the local system time.
+**/
+typedef struct _FPDF_SYSTEMTIME 
+{
+    unsigned short wYear;			/* years since 1900 */
+    unsigned short wMonth;			/* months since January - [0,11] */
+    unsigned short wDayOfWeek;		/* days since Sunday - [0,6] */
+    unsigned short wDay;			/* day of the month - [1,31] */
+    unsigned short wHour;			/* hours since midnight - [0,23] */
+    unsigned short wMinute;			/* minutes after the hour - [0,59] */
+    unsigned short wSecond;			/* seconds after the minute - [0,59] */
+    unsigned short wMilliseconds;	/* milliseconds after the second - [0,999] */
+}FPDF_SYSTEMTIME;
+
+
+typedef struct  _FPDF_FORMFILLINFO
+{
+	/**
+	 * Version number of the interface. Currently must be 1.
+	 **/
+	int	version;
+
+		/** 
+	 * Method: Release
+	 *			Give implementation a chance to release any data after the interface is no longer used
+	 * Interface Version:
+	 *			1
+	 * Implementation Required:
+	 *			No
+	 * Comments:
+	 *			Called by Foxit SDK during the final cleanup process.
+	 * Parameters:
+	 *			pThis		-	Pointer to the interface structure itself
+	 * Return Value:
+	 *			None
+	 */
+
+	void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
+
+	/** 
+	 * Method: FFI_Invalidate
+	 *			Invalidate the client area within the specified rectangle.
+	 * Interface Version:
+	 *			1
+	 * Implementation Required:
+		*			yes
+	 * Parameters:
+	 *			pThis		-	Pointer to the interface structure itself.
+	 *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+	 *			left		-	Left position of the client area in PDF page coordinate.
+	 *			top			-	Top  position of the client area in PDF page coordinate.
+	 *			right		-	Right position of the client area in PDF page  coordinate.
+	 *			bottom		-	Bottom position of the client area in PDF page coordinate.
+	 * Return Value:
+	 *			None.
+	 *
+	 *comments:
+	 *			All positions are measured in PDF "user space".
+	 *			Implementation should call FPDF_RenderPageBitmap() function for repainting a specified page area.
+	*/
+	void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
+	
+	/** 
+	 * Method: FFI_OutputSelectedRect
+	 *			When user is taking the mouse to select texts on a form field, this callback function will keep 
+	 *			returning the selected areas to the implementation.
+	 *
+	 * Interface Version:
+	 *			1
+	 * Implementation Required:
+	 *			No
+	 * Parameters:
+	 *			pThis		-	Pointer to the interface structure itself.
+	 *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+	 *			left		-	Left position of the client area in PDF page coordinate.
+	 *			top			-	Top  position of the client area in PDF page coordinate.
+	 *			right		-	Right position of the client area in PDF page  coordinate.
+	 *			bottom		-	Bottom position of the client area in PDF page coordinate.
+	 * Return Value:
+	 *			None.
+	 *
+	 * comments:
+	 *			This CALLBACK function is useful for implementing special text selection effect. Implementation should
+	 *			first records the returned rectangles, then draw them one by one at the painting period, last,remove all 
+	 *			the recorded rectangles when finish painting.
+	*/
+	void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
+
+	/** 
+	* Method: FFI_SetCursor
+	*			Set the Cursor shape.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 		nCursorType	-	Cursor type. see Flags for Cursor type for the details.
+	* 	Return value:
+	* 		None.
+	* */
+	void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
+
+	/** 
+	* Method: FFI_SetTimer
+	*			This method installs a system timer. A time-out value is specified, 
+	*			and every time a time-out occurs, the system passes a message to
+	*			the TimerProc callback function. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 		uElapse		-	Specifies the time-out value, in milliseconds.
+	* 		lpTimerFunc	-	A pointer to the callback function-TimerCallback.
+	* 	Return value:
+	* 		The timer identifier of the new timer if the function is successful.
+	*		An application passes this value to the FFI_KillTimer method to kill 
+	*		the timer. Nonzero if it is successful; otherwise, it is zero.
+	* */
+	int  (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);
+
+	/** 
+	* Method: FFI_KillTimer
+	*			This method kills the timer event identified by nIDEvent, set by an earlier call to FFI_SetTimer. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 		nTimerID	-	The timer ID return by FFI_SetTimer function.
+	* 	Return value:
+	* 		None.
+	* */
+	void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
+
+
+	/** 
+	* Method: FFI_GetLocalTime
+	*			This method receives the current local time on the system. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 	Return value:
+	* 		None.
+	* */
+	FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
+
+	/** 
+	* Method: FFI_OnChange
+	*			This method will be invoked to notify implementation when the value of any FormField on the document had been changed.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			no
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 	Return value:
+	* 		None.
+	* */
+	void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
+
+	/** 
+	* Method: FFI_GetPage
+	*			This method receives the page pointer associated with a specified page index.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	*		document	-	Handle to document. Returned by FPDF_LoadDocument function.
+	*		nPageIndex  -	Index number of the page. 0 for the first page.
+	* Return value:
+	* 		Handle to the page. Returned by FPDF_LoadPage function.
+	* Comments:
+	*		In some cases, the document-level JavaScript action may refer to a page which hadn't been loaded yet.
+	*		To successfully run the javascript action, implementation need to load the page for SDK.
+	* */
+	FPDF_PAGE	(*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int nPageIndex);
+
+	/** 
+	* Method: FFI_GetCurrentPage
+	*		This method receives the current page pointer.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	*		document	-	Handle to document. Returned by FPDF_LoadDocument function.
+	* Return value:
+	* 		Handle to the page. Returned by FPDF_LoadPage function.
+	* */
+	FPDF_PAGE	(*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
+
+	/** 
+	* Method: FFI_GetRotation
+	*			This method receives currently rotation of the page view.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	*		page		-	Handle to page. Returned by FPDF_LoadPage function.
+	* Return value:
+	* 		The page rotation. Should be 0(0 degree),1(90 degree),2(180 degree),3(270 degree), in a clockwise direction.
+	* */
+	int 	(*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
+
+	/** 
+	* Method: FFI_ExecuteNamedAction
+	*			This method will execute an named action.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			yes
+	* Parameters:
+	*		pThis			-	Pointer to the interface structure itself.
+	*		namedAction		-	A byte string which indicates the named action, terminated by 0.
+	* Return value:
+	* 		None.
+	* Comments:
+	*		See the named actions description of <<PDF Reference, version 1.7>> for more details.  
+	* */
+	void 	(*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction);
+	/** 
+	* @brief This method will be called when a text field is getting or losing a focus.
+	*
+	* @param[in] pThis		Pointer to the interface structure itself.
+	* @param[in] value		The string value of the form field, in UTF-16LE format.
+	* @param[in] valueLen	The length of the string value, number of characters (not bytes).
+	* @param[in] is_focus	True if the form field is getting a focus, False for losing a focus.
+	*
+	* @return None.
+	*
+	* @note Currently,only support text field and combobox field.
+	* */
+	void	(*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING value, FPDF_DWORD valueLen, FPDF_BOOL is_focus);
+
+	
+	/** 
+	* Method: FFI_DoURIAction
+	*			This action resolves to a uniform resource identifier. 
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			No
+	* Parameters:
+	*		pThis			-	Pointer to the interface structure itself.
+	*		bsURI			-	A byte string which indicates the uniform resource identifier, terminated by 0.
+	* Return value:
+	* 		None.
+	* Comments:
+	*		See the URI actions description of <<PDF Reference, version 1.7>> for more details.  
+	* */
+	void	(*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING bsURI);
+	
+	/** 
+	* Method: FFI_DoGoToAction
+	*			This action changes the view to a specified destination.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			No
+	* Parameters:
+	*		pThis			-	Pointer to the interface structure itself.
+	*		nPageIndex		-	The index of the PDF page.
+	*		zoomMode		-	The zoom mode for viewing page.See Macros "PDFZOOM_XXX" defined in "fpdfdoc.h". 
+	*		fPosArray		-	The float array which carries the position info.
+	*		sizeofArray		-	The size of float array.
+	* Return value:
+	* 		None.
+	* Comments:
+	*		See the Destinations description of <<PDF Reference, version 1.7>> in 8.2.1 for more details.  
+	**/
+	void	(*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, float* fPosArray, int sizeofArray);
+	/**
+	*	pointer to IPDF_JSPLATFORM interface
+	**/
+	IPDF_JSPLATFORM*	m_pJsPlatform;
+
+} FPDF_FORMFILLINFO;
+
+
+
+/**
+ * Function: FPDFDOC_InitFormFillEnviroument
+ *			Init form fill environment. 
+ * Comments:
+ *			This function should be called before any form fill operation.
+ * Parameters:
+ *			document		-	Handle to document. Returned by FPDF_LoadDocument function.
+ *			pFormFillInfo	-	Pointer to a FPDF_FORMFILLINFO structure.
+ * Return Value:
+ *			Return handler to the form fill module. NULL means fails. 
+ **/
+DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnviroument(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);
+
+/**
+ * Function: FPDFDOC_ExitFormFillEnviroument
+ *			Exit form fill environment. 
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ * Return Value:
+ *			NULL.
+ **/
+DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnviroument(FPDF_FORMHANDLE hHandle);
+
+/**
+ * Function: FORM_OnAfterLoadPage
+ *			This method is required for implementing all the form related functions. Should be invoked after user 
+ *			successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnviroument had been invoked.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ * Return Value:
+ *			NONE.
+ **/
+DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
+
+/**
+ * Function: FORM_OnBeforeClosePage
+ *			This method is required for implementing all the form related functions. Should be invoked before user 
+ *			close the PDF page.
+ * Parameters:
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ * Return Value:
+ *			NONE.
+ **/
+DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
+
+/**
+* Function: FORM_DoDocumentJSAction
+*			This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document
+*			had been loaded.
+* Parameters:
+*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+* Return Value:
+*			NONE
+* Comments:
+*			If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;
+*			otherwise, the method will do nothing.
+**/
+DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
+
+
+/**
+* Function: FORM_DoDocumentOpenAction
+*			This method is required for performing open-action when the document is opened.
+* Parameters:
+*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+* Return Value:
+*			NONE
+* Comments:
+*			This method will do nothing if there is no open-actions embedded in the document. 
+**/
+DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
+
+
+// additional actions type of document.
+#define FPDFDOC_AACTION_WC		0x10		//WC, before closing document, JavaScript action.
+#define FPDFDOC_AACTION_WS		0x11		//WS, before saving document, JavaScript action.
+#define FPDFDOC_AACTION_DS		0x12		//DS, after saving document, JavaScript action.
+#define FPDFDOC_AACTION_WP		0x13		//WP, before printing document, JavaScript action.
+#define FPDFDOC_AACTION_DP		0x14		//DP, after printing document, JavaScript action. 
+/**
+* Function: FORM_DoDocumentAAction
+*			This method is required for performing the document's additional-action.
+* Parameters:
+*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+*			aaType	    -   The type of the additional-actions which defined above.
+* Return Value:
+*			NONE
+* Comments:
+*			This method will do nothing if there is no document additional-action corresponding to the specified aaType.
+**/
+
+DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);
+
+// Additional-action types of page object
+#define FPDFPAGE_AACTION_OPEN		0		// /O -- An action to be performed when the page is opened
+#define FPDFPAGE_AACTION_CLOSE		1		// /C -- An action to be performed when the page is closed
+
+/**
+* Function: FORM_DoPageAAction
+*			This method is required for performing the page object's additional-action when opened or closed.
+* Parameters:
+*			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+*			aaType	    -   The type of the page object's additional-actions which defined above.
+* Return Value:
+*			NONE
+* Comments:
+*			This method will do nothing if no additional-action corresponding to the specified aaType exists.
+**/
+DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);
+
+/**
+ * Function: FORM_OnMouseMove
+ *			You can call this member function when the mouse cursor moves. 
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			modifier		-	Indicates whether various virtual keys are down. 
+ *			page_x		-	Specifies the x-coordinate of the cursor in PDF user space. 
+ *			page_y		-	Specifies the y-coordinate of the cursor in PDF user space.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnLButtonDown
+ *			You can call this member function when the user presses the left mouse button.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			modifier		-	Indicates whether various virtual keys are down. 
+ *			page_x		-	Specifies the x-coordinate of the cursor in PDF user space. 
+ *			page_y		-	Specifies the y-coordinate of the cursor in PDF user space.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnLButtonUp
+ *			You can call this member function when the user releases the left mouse button.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			modifier	-	Indicates whether various virtual keys are down. 
+ *			page_x		-	Specifies the x-coordinate of the cursor in device. 
+ *			page_y		-	Specifies the y-coordinate of the cursor in device.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnKeyDown
+ *			You can call this member function when a nonsystem key is pressed. 
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			nKeyCode	-	Indicates whether various virtual keys are down. 
+ *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
+
+/**
+ * Function: FORM_OnKeyUp
+ *			You can call this member function when a nonsystem key is released. 
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			nKeyCode	-	The virtual-key code of the given key.
+ *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
+
+/**
+ * Function: FORM_OnChar
+ *			You can call this member function when a keystroke translates to a nonsystem character.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			nChar		-	The character code value of the key.  
+ *			modifier	-	Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);
+
+/**
+ * Function: FORM_ForceToKillFocus.
+ *			You can call this member function to force to kill the focus of the form field which got focus.
+ *			It would kill the focus on the form field, save the value of form field if it's changed by user.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ * Return Value:
+ *			TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
+
+// Field Types
+#define FPDF_FORMFIELD_UNKNOWN		0		// Unknown.
+#define FPDF_FORMFIELD_PUSHBUTTON	1		// push button type.
+#define FPDF_FORMFIELD_CHECKBOX		2		// check box type.
+#define FPDF_FORMFIELD_RADIOBUTTON	3		// radio button type.
+#define FPDF_FORMFIELD_COMBOBOX		4		// combo box type.
+#define FPDF_FORMFIELD_LISTBOX		5		// list box type.
+#define FPDF_FORMFIELD_TEXTFIELD	6		// text field type.
+
+/**
+ * Function: FPDPage_HasFormFieldAtPoint
+ *			Check the form filed position by point.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+ *			page_x		-	X position in PDF "user space".
+ *			page_y		-	Y position in PDF "user space".
+ * Return Value:
+ *			Return the type of the formfiled; -1 indicates no fields.
+ **/
+DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);
+
+/**
+ * Function: FPDF_SetFormFieldHighlightColor
+ *			Set the highlight color of specified or all the form fields in the document.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			doc			-	Handle to the document. Returned by FPDF_LoadDocument function.
+ *			fieldType	-	A 32-bit integer indicating the type of a form field(defined above).
+ *			color		-	The highlight color of the form field.Constructed by 0xxxrrggbb.
+ * Return Value:
+ *			NONE.
+ * Comments:
+ *			When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the 
+ *			document.
+ *			Please refresh the client window to show the highlight immediately if necessary.
+ **/
+DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);
+
+/**
+ * Function: FPDF_SetFormFieldHighlightAlpha
+ *			Set the transparency of the form field highlight color in the document.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ *			doc			-	Handle to the document. Returned by FPDF_LoadDocument function.
+ *			alpha		-	The transparency of the form field highlight color. between 0-255.
+ * Return Value:
+ *			NONE.
+ **/
+DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
+
+
+/**
+ * Function: FPDF_RemoveFormFieldHighlight
+ *			Remove the form field highlight color in the document.
+ * Parameters:
+ *			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+ * Return Value:
+ *			NONE.
+ * Comments:
+ *			Please refresh the client window to remove the highlight immediately if necessary.
+ **/
+DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
+
+/**
+* Function: FPDF_FFLDraw
+*			Render FormFeilds on a page to a device independent bitmap. 			
+* Parameters:
+*			hHandle		-	Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
+*			bitmap		-	Handle to the device independent bitmap (as the output buffer).
+*							Bitmap handle can be created by FPDFBitmap_Create function.
+*			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+*			start_x		-	Left pixel position of the display area in the device coordinate.
+*			start_y		-	Top pixel position of the display area in the device coordinate.
+*			size_x		-	Horizontal size (in pixels) for displaying the page.
+*			size_y		-	Vertical size (in pixels) for displaying the page.
+*			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+*								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+*			flags		-	0 for normal display, or combination of flags defined above. 
+* Return Value:
+*			None.
+* Comments: 
+*			This method is designed to only render annotations and FormFields on the page. 
+*			Without FPDF_ANNOT specified for flags, Rendering functions such as FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page contents(without annotations) to a bitmap.
+*			In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.
+**/
+DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 
+						int size_x, int size_y, int rotate, int flags);
+
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDFORMFILL_H
+
diff --git a/fpdfsdk/include/fpdfoom.h b/fpdfsdk/include/fpdfoom.h
index 638b012..dd14b74 100644
--- a/fpdfsdk/include/fpdfoom.h
+++ b/fpdfsdk/include/fpdfoom.h
@@ -1,61 +1,61 @@
-// 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 _FPDFOOM_H_

-#define _FPDFOOM_H_

-

-#ifndef _FPDFVIEW_H_

-#include "fpdfview.h"

-#endif

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-typedef	struct _OOM_INFO

-{

-	/**

-	* Version number of the interface. Currently must be 1.

-	**/

-	int version;

-	

-	/** 

-	* Method: FSDK_OOM_Handler

-	*			 Out-Of-Memory handling function.

-	* Interface Version:

-	*			1

-	* Implementation Required:

-	*			Yes

-	* Parameters:

-	*		pThis		-	Pointer to the interface structure itself.

-	* 	Return value:

-	* 		None.

-	* */

-

-	void(*FSDK_OOM_Handler)(_OOM_INFO* pThis);

-}OOM_INFO;

-

-

-/**

- * Function: FSDK_SetOOMHandler

- *			 Setup A Out-Of-Memory handler for foxit sdk. 

- * Parameters:

- *			oomInfo		-	Pointer to a OOM_INFO structure.

- * Return Value:

- *			TRUE means successful. FALSE means fails. 

- **/

-

-DLLEXPORT FPDF_BOOL STDCALL FSDK_SetOOMHandler(OOM_INFO* oomInfo);

-

-

-#ifdef __cplusplus

-};

-#endif

-

-

-

-

-#endif

+// 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 _FPDFOOM_H_
+#define _FPDFOOM_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef	struct _OOM_INFO
+{
+	/**
+	* Version number of the interface. Currently must be 1.
+	**/
+	int version;
+	
+	/** 
+	* Method: FSDK_OOM_Handler
+	*			 Out-Of-Memory handling function.
+	* Interface Version:
+	*			1
+	* Implementation Required:
+	*			Yes
+	* Parameters:
+	*		pThis		-	Pointer to the interface structure itself.
+	* 	Return value:
+	* 		None.
+	* */
+
+	void(*FSDK_OOM_Handler)(_OOM_INFO* pThis);
+}OOM_INFO;
+
+
+/**
+ * Function: FSDK_SetOOMHandler
+ *			 Setup A Out-Of-Memory handler for foxit sdk. 
+ * Parameters:
+ *			oomInfo		-	Pointer to a OOM_INFO structure.
+ * Return Value:
+ *			TRUE means successful. FALSE means fails. 
+ **/
+
+DLLEXPORT FPDF_BOOL STDCALL FSDK_SetOOMHandler(OOM_INFO* oomInfo);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+
+
+
+#endif
diff --git a/fpdfsdk/include/fpdfppo.h b/fpdfsdk/include/fpdfppo.h
index 5f77b5b..57fd638 100644
--- a/fpdfsdk/include/fpdfppo.h
+++ b/fpdfsdk/include/fpdfppo.h
@@ -1,34 +1,34 @@
-// 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 _FPDFPPO_H_

-#define _FPDFPPO_H_

-

-#include "fpdfview.h"

-

-// Function: FPDF_ImportPages

-//			Import some pages to a PDF document.

-// Parameters:	

-//			dest_doc	-	The destination document which add the pages.

-//			src_doc		-	A document to be imported.

-//			pagerange	-	A page range string, Such as "1,3,5-7". 

-//							If this parameter is NULL, it would import all pages in src_doc.

-//			index		-	The page index wanted to insert from.	

-// Return value:

-//			TRUE for succeed, FALSE for Failed.	

-DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, FPDF_BYTESTRING pagerange, int index);

-

-

-// Function: FPDF_CopyViewerPreferences

-//			Copy the viewer preferences from one PDF document to another.#endif

-// Parameters:	

-//			dest_doc	-	Handle to document to write the viewer preferences to.

-//			src_doc		-	Handle to document with the viewer preferences.

-// Return value:

-//			TRUE for success, FALSE for failure.

-DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);

-#endif

-

+// 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 _FPDFPPO_H_
+#define _FPDFPPO_H_
+
+#include "fpdfview.h"
+
+// Function: FPDF_ImportPages
+//			Import some pages to a PDF document.
+// Parameters:	
+//			dest_doc	-	The destination document which add the pages.
+//			src_doc		-	A document to be imported.
+//			pagerange	-	A page range string, Such as "1,3,5-7". 
+//							If this parameter is NULL, it would import all pages in src_doc.
+//			index		-	The page index wanted to insert from.	
+// Return value:
+//			TRUE for succeed, FALSE for Failed.	
+DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, FPDF_BYTESTRING pagerange, int index);
+
+
+// Function: FPDF_CopyViewerPreferences
+//			Copy the viewer preferences from one PDF document to another.#endif
+// Parameters:	
+//			dest_doc	-	Handle to document to write the viewer preferences to.
+//			src_doc		-	Handle to document with the viewer preferences.
+// Return value:
+//			TRUE for success, FALSE for failure.
+DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
+#endif
+
diff --git a/fpdfsdk/include/fpdfsave.h b/fpdfsdk/include/fpdfsave.h
index be340f4..a694560 100644
--- a/fpdfsdk/include/fpdfsave.h
+++ b/fpdfsdk/include/fpdfsave.h
@@ -1,81 +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 _FPDFSAVE_H_

-#define _FPDFSAVE_H_

-

-#include "fpdfview.h"

-

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-

-// Structure for custom file write

-struct FPDF_FILEWRITE{

-

-	//

-	//Version number of the interface. Currently must be 1.

-	//

-	int version;

-

-	// 

-	// Method: WriteBlock

-	//			Output a block of data in your custom way.

-	// Interface Version:

-	//			1

-	// Implementation Required:

-	//			Yes

-	// Comments:

-	//			Called by function FPDF_SaveDocument

-	// Parameters:

-	//			pThis		-	Pointer to the structure itself

-	//			pData		-	Pointer to a buffer to output

-	//			size		-	The size of the buffer.

-	// Return value:

-	//			Should be non-zero if successful, zero for error.

-	//

-	int		(*WriteBlock)( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size);

-

-};

-

-

-/** @brief Incremental. */

-#define FPDF_INCREMENTAL		1

-/** @brief No Incremental. */

-#define FPDF_NO_INCREMENTAL		2

-

-

-// Function: FPDF_SaveAsCopy

-//			Saves the copy of specified document in custom way.

-// Parameters:	

-//			document		-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.

-//			pFileWrite		-	A pointer to a custom file write structure.

-//			flags			-	The creating flags.

-// Return value:

-//			TRUE for succeed, FALSE for failed.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(	FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,

-												FPDF_DWORD flags );

-

-// Function: FPDF_SaveWithVersion

-//			Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.

-// Parameters:	

-//			document		-	Handle to document.

-//			pFileWrite		-	A pointer to a custom file write structure.

-//			flags			-	The creating flags.

-//			fileVersion		-	The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...

-// Return value:

-//			TRUE if succeed, FALSE if failed.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,

-	FPDF_DWORD flags, int fileVersion);

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif //_FPDFSAVE_H_

+// 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 _FPDFSAVE_H_
+#define _FPDFSAVE_H_
+
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Structure for custom file write
+struct FPDF_FILEWRITE{
+
+	//
+	//Version number of the interface. Currently must be 1.
+	//
+	int version;
+
+	// 
+	// Method: WriteBlock
+	//			Output a block of data in your custom way.
+	// Interface Version:
+	//			1
+	// Implementation Required:
+	//			Yes
+	// Comments:
+	//			Called by function FPDF_SaveDocument
+	// Parameters:
+	//			pThis		-	Pointer to the structure itself
+	//			pData		-	Pointer to a buffer to output
+	//			size		-	The size of the buffer.
+	// Return value:
+	//			Should be non-zero if successful, zero for error.
+	//
+	int		(*WriteBlock)( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size);
+
+};
+
+
+/** @brief Incremental. */
+#define FPDF_INCREMENTAL		1
+/** @brief No Incremental. */
+#define FPDF_NO_INCREMENTAL		2
+
+
+// Function: FPDF_SaveAsCopy
+//			Saves the copy of specified document in custom way.
+// Parameters:	
+//			document		-	Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+//			pFileWrite		-	A pointer to a custom file write structure.
+//			flags			-	The creating flags.
+// Return value:
+//			TRUE for succeed, FALSE for failed.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(	FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
+												FPDF_DWORD flags );
+
+// Function: FPDF_SaveWithVersion
+//			Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.
+// Parameters:	
+//			document		-	Handle to document.
+//			pFileWrite		-	A pointer to a custom file write structure.
+//			flags			-	The creating flags.
+//			fileVersion		-	The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
+// Return value:
+//			TRUE if succeed, FALSE if failed.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
+	FPDF_DWORD flags, int fileVersion);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDFSAVE_H_
diff --git a/fpdfsdk/include/fpdftext.h b/fpdfsdk/include/fpdftext.h
index f862db4..8b89779 100644
--- a/fpdfsdk/include/fpdftext.h
+++ b/fpdfsdk/include/fpdftext.h
@@ -1,316 +1,316 @@
-// 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 _FPDFTEXT_H_

-#define _FPDFTEXT_H_

-

-#include "fpdfview.h"

-

-// Exported Functions

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-// Function: FPDFText_LoadPage

-//			Prepare information about all characters in a page.

-// Parameters: 

-//			page	-	Handle to the page. Returned by FPDF_LoadPage function (in FPDFVIEW module).	

-// Return value:

-//			A handle to the text page information structure.

-//			NULL if something goes wrong.

-// Comments:

-//			Application must call FPDFText_ClosePage to release the text page information.

-//			If you don't purchase Text Module , this function will return NULL.

-//	

-DLLEXPORT FPDF_TEXTPAGE	STDCALL FPDFText_LoadPage(FPDF_PAGE page);

-

-// Function: FPDFText_ClosePage

-//			Release all resources allocated for a text page information structure.

-// Parameters: 

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-// Return Value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);

-	

-// Function: FPDFText_CountChars

-//			Get number of characters in a page.

-// Parameters: 

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-// Return value:

-//			Number of characters in the page. Return -1 for error. 

-//			Generated characters, like additional space characters, new line characters, are also counted.

-// Comments:

-//			Characters in a page form a "stream", inside the stream, each character has an index.

-//			We will use the index parameters in many of FPDFTEXT functions. The first character in the page

-//			has an index value of zero.

-//

-DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);

-

-// Function: FPDFText_GetUnicode

-//			Get Unicode of a character in a page.

-// Parameters: 

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			index		-	Zero-based index of the character.

-// Return value:

-//			The Unicode of the particular character.

-//			If a character is not encoded in Unicode and Foxit engine can't convert to Unicode,

-//			the return value will be zero.

-//

-DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);

-

-// Function: FPDFText_GetFontSize

-//			Get the font size of a particular character.

-// Parameters: 

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			index		-	Zero-based index of the character.

-// Return value:

-//			The font size of the particular character, measured in points (about 1/72 inch).

-//			This is the typographic size of the font (so called "em size").

-//

-DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index);

-

-// Function: FPDFText_GetCharBox

-//			Get bounding box of a particular character.

-// Parameters: 

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			index		-	Zero-based index of the character.

-//			left		-	Pointer to a double number receiving left position of the character box.

-//			right		-	Pointer to a double number receiving right position of the character box.

-//			bottom		-	Pointer to a double number receiving bottom position of the character box.

-//			top			-	Pointer to a double number receiving top position of the character box.

-// Return Value:

-//			None.

-// Comments:

-//			All positions are measured in PDF "user space".

-//

-DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, double* left,

-													double* right, double* bottom, double* top);

-

-// Function: FPDFText_GetCharIndexAtPos

-//			Get the index of a character at or nearby a certain position on the page.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			x			-	X position in PDF "user space".

-//			y			-	Y position in PDF "user space".

-//			xTolerance	-	An x-axis tolerance value for character hit detection, in point unit.

-//			yTolerance	-	A y-axis tolerance value for character hit detection, in point unit.

-// Return Value:

-//			The zero-based index of the character at, or nearby the point (x,y).

-//			If there is no character at or nearby the point, return value will be -1.

-//			If an error occurs, -3 will be returned.

-//

-DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,

-												 double x, double y, double xTorelance, double yTolerance);

-

-// Function: FPDFText_GetText

-//			Extract unicode text string from the page.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			start_index	-	Index for the start characters.

-//			count		-	Number of characters to be extracted.

-//			result		-	A buffer (allocated by application) receiving the extracted unicodes.

-//							The size of the buffer must be able to hold the number of characters plus a terminator.

-// Return Value:

-//			Number of characters written into the result buffer, including the trailing terminator.

-// Comments:

-//			This function ignores characters without unicode information.

-//			

-DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index, int count, unsigned short* result);

-

-// Function: FPDFText_CountRects

-//			Count number of rectangular areas occupied by a segment of texts.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			start_index	-	Index for the start characters.

-//			count		-	Number of characters.

-// Return value:

-//			Number of rectangles. Zero for error.

-// Comments:

-//			This function, along with FPDFText_GetRect can be used by applications to detect the position

-//			on the page for a text segment, so proper areas can be highlighted or something.

-//			FPDFTEXT will automatically merge small character boxes into bigger one if those characters

-//			are on the same line and use same font settings.

-//

-DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_index, int count);

-

-// Function: FPDFText_GetRect

-//			Get a rectangular area from the result generated by FPDFText_CountRects.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			rect_index	-	Zero-based index for the rectangle.

-//			left		-	Pointer to a double value receiving the rectangle left boundary.

-//			top			-	Pointer to a double value receiving the rectangle top boundary.

-//			right		-	Pointer to a double value receiving the rectangle right boundary.

-//			bottom		-	Pointer to a double value receiving the rectangle bottom boundary.

-// Return Value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index, double* left, double* top,

-											double* right, double* bottom);

-

-// Function: FPDFText_GetBoundedText

-//			Extract unicode text within a rectangular boundary on the page.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			left		-	Left boundary.

-//			top			-	Top boundary.

-//			right		-	Right boundary.

-//			bottom		-	Bottom boundary.

-//			buffer		-	A unicode buffer.

-//			buflen		-	Number of characters (not bytes) for the buffer, excluding an additional terminator.

-// Return Value:

-//			If buffer is NULL or buflen is zero, return number of characters (not bytes) needed,

-//			otherwise, return number of characters copied into the buffer.

-//

-DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top, 

-											  double right, double bottom,unsigned short* buffer,int buflen);

-

-

-// Flags used by FPDFText_FindStart function.

-#define FPDF_MATCHCASE      0x00000001		//If not set, it will not match case by default.

-#define FPDF_MATCHWHOLEWORD 0x00000002		//If not set, it will not match the whole word by default.

-

-// Function: FPDFText_FindStart

-//			Start a search.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-//			findwhat	-	A unicode match pattern.

-//			flags		-	Option flags.

-//			start_index	-	Start from this character. -1 for end of the page.

-// Return Value:

-//			A handle for the search context. FPDFText_FindClose must be called to release this handle.

-//

-DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPDF_WIDESTRING findwhat,

-													unsigned long flags, int start_index);

-

-// Function: FPDFText_FindNext

-//			Search in the direction from page start to end.

-// Parameters:

-//			handle		-	A search context handle returned by FPDFText_FindStart.

-// Return Value:

-//			Whether a match is found.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);

-

-// Function: FPDFText_FindPrev

-//			Search in the direction from page end to start.

-// Parameters:

-//			handle		-	A search context handle returned by FPDFText_FindStart.

-// Return Value:

-//			Whether a match is found.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);

-

-// Function: FPDFText_GetSchResultIndex

-//			Get the starting character index of the search result.

-// Parameters:

-//			handle		-	A search context handle returned by FPDFText_FindStart.

-// Return Value:

-//			Index for the starting character.

-//

-DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);

-

-// Function: FPDFText_GetSchCount

-//			Get the number of matched characters in the search result.

-// Parameters:

-//			handle		-	A search context handle returned by FPDFText_FindStart.

-// Return Value:

-//			Number of matched characters.

-//

-DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);

-

-// Function: FPDFText_FindClose

-//			Release a search context.

-// Parameters:

-//			handle		-	A search context handle returned by FPDFText_FindStart.

-// Return Value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);

-

-// Function: FPDFLink_LoadWebLinks

-//			Prepare information about weblinks in a page.

-// Parameters:

-//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.

-// Return Value:	

-//			A handle to the page's links information structure.

-//			NULL if something goes wrong.

-// Comments:

-//			Weblinks are those links implicitly embedded in PDF pages. PDF also has a type of

-//			annotation called "link", FPDFTEXT doesn't deal with that kind of link.

-//			FPDFTEXT weblink feature is useful for automatically detecting links in the page

-//			contents. For example, things like "http://www.foxitsoftware.com" will be detected,

-//			so applications can allow user to click on those characters to activate the link,

-//			even the PDF doesn't come with link annotations.

-//

-//			FPDFLink_CloseWebLinks must be called to release resources.

-//

-DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);

-

-// Function: FPDFLink_CountWebLinks

-//			Count number of detected web links.

-// Parameters:

-//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.

-// Return Value:

-//			Number of detected web links.

-//

-DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);

-

-// Function: FPDFLink_GetURL

-//			Fetch the URL information for a detected web link.

-// Parameters:

-//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.

-//			link_index	-	Zero-based index for the link.

-//			buffer		-	A unicode buffer.

-//			buflen		-	Number of characters (not bytes) for the buffer, including an additional terminator.

-// Return Value:

-//			If buffer is NULL or buflen is zero, return number of characters (not bytes and an additional terminator is also counted) needed,

-//			otherwise, return number of characters copied into the buffer.

-//

-DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, unsigned short* buffer,int buflen);

-

-// Function: FPDFLink_CountRects

-//			Count number of rectangular areas for the link.

-// Parameters:

-//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.

-//			link_index	-	Zero-based index for the link.

-// Return Value:

-//			Number of rectangular areas for the link.

-//

-DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_index);

-

-// Function: FPDFLink_GetRect

-//			Fetch the boundaries of a rectangle for a link.

-// Parameters:

-//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.

-//			link_index	-	Zero-based index for the link.

-//			rect_index	-	Zero-based index for a rectangle.

-//			left		-	Pointer to a double value receiving the rectangle left boundary.

-//			top			-	Pointer to a double value receiving the rectangle top boundary.

-//			right		-	Pointer to a double value receiving the rectangle right boundary.

-//			bottom		-	Pointer to a double value receiving the rectangle bottom boundary.

-// Return Value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index, int rect_index, 

-										double* left, double* top,double* right, double* bottom);

-

-// Function: FPDFLink_CloseWebLinks

-//			Release resources used by weblink feature.

-// Parameters:

-//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.

-// Return Value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);

-

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif//_FPDFTEXT_H_

+// 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 _FPDFTEXT_H_
+#define _FPDFTEXT_H_
+
+#include "fpdfview.h"
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFText_LoadPage
+//			Prepare information about all characters in a page.
+// Parameters: 
+//			page	-	Handle to the page. Returned by FPDF_LoadPage function (in FPDFVIEW module).	
+// Return value:
+//			A handle to the text page information structure.
+//			NULL if something goes wrong.
+// Comments:
+//			Application must call FPDFText_ClosePage to release the text page information.
+//			If you don't purchase Text Module , this function will return NULL.
+//	
+DLLEXPORT FPDF_TEXTPAGE	STDCALL FPDFText_LoadPage(FPDF_PAGE page);
+
+// Function: FPDFText_ClosePage
+//			Release all resources allocated for a text page information structure.
+// Parameters: 
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return Value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
+	
+// Function: FPDFText_CountChars
+//			Get number of characters in a page.
+// Parameters: 
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return value:
+//			Number of characters in the page. Return -1 for error. 
+//			Generated characters, like additional space characters, new line characters, are also counted.
+// Comments:
+//			Characters in a page form a "stream", inside the stream, each character has an index.
+//			We will use the index parameters in many of FPDFTEXT functions. The first character in the page
+//			has an index value of zero.
+//
+DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFText_GetUnicode
+//			Get Unicode of a character in a page.
+// Parameters: 
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			index		-	Zero-based index of the character.
+// Return value:
+//			The Unicode of the particular character.
+//			If a character is not encoded in Unicode and Foxit engine can't convert to Unicode,
+//			the return value will be zero.
+//
+DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
+
+// Function: FPDFText_GetFontSize
+//			Get the font size of a particular character.
+// Parameters: 
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			index		-	Zero-based index of the character.
+// Return value:
+//			The font size of the particular character, measured in points (about 1/72 inch).
+//			This is the typographic size of the font (so called "em size").
+//
+DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index);
+
+// Function: FPDFText_GetCharBox
+//			Get bounding box of a particular character.
+// Parameters: 
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			index		-	Zero-based index of the character.
+//			left		-	Pointer to a double number receiving left position of the character box.
+//			right		-	Pointer to a double number receiving right position of the character box.
+//			bottom		-	Pointer to a double number receiving bottom position of the character box.
+//			top			-	Pointer to a double number receiving top position of the character box.
+// Return Value:
+//			None.
+// Comments:
+//			All positions are measured in PDF "user space".
+//
+DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, double* left,
+													double* right, double* bottom, double* top);
+
+// Function: FPDFText_GetCharIndexAtPos
+//			Get the index of a character at or nearby a certain position on the page.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			x			-	X position in PDF "user space".
+//			y			-	Y position in PDF "user space".
+//			xTolerance	-	An x-axis tolerance value for character hit detection, in point unit.
+//			yTolerance	-	A y-axis tolerance value for character hit detection, in point unit.
+// Return Value:
+//			The zero-based index of the character at, or nearby the point (x,y).
+//			If there is no character at or nearby the point, return value will be -1.
+//			If an error occurs, -3 will be returned.
+//
+DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
+												 double x, double y, double xTorelance, double yTolerance);
+
+// Function: FPDFText_GetText
+//			Extract unicode text string from the page.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			start_index	-	Index for the start characters.
+//			count		-	Number of characters to be extracted.
+//			result		-	A buffer (allocated by application) receiving the extracted unicodes.
+//							The size of the buffer must be able to hold the number of characters plus a terminator.
+// Return Value:
+//			Number of characters written into the result buffer, including the trailing terminator.
+// Comments:
+//			This function ignores characters without unicode information.
+//			
+DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index, int count, unsigned short* result);
+
+// Function: FPDFText_CountRects
+//			Count number of rectangular areas occupied by a segment of texts.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			start_index	-	Index for the start characters.
+//			count		-	Number of characters.
+// Return value:
+//			Number of rectangles. Zero for error.
+// Comments:
+//			This function, along with FPDFText_GetRect can be used by applications to detect the position
+//			on the page for a text segment, so proper areas can be highlighted or something.
+//			FPDFTEXT will automatically merge small character boxes into bigger one if those characters
+//			are on the same line and use same font settings.
+//
+DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_index, int count);
+
+// Function: FPDFText_GetRect
+//			Get a rectangular area from the result generated by FPDFText_CountRects.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			rect_index	-	Zero-based index for the rectangle.
+//			left		-	Pointer to a double value receiving the rectangle left boundary.
+//			top			-	Pointer to a double value receiving the rectangle top boundary.
+//			right		-	Pointer to a double value receiving the rectangle right boundary.
+//			bottom		-	Pointer to a double value receiving the rectangle bottom boundary.
+// Return Value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index, double* left, double* top,
+											double* right, double* bottom);
+
+// Function: FPDFText_GetBoundedText
+//			Extract unicode text within a rectangular boundary on the page.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			left		-	Left boundary.
+//			top			-	Top boundary.
+//			right		-	Right boundary.
+//			bottom		-	Bottom boundary.
+//			buffer		-	A unicode buffer.
+//			buflen		-	Number of characters (not bytes) for the buffer, excluding an additional terminator.
+// Return Value:
+//			If buffer is NULL or buflen is zero, return number of characters (not bytes) needed,
+//			otherwise, return number of characters copied into the buffer.
+//
+DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top, 
+											  double right, double bottom,unsigned short* buffer,int buflen);
+
+
+// Flags used by FPDFText_FindStart function.
+#define FPDF_MATCHCASE      0x00000001		//If not set, it will not match case by default.
+#define FPDF_MATCHWHOLEWORD 0x00000002		//If not set, it will not match the whole word by default.
+
+// Function: FPDFText_FindStart
+//			Start a search.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+//			findwhat	-	A unicode match pattern.
+//			flags		-	Option flags.
+//			start_index	-	Start from this character. -1 for end of the page.
+// Return Value:
+//			A handle for the search context. FPDFText_FindClose must be called to release this handle.
+//
+DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPDF_WIDESTRING findwhat,
+													unsigned long flags, int start_index);
+
+// Function: FPDFText_FindNext
+//			Search in the direction from page start to end.
+// Parameters:
+//			handle		-	A search context handle returned by FPDFText_FindStart.
+// Return Value:
+//			Whether a match is found.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindPrev
+//			Search in the direction from page end to start.
+// Parameters:
+//			handle		-	A search context handle returned by FPDFText_FindStart.
+// Return Value:
+//			Whether a match is found.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchResultIndex
+//			Get the starting character index of the search result.
+// Parameters:
+//			handle		-	A search context handle returned by FPDFText_FindStart.
+// Return Value:
+//			Index for the starting character.
+//
+DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchCount
+//			Get the number of matched characters in the search result.
+// Parameters:
+//			handle		-	A search context handle returned by FPDFText_FindStart.
+// Return Value:
+//			Number of matched characters.
+//
+DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindClose
+//			Release a search context.
+// Parameters:
+//			handle		-	A search context handle returned by FPDFText_FindStart.
+// Return Value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
+
+// Function: FPDFLink_LoadWebLinks
+//			Prepare information about weblinks in a page.
+// Parameters:
+//			text_page	-	Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return Value:	
+//			A handle to the page's links information structure.
+//			NULL if something goes wrong.
+// Comments:
+//			Weblinks are those links implicitly embedded in PDF pages. PDF also has a type of
+//			annotation called "link", FPDFTEXT doesn't deal with that kind of link.
+//			FPDFTEXT weblink feature is useful for automatically detecting links in the page
+//			contents. For example, things like "http://www.foxitsoftware.com" will be detected,
+//			so applications can allow user to click on those characters to activate the link,
+//			even the PDF doesn't come with link annotations.
+//
+//			FPDFLink_CloseWebLinks must be called to release resources.
+//
+DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFLink_CountWebLinks
+//			Count number of detected web links.
+// Parameters:
+//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+//			Number of detected web links.
+//
+DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
+
+// Function: FPDFLink_GetURL
+//			Fetch the URL information for a detected web link.
+// Parameters:
+//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.
+//			link_index	-	Zero-based index for the link.
+//			buffer		-	A unicode buffer.
+//			buflen		-	Number of characters (not bytes) for the buffer, including an additional terminator.
+// Return Value:
+//			If buffer is NULL or buflen is zero, return number of characters (not bytes and an additional terminator is also counted) needed,
+//			otherwise, return number of characters copied into the buffer.
+//
+DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, unsigned short* buffer,int buflen);
+
+// Function: FPDFLink_CountRects
+//			Count number of rectangular areas for the link.
+// Parameters:
+//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.
+//			link_index	-	Zero-based index for the link.
+// Return Value:
+//			Number of rectangular areas for the link.
+//
+DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_index);
+
+// Function: FPDFLink_GetRect
+//			Fetch the boundaries of a rectangle for a link.
+// Parameters:
+//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.
+//			link_index	-	Zero-based index for the link.
+//			rect_index	-	Zero-based index for a rectangle.
+//			left		-	Pointer to a double value receiving the rectangle left boundary.
+//			top			-	Pointer to a double value receiving the rectangle top boundary.
+//			right		-	Pointer to a double value receiving the rectangle right boundary.
+//			bottom		-	Pointer to a double value receiving the rectangle bottom boundary.
+// Return Value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index, int rect_index, 
+										double* left, double* top,double* right, double* bottom);
+
+// Function: FPDFLink_CloseWebLinks
+//			Release resources used by weblink feature.
+// Parameters:
+//			link_page	-	Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif//_FPDFTEXT_H_
diff --git a/fpdfsdk/include/fpdfview.h b/fpdfsdk/include/fpdfview.h
index 182d3cf..a563762 100644
--- a/fpdfsdk/include/fpdfview.h
+++ b/fpdfsdk/include/fpdfview.h
@@ -1,578 +1,578 @@
-// 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 _FPDFVIEW_H_

-#define _FPDFVIEW_H_

-

-#if defined(_WIN32) && !defined(__WINDOWS__)

-#include <windows.h>

-#endif

-

-// Data types

-typedef void*	FPDF_MODULEMGR;

-

-// PDF types

-typedef void*	FPDF_DOCUMENT;		

-typedef void*	FPDF_PAGE;			

-typedef void*	FPDF_PAGEOBJECT;	// Page object(text, path, etc)

-typedef void*	FPDF_PATH;

-typedef void*	FPDF_CLIPPATH;	

-typedef void*	FPDF_BITMAP;	

-typedef void*	FPDF_FONT;			

-

-typedef void*	FPDF_TEXTPAGE;

-typedef void*	FPDF_SCHHANDLE;

-typedef void*	FPDF_PAGELINK;

-typedef void*	FPDF_HMODULE;

-typedef void*	FPDF_DOCSCHHANDLE;

-

-typedef void*	FPDF_BOOKMARK;

-typedef void*	FPDF_DEST;

-typedef void*	FPDF_ACTION;

-typedef void*	FPDF_LINK;

-

-// Basic data types

-typedef int				FPDF_BOOL;

-typedef int				FPDF_ERROR;	

-typedef unsigned long	FPDF_DWORD;

-

-typedef	float			FS_FLOAT;

-

-// String types

-typedef unsigned short			FPDF_WCHAR;

-typedef unsigned char const*	FPDF_LPCBYTE;

-

-// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string

-typedef const char*				FPDF_BYTESTRING;

-

-typedef const unsigned short*	FPDF_WIDESTRING;		// Foxit PDF SDK always use UTF-16LE encoding wide string,

-														// each character use 2 bytes (except surrogation), with low byte first.

-

-// For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string,

-//		 however, special care needs to be taken if you expect to process Unicode larger than 0xffff.

-// For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character,

-//		you have to convert between FPDF_WIDESTRING and system wide string by yourself.

-

-#ifdef _WIN32_WCE

-typedef const unsigned short* FPDF_STRING;

-#else

-typedef const char* FPDF_STRING;

-#endif

-

-#ifndef _FS_DEF_MATRIX_

-#define _FS_DEF_MATRIX_

-/** @brief Matrix for transformation. */

-typedef struct _FS_MATRIX_

-{

-	float	a;	/**< @brief Coefficient a.*/

-	float	b;	/**< @brief Coefficient b.*/

-	float	c;	/**< @brief Coefficient c.*/

-	float	d;	/**< @brief Coefficient d.*/

-	float	e;	/**< @brief Coefficient e.*/

-	float	f;	/**< @brief Coefficient f.*/

-} FS_MATRIX;

-#endif

-

-#ifndef _FS_DEF_RECTF_

-#define _FS_DEF_RECTF_

-/** @brief Rectangle area(float) in device or page coordination system. */

-typedef struct _FS_RECTF_

-{

-	/**@{*/

-	/** @brief The x-coordinate of the left-top corner. */

-	float	left;

-	/** @brief The y-coordinate of the left-top corner. */

-	float	top;

-	/** @brief The x-coordinate of the right-bottom corner. */

-	float	right;

-	/** @brief The y-coordinate of the right-bottom corner. */

-	float	bottom;

-	/**@}*/

-}* FS_LPRECTF, FS_RECTF;

-/** @brief Const Pointer to ::FS_RECTF structure.*/

-typedef const FS_RECTF*	FS_LPCRECTF;

-#endif

-

-#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)

-// On Windows system, functions are exported in a DLL

-#define DLLEXPORT __declspec( dllexport )

-#define STDCALL __stdcall

-#else

-#define DLLEXPORT

-#define STDCALL

-#endif

-

-extern const char g_ExpireDate[];

-extern const char g_ModuleCodes[];

-

-// Exported Functions

-#ifdef __cplusplus

-extern "C" {

-#endif

-

-// Function: FPDF_InitLibrary

-//			Initialize the FPDFSDK library 

-// Parameters:

-//			hInstance	-	For WIN32 system only: the instance of the executable or DLL module.

-// Return value:

-//			None.

-// Comments:

-//			You have to call this function before you can call any PDF processing functions.

-

-DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance);

-

-

-// Function: FPDF_DestroyLibary

-//			Release all resources allocated by the FPDFSDK library.

-// Parameters:

-//			None.

-// Return value:

-//			None.

-// Comments:

-//			You can call this function to release all memory blocks allocated by the library. 

-//			After this function called, you should not call any PDF processing functions.

-DLLEXPORT void STDCALL FPDF_DestroyLibrary();

-

-//Policy for accessing the local machine time.

-#define FPDF_POLICY_MACHINETIME_ACCESS	0

-

-// Function: FPDF_SetSandBoxPolicy

-//			Set the policy for the sandbox environment.

-// Parameters:	

-//			policy		-	The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS.

-//			enable		-	True for enable, False for disable the policy.

-// Return value:

-//			None.

-DLLEXPORT void	STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);

-

-/**

-* Open and load a PDF document.

-* @param[in] file_path	-	Path to the PDF file (including extension).

-* @param[in] password	-	A string used as the password for PDF file. 

-*							If no password needed, empty or NULL can be used.

-* @note		Loaded document can be closed by FPDF_CloseDocument.

-*			If this function fails, you can use FPDF_GetLastError() to retrieve

-*			the reason why it fails.

-* @retval	A handle to the loaded document. If failed, NULL is returned.

-*/

-DLLEXPORT FPDF_DOCUMENT	STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 

-	FPDF_BYTESTRING password);

-

-// Function: FPDF_LoadMemDocument

-//			Open and load a PDF document from memory.

-// Parameters: 

-//			data_buf	-	Pointer to a buffer containing the PDF document.

-//			size		-	Number of bytes in the PDF document.

-//			password	-	A string used as the password for PDF file. 

-//							If no password needed, empty or NULL can be used.

-// Return value:

-//			A handle to the loaded document. If failed, NULL is returned.

-// Comments:

-//			The memory buffer must remain valid when the document is open.

-//			Loaded document can be closed by FPDF_CloseDocument.

-//			If this function fails, you can use FPDF_GetLastError() to retrieve

-//			the reason why it fails.

-//

-DLLEXPORT FPDF_DOCUMENT	STDCALL FPDF_LoadMemDocument(const void* data_buf, 

-											int size, FPDF_BYTESTRING password);

-

-// Structure for custom file access.

-typedef struct {

-	// File length, in bytes.

-	unsigned long	m_FileLen;

-

-	// A function pointer for getting a block of data from specific position.

-	// Position is specified by byte offset from beginning of the file.

-	// The position and size will never go out range of file length.

-	// It may be possible for FPDFSDK to call this function multiple times for same position.

-	// Return value: should be non-zero if successful, zero for error.

-	int				(*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size);

-

-	// A custom pointer for all implementation specific data.

-	// This pointer will be used as the first parameter to m_GetBlock callback.

-	void*			m_Param;

-} FPDF_FILEACCESS;

-

-// Function: FPDF_LoadCustomDocument

-//			Load PDF document from a custom access descriptor.

-// Parameters:

-//			pFileAccess	-	A structure for access the file.

-//			password	-	Optional password for decrypting the PDF file.

-// Return value:

-//			A handle to the loaded document. If failed, NULL is returned.

-// Comments:

-//			The application should maintain the file resources being valid until the PDF document close.

-//			Loaded document can be closed by FPDF_CloseDocument.

-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, 

-														FPDF_BYTESTRING password);

-

-// Function: FPDF_GetFileVersion

-//			Get the file version of the specific PDF document.

-// Parameters:

-//			doc			-	Handle to document.

-//			fileVersion	-	The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...

-// Return value:

-//			TRUE if this call succeed, If failed, FALSE is returned.

-// Comments:

-//			If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail.

-DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion);

-

-#define FPDF_ERR_SUCCESS		0		// No error.

-#define FPDF_ERR_UNKNOWN		1		// Unknown error.

-#define FPDF_ERR_FILE			2		// File not found or could not be opened.

-#define FPDF_ERR_FORMAT			3		// File not in PDF format or corrupted.

-#define FPDF_ERR_PASSWORD		4		// Password required or incorrect password.

-#define FPDF_ERR_SECURITY		5		// Unsupported security scheme.

-#define FPDF_ERR_PAGE			6		// Page not found or content error.

-

-// Function: FPDF_GetLastError

-//			Get last error code when an SDK function failed.

-// Parameters: 

-//			None.

-// Return value:

-//			A 32-bit integer indicating error codes (defined above).

-// Comments:

-//			If the previous SDK call succeeded, the return value of this function

-//			is not defined.

-//

-DLLEXPORT unsigned long	STDCALL FPDF_GetLastError();

-

-// Function: FPDF_GetDocPermission

-//			Get file permission flags of the document.

-// Parameters: 

-//			document	-	Handle to document. Returned by FPDF_LoadDocument function.

-// Return value:

-//			A 32-bit integer indicating permission flags. Please refer to PDF Reference for

-//			detailed description. If the document is not protected, 0xffffffff will be returned.

-//

-DLLEXPORT unsigned long	STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);

-

-// Function: FPDF_GetPageCount

-//			Get total number of pages in a document.

-// Parameters: 

-//			document	-	Handle to document. Returned by FPDF_LoadDocument function.

-// Return value:

-//			Total number of pages in the document.

-//

-DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);

-

-// Function: FPDF_LoadPage

-//			Load a page inside a document.

-// Parameters: 

-//			document	-	Handle to document. Returned by FPDF_LoadDocument function.

-//			page_index	-	Index number of the page. 0 for the first page.

-// Return value:

-//			A handle to the loaded page. If failed, NULL is returned.

-// Comments:

-//			Loaded page can be rendered to devices using FPDF_RenderPage function.

-//			Loaded page can be closed by FPDF_ClosePage.

-//

-DLLEXPORT FPDF_PAGE	STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index);

-

-// Function: FPDF_GetPageWidth

-//			Get page width.

-// Parameters:

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-// Return value:

-//			Page width (excluding non-displayable area) measured in points.

-//			One point is 1/72 inch (around 0.3528 mm).

-//

-DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);

-

-// Function: FPDF_GetPageHeight

-//			Get page height.

-// Parameters:

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-// Return value:

-//			Page height (excluding non-displayable area) measured in points.

-//			One point is 1/72 inch (around 0.3528 mm)

-//

-DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);

-

-// Function: FPDF_GetPageSizeByIndex

-//			Get the size of a page by index.

-// Parameters:

-//			document	-	Handle to document. Returned by FPDF_LoadDocument function.

-//			page_index	-	Page index, zero for the first page.

-//			width		-	Pointer to a double value receiving the page width (in points).

-//			height		-	Pointer to a double value receiving the page height (in points).

-// Return value:

-//			Non-zero for success. 0 for error (document or page not found).

-//

-DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);

-

-

-// Page rendering flags. They can be combined with bit OR.

-#define FPDF_ANNOT			0x01		// Set if annotations are to be rendered.

-#define FPDF_LCD_TEXT		0x02		// Set if using text rendering optimized for LCD display.

-#define FPDF_NO_NATIVETEXT	0x04		// Don't use the native text output available on some platforms

-#define FPDF_GRAYSCALE		0x08		// Grayscale output.

-#define FPDF_DEBUG_INFO		0x80		// Set if you want to get some debug info. 

-										// Please discuss with Foxit first if you need to collect debug info.

-#define FPDF_NO_CATCH		0x100		// Set if you don't want to catch exception.

-#define FPDF_RENDER_LIMITEDIMAGECACHE	0x200	// Limit image cache size. 

-#define FPDF_RENDER_FORCEHALFTONE		0x400	// Always use halftone for image stretching.

-#define FPDF_PRINTING		0x800	// Render for printing.

-#define FPDF_REVERSE_BYTE_ORDER		0x10		//set whether render in a reverse Byte order, this flag only 

-												//enable when render to a bitmap.

-#ifdef _WIN32

-// Function: FPDF_RenderPage

-//			Render contents in a page to a device (screen, bitmap, or printer).

-//			This function is only supported on Windows system.

-// Parameters: 

-//			dc			-	Handle to device context.

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			start_x		-	Left pixel position of the display area in the device coordinate.

-//			start_y		-	Top pixel position of the display area in the device coordinate.

-//			size_x		-	Horizontal size (in pixels) for displaying the page.

-//			size_y		-	Vertical size (in pixels) for displaying the page.

-//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-//			flags		-	0 for normal display, or combination of flags defined above.

-// Return value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,

-						int rotate, int flags);

-#endif

-

-// Function: FPDF_RenderPageBitmap

-//			Render contents in a page to a device independent bitmap

-// Parameters: 

-//			bitmap		-	Handle to the device independent bitmap (as the output buffer).

-//							Bitmap handle can be created by FPDFBitmap_Create function.

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			start_x		-	Left pixel position of the display area in the bitmap coordinate.

-//			start_y		-	Top pixel position of the display area in the bitmap coordinate.

-//			size_x		-	Horizontal size (in pixels) for displaying the page.

-//			size_y		-	Vertical size (in pixels) for displaying the page.

-//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-//			flags		-	0 for normal display, or combination of flags defined above.

-// Return value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 

-						int size_x, int size_y, int rotate, int flags);

-

-// Function: FPDF_ClosePage

-//			Close a loaded PDF page.

-// Parameters: 

-//			page		-	Handle to the loaded page.

-// Return value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);

-

-// Function: FPDF_CloseDocument

-//			Close a loaded PDF document.

-// Parameters: 

-//			document	-	Handle to the loaded document.

-// Return value:

-//			None.

-//

-DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);

-

-// Function: FPDF_DeviceToPage

-//			Convert the screen coordinate of a point to page coordinate.

-// Parameters:

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			start_x		-	Left pixel position of the display area in the device coordinate.

-//			start_y		-	Top pixel position of the display area in the device coordinate.

-//			size_x		-	Horizontal size (in pixels) for displaying the page.

-//			size_y		-	Vertical size (in pixels) for displaying the page.

-//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-//			device_x	-	X value in device coordinate, for the point to be converted.

-//			device_y	-	Y value in device coordinate, for the point to be converted.

-//			page_x		-	A Pointer to a double receiving the converted X value in page coordinate.

-//			page_y		-	A Pointer to a double receiving the converted Y value in page coordinate.

-// Return value:

-//			None.

-// Comments:

-//			The page coordinate system has its origin at left-bottom corner of the page, with X axis goes along

-//			the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordinate system 

-//			can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have 

-//			the same coordinate values in the page coordinate system. 

-//

-//			The device coordinate system is device dependent. For screen device, its origin is at left-top

-//			corner of the window. However this origin can be altered by Windows coordinate transformation

-//			utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly

-//			same values as you used in FPDF_RenderPage() function call.

-//

-DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,

-						int rotate, int device_x, int device_y, double* page_x, double* page_y);

-

-// Function: FPDF_PageToDevice

-//			Convert the page coordinate of a point to screen coordinate.

-// Parameters:

-//			page		-	Handle to the page. Returned by FPDF_LoadPage function.

-//			start_x		-	Left pixel position of the display area in the device coordinate.

-//			start_y		-	Top pixel position of the display area in the device coordinate.

-//			size_x		-	Horizontal size (in pixels) for displaying the page.

-//			size_y		-	Vertical size (in pixels) for displaying the page.

-//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),

-//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).

-//			page_x		-	X value in page coordinate, for the point to be converted.

-//			page_y		-	Y value in page coordinate, for the point to be converted.

-//			device_x	-	A pointer to an integer receiving the result X value in device coordinate.

-//			device_y	-	A pointer to an integer receiving the result Y value in device coordinate.

-// Return value:

-//			None.

-// Comments:

-//			See comments of FPDF_DeviceToPage() function.

-//

-DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,

-						int rotate, double page_x, double page_y, int* device_x, int* device_y);

-

-// Function: FPDFBitmap_Create

-//			Create a Foxit Device Independent Bitmap (FXDIB).

-// Parameters:

-//			width		-	Number of pixels in a horizontal line of the bitmap. Must be greater than 0.

-//			height		-	Number of pixels in a vertical line of the bitmap. Must be greater than 0.

-//			alpha		-	A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.

-// Return value:

-//			The created bitmap handle, or NULL if parameter error or out of memory.

-// Comments:

-//			An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned.

-//			Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values.

-//			The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.

-//			

-//			The pixels in a horizontal line (also called scan line) are stored side by side, with left most

-//			pixel stored first (with lower memory address). Each scan line uses width*4 bytes.

-//

-//			Scan lines are stored one after another, with top most scan line stored first. There is no gap

-//			between adjacent scan lines.

-//

-//			This function allocates enough memory for holding all pixels in the bitmap, but it doesn't 

-//			initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.

-DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);

-

-// More DIB formats

-#define FPDFBitmap_Gray		1		// Gray scale bitmap, one byte per pixel.

-#define FPDFBitmap_BGR		2		// 3 bytes per pixel, byte order: blue, green, red.

-#define FPDFBitmap_BGRx		3		// 4 bytes per pixel, byte order: blue, green, red, unused.

-#define FPDFBitmap_BGRA		4		// 4 bytes per pixel, byte order: blue, green, red, alpha.

-

-// Function: FPDFBitmap_CreateEx

-//			Create a Foxit Device Independent Bitmap (FXDIB)

-// Parameters:

-//			width		-	Number of pixels in a horizontal line of the bitmap. Must be greater than 0.

-//			height		-	Number of pixels in a vertical line of the bitmap. Must be greater than 0.

-//			format		-	A number indicating for bitmap format, as defined above.

-//			first_scan	-	A pointer to the first byte of first scan line, for external buffer

-//							only. If this parameter is NULL, then the SDK will create its own buffer.

-//			stride		-	Number of bytes for each scan line, for external buffer only..

-// Return value:

-//			The created bitmap handle, or NULL if parameter error or out of memory.

-// Comments:

-//			Similar to FPDFBitmap_Create function, with more formats and external buffer supported. 

-//			Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is 

-//			required. 

-//

-//			If external scanline buffer is used, then the application should destroy the buffer

-//			by itself. FPDFBitmap_Destroy function will not destroy the buffer.

-//

-DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);

-

-// Function: FPDFBitmap_FillRect

-//			Fill a rectangle area in an FXDIB.

-// Parameters:

-//			bitmap		-	The handle to the bitmap. Returned by FPDFBitmap_Create function.

-//			left		-	The left side position. Starting from 0 at the left-most pixel.

-//			top			-	The top side position. Starting from 0 at the top-most scan line.

-//			width		-	Number of pixels to be filled in each scan line.

-//			height		-	Number of scan lines to be filled.

-//			red			-	A number from 0 to 255, identifying the red intensity.

-//			green		-	A number from 0 to 255, identifying the green intensity.

-//			blue		-	A number from 0 to 255, identifying the blue intensity.

-//			alpha		-	(Only if the alpha channeled is used when bitmap created) A number from 0 to 255,

-//							identifying the alpha value.

-// Return value:

-//			None.

-// Comments:

-//			This function set the color and (optionally) alpha value in specified region of the bitmap.

-//			NOTE: If alpha channel is used, this function does NOT composite the background with the source color,

-//			instead the background will be replaced by the source color and alpha.

-//			If alpha channel is not used, the "alpha" parameter is ignored.

-//

-DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, 

-									int red, int green, int blue, int alpha);

-

-// Function: FPDFBitmap_GetBuffer

-//			Get data buffer of an FXDIB

-// Parameters:

-//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.

-// Return value:

-//			The pointer to the first byte of the bitmap buffer.

-// Comments:

-//			The stride may be more than width * number of bytes per pixel

-//			Applications can use this function to get the bitmap buffer pointer, then manipulate any color

-//			and/or alpha values for any pixels in the bitmap.

-DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);

-

-// Function: FPDFBitmap_GetWidth

-//			Get width of an FXDIB.

-// Parameters:

-//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.

-// Return value:

-//			The number of pixels in a horizontal line of the bitmap.

-DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);

-

-// Function: FPDFBitmap_GetHeight

-//			Get height of an FXDIB.

-// Parameters:

-//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.

-// Return value:

-//			The number of pixels in a vertical line of the bitmap.

-DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);

-

-// Function: FPDFBitmap_GetStride

-//			Get number of bytes for each scan line in the bitmap buffer.

-// Parameters:

-//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.

-// Return value:

-//			The number of bytes for each scan line in the bitmap buffer.

-// Comments:

-//			The stride may be more than width * number of bytes per pixel

-DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);

-

-// Function: FPDFBitmap_Destroy

-//			Destroy an FXDIB and release all related buffers. 

-// Parameters:

-//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.

-// Return value:

-//			None.

-// Comments:

-//			This function will not destroy any external buffer.

-//

-DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);

-

-// Function: FPDF_VIEWERREF_GetPrintScaling

-//			Whether the PDF document prefers to be scaled or not.

-// Parameters: 

-//			document	-	Handle to the loaded document.

-// Return value:

-//			None.

-//

-DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);

-

-// Function: FPDF_GetNamedDestByName

-//			get a special dest handle by the index.

-// Parameters: 

-//			document	-	Handle to the loaded document.

-//			name		-	The name of a special named dest.

-// Return value:

-//			The handle of the dest.

-//

-DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name);

-

-#ifdef __cplusplus

-};

-#endif

-

-#endif // _FPDFVIEW_H_

+// 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 _FPDFVIEW_H_
+#define _FPDFVIEW_H_
+
+#if defined(_WIN32) && !defined(__WINDOWS__)
+#include <windows.h>
+#endif
+
+// Data types
+typedef void*	FPDF_MODULEMGR;
+
+// PDF types
+typedef void*	FPDF_DOCUMENT;		
+typedef void*	FPDF_PAGE;			
+typedef void*	FPDF_PAGEOBJECT;	// Page object(text, path, etc)
+typedef void*	FPDF_PATH;
+typedef void*	FPDF_CLIPPATH;	
+typedef void*	FPDF_BITMAP;	
+typedef void*	FPDF_FONT;			
+
+typedef void*	FPDF_TEXTPAGE;
+typedef void*	FPDF_SCHHANDLE;
+typedef void*	FPDF_PAGELINK;
+typedef void*	FPDF_HMODULE;
+typedef void*	FPDF_DOCSCHHANDLE;
+
+typedef void*	FPDF_BOOKMARK;
+typedef void*	FPDF_DEST;
+typedef void*	FPDF_ACTION;
+typedef void*	FPDF_LINK;
+
+// Basic data types
+typedef int				FPDF_BOOL;
+typedef int				FPDF_ERROR;	
+typedef unsigned long	FPDF_DWORD;
+
+typedef	float			FS_FLOAT;
+
+// String types
+typedef unsigned short			FPDF_WCHAR;
+typedef unsigned char const*	FPDF_LPCBYTE;
+
+// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string
+typedef const char*				FPDF_BYTESTRING;
+
+typedef const unsigned short*	FPDF_WIDESTRING;		// Foxit PDF SDK always use UTF-16LE encoding wide string,
+														// each character use 2 bytes (except surrogation), with low byte first.
+
+// For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string,
+//		 however, special care needs to be taken if you expect to process Unicode larger than 0xffff.
+// For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character,
+//		you have to convert between FPDF_WIDESTRING and system wide string by yourself.
+
+#ifdef _WIN32_WCE
+typedef const unsigned short* FPDF_STRING;
+#else
+typedef const char* FPDF_STRING;
+#endif
+
+#ifndef _FS_DEF_MATRIX_
+#define _FS_DEF_MATRIX_
+/** @brief Matrix for transformation. */
+typedef struct _FS_MATRIX_
+{
+	float	a;	/**< @brief Coefficient a.*/
+	float	b;	/**< @brief Coefficient b.*/
+	float	c;	/**< @brief Coefficient c.*/
+	float	d;	/**< @brief Coefficient d.*/
+	float	e;	/**< @brief Coefficient e.*/
+	float	f;	/**< @brief Coefficient f.*/
+} FS_MATRIX;
+#endif
+
+#ifndef _FS_DEF_RECTF_
+#define _FS_DEF_RECTF_
+/** @brief Rectangle area(float) in device or page coordination system. */
+typedef struct _FS_RECTF_
+{
+	/**@{*/
+	/** @brief The x-coordinate of the left-top corner. */
+	float	left;
+	/** @brief The y-coordinate of the left-top corner. */
+	float	top;
+	/** @brief The x-coordinate of the right-bottom corner. */
+	float	right;
+	/** @brief The y-coordinate of the right-bottom corner. */
+	float	bottom;
+	/**@}*/
+}* FS_LPRECTF, FS_RECTF;
+/** @brief Const Pointer to ::FS_RECTF structure.*/
+typedef const FS_RECTF*	FS_LPCRECTF;
+#endif
+
+#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
+// On Windows system, functions are exported in a DLL
+#define DLLEXPORT __declspec( dllexport )
+#define STDCALL __stdcall
+#else
+#define DLLEXPORT
+#define STDCALL
+#endif
+
+extern const char g_ExpireDate[];
+extern const char g_ModuleCodes[];
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDF_InitLibrary
+//			Initialize the FPDFSDK library 
+// Parameters:
+//			hInstance	-	For WIN32 system only: the instance of the executable or DLL module.
+// Return value:
+//			None.
+// Comments:
+//			You have to call this function before you can call any PDF processing functions.
+
+DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance);
+
+
+// Function: FPDF_DestroyLibary
+//			Release all resources allocated by the FPDFSDK library.
+// Parameters:
+//			None.
+// Return value:
+//			None.
+// Comments:
+//			You can call this function to release all memory blocks allocated by the library. 
+//			After this function called, you should not call any PDF processing functions.
+DLLEXPORT void STDCALL FPDF_DestroyLibrary();
+
+//Policy for accessing the local machine time.
+#define FPDF_POLICY_MACHINETIME_ACCESS	0
+
+// Function: FPDF_SetSandBoxPolicy
+//			Set the policy for the sandbox environment.
+// Parameters:	
+//			policy		-	The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS.
+//			enable		-	True for enable, False for disable the policy.
+// Return value:
+//			None.
+DLLEXPORT void	STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
+
+/**
+* Open and load a PDF document.
+* @param[in] file_path	-	Path to the PDF file (including extension).
+* @param[in] password	-	A string used as the password for PDF file. 
+*							If no password needed, empty or NULL can be used.
+* @note		Loaded document can be closed by FPDF_CloseDocument.
+*			If this function fails, you can use FPDF_GetLastError() to retrieve
+*			the reason why it fails.
+* @retval	A handle to the loaded document. If failed, NULL is returned.
+*/
+DLLEXPORT FPDF_DOCUMENT	STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 
+	FPDF_BYTESTRING password);
+
+// Function: FPDF_LoadMemDocument
+//			Open and load a PDF document from memory.
+// Parameters: 
+//			data_buf	-	Pointer to a buffer containing the PDF document.
+//			size		-	Number of bytes in the PDF document.
+//			password	-	A string used as the password for PDF file. 
+//							If no password needed, empty or NULL can be used.
+// Return value:
+//			A handle to the loaded document. If failed, NULL is returned.
+// Comments:
+//			The memory buffer must remain valid when the document is open.
+//			Loaded document can be closed by FPDF_CloseDocument.
+//			If this function fails, you can use FPDF_GetLastError() to retrieve
+//			the reason why it fails.
+//
+DLLEXPORT FPDF_DOCUMENT	STDCALL FPDF_LoadMemDocument(const void* data_buf, 
+											int size, FPDF_BYTESTRING password);
+
+// Structure for custom file access.
+typedef struct {
+	// File length, in bytes.
+	unsigned long	m_FileLen;
+
+	// A function pointer for getting a block of data from specific position.
+	// Position is specified by byte offset from beginning of the file.
+	// The position and size will never go out range of file length.
+	// It may be possible for FPDFSDK to call this function multiple times for same position.
+	// Return value: should be non-zero if successful, zero for error.
+	int				(*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size);
+
+	// A custom pointer for all implementation specific data.
+	// This pointer will be used as the first parameter to m_GetBlock callback.
+	void*			m_Param;
+} FPDF_FILEACCESS;
+
+// Function: FPDF_LoadCustomDocument
+//			Load PDF document from a custom access descriptor.
+// Parameters:
+//			pFileAccess	-	A structure for access the file.
+//			password	-	Optional password for decrypting the PDF file.
+// Return value:
+//			A handle to the loaded document. If failed, NULL is returned.
+// Comments:
+//			The application should maintain the file resources being valid until the PDF document close.
+//			Loaded document can be closed by FPDF_CloseDocument.
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, 
+														FPDF_BYTESTRING password);
+
+// Function: FPDF_GetFileVersion
+//			Get the file version of the specific PDF document.
+// Parameters:
+//			doc			-	Handle to document.
+//			fileVersion	-	The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
+// Return value:
+//			TRUE if this call succeed, If failed, FALSE is returned.
+// Comments:
+//			If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail.
+DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion);
+
+#define FPDF_ERR_SUCCESS		0		// No error.
+#define FPDF_ERR_UNKNOWN		1		// Unknown error.
+#define FPDF_ERR_FILE			2		// File not found or could not be opened.
+#define FPDF_ERR_FORMAT			3		// File not in PDF format or corrupted.
+#define FPDF_ERR_PASSWORD		4		// Password required or incorrect password.
+#define FPDF_ERR_SECURITY		5		// Unsupported security scheme.
+#define FPDF_ERR_PAGE			6		// Page not found or content error.
+
+// Function: FPDF_GetLastError
+//			Get last error code when an SDK function failed.
+// Parameters: 
+//			None.
+// Return value:
+//			A 32-bit integer indicating error codes (defined above).
+// Comments:
+//			If the previous SDK call succeeded, the return value of this function
+//			is not defined.
+//
+DLLEXPORT unsigned long	STDCALL FPDF_GetLastError();
+
+// Function: FPDF_GetDocPermission
+//			Get file permission flags of the document.
+// Parameters: 
+//			document	-	Handle to document. Returned by FPDF_LoadDocument function.
+// Return value:
+//			A 32-bit integer indicating permission flags. Please refer to PDF Reference for
+//			detailed description. If the document is not protected, 0xffffffff will be returned.
+//
+DLLEXPORT unsigned long	STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetPageCount
+//			Get total number of pages in a document.
+// Parameters: 
+//			document	-	Handle to document. Returned by FPDF_LoadDocument function.
+// Return value:
+//			Total number of pages in the document.
+//
+DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
+
+// Function: FPDF_LoadPage
+//			Load a page inside a document.
+// Parameters: 
+//			document	-	Handle to document. Returned by FPDF_LoadDocument function.
+//			page_index	-	Index number of the page. 0 for the first page.
+// Return value:
+//			A handle to the loaded page. If failed, NULL is returned.
+// Comments:
+//			Loaded page can be rendered to devices using FPDF_RenderPage function.
+//			Loaded page can be closed by FPDF_ClosePage.
+//
+DLLEXPORT FPDF_PAGE	STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index);
+
+// Function: FPDF_GetPageWidth
+//			Get page width.
+// Parameters:
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+//			Page width (excluding non-displayable area) measured in points.
+//			One point is 1/72 inch (around 0.3528 mm).
+//
+DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
+
+// Function: FPDF_GetPageHeight
+//			Get page height.
+// Parameters:
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+//			Page height (excluding non-displayable area) measured in points.
+//			One point is 1/72 inch (around 0.3528 mm)
+//
+DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
+
+// Function: FPDF_GetPageSizeByIndex
+//			Get the size of a page by index.
+// Parameters:
+//			document	-	Handle to document. Returned by FPDF_LoadDocument function.
+//			page_index	-	Page index, zero for the first page.
+//			width		-	Pointer to a double value receiving the page width (in points).
+//			height		-	Pointer to a double value receiving the page height (in points).
+// Return value:
+//			Non-zero for success. 0 for error (document or page not found).
+//
+DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);
+
+
+// Page rendering flags. They can be combined with bit OR.
+#define FPDF_ANNOT			0x01		// Set if annotations are to be rendered.
+#define FPDF_LCD_TEXT		0x02		// Set if using text rendering optimized for LCD display.
+#define FPDF_NO_NATIVETEXT	0x04		// Don't use the native text output available on some platforms
+#define FPDF_GRAYSCALE		0x08		// Grayscale output.
+#define FPDF_DEBUG_INFO		0x80		// Set if you want to get some debug info. 
+										// Please discuss with Foxit first if you need to collect debug info.
+#define FPDF_NO_CATCH		0x100		// Set if you don't want to catch exception.
+#define FPDF_RENDER_LIMITEDIMAGECACHE	0x200	// Limit image cache size. 
+#define FPDF_RENDER_FORCEHALFTONE		0x400	// Always use halftone for image stretching.
+#define FPDF_PRINTING		0x800	// Render for printing.
+#define FPDF_REVERSE_BYTE_ORDER		0x10		//set whether render in a reverse Byte order, this flag only 
+												//enable when render to a bitmap.
+#ifdef _WIN32
+// Function: FPDF_RenderPage
+//			Render contents in a page to a device (screen, bitmap, or printer).
+//			This function is only supported on Windows system.
+// Parameters: 
+//			dc			-	Handle to device context.
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			start_x		-	Left pixel position of the display area in the device coordinate.
+//			start_y		-	Top pixel position of the display area in the device coordinate.
+//			size_x		-	Horizontal size (in pixels) for displaying the page.
+//			size_y		-	Vertical size (in pixels) for displaying the page.
+//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+//			flags		-	0 for normal display, or combination of flags defined above.
+// Return value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
+						int rotate, int flags);
+#endif
+
+// Function: FPDF_RenderPageBitmap
+//			Render contents in a page to a device independent bitmap
+// Parameters: 
+//			bitmap		-	Handle to the device independent bitmap (as the output buffer).
+//							Bitmap handle can be created by FPDFBitmap_Create function.
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			start_x		-	Left pixel position of the display area in the bitmap coordinate.
+//			start_y		-	Top pixel position of the display area in the bitmap coordinate.
+//			size_x		-	Horizontal size (in pixels) for displaying the page.
+//			size_y		-	Vertical size (in pixels) for displaying the page.
+//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+//			flags		-	0 for normal display, or combination of flags defined above.
+// Return value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 
+						int size_x, int size_y, int rotate, int flags);
+
+// Function: FPDF_ClosePage
+//			Close a loaded PDF page.
+// Parameters: 
+//			page		-	Handle to the loaded page.
+// Return value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
+
+// Function: FPDF_CloseDocument
+//			Close a loaded PDF document.
+// Parameters: 
+//			document	-	Handle to the loaded document.
+// Return value:
+//			None.
+//
+DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
+
+// Function: FPDF_DeviceToPage
+//			Convert the screen coordinate of a point to page coordinate.
+// Parameters:
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			start_x		-	Left pixel position of the display area in the device coordinate.
+//			start_y		-	Top pixel position of the display area in the device coordinate.
+//			size_x		-	Horizontal size (in pixels) for displaying the page.
+//			size_y		-	Vertical size (in pixels) for displaying the page.
+//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+//			device_x	-	X value in device coordinate, for the point to be converted.
+//			device_y	-	Y value in device coordinate, for the point to be converted.
+//			page_x		-	A Pointer to a double receiving the converted X value in page coordinate.
+//			page_y		-	A Pointer to a double receiving the converted Y value in page coordinate.
+// Return value:
+//			None.
+// Comments:
+//			The page coordinate system has its origin at left-bottom corner of the page, with X axis goes along
+//			the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordinate system 
+//			can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have 
+//			the same coordinate values in the page coordinate system. 
+//
+//			The device coordinate system is device dependent. For screen device, its origin is at left-top
+//			corner of the window. However this origin can be altered by Windows coordinate transformation
+//			utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly
+//			same values as you used in FPDF_RenderPage() function call.
+//
+DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
+						int rotate, int device_x, int device_y, double* page_x, double* page_y);
+
+// Function: FPDF_PageToDevice
+//			Convert the page coordinate of a point to screen coordinate.
+// Parameters:
+//			page		-	Handle to the page. Returned by FPDF_LoadPage function.
+//			start_x		-	Left pixel position of the display area in the device coordinate.
+//			start_y		-	Top pixel position of the display area in the device coordinate.
+//			size_x		-	Horizontal size (in pixels) for displaying the page.
+//			size_y		-	Vertical size (in pixels) for displaying the page.
+//			rotate		-	Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+//								2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+//			page_x		-	X value in page coordinate, for the point to be converted.
+//			page_y		-	Y value in page coordinate, for the point to be converted.
+//			device_x	-	A pointer to an integer receiving the result X value in device coordinate.
+//			device_y	-	A pointer to an integer receiving the result Y value in device coordinate.
+// Return value:
+//			None.
+// Comments:
+//			See comments of FPDF_DeviceToPage() function.
+//
+DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
+						int rotate, double page_x, double page_y, int* device_x, int* device_y);
+
+// Function: FPDFBitmap_Create
+//			Create a Foxit Device Independent Bitmap (FXDIB).
+// Parameters:
+//			width		-	Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
+//			height		-	Number of pixels in a vertical line of the bitmap. Must be greater than 0.
+//			alpha		-	A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
+// Return value:
+//			The created bitmap handle, or NULL if parameter error or out of memory.
+// Comments:
+//			An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned.
+//			Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values.
+//			The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.
+//			
+//			The pixels in a horizontal line (also called scan line) are stored side by side, with left most
+//			pixel stored first (with lower memory address). Each scan line uses width*4 bytes.
+//
+//			Scan lines are stored one after another, with top most scan line stored first. There is no gap
+//			between adjacent scan lines.
+//
+//			This function allocates enough memory for holding all pixels in the bitmap, but it doesn't 
+//			initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.
+DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);
+
+// More DIB formats
+#define FPDFBitmap_Gray		1		// Gray scale bitmap, one byte per pixel.
+#define FPDFBitmap_BGR		2		// 3 bytes per pixel, byte order: blue, green, red.
+#define FPDFBitmap_BGRx		3		// 4 bytes per pixel, byte order: blue, green, red, unused.
+#define FPDFBitmap_BGRA		4		// 4 bytes per pixel, byte order: blue, green, red, alpha.
+
+// Function: FPDFBitmap_CreateEx
+//			Create a Foxit Device Independent Bitmap (FXDIB)
+// Parameters:
+//			width		-	Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
+//			height		-	Number of pixels in a vertical line of the bitmap. Must be greater than 0.
+//			format		-	A number indicating for bitmap format, as defined above.
+//			first_scan	-	A pointer to the first byte of first scan line, for external buffer
+//							only. If this parameter is NULL, then the SDK will create its own buffer.
+//			stride		-	Number of bytes for each scan line, for external buffer only..
+// Return value:
+//			The created bitmap handle, or NULL if parameter error or out of memory.
+// Comments:
+//			Similar to FPDFBitmap_Create function, with more formats and external buffer supported. 
+//			Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is 
+//			required. 
+//
+//			If external scanline buffer is used, then the application should destroy the buffer
+//			by itself. FPDFBitmap_Destroy function will not destroy the buffer.
+//
+DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);
+
+// Function: FPDFBitmap_FillRect
+//			Fill a rectangle area in an FXDIB.
+// Parameters:
+//			bitmap		-	The handle to the bitmap. Returned by FPDFBitmap_Create function.
+//			left		-	The left side position. Starting from 0 at the left-most pixel.
+//			top			-	The top side position. Starting from 0 at the top-most scan line.
+//			width		-	Number of pixels to be filled in each scan line.
+//			height		-	Number of scan lines to be filled.
+//			red			-	A number from 0 to 255, identifying the red intensity.
+//			green		-	A number from 0 to 255, identifying the green intensity.
+//			blue		-	A number from 0 to 255, identifying the blue intensity.
+//			alpha		-	(Only if the alpha channeled is used when bitmap created) A number from 0 to 255,
+//							identifying the alpha value.
+// Return value:
+//			None.
+// Comments:
+//			This function set the color and (optionally) alpha value in specified region of the bitmap.
+//			NOTE: If alpha channel is used, this function does NOT composite the background with the source color,
+//			instead the background will be replaced by the source color and alpha.
+//			If alpha channel is not used, the "alpha" parameter is ignored.
+//
+DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, 
+									int red, int green, int blue, int alpha);
+
+// Function: FPDFBitmap_GetBuffer
+//			Get data buffer of an FXDIB
+// Parameters:
+//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+//			The pointer to the first byte of the bitmap buffer.
+// Comments:
+//			The stride may be more than width * number of bytes per pixel
+//			Applications can use this function to get the bitmap buffer pointer, then manipulate any color
+//			and/or alpha values for any pixels in the bitmap.
+DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetWidth
+//			Get width of an FXDIB.
+// Parameters:
+//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+//			The number of pixels in a horizontal line of the bitmap.
+DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetHeight
+//			Get height of an FXDIB.
+// Parameters:
+//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+//			The number of pixels in a vertical line of the bitmap.
+DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetStride
+//			Get number of bytes for each scan line in the bitmap buffer.
+// Parameters:
+//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+//			The number of bytes for each scan line in the bitmap buffer.
+// Comments:
+//			The stride may be more than width * number of bytes per pixel
+DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_Destroy
+//			Destroy an FXDIB and release all related buffers. 
+// Parameters:
+//			bitmap		-	Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+//			None.
+// Comments:
+//			This function will not destroy any external buffer.
+//
+DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
+
+// Function: FPDF_VIEWERREF_GetPrintScaling
+//			Whether the PDF document prefers to be scaled or not.
+// Parameters: 
+//			document	-	Handle to the loaded document.
+// Return value:
+//			None.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetNamedDestByName
+//			get a special dest handle by the index.
+// Parameters: 
+//			document	-	Handle to the loaded document.
+//			name		-	The name of a special named dest.
+// Return value:
+//			The handle of the dest.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _FPDFVIEW_H_
diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h
index c93e679..0ffbddb 100644
--- a/fpdfsdk/include/fsdk_actionhandler.h
+++ b/fpdfsdk/include/fsdk_actionhandler.h
@@ -1,82 +1,82 @@
-// 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 _FSDK_ACTIONHANDLER_H_

-#define _FSDK_ACTIONHANDLER_H_

-

-

-class CPDFDoc_Environment;

-class IFXJS_Runtime;

-

-class CPDFSDK_FormActionHandler

-{

-public:

-	FX_BOOL	DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-	FX_BOOL	DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-	FX_BOOL	DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-	FX_BOOL	DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-};

-

-class CPDFSDK_MediaActionHandler

-{

-public:

-	FX_BOOL	DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-	FX_BOOL	DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-	FX_BOOL	DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);

-};

-

-class  CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/

-{

-public:

-	CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);

-	virtual ~CPDFSDK_ActionHandler();

-	

-	virtual void		Destroy();

-	virtual FX_BOOL		DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/);

-	virtual FX_BOOL		DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);

-	virtual FX_BOOL		DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);

-	virtual FX_BOOL		DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);

-	virtual FX_BOOL		DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);	

-	virtual FX_BOOL		DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen);

-	virtual FX_BOOL		DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);

-	virtual FX_BOOL		DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data);

-	virtual FX_BOOL		DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);

-public:

-	void				SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler);

-	void				SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);

-	

-private:

-	FX_BOOL				ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);

-	FX_BOOL				ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);

-	FX_BOOL				ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);

-	FX_BOOL				ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list);

-	FX_BOOL				ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list);

-	FX_BOOL				ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& list);

-	

-	void				DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);

-	void				RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);

-	void				RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);

-	void				RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);

-	

-private:

-	FX_BOOL				IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);

-	FX_BOOL				IsValidDocView(CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);

-	

-	void				DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ const CPDF_Action& action);

-	void				DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);

-	void				DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);

-	void				DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);

-	void				DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);

-	void				DoAction_SetOCGState(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ const CPDF_Action& action);

-	

-private:

-	CPDFDoc_Environment*			m_pEvi;

-	CPDFSDK_FormActionHandler*		m_pFormActionHandler;

-	CPDFSDK_MediaActionHandler*		m_pMediaActionHandler;

-};

-

-#endif //_BA_ACTIONHANDLER_H_

-

+// 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 _FSDK_ACTIONHANDLER_H_
+#define _FSDK_ACTIONHANDLER_H_
+
+
+class CPDFDoc_Environment;
+class IFXJS_Runtime;
+
+class CPDFSDK_FormActionHandler
+{
+public:
+	FX_BOOL	DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+	FX_BOOL	DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+	FX_BOOL	DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+	FX_BOOL	DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+};
+
+class CPDFSDK_MediaActionHandler
+{
+public:
+	FX_BOOL	DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+	FX_BOOL	DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+	FX_BOOL	DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+};
+
+class  CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/
+{
+public:
+	CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
+	virtual ~CPDFSDK_ActionHandler();
+	
+	virtual void		Destroy();
+	virtual FX_BOOL		DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/);
+	virtual FX_BOOL		DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
+	virtual FX_BOOL		DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
+	virtual FX_BOOL		DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
+	virtual FX_BOOL		DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);	
+	virtual FX_BOOL		DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen);
+	virtual FX_BOOL		DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
+	virtual FX_BOOL		DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
+	virtual FX_BOOL		DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
+public:
+	void				SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler);
+	void				SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
+	
+private:
+	FX_BOOL				ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
+	FX_BOOL				ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
+	FX_BOOL				ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);
+	FX_BOOL				ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list);
+	FX_BOOL				ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list);
+	FX_BOOL				ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& list);
+	
+	void				DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
+	void				RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);
+	void				RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);
+	void				RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);
+	
+private:
+	FX_BOOL				IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);
+	FX_BOOL				IsValidDocView(CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
+	
+	void				DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ const CPDF_Action& action);
+	void				DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+	void				DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+	void				DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+	void				DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+	void				DoAction_SetOCGState(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ const CPDF_Action& action);
+	
+private:
+	CPDFDoc_Environment*			m_pEvi;
+	CPDFSDK_FormActionHandler*		m_pFormActionHandler;
+	CPDFSDK_MediaActionHandler*		m_pMediaActionHandler;
+};
+
+#endif //_BA_ACTIONHANDLER_H_
+
diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h
index dc2e40a..fec3d92 100644
--- a/fpdfsdk/include/fsdk_annothandler.h
+++ b/fpdfsdk/include/fsdk_annothandler.h
@@ -1,248 +1,248 @@
-// 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 _FSDK_ANNOTHANDLER_H_

-#define _FSDK_ANNOTHANDLER_H_

-

-

-class CPDFDoc_Environment;

-class CFFL_IFormFiller;

-class CPDFSDK_PageView;

-class IPDFSDK_AnnotHandler

-{

-

-public:

-	virtual ~IPDFSDK_AnnotHandler() {};

-

-	virtual CFX_ByteString		GetType() = 0;

-

-	virtual CFX_ByteString		GetName() = 0;

-

-	virtual FX_BOOL				CanAnswer(CPDFSDK_Annot* pAnnot) = 0;

-	

-

-	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0;

-

-	virtual void				ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;

-

-	virtual void				DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;

-	

-

-	virtual CPDF_Rect				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) = 0;

-	

-	virtual FX_BOOL				HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point) = 0;

-	

-

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 

-		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-		FX_DWORD dwFlags) = 0;

-	

-	virtual void				OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 

-		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-		const CPDF_Rect& rcWindow, FX_DWORD dwFlags) = 0;

-	

-

-	

-

-	virtual void				OnCreate(CPDFSDK_Annot* pAnnot) = 0;

-

-	virtual void				OnLoad(CPDFSDK_Annot* pAnnot) = 0;

-

-	virtual void				OnDelete(CPDFSDK_Annot* pAnnot) = 0;

-

-	virtual void				OnRelease(CPDFSDK_Annot* pAnnot) = 0;

-	

-

-	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;

-	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;

-	

-

-	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;

-//by wjm.

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) = 0;

-	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;

-	virtual FX_BOOL				OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) =0 ;

-

-	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;

-	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot) = 0;

-

-	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;

-	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;

-

-};

-

-

-class CPDFSDK_BFAnnotHandler:public IPDFSDK_AnnotHandler

-{

-public:

-	CPDFSDK_BFAnnotHandler(CPDFDoc_Environment*	pApp):m_pFormFiller(NULL),m_pApp(pApp) {}

-	virtual	~CPDFSDK_BFAnnotHandler() {}

-public:

-

-	virtual CFX_ByteString		GetType()  {return CFX_ByteString("Widget");}

-

-	virtual CFX_ByteString		GetName()  {return CFX_ByteString("WidgetHandler");}

-	

-	virtual FX_BOOL				CanAnswer(CPDFSDK_Annot* pAnnot);

-

-	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage);

-

-	virtual void				ReleaseAnnot(CPDFSDK_Annot* pAnnot)  ;

-

-	virtual void				DeleteAnnot(CPDFSDK_Annot* pAnnot) {}

-	

-

-	virtual CPDF_Rect				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) ;

-	

-	virtual FX_BOOL				HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);

-	

-

-	virtual void				OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 

-		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-		 FX_DWORD dwFlags) ;

-	

-	virtual void				OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 

-		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-		const CPDF_Rect& rcWindow, FX_DWORD dwFlags) {}

-	

-

-	virtual void				OnCreate(CPDFSDK_Annot* pAnnot) ;

-

-	virtual void				OnLoad(CPDFSDK_Annot* pAnnot) ;

-

-	virtual void				OnDelete(CPDFSDK_Annot* pAnnot) {}

-

-	virtual void				OnRelease(CPDFSDK_Annot* pAnnot) {}

-	

-

-	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;

-	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;

-	

-

-	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;

-	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) {return FALSE;}

-	

-//by wjm.

-	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);

-	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);

-	virtual FX_BOOL				OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);

-

-	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot) {}

-	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot) {}

-

-	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);

-	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);

-

-	void						SetFormFiller(CFFL_IFormFiller* pFiller){m_pFormFiller = pFiller;}

-	CFFL_IFormFiller*			GetFormFiller() {return m_pFormFiller;}

-private:

-

-	CPDFDoc_Environment*		m_pApp;

-	CFFL_IFormFiller*			m_pFormFiller;

-};

-

-#define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*>

-class CPDFSDK_AnnotHandlerMgr

-{

-public:

-	// Destroy the handler

-	CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);

-	virtual ~CPDFSDK_AnnotHandlerMgr() ;

-

-public:

-	void						RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);

-	void						UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);

-

-	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_PageView *pPageView);

-	virtual void				ReleaseAnnot(CPDFSDK_Annot * pAnnot);

-	

-	virtual void				Annot_OnCreate(CPDFSDK_Annot* pAnnot);

-	virtual void				Annot_OnLoad(CPDFSDK_Annot* pAnnot);

-public:

-	IPDFSDK_AnnotHandler*		GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;

-	virtual void				Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot,

-		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwFlags);

-

-	virtual void				Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);

-	virtual void				Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);

-

-	virtual FX_BOOL				Annot_OnLButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-	

-	virtual FX_BOOL				Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point);

-	virtual FX_BOOL				Annot_OnRButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-	virtual FX_BOOL				Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);

-

-

-	virtual FX_BOOL				Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);

-	virtual FX_BOOL				Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);

-	virtual FX_BOOL				Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);

-

-	virtual FX_BOOL				Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);

-	virtual FX_BOOL				Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);

-

-	virtual CPDF_Rect			Annot_OnGetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);

-	virtual FX_BOOL				Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);

-

-private:

-	IPDFSDK_AnnotHandler*			GetAnnotHandler(const CFX_ByteString& sType) const;

-	CPDFSDK_Annot*				GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,FX_BOOL bNext);

-private:

-	CBA_AnnotHandlerArray		m_Handlers;

-	CFX_MapByteStringToPtr		m_mapType2Handler;

-	CPDFDoc_Environment*		m_pApp;

-};

-

-//#define CBF_Page2Accessible	 CFX_MapPtrTemplate<CPDFSDK_PageView*, IAccessible*>

-

-typedef int (*AI_COMPARE) (CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);

-

-class CPDFSDK_AnnotIterator

-{

-protected:

-	CPDFSDK_Annot*	NextAnnot (const CPDFSDK_Annot* pCurrent) ;

-	CPDFSDK_Annot*	PrevAnnot (const CPDFSDK_Annot* pCurrent) ;	

-	CPDFSDK_Annot*	NextAnnot(int& index ) ;

-	CPDFSDK_Annot*	PrevAnnot(int& index ) ;

-public:

-    CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView, FX_BOOL bReverse,

-		FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL);	

-	virtual CPDFSDK_Annot*	Next (const CPDFSDK_Annot* pCurrent) ;

-	virtual CPDFSDK_Annot*	Prev (const CPDFSDK_Annot* pCurrent) ;	

-	virtual CPDFSDK_Annot*	Next(int& index ) ;

-	virtual CPDFSDK_Annot*	Prev(int& index ) ;

-	virtual int             Count(){return m_pIteratorAnnotList.GetSize();}

-	

-	virtual FX_BOOL         InitIteratorAnnotList(CPDFSDK_PageView * pPageView,CFX_PtrArray* pList=NULL);

-	

-	void					InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pCompare);

-protected:

-	//	CFX_PtrList			 m_pIteratorAnnotList; 

-	CFX_PtrArray	     m_pIteratorAnnotList;	

-	FX_BOOL			     m_bReverse;

-	FX_BOOL              m_bIgnoreTopmost;

-	FX_BOOL              m_bCircle;

-};

-

-

-

-#endif

-

+// 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 _FSDK_ANNOTHANDLER_H_
+#define _FSDK_ANNOTHANDLER_H_
+
+
+class CPDFDoc_Environment;
+class CFFL_IFormFiller;
+class CPDFSDK_PageView;
+class IPDFSDK_AnnotHandler
+{
+
+public:
+	virtual ~IPDFSDK_AnnotHandler() {};
+
+	virtual CFX_ByteString		GetType() = 0;
+
+	virtual CFX_ByteString		GetName() = 0;
+
+	virtual FX_BOOL				CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
+	
+
+	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0;
+
+	virtual void				ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
+
+	virtual void				DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
+	
+
+	virtual CPDF_Rect				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) = 0;
+	
+	virtual FX_BOOL				HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point) = 0;
+	
+
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 
+		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+		FX_DWORD dwFlags) = 0;
+	
+	virtual void				OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 
+		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+		const CPDF_Rect& rcWindow, FX_DWORD dwFlags) = 0;
+	
+
+	
+
+	virtual void				OnCreate(CPDFSDK_Annot* pAnnot) = 0;
+
+	virtual void				OnLoad(CPDFSDK_Annot* pAnnot) = 0;
+
+	virtual void				OnDelete(CPDFSDK_Annot* pAnnot) = 0;
+
+	virtual void				OnRelease(CPDFSDK_Annot* pAnnot) = 0;
+	
+
+	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+	
+
+	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
+//by wjm.
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) = 0;
+	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
+	virtual FX_BOOL				OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) =0 ;
+
+	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
+	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot) = 0;
+
+	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+
+};
+
+
+class CPDFSDK_BFAnnotHandler:public IPDFSDK_AnnotHandler
+{
+public:
+	CPDFSDK_BFAnnotHandler(CPDFDoc_Environment*	pApp):m_pFormFiller(NULL),m_pApp(pApp) {}
+	virtual	~CPDFSDK_BFAnnotHandler() {}
+public:
+
+	virtual CFX_ByteString		GetType()  {return CFX_ByteString("Widget");}
+
+	virtual CFX_ByteString		GetName()  {return CFX_ByteString("WidgetHandler");}
+	
+	virtual FX_BOOL				CanAnswer(CPDFSDK_Annot* pAnnot);
+
+	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage);
+
+	virtual void				ReleaseAnnot(CPDFSDK_Annot* pAnnot)  ;
+
+	virtual void				DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
+	
+
+	virtual CPDF_Rect				GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) ;
+	
+	virtual FX_BOOL				HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
+	
+
+	virtual void				OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 
+		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+		 FX_DWORD dwFlags) ;
+	
+	virtual void				OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, 
+		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+		const CPDF_Rect& rcWindow, FX_DWORD dwFlags) {}
+	
+
+	virtual void				OnCreate(CPDFSDK_Annot* pAnnot) ;
+
+	virtual void				OnLoad(CPDFSDK_Annot* pAnnot) ;
+
+	virtual void				OnDelete(CPDFSDK_Annot* pAnnot) {}
+
+	virtual void				OnRelease(CPDFSDK_Annot* pAnnot) {}
+	
+
+	virtual void				OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
+	virtual void				OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
+	
+
+	virtual FX_BOOL				OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
+	virtual FX_BOOL				OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) {return FALSE;}
+	
+//by wjm.
+	virtual FX_BOOL				OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
+	virtual FX_BOOL				OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+	virtual FX_BOOL				OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+
+	virtual	void				OnDeSelected(CPDFSDK_Annot* pAnnot) {}
+	virtual	void				OnSelected(CPDFSDK_Annot* pAnnot) {}
+
+	virtual FX_BOOL				OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+	virtual FX_BOOL				OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+
+	void						SetFormFiller(CFFL_IFormFiller* pFiller){m_pFormFiller = pFiller;}
+	CFFL_IFormFiller*			GetFormFiller() {return m_pFormFiller;}
+private:
+
+	CPDFDoc_Environment*		m_pApp;
+	CFFL_IFormFiller*			m_pFormFiller;
+};
+
+#define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*>
+class CPDFSDK_AnnotHandlerMgr
+{
+public:
+	// Destroy the handler
+	CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);
+	virtual ~CPDFSDK_AnnotHandlerMgr() ;
+
+public:
+	void						RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
+	void						UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
+
+	virtual CPDFSDK_Annot*		NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_PageView *pPageView);
+	virtual void				ReleaseAnnot(CPDFSDK_Annot * pAnnot);
+	
+	virtual void				Annot_OnCreate(CPDFSDK_Annot* pAnnot);
+	virtual void				Annot_OnLoad(CPDFSDK_Annot* pAnnot);
+public:
+	IPDFSDK_AnnotHandler*		GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
+	virtual void				Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot,
+		CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwFlags);
+
+	virtual void				Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
+	virtual void				Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
+
+	virtual FX_BOOL				Annot_OnLButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+	
+	virtual FX_BOOL				Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point);
+	virtual FX_BOOL				Annot_OnRButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+	virtual FX_BOOL				Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
+
+
+	virtual FX_BOOL				Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
+	virtual FX_BOOL				Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+	virtual FX_BOOL				Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+
+	virtual FX_BOOL				Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+	virtual FX_BOOL				Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+
+	virtual CPDF_Rect			Annot_OnGetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+	virtual FX_BOOL				Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
+
+private:
+	IPDFSDK_AnnotHandler*			GetAnnotHandler(const CFX_ByteString& sType) const;
+	CPDFSDK_Annot*				GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,FX_BOOL bNext);
+private:
+	CBA_AnnotHandlerArray		m_Handlers;
+	CFX_MapByteStringToPtr		m_mapType2Handler;
+	CPDFDoc_Environment*		m_pApp;
+};
+
+//#define CBF_Page2Accessible	 CFX_MapPtrTemplate<CPDFSDK_PageView*, IAccessible*>
+
+typedef int (*AI_COMPARE) (CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+
+class CPDFSDK_AnnotIterator
+{
+protected:
+	CPDFSDK_Annot*	NextAnnot (const CPDFSDK_Annot* pCurrent) ;
+	CPDFSDK_Annot*	PrevAnnot (const CPDFSDK_Annot* pCurrent) ;	
+	CPDFSDK_Annot*	NextAnnot(int& index ) ;
+	CPDFSDK_Annot*	PrevAnnot(int& index ) ;
+public:
+    CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView, FX_BOOL bReverse,
+		FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL);	
+	virtual CPDFSDK_Annot*	Next (const CPDFSDK_Annot* pCurrent) ;
+	virtual CPDFSDK_Annot*	Prev (const CPDFSDK_Annot* pCurrent) ;	
+	virtual CPDFSDK_Annot*	Next(int& index ) ;
+	virtual CPDFSDK_Annot*	Prev(int& index ) ;
+	virtual int             Count(){return m_pIteratorAnnotList.GetSize();}
+	
+	virtual FX_BOOL         InitIteratorAnnotList(CPDFSDK_PageView * pPageView,CFX_PtrArray* pList=NULL);
+	
+	void					InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pCompare);
+protected:
+	//	CFX_PtrList			 m_pIteratorAnnotList; 
+	CFX_PtrArray	     m_pIteratorAnnotList;	
+	FX_BOOL			     m_bReverse;
+	FX_BOOL              m_bIgnoreTopmost;
+	FX_BOOL              m_bCircle;
+};
+
+
+
+#endif
+
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h
index b6cadb7..4642508 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -1,186 +1,186 @@
-// 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 _FSDK_BASEANNOT_H_

-#define _FSDK_BASEANNOT_H_

-

-#if _FX_OS_ == _FX_ANDROID_

-#include "time.h"

-#else

-#include <ctime>

-#endif

-

-class CPDFSDK_PageView;

-#define CFX_IntArray				CFX_ArrayTemplate<int>

-

-class  CPDFSDK_DateTime : public CFX_Object

-{

-public:

-	CPDFSDK_DateTime();

-	CPDFSDK_DateTime(const CFX_ByteString& dtStr);

-	CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);

-	CPDFSDK_DateTime(const FX_SYSTEMTIME& st);

-	

-	

-	CPDFSDK_DateTime&	operator = (const CPDFSDK_DateTime& datetime);

-	CPDFSDK_DateTime&	operator = (const FX_SYSTEMTIME& st);

-	FX_BOOL				operator == (CPDFSDK_DateTime& datetime);

-	FX_BOOL				operator != (CPDFSDK_DateTime& datetime);

-	FX_BOOL				operator > (CPDFSDK_DateTime& datetime);

-	FX_BOOL				operator >= (CPDFSDK_DateTime& datetime);

-	FX_BOOL				operator < (CPDFSDK_DateTime& datetime);

-	FX_BOOL				operator <= (CPDFSDK_DateTime& datetime);	

-						operator time_t();

-	

-	CPDFSDK_DateTime&	FromPDFDateTimeString(const CFX_ByteString& dtStr);

-	CFX_ByteString		ToCommonDateTimeString();

-	CFX_ByteString		ToPDFDateTimeString();

-	void				ToSystemTime(FX_SYSTEMTIME& st);

-	CPDFSDK_DateTime	ToGMT();

-	CPDFSDK_DateTime&	AddDays(short days);

-	CPDFSDK_DateTime&	AddSeconds(int seconds);

-	

-	void				ResetDateTime();

-	

-	struct FX_DATETIME

-	{

-		FX_SHORT	year;

-		FX_BYTE		month;

-		FX_BYTE		day;

-		FX_BYTE		hour;

-		FX_BYTE		minute;

-		FX_BYTE		second;

-		FX_CHAR		tzHour;

-		FX_BYTE		tzMinute;

-	}dt;

-};

-

-class CPDFSDK_Annot

-{

-public:

-	CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);

-	virtual ~CPDFSDK_Annot();

-public:

-	virtual FX_FLOAT			GetMinWidth() const;

-	virtual FX_FLOAT			GetMinHeight() const;

-	//define layout order to 5.

-	virtual int					GetLayoutOrder() const { return 5; }

-

-public:

-	CPDF_Annot*					GetPDFAnnot();

-	

-	void						SetPage(CPDFSDK_PageView* pPageView);

-	CPDFSDK_PageView*			GetPageView();	

-	FX_DWORD					GetFlags();

-	

-	// Tab Order	

-	int							GetTabOrder();

-	void						SetTabOrder(int iTabOrder);

-	

-	// Selection

-	FX_BOOL						IsSelected();

-	void						SetSelected(FX_BOOL bSelected);

-	

-	CFX_ByteString				GetType() const;

-	virtual CFX_ByteString		GetSubType() const;

-

-	CPDF_Page*					GetPDFPage();

-

-public:

-	CPDF_Dictionary*			GetAnnotDict() const;

-	

-	void						SetRect(const CPDF_Rect& rect);

-	CPDF_Rect					GetRect() const;

-	

-	void						SetContents(const CFX_WideString& sContents);

-	CFX_WideString				GetContents() const;

-	

-	void						SetAnnotName(const CFX_WideString& sName);

-	CFX_WideString				GetAnnotName() const;

-	

-	void						SetModifiedDate(const FX_SYSTEMTIME& st);

-	FX_SYSTEMTIME				GetModifiedDate() const;

-

-	void						SetFlags(int nFlags);

-	int							GetFlags() const;

-

-	void						SetAppState(const CFX_ByteString& str);

-	CFX_ByteString				GetAppState() const;

-	

-	void						SetStructParent(int key);

-	int							GetStructParent() const;

-	

-	//border

-	void						SetBorderWidth(int nWidth);

-	int							GetBorderWidth() const;

-	

-	//BBS_SOLID

-	//BBS_DASH

-	//BBS_BEVELED

-	//BBS_INSET

-	//BBS_UNDERLINE

-	

-	void						SetBorderStyle(int nStyle);

-	int							GetBorderStyle() const;

-	

-	void						SetBorderDash(const CFX_IntArray& array);

-	void						GetBorderDash(CFX_IntArray& array) const;

-	

-	//The background of the annotation's icon when closed

-	//The title bar of the annotation's pop-up window

-	//The border of a link annotation

-	

-	void						SetColor(FX_COLORREF color);

-	void						RemoveColor();

-	FX_BOOL						GetColor(FX_COLORREF& color) const;

-	

-	FX_BOOL						IsVisible() const;

-	//action

-

-	CPDF_Action					GetAction() const;

-	void						SetAction(const CPDF_Action& a);

-	void						RemoveAction();

-	

-	CPDF_AAction				GetAAction() const;

-	void						SetAAction(const CPDF_AAction& aa);

-	void						RemoveAAction();

-	

-	virtual CPDF_Action			GetAAction(CPDF_AAction::AActionType eAAT);

-	

-public:

-	FX_BOOL						IsAppearanceValid();

-	FX_BOOL						IsAppearanceValid(CPDF_Annot::AppearanceMode mode);

-	void						DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,

-		CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);

-	void						DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,

-		const CPDF_RenderOptions* pOptions);

-	

-	void						ClearCachedAP();

-	

-	virtual void				ResetAppearance();

-	void						WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox, 

-		const CPDF_Matrix& matrix, const CFX_ByteString& sContents,

-		const CFX_ByteString& sAPState = "");

-

-public:

-	virtual void			Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions);

-public:

-

-

-private:

-	FX_BOOL CreateFormFiller();

-protected:

-	CPDF_Annot*			m_pAnnot;

-	CPDFSDK_PageView*	m_pPageView;

-	FX_BOOL				m_bSelected;

-	int					m_nTabOrder;

-	

-};

-

-

-

-#endif

-

+// 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 _FSDK_BASEANNOT_H_
+#define _FSDK_BASEANNOT_H_
+
+#if _FX_OS_ == _FX_ANDROID_
+#include "time.h"
+#else
+#include <ctime>
+#endif
+
+class CPDFSDK_PageView;
+#define CFX_IntArray				CFX_ArrayTemplate<int>
+
+class  CPDFSDK_DateTime : public CFX_Object
+{
+public:
+	CPDFSDK_DateTime();
+	CPDFSDK_DateTime(const CFX_ByteString& dtStr);
+	CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
+	CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
+	
+	
+	CPDFSDK_DateTime&	operator = (const CPDFSDK_DateTime& datetime);
+	CPDFSDK_DateTime&	operator = (const FX_SYSTEMTIME& st);
+	FX_BOOL				operator == (CPDFSDK_DateTime& datetime);
+	FX_BOOL				operator != (CPDFSDK_DateTime& datetime);
+	FX_BOOL				operator > (CPDFSDK_DateTime& datetime);
+	FX_BOOL				operator >= (CPDFSDK_DateTime& datetime);
+	FX_BOOL				operator < (CPDFSDK_DateTime& datetime);
+	FX_BOOL				operator <= (CPDFSDK_DateTime& datetime);	
+						operator time_t();
+	
+	CPDFSDK_DateTime&	FromPDFDateTimeString(const CFX_ByteString& dtStr);
+	CFX_ByteString		ToCommonDateTimeString();
+	CFX_ByteString		ToPDFDateTimeString();
+	void				ToSystemTime(FX_SYSTEMTIME& st);
+	CPDFSDK_DateTime	ToGMT();
+	CPDFSDK_DateTime&	AddDays(short days);
+	CPDFSDK_DateTime&	AddSeconds(int seconds);
+	
+	void				ResetDateTime();
+	
+	struct FX_DATETIME
+	{
+		FX_SHORT	year;
+		FX_BYTE		month;
+		FX_BYTE		day;
+		FX_BYTE		hour;
+		FX_BYTE		minute;
+		FX_BYTE		second;
+		FX_CHAR		tzHour;
+		FX_BYTE		tzMinute;
+	}dt;
+};
+
+class CPDFSDK_Annot
+{
+public:
+	CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
+	virtual ~CPDFSDK_Annot();
+public:
+	virtual FX_FLOAT			GetMinWidth() const;
+	virtual FX_FLOAT			GetMinHeight() const;
+	//define layout order to 5.
+	virtual int					GetLayoutOrder() const { return 5; }
+
+public:
+	CPDF_Annot*					GetPDFAnnot();
+	
+	void						SetPage(CPDFSDK_PageView* pPageView);
+	CPDFSDK_PageView*			GetPageView();	
+	FX_DWORD					GetFlags();
+	
+	// Tab Order	
+	int							GetTabOrder();
+	void						SetTabOrder(int iTabOrder);
+	
+	// Selection
+	FX_BOOL						IsSelected();
+	void						SetSelected(FX_BOOL bSelected);
+	
+	CFX_ByteString				GetType() const;
+	virtual CFX_ByteString		GetSubType() const;
+
+	CPDF_Page*					GetPDFPage();
+
+public:
+	CPDF_Dictionary*			GetAnnotDict() const;
+	
+	void						SetRect(const CPDF_Rect& rect);
+	CPDF_Rect					GetRect() const;
+	
+	void						SetContents(const CFX_WideString& sContents);
+	CFX_WideString				GetContents() const;
+	
+	void						SetAnnotName(const CFX_WideString& sName);
+	CFX_WideString				GetAnnotName() const;
+	
+	void						SetModifiedDate(const FX_SYSTEMTIME& st);
+	FX_SYSTEMTIME				GetModifiedDate() const;
+
+	void						SetFlags(int nFlags);
+	int							GetFlags() const;
+
+	void						SetAppState(const CFX_ByteString& str);
+	CFX_ByteString				GetAppState() const;
+	
+	void						SetStructParent(int key);
+	int							GetStructParent() const;
+	
+	//border
+	void						SetBorderWidth(int nWidth);
+	int							GetBorderWidth() const;
+	
+	//BBS_SOLID
+	//BBS_DASH
+	//BBS_BEVELED
+	//BBS_INSET
+	//BBS_UNDERLINE
+	
+	void						SetBorderStyle(int nStyle);
+	int							GetBorderStyle() const;
+	
+	void						SetBorderDash(const CFX_IntArray& array);
+	void						GetBorderDash(CFX_IntArray& array) const;
+	
+	//The background of the annotation's icon when closed
+	//The title bar of the annotation's pop-up window
+	//The border of a link annotation
+	
+	void						SetColor(FX_COLORREF color);
+	void						RemoveColor();
+	FX_BOOL						GetColor(FX_COLORREF& color) const;
+	
+	FX_BOOL						IsVisible() const;
+	//action
+
+	CPDF_Action					GetAction() const;
+	void						SetAction(const CPDF_Action& a);
+	void						RemoveAction();
+	
+	CPDF_AAction				GetAAction() const;
+	void						SetAAction(const CPDF_AAction& aa);
+	void						RemoveAAction();
+	
+	virtual CPDF_Action			GetAAction(CPDF_AAction::AActionType eAAT);
+	
+public:
+	FX_BOOL						IsAppearanceValid();
+	FX_BOOL						IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
+	void						DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
+		CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
+	void						DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
+		const CPDF_RenderOptions* pOptions);
+	
+	void						ClearCachedAP();
+	
+	virtual void				ResetAppearance();
+	void						WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox, 
+		const CPDF_Matrix& matrix, const CFX_ByteString& sContents,
+		const CFX_ByteString& sAPState = "");
+
+public:
+	virtual void			Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions);
+public:
+
+
+private:
+	FX_BOOL CreateFormFiller();
+protected:
+	CPDF_Annot*			m_pAnnot;
+	CPDFSDK_PageView*	m_pPageView;
+	FX_BOOL				m_bSelected;
+	int					m_nTabOrder;
+	
+};
+
+
+
+#endif
+
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index baa1c28..b93cbbd 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -1,292 +1,292 @@
-// 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 _FSDK_BASEFORM_H_

-#define _FSDK_BASEFORM_H_

-

-#if _FX_OS_ == _FX_ANDROID_

-#include "time.h"

-#else

-#include <ctime>

-#endif

-

-class CPDFSDK_Document;

-class  CPDFSDK_DateTime;

-struct CPWL_Color;

-class CFFL_FormFiller;

-class CPDFSDK_PageView;

-class CPDFSDK_InterForm;

-

-

-typedef struct _PDFSDK_FieldAction

-{

-	_PDFSDK_FieldAction()

-	{

-		bModifier = FALSE;

-		bShift = FALSE;

-		nCommitKey = 0;

-		bKeyDown = FALSE;

-		nSelEnd = nSelStart = 0;

-		bWillCommit = FALSE;

-		bFieldFull = FALSE;

-		bRC = TRUE;

-	}

-	

-	FX_BOOL					bModifier;		//in

-	FX_BOOL					bShift;			//in

-	int						nCommitKey;		//in

-	CFX_WideString			sChange;		//in[out]

-	CFX_WideString			sChangeEx;		//in

-	FX_BOOL					bKeyDown;		//in

-	int						nSelEnd;		//in[out]

-	int						nSelStart;		//in[out]

-	CFX_WideString			sValue;			//in[out]

-	FX_BOOL					bWillCommit;	//in

-	FX_BOOL					bFieldFull;		//in

-	FX_BOOL					bRC;			//in[out]

-}PDFSDK_FieldAction;

-class CPDFSDK_Widget:public CPDFSDK_Annot

-{

-public:

-	CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);

-	virtual ~CPDFSDK_Widget();

-

-	virtual CFX_ByteString			GetSubType() const;

-	

-	virtual CPDF_Action				GetAAction(CPDF_AAction::AActionType eAAT);

-

-	int								GetFieldType() const;

-	//define layout order to 2.

-	virtual int						GetLayoutOrder() {return 2;}

-	/*

-	FIELDFLAG_READONLY

-	FIELDFLAG_REQUIRED

-	FIELDFLAG_NOEXPORT

-	*/

-	

-	int								GetFieldFlags() const;

-	int								GetRotate() const;

-

-	FX_BOOL							GetFillColor(FX_COLORREF& color) const;

-	FX_BOOL							GetBorderColor(FX_COLORREF& color) const;

-	FX_BOOL							GetTextColor(FX_COLORREF& color) const;

-	FX_FLOAT						GetFontSize() const;

-

-	int								GetSelectedIndex(int nIndex) const;

-	CFX_WideString					GetValue() const;

-	CFX_WideString					GetDefaultValue() const;

-	CFX_WideString					GetOptionLabel(int nIndex) const;

-	int								CountOptions() const;

-	FX_BOOL							IsOptionSelected(int nIndex) const;

-	int								GetTopVisibleIndex() const;

-	FX_BOOL							IsChecked() const;

-	/*

-	BF_ALIGN_LEFT

-	BF_ALIGN_MIDDL

-	BF_ALIGN_RIGHT

-	*/

-	int								GetAlignment() const;

-	int								GetMaxLen() const;

-	CFX_WideString					GetAlternateName() const;

-

-//Set Properties.

-	void							SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);

-	void							SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);

-	void							SetDefaultValue(const CFX_WideString& sValue);

-	void							SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);

-	void							ClearSelection(FX_BOOL bNotify);

-	void							SetTopVisibleIndex(int index);

-

-	void							ResetAppearance(FX_LPCWSTR sValue, FX_BOOL bValueChanged);

-	void							ResetFieldAppearance(FX_BOOL bValueChanged);

-	void							UpdateField();

-	CFX_WideString					OnFormat(int nCommitKey, FX_BOOL& bFormated);

-	

-//Message.

- 	FX_BOOL							OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, 

-												CPDFSDK_PageView* pPageView);

-

-	CPDFSDK_InterForm*				GetInterForm() const {return m_pInterForm;}

-	CPDF_FormField*					GetFormField() const;

-	CPDF_FormControl*				GetFormControl() const;

-	static CPDF_FormControl*		GetFormControl(CPDF_InterForm* pInterForm, CPDF_Dictionary* pAnnotDict);

-

-	void							DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);

-	

-	void							SetAppModified();

-	void							ClearAppModified();

-	FX_BOOL							IsAppModified() const;

-	

-	FX_INT32						GetAppearanceAge() const;

-	FX_INT32						GetValueAge() const;

-	

-private:

-	void							ResetAppearance_PushButton();

-	void							ResetAppearance_CheckBox();

-	void							ResetAppearance_RadioButton();

-	void							ResetAppearance_ComboBox(FX_LPCWSTR sValue);

-	void							ResetAppearance_ListBox();

-	void							ResetAppearance_TextField(FX_LPCWSTR sValue);

-	

-	CPDF_Rect						GetClientRect() const;

-	CPDF_Rect						GetRotatedRect() const;

-	

-	CFX_ByteString					GetBackgroundAppStream() const;

-	CFX_ByteString					GetBorderAppStream() const;

-	CPDF_Matrix						GetMatrix() const;

-	

-	CPWL_Color						GetTextPWLColor() const;

-	CPWL_Color						GetBorderPWLColor() const;

-	CPWL_Color						GetFillPWLColor() const;

-	

-	void							AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);

-	void							RemoveAppearance(const CFX_ByteString& sAPType);

-public:

-	FX_BOOL							IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);

-	void							DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,

-		CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);

-public:

-	FX_BOOL							HitTest(FX_FLOAT pageX, FX_FLOAT pageY);

-private:

-	CPDFSDK_InterForm*				m_pInterForm;

-	FX_BOOL							m_bAppModified;

-	FX_INT32						m_nAppAge;

-	FX_INT32						m_nValueAge;

-};

-

-#define CPDFSDK_WidgetMap				CFX_MapPtrTemplate<CPDF_FormControl*, CPDFSDK_Widget*>

-

-class CPDFSDK_InterForm : public CPDF_FormNotify

-{

-public:

-	CPDFSDK_InterForm(CPDFSDK_Document* pDocument);

-	virtual ~CPDFSDK_InterForm();

-	

-public:

-	virtual void					Destroy();

-	virtual CPDF_InterForm*			GetInterForm();

-	

-	CPDFSDK_Document*				GetDocument();

-	FX_BOOL							HighlightWidgets();

-	

-	CPDFSDK_Widget*					GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;

-	CPDFSDK_Widget*					GetWidget(CPDF_FormControl* pControl) const;

-	void							GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);

-	void							GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);

-	

-	void							AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);

-	void							RemoveMap(CPDF_FormControl* pControl);

-	

-	void							EnableCalculate(FX_BOOL bEnabled);

-	FX_BOOL							IsCalculateEnabled() const;

-

-#ifdef _WIN32

-	CPDF_Stream*					LoadImageFromFile(const CFX_WideString& sFile);

-#endif

-

-	void							OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);

-	void							OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);

-	void							OnCalculate(CPDF_FormField* pFormField = NULL);

-	CFX_WideString					OnFormat(CPDF_FormField* pFormField, int nCommitKey, FX_BOOL& bFormated);

-	

-	void							ResetFieldAppearance(CPDF_FormField* pFormField, FX_LPCWSTR sValue, FX_BOOL bValueChanged);

-	void							UpdateField(CPDF_FormField* pFormField);

-	

-public:

-	FX_BOOL							DoAction_Hide(const CPDF_Action& action);

-	FX_BOOL							DoAction_SubmitForm(const CPDF_Action& action);

-	FX_BOOL							DoAction_ResetForm(const CPDF_Action& action);

-	FX_BOOL							DoAction_ImportData(const CPDF_Action& action);

-	

-	void							GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);

-	FX_BOOL							IsValidField(CPDF_Dictionary* pFieldDict);

-	FX_BOOL							SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields, 

-		FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded);

-	FX_BOOL							SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);

-	FX_BOOL							ImportFormFromFDFFile(const CFX_WideString& csFDFFileName, FX_BOOL bNotify);

-	FX_BOOL							ExportFormToFDFFile(const CFX_WideString& sFDFFileName);

-	FX_BOOL							ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);

-	FX_BOOL							ExportFieldsToFDFFile(const CFX_WideString& sFDFFileName, const CFX_PtrArray& fields,

-		FX_BOOL bIncludeOrExclude);

-	FX_BOOL							ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf);

-	FX_BOOL							ExportFormToTxtFile(const CFX_WideString& sTxtFileName);

-	FX_BOOL							ImportFormFromTxtFile(const CFX_WideString& sTxtFileName);

-	CFX_WideString					GetTemporaryFileName(const CFX_WideString& sFileExt);

-	

-private:

-	virtual int						BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue);

-	virtual int						AfterValueChange(const CPDF_FormField* pField);

-	virtual int						BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue);

-	virtual int						AfterSelectionChange(const CPDF_FormField* pField);

-	virtual int						AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray);

-	virtual int						BeforeFormReset(const CPDF_InterForm* pForm);

-	virtual int						AfterFormReset(const CPDF_InterForm* pForm);

-	virtual int						BeforeFormImportData(const CPDF_InterForm* pForm);

-	virtual int						AfterFormImportData(const CPDF_InterForm* pForm);

-	

-private:

-	FX_BOOL							FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);

-	FX_BOOL							FDFToURLEncodedData(FX_LPBYTE& pBuf, FX_STRSIZE& nBufSize);

-	int								GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const;

-	void							DoFDFBuffer(CFX_ByteString sBuffer);

-	

-private:

-	CPDFSDK_Document*				m_pDocument;

-	CPDF_InterForm*					m_pInterForm;

-	CPDFSDK_WidgetMap				m_Map;

-	FX_BOOL							m_bCalculate;

-	FX_BOOL							m_bBusy;

-

-public:

-	FX_BOOL IsNeedHighLight(int nFieldType);

-	void    RemoveAllHighLight();

-	void    SetHighlightAlpha(FX_BYTE alpha) {m_iHighlightAlpha = alpha;}

-	FX_BYTE GetHighlightAlpha() {return m_iHighlightAlpha;}

-	void    SetHighlightColor(FX_COLORREF clr, int nFieldType);

-	FX_COLORREF GetHighlightColor(int nFieldType);

-private:

-	FX_COLORREF m_aHighlightColor[6];

-	FX_BYTE m_iHighlightAlpha;

-	FX_BOOL	m_bNeedHightlight[6];

-};

-

-#define BAI_STRUCTURE		0

-#define BAI_ROW				1

-#define BAI_COLUMN			2

-

-#define CPDFSDK_Annots				CFX_ArrayTemplate<CPDFSDK_Annot*>

-#define CPDFSDK_SortAnnots			CGW_ArrayTemplate<CPDFSDK_Annot*>

-class CBA_AnnotIterator 

-{

-public:

-	CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType);

-	virtual ~CBA_AnnotIterator();

-	

-	virtual CPDFSDK_Annot*				GetFirstAnnot();

-	virtual CPDFSDK_Annot*				GetLastAnnot();

-	virtual CPDFSDK_Annot*				GetNextAnnot(CPDFSDK_Annot* pAnnot);

-	virtual CPDFSDK_Annot*				GetPrevAnnot(CPDFSDK_Annot* pAnnot);

-	

-	virtual void						Release(){delete this;}

-	

-private:

-	void								GenerateResults();

-	static int							CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);

-	static int							CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);

-	

-	static CPDF_Rect					GetAnnotRect(CPDFSDK_Annot* pAnnot);

-	

-private:

-	CPDFSDK_PageView*					m_pPageView;

-	CFX_ByteString						m_sType;

-	CFX_ByteString						m_sSubType;

-	int									m_nTabs;

-	

-	CPDFSDK_Annots						m_Annots;

-};

-

-#endif //#define _FSDK_BASEFORM_H_

-

+// 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 _FSDK_BASEFORM_H_
+#define _FSDK_BASEFORM_H_
+
+#if _FX_OS_ == _FX_ANDROID_
+#include "time.h"
+#else
+#include <ctime>
+#endif
+
+class CPDFSDK_Document;
+class  CPDFSDK_DateTime;
+struct CPWL_Color;
+class CFFL_FormFiller;
+class CPDFSDK_PageView;
+class CPDFSDK_InterForm;
+
+
+typedef struct _PDFSDK_FieldAction
+{
+	_PDFSDK_FieldAction()
+	{
+		bModifier = FALSE;
+		bShift = FALSE;
+		nCommitKey = 0;
+		bKeyDown = FALSE;
+		nSelEnd = nSelStart = 0;
+		bWillCommit = FALSE;
+		bFieldFull = FALSE;
+		bRC = TRUE;
+	}
+	
+	FX_BOOL					bModifier;		//in
+	FX_BOOL					bShift;			//in
+	int						nCommitKey;		//in
+	CFX_WideString			sChange;		//in[out]
+	CFX_WideString			sChangeEx;		//in
+	FX_BOOL					bKeyDown;		//in
+	int						nSelEnd;		//in[out]
+	int						nSelStart;		//in[out]
+	CFX_WideString			sValue;			//in[out]
+	FX_BOOL					bWillCommit;	//in
+	FX_BOOL					bFieldFull;		//in
+	FX_BOOL					bRC;			//in[out]
+}PDFSDK_FieldAction;
+class CPDFSDK_Widget:public CPDFSDK_Annot
+{
+public:
+	CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);
+	virtual ~CPDFSDK_Widget();
+
+	virtual CFX_ByteString			GetSubType() const;
+	
+	virtual CPDF_Action				GetAAction(CPDF_AAction::AActionType eAAT);
+
+	int								GetFieldType() const;
+	//define layout order to 2.
+	virtual int						GetLayoutOrder() {return 2;}
+	/*
+	FIELDFLAG_READONLY
+	FIELDFLAG_REQUIRED
+	FIELDFLAG_NOEXPORT
+	*/
+	
+	int								GetFieldFlags() const;
+	int								GetRotate() const;
+
+	FX_BOOL							GetFillColor(FX_COLORREF& color) const;
+	FX_BOOL							GetBorderColor(FX_COLORREF& color) const;
+	FX_BOOL							GetTextColor(FX_COLORREF& color) const;
+	FX_FLOAT						GetFontSize() const;
+
+	int								GetSelectedIndex(int nIndex) const;
+	CFX_WideString					GetValue() const;
+	CFX_WideString					GetDefaultValue() const;
+	CFX_WideString					GetOptionLabel(int nIndex) const;
+	int								CountOptions() const;
+	FX_BOOL							IsOptionSelected(int nIndex) const;
+	int								GetTopVisibleIndex() const;
+	FX_BOOL							IsChecked() const;
+	/*
+	BF_ALIGN_LEFT
+	BF_ALIGN_MIDDL
+	BF_ALIGN_RIGHT
+	*/
+	int								GetAlignment() const;
+	int								GetMaxLen() const;
+	CFX_WideString					GetAlternateName() const;
+
+//Set Properties.
+	void							SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
+	void							SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
+	void							SetDefaultValue(const CFX_WideString& sValue);
+	void							SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
+	void							ClearSelection(FX_BOOL bNotify);
+	void							SetTopVisibleIndex(int index);
+
+	void							ResetAppearance(FX_LPCWSTR sValue, FX_BOOL bValueChanged);
+	void							ResetFieldAppearance(FX_BOOL bValueChanged);
+	void							UpdateField();
+	CFX_WideString					OnFormat(int nCommitKey, FX_BOOL& bFormated);
+	
+//Message.
+ 	FX_BOOL							OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, 
+												CPDFSDK_PageView* pPageView);
+
+	CPDFSDK_InterForm*				GetInterForm() const {return m_pInterForm;}
+	CPDF_FormField*					GetFormField() const;
+	CPDF_FormControl*				GetFormControl() const;
+	static CPDF_FormControl*		GetFormControl(CPDF_InterForm* pInterForm, CPDF_Dictionary* pAnnotDict);
+
+	void							DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);
+	
+	void							SetAppModified();
+	void							ClearAppModified();
+	FX_BOOL							IsAppModified() const;
+	
+	FX_INT32						GetAppearanceAge() const;
+	FX_INT32						GetValueAge() const;
+	
+private:
+	void							ResetAppearance_PushButton();
+	void							ResetAppearance_CheckBox();
+	void							ResetAppearance_RadioButton();
+	void							ResetAppearance_ComboBox(FX_LPCWSTR sValue);
+	void							ResetAppearance_ListBox();
+	void							ResetAppearance_TextField(FX_LPCWSTR sValue);
+	
+	CPDF_Rect						GetClientRect() const;
+	CPDF_Rect						GetRotatedRect() const;
+	
+	CFX_ByteString					GetBackgroundAppStream() const;
+	CFX_ByteString					GetBorderAppStream() const;
+	CPDF_Matrix						GetMatrix() const;
+	
+	CPWL_Color						GetTextPWLColor() const;
+	CPWL_Color						GetBorderPWLColor() const;
+	CPWL_Color						GetFillPWLColor() const;
+	
+	void							AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
+	void							RemoveAppearance(const CFX_ByteString& sAPType);
+public:
+	FX_BOOL							IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
+	void							DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
+		CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
+public:
+	FX_BOOL							HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
+private:
+	CPDFSDK_InterForm*				m_pInterForm;
+	FX_BOOL							m_bAppModified;
+	FX_INT32						m_nAppAge;
+	FX_INT32						m_nValueAge;
+};
+
+#define CPDFSDK_WidgetMap				CFX_MapPtrTemplate<CPDF_FormControl*, CPDFSDK_Widget*>
+
+class CPDFSDK_InterForm : public CPDF_FormNotify
+{
+public:
+	CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
+	virtual ~CPDFSDK_InterForm();
+	
+public:
+	virtual void					Destroy();
+	virtual CPDF_InterForm*			GetInterForm();
+	
+	CPDFSDK_Document*				GetDocument();
+	FX_BOOL							HighlightWidgets();
+	
+	CPDFSDK_Widget*					GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
+	CPDFSDK_Widget*					GetWidget(CPDF_FormControl* pControl) const;
+	void							GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);
+	void							GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);
+	
+	void							AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
+	void							RemoveMap(CPDF_FormControl* pControl);
+	
+	void							EnableCalculate(FX_BOOL bEnabled);
+	FX_BOOL							IsCalculateEnabled() const;
+
+#ifdef _WIN32
+	CPDF_Stream*					LoadImageFromFile(const CFX_WideString& sFile);
+#endif
+
+	void							OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
+	void							OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
+	void							OnCalculate(CPDF_FormField* pFormField = NULL);
+	CFX_WideString					OnFormat(CPDF_FormField* pFormField, int nCommitKey, FX_BOOL& bFormated);
+	
+	void							ResetFieldAppearance(CPDF_FormField* pFormField, FX_LPCWSTR sValue, FX_BOOL bValueChanged);
+	void							UpdateField(CPDF_FormField* pFormField);
+	
+public:
+	FX_BOOL							DoAction_Hide(const CPDF_Action& action);
+	FX_BOOL							DoAction_SubmitForm(const CPDF_Action& action);
+	FX_BOOL							DoAction_ResetForm(const CPDF_Action& action);
+	FX_BOOL							DoAction_ImportData(const CPDF_Action& action);
+	
+	void							GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);
+	FX_BOOL							IsValidField(CPDF_Dictionary* pFieldDict);
+	FX_BOOL							SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields, 
+		FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded);
+	FX_BOOL							SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
+	FX_BOOL							ImportFormFromFDFFile(const CFX_WideString& csFDFFileName, FX_BOOL bNotify);
+	FX_BOOL							ExportFormToFDFFile(const CFX_WideString& sFDFFileName);
+	FX_BOOL							ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
+	FX_BOOL							ExportFieldsToFDFFile(const CFX_WideString& sFDFFileName, const CFX_PtrArray& fields,
+		FX_BOOL bIncludeOrExclude);
+	FX_BOOL							ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf);
+	FX_BOOL							ExportFormToTxtFile(const CFX_WideString& sTxtFileName);
+	FX_BOOL							ImportFormFromTxtFile(const CFX_WideString& sTxtFileName);
+	CFX_WideString					GetTemporaryFileName(const CFX_WideString& sFileExt);
+	
+private:
+	virtual int						BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue);
+	virtual int						AfterValueChange(const CPDF_FormField* pField);
+	virtual int						BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue);
+	virtual int						AfterSelectionChange(const CPDF_FormField* pField);
+	virtual int						AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray);
+	virtual int						BeforeFormReset(const CPDF_InterForm* pForm);
+	virtual int						AfterFormReset(const CPDF_InterForm* pForm);
+	virtual int						BeforeFormImportData(const CPDF_InterForm* pForm);
+	virtual int						AfterFormImportData(const CPDF_InterForm* pForm);
+	
+private:
+	FX_BOOL							FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);
+	FX_BOOL							FDFToURLEncodedData(FX_LPBYTE& pBuf, FX_STRSIZE& nBufSize);
+	int								GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const;
+	void							DoFDFBuffer(CFX_ByteString sBuffer);
+	
+private:
+	CPDFSDK_Document*				m_pDocument;
+	CPDF_InterForm*					m_pInterForm;
+	CPDFSDK_WidgetMap				m_Map;
+	FX_BOOL							m_bCalculate;
+	FX_BOOL							m_bBusy;
+
+public:
+	FX_BOOL IsNeedHighLight(int nFieldType);
+	void    RemoveAllHighLight();
+	void    SetHighlightAlpha(FX_BYTE alpha) {m_iHighlightAlpha = alpha;}
+	FX_BYTE GetHighlightAlpha() {return m_iHighlightAlpha;}
+	void    SetHighlightColor(FX_COLORREF clr, int nFieldType);
+	FX_COLORREF GetHighlightColor(int nFieldType);
+private:
+	FX_COLORREF m_aHighlightColor[6];
+	FX_BYTE m_iHighlightAlpha;
+	FX_BOOL	m_bNeedHightlight[6];
+};
+
+#define BAI_STRUCTURE		0
+#define BAI_ROW				1
+#define BAI_COLUMN			2
+
+#define CPDFSDK_Annots				CFX_ArrayTemplate<CPDFSDK_Annot*>
+#define CPDFSDK_SortAnnots			CGW_ArrayTemplate<CPDFSDK_Annot*>
+class CBA_AnnotIterator 
+{
+public:
+	CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType);
+	virtual ~CBA_AnnotIterator();
+	
+	virtual CPDFSDK_Annot*				GetFirstAnnot();
+	virtual CPDFSDK_Annot*				GetLastAnnot();
+	virtual CPDFSDK_Annot*				GetNextAnnot(CPDFSDK_Annot* pAnnot);
+	virtual CPDFSDK_Annot*				GetPrevAnnot(CPDFSDK_Annot* pAnnot);
+	
+	virtual void						Release(){delete this;}
+	
+private:
+	void								GenerateResults();
+	static int							CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+	static int							CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+	
+	static CPDF_Rect					GetAnnotRect(CPDFSDK_Annot* pAnnot);
+	
+private:
+	CPDFSDK_PageView*					m_pPageView;
+	CFX_ByteString						m_sType;
+	CFX_ByteString						m_sSubType;
+	int									m_nTabs;
+	
+	CPDFSDK_Annots						m_Annots;
+};
+
+#endif //#define _FSDK_BASEFORM_H_
+
diff --git a/fpdfsdk/include/fsdk_common.h b/fpdfsdk/include/fsdk_common.h
index b49c1d1..197917c 100644
--- a/fpdfsdk/include/fsdk_common.h
+++ b/fpdfsdk/include/fsdk_common.h
@@ -1,46 +1,46 @@
-// 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 _FSDK_COMMON_H_

-#define _FSDK_COMMON_H_

-

-#define BFFT_SIGNATURE				"Signature"

-

-//for all fields

-#define FIELDFLAG_READONLY					1

-#define FIELDFLAG_REQUIRED					2

-#define FIELDFLAG_NOEXPORT					4

-//for text fields

-#define FIELDFLAG_MULTILINE					(1<<12)

-#define FIELDFLAG_PASSWORD					(1<<13)

-#define FIELDFLAG_FILESELECT				(1<<20)

-#define FIELDFLAG_DONOTSPELLCHECK			(1<<22)

-#define FIELDFLAG_DONOTSCROLL				(1<<23)

-#define FIELDFLAG_COMB						(1<<24)

-#define FIELDFLAG_RICHTEXT					(1<<25)

-//for button fileds

-#define FIELDFLAG_NOTOGGLETOOFF				(1<<14)

-#define FIELDFLAG_RADIO						(1<<15)

-#define FIELDFLAG_PUSHBUTTON				(1<<16)

-#define FIELDFLAG_RADIOSINUNISON			(1<<25)

-//for choice fields

-#define FIELDFLAG_COMBO						(1<<17)

-#define FIELDFLAG_EDIT						(1<<18)

-#define FIELDFLAG_SORT						(1<<19)

-#define FIELDFLAG_MULTISELECT				(1<<21)

-#ifndef FIELDFLAG_DONOTSPELLCHECK

-#define FIELDFLAG_DONOTSPELLCHECK		(1<<22)

-#endif

-#define FIELDFLAG_COMMITONSELCHANGE			(1<<26)

-

-#define BBS_SOLID					0

-#define BBS_DASH					1

-#define BBS_BEVELED					2

-#define BBS_INSET					3

-#define BBS_UNDERLINE				4

-

-

-#endif

+// 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 _FSDK_COMMON_H_
+#define _FSDK_COMMON_H_
+
+#define BFFT_SIGNATURE				"Signature"
+
+//for all fields
+#define FIELDFLAG_READONLY					1
+#define FIELDFLAG_REQUIRED					2
+#define FIELDFLAG_NOEXPORT					4
+//for text fields
+#define FIELDFLAG_MULTILINE					(1<<12)
+#define FIELDFLAG_PASSWORD					(1<<13)
+#define FIELDFLAG_FILESELECT				(1<<20)
+#define FIELDFLAG_DONOTSPELLCHECK			(1<<22)
+#define FIELDFLAG_DONOTSCROLL				(1<<23)
+#define FIELDFLAG_COMB						(1<<24)
+#define FIELDFLAG_RICHTEXT					(1<<25)
+//for button fileds
+#define FIELDFLAG_NOTOGGLETOOFF				(1<<14)
+#define FIELDFLAG_RADIO						(1<<15)
+#define FIELDFLAG_PUSHBUTTON				(1<<16)
+#define FIELDFLAG_RADIOSINUNISON			(1<<25)
+//for choice fields
+#define FIELDFLAG_COMBO						(1<<17)
+#define FIELDFLAG_EDIT						(1<<18)
+#define FIELDFLAG_SORT						(1<<19)
+#define FIELDFLAG_MULTISELECT				(1<<21)
+#ifndef FIELDFLAG_DONOTSPELLCHECK
+#define FIELDFLAG_DONOTSPELLCHECK		(1<<22)
+#endif
+#define FIELDFLAG_COMMITONSELCHANGE			(1<<26)
+
+#define BBS_SOLID					0
+#define BBS_DASH					1
+#define BBS_BEVELED					2
+#define BBS_INSET					3
+#define BBS_UNDERLINE				4
+
+
+#endif
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index 5f9cde3..2bf4721 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -1,128 +1,128 @@
-// 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 _FPDFSDK_DEFINE_H

-#define _FPDFSDK_DEFINE_H

-

-#ifdef _WIN32

-#include <tchar.h>

-#include <math.h>

-#endif

-

-//#define API5

-#define API6

-#define  _FPDFAPI_ASYNC_PARSING_

-#define _FXSDK_OPENSOURCE_

-

-#ifdef _FPDFEMB_WCE_

-	#include "../../core/include/fpdfapi/fpdfapi.h" 

-	#include "../../core/include/fpdfapi/fpdf_parser.h" 

-	#include "../../core/include/fpdfapi/fpdf_module.h" 

-	#include "../../core/include/fpdfapi/fpdf_render.h" 

-	#include "../../core/include/fpdfapi/fpdf_pageobj.h" 

-	#include "../../core/include/fpdfapi/fpdf_serial.h" 

-

-	#include "../../core/include/fpdftext/fpdf_text.h"

-

-	#include "../../core/include/fxge/fx_ge_win32.h"

-	#include "../../core/include/fxge/fx_ge.h"

-

-	#include "../../core/include/fxcodec/fx_codec.h"

-

-	#include "../../core/include/fpdfdoc/fpdf_doc.h" 

-	#include "../../core/include/fpdfdoc/fpdf_vt.h" 

-

-	#include "../../core/include/fxcrt/fx_xml.h" 

-	#include "../../core/include/fxcrt/fx_crypt.h"

-

-#else

-	#ifdef API6

-		#include "../../core/include/fpdfapi/fpdf_parser.h" 

-		#include "../../core/include/fpdfapi/fpdfapi.h" 

-		#include "../../core/include/fpdfapi/fpdf_parser.h" 

-		#include "../../core/include/fpdfapi/fpdf_module.h" 

-		#include "../../core/include/fpdfapi/fpdf_render.h" 

-		#include "../../core/include/fpdfapi/fpdf_pageobj.h" 

-		#include "../../core/include/fpdfapi/fpdf_serial.h" 

-

-		#include "../../core/include/fpdftext/fpdf_text.h"

-

-		#include "../../core/include/fxge/fx_ge_win32.h"

-		#include "../../core/include/fxge/fx_ge.h"

-

-		#include "../../core/include/fxcodec/fx_codec.h"

-

-		#include "../../core/include/fpdfdoc/fpdf_doc.h" 

-		#include "../../core/include/fpdfdoc/fpdf_vt.h" 

-

-		#include "../../core/include/fxcrt/fx_xml.h" 

-	//	#include "../../core/include/fdrm/fx_crypt.h"

-		#ifdef _LICENSED_BUILD_

-			#include "../../cryptopp/Cryptlib.h"

-		#endif

-	#endif

-#endif

-

-

-#ifndef FX_GetAValue

-/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */

-#define FX_GetAValue(argb)			((argb & 0xFF000000) >> 24)

-#endif

-

-#ifndef FX_GetRValue

-/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */

-#define FX_GetRValue(argb)			((argb & 0x00FF0000) >> 16)

-#endif

-

-#ifndef FX_GetGValue

-/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */

-#define FX_GetGValue(argb)			((argb & 0x0000FF00) >> 8)

-#endif

-

-#ifndef FX_GetBValue

-/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */

-#define FX_GetBValue(argb)			(argb & 0x000000FF)

-#endif

-

-#ifndef FX_ARGBTOCOLORREF

-/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */

-#define FX_ARGBTOCOLORREF(argb)		((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))

-#endif

-

-#ifndef FX_COLORREFTOARGB

-/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */

-#define FX_COLORREFTOARGB(rgb)		((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))

-#endif

-

-typedef unsigned int FX_UINT;	

-

-#include "fpdfview.h"

-

-class CPDF_CustomAccess : public IFX_FileRead, public CFX_Object

-{

-public:

-	CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);

-	~CPDF_CustomAccess() {}

-

-	virtual CFX_ByteString GetFullPath() { return ""; }

-	virtual FX_FILESIZE	GetSize() { return m_FileAccess.m_FileLen; }

-

-	virtual FX_BOOL		GetByte(FX_DWORD pos, FX_BYTE& ch);

-	virtual FX_BOOL		GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);

-	virtual void		Release() { delete this; }

-

-	virtual FX_BOOL		ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);

-

-	FPDF_FILEACCESS		m_FileAccess;

-	FX_BYTE				m_Buffer[512];

-	FX_DWORD			m_BufferOffset;

-};

-

-void		FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);

-FPDF_BOOL	FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);

-

-

-#endif//_FPDFSDK_DEFINE_H

+// 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 _FPDFSDK_DEFINE_H
+#define _FPDFSDK_DEFINE_H
+
+#ifdef _WIN32
+#include <tchar.h>
+#include <math.h>
+#endif
+
+//#define API5
+#define API6
+#define  _FPDFAPI_ASYNC_PARSING_
+#define _FXSDK_OPENSOURCE_
+
+#ifdef _FPDFEMB_WCE_
+	#include "../../core/include/fpdfapi/fpdfapi.h" 
+	#include "../../core/include/fpdfapi/fpdf_parser.h" 
+	#include "../../core/include/fpdfapi/fpdf_module.h" 
+	#include "../../core/include/fpdfapi/fpdf_render.h" 
+	#include "../../core/include/fpdfapi/fpdf_pageobj.h" 
+	#include "../../core/include/fpdfapi/fpdf_serial.h" 
+
+	#include "../../core/include/fpdftext/fpdf_text.h"
+
+	#include "../../core/include/fxge/fx_ge_win32.h"
+	#include "../../core/include/fxge/fx_ge.h"
+
+	#include "../../core/include/fxcodec/fx_codec.h"
+
+	#include "../../core/include/fpdfdoc/fpdf_doc.h" 
+	#include "../../core/include/fpdfdoc/fpdf_vt.h" 
+
+	#include "../../core/include/fxcrt/fx_xml.h" 
+	#include "../../core/include/fxcrt/fx_crypt.h"
+
+#else
+	#ifdef API6
+		#include "../../core/include/fpdfapi/fpdf_parser.h" 
+		#include "../../core/include/fpdfapi/fpdfapi.h" 
+		#include "../../core/include/fpdfapi/fpdf_parser.h" 
+		#include "../../core/include/fpdfapi/fpdf_module.h" 
+		#include "../../core/include/fpdfapi/fpdf_render.h" 
+		#include "../../core/include/fpdfapi/fpdf_pageobj.h" 
+		#include "../../core/include/fpdfapi/fpdf_serial.h" 
+
+		#include "../../core/include/fpdftext/fpdf_text.h"
+
+		#include "../../core/include/fxge/fx_ge_win32.h"
+		#include "../../core/include/fxge/fx_ge.h"
+
+		#include "../../core/include/fxcodec/fx_codec.h"
+
+		#include "../../core/include/fpdfdoc/fpdf_doc.h" 
+		#include "../../core/include/fpdfdoc/fpdf_vt.h" 
+
+		#include "../../core/include/fxcrt/fx_xml.h" 
+	//	#include "../../core/include/fdrm/fx_crypt.h"
+		#ifdef _LICENSED_BUILD_
+			#include "../../cryptopp/Cryptlib.h"
+		#endif
+	#endif
+#endif
+
+
+#ifndef FX_GetAValue
+/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */
+#define FX_GetAValue(argb)			((argb & 0xFF000000) >> 24)
+#endif
+
+#ifndef FX_GetRValue
+/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */
+#define FX_GetRValue(argb)			((argb & 0x00FF0000) >> 16)
+#endif
+
+#ifndef FX_GetGValue
+/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */
+#define FX_GetGValue(argb)			((argb & 0x0000FF00) >> 8)
+#endif
+
+#ifndef FX_GetBValue
+/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */
+#define FX_GetBValue(argb)			(argb & 0x000000FF)
+#endif
+
+#ifndef FX_ARGBTOCOLORREF
+/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */
+#define FX_ARGBTOCOLORREF(argb)		((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))
+#endif
+
+#ifndef FX_COLORREFTOARGB
+/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */
+#define FX_COLORREFTOARGB(rgb)		((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))
+#endif
+
+typedef unsigned int FX_UINT;	
+
+#include "fpdfview.h"
+
+class CPDF_CustomAccess : public IFX_FileRead, public CFX_Object
+{
+public:
+	CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
+	~CPDF_CustomAccess() {}
+
+	virtual CFX_ByteString GetFullPath() { return ""; }
+	virtual FX_FILESIZE	GetSize() { return m_FileAccess.m_FileLen; }
+
+	virtual FX_BOOL		GetByte(FX_DWORD pos, FX_BYTE& ch);
+	virtual FX_BOOL		GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);
+	virtual void		Release() { delete this; }
+
+	virtual FX_BOOL		ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+
+	FPDF_FILEACCESS		m_FileAccess;
+	FX_BYTE				m_Buffer[512];
+	FX_DWORD			m_BufferOffset;
+};
+
+void		FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
+FPDF_BOOL	FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
+
+
+#endif//_FPDFSDK_DEFINE_H
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index 9933c41..bb25b35 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -1,615 +1,615 @@
-// 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 _FPDFSDK_MGR_H

-#define _FPDFSDK_MGR_H

-

-#include "fsdk_common.h"

-#include "fsdk_define.h"

-#include "fx_systemhandler.h"

-#include "fsdk_baseannot.h"

-#include "fsdk_baseform.h"

-#include "fpdfformfill.h"

-#include "fsdk_annothandler.h"

-#include "fsdk_actionhandler.h"

-

-//cross platform keycode and events define.

-#include "fpdf_fwlevent.h"

-

-

-class CPDFSDK_Document;

-class CPDFSDK_PageView;

-class CPDFSDK_Annot;

-class CFFL_IFormFiller;

-class CPDFSDK_Widget;

-class IFX_SystemHandler;

-class CPDFSDK_ActionHandler;

-class CJS_RuntimeFactory;

-

-#include "javascript/IJavaScript.h"

-

-class CPDFDoc_Environment

-{

-public:

-	CPDFDoc_Environment(CPDF_Document * pDoc);

-	~CPDFDoc_Environment();

-

-	int RegAppHandle(FPDF_FORMFILLINFO* pFFinfo);//{ m_pInfo  = pFFinfo; return TRUE;}

-

-	virtual void		Release()

-	{

-		if (m_pInfo && m_pInfo->Release)

-			m_pInfo->Release(m_pInfo);

-		delete this;

-	}

-

-	virtual void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, double bottom)

-	{

-		if (m_pInfo && m_pInfo->FFI_Invalidate) 

-		{

-			m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);

-		}

-	}

-	virtual void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom)

-	{

-		if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) 

-		{

-			m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);

-		}

-	}

-

-	virtual void FFI_SetCursor(int nCursorType)

-	{

-		if (m_pInfo && m_pInfo->FFI_SetCursor) 

-		{

-			m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);

-		}

-	}

-

-	virtual	int  FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc)

-	{

-		if (m_pInfo && m_pInfo->FFI_SetTimer) 

-		{

-			return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);

-		}

-		return -1;

-	}

-		

-	virtual void FFI_KillTimer(int nTimerID)

-	{

-		if (m_pInfo && m_pInfo->FFI_KillTimer) 

-		{

-			m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);

-		}

-	}

-	FX_SYSTEMTIME FFI_GetLocalTime()

-	{

-		FX_SYSTEMTIME fxtime;

-		if(m_pInfo && m_pInfo->FFI_GetLocalTime)

-		{

-			FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);

-			fxtime.wDay = systime.wDay;

-			fxtime.wDayOfWeek = systime.wDayOfWeek;

-			fxtime.wHour = systime.wHour;

-			fxtime.wMilliseconds = systime.wMilliseconds;

-			fxtime.wMinute = systime.wMinute;

-			fxtime.wMonth = systime.wMonth;

-			fxtime.wSecond = systime.wSecond;

-			fxtime.wYear = systime.wYear;

-		}

-		return fxtime;

-	}

-

-	virtual void FFI_OnChange()

-	{

-		if(m_pInfo && m_pInfo->FFI_OnChange)

-		{

-			m_pInfo->FFI_OnChange(m_pInfo);

-		}

-	}

-

-	virtual	FX_BOOL	FFI_IsSHIFTKeyDown(FX_DWORD nFlag)

-	{

-		

-		return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;

-	}

-	virtual	FX_BOOL	FFI_IsCTRLKeyDown(FX_DWORD nFlag)

-	{

-

-		return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;

-	}

-	virtual	FX_BOOL	FFI_IsALTKeyDown(FX_DWORD nFlag)

-	{

-

-		return (nFlag & FWL_EVENTFLAG_AltKey) != 0;

-	}

-	virtual	FX_BOOL	FFI_IsINSERTKeyDown(FX_DWORD nFlag)

-	{

-		return FALSE;

-	}

-

-	virtual int JS_appAlert(FX_LPCWSTR Msg, FX_LPCWSTR Title, FX_UINT Type, FX_UINT Icon)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)

-		{

-			CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();

-			CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();

-			FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());

-			FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());

-			int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, pMsg, pTitle, Type, Icon);

-			bsMsg.ReleaseBuffer();

-			bsTitle.ReleaseBuffer();

-			return ret;

-		}

-		return -1;

-	}

-

-	virtual int JS_appResponse(FX_LPCWSTR Question, FX_LPCWSTR Title, FX_LPCWSTR Default, FX_LPCWSTR cLabel, FPDF_BOOL bPassword, void* response, int length)

-	{

-		if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_response)

-		{

-			CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();

-			CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();

-			CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();

-			CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();

-			FPDF_WIDESTRING pQuestion = (FPDF_WIDESTRING)bsQuestion.GetBuffer(bsQuestion.GetLength());

-			FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());

-			FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.GetBuffer(bsDefault.GetLength());

-			FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuffer(bsLabel.GetLength());

-			int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform, pQuestion, pTitle, 

-				pDefault, pLabel, bPassword, response, length);

-			bsQuestion.ReleaseBuffer();

-			bsTitle.ReleaseBuffer();

-			bsDefault.ReleaseBuffer();

-			bsLabel.ReleaseBuffer();

-			return ret;

-		}

-		return -1;

-	}

-

-	virtual void JS_appBeep(int nType)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep)

-		{

-			m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);

-		}

-	}

-

-	virtual CFX_WideString JS_fieldBrowse()

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Field_browse)

-		{

-			int nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, NULL, 0);

-			if(nLen <= 0)

-				return L"";

-			char* pbuff = new char[nLen];

-			if(pbuff)

-				memset(pbuff, 0, nLen);

-			else	

-				return L"";

-			nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, pbuff, nLen);

-			CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);

-			CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);

-			delete[] pbuff;

-			return wsRet;

-		}

-		return L"";

-	}

-

-	CFX_WideString JS_docGetFilePath()

-	{		

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_getFilePath)

-		{

-			int nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, NULL, 0);

-			if(nLen <= 0)

-				return L"";

-			char* pbuff = new char[nLen];

-			if(pbuff)

-				memset(pbuff, 0, nLen);

-			else

-				return L"";

-			nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, pbuff, nLen);

-			CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);

-			CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);

-			delete[] pbuff;

-			return wsRet;

-		}

-		return L"";

-	}

-

-	void JS_docSubmitForm(void* formData, int length, FX_LPCWSTR URL)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_submitForm)

-		{

-			CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();

-			FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestination.GetBuffer(bsDestination.GetLength());

-			m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, length, pDestination);

-			bsDestination.ReleaseBuffer();

-		}

-	}

-

-	void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,FX_LPCWSTR To, FX_LPCWSTR Subject, FX_LPCWSTR CC, FX_LPCWSTR BCC, FX_LPCWSTR Msg)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_mail)

-		{

-			CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();

-			CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_Encode();

-			CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();

-			CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();

-			CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();

-			FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());

-			FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());

-			FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());

-			FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());

-			FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());

-			m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject,

-				pCC, pBcc, pMsg);

-			bsTo.ReleaseBuffer();

-			bsCC.ReleaseBuffer();

-			bsBcc.ReleaseBuffer();

-			bsSubject.ReleaseBuffer();

-			bsMsg.ReleaseBuffer();

-		}

-	}

-	CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameInit)

-	{

-		//to do....

-		return L"";

-// 		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_browseForDoc)

-// 		{

-// 			CFX_ByteString bsFilenameInit = CFX_WideString(cFilenameInit).UTF16LE_Encode();

-// 			FPDF_WIDESTRING pFileNameInit = (FPDF_WIDESTRING)bsFilenameInit.GetBuffer(bsFilenameInit.GetLength());

-// 

-// 			m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsPlatform, pFileNameInit);

-// 			bsFilenameInit.ReleaseBuffer();

-// 		}

-	}

-

-	void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print)

-		{

-			m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations);

-		}

-	}

-	void JS_docgotoPage(int nPageNum)

-	{

-		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_gotoPage)

-		{

-			m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);

-		}

-	}

-

-	virtual FPDF_PAGE	FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex)

-	{

-		if(m_pInfo && m_pInfo->FFI_GetPage)

-		{

-			return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);

-		}

-		return NULL;

-	}

-

-	virtual FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document)

-	{

-		if(m_pInfo && m_pInfo->FFI_GetCurrentPage)

-		{

-			return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);

-		}

-		return NULL;

-	}

-

-	int 	FFI_GetRotation(FPDF_PAGE page)

-	{

-		if(m_pInfo && m_pInfo->FFI_GetRotation)

-		{

-			return m_pInfo->FFI_GetRotation(m_pInfo, page);

-		}

-		return 0;

-	}

-	void	FFI_ExecuteNamedAction(FX_LPCSTR namedAction)

-	{

-		if(m_pInfo && m_pInfo->FFI_ExecuteNamedAction)

-		{

-			m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);

-		}

-	}

-	void	FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus)

-	{

-		if(m_pInfo && m_pInfo->FFI_SetTextFieldFocus)

-		{

-			m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);

-		}

-	}

-

-	void	FFI_DoURIAction(FX_LPCSTR bsURI)

-	{

-		if(m_pInfo && m_pInfo->FFI_DoURIAction)

-		{

-			m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);

-		}

-	}

-

-	void	FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray)

-	{

-		if(m_pInfo && m_pInfo->FFI_DoGoToAction)

-		{

-			m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray);

-		}

-	}

-

-public:

-	FX_BOOL				IsJSInitiated();

-

-public:	

-	void				SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;}

-	CPDFSDK_Document*	GetCurrentDoc();

-	CPDF_Document*		GetPDFDocument() {return m_pPDFDoc;}

-// 	CPDFSDK_Document*   GetDocument(int nIndex);

-// 	int					CountDocuments() {return m_docMap.GetCount();}

-

-	CPDFSDK_Document*		OpenDocument(CFX_WideString &fileName);

-	CPDFSDK_Document*		OpenMemPDFDoc(CPDF_Document* pNewDoc, CFX_WideString &fileName);

-	FX_BOOL					OpenURL(CFX_WideString &filePath);

-	

-

-	CFX_ByteString		GetAppName() {return "";}

-

-	CFFL_IFormFiller*	GetIFormFiller();

-	IFX_SystemHandler*	GetSysHandler() {return m_pSysHandler;}

-

-public:

-	CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr();

-	IFXJS_Runtime*	GetJSRuntime();

-	CPDFSDK_ActionHandler* GetActionHander();

-private:

-	CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;

-	CPDFSDK_ActionHandler*	m_pActionHandler;

-	IFXJS_Runtime*	m_pJSRuntime;

-public:

-	FPDF_FORMFILLINFO* GetFormFillInfo() {return m_pInfo;}

-private:

-	FPDF_FORMFILLINFO*	m_pInfo;

-//	CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docMap;

-	CPDFSDK_Document* m_pSDKDoc;

-	CPDF_Document* m_pPDFDoc;

-

-	CFFL_IFormFiller* m_pIFormFiller;

-	IFX_SystemHandler* m_pSysHandler;

-

-public:

-	CJS_RuntimeFactory*  m_pJSRuntimeFactory;

-};

-

-

-

-// class CFX_App

-// {

-// public:

-// 	CFX_App():m_pCurDoc(NULL) {}

-// 	void SetAt(CPDF_Document* pPDFDoc, CPDFSDK_Document* pFXDoc);

-// 	CPDFSDK_Document* GetAt(CPDF_Document* pPDFDoc);

-// public:

-// 	void SetCurrentDocument(CPDFSDK_Document* pFXDoc) {m_pCurDoc = pFXDoc;}

-// 	CPDFSDK_Document* GetCurrentDocument() {return m_pCurDoc;}

-// private:

-// 	CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docArray;

-// 	CPDFSDK_Document* m_pCurDoc;

-// };

-class CPDFSDK_InterForm;

-class CPDFSDK_Document

-{

-public:

-	CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv);

-	~CPDFSDK_Document();

-public:

-	CPDFSDK_InterForm*		GetInterForm() ;

-	CPDF_Document*			GetDocument() {return m_pDoc;}

-

-public:

-	void					InitPageView();

-	void					AddPageView(CPDF_Page* pPDFPage, CPDFSDK_PageView* pPageView);

-	CPDFSDK_PageView*		GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE);

-	CPDFSDK_PageView*		GetPageView(int nIndex);

-	CPDFSDK_PageView*		GetCurrentView();

-	void					ReMovePageView(CPDF_Page* pPDFPage);

-	void					UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);

-

-	CPDFSDK_Annot*			GetFocusAnnot();//{return NULL;}

-

-	IFXJS_Runtime *			GetJsRuntime();

-	

-	FX_BOOL					SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);//{return FALSE;}

-	FX_BOOL					KillFocusAnnot(FX_UINT nFlag = 0);

-

-	FX_BOOL					ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc);

-	FX_BOOL					InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);

-	FX_BOOL					DeletePages(int nStart, int nCount);

-	FX_BOOL					ReplacePages(int nPage, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);

-

-	void					OnCloseDocument();

-

-	int						GetPageCount() {return m_pDoc->GetPageCount();}

-	FX_BOOL					GetPermissions(int nFlag);

-	FX_BOOL					GetChangeMark() {return m_bChangeMask;}

-	void					SetChangeMark() {m_bChangeMask = TRUE;}

-	void					ClearChangeMark() {m_bChangeMask= FALSE;}

-//	FX_BOOL					GetChangeMark(){return FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;}	

-//	void                    ClearChangeMark(){}

-	CFX_WideString			GetPath() ;

-	CPDF_Page*				GetPage(int nIndex);

-	CPDFDoc_Environment *	GetEnv() {return m_pEnv; }

-	void				    ProcJavascriptFun();

-	FX_BOOL					ProcOpenAction();

-	CPDF_OCContext*			GetOCContext();

-private:

-	//CFX_ArrayTemplate<CPDFSDK_PageView*> m_pageArray;

-	CFX_MapPtrTemplate<CPDF_Page*, CPDFSDK_PageView*> m_pageMap;

-	CPDF_Document*			m_pDoc;

-

-	CPDFSDK_InterForm*		m_pInterForm;

-	CPDFSDK_Annot*			m_pFocusAnnot;

-	CPDFDoc_Environment *	m_pEnv;

-	CPDF_OCContext *		m_pOccontent;

-	FX_BOOL					m_bChangeMask;

-};

-

-class CPDFSDK_PageView

-{

-public:

-	CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page);

-	~CPDFSDK_PageView();

-public:

-	virtual	void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions) ;

-public:

-	CPDF_Annot*						GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);

-	CPDFSDK_Annot*					GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);

-	CPDF_Annot*						GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);

-	CPDFSDK_Annot*					GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);

-	CPDFSDK_Annot*					GetFocusAnnot() ;

-	void							SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);}

-	FX_BOOL							KillFocusAnnot(FX_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);}

-	FX_BOOL							Annot_HasAppearance(CPDF_Annot* pAnnot);

-

-	CPDFSDK_Annot*					AddAnnot(CPDF_Dictionary * pDict);

-	CPDFSDK_Annot*					AddAnnot(FX_LPCSTR lpSubType,CPDF_Dictionary * pDict);

-	CPDFSDK_Annot*					AddAnnot(CPDF_Annot * pPDFAnnot);

-	FX_BOOL							DeleteAnnot(CPDFSDK_Annot* pAnnot);							

-	

-	int								CountAnnots();

-	CPDFSDK_Annot*					GetAnnot(int nIndex);

-	CPDFSDK_Annot*				    GetAnnotByDict(CPDF_Dictionary * pDict);

-	CPDF_Page*						GetPDFPage(){return m_page;}

-	CPDF_Document*					GetPDFDocument();

-	CPDFSDK_Document*				GetSDKDocument() {return m_pSDKDoc;}	

-public:

-	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag);

-	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag);

-	virtual FX_BOOL					OnChar(int nChar, FX_UINT nFlag);

-	virtual FX_BOOL					OnKeyDown(int nKeyCode, int nFlag);

-	virtual FX_BOOL					OnKeyUp(int nKeyCode, int nFlag);

-

-	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, int nFlag);

-	virtual FX_BOOL					OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag);

-	virtual FX_BOOL					IsValidAnnot(FX_LPVOID p);

-public:

-	virtual void					GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_curMatrix;}

-	virtual void					UpdateRects(CFX_RectArray& rects);

-	void							UpdateView(CPDFSDK_Annot* pAnnot);

-	CFX_PtrArray*					GetAnnotList(){ return &m_fxAnnotArray; }

-

-public:

-	virtual int						GetPageIndex();

-	void							LoadFXAnnots();

-private:

-	CPDF_Matrix m_curMatrix;

-

-private:

-	void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widget* pWidget);

-

-private:

-	CPDF_Page* m_page;

-	CPDF_AnnotList* m_pAnnotList;

-

-	//CPDFSDK_Annot* m_pFocusAnnot;

-	CFX_PtrArray  m_fxAnnotArray;

-

-	CPDFSDK_Document* m_pSDKDoc;

-private:

-	CPDFSDK_Widget* m_CaptureWidget;

-	FX_BOOL m_bEnterWidget;

-	FX_BOOL m_bExitWidget;

-	FX_BOOL m_bOnWidget;

-public:

-	void SetValid(FX_BOOL bValid) {m_bValid = bValid;}

-	FX_BOOL IsValid() {return m_bValid;}

-private:

-	FX_BOOL m_bValid;

-};

-

-

-template<class TYPE>

-class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE>

-{

-public: 

-	CGW_ArrayTemplate(){}

-	virtual ~CGW_ArrayTemplate(){}

-	

-	typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);

-	

-	void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE)

-	{

-		int nSize = this->GetSize();

-		QuickSort(0, nSize -1, bAscent, pCompare);

-	}

-	

-private:

-	void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare)

-	{

-		if (nStartPos >= nStopPos) return;

-		

-		if ((nStopPos - nStartPos) == 1)

-		{

-			TYPE Value1 = this->GetAt(nStartPos);

-			TYPE Value2 = this->GetAt(nStopPos);

-			

-			int iGreate = (*pCompare)(Value1, Value2);

-			if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))

-			{

-				this->SetAt(nStartPos, Value2);

-				this->SetAt(nStopPos, Value1);

-			}

-			return;

-		}

-		

-		FX_UINT m = (nStartPos + nStopPos) / 2;

-		FX_UINT i = nStartPos;

-		

-		TYPE Value = this->GetAt(m);

-		

-		while (i < m)

-		{

-			TYPE temp = this->GetAt(i);

-			

-			int iGreate = (*pCompare)(temp, Value);

-			if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))

-			{

-				this->InsertAt(m+1, temp);

-				this->RemoveAt(i);

-				m--;

-			}

-			else

-			{

-				i++;

-			}

-		}

-		

-		FX_UINT j = nStopPos;

-		

-		while (j > m)

-		{

-			TYPE temp = this->GetAt(j);

-			

-			int iGreate = (*pCompare)(temp, Value);

-			if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0))

-			{

-				this->RemoveAt(j);

-				this->InsertAt(m, temp);

-				m++;

-			}

-			else

-			{

-				j--;

-			}

-		}

-		

-		if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare);

-		if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare);

-	}

-};

-

-

-#endif //_FPDFSDK_MGR_H

-

+// 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 _FPDFSDK_MGR_H
+#define _FPDFSDK_MGR_H
+
+#include "fsdk_common.h"
+#include "fsdk_define.h"
+#include "fx_systemhandler.h"
+#include "fsdk_baseannot.h"
+#include "fsdk_baseform.h"
+#include "fpdfformfill.h"
+#include "fsdk_annothandler.h"
+#include "fsdk_actionhandler.h"
+
+//cross platform keycode and events define.
+#include "fpdf_fwlevent.h"
+
+
+class CPDFSDK_Document;
+class CPDFSDK_PageView;
+class CPDFSDK_Annot;
+class CFFL_IFormFiller;
+class CPDFSDK_Widget;
+class IFX_SystemHandler;
+class CPDFSDK_ActionHandler;
+class CJS_RuntimeFactory;
+
+#include "javascript/IJavaScript.h"
+
+class CPDFDoc_Environment
+{
+public:
+	CPDFDoc_Environment(CPDF_Document * pDoc);
+	~CPDFDoc_Environment();
+
+	int RegAppHandle(FPDF_FORMFILLINFO* pFFinfo);//{ m_pInfo  = pFFinfo; return TRUE;}
+
+	virtual void		Release()
+	{
+		if (m_pInfo && m_pInfo->Release)
+			m_pInfo->Release(m_pInfo);
+		delete this;
+	}
+
+	virtual void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, double bottom)
+	{
+		if (m_pInfo && m_pInfo->FFI_Invalidate) 
+		{
+			m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
+		}
+	}
+	virtual void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom)
+	{
+		if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) 
+		{
+			m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);
+		}
+	}
+
+	virtual void FFI_SetCursor(int nCursorType)
+	{
+		if (m_pInfo && m_pInfo->FFI_SetCursor) 
+		{
+			m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);
+		}
+	}
+
+	virtual	int  FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc)
+	{
+		if (m_pInfo && m_pInfo->FFI_SetTimer) 
+		{
+			return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);
+		}
+		return -1;
+	}
+		
+	virtual void FFI_KillTimer(int nTimerID)
+	{
+		if (m_pInfo && m_pInfo->FFI_KillTimer) 
+		{
+			m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);
+		}
+	}
+	FX_SYSTEMTIME FFI_GetLocalTime()
+	{
+		FX_SYSTEMTIME fxtime;
+		if(m_pInfo && m_pInfo->FFI_GetLocalTime)
+		{
+			FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);
+			fxtime.wDay = systime.wDay;
+			fxtime.wDayOfWeek = systime.wDayOfWeek;
+			fxtime.wHour = systime.wHour;
+			fxtime.wMilliseconds = systime.wMilliseconds;
+			fxtime.wMinute = systime.wMinute;
+			fxtime.wMonth = systime.wMonth;
+			fxtime.wSecond = systime.wSecond;
+			fxtime.wYear = systime.wYear;
+		}
+		return fxtime;
+	}
+
+	virtual void FFI_OnChange()
+	{
+		if(m_pInfo && m_pInfo->FFI_OnChange)
+		{
+			m_pInfo->FFI_OnChange(m_pInfo);
+		}
+	}
+
+	virtual	FX_BOOL	FFI_IsSHIFTKeyDown(FX_DWORD nFlag)
+	{
+		
+		return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
+	}
+	virtual	FX_BOOL	FFI_IsCTRLKeyDown(FX_DWORD nFlag)
+	{
+
+		return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
+	}
+	virtual	FX_BOOL	FFI_IsALTKeyDown(FX_DWORD nFlag)
+	{
+
+		return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
+	}
+	virtual	FX_BOOL	FFI_IsINSERTKeyDown(FX_DWORD nFlag)
+	{
+		return FALSE;
+	}
+
+	virtual int JS_appAlert(FX_LPCWSTR Msg, FX_LPCWSTR Title, FX_UINT Type, FX_UINT Icon)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)
+		{
+			CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
+			CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
+			FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
+			FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
+			int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, pMsg, pTitle, Type, Icon);
+			bsMsg.ReleaseBuffer();
+			bsTitle.ReleaseBuffer();
+			return ret;
+		}
+		return -1;
+	}
+
+	virtual int JS_appResponse(FX_LPCWSTR Question, FX_LPCWSTR Title, FX_LPCWSTR Default, FX_LPCWSTR cLabel, FPDF_BOOL bPassword, void* response, int length)
+	{
+		if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_response)
+		{
+			CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();
+			CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
+			CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();
+			CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();
+			FPDF_WIDESTRING pQuestion = (FPDF_WIDESTRING)bsQuestion.GetBuffer(bsQuestion.GetLength());
+			FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
+			FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.GetBuffer(bsDefault.GetLength());
+			FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuffer(bsLabel.GetLength());
+			int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform, pQuestion, pTitle, 
+				pDefault, pLabel, bPassword, response, length);
+			bsQuestion.ReleaseBuffer();
+			bsTitle.ReleaseBuffer();
+			bsDefault.ReleaseBuffer();
+			bsLabel.ReleaseBuffer();
+			return ret;
+		}
+		return -1;
+	}
+
+	virtual void JS_appBeep(int nType)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep)
+		{
+			m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
+		}
+	}
+
+	virtual CFX_WideString JS_fieldBrowse()
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Field_browse)
+		{
+			int nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, NULL, 0);
+			if(nLen <= 0)
+				return L"";
+			char* pbuff = new char[nLen];
+			if(pbuff)
+				memset(pbuff, 0, nLen);
+			else	
+				return L"";
+			nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, pbuff, nLen);
+			CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);
+			CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
+			delete[] pbuff;
+			return wsRet;
+		}
+		return L"";
+	}
+
+	CFX_WideString JS_docGetFilePath()
+	{		
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_getFilePath)
+		{
+			int nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, NULL, 0);
+			if(nLen <= 0)
+				return L"";
+			char* pbuff = new char[nLen];
+			if(pbuff)
+				memset(pbuff, 0, nLen);
+			else
+				return L"";
+			nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, pbuff, nLen);
+			CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);
+			CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
+			delete[] pbuff;
+			return wsRet;
+		}
+		return L"";
+	}
+
+	void JS_docSubmitForm(void* formData, int length, FX_LPCWSTR URL)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_submitForm)
+		{
+			CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
+			FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestination.GetBuffer(bsDestination.GetLength());
+			m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, length, pDestination);
+			bsDestination.ReleaseBuffer();
+		}
+	}
+
+	void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,FX_LPCWSTR To, FX_LPCWSTR Subject, FX_LPCWSTR CC, FX_LPCWSTR BCC, FX_LPCWSTR Msg)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_mail)
+		{
+			CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
+			CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_Encode();
+			CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
+			CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
+			CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
+			FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
+			FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
+			FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
+			FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
+			FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
+			m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject,
+				pCC, pBcc, pMsg);
+			bsTo.ReleaseBuffer();
+			bsCC.ReleaseBuffer();
+			bsBcc.ReleaseBuffer();
+			bsSubject.ReleaseBuffer();
+			bsMsg.ReleaseBuffer();
+		}
+	}
+	CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameInit)
+	{
+		//to do....
+		return L"";
+// 		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_browseForDoc)
+// 		{
+// 			CFX_ByteString bsFilenameInit = CFX_WideString(cFilenameInit).UTF16LE_Encode();
+// 			FPDF_WIDESTRING pFileNameInit = (FPDF_WIDESTRING)bsFilenameInit.GetBuffer(bsFilenameInit.GetLength());
+// 
+// 			m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsPlatform, pFileNameInit);
+// 			bsFilenameInit.ReleaseBuffer();
+// 		}
+	}
+
+	void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print)
+		{
+			m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations);
+		}
+	}
+	void JS_docgotoPage(int nPageNum)
+	{
+		if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_gotoPage)
+		{
+			m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
+		}
+	}
+
+	virtual FPDF_PAGE	FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex)
+	{
+		if(m_pInfo && m_pInfo->FFI_GetPage)
+		{
+			return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
+		}
+		return NULL;
+	}
+
+	virtual FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document)
+	{
+		if(m_pInfo && m_pInfo->FFI_GetCurrentPage)
+		{
+			return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
+		}
+		return NULL;
+	}
+
+	int 	FFI_GetRotation(FPDF_PAGE page)
+	{
+		if(m_pInfo && m_pInfo->FFI_GetRotation)
+		{
+			return m_pInfo->FFI_GetRotation(m_pInfo, page);
+		}
+		return 0;
+	}
+	void	FFI_ExecuteNamedAction(FX_LPCSTR namedAction)
+	{
+		if(m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
+		{
+			m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
+		}
+	}
+	void	FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus)
+	{
+		if(m_pInfo && m_pInfo->FFI_SetTextFieldFocus)
+		{
+			m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
+		}
+	}
+
+	void	FFI_DoURIAction(FX_LPCSTR bsURI)
+	{
+		if(m_pInfo && m_pInfo->FFI_DoURIAction)
+		{
+			m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
+		}
+	}
+
+	void	FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray)
+	{
+		if(m_pInfo && m_pInfo->FFI_DoGoToAction)
+		{
+			m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray);
+		}
+	}
+
+public:
+	FX_BOOL				IsJSInitiated();
+
+public:	
+	void				SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;}
+	CPDFSDK_Document*	GetCurrentDoc();
+	CPDF_Document*		GetPDFDocument() {return m_pPDFDoc;}
+// 	CPDFSDK_Document*   GetDocument(int nIndex);
+// 	int					CountDocuments() {return m_docMap.GetCount();}
+
+	CPDFSDK_Document*		OpenDocument(CFX_WideString &fileName);
+	CPDFSDK_Document*		OpenMemPDFDoc(CPDF_Document* pNewDoc, CFX_WideString &fileName);
+	FX_BOOL					OpenURL(CFX_WideString &filePath);
+	
+
+	CFX_ByteString		GetAppName() {return "";}
+
+	CFFL_IFormFiller*	GetIFormFiller();
+	IFX_SystemHandler*	GetSysHandler() {return m_pSysHandler;}
+
+public:
+	CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr();
+	IFXJS_Runtime*	GetJSRuntime();
+	CPDFSDK_ActionHandler* GetActionHander();
+private:
+	CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;
+	CPDFSDK_ActionHandler*	m_pActionHandler;
+	IFXJS_Runtime*	m_pJSRuntime;
+public:
+	FPDF_FORMFILLINFO* GetFormFillInfo() {return m_pInfo;}
+private:
+	FPDF_FORMFILLINFO*	m_pInfo;
+//	CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docMap;
+	CPDFSDK_Document* m_pSDKDoc;
+	CPDF_Document* m_pPDFDoc;
+
+	CFFL_IFormFiller* m_pIFormFiller;
+	IFX_SystemHandler* m_pSysHandler;
+
+public:
+	CJS_RuntimeFactory*  m_pJSRuntimeFactory;
+};
+
+
+
+// class CFX_App
+// {
+// public:
+// 	CFX_App():m_pCurDoc(NULL) {}
+// 	void SetAt(CPDF_Document* pPDFDoc, CPDFSDK_Document* pFXDoc);
+// 	CPDFSDK_Document* GetAt(CPDF_Document* pPDFDoc);
+// public:
+// 	void SetCurrentDocument(CPDFSDK_Document* pFXDoc) {m_pCurDoc = pFXDoc;}
+// 	CPDFSDK_Document* GetCurrentDocument() {return m_pCurDoc;}
+// private:
+// 	CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docArray;
+// 	CPDFSDK_Document* m_pCurDoc;
+// };
+class CPDFSDK_InterForm;
+class CPDFSDK_Document
+{
+public:
+	CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv);
+	~CPDFSDK_Document();
+public:
+	CPDFSDK_InterForm*		GetInterForm() ;
+	CPDF_Document*			GetDocument() {return m_pDoc;}
+
+public:
+	void					InitPageView();
+	void					AddPageView(CPDF_Page* pPDFPage, CPDFSDK_PageView* pPageView);
+	CPDFSDK_PageView*		GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE);
+	CPDFSDK_PageView*		GetPageView(int nIndex);
+	CPDFSDK_PageView*		GetCurrentView();
+	void					ReMovePageView(CPDF_Page* pPDFPage);
+	void					UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
+
+	CPDFSDK_Annot*			GetFocusAnnot();//{return NULL;}
+
+	IFXJS_Runtime *			GetJsRuntime();
+	
+	FX_BOOL					SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);//{return FALSE;}
+	FX_BOOL					KillFocusAnnot(FX_UINT nFlag = 0);
+
+	FX_BOOL					ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc);
+	FX_BOOL					InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);
+	FX_BOOL					DeletePages(int nStart, int nCount);
+	FX_BOOL					ReplacePages(int nPage, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);
+
+	void					OnCloseDocument();
+
+	int						GetPageCount() {return m_pDoc->GetPageCount();}
+	FX_BOOL					GetPermissions(int nFlag);
+	FX_BOOL					GetChangeMark() {return m_bChangeMask;}
+	void					SetChangeMark() {m_bChangeMask = TRUE;}
+	void					ClearChangeMark() {m_bChangeMask= FALSE;}
+//	FX_BOOL					GetChangeMark(){return FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;}	
+//	void                    ClearChangeMark(){}
+	CFX_WideString			GetPath() ;
+	CPDF_Page*				GetPage(int nIndex);
+	CPDFDoc_Environment *	GetEnv() {return m_pEnv; }
+	void				    ProcJavascriptFun();
+	FX_BOOL					ProcOpenAction();
+	CPDF_OCContext*			GetOCContext();
+private:
+	//CFX_ArrayTemplate<CPDFSDK_PageView*> m_pageArray;
+	CFX_MapPtrTemplate<CPDF_Page*, CPDFSDK_PageView*> m_pageMap;
+	CPDF_Document*			m_pDoc;
+
+	CPDFSDK_InterForm*		m_pInterForm;
+	CPDFSDK_Annot*			m_pFocusAnnot;
+	CPDFDoc_Environment *	m_pEnv;
+	CPDF_OCContext *		m_pOccontent;
+	FX_BOOL					m_bChangeMask;
+};
+
+class CPDFSDK_PageView
+{
+public:
+	CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page);
+	~CPDFSDK_PageView();
+public:
+	virtual	void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions) ;
+public:
+	CPDF_Annot*						GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+	CPDFSDK_Annot*					GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+	CPDF_Annot*						GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+	CPDFSDK_Annot*					GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+	CPDFSDK_Annot*					GetFocusAnnot() ;
+	void							SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);}
+	FX_BOOL							KillFocusAnnot(FX_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);}
+	FX_BOOL							Annot_HasAppearance(CPDF_Annot* pAnnot);
+
+	CPDFSDK_Annot*					AddAnnot(CPDF_Dictionary * pDict);
+	CPDFSDK_Annot*					AddAnnot(FX_LPCSTR lpSubType,CPDF_Dictionary * pDict);
+	CPDFSDK_Annot*					AddAnnot(CPDF_Annot * pPDFAnnot);
+	FX_BOOL							DeleteAnnot(CPDFSDK_Annot* pAnnot);							
+	
+	int								CountAnnots();
+	CPDFSDK_Annot*					GetAnnot(int nIndex);
+	CPDFSDK_Annot*				    GetAnnotByDict(CPDF_Dictionary * pDict);
+	CPDF_Page*						GetPDFPage(){return m_page;}
+	CPDF_Document*					GetPDFDocument();
+	CPDFSDK_Document*				GetSDKDocument() {return m_pSDKDoc;}	
+public:
+	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag);
+	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag);
+	virtual FX_BOOL					OnChar(int nChar, FX_UINT nFlag);
+	virtual FX_BOOL					OnKeyDown(int nKeyCode, int nFlag);
+	virtual FX_BOOL					OnKeyUp(int nKeyCode, int nFlag);
+
+	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, int nFlag);
+	virtual FX_BOOL					OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag);
+	virtual FX_BOOL					IsValidAnnot(FX_LPVOID p);
+public:
+	virtual void					GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_curMatrix;}
+	virtual void					UpdateRects(CFX_RectArray& rects);
+	void							UpdateView(CPDFSDK_Annot* pAnnot);
+	CFX_PtrArray*					GetAnnotList(){ return &m_fxAnnotArray; }
+
+public:
+	virtual int						GetPageIndex();
+	void							LoadFXAnnots();
+private:
+	CPDF_Matrix m_curMatrix;
+
+private:
+	void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widget* pWidget);
+
+private:
+	CPDF_Page* m_page;
+	CPDF_AnnotList* m_pAnnotList;
+
+	//CPDFSDK_Annot* m_pFocusAnnot;
+	CFX_PtrArray  m_fxAnnotArray;
+
+	CPDFSDK_Document* m_pSDKDoc;
+private:
+	CPDFSDK_Widget* m_CaptureWidget;
+	FX_BOOL m_bEnterWidget;
+	FX_BOOL m_bExitWidget;
+	FX_BOOL m_bOnWidget;
+public:
+	void SetValid(FX_BOOL bValid) {m_bValid = bValid;}
+	FX_BOOL IsValid() {return m_bValid;}
+private:
+	FX_BOOL m_bValid;
+};
+
+
+template<class TYPE>
+class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
+{
+public: 
+	CGW_ArrayTemplate(){}
+	virtual ~CGW_ArrayTemplate(){}
+	
+	typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
+	
+	void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE)
+	{
+		int nSize = this->GetSize();
+		QuickSort(0, nSize -1, bAscent, pCompare);
+	}
+	
+private:
+	void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare)
+	{
+		if (nStartPos >= nStopPos) return;
+		
+		if ((nStopPos - nStartPos) == 1)
+		{
+			TYPE Value1 = this->GetAt(nStartPos);
+			TYPE Value2 = this->GetAt(nStopPos);
+			
+			int iGreate = (*pCompare)(Value1, Value2);
+			if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
+			{
+				this->SetAt(nStartPos, Value2);
+				this->SetAt(nStopPos, Value1);
+			}
+			return;
+		}
+		
+		FX_UINT m = (nStartPos + nStopPos) / 2;
+		FX_UINT i = nStartPos;
+		
+		TYPE Value = this->GetAt(m);
+		
+		while (i < m)
+		{
+			TYPE temp = this->GetAt(i);
+			
+			int iGreate = (*pCompare)(temp, Value);
+			if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
+			{
+				this->InsertAt(m+1, temp);
+				this->RemoveAt(i);
+				m--;
+			}
+			else
+			{
+				i++;
+			}
+		}
+		
+		FX_UINT j = nStopPos;
+		
+		while (j > m)
+		{
+			TYPE temp = this->GetAt(j);
+			
+			int iGreate = (*pCompare)(temp, Value);
+			if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0))
+			{
+				this->RemoveAt(j);
+				this->InsertAt(m, temp);
+				m++;
+			}
+			else
+			{
+				j--;
+			}
+		}
+		
+		if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare);
+		if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare);
+	}
+};
+
+
+#endif //_FPDFSDK_MGR_H
+
diff --git a/fpdfsdk/include/fsdk_rendercontext.h b/fpdfsdk/include/fsdk_rendercontext.h
index c33dfdd..51c37b3 100644
--- a/fpdfsdk/include/fsdk_rendercontext.h
+++ b/fpdfsdk/include/fsdk_rendercontext.h
@@ -1,41 +1,41 @@
-// 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 _RENDERCONTENT_H_

-#define _RENDERCONTENT_H_

-#include "../include/fsdk_define.h"

-#include "../include/fpdf_progressive.h"

-

-// Everything about rendering is put here: for OOM recovery

-class CRenderContext : public CFX_Object

-{

-public:

-	CRenderContext() { Clear(); }

-	~CRenderContext();

-	

-	void Clear();

-	

-	CFX_RenderDevice*		m_pDevice;

-	CPDF_RenderContext*		m_pContext;

-	CPDF_ProgressiveRenderer*	m_pRenderer;

-	CPDF_AnnotList*			m_pAnnots;

-	CPDF_RenderOptions*		m_pOptions;

-#ifdef _WIN32_WCE

-	CFX_DIBitmap*	m_pBitmap;

-	HBITMAP			m_hBitmap;

-#endif

-};

-

-class IFSDK_PAUSE_Adapter : public IFX_Pause

-{

-public:

-	IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause );

-	FX_BOOL NeedToPauseNow();

-	

-private:

-	IFSDK_PAUSE* m_IPause;

-};

-#endif

+// 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 _RENDERCONTENT_H_
+#define _RENDERCONTENT_H_
+#include "../include/fsdk_define.h"
+#include "../include/fpdf_progressive.h"
+
+// Everything about rendering is put here: for OOM recovery
+class CRenderContext : public CFX_Object
+{
+public:
+	CRenderContext() { Clear(); }
+	~CRenderContext();
+	
+	void Clear();
+	
+	CFX_RenderDevice*		m_pDevice;
+	CPDF_RenderContext*		m_pContext;
+	CPDF_ProgressiveRenderer*	m_pRenderer;
+	CPDF_AnnotList*			m_pAnnots;
+	CPDF_RenderOptions*		m_pOptions;
+#ifdef _WIN32_WCE
+	CFX_DIBitmap*	m_pBitmap;
+	HBITMAP			m_hBitmap;
+#endif
+};
+
+class IFSDK_PAUSE_Adapter : public IFX_Pause
+{
+public:
+	IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause );
+	FX_BOOL NeedToPauseNow();
+	
+private:
+	IFSDK_PAUSE* m_IPause;
+};
+#endif
diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h
index c760377..b9ac413 100644
--- a/fpdfsdk/include/fx_systemhandler.h
+++ b/fpdfsdk/include/fx_systemhandler.h
@@ -1,85 +1,85 @@
-// 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 _FX_SYSTEMHANDLER_H_

-#define _FX_SYSTEMHANDLER_H_

-

-typedef FX_LPVOID				FX_HWND;

-typedef FX_LPVOID				FX_HMENU;

-typedef void					(*TimerCallback)(FX_INT32 idEvent);

-

-typedef struct _FX_SYSTEMTIME 

-{

-    FX_WORD wYear;

-    FX_WORD wMonth;

-    FX_WORD wDayOfWeek;

-    FX_WORD wDay;

-    FX_WORD wHour;

-    FX_WORD wMinute;

-    FX_WORD wSecond;

-    FX_WORD wMilliseconds;

-}FX_SYSTEMTIME;

-

-//cursor style

-#define FXCT_ARROW				0

-#define FXCT_NESW				1

-#define FXCT_NWSE				2

-#define FXCT_VBEAM				3

-#define FXCT_HBEAM				4

-#define FXCT_HAND				5

-

-class IFX_SystemHandler

-{

-public:

-	virtual ~IFX_SystemHandler() {}

-	virtual void				InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;

-    virtual void				OutputSelectedRect(void* pFormFiller, CPDF_Rect&rect) = 0;

-

-	virtual FX_BOOL				IsSelectionImplemented() = 0;

-

-	virtual CFX_WideString		GetClipboardText(FX_HWND hWnd) = 0;

-	virtual FX_BOOL				SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;

-	

-	virtual void				ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;

-	virtual void				ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;

-

-	/*cursor style

-	FXCT_ARROW	

-	FXCT_NESW		

-	FXCT_NWSE		

-	FXCT_VBEAM		

-	FXCT_HBEAM		

-	FXCT_HAND

-	*/

-	virtual void				SetCursor(FX_INT32 nCursorType) = 0;

-

-	virtual FX_HMENU			CreatePopupMenu() = 0;

-	virtual FX_BOOL				AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) = 0;

-	virtual FX_BOOL				EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) = 0;

-	virtual FX_INT32			TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) = 0;

-	virtual void				DestroyMenu(FX_HMENU hMenu) = 0;

-

-	virtual CFX_ByteString		GetNativeTrueTypeFont(FX_INT32 nCharset) = 0;

-	virtual FX_BOOL				FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) = 0;

-	virtual CPDF_Font*			AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset) = 0;

-

-	virtual FX_INT32			SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) = 0;

-	virtual void				KillTimer(FX_INT32 nID) = 0;

-

-

-	virtual FX_BOOL				IsSHIFTKeyDown(FX_DWORD nFlag) = 0;

-	virtual FX_BOOL				IsCTRLKeyDown(FX_DWORD nFlag) = 0;

-	virtual FX_BOOL				IsALTKeyDown(FX_DWORD nFlag) = 0;

-	virtual FX_BOOL				IsINSERTKeyDown(FX_DWORD nFlag) = 0;

-

-	virtual	FX_SYSTEMTIME		GetLocalTime() = 0;

-

-	virtual FX_INT32			GetCharSet() = 0;	

-	virtual void 				SetCharSet(FX_INT32 nCharSet) = 0;

-};

-

-#endif //_FX_SYSTEMHANDLER_H_

-

+// 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 _FX_SYSTEMHANDLER_H_
+#define _FX_SYSTEMHANDLER_H_
+
+typedef FX_LPVOID				FX_HWND;
+typedef FX_LPVOID				FX_HMENU;
+typedef void					(*TimerCallback)(FX_INT32 idEvent);
+
+typedef struct _FX_SYSTEMTIME 
+{
+    FX_WORD wYear;
+    FX_WORD wMonth;
+    FX_WORD wDayOfWeek;
+    FX_WORD wDay;
+    FX_WORD wHour;
+    FX_WORD wMinute;
+    FX_WORD wSecond;
+    FX_WORD wMilliseconds;
+}FX_SYSTEMTIME;
+
+//cursor style
+#define FXCT_ARROW				0
+#define FXCT_NESW				1
+#define FXCT_NWSE				2
+#define FXCT_VBEAM				3
+#define FXCT_HBEAM				4
+#define FXCT_HAND				5
+
+class IFX_SystemHandler
+{
+public:
+	virtual ~IFX_SystemHandler() {}
+	virtual void				InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
+    virtual void				OutputSelectedRect(void* pFormFiller, CPDF_Rect&rect) = 0;
+
+	virtual FX_BOOL				IsSelectionImplemented() = 0;
+
+	virtual CFX_WideString		GetClipboardText(FX_HWND hWnd) = 0;
+	virtual FX_BOOL				SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;
+	
+	virtual void				ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
+	virtual void				ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
+
+	/*cursor style
+	FXCT_ARROW	
+	FXCT_NESW		
+	FXCT_NWSE		
+	FXCT_VBEAM		
+	FXCT_HBEAM		
+	FXCT_HAND
+	*/
+	virtual void				SetCursor(FX_INT32 nCursorType) = 0;
+
+	virtual FX_HMENU			CreatePopupMenu() = 0;
+	virtual FX_BOOL				AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) = 0;
+	virtual FX_BOOL				EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) = 0;
+	virtual FX_INT32			TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) = 0;
+	virtual void				DestroyMenu(FX_HMENU hMenu) = 0;
+
+	virtual CFX_ByteString		GetNativeTrueTypeFont(FX_INT32 nCharset) = 0;
+	virtual FX_BOOL				FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) = 0;
+	virtual CPDF_Font*			AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset) = 0;
+
+	virtual FX_INT32			SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) = 0;
+	virtual void				KillTimer(FX_INT32 nID) = 0;
+
+
+	virtual FX_BOOL				IsSHIFTKeyDown(FX_DWORD nFlag) = 0;
+	virtual FX_BOOL				IsCTRLKeyDown(FX_DWORD nFlag) = 0;
+	virtual FX_BOOL				IsALTKeyDown(FX_DWORD nFlag) = 0;
+	virtual FX_BOOL				IsINSERTKeyDown(FX_DWORD nFlag) = 0;
+
+	virtual	FX_SYSTEMTIME		GetLocalTime() = 0;
+
+	virtual FX_INT32			GetCharSet() = 0;	
+	virtual void 				SetCharSet(FX_INT32 nCharSet) = 0;
+};
+
+#endif //_FX_SYSTEMHANDLER_H_
+
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
index 2b73e61..95b9096 100644
--- a/fpdfsdk/include/fxedit/fx_edit.h
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -1,471 +1,471 @@
-// 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 _FX_EDIT_H_

-#define _FX_EDIT_H_

-

-#define PVTWORD_STYLE_NORMAL				0x0000L

-#define PVTWORD_STYLE_HIGHLIGHT				0x0001L

-#define PVTWORD_STYLE_UNDERLINE				0x0002L

-#define PVTWORD_STYLE_CROSSOUT				0x0004L

-#define PVTWORD_STYLE_SQUIGGLY				0x0008L

-#define PVTWORD_STYLE_DUALCROSSOUT			0x0010L

-#define PVTWORD_STYLE_BOLD					0x0020L

-#define PVTWORD_STYLE_ITALIC				0x0040L

-

-#define FX_EDIT_ISLATINWORD(u)	(u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))

-

-#ifdef FX_READER_DLL

-	#ifdef FXET_EXPORT

-		#define FXET_CLASS __declspec(dllexport)

-	#else

-		#define FXET_CLASS

-	#endif

-#else

-	#define FXET_CLASS

-#endif

-

-#ifndef DEFAULT_CHARSET

-#define DEFAULT_CHARSET         1

-#endif 

-

-class IFX_Edit_FontMap;

-class IFX_Edit_Notify;

-class IFX_Edit_Iterator;

-class IFX_Edit_UndoItem;

-class IFX_Edit;

-class IFX_List_Notify;

-class IFX_List;

-class IFX_SystemHandler;

-

-class IFX_Edit_FontMap

-{

-public:

-	//map a fontindex to pdf font.

-	virtual CPDF_Font *						GetPDFFont(FX_INT32 nFontIndex) = 0;

-	//get the alias of a pdf font.

-	virtual CFX_ByteString					GetPDFFontAlias(FX_INT32 nFontIndex) = 0;

-	//get the index of a font that can show a word.

-	virtual FX_INT32						GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;

-	//get the charcode of word from unicode

-	virtual FX_INT32						CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;

-	//get the charset of unicode

-	virtual FX_INT32						CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;

-};

-

-class IFX_Edit_Notify

-{

-	//this class is implemented by user

-public:

-	//set the horizontal scrollbar information.

-	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;

-	//set the vertical scrollbar information.

-	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;

-	//set the position of horizontal scrollbar.

-	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;

-	//set the position of vertical scrollbar.

-	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;

-	//set the caret information.

-	virtual void							IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;

-	//if the caret position is changed ,send the information of current postion to user.

-	virtual void							IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;

-	//if the text area is changed, send the information to user.

-	virtual void							IOnContentChange(const CPDF_Rect& rcContent) = 0;

-	//Invalidate the rectangle relative to the bounding box of edit.

-	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;

-};

-

-class IFX_Edit_OprNotify

-{

-	//this class is implemented by user

-public:

-	//OprType: 0

-	virtual void							OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 1

-	virtual void							OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 2

-	virtual void							OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 3

-	virtual void							OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 4

-	virtual void							OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 5

-	virtual void							OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//OprType: 6

-	virtual void							OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;

-	//

-	virtual void							OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;

-};

-

-class IFX_Edit_Iterator

-{

-public:

-	virtual ~IFX_Edit_Iterator()  {}

-public:

-	//move the current position to the next word.

-	virtual FX_BOOL							NextWord() = 0;

-	//move the current position to the next line.

-	virtual FX_BOOL							NextLine() = 0;

-	//move the current position to the next section. 

-	virtual FX_BOOL							NextSection() = 0;

-

-	//move the current position to the previous word.

-	virtual FX_BOOL							PrevWord() = 0;

-	//move the current position to the previous line.

-	virtual FX_BOOL							PrevLine() = 0;

-	//move the current position to the previous section. 

-	virtual FX_BOOL							PrevSection() = 0;

-

-	//get the information of the current word.

-	virtual FX_BOOL							GetWord(CPVT_Word & word) const = 0;

-	//get the information of the current line.

-	virtual FX_BOOL							GetLine(CPVT_Line & line) const = 0;

-	//get the information of the current section.

-	virtual FX_BOOL							GetSection(CPVT_Section & section) const = 0;

-	//set the current position.

-	virtual void							SetAt(FX_INT32 nWordIndex) = 0;

-	//set the current position.

-	virtual void							SetAt(const CPVT_WordPlace & place) = 0;

-	//get the current position.

-	virtual const CPVT_WordPlace &			GetAt() const = 0;

-

-	//get the edit which this iterator belongs to

-	virtual IFX_Edit*						GetEdit() const = 0;

-};

-

-class IFX_Edit_UndoItem

-{

-public:

-	virtual void							Undo() = 0;

-	virtual void							Redo() = 0;

-	virtual CFX_WideString					GetUndoTitle() = 0;

-	virtual void							Release() = 0;

-};

-

-class FXET_CLASS IFX_Edit

-{

-public:

-	static IFX_Edit*						NewEdit();

-	static	void							DelEdit(IFX_Edit* pEdit);

-

-public:

-	//set a IFX_Edit_FontMap pointer implemented by user.

-	virtual void							SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;

-	//if user don't like to use FontMap, implement VTProvider and set it directly.

-	virtual void							SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;

-	//set a IFX_Edit_Notify pointer implemented by user.

-	virtual void							SetNotify(IFX_Edit_Notify * pNotify) = 0;

-	virtual void							SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;

-	//get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.

-	virtual IFX_Edit_Iterator*				GetIterator() = 0;

-	//get a VT pointer relative to this edit.

-	virtual IPDF_VariableText*				GetVariableText() = 0;

-	//get the IFX_Edit_FontMap pointer set by user.

-	virtual IFX_Edit_FontMap*				GetFontMap() = 0;

-

-	//initialize the edit.

-	virtual void							Initialize() = 0;

-

-	//set the bounding box of the text area.

-	virtual void							SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;

-	//set the scroll origin

-	virtual void							SetScrollPos(const CPDF_Point & point) = 0;

-

-	//set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).

-	virtual void							SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;

-	//set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).

-	virtual void							SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;

-	//if the text is shown in secret , set a character for substitute.

-	virtual void							SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;

-	//set the maximal count of words of the text.

-	virtual void							SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;

-	//if set the count of charArray , then all words is shown in equal space.

-	virtual void							SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;

-	//set the space of two characters.

-	virtual void							SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;

-	//set the horizontal scale of all characters.

-	virtual void							SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;

-	//set the leading of all lines

-	virtual void							SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;

-	//if set, CRLF is allowed.

-	virtual void							SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;

-	//if set, all words auto fit the width of the bounding box.	

-	virtual void							SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;

-	//if set, a font size is calculated to full fit the bounding box.

-	virtual void							SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;

-	//is set, the text is allowed to scroll.

-	virtual void							SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;

-	//set the font size of all words.

-	virtual void							SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;

-	//the text is allowed to auto-scroll, allow the text overflow?

-	virtual void							SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;

-

-	//query if the edit is richedit.

-	virtual FX_BOOL							IsRichText() const = 0;

-	//set the edit is richedit.

-	virtual void							SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;

-	//set the fontsize of selected text.

-	virtual FX_BOOL							SetRichFontSize(FX_FLOAT fFontSize) = 0;	

-	//set the fontindex of selected text, user can change the font of selected text.

-	virtual FX_BOOL							SetRichFontIndex(FX_INT32 nFontIndex) = 0;

-	//set the textcolor of selected text.

-	virtual FX_BOOL							SetRichTextColor(FX_COLORREF dwColor) = 0;

-	//set the text script type of selected text. (0:normal 1:superscript 2:subscript)

-	virtual FX_BOOL							SetRichTextScript(FX_INT32 nScriptType) = 0;	

-	//set the bold font style of selected text.

-	virtual FX_BOOL							SetRichTextBold(FX_BOOL bBold = TRUE) = 0;

-	//set the italic font style of selected text.

-	virtual FX_BOOL							SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;

-	//set the underline style of selected text.

-	virtual FX_BOOL							SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;

-	//set the crossout style of selected text.

-	virtual FX_BOOL							SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;

-	//set the charspace of selected text, in user coordinate.

-	virtual	FX_BOOL							SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;

-	//set the horizontal scale of selected text, default value is 100.

-	virtual FX_BOOL							SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0;

-	//set the leading of selected section, in user coordinate.

-	virtual FX_BOOL							SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;

-	//set the indent of selected section, in user coordinate.

-	virtual FX_BOOL							SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;

-	//set the alignment of selected section, nAlignment(0:left 1:middle 2:right)

-	virtual FX_BOOL							SetRichTextAlignment(FX_INT32 nAlignment) = 0;

-

-	//set the selected range of text.

-	//if nStartChar == 0 and nEndChar == -1, select all the text.

-	virtual void							SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;

-	//get the selected range of text.

-	virtual void							GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0;

-	//select all the text.

-	virtual	void							SelectAll() = 0;

-	//set text is not selected.

-	virtual void							SelectNone() = 0;		

-	//get the caret position.

-	virtual FX_INT32						GetCaret() const = 0;

-	virtual CPVT_WordPlace					GetCaretWordPlace() const = 0;

-	//get the string of selected text.

-	virtual CFX_WideString					GetSelText() const = 0;

-	//get the text conent

-	virtual CFX_WideString					GetText() const = 0;

-	//query if any text is selected.

-	virtual FX_BOOL							IsSelected() const = 0;	

-	//get the scroll origin

-	virtual CPDF_Point						GetScrollPos() const = 0;

-	//get the bounding box of the text area.

-	virtual CPDF_Rect						GetPlateRect() const = 0;

-	//get the fact area of the text.

-	virtual CPDF_Rect						GetContentRect() const = 0;

-	//get the visible word range

-	virtual CPVT_WordRange					GetVisibleWordRange() const = 0;

-	//get the whole word range

-	virtual CPVT_WordRange					GetWholeWordRange() const = 0;

-	//get the word range of select text

-	virtual CPVT_WordRange					GetSelectWordRange() const = 0;

-

-	//send the mousedown message to edit for response.

-	//if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.

-	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the mousemove message to edit when mouse down is TRUE.

-	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the UP key message to edit.

-	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the DOWN key message to edit.

-	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the LEFT key message to edit.

-	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the RIGHT key message to edit.

-	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the HOME key message to edit.

-	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	//send the END key message to edit.

-	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-

-	//put text into edit.

-	virtual void							SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,

-													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;	

-	//insert a word into the edit.

-	virtual FX_BOOL							InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;

-	//insert a return into the edit.

-	virtual FX_BOOL							InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;	

-	//insert text into the edit.

-	virtual FX_BOOL							InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,

-													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;

-	//do backspace operation.

-	virtual FX_BOOL							Backspace() = 0;

-	//do delete operation.

-	virtual FX_BOOL							Delete() = 0;	

-	//delete the selected text.

-	virtual FX_BOOL							Clear() = 0;

-

-	//do Redo operation.

-	virtual FX_BOOL							Redo() = 0;

-	//do Undo operation.

-	virtual FX_BOOL							Undo() = 0;

-	//move caret

-	virtual void							SetCaret(FX_INT32 nPos) = 0;

-

-	//arrange all words over again

-	virtual void							Paint() = 0;

-	

-	//allow to refresh screen?

-	virtual void							EnableRefresh(FX_BOOL bRefresh) = 0;

-

-	virtual void							RefreshWordRange(const CPVT_WordRange& wr) = 0;

-

-	//allow undo/redo?

-	virtual void							EnableUndo(FX_BOOL bUndo) = 0;

-

-	//allow notify?

-	virtual void							EnableNotify(FX_BOOL bNotify) = 0;

-

-	//allow opr notify?

-	virtual void							EnableOprNotify(FX_BOOL bNotify) = 0;

-

-	//map word place to word index.

-	virtual FX_INT32						WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;

-	//map word index to word place.

-	virtual CPVT_WordPlace					WordIndexToWordPlace(FX_INT32 index) const = 0;

-

-	//get the beginning position of a line

-	virtual CPVT_WordPlace					GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;

-

-	//get the ending position of a line

-	virtual CPVT_WordPlace					GetLineEndPlace(const CPVT_WordPlace & place) const = 0;

-

-	//get the beginning position of a section

-	virtual CPVT_WordPlace					GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;

-

-	//get the ending position of a section

-	virtual CPVT_WordPlace					GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;

-

-	//search a wordplace form point

-	virtual CPVT_WordPlace					SearchWordPlace(const CPDF_Point& point) const = 0;

-

-	//get the font size of non_rich text or default font size of richtext.

-	virtual FX_FLOAT						GetFontSize() const = 0;

-	//get the mask character.

-	virtual FX_WORD							GetPasswordChar() const = 0;

-	//get the count of charArray

-	virtual FX_INT32						GetCharArray() const = 0;

-	//get the horizontal scale of all characters

-	virtual FX_INT32						GetHorzScale() const = 0;

-	//get the space of two characters

-	virtual FX_FLOAT						GetCharSpace() const = 0;

-	//get the latin words of specified range

-	virtual CFX_WideString					GetRangeText(const CPVT_WordRange & range) const = 0;

-	//is the text full in bounding box

-	virtual FX_BOOL							IsTextFull() const = 0;

-	virtual FX_BOOL							CanUndo() const = 0;

-	virtual FX_BOOL							CanRedo() const = 0;

-	//if the content is changed after settext?

-	virtual FX_BOOL							IsModified() const = 0;

-	//get the total words in edit

-	virtual FX_INT32						GetTotalWords() const = 0;

-

-	virtual void							AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;

-

-public:

-	static CFX_ByteString					GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, 

-													const CPVT_WordRange* pRange = NULL, 

-													FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);

-	static CFX_ByteString					GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);

-	static void								DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,

-													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);

-	static void								DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,

-													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);

-	static void								DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,  

-													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);

-	static void								GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,

-													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);

-	static void								GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,

-													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);

-	static void								GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,

-													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);

-};

-

-class IFX_List_Notify

-{

-	//this class is implemented by user

-public:

-	//set the horizontal scrollbar information.

-	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;

-	//set the vertical scrollbar information.

-	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;

-	//set the position of horizontal scrollbar.

-	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;

-	//set the position of vertical scrollbar.

-	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;

-	//Invalidate the rectangle relative to the bounding box of edit.

-	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;

-};

-

-class FXET_CLASS IFX_List

-{

-public:

-	static IFX_List*						NewList();

-	static void								DelList(IFX_List* pList);

-

-public:

-	virtual void							SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;

-	virtual void							SetNotify(IFX_List_Notify * pNotify) = 0;

-

-	virtual void							SetPlateRect(const CPDF_Rect & rect) = 0;

-	virtual void							SetFontSize(FX_FLOAT fFontSize) = 0;

-

-	virtual CPDF_Rect						GetPlateRect() const = 0;

-	virtual CPDF_Rect						GetContentRect() const = 0;

-

-	virtual FX_FLOAT						GetFontSize() const = 0;

-	virtual IFX_Edit*						GetItemEdit(FX_INT32 nIndex) const = 0;

-	virtual FX_INT32						GetCount() const = 0;

-	virtual FX_BOOL							IsItemSelected(FX_INT32 nIndex) const = 0;

-	virtual FX_FLOAT						GetFirstHeight() const = 0;

-	

-	virtual void							SetMultipleSel(FX_BOOL bMultiple) = 0;

-	virtual FX_BOOL							IsMultipleSel() const = 0;	

-	virtual FX_BOOL							IsValid(FX_INT32 nItemIndex) const = 0;

-	virtual FX_INT32						FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;	

-

-	virtual void							SetScrollPos(const CPDF_Point & point) = 0;

-	virtual void							ScrollToListItem(FX_INT32 nItemIndex) = 0;

-	virtual CPDF_Rect						GetItemRect(FX_INT32 nIndex) const = 0;

-	virtual FX_INT32						GetCaret() const = 0;

-	virtual FX_INT32						GetSelect() const = 0;	

-	virtual FX_INT32						GetTopItem() const = 0;

-	virtual FX_INT32						GetItemIndex(const CPDF_Point & point) const = 0;

-	virtual FX_INT32						GetFirstSelected() const = 0;

-

-	virtual void							AddString(FX_LPCWSTR string) = 0;

-	virtual void							SetTopItem(FX_INT32 nIndex) = 0;	

-	virtual void							Select(FX_INT32 nItemIndex) = 0;

-	virtual void							SetCaret(FX_INT32 nItemIndex) = 0;

-	virtual void							Empty() = 0;

-	virtual void							Cancel() = 0;

-	virtual CFX_WideString					GetText() const = 0;

-

-

-	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual void							OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-	virtual FX_BOOL							OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;

-};

-

-#endif 

-

+// 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 _FX_EDIT_H_
+#define _FX_EDIT_H_
+
+#define PVTWORD_STYLE_NORMAL				0x0000L
+#define PVTWORD_STYLE_HIGHLIGHT				0x0001L
+#define PVTWORD_STYLE_UNDERLINE				0x0002L
+#define PVTWORD_STYLE_CROSSOUT				0x0004L
+#define PVTWORD_STYLE_SQUIGGLY				0x0008L
+#define PVTWORD_STYLE_DUALCROSSOUT			0x0010L
+#define PVTWORD_STYLE_BOLD					0x0020L
+#define PVTWORD_STYLE_ITALIC				0x0040L
+
+#define FX_EDIT_ISLATINWORD(u)	(u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
+
+#ifdef FX_READER_DLL
+	#ifdef FXET_EXPORT
+		#define FXET_CLASS __declspec(dllexport)
+	#else
+		#define FXET_CLASS
+	#endif
+#else
+	#define FXET_CLASS
+#endif
+
+#ifndef DEFAULT_CHARSET
+#define DEFAULT_CHARSET         1
+#endif 
+
+class IFX_Edit_FontMap;
+class IFX_Edit_Notify;
+class IFX_Edit_Iterator;
+class IFX_Edit_UndoItem;
+class IFX_Edit;
+class IFX_List_Notify;
+class IFX_List;
+class IFX_SystemHandler;
+
+class IFX_Edit_FontMap
+{
+public:
+	//map a fontindex to pdf font.
+	virtual CPDF_Font *						GetPDFFont(FX_INT32 nFontIndex) = 0;
+	//get the alias of a pdf font.
+	virtual CFX_ByteString					GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
+	//get the index of a font that can show a word.
+	virtual FX_INT32						GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;
+	//get the charcode of word from unicode
+	virtual FX_INT32						CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;
+	//get the charset of unicode
+	virtual FX_INT32						CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;
+};
+
+class IFX_Edit_Notify
+{
+	//this class is implemented by user
+public:
+	//set the horizontal scrollbar information.
+	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+	//set the vertical scrollbar information.
+	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+	//set the position of horizontal scrollbar.
+	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;
+	//set the position of vertical scrollbar.
+	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;
+	//set the caret information.
+	virtual void							IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
+	//if the caret position is changed ,send the information of current postion to user.
+	virtual void							IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
+	//if the text area is changed, send the information to user.
+	virtual void							IOnContentChange(const CPDF_Rect& rcContent) = 0;
+	//Invalidate the rectangle relative to the bounding box of edit.
+	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+};
+
+class IFX_Edit_OprNotify
+{
+	//this class is implemented by user
+public:
+	//OprType: 0
+	virtual void							OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 1
+	virtual void							OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 2
+	virtual void							OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 3
+	virtual void							OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 4
+	virtual void							OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 5
+	virtual void							OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//OprType: 6
+	virtual void							OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+	//
+	virtual void							OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
+};
+
+class IFX_Edit_Iterator
+{
+public:
+	virtual ~IFX_Edit_Iterator()  {}
+public:
+	//move the current position to the next word.
+	virtual FX_BOOL							NextWord() = 0;
+	//move the current position to the next line.
+	virtual FX_BOOL							NextLine() = 0;
+	//move the current position to the next section. 
+	virtual FX_BOOL							NextSection() = 0;
+
+	//move the current position to the previous word.
+	virtual FX_BOOL							PrevWord() = 0;
+	//move the current position to the previous line.
+	virtual FX_BOOL							PrevLine() = 0;
+	//move the current position to the previous section. 
+	virtual FX_BOOL							PrevSection() = 0;
+
+	//get the information of the current word.
+	virtual FX_BOOL							GetWord(CPVT_Word & word) const = 0;
+	//get the information of the current line.
+	virtual FX_BOOL							GetLine(CPVT_Line & line) const = 0;
+	//get the information of the current section.
+	virtual FX_BOOL							GetSection(CPVT_Section & section) const = 0;
+	//set the current position.
+	virtual void							SetAt(FX_INT32 nWordIndex) = 0;
+	//set the current position.
+	virtual void							SetAt(const CPVT_WordPlace & place) = 0;
+	//get the current position.
+	virtual const CPVT_WordPlace &			GetAt() const = 0;
+
+	//get the edit which this iterator belongs to
+	virtual IFX_Edit*						GetEdit() const = 0;
+};
+
+class IFX_Edit_UndoItem
+{
+public:
+	virtual void							Undo() = 0;
+	virtual void							Redo() = 0;
+	virtual CFX_WideString					GetUndoTitle() = 0;
+	virtual void							Release() = 0;
+};
+
+class FXET_CLASS IFX_Edit
+{
+public:
+	static IFX_Edit*						NewEdit();
+	static	void							DelEdit(IFX_Edit* pEdit);
+
+public:
+	//set a IFX_Edit_FontMap pointer implemented by user.
+	virtual void							SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
+	//if user don't like to use FontMap, implement VTProvider and set it directly.
+	virtual void							SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
+	//set a IFX_Edit_Notify pointer implemented by user.
+	virtual void							SetNotify(IFX_Edit_Notify * pNotify) = 0;
+	virtual void							SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
+	//get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.
+	virtual IFX_Edit_Iterator*				GetIterator() = 0;
+	//get a VT pointer relative to this edit.
+	virtual IPDF_VariableText*				GetVariableText() = 0;
+	//get the IFX_Edit_FontMap pointer set by user.
+	virtual IFX_Edit_FontMap*				GetFontMap() = 0;
+
+	//initialize the edit.
+	virtual void							Initialize() = 0;
+
+	//set the bounding box of the text area.
+	virtual void							SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
+	//set the scroll origin
+	virtual void							SetScrollPos(const CPDF_Point & point) = 0;
+
+	//set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
+	virtual void							SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+	//set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).
+	virtual void							SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+	//if the text is shown in secret , set a character for substitute.
+	virtual void							SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
+	//set the maximal count of words of the text.
+	virtual void							SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
+	//if set the count of charArray , then all words is shown in equal space.
+	virtual void							SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
+	//set the space of two characters.
+	virtual void							SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;
+	//set the horizontal scale of all characters.
+	virtual void							SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;
+	//set the leading of all lines
+	virtual void							SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
+	//if set, CRLF is allowed.
+	virtual void							SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;
+	//if set, all words auto fit the width of the bounding box.	
+	virtual void							SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+	//if set, a font size is calculated to full fit the bounding box.
+	virtual void							SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+	//is set, the text is allowed to scroll.
+	virtual void							SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+	//set the font size of all words.
+	virtual void							SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
+	//the text is allowed to auto-scroll, allow the text overflow?
+	virtual void							SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;
+
+	//query if the edit is richedit.
+	virtual FX_BOOL							IsRichText() const = 0;
+	//set the edit is richedit.
+	virtual void							SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
+	//set the fontsize of selected text.
+	virtual FX_BOOL							SetRichFontSize(FX_FLOAT fFontSize) = 0;	
+	//set the fontindex of selected text, user can change the font of selected text.
+	virtual FX_BOOL							SetRichFontIndex(FX_INT32 nFontIndex) = 0;
+	//set the textcolor of selected text.
+	virtual FX_BOOL							SetRichTextColor(FX_COLORREF dwColor) = 0;
+	//set the text script type of selected text. (0:normal 1:superscript 2:subscript)
+	virtual FX_BOOL							SetRichTextScript(FX_INT32 nScriptType) = 0;	
+	//set the bold font style of selected text.
+	virtual FX_BOOL							SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
+	//set the italic font style of selected text.
+	virtual FX_BOOL							SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
+	//set the underline style of selected text.
+	virtual FX_BOOL							SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
+	//set the crossout style of selected text.
+	virtual FX_BOOL							SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
+	//set the charspace of selected text, in user coordinate.
+	virtual	FX_BOOL							SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
+	//set the horizontal scale of selected text, default value is 100.
+	virtual FX_BOOL							SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0;
+	//set the leading of selected section, in user coordinate.
+	virtual FX_BOOL							SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
+	//set the indent of selected section, in user coordinate.
+	virtual FX_BOOL							SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
+	//set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
+	virtual FX_BOOL							SetRichTextAlignment(FX_INT32 nAlignment) = 0;
+
+	//set the selected range of text.
+	//if nStartChar == 0 and nEndChar == -1, select all the text.
+	virtual void							SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;
+	//get the selected range of text.
+	virtual void							GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0;
+	//select all the text.
+	virtual	void							SelectAll() = 0;
+	//set text is not selected.
+	virtual void							SelectNone() = 0;		
+	//get the caret position.
+	virtual FX_INT32						GetCaret() const = 0;
+	virtual CPVT_WordPlace					GetCaretWordPlace() const = 0;
+	//get the string of selected text.
+	virtual CFX_WideString					GetSelText() const = 0;
+	//get the text conent
+	virtual CFX_WideString					GetText() const = 0;
+	//query if any text is selected.
+	virtual FX_BOOL							IsSelected() const = 0;	
+	//get the scroll origin
+	virtual CPDF_Point						GetScrollPos() const = 0;
+	//get the bounding box of the text area.
+	virtual CPDF_Rect						GetPlateRect() const = 0;
+	//get the fact area of the text.
+	virtual CPDF_Rect						GetContentRect() const = 0;
+	//get the visible word range
+	virtual CPVT_WordRange					GetVisibleWordRange() const = 0;
+	//get the whole word range
+	virtual CPVT_WordRange					GetWholeWordRange() const = 0;
+	//get the word range of select text
+	virtual CPVT_WordRange					GetSelectWordRange() const = 0;
+
+	//send the mousedown message to edit for response.
+	//if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
+	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the mousemove message to edit when mouse down is TRUE.
+	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the UP key message to edit.
+	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the DOWN key message to edit.
+	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the LEFT key message to edit.
+	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the RIGHT key message to edit.
+	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the HOME key message to edit.
+	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	//send the END key message to edit.
+	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+
+	//put text into edit.
+	virtual void							SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
+													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;	
+	//insert a word into the edit.
+	virtual FX_BOOL							InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;
+	//insert a return into the edit.
+	virtual FX_BOOL							InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;	
+	//insert text into the edit.
+	virtual FX_BOOL							InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
+													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
+	//do backspace operation.
+	virtual FX_BOOL							Backspace() = 0;
+	//do delete operation.
+	virtual FX_BOOL							Delete() = 0;	
+	//delete the selected text.
+	virtual FX_BOOL							Clear() = 0;
+
+	//do Redo operation.
+	virtual FX_BOOL							Redo() = 0;
+	//do Undo operation.
+	virtual FX_BOOL							Undo() = 0;
+	//move caret
+	virtual void							SetCaret(FX_INT32 nPos) = 0;
+
+	//arrange all words over again
+	virtual void							Paint() = 0;
+	
+	//allow to refresh screen?
+	virtual void							EnableRefresh(FX_BOOL bRefresh) = 0;
+
+	virtual void							RefreshWordRange(const CPVT_WordRange& wr) = 0;
+
+	//allow undo/redo?
+	virtual void							EnableUndo(FX_BOOL bUndo) = 0;
+
+	//allow notify?
+	virtual void							EnableNotify(FX_BOOL bNotify) = 0;
+
+	//allow opr notify?
+	virtual void							EnableOprNotify(FX_BOOL bNotify) = 0;
+
+	//map word place to word index.
+	virtual FX_INT32						WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
+	//map word index to word place.
+	virtual CPVT_WordPlace					WordIndexToWordPlace(FX_INT32 index) const = 0;
+
+	//get the beginning position of a line
+	virtual CPVT_WordPlace					GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
+
+	//get the ending position of a line
+	virtual CPVT_WordPlace					GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
+
+	//get the beginning position of a section
+	virtual CPVT_WordPlace					GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
+
+	//get the ending position of a section
+	virtual CPVT_WordPlace					GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
+
+	//search a wordplace form point
+	virtual CPVT_WordPlace					SearchWordPlace(const CPDF_Point& point) const = 0;
+
+	//get the font size of non_rich text or default font size of richtext.
+	virtual FX_FLOAT						GetFontSize() const = 0;
+	//get the mask character.
+	virtual FX_WORD							GetPasswordChar() const = 0;
+	//get the count of charArray
+	virtual FX_INT32						GetCharArray() const = 0;
+	//get the horizontal scale of all characters
+	virtual FX_INT32						GetHorzScale() const = 0;
+	//get the space of two characters
+	virtual FX_FLOAT						GetCharSpace() const = 0;
+	//get the latin words of specified range
+	virtual CFX_WideString					GetRangeText(const CPVT_WordRange & range) const = 0;
+	//is the text full in bounding box
+	virtual FX_BOOL							IsTextFull() const = 0;
+	virtual FX_BOOL							CanUndo() const = 0;
+	virtual FX_BOOL							CanRedo() const = 0;
+	//if the content is changed after settext?
+	virtual FX_BOOL							IsModified() const = 0;
+	//get the total words in edit
+	virtual FX_INT32						GetTotalWords() const = 0;
+
+	virtual void							AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
+
+public:
+	static CFX_ByteString					GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, 
+													const CPVT_WordRange* pRange = NULL, 
+													FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
+	static CFX_ByteString					GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
+	static void								DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
+													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
+	static void								DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
+													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
+	static void								DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,  
+													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
+	static void								GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+	static void								GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+	static void								GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
+};
+
+class IFX_List_Notify
+{
+	//this class is implemented by user
+public:
+	//set the horizontal scrollbar information.
+	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+	//set the vertical scrollbar information.
+	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+	//set the position of horizontal scrollbar.
+	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;
+	//set the position of vertical scrollbar.
+	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;
+	//Invalidate the rectangle relative to the bounding box of edit.
+	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+};
+
+class FXET_CLASS IFX_List
+{
+public:
+	static IFX_List*						NewList();
+	static void								DelList(IFX_List* pList);
+
+public:
+	virtual void							SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
+	virtual void							SetNotify(IFX_List_Notify * pNotify) = 0;
+
+	virtual void							SetPlateRect(const CPDF_Rect & rect) = 0;
+	virtual void							SetFontSize(FX_FLOAT fFontSize) = 0;
+
+	virtual CPDF_Rect						GetPlateRect() const = 0;
+	virtual CPDF_Rect						GetContentRect() const = 0;
+
+	virtual FX_FLOAT						GetFontSize() const = 0;
+	virtual IFX_Edit*						GetItemEdit(FX_INT32 nIndex) const = 0;
+	virtual FX_INT32						GetCount() const = 0;
+	virtual FX_BOOL							IsItemSelected(FX_INT32 nIndex) const = 0;
+	virtual FX_FLOAT						GetFirstHeight() const = 0;
+	
+	virtual void							SetMultipleSel(FX_BOOL bMultiple) = 0;
+	virtual FX_BOOL							IsMultipleSel() const = 0;	
+	virtual FX_BOOL							IsValid(FX_INT32 nItemIndex) const = 0;
+	virtual FX_INT32						FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;	
+
+	virtual void							SetScrollPos(const CPDF_Point & point) = 0;
+	virtual void							ScrollToListItem(FX_INT32 nItemIndex) = 0;
+	virtual CPDF_Rect						GetItemRect(FX_INT32 nIndex) const = 0;
+	virtual FX_INT32						GetCaret() const = 0;
+	virtual FX_INT32						GetSelect() const = 0;	
+	virtual FX_INT32						GetTopItem() const = 0;
+	virtual FX_INT32						GetItemIndex(const CPDF_Point & point) const = 0;
+	virtual FX_INT32						GetFirstSelected() const = 0;
+
+	virtual void							AddString(FX_LPCWSTR string) = 0;
+	virtual void							SetTopItem(FX_INT32 nIndex) = 0;	
+	virtual void							Select(FX_INT32 nItemIndex) = 0;
+	virtual void							SetCaret(FX_INT32 nItemIndex) = 0;
+	virtual void							Empty() = 0;
+	virtual void							Cancel() = 0;
+	virtual CFX_WideString					GetText() const = 0;
+
+
+	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual void							OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+	virtual FX_BOOL							OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+};
+
+#endif 
+
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index 72b7809..f65715b 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -1,823 +1,823 @@
-// 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 _FXET_EDIT_H_

-#define _FXET_EDIT_H_

-

-#include "fx_edit.h"

-

-class CFX_Edit_Page;

-struct CFX_Edit_LineRect;

-class CFX_Edit_LineRectArray;

-class CFX_Edit_RectArray;

-class CFX_Edit_Refresh;

-class CFX_Edit_Select;

-class CFX_Edit;

-class CFX_Edit_Iterator;

-class CFX_Edit_Refresh;

-class CFX_Edit_UndoItem;

-class CFX_Edit_Undo;

-class CFX_Edit_Provider;

-

-#define FX_EDIT_IsFloatZero(f)						(f < 0.0001 && f > -0.0001)

-#define FX_EDIT_IsFloatEqual(fa,fb)					FX_EDIT_IsFloatZero(fa - fb)

-#define FX_EDIT_IsFloatBigger(fa,fb)				(fa > fb && !FX_EDIT_IsFloatEqual(fa,fb))

-#define FX_EDIT_IsFloatSmaller(fa,fb)				(fa < fb && !FX_EDIT_IsFloatEqual(fa,fb))

-

-template<class T> T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }

-template<class T> T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }

-

-#define	FX_EDIT_PI									3.14159265358979f

-#define FX_EDIT_ITALIC_ANGEL						10 * FX_EDIT_PI / 180.0f

-

-

-/* ------------------------- CFX_Edit_Refresh ---------------------------- */

-

-enum REFRESH_PLAN_E

-{

-	RP_ANALYSE,

-	RP_NOANALYSE,

-	RP_OPTIONAL

-};

-

-enum EDIT_PROPS_E

-{

-	EP_LINELEADING,

-	EP_LINEINDENT,

-	EP_ALIGNMENT,

-	EP_FONTINDEX,

-	EP_FONTSIZE,

-	EP_WORDCOLOR,

-	EP_SCRIPTTYPE,

-	EP_UNDERLINE,

-	EP_CROSSOUT,

-	EP_CHARSPACE,

-	EP_HORZSCALE,

-	EP_BOLD,

-	EP_ITALIC

-};

-

-struct CFX_Edit_LineRect

-{

-	CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) :

-		m_wrLine(wrLine), m_rcLine(rcLine)

-	{

-	}

-

-	FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const

-	{

-		return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;

-	}

-

-	FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const

-	{

-		return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (linerect.m_rcLine.top -linerect.m_rcLine.bottom));

-	}

-

-	FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const

-	{

-		return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);

-	}

-

-	FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const

-	{

-		return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);

-	}

-

-	FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const

-	{

-		return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);

-	}

-

-	CPVT_WordRange							m_wrLine;

-	CPDF_Rect								m_rcLine;

-};

-

-class CFX_Edit_LineRectArray

-{

-public:

-	CFX_Edit_LineRectArray()

-	{

-	}

-

-	virtual ~CFX_Edit_LineRectArray()

-	{

-		Empty();

-	}

-

-	void Empty()

-	{

-		for (FX_INT32 i = 0, sz = m_LineRects.GetSize(); i < sz; i++)

-			delete m_LineRects.GetAt(i);

-

-		m_LineRects.RemoveAll();

-	}

-

-	void RemoveAll()

-	{

-		m_LineRects.RemoveAll();

-	}

-

-	void operator = (CFX_Edit_LineRectArray & rects)

-	{

-		Empty();

-		for (FX_INT32 i = 0, sz = rects.GetSize(); i < sz; i++)

-			m_LineRects.Add(rects.GetAt(i));

-

-		rects.RemoveAll();

-	}

-

-	void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine)

-	{

-		if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcLine))

-			m_LineRects.Add(pRect);

-	}

-

-	FX_INT32 GetSize() const

-	{

-		return m_LineRects.GetSize();

-	}

-

-	CFX_Edit_LineRect * GetAt(FX_INT32 nIndex) const

-	{

-		if (nIndex < 0 || nIndex >= m_LineRects.GetSize())

-			return NULL;

-

-		return m_LineRects.GetAt(nIndex);

-	}

-

-	CFX_ArrayTemplate<CFX_Edit_LineRect*>		m_LineRects;

-};

-

-class CFX_Edit_RectArray

-{

-public:

-	CFX_Edit_RectArray()

-	{

-	}

-

-	virtual ~CFX_Edit_RectArray()

-	{

-		this->Empty();

-	}

-

-	void Empty()

-	{

-		for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)

-			delete m_Rects.GetAt(i);

-

-		this->m_Rects.RemoveAll();

-	}

-

-	void Add(const CPDF_Rect & rect)

-	{

-		//check for overlaped area

-		for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)

-			if (CPDF_Rect * pRect = m_Rects.GetAt(i))

-				if (pRect->Contains(rect))return;

-

-		if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))

-			m_Rects.Add(pNewRect);

-	}

-

-	FX_INT32 GetSize() const

-	{

-		return m_Rects.GetSize();

-	}

-

-	CPDF_Rect * GetAt(FX_INT32 nIndex) const

-	{

-		if (nIndex < 0 || nIndex >= m_Rects.GetSize())

-			return NULL;

-

-		return m_Rects.GetAt(nIndex);

-	}

-

-	CFX_ArrayTemplate<CPDF_Rect*>			m_Rects;

-};

-

-class CFX_Edit_Refresh

-{

-public:

-	CFX_Edit_Refresh();

-	virtual ~CFX_Edit_Refresh();

-

-	void									BeginRefresh();

-	void									Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);

-	void									NoAnalyse();

-	void									Analyse(FX_INT32 nAlignment);

-	void									AddRefresh(const CPDF_Rect & rect);

-	const CFX_Edit_RectArray *				GetRefreshRects() const;

-	void									EndRefresh();

-

-private:

-	CFX_Edit_LineRectArray					m_NewLineRects;

-	CFX_Edit_LineRectArray					m_OldLineRects;

-	CFX_Edit_RectArray						m_RefreshRects;

-};

-

-

-/* ------------------------- CFX_Edit_Select ---------------------------- */

-

-class CFX_Edit_Select

-{

-public:

-	CFX_Edit_Select()

-	{

-	}

-

-	CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)

-	{

-		Set(begin,end);

-	}

-

-	CFX_Edit_Select(const CPVT_WordRange & range)

-	{

-		Set(range.BeginPos,range.EndPos);

-	}

-

-	CPVT_WordRange ConvertToWordRange() const

-	{

-		return CPVT_WordRange(this->BeginPos,this->EndPos);

-	}

-

-	void Default()

-	{

-		BeginPos.Default();

-		EndPos.Default();

-	}

-

-	void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)

-	{

-		this->BeginPos = begin;

-		this->EndPos = end;

-	}

-

-	void SetBeginPos(const CPVT_WordPlace & begin)

-	{

-		this->BeginPos = begin;

-	}

-

-	void SetEndPos(const CPVT_WordPlace & end)

-	{

-		this->EndPos = end;

-	}

-

-	FX_BOOL IsExist() const

-	{

-		return this->BeginPos != this->EndPos;

-	}

-

-	FX_BOOL operator != (const CPVT_WordRange & wr) const

-	{

-		return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos;

-	}

-

-	CPVT_WordPlace BeginPos,EndPos;

-};

-

-/* ------------------------- CFX_Edit_Undo ---------------------------- */

-

-class CFX_Edit_Undo

-{

-public:

-	CFX_Edit_Undo(FX_INT32 nBufsize = 10000);

-	virtual ~CFX_Edit_Undo();

-

-	void									Undo();

-	void									Redo();

-

-	void									AddItem(IFX_Edit_UndoItem* pItem);

-

-	FX_BOOL									CanUndo() const;

-	FX_BOOL									CanRedo() const;

-	FX_BOOL									IsModified() const;

-	FX_BOOL									IsWorking() const;

-

-	void									Reset();

-

-	IFX_Edit_UndoItem*						GetItem(FX_INT32 nIndex);

-	FX_INT32								GetItemCount(){return m_UndoItemStack.GetSize();}

-	FX_INT32								GetCurUndoPos(){return m_nCurUndoPos;}

-

-private:

-	void									SetBufSize(FX_INT32 nSize){m_nBufSize = nSize;}

-	FX_INT32								GetBufSize(){return m_nBufSize;}

-

-	void									RemoveHeads();

-	void									RemoveTails();

-

-private:

-	CFX_ArrayTemplate<IFX_Edit_UndoItem*>	m_UndoItemStack;

-	

-	FX_INT32								m_nCurUndoPos;

-	FX_INT32								m_nBufSize;

-	FX_BOOL									m_bModified; 

-	FX_BOOL									m_bVirgin;

-	FX_BOOL									m_bWorking;

-};

-

-class CFX_Edit_UndoItem : public IFX_Edit_UndoItem

-{

-public:

-	CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}

-	virtual ~CFX_Edit_UndoItem(){}

-

-	virtual CFX_WideString					GetUndoTitle() {return L"";}

-	virtual void							Release(){delete this;}

-

-public:

-	void									SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;}

-	FX_BOOL									IsFirst(){return m_bFirst;}

-	void									SetLast(FX_BOOL bLast){m_bLast = bLast;}

-	FX_BOOL									IsLast(){return m_bLast;}

-

-private:

-	FX_BOOL									m_bFirst;

-	FX_BOOL									m_bLast;

-};

-

-class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem

-{

-public:

-	CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);

-	virtual ~CFX_Edit_GroupUndoItem();

-

-	void									AddUndoItem(CFX_Edit_UndoItem* pUndoItem);

-	void									UpdateItems();

-

-public:

-	virtual void							Undo();

-	virtual void							Redo();

-	virtual CFX_WideString					GetUndoTitle();

-	virtual void							Release();

-

-private:

-	CFX_WideString							m_sTitle;

-	CFX_ArrayTemplate<CFX_Edit_UndoItem*>	m_Items;

-};

-

-/* ------------------------- CFX_Edit_UndoItem derived classes ---------------------------- */

-

-class CFXEU_InsertWord : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-		FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps);

-	virtual ~CFXEU_InsertWord();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit*					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	FX_WORD						m_Word;

-	FX_INT32					m_nCharset;

-	CPVT_WordProps				m_WordProps;

-};

-

-class CFXEU_InsertReturn : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-							 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);

-	virtual ~CFXEU_InsertReturn();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	CPVT_SecProps				m_SecProps;

-	CPVT_WordProps				m_WordProps;

-};

-

-class CFXEU_Backspace : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-						FX_WORD word, FX_INT32 charset,

-						const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);

-	virtual ~CFXEU_Backspace();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	FX_WORD						m_Word;

-	FX_INT32					m_nCharset;

-	CPVT_SecProps				m_SecProps;

-	CPVT_WordProps				m_WordProps;

-};

-

-class CFXEU_Delete : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-						FX_WORD word, FX_INT32 charset,

-						const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd);

-	virtual ~CFXEU_Delete();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	FX_WORD						m_Word;

-	FX_INT32					m_nCharset;

-	CPVT_SecProps				m_SecProps;

-	CPVT_WordProps				m_WordProps;

-	FX_BOOL						m_bSecEnd;

-};

-

-class CFXEU_Clear : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText);

-	virtual ~CFXEU_Clear();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit*					m_pEdit;

-

-	CPVT_WordRange				m_wrSel;

-	CFX_WideString				m_swText;

-};

-

-class CFXEU_ClearRich : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-						const CPVT_WordRange & wrSel,

-					   FX_WORD word, FX_INT32 charset,

-					   const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);

-	virtual ~CFXEU_ClearRich();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	CPVT_WordRange				m_wrSel;

-	FX_WORD						m_Word;

-	FX_INT32					m_nCharset;

-	CPVT_SecProps				m_SecProps;

-	CPVT_WordProps				m_WordProps;

-};

-

-class CFXEU_InsertText : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,

-						   const CFX_WideString & swText, FX_INT32 charset,

-						   const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);

-	virtual ~CFXEU_InsertText();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-

-	CPVT_WordPlace				m_wpOld;

-	CPVT_WordPlace				m_wpNew;

-	CFX_WideString				m_swText;

-	FX_INT32					m_nCharset;

-	CPVT_SecProps				m_SecProps;

-	CPVT_WordProps				m_WordProps;

-};

-

-class CFXEU_SetSecProps : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, 

-		const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, 

-		const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range);

-	virtual ~CFXEU_SetSecProps();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-	CPVT_WordPlace				m_wpPlace;

-	CPVT_WordRange				m_wrPlace;

-	EDIT_PROPS_E				m_eProps;

-

-	CPVT_SecProps				m_OldSecProps;

-	CPVT_SecProps				m_NewSecProps;

-	CPVT_WordProps				m_OldWordProps;

-	CPVT_WordProps				m_NewWordProps;	

-};

-

-class CFXEU_SetWordProps : public CFX_Edit_UndoItem

-{

-public:

-	CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, 

-		const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range);

-	virtual ~CFXEU_SetWordProps();

-

-	void						Redo();

-	void						Undo();

-

-private:

-	CFX_Edit *					m_pEdit;

-	CPVT_WordPlace				m_wpPlace;

-	CPVT_WordRange				m_wrPlace;

-	EDIT_PROPS_E				m_eProps;

-	

-	CPVT_WordProps				m_OldWordProps;

-	CPVT_WordProps				m_NewWordProps;	

-};

-

-/* ------------------------- CFX_Edit ---------------------------- */

-

-class CFX_Edit : public IFX_Edit

-{

-	friend class CFX_Edit_Iterator;

-	friend class CFXEU_InsertWord;

-	friend class CFXEU_InsertReturn;

-	friend class CFXEU_Backspace;

-	friend class CFXEU_Delete;

-	friend class CFXEU_Clear;

-	friend class CFXEU_ClearRich;

-	friend class CFXEU_SetSecProps;

-	friend class CFXEU_SetWordProps;	

-	friend class CFXEU_InsertText;

-

-public:

-	CFX_Edit(IPDF_VariableText * pVT);

-	virtual ~CFX_Edit();

-

-	void									SetFontMap(IFX_Edit_FontMap * pFontMap);	

-	void									SetVTProvider(IPDF_VariableText_Provider* pProvider);

-	void									SetNotify(IFX_Edit_Notify * pNotify);

-	void									SetOprNotify(IFX_Edit_OprNotify* pOprNotify);

-	IFX_Edit_Iterator*						GetIterator();

-	IPDF_VariableText *						GetVariableText();

-	IFX_Edit_FontMap*						GetFontMap();

-

-	void									Initialize();

-	void									SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE);

-	void									SetScrollPos(const CPDF_Point & point);

-

-	void									SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);

-	void									SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);

-	void									SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);

-	void									SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE);

-	void									SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE);

-	void									SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);

-	void									SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE);

-	void									SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);

-	void									SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);

-	void									SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);

-	void									SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);	

-	void									SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);	

-	void									SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);

-	void									SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);

-

-	FX_BOOL									IsRichText() const;

-	void									SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);

-	FX_BOOL									SetRichFontSize(FX_FLOAT fFontSize);	

-	FX_BOOL									SetRichFontIndex(FX_INT32 nFontIndex);

-	FX_BOOL									SetRichTextColor(FX_COLORREF dwColor);

-	FX_BOOL									SetRichTextScript(FX_INT32 nScriptType);

-	FX_BOOL									SetRichTextBold(FX_BOOL bBold = TRUE);	

-	FX_BOOL									SetRichTextItalic(FX_BOOL bItalic = TRUE);

-	FX_BOOL									SetRichTextUnderline(FX_BOOL bUnderline = TRUE);

-	FX_BOOL									SetRichTextCrossout(FX_BOOL bCrossout = TRUE);

-	FX_BOOL									SetRichTextCharSpace(FX_FLOAT fCharSpace);

-	FX_BOOL									SetRichTextHorzScale(FX_INT32 nHorzScale = 100);

-	FX_BOOL									SetRichTextLineLeading(FX_FLOAT fLineLeading);

-	FX_BOOL									SetRichTextLineIndent(FX_FLOAT fLineIndent);

-	FX_BOOL									SetRichTextAlignment(FX_INT32 nAlignment);

-

-	void									OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);

-	void									OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);

-

-	void									SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,

-													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);	

-	FX_BOOL									InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL);

-	FX_BOOL									InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);

-	FX_BOOL									Backspace();

-	FX_BOOL									Delete();		

-	FX_BOOL									Clear();

-	FX_BOOL									Empty();

-	FX_BOOL									InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,

-													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);

-	FX_BOOL									Redo();

-	FX_BOOL									Undo();	

-	CPVT_WordPlace							DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset, 

-												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);

-	FX_INT32								GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);

-

-	FX_INT32								WordPlaceToWordIndex(const CPVT_WordPlace & place) const;

-	CPVT_WordPlace							WordIndexToWordPlace(FX_INT32 index) const;	

-

-	CPVT_WordPlace							GetLineBeginPlace(const CPVT_WordPlace & place) const;

-	CPVT_WordPlace							GetLineEndPlace(const CPVT_WordPlace & place) const;

-	CPVT_WordPlace							GetSectionBeginPlace(const CPVT_WordPlace & place) const;

-	CPVT_WordPlace							GetSectionEndPlace(const CPVT_WordPlace & place) const;

-	CPVT_WordPlace							SearchWordPlace(const CPDF_Point& point) const;

-

-	FX_INT32								GetCaret() const;

-	CPVT_WordPlace							GetCaretWordPlace() const;

-	CFX_WideString							GetSelText() const;

-	CFX_WideString							GetText() const;

-	FX_FLOAT								GetFontSize() const;

-	FX_WORD									GetPasswordChar() const;

-	CPDF_Point								GetScrollPos() const;

-	FX_INT32								GetCharArray() const;

-	CPDF_Rect								GetPlateRect() const;

-	CPDF_Rect								GetContentRect() const;

-	CFX_WideString							GetRangeText(const CPVT_WordRange & range) const;

-	FX_INT32								GetHorzScale() const;

-	FX_FLOAT								GetCharSpace() const;

-	FX_INT32								GetTotalWords() const;

-	FX_INT32								GetTotalLines() const;

-

-	void									SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);

-	void									GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;

-

-private:

-	void									SelectAll();

-	void									SelectNone();

-	void									SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end);

-	FX_BOOL									IsSelected() const;

-

-	void									RearrangeAll();

-	void									RearrangePart(const CPVT_WordRange & range);

-	void									Paint();

-	void									ScrollToCaret();

-	void									SetScrollInfo();

-	void									SetScrollPosX(FX_FLOAT fx);

-	void									SetScrollPosY(FX_FLOAT fy);

-	void									SetScrollLimit();

-	void									SetContentChanged();

-	void									EnableNotify(FX_BOOL bNotify);

-

-	void									SetText(FX_LPCWSTR text,FX_INT32 charset,

-													const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);	

-	FX_BOOL									InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);

-	FX_BOOL									InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);

-	FX_BOOL									Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);

-	FX_BOOL									Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);		

-	FX_BOOL									Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);

-	FX_BOOL									InsertText(FX_LPCWSTR text, FX_INT32 charset,

-												const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);

-	FX_BOOL									SetRichTextProps(EDIT_PROPS_E eProps,

-												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);

-	FX_BOOL									SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 

-												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);

-	FX_BOOL									SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 

-												const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);

-	void									PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr);

-	void									PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew);

-

-	inline CPDF_Point						VTToEdit(const CPDF_Point & point) const;

-	inline CPDF_Point						EditToVT(const CPDF_Point & point) const;

-	inline CPDF_Rect						VTToEdit(const CPDF_Rect & rect) const;

-	inline CPDF_Rect						EditToVT(const CPDF_Rect & rect) const;

-

-	void									EnableRefresh(FX_BOOL bRefresh);

-	void									Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_WordRange * pRange2 = NULL);

-	void									RefreshPushLineRects(const CPVT_WordRange & wr);

-	void									RefreshPushRandomRects(const CPVT_WordRange & wr);

-	void									RefreshWordRange(const CPVT_WordRange& wr);

-

-	void									SetCaret(FX_INT32 nPos);

-	void									SetCaret(const CPVT_WordPlace & place);

-	void									SetCaretInfo();

-	void									SetCaretOrigin();

-	void									SetCaretChange();

-

-	CPVT_WordRange							GetWholeWordRange() const;

-	CPVT_WordRange							GetVisibleWordRange() const;

-	CPVT_WordRange							GetLatinWordsRange(const CPVT_WordPlace & place) const;

-	CPVT_WordRange							CombineWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2);

-	CPVT_WordRange							GetSelectWordRange() const;

-

-	void									EnableUndo(FX_BOOL bUndo);

-	void									EnableOprNotify(FX_BOOL bNotify);

-

-	FX_BOOL									IsTextFull() const;

-	FX_BOOL									IsTextOverflow() const;

-	FX_BOOL									CanUndo() const;

-	FX_BOOL									CanRedo() const;

-	FX_BOOL									IsModified() const;

-

-	void									BeginGroupUndo(const CFX_WideString& sTitle);

-	void									EndGroupUndo();

-	void									AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);

-	void									AddUndoItem(IFX_Edit_UndoItem* pUndoItem);

-

-	void									SetPageInfo(const CPVT_WordPlace& place);

-	CPVT_WordPlace							SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const;

-	FX_FLOAT								GetLineTop(const CPVT_WordPlace& place) const;

-	FX_FLOAT								GetLineBottom(const CPVT_WordPlace& place) const;

-

-private:	

-	IPDF_VariableText*						m_pVT;

-	IFX_Edit_Notify*						m_pNotify;

-	IFX_Edit_OprNotify*						m_pOprNotify;

-	CFX_Edit_Provider*						m_pVTProvide;

-

-	CPVT_WordPlace							m_wpCaret;

-	CPVT_WordPlace							m_wpOldCaret;

-	CFX_Edit_Select							m_SelState;

-

-	CPDF_Point								m_ptScrollPos;

-	CPDF_Point								m_ptRefreshScrollPos;

-	FX_BOOL									m_bEnableScroll;	

-	IFX_Edit_Iterator *						m_pIterator;	

-	CFX_Edit_Refresh						m_Refresh;

-	CPDF_Point								m_ptCaret;

-	CFX_Edit_Undo							m_Undo;

-	FX_INT32								m_nAlignment;

-	FX_BOOL									m_bNotifyFlag;

-	FX_BOOL									m_bTextFullFlag;

-	FX_BOOL									m_bEnableOverflow;

-	FX_BOOL									m_bEnableRefresh;

-	CPDF_Rect								m_rcOldContent;

-	FX_BOOL									m_bEnableUndo;

-	FX_BOOL									m_bNotify;

-	FX_BOOL									m_bOprNotify;

-	CFX_Edit_GroupUndoItem*					m_pGroupUndoItem;

-};

-

-/* ------------------------- CFX_Edit_Iterator ---------------------------- */

-

-class CFX_Edit_Iterator : public IFX_Edit_Iterator

-{

-public:

-	CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator);

-	virtual ~CFX_Edit_Iterator();

-

-	FX_BOOL									NextWord();

-	FX_BOOL									NextLine();

-	FX_BOOL									NextSection();

-	FX_BOOL									PrevWord();

-	FX_BOOL									PrevLine();

-	FX_BOOL									PrevSection();

-

-	FX_BOOL									GetWord(CPVT_Word & word) const;

-	FX_BOOL									GetLine(CPVT_Line & line) const;

-	FX_BOOL									GetSection(CPVT_Section & section) const;

-	void									SetAt(FX_INT32 nWordIndex);

-	void									SetAt(const CPVT_WordPlace & place);

-	const CPVT_WordPlace &					GetAt() const;

-	IFX_Edit*								GetEdit() const;

-

-private:

-	CFX_Edit *								m_pEdit;

-	IPDF_VariableText_Iterator*				m_pVTIterator;

-};

-

-class CFX_Edit_Provider : public IPDF_VariableText_Provider

-{

-public:

-	CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);

-	virtual ~CFX_Edit_Provider();

-

-	IFX_Edit_FontMap*			GetFontMap();

-

-	FX_INT32					GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle);

-	FX_INT32					GetTypeAscent(FX_INT32 nFontIndex);

-	FX_INT32					GetTypeDescent(FX_INT32 nFontIndex);

-	FX_INT32					GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex);

-	FX_INT32					GetDefaultFontIndex();

-	FX_BOOL						IsLatinWord(FX_WORD word);

-

-private:

-	IFX_Edit_FontMap*			m_pFontMap;

-};

-

-#endif //_FXET_EDIT_H_

-

+// 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 _FXET_EDIT_H_
+#define _FXET_EDIT_H_
+
+#include "fx_edit.h"
+
+class CFX_Edit_Page;
+struct CFX_Edit_LineRect;
+class CFX_Edit_LineRectArray;
+class CFX_Edit_RectArray;
+class CFX_Edit_Refresh;
+class CFX_Edit_Select;
+class CFX_Edit;
+class CFX_Edit_Iterator;
+class CFX_Edit_Refresh;
+class CFX_Edit_UndoItem;
+class CFX_Edit_Undo;
+class CFX_Edit_Provider;
+
+#define FX_EDIT_IsFloatZero(f)						(f < 0.0001 && f > -0.0001)
+#define FX_EDIT_IsFloatEqual(fa,fb)					FX_EDIT_IsFloatZero(fa - fb)
+#define FX_EDIT_IsFloatBigger(fa,fb)				(fa > fb && !FX_EDIT_IsFloatEqual(fa,fb))
+#define FX_EDIT_IsFloatSmaller(fa,fb)				(fa < fb && !FX_EDIT_IsFloatEqual(fa,fb))
+
+template<class T> T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
+template<class T> T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+
+#define	FX_EDIT_PI									3.14159265358979f
+#define FX_EDIT_ITALIC_ANGEL						10 * FX_EDIT_PI / 180.0f
+
+
+/* ------------------------- CFX_Edit_Refresh ---------------------------- */
+
+enum REFRESH_PLAN_E
+{
+	RP_ANALYSE,
+	RP_NOANALYSE,
+	RP_OPTIONAL
+};
+
+enum EDIT_PROPS_E
+{
+	EP_LINELEADING,
+	EP_LINEINDENT,
+	EP_ALIGNMENT,
+	EP_FONTINDEX,
+	EP_FONTSIZE,
+	EP_WORDCOLOR,
+	EP_SCRIPTTYPE,
+	EP_UNDERLINE,
+	EP_CROSSOUT,
+	EP_CHARSPACE,
+	EP_HORZSCALE,
+	EP_BOLD,
+	EP_ITALIC
+};
+
+struct CFX_Edit_LineRect
+{
+	CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) :
+		m_wrLine(wrLine), m_rcLine(rcLine)
+	{
+	}
+
+	FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const
+	{
+		return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
+	}
+
+	FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const
+	{
+		return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (linerect.m_rcLine.top -linerect.m_rcLine.bottom));
+	}
+
+	FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const
+	{
+		return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
+	}
+
+	FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const
+	{
+		return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
+	}
+
+	FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const
+	{
+		return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
+	}
+
+	CPVT_WordRange							m_wrLine;
+	CPDF_Rect								m_rcLine;
+};
+
+class CFX_Edit_LineRectArray
+{
+public:
+	CFX_Edit_LineRectArray()
+	{
+	}
+
+	virtual ~CFX_Edit_LineRectArray()
+	{
+		Empty();
+	}
+
+	void Empty()
+	{
+		for (FX_INT32 i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
+			delete m_LineRects.GetAt(i);
+
+		m_LineRects.RemoveAll();
+	}
+
+	void RemoveAll()
+	{
+		m_LineRects.RemoveAll();
+	}
+
+	void operator = (CFX_Edit_LineRectArray & rects)
+	{
+		Empty();
+		for (FX_INT32 i = 0, sz = rects.GetSize(); i < sz; i++)
+			m_LineRects.Add(rects.GetAt(i));
+
+		rects.RemoveAll();
+	}
+
+	void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine)
+	{
+		if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcLine))
+			m_LineRects.Add(pRect);
+	}
+
+	FX_INT32 GetSize() const
+	{
+		return m_LineRects.GetSize();
+	}
+
+	CFX_Edit_LineRect * GetAt(FX_INT32 nIndex) const
+	{
+		if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
+			return NULL;
+
+		return m_LineRects.GetAt(nIndex);
+	}
+
+	CFX_ArrayTemplate<CFX_Edit_LineRect*>		m_LineRects;
+};
+
+class CFX_Edit_RectArray
+{
+public:
+	CFX_Edit_RectArray()
+	{
+	}
+
+	virtual ~CFX_Edit_RectArray()
+	{
+		this->Empty();
+	}
+
+	void Empty()
+	{
+		for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+			delete m_Rects.GetAt(i);
+
+		this->m_Rects.RemoveAll();
+	}
+
+	void Add(const CPDF_Rect & rect)
+	{
+		//check for overlaped area
+		for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+			if (CPDF_Rect * pRect = m_Rects.GetAt(i))
+				if (pRect->Contains(rect))return;
+
+		if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))
+			m_Rects.Add(pNewRect);
+	}
+
+	FX_INT32 GetSize() const
+	{
+		return m_Rects.GetSize();
+	}
+
+	CPDF_Rect * GetAt(FX_INT32 nIndex) const
+	{
+		if (nIndex < 0 || nIndex >= m_Rects.GetSize())
+			return NULL;
+
+		return m_Rects.GetAt(nIndex);
+	}
+
+	CFX_ArrayTemplate<CPDF_Rect*>			m_Rects;
+};
+
+class CFX_Edit_Refresh
+{
+public:
+	CFX_Edit_Refresh();
+	virtual ~CFX_Edit_Refresh();
+
+	void									BeginRefresh();
+	void									Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);
+	void									NoAnalyse();
+	void									Analyse(FX_INT32 nAlignment);
+	void									AddRefresh(const CPDF_Rect & rect);
+	const CFX_Edit_RectArray *				GetRefreshRects() const;
+	void									EndRefresh();
+
+private:
+	CFX_Edit_LineRectArray					m_NewLineRects;
+	CFX_Edit_LineRectArray					m_OldLineRects;
+	CFX_Edit_RectArray						m_RefreshRects;
+};
+
+
+/* ------------------------- CFX_Edit_Select ---------------------------- */
+
+class CFX_Edit_Select
+{
+public:
+	CFX_Edit_Select()
+	{
+	}
+
+	CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
+	{
+		Set(begin,end);
+	}
+
+	CFX_Edit_Select(const CPVT_WordRange & range)
+	{
+		Set(range.BeginPos,range.EndPos);
+	}
+
+	CPVT_WordRange ConvertToWordRange() const
+	{
+		return CPVT_WordRange(this->BeginPos,this->EndPos);
+	}
+
+	void Default()
+	{
+		BeginPos.Default();
+		EndPos.Default();
+	}
+
+	void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
+	{
+		this->BeginPos = begin;
+		this->EndPos = end;
+	}
+
+	void SetBeginPos(const CPVT_WordPlace & begin)
+	{
+		this->BeginPos = begin;
+	}
+
+	void SetEndPos(const CPVT_WordPlace & end)
+	{
+		this->EndPos = end;
+	}
+
+	FX_BOOL IsExist() const
+	{
+		return this->BeginPos != this->EndPos;
+	}
+
+	FX_BOOL operator != (const CPVT_WordRange & wr) const
+	{
+		return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos;
+	}
+
+	CPVT_WordPlace BeginPos,EndPos;
+};
+
+/* ------------------------- CFX_Edit_Undo ---------------------------- */
+
+class CFX_Edit_Undo
+{
+public:
+	CFX_Edit_Undo(FX_INT32 nBufsize = 10000);
+	virtual ~CFX_Edit_Undo();
+
+	void									Undo();
+	void									Redo();
+
+	void									AddItem(IFX_Edit_UndoItem* pItem);
+
+	FX_BOOL									CanUndo() const;
+	FX_BOOL									CanRedo() const;
+	FX_BOOL									IsModified() const;
+	FX_BOOL									IsWorking() const;
+
+	void									Reset();
+
+	IFX_Edit_UndoItem*						GetItem(FX_INT32 nIndex);
+	FX_INT32								GetItemCount(){return m_UndoItemStack.GetSize();}
+	FX_INT32								GetCurUndoPos(){return m_nCurUndoPos;}
+
+private:
+	void									SetBufSize(FX_INT32 nSize){m_nBufSize = nSize;}
+	FX_INT32								GetBufSize(){return m_nBufSize;}
+
+	void									RemoveHeads();
+	void									RemoveTails();
+
+private:
+	CFX_ArrayTemplate<IFX_Edit_UndoItem*>	m_UndoItemStack;
+	
+	FX_INT32								m_nCurUndoPos;
+	FX_INT32								m_nBufSize;
+	FX_BOOL									m_bModified; 
+	FX_BOOL									m_bVirgin;
+	FX_BOOL									m_bWorking;
+};
+
+class CFX_Edit_UndoItem : public IFX_Edit_UndoItem
+{
+public:
+	CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
+	virtual ~CFX_Edit_UndoItem(){}
+
+	virtual CFX_WideString					GetUndoTitle() {return L"";}
+	virtual void							Release(){delete this;}
+
+public:
+	void									SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;}
+	FX_BOOL									IsFirst(){return m_bFirst;}
+	void									SetLast(FX_BOOL bLast){m_bLast = bLast;}
+	FX_BOOL									IsLast(){return m_bLast;}
+
+private:
+	FX_BOOL									m_bFirst;
+	FX_BOOL									m_bLast;
+};
+
+class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem
+{
+public:
+	CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
+	virtual ~CFX_Edit_GroupUndoItem();
+
+	void									AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
+	void									UpdateItems();
+
+public:
+	virtual void							Undo();
+	virtual void							Redo();
+	virtual CFX_WideString					GetUndoTitle();
+	virtual void							Release();
+
+private:
+	CFX_WideString							m_sTitle;
+	CFX_ArrayTemplate<CFX_Edit_UndoItem*>	m_Items;
+};
+
+/* ------------------------- CFX_Edit_UndoItem derived classes ---------------------------- */
+
+class CFXEU_InsertWord : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+		FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps);
+	virtual ~CFXEU_InsertWord();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit*					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	FX_WORD						m_Word;
+	FX_INT32					m_nCharset;
+	CPVT_WordProps				m_WordProps;
+};
+
+class CFXEU_InsertReturn : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+							 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+	virtual ~CFXEU_InsertReturn();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	CPVT_SecProps				m_SecProps;
+	CPVT_WordProps				m_WordProps;
+};
+
+class CFXEU_Backspace : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+						FX_WORD word, FX_INT32 charset,
+						const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
+	virtual ~CFXEU_Backspace();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	FX_WORD						m_Word;
+	FX_INT32					m_nCharset;
+	CPVT_SecProps				m_SecProps;
+	CPVT_WordProps				m_WordProps;
+};
+
+class CFXEU_Delete : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+						FX_WORD word, FX_INT32 charset,
+						const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd);
+	virtual ~CFXEU_Delete();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	FX_WORD						m_Word;
+	FX_INT32					m_nCharset;
+	CPVT_SecProps				m_SecProps;
+	CPVT_WordProps				m_WordProps;
+	FX_BOOL						m_bSecEnd;
+};
+
+class CFXEU_Clear : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText);
+	virtual ~CFXEU_Clear();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit*					m_pEdit;
+
+	CPVT_WordRange				m_wrSel;
+	CFX_WideString				m_swText;
+};
+
+class CFXEU_ClearRich : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+						const CPVT_WordRange & wrSel,
+					   FX_WORD word, FX_INT32 charset,
+					   const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
+	virtual ~CFXEU_ClearRich();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	CPVT_WordRange				m_wrSel;
+	FX_WORD						m_Word;
+	FX_INT32					m_nCharset;
+	CPVT_SecProps				m_SecProps;
+	CPVT_WordProps				m_WordProps;
+};
+
+class CFXEU_InsertText : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+						   const CFX_WideString & swText, FX_INT32 charset,
+						   const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+	virtual ~CFXEU_InsertText();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+
+	CPVT_WordPlace				m_wpOld;
+	CPVT_WordPlace				m_wpNew;
+	CFX_WideString				m_swText;
+	FX_INT32					m_nCharset;
+	CPVT_SecProps				m_SecProps;
+	CPVT_WordProps				m_WordProps;
+};
+
+class CFXEU_SetSecProps : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, 
+		const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, 
+		const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range);
+	virtual ~CFXEU_SetSecProps();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+	CPVT_WordPlace				m_wpPlace;
+	CPVT_WordRange				m_wrPlace;
+	EDIT_PROPS_E				m_eProps;
+
+	CPVT_SecProps				m_OldSecProps;
+	CPVT_SecProps				m_NewSecProps;
+	CPVT_WordProps				m_OldWordProps;
+	CPVT_WordProps				m_NewWordProps;	
+};
+
+class CFXEU_SetWordProps : public CFX_Edit_UndoItem
+{
+public:
+	CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, 
+		const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range);
+	virtual ~CFXEU_SetWordProps();
+
+	void						Redo();
+	void						Undo();
+
+private:
+	CFX_Edit *					m_pEdit;
+	CPVT_WordPlace				m_wpPlace;
+	CPVT_WordRange				m_wrPlace;
+	EDIT_PROPS_E				m_eProps;
+	
+	CPVT_WordProps				m_OldWordProps;
+	CPVT_WordProps				m_NewWordProps;	
+};
+
+/* ------------------------- CFX_Edit ---------------------------- */
+
+class CFX_Edit : public IFX_Edit
+{
+	friend class CFX_Edit_Iterator;
+	friend class CFXEU_InsertWord;
+	friend class CFXEU_InsertReturn;
+	friend class CFXEU_Backspace;
+	friend class CFXEU_Delete;
+	friend class CFXEU_Clear;
+	friend class CFXEU_ClearRich;
+	friend class CFXEU_SetSecProps;
+	friend class CFXEU_SetWordProps;	
+	friend class CFXEU_InsertText;
+
+public:
+	CFX_Edit(IPDF_VariableText * pVT);
+	virtual ~CFX_Edit();
+
+	void									SetFontMap(IFX_Edit_FontMap * pFontMap);	
+	void									SetVTProvider(IPDF_VariableText_Provider* pProvider);
+	void									SetNotify(IFX_Edit_Notify * pNotify);
+	void									SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
+	IFX_Edit_Iterator*						GetIterator();
+	IPDF_VariableText *						GetVariableText();
+	IFX_Edit_FontMap*						GetFontMap();
+
+	void									Initialize();
+	void									SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE);
+	void									SetScrollPos(const CPDF_Point & point);
+
+	void									SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
+	void									SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
+	void									SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
+	void									SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE);
+	void									SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE);
+	void									SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
+	void									SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE);
+	void									SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+	void									SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
+	void									SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+	void									SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);	
+	void									SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);	
+	void									SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
+	void									SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
+
+	FX_BOOL									IsRichText() const;
+	void									SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
+	FX_BOOL									SetRichFontSize(FX_FLOAT fFontSize);	
+	FX_BOOL									SetRichFontIndex(FX_INT32 nFontIndex);
+	FX_BOOL									SetRichTextColor(FX_COLORREF dwColor);
+	FX_BOOL									SetRichTextScript(FX_INT32 nScriptType);
+	FX_BOOL									SetRichTextBold(FX_BOOL bBold = TRUE);	
+	FX_BOOL									SetRichTextItalic(FX_BOOL bItalic = TRUE);
+	FX_BOOL									SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
+	FX_BOOL									SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
+	FX_BOOL									SetRichTextCharSpace(FX_FLOAT fCharSpace);
+	FX_BOOL									SetRichTextHorzScale(FX_INT32 nHorzScale = 100);
+	FX_BOOL									SetRichTextLineLeading(FX_FLOAT fLineLeading);
+	FX_BOOL									SetRichTextLineIndent(FX_FLOAT fLineIndent);
+	FX_BOOL									SetRichTextAlignment(FX_INT32 nAlignment);
+
+	void									OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
+	void									OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
+
+	void									SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
+													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);	
+	FX_BOOL									InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL);
+	FX_BOOL									InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
+	FX_BOOL									Backspace();
+	FX_BOOL									Delete();		
+	FX_BOOL									Clear();
+	FX_BOOL									Empty();
+	FX_BOOL									InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
+													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
+	FX_BOOL									Redo();
+	FX_BOOL									Undo();	
+	CPVT_WordPlace							DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset, 
+												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+	FX_INT32								GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);
+
+	FX_INT32								WordPlaceToWordIndex(const CPVT_WordPlace & place) const;
+	CPVT_WordPlace							WordIndexToWordPlace(FX_INT32 index) const;	
+
+	CPVT_WordPlace							GetLineBeginPlace(const CPVT_WordPlace & place) const;
+	CPVT_WordPlace							GetLineEndPlace(const CPVT_WordPlace & place) const;
+	CPVT_WordPlace							GetSectionBeginPlace(const CPVT_WordPlace & place) const;
+	CPVT_WordPlace							GetSectionEndPlace(const CPVT_WordPlace & place) const;
+	CPVT_WordPlace							SearchWordPlace(const CPDF_Point& point) const;
+
+	FX_INT32								GetCaret() const;
+	CPVT_WordPlace							GetCaretWordPlace() const;
+	CFX_WideString							GetSelText() const;
+	CFX_WideString							GetText() const;
+	FX_FLOAT								GetFontSize() const;
+	FX_WORD									GetPasswordChar() const;
+	CPDF_Point								GetScrollPos() const;
+	FX_INT32								GetCharArray() const;
+	CPDF_Rect								GetPlateRect() const;
+	CPDF_Rect								GetContentRect() const;
+	CFX_WideString							GetRangeText(const CPVT_WordRange & range) const;
+	FX_INT32								GetHorzScale() const;
+	FX_FLOAT								GetCharSpace() const;
+	FX_INT32								GetTotalWords() const;
+	FX_INT32								GetTotalLines() const;
+
+	void									SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
+	void									GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
+
+private:
+	void									SelectAll();
+	void									SelectNone();
+	void									SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end);
+	FX_BOOL									IsSelected() const;
+
+	void									RearrangeAll();
+	void									RearrangePart(const CPVT_WordRange & range);
+	void									Paint();
+	void									ScrollToCaret();
+	void									SetScrollInfo();
+	void									SetScrollPosX(FX_FLOAT fx);
+	void									SetScrollPosY(FX_FLOAT fy);
+	void									SetScrollLimit();
+	void									SetContentChanged();
+	void									EnableNotify(FX_BOOL bNotify);
+
+	void									SetText(FX_LPCWSTR text,FX_INT32 charset,
+													const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);	
+	FX_BOOL									InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+	FX_BOOL									InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+	FX_BOOL									Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
+	FX_BOOL									Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);		
+	FX_BOOL									Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
+	FX_BOOL									InsertText(FX_LPCWSTR text, FX_INT32 charset,
+												const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+	FX_BOOL									SetRichTextProps(EDIT_PROPS_E eProps,
+												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+	FX_BOOL									SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 
+												const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
+	FX_BOOL									SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 
+												const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
+	void									PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr);
+	void									PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew);
+
+	inline CPDF_Point						VTToEdit(const CPDF_Point & point) const;
+	inline CPDF_Point						EditToVT(const CPDF_Point & point) const;
+	inline CPDF_Rect						VTToEdit(const CPDF_Rect & rect) const;
+	inline CPDF_Rect						EditToVT(const CPDF_Rect & rect) const;
+
+	void									EnableRefresh(FX_BOOL bRefresh);
+	void									Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_WordRange * pRange2 = NULL);
+	void									RefreshPushLineRects(const CPVT_WordRange & wr);
+	void									RefreshPushRandomRects(const CPVT_WordRange & wr);
+	void									RefreshWordRange(const CPVT_WordRange& wr);
+
+	void									SetCaret(FX_INT32 nPos);
+	void									SetCaret(const CPVT_WordPlace & place);
+	void									SetCaretInfo();
+	void									SetCaretOrigin();
+	void									SetCaretChange();
+
+	CPVT_WordRange							GetWholeWordRange() const;
+	CPVT_WordRange							GetVisibleWordRange() const;
+	CPVT_WordRange							GetLatinWordsRange(const CPVT_WordPlace & place) const;
+	CPVT_WordRange							CombineWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2);
+	CPVT_WordRange							GetSelectWordRange() const;
+
+	void									EnableUndo(FX_BOOL bUndo);
+	void									EnableOprNotify(FX_BOOL bNotify);
+
+	FX_BOOL									IsTextFull() const;
+	FX_BOOL									IsTextOverflow() const;
+	FX_BOOL									CanUndo() const;
+	FX_BOOL									CanRedo() const;
+	FX_BOOL									IsModified() const;
+
+	void									BeginGroupUndo(const CFX_WideString& sTitle);
+	void									EndGroupUndo();
+	void									AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
+	void									AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
+
+	void									SetPageInfo(const CPVT_WordPlace& place);
+	CPVT_WordPlace							SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const;
+	FX_FLOAT								GetLineTop(const CPVT_WordPlace& place) const;
+	FX_FLOAT								GetLineBottom(const CPVT_WordPlace& place) const;
+
+private:	
+	IPDF_VariableText*						m_pVT;
+	IFX_Edit_Notify*						m_pNotify;
+	IFX_Edit_OprNotify*						m_pOprNotify;
+	CFX_Edit_Provider*						m_pVTProvide;
+
+	CPVT_WordPlace							m_wpCaret;
+	CPVT_WordPlace							m_wpOldCaret;
+	CFX_Edit_Select							m_SelState;
+
+	CPDF_Point								m_ptScrollPos;
+	CPDF_Point								m_ptRefreshScrollPos;
+	FX_BOOL									m_bEnableScroll;	
+	IFX_Edit_Iterator *						m_pIterator;	
+	CFX_Edit_Refresh						m_Refresh;
+	CPDF_Point								m_ptCaret;
+	CFX_Edit_Undo							m_Undo;
+	FX_INT32								m_nAlignment;
+	FX_BOOL									m_bNotifyFlag;
+	FX_BOOL									m_bTextFullFlag;
+	FX_BOOL									m_bEnableOverflow;
+	FX_BOOL									m_bEnableRefresh;
+	CPDF_Rect								m_rcOldContent;
+	FX_BOOL									m_bEnableUndo;
+	FX_BOOL									m_bNotify;
+	FX_BOOL									m_bOprNotify;
+	CFX_Edit_GroupUndoItem*					m_pGroupUndoItem;
+};
+
+/* ------------------------- CFX_Edit_Iterator ---------------------------- */
+
+class CFX_Edit_Iterator : public IFX_Edit_Iterator
+{
+public:
+	CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator);
+	virtual ~CFX_Edit_Iterator();
+
+	FX_BOOL									NextWord();
+	FX_BOOL									NextLine();
+	FX_BOOL									NextSection();
+	FX_BOOL									PrevWord();
+	FX_BOOL									PrevLine();
+	FX_BOOL									PrevSection();
+
+	FX_BOOL									GetWord(CPVT_Word & word) const;
+	FX_BOOL									GetLine(CPVT_Line & line) const;
+	FX_BOOL									GetSection(CPVT_Section & section) const;
+	void									SetAt(FX_INT32 nWordIndex);
+	void									SetAt(const CPVT_WordPlace & place);
+	const CPVT_WordPlace &					GetAt() const;
+	IFX_Edit*								GetEdit() const;
+
+private:
+	CFX_Edit *								m_pEdit;
+	IPDF_VariableText_Iterator*				m_pVTIterator;
+};
+
+class CFX_Edit_Provider : public IPDF_VariableText_Provider
+{
+public:
+	CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
+	virtual ~CFX_Edit_Provider();
+
+	IFX_Edit_FontMap*			GetFontMap();
+
+	FX_INT32					GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle);
+	FX_INT32					GetTypeAscent(FX_INT32 nFontIndex);
+	FX_INT32					GetTypeDescent(FX_INT32 nFontIndex);
+	FX_INT32					GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex);
+	FX_INT32					GetDefaultFontIndex();
+	FX_BOOL						IsLatinWord(FX_WORD word);
+
+private:
+	IFX_Edit_FontMap*			m_pFontMap;
+};
+
+#endif //_FXET_EDIT_H_
+
diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h
index d77be86..1157bbe 100644
--- a/fpdfsdk/include/fxedit/fxet_list.h
+++ b/fpdfsdk/include/fxedit/fxet_list.h
@@ -1,363 +1,363 @@
-// 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 _FXET_LIST_H_

-#define _FXET_LIST_H_

-

-#include "fx_edit.h"

-

-class IFX_Edit;

-

-class CLST_Size

-{

-public:

-	CLST_Size() : x(0.0f), y(0.0f)

-	{		

-	}

-

-	CLST_Size(FX_FLOAT x,FX_FLOAT y)

-	{ 

-		this->x = x;

-		this->y = y;

-	}

-

-	void Default()

-	{

-		x = 0.0f;

-		y = 0.0f;

-	}

-

-	FX_BOOL operator != (const CLST_Size & size) const

-	{

-		return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;

-	}

-

-	FX_FLOAT x,y;

-};

-

-class CLST_Rect : public CPDF_Rect

-{

-public:

-	CLST_Rect()

-	{	

-		left = top = right = bottom = 0.0f;

-	}

-

-	CLST_Rect(FX_FLOAT left,FX_FLOAT top,

-						FX_FLOAT right,FX_FLOAT bottom)

-	{ 

-		this->left = left; 

-		this->top = top; 

-		this->right = right; 

-		this->bottom = bottom; 

-	}

-

-	CLST_Rect(const CPDF_Rect & rect)

-	{ 

-		this->left = rect.left; 

-		this->top = rect.top; 

-		this->right = rect.right; 

-		this->bottom = rect.bottom; 

-	}

-

-	void Default()

-	{

-		left = top = right = bottom = 0.0f;

-	}

-

-	const CLST_Rect operator = (const CPDF_Rect & rect)

-	{

-		this->left = rect.left;

-		this->top = rect.top;

-		this->right = rect.right;

-		this->bottom = rect.bottom;

-

-		return *this;

-	}

-

-	FX_BOOL operator == (const CLST_Rect & rect) const

-	{

-		return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;

-	}

-

-	FX_BOOL operator != (const CLST_Rect & rect) const

-	{

-		return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;

-	}

-

-	FX_FLOAT Width() const

-	{

-		return this->right - this->left;

-	}

-

-	FX_FLOAT Height() const

-	{

-		if (this->top > this->bottom)

-			return this->top - this->bottom;

-		else

-			return this->bottom - this->top;

-	}

-

-	CPDF_Point LeftTop() const

-	{

-		return CPDF_Point(left,top);

-	}

-

-	CPDF_Point RightBottom() const

-	{

-		return CPDF_Point(right,bottom);

-	}

-

-	const CLST_Rect operator += (const CPDF_Point & point) 

-	{

-		this->left += point.x;

-		this->right += point.x;

-		this->top += point.y;

-		this->bottom += point.y;

-

-		return *this;

-	}

-

-	const CLST_Rect operator -= (const CPDF_Point & point) 

-	{

-		this->left -= point.x;

-		this->right -= point.x;

-		this->top -= point.y;

-		this->bottom -= point.y;

-

-		return *this;

-	}

-

-	CLST_Rect operator + (const CPDF_Point & point) const

-	{

-		return CLST_Rect(left + point.x,

-					top + point.y,

-					right + point.x,

-					bottom + point.y);

-	}

-

-	CLST_Rect operator - (const CPDF_Point & point) const

-	{

-		return CLST_Rect(left - point.x,

-					top - point.y,

-					right - point.x,

-					bottom - point.y);

-	}

-};

-

-class CFX_ListItem

-{

-public:

-	CFX_ListItem();

-	virtual ~CFX_ListItem();

-

-	void							SetFontMap(IFX_Edit_FontMap * pFontMap);

-	IFX_Edit_Iterator*				GetIterator() const;

-	IFX_Edit*						GetEdit() const;

-

-public:

-	void							SetRect(const CLST_Rect & rect);		

-	void							SetSelect(FX_BOOL bSelected);	

-	void							SetCaret(FX_BOOL bCaret);

-	void							SetText(FX_LPCWSTR text);

-	void							SetFontSize(FX_FLOAT fFontSize);

-	CFX_WideString					GetText() const;

-

-	CLST_Rect						GetRect() const;

-	FX_BOOL							IsSelected() const;

-	FX_BOOL							IsCaret() const;

-	FX_FLOAT						GetItemHeight() const;	

-	FX_WORD							GetFirstChar() const;

-

-private:

-	IFX_Edit*						m_pEdit;

-	FX_BOOL							m_bSelected;		//ÊÇ·ñÑ¡ÖÐ

-	FX_BOOL							m_bCaret;		//ÊÇ·ñΪ½¹µã£¬¶àѡʱÓÃ

-	CLST_Rect						m_rcListItem;	//ÄÚ²¿×ø±ê

-};

-

-class CFX_ListContainer

-{

-public:

-	CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0.0f,0.0f,0.0f){}

-	virtual ~CFX_ListContainer(){}

-	virtual void					SetPlateRect(const CPDF_Rect & rect){m_rcPlate = rect;}

-	CPDF_Rect						GetPlateRect() const{return m_rcPlate;}

-	void							SetContentRect(const CLST_Rect & rect){m_rcContent = rect;}

-	CLST_Rect						GetContentRect() const{return m_rcContent;}

-	CPDF_Point						GetBTPoint() const{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);}

-	CPDF_Point						GetETPoint() const{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);}

-public:

-	CPDF_Point						InnerToOuter(const CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoint().y - point.y);}

-	CPDF_Point						OuterToInner(const CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoint().y - point.y);}

-	CPDF_Rect						InnerToOuter(const CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left,rect.top));

-																			CPDF_Point ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom));

-																			return CPDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);}

-	CLST_Rect						OuterToInner(const CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left,rect.top));

-																			CPDF_Point ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom));

-																			return CLST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);}

-private:

-	CPDF_Rect						m_rcPlate; 	

-	CLST_Rect						m_rcContent;		//positive forever!

-};

-

-template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE>

-{

-public:	

-	FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }

-	TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return NULL;}

-	void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);}

-};

-

-class CFX_List : protected CFX_ListContainer , public IFX_List

-{

-public:

-	CFX_List();

-	virtual ~CFX_List();

-

-public:

-	virtual void					SetFontMap(IFX_Edit_FontMap * pFontMap);

-	virtual void					SetFontSize(FX_FLOAT fFontSize);

-

-	virtual CPDF_Rect				GetPlateRect() const;

-	virtual CPDF_Rect				GetContentRect() const;

-

-	virtual FX_FLOAT				GetFontSize() const;

-	virtual IFX_Edit*				GetItemEdit(FX_INT32 nIndex) const;

-	virtual FX_INT32				GetCount() const;

-	virtual FX_BOOL					IsItemSelected(FX_INT32 nIndex) const;

-	virtual FX_FLOAT				GetFirstHeight() const;

-	

-	virtual void					SetMultipleSel(FX_BOOL bMultiple);

-	virtual FX_BOOL					IsMultipleSel() const;	

-	virtual FX_BOOL					IsValid(FX_INT32 nItemIndex) const;

-	virtual FX_INT32				FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;	

-

-protected:

-	virtual void					Empty();

-

-	void							AddItem(FX_LPCWSTR str);

-	virtual void					ReArrange(FX_INT32 nItemIndex);	

-

-	virtual CPDF_Rect				GetItemRect(FX_INT32 nIndex) const;	

-	CFX_WideString					GetItemText(FX_INT32 nIndex) const;

-

-	void							SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);

-	void							SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret);

-

-	virtual FX_INT32				GetItemIndex(const CPDF_Point & point) const;		

-	FX_INT32						GetFirstSelected() const;

-	FX_INT32						GetLastSelected() const;

-	FX_WCHAR						Toupper(FX_WCHAR c) const;

-		

-private:

-	CLST_ArrayTemplate<CFX_ListItem*>	m_aListItems;

-	FX_FLOAT							m_fFontSize;

-	IFX_Edit_FontMap*					m_pFontMap;

-	FX_BOOL								m_bMultiple;	

-};

-

-struct CPLST_Select_Item

-{

-	CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState)

-	{

-		this->nItemIndex = nItemIndex;

-		this->nState = nState;

-	}

-

-	FX_INT32		nItemIndex;

-	FX_INT32		nState; //0:normal select -1:to deselect 1: to select

-};

-

-class CPLST_Select

-{

-public:

-	CPLST_Select();

-	virtual ~CPLST_Select();

-

-public:

-	void							Add(FX_INT32 nItemIndex);

-	void							Add(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);

-	void							Sub(FX_INT32 nItemIndex);

-	void							Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);

-	FX_BOOL							IsExist(FX_INT32 nItemIndex) const;

-	FX_INT32						Find(FX_INT32 nItemIndex) const;

-	FX_INT32						GetCount() const;

-	FX_INT32						GetItemIndex(FX_INT32 nIndex) const;

-	FX_INT32						GetState(FX_INT32 nIndex) const;

-	void							Done();

-	void							DeselectAll();

-

-private:

-	CFX_ArrayTemplate<CPLST_Select_Item*>	m_aItems;

-};

-

-class CFX_ListCtrl : public CFX_List

-{

-public:

-	CFX_ListCtrl();

-	virtual ~CFX_ListCtrl();

-

-public:

-	void							SetNotify(IFX_List_Notify * pNotify);

-

-	void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);

-	void							OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl);

-	FX_BOOL							OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl);

-

-	virtual CPDF_Point				InToOut(const CPDF_Point & point) const;

-	virtual CPDF_Point				OutToIn(const CPDF_Point & point) const;

-	virtual CPDF_Rect				InToOut(const CPDF_Rect & rect) const;

-	virtual CPDF_Rect				OutToIn(const CPDF_Rect & rect) const;

-

-	virtual void					SetPlateRect(const CPDF_Rect & rect);

-	void							SetScrollPos(const CPDF_Point & point);

-	void							ScrollToListItem(FX_INT32 nItemIndex);

-	virtual CPDF_Rect				GetItemRect(FX_INT32 nIndex) const;

-	FX_INT32						GetCaret() const {return m_nCaretIndex;}

-	FX_INT32						GetSelect() const {return m_nSelItem;}	

-	FX_INT32						GetTopItem() const;

-	virtual CPDF_Rect				GetContentRect() const;

-	virtual FX_INT32				GetItemIndex(const CPDF_Point & point) const;

-

-	void							AddString(FX_LPCWSTR string);

-	void							SetTopItem(FX_INT32 nIndex);	

-	void							Select(FX_INT32 nItemIndex);

-	virtual void					SetCaret(FX_INT32 nItemIndex);

-	virtual void					Empty();

-	virtual void					Cancel();

-	CFX_WideString					GetText() const;

-

-private:

-	void							SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);

-	void							SetSingleSelect(FX_INT32 nItemIndex);

-	void							InvalidateItem(FX_INT32 nItemIndex);

-	void							SelectItems();

-	FX_BOOL							IsItemVisible(FX_INT32 nItemIndex) const;		

-	void							SetScrollInfo();

-	void							SetScrollPosY(FX_FLOAT fy);

-	virtual void					ReArrange(FX_INT32 nItemIndex);	

-

-private:

-	IFX_List_Notify*				m_pNotify;

-	FX_BOOL							m_bNotifyFlag;

-	CPDF_Point						m_ptScrollPos;

-	CPLST_Select					m_aSelItems;	//for multiple

-	FX_INT32						m_nSelItem;		//for single

-	FX_INT32						m_nFootIndex;	//for multiple

-	FX_BOOL							m_bCtrlSel;		//for multiple

-	FX_INT32						m_nCaretIndex;	//for multiple

-};

-

-#endif

-

+// 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 _FXET_LIST_H_
+#define _FXET_LIST_H_
+
+#include "fx_edit.h"
+
+class IFX_Edit;
+
+class CLST_Size
+{
+public:
+	CLST_Size() : x(0.0f), y(0.0f)
+	{		
+	}
+
+	CLST_Size(FX_FLOAT x,FX_FLOAT y)
+	{ 
+		this->x = x;
+		this->y = y;
+	}
+
+	void Default()
+	{
+		x = 0.0f;
+		y = 0.0f;
+	}
+
+	FX_BOOL operator != (const CLST_Size & size) const
+	{
+		return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
+	}
+
+	FX_FLOAT x,y;
+};
+
+class CLST_Rect : public CPDF_Rect
+{
+public:
+	CLST_Rect()
+	{	
+		left = top = right = bottom = 0.0f;
+	}
+
+	CLST_Rect(FX_FLOAT left,FX_FLOAT top,
+						FX_FLOAT right,FX_FLOAT bottom)
+	{ 
+		this->left = left; 
+		this->top = top; 
+		this->right = right; 
+		this->bottom = bottom; 
+	}
+
+	CLST_Rect(const CPDF_Rect & rect)
+	{ 
+		this->left = rect.left; 
+		this->top = rect.top; 
+		this->right = rect.right; 
+		this->bottom = rect.bottom; 
+	}
+
+	void Default()
+	{
+		left = top = right = bottom = 0.0f;
+	}
+
+	const CLST_Rect operator = (const CPDF_Rect & rect)
+	{
+		this->left = rect.left;
+		this->top = rect.top;
+		this->right = rect.right;
+		this->bottom = rect.bottom;
+
+		return *this;
+	}
+
+	FX_BOOL operator == (const CLST_Rect & rect) const
+	{
+		return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
+	}
+
+	FX_BOOL operator != (const CLST_Rect & rect) const
+	{
+		return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
+	}
+
+	FX_FLOAT Width() const
+	{
+		return this->right - this->left;
+	}
+
+	FX_FLOAT Height() const
+	{
+		if (this->top > this->bottom)
+			return this->top - this->bottom;
+		else
+			return this->bottom - this->top;
+	}
+
+	CPDF_Point LeftTop() const
+	{
+		return CPDF_Point(left,top);
+	}
+
+	CPDF_Point RightBottom() const
+	{
+		return CPDF_Point(right,bottom);
+	}
+
+	const CLST_Rect operator += (const CPDF_Point & point) 
+	{
+		this->left += point.x;
+		this->right += point.x;
+		this->top += point.y;
+		this->bottom += point.y;
+
+		return *this;
+	}
+
+	const CLST_Rect operator -= (const CPDF_Point & point) 
+	{
+		this->left -= point.x;
+		this->right -= point.x;
+		this->top -= point.y;
+		this->bottom -= point.y;
+
+		return *this;
+	}
+
+	CLST_Rect operator + (const CPDF_Point & point) const
+	{
+		return CLST_Rect(left + point.x,
+					top + point.y,
+					right + point.x,
+					bottom + point.y);
+	}
+
+	CLST_Rect operator - (const CPDF_Point & point) const
+	{
+		return CLST_Rect(left - point.x,
+					top - point.y,
+					right - point.x,
+					bottom - point.y);
+	}
+};
+
+class CFX_ListItem
+{
+public:
+	CFX_ListItem();
+	virtual ~CFX_ListItem();
+
+	void							SetFontMap(IFX_Edit_FontMap * pFontMap);
+	IFX_Edit_Iterator*				GetIterator() const;
+	IFX_Edit*						GetEdit() const;
+
+public:
+	void							SetRect(const CLST_Rect & rect);		
+	void							SetSelect(FX_BOOL bSelected);	
+	void							SetCaret(FX_BOOL bCaret);
+	void							SetText(FX_LPCWSTR text);
+	void							SetFontSize(FX_FLOAT fFontSize);
+	CFX_WideString					GetText() const;
+
+	CLST_Rect						GetRect() const;
+	FX_BOOL							IsSelected() const;
+	FX_BOOL							IsCaret() const;
+	FX_FLOAT						GetItemHeight() const;	
+	FX_WORD							GetFirstChar() const;
+
+private:
+	IFX_Edit*						m_pEdit;
+	FX_BOOL							m_bSelected;		//ÊÇ·ñÑ¡ÖÐ
+	FX_BOOL							m_bCaret;		//ÊÇ·ñΪ½¹µã£¬¶àѡʱÓÃ
+	CLST_Rect						m_rcListItem;	//ÄÚ²¿×ø±ê
+};
+
+class CFX_ListContainer
+{
+public:
+	CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0.0f,0.0f,0.0f){}
+	virtual ~CFX_ListContainer(){}
+	virtual void					SetPlateRect(const CPDF_Rect & rect){m_rcPlate = rect;}
+	CPDF_Rect						GetPlateRect() const{return m_rcPlate;}
+	void							SetContentRect(const CLST_Rect & rect){m_rcContent = rect;}
+	CLST_Rect						GetContentRect() const{return m_rcContent;}
+	CPDF_Point						GetBTPoint() const{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);}
+	CPDF_Point						GetETPoint() const{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);}
+public:
+	CPDF_Point						InnerToOuter(const CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoint().y - point.y);}
+	CPDF_Point						OuterToInner(const CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoint().y - point.y);}
+	CPDF_Rect						InnerToOuter(const CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left,rect.top));
+																			CPDF_Point ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom));
+																			return CPDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);}
+	CLST_Rect						OuterToInner(const CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left,rect.top));
+																			CPDF_Point ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom));
+																			return CLST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);}
+private:
+	CPDF_Rect						m_rcPlate; 	
+	CLST_Rect						m_rcContent;		//positive forever!
+};
+
+template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
+{
+public:	
+	FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
+	TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return NULL;}
+	void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);}
+};
+
+class CFX_List : protected CFX_ListContainer , public IFX_List
+{
+public:
+	CFX_List();
+	virtual ~CFX_List();
+
+public:
+	virtual void					SetFontMap(IFX_Edit_FontMap * pFontMap);
+	virtual void					SetFontSize(FX_FLOAT fFontSize);
+
+	virtual CPDF_Rect				GetPlateRect() const;
+	virtual CPDF_Rect				GetContentRect() const;
+
+	virtual FX_FLOAT				GetFontSize() const;
+	virtual IFX_Edit*				GetItemEdit(FX_INT32 nIndex) const;
+	virtual FX_INT32				GetCount() const;
+	virtual FX_BOOL					IsItemSelected(FX_INT32 nIndex) const;
+	virtual FX_FLOAT				GetFirstHeight() const;
+	
+	virtual void					SetMultipleSel(FX_BOOL bMultiple);
+	virtual FX_BOOL					IsMultipleSel() const;	
+	virtual FX_BOOL					IsValid(FX_INT32 nItemIndex) const;
+	virtual FX_INT32				FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;	
+
+protected:
+	virtual void					Empty();
+
+	void							AddItem(FX_LPCWSTR str);
+	virtual void					ReArrange(FX_INT32 nItemIndex);	
+
+	virtual CPDF_Rect				GetItemRect(FX_INT32 nIndex) const;	
+	CFX_WideString					GetItemText(FX_INT32 nIndex) const;
+
+	void							SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
+	void							SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret);
+
+	virtual FX_INT32				GetItemIndex(const CPDF_Point & point) const;		
+	FX_INT32						GetFirstSelected() const;
+	FX_INT32						GetLastSelected() const;
+	FX_WCHAR						Toupper(FX_WCHAR c) const;
+		
+private:
+	CLST_ArrayTemplate<CFX_ListItem*>	m_aListItems;
+	FX_FLOAT							m_fFontSize;
+	IFX_Edit_FontMap*					m_pFontMap;
+	FX_BOOL								m_bMultiple;	
+};
+
+struct CPLST_Select_Item
+{
+	CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState)
+	{
+		this->nItemIndex = nItemIndex;
+		this->nState = nState;
+	}
+
+	FX_INT32		nItemIndex;
+	FX_INT32		nState; //0:normal select -1:to deselect 1: to select
+};
+
+class CPLST_Select
+{
+public:
+	CPLST_Select();
+	virtual ~CPLST_Select();
+
+public:
+	void							Add(FX_INT32 nItemIndex);
+	void							Add(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
+	void							Sub(FX_INT32 nItemIndex);
+	void							Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
+	FX_BOOL							IsExist(FX_INT32 nItemIndex) const;
+	FX_INT32						Find(FX_INT32 nItemIndex) const;
+	FX_INT32						GetCount() const;
+	FX_INT32						GetItemIndex(FX_INT32 nIndex) const;
+	FX_INT32						GetState(FX_INT32 nIndex) const;
+	void							Done();
+	void							DeselectAll();
+
+private:
+	CFX_ArrayTemplate<CPLST_Select_Item*>	m_aItems;
+};
+
+class CFX_ListCtrl : public CFX_List
+{
+public:
+	CFX_ListCtrl();
+	virtual ~CFX_ListCtrl();
+
+public:
+	void							SetNotify(IFX_List_Notify * pNotify);
+
+	void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
+	void							OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl);
+	FX_BOOL							OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl);
+
+	virtual CPDF_Point				InToOut(const CPDF_Point & point) const;
+	virtual CPDF_Point				OutToIn(const CPDF_Point & point) const;
+	virtual CPDF_Rect				InToOut(const CPDF_Rect & rect) const;
+	virtual CPDF_Rect				OutToIn(const CPDF_Rect & rect) const;
+
+	virtual void					SetPlateRect(const CPDF_Rect & rect);
+	void							SetScrollPos(const CPDF_Point & point);
+	void							ScrollToListItem(FX_INT32 nItemIndex);
+	virtual CPDF_Rect				GetItemRect(FX_INT32 nIndex) const;
+	FX_INT32						GetCaret() const {return m_nCaretIndex;}
+	FX_INT32						GetSelect() const {return m_nSelItem;}	
+	FX_INT32						GetTopItem() const;
+	virtual CPDF_Rect				GetContentRect() const;
+	virtual FX_INT32				GetItemIndex(const CPDF_Point & point) const;
+
+	void							AddString(FX_LPCWSTR string);
+	void							SetTopItem(FX_INT32 nIndex);	
+	void							Select(FX_INT32 nItemIndex);
+	virtual void					SetCaret(FX_INT32 nItemIndex);
+	virtual void					Empty();
+	virtual void					Cancel();
+	CFX_WideString					GetText() const;
+
+private:
+	void							SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
+	void							SetSingleSelect(FX_INT32 nItemIndex);
+	void							InvalidateItem(FX_INT32 nItemIndex);
+	void							SelectItems();
+	FX_BOOL							IsItemVisible(FX_INT32 nItemIndex) const;		
+	void							SetScrollInfo();
+	void							SetScrollPosY(FX_FLOAT fy);
+	virtual void					ReArrange(FX_INT32 nItemIndex);	
+
+private:
+	IFX_List_Notify*				m_pNotify;
+	FX_BOOL							m_bNotifyFlag;
+	CPDF_Point						m_ptScrollPos;
+	CPLST_Select					m_aSelItems;	//for multiple
+	FX_INT32						m_nSelItem;		//for single
+	FX_INT32						m_nFootIndex;	//for multiple
+	FX_BOOL							m_bCtrlSel;		//for multiple
+	FX_INT32						m_nCaretIndex;	//for multiple
+};
+
+#endif
+
diff --git a/fpdfsdk/include/fxedit/fxet_stub.h b/fpdfsdk/include/fxedit/fxet_stub.h
index aa50cd5..a1aa2e2 100644
--- a/fpdfsdk/include/fxedit/fxet_stub.h
+++ b/fpdfsdk/include/fxedit/fxet_stub.h
@@ -1,26 +1,26 @@
-// 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 _FXET_STUB_H_

-#define _FXET_STUB_H_

-

-#include "../../../core/include/fpdfapi/fpdf_module.h" 

-#include "../../../core/include/fpdfapi/fpdf_render.h" 

-#include "../../../core/include/fpdfapi/fpdf_pageobj.h" 

-#include "../../../core/include/fpdfdoc/fpdf_vt.h" 

-#include "../fx_systemhandler.h"

-#ifdef FX_READER_DLL

-	#ifdef _DEBUG

-		#pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fxcoredll[dbg,w32,vc6].lib")

-		#pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fpdfdocdll[dbg,w32,vc6].lib")

-	#else

-		#pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fxcoredll[rel,w32,vc6].lib")

-		#pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fpdfdocdll[rel,w32,vc6].lib")

-	#endif

-#endif

-

-#endif 

-

+// 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 _FXET_STUB_H_
+#define _FXET_STUB_H_
+
+#include "../../../core/include/fpdfapi/fpdf_module.h" 
+#include "../../../core/include/fpdfapi/fpdf_render.h" 
+#include "../../../core/include/fpdfapi/fpdf_pageobj.h" 
+#include "../../../core/include/fpdfdoc/fpdf_vt.h" 
+#include "../fx_systemhandler.h"
+#ifdef FX_READER_DLL
+	#ifdef _DEBUG
+		#pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fxcoredll[dbg,w32,vc6].lib")
+		#pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fpdfdocdll[dbg,w32,vc6].lib")
+	#else
+		#pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fxcoredll[rel,w32,vc6].lib")
+		#pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fpdfdocdll[rel,w32,vc6].lib")
+	#endif
+#endif
+
+#endif 
+
diff --git a/fpdfsdk/include/javascript/Consts.h b/fpdfsdk/include/javascript/Consts.h
index 32b0217..c3a954e 100644
--- a/fpdfsdk/include/javascript/Consts.h
+++ b/fpdfsdk/include/javascript/Consts.h
@@ -1,126 +1,126 @@
-// 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 _CONSTS_H_

-#define _CONSTS_H_

-

-/* ------------------------------ border ------------------------------ */

-

-class CJS_Border : public CJS_Object

-{

-public:

-	CJS_Border(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Border(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ display ------------------------------ */

-

-class CJS_Display : public CJS_Object

-{

-public:

-	CJS_Display(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Display(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ font ------------------------------ */

-

-class CJS_Font : public CJS_Object

-{

-public:

-	CJS_Font(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Font(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ highlight ------------------------------ */

-

-class CJS_Highlight : public CJS_Object

-{

-public:

-	CJS_Highlight(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Highlight(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ position ------------------------------ */

-

-class CJS_Position : public CJS_Object

-{

-public:

-	CJS_Position(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Position(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ scaleHow ------------------------------ */

-

-class CJS_ScaleHow : public CJS_Object

-{

-public:

-	CJS_ScaleHow(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_ScaleHow(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ scaleWhen ------------------------------ */

-

-class CJS_ScaleWhen : public CJS_Object

-{

-public:

-	CJS_ScaleWhen(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_ScaleWhen(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ style ------------------------------ */

-

-class CJS_Style : public CJS_Object

-{

-public:

-	CJS_Style(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Style(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ zoomtype ------------------------------ */

-

-class CJS_Zoomtype : public CJS_Object

-{

-public:

-	CJS_Zoomtype(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Zoomtype(void){};

-

-	DECLARE_JS_CLASS_CONST();

-};

-

-/* ------------------------------ CJS_GlobalConsts ------------------------------ */

-

-class CJS_GlobalConsts : public CJS_Object

-{

-public:

-	static int				Init(IJS_Runtime* pRuntime);

-};

-

-/* ------------------------------ CJS_GlobalArrays ------------------------------ */

-

-class CJS_GlobalArrays : public CJS_Object

-{

-public:

-	static int				Init(IJS_Runtime* pRuntime);

-};

-

-#endif //_CONSTS_H_

-

+// 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 _CONSTS_H_
+#define _CONSTS_H_
+
+/* ------------------------------ border ------------------------------ */
+
+class CJS_Border : public CJS_Object
+{
+public:
+	CJS_Border(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Border(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ display ------------------------------ */
+
+class CJS_Display : public CJS_Object
+{
+public:
+	CJS_Display(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Display(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ font ------------------------------ */
+
+class CJS_Font : public CJS_Object
+{
+public:
+	CJS_Font(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Font(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ highlight ------------------------------ */
+
+class CJS_Highlight : public CJS_Object
+{
+public:
+	CJS_Highlight(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Highlight(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ position ------------------------------ */
+
+class CJS_Position : public CJS_Object
+{
+public:
+	CJS_Position(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Position(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ scaleHow ------------------------------ */
+
+class CJS_ScaleHow : public CJS_Object
+{
+public:
+	CJS_ScaleHow(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_ScaleHow(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ scaleWhen ------------------------------ */
+
+class CJS_ScaleWhen : public CJS_Object
+{
+public:
+	CJS_ScaleWhen(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_ScaleWhen(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ style ------------------------------ */
+
+class CJS_Style : public CJS_Object
+{
+public:
+	CJS_Style(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Style(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ zoomtype ------------------------------ */
+
+class CJS_Zoomtype : public CJS_Object
+{
+public:
+	CJS_Zoomtype(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Zoomtype(void){};
+
+	DECLARE_JS_CLASS_CONST();
+};
+
+/* ------------------------------ CJS_GlobalConsts ------------------------------ */
+
+class CJS_GlobalConsts : public CJS_Object
+{
+public:
+	static int				Init(IJS_Runtime* pRuntime);
+};
+
+/* ------------------------------ CJS_GlobalArrays ------------------------------ */
+
+class CJS_GlobalArrays : public CJS_Object
+{
+public:
+	static int				Init(IJS_Runtime* pRuntime);
+};
+
+#endif //_CONSTS_H_
+
diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h
index 3e9669b..ca8b51b 100644
--- a/fpdfsdk/include/javascript/Document.h
+++ b/fpdfsdk/include/javascript/Document.h
@@ -1,282 +1,282 @@
-// 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 _DOCUMENT_H_

-#define _DOCUMENT_H_

-

-

-

-class PrintParamsObj : public CJS_EmbedObj

-{

-public:

-	PrintParamsObj(CJS_Object* pJSObject);

-	virtual ~PrintParamsObj(){}

-	

-public:

-	FX_BOOL bUI;

-	int nStart;

-	int nEnd;

-	FX_BOOL bSilent;

-	FX_BOOL bShrinkToFit;

-	FX_BOOL bPrintAsImage;

-	FX_BOOL bReverse;

-	FX_BOOL bAnnotations;

-};

-

-class CJS_PrintParamsObj : public CJS_Object

-{

-public:

-	CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}

-	virtual ~CJS_PrintParamsObj(){}

-	

-	DECLARE_JS_CLASS(CJS_PrintParamsObj);

-};

-

-

-class Icon;

-class Field;

-

-struct IconElement

-{

-	IconElement() : IconName(L""), IconStream(NULL), NextIcon(NULL){}

-	virtual ~IconElement()

-	{

-	}

-	CFX_WideString	IconName;

-	IconElement*	NextIcon;

-	Icon*			IconStream;

-};

-

-class IconTree

-{

-public:

-	IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0)

-	{

-

-	}

-

-	virtual ~IconTree()

-	{

-	}

-

-public:

-	void			InsertIconElement(IconElement* pNewIcon);

-	void			DeleteIconElement(CFX_WideString swIconName);

-	void			DeleteIconTree();

-	int				GetLength();

-	IconElement*	operator[](int iIndex);

-

-private:

-	IconElement*	m_pHead;

-	IconElement*	m_pEnd;

-	int				m_iLength;

-};

-

-struct CJS_DelayData;

-struct CJS_DelayAnnot;

-struct CJS_AnnotObj;

-

-class Document : public CJS_EmbedObj

-{

-public:

-	Document(CJS_Object* pJSObject);

-	virtual ~Document();

-

-public:

-	FX_BOOL	ADBE(OBJ_PROP_PARAMS);

-	FX_BOOL	author(OBJ_PROP_PARAMS);

-	FX_BOOL	baseURL(OBJ_PROP_PARAMS);

-	FX_BOOL	bookmarkRoot(OBJ_PROP_PARAMS);

-	FX_BOOL	calculate(OBJ_PROP_PARAMS);

-	FX_BOOL	Collab(OBJ_PROP_PARAMS);

-	FX_BOOL	creationDate(OBJ_PROP_PARAMS);

-	FX_BOOL	creator(OBJ_PROP_PARAMS);

-	FX_BOOL	delay(OBJ_PROP_PARAMS);

-	FX_BOOL	dirty(OBJ_PROP_PARAMS);

-	FX_BOOL	documentFileName(OBJ_PROP_PARAMS);

-	FX_BOOL external(OBJ_PROP_PARAMS);

-	FX_BOOL	filesize(OBJ_PROP_PARAMS);

-	FX_BOOL	icons(OBJ_PROP_PARAMS);

-	FX_BOOL	info(OBJ_PROP_PARAMS);

-	FX_BOOL	keywords(OBJ_PROP_PARAMS);

-	FX_BOOL	layout(OBJ_PROP_PARAMS);

-	FX_BOOL	media(OBJ_PROP_PARAMS);

-	FX_BOOL	modDate(OBJ_PROP_PARAMS);

-	FX_BOOL	mouseX(OBJ_PROP_PARAMS);

-	FX_BOOL	mouseY(OBJ_PROP_PARAMS);

-	FX_BOOL	numFields(OBJ_PROP_PARAMS);

-	FX_BOOL	numPages(OBJ_PROP_PARAMS);

-	FX_BOOL	pageNum(OBJ_PROP_PARAMS);

-	FX_BOOL	pageWindowRect(OBJ_PROP_PARAMS);

-	FX_BOOL	path(OBJ_PROP_PARAMS);

-	FX_BOOL	producer(OBJ_PROP_PARAMS);

-	FX_BOOL	subject(OBJ_PROP_PARAMS);

-	FX_BOOL	title(OBJ_PROP_PARAMS);

-	FX_BOOL	zoom(OBJ_PROP_PARAMS);

-	FX_BOOL	zoomType(OBJ_PROP_PARAMS);

-

-	FX_BOOL addAnnot(OBJ_METHOD_PARAMS);

-	FX_BOOL	addField(OBJ_METHOD_PARAMS);

-	FX_BOOL	addLink(OBJ_METHOD_PARAMS);

-	FX_BOOL	addIcon(OBJ_METHOD_PARAMS);

-	FX_BOOL	calculateNow(OBJ_METHOD_PARAMS);

-	FX_BOOL	closeDoc(OBJ_METHOD_PARAMS);

-	FX_BOOL	createDataObject(OBJ_METHOD_PARAMS);

-	FX_BOOL deletePages(OBJ_METHOD_PARAMS);

-	FX_BOOL	exportAsText(OBJ_METHOD_PARAMS);

-	FX_BOOL	exportAsFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL	exportAsXFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL extractPages(OBJ_METHOD_PARAMS);

-	FX_BOOL	getAnnot(OBJ_METHOD_PARAMS);

-	FX_BOOL	getAnnots(OBJ_METHOD_PARAMS);

-	FX_BOOL	getAnnot3D(OBJ_METHOD_PARAMS);

-	FX_BOOL	getAnnots3D(OBJ_METHOD_PARAMS);

-	FX_BOOL	getField(OBJ_METHOD_PARAMS);

-	FX_BOOL	getIcon(OBJ_METHOD_PARAMS);

-	FX_BOOL	getLinks(OBJ_METHOD_PARAMS);

-	FX_BOOL	getNthFieldName(OBJ_METHOD_PARAMS);

-	FX_BOOL	getOCGs(OBJ_METHOD_PARAMS);

-	FX_BOOL	getPageBox(OBJ_METHOD_PARAMS);

-	FX_BOOL	getPageNthWord(OBJ_METHOD_PARAMS);

-	FX_BOOL	getPageNthWordQuads(OBJ_METHOD_PARAMS);

-	FX_BOOL	getPageNumWords(OBJ_METHOD_PARAMS);

-	FX_BOOL getPrintParams(OBJ_METHOD_PARAMS);

-	FX_BOOL getURL(OBJ_METHOD_PARAMS);

-	FX_BOOL	importAnFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL	importAnXFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL	importTextData(OBJ_METHOD_PARAMS);

-	FX_BOOL insertPages(OBJ_METHOD_PARAMS);

-	FX_BOOL	mailForm(OBJ_METHOD_PARAMS);

-	FX_BOOL	print(OBJ_METHOD_PARAMS);

-	FX_BOOL	removeField(OBJ_METHOD_PARAMS);

-	FX_BOOL replacePages(OBJ_METHOD_PARAMS);

-	FX_BOOL	resetForm(OBJ_METHOD_PARAMS);

-	FX_BOOL	saveAs(OBJ_METHOD_PARAMS);

-	FX_BOOL	submitForm(OBJ_METHOD_PARAMS);

-	FX_BOOL	mailDoc(OBJ_METHOD_PARAMS);

-	FX_BOOL	removeIcon(OBJ_METHOD_PARAMS);

-	

-public:

-	void AttachDoc(CPDFSDK_Document* pDoc);

-	CPDFSDK_Document* GetReaderDoc();

-

-	static FX_BOOL				ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName);

-	static FX_BOOL				ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName);

-

-public:

-	void						AddDelayData(CJS_DelayData* pData);

-	void						DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);

-

-	void						AddDelayAnnotData(CJS_AnnotObj *pData);

-	void						DoAnnotDelay();

-	void						SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}

-

-private:

-	CFX_WideString				ReversalStr(CFX_WideString cbFrom);

-	CFX_WideString				CutString(CFX_WideString cbFrom);

-	bool						IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);

-	int							CountWords(CPDF_TextObject* pTextObj);

-	CFX_WideString				GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);

-

-	FX_BOOL						ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj);

-

-private:

-	v8::Isolate*					m_isolate;

-	IconTree*					m_pIconTree;

-	CPDFSDK_Document*			m_pDocument;

-	CFX_WideString				m_cwBaseURL;

-

-	FX_BOOL								m_bDelay;

-	CFX_ArrayTemplate<CJS_DelayData*>	m_DelayData;

-	CFX_ArrayTemplate<CJS_AnnotObj*>	m_DelayAnnotData;

-};

-

-class CJS_Document : public CJS_Object

-{

-public:

-	CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Document(){};

-

-	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);	

-

-	DECLARE_JS_CLASS(CJS_Document);

-

-	JS_STATIC_PROP(ADBE, Document);

-	JS_STATIC_PROP(author, Document);

-	JS_STATIC_PROP(baseURL, Document);

-	JS_STATIC_PROP(bookmarkRoot, Document);

-	JS_STATIC_PROP(calculate, Document);

-	JS_STATIC_PROP(Collab, Document);

-	JS_STATIC_PROP(creationDate, Document);

-	JS_STATIC_PROP(creator, Document);

-	JS_STATIC_PROP(delay, Document);

-	JS_STATIC_PROP(dirty, Document);

-	JS_STATIC_PROP(documentFileName, Document);

-	JS_STATIC_PROP(external, Document);

-	JS_STATIC_PROP(filesize, Document);

-	JS_STATIC_PROP(icons, Document);

-	JS_STATIC_PROP(info, Document);

-	JS_STATIC_PROP(keywords, Document);

-	JS_STATIC_PROP(layout, Document);

-	JS_STATIC_PROP(media, Document);

-	JS_STATIC_PROP(modDate, Document);

-	JS_STATIC_PROP(mouseX, Document);

-	JS_STATIC_PROP(mouseY, Document);

-	JS_STATIC_PROP(numFields, Document);

-	JS_STATIC_PROP(numPages, Document);

-	JS_STATIC_PROP(pageNum, Document);

-	JS_STATIC_PROP(pageWindowRect, Document);

-	JS_STATIC_PROP(path, Document);

-	JS_STATIC_PROP(producer, Document);

-	JS_STATIC_PROP(subject, Document);

-	JS_STATIC_PROP(title, Document);

-	JS_STATIC_PROP(zoom, Document);

-	JS_STATIC_PROP(zoomType, Document);

-

-	JS_STATIC_METHOD(addAnnot,Document);

-	JS_STATIC_METHOD(addField, Document);

-	JS_STATIC_METHOD(addLink, Document);

-	JS_STATIC_METHOD(addIcon, Document);

-	JS_STATIC_METHOD(calculateNow, Document);

-	JS_STATIC_METHOD(closeDoc, Document);

-	JS_STATIC_METHOD(createDataObject, Document);

-	JS_STATIC_METHOD(deletePages, Document);

-	JS_STATIC_METHOD(exportAsText, Document);

-	JS_STATIC_METHOD(exportAsFDF, Document);

-	JS_STATIC_METHOD(exportAsXFDF, Document);

-	JS_STATIC_METHOD(extractPages, Document);

-	JS_STATIC_METHOD(getAnnot, Document);

-	JS_STATIC_METHOD(getAnnots, Document);

-	JS_STATIC_METHOD(getAnnot3D, Document);

-	JS_STATIC_METHOD(getAnnots3D, Document);

-	JS_STATIC_METHOD(getField, Document);

-	JS_STATIC_METHOD(getIcon, Document);

-	JS_STATIC_METHOD(getLinks, Document);

-	JS_STATIC_METHOD(getNthFieldName, Document);

-	JS_STATIC_METHOD(getOCGs, Document);

-	JS_STATIC_METHOD(getPageBox, Document);

-	JS_STATIC_METHOD(getPageNthWord, Document);

-	JS_STATIC_METHOD(getPageNthWordQuads, Document);

-	JS_STATIC_METHOD(getPageNumWords, Document);

-	JS_STATIC_METHOD(getPrintParams, Document);

-	JS_STATIC_METHOD(getURL, Document);

-	JS_STATIC_METHOD(importAnFDF, Document);

-	JS_STATIC_METHOD(importAnXFDF, Document);

-	JS_STATIC_METHOD(importTextData, Document);

-	JS_STATIC_METHOD(insertPages, Document);

-	JS_STATIC_METHOD(mailForm, Document);

-	JS_STATIC_METHOD(print, Document);

-	JS_STATIC_METHOD(removeField, Document);

-	JS_STATIC_METHOD(replacePages, Document);

-	JS_STATIC_METHOD(removeIcon, Document);

-	JS_STATIC_METHOD(resetForm, Document);

-	JS_STATIC_METHOD(saveAs, Document);

-	JS_STATIC_METHOD(submitForm, Document);

-	JS_STATIC_METHOD(mailDoc, Document);

-};

-

-#endif//_DOCUMENT_H_

-

+// 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 _DOCUMENT_H_
+#define _DOCUMENT_H_
+
+
+
+class PrintParamsObj : public CJS_EmbedObj
+{
+public:
+	PrintParamsObj(CJS_Object* pJSObject);
+	virtual ~PrintParamsObj(){}
+	
+public:
+	FX_BOOL bUI;
+	int nStart;
+	int nEnd;
+	FX_BOOL bSilent;
+	FX_BOOL bShrinkToFit;
+	FX_BOOL bPrintAsImage;
+	FX_BOOL bReverse;
+	FX_BOOL bAnnotations;
+};
+
+class CJS_PrintParamsObj : public CJS_Object
+{
+public:
+	CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
+	virtual ~CJS_PrintParamsObj(){}
+	
+	DECLARE_JS_CLASS(CJS_PrintParamsObj);
+};
+
+
+class Icon;
+class Field;
+
+struct IconElement
+{
+	IconElement() : IconName(L""), IconStream(NULL), NextIcon(NULL){}
+	virtual ~IconElement()
+	{
+	}
+	CFX_WideString	IconName;
+	IconElement*	NextIcon;
+	Icon*			IconStream;
+};
+
+class IconTree
+{
+public:
+	IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0)
+	{
+
+	}
+
+	virtual ~IconTree()
+	{
+	}
+
+public:
+	void			InsertIconElement(IconElement* pNewIcon);
+	void			DeleteIconElement(CFX_WideString swIconName);
+	void			DeleteIconTree();
+	int				GetLength();
+	IconElement*	operator[](int iIndex);
+
+private:
+	IconElement*	m_pHead;
+	IconElement*	m_pEnd;
+	int				m_iLength;
+};
+
+struct CJS_DelayData;
+struct CJS_DelayAnnot;
+struct CJS_AnnotObj;
+
+class Document : public CJS_EmbedObj
+{
+public:
+	Document(CJS_Object* pJSObject);
+	virtual ~Document();
+
+public:
+	FX_BOOL	ADBE(OBJ_PROP_PARAMS);
+	FX_BOOL	author(OBJ_PROP_PARAMS);
+	FX_BOOL	baseURL(OBJ_PROP_PARAMS);
+	FX_BOOL	bookmarkRoot(OBJ_PROP_PARAMS);
+	FX_BOOL	calculate(OBJ_PROP_PARAMS);
+	FX_BOOL	Collab(OBJ_PROP_PARAMS);
+	FX_BOOL	creationDate(OBJ_PROP_PARAMS);
+	FX_BOOL	creator(OBJ_PROP_PARAMS);
+	FX_BOOL	delay(OBJ_PROP_PARAMS);
+	FX_BOOL	dirty(OBJ_PROP_PARAMS);
+	FX_BOOL	documentFileName(OBJ_PROP_PARAMS);
+	FX_BOOL external(OBJ_PROP_PARAMS);
+	FX_BOOL	filesize(OBJ_PROP_PARAMS);
+	FX_BOOL	icons(OBJ_PROP_PARAMS);
+	FX_BOOL	info(OBJ_PROP_PARAMS);
+	FX_BOOL	keywords(OBJ_PROP_PARAMS);
+	FX_BOOL	layout(OBJ_PROP_PARAMS);
+	FX_BOOL	media(OBJ_PROP_PARAMS);
+	FX_BOOL	modDate(OBJ_PROP_PARAMS);
+	FX_BOOL	mouseX(OBJ_PROP_PARAMS);
+	FX_BOOL	mouseY(OBJ_PROP_PARAMS);
+	FX_BOOL	numFields(OBJ_PROP_PARAMS);
+	FX_BOOL	numPages(OBJ_PROP_PARAMS);
+	FX_BOOL	pageNum(OBJ_PROP_PARAMS);
+	FX_BOOL	pageWindowRect(OBJ_PROP_PARAMS);
+	FX_BOOL	path(OBJ_PROP_PARAMS);
+	FX_BOOL	producer(OBJ_PROP_PARAMS);
+	FX_BOOL	subject(OBJ_PROP_PARAMS);
+	FX_BOOL	title(OBJ_PROP_PARAMS);
+	FX_BOOL	zoom(OBJ_PROP_PARAMS);
+	FX_BOOL	zoomType(OBJ_PROP_PARAMS);
+
+	FX_BOOL addAnnot(OBJ_METHOD_PARAMS);
+	FX_BOOL	addField(OBJ_METHOD_PARAMS);
+	FX_BOOL	addLink(OBJ_METHOD_PARAMS);
+	FX_BOOL	addIcon(OBJ_METHOD_PARAMS);
+	FX_BOOL	calculateNow(OBJ_METHOD_PARAMS);
+	FX_BOOL	closeDoc(OBJ_METHOD_PARAMS);
+	FX_BOOL	createDataObject(OBJ_METHOD_PARAMS);
+	FX_BOOL deletePages(OBJ_METHOD_PARAMS);
+	FX_BOOL	exportAsText(OBJ_METHOD_PARAMS);
+	FX_BOOL	exportAsFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL	exportAsXFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL extractPages(OBJ_METHOD_PARAMS);
+	FX_BOOL	getAnnot(OBJ_METHOD_PARAMS);
+	FX_BOOL	getAnnots(OBJ_METHOD_PARAMS);
+	FX_BOOL	getAnnot3D(OBJ_METHOD_PARAMS);
+	FX_BOOL	getAnnots3D(OBJ_METHOD_PARAMS);
+	FX_BOOL	getField(OBJ_METHOD_PARAMS);
+	FX_BOOL	getIcon(OBJ_METHOD_PARAMS);
+	FX_BOOL	getLinks(OBJ_METHOD_PARAMS);
+	FX_BOOL	getNthFieldName(OBJ_METHOD_PARAMS);
+	FX_BOOL	getOCGs(OBJ_METHOD_PARAMS);
+	FX_BOOL	getPageBox(OBJ_METHOD_PARAMS);
+	FX_BOOL	getPageNthWord(OBJ_METHOD_PARAMS);
+	FX_BOOL	getPageNthWordQuads(OBJ_METHOD_PARAMS);
+	FX_BOOL	getPageNumWords(OBJ_METHOD_PARAMS);
+	FX_BOOL getPrintParams(OBJ_METHOD_PARAMS);
+	FX_BOOL getURL(OBJ_METHOD_PARAMS);
+	FX_BOOL	importAnFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL	importAnXFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL	importTextData(OBJ_METHOD_PARAMS);
+	FX_BOOL insertPages(OBJ_METHOD_PARAMS);
+	FX_BOOL	mailForm(OBJ_METHOD_PARAMS);
+	FX_BOOL	print(OBJ_METHOD_PARAMS);
+	FX_BOOL	removeField(OBJ_METHOD_PARAMS);
+	FX_BOOL replacePages(OBJ_METHOD_PARAMS);
+	FX_BOOL	resetForm(OBJ_METHOD_PARAMS);
+	FX_BOOL	saveAs(OBJ_METHOD_PARAMS);
+	FX_BOOL	submitForm(OBJ_METHOD_PARAMS);
+	FX_BOOL	mailDoc(OBJ_METHOD_PARAMS);
+	FX_BOOL	removeIcon(OBJ_METHOD_PARAMS);
+	
+public:
+	void AttachDoc(CPDFSDK_Document* pDoc);
+	CPDFSDK_Document* GetReaderDoc();
+
+	static FX_BOOL				ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName);
+	static FX_BOOL				ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName);
+
+public:
+	void						AddDelayData(CJS_DelayData* pData);
+	void						DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
+
+	void						AddDelayAnnotData(CJS_AnnotObj *pData);
+	void						DoAnnotDelay();
+	void						SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
+
+private:
+	CFX_WideString				ReversalStr(CFX_WideString cbFrom);
+	CFX_WideString				CutString(CFX_WideString cbFrom);
+	bool						IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
+	int							CountWords(CPDF_TextObject* pTextObj);
+	CFX_WideString				GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
+
+	FX_BOOL						ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj);
+
+private:
+	v8::Isolate*					m_isolate;
+	IconTree*					m_pIconTree;
+	CPDFSDK_Document*			m_pDocument;
+	CFX_WideString				m_cwBaseURL;
+
+	FX_BOOL								m_bDelay;
+	CFX_ArrayTemplate<CJS_DelayData*>	m_DelayData;
+	CFX_ArrayTemplate<CJS_AnnotObj*>	m_DelayAnnotData;
+};
+
+class CJS_Document : public CJS_Object
+{
+public:
+	CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Document(){};
+
+	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);	
+
+	DECLARE_JS_CLASS(CJS_Document);
+
+	JS_STATIC_PROP(ADBE, Document);
+	JS_STATIC_PROP(author, Document);
+	JS_STATIC_PROP(baseURL, Document);
+	JS_STATIC_PROP(bookmarkRoot, Document);
+	JS_STATIC_PROP(calculate, Document);
+	JS_STATIC_PROP(Collab, Document);
+	JS_STATIC_PROP(creationDate, Document);
+	JS_STATIC_PROP(creator, Document);
+	JS_STATIC_PROP(delay, Document);
+	JS_STATIC_PROP(dirty, Document);
+	JS_STATIC_PROP(documentFileName, Document);
+	JS_STATIC_PROP(external, Document);
+	JS_STATIC_PROP(filesize, Document);
+	JS_STATIC_PROP(icons, Document);
+	JS_STATIC_PROP(info, Document);
+	JS_STATIC_PROP(keywords, Document);
+	JS_STATIC_PROP(layout, Document);
+	JS_STATIC_PROP(media, Document);
+	JS_STATIC_PROP(modDate, Document);
+	JS_STATIC_PROP(mouseX, Document);
+	JS_STATIC_PROP(mouseY, Document);
+	JS_STATIC_PROP(numFields, Document);
+	JS_STATIC_PROP(numPages, Document);
+	JS_STATIC_PROP(pageNum, Document);
+	JS_STATIC_PROP(pageWindowRect, Document);
+	JS_STATIC_PROP(path, Document);
+	JS_STATIC_PROP(producer, Document);
+	JS_STATIC_PROP(subject, Document);
+	JS_STATIC_PROP(title, Document);
+	JS_STATIC_PROP(zoom, Document);
+	JS_STATIC_PROP(zoomType, Document);
+
+	JS_STATIC_METHOD(addAnnot,Document);
+	JS_STATIC_METHOD(addField, Document);
+	JS_STATIC_METHOD(addLink, Document);
+	JS_STATIC_METHOD(addIcon, Document);
+	JS_STATIC_METHOD(calculateNow, Document);
+	JS_STATIC_METHOD(closeDoc, Document);
+	JS_STATIC_METHOD(createDataObject, Document);
+	JS_STATIC_METHOD(deletePages, Document);
+	JS_STATIC_METHOD(exportAsText, Document);
+	JS_STATIC_METHOD(exportAsFDF, Document);
+	JS_STATIC_METHOD(exportAsXFDF, Document);
+	JS_STATIC_METHOD(extractPages, Document);
+	JS_STATIC_METHOD(getAnnot, Document);
+	JS_STATIC_METHOD(getAnnots, Document);
+	JS_STATIC_METHOD(getAnnot3D, Document);
+	JS_STATIC_METHOD(getAnnots3D, Document);
+	JS_STATIC_METHOD(getField, Document);
+	JS_STATIC_METHOD(getIcon, Document);
+	JS_STATIC_METHOD(getLinks, Document);
+	JS_STATIC_METHOD(getNthFieldName, Document);
+	JS_STATIC_METHOD(getOCGs, Document);
+	JS_STATIC_METHOD(getPageBox, Document);
+	JS_STATIC_METHOD(getPageNthWord, Document);
+	JS_STATIC_METHOD(getPageNthWordQuads, Document);
+	JS_STATIC_METHOD(getPageNumWords, Document);
+	JS_STATIC_METHOD(getPrintParams, Document);
+	JS_STATIC_METHOD(getURL, Document);
+	JS_STATIC_METHOD(importAnFDF, Document);
+	JS_STATIC_METHOD(importAnXFDF, Document);
+	JS_STATIC_METHOD(importTextData, Document);
+	JS_STATIC_METHOD(insertPages, Document);
+	JS_STATIC_METHOD(mailForm, Document);
+	JS_STATIC_METHOD(print, Document);
+	JS_STATIC_METHOD(removeField, Document);
+	JS_STATIC_METHOD(replacePages, Document);
+	JS_STATIC_METHOD(removeIcon, Document);
+	JS_STATIC_METHOD(resetForm, Document);
+	JS_STATIC_METHOD(saveAs, Document);
+	JS_STATIC_METHOD(submitForm, Document);
+	JS_STATIC_METHOD(mailDoc, Document);
+};
+
+#endif//_DOCUMENT_H_
+
diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h
index 1b0bb05..2aea85a 100644
--- a/fpdfsdk/include/javascript/Field.h
+++ b/fpdfsdk/include/javascript/Field.h
@@ -1,355 +1,355 @@
-// 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 _FIELD_H_

-#define _FIELD_H_

-

-class Document;

-

-enum FIELD_PROP

-{

-	FP_ALIGNMENT,

-	FP_BORDERSTYLE,

-	FP_BUTTONALIGNX,

-	FP_BUTTONALIGNY,

-	FP_BUTTONFITBOUNDS,

-	FP_BUTTONPOSITION,

-	FP_BUTTONSCALEHOW,

-	FP_BUTTONSCALEWHEN,

-	FP_CALCORDERINDEX,

-	FP_CHARLIMIT,

-	FP_COMB,

-	FP_COMMITONSELCHANGE,

-	FP_CURRENTVALUEINDICES,

-	FP_DEFAULTVALUE,

-	FP_DONOTSCROLL,

-	FP_DISPLAY,

-	FP_FILLCOLOR,

-	FP_HIDDEN,

-	FP_HIGHLIGHT,

-	FP_LINEWIDTH,

-	FP_MULTILINE,

-	FP_MULTIPLESELECTION,

-	FP_PASSWORD,

-	FP_RECT,

-	FP_RICHTEXT,

-	FP_RICHVALUE,

-	FP_ROTATION,

-	FP_STROKECOLOR,

-	FP_STYLE,

-	FP_TEXTCOLOR,

-	FP_TEXTFONT,

-	FP_TEXTSIZE,

-	FP_USERNAME,

-	FP_VALUE

-};

-

-class CJS_WideStringArray

-{

-public:

-	CJS_WideStringArray(){}

-	virtual ~CJS_WideStringArray()

-	{

-		for (int i=0,sz=m_Data.GetSize(); i<sz; i++)

-			delete m_Data.GetAt(i);

-		m_Data.RemoveAll();

-	}

-

-	void Add(const CFX_WideString& string)

-	{

-		m_Data.Add(new CFX_WideString(string));

-	}

-

-	int GetSize() const

-	{

-		return m_Data.GetSize();

-	}

-

-	CFX_WideString GetAt(int i) const

-	{

-		return *m_Data.GetAt(i);

-	}

-

-private:

-	CFX_ArrayTemplate<CFX_WideString*>	m_Data;

-};

-

-struct CJS_DelayData

-{

-	CFX_WideString			sFieldName;

-	int						nControlIndex;

-	enum FIELD_PROP			eProp;

-	FX_INT32				num;

-	bool					b;

-	CFX_ByteString			string;

-	CFX_WideString			widestring;

-	CPDF_Rect				rect;

-	CPWL_Color				color;

-	CFX_DWordArray			wordarray;

-	CJS_WideStringArray		widestringarray;

-};

-

-class Field : public CJS_EmbedObj

-{

-public:

-	Field(CJS_Object* pJSObject);	

-	virtual ~Field(void);

-

-    FX_BOOL alignment(OBJ_PROP_PARAMS);

-    FX_BOOL borderStyle(OBJ_PROP_PARAMS);

-	FX_BOOL buttonAlignX(OBJ_PROP_PARAMS);

-	FX_BOOL buttonAlignY(OBJ_PROP_PARAMS);

-	FX_BOOL buttonFitBounds(OBJ_PROP_PARAMS);

-	FX_BOOL buttonPosition(OBJ_PROP_PARAMS);

-	FX_BOOL buttonScaleHow(OBJ_PROP_PARAMS);

-    FX_BOOL buttonScaleWhen(OBJ_PROP_PARAMS);

-	FX_BOOL calcOrderIndex(OBJ_PROP_PARAMS);

-	FX_BOOL charLimit(OBJ_PROP_PARAMS);

-	FX_BOOL comb(OBJ_PROP_PARAMS);

-	FX_BOOL commitOnSelChange(OBJ_PROP_PARAMS);

-	FX_BOOL currentValueIndices(OBJ_PROP_PARAMS);

-    FX_BOOL defaultStyle(OBJ_PROP_PARAMS);

-	FX_BOOL defaultValue(OBJ_PROP_PARAMS);

-	FX_BOOL doNotScroll(OBJ_PROP_PARAMS);

-	FX_BOOL doNotSpellCheck(OBJ_PROP_PARAMS);

-	FX_BOOL delay(OBJ_PROP_PARAMS);

-	FX_BOOL display(OBJ_PROP_PARAMS);

-    FX_BOOL doc(OBJ_PROP_PARAMS);

-	FX_BOOL editable(OBJ_PROP_PARAMS);

-	FX_BOOL exportValues(OBJ_PROP_PARAMS);

-	FX_BOOL fileSelect(OBJ_PROP_PARAMS);

-	FX_BOOL fillColor(OBJ_PROP_PARAMS);

-	FX_BOOL hidden(OBJ_PROP_PARAMS);

-    FX_BOOL highlight(OBJ_PROP_PARAMS);

-	FX_BOOL lineWidth(OBJ_PROP_PARAMS);

-	FX_BOOL multiline(OBJ_PROP_PARAMS);

-	FX_BOOL multipleSelection(OBJ_PROP_PARAMS);

-	FX_BOOL name(OBJ_PROP_PARAMS);

-	FX_BOOL numItems(OBJ_PROP_PARAMS);

-    FX_BOOL page(OBJ_PROP_PARAMS);

-	FX_BOOL password(OBJ_PROP_PARAMS);

-	FX_BOOL print(OBJ_PROP_PARAMS);

-	FX_BOOL radiosInUnison(OBJ_PROP_PARAMS);

-	FX_BOOL readonly(OBJ_PROP_PARAMS);

-	FX_BOOL rect(OBJ_PROP_PARAMS);

-    FX_BOOL required(OBJ_PROP_PARAMS);

-	FX_BOOL richText(OBJ_PROP_PARAMS);

-	FX_BOOL richValue(OBJ_PROP_PARAMS);

-	FX_BOOL rotation(OBJ_PROP_PARAMS);

-	FX_BOOL strokeColor(OBJ_PROP_PARAMS);

-	FX_BOOL style(OBJ_PROP_PARAMS);

-	FX_BOOL submitName(OBJ_PROP_PARAMS);

-	FX_BOOL textColor(OBJ_PROP_PARAMS);

-	FX_BOOL textFont(OBJ_PROP_PARAMS);

-	FX_BOOL textSize(OBJ_PROP_PARAMS);

-	FX_BOOL type(OBJ_PROP_PARAMS);

-	FX_BOOL userName(OBJ_PROP_PARAMS);

-	FX_BOOL value(OBJ_PROP_PARAMS);

-	FX_BOOL valueAsString(OBJ_PROP_PARAMS);

-	FX_BOOL source(OBJ_PROP_PARAMS);

-

-	FX_BOOL browseForFileToSubmit(OBJ_METHOD_PARAMS);

-	FX_BOOL buttonGetCaption(OBJ_METHOD_PARAMS);

-	FX_BOOL buttonGetIcon(OBJ_METHOD_PARAMS);

-	FX_BOOL buttonImportIcon(OBJ_METHOD_PARAMS);

-	FX_BOOL buttonSetCaption(OBJ_METHOD_PARAMS);

-	FX_BOOL buttonSetIcon(OBJ_METHOD_PARAMS);

-	FX_BOOL checkThisBox(OBJ_METHOD_PARAMS);

-	FX_BOOL clearItems(OBJ_METHOD_PARAMS);

-	FX_BOOL defaultIsChecked(OBJ_METHOD_PARAMS);

-	FX_BOOL deleteItemAt(OBJ_METHOD_PARAMS);

-	FX_BOOL getArray(OBJ_METHOD_PARAMS);

-	FX_BOOL getItemAt(OBJ_METHOD_PARAMS);

-	FX_BOOL getLock(OBJ_METHOD_PARAMS);

-	FX_BOOL insertItemAt(OBJ_METHOD_PARAMS);

-	FX_BOOL isBoxChecked(OBJ_METHOD_PARAMS);

-	FX_BOOL isDefaultChecked(OBJ_METHOD_PARAMS);

-	FX_BOOL setAction(OBJ_METHOD_PARAMS);

-	FX_BOOL setFocus(OBJ_METHOD_PARAMS);

-	FX_BOOL setItems(OBJ_METHOD_PARAMS);

-	FX_BOOL setLock(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureGetModifications(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureGetSeedValue(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureInfo(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureSetSeedValue(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureSign(OBJ_METHOD_PARAMS);

-	FX_BOOL signatureValidate(OBJ_METHOD_PARAMS);

-

-public:

-	static void SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);

-    static void SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);

-	static void SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-    static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array);

-    static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);

-	static void SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);

-	static void SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);

-	static void SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-    static void SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);

-	static void SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect);

-	static void SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);

-	static void SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);

-	static void SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);

-	static void SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);

-	static void SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);

-	static void SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);

-	static void SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);

-	static void SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);

-	static void SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray);

-

-public:

-	static void							AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType, 

-											const CFX_WideString& sName, const CPDF_Rect& rcCoords);

-public:

-	static void							UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, 

-											FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);

-	static void							UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl, 

-											FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);

-

-	static CPDFSDK_Widget*					GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl);

-	static void							GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);

-

-	static void							DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);

-

-public:

-	FX_BOOL								AttachField(Document* pDocument, const CFX_WideString& csFieldName);

-	void								SetDelay(FX_BOOL bDelay);

-	void								SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}

-protected:

-	void								ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &strFieldName,int & iControlNo);

-	void								GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);

-	CPDF_FormControl* 					GetSmartFieldControl(CPDF_FormField* pFormField);

-	FX_BOOL								ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);

-

-	void								AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n);

-	void								AddDelay_Bool(enum FIELD_PROP prop,bool b);

-	void								AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);

-	void								AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);

-	void								AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);

-	void								AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);

-	void								AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);

-	void								AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array);

-

-	void								DoDelay();

-public:

-	Document*							m_pJSDoc;

-	CPDFSDK_Document*					m_pDocument;

-	CFX_WideString						m_FieldName;

-	int									m_nFormControlIndex;

-	FX_BOOL								m_bCanSet;

-

-	FX_BOOL								m_bDelay;

-	v8::Isolate*							m_isolate;

-};

-

-class CJS_Field : public CJS_Object

-{

-public:

-	CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Field(void){};

-

-	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);

-

-	DECLARE_JS_CLASS(CJS_Field);

-

-    JS_STATIC_PROP(alignment, Field);

-    JS_STATIC_PROP(borderStyle, Field);

-	JS_STATIC_PROP(buttonAlignX, Field);

-	JS_STATIC_PROP(buttonAlignY, Field);

-	JS_STATIC_PROP(buttonFitBounds, Field);

-	JS_STATIC_PROP(buttonPosition, Field);

-	JS_STATIC_PROP(buttonScaleHow, Field);

-    JS_STATIC_PROP(buttonScaleWhen, Field);

-	JS_STATIC_PROP(calcOrderIndex, Field);

-	JS_STATIC_PROP(charLimit, Field);

-	JS_STATIC_PROP(comb, Field);

-	JS_STATIC_PROP(commitOnSelChange, Field);

-	JS_STATIC_PROP(currentValueIndices, Field);

-    JS_STATIC_PROP(defaultStyle, Field);

-	JS_STATIC_PROP(defaultValue, Field);

-	JS_STATIC_PROP(doNotScroll, Field);

-	JS_STATIC_PROP(doNotSpellCheck, Field);

-	JS_STATIC_PROP(delay, Field);

-	JS_STATIC_PROP(display, Field);

-    JS_STATIC_PROP(doc, Field);

-	JS_STATIC_PROP(editable, Field);

-	JS_STATIC_PROP(exportValues, Field);

-	JS_STATIC_PROP(fileSelect, Field);

-	JS_STATIC_PROP(fillColor, Field);

-	JS_STATIC_PROP(hidden, Field);

-    JS_STATIC_PROP(highlight, Field);

-	JS_STATIC_PROP(lineWidth, Field);

-	JS_STATIC_PROP(multiline, Field);

-	JS_STATIC_PROP(multipleSelection, Field);

-	JS_STATIC_PROP(name, Field);

-	JS_STATIC_PROP(numItems, Field);

-    JS_STATIC_PROP(page, Field);

-	JS_STATIC_PROP(password, Field);

-	JS_STATIC_PROP(print, Field);

-	JS_STATIC_PROP(radiosInUnison, Field);

-	JS_STATIC_PROP(readonly, Field);

-	JS_STATIC_PROP(rect, Field);

-    JS_STATIC_PROP(required, Field);

-	JS_STATIC_PROP(richText, Field);

-	JS_STATIC_PROP(richValue, Field);

-	JS_STATIC_PROP(rotation, Field);

-	JS_STATIC_PROP(strokeColor, Field);

-	JS_STATIC_PROP(style, Field);

-	JS_STATIC_PROP(submitName, Field);

-	JS_STATIC_PROP(textColor, Field);

-	JS_STATIC_PROP(textFont, Field);

-	JS_STATIC_PROP(textSize, Field);

-	JS_STATIC_PROP(type, Field);

-	JS_STATIC_PROP(userName, Field);

-	JS_STATIC_PROP(value, Field);

-	JS_STATIC_PROP(valueAsString, Field);

-	JS_STATIC_PROP(source, Field);

-

-	JS_STATIC_METHOD(browseForFileToSubmit, Field);

-	JS_STATIC_METHOD(buttonGetCaption, Field);

-	JS_STATIC_METHOD(buttonGetIcon, Field);

-	JS_STATIC_METHOD(buttonImportIcon, Field);

-	JS_STATIC_METHOD(buttonSetCaption, Field);

-	JS_STATIC_METHOD(buttonSetIcon, Field);

-	JS_STATIC_METHOD(checkThisBox, Field);

-	JS_STATIC_METHOD(clearItems, Field);

- 	JS_STATIC_METHOD(defaultIsChecked, Field);

-	JS_STATIC_METHOD(deleteItemAt, Field);

-	JS_STATIC_METHOD(getArray, Field);

-	JS_STATIC_METHOD(getItemAt, Field);

-	JS_STATIC_METHOD(getLock, Field);

-	JS_STATIC_METHOD(insertItemAt, Field);

-	JS_STATIC_METHOD(isBoxChecked, Field);

-	JS_STATIC_METHOD(isDefaultChecked, Field);

-	JS_STATIC_METHOD(setAction, Field);

-	JS_STATIC_METHOD(setFocus, Field);

-	JS_STATIC_METHOD(setItems, Field);

-	JS_STATIC_METHOD(setLock, Field);

-	JS_STATIC_METHOD(signatureGetModifications, Field);

-	JS_STATIC_METHOD(signatureGetSeedValue, Field);

-	JS_STATIC_METHOD(signatureInfo, Field);

-	JS_STATIC_METHOD(signatureSetSeedValue, Field);

-	JS_STATIC_METHOD(signatureSign, Field);

-	JS_STATIC_METHOD(signatureValidate, Field);

-};

-

-#endif //_FIELD_H_

-

+// 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 _FIELD_H_
+#define _FIELD_H_
+
+class Document;
+
+enum FIELD_PROP
+{
+	FP_ALIGNMENT,
+	FP_BORDERSTYLE,
+	FP_BUTTONALIGNX,
+	FP_BUTTONALIGNY,
+	FP_BUTTONFITBOUNDS,
+	FP_BUTTONPOSITION,
+	FP_BUTTONSCALEHOW,
+	FP_BUTTONSCALEWHEN,
+	FP_CALCORDERINDEX,
+	FP_CHARLIMIT,
+	FP_COMB,
+	FP_COMMITONSELCHANGE,
+	FP_CURRENTVALUEINDICES,
+	FP_DEFAULTVALUE,
+	FP_DONOTSCROLL,
+	FP_DISPLAY,
+	FP_FILLCOLOR,
+	FP_HIDDEN,
+	FP_HIGHLIGHT,
+	FP_LINEWIDTH,
+	FP_MULTILINE,
+	FP_MULTIPLESELECTION,
+	FP_PASSWORD,
+	FP_RECT,
+	FP_RICHTEXT,
+	FP_RICHVALUE,
+	FP_ROTATION,
+	FP_STROKECOLOR,
+	FP_STYLE,
+	FP_TEXTCOLOR,
+	FP_TEXTFONT,
+	FP_TEXTSIZE,
+	FP_USERNAME,
+	FP_VALUE
+};
+
+class CJS_WideStringArray
+{
+public:
+	CJS_WideStringArray(){}
+	virtual ~CJS_WideStringArray()
+	{
+		for (int i=0,sz=m_Data.GetSize(); i<sz; i++)
+			delete m_Data.GetAt(i);
+		m_Data.RemoveAll();
+	}
+
+	void Add(const CFX_WideString& string)
+	{
+		m_Data.Add(new CFX_WideString(string));
+	}
+
+	int GetSize() const
+	{
+		return m_Data.GetSize();
+	}
+
+	CFX_WideString GetAt(int i) const
+	{
+		return *m_Data.GetAt(i);
+	}
+
+private:
+	CFX_ArrayTemplate<CFX_WideString*>	m_Data;
+};
+
+struct CJS_DelayData
+{
+	CFX_WideString			sFieldName;
+	int						nControlIndex;
+	enum FIELD_PROP			eProp;
+	FX_INT32				num;
+	bool					b;
+	CFX_ByteString			string;
+	CFX_WideString			widestring;
+	CPDF_Rect				rect;
+	CPWL_Color				color;
+	CFX_DWordArray			wordarray;
+	CJS_WideStringArray		widestringarray;
+};
+
+class Field : public CJS_EmbedObj
+{
+public:
+	Field(CJS_Object* pJSObject);	
+	virtual ~Field(void);
+
+    FX_BOOL alignment(OBJ_PROP_PARAMS);
+    FX_BOOL borderStyle(OBJ_PROP_PARAMS);
+	FX_BOOL buttonAlignX(OBJ_PROP_PARAMS);
+	FX_BOOL buttonAlignY(OBJ_PROP_PARAMS);
+	FX_BOOL buttonFitBounds(OBJ_PROP_PARAMS);
+	FX_BOOL buttonPosition(OBJ_PROP_PARAMS);
+	FX_BOOL buttonScaleHow(OBJ_PROP_PARAMS);
+    FX_BOOL buttonScaleWhen(OBJ_PROP_PARAMS);
+	FX_BOOL calcOrderIndex(OBJ_PROP_PARAMS);
+	FX_BOOL charLimit(OBJ_PROP_PARAMS);
+	FX_BOOL comb(OBJ_PROP_PARAMS);
+	FX_BOOL commitOnSelChange(OBJ_PROP_PARAMS);
+	FX_BOOL currentValueIndices(OBJ_PROP_PARAMS);
+    FX_BOOL defaultStyle(OBJ_PROP_PARAMS);
+	FX_BOOL defaultValue(OBJ_PROP_PARAMS);
+	FX_BOOL doNotScroll(OBJ_PROP_PARAMS);
+	FX_BOOL doNotSpellCheck(OBJ_PROP_PARAMS);
+	FX_BOOL delay(OBJ_PROP_PARAMS);
+	FX_BOOL display(OBJ_PROP_PARAMS);
+    FX_BOOL doc(OBJ_PROP_PARAMS);
+	FX_BOOL editable(OBJ_PROP_PARAMS);
+	FX_BOOL exportValues(OBJ_PROP_PARAMS);
+	FX_BOOL fileSelect(OBJ_PROP_PARAMS);
+	FX_BOOL fillColor(OBJ_PROP_PARAMS);
+	FX_BOOL hidden(OBJ_PROP_PARAMS);
+    FX_BOOL highlight(OBJ_PROP_PARAMS);
+	FX_BOOL lineWidth(OBJ_PROP_PARAMS);
+	FX_BOOL multiline(OBJ_PROP_PARAMS);
+	FX_BOOL multipleSelection(OBJ_PROP_PARAMS);
+	FX_BOOL name(OBJ_PROP_PARAMS);
+	FX_BOOL numItems(OBJ_PROP_PARAMS);
+    FX_BOOL page(OBJ_PROP_PARAMS);
+	FX_BOOL password(OBJ_PROP_PARAMS);
+	FX_BOOL print(OBJ_PROP_PARAMS);
+	FX_BOOL radiosInUnison(OBJ_PROP_PARAMS);
+	FX_BOOL readonly(OBJ_PROP_PARAMS);
+	FX_BOOL rect(OBJ_PROP_PARAMS);
+    FX_BOOL required(OBJ_PROP_PARAMS);
+	FX_BOOL richText(OBJ_PROP_PARAMS);
+	FX_BOOL richValue(OBJ_PROP_PARAMS);
+	FX_BOOL rotation(OBJ_PROP_PARAMS);
+	FX_BOOL strokeColor(OBJ_PROP_PARAMS);
+	FX_BOOL style(OBJ_PROP_PARAMS);
+	FX_BOOL submitName(OBJ_PROP_PARAMS);
+	FX_BOOL textColor(OBJ_PROP_PARAMS);
+	FX_BOOL textFont(OBJ_PROP_PARAMS);
+	FX_BOOL textSize(OBJ_PROP_PARAMS);
+	FX_BOOL type(OBJ_PROP_PARAMS);
+	FX_BOOL userName(OBJ_PROP_PARAMS);
+	FX_BOOL value(OBJ_PROP_PARAMS);
+	FX_BOOL valueAsString(OBJ_PROP_PARAMS);
+	FX_BOOL source(OBJ_PROP_PARAMS);
+
+	FX_BOOL browseForFileToSubmit(OBJ_METHOD_PARAMS);
+	FX_BOOL buttonGetCaption(OBJ_METHOD_PARAMS);
+	FX_BOOL buttonGetIcon(OBJ_METHOD_PARAMS);
+	FX_BOOL buttonImportIcon(OBJ_METHOD_PARAMS);
+	FX_BOOL buttonSetCaption(OBJ_METHOD_PARAMS);
+	FX_BOOL buttonSetIcon(OBJ_METHOD_PARAMS);
+	FX_BOOL checkThisBox(OBJ_METHOD_PARAMS);
+	FX_BOOL clearItems(OBJ_METHOD_PARAMS);
+	FX_BOOL defaultIsChecked(OBJ_METHOD_PARAMS);
+	FX_BOOL deleteItemAt(OBJ_METHOD_PARAMS);
+	FX_BOOL getArray(OBJ_METHOD_PARAMS);
+	FX_BOOL getItemAt(OBJ_METHOD_PARAMS);
+	FX_BOOL getLock(OBJ_METHOD_PARAMS);
+	FX_BOOL insertItemAt(OBJ_METHOD_PARAMS);
+	FX_BOOL isBoxChecked(OBJ_METHOD_PARAMS);
+	FX_BOOL isDefaultChecked(OBJ_METHOD_PARAMS);
+	FX_BOOL setAction(OBJ_METHOD_PARAMS);
+	FX_BOOL setFocus(OBJ_METHOD_PARAMS);
+	FX_BOOL setItems(OBJ_METHOD_PARAMS);
+	FX_BOOL setLock(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureGetModifications(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureGetSeedValue(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureInfo(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureSetSeedValue(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureSign(OBJ_METHOD_PARAMS);
+	FX_BOOL signatureValidate(OBJ_METHOD_PARAMS);
+
+public:
+	static void SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
+    static void SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
+	static void SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+    static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array);
+    static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
+	static void SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
+	static void SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
+	static void SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+    static void SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
+	static void SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect);
+	static void SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
+	static void SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
+	static void SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
+	static void SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
+	static void SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
+	static void SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
+	static void SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
+	static void SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
+	static void SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray);
+
+public:
+	static void							AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType, 
+											const CFX_WideString& sName, const CPDF_Rect& rcCoords);
+public:
+	static void							UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, 
+											FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
+	static void							UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl, 
+											FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
+
+	static CPDFSDK_Widget*					GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl);
+	static void							GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
+
+	static void							DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
+
+public:
+	FX_BOOL								AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+	void								SetDelay(FX_BOOL bDelay);
+	void								SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
+protected:
+	void								ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &strFieldName,int & iControlNo);
+	void								GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
+	CPDF_FormControl* 					GetSmartFieldControl(CPDF_FormField* pFormField);
+	FX_BOOL								ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+
+	void								AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n);
+	void								AddDelay_Bool(enum FIELD_PROP prop,bool b);
+	void								AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
+	void								AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
+	void								AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
+	void								AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
+	void								AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
+	void								AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array);
+
+	void								DoDelay();
+public:
+	Document*							m_pJSDoc;
+	CPDFSDK_Document*					m_pDocument;
+	CFX_WideString						m_FieldName;
+	int									m_nFormControlIndex;
+	FX_BOOL								m_bCanSet;
+
+	FX_BOOL								m_bDelay;
+	v8::Isolate*							m_isolate;
+};
+
+class CJS_Field : public CJS_Object
+{
+public:
+	CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Field(void){};
+
+	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);
+
+	DECLARE_JS_CLASS(CJS_Field);
+
+    JS_STATIC_PROP(alignment, Field);
+    JS_STATIC_PROP(borderStyle, Field);
+	JS_STATIC_PROP(buttonAlignX, Field);
+	JS_STATIC_PROP(buttonAlignY, Field);
+	JS_STATIC_PROP(buttonFitBounds, Field);
+	JS_STATIC_PROP(buttonPosition, Field);
+	JS_STATIC_PROP(buttonScaleHow, Field);
+    JS_STATIC_PROP(buttonScaleWhen, Field);
+	JS_STATIC_PROP(calcOrderIndex, Field);
+	JS_STATIC_PROP(charLimit, Field);
+	JS_STATIC_PROP(comb, Field);
+	JS_STATIC_PROP(commitOnSelChange, Field);
+	JS_STATIC_PROP(currentValueIndices, Field);
+    JS_STATIC_PROP(defaultStyle, Field);
+	JS_STATIC_PROP(defaultValue, Field);
+	JS_STATIC_PROP(doNotScroll, Field);
+	JS_STATIC_PROP(doNotSpellCheck, Field);
+	JS_STATIC_PROP(delay, Field);
+	JS_STATIC_PROP(display, Field);
+    JS_STATIC_PROP(doc, Field);
+	JS_STATIC_PROP(editable, Field);
+	JS_STATIC_PROP(exportValues, Field);
+	JS_STATIC_PROP(fileSelect, Field);
+	JS_STATIC_PROP(fillColor, Field);
+	JS_STATIC_PROP(hidden, Field);
+    JS_STATIC_PROP(highlight, Field);
+	JS_STATIC_PROP(lineWidth, Field);
+	JS_STATIC_PROP(multiline, Field);
+	JS_STATIC_PROP(multipleSelection, Field);
+	JS_STATIC_PROP(name, Field);
+	JS_STATIC_PROP(numItems, Field);
+    JS_STATIC_PROP(page, Field);
+	JS_STATIC_PROP(password, Field);
+	JS_STATIC_PROP(print, Field);
+	JS_STATIC_PROP(radiosInUnison, Field);
+	JS_STATIC_PROP(readonly, Field);
+	JS_STATIC_PROP(rect, Field);
+    JS_STATIC_PROP(required, Field);
+	JS_STATIC_PROP(richText, Field);
+	JS_STATIC_PROP(richValue, Field);
+	JS_STATIC_PROP(rotation, Field);
+	JS_STATIC_PROP(strokeColor, Field);
+	JS_STATIC_PROP(style, Field);
+	JS_STATIC_PROP(submitName, Field);
+	JS_STATIC_PROP(textColor, Field);
+	JS_STATIC_PROP(textFont, Field);
+	JS_STATIC_PROP(textSize, Field);
+	JS_STATIC_PROP(type, Field);
+	JS_STATIC_PROP(userName, Field);
+	JS_STATIC_PROP(value, Field);
+	JS_STATIC_PROP(valueAsString, Field);
+	JS_STATIC_PROP(source, Field);
+
+	JS_STATIC_METHOD(browseForFileToSubmit, Field);
+	JS_STATIC_METHOD(buttonGetCaption, Field);
+	JS_STATIC_METHOD(buttonGetIcon, Field);
+	JS_STATIC_METHOD(buttonImportIcon, Field);
+	JS_STATIC_METHOD(buttonSetCaption, Field);
+	JS_STATIC_METHOD(buttonSetIcon, Field);
+	JS_STATIC_METHOD(checkThisBox, Field);
+	JS_STATIC_METHOD(clearItems, Field);
+ 	JS_STATIC_METHOD(defaultIsChecked, Field);
+	JS_STATIC_METHOD(deleteItemAt, Field);
+	JS_STATIC_METHOD(getArray, Field);
+	JS_STATIC_METHOD(getItemAt, Field);
+	JS_STATIC_METHOD(getLock, Field);
+	JS_STATIC_METHOD(insertItemAt, Field);
+	JS_STATIC_METHOD(isBoxChecked, Field);
+	JS_STATIC_METHOD(isDefaultChecked, Field);
+	JS_STATIC_METHOD(setAction, Field);
+	JS_STATIC_METHOD(setFocus, Field);
+	JS_STATIC_METHOD(setItems, Field);
+	JS_STATIC_METHOD(setLock, Field);
+	JS_STATIC_METHOD(signatureGetModifications, Field);
+	JS_STATIC_METHOD(signatureGetSeedValue, Field);
+	JS_STATIC_METHOD(signatureInfo, Field);
+	JS_STATIC_METHOD(signatureSetSeedValue, Field);
+	JS_STATIC_METHOD(signatureSign, Field);
+	JS_STATIC_METHOD(signatureValidate, Field);
+};
+
+#endif //_FIELD_H_
+
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h
index 567ee82..3087b6a 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -1,112 +1,112 @@
-// 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 _IJAVASCRIPT_H_

-#define _IJAVASCRIPT_H_

-

-class IFXJS_Context  

-{

-public:

-	virtual FX_BOOL				Compile(const CFX_WideString& script, CFX_WideString& info) = 0;

-	virtual FX_BOOL				RunScript(const CFX_WideString& script, CFX_WideString& info) = 0;

-

-public:

-	virtual void				OnApp_Init() = 0;

-

-	virtual void				OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0;

-	virtual void				OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;

-	virtual void				OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;

-	virtual void				OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;

-	virtual void				OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;

-	virtual void				OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;

-

-	virtual void				OnPage_Open(CPDFSDK_Document* pTarget) = 0;

-	virtual void				OnPage_Close(CPDFSDK_Document* pTarget) = 0;

-	virtual void				OnPage_InView(CPDFSDK_Document* pTarget) = 0;

-	virtual void				OnPage_OutView(CPDFSDK_Document* pTarget) = 0;

-	

-	virtual void				OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;

-	virtual void				OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;

-	virtual void				OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;

-	virtual void				OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;

-	virtual void				OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;

-	virtual void				OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;

-

-	virtual void				OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;

-	virtual void				OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit) = 0;

-	virtual void				OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,

-									FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,

-									CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 

-									FX_BOOL bFieldFull, FX_BOOL &bRc) = 0;

-	virtual void				OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,

-									FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;

-

-	virtual void				OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-	virtual void				OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;

-

-	virtual void				OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;

-	virtual void				OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;

-

-	virtual void				OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString &) = 0;

-	virtual void				OnBatchExec(CPDFSDK_Document* pTarget) = 0;

-	virtual void				OnConsole_Exec() = 0;

-	virtual void				OnExternal_Exec() = 0;

-

-	virtual void				EnableMessageBox(FX_BOOL bEnable) = 0;

-};

-

-class IFXJS_Runtime

-{

-public:

-	virtual IFXJS_Context*		NewContext() = 0;

-	virtual void				ReleaseContext(IFXJS_Context * pContext) = 0;

-	virtual IFXJS_Context*		GetCurrentContext() = 0;

-

-	virtual void				SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;

-	virtual	CPDFSDK_Document*	GetReaderDocument() = 0;	

-

-	virtual void				GetObjectNames(CFX_WideStringArray& array) = 0;

-	virtual void				GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;

-	virtual void				GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;

-	virtual void				GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;

-

-	virtual void				Exit() = 0;

-	virtual void				Enter() = 0;

-	virtual FX_BOOL				IsEntered() = 0;

-};

-

-class CPDFDoc_Environment;

-class CJS_GlobalData;

-

-class CJS_RuntimeFactory

-{

-public:

-	CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}

-	~CJS_RuntimeFactory();

-	IFXJS_Runtime*					NewJSRuntime(CPDFDoc_Environment* pApp);

-	void							DeleteJSRuntime(IFXJS_Runtime* pRuntime);

-	void							AddRef();

-	void							Release();

-

-	CJS_GlobalData*					NewGlobalData(CPDFDoc_Environment* pApp);

-	void							ReleaseGlobalData();

-private:

-	FX_BOOL m_bInit;

-	int m_nRef;

-	CJS_GlobalData*					m_pGlobalData;

-	FX_INT32						m_nGlobalDataCount;

-};

-

-#endif //_IJAVASCRIPT_H_

-

+// 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 _IJAVASCRIPT_H_
+#define _IJAVASCRIPT_H_
+
+class IFXJS_Context  
+{
+public:
+	virtual FX_BOOL				Compile(const CFX_WideString& script, CFX_WideString& info) = 0;
+	virtual FX_BOOL				RunScript(const CFX_WideString& script, CFX_WideString& info) = 0;
+
+public:
+	virtual void				OnApp_Init() = 0;
+
+	virtual void				OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0;
+	virtual void				OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
+	virtual void				OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
+	virtual void				OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
+	virtual void				OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
+	virtual void				OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
+
+	virtual void				OnPage_Open(CPDFSDK_Document* pTarget) = 0;
+	virtual void				OnPage_Close(CPDFSDK_Document* pTarget) = 0;
+	virtual void				OnPage_InView(CPDFSDK_Document* pTarget) = 0;
+	virtual void				OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
+	
+	virtual void				OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
+	virtual void				OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
+	virtual void				OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
+	virtual void				OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
+	virtual void				OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
+	virtual void				OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
+
+	virtual void				OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
+	virtual void				OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit) = 0;
+	virtual void				OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
+									FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
+									CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 
+									FX_BOOL bFieldFull, FX_BOOL &bRc) = 0;
+	virtual void				OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
+									FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
+
+	virtual void				OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+	virtual void				OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
+
+	virtual void				OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
+	virtual void				OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
+
+	virtual void				OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString &) = 0;
+	virtual void				OnBatchExec(CPDFSDK_Document* pTarget) = 0;
+	virtual void				OnConsole_Exec() = 0;
+	virtual void				OnExternal_Exec() = 0;
+
+	virtual void				EnableMessageBox(FX_BOOL bEnable) = 0;
+};
+
+class IFXJS_Runtime
+{
+public:
+	virtual IFXJS_Context*		NewContext() = 0;
+	virtual void				ReleaseContext(IFXJS_Context * pContext) = 0;
+	virtual IFXJS_Context*		GetCurrentContext() = 0;
+
+	virtual void				SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
+	virtual	CPDFSDK_Document*	GetReaderDocument() = 0;	
+
+	virtual void				GetObjectNames(CFX_WideStringArray& array) = 0;
+	virtual void				GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
+	virtual void				GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
+	virtual void				GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
+
+	virtual void				Exit() = 0;
+	virtual void				Enter() = 0;
+	virtual FX_BOOL				IsEntered() = 0;
+};
+
+class CPDFDoc_Environment;
+class CJS_GlobalData;
+
+class CJS_RuntimeFactory
+{
+public:
+	CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
+	~CJS_RuntimeFactory();
+	IFXJS_Runtime*					NewJSRuntime(CPDFDoc_Environment* pApp);
+	void							DeleteJSRuntime(IFXJS_Runtime* pRuntime);
+	void							AddRef();
+	void							Release();
+
+	CJS_GlobalData*					NewGlobalData(CPDFDoc_Environment* pApp);
+	void							ReleaseGlobalData();
+private:
+	FX_BOOL m_bInit;
+	int m_nRef;
+	CJS_GlobalData*					m_pGlobalData;
+	FX_INT32						m_nGlobalDataCount;
+};
+
+#endif //_IJAVASCRIPT_H_
+
diff --git a/fpdfsdk/include/javascript/Icon.h b/fpdfsdk/include/javascript/Icon.h
index 26fec2d..9426d32 100644
--- a/fpdfsdk/include/javascript/Icon.h
+++ b/fpdfsdk/include/javascript/Icon.h
@@ -1,42 +1,42 @@
-// 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 _ICON_H_

-#define _ICON_H_

-

-class Icon : public CJS_EmbedObj

-{

-public:

-	Icon(CJS_Object* pJSObject);

-	virtual ~Icon();

-

-public:

-	FX_BOOL name(OBJ_PROP_PARAMS);

-	

-public:

-	void				SetStream(CPDF_Stream* pIconStream);

-	CPDF_Stream*		GetStream();

-	void				SetIconName(CFX_WideString name);

-	CFX_WideString		GetIconName();

-private:

-	CPDF_Stream*		m_pIconStream;

-	CFX_WideString		m_swIconName;

-};

-

-class CJS_Icon : public CJS_Object

-{

-public:

-	CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};

-	virtual ~CJS_Icon(){};

-

-public:

-	DECLARE_JS_CLASS(CJS_Icon);

-

-	JS_STATIC_PROP(name, Icon);

-};

-

-#endif //_ICON_H_

-

+// 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 _ICON_H_
+#define _ICON_H_
+
+class Icon : public CJS_EmbedObj
+{
+public:
+	Icon(CJS_Object* pJSObject);
+	virtual ~Icon();
+
+public:
+	FX_BOOL name(OBJ_PROP_PARAMS);
+	
+public:
+	void				SetStream(CPDF_Stream* pIconStream);
+	CPDF_Stream*		GetStream();
+	void				SetIconName(CFX_WideString name);
+	CFX_WideString		GetIconName();
+private:
+	CPDF_Stream*		m_pIconStream;
+	CFX_WideString		m_swIconName;
+};
+
+class CJS_Icon : public CJS_Object
+{
+public:
+	CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
+	virtual ~CJS_Icon(){};
+
+public:
+	DECLARE_JS_CLASS(CJS_Icon);
+
+	JS_STATIC_PROP(name, Icon);
+};
+
+#endif //_ICON_H_
+
diff --git a/fpdfsdk/include/javascript/JS_Console.h b/fpdfsdk/include/javascript/JS_Console.h
index da842bd..f435135 100644
--- a/fpdfsdk/include/javascript/JS_Console.h
+++ b/fpdfsdk/include/javascript/JS_Console.h
@@ -1,239 +1,239 @@
-// 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 _JS_CONSOLE_H_

-#define _JS_CONSOLE_H_

-

-#include "../res/resource.h"

-

-#define WST_NONE		0x00					// No size changed

-#define WST_LEFT		0x01					// size to left

-#define WST_TOP			0x02					// size to top

-#define WST_RIGHT		0x04					// size to right

-#define WST_BOTTOM		0x08					// size to bottom

-#define WST_TOPLEFT		(WST_TOP|WST_LEFT)		// size to top & left

-#define WST_TOPRIGHT	(WST_TOP|WST_RIGHT)		// size to top & right

-#define WST_BOTTOMRIGHT	(WST_BOTTOM|WST_RIGHT)	// size to bottom & right

-#define WST_BOTTOMLEFT	(WST_BOTTOM|WST_LEFT)	// size to bottom & right

-

-#ifndef IDC_DLGSIZEBOX

-#define IDC_DLGSIZEBOX  50

-#endif	/* IDC_DLGSIZEBOX */

-

-enum { m_idSizeIcon = IDC_DLGSIZEBOX };

-enum {				// possible Control reSize Type

-	CST_NONE = 0,

-	CST_RESIZE,		// NOMOVE + SIZE, add all delta-size of dlg to control

-	CST_REPOS,		// MOVE(absolutely) + NOSIZE, move control's pos by delta-size

-	CST_RELATIVE,	// MOVE(proportional)  + NOSIZE, keep control always at a relative pos

-	CST_ZOOM,		// MOVE + SIZE (both are automatically proportional)

-	CST_DELTA_ZOOM	// MOVE(proportional, set manually) + SIZE(proportional, set manuall)

-};

-

-// contained class to hold item state

-//

-class CJS_ItemCtrl

-{

-public:

-	UINT	m_nID;

-	UINT	m_stxLeft  	   : 4;			// when left resizing ...

-	UINT	m_stxRight     : 4;			// when right resizing ...

-	UINT	m_styTop   	   : 4;			// when top resizing ...

-	UINT	m_styBottom    : 4;			// when bottom resizing ...

-	UINT	m_bFlickerFree : 1;

-	UINT	m_bInvalidate  : 1;			// Invalidate ctrl's rect(eg. no-automatical update for static when resize+move)

-	UINT	m_r0		   : 14;

-	CRect	m_wRect;

-	double	m_xRatio, m_cxRatio;

-	double	m_yRatio, m_cyRatio;

-

-protected:

-	void Assign(const CJS_ItemCtrl& src);

-

-public:

-	CJS_ItemCtrl();

-	CJS_ItemCtrl(const CJS_ItemCtrl& src);

-

-	HDWP OnSize(HDWP hdwp, int sizeType, CRect *pnCltRect, CRect *poCltRect, CRect *pR0, CWnd *pDlg);

-

-	CJS_ItemCtrl& operator=(const CJS_ItemCtrl& src);

-};

-

-class CJS_ResizeDlg : public CDialog

-{

-//	DECLARE_DYNAMIC(CJS_ResizeDlg)

-public:

-	CJS_ResizeDlg(UINT nID,CWnd *pParentWnd = NULL);

-	virtual ~CJS_ResizeDlg();

-

-

-public:

-	std::vector<CJS_ItemCtrl>	m_Items;           // array of controlled items

-	CRect					m_cltRect, m_cltR0;

-	int						m_xMin, m_yMin;

-	int						m_xSt,  m_ySt;		//step?

-	UINT					m_nDelaySide;		//drag side of window

-	CStatic					m_wndSizeIcon;     // size icon window

-

-protected:

-	void 					AddControl( UINT nID, int xl, int xr, int yt, int yb, int bFlickerFree = 0, 

-									    double xRatio = -1.0, double cxRatio = -1.0,

-									    double yRatio = -1.0, double cyRatio = -1.0 );

-	void 					AllowSizing(int xst, int yst);

-	void 					HideSizeIcon(void);	

-	virtual BOOL			OnInitDialog();

-

-	void					OnSizing(UINT nSide, LPRECT lpRect);

-	void					OnSize(UINT nType, int cx, int cy);

-	void					OnGetMinMaxInfo(MINMAXINFO *pmmi);

-	BOOL					OnEraseBkgnd(CDC* pDC);

-

-public:

-	int						UpdateControlRect(UINT nID, CRect *pnr);

-};

-

-

-//------------------------CIconListBox for CWndElementList-------------------------------------

-

-class CIconListBox : public CListBox

-{

-public:

-	CIconListBox();

-	virtual ~CIconListBox();

-

-public:

-	int				InsertString(int nIndex, LPCWSTR lpszItem , int nImage);

-	virtual	void	ResetContent();

-	virtual void	GetText(int nIndex, CString& rString);

-

-	virtual void	DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);

-	void			MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

-	int				CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);

-

-protected:

-	// Generated message map functions

-	//{{AFX_MSG(CIconListBox)

-	afx_msg void OnMouseMove(UINT nFlags, CPoint point);

-	//}}AFX_MSG	

-	DECLARE_MESSAGE_MAP()

-

-protected:

-	struct ItemDatas 

-	{

-		CString	csText;

-		int		nImage;

-	};

-};

-//----------------------------------CWndElementList--------------------------------------------

-#define IDC_LIST_JS_ELEMENT 10070

-

-#define ELEMENT_LIST_WIDTH 140

-#define ELEMENT_LIST_HEIGHT 180

-#define ELEMENT_LIST_TOP_OFFSET 13

-

-#define ELEMENT_TYPE_NAME	0

-#define ELEMENT_TYPE_CONST	1

-#define ELEMENT_TYPE_FUN	2

-#define ELEMENT_TYPE_PRO	3

-

-class CWndElementList : public CWnd

-{

-public:

-	CWndElementList();

-	virtual ~CWndElementList();

-	

-public:

-	virtual void	OnSize(UINT nType, int cx, int cy);

-	virtual BOOL	Create(CWnd* pParentWnd);

-	virtual BOOL	ShowWindow(int nCmdShow);

-	void			RemoveAllElement();

-	void			SetElementList(LPCWSTR* pElement, int* pType ,  int iCount);

-	void			AddElement(CFX_WideString csValue , int nType);

-	BOOL			GetElementSel(CString &csElement);

-	BOOL			SelectNext();

-	BOOL			SelectPrevious();

-	BOOL			SelectFirst();

-	BOOL			SelectLast();

-	BOOL			SelectNextPage();

-	BOOL			SelectPreviousPage();

-	int				GetListHeight();

-	

-protected:

-	// Generated message map functions

-	//{{AFX_MSG(CWndElementList)

-	afx_msg void OnPaint();

-	afx_msg BOOL OnNcActivate(BOOL bActive);

-	afx_msg void OnSelJSElement();

-	afx_msg void OnDblclkJSElement();

-	afx_msg void OnDestroy();

-	//}}AFX_MSG	

-	DECLARE_MESSAGE_MAP()

-protected:

-	CIconListBox	m_ListBox;

-	BOOL			m_bBlock;

-};

-

-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

-// CJS_ConsoleDlg ¶Ô»°¿ò

-class CJS_ConsoleDlg : public CJS_ResizeDlg

-{

-	DECLARE_DYNAMIC(CJS_ConsoleDlg)

-

-public:

-	CJS_ConsoleDlg(CReader_App* pApp, CWnd* pParent);	

-	virtual ~CJS_ConsoleDlg();

-

-	enum { IDD = IDD_JS_CONSOLE };

-

-	void				Create();

-

-	void				AppendConsoleText(const CFX_WideString& swText);

-	void				SetConsoleText(const CFX_WideString& swText);

-	CFX_WideString		GetConsoleText() const;

-	CFX_WideString		GetScriptText() const;

-

-	BOOL				ResetElementList(LPCWSTR lpstrRef);

-	IFXJS_Runtime*		GetJSRuntime();

-

-protected:

-	virtual void		DoDataExchange(CDataExchange* pDX);	// DDX/DDV Ö§³Ö

-

-protected:

-	virtual BOOL		OnInitDialog();	

-	virtual void		OnCancel();

-

-	virtual BOOL		PreTranslateMessage(MSG* pMsg);

-

-protected:

-	// Generated message map functions

-	//{{AFX_MSG(CJS_ConsoleDlg)

-	afx_msg void OnBnClickedClear();

-	afx_msg void OnBnClickedOk();

-	afx_msg void OnBnClickTips();

-	afx_msg void OnSizing(UINT nSide, LPRECT lpRect);

-	afx_msg void OnSize(UINT nType, int cx, int cy);

-	afx_msg void OnGetMinMaxInfo(MINMAXINFO *pmmi);

-	afx_msg BOOL OnEraseBkgnd(CDC* pDC);

-	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);

-

-	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

-	afx_msg void OnChangeScriptEdit(WPARAM wParam , LPARAM lParam);

-	afx_msg void OnMove(int x , int y);

-	public:

-	virtual int	DoModal();	

-	//}}AFX_MSG

-	DECLARE_MESSAGE_MAP()

-

-public:

-	CGW_LineNumberEdit			m_edtSC;

-	BOOL						m_bTips;

-	const UINT					m_uTextlimited;

-	FX_HGLOBAL					m_hGlobal;

-	CReader_App *				m_pApp;

-	CWndElementList				m_WndElementList;

-};

-

+// 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 _JS_CONSOLE_H_
+#define _JS_CONSOLE_H_
+
+#include "../res/resource.h"
+
+#define WST_NONE		0x00					// No size changed
+#define WST_LEFT		0x01					// size to left
+#define WST_TOP			0x02					// size to top
+#define WST_RIGHT		0x04					// size to right
+#define WST_BOTTOM		0x08					// size to bottom
+#define WST_TOPLEFT		(WST_TOP|WST_LEFT)		// size to top & left
+#define WST_TOPRIGHT	(WST_TOP|WST_RIGHT)		// size to top & right
+#define WST_BOTTOMRIGHT	(WST_BOTTOM|WST_RIGHT)	// size to bottom & right
+#define WST_BOTTOMLEFT	(WST_BOTTOM|WST_LEFT)	// size to bottom & right
+
+#ifndef IDC_DLGSIZEBOX
+#define IDC_DLGSIZEBOX  50
+#endif	/* IDC_DLGSIZEBOX */
+
+enum { m_idSizeIcon = IDC_DLGSIZEBOX };
+enum {				// possible Control reSize Type
+	CST_NONE = 0,
+	CST_RESIZE,		// NOMOVE + SIZE, add all delta-size of dlg to control
+	CST_REPOS,		// MOVE(absolutely) + NOSIZE, move control's pos by delta-size
+	CST_RELATIVE,	// MOVE(proportional)  + NOSIZE, keep control always at a relative pos
+	CST_ZOOM,		// MOVE + SIZE (both are automatically proportional)
+	CST_DELTA_ZOOM	// MOVE(proportional, set manually) + SIZE(proportional, set manuall)
+};
+
+// contained class to hold item state
+//
+class CJS_ItemCtrl
+{
+public:
+	UINT	m_nID;
+	UINT	m_stxLeft  	   : 4;			// when left resizing ...
+	UINT	m_stxRight     : 4;			// when right resizing ...
+	UINT	m_styTop   	   : 4;			// when top resizing ...
+	UINT	m_styBottom    : 4;			// when bottom resizing ...
+	UINT	m_bFlickerFree : 1;
+	UINT	m_bInvalidate  : 1;			// Invalidate ctrl's rect(eg. no-automatical update for static when resize+move)
+	UINT	m_r0		   : 14;
+	CRect	m_wRect;
+	double	m_xRatio, m_cxRatio;
+	double	m_yRatio, m_cyRatio;
+
+protected:
+	void Assign(const CJS_ItemCtrl& src);
+
+public:
+	CJS_ItemCtrl();
+	CJS_ItemCtrl(const CJS_ItemCtrl& src);
+
+	HDWP OnSize(HDWP hdwp, int sizeType, CRect *pnCltRect, CRect *poCltRect, CRect *pR0, CWnd *pDlg);
+
+	CJS_ItemCtrl& operator=(const CJS_ItemCtrl& src);
+};
+
+class CJS_ResizeDlg : public CDialog
+{
+//	DECLARE_DYNAMIC(CJS_ResizeDlg)
+public:
+	CJS_ResizeDlg(UINT nID,CWnd *pParentWnd = NULL);
+	virtual ~CJS_ResizeDlg();
+
+
+public:
+	std::vector<CJS_ItemCtrl>	m_Items;           // array of controlled items
+	CRect					m_cltRect, m_cltR0;
+	int						m_xMin, m_yMin;
+	int						m_xSt,  m_ySt;		//step?
+	UINT					m_nDelaySide;		//drag side of window
+	CStatic					m_wndSizeIcon;     // size icon window
+
+protected:
+	void 					AddControl( UINT nID, int xl, int xr, int yt, int yb, int bFlickerFree = 0, 
+									    double xRatio = -1.0, double cxRatio = -1.0,
+									    double yRatio = -1.0, double cyRatio = -1.0 );
+	void 					AllowSizing(int xst, int yst);
+	void 					HideSizeIcon(void);	
+	virtual BOOL			OnInitDialog();
+
+	void					OnSizing(UINT nSide, LPRECT lpRect);
+	void					OnSize(UINT nType, int cx, int cy);
+	void					OnGetMinMaxInfo(MINMAXINFO *pmmi);
+	BOOL					OnEraseBkgnd(CDC* pDC);
+
+public:
+	int						UpdateControlRect(UINT nID, CRect *pnr);
+};
+
+
+//------------------------CIconListBox for CWndElementList-------------------------------------
+
+class CIconListBox : public CListBox
+{
+public:
+	CIconListBox();
+	virtual ~CIconListBox();
+
+public:
+	int				InsertString(int nIndex, LPCWSTR lpszItem , int nImage);
+	virtual	void	ResetContent();
+	virtual void	GetText(int nIndex, CString& rString);
+
+	virtual void	DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	void			MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
+	int				CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
+
+protected:
+	// Generated message map functions
+	//{{AFX_MSG(CIconListBox)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG	
+	DECLARE_MESSAGE_MAP()
+
+protected:
+	struct ItemDatas 
+	{
+		CString	csText;
+		int		nImage;
+	};
+};
+//----------------------------------CWndElementList--------------------------------------------
+#define IDC_LIST_JS_ELEMENT 10070
+
+#define ELEMENT_LIST_WIDTH 140
+#define ELEMENT_LIST_HEIGHT 180
+#define ELEMENT_LIST_TOP_OFFSET 13
+
+#define ELEMENT_TYPE_NAME	0
+#define ELEMENT_TYPE_CONST	1
+#define ELEMENT_TYPE_FUN	2
+#define ELEMENT_TYPE_PRO	3
+
+class CWndElementList : public CWnd
+{
+public:
+	CWndElementList();
+	virtual ~CWndElementList();
+	
+public:
+	virtual void	OnSize(UINT nType, int cx, int cy);
+	virtual BOOL	Create(CWnd* pParentWnd);
+	virtual BOOL	ShowWindow(int nCmdShow);
+	void			RemoveAllElement();
+	void			SetElementList(LPCWSTR* pElement, int* pType ,  int iCount);
+	void			AddElement(CFX_WideString csValue , int nType);
+	BOOL			GetElementSel(CString &csElement);
+	BOOL			SelectNext();
+	BOOL			SelectPrevious();
+	BOOL			SelectFirst();
+	BOOL			SelectLast();
+	BOOL			SelectNextPage();
+	BOOL			SelectPreviousPage();
+	int				GetListHeight();
+	
+protected:
+	// Generated message map functions
+	//{{AFX_MSG(CWndElementList)
+	afx_msg void OnPaint();
+	afx_msg BOOL OnNcActivate(BOOL bActive);
+	afx_msg void OnSelJSElement();
+	afx_msg void OnDblclkJSElement();
+	afx_msg void OnDestroy();
+	//}}AFX_MSG	
+	DECLARE_MESSAGE_MAP()
+protected:
+	CIconListBox	m_ListBox;
+	BOOL			m_bBlock;
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// CJS_ConsoleDlg ¶Ô»°¿ò
+class CJS_ConsoleDlg : public CJS_ResizeDlg
+{
+	DECLARE_DYNAMIC(CJS_ConsoleDlg)
+
+public:
+	CJS_ConsoleDlg(CReader_App* pApp, CWnd* pParent);	
+	virtual ~CJS_ConsoleDlg();
+
+	enum { IDD = IDD_JS_CONSOLE };
+
+	void				Create();
+
+	void				AppendConsoleText(const CFX_WideString& swText);
+	void				SetConsoleText(const CFX_WideString& swText);
+	CFX_WideString		GetConsoleText() const;
+	CFX_WideString		GetScriptText() const;
+
+	BOOL				ResetElementList(LPCWSTR lpstrRef);
+	IFXJS_Runtime*		GetJSRuntime();
+
+protected:
+	virtual void		DoDataExchange(CDataExchange* pDX);	// DDX/DDV Ö§³Ö
+
+protected:
+	virtual BOOL		OnInitDialog();	
+	virtual void		OnCancel();
+
+	virtual BOOL		PreTranslateMessage(MSG* pMsg);
+
+protected:
+	// Generated message map functions
+	//{{AFX_MSG(CJS_ConsoleDlg)
+	afx_msg void OnBnClickedClear();
+	afx_msg void OnBnClickedOk();
+	afx_msg void OnBnClickTips();
+	afx_msg void OnSizing(UINT nSide, LPRECT lpRect);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnGetMinMaxInfo(MINMAXINFO *pmmi);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnChangeScriptEdit(WPARAM wParam , LPARAM lParam);
+	afx_msg void OnMove(int x , int y);
+	public:
+	virtual int	DoModal();	
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+
+public:
+	CGW_LineNumberEdit			m_edtSC;
+	BOOL						m_bTips;
+	const UINT					m_uTextlimited;
+	FX_HGLOBAL					m_hGlobal;
+	CReader_App *				m_pApp;
+	CWndElementList				m_WndElementList;
+};
+
 #endif //_JS_CONSOLE_H_
\ No newline at end of file
diff --git a/fpdfsdk/include/javascript/JS_Context.h b/fpdfsdk/include/javascript/JS_Context.h
index 0e79169..8068086 100644
--- a/fpdfsdk/include/javascript/JS_Context.h
+++ b/fpdfsdk/include/javascript/JS_Context.h
@@ -1,101 +1,101 @@
-// 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 _JS_CONTEXT_H_

-#define _JS_CONTEXT_H_

-

-class CJS_EventHandler;

-class CJS_Runtime;

-

-class CJS_Context : public IFXJS_Context

-{

-public:

-	CJS_Context(CJS_Runtime* pRuntime);

-	virtual ~CJS_Context();

-

-public:

-	virtual FX_BOOL				Compile(const CFX_WideString& script, CFX_WideString& info);

-	virtual FX_BOOL				RunScript(const CFX_WideString& script, CFX_WideString& info);

-

-public:

-	virtual void				OnApp_Init();

-

-	virtual void				OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);

-	virtual void				OnDoc_WillPrint(CPDFSDK_Document* pDoc);

-	virtual void				OnDoc_DidPrint(CPDFSDK_Document* pDoc);

-	virtual void				OnDoc_WillSave(CPDFSDK_Document* pDoc);

-	virtual void				OnDoc_DidSave(CPDFSDK_Document* pDoc);

-	virtual void				OnDoc_WillClose(CPDFSDK_Document* pDoc);

-

-	virtual void				OnPage_Open(CPDFSDK_Document* pTarget);

-	virtual void				OnPage_Close(CPDFSDK_Document* pTarget);

-	virtual void				OnPage_InView(CPDFSDK_Document* pTarget);

-	virtual void				OnPage_OutView(CPDFSDK_Document* pTarget);

-	

-	virtual void				OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	virtual void				OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	virtual void				OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	virtual void				OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	virtual void				OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);

-	virtual void				OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);

-

-	virtual void				OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);

-	virtual void				OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);

-	virtual void				OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,

-									FX_BOOL bKeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,

-									CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 

-									FX_BOOL bFieldFull, FX_BOOL &bRc);

-	virtual void				OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,

-									FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);

-

-	virtual void				OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	virtual void				OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-

-	virtual void				OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);

-	virtual void				OnLink_MouseUp(CPDFSDK_Document* pTarget);

-

-	virtual void				OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);

-	virtual void				OnBatchExec(CPDFSDK_Document* pTarget);

-	virtual void				OnConsole_Exec();

-	virtual void				OnExternal_Exec();

-

-	virtual void				EnableMessageBox(FX_BOOL bEnable) {m_bMsgBoxEnable = bEnable;}

-	FX_BOOL						IsMsgBoxEnabled() const {return m_bMsgBoxEnable;}

-

-public:

-	CPDFDoc_Environment*			GetReaderApp();

-	CJS_Runtime*				GetJSRuntime(){return m_pRuntime;}

-

-	FX_BOOL						DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);

-

-	CJS_EventHandler*			GetEventHandler(){return m_pEventHandler;};	

-	CPDFSDK_Document*			GetReaderDocument();

-

-private:

-	CJS_Runtime*				m_pRuntime;	

-	CJS_EventHandler*			m_pEventHandler;	

-

-	FX_BOOL						m_bBusy;	

-	FX_BOOL						m_bMsgBoxEnable;

-};

-

-// static CFX_WideString JSGetStringFromID(CJS_Context* pContext, UINT ID)

-// {

-// 	ASSERT(pContext != NULL);

-// 

-// 	return JS_LoadString(pContext->GetReaderApp(), ID);

-// }

-

-#endif //_JS_CONTEXT_H_

-

+// 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 _JS_CONTEXT_H_
+#define _JS_CONTEXT_H_
+
+class CJS_EventHandler;
+class CJS_Runtime;
+
+class CJS_Context : public IFXJS_Context
+{
+public:
+	CJS_Context(CJS_Runtime* pRuntime);
+	virtual ~CJS_Context();
+
+public:
+	virtual FX_BOOL				Compile(const CFX_WideString& script, CFX_WideString& info);
+	virtual FX_BOOL				RunScript(const CFX_WideString& script, CFX_WideString& info);
+
+public:
+	virtual void				OnApp_Init();
+
+	virtual void				OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
+	virtual void				OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+	virtual void				OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+	virtual void				OnDoc_WillSave(CPDFSDK_Document* pDoc);
+	virtual void				OnDoc_DidSave(CPDFSDK_Document* pDoc);
+	virtual void				OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+	virtual void				OnPage_Open(CPDFSDK_Document* pTarget);
+	virtual void				OnPage_Close(CPDFSDK_Document* pTarget);
+	virtual void				OnPage_InView(CPDFSDK_Document* pTarget);
+	virtual void				OnPage_OutView(CPDFSDK_Document* pTarget);
+	
+	virtual void				OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	virtual void				OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	virtual void				OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	virtual void				OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	virtual void				OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
+	virtual void				OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
+
+	virtual void				OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
+	virtual void				OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
+	virtual void				OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
+									FX_BOOL bKeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
+									CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 
+									FX_BOOL bFieldFull, FX_BOOL &bRc);
+	virtual void				OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
+									FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
+
+	virtual void				OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	virtual void				OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+
+	virtual void				OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+	virtual void				OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+	virtual void				OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
+	virtual void				OnBatchExec(CPDFSDK_Document* pTarget);
+	virtual void				OnConsole_Exec();
+	virtual void				OnExternal_Exec();
+
+	virtual void				EnableMessageBox(FX_BOOL bEnable) {m_bMsgBoxEnable = bEnable;}
+	FX_BOOL						IsMsgBoxEnabled() const {return m_bMsgBoxEnable;}
+
+public:
+	CPDFDoc_Environment*			GetReaderApp();
+	CJS_Runtime*				GetJSRuntime(){return m_pRuntime;}
+
+	FX_BOOL						DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
+
+	CJS_EventHandler*			GetEventHandler(){return m_pEventHandler;};	
+	CPDFSDK_Document*			GetReaderDocument();
+
+private:
+	CJS_Runtime*				m_pRuntime;	
+	CJS_EventHandler*			m_pEventHandler;	
+
+	FX_BOOL						m_bBusy;	
+	FX_BOOL						m_bMsgBoxEnable;
+};
+
+// static CFX_WideString JSGetStringFromID(CJS_Context* pContext, UINT ID)
+// {
+// 	ASSERT(pContext != NULL);
+// 
+// 	return JS_LoadString(pContext->GetReaderApp(), ID);
+// }
+
+#endif //_JS_CONTEXT_H_
+
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index 81d4455..cc20333 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -1,785 +1,785 @@
-// 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 _JS_DEFINE_H_

-#define _JS_DEFINE_H_

-

-typedef v8::Value			JSValue;

-typedef v8::Handle<v8::Object>	JSObject;

-typedef v8::Handle<v8::Object>	JSFXObject;

-typedef unsigned		JSBool;

-

-struct JSConstSpec

-{

-	const wchar_t* pName;

-	double number;

-	const wchar_t* string;

-	FX_BYTE t; //0:double 1:str

-};

-

-struct JSPropertySpec

-{

-	const wchar_t* pName;

-	v8::AccessorGetterCallback pPropGet;

-	v8::AccessorSetterCallback pPropPut;

-};

-

-struct JSMethodSpec

-{

-	const wchar_t* pName;

-	v8::FunctionCallback pMethodCall;

-	unsigned nParamNum;

-};

-

-typedef CFX_WideString	JS_ErrorString;

-

-#define JS_TRUE			(unsigned)1

-#define JS_FALSE		(unsigned)0

-

-

-#define CJS_PointsArray		CFX_ArrayTemplate<float>

-#define CJS_IntArray		CFX_ArrayTemplate<int>

-

-/* ====================================== PUBLIC DEFINE SPEC ============================================== */

-#ifndef __GNUC__

-#define JS_WIDESTRING(widestring) L#widestring

-#else

-#define JS_WIDESTRING(widestring) L""#widestring

-#endif

-

-#define OBJ_PROP_PARAMS			IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError

-#define OBJ_METHOD_PARAMS		IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError

-#define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {

-#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},

-#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},

-#define END_JS_STATIC_CONST() {0, 0, 0, 0}};

-

-#define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {

-#define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},

-#define END_JS_STATIC_PROP() {0, 0, 0}};

-

-#define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {

-#define JS_STATIC_METHOD_ENTRY(method_name, nargs) {JS_WIDESTRING(method_name), method_name##_static, nargs},

-#define END_JS_STATIC_METHOD() {0, 0, 0}};

-#define MEMLEAKCHECK_1() ((void)0)

-#define MEMLEAKCHECK_2(main_name, sub_name) ((void)0)

-

-

-/*

-#ifdef _DEBUG

-#define MEMLEAKCHECK_1() \

-	_CrtMemState state1;\

-	_CrtMemCheckpoint(&state1);

-

-#define MEMLEAKCHECK_2(main_name,sub_name) \

-	_CrtMemState state2;\

-	_CrtMemCheckpoint(&state2);\

-	_CrtMemState diff;\

-	_CrtMemDifference(&diff,&state1,&state2);\

-	if (diff.lSizes[_NORMAL_BLOCK] > 0)\

-	{\

-		TRACE("Detected normal block memory leaks in JS Module! [%s.%s]\n",#main_name,#sub_name);\

-		_CrtMemDumpStatistics(&diff);\

-	}

-#else

-	#define MEMLEAKCHECK_1() ((void)0)

-	#define MEMLEAKCHECK_2(main_name,sub_name) ((void)0)

-#endif

-*/

-

-/* ======================================== PROP CALLBACK ============================================ */

-

-#define JS_STATIC_PROP_GET(prop_name, class_name)\

-	static void get_##prop_name##_static(JS_PROPGET_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	CJS_PropValue value(isolate);\

-	value.StartGetting();\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->prop_name(cc, value, sError);\

-		MEMLEAKCHECK_2(class_name, prop_name);\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #prop_name);\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\

-		return ;\

-	}\

-	else\

-	{\

-	CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #prop_name);\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-}

-

-#define JS_STATIC_PROP_SET(prop_name, class_name)\

-	static void set_##prop_name##_static(JS_PROPPUT_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	CJS_PropValue propValue(CJS_Value(isolate,value,VT_unknown));\

-	propValue.StartSetting();\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->prop_name(cc, propValue, sError);\

-		MEMLEAKCHECK_2(class_name, prop_name);\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #prop_name);\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #prop_name);\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-}

-

-#define JS_STATIC_PROP(prop_name, class_name)\

-JS_STATIC_PROP_GET(prop_name, class_name);\

-JS_STATIC_PROP_SET(prop_name, class_name)

-

-/* ========================================= METHOD CALLBACK =========================================== */

-

-#define JS_STATIC_METHOD(method_name, class_name)\

-	static void method_name##_static(JS_METHOD_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	CJS_Parameters parameters;\

-	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\

-    {\

-		parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\

-	}\

-	CJS_Value valueRes(isolate);\

-	CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->method_name(cc, parameters, valueRes, sError);\

-		MEMLEAKCHECK_2(class_name, method_name);\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #method_name);\

-		JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		info.GetReturnValue().Set(valueRes.ToJSValue());\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #method_name);\

-		JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-}

-

-/* ===================================== JS CLASS =============================================== */

-

-#define DECLARE_JS_CLASS(js_class_name) \

-	static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\

-	static JSBool JSDestructor(JSFXObject obj);\

-	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\

-	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\

-	static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\

-	static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\

-	static JSConstSpec JS_Class_Consts[];\

-	static JSPropertySpec JS_Class_Properties[];\

-	static JSMethodSpec	JS_Class_Methods[];\

-	static const wchar_t* m_pClassName

-

-#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \

-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\

-JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\

-{\

-	CJS_Object* pObj = FX_NEW js_class_name(obj);\

-	pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\

-	JS_SetPrivate(NULL,obj,(void*)pObj); \

-	pObj->InitInstance(cc);\

-	return JS_TRUE;\

-}\

-\

-JSBool js_class_name::JSDestructor(JSFXObject obj) \

-{\

-	js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\

-	ASSERT(pObj != NULL);\

-	pObj->ExitInstance();\

-	delete pObj;\

-	return JS_TRUE;\

-}\

-\

-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\

-{\

-	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\

-	if (nObjDefnID >= 0)\

-	{\

-		for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\

-		{\

-			if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPropPut) < 0) return -1;\

-		}\

-		for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\

-		{\

-			if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName, JS_Class_Methods[k].pMethodCall, JS_Class_Methods[k].nParamNum) < 0) return -1;\

-		}\

-		return nObjDefnID;\

-	}\

-	return -1;\

-}\

-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\

-{\

-	pConsts = JS_Class_Consts;\

-	nSize = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1;\

-}\

-void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\

-{\

-	pProperties = JS_Class_Properties;\

-	nSize = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1;\

-}\

-void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\

-{\

-	pMethods = JS_Class_Methods;\

-	nSize = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1;\

-}

-

-#define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)

-

-/* ======================================== CONST CLASS ============================================ */

-

-#define DECLARE_JS_CLASS_CONST() \

-	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\

-	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\

-	static JSConstSpec JS_Class_Consts[];\

-	static const wchar_t* m_pClassName

-

-#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \

-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\

-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\

-{\

-	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, NULL, NULL, 0);\

-	if (nObjDefnID >=0)\

-	{\

-		for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\

-		{\

-			if (JS_Class_Consts[i].t == 0)\

-			{\

-				if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) return -1;\

-			}\

-			else\

-			{\

-			if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\

-			}\

-		}\

-		return nObjDefnID;\

-	}\

-	return -1;\

-}\

-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\

-{\

-	pConsts = JS_Class_Consts;\

-	nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\

-}

-

-/* ===================================== SPECIAL JS CLASS =============================================== */

-

-#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \

-	static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\

-	static JSBool JSDestructor(JSFXObject obj);\

-	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\

-	static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\

-	static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\

-	static JSConstSpec JS_Class_Consts[];\

-	static JSPropertySpec JS_Class_Properties[];\

-	static JSMethodSpec	JS_Class_Methods[];\

-	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\

-	static const wchar_t* m_pClassName;\

-	static void queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS);\

-	static void getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS);\

-	static void putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS);\

-	static void delprop_##js_class_name##_static(JS_PROPDEL_ARGS)

-

-#define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \

-const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\

-	void js_class_name::queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::String::Utf8Value utf8_value(property);\

-	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->QueryProperty((FX_LPCWSTR)propname);\

-		MEMLEAKCHECK_2(class_name, (FX_LPCWSTR)prop_name);\

-	}\

-	catch (...)\

-	{\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		info.GetReturnValue().Set(0x004);\

-		return ;\

-	}\

-	else\

-	{\

-		info.GetReturnValue().Set(0);\

-		return ;\

-	}\

-	return ;\

-}\

-	void js_class_name::getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	v8::String::Utf8Value utf8_value(property);\

-	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\

-	CJS_PropValue value(isolate);\

-	value.StartGetting();\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, value, sError);\

-		MEMLEAKCHECK_2(class_name, L"GetProperty");\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, L"GetProperty");\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, L"GetProperty");\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-	JS_Error(NULL,L"GetProperty", L"Embeded object not found!");\

-	return ;\

-}\

-	void js_class_name::putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	v8::String::Utf8Value utf8_value(property);\

-	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\

-	CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));\

-	PropValue.StartSetting();\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	if(!pJSObj) return;\

-	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, PropValue, sError);\

-		MEMLEAKCHECK_2(class_name,L"PutProperty");\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, "PutProperty");\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, "PutProperty");\

-		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-	JS_Error(NULL,L"PutProperty", L"Embeded object not found!");\

-	return ;\

-}\

-	void js_class_name::delprop_##js_class_name##_static(JS_PROPDEL_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	v8::String::Utf8Value utf8_value(property);\

-	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\

-	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->DelProperty(cc, (FX_LPCWSTR)propname, sError);\

-		MEMLEAKCHECK_2(class_name,L"DelProperty");\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, "DelProperty");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, "DelProperty");\

-		return ;\

-	}\

-	return ;\

-}\

-JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject  obj,JSFXObject  global)\

-{\

-	CJS_Object* pObj = FX_NEW js_class_name(obj);\

-	pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\

-	JS_SetPrivate(NULL,obj, (void*)pObj); \

-	pObj->InitInstance(cc);\

-	return JS_TRUE;\

-}\

-\

-JSBool js_class_name::JSDestructor(JSFXObject obj) \

-{\

-	js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\

-	ASSERT(pObj != NULL);\

-	pObj->ExitInstance();\

-	delete pObj;\

-	return JS_TRUE;\

-}\

-\

-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\

-{\

-\

-	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\

-\

-	if (nObjDefnID >= 0)\

-	{\

-		for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\

-		{\

-			if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet,JS_Class_Properties[j].pPropPut)<0)return -1;\

-		}\

-\

-		for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\

-		{\

-			if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName,JS_Class_Methods[k].pMethodCall,JS_Class_Methods[k].nParamNum)<0)return -1;\

-		}\

-		if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_name::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_##js_class_name##_static)<0) return -1;\

-\

-		return nObjDefnID;\

-	}\

-\

-	return -1;\

-}\

-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\

-{\

-	pConsts = JS_Class_Consts;\

-	nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\

-}\

-void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\

-{\

-	pProperties = JS_Class_Properties;\

-	nSize = sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1;\

-}\

-void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\

-{\

-	pMethods = JS_Class_Methods;\

-	nSize = sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1;\

-}

-

-#define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name)\

-	static void method_name##_static(JS_METHOD_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	CJS_Parameters parameters;\

-	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\

-	{\

-	parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\

-	}\

-	CJS_Value valueRes(isolate);\

-	CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate, info.Holder());\

-	ASSERT(pJSObj != NULL);\

-	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\

-	ASSERT(pObj != NULL);\

-	JS_ErrorString sError;\

-	FX_BOOL bRet = FALSE;\

-	try\

-	{\

-		MEMLEAKCHECK_1();\

-		bRet = pObj->method_name(cc, parameters, valueRes, sError);\

-		MEMLEAKCHECK_2(class_name, method_name);\

-	}\

-	catch (...)\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #method_name);\

-		JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\

-		return ;\

-	}\

-	if (bRet)\

-	{\

-		info.GetReturnValue().Set(valueRes.ToJSValue());\

-		return ;\

-	}\

-	else\

-	{\

-		CFX_ByteString cbName;\

-		cbName.Format("%s.%s", #class_name, #method_name);\

-		JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\

-		return ;\

-	}\

-	JS_Error(NULL,  JS_WIDESTRING(method_name), L"Embeded object not found!");\

-    return ;\

-}

-

-/* ======================================== GLOBAL METHODS ============================================ */

-#define JS_STATIC_GLOBAL_FUN(fun_name) \

-static void fun_name##_static(JS_METHOD_ARGS)\

-{\

-	v8::Isolate* isolate = info.GetIsolate();\

-	v8::Local<v8::Context> context = isolate->GetCurrentContext();\

-	v8::Local<v8::Value> v = context->GetEmbedderData(1);\

-	ASSERT(!v.IsEmpty());\

-	if(v.IsEmpty()) return;\

-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\

-	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\

-	IFXJS_Context* cc = pRuntime->GetCurrentContext();\

-	CJS_Parameters parameters;\

-	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\

-	{\

-	parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\

-	}\

-	CJS_Value valueRes(isolate);\

-	JS_ErrorString sError;\

-	if (!fun_name(cc, parameters, valueRes, sError))\

-	{\

-		JS_Error(NULL, JS_WIDESTRING(fun_name), sError);\

-		return ;\

-	}\

-	info.GetReturnValue().Set(valueRes.ToJSValue());\

-	return ;\

-}

-

-#define JS_STATIC_DECLARE_GLOBAL_FUN() \

-static JSMethodSpec	global_methods[]; \

-static int Init(IJS_Runtime* pRuntime)

-

-#define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \

-JSMethodSpec js_class_name::global_methods[] = {

-

-#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name,nargs) JS_STATIC_METHOD_ENTRY(method_name,nargs)

-

-#define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()

-

-#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \

-int js_class_name::Init(IJS_Runtime* pRuntime)\

-{\

-	for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i<sz; i++)\

-	{\

-		if (JS_DefineGlobalMethod(pRuntime,\

-				js_class_name::global_methods[i].pName,\

-				js_class_name::global_methods[i].pMethodCall,\

-				js_class_name::global_methods[i].nParamNum\

-				) < 0\

-			)return -1;\

-	}\

-	return 0;\

-}

-

-/* ======================================== GLOBAL CONSTS ============================================ */

-#define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\

-if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntime,JS_WIDESTRING(const_value)))) return -1

-

-/* ======================================== GLOBAL ARRAYS ============================================ */

-

-#define DEFINE_GLOBAL_ARRAY(pRuntime)\

-int size = sizeof(ArrayContent) / sizeof(FX_LPCWSTR);\

-\

-CJS_Array array(pRuntime);\

-for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,(FX_LPCWSTR)ArrayContent[i]));\

-\

-CJS_PropValue prop(pRuntime);\

-prop << array;\

-if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue()) < 0)\

-	return -1

-

-/* ============================================================ */

-

-#define VALUE_NAME_STRING		L"string"

-#define VALUE_NAME_NUMBER		L"number"

-#define VALUE_NAME_BOOLEAN		L"boolean"

-#define VALUE_NAME_DATE			L"date"

-#define VALUE_NAME_OBJECT		L"object"

-#define VALUE_NAME_FXOBJ		L"fxobj"

-#define VALUE_NAME_NULL			L"null"

-#define VALUE_NAME_UNDEFINED	L"undefined"

-

-#define CLASSNAME_ARRAY			L"Array"

-#define CLASSNAME_DATE			L"Date"

-#define CLASSNAME_STRING		L"v8::String"

-

-const unsigned int JSCONST_nStringHash = JS_CalcHash(VALUE_NAME_STRING,wcslen(VALUE_NAME_STRING));

-const unsigned int JSCONST_nNumberHash = JS_CalcHash(VALUE_NAME_NUMBER,wcslen(VALUE_NAME_NUMBER));

-const unsigned int JSCONST_nBoolHash = JS_CalcHash(VALUE_NAME_BOOLEAN,wcslen(VALUE_NAME_BOOLEAN));

-const unsigned int JSCONST_nDateHash = JS_CalcHash(VALUE_NAME_DATE,wcslen(VALUE_NAME_DATE));

-const unsigned int JSCONST_nObjectHash = JS_CalcHash(VALUE_NAME_OBJECT,wcslen(VALUE_NAME_OBJECT));

-const unsigned int JSCONST_nFXobjHash = JS_CalcHash(VALUE_NAME_FXOBJ,wcslen(VALUE_NAME_FXOBJ));

-const unsigned int JSCONST_nNullHash = JS_CalcHash(VALUE_NAME_NULL,wcslen(VALUE_NAME_NULL));

-const unsigned int JSCONST_nUndefHash = JS_CalcHash(VALUE_NAME_UNDEFINED,wcslen(VALUE_NAME_UNDEFINED));

-

-static FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p)

-{

-

-		const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));

-

-		if (nHash == JSCONST_nUndefHash)

-			return VT_undefined;

-		else if (nHash == JSCONST_nNullHash)

-			return VT_null;

-		else if (nHash == JSCONST_nStringHash)

-			return VT_string;

-		else if (nHash == JSCONST_nNumberHash)

-			return VT_number;

-		else if (nHash == JSCONST_nBoolHash)

-			return VT_boolean;

-		else if (nHash == JSCONST_nDateHash)

-			return VT_date;

-		else if (nHash == JSCONST_nObjectHash)

-			return VT_object;		

-		else if (nHash == JSCONST_nFXobjHash)

-			return VT_fxobject;

-

-		/*

-		const char * sType = p->getTypeof()->toDchars();

-		if (strcmp(sType,VALUE_NAME_STRING) == 0)

-			return VT_string;

-		else if (strcmp(sType,VALUE_NAME_NUMBER) == 0)

-			return VT_number;

-		else if (strcmp(sType,VALUE_NAME_BOOLEAN) == 0)

-			return VT_boolean;

-		else if (strcmp(sType,VALUE_NAME_DATE) == 0)

-			return VT_date;

-		else if (strcmp(sType,VALUE_NAME_OBJECT) == 0)

-			return VT_object;

-		else if (strcmp(sType,VALUE_NAME_FXOBJ) == 0)

-			return VT_object;

-		else if (strcmp(sType,VALUE_NAME_NULL) == 0)

-			return VT_null;

-		else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0)

-			return VT_undefined;

-			*/

-

-	return VT_unknown;

-}

-

-#endif //_JS_DEFINE_H_

+// 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 _JS_DEFINE_H_
+#define _JS_DEFINE_H_
+
+typedef v8::Value			JSValue;
+typedef v8::Handle<v8::Object>	JSObject;
+typedef v8::Handle<v8::Object>	JSFXObject;
+typedef unsigned		JSBool;
+
+struct JSConstSpec
+{
+	const wchar_t* pName;
+	double number;
+	const wchar_t* string;
+	FX_BYTE t; //0:double 1:str
+};
+
+struct JSPropertySpec
+{
+	const wchar_t* pName;
+	v8::AccessorGetterCallback pPropGet;
+	v8::AccessorSetterCallback pPropPut;
+};
+
+struct JSMethodSpec
+{
+	const wchar_t* pName;
+	v8::FunctionCallback pMethodCall;
+	unsigned nParamNum;
+};
+
+typedef CFX_WideString	JS_ErrorString;
+
+#define JS_TRUE			(unsigned)1
+#define JS_FALSE		(unsigned)0
+
+
+#define CJS_PointsArray		CFX_ArrayTemplate<float>
+#define CJS_IntArray		CFX_ArrayTemplate<int>
+
+/* ====================================== PUBLIC DEFINE SPEC ============================================== */
+#ifndef __GNUC__
+#define JS_WIDESTRING(widestring) L#widestring
+#else
+#define JS_WIDESTRING(widestring) L""#widestring
+#endif
+
+#define OBJ_PROP_PARAMS			IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError
+#define OBJ_METHOD_PARAMS		IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError
+#define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
+#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},
+#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},
+#define END_JS_STATIC_CONST() {0, 0, 0, 0}};
+
+#define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {
+#define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},
+#define END_JS_STATIC_PROP() {0, 0, 0}};
+
+#define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {
+#define JS_STATIC_METHOD_ENTRY(method_name, nargs) {JS_WIDESTRING(method_name), method_name##_static, nargs},
+#define END_JS_STATIC_METHOD() {0, 0, 0}};
+#define MEMLEAKCHECK_1() ((void)0)
+#define MEMLEAKCHECK_2(main_name, sub_name) ((void)0)
+
+
+/*
+#ifdef _DEBUG
+#define MEMLEAKCHECK_1() \
+	_CrtMemState state1;\
+	_CrtMemCheckpoint(&state1);
+
+#define MEMLEAKCHECK_2(main_name,sub_name) \
+	_CrtMemState state2;\
+	_CrtMemCheckpoint(&state2);\
+	_CrtMemState diff;\
+	_CrtMemDifference(&diff,&state1,&state2);\
+	if (diff.lSizes[_NORMAL_BLOCK] > 0)\
+	{\
+		TRACE("Detected normal block memory leaks in JS Module! [%s.%s]\n",#main_name,#sub_name);\
+		_CrtMemDumpStatistics(&diff);\
+	}
+#else
+	#define MEMLEAKCHECK_1() ((void)0)
+	#define MEMLEAKCHECK_2(main_name,sub_name) ((void)0)
+#endif
+*/
+
+/* ======================================== PROP CALLBACK ============================================ */
+
+#define JS_STATIC_PROP_GET(prop_name, class_name)\
+	static void get_##prop_name##_static(JS_PROPGET_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	CJS_PropValue value(isolate);\
+	value.StartGetting();\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->prop_name(cc, value, sError);\
+		MEMLEAKCHECK_2(class_name, prop_name);\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #prop_name);\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\
+		return ;\
+	}\
+	else\
+	{\
+	CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #prop_name);\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+}
+
+#define JS_STATIC_PROP_SET(prop_name, class_name)\
+	static void set_##prop_name##_static(JS_PROPPUT_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	CJS_PropValue propValue(CJS_Value(isolate,value,VT_unknown));\
+	propValue.StartSetting();\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->prop_name(cc, propValue, sError);\
+		MEMLEAKCHECK_2(class_name, prop_name);\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #prop_name);\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #prop_name);\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+}
+
+#define JS_STATIC_PROP(prop_name, class_name)\
+JS_STATIC_PROP_GET(prop_name, class_name);\
+JS_STATIC_PROP_SET(prop_name, class_name)
+
+/* ========================================= METHOD CALLBACK =========================================== */
+
+#define JS_STATIC_METHOD(method_name, class_name)\
+	static void method_name##_static(JS_METHOD_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	CJS_Parameters parameters;\
+	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
+    {\
+		parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
+	}\
+	CJS_Value valueRes(isolate);\
+	CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->method_name(cc, parameters, valueRes, sError);\
+		MEMLEAKCHECK_2(class_name, method_name);\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #method_name);\
+		JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		info.GetReturnValue().Set(valueRes.ToJSValue());\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #method_name);\
+		JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+}
+
+/* ===================================== JS CLASS =============================================== */
+
+#define DECLARE_JS_CLASS(js_class_name) \
+	static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
+	static JSBool JSDestructor(JSFXObject obj);\
+	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
+	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
+	static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
+	static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
+	static JSConstSpec JS_Class_Consts[];\
+	static JSPropertySpec JS_Class_Properties[];\
+	static JSMethodSpec	JS_Class_Methods[];\
+	static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
+const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
+JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\
+{\
+	CJS_Object* pObj = FX_NEW js_class_name(obj);\
+	pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
+	JS_SetPrivate(NULL,obj,(void*)pObj); \
+	pObj->InitInstance(cc);\
+	return JS_TRUE;\
+}\
+\
+JSBool js_class_name::JSDestructor(JSFXObject obj) \
+{\
+	js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
+	ASSERT(pObj != NULL);\
+	pObj->ExitInstance();\
+	delete pObj;\
+	return JS_TRUE;\
+}\
+\
+int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
+{\
+	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
+	if (nObjDefnID >= 0)\
+	{\
+		for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
+		{\
+			if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPropPut) < 0) return -1;\
+		}\
+		for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
+		{\
+			if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName, JS_Class_Methods[k].pMethodCall, JS_Class_Methods[k].nParamNum) < 0) return -1;\
+		}\
+		return nObjDefnID;\
+	}\
+	return -1;\
+}\
+void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
+{\
+	pConsts = JS_Class_Consts;\
+	nSize = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1;\
+}\
+void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
+{\
+	pProperties = JS_Class_Properties;\
+	nSize = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1;\
+}\
+void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
+{\
+	pMethods = JS_Class_Methods;\
+	nSize = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1;\
+}
+
+#define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
+
+/* ======================================== CONST CLASS ============================================ */
+
+#define DECLARE_JS_CLASS_CONST() \
+	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
+	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
+	static JSConstSpec JS_Class_Consts[];\
+	static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
+const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
+int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
+{\
+	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, NULL, NULL, 0);\
+	if (nObjDefnID >=0)\
+	{\
+		for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\
+		{\
+			if (JS_Class_Consts[i].t == 0)\
+			{\
+				if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) return -1;\
+			}\
+			else\
+			{\
+			if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\
+			}\
+		}\
+		return nObjDefnID;\
+	}\
+	return -1;\
+}\
+void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
+{\
+	pConsts = JS_Class_Consts;\
+	nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
+}
+
+/* ===================================== SPECIAL JS CLASS =============================================== */
+
+#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
+	static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\
+	static JSBool JSDestructor(JSFXObject obj);\
+	static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
+	static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
+	static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
+	static JSConstSpec JS_Class_Consts[];\
+	static JSPropertySpec JS_Class_Properties[];\
+	static JSMethodSpec	JS_Class_Methods[];\
+	static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
+	static const wchar_t* m_pClassName;\
+	static void queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS);\
+	static void getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS);\
+	static void putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS);\
+	static void delprop_##js_class_name##_static(JS_PROPDEL_ARGS)
+
+#define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \
+const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
+	void js_class_name::queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::String::Utf8Value utf8_value(property);\
+	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->QueryProperty((FX_LPCWSTR)propname);\
+		MEMLEAKCHECK_2(class_name, (FX_LPCWSTR)prop_name);\
+	}\
+	catch (...)\
+	{\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		info.GetReturnValue().Set(0x004);\
+		return ;\
+	}\
+	else\
+	{\
+		info.GetReturnValue().Set(0);\
+		return ;\
+	}\
+	return ;\
+}\
+	void js_class_name::getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	v8::String::Utf8Value utf8_value(property);\
+	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
+	CJS_PropValue value(isolate);\
+	value.StartGetting();\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, value, sError);\
+		MEMLEAKCHECK_2(class_name, L"GetProperty");\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, L"GetProperty");\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, L"GetProperty");\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+	JS_Error(NULL,L"GetProperty", L"Embeded object not found!");\
+	return ;\
+}\
+	void js_class_name::putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	v8::String::Utf8Value utf8_value(property);\
+	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
+	CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));\
+	PropValue.StartSetting();\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	if(!pJSObj) return;\
+	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, PropValue, sError);\
+		MEMLEAKCHECK_2(class_name,L"PutProperty");\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, "PutProperty");\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, "PutProperty");\
+		JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+	JS_Error(NULL,L"PutProperty", L"Embeded object not found!");\
+	return ;\
+}\
+	void js_class_name::delprop_##js_class_name##_static(JS_PROPDEL_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	v8::String::Utf8Value utf8_value(property);\
+	CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
+	CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->DelProperty(cc, (FX_LPCWSTR)propname, sError);\
+		MEMLEAKCHECK_2(class_name,L"DelProperty");\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, "DelProperty");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, "DelProperty");\
+		return ;\
+	}\
+	return ;\
+}\
+JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject  obj,JSFXObject  global)\
+{\
+	CJS_Object* pObj = FX_NEW js_class_name(obj);\
+	pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
+	JS_SetPrivate(NULL,obj, (void*)pObj); \
+	pObj->InitInstance(cc);\
+	return JS_TRUE;\
+}\
+\
+JSBool js_class_name::JSDestructor(JSFXObject obj) \
+{\
+	js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
+	ASSERT(pObj != NULL);\
+	pObj->ExitInstance();\
+	delete pObj;\
+	return JS_TRUE;\
+}\
+\
+int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
+{\
+\
+	int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
+\
+	if (nObjDefnID >= 0)\
+	{\
+		for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
+		{\
+			if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet,JS_Class_Properties[j].pPropPut)<0)return -1;\
+		}\
+\
+		for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
+		{\
+			if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName,JS_Class_Methods[k].pMethodCall,JS_Class_Methods[k].nParamNum)<0)return -1;\
+		}\
+		if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_name::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_##js_class_name##_static)<0) return -1;\
+\
+		return nObjDefnID;\
+	}\
+\
+	return -1;\
+}\
+void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
+{\
+	pConsts = JS_Class_Consts;\
+	nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
+}\
+void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
+{\
+	pProperties = JS_Class_Properties;\
+	nSize = sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1;\
+}\
+void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
+{\
+	pMethods = JS_Class_Methods;\
+	nSize = sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1;\
+}
+
+#define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name)\
+	static void method_name##_static(JS_METHOD_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	CJS_Parameters parameters;\
+	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
+	{\
+	parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
+	}\
+	CJS_Value valueRes(isolate);\
+	CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate, info.Holder());\
+	ASSERT(pJSObj != NULL);\
+	class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
+	ASSERT(pObj != NULL);\
+	JS_ErrorString sError;\
+	FX_BOOL bRet = FALSE;\
+	try\
+	{\
+		MEMLEAKCHECK_1();\
+		bRet = pObj->method_name(cc, parameters, valueRes, sError);\
+		MEMLEAKCHECK_2(class_name, method_name);\
+	}\
+	catch (...)\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #method_name);\
+		JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
+		return ;\
+	}\
+	if (bRet)\
+	{\
+		info.GetReturnValue().Set(valueRes.ToJSValue());\
+		return ;\
+	}\
+	else\
+	{\
+		CFX_ByteString cbName;\
+		cbName.Format("%s.%s", #class_name, #method_name);\
+		JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\
+		return ;\
+	}\
+	JS_Error(NULL,  JS_WIDESTRING(method_name), L"Embeded object not found!");\
+    return ;\
+}
+
+/* ======================================== GLOBAL METHODS ============================================ */
+#define JS_STATIC_GLOBAL_FUN(fun_name) \
+static void fun_name##_static(JS_METHOD_ARGS)\
+{\
+	v8::Isolate* isolate = info.GetIsolate();\
+	v8::Local<v8::Context> context = isolate->GetCurrentContext();\
+	v8::Local<v8::Value> v = context->GetEmbedderData(1);\
+	ASSERT(!v.IsEmpty());\
+	if(v.IsEmpty()) return;\
+	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\
+	IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
+	IFXJS_Context* cc = pRuntime->GetCurrentContext();\
+	CJS_Parameters parameters;\
+	for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
+	{\
+	parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
+	}\
+	CJS_Value valueRes(isolate);\
+	JS_ErrorString sError;\
+	if (!fun_name(cc, parameters, valueRes, sError))\
+	{\
+		JS_Error(NULL, JS_WIDESTRING(fun_name), sError);\
+		return ;\
+	}\
+	info.GetReturnValue().Set(valueRes.ToJSValue());\
+	return ;\
+}
+
+#define JS_STATIC_DECLARE_GLOBAL_FUN() \
+static JSMethodSpec	global_methods[]; \
+static int Init(IJS_Runtime* pRuntime)
+
+#define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \
+JSMethodSpec js_class_name::global_methods[] = {
+
+#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name,nargs) JS_STATIC_METHOD_ENTRY(method_name,nargs)
+
+#define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()
+
+#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
+int js_class_name::Init(IJS_Runtime* pRuntime)\
+{\
+	for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i<sz; i++)\
+	{\
+		if (JS_DefineGlobalMethod(pRuntime,\
+				js_class_name::global_methods[i].pName,\
+				js_class_name::global_methods[i].pMethodCall,\
+				js_class_name::global_methods[i].nParamNum\
+				) < 0\
+			)return -1;\
+	}\
+	return 0;\
+}
+
+/* ======================================== GLOBAL CONSTS ============================================ */
+#define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\
+if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntime,JS_WIDESTRING(const_value)))) return -1
+
+/* ======================================== GLOBAL ARRAYS ============================================ */
+
+#define DEFINE_GLOBAL_ARRAY(pRuntime)\
+int size = sizeof(ArrayContent) / sizeof(FX_LPCWSTR);\
+\
+CJS_Array array(pRuntime);\
+for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,(FX_LPCWSTR)ArrayContent[i]));\
+\
+CJS_PropValue prop(pRuntime);\
+prop << array;\
+if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue()) < 0)\
+	return -1
+
+/* ============================================================ */
+
+#define VALUE_NAME_STRING		L"string"
+#define VALUE_NAME_NUMBER		L"number"
+#define VALUE_NAME_BOOLEAN		L"boolean"
+#define VALUE_NAME_DATE			L"date"
+#define VALUE_NAME_OBJECT		L"object"
+#define VALUE_NAME_FXOBJ		L"fxobj"
+#define VALUE_NAME_NULL			L"null"
+#define VALUE_NAME_UNDEFINED	L"undefined"
+
+#define CLASSNAME_ARRAY			L"Array"
+#define CLASSNAME_DATE			L"Date"
+#define CLASSNAME_STRING		L"v8::String"
+
+const unsigned int JSCONST_nStringHash = JS_CalcHash(VALUE_NAME_STRING,wcslen(VALUE_NAME_STRING));
+const unsigned int JSCONST_nNumberHash = JS_CalcHash(VALUE_NAME_NUMBER,wcslen(VALUE_NAME_NUMBER));
+const unsigned int JSCONST_nBoolHash = JS_CalcHash(VALUE_NAME_BOOLEAN,wcslen(VALUE_NAME_BOOLEAN));
+const unsigned int JSCONST_nDateHash = JS_CalcHash(VALUE_NAME_DATE,wcslen(VALUE_NAME_DATE));
+const unsigned int JSCONST_nObjectHash = JS_CalcHash(VALUE_NAME_OBJECT,wcslen(VALUE_NAME_OBJECT));
+const unsigned int JSCONST_nFXobjHash = JS_CalcHash(VALUE_NAME_FXOBJ,wcslen(VALUE_NAME_FXOBJ));
+const unsigned int JSCONST_nNullHash = JS_CalcHash(VALUE_NAME_NULL,wcslen(VALUE_NAME_NULL));
+const unsigned int JSCONST_nUndefHash = JS_CalcHash(VALUE_NAME_UNDEFINED,wcslen(VALUE_NAME_UNDEFINED));
+
+static FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p)
+{
+
+		const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));
+
+		if (nHash == JSCONST_nUndefHash)
+			return VT_undefined;
+		else if (nHash == JSCONST_nNullHash)
+			return VT_null;
+		else if (nHash == JSCONST_nStringHash)
+			return VT_string;
+		else if (nHash == JSCONST_nNumberHash)
+			return VT_number;
+		else if (nHash == JSCONST_nBoolHash)
+			return VT_boolean;
+		else if (nHash == JSCONST_nDateHash)
+			return VT_date;
+		else if (nHash == JSCONST_nObjectHash)
+			return VT_object;		
+		else if (nHash == JSCONST_nFXobjHash)
+			return VT_fxobject;
+
+		/*
+		const char * sType = p->getTypeof()->toDchars();
+		if (strcmp(sType,VALUE_NAME_STRING) == 0)
+			return VT_string;
+		else if (strcmp(sType,VALUE_NAME_NUMBER) == 0)
+			return VT_number;
+		else if (strcmp(sType,VALUE_NAME_BOOLEAN) == 0)
+			return VT_boolean;
+		else if (strcmp(sType,VALUE_NAME_DATE) == 0)
+			return VT_date;
+		else if (strcmp(sType,VALUE_NAME_OBJECT) == 0)
+			return VT_object;
+		else if (strcmp(sType,VALUE_NAME_FXOBJ) == 0)
+			return VT_object;
+		else if (strcmp(sType,VALUE_NAME_NULL) == 0)
+			return VT_null;
+		else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0)
+			return VT_undefined;
+			*/
+
+	return VT_unknown;
+}
+
+#endif //_JS_DEFINE_H_
diff --git a/fpdfsdk/include/javascript/JS_EventHandler.h b/fpdfsdk/include/javascript/JS_EventHandler.h
index d88c50c..d16933a 100644
--- a/fpdfsdk/include/javascript/JS_EventHandler.h
+++ b/fpdfsdk/include/javascript/JS_EventHandler.h
@@ -1,167 +1,167 @@
-// 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 _JS_EVENTHANDLER_H_

-#define _JS_EVENTHANDLER_H_

-

-class CJS_Context;

-class Field;

-

-enum JS_EVENT_T

-{

-	JET_UNKNOWN,

-	JET_APP_INIT,

-	JET_DOC_OPEN,

-	JET_DOC_WILLPRINT,

-	JET_DOC_DIDPRINT,

-	JET_DOC_WILLSAVE,

-	JET_DOC_DIDSAVE,

-	JET_DOC_WILLCLOSE,

-	JET_PAGE_OPEN,

-	JET_PAGE_CLOSE,

-	JET_PAGE_INVIEW,

-	JET_PAGE_OUTVIEW,

-	JET_FIELD_MOUSEDOWN,

-	JET_FIELD_MOUSEUP,

-	JET_FIELD_MOUSEENTER,

-	JET_FIELD_MOUSEEXIT,

-	JET_FIELD_FOCUS,

-	JET_FIELD_BLUR,

-	JET_FIELD_KEYSTROKE,

-	JET_FIELD_VALIDATE,

-	JET_FIELD_CALCULATE,

-	JET_FIELD_FORMAT,

-	JET_SCREEN_FOCUS,

-	JET_SCREEN_BLUR,

-	JET_SCREEN_OPEN,

-	JET_SCREEN_CLOSE,

-	JET_SCREEN_MOUSEDOWN,

-	JET_SCREEN_MOUSEUP,

-	JET_SCREEN_MOUSEENTER,

-	JET_SCREEN_MOUSEEXIT,

-	JET_SCREEN_INVIEW,

-	JET_SCREEN_OUTVIEW,

-	JET_BATCH_EXEC,

-	JET_MENU_EXEC,

-	JET_CONSOLE_EXEC,

-	JET_EXTERNAL_EXEC,

-	JET_BOOKMARK_MOUSEUP,

-	JET_LINK_MOUSEUP

-};

-

-class CJS_EventHandler

-{

-public:

-	CJS_EventHandler(CJS_Context * pContext);

-	virtual ~CJS_EventHandler();

-

-	void					OnApp_Init();

-

-	void					OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);

-	void					OnDoc_WillPrint(CPDFSDK_Document* pDoc);

-	void					OnDoc_DidPrint(CPDFSDK_Document* pDoc);

-	void					OnDoc_WillSave(CPDFSDK_Document* pDoc);

-	void					OnDoc_DidSave(CPDFSDK_Document* pDoc);

-	void					OnDoc_WillClose(CPDFSDK_Document* pDoc);

-

-	void					OnPage_Open(CPDFSDK_Document* pDoc);

-	void					OnPage_Close(CPDFSDK_Document* pDoc);

-	void					OnPage_InView(CPDFSDK_Document* pTarget);

-	void					OnPage_OutView(CPDFSDK_Document* pTarget);

-	

-	void					OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);

-	void					OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);

-	void					OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,

-								FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,

-								CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 

-								FX_BOOL bFieldFull, FX_BOOL &bRc);

-	void					OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,

-								FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);

-

-	void					OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	void					OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	void					OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	void					OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);

-	void					OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);

-	void					OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);

-

-	void					OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-	void					OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);

-

-	void					OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);

-	void					OnLink_MouseUp(CPDFSDK_Document* pTarget);

-

-	void					OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);

-	void					OnBatchExec(CPDFSDK_Document *pTarget);

-	void					OnConsole_Exec();

-	void					OnExternal_Exec();

-

-public:

-    void					Initial(JS_EVENT_T type);

-	void					Destroy();

-	FX_BOOL					IsValid();

-

-	

-	CFX_WideString&			Change();

-	CFX_WideString			ChangeEx();

-	int						CommitKey();

-	FX_BOOL					FieldFull();

-	FX_BOOL					KeyDown();

-	FX_BOOL					Modifier();

-	FX_LPCWSTR				Name();

-	FX_LPCWSTR				Type();

-	FX_BOOL&				Rc();

-	int&					SelEnd();

-	int&					SelStart();

-	FX_BOOL					Shift();

-	Field*					Source();

-	Field*					Target_Field();

-	CFX_WideString&			Value();

-	FX_BOOL					WillCommit();

-	CFX_WideString			TargetName();

-

-	JS_EVENT_T				EventType() {return m_eEventType;};	

-

-public:

-	CJS_Context*			m_pJSContext;

-	JS_EVENT_T				m_eEventType;

-	FX_BOOL					m_bValid;

-

-	CFX_WideString			m_strTargetName;

-	CFX_WideString			m_strSourceName;

-	CFX_WideString*			m_pWideStrChange;

-	CFX_WideString			m_WideStrChangeDu;

-	CFX_WideString			m_WideStrChangeEx;

-	int						m_nCommitKey;

-	FX_BOOL					m_bKeyDown;

-	FX_BOOL					m_bModifier;

-	FX_BOOL					m_bShift;

-	int*					m_pISelEnd;

-	int						m_nSelEndDu;

-	int*					m_pISelStart;

-	int						m_nSelStartDu;

-	FX_BOOL					m_bWillCommit;

-	CFX_WideString*			m_pValue;

-	FX_BOOL					m_bFieldFull;

-	FX_BOOL*				m_pbRc;

-	FX_BOOL					m_bRcDu;

-

-	CPDFSDK_Document*		m_pSourceDoc;

-	CPDF_Bookmark*			m_pTargetBookMark;

-	CPDFSDK_Document*		m_pTargetDoc;

-	CPDFSDK_Annot*			m_pTargetAnnot;

-};

-

-#endif //_JS_EVENTHANDLER_H_

-

+// 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 _JS_EVENTHANDLER_H_
+#define _JS_EVENTHANDLER_H_
+
+class CJS_Context;
+class Field;
+
+enum JS_EVENT_T
+{
+	JET_UNKNOWN,
+	JET_APP_INIT,
+	JET_DOC_OPEN,
+	JET_DOC_WILLPRINT,
+	JET_DOC_DIDPRINT,
+	JET_DOC_WILLSAVE,
+	JET_DOC_DIDSAVE,
+	JET_DOC_WILLCLOSE,
+	JET_PAGE_OPEN,
+	JET_PAGE_CLOSE,
+	JET_PAGE_INVIEW,
+	JET_PAGE_OUTVIEW,
+	JET_FIELD_MOUSEDOWN,
+	JET_FIELD_MOUSEUP,
+	JET_FIELD_MOUSEENTER,
+	JET_FIELD_MOUSEEXIT,
+	JET_FIELD_FOCUS,
+	JET_FIELD_BLUR,
+	JET_FIELD_KEYSTROKE,
+	JET_FIELD_VALIDATE,
+	JET_FIELD_CALCULATE,
+	JET_FIELD_FORMAT,
+	JET_SCREEN_FOCUS,
+	JET_SCREEN_BLUR,
+	JET_SCREEN_OPEN,
+	JET_SCREEN_CLOSE,
+	JET_SCREEN_MOUSEDOWN,
+	JET_SCREEN_MOUSEUP,
+	JET_SCREEN_MOUSEENTER,
+	JET_SCREEN_MOUSEEXIT,
+	JET_SCREEN_INVIEW,
+	JET_SCREEN_OUTVIEW,
+	JET_BATCH_EXEC,
+	JET_MENU_EXEC,
+	JET_CONSOLE_EXEC,
+	JET_EXTERNAL_EXEC,
+	JET_BOOKMARK_MOUSEUP,
+	JET_LINK_MOUSEUP
+};
+
+class CJS_EventHandler
+{
+public:
+	CJS_EventHandler(CJS_Context * pContext);
+	virtual ~CJS_EventHandler();
+
+	void					OnApp_Init();
+
+	void					OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
+	void					OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+	void					OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+	void					OnDoc_WillSave(CPDFSDK_Document* pDoc);
+	void					OnDoc_DidSave(CPDFSDK_Document* pDoc);
+	void					OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+	void					OnPage_Open(CPDFSDK_Document* pDoc);
+	void					OnPage_Close(CPDFSDK_Document* pDoc);
+	void					OnPage_InView(CPDFSDK_Document* pTarget);
+	void					OnPage_OutView(CPDFSDK_Document* pTarget);
+	
+	void					OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
+	void					OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
+	void					OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
+								FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
+								CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit, 
+								FX_BOOL bFieldFull, FX_BOOL &bRc);
+	void					OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
+								FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
+
+	void					OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	void					OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	void					OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	void					OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
+	void					OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
+	void					OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
+
+	void					OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+	void					OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+
+	void					OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+	void					OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+	void					OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
+	void					OnBatchExec(CPDFSDK_Document *pTarget);
+	void					OnConsole_Exec();
+	void					OnExternal_Exec();
+
+public:
+    void					Initial(JS_EVENT_T type);
+	void					Destroy();
+	FX_BOOL					IsValid();
+
+	
+	CFX_WideString&			Change();
+	CFX_WideString			ChangeEx();
+	int						CommitKey();
+	FX_BOOL					FieldFull();
+	FX_BOOL					KeyDown();
+	FX_BOOL					Modifier();
+	FX_LPCWSTR				Name();
+	FX_LPCWSTR				Type();
+	FX_BOOL&				Rc();
+	int&					SelEnd();
+	int&					SelStart();
+	FX_BOOL					Shift();
+	Field*					Source();
+	Field*					Target_Field();
+	CFX_WideString&			Value();
+	FX_BOOL					WillCommit();
+	CFX_WideString			TargetName();
+
+	JS_EVENT_T				EventType() {return m_eEventType;};	
+
+public:
+	CJS_Context*			m_pJSContext;
+	JS_EVENT_T				m_eEventType;
+	FX_BOOL					m_bValid;
+
+	CFX_WideString			m_strTargetName;
+	CFX_WideString			m_strSourceName;
+	CFX_WideString*			m_pWideStrChange;
+	CFX_WideString			m_WideStrChangeDu;
+	CFX_WideString			m_WideStrChangeEx;
+	int						m_nCommitKey;
+	FX_BOOL					m_bKeyDown;
+	FX_BOOL					m_bModifier;
+	FX_BOOL					m_bShift;
+	int*					m_pISelEnd;
+	int						m_nSelEndDu;
+	int*					m_pISelStart;
+	int						m_nSelStartDu;
+	FX_BOOL					m_bWillCommit;
+	CFX_WideString*			m_pValue;
+	FX_BOOL					m_bFieldFull;
+	FX_BOOL*				m_pbRc;
+	FX_BOOL					m_bRcDu;
+
+	CPDFSDK_Document*		m_pSourceDoc;
+	CPDF_Bookmark*			m_pTargetBookMark;
+	CPDFSDK_Document*		m_pTargetDoc;
+	CPDFSDK_Annot*			m_pTargetAnnot;
+};
+
+#endif //_JS_EVENTHANDLER_H_
+
diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h
index 97a5402..1001ff6 100644
--- a/fpdfsdk/include/javascript/JS_GlobalData.h
+++ b/fpdfsdk/include/javascript/JS_GlobalData.h
@@ -1,97 +1,97 @@
-// 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 _JS_GLOBALDATA_H_

-#define _JS_GLOBALDATA_H_

-

-#define JS_GLOBALDATA_TYPE_NUMBER		0

-#define JS_GLOBALDATA_TYPE_BOOLEAN		1

-#define JS_GLOBALDATA_TYPE_STRING		2

-#define JS_GLOBALDATA_TYPE_OBJECT		3

-#define JS_GLOBALDATA_TYPE_NULL			4

-

-class CJS_KeyValue;

-class CJS_GlobalVariableArray;

-class CJS_GlobalData_Element;

-

-class CJS_GlobalVariableArray

-{

-public:

-	CJS_GlobalVariableArray();

-	virtual ~CJS_GlobalVariableArray();

-

-	void			Add(CJS_KeyValue* p);

-	int				Count() const;

-	CJS_KeyValue*	GetAt(int index) const;

-	void			Copy(const CJS_GlobalVariableArray& array);

-

-	void			Empty();

-

-private:

-	CFX_ArrayTemplate<CJS_KeyValue*> array;

-};

-

-class CJS_KeyValue

-{

-public:

-	CJS_KeyValue(){}

-	virtual ~CJS_KeyValue(){}

-

-	CFX_ByteString					sKey;

-	int								nType; //0:int 1:bool 2:string 3:obj

-	double							dData;

-	bool							bData;

-	CFX_ByteString					sData;

-	CJS_GlobalVariableArray			objData;

-};

-

-class CJS_GlobalData_Element

-{

-public:

-	CJS_GlobalData_Element(){}

-	virtual ~CJS_GlobalData_Element(){}

-

-	CJS_KeyValue			data;

-	FX_BOOL					bPersistent;

-};

-

-class CJS_GlobalData

-{

-public:

-	CJS_GlobalData(CPDFDoc_Environment* pApp);

-	virtual ~CJS_GlobalData();

-

-public:

-	void								SetGlobalVariableNumber(FX_LPCSTR propname, double dData);

-	void								SetGlobalVariableBoolean(FX_LPCSTR propname, bool bData);

-	void								SetGlobalVariableString(FX_LPCSTR propname, const CFX_ByteString& sData);

-	void								SetGlobalVariableObject(FX_LPCSTR propname, const CJS_GlobalVariableArray& array);

-	void								SetGlobalVariableNull(FX_LPCSTR propname);

-

-	FX_BOOL								SetGlobalVariablePersistent(FX_LPCSTR propname, FX_BOOL bPersistent);

-	FX_BOOL								DeleteGlobalVariable(FX_LPCSTR propname);

-	

-	FX_INT32							GetSize() const;

-	CJS_GlobalData_Element*				GetAt(int index) const;

-

-private:

-	void								LoadGlobalPersistentVariables();

-	void								SaveGlobalPersisitentVariables();

-	

-	CJS_GlobalData_Element*				GetGlobalVariable(FX_LPCSTR propname);	

-	int									FindGlobalVariable(FX_LPCSTR propname);

-

-	void								LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength);

-	void								WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength);

-	void								MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData);

-

-private:

-	CFX_ArrayTemplate<CJS_GlobalData_Element*>	m_arrayGlobalData;

-	CFX_WideString								m_sFilePath;

-	CPDFDoc_Environment*								m_pApp;

-};

-

-#endif //_JS_GLOBALDATA_H_

+// 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 _JS_GLOBALDATA_H_
+#define _JS_GLOBALDATA_H_
+
+#define JS_GLOBALDATA_TYPE_NUMBER		0
+#define JS_GLOBALDATA_TYPE_BOOLEAN		1
+#define JS_GLOBALDATA_TYPE_STRING		2
+#define JS_GLOBALDATA_TYPE_OBJECT		3
+#define JS_GLOBALDATA_TYPE_NULL			4
+
+class CJS_KeyValue;
+class CJS_GlobalVariableArray;
+class CJS_GlobalData_Element;
+
+class CJS_GlobalVariableArray
+{
+public:
+	CJS_GlobalVariableArray();
+	virtual ~CJS_GlobalVariableArray();
+
+	void			Add(CJS_KeyValue* p);
+	int				Count() const;
+	CJS_KeyValue*	GetAt(int index) const;
+	void			Copy(const CJS_GlobalVariableArray& array);
+
+	void			Empty();
+
+private:
+	CFX_ArrayTemplate<CJS_KeyValue*> array;
+};
+
+class CJS_KeyValue
+{
+public:
+	CJS_KeyValue(){}
+	virtual ~CJS_KeyValue(){}
+
+	CFX_ByteString					sKey;
+	int								nType; //0:int 1:bool 2:string 3:obj
+	double							dData;
+	bool							bData;
+	CFX_ByteString					sData;
+	CJS_GlobalVariableArray			objData;
+};
+
+class CJS_GlobalData_Element
+{
+public:
+	CJS_GlobalData_Element(){}
+	virtual ~CJS_GlobalData_Element(){}
+
+	CJS_KeyValue			data;
+	FX_BOOL					bPersistent;
+};
+
+class CJS_GlobalData
+{
+public:
+	CJS_GlobalData(CPDFDoc_Environment* pApp);
+	virtual ~CJS_GlobalData();
+
+public:
+	void								SetGlobalVariableNumber(FX_LPCSTR propname, double dData);
+	void								SetGlobalVariableBoolean(FX_LPCSTR propname, bool bData);
+	void								SetGlobalVariableString(FX_LPCSTR propname, const CFX_ByteString& sData);
+	void								SetGlobalVariableObject(FX_LPCSTR propname, const CJS_GlobalVariableArray& array);
+	void								SetGlobalVariableNull(FX_LPCSTR propname);
+
+	FX_BOOL								SetGlobalVariablePersistent(FX_LPCSTR propname, FX_BOOL bPersistent);
+	FX_BOOL								DeleteGlobalVariable(FX_LPCSTR propname);
+	
+	FX_INT32							GetSize() const;
+	CJS_GlobalData_Element*				GetAt(int index) const;
+
+private:
+	void								LoadGlobalPersistentVariables();
+	void								SaveGlobalPersisitentVariables();
+	
+	CJS_GlobalData_Element*				GetGlobalVariable(FX_LPCSTR propname);	
+	int									FindGlobalVariable(FX_LPCSTR propname);
+
+	void								LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength);
+	void								WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength);
+	void								MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData);
+
+private:
+	CFX_ArrayTemplate<CJS_GlobalData_Element*>	m_arrayGlobalData;
+	CFX_WideString								m_sFilePath;
+	CPDFDoc_Environment*								m_pApp;
+};
+
+#endif //_JS_GLOBALDATA_H_
diff --git a/fpdfsdk/include/javascript/JS_Module.h b/fpdfsdk/include/javascript/JS_Module.h
index d725f6b..1fcb583 100644
--- a/fpdfsdk/include/javascript/JS_Module.h
+++ b/fpdfsdk/include/javascript/JS_Module.h
@@ -1,47 +1,47 @@
-// 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 _JS_MODULE_H_

-#define _JS_MODULE_H_

-

-class CJS_GlobalData;

-class CJS_ConsoleDlg;

-

-class CJS_Module : public IReader_Module

-{

-public:

-	CJS_Module(HMODULE hModule, CReader_App* pApp);

-	virtual ~CJS_Module();

-

-	virtual void					Destroy(){delete this;}

-	virtual CFX_ByteString			GetModuleName();

-

-public:

-	static CJS_Module*				GetModule(CReader_App* pApp);

-

-	IFXJS_Runtime*					NewJSRuntime();

-	CJS_GlobalData*					NewGlobalData();

-	void							ReleaseGlobalData();

-

-public:

-	//console

-	void							ShowConsole();

-	void							HideConsole();

-	void							ClearConsole();

-	void							PrintLineConsole(FX_LPCWSTR string);

-

-private:

-	HMODULE							m_hModule;

-	CReader_App*					m_pApp;

-

-	FX_BOOL							m_bInitial;

-	CJS_GlobalData*					m_pGlobalData;

-	FX_INT32						m_nGlobalDataCount;

-

-	CJS_ConsoleDlg*					m_pConsole;

-};

-

+// 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 _JS_MODULE_H_
+#define _JS_MODULE_H_
+
+class CJS_GlobalData;
+class CJS_ConsoleDlg;
+
+class CJS_Module : public IReader_Module
+{
+public:
+	CJS_Module(HMODULE hModule, CReader_App* pApp);
+	virtual ~CJS_Module();
+
+	virtual void					Destroy(){delete this;}
+	virtual CFX_ByteString			GetModuleName();
+
+public:
+	static CJS_Module*				GetModule(CReader_App* pApp);
+
+	IFXJS_Runtime*					NewJSRuntime();
+	CJS_GlobalData*					NewGlobalData();
+	void							ReleaseGlobalData();
+
+public:
+	//console
+	void							ShowConsole();
+	void							HideConsole();
+	void							ClearConsole();
+	void							PrintLineConsole(FX_LPCWSTR string);
+
+private:
+	HMODULE							m_hModule;
+	CReader_App*					m_pApp;
+
+	FX_BOOL							m_bInitial;
+	CJS_GlobalData*					m_pGlobalData;
+	FX_INT32						m_nGlobalDataCount;
+
+	CJS_ConsoleDlg*					m_pConsole;
+};
+
 #endif //_JS_MODULE_H_
\ No newline at end of file
diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h
index 8b91f8c..f22da76 100644
--- a/fpdfsdk/include/javascript/JS_Object.h
+++ b/fpdfsdk/include/javascript/JS_Object.h
@@ -1,288 +1,288 @@
-// 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 _JS_OBJECT_H_

-#define _JS_OBJECT_H_

-

-class CJS_Object;

-class CJS_Timer;

-class CJS_Context;

-

-class CJS_EmbedObj : public CFX_Object

-{

-public:

-	CJS_EmbedObj(CJS_Object* pJSObject);

-	virtual ~CJS_EmbedObj();

-

-	virtual void				TimerProc(CJS_Timer* pTimer){};

-

-	CJS_Timer*					BeginTimer(CPDFDoc_Environment * pApp, FX_UINT nElapse);

-	void						EndTimer(CJS_Timer* pTimer);

-

-	CJS_Object*					GetJSObject(){return m_pJSObject;};

-	operator					CJS_Object* (){return m_pJSObject;};

-

-	CPDFSDK_PageView *			JSGetPageView(IFXJS_Context* cc);

-	int							MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0);

-	void						Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);

-	FX_BOOL						IsSafeMode(IFXJS_Context* cc);

-

-protected:

-

-	CJS_Object*					m_pJSObject;

-};

-

-class CJS_Object : public CFX_Object

-{

-public:

-	CJS_Object(JSFXObject pObject);

-	virtual ~CJS_Object(void);

-	

-	void						MakeWeak();

-

-	virtual FX_BOOL				IsType(FX_LPCSTR sClassName){return TRUE;};

-	virtual CFX_ByteString		GetClassName(){return "";};

-

-	virtual FX_BOOL				InitInstance(IFXJS_Context* cc){return TRUE;};

-	virtual FX_BOOL				ExitInstance(){return TRUE;};

-

-	operator					JSFXObject () {return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);}

-	operator					CJS_EmbedObj* (){return m_pEmbedObj;};

-

-	void						SetEmbedObject(CJS_EmbedObj* pObj){m_pEmbedObj = pObj;};

-	CJS_EmbedObj *				GetEmbedObject(){return m_pEmbedObj;};

-

-	static CPDFSDK_PageView *	JSGetPageView(IFXJS_Context* cc);

-	static int					MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0);

-	static void					Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);

-

-	v8::Isolate*					GetIsolate() {return m_pIsolate;}

-protected:

-	CJS_EmbedObj *				m_pEmbedObj;

-	v8::Persistent<v8::Object>			m_pObject;

-	v8::Isolate*					m_pIsolate;

-};

-

-struct JS_TIMER_MAP

-{

-	FX_UINT nID;

-	CJS_Timer * pTimer;

-};

-

-typedef CFX_ArrayTemplate<JS_TIMER_MAP*>	CTimerMapArray;

-

-struct JS_TIMER_MAPARRAY

-{

-public:

-	JS_TIMER_MAPARRAY()

-	{

-	}

-

-	~JS_TIMER_MAPARRAY()

-	{

-		Reset();

-	}

-

-	void Reset()

-	{

-		for (int i=0,sz=m_Array.GetSize(); i<sz; i++)

-			delete m_Array.GetAt(i);

-

-		m_Array.RemoveAll();

-	}

-

-	void SetAt(FX_UINT nIndex,CJS_Timer * pTimer)

-	{

-		int i = Find(nIndex);

-

-		if (i>=0)

-		{

-			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))

-				pMap->pTimer = pTimer;

-		}

-		else

-		{

-			if (JS_TIMER_MAP * pMap = new JS_TIMER_MAP)

-			{

-				pMap->nID = nIndex;

-				pMap->pTimer = pTimer;

-				m_Array.Add(pMap);

-			}

-		}

-	}

-

-	CJS_Timer * GetAt(FX_UINT nIndex)

-	{

-		int i = Find(nIndex);

-

-		if (i>=0)

-		{

-			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))

-				return pMap->pTimer;

-		}

-		return NULL;

-	}

-

-	void RemoveAt(FX_UINT nIndex)

-	{

-		int i = Find(nIndex);

-

-		if (i>=0)

-		{

-			delete m_Array.GetAt(i);

-			m_Array.RemoveAt(i);

-		}

-		//To prevent potential fake memory leak reported by vc6.

-		if(m_Array.GetSize() == 0)

-			m_Array.RemoveAll();

-	}

-

-	int Find(FX_UINT nIndex)

-	{		

-		for (int i=0,sz=m_Array.GetSize(); i<sz; i++)

-		{			

-			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))

-			{

-				if (pMap->nID == nIndex)

-					return i;

-			}

-		}

-

-		return -1;

-	}

-

-	CTimerMapArray		m_Array;

-};

-

-static JS_TIMER_MAPARRAY	m_sTimeMap;

-

-class CJS_Runtime;

-

-class CJS_Timer

-{

-public:

-	CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): m_pEmbedObj(pObj), 

-		m_nTimerID(0), 

-		m_bProcessing(FALSE),

-		m_dwStartTime(0),

-		m_dwTimeOut(0),

-		m_dwElapse(0),

-		m_pRuntime(NULL),

-		m_nType(0),

-		m_pApp(pApp)

-	{

-	}

-	

-	virtual ~CJS_Timer()

-	{

-		KillJSTimer();

-	}

-

-public:

-	FX_UINT SetJSTimer(FX_UINT nElapse)

-	{	

-		if (m_nTimerID)KillJSTimer();

-		IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();

-		m_nTimerID = pHandler->SetTimer(nElapse,TimerProc);

-		m_sTimeMap.SetAt(m_nTimerID,this);

-		m_dwElapse = nElapse;

-		return m_nTimerID;

-	};

-

-	void KillJSTimer()

-	{

-		if (m_nTimerID)

-		{

-			IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();

-			pHandler->KillTimer(m_nTimerID);

-			m_sTimeMap.RemoveAt(m_nTimerID);

-			m_nTimerID = 0;

-		}

-	};

-

-	void SetType(int nType)

-	{

-		m_nType = nType;

-	}

-

-	int GetType() const

-	{

-		return m_nType;

-	}

-

-	void SetStartTime(FX_DWORD dwStartTime)

-	{

-		m_dwStartTime = dwStartTime;

-	}

-

-	FX_DWORD GetStartTime() const

-	{

-		return m_dwStartTime;

-	}

-

-	void SetTimeOut(FX_DWORD dwTimeOut)

-	{

-		m_dwTimeOut = dwTimeOut;

-	}

-

-	FX_DWORD GetTimeOut() const

-	{

-		return m_dwTimeOut;

-	}

-

-	void SetRuntime(CJS_Runtime* pRuntime)

-	{

-		m_pRuntime = pRuntime;

-	}

-	

-	CJS_Runtime* GetRuntime() const

-	{

-		return m_pRuntime;

-	}

-

-	void SetJScript(const CFX_WideString& script)

-	{

-		m_swJScript = script;

-	}

-

-	CFX_WideString GetJScript() const

-	{

-		return m_swJScript;

-	}

-

-	static void TimerProc(int idEvent)

-	{

-		if (CJS_Timer * pTimer = m_sTimeMap.GetAt(idEvent))

-		{

-			if (!pTimer->m_bProcessing)

-			{

-				pTimer->m_bProcessing = TRUE;

-				if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->TimerProc(pTimer);

-				pTimer->m_bProcessing = FALSE;

-			}

-			else

-			{

-			//	TRACE(L"BUSY!\n");

-			}

-		}

-	};

-

-private:

-	FX_UINT							m_nTimerID;	

-	CJS_EmbedObj*					m_pEmbedObj;

-	FX_BOOL							m_bProcessing;

-

-	//data

-	FX_DWORD							m_dwStartTime;

-	FX_DWORD							m_dwTimeOut;

-	FX_DWORD						m_dwElapse;

-	CJS_Runtime*					m_pRuntime;

-	CFX_WideString					m_swJScript;

-	int								m_nType; //0:Interval; 1:TimeOut

-

-	CPDFDoc_Environment*			m_pApp;

-};

-#endif //_JS_OBJECT_H_

+// 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 _JS_OBJECT_H_
+#define _JS_OBJECT_H_
+
+class CJS_Object;
+class CJS_Timer;
+class CJS_Context;
+
+class CJS_EmbedObj : public CFX_Object
+{
+public:
+	CJS_EmbedObj(CJS_Object* pJSObject);
+	virtual ~CJS_EmbedObj();
+
+	virtual void				TimerProc(CJS_Timer* pTimer){};
+
+	CJS_Timer*					BeginTimer(CPDFDoc_Environment * pApp, FX_UINT nElapse);
+	void						EndTimer(CJS_Timer* pTimer);
+
+	CJS_Object*					GetJSObject(){return m_pJSObject;};
+	operator					CJS_Object* (){return m_pJSObject;};
+
+	CPDFSDK_PageView *			JSGetPageView(IFXJS_Context* cc);
+	int							MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0);
+	void						Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);
+	FX_BOOL						IsSafeMode(IFXJS_Context* cc);
+
+protected:
+
+	CJS_Object*					m_pJSObject;
+};
+
+class CJS_Object : public CFX_Object
+{
+public:
+	CJS_Object(JSFXObject pObject);
+	virtual ~CJS_Object(void);
+	
+	void						MakeWeak();
+
+	virtual FX_BOOL				IsType(FX_LPCSTR sClassName){return TRUE;};
+	virtual CFX_ByteString		GetClassName(){return "";};
+
+	virtual FX_BOOL				InitInstance(IFXJS_Context* cc){return TRUE;};
+	virtual FX_BOOL				ExitInstance(){return TRUE;};
+
+	operator					JSFXObject () {return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);}
+	operator					CJS_EmbedObj* (){return m_pEmbedObj;};
+
+	void						SetEmbedObject(CJS_EmbedObj* pObj){m_pEmbedObj = pObj;};
+	CJS_EmbedObj *				GetEmbedObject(){return m_pEmbedObj;};
+
+	static CPDFSDK_PageView *	JSGetPageView(IFXJS_Context* cc);
+	static int					MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0);
+	static void					Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);
+
+	v8::Isolate*					GetIsolate() {return m_pIsolate;}
+protected:
+	CJS_EmbedObj *				m_pEmbedObj;
+	v8::Persistent<v8::Object>			m_pObject;
+	v8::Isolate*					m_pIsolate;
+};
+
+struct JS_TIMER_MAP
+{
+	FX_UINT nID;
+	CJS_Timer * pTimer;
+};
+
+typedef CFX_ArrayTemplate<JS_TIMER_MAP*>	CTimerMapArray;
+
+struct JS_TIMER_MAPARRAY
+{
+public:
+	JS_TIMER_MAPARRAY()
+	{
+	}
+
+	~JS_TIMER_MAPARRAY()
+	{
+		Reset();
+	}
+
+	void Reset()
+	{
+		for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
+			delete m_Array.GetAt(i);
+
+		m_Array.RemoveAll();
+	}
+
+	void SetAt(FX_UINT nIndex,CJS_Timer * pTimer)
+	{
+		int i = Find(nIndex);
+
+		if (i>=0)
+		{
+			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
+				pMap->pTimer = pTimer;
+		}
+		else
+		{
+			if (JS_TIMER_MAP * pMap = new JS_TIMER_MAP)
+			{
+				pMap->nID = nIndex;
+				pMap->pTimer = pTimer;
+				m_Array.Add(pMap);
+			}
+		}
+	}
+
+	CJS_Timer * GetAt(FX_UINT nIndex)
+	{
+		int i = Find(nIndex);
+
+		if (i>=0)
+		{
+			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
+				return pMap->pTimer;
+		}
+		return NULL;
+	}
+
+	void RemoveAt(FX_UINT nIndex)
+	{
+		int i = Find(nIndex);
+
+		if (i>=0)
+		{
+			delete m_Array.GetAt(i);
+			m_Array.RemoveAt(i);
+		}
+		//To prevent potential fake memory leak reported by vc6.
+		if(m_Array.GetSize() == 0)
+			m_Array.RemoveAll();
+	}
+
+	int Find(FX_UINT nIndex)
+	{		
+		for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
+		{			
+			if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
+			{
+				if (pMap->nID == nIndex)
+					return i;
+			}
+		}
+
+		return -1;
+	}
+
+	CTimerMapArray		m_Array;
+};
+
+static JS_TIMER_MAPARRAY	m_sTimeMap;
+
+class CJS_Runtime;
+
+class CJS_Timer
+{
+public:
+	CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): m_pEmbedObj(pObj), 
+		m_nTimerID(0), 
+		m_bProcessing(FALSE),
+		m_dwStartTime(0),
+		m_dwTimeOut(0),
+		m_dwElapse(0),
+		m_pRuntime(NULL),
+		m_nType(0),
+		m_pApp(pApp)
+	{
+	}
+	
+	virtual ~CJS_Timer()
+	{
+		KillJSTimer();
+	}
+
+public:
+	FX_UINT SetJSTimer(FX_UINT nElapse)
+	{	
+		if (m_nTimerID)KillJSTimer();
+		IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+		m_nTimerID = pHandler->SetTimer(nElapse,TimerProc);
+		m_sTimeMap.SetAt(m_nTimerID,this);
+		m_dwElapse = nElapse;
+		return m_nTimerID;
+	};
+
+	void KillJSTimer()
+	{
+		if (m_nTimerID)
+		{
+			IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+			pHandler->KillTimer(m_nTimerID);
+			m_sTimeMap.RemoveAt(m_nTimerID);
+			m_nTimerID = 0;
+		}
+	};
+
+	void SetType(int nType)
+	{
+		m_nType = nType;
+	}
+
+	int GetType() const
+	{
+		return m_nType;
+	}
+
+	void SetStartTime(FX_DWORD dwStartTime)
+	{
+		m_dwStartTime = dwStartTime;
+	}
+
+	FX_DWORD GetStartTime() const
+	{
+		return m_dwStartTime;
+	}
+
+	void SetTimeOut(FX_DWORD dwTimeOut)
+	{
+		m_dwTimeOut = dwTimeOut;
+	}
+
+	FX_DWORD GetTimeOut() const
+	{
+		return m_dwTimeOut;
+	}
+
+	void SetRuntime(CJS_Runtime* pRuntime)
+	{
+		m_pRuntime = pRuntime;
+	}
+	
+	CJS_Runtime* GetRuntime() const
+	{
+		return m_pRuntime;
+	}
+
+	void SetJScript(const CFX_WideString& script)
+	{
+		m_swJScript = script;
+	}
+
+	CFX_WideString GetJScript() const
+	{
+		return m_swJScript;
+	}
+
+	static void TimerProc(int idEvent)
+	{
+		if (CJS_Timer * pTimer = m_sTimeMap.GetAt(idEvent))
+		{
+			if (!pTimer->m_bProcessing)
+			{
+				pTimer->m_bProcessing = TRUE;
+				if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->TimerProc(pTimer);
+				pTimer->m_bProcessing = FALSE;
+			}
+			else
+			{
+			//	TRACE(L"BUSY!\n");
+			}
+		}
+	};
+
+private:
+	FX_UINT							m_nTimerID;	
+	CJS_EmbedObj*					m_pEmbedObj;
+	FX_BOOL							m_bProcessing;
+
+	//data
+	FX_DWORD							m_dwStartTime;
+	FX_DWORD							m_dwTimeOut;
+	FX_DWORD						m_dwElapse;
+	CJS_Runtime*					m_pRuntime;
+	CFX_WideString					m_swJScript;
+	int								m_nType; //0:Interval; 1:TimeOut
+
+	CPDFDoc_Environment*			m_pApp;
+};
+#endif //_JS_OBJECT_H_
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 32f8457..0a195f1 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -1,70 +1,70 @@
-// 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 _JS_RUNTIME_H_

-#define _JS_RUNTIME_H_

-

-class CJS_FieldEvent

-{

-public:

-	CFX_WideString		sTargetName;

-	JS_EVENT_T			eEventType;

-	CJS_FieldEvent*		pNext;

-};

-

-class CJS_Runtime : public IFXJS_Runtime

-{

-public:

-	CJS_Runtime(CPDFDoc_Environment * pApp);

-	virtual ~CJS_Runtime();

-

-	virtual IFXJS_Context *					NewContext();

-	virtual void							ReleaseContext(IFXJS_Context * pContext);

-	virtual IFXJS_Context*					GetCurrentContext();

-

-	virtual void							SetReaderDocument(CPDFSDK_Document *pReaderDoc);

-	virtual CPDFSDK_Document *				GetReaderDocument(){return m_pDocument;}

-

-	virtual void							GetObjectNames(CFX_WideStringArray& array);

-	virtual void							GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array);

-	virtual void							GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array);

-	virtual void							GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array);

-

-	virtual void							Exit();

-	virtual void							Enter();

-	virtual FX_BOOL							IsEntered();

-

-	CPDFDoc_Environment *							GetReaderApp(){return m_pApp;}

-

-	FX_BOOL									InitJSObjects();

-

-	FX_BOOL									AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);

-	void									RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);

-	void									RemoveEventsInLoop(CJS_FieldEvent* pStart);

-

-	void									BeginBlock(){m_bBlocking = TRUE;}

-	void									EndBlock(){m_bBlocking = FALSE;}

-	FX_BOOL									IsBlocking(){return m_bBlocking;}

-

-	operator								IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}

-	v8::Isolate*								GetIsolate(){return m_isolate;};

-	void									SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}

-

-	v8::Handle<v8::Context>							NewJSContext();

-protected:

-	CFX_ArrayTemplate<CJS_Context *>		m_ContextArray;

-	CPDFDoc_Environment *							m_pApp;

-	CPDFSDK_Document *						m_pDocument;

-	FX_BOOL									m_bBlocking;

-	CJS_FieldEvent*							m_pFieldEventPath;

-

-	v8::Isolate*								m_isolate;

-	v8::Persistent<v8::Context>						m_context;

-	FX_BOOL									m_bRegistered;

-};

-

-#endif //_JS_RUNTIME_H_

-

+// 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 _JS_RUNTIME_H_
+#define _JS_RUNTIME_H_
+
+class CJS_FieldEvent
+{
+public:
+	CFX_WideString		sTargetName;
+	JS_EVENT_T			eEventType;
+	CJS_FieldEvent*		pNext;
+};
+
+class CJS_Runtime : public IFXJS_Runtime
+{
+public:
+	CJS_Runtime(CPDFDoc_Environment * pApp);
+	virtual ~CJS_Runtime();
+
+	virtual IFXJS_Context *					NewContext();
+	virtual void							ReleaseContext(IFXJS_Context * pContext);
+	virtual IFXJS_Context*					GetCurrentContext();
+
+	virtual void							SetReaderDocument(CPDFSDK_Document *pReaderDoc);
+	virtual CPDFSDK_Document *				GetReaderDocument(){return m_pDocument;}
+
+	virtual void							GetObjectNames(CFX_WideStringArray& array);
+	virtual void							GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array);
+	virtual void							GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array);
+	virtual void							GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array);
+
+	virtual void							Exit();
+	virtual void							Enter();
+	virtual FX_BOOL							IsEntered();
+
+	CPDFDoc_Environment *							GetReaderApp(){return m_pApp;}
+
+	FX_BOOL									InitJSObjects();
+
+	FX_BOOL									AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
+	void									RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
+	void									RemoveEventsInLoop(CJS_FieldEvent* pStart);
+
+	void									BeginBlock(){m_bBlocking = TRUE;}
+	void									EndBlock(){m_bBlocking = FALSE;}
+	FX_BOOL									IsBlocking(){return m_bBlocking;}
+
+	operator								IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}
+	v8::Isolate*								GetIsolate(){return m_isolate;};
+	void									SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
+
+	v8::Handle<v8::Context>							NewJSContext();
+protected:
+	CFX_ArrayTemplate<CJS_Context *>		m_ContextArray;
+	CPDFDoc_Environment *							m_pApp;
+	CPDFSDK_Document *						m_pDocument;
+	FX_BOOL									m_bBlocking;
+	CJS_FieldEvent*							m_pFieldEventPath;
+
+	v8::Isolate*								m_isolate;
+	v8::Persistent<v8::Context>						m_context;
+	FX_BOOL									m_bRegistered;
+};
+
+#endif //_JS_RUNTIME_H_
+
diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h
index f87f9e1..030cdd5 100644
--- a/fpdfsdk/include/javascript/JS_Value.h
+++ b/fpdfsdk/include/javascript/JS_Value.h
@@ -1,186 +1,186 @@
-// 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 _JS_VALUE_H_

-#define _JS_VALUE_H_

-

-class CJS_Array;

-class CJS_Date;

-

-class CJS_Value

-{

-public:

-	CJS_Value(v8::Isolate* isolate);

-	CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);

-	CJS_Value(v8::Isolate* isolate, const int &iValue);

-	CJS_Value(v8::Isolate* isolate, const double &dValue);

-	CJS_Value(v8::Isolate* isolate, const float &fValue);	

-	CJS_Value(v8::Isolate* isolate, const bool &bValue);

-	CJS_Value(v8::Isolate* isolate, JSFXObject);

-	CJS_Value(v8::Isolate* isolate, CJS_Object *);

-	CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr);

-	CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr);

-	CJS_Value(v8::Isolate* isolate, CJS_Array& array);

-	

-	~CJS_Value();

-

-	void SetNull();

-    void Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);

-	void Attach(CJS_Value *pValue);

-	void Detach();

-

-

-	operator int() const;

-	operator bool() const;

-	operator double() const;

-	operator float() const;

-	operator CJS_Object *() const;

-	//operator JSFXObject *() const;

-	operator v8::Handle<v8::Object>() const;

-	operator v8::Handle<v8::Array>() const;

-	operator CFX_WideString() const;

-	//operator FX_WCHAR *() const;

-	operator CFX_ByteString() const;

-	v8::Handle<v8::Value> ToJSValue();

-

-	void operator = (int iValue);

-	void operator = (bool bValue);	

-	void operator = (double);	

-	void operator = (float);	

-	void operator = (CJS_Object *);	

-	void operator = (v8::Handle<v8::Object>);

-//	void operator = (JSObject *);

-	void operator = (CJS_Array &);

-	void operator = (CJS_Date &);

-	void operator = (FX_LPCWSTR pWstr);	

-	void operator = (FX_LPCSTR pStr);	

-	void operator = (CJS_Value value);

-	

-	FX_BOOL IsArrayObject() const;

-	FX_BOOL	IsDateObject() const;

-	FXJSVALUETYPE GetType() const;

-

-	FX_BOOL ConvertToArray(CJS_Array &) const;

-	FX_BOOL ConvertToDate(CJS_Date &) const;

-

-	v8::Isolate* GetIsolate() {return m_isolate;}

-protected:	

-	v8::Handle<v8::Value> m_pValue;

-	FXJSVALUETYPE m_eType;

-	v8::Isolate* m_isolate;

-};

-

-template<class TYPE> class CJS_ParametersTmpl : public CFX_ArrayTemplate<TYPE>

-{

-public:

-	void push_back(TYPE newElement){CFX_ArrayTemplate<TYPE>::Add(newElement);}

-	int size() const{return CFX_ArrayTemplate<TYPE>::GetSize();}

-};

-typedef CJS_ParametersTmpl<CJS_Value> CJS_Parameters;

-

-class CJS_PropValue: public CJS_Value

-{

-public:

-	CJS_PropValue(const CJS_Value &);

-	CJS_PropValue(v8::Isolate* isolate);

-	~CJS_PropValue();

-public:

-	FX_BOOL IsSetting();

-	FX_BOOL IsGetting();

-	void operator<<(int );

-	void operator>>(int &) const;

-	void operator<<(bool);

-	void operator>>(bool &) const;

-	void operator<<(double );

-	void operator>>(double &) const;

-	void operator<<(CJS_Object *pObj);

-	void operator>>(CJS_Object *&ppObj) const;

-	void operator<<(CFX_ByteString);

-	void operator>>(CFX_ByteString &) const;

-	void operator<<(CFX_WideString);

-	void operator>>(CFX_WideString &) const;

-	void operator<<(FX_LPCWSTR c_string);

-

-	void operator<<(JSFXObject);

-	void operator>>(JSFXObject &) const;

-

-	void operator>>(CJS_Array &array) const;

-	void operator<<(CJS_Array &array);

-

-	void operator<<(CJS_Date &date);

-	void operator>>(CJS_Date &date) const;

-

-	operator v8::Handle<v8::Value>() const;

-

-	void StartSetting();

-	void StartGetting();

-private:

-	FX_BOOL m_bIsSetting;

-};

-

-class CJS_Array

-{

-public:

-	CJS_Array(v8::Isolate* isolate);

-	virtual ~CJS_Array();

-

-	void Attach(v8::Handle<v8::Array> pArray);

-	void GetElement(unsigned index,CJS_Value &value);

-	void SetElement(unsigned index,CJS_Value value);

-    int GetLength();

-	FX_BOOL IsAttached();

-	operator v8::Handle<v8::Array>();

-

-	v8::Isolate* GetIsolate() {return m_isolate;}

-private:

-	v8::Handle<v8::Array> m_pArray;

-	v8::Isolate* m_isolate;

-};

-

-class CJS_Date

-{

-friend class CJS_Value;

-public:

-	CJS_Date(v8::Isolate* isolate);

-	CJS_Date(v8::Isolate* isolate,double dMsec_time);

-	CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);

-	virtual ~CJS_Date();

-	void Attach(v8::Handle<v8::Value> pDate);

-

-	int     GetYear();

-	void    SetYear(int iYear);

-

-	int     GetMonth();

-	void    SetMonth(int iMonth);

-

-	int     GetDay();

-	void    SetDay(int iDay);

-

-	int     GetHours();

-	void    SetHours(int iHours);

-

-	int     GetMinutes();

-	void    SetMinutes(int minutes);

-

-	int     GetSeconds();

-	void    SetSeconds(int seconds);

-

-	operator v8::Handle<v8::Value>();

-	operator double() const;

-

-	CFX_WideString	ToString() const;

-

-	static double	MakeDate(int year, int mon, int mday,int hour, int min, int sec,int ms);

-

-	FX_BOOL	IsValidDate();

-

-protected:

-	v8::Handle<v8::Value> m_pDate;

-	v8::Isolate* m_isolate;

-};

-

-#endif //_JS_VALUE_H_

-

+// 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 _JS_VALUE_H_
+#define _JS_VALUE_H_
+
+class CJS_Array;
+class CJS_Date;
+
+class CJS_Value
+{
+public:
+	CJS_Value(v8::Isolate* isolate);
+	CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);
+	CJS_Value(v8::Isolate* isolate, const int &iValue);
+	CJS_Value(v8::Isolate* isolate, const double &dValue);
+	CJS_Value(v8::Isolate* isolate, const float &fValue);	
+	CJS_Value(v8::Isolate* isolate, const bool &bValue);
+	CJS_Value(v8::Isolate* isolate, JSFXObject);
+	CJS_Value(v8::Isolate* isolate, CJS_Object *);
+	CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr);
+	CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr);
+	CJS_Value(v8::Isolate* isolate, CJS_Array& array);
+	
+	~CJS_Value();
+
+	void SetNull();
+    void Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);
+	void Attach(CJS_Value *pValue);
+	void Detach();
+
+
+	operator int() const;
+	operator bool() const;
+	operator double() const;
+	operator float() const;
+	operator CJS_Object *() const;
+	//operator JSFXObject *() const;
+	operator v8::Handle<v8::Object>() const;
+	operator v8::Handle<v8::Array>() const;
+	operator CFX_WideString() const;
+	//operator FX_WCHAR *() const;
+	operator CFX_ByteString() const;
+	v8::Handle<v8::Value> ToJSValue();
+
+	void operator = (int iValue);
+	void operator = (bool bValue);	
+	void operator = (double);	
+	void operator = (float);	
+	void operator = (CJS_Object *);	
+	void operator = (v8::Handle<v8::Object>);
+//	void operator = (JSObject *);
+	void operator = (CJS_Array &);
+	void operator = (CJS_Date &);
+	void operator = (FX_LPCWSTR pWstr);	
+	void operator = (FX_LPCSTR pStr);	
+	void operator = (CJS_Value value);
+	
+	FX_BOOL IsArrayObject() const;
+	FX_BOOL	IsDateObject() const;
+	FXJSVALUETYPE GetType() const;
+
+	FX_BOOL ConvertToArray(CJS_Array &) const;
+	FX_BOOL ConvertToDate(CJS_Date &) const;
+
+	v8::Isolate* GetIsolate() {return m_isolate;}
+protected:	
+	v8::Handle<v8::Value> m_pValue;
+	FXJSVALUETYPE m_eType;
+	v8::Isolate* m_isolate;
+};
+
+template<class TYPE> class CJS_ParametersTmpl : public CFX_ArrayTemplate<TYPE>
+{
+public:
+	void push_back(TYPE newElement){CFX_ArrayTemplate<TYPE>::Add(newElement);}
+	int size() const{return CFX_ArrayTemplate<TYPE>::GetSize();}
+};
+typedef CJS_ParametersTmpl<CJS_Value> CJS_Parameters;
+
+class CJS_PropValue: public CJS_Value
+{
+public:
+	CJS_PropValue(const CJS_Value &);
+	CJS_PropValue(v8::Isolate* isolate);
+	~CJS_PropValue();
+public:
+	FX_BOOL IsSetting();
+	FX_BOOL IsGetting();
+	void operator<<(int );
+	void operator>>(int &) const;
+	void operator<<(bool);
+	void operator>>(bool &) const;
+	void operator<<(double );
+	void operator>>(double &) const;
+	void operator<<(CJS_Object *pObj);
+	void operator>>(CJS_Object *&ppObj) const;
+	void operator<<(CFX_ByteString);
+	void operator>>(CFX_ByteString &) const;
+	void operator<<(CFX_WideString);
+	void operator>>(CFX_WideString &) const;
+	void operator<<(FX_LPCWSTR c_string);
+
+	void operator<<(JSFXObject);
+	void operator>>(JSFXObject &) const;
+
+	void operator>>(CJS_Array &array) const;
+	void operator<<(CJS_Array &array);
+
+	void operator<<(CJS_Date &date);
+	void operator>>(CJS_Date &date) const;
+
+	operator v8::Handle<v8::Value>() const;
+
+	void StartSetting();
+	void StartGetting();
+private:
+	FX_BOOL m_bIsSetting;
+};
+
+class CJS_Array
+{
+public:
+	CJS_Array(v8::Isolate* isolate);
+	virtual ~CJS_Array();
+
+	void Attach(v8::Handle<v8::Array> pArray);
+	void GetElement(unsigned index,CJS_Value &value);
+	void SetElement(unsigned index,CJS_Value value);
+    int GetLength();
+	FX_BOOL IsAttached();
+	operator v8::Handle<v8::Array>();
+
+	v8::Isolate* GetIsolate() {return m_isolate;}
+private:
+	v8::Handle<v8::Array> m_pArray;
+	v8::Isolate* m_isolate;
+};
+
+class CJS_Date
+{
+friend class CJS_Value;
+public:
+	CJS_Date(v8::Isolate* isolate);
+	CJS_Date(v8::Isolate* isolate,double dMsec_time);
+	CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);
+	virtual ~CJS_Date();
+	void Attach(v8::Handle<v8::Value> pDate);
+
+	int     GetYear();
+	void    SetYear(int iYear);
+
+	int     GetMonth();
+	void    SetMonth(int iMonth);
+
+	int     GetDay();
+	void    SetDay(int iDay);
+
+	int     GetHours();
+	void    SetHours(int iHours);
+
+	int     GetMinutes();
+	void    SetMinutes(int minutes);
+
+	int     GetSeconds();
+	void    SetSeconds(int seconds);
+
+	operator v8::Handle<v8::Value>();
+	operator double() const;
+
+	CFX_WideString	ToString() const;
+
+	static double	MakeDate(int year, int mon, int mday,int hour, int min, int sec,int ms);
+
+	FX_BOOL	IsValidDate();
+
+protected:
+	v8::Handle<v8::Value> m_pDate;
+	v8::Isolate* m_isolate;
+};
+
+#endif //_JS_VALUE_H_
+
diff --git a/fpdfsdk/include/javascript/JavaScript.h b/fpdfsdk/include/javascript/JavaScript.h
index d1375cc..166472b 100644
--- a/fpdfsdk/include/javascript/JavaScript.h
+++ b/fpdfsdk/include/javascript/JavaScript.h
@@ -1,39 +1,39 @@
-// 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 _JAVASCRIPT_H_

-#define _JAVASCRIPT_H_

-

-

-#ifndef _INC_PDFAPI

-	#define _INC_PDFAPI

-

-	#include "../../../core/include/fpdfapi/fpdf_module.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 

-	#include "../../../core/include/fxcrt/fx_xml.h" 

-	#include "../../../core/include/fdrm/fx_crypt.h" 

-	#include "../../../core/include/fpdfapi/fpdf_pageobj.h" 

-	#include "../../../core/include/fpdfapi/fpdf_serial.h"

-

-

-	#include "../../include/fx_systemhandler.h"	

-#endif

-

-

-#include "../jsapi/fxjs_v8.h"

-#include "../fxedit/fx_edit.h"

-#include "../pdfwindow/IPDFWindow.h"

-#include "../fsdk_mgr.h"

-

-

-#include <string>

-//#pragma warning( disable : 4786) 

-#include <vector>

-

-

-#endif //_JAVASCRIPT_H_

-

+// 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 _JAVASCRIPT_H_
+#define _JAVASCRIPT_H_
+
+
+#ifndef _INC_PDFAPI
+	#define _INC_PDFAPI
+
+	#include "../../../core/include/fpdfapi/fpdf_module.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 
+	#include "../../../core/include/fxcrt/fx_xml.h" 
+	#include "../../../core/include/fdrm/fx_crypt.h" 
+	#include "../../../core/include/fpdfapi/fpdf_pageobj.h" 
+	#include "../../../core/include/fpdfapi/fpdf_serial.h"
+
+
+	#include "../../include/fx_systemhandler.h"	
+#endif
+
+
+#include "../jsapi/fxjs_v8.h"
+#include "../fxedit/fx_edit.h"
+#include "../pdfwindow/IPDFWindow.h"
+#include "../fsdk_mgr.h"
+
+
+#include <string>
+//#pragma warning( disable : 4786) 
+#include <vector>
+
+
+#endif //_JAVASCRIPT_H_
+
diff --git a/fpdfsdk/include/javascript/PublicMethods.h b/fpdfsdk/include/javascript/PublicMethods.h
index a485a9a..8d4e683 100644
--- a/fpdfsdk/include/javascript/PublicMethods.h
+++ b/fpdfsdk/include/javascript/PublicMethods.h
@@ -1,101 +1,101 @@
-// 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 _PUBLICMETHODS_H_

-#define _PUBLICMETHODS_H_

-

-class CJS_PublicMethods : public CJS_Object

-{

-public:

-	CJS_PublicMethods(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_PublicMethods(void){};

-

-public:

-	static FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //

-	static FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS);//

-	static FX_BOOL AFSimple(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS); 

-	static FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);

-	static FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);

-

-public:

-	JS_STATIC_GLOBAL_FUN(AFNumber_Format);

-	JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);

-	JS_STATIC_GLOBAL_FUN(AFPercent_Format);

-	JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);

-	JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);

-	JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);

-	JS_STATIC_GLOBAL_FUN(AFDate_Format);

-	JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);

-	JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);

-	JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);

-	JS_STATIC_GLOBAL_FUN(AFTime_Format);

-	JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);

-	JS_STATIC_GLOBAL_FUN(AFSpecial_Format);

-	JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);

-	JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);

-	JS_STATIC_GLOBAL_FUN(AFSimple);

-	JS_STATIC_GLOBAL_FUN(AFMakeNumber);	

-	JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);

-	JS_STATIC_GLOBAL_FUN(AFRange_Validate);

-	JS_STATIC_GLOBAL_FUN(AFMergeChange);

-	JS_STATIC_GLOBAL_FUN(AFParseDateEx);

-	JS_STATIC_GLOBAL_FUN(AFExtractNums);

-

-	JS_STATIC_DECLARE_GLOBAL_FUN();

-	

-public:

-	static int				ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);

-	static CFX_WideString	ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);

-	static double			MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);

-	static CFX_WideString	MakeFormatDate(double dDate,const CFX_WideString & format);

-	static FX_BOOL			ConvertStringToNumber(FX_LPCWSTR swSource, double & dRet, FX_BOOL & bDot);

-	static double			ParseStringToNumber(FX_LPCWSTR swSource);

-	static double			ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);

-	static double           MakeInterDate(CFX_WideString strValue);

-	static double			ParseNumber(FX_LPCWSTR swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);

-

-public:

-	static CFX_WideString	StrLTrim(FX_LPCWSTR pStr);

-	static CFX_WideString	StrRTrim(FX_LPCWSTR pStr);

-	static CFX_WideString	StrTrim(FX_LPCWSTR pStr);

-

-	static CFX_ByteString	StrLTrim(FX_LPCSTR pStr);

-	static CFX_ByteString	StrRTrim(FX_LPCSTR pStr);

-	static CFX_ByteString	StrTrim(FX_LPCSTR pStr);

-

-	static FX_BOOL			IsNumber(FX_LPCSTR string);

-	static FX_BOOL			IsNumber(FX_LPCWSTR string);

-

-	static FX_BOOL			IsDigit(char ch);

-	static FX_BOOL			IsDigit(wchar_t ch);

-	static FX_BOOL			IsAlphabetic(wchar_t ch);

-	static FX_BOOL			IsAlphaNumeric(wchar_t ch);

-

-	static FX_BOOL			maskSatisfied(wchar_t c_Change,wchar_t c_Mask);

-	static FX_BOOL			isReservedMaskChar(wchar_t ch);

-

-	static double			AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);

-	static CJS_Array		AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);

-};

-

-#endif //_PUBLICMETHODS_H_

+// 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 _PUBLICMETHODS_H_
+#define _PUBLICMETHODS_H_
+
+class CJS_PublicMethods : public CJS_Object
+{
+public:
+	CJS_PublicMethods(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_PublicMethods(void){};
+
+public:
+	static FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
+	static FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS);//
+	static FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS); 
+	static FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
+	static FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
+
+public:
+	JS_STATIC_GLOBAL_FUN(AFNumber_Format);
+	JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
+	JS_STATIC_GLOBAL_FUN(AFPercent_Format);
+	JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
+	JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
+	JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
+	JS_STATIC_GLOBAL_FUN(AFDate_Format);
+	JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
+	JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
+	JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
+	JS_STATIC_GLOBAL_FUN(AFTime_Format);
+	JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
+	JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
+	JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
+	JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
+	JS_STATIC_GLOBAL_FUN(AFSimple);
+	JS_STATIC_GLOBAL_FUN(AFMakeNumber);	
+	JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
+	JS_STATIC_GLOBAL_FUN(AFRange_Validate);
+	JS_STATIC_GLOBAL_FUN(AFMergeChange);
+	JS_STATIC_GLOBAL_FUN(AFParseDateEx);
+	JS_STATIC_GLOBAL_FUN(AFExtractNums);
+
+	JS_STATIC_DECLARE_GLOBAL_FUN();
+	
+public:
+	static int				ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);
+	static CFX_WideString	ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
+	static double			MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);
+	static CFX_WideString	MakeFormatDate(double dDate,const CFX_WideString & format);
+	static FX_BOOL			ConvertStringToNumber(FX_LPCWSTR swSource, double & dRet, FX_BOOL & bDot);
+	static double			ParseStringToNumber(FX_LPCWSTR swSource);
+	static double			ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);
+	static double           MakeInterDate(CFX_WideString strValue);
+	static double			ParseNumber(FX_LPCWSTR swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
+
+public:
+	static CFX_WideString	StrLTrim(FX_LPCWSTR pStr);
+	static CFX_WideString	StrRTrim(FX_LPCWSTR pStr);
+	static CFX_WideString	StrTrim(FX_LPCWSTR pStr);
+
+	static CFX_ByteString	StrLTrim(FX_LPCSTR pStr);
+	static CFX_ByteString	StrRTrim(FX_LPCSTR pStr);
+	static CFX_ByteString	StrTrim(FX_LPCSTR pStr);
+
+	static FX_BOOL			IsNumber(FX_LPCSTR string);
+	static FX_BOOL			IsNumber(FX_LPCWSTR string);
+
+	static FX_BOOL			IsDigit(char ch);
+	static FX_BOOL			IsDigit(wchar_t ch);
+	static FX_BOOL			IsAlphabetic(wchar_t ch);
+	static FX_BOOL			IsAlphaNumeric(wchar_t ch);
+
+	static FX_BOOL			maskSatisfied(wchar_t c_Change,wchar_t c_Mask);
+	static FX_BOOL			isReservedMaskChar(wchar_t ch);
+
+	static double			AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
+	static CJS_Array		AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
+};
+
+#endif //_PUBLICMETHODS_H_
diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h
index 35ee401..6273a7d 100644
--- a/fpdfsdk/include/javascript/app.h
+++ b/fpdfsdk/include/javascript/app.h
@@ -1,225 +1,225 @@
-// 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 _APP_H_

-#define _APP_H_

-

-class CJS_Runtime;

-

-/* ---------------------------- TimerObj ---------------------------- */

-

-class CJS_Timer;

-

-class TimerObj : public CJS_EmbedObj

-{

-public:

-	TimerObj(CJS_Object* pJSObject);

-	virtual ~TimerObj();

-	

-public:

-	void			SetTimer(CJS_Timer* pTimer);

-	CJS_Timer*		GetTimer() const;

-	

-private:

-	CJS_Timer*		m_pTimer;

-};

-

-class CJS_TimerObj : public CJS_Object

-{

-public:

-	CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}

-	virtual ~CJS_TimerObj(){}

-	

-	DECLARE_JS_CLASS(CJS_TimerObj);

-};

-

-

-// struct APP_MENUITEM_ARRAY;

-// 

-// struct APP_MENUITEM

-// {

-// 	APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""), bMarked(false), bEnabled(true)

-// 	{

-// 	}

-// 	CFX_WideString cName;

-// 	CFX_WideString cReturn;

-// 	APP_MENUITEM_ARRAY* oSubMenu;

-// 	bool bMarked;

-// 	bool bEnabled;

-// };

-

-// struct APP_MENUITEM_ARRAY

-// {

-// 	APP_MENUITEM_ARRAY() : m_hMenu(NULL), pContents(NULL), nSize(0)

-// 	{

-// 

-// 	}

-// 	APP_MENUITEM * pContents;

-// 	HMENU m_hMenu;

-// 	int	nSize;

-// };

-

-// struct APP_MENU;

-// struct APP_MENU_ARRAY

-// {

-// 	APP_MENU_ARRAY():

-//     pContent(NULL)

-// 	{

-// 	}

-// 

-// 	APP_MENU* pContent;

-// };

-

-// struct APP_MENU

-// {

-// 	APP_MENU():bSubMenu(false), 

-// 	SubMenuItems(NULL),

-// 	cwMenuItemName(L""),

-// 	hMenu(NULL),

-// 	iSize(0)

-// 	{

-// 

-// 	}

-// 

-// 	APP_MENU(CFX_WideString &cwName):

-// 	cwMenuItemName(cwName),

-// 	bSubMenu(false),

-// 	SubMenuItems(NULL),

-// 	hMenu(NULL),

-// 	iSize(0)

-// 	{

-// 

-// 	}

-// 	

-// 	CFX_WideString cwMenuItemName;

-// 	bool bSubMenu;	

-// 	APP_MENU_ARRAY* SubMenuItems;

-// 	int iSize;

-// 	HMENU hMenu;

-// };

-

-class app : public CJS_EmbedObj

-{

-public:

-	app(CJS_Object * pJSObject);

-	virtual ~app();

-

-public:

-	FX_BOOL						activeDocs(OBJ_PROP_PARAMS);

-	FX_BOOL						calculate(OBJ_PROP_PARAMS);

-	FX_BOOL						formsVersion(OBJ_PROP_PARAMS);

-	FX_BOOL						fs(OBJ_PROP_PARAMS);

-	FX_BOOL						fullscreen(OBJ_PROP_PARAMS);

-	FX_BOOL						language(OBJ_PROP_PARAMS);

-	FX_BOOL						media(OBJ_PROP_PARAMS);

-	FX_BOOL						platform(OBJ_PROP_PARAMS);

-	FX_BOOL						runtimeHighlight(OBJ_PROP_PARAMS);

-	FX_BOOL						viewerType(OBJ_PROP_PARAMS);

-	FX_BOOL						viewerVariation(OBJ_PROP_PARAMS);

-	FX_BOOL						viewerVersion(OBJ_PROP_PARAMS);	

-

-

-	FX_BOOL						alert(OBJ_METHOD_PARAMS);

-	FX_BOOL						beep(OBJ_METHOD_PARAMS);

-	FX_BOOL						browseForDoc(OBJ_METHOD_PARAMS);

-	FX_BOOL						clearInterval(OBJ_METHOD_PARAMS);

-	FX_BOOL						clearTimeOut(OBJ_METHOD_PARAMS);

-	FX_BOOL						execDialog(OBJ_METHOD_PARAMS);

-	FX_BOOL						execMenuItem(OBJ_METHOD_PARAMS);

-	FX_BOOL						findComponent(OBJ_METHOD_PARAMS);

-	FX_BOOL						goBack(OBJ_METHOD_PARAMS);

-	FX_BOOL						goForward(OBJ_METHOD_PARAMS);

-	FX_BOOL						launchURL(OBJ_METHOD_PARAMS);

-	FX_BOOL						mailMsg(OBJ_METHOD_PARAMS);

-	FX_BOOL						newFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL						newDoc(OBJ_METHOD_PARAMS);

-	FX_BOOL						openDoc(OBJ_METHOD_PARAMS);

-	FX_BOOL						openFDF(OBJ_METHOD_PARAMS);

-	FX_BOOL						popUpMenuEx(OBJ_METHOD_PARAMS);

-	FX_BOOL						popUpMenu(OBJ_METHOD_PARAMS);

-	FX_BOOL						response(OBJ_METHOD_PARAMS);

-	FX_BOOL						setInterval(OBJ_METHOD_PARAMS);

-	FX_BOOL						setTimeOut(OBJ_METHOD_PARAMS);

-

-private:

-//	FX_DWORD					AppGetTickCount(); 

-	void						TimerProc(CJS_Timer* pTimer);

-	void						RunJsScript(CJS_Runtime * pRuntime,const CFX_WideString & wsScript);

-//	void						ParsePopupMenuObj(APP_MENUITEM * ppMenuItem,JSObject * pObj);

-//	void						DeleteMenuItems(APP_MENUITEM_ARRAY * pMenuItems);

-// 	void						AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU hMenu, MENUITEMINFO MenuItemInfo);

-// 	void						InitMenuItemInfo(MENUITEMINFO& MenuItemInfo);

-// 	void						DestroyPopUpMenu();

-

-// 	void						ParserMenuItem(APP_MENU* pHead, const CJS_Parameters&params);

-// 	void						AddItemToMenu(APP_MENU* pHead, HMENU hMenu, MENUITEMINFO MenuItemInfo);

-// 	void						DestroyMenuItems(APP_MENU* pHead);

-

-public:

-	static CFX_WideString		SysPathToPDFPath(const CFX_WideString& sOldPath);

-	static CFX_WideString		PDFPathToSysPath(const CFX_WideString& sOldPath);

-	static CFX_WideString		RelativePathToSysPath(const CFX_WideString& sOldPath, const CFX_WideString& sFilePath);

-

-

-private:

-

-	bool						m_bCalculate;	

-	CJS_Runtime*				m_pRuntime;

-	bool						m_bRuntimeHighLight;

-

-	CFX_ArrayTemplate<CJS_Timer*>	m_aTimer;

-//	APP_MENU*					m_pMenuHead;

-	

-public:

-//	static CReader_App* s_App;

-};

-

-class CJS_App : public CJS_Object

-{

-public:

-	CJS_App(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_App(void){};

-

-	DECLARE_JS_CLASS(CJS_App);

-

-	JS_STATIC_PROP(activeDocs, app);

-	JS_STATIC_PROP(calculate, app);

-	JS_STATIC_PROP(formsVersion, app);

-	JS_STATIC_PROP(fs, app);

-	JS_STATIC_PROP(fullscreen, app);

-	JS_STATIC_PROP(language, app);

-	JS_STATIC_PROP(media, app);

-	JS_STATIC_PROP(platform, app);

-	JS_STATIC_PROP(runtimeHighlight, app);

-	JS_STATIC_PROP(viewerType, app);

-	JS_STATIC_PROP(viewerVariation, app);

-	JS_STATIC_PROP(viewerVersion, app);	

-

-	JS_STATIC_METHOD(alert, app);

-	JS_STATIC_METHOD(beep, app);

-	JS_STATIC_METHOD(browseForDoc, app);

-	JS_STATIC_METHOD(clearInterval, app);

-	JS_STATIC_METHOD(clearTimeOut, app);

-	JS_STATIC_METHOD(execDialog, app);

-	JS_STATIC_METHOD(execMenuItem, app);

-	JS_STATIC_METHOD(findComponent, app);

-	JS_STATIC_METHOD(goBack, app);

-	JS_STATIC_METHOD(goForward, app);

-	JS_STATIC_METHOD(launchURL, app);

-	JS_STATIC_METHOD(mailMsg, app);

-	JS_STATIC_METHOD(newFDF, app);

-	JS_STATIC_METHOD(newDoc, app);

-	JS_STATIC_METHOD(openDoc, app);

-	JS_STATIC_METHOD(openFDF, app);

-	JS_STATIC_METHOD(popUpMenuEx, app);

-	JS_STATIC_METHOD(popUpMenu, app);

-	JS_STATIC_METHOD(response, app);

-	JS_STATIC_METHOD(setInterval, app);

-	JS_STATIC_METHOD(setTimeOut, app);

-

-};

-

-#endif //_APP_H_

+// 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 _APP_H_
+#define _APP_H_
+
+class CJS_Runtime;
+
+/* ---------------------------- TimerObj ---------------------------- */
+
+class CJS_Timer;
+
+class TimerObj : public CJS_EmbedObj
+{
+public:
+	TimerObj(CJS_Object* pJSObject);
+	virtual ~TimerObj();
+	
+public:
+	void			SetTimer(CJS_Timer* pTimer);
+	CJS_Timer*		GetTimer() const;
+	
+private:
+	CJS_Timer*		m_pTimer;
+};
+
+class CJS_TimerObj : public CJS_Object
+{
+public:
+	CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
+	virtual ~CJS_TimerObj(){}
+	
+	DECLARE_JS_CLASS(CJS_TimerObj);
+};
+
+
+// struct APP_MENUITEM_ARRAY;
+// 
+// struct APP_MENUITEM
+// {
+// 	APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""), bMarked(false), bEnabled(true)
+// 	{
+// 	}
+// 	CFX_WideString cName;
+// 	CFX_WideString cReturn;
+// 	APP_MENUITEM_ARRAY* oSubMenu;
+// 	bool bMarked;
+// 	bool bEnabled;
+// };
+
+// struct APP_MENUITEM_ARRAY
+// {
+// 	APP_MENUITEM_ARRAY() : m_hMenu(NULL), pContents(NULL), nSize(0)
+// 	{
+// 
+// 	}
+// 	APP_MENUITEM * pContents;
+// 	HMENU m_hMenu;
+// 	int	nSize;
+// };
+
+// struct APP_MENU;
+// struct APP_MENU_ARRAY
+// {
+// 	APP_MENU_ARRAY():
+//     pContent(NULL)
+// 	{
+// 	}
+// 
+// 	APP_MENU* pContent;
+// };
+
+// struct APP_MENU
+// {
+// 	APP_MENU():bSubMenu(false), 
+// 	SubMenuItems(NULL),
+// 	cwMenuItemName(L""),
+// 	hMenu(NULL),
+// 	iSize(0)
+// 	{
+// 
+// 	}
+// 
+// 	APP_MENU(CFX_WideString &cwName):
+// 	cwMenuItemName(cwName),
+// 	bSubMenu(false),
+// 	SubMenuItems(NULL),
+// 	hMenu(NULL),
+// 	iSize(0)
+// 	{
+// 
+// 	}
+// 	
+// 	CFX_WideString cwMenuItemName;
+// 	bool bSubMenu;	
+// 	APP_MENU_ARRAY* SubMenuItems;
+// 	int iSize;
+// 	HMENU hMenu;
+// };
+
+class app : public CJS_EmbedObj
+{
+public:
+	app(CJS_Object * pJSObject);
+	virtual ~app();
+
+public:
+	FX_BOOL						activeDocs(OBJ_PROP_PARAMS);
+	FX_BOOL						calculate(OBJ_PROP_PARAMS);
+	FX_BOOL						formsVersion(OBJ_PROP_PARAMS);
+	FX_BOOL						fs(OBJ_PROP_PARAMS);
+	FX_BOOL						fullscreen(OBJ_PROP_PARAMS);
+	FX_BOOL						language(OBJ_PROP_PARAMS);
+	FX_BOOL						media(OBJ_PROP_PARAMS);
+	FX_BOOL						platform(OBJ_PROP_PARAMS);
+	FX_BOOL						runtimeHighlight(OBJ_PROP_PARAMS);
+	FX_BOOL						viewerType(OBJ_PROP_PARAMS);
+	FX_BOOL						viewerVariation(OBJ_PROP_PARAMS);
+	FX_BOOL						viewerVersion(OBJ_PROP_PARAMS);	
+
+
+	FX_BOOL						alert(OBJ_METHOD_PARAMS);
+	FX_BOOL						beep(OBJ_METHOD_PARAMS);
+	FX_BOOL						browseForDoc(OBJ_METHOD_PARAMS);
+	FX_BOOL						clearInterval(OBJ_METHOD_PARAMS);
+	FX_BOOL						clearTimeOut(OBJ_METHOD_PARAMS);
+	FX_BOOL						execDialog(OBJ_METHOD_PARAMS);
+	FX_BOOL						execMenuItem(OBJ_METHOD_PARAMS);
+	FX_BOOL						findComponent(OBJ_METHOD_PARAMS);
+	FX_BOOL						goBack(OBJ_METHOD_PARAMS);
+	FX_BOOL						goForward(OBJ_METHOD_PARAMS);
+	FX_BOOL						launchURL(OBJ_METHOD_PARAMS);
+	FX_BOOL						mailMsg(OBJ_METHOD_PARAMS);
+	FX_BOOL						newFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL						newDoc(OBJ_METHOD_PARAMS);
+	FX_BOOL						openDoc(OBJ_METHOD_PARAMS);
+	FX_BOOL						openFDF(OBJ_METHOD_PARAMS);
+	FX_BOOL						popUpMenuEx(OBJ_METHOD_PARAMS);
+	FX_BOOL						popUpMenu(OBJ_METHOD_PARAMS);
+	FX_BOOL						response(OBJ_METHOD_PARAMS);
+	FX_BOOL						setInterval(OBJ_METHOD_PARAMS);
+	FX_BOOL						setTimeOut(OBJ_METHOD_PARAMS);
+
+private:
+//	FX_DWORD					AppGetTickCount(); 
+	void						TimerProc(CJS_Timer* pTimer);
+	void						RunJsScript(CJS_Runtime * pRuntime,const CFX_WideString & wsScript);
+//	void						ParsePopupMenuObj(APP_MENUITEM * ppMenuItem,JSObject * pObj);
+//	void						DeleteMenuItems(APP_MENUITEM_ARRAY * pMenuItems);
+// 	void						AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU hMenu, MENUITEMINFO MenuItemInfo);
+// 	void						InitMenuItemInfo(MENUITEMINFO& MenuItemInfo);
+// 	void						DestroyPopUpMenu();
+
+// 	void						ParserMenuItem(APP_MENU* pHead, const CJS_Parameters&params);
+// 	void						AddItemToMenu(APP_MENU* pHead, HMENU hMenu, MENUITEMINFO MenuItemInfo);
+// 	void						DestroyMenuItems(APP_MENU* pHead);
+
+public:
+	static CFX_WideString		SysPathToPDFPath(const CFX_WideString& sOldPath);
+	static CFX_WideString		PDFPathToSysPath(const CFX_WideString& sOldPath);
+	static CFX_WideString		RelativePathToSysPath(const CFX_WideString& sOldPath, const CFX_WideString& sFilePath);
+
+
+private:
+
+	bool						m_bCalculate;	
+	CJS_Runtime*				m_pRuntime;
+	bool						m_bRuntimeHighLight;
+
+	CFX_ArrayTemplate<CJS_Timer*>	m_aTimer;
+//	APP_MENU*					m_pMenuHead;
+	
+public:
+//	static CReader_App* s_App;
+};
+
+class CJS_App : public CJS_Object
+{
+public:
+	CJS_App(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_App(void){};
+
+	DECLARE_JS_CLASS(CJS_App);
+
+	JS_STATIC_PROP(activeDocs, app);
+	JS_STATIC_PROP(calculate, app);
+	JS_STATIC_PROP(formsVersion, app);
+	JS_STATIC_PROP(fs, app);
+	JS_STATIC_PROP(fullscreen, app);
+	JS_STATIC_PROP(language, app);
+	JS_STATIC_PROP(media, app);
+	JS_STATIC_PROP(platform, app);
+	JS_STATIC_PROP(runtimeHighlight, app);
+	JS_STATIC_PROP(viewerType, app);
+	JS_STATIC_PROP(viewerVariation, app);
+	JS_STATIC_PROP(viewerVersion, app);	
+
+	JS_STATIC_METHOD(alert, app);
+	JS_STATIC_METHOD(beep, app);
+	JS_STATIC_METHOD(browseForDoc, app);
+	JS_STATIC_METHOD(clearInterval, app);
+	JS_STATIC_METHOD(clearTimeOut, app);
+	JS_STATIC_METHOD(execDialog, app);
+	JS_STATIC_METHOD(execMenuItem, app);
+	JS_STATIC_METHOD(findComponent, app);
+	JS_STATIC_METHOD(goBack, app);
+	JS_STATIC_METHOD(goForward, app);
+	JS_STATIC_METHOD(launchURL, app);
+	JS_STATIC_METHOD(mailMsg, app);
+	JS_STATIC_METHOD(newFDF, app);
+	JS_STATIC_METHOD(newDoc, app);
+	JS_STATIC_METHOD(openDoc, app);
+	JS_STATIC_METHOD(openFDF, app);
+	JS_STATIC_METHOD(popUpMenuEx, app);
+	JS_STATIC_METHOD(popUpMenu, app);
+	JS_STATIC_METHOD(response, app);
+	JS_STATIC_METHOD(setInterval, app);
+	JS_STATIC_METHOD(setTimeOut, app);
+
+};
+
+#endif //_APP_H_
diff --git a/fpdfsdk/include/javascript/color.h b/fpdfsdk/include/javascript/color.h
index 1910e16..d0aa72f 100644
--- a/fpdfsdk/include/javascript/color.h
+++ b/fpdfsdk/include/javascript/color.h
@@ -1,78 +1,78 @@
-// 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 _COLOR_H_

-#define _COLOR_H_

-

-class color : public CJS_EmbedObj

-{

-public:

-	color(CJS_Object* pJSObject);

-	virtual ~color(void);

-

-	FX_BOOL black(OBJ_PROP_PARAMS);

-	FX_BOOL blue(OBJ_PROP_PARAMS);

-	FX_BOOL cyan(OBJ_PROP_PARAMS);	

-	FX_BOOL dkGray(OBJ_PROP_PARAMS);

-	FX_BOOL gray(OBJ_PROP_PARAMS);

-	FX_BOOL green(OBJ_PROP_PARAMS);

-	FX_BOOL ltGray(OBJ_PROP_PARAMS);

-	FX_BOOL magenta(OBJ_PROP_PARAMS);

-	FX_BOOL red(OBJ_PROP_PARAMS);	

-	FX_BOOL transparent(OBJ_PROP_PARAMS);

-	FX_BOOL white(OBJ_PROP_PARAMS);

-	FX_BOOL yellow(OBJ_PROP_PARAMS);

-

-	FX_BOOL convert(OBJ_METHOD_PARAMS);

-	FX_BOOL equal(OBJ_METHOD_PARAMS);

-

-public:  

-	static void		ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);

-	static void		ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);

-

-private:

-	CPWL_Color		m_crTransparent;

-	CPWL_Color		m_crBlack;

-	CPWL_Color		m_crWhite;

-	CPWL_Color		m_crRed;

-	CPWL_Color		m_crGreen;

-	CPWL_Color		m_crBlue;

-	CPWL_Color		m_crCyan;

-	CPWL_Color		m_crMagenta;

-	CPWL_Color		m_crYellow;

-	CPWL_Color		m_crDKGray;

-	CPWL_Color		m_crGray;

-	CPWL_Color		m_crLTGray;

-};

-

-class CJS_Color : public CJS_Object

-{

-public:

-	CJS_Color(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Color(void){};

-

-	DECLARE_JS_CLASS(CJS_Color);

-

-	JS_STATIC_PROP(black, color);

-	JS_STATIC_PROP(blue, color);

-	JS_STATIC_PROP(cyan, color);	

-	JS_STATIC_PROP(dkGray, color);

-	JS_STATIC_PROP(gray, color);

-	JS_STATIC_PROP(green, color);

-	JS_STATIC_PROP(ltGray, color);

-	JS_STATIC_PROP(magenta, color);

-	JS_STATIC_PROP(red, color);	

-	JS_STATIC_PROP(transparent, color);

-	JS_STATIC_PROP(white, color);

-	JS_STATIC_PROP(yellow, color);

-

-	JS_STATIC_METHOD(convert,color);

-	JS_STATIC_METHOD(equal,color);

-

-};

-

-#endif //_COLOR_H_

-

+// 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 _COLOR_H_
+#define _COLOR_H_
+
+class color : public CJS_EmbedObj
+{
+public:
+	color(CJS_Object* pJSObject);
+	virtual ~color(void);
+
+	FX_BOOL black(OBJ_PROP_PARAMS);
+	FX_BOOL blue(OBJ_PROP_PARAMS);
+	FX_BOOL cyan(OBJ_PROP_PARAMS);	
+	FX_BOOL dkGray(OBJ_PROP_PARAMS);
+	FX_BOOL gray(OBJ_PROP_PARAMS);
+	FX_BOOL green(OBJ_PROP_PARAMS);
+	FX_BOOL ltGray(OBJ_PROP_PARAMS);
+	FX_BOOL magenta(OBJ_PROP_PARAMS);
+	FX_BOOL red(OBJ_PROP_PARAMS);	
+	FX_BOOL transparent(OBJ_PROP_PARAMS);
+	FX_BOOL white(OBJ_PROP_PARAMS);
+	FX_BOOL yellow(OBJ_PROP_PARAMS);
+
+	FX_BOOL convert(OBJ_METHOD_PARAMS);
+	FX_BOOL equal(OBJ_METHOD_PARAMS);
+
+public:  
+	static void		ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
+	static void		ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
+
+private:
+	CPWL_Color		m_crTransparent;
+	CPWL_Color		m_crBlack;
+	CPWL_Color		m_crWhite;
+	CPWL_Color		m_crRed;
+	CPWL_Color		m_crGreen;
+	CPWL_Color		m_crBlue;
+	CPWL_Color		m_crCyan;
+	CPWL_Color		m_crMagenta;
+	CPWL_Color		m_crYellow;
+	CPWL_Color		m_crDKGray;
+	CPWL_Color		m_crGray;
+	CPWL_Color		m_crLTGray;
+};
+
+class CJS_Color : public CJS_Object
+{
+public:
+	CJS_Color(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Color(void){};
+
+	DECLARE_JS_CLASS(CJS_Color);
+
+	JS_STATIC_PROP(black, color);
+	JS_STATIC_PROP(blue, color);
+	JS_STATIC_PROP(cyan, color);	
+	JS_STATIC_PROP(dkGray, color);
+	JS_STATIC_PROP(gray, color);
+	JS_STATIC_PROP(green, color);
+	JS_STATIC_PROP(ltGray, color);
+	JS_STATIC_PROP(magenta, color);
+	JS_STATIC_PROP(red, color);	
+	JS_STATIC_PROP(transparent, color);
+	JS_STATIC_PROP(white, color);
+	JS_STATIC_PROP(yellow, color);
+
+	JS_STATIC_METHOD(convert,color);
+	JS_STATIC_METHOD(equal,color);
+
+};
+
+#endif //_COLOR_H_
+
diff --git a/fpdfsdk/include/javascript/console.h b/fpdfsdk/include/javascript/console.h
index 98a3293..70d993b 100644
--- a/fpdfsdk/include/javascript/console.h
+++ b/fpdfsdk/include/javascript/console.h
@@ -1,38 +1,38 @@
-// 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 _CONSOLE_H_

-#define _CONSOLE_H_

-

-class console : public CJS_EmbedObj

-{

-public:

-	console(CJS_Object* pJSObject);

-	virtual ~console(void);

-

-public:

-	FX_BOOL clear(OBJ_METHOD_PARAMS);

-	FX_BOOL hide(OBJ_METHOD_PARAMS);

-	FX_BOOL println(OBJ_METHOD_PARAMS);

-	FX_BOOL show(OBJ_METHOD_PARAMS);

-};

-

-class CJS_Console : public CJS_Object  

-{

-public:

-	CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Console(void){};

-

-	DECLARE_JS_CLASS(CJS_Console);

-

-	JS_STATIC_METHOD(clear, console);

-	JS_STATIC_METHOD(hide, console);

-	JS_STATIC_METHOD(println, console);

-	JS_STATIC_METHOD(show, console);

-};

-

-#endif //_CONSOLE_H_

-

+// 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 _CONSOLE_H_
+#define _CONSOLE_H_
+
+class console : public CJS_EmbedObj
+{
+public:
+	console(CJS_Object* pJSObject);
+	virtual ~console(void);
+
+public:
+	FX_BOOL clear(OBJ_METHOD_PARAMS);
+	FX_BOOL hide(OBJ_METHOD_PARAMS);
+	FX_BOOL println(OBJ_METHOD_PARAMS);
+	FX_BOOL show(OBJ_METHOD_PARAMS);
+};
+
+class CJS_Console : public CJS_Object  
+{
+public:
+	CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Console(void){};
+
+	DECLARE_JS_CLASS(CJS_Console);
+
+	JS_STATIC_METHOD(clear, console);
+	JS_STATIC_METHOD(hide, console);
+	JS_STATIC_METHOD(println, console);
+	JS_STATIC_METHOD(show, console);
+};
+
+#endif //_CONSOLE_H_
+
diff --git a/fpdfsdk/include/javascript/event.h b/fpdfsdk/include/javascript/event.h
index 91f2c65..040a933 100644
--- a/fpdfsdk/include/javascript/event.h
+++ b/fpdfsdk/include/javascript/event.h
@@ -1,70 +1,70 @@
-// 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 _EVENT_H_

-#define _EVENT_H_

-

-class event : public CJS_EmbedObj

-{

-public:

-	event(CJS_Object * pJSObject);

-	virtual ~event(void);

-

-public:

-	FX_BOOL change(OBJ_PROP_PARAMS);

-	FX_BOOL changeEx(OBJ_PROP_PARAMS);

-	FX_BOOL commitKey(OBJ_PROP_PARAMS);

-	FX_BOOL fieldFull(OBJ_PROP_PARAMS);

-	FX_BOOL keyDown(OBJ_PROP_PARAMS);

-	FX_BOOL modifier(OBJ_PROP_PARAMS);

-	FX_BOOL name(OBJ_PROP_PARAMS);

-	FX_BOOL rc(OBJ_PROP_PARAMS);

-	FX_BOOL richChange(OBJ_PROP_PARAMS);

-	FX_BOOL richChangeEx(OBJ_PROP_PARAMS);

-	FX_BOOL richValue(OBJ_PROP_PARAMS);

-	FX_BOOL selEnd(OBJ_PROP_PARAMS);

-	FX_BOOL selStart(OBJ_PROP_PARAMS);

-	FX_BOOL shift(OBJ_PROP_PARAMS);

-	FX_BOOL source(OBJ_PROP_PARAMS);

-	FX_BOOL target(OBJ_PROP_PARAMS);

-	FX_BOOL targetName(OBJ_PROP_PARAMS);

-	FX_BOOL type(OBJ_PROP_PARAMS);

-	FX_BOOL value(OBJ_PROP_PARAMS);

-	FX_BOOL willCommit(OBJ_PROP_PARAMS);

-

-};

-

-class CJS_Event : public CJS_Object

-{

-public:

-	CJS_Event(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Event(void){};

-

-	DECLARE_JS_CLASS(CJS_Event);

-

-	JS_STATIC_PROP(change, event);

-	JS_STATIC_PROP(changeEx, event);

-	JS_STATIC_PROP(commitKey, event);

-	JS_STATIC_PROP(fieldFull, event);

-	JS_STATIC_PROP(keyDown, event);

-	JS_STATIC_PROP(modifier, event);

-	JS_STATIC_PROP(name, event);

-	JS_STATIC_PROP(rc, event);

-	JS_STATIC_PROP(richChange, event);

-	JS_STATIC_PROP(richChangeEx, event);

-	JS_STATIC_PROP(richValue, event);

-	JS_STATIC_PROP(selEnd, event);

-	JS_STATIC_PROP(selStart, event);

-	JS_STATIC_PROP(shift, event);

-	JS_STATIC_PROP(source, event);

-	JS_STATIC_PROP(target, event);

-	JS_STATIC_PROP(targetName, event);

-	JS_STATIC_PROP(type, event);

-	JS_STATIC_PROP(value, event);

-	JS_STATIC_PROP(willCommit, event);

-};

-

-#endif //_EVENT_H_

+// 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 _EVENT_H_
+#define _EVENT_H_
+
+class event : public CJS_EmbedObj
+{
+public:
+	event(CJS_Object * pJSObject);
+	virtual ~event(void);
+
+public:
+	FX_BOOL change(OBJ_PROP_PARAMS);
+	FX_BOOL changeEx(OBJ_PROP_PARAMS);
+	FX_BOOL commitKey(OBJ_PROP_PARAMS);
+	FX_BOOL fieldFull(OBJ_PROP_PARAMS);
+	FX_BOOL keyDown(OBJ_PROP_PARAMS);
+	FX_BOOL modifier(OBJ_PROP_PARAMS);
+	FX_BOOL name(OBJ_PROP_PARAMS);
+	FX_BOOL rc(OBJ_PROP_PARAMS);
+	FX_BOOL richChange(OBJ_PROP_PARAMS);
+	FX_BOOL richChangeEx(OBJ_PROP_PARAMS);
+	FX_BOOL richValue(OBJ_PROP_PARAMS);
+	FX_BOOL selEnd(OBJ_PROP_PARAMS);
+	FX_BOOL selStart(OBJ_PROP_PARAMS);
+	FX_BOOL shift(OBJ_PROP_PARAMS);
+	FX_BOOL source(OBJ_PROP_PARAMS);
+	FX_BOOL target(OBJ_PROP_PARAMS);
+	FX_BOOL targetName(OBJ_PROP_PARAMS);
+	FX_BOOL type(OBJ_PROP_PARAMS);
+	FX_BOOL value(OBJ_PROP_PARAMS);
+	FX_BOOL willCommit(OBJ_PROP_PARAMS);
+
+};
+
+class CJS_Event : public CJS_Object
+{
+public:
+	CJS_Event(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Event(void){};
+
+	DECLARE_JS_CLASS(CJS_Event);
+
+	JS_STATIC_PROP(change, event);
+	JS_STATIC_PROP(changeEx, event);
+	JS_STATIC_PROP(commitKey, event);
+	JS_STATIC_PROP(fieldFull, event);
+	JS_STATIC_PROP(keyDown, event);
+	JS_STATIC_PROP(modifier, event);
+	JS_STATIC_PROP(name, event);
+	JS_STATIC_PROP(rc, event);
+	JS_STATIC_PROP(richChange, event);
+	JS_STATIC_PROP(richChangeEx, event);
+	JS_STATIC_PROP(richValue, event);
+	JS_STATIC_PROP(selEnd, event);
+	JS_STATIC_PROP(selStart, event);
+	JS_STATIC_PROP(shift, event);
+	JS_STATIC_PROP(source, event);
+	JS_STATIC_PROP(target, event);
+	JS_STATIC_PROP(targetName, event);
+	JS_STATIC_PROP(type, event);
+	JS_STATIC_PROP(value, event);
+	JS_STATIC_PROP(willCommit, event);
+};
+
+#endif //_EVENT_H_
diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h
index 7effd57..f5867c5 100644
--- a/fpdfsdk/include/javascript/global.h
+++ b/fpdfsdk/include/javascript/global.h
@@ -1,85 +1,85 @@
-// 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 _GLOBAL_H_

-#define _GLOBAL_H_

-

-class CJS_GlobalData;

-

-struct js_global_data

-{

-	js_global_data()

-	{

-		nType = 0;

-		dData = 0;

-		bData = FALSE;

-		sData = "";

-		bPersistent = FALSE;

-		bDeleted = FALSE;

-	}

-

-	~js_global_data()

-	{

-		pData.Reset();

-	}

-	int					nType; //0:int 1:bool 2:string 3:obj

-	double				dData;

-	bool				bData;

-	CFX_ByteString		sData;

-	v8::Persistent<v8::Object>  pData;

-	bool				bPersistent;

-	bool				bDeleted;

-};

-

-class global_alternate : public CJS_EmbedObj

-{

-public:

-	global_alternate(CJS_Object* pJSObject);

-	virtual ~global_alternate();

-

-public:

-	FX_BOOL						setPersistent(OBJ_METHOD_PARAMS);

-

-public:

-	FX_BOOL						QueryProperty(FX_LPCWSTR propname);

-	FX_BOOL						DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS_PropValue & vp, JS_ErrorString & sError);

-	FX_BOOL						DelProperty(IFXJS_Context* cc, FX_LPCWSTR propname, JS_ErrorString & sError);

-

-	void						Initial(CPDFDoc_Environment* pApp);

-

-private:

-	void						UpdateGlobalPersistentVariables();

-	void						CommitGlobalPersisitentVariables();

-	void						DestroyGlobalPersisitentVariables();

-	FX_BOOL						SetGlobalVariables(FX_LPCSTR propname, int nType, 

-									double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);

-

-	void						ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array);

-	void						PutObjectProperty(v8::Handle<v8::Object> obj, CJS_KeyValue* pData);

-

-private:

-	CFX_MapByteStringToPtr		m_mapGlobal;

-	CFX_WideString				m_sFilePath;

-	CJS_GlobalData*				m_pGlobalData;

-	CPDFDoc_Environment*				m_pApp;

-};

-

-

-class CJS_Global : public CJS_Object

-{

-public:

-	CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Global(void){};

-

-	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);	

-

-	DECLARE_SPECIAL_JS_CLASS(CJS_Global);

-

-	JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);

-

-};

-

-#endif //_GLOBAL_H_

+// 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 _GLOBAL_H_
+#define _GLOBAL_H_
+
+class CJS_GlobalData;
+
+struct js_global_data
+{
+	js_global_data()
+	{
+		nType = 0;
+		dData = 0;
+		bData = FALSE;
+		sData = "";
+		bPersistent = FALSE;
+		bDeleted = FALSE;
+	}
+
+	~js_global_data()
+	{
+		pData.Reset();
+	}
+	int					nType; //0:int 1:bool 2:string 3:obj
+	double				dData;
+	bool				bData;
+	CFX_ByteString		sData;
+	v8::Persistent<v8::Object>  pData;
+	bool				bPersistent;
+	bool				bDeleted;
+};
+
+class global_alternate : public CJS_EmbedObj
+{
+public:
+	global_alternate(CJS_Object* pJSObject);
+	virtual ~global_alternate();
+
+public:
+	FX_BOOL						setPersistent(OBJ_METHOD_PARAMS);
+
+public:
+	FX_BOOL						QueryProperty(FX_LPCWSTR propname);
+	FX_BOOL						DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS_PropValue & vp, JS_ErrorString & sError);
+	FX_BOOL						DelProperty(IFXJS_Context* cc, FX_LPCWSTR propname, JS_ErrorString & sError);
+
+	void						Initial(CPDFDoc_Environment* pApp);
+
+private:
+	void						UpdateGlobalPersistentVariables();
+	void						CommitGlobalPersisitentVariables();
+	void						DestroyGlobalPersisitentVariables();
+	FX_BOOL						SetGlobalVariables(FX_LPCSTR propname, int nType, 
+									double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);
+
+	void						ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array);
+	void						PutObjectProperty(v8::Handle<v8::Object> obj, CJS_KeyValue* pData);
+
+private:
+	CFX_MapByteStringToPtr		m_mapGlobal;
+	CFX_WideString				m_sFilePath;
+	CJS_GlobalData*				m_pGlobalData;
+	CPDFDoc_Environment*				m_pApp;
+};
+
+
+class CJS_Global : public CJS_Object
+{
+public:
+	CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Global(void){};
+
+	virtual FX_BOOL	InitInstance(IFXJS_Context* cc);	
+
+	DECLARE_SPECIAL_JS_CLASS(CJS_Global);
+
+	JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
+
+};
+
+#endif //_GLOBAL_H_
diff --git a/fpdfsdk/include/javascript/report.h b/fpdfsdk/include/javascript/report.h
index 8a4084d..fb5adf3 100644
--- a/fpdfsdk/include/javascript/report.h
+++ b/fpdfsdk/include/javascript/report.h
@@ -1,35 +1,35 @@
-// 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 _REPORT_H_

-#define _REPORT_H_

-

-class Report : public CJS_EmbedObj

-{

-public:

-	Report(CJS_Object * pJSObject);

-	virtual ~Report();

-

-public:

-	FX_BOOL save(OBJ_METHOD_PARAMS);

-	FX_BOOL writeText(OBJ_METHOD_PARAMS);

-};

-

-class CJS_Report : public CJS_Object

-{

-public:

-	CJS_Report(JSFXObject  pObject) : CJS_Object(pObject){};

-	virtual ~CJS_Report(){};

-

-public:

-	DECLARE_JS_CLASS(CJS_Report);

-

-	JS_STATIC_METHOD(save, Report)

-	JS_STATIC_METHOD(writeText, Report);

-};

-

-#endif //_REPORT_H_

-

+// 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 _REPORT_H_
+#define _REPORT_H_
+
+class Report : public CJS_EmbedObj
+{
+public:
+	Report(CJS_Object * pJSObject);
+	virtual ~Report();
+
+public:
+	FX_BOOL save(OBJ_METHOD_PARAMS);
+	FX_BOOL writeText(OBJ_METHOD_PARAMS);
+};
+
+class CJS_Report : public CJS_Object
+{
+public:
+	CJS_Report(JSFXObject  pObject) : CJS_Object(pObject){};
+	virtual ~CJS_Report(){};
+
+public:
+	DECLARE_JS_CLASS(CJS_Report);
+
+	JS_STATIC_METHOD(save, Report)
+	JS_STATIC_METHOD(writeText, Report);
+};
+
+#endif //_REPORT_H_
+
diff --git a/fpdfsdk/include/javascript/resource.h b/fpdfsdk/include/javascript/resource.h
index 0b7668e..710cc50 100644
--- a/fpdfsdk/include/javascript/resource.h
+++ b/fpdfsdk/include/javascript/resource.h
@@ -1,110 +1,110 @@
-// 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

-

-#define IDD_JS_MSGBOX                   25600

-#define IDD_RESPONSE                    25601

-#define IDC_JS_MSG_TEXT                 25602

-#define ID_JS_MSG_OK                    25603

-#define ID_JS_MSG_CANCEL                25604

-#define IDC_JS_MSG_ICON                 25605

-#define ID_JS_MSG_YES                   25606

-#define ID_JS_MSG_NO                    25607

-#define IDC_JS_QUESTION                 25608

-#define ID_JS_OK                        25609

-#define ID_JS_CANCEL                    25610

-#define IDC_JS_ANSWER                   25611

-#define IDC_JS_EDIT                     25612

-#define IDS_STRING_JSALERT              25613

-#define IDS_STRING_JSPARAMERROR         25614

-#define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615

-#define IDS_STRING_JSINPUTERROR         25616

-#define IDS_STRING_JSPARAM_TOOLONG      25617

-#define IDS_STRING_JSPARSEDATE          25618

-#define IDS_STRING_JSRANGE1             25619

-#define IDS_STRING_JSRANGE2             25620

-#define IDS_STRING_JSRANGE3             25621

-#define IDS_STRING_JSRANGE4             25622

-#define IDS_STRING_FILEOPENFAIL         25623

-#define IDS_STRING_JSATTENTION          25624

-#define IDS_STRING_JSSUBMITS            25625

-#define IDS_STRING_JSSUBMITF            25626

-#define IDS_STRING_NOTSUPPORT           25627

-#define IDS_STRING_JSBUSY               25628

-#define IDS_STRING_JSEVENT              25629

-#define IDS_STRING_RUN                  25630

-#define IDS_STRING_UNHANDLED            25631

-#define IDS_STRING_JSPRINT1             25632

-#define IDS_STRING_JSPRINT2             25633

-#define IDS_STRING_LAUNCHURL            25634

-#define IDS_JSPARAM_INCORRECT           25635

-#define IDD_JS_CONSOLE                  25636

-#define IDS_STRING_SAFEMODEL            25636

-#define IDC_EDTSCRIPT                   25637

-#define IDC_BTNCLEAR                    25638

-#define IDC_EDTOUTPUT                   25639

-#define IDC_CHECK_TIPS                  25640

-#define IDC_BTNRUN                      25641

-

-

-

-static CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT ID)

-{

-	switch(ID)

-	{                  

-	case IDS_STRING_JSALERT:

-		return L"Alert";

-	case IDS_STRING_JSPARAMERROR:

-        return L"The amount of parameters is not correct !";	

-	case IDS_STRING_JSAFNUMBER_KEYSTROKE:

-		return L"The input value is invalid.";

-	case	IDS_STRING_JSINPUTERROR:

-        return L"Input error !";

-	case	IDS_STRING_JSPARAM_TOOLONG:

-		return L"The value you are going to input is too long.";

-	case	IDS_STRING_JSPARSEDATE:

-		return L"The input string can't be parsed to a valid date time (%s).";

-	case	IDS_STRING_JSRANGE1:

-		return L"Invalid value: must be greater or equal to %s and less than or equal to %s.";	

-	case	IDS_STRING_JSRANGE2:

-		return L"Invalid value: must be greater or equal to %s.";

-	case	IDS_STRING_JSRANGE3:

-		return L"Invalid value: must be less than or equal to %s.";

-	case	IDS_STRING_JSRANGE4:

-		return L"Range Error";	

-	case	IDS_STRING_FILEOPENFAIL:

-        return L"Opening file failed.";

-	case	IDS_STRING_JSATTENTION:

-		return L"Attention";	

-	case	IDS_STRING_JSSUBMITS:

-		return L"Submit form successfully!";

-	case	IDS_STRING_JSSUBMITF:

-		return L"Submit form failed!";	

-	case	IDS_STRING_NOTSUPPORT:

-		return L"Not supported.";

-	case	IDS_STRING_JSBUSY:

-		return L"System is busy!";	

-	case	IDS_STRING_JSEVENT:

-		return L"The event of the formfield exists!";	

-	case	IDS_STRING_RUN:

-		return L"It runs successfully.";

-	case	IDS_STRING_UNHANDLED:

-		return L"An unhandled error!";

-	case	IDS_STRING_JSPRINT1:

-		return L"The second parameter can't convert to Date!";

-	case	IDS_STRING_JSPRINT2:

-		return L"The second parameter isn't a valid Date!";

-	case	IDS_STRING_LAUNCHURL:

-		return L"The Document is trying to connect to \r\n%s\r\nIf you trust the site, choose OK. If you don't trust the site, choose Cancel.";	

-	case	IDS_JSPARAM_INCORRECT:

-		return L"The parameter you inputted is incorrect!";

-	case	IDS_STRING_SAFEMODEL:

-		return L"Secure reading mode";

-	default:

-		return L"";

-

-	}

-}

-

+// 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
+
+#define IDD_JS_MSGBOX                   25600
+#define IDD_RESPONSE                    25601
+#define IDC_JS_MSG_TEXT                 25602
+#define ID_JS_MSG_OK                    25603
+#define ID_JS_MSG_CANCEL                25604
+#define IDC_JS_MSG_ICON                 25605
+#define ID_JS_MSG_YES                   25606
+#define ID_JS_MSG_NO                    25607
+#define IDC_JS_QUESTION                 25608
+#define ID_JS_OK                        25609
+#define ID_JS_CANCEL                    25610
+#define IDC_JS_ANSWER                   25611
+#define IDC_JS_EDIT                     25612
+#define IDS_STRING_JSALERT              25613
+#define IDS_STRING_JSPARAMERROR         25614
+#define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615
+#define IDS_STRING_JSINPUTERROR         25616
+#define IDS_STRING_JSPARAM_TOOLONG      25617
+#define IDS_STRING_JSPARSEDATE          25618
+#define IDS_STRING_JSRANGE1             25619
+#define IDS_STRING_JSRANGE2             25620
+#define IDS_STRING_JSRANGE3             25621
+#define IDS_STRING_JSRANGE4             25622
+#define IDS_STRING_FILEOPENFAIL         25623
+#define IDS_STRING_JSATTENTION          25624
+#define IDS_STRING_JSSUBMITS            25625
+#define IDS_STRING_JSSUBMITF            25626
+#define IDS_STRING_NOTSUPPORT           25627
+#define IDS_STRING_JSBUSY               25628
+#define IDS_STRING_JSEVENT              25629
+#define IDS_STRING_RUN                  25630
+#define IDS_STRING_UNHANDLED            25631
+#define IDS_STRING_JSPRINT1             25632
+#define IDS_STRING_JSPRINT2             25633
+#define IDS_STRING_LAUNCHURL            25634
+#define IDS_JSPARAM_INCORRECT           25635
+#define IDD_JS_CONSOLE                  25636
+#define IDS_STRING_SAFEMODEL            25636
+#define IDC_EDTSCRIPT                   25637
+#define IDC_BTNCLEAR                    25638
+#define IDC_EDTOUTPUT                   25639
+#define IDC_CHECK_TIPS                  25640
+#define IDC_BTNRUN                      25641
+
+
+
+static CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT ID)
+{
+	switch(ID)
+	{                  
+	case IDS_STRING_JSALERT:
+		return L"Alert";
+	case IDS_STRING_JSPARAMERROR:
+        return L"The amount of parameters is not correct !";	
+	case IDS_STRING_JSAFNUMBER_KEYSTROKE:
+		return L"The input value is invalid.";
+	case	IDS_STRING_JSINPUTERROR:
+        return L"Input error !";
+	case	IDS_STRING_JSPARAM_TOOLONG:
+		return L"The value you are going to input is too long.";
+	case	IDS_STRING_JSPARSEDATE:
+		return L"The input string can't be parsed to a valid date time (%s).";
+	case	IDS_STRING_JSRANGE1:
+		return L"Invalid value: must be greater or equal to %s and less than or equal to %s.";	
+	case	IDS_STRING_JSRANGE2:
+		return L"Invalid value: must be greater or equal to %s.";
+	case	IDS_STRING_JSRANGE3:
+		return L"Invalid value: must be less than or equal to %s.";
+	case	IDS_STRING_JSRANGE4:
+		return L"Range Error";	
+	case	IDS_STRING_FILEOPENFAIL:
+        return L"Opening file failed.";
+	case	IDS_STRING_JSATTENTION:
+		return L"Attention";	
+	case	IDS_STRING_JSSUBMITS:
+		return L"Submit form successfully!";
+	case	IDS_STRING_JSSUBMITF:
+		return L"Submit form failed!";	
+	case	IDS_STRING_NOTSUPPORT:
+		return L"Not supported.";
+	case	IDS_STRING_JSBUSY:
+		return L"System is busy!";	
+	case	IDS_STRING_JSEVENT:
+		return L"The event of the formfield exists!";	
+	case	IDS_STRING_RUN:
+		return L"It runs successfully.";
+	case	IDS_STRING_UNHANDLED:
+		return L"An unhandled error!";
+	case	IDS_STRING_JSPRINT1:
+		return L"The second parameter can't convert to Date!";
+	case	IDS_STRING_JSPRINT2:
+		return L"The second parameter isn't a valid Date!";
+	case	IDS_STRING_LAUNCHURL:
+		return L"The Document is trying to connect to \r\n%s\r\nIf you trust the site, choose OK. If you don't trust the site, choose Cancel.";	
+	case	IDS_JSPARAM_INCORRECT:
+		return L"The parameter you inputted is incorrect!";
+	case	IDS_STRING_SAFEMODEL:
+		return L"Secure reading mode";
+	default:
+		return L"";
+
+	}
+}
+
diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h
index 9f4efc3..14857c9 100644
--- a/fpdfsdk/include/javascript/util.h
+++ b/fpdfsdk/include/javascript/util.h
@@ -1,45 +1,45 @@
-// 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 _UTIL_H_

-#define _UTIL_H_

-

-class util : public CJS_EmbedObj

-{

-public:

-	util(CJS_Object * pJSObject);

-	virtual ~util(void);

-

-public:

-	FX_BOOL printd(OBJ_METHOD_PARAMS);

-	FX_BOOL printf(OBJ_METHOD_PARAMS);

-	FX_BOOL printx(OBJ_METHOD_PARAMS);

-	FX_BOOL scand(OBJ_METHOD_PARAMS);

-	FX_BOOL byteToChar(OBJ_METHOD_PARAMS);

-

-public:

-	static void		printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture, std::wstring &cPurpose);

-	static void		printx(const std::string &cFormat,const std::string &cSource, std::string &cPurpose);

-	static int		ParstDataType(std::wstring* sFormat);

-};

-

-class CJS_Util : public CJS_Object

-{

-public:

-	CJS_Util(JSFXObject  pObject) : CJS_Object(pObject) {};

-	virtual ~CJS_Util(void){};

-

-	DECLARE_JS_CLASS(CJS_Util);

-

-	JS_STATIC_METHOD(printd, util);

-	JS_STATIC_METHOD(printf, util);

-	JS_STATIC_METHOD(printx, util);

-	JS_STATIC_METHOD(scand, util);

-	JS_STATIC_METHOD(byteToChar, util);

-};

-

-FX_INT64 FX_atoi64(const char *nptr);

-#endif //_UTIL_H_

+// 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 _UTIL_H_
+#define _UTIL_H_
+
+class util : public CJS_EmbedObj
+{
+public:
+	util(CJS_Object * pJSObject);
+	virtual ~util(void);
+
+public:
+	FX_BOOL printd(OBJ_METHOD_PARAMS);
+	FX_BOOL printf(OBJ_METHOD_PARAMS);
+	FX_BOOL printx(OBJ_METHOD_PARAMS);
+	FX_BOOL scand(OBJ_METHOD_PARAMS);
+	FX_BOOL byteToChar(OBJ_METHOD_PARAMS);
+
+public:
+	static void		printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture, std::wstring &cPurpose);
+	static void		printx(const std::string &cFormat,const std::string &cSource, std::string &cPurpose);
+	static int		ParstDataType(std::wstring* sFormat);
+};
+
+class CJS_Util : public CJS_Object
+{
+public:
+	CJS_Util(JSFXObject  pObject) : CJS_Object(pObject) {};
+	virtual ~CJS_Util(void){};
+
+	DECLARE_JS_CLASS(CJS_Util);
+
+	JS_STATIC_METHOD(printd, util);
+	JS_STATIC_METHOD(printf, util);
+	JS_STATIC_METHOD(printx, util);
+	JS_STATIC_METHOD(scand, util);
+	JS_STATIC_METHOD(byteToChar, util);
+};
+
+FX_INT64 FX_atoi64(const char *nptr);
+#endif //_UTIL_H_
diff --git a/fpdfsdk/include/pdfwindow/IPDFWindow.h b/fpdfsdk/include/pdfwindow/IPDFWindow.h
index 53b96a6..22f023d 100644
--- a/fpdfsdk/include/pdfwindow/IPDFWindow.h
+++ b/fpdfsdk/include/pdfwindow/IPDFWindow.h
@@ -1,28 +1,28 @@
-// 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 _IPDFWINDOW_H_

-#define _IPDFWINDOW_H_

-

-#include "PWL_Wnd.h"

-#include "PWL_EditCtrl.h"

-#include "PWL_Edit.h"

-#include "PWL_ListBox.h"

-#include "PWL_ComboBox.h"

-#include "PWL_Button.h"

-#include "PWL_SpecialButton.h"

-#include "PWL_Icon.h"

-#include "PWL_Label.h"

-#include "PWL_ListCtrl.h"

-#include "PWL_Caret.h"

-#include "PWL_ScrollBar.h"

-#include "PWL_Note.h"

-#include "PWL_IconList.h"

-#include "PWL_FontMap.h"

-#include "PWL_Signature.h"

-#include "PWL_Utils.h"

-

-#endif //_IPDFWINDOW_H_

+// 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 _IPDFWINDOW_H_
+#define _IPDFWINDOW_H_
+
+#include "PWL_Wnd.h"
+#include "PWL_EditCtrl.h"
+#include "PWL_Edit.h"
+#include "PWL_ListBox.h"
+#include "PWL_ComboBox.h"
+#include "PWL_Button.h"
+#include "PWL_SpecialButton.h"
+#include "PWL_Icon.h"
+#include "PWL_Label.h"
+#include "PWL_ListCtrl.h"
+#include "PWL_Caret.h"
+#include "PWL_ScrollBar.h"
+#include "PWL_Note.h"
+#include "PWL_IconList.h"
+#include "PWL_FontMap.h"
+#include "PWL_Signature.h"
+#include "PWL_Utils.h"
+
+#endif //_IPDFWINDOW_H_
diff --git a/fpdfsdk/include/pdfwindow/PDFWindow.h b/fpdfsdk/include/pdfwindow/PDFWindow.h
index 22703e1..a83be41 100644
--- a/fpdfsdk/include/pdfwindow/PDFWindow.h
+++ b/fpdfsdk/include/pdfwindow/PDFWindow.h
@@ -1,28 +1,28 @@
-// 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 _PDFWINDOW_H_

-#define _PDFWINDOW_H_

-

-// #define VC_EXTRALEAN

-// #include <afxext.h>

-// #include <afxcmn.h>

-

-#ifndef _INC_PDFAPI

-	#define _INC_PDFAPI

- 

-	#include "../../../core/include/fpdfapi/fpdf_module.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 

-	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 

-	#include "../../../core/include/fxcrt/fx_xml.h" 

-

-	#include "../fpdf_fwlevent.h"

-	#include "../fx_systemhandler.h"

-#endif

-

-#include "../fxedit/fx_edit.h"

-#endif

-

+// 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 _PDFWINDOW_H_
+#define _PDFWINDOW_H_
+
+// #define VC_EXTRALEAN
+// #include <afxext.h>
+// #include <afxcmn.h>
+
+#ifndef _INC_PDFAPI
+	#define _INC_PDFAPI
+ 
+	#include "../../../core/include/fpdfapi/fpdf_module.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_doc.h" 
+	#include "../../../core/include/fpdfdoc/fpdf_vt.h" 
+	#include "../../../core/include/fxcrt/fx_xml.h" 
+
+	#include "../fpdf_fwlevent.h"
+	#include "../fx_systemhandler.h"
+#endif
+
+#include "../fxedit/fx_edit.h"
+#endif
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Button.h b/fpdfsdk/include/pdfwindow/PWL_Button.h
index 202a0d1..8416c4d 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Button.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Button.h
@@ -1,28 +1,28 @@
-// 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 _PWL_BUTTON_H_

-#define _PWL_BUTTON_H_

-

-class PWL_CLASS CPWL_Button : public CPWL_Wnd  

-{

-public:

-	CPWL_Button();

-	virtual ~CPWL_Button();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual void				OnCreate(PWL_CREATEPARAM & cp);

-

-	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-

-protected:

-	FX_BOOL						m_bMouseDown;	

-};

-

-#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)

-

+// 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 _PWL_BUTTON_H_
+#define _PWL_BUTTON_H_
+
+class PWL_CLASS CPWL_Button : public CPWL_Wnd  
+{
+public:
+	CPWL_Button();
+	virtual ~CPWL_Button();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual void				OnCreate(PWL_CREATEPARAM & cp);
+
+	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+
+protected:
+	FX_BOOL						m_bMouseDown;	
+};
+
+#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h
index 4586d47..600e509 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Caret.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h
@@ -1,58 +1,58 @@
-// 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 _PWL_CARET_H_

-#define _PWL_CARET_H_

-

-struct PWL_CARET_INFO

-{

-public:

-	PWL_CARET_INFO() : bVisible(FALSE), ptHead(0,0), ptFoot(0,0)

-	{		

-	}

-

-	FX_BOOL						bVisible;

-	CPDF_Point					ptHead;

-	CPDF_Point					ptFoot;

-};

-

-

-class CPWL_Caret : public CPWL_Wnd  

-{

-public:

-	CPWL_Caret();

-	virtual ~CPWL_Caret();

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual void				InvalidateRect(CPDF_Rect * pRect = NULL);

-

-	virtual void				SetVisible(FX_BOOL bVisible) {}

-

-	virtual	void				TimerProc();

-

-	void						SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);	

-	CFX_ByteString				GetCaretAppearanceStream(const CPDF_Point & ptOffset);

-

-private:

-	void						GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset);

-	CPDF_Rect					GetCaretRect() const;

-

-	FX_BOOL						m_bFlash;

-	CPDF_Point					m_ptHead;

-	CPDF_Point					m_ptFoot;

-	FX_FLOAT					m_fWidth;

-	FX_INT32						m_nDelay;

-

-public:

-	void						SetInvalidRect(CPDF_Rect rc) {m_rcInvalid = rc;}

-private:

-	CPDF_Rect					m_rcInvalid;

-};

-

-#endif // !defined(AFX_PWL_CARET_H__6A729612_4173_4B65_BCAB_7C6C850ECA47__INCLUDED_)

-

+// 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 _PWL_CARET_H_
+#define _PWL_CARET_H_
+
+struct PWL_CARET_INFO
+{
+public:
+	PWL_CARET_INFO() : bVisible(FALSE), ptHead(0,0), ptFoot(0,0)
+	{		
+	}
+
+	FX_BOOL						bVisible;
+	CPDF_Point					ptHead;
+	CPDF_Point					ptFoot;
+};
+
+
+class CPWL_Caret : public CPWL_Wnd  
+{
+public:
+	CPWL_Caret();
+	virtual ~CPWL_Caret();
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual void				InvalidateRect(CPDF_Rect * pRect = NULL);
+
+	virtual void				SetVisible(FX_BOOL bVisible) {}
+
+	virtual	void				TimerProc();
+
+	void						SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);	
+	CFX_ByteString				GetCaretAppearanceStream(const CPDF_Point & ptOffset);
+
+private:
+	void						GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset);
+	CPDF_Rect					GetCaretRect() const;
+
+	FX_BOOL						m_bFlash;
+	CPDF_Point					m_ptHead;
+	CPDF_Point					m_ptFoot;
+	FX_FLOAT					m_fWidth;
+	FX_INT32						m_nDelay;
+
+public:
+	void						SetInvalidRect(CPDF_Rect rc) {m_rcInvalid = rc;}
+private:
+	CPDF_Rect					m_rcInvalid;
+};
+
+#endif // !defined(AFX_PWL_CARET_H__6A729612_4173_4B65_BCAB_7C6C850ECA47__INCLUDED_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
index f64b636..5b91fe4 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
@@ -1,115 +1,115 @@
-// 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 _PWL_COMBOBOX_H_

-#define _PWL_COMBOBOX_H_

-

-class CPWL_CBEdit : public CPWL_Edit

-{

-public:

-	CPWL_CBEdit(){};

-	virtual ~CPWL_CBEdit(){};

-};

-

-class PWL_CLASS CPWL_CBListBox : public CPWL_ListBox

-{

-public:

-	CPWL_CBListBox(){};

-	virtual ~CPWL_CBListBox(){};

-

-public:

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-

-	virtual FX_BOOL				OnKeyDown(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);

-	virtual FX_BOOL				OnChar(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);

-};

-

-#define PWL_COMBOBOX_BUTTON_WIDTH		13

-

-class CPWL_CBButton : public CPWL_Wnd

-{

-public:

-	CPWL_CBButton(){};

-	virtual ~CPWL_CBButton(){};

-

-public:

-	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-

-};

-

-class PWL_CLASS CPWL_ComboBox : public CPWL_Wnd  

-{

-public:

-	CPWL_ComboBox();

-	operator CPWL_Edit* ()		{return m_pEdit;}

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual void				OnCreate(PWL_CREATEPARAM & cp);

-

-	virtual FX_BOOL				OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);	

-	virtual FX_BOOL				OnChar(FX_WORD nChar, FX_DWORD nFlag);

-

-	virtual void				OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-	virtual void				CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual void				RePosChildWnd();

-

-	virtual CPDF_Rect			GetFocusRect() const;

-	

-	virtual void				SetFocus();

-	virtual void				KillFocus();

-

-	FX_BOOL						IsModified() const;

-

-public:	

-	void						SetFillerNotify(IPWL_Filler_Notify* pNotify);

-

-	CFX_WideString				GetText() const;

-	void						SetText(FX_LPCWSTR text);

-

-	void						AddString(FX_LPCWSTR string);

-	FX_INT32					GetSelect() const;

-	void						SetSelect(FX_INT32 nItemIndex);

-

-	void						SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar);

-	void						GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;

-	void						Clear();

-	void						SelectAll();

-	FX_BOOL						IsPopup() const;

-

-	void						SetSelectText();

-

-private:	

-	void						CreateEdit(const PWL_CREATEPARAM & cp);

-	void						CreateButton(const PWL_CREATEPARAM & cp);

-	void						CreateListBox(const PWL_CREATEPARAM & cp);

-

-	void						SetPopup(FX_BOOL bPopup);

-	

-private:

-	CPWL_CBEdit*				m_pEdit;

-	CPWL_CBButton*				m_pButton;

-	CPWL_CBListBox*				m_pList;

-

-	FX_BOOL						m_bPopup;

-	CPDF_Rect					m_rcOldWindow;

-	FX_INT32					m_nPopupWhere;

-	FX_INT32					m_nSelectItem;

-	IPWL_Filler_Notify*			m_pFillerNotify;

-

-public:

-	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}

-private:

-	void*							m_pFormFiller;

-};

-

-#endif // !defined(AFX_PWL_COMBOBOX_H__9D6645F8_64AA_4806_94E8_95FDEDD39C17__INCLUDED_)

-

+// 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 _PWL_COMBOBOX_H_
+#define _PWL_COMBOBOX_H_
+
+class CPWL_CBEdit : public CPWL_Edit
+{
+public:
+	CPWL_CBEdit(){};
+	virtual ~CPWL_CBEdit(){};
+};
+
+class PWL_CLASS CPWL_CBListBox : public CPWL_ListBox
+{
+public:
+	CPWL_CBListBox(){};
+	virtual ~CPWL_CBListBox(){};
+
+public:
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+
+	virtual FX_BOOL				OnKeyDown(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
+	virtual FX_BOOL				OnChar(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
+};
+
+#define PWL_COMBOBOX_BUTTON_WIDTH		13
+
+class CPWL_CBButton : public CPWL_Wnd
+{
+public:
+	CPWL_CBButton(){};
+	virtual ~CPWL_CBButton(){};
+
+public:
+	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+
+};
+
+class PWL_CLASS CPWL_ComboBox : public CPWL_Wnd  
+{
+public:
+	CPWL_ComboBox();
+	operator CPWL_Edit* ()		{return m_pEdit;}
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual void				OnCreate(PWL_CREATEPARAM & cp);
+
+	virtual FX_BOOL				OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);	
+	virtual FX_BOOL				OnChar(FX_WORD nChar, FX_DWORD nFlag);
+
+	virtual void				OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+	virtual void				CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual void				RePosChildWnd();
+
+	virtual CPDF_Rect			GetFocusRect() const;
+	
+	virtual void				SetFocus();
+	virtual void				KillFocus();
+
+	FX_BOOL						IsModified() const;
+
+public:	
+	void						SetFillerNotify(IPWL_Filler_Notify* pNotify);
+
+	CFX_WideString				GetText() const;
+	void						SetText(FX_LPCWSTR text);
+
+	void						AddString(FX_LPCWSTR string);
+	FX_INT32					GetSelect() const;
+	void						SetSelect(FX_INT32 nItemIndex);
+
+	void						SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
+	void						GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;
+	void						Clear();
+	void						SelectAll();
+	FX_BOOL						IsPopup() const;
+
+	void						SetSelectText();
+
+private:	
+	void						CreateEdit(const PWL_CREATEPARAM & cp);
+	void						CreateButton(const PWL_CREATEPARAM & cp);
+	void						CreateListBox(const PWL_CREATEPARAM & cp);
+
+	void						SetPopup(FX_BOOL bPopup);
+	
+private:
+	CPWL_CBEdit*				m_pEdit;
+	CPWL_CBButton*				m_pButton;
+	CPWL_CBListBox*				m_pList;
+
+	FX_BOOL						m_bPopup;
+	CPDF_Rect					m_rcOldWindow;
+	FX_INT32					m_nPopupWhere;
+	FX_INT32					m_nSelectItem;
+	IPWL_Filler_Notify*			m_pFillerNotify;
+
+public:
+	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}
+private:
+	void*							m_pFormFiller;
+};
+
+#endif // !defined(AFX_PWL_COMBOBOX_H__9D6645F8_64AA_4806_94E8_95FDEDD39C17__INCLUDED_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h
index 71f6756..d86cb77 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h
@@ -1,138 +1,138 @@
-// 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 _PWL_EDIT_H_

-#define _PWL_EDIT_H_

-

-class IPWL_Filler_Notify;

-class CPWL_Edit;

-class IPWL_SpellCheck;

-

-class IPWL_Filler_Notify

-{

-public:

-	virtual void					QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, 

-										FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)

-	virtual void					OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,

-										CFX_WideString & strChange, const CFX_WideString& strChangeEx, 

-										int nSelStart, int nSelEnd,

-										FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;

-	virtual void					OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;

-};

-

-class PWL_CLASS CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify

-{

-public:

-	CPWL_Edit();

-	virtual ~CPWL_Edit();

-

-public:

-	virtual CFX_ByteString			GetClassName() const;

-	virtual void					OnDestroy();

-	virtual void					OnCreated();

-	virtual void					RePosChildWnd();

-	virtual CPDF_Rect				GetClientRect() const;

-

-	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);

-

-	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);

-

-	virtual CPDF_Rect				GetFocusRect() const;

-

-public:		

-	void							SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE);	//0:left 1:right 2:middle 

-	void							SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE);	//0:top 1:bottom 2:center

-

-	void							SetCharArray(FX_INT32 nCharArray);

-	void							SetLimitChar(FX_INT32 nLimitChar);

-

-	void							SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE);

-	void							SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);

-

-	void							SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);

-

-	void							EnableSpellCheck(FX_BOOL bEnabled);

-

-	FX_BOOL							CanSelectAll() const;

-	FX_BOOL							CanClear() const;

-	FX_BOOL							CanCopy() const;

-	FX_BOOL							CanCut() const;

-	FX_BOOL							CanPaste() const;

-

-	virtual void					CopyText();

-	virtual void					PasteText();

-	virtual void 					CutText();

-

-	virtual void					SetText(FX_LPCWSTR csText);

-	void							ReplaceSel(FX_LPCWSTR csText);

-

-	CFX_ByteString					GetTextAppearanceStream(const CPDF_Point & ptOffset) const;

-	CFX_ByteString					GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;	

-	CFX_ByteString					GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;

-

-	FX_BOOL							IsTextFull() const;	

-

-	static FX_FLOAT					GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray);

-

-	void							SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}

-

-	void							GeneratePageObjects(CPDF_PageObjects* pPageObjects, 

-										const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);

-	void							GeneratePageObjects(CPDF_PageObjects* pPageObjects, 

-										const CPDF_Point& ptOffset);

-

-protected:

-	virtual void					OnSetFocus();

-	virtual void					OnKillFocus();

-

-protected:

-	virtual void					OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);

-	virtual void					OnAddUndo(IFX_Edit_UndoItem* pUndoItem);

-

-private:	

-	CPVT_WordRange					GetSelectWordRange() const;

-	virtual void					ShowVScrollBar(FX_BOOL bShow);

-	FX_BOOL							IsVScrollBarVisible() const;

-	void							SetParamByFlag();

-

-	FX_FLOAT						GetCharArrayAutoFontSize(FX_INT32 nCharArray);

-	CPDF_Point						GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);

-

-	CPVT_WordRange					CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);

-	CPVT_WordRange					GetLatinWordsRange(const CPDF_Point & point) const;

-	CPVT_WordRange					GetLatinWordsRange(const CPVT_WordPlace & place) const;

-	CPVT_WordRange					GetArabicWordsRange(const CPVT_WordPlace & place) const;

-	CPVT_WordRange					GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;

-

-	void							AjustArabicWords(const CPVT_WordRange& wr);

-public:

-	FX_BOOL							IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);

-private:

-	IPWL_Filler_Notify*				m_pFillerNotify;

-	IPWL_SpellCheck*				m_pSpellCheck;

-	FX_BOOL							m_bFocus;

-	CPDF_Rect						m_rcOldWindow;

-public:

-	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}

-private:

-	void*							m_pFormFiller;

-};

-

-#endif 

-

+// 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 _PWL_EDIT_H_
+#define _PWL_EDIT_H_
+
+class IPWL_Filler_Notify;
+class CPWL_Edit;
+class IPWL_SpellCheck;
+
+class IPWL_Filler_Notify
+{
+public:
+	virtual void					QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, 
+										FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)
+	virtual void					OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
+										CFX_WideString & strChange, const CFX_WideString& strChangeEx, 
+										int nSelStart, int nSelEnd,
+										FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
+	virtual void					OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
+};
+
+class PWL_CLASS CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify
+{
+public:
+	CPWL_Edit();
+	virtual ~CPWL_Edit();
+
+public:
+	virtual CFX_ByteString			GetClassName() const;
+	virtual void					OnDestroy();
+	virtual void					OnCreated();
+	virtual void					RePosChildWnd();
+	virtual CPDF_Rect				GetClientRect() const;
+
+	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
+
+	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);
+
+	virtual CPDF_Rect				GetFocusRect() const;
+
+public:		
+	void							SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE);	//0:left 1:right 2:middle 
+	void							SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE);	//0:top 1:bottom 2:center
+
+	void							SetCharArray(FX_INT32 nCharArray);
+	void							SetLimitChar(FX_INT32 nLimitChar);
+
+	void							SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE);
+	void							SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
+
+	void							SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+
+	void							EnableSpellCheck(FX_BOOL bEnabled);
+
+	FX_BOOL							CanSelectAll() const;
+	FX_BOOL							CanClear() const;
+	FX_BOOL							CanCopy() const;
+	FX_BOOL							CanCut() const;
+	FX_BOOL							CanPaste() const;
+
+	virtual void					CopyText();
+	virtual void					PasteText();
+	virtual void 					CutText();
+
+	virtual void					SetText(FX_LPCWSTR csText);
+	void							ReplaceSel(FX_LPCWSTR csText);
+
+	CFX_ByteString					GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
+	CFX_ByteString					GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;	
+	CFX_ByteString					GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;
+
+	FX_BOOL							IsTextFull() const;	
+
+	static FX_FLOAT					GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray);
+
+	void							SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
+
+	void							GeneratePageObjects(CPDF_PageObjects* pPageObjects, 
+										const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+	void							GeneratePageObjects(CPDF_PageObjects* pPageObjects, 
+										const CPDF_Point& ptOffset);
+
+protected:
+	virtual void					OnSetFocus();
+	virtual void					OnKillFocus();
+
+protected:
+	virtual void					OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+	virtual void					OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
+
+private:	
+	CPVT_WordRange					GetSelectWordRange() const;
+	virtual void					ShowVScrollBar(FX_BOOL bShow);
+	FX_BOOL							IsVScrollBarVisible() const;
+	void							SetParamByFlag();
+
+	FX_FLOAT						GetCharArrayAutoFontSize(FX_INT32 nCharArray);
+	CPDF_Point						GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
+
+	CPVT_WordRange					CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
+	CPVT_WordRange					GetLatinWordsRange(const CPDF_Point & point) const;
+	CPVT_WordRange					GetLatinWordsRange(const CPVT_WordPlace & place) const;
+	CPVT_WordRange					GetArabicWordsRange(const CPVT_WordPlace & place) const;
+	CPVT_WordRange					GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;
+
+	void							AjustArabicWords(const CPVT_WordRange& wr);
+public:
+	FX_BOOL							IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);
+private:
+	IPWL_Filler_Notify*				m_pFillerNotify;
+	IPWL_SpellCheck*				m_pSpellCheck;
+	FX_BOOL							m_bFocus;
+	CPDF_Rect						m_rcOldWindow;
+public:
+	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}
+private:
+	void*							m_pFormFiller;
+};
+
+#endif 
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
index 3df0f4c..b13d5e1 100644
--- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
+++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
@@ -1,171 +1,171 @@
-// 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 _PWL_EDITCTRL_H_

-#define _PWL_EDITCTRL_H_

-

-enum PWL_EDIT_ALIGNFORMAT_H

-{

-	PEAH_LEFT = 0,

-	PEAH_MIDDLE,

-	PEAH_RIGHT

-};

-

-enum PWL_EDIT_ALIGNFORMAT_V

-{

-	PEAV_TOP = 0,	

-	PEAV_CENTER,

-	PEAV_BOTTOM

-};

-

-class IPWL_Edit_Notify;

-class CPWL_EditCtrl;

-class CPWL_Caret;

-class IFX_Edit;

-class CPWL_Edit;

-

-class IPWL_Edit_Notify

-{

-public:

-	//when the position of caret is changed in edit

-	virtual void					OnCaretMove(FX_INT32 x1, FX_INT32 y1, FX_INT32 x2, FX_INT32 y2) {}

-	virtual void					OnContentChange(const CPDF_Rect& rcContent){}

-	//OprType: 0 InsertWord

-	//1 InsertReturn

-	//2 BackSpace

-	//3 Delete

-	//4 Clear

-	//5 InsertText

-	//6 SetText

-	virtual void					OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}

-	virtual void					OnAddUndo(CPWL_Edit* pEdit) {}

-};

-

-class PWL_CLASS CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify

-{

-	friend class CPWL_Edit_Notify;

-

-public:

-	CPWL_EditCtrl();

-	virtual ~CPWL_EditCtrl();

-

-public:

-	virtual void					OnCreate(PWL_CREATEPARAM & cp);

-	virtual void					OnCreated();

-

-	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);	

-	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);	

-	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-	virtual void					CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual void					RePosChildWnd();	

-	virtual void					SetFontSize(FX_FLOAT fFontSize);

-	virtual FX_FLOAT				GetFontSize() const;

-	

-public:

-	virtual void					SetText(FX_LPCWSTR csText);

-

-	virtual void					CopyText();

-	virtual void					PasteText();

-	virtual void 					CutText();

-

-	CPDF_Rect						GetContentRect() const;

-	void							GetCaretPos(FX_INT32& x, FX_INT32& y) const;

-	FX_BOOL							IsModified() const;

-

-	CFX_WideString					GetText() const;

-	void							SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);

-	void							GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;

-	void							GetTextRange(const CPDF_Rect& rect, FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;

-	CFX_WideString					GetText(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;

-	void							Clear();

-	void							SelectAll();

-

-	FX_INT32						GetCaret() const;

-	void							SetCaret(FX_INT32 nPos);

-	FX_INT32						GetTotalWords() const;

-

-	void							Paint();

-

-	void							EnableRefresh(FX_BOOL bRefresh);	

-	CPDF_Point						GetScrollPos() const;

-	void							SetScrollPos(const CPDF_Point& point);

-

-	void							SetEditNotify(IPWL_Edit_Notify* pNotify) {m_pEditNotify = pNotify;}	

-

-	void							SetCharSet(FX_BYTE nCharSet){m_nCharSet = nCharSet;}

-	FX_INT32						GetCharSet() const;

-

-	void							SetCodePage(FX_INT32 nCodePage){m_nCodePage = nCodePage;}

-	FX_INT32						GetCodePage() const {return m_nCodePage;}

-

-	CPDF_Font *						GetCaretFont() const;

-	FX_FLOAT						GetCaretFontSize() const;

-

-	FX_BOOL							CanUndo() const;

-	FX_BOOL							CanRedo() const;

-	void							Redo();

-	void							Undo();

-

-	void							SetReadyToInput();

-protected:

-	virtual void					ShowVScrollBar(FX_BOOL bShow);

-

-	virtual void					InsertWord(FX_WORD word, FX_INT32 nCharset);

-	virtual void					InsertReturn();

-	virtual void					InsertText(FX_LPCWSTR csText);

-

-	virtual void					SetCursor();

-	FX_BOOL							IsWndHorV();

-

-	void							Delete();

-	void							Backspace();

-

-protected:

-	void							GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const;

-	void							SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);

-	

-	void							SetEditCaret(FX_BOOL bVisible);

-

-protected:

-	virtual void					IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}

-	virtual void					IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep);

-	virtual void					IOnSetScrollPosX(FX_FLOAT fx){}

-	virtual void					IOnSetScrollPosY(FX_FLOAT fy);

-	virtual void					IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);

-	virtual void					IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);

-	virtual void					IOnContentChange(const CPDF_Rect& rcContent);

-	virtual void					IOnInvalidateRect(CPDF_Rect * pRect);

-

-private:

-	void							CreateEditCaret(const PWL_CREATEPARAM & cp);

-

-protected:

-	IFX_Edit*						m_pEdit;

-	CPWL_Caret*						m_pEditCaret;

-	FX_BOOL							m_bMouseDown;

-	IPWL_Edit_Notify*				m_pEditNotify;	

-

-private:

-	FX_INT32						m_nCharSet;

-	FX_INT32						m_nCodePage;

-};

-

-#endif

-

+// 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 _PWL_EDITCTRL_H_
+#define _PWL_EDITCTRL_H_
+
+enum PWL_EDIT_ALIGNFORMAT_H
+{
+	PEAH_LEFT = 0,
+	PEAH_MIDDLE,
+	PEAH_RIGHT
+};
+
+enum PWL_EDIT_ALIGNFORMAT_V
+{
+	PEAV_TOP = 0,	
+	PEAV_CENTER,
+	PEAV_BOTTOM
+};
+
+class IPWL_Edit_Notify;
+class CPWL_EditCtrl;
+class CPWL_Caret;
+class IFX_Edit;
+class CPWL_Edit;
+
+class IPWL_Edit_Notify
+{
+public:
+	//when the position of caret is changed in edit
+	virtual void					OnCaretMove(FX_INT32 x1, FX_INT32 y1, FX_INT32 x2, FX_INT32 y2) {}
+	virtual void					OnContentChange(const CPDF_Rect& rcContent){}
+	//OprType: 0 InsertWord
+	//1 InsertReturn
+	//2 BackSpace
+	//3 Delete
+	//4 Clear
+	//5 InsertText
+	//6 SetText
+	virtual void					OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
+	virtual void					OnAddUndo(CPWL_Edit* pEdit) {}
+};
+
+class PWL_CLASS CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify
+{
+	friend class CPWL_Edit_Notify;
+
+public:
+	CPWL_EditCtrl();
+	virtual ~CPWL_EditCtrl();
+
+public:
+	virtual void					OnCreate(PWL_CREATEPARAM & cp);
+	virtual void					OnCreated();
+
+	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);	
+	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);	
+	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+	virtual void					CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual void					RePosChildWnd();	
+	virtual void					SetFontSize(FX_FLOAT fFontSize);
+	virtual FX_FLOAT				GetFontSize() const;
+	
+public:
+	virtual void					SetText(FX_LPCWSTR csText);
+
+	virtual void					CopyText();
+	virtual void					PasteText();
+	virtual void 					CutText();
+
+	CPDF_Rect						GetContentRect() const;
+	void							GetCaretPos(FX_INT32& x, FX_INT32& y) const;
+	FX_BOOL							IsModified() const;
+
+	CFX_WideString					GetText() const;
+	void							SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
+	void							GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;
+	void							GetTextRange(const CPDF_Rect& rect, FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
+	CFX_WideString					GetText(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
+	void							Clear();
+	void							SelectAll();
+
+	FX_INT32						GetCaret() const;
+	void							SetCaret(FX_INT32 nPos);
+	FX_INT32						GetTotalWords() const;
+
+	void							Paint();
+
+	void							EnableRefresh(FX_BOOL bRefresh);	
+	CPDF_Point						GetScrollPos() const;
+	void							SetScrollPos(const CPDF_Point& point);
+
+	void							SetEditNotify(IPWL_Edit_Notify* pNotify) {m_pEditNotify = pNotify;}	
+
+	void							SetCharSet(FX_BYTE nCharSet){m_nCharSet = nCharSet;}
+	FX_INT32						GetCharSet() const;
+
+	void							SetCodePage(FX_INT32 nCodePage){m_nCodePage = nCodePage;}
+	FX_INT32						GetCodePage() const {return m_nCodePage;}
+
+	CPDF_Font *						GetCaretFont() const;
+	FX_FLOAT						GetCaretFontSize() const;
+
+	FX_BOOL							CanUndo() const;
+	FX_BOOL							CanRedo() const;
+	void							Redo();
+	void							Undo();
+
+	void							SetReadyToInput();
+protected:
+	virtual void					ShowVScrollBar(FX_BOOL bShow);
+
+	virtual void					InsertWord(FX_WORD word, FX_INT32 nCharset);
+	virtual void					InsertReturn();
+	virtual void					InsertText(FX_LPCWSTR csText);
+
+	virtual void					SetCursor();
+	FX_BOOL							IsWndHorV();
+
+	void							Delete();
+	void							Backspace();
+
+protected:
+	void							GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const;
+	void							SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);
+	
+	void							SetEditCaret(FX_BOOL bVisible);
+
+protected:
+	virtual void					IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
+	virtual void					IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
+	virtual void					IOnSetScrollPosX(FX_FLOAT fx){}
+	virtual void					IOnSetScrollPosY(FX_FLOAT fy);
+	virtual void					IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
+	virtual void					IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
+	virtual void					IOnContentChange(const CPDF_Rect& rcContent);
+	virtual void					IOnInvalidateRect(CPDF_Rect * pRect);
+
+private:
+	void							CreateEditCaret(const PWL_CREATEPARAM & cp);
+
+protected:
+	IFX_Edit*						m_pEdit;
+	CPWL_Caret*						m_pEditCaret;
+	FX_BOOL							m_bMouseDown;
+	IPWL_Edit_Notify*				m_pEditNotify;	
+
+private:
+	FX_INT32						m_nCharSet;
+	FX_INT32						m_nCodePage;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
index 858bb2a..b3da533 100644
--- a/fpdfsdk/include/pdfwindow/PWL_FontMap.h
+++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
@@ -1,137 +1,137 @@
-// 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 _PWL_FONTMAP_H_

-#define _PWL_FONTMAP_H_

-

-struct CPWL_FontMap_Data

-{

-	CPDF_Font*			pFont;

-	FX_INT32			nCharset;

-	CFX_ByteString		sFontName;

-};

-

-struct CPWL_FontMap_Native

-{

-	FX_INT32			nCharset;

-	CFX_ByteString		sFontName;

-};

-

-#ifndef ANSI_CHARSET

-

-#define ANSI_CHARSET            0

-#define DEFAULT_CHARSET         1

-#define SYMBOL_CHARSET          2

-#define SHIFTJIS_CHARSET        128

-#define HANGEUL_CHARSET         129

-#define HANGUL_CHARSET          129

-#define GB2312_CHARSET          134

-#define CHINESEBIG5_CHARSET     136

-#define OEM_CHARSET             255

-#define JOHAB_CHARSET           130

-#define HEBREW_CHARSET          177

-#define ARABIC_CHARSET          178

-#define GREEK_CHARSET           161

-#define TURKISH_CHARSET         162

-#define VIETNAMESE_CHARSET      163

-#define THAI_CHARSET            222

-#define EASTEUROPE_CHARSET      238

-#define RUSSIAN_CHARSET         204

-#define BALTIC_CHARSET          186

-

-#endif

-

-#ifndef PWL_CLASS

-

-	#ifdef FX_READER_DLL

-		#define PWL_CLASS		__declspec(dllexport)

-	#else

-		#define PWL_CLASS

-	#endif

-#endif

-

-class IFX_SystemHandler;

-class PWL_CLASS CPWL_FontMap : public IFX_Edit_FontMap

-{

-public:

-	CPWL_FontMap(IFX_SystemHandler* pSystemHandler);

-	virtual ~CPWL_FontMap();

-

-	virtual CPDF_Font*							GetPDFFont(FX_INT32 nFontIndex);

-	virtual CFX_ByteString						GetPDFFontAlias(FX_INT32 nFontIndex);

-	virtual FX_INT32							GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT32 nFontIndex);

-	virtual FX_INT32							CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word);

-	virtual FX_INT32							CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);

-

-public:

-	virtual void								Initial(FX_LPCSTR fontname = NULL);

-	void										SetSystemHandler(IFX_SystemHandler* pSystemHandler);

-

-	FX_INT32									GetFontMapCount() const;

-	const CPWL_FontMap_Data*					GetFontMapData(FX_INT32 nIndex) const;

-

-public:

-	static FX_INT32								GetNativeCharset();

-	CFX_ByteString								GetNativeFontName(FX_INT32 nCharset);

-

-	static CFX_ByteString						GetDefaultFontByCharset(FX_INT32 nCharset);

-

-	CPDF_Font*									AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset);

-	static FX_BOOL								IsStandardFont(const CFX_ByteString& sFontName);							

-	CPDF_Font*									AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);

-	CPDF_Font*									AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, 

-													FX_BYTE nCharset);

-

-protected:

-	virtual CPDF_Font*							FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);

-	virtual void								AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);

-	FX_BOOL										KnowWord(FX_INT32 nFontIndex, FX_WORD word);

-

-	virtual CPDF_Document*						GetDocument();

-

-	void										Empty();

-	FX_INT32									GetFontIndex(const CFX_ByteString& sFontName, FX_INT32 nCharset, FX_BOOL bFind);

-	FX_INT32									GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset);

-	FX_INT32									AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, FX_INT32 nCharset = DEFAULT_CHARSET);

-

-	CFX_ByteString								EncodeFontAlias(const CFX_ByteString& sFontName, FX_INT32 nCharset);

-	CFX_ByteString								EncodeFontAlias(const CFX_ByteString& sFontName);

-

-private:

-	CFX_ByteString								GetFontName(FX_INT32 nFontIndex);

-	FX_INT32									FindFont(const CFX_ByteString& sFontName, FX_INT32 nCharset = DEFAULT_CHARSET);

-

-	CFX_ByteString								GetNativeFont(FX_INT32 nCharset);

-

-public:

-	struct CharsetFontMap {

-		FX_INT32								charset;

-		const char*								fontname;

-	};

-	static const CharsetFontMap					defaultTTFMap[];

-

-protected:

-	CFX_ArrayTemplate<CPWL_FontMap_Data*>		m_aData;

-	CFX_ArrayTemplate<CPWL_FontMap_Native*>		m_aNativeFont;

-

-private:

-	CPDF_Document*								m_pPDFDoc;

-	IFX_SystemHandler*							m_pSystemHandler;

-};

-

-class PWL_CLASS CPWL_DocFontMap : public CPWL_FontMap

-{

-public:

-	CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc);

-	virtual ~CPWL_DocFontMap();

-

-	virtual CPDF_Document*						GetDocument();

-

-private:

-	CPDF_Document*								m_pAttachedDoc;

-};

-

-#endif

+// 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 _PWL_FONTMAP_H_
+#define _PWL_FONTMAP_H_
+
+struct CPWL_FontMap_Data
+{
+	CPDF_Font*			pFont;
+	FX_INT32			nCharset;
+	CFX_ByteString		sFontName;
+};
+
+struct CPWL_FontMap_Native
+{
+	FX_INT32			nCharset;
+	CFX_ByteString		sFontName;
+};
+
+#ifndef ANSI_CHARSET
+
+#define ANSI_CHARSET            0
+#define DEFAULT_CHARSET         1
+#define SYMBOL_CHARSET          2
+#define SHIFTJIS_CHARSET        128
+#define HANGEUL_CHARSET         129
+#define HANGUL_CHARSET          129
+#define GB2312_CHARSET          134
+#define CHINESEBIG5_CHARSET     136
+#define OEM_CHARSET             255
+#define JOHAB_CHARSET           130
+#define HEBREW_CHARSET          177
+#define ARABIC_CHARSET          178
+#define GREEK_CHARSET           161
+#define TURKISH_CHARSET         162
+#define VIETNAMESE_CHARSET      163
+#define THAI_CHARSET            222
+#define EASTEUROPE_CHARSET      238
+#define RUSSIAN_CHARSET         204
+#define BALTIC_CHARSET          186
+
+#endif
+
+#ifndef PWL_CLASS
+
+	#ifdef FX_READER_DLL
+		#define PWL_CLASS		__declspec(dllexport)
+	#else
+		#define PWL_CLASS
+	#endif
+#endif
+
+class IFX_SystemHandler;
+class PWL_CLASS CPWL_FontMap : public IFX_Edit_FontMap
+{
+public:
+	CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
+	virtual ~CPWL_FontMap();
+
+	virtual CPDF_Font*							GetPDFFont(FX_INT32 nFontIndex);
+	virtual CFX_ByteString						GetPDFFontAlias(FX_INT32 nFontIndex);
+	virtual FX_INT32							GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT32 nFontIndex);
+	virtual FX_INT32							CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word);
+	virtual FX_INT32							CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);
+
+public:
+	virtual void								Initial(FX_LPCSTR fontname = NULL);
+	void										SetSystemHandler(IFX_SystemHandler* pSystemHandler);
+
+	FX_INT32									GetFontMapCount() const;
+	const CPWL_FontMap_Data*					GetFontMapData(FX_INT32 nIndex) const;
+
+public:
+	static FX_INT32								GetNativeCharset();
+	CFX_ByteString								GetNativeFontName(FX_INT32 nCharset);
+
+	static CFX_ByteString						GetDefaultFontByCharset(FX_INT32 nCharset);
+
+	CPDF_Font*									AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset);
+	static FX_BOOL								IsStandardFont(const CFX_ByteString& sFontName);							
+	CPDF_Font*									AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
+	CPDF_Font*									AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, 
+													FX_BYTE nCharset);
+
+protected:
+	virtual CPDF_Font*							FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
+	virtual void								AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+	FX_BOOL										KnowWord(FX_INT32 nFontIndex, FX_WORD word);
+
+	virtual CPDF_Document*						GetDocument();
+
+	void										Empty();
+	FX_INT32									GetFontIndex(const CFX_ByteString& sFontName, FX_INT32 nCharset, FX_BOOL bFind);
+	FX_INT32									GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset);
+	FX_INT32									AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, FX_INT32 nCharset = DEFAULT_CHARSET);
+
+	CFX_ByteString								EncodeFontAlias(const CFX_ByteString& sFontName, FX_INT32 nCharset);
+	CFX_ByteString								EncodeFontAlias(const CFX_ByteString& sFontName);
+
+private:
+	CFX_ByteString								GetFontName(FX_INT32 nFontIndex);
+	FX_INT32									FindFont(const CFX_ByteString& sFontName, FX_INT32 nCharset = DEFAULT_CHARSET);
+
+	CFX_ByteString								GetNativeFont(FX_INT32 nCharset);
+
+public:
+	struct CharsetFontMap {
+		FX_INT32								charset;
+		const char*								fontname;
+	};
+	static const CharsetFontMap					defaultTTFMap[];
+
+protected:
+	CFX_ArrayTemplate<CPWL_FontMap_Data*>		m_aData;
+	CFX_ArrayTemplate<CPWL_FontMap_Native*>		m_aNativeFont;
+
+private:
+	CPDF_Document*								m_pPDFDoc;
+	IFX_SystemHandler*							m_pSystemHandler;
+};
+
+class PWL_CLASS CPWL_DocFontMap : public CPWL_FontMap
+{
+public:
+	CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc);
+	virtual ~CPWL_DocFontMap();
+
+	virtual CPDF_Document*						GetDocument();
+
+private:
+	CPDF_Document*								m_pAttachedDoc;
+};
+
+#endif
diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h
index d6b121e..4a084fd 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Icon.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h
@@ -1,59 +1,59 @@
-// 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 _PWL_ICON_H_

-#define _PWL_ICON_H_

-

-class PWL_CLASS CPWL_Image : public CPWL_Wnd

-{

-public:

-	CPWL_Image();

-	virtual ~CPWL_Image();

-

-	virtual CFX_ByteString			GetImageAppStream();

-

-	virtual void					GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);

-	virtual void					GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);

-	virtual CPDF_Stream *			GetPDFStream();

-

-public:

-	void							SetPDFStream(CPDF_Stream* pStream);	

-	void							GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight);

-	CPDF_Matrix						GetImageMatrix();

-	CFX_ByteString					GetImageAlias();

-	void							SetImageAlias(FX_LPCSTR sImageAlias);

-

-protected:

-	CPDF_Stream*					m_pPDFStream;

-	CFX_ByteString					m_sImageAlias;

-};

-

-class PWL_CLASS CPWL_Icon : public CPWL_Image 

-{

-public:

-	CPWL_Icon();

-	virtual ~CPWL_Icon();

-

-	virtual CPDF_IconFit *			GetIconFit(){return m_pIconFit;};

-

-	virtual void					GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);

-	virtual void					GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);

-

-	FX_INT32						GetScaleMethod();

-	FX_BOOL							IsProportionalScale();

-	void							GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom);

-	FX_BOOL							GetFittingBounds();

-

-	void							SetIconFit(CPDF_IconFit * pIconFit){m_pIconFit = pIconFit;};

-

-private:

-	CPDF_IconFit *					m_pIconFit;

-};

-

-

-#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)

-

-

+// 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 _PWL_ICON_H_
+#define _PWL_ICON_H_
+
+class PWL_CLASS CPWL_Image : public CPWL_Wnd
+{
+public:
+	CPWL_Image();
+	virtual ~CPWL_Image();
+
+	virtual CFX_ByteString			GetImageAppStream();
+
+	virtual void					GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
+	virtual void					GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
+	virtual CPDF_Stream *			GetPDFStream();
+
+public:
+	void							SetPDFStream(CPDF_Stream* pStream);	
+	void							GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight);
+	CPDF_Matrix						GetImageMatrix();
+	CFX_ByteString					GetImageAlias();
+	void							SetImageAlias(FX_LPCSTR sImageAlias);
+
+protected:
+	CPDF_Stream*					m_pPDFStream;
+	CFX_ByteString					m_sImageAlias;
+};
+
+class PWL_CLASS CPWL_Icon : public CPWL_Image 
+{
+public:
+	CPWL_Icon();
+	virtual ~CPWL_Icon();
+
+	virtual CPDF_IconFit *			GetIconFit(){return m_pIconFit;};
+
+	virtual void					GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
+	virtual void					GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
+
+	FX_INT32						GetScaleMethod();
+	FX_BOOL							IsProportionalScale();
+	void							GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom);
+	FX_BOOL							GetFittingBounds();
+
+	void							SetIconFit(CPDF_IconFit * pIconFit){m_pIconFit = pIconFit;};
+
+private:
+	CPDF_IconFit *					m_pIconFit;
+};
+
+
+#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h
index e519290..f084448 100644
--- a/fpdfsdk/include/pdfwindow/PWL_IconList.h
+++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h
@@ -1,125 +1,125 @@
-// 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 _PWL_IconList_H_

-#define _PWL_IconList_H_

-

-class IPWL_IconList_Notify;

-class CPWL_IconList_Item;

-class CPWL_IconList_Content;

-class CPWL_IconList;

-class CPWL_Label;

-

-class IPWL_IconList_Notify

-{

-public:

-	virtual void						OnNoteListSelChanged(FX_INT32 nItemIndex) = 0;

-};

-

-class CPWL_IconList_Item : public CPWL_Wnd

-{

-public:

-	CPWL_IconList_Item();

-	virtual ~CPWL_IconList_Item();

-

-	virtual CFX_ByteString				GetClassName() const;

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual void						RePosChildWnd();

-

-	void								SetSelect(FX_BOOL bSelected);

-	FX_BOOL								IsSelected() const;

-	void								SetData(void* pData);

-	void								SetIcon(FX_INT32 nIconIndex);

-	void								SetText(const CFX_WideString& str);

-	void								SetIconFillColor(const CPWL_Color& color);

-	CFX_WideString						GetText() const;

-

-protected:

-	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual void						OnEnabled();

-	virtual void						OnDisabled();

-

-private:

-	FX_INT32							m_nIconIndex;

-	void*								m_pData;

-	FX_BOOL								m_bSelected;

-	CPWL_Label*							m_pText;

-	CPWL_Color							m_crIcon;

-};

-

-class CPWL_IconList_Content : public CPWL_ListCtrl

-{

-public:

-	CPWL_IconList_Content(FX_INT32 nListCount);

-	virtual ~CPWL_IconList_Content();

-

-	void								SetSelect(FX_INT32 nIndex);

-	FX_INT32							GetSelect() const;

-	void								SetNotify(IPWL_IconList_Notify* pNotify);

-	void								EnableNotify(FX_BOOL bNotify);

-	void								SetListData(FX_INT32 nItemIndex, void* pData);

-	void								SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);

-	void								SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);

-	void								SetIconFillColor(const CPWL_Color& color);

-	CFX_WideString						GetListString(FX_INT32 nItemIndex) const;

-	IPWL_IconList_Notify*				GetNotify() const;

-	void								ScrollToItem(FX_INT32 nItemIndex);

-

-protected:

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point);

-	virtual FX_BOOL						OnLButtonUp(const CPDF_Point & point);

-	virtual FX_BOOL						OnMouseMove(const CPDF_Point & point);

-	virtual FX_BOOL						OnKeyDown(FX_WORD nChar);

-

-private:

-	CPWL_IconList_Item*					GetListItem(FX_INT32 nItemIndex) const;

-	void								SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect);

-	FX_INT32							FindItemIndex(const CPDF_Point& point);

-	

-	FX_BOOL								m_nSelectIndex;

-	IPWL_IconList_Notify*				m_pNotify;

-	FX_BOOL								m_bEnableNotify;

-	FX_BOOL								m_bMouseDown;

-	FX_INT32							m_nListCount;

-};

-

-class PWL_CLASS CPWL_IconList : public CPWL_Wnd

-{

-public:

-	CPWL_IconList(FX_INT32 nListCount);

-	virtual ~CPWL_IconList();

-

-	virtual FX_BOOL						OnMouseWheel(short zDelta, const CPDF_Point & point);

-

-	void								SetSelect(FX_INT32 nIndex);

-	void								SetTopItem(FX_INT32 nIndex);

-	FX_INT32							GetSelect() const;

-	void								SetNotify(IPWL_IconList_Notify* pNotify);

-	void								EnableNotify(FX_BOOL bNotify);

-	void								SetListData(FX_INT32 nItemIndex, void* pData);

-	void								SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);

-	void								SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);

-	void								SetIconFillColor(const CPWL_Color& color);

-	CFX_WideString						GetListString(FX_INT32 nItemIndex) const;

-

-protected:

-	virtual void						OnCreated();

-	virtual void						RePosChildWnd();

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-	

-	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-private:

-	CPWL_IconList_Content*				m_pListContent;

-	FX_INT32							m_nListCount;

-};

- 

-#endif //_PWL_IconList_H_

-

-

+// 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 _PWL_IconList_H_
+#define _PWL_IconList_H_
+
+class IPWL_IconList_Notify;
+class CPWL_IconList_Item;
+class CPWL_IconList_Content;
+class CPWL_IconList;
+class CPWL_Label;
+
+class IPWL_IconList_Notify
+{
+public:
+	virtual void						OnNoteListSelChanged(FX_INT32 nItemIndex) = 0;
+};
+
+class CPWL_IconList_Item : public CPWL_Wnd
+{
+public:
+	CPWL_IconList_Item();
+	virtual ~CPWL_IconList_Item();
+
+	virtual CFX_ByteString				GetClassName() const;
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual void						RePosChildWnd();
+
+	void								SetSelect(FX_BOOL bSelected);
+	FX_BOOL								IsSelected() const;
+	void								SetData(void* pData);
+	void								SetIcon(FX_INT32 nIconIndex);
+	void								SetText(const CFX_WideString& str);
+	void								SetIconFillColor(const CPWL_Color& color);
+	CFX_WideString						GetText() const;
+
+protected:
+	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual void						OnEnabled();
+	virtual void						OnDisabled();
+
+private:
+	FX_INT32							m_nIconIndex;
+	void*								m_pData;
+	FX_BOOL								m_bSelected;
+	CPWL_Label*							m_pText;
+	CPWL_Color							m_crIcon;
+};
+
+class CPWL_IconList_Content : public CPWL_ListCtrl
+{
+public:
+	CPWL_IconList_Content(FX_INT32 nListCount);
+	virtual ~CPWL_IconList_Content();
+
+	void								SetSelect(FX_INT32 nIndex);
+	FX_INT32							GetSelect() const;
+	void								SetNotify(IPWL_IconList_Notify* pNotify);
+	void								EnableNotify(FX_BOOL bNotify);
+	void								SetListData(FX_INT32 nItemIndex, void* pData);
+	void								SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
+	void								SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
+	void								SetIconFillColor(const CPWL_Color& color);
+	CFX_WideString						GetListString(FX_INT32 nItemIndex) const;
+	IPWL_IconList_Notify*				GetNotify() const;
+	void								ScrollToItem(FX_INT32 nItemIndex);
+
+protected:
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point);
+	virtual FX_BOOL						OnLButtonUp(const CPDF_Point & point);
+	virtual FX_BOOL						OnMouseMove(const CPDF_Point & point);
+	virtual FX_BOOL						OnKeyDown(FX_WORD nChar);
+
+private:
+	CPWL_IconList_Item*					GetListItem(FX_INT32 nItemIndex) const;
+	void								SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect);
+	FX_INT32							FindItemIndex(const CPDF_Point& point);
+	
+	FX_BOOL								m_nSelectIndex;
+	IPWL_IconList_Notify*				m_pNotify;
+	FX_BOOL								m_bEnableNotify;
+	FX_BOOL								m_bMouseDown;
+	FX_INT32							m_nListCount;
+};
+
+class PWL_CLASS CPWL_IconList : public CPWL_Wnd
+{
+public:
+	CPWL_IconList(FX_INT32 nListCount);
+	virtual ~CPWL_IconList();
+
+	virtual FX_BOOL						OnMouseWheel(short zDelta, const CPDF_Point & point);
+
+	void								SetSelect(FX_INT32 nIndex);
+	void								SetTopItem(FX_INT32 nIndex);
+	FX_INT32							GetSelect() const;
+	void								SetNotify(IPWL_IconList_Notify* pNotify);
+	void								EnableNotify(FX_BOOL bNotify);
+	void								SetListData(FX_INT32 nItemIndex, void* pData);
+	void								SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
+	void								SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
+	void								SetIconFillColor(const CPWL_Color& color);
+	CFX_WideString						GetListString(FX_INT32 nItemIndex) const;
+
+protected:
+	virtual void						OnCreated();
+	virtual void						RePosChildWnd();
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+	
+	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+private:
+	CPWL_IconList_Content*				m_pListContent;
+	FX_INT32							m_nListCount;
+};
+ 
+#endif //_PWL_IconList_H_
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h
index 16bd1ae..29ea513 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Label.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Label.h
@@ -1,51 +1,51 @@
-// 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 _PWL_LABEL_H_

-#define _PWL_LABEL_H_

-

-class IFX_Edit;

-

-class PWL_CLASS CPWL_Label : public CPWL_Wnd

-{

-public:

-	CPWL_Label();

-	virtual ~CPWL_Label();

-

-public:

-	virtual CFX_ByteString			GetClassName() const;	

-	virtual void					SetFontSize(FX_FLOAT fFontSize);

-	virtual FX_FLOAT				GetFontSize() const;

-

-public:		

-	void							SetText(FX_LPCWSTR csText);

-	CFX_WideString					GetText() const;

-

-	void							SetLimitChar(FX_INT32 nLimitChar);

-	void							SetHorzScale(FX_INT32 nHorzScale);

-	void							SetCharSpace(FX_FLOAT fCharSpace);

-

-	CPDF_Rect						GetContentRect() const;	

-	FX_INT32						GetTotalWords();

-

-	CFX_ByteString					GetTextAppearanceStream(const CPDF_Point & ptOffset) const;

-

-protected:

-	virtual void					OnCreated();

-	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void					RePosChildWnd();	

-

-private:

-	void							SetParamByFlag();

-

-private:

-	IFX_Edit*						m_pEdit;

-};

-

-#endif

-

-

+// 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 _PWL_LABEL_H_
+#define _PWL_LABEL_H_
+
+class IFX_Edit;
+
+class PWL_CLASS CPWL_Label : public CPWL_Wnd
+{
+public:
+	CPWL_Label();
+	virtual ~CPWL_Label();
+
+public:
+	virtual CFX_ByteString			GetClassName() const;	
+	virtual void					SetFontSize(FX_FLOAT fFontSize);
+	virtual FX_FLOAT				GetFontSize() const;
+
+public:		
+	void							SetText(FX_LPCWSTR csText);
+	CFX_WideString					GetText() const;
+
+	void							SetLimitChar(FX_INT32 nLimitChar);
+	void							SetHorzScale(FX_INT32 nHorzScale);
+	void							SetCharSpace(FX_FLOAT fCharSpace);
+
+	CPDF_Rect						GetContentRect() const;	
+	FX_INT32						GetTotalWords();
+
+	CFX_ByteString					GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
+
+protected:
+	virtual void					OnCreated();
+	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void					RePosChildWnd();	
+
+private:
+	void							SetParamByFlag();
+
+private:
+	IFX_Edit*						m_pEdit;
+};
+
+#endif
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
index 6ef82c8..7961579 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
@@ -1,103 +1,103 @@
-// 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 _PWL_LISTBOX_H_

-#define _PWL_LISTBOX_H_

-

-class CPDF_ListCtrl;

-class CPWL_List_Notify;

-class CPWL_ListBox;

-class IPWL_Filler_Notify;

-

-class CPWL_List_Notify : public IFX_List_Notify

-{

-public:

-	CPWL_List_Notify(CPWL_ListBox * pList);

-	virtual ~CPWL_List_Notify();

-

-	void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}

-	void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 

-												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 

-												FX_FLOAT fSmallStep, FX_FLOAT fBigStep);

-	void							IOnSetScrollPosX(FX_FLOAT fx){}

-	void							IOnSetScrollPosY(FX_FLOAT fy);

-	void							IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);

-	void							IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);

-	void							IOnInvalidateRect(CPDF_Rect * pRect);

-

-private:

-	CPWL_ListBox*					m_pList;	

-};

-

-class PWL_CLASS CPWL_ListBox : public CPWL_Wnd

-{

-public:

-	CPWL_ListBox();

-	virtual ~CPWL_ListBox();

-

-	virtual CFX_ByteString			GetClassName() const;

-	virtual void					OnCreated();

-	virtual void					OnDestroy();

-	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);

-	virtual void					KillFocus();

-

-	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-	virtual void					RePosChildWnd();

-	virtual void					SetText(FX_LPCWSTR csText,FX_BOOL bRefresh = TRUE);

-	virtual CFX_WideString			GetText() const;	

-	virtual CPDF_Rect				GetFocusRect() const;

-	virtual void					SetFontSize(FX_FLOAT fFontSize);

-	virtual FX_FLOAT				GetFontSize() const;

-

-	void							OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag);

-

-	void							AddString(FX_LPCWSTR string);	

-	void							SetTopVisibleIndex(FX_INT32 nItemIndex);

-	void							ScrollToListItem(FX_INT32 nItemIndex);

-	void							ResetContent();

-	void							Reset();

-	void							Select(FX_INT32 nItemIndex);

-	void							SetCaret(FX_INT32 nItemIndex);

-	void							SetHoverSel(FX_BOOL bHoverSel);

-	

-	FX_INT32						GetCount() const;

-	FX_BOOL							IsMultipleSel() const;

-	FX_INT32						GetCaretIndex() const;

-	FX_INT32						GetCurSel() const;

-	FX_BOOL							IsItemSelected(FX_INT32 nItemIndex) const;

-	FX_INT32						GetTopVisibleIndex() const;

-	FX_INT32						FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;

-	CPDF_Rect						GetContentRect() const;	

-	FX_FLOAT						GetFirstHeight() const;

-	CPDF_Rect						GetListRect() const;

-

-	void							SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}

-

-protected:

-	IFX_List*						m_pList;

-	CPWL_List_Notify*				m_pListNotify;

-	FX_BOOL							m_bMouseDown;

-	FX_BOOL							m_bHoverSel;

-	IPWL_Filler_Notify*				m_pFillerNotify;

-public:

-	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}

-private:

-	void*							m_pFormFiller;

-};

-

-#endif // !defined(AFX_PWL_LISTBOX_H__F8C0DD72_CC3C_4806_86FB_E9D02B04A34B__INCLUDED_)

-

-

+// 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 _PWL_LISTBOX_H_
+#define _PWL_LISTBOX_H_
+
+class CPDF_ListCtrl;
+class CPWL_List_Notify;
+class CPWL_ListBox;
+class IPWL_Filler_Notify;
+
+class CPWL_List_Notify : public IFX_List_Notify
+{
+public:
+	CPWL_List_Notify(CPWL_ListBox * pList);
+	virtual ~CPWL_List_Notify();
+
+	void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
+	void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, 
+												FX_FLOAT fContentMin, FX_FLOAT fContentMax, 
+												FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
+	void							IOnSetScrollPosX(FX_FLOAT fx){}
+	void							IOnSetScrollPosY(FX_FLOAT fy);
+	void							IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
+	void							IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
+	void							IOnInvalidateRect(CPDF_Rect * pRect);
+
+private:
+	CPWL_ListBox*					m_pList;	
+};
+
+class PWL_CLASS CPWL_ListBox : public CPWL_Wnd
+{
+public:
+	CPWL_ListBox();
+	virtual ~CPWL_ListBox();
+
+	virtual CFX_ByteString			GetClassName() const;
+	virtual void					OnCreated();
+	virtual void					OnDestroy();
+	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
+	virtual void					KillFocus();
+
+	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+	virtual void					RePosChildWnd();
+	virtual void					SetText(FX_LPCWSTR csText,FX_BOOL bRefresh = TRUE);
+	virtual CFX_WideString			GetText() const;	
+	virtual CPDF_Rect				GetFocusRect() const;
+	virtual void					SetFontSize(FX_FLOAT fFontSize);
+	virtual FX_FLOAT				GetFontSize() const;
+
+	void							OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag);
+
+	void							AddString(FX_LPCWSTR string);	
+	void							SetTopVisibleIndex(FX_INT32 nItemIndex);
+	void							ScrollToListItem(FX_INT32 nItemIndex);
+	void							ResetContent();
+	void							Reset();
+	void							Select(FX_INT32 nItemIndex);
+	void							SetCaret(FX_INT32 nItemIndex);
+	void							SetHoverSel(FX_BOOL bHoverSel);
+	
+	FX_INT32						GetCount() const;
+	FX_BOOL							IsMultipleSel() const;
+	FX_INT32						GetCaretIndex() const;
+	FX_INT32						GetCurSel() const;
+	FX_BOOL							IsItemSelected(FX_INT32 nItemIndex) const;
+	FX_INT32						GetTopVisibleIndex() const;
+	FX_INT32						FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;
+	CPDF_Rect						GetContentRect() const;	
+	FX_FLOAT						GetFirstHeight() const;
+	CPDF_Rect						GetListRect() const;
+
+	void							SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
+
+protected:
+	IFX_List*						m_pList;
+	CPWL_List_Notify*				m_pListNotify;
+	FX_BOOL							m_bMouseDown;
+	FX_BOOL							m_bHoverSel;
+	IPWL_Filler_Notify*				m_pFillerNotify;
+public:
+	void							AttachFFLData(void* pData) {m_pFormFiller = pData;}
+private:
+	void*							m_pFormFiller;
+};
+
+#endif // !defined(AFX_PWL_LISTBOX_H__F8C0DD72_CC3C_4806_86FB_E9D02B04A34B__INCLUDED_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
index 3a3b922..8997296 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
@@ -1,53 +1,53 @@
-// 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 _PWL_LISTCTRL_H_

-#define _PWL_LISTCTRL_H_

-

-class CPWL_ListCtrl;

-

-class CPWL_ListCtrl : public CPWL_Wnd

-{

-public:

-	CPWL_ListCtrl();

-	virtual ~CPWL_ListCtrl();

-

-public:

-	void								SetScrollPos(const CPDF_Point& point);

-	CPDF_Point							GetScrollPos() const;

-	CPDF_Rect							GetScrollArea() const;

-	

-	void								SetItemSpace(FX_FLOAT fSpace);

-	void								SetTopSpace(FX_FLOAT fSpace);

-	void								SetBottomSpace(FX_FLOAT fSpace);

-	void								ResetFace();

-	void								ResetContent(FX_INT32 nStart);

-	FX_INT32							GetItemIndex(CPWL_Wnd* pItem);

-	FX_FLOAT							GetContentsHeight(FX_FLOAT fLimitWidth);

-

-protected:

-	virtual void						RePosChildWnd();

-	virtual void						DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-public:

-	CPDF_Point							InToOut(const CPDF_Point& point) const;

-	CPDF_Point							OutToIn(const CPDF_Point& point) const;

-	CPDF_Rect							InToOut(const CPDF_Rect& rect) const;

-	CPDF_Rect							OutToIn(const CPDF_Rect& rect) const;

-

-private:

-	void								ResetAll(FX_BOOL bMove,FX_INT32 nStart);

-

-private:

-	CPDF_Rect							m_rcContent;

-	CPDF_Point							m_ptScroll;

-	FX_FLOAT							m_fItemSpace;

-	FX_FLOAT							m_fTopSpace;

-	FX_FLOAT							m_fBottomSpace;

-};

-

-#endif

-

+// 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 _PWL_LISTCTRL_H_
+#define _PWL_LISTCTRL_H_
+
+class CPWL_ListCtrl;
+
+class CPWL_ListCtrl : public CPWL_Wnd
+{
+public:
+	CPWL_ListCtrl();
+	virtual ~CPWL_ListCtrl();
+
+public:
+	void								SetScrollPos(const CPDF_Point& point);
+	CPDF_Point							GetScrollPos() const;
+	CPDF_Rect							GetScrollArea() const;
+	
+	void								SetItemSpace(FX_FLOAT fSpace);
+	void								SetTopSpace(FX_FLOAT fSpace);
+	void								SetBottomSpace(FX_FLOAT fSpace);
+	void								ResetFace();
+	void								ResetContent(FX_INT32 nStart);
+	FX_INT32							GetItemIndex(CPWL_Wnd* pItem);
+	FX_FLOAT							GetContentsHeight(FX_FLOAT fLimitWidth);
+
+protected:
+	virtual void						RePosChildWnd();
+	virtual void						DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+public:
+	CPDF_Point							InToOut(const CPDF_Point& point) const;
+	CPDF_Point							OutToIn(const CPDF_Point& point) const;
+	CPDF_Rect							InToOut(const CPDF_Rect& rect) const;
+	CPDF_Rect							OutToIn(const CPDF_Rect& rect) const;
+
+private:
+	void								ResetAll(FX_BOOL bMove,FX_INT32 nStart);
+
+private:
+	CPDF_Rect							m_rcContent;
+	CPDF_Point							m_ptScroll;
+	FX_FLOAT							m_fItemSpace;
+	FX_FLOAT							m_fTopSpace;
+	FX_FLOAT							m_fBottomSpace;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h
index 89308e6..7cc9e04 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Note.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Note.h
@@ -1,355 +1,355 @@
-// 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 _PWL_NOTE_H_

-#define _PWL_NOTE_H_

-

-class IPWL_NoteNotify;

-class IPWL_NoteHandler;

-class IPWL_NoteItem;

-class CPWL_NoteItem;

-class CPWL_Note;

-class CPWL_Label;

-class CPWL_Edit;

-class CPWL_Note_Icon;

-class CPWL_Note_CloseBox;

-class CPWL_Note_LBBox;

-class CPWL_Note_RBBox;

-class CPWL_Note_Edit;

-class CPWL_Note_Options;

-class CPWL_Note_Contents;

-class IPopup_Note;

-

-

-class IPWL_NoteNotify

-{

-public:

-	virtual void						OnNoteMove(const FX_RECT& rtWin) = 0;

-	virtual void						OnNoteShow(FX_BOOL bShow) = 0;

-	virtual void						OnNoteActivate(FX_BOOL bActive) = 0;

-	virtual void						OnNoteClose() = 0;

-	virtual void						OnItemCreate(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnItemDelete(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnSetAuthorName(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnSetBkColor(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnSetContents(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnSetDateTime(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnSetSubjectName(IPWL_NoteItem* pItem) = 0;

-	virtual void						OnPopupMenu(FX_INT32 x, FX_INT32 y) = 0;

-	virtual void						OnPopupMenu(IPWL_NoteItem* pItem, FX_INT32 x, FX_INT32 y) = 0;

-};

-

-class IPWL_NoteHandler

-{

-public:

-	virtual void						OnNoteColorChanged(const CPWL_Color& color) = 0;

-};

-

-class IPWL_NoteItem

-{

-public:

-	virtual void						SetPrivateData(void* pData) = 0;

-	virtual void						SetBkColor(const CPWL_Color& color) = 0;

-	virtual void						SetSubjectName(const CFX_WideString& sName) = 0;

-	virtual void						SetAuthorName(const CFX_WideString& sName) = 0;

-	virtual void						SetDateTime(FX_SYSTEMTIME time) = 0;

-	virtual void						SetContents(const CFX_WideString& sContents) = 0;

-

-	virtual IPWL_NoteItem*				CreateSubItem() = 0;

-	virtual FX_INT32					CountSubItems() const = 0;

-	virtual IPWL_NoteItem*				GetSubItems(FX_INT32 index) const = 0;

-	virtual void						DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;

-	virtual void						SetFocus() = 0;

-	

-	virtual IPWL_NoteItem*				GetParentItem() const = 0;

-	virtual void*						GetPrivateData() const = 0;

-	virtual CFX_WideString				GetAuthorName() const = 0;

-	virtual CPWL_Color					GetBkColor() const = 0;

-	virtual CFX_WideString				GetContents() const = 0;

-	virtual FX_SYSTEMTIME				GetDateTime() const = 0;

-	virtual CFX_WideString				GetSubjectName() const = 0;

-

-	virtual CPWL_Edit*					GetEdit() const = 0;

-};

-

-class PWL_CLASS CPWL_Note_Icon : public CPWL_Wnd

-{

-public:

-	CPWL_Note_Icon();

-	virtual ~CPWL_Note_Icon();

-

-	void								SetIconType(FX_INT32 nType);

-

-public:

-

-protected:

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-private:

-	FX_INT32							m_nType;

-};

-

-class CPWL_Note_CloseBox : public CPWL_Button

-{

-public:

-	CPWL_Note_CloseBox();

-	virtual ~CPWL_Note_CloseBox();

-

-protected:

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL						OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-

-private:

-	FX_BOOL								m_bMouseDown;

-};

-

-class CPWL_Note_LBBox : public CPWL_Wnd

-{

-public:

-	CPWL_Note_LBBox();

-	virtual ~CPWL_Note_LBBox();

-

-protected:

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-};

-

-class CPWL_Note_RBBox : public CPWL_Wnd

-{

-public:

-	CPWL_Note_RBBox();

-	virtual ~CPWL_Note_RBBox();

-

-protected:

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-};

-

-class CPWL_Note_Edit : public CPWL_Edit

-{

-public:

-	CPWL_Note_Edit();

-	virtual ~CPWL_Note_Edit();

-

-	void								EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;}

-	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);

-	FX_FLOAT							GetItemLeftMargin();

-	FX_FLOAT							GetItemRightMargin();

-

-	virtual void						SetText(FX_LPCWSTR csText);

-

-protected:

-	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-	virtual void						RePosChildWnd();

-	virtual void						OnSetFocus();

-	virtual void						OnKillFocus();	

-

-private:

-	FX_BOOL								m_bEnableNotify;

-	FX_FLOAT							m_fOldItemHeight;

-	FX_BOOL								m_bSizeChanged;

-	FX_FLOAT							m_fOldMin;

-	FX_FLOAT							m_fOldMax;

-};

-

-class CPWL_Note_Options : public CPWL_Wnd

-{

-public:

-	CPWL_Note_Options();

-	virtual ~CPWL_Note_Options();

-

-	CPDF_Rect							GetContentRect() const;

-	virtual void						SetTextColor(const CPWL_Color & color);

-	void								SetText(const CFX_WideString& sText);

-

-protected:

-	virtual void						RePosChildWnd();

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-private:

-	CPWL_Label*							m_pText;

-};

-

-class CPWL_Note_Contents : public CPWL_ListCtrl

-{

-public:

-	CPWL_Note_Contents();

-	virtual ~CPWL_Note_Contents();

-

-	virtual CFX_ByteString				GetClassName() const;

-	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-	virtual FX_BOOL						OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);

-

-	void								SetEditFocus(FX_BOOL bLast);

-	CPWL_Edit*							GetEdit() const;

-

-public:

-	void								SetText(const CFX_WideString& sText);

-	CFX_WideString						GetText() const;

-

-	CPWL_NoteItem*						CreateSubItem();

-	void								DeleteSubItem(IPWL_NoteItem* pNoteItem);

-	FX_INT32							CountSubItems() const;

-	IPWL_NoteItem*						GetSubItems(FX_INT32 index) const;

-

-	virtual IPWL_NoteItem*				GetHitNoteItem(const CPDF_Point& point);

-	void								EnableRead(FX_BOOL bEnabled);

-	void								EnableModify(FX_BOOL bEnabled);

-

-protected:

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-

-private:

-	CPWL_Note_Edit*						m_pEdit;

-};

-

-class PWL_CLASS CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem 

-{

-public:

-	CPWL_NoteItem();

-	virtual ~CPWL_NoteItem();

-

-public:

-	virtual void						SetPrivateData(void* pData);

-	virtual void						SetBkColor(const CPWL_Color& color);

-	virtual void						SetSubjectName(const CFX_WideString& sName);

-	virtual void						SetAuthorName(const CFX_WideString& sName);

-	virtual void						SetDateTime(FX_SYSTEMTIME time);

-	virtual void						SetContents(const CFX_WideString& sContents);

-

-	virtual IPWL_NoteItem*				CreateSubItem();

-	virtual FX_INT32					CountSubItems() const;

-	virtual IPWL_NoteItem*				GetSubItems(FX_INT32 index) const;

-	virtual void						DeleteSubItem(IPWL_NoteItem* pNoteItem);

-	virtual void						SetFocus(){SetNoteFocus(FALSE);}

-

-	virtual IPWL_NoteItem*				GetParentItem() const;

-	virtual void*						GetPrivateData() const;

-	virtual CFX_WideString				GetAuthorName() const;

-	virtual CPWL_Color					GetBkColor() const;

-	virtual CFX_WideString				GetContents() const;

-	virtual FX_SYSTEMTIME				GetDateTime() const;

-	virtual CFX_WideString				GetSubjectName() const;

-	virtual FX_BOOL						IsTopItem() const { return FALSE;}

-	virtual CPWL_Edit*					GetEdit() const;

-

-public:

-	virtual FX_BOOL						OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);

-	virtual FX_BOOL						OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual CFX_ByteString				GetClassName() const;

-	virtual IPWL_NoteItem*				GetHitNoteItem(const CPDF_Point& point);

-	virtual IPWL_NoteItem*				GetFocusedNoteItem() const;

-

-	virtual void						ResetSubjectName(FX_INT32 nItemIndex);

-	void								EnableRead(FX_BOOL bEnabled);

-	void								EnableModify(FX_BOOL bEnabled);

-

-protected:

-	virtual void						RePosChildWnd();

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-

-	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-public:

-	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);

-	virtual FX_FLOAT					GetItemLeftMargin();

-	virtual FX_FLOAT					GetItemRightMargin();

-	CPWL_NoteItem*						CreateNoteItem();

-	CPWL_NoteItem*						GetParentNoteItem() const;

-

-	void								SetNoteFocus(FX_BOOL bLast);

-	void								OnContentsValidate();

-	

-	void								OnCreateNoteItem();

-

-protected:

-	void								PopupNoteItemMenu(const CPDF_Point& point);

-

-	virtual const CPWL_Note*			GetNote() const;

-	virtual IPWL_NoteNotify*			GetNoteNotify() const;

-

-protected:

-	CPWL_Label*							m_pSubject;

-	CPWL_Label*							m_pDateTime;

-	CPWL_Note_Contents*					m_pContents;

-

-private:

-	void*								m_pPrivateData;

-	FX_SYSTEMTIME						m_dtNote;

-	CFX_WideString						m_sAuthor;

-

-	FX_FLOAT							m_fOldItemHeight;

-	FX_BOOL								m_bSizeChanged;

-	FX_BOOL								m_bAllowModify;

-};

-

-class PWL_CLASS CPWL_Note : public CPWL_NoteItem

-{

-public:

-	CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler);

-	virtual ~CPWL_Note();

-

-public:

-	virtual void						SetSubjectName(const CFX_WideString& sName);

-	virtual void						SetAuthorName(const CFX_WideString& sName);

-	virtual CFX_WideString				GetAuthorName() const;

-	virtual void						SetBkColor(const CPWL_Color& color);

-	virtual void						ResetSubjectName(FX_INT32 nItemIndex){}

-	virtual FX_BOOL						IsTopItem() const {return TRUE;}

-	virtual const CPWL_Note*			GetNote() const;

-	virtual IPWL_NoteNotify*			GetNoteNotify() const;

-

-public:

-	IPWL_NoteItem*						Reply();

-	void								EnableNotify(FX_BOOL bEnabled);

-	void								SetIconType(FX_INT32 nType);

-	void								SetOptionsText(const CFX_WideString& sText);

-	void								EnableRead(FX_BOOL bEnabled);

-	void								EnableModify(FX_BOOL bEnabled);

-

-	CFX_WideString						GetReplyString() const;

-	void								SetReplyString(const CFX_WideString& string);

-

-	//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options 

-	FX_INT32							NoteHitTest(const CPDF_Point& point) const;

-	CPDF_Rect							GetCaptionRect() const {return m_rcCaption;}

-	IPopup_Note*						GetPopupNote() const {return m_pPopupNote;}

-

-public:

-	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL						OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL						OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);

-

-protected:

-	virtual void						RePosChildWnd();

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-

-	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-	FX_BOOL								ResetScrollBar();

-	void								RePosNoteChildren();

-	FX_BOOL								ScrollBarShouldVisible();

-

-private:

-	CPWL_Label*							m_pAuthor;

-	CPWL_Note_Icon*						m_pIcon;

-	CPWL_Note_CloseBox*					m_pCloseBox;

-	CPWL_Note_LBBox*					m_pLBBox;

-	CPWL_Note_RBBox*					m_pRBBox;

-	CPWL_ScrollBar*						m_pContentsBar;	

-	CPWL_Note_Options*					m_pOptions;

-	IPWL_NoteNotify*					m_pNoteNotify;

-	FX_BOOL								m_bResizing;

-	PWL_SCROLL_INFO						m_OldScrollInfo;

-	CPDF_Rect							m_rcCaption;

-	FX_BOOL								m_bEnalbleNotify;

-	IPopup_Note*						m_pPopupNote;

-	IPWL_NoteHandler*					m_pNoteHandler;

-	CFX_WideString						m_sReplyString;

-};

-

-#endif

-

+// 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 _PWL_NOTE_H_
+#define _PWL_NOTE_H_
+
+class IPWL_NoteNotify;
+class IPWL_NoteHandler;
+class IPWL_NoteItem;
+class CPWL_NoteItem;
+class CPWL_Note;
+class CPWL_Label;
+class CPWL_Edit;
+class CPWL_Note_Icon;
+class CPWL_Note_CloseBox;
+class CPWL_Note_LBBox;
+class CPWL_Note_RBBox;
+class CPWL_Note_Edit;
+class CPWL_Note_Options;
+class CPWL_Note_Contents;
+class IPopup_Note;
+
+
+class IPWL_NoteNotify
+{
+public:
+	virtual void						OnNoteMove(const FX_RECT& rtWin) = 0;
+	virtual void						OnNoteShow(FX_BOOL bShow) = 0;
+	virtual void						OnNoteActivate(FX_BOOL bActive) = 0;
+	virtual void						OnNoteClose() = 0;
+	virtual void						OnItemCreate(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnItemDelete(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnSetBkColor(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnSetContents(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnSetDateTime(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
+	virtual void						OnPopupMenu(FX_INT32 x, FX_INT32 y) = 0;
+	virtual void						OnPopupMenu(IPWL_NoteItem* pItem, FX_INT32 x, FX_INT32 y) = 0;
+};
+
+class IPWL_NoteHandler
+{
+public:
+	virtual void						OnNoteColorChanged(const CPWL_Color& color) = 0;
+};
+
+class IPWL_NoteItem
+{
+public:
+	virtual void						SetPrivateData(void* pData) = 0;
+	virtual void						SetBkColor(const CPWL_Color& color) = 0;
+	virtual void						SetSubjectName(const CFX_WideString& sName) = 0;
+	virtual void						SetAuthorName(const CFX_WideString& sName) = 0;
+	virtual void						SetDateTime(FX_SYSTEMTIME time) = 0;
+	virtual void						SetContents(const CFX_WideString& sContents) = 0;
+
+	virtual IPWL_NoteItem*				CreateSubItem() = 0;
+	virtual FX_INT32					CountSubItems() const = 0;
+	virtual IPWL_NoteItem*				GetSubItems(FX_INT32 index) const = 0;
+	virtual void						DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
+	virtual void						SetFocus() = 0;
+	
+	virtual IPWL_NoteItem*				GetParentItem() const = 0;
+	virtual void*						GetPrivateData() const = 0;
+	virtual CFX_WideString				GetAuthorName() const = 0;
+	virtual CPWL_Color					GetBkColor() const = 0;
+	virtual CFX_WideString				GetContents() const = 0;
+	virtual FX_SYSTEMTIME				GetDateTime() const = 0;
+	virtual CFX_WideString				GetSubjectName() const = 0;
+
+	virtual CPWL_Edit*					GetEdit() const = 0;
+};
+
+class PWL_CLASS CPWL_Note_Icon : public CPWL_Wnd
+{
+public:
+	CPWL_Note_Icon();
+	virtual ~CPWL_Note_Icon();
+
+	void								SetIconType(FX_INT32 nType);
+
+public:
+
+protected:
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+private:
+	FX_INT32							m_nType;
+};
+
+class CPWL_Note_CloseBox : public CPWL_Button
+{
+public:
+	CPWL_Note_CloseBox();
+	virtual ~CPWL_Note_CloseBox();
+
+protected:
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL						OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+
+private:
+	FX_BOOL								m_bMouseDown;
+};
+
+class CPWL_Note_LBBox : public CPWL_Wnd
+{
+public:
+	CPWL_Note_LBBox();
+	virtual ~CPWL_Note_LBBox();
+
+protected:
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+};
+
+class CPWL_Note_RBBox : public CPWL_Wnd
+{
+public:
+	CPWL_Note_RBBox();
+	virtual ~CPWL_Note_RBBox();
+
+protected:
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+};
+
+class CPWL_Note_Edit : public CPWL_Edit
+{
+public:
+	CPWL_Note_Edit();
+	virtual ~CPWL_Note_Edit();
+
+	void								EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;}
+	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);
+	FX_FLOAT							GetItemLeftMargin();
+	FX_FLOAT							GetItemRightMargin();
+
+	virtual void						SetText(FX_LPCWSTR csText);
+
+protected:
+	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+	virtual void						RePosChildWnd();
+	virtual void						OnSetFocus();
+	virtual void						OnKillFocus();	
+
+private:
+	FX_BOOL								m_bEnableNotify;
+	FX_FLOAT							m_fOldItemHeight;
+	FX_BOOL								m_bSizeChanged;
+	FX_FLOAT							m_fOldMin;
+	FX_FLOAT							m_fOldMax;
+};
+
+class CPWL_Note_Options : public CPWL_Wnd
+{
+public:
+	CPWL_Note_Options();
+	virtual ~CPWL_Note_Options();
+
+	CPDF_Rect							GetContentRect() const;
+	virtual void						SetTextColor(const CPWL_Color & color);
+	void								SetText(const CFX_WideString& sText);
+
+protected:
+	virtual void						RePosChildWnd();
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+private:
+	CPWL_Label*							m_pText;
+};
+
+class CPWL_Note_Contents : public CPWL_ListCtrl
+{
+public:
+	CPWL_Note_Contents();
+	virtual ~CPWL_Note_Contents();
+
+	virtual CFX_ByteString				GetClassName() const;
+	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+	virtual FX_BOOL						OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+
+	void								SetEditFocus(FX_BOOL bLast);
+	CPWL_Edit*							GetEdit() const;
+
+public:
+	void								SetText(const CFX_WideString& sText);
+	CFX_WideString						GetText() const;
+
+	CPWL_NoteItem*						CreateSubItem();
+	void								DeleteSubItem(IPWL_NoteItem* pNoteItem);
+	FX_INT32							CountSubItems() const;
+	IPWL_NoteItem*						GetSubItems(FX_INT32 index) const;
+
+	virtual IPWL_NoteItem*				GetHitNoteItem(const CPDF_Point& point);
+	void								EnableRead(FX_BOOL bEnabled);
+	void								EnableModify(FX_BOOL bEnabled);
+
+protected:
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+
+private:
+	CPWL_Note_Edit*						m_pEdit;
+};
+
+class PWL_CLASS CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem 
+{
+public:
+	CPWL_NoteItem();
+	virtual ~CPWL_NoteItem();
+
+public:
+	virtual void						SetPrivateData(void* pData);
+	virtual void						SetBkColor(const CPWL_Color& color);
+	virtual void						SetSubjectName(const CFX_WideString& sName);
+	virtual void						SetAuthorName(const CFX_WideString& sName);
+	virtual void						SetDateTime(FX_SYSTEMTIME time);
+	virtual void						SetContents(const CFX_WideString& sContents);
+
+	virtual IPWL_NoteItem*				CreateSubItem();
+	virtual FX_INT32					CountSubItems() const;
+	virtual IPWL_NoteItem*				GetSubItems(FX_INT32 index) const;
+	virtual void						DeleteSubItem(IPWL_NoteItem* pNoteItem);
+	virtual void						SetFocus(){SetNoteFocus(FALSE);}
+
+	virtual IPWL_NoteItem*				GetParentItem() const;
+	virtual void*						GetPrivateData() const;
+	virtual CFX_WideString				GetAuthorName() const;
+	virtual CPWL_Color					GetBkColor() const;
+	virtual CFX_WideString				GetContents() const;
+	virtual FX_SYSTEMTIME				GetDateTime() const;
+	virtual CFX_WideString				GetSubjectName() const;
+	virtual FX_BOOL						IsTopItem() const { return FALSE;}
+	virtual CPWL_Edit*					GetEdit() const;
+
+public:
+	virtual FX_BOOL						OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+	virtual FX_BOOL						OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual CFX_ByteString				GetClassName() const;
+	virtual IPWL_NoteItem*				GetHitNoteItem(const CPDF_Point& point);
+	virtual IPWL_NoteItem*				GetFocusedNoteItem() const;
+
+	virtual void						ResetSubjectName(FX_INT32 nItemIndex);
+	void								EnableRead(FX_BOOL bEnabled);
+	void								EnableModify(FX_BOOL bEnabled);
+
+protected:
+	virtual void						RePosChildWnd();
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+
+	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+public:
+	virtual FX_FLOAT					GetItemHeight(FX_FLOAT fLimitWidth);
+	virtual FX_FLOAT					GetItemLeftMargin();
+	virtual FX_FLOAT					GetItemRightMargin();
+	CPWL_NoteItem*						CreateNoteItem();
+	CPWL_NoteItem*						GetParentNoteItem() const;
+
+	void								SetNoteFocus(FX_BOOL bLast);
+	void								OnContentsValidate();
+	
+	void								OnCreateNoteItem();
+
+protected:
+	void								PopupNoteItemMenu(const CPDF_Point& point);
+
+	virtual const CPWL_Note*			GetNote() const;
+	virtual IPWL_NoteNotify*			GetNoteNotify() const;
+
+protected:
+	CPWL_Label*							m_pSubject;
+	CPWL_Label*							m_pDateTime;
+	CPWL_Note_Contents*					m_pContents;
+
+private:
+	void*								m_pPrivateData;
+	FX_SYSTEMTIME						m_dtNote;
+	CFX_WideString						m_sAuthor;
+
+	FX_FLOAT							m_fOldItemHeight;
+	FX_BOOL								m_bSizeChanged;
+	FX_BOOL								m_bAllowModify;
+};
+
+class PWL_CLASS CPWL_Note : public CPWL_NoteItem
+{
+public:
+	CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler);
+	virtual ~CPWL_Note();
+
+public:
+	virtual void						SetSubjectName(const CFX_WideString& sName);
+	virtual void						SetAuthorName(const CFX_WideString& sName);
+	virtual CFX_WideString				GetAuthorName() const;
+	virtual void						SetBkColor(const CPWL_Color& color);
+	virtual void						ResetSubjectName(FX_INT32 nItemIndex){}
+	virtual FX_BOOL						IsTopItem() const {return TRUE;}
+	virtual const CPWL_Note*			GetNote() const;
+	virtual IPWL_NoteNotify*			GetNoteNotify() const;
+
+public:
+	IPWL_NoteItem*						Reply();
+	void								EnableNotify(FX_BOOL bEnabled);
+	void								SetIconType(FX_INT32 nType);
+	void								SetOptionsText(const CFX_WideString& sText);
+	void								EnableRead(FX_BOOL bEnabled);
+	void								EnableModify(FX_BOOL bEnabled);
+
+	CFX_WideString						GetReplyString() const;
+	void								SetReplyString(const CFX_WideString& string);
+
+	//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options 
+	FX_INT32							NoteHitTest(const CPDF_Point& point) const;
+	CPDF_Rect							GetCaptionRect() const {return m_rcCaption;}
+	IPopup_Note*						GetPopupNote() const {return m_pPopupNote;}
+
+public:
+	virtual FX_BOOL						OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL						OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL						OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
+
+protected:
+	virtual void						RePosChildWnd();
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+
+	virtual void						OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+	FX_BOOL								ResetScrollBar();
+	void								RePosNoteChildren();
+	FX_BOOL								ScrollBarShouldVisible();
+
+private:
+	CPWL_Label*							m_pAuthor;
+	CPWL_Note_Icon*						m_pIcon;
+	CPWL_Note_CloseBox*					m_pCloseBox;
+	CPWL_Note_LBBox*					m_pLBBox;
+	CPWL_Note_RBBox*					m_pRBBox;
+	CPWL_ScrollBar*						m_pContentsBar;	
+	CPWL_Note_Options*					m_pOptions;
+	IPWL_NoteNotify*					m_pNoteNotify;
+	FX_BOOL								m_bResizing;
+	PWL_SCROLL_INFO						m_OldScrollInfo;
+	CPDF_Rect							m_rcCaption;
+	FX_BOOL								m_bEnalbleNotify;
+	IPopup_Note*						m_pPopupNote;
+	IPWL_NoteHandler*					m_pNoteHandler;
+	CFX_WideString						m_sReplyString;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
index 3196b22..d256542 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
@@ -1,166 +1,166 @@
-// 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 _PWL_SCROLLBAR_H_

-#define _PWL_SCROLLBAR_H_

-

-class CPWL_SBButton;

-class CPWL_ScrollBar;

-

-struct PWL_SCROLL_INFO

-{

-public:

-	PWL_SCROLL_INFO() : fContentMin(0.0f), fContentMax(0.0f), fPlateWidth(0.0f), fBigStep(0.0f), fSmallStep(0.0f)

-	{

-	}

-	FX_FLOAT					fContentMin;

-	FX_FLOAT					fContentMax;	

-	FX_FLOAT					fPlateWidth;	

-	FX_FLOAT					fBigStep;

-	FX_FLOAT					fSmallStep;

-};

-

-enum PWL_SCROLLBAR_TYPE

-{

-	SBT_HSCROLL,

-	SBT_VSCROLL

-};

-

-enum PWL_SBBUTTON_TYPE

-{

-	PSBT_MIN,

-	PSBT_MAX,

-	PSBT_POS

-};

-

-class CPWL_SBButton : public CPWL_Wnd  

-{

-public:

-	CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE eButtonType);

-	virtual ~CPWL_SBButton();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual void				OnCreate(PWL_CREATEPARAM & cp);

-	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL				OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);

-

-protected:

-	PWL_SCROLLBAR_TYPE			m_eScrollBarType;

-	PWL_SBBUTTON_TYPE			m_eSBButtonType;

-

-	FX_BOOL						m_bMouseDown;

-};

-

-struct PWL_FLOATRANGE

-{

-public:

-	PWL_FLOATRANGE();

-	PWL_FLOATRANGE(FX_FLOAT min,FX_FLOAT max);

-	void Default();

-	void Set(FX_FLOAT min,FX_FLOAT max);

-	FX_BOOL	In(FX_FLOAT x) const;

-	FX_FLOAT GetWidth() const;

-

-	FX_FLOAT fMin,fMax;

-};

-

-struct PWL_SCROLL_PRIVATEDATA

-{

-public:

-	PWL_SCROLL_PRIVATEDATA();

-

-	void Default();

-	void SetScrollRange(FX_FLOAT min,FX_FLOAT max);

-	void SetClientWidth(FX_FLOAT width);

-	void SetSmallStep(FX_FLOAT step);

-	void SetBigStep(FX_FLOAT step);

-	FX_BOOL SetPos(FX_FLOAT pos);

-

-	void AddSmall();

-	void SubSmall();

-	void AddBig();

-	void SubBig();

-

-	PWL_FLOATRANGE				ScrollRange;

-	FX_FLOAT					fClientWidth;

-	FX_FLOAT					fScrollPos;

-	FX_FLOAT					fBigStep;

-	FX_FLOAT					fSmallStep;

-};

-

-class CPWL_ScrollBar : public CPWL_Wnd  

-{

-public:

-	CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL);

-	virtual ~CPWL_ScrollBar();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual void				OnCreate(PWL_CREATEPARAM & cp);

-	virtual void				RePosChildWnd();

-	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual void				OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-

-	virtual void				CreateChildWnd(const PWL_CREATEPARAM & cp);

-	

-	FX_FLOAT					GetScrollBarWidth() const;	

-	PWL_SCROLLBAR_TYPE			GetScrollBarType() const {return m_sbType;};

-

-	void						SetNotifyForever(FX_BOOL bForever) {m_bNotifyForever = bForever;}

-

-protected:			

-	void						SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClientWidth);

-	void						SetScrollPos(FX_FLOAT fPos);

-	void						MovePosButton(FX_BOOL bRefresh);

-	void						SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep);

-	void						NotifyScrollWindow();

-	CPDF_Rect					GetScrollArea() const;

-

-private:

-	void						CreateButtons(const PWL_CREATEPARAM & cp);

-

-	void						OnMinButtonLBDown(const CPDF_Point & point);

-	void						OnMinButtonLBUp(const CPDF_Point & point);

-	void						OnMinButtonMouseMove(const CPDF_Point & point);

-

-	void						OnMaxButtonLBDown(const CPDF_Point & point);

-	void						OnMaxButtonLBUp(const CPDF_Point & point);

-	void						OnMaxButtonMouseMove(const CPDF_Point & point);

-

-	void						OnPosButtonLBDown(const CPDF_Point & point);

-	void						OnPosButtonLBUp(const CPDF_Point & point);

-	void						OnPosButtonMouseMove(const CPDF_Point & point);

-

-	FX_FLOAT					TrueToFace(FX_FLOAT);

-	FX_FLOAT					FaceToTrue(FX_FLOAT);

-

-	virtual	void				TimerProc();

-

-private:

-	PWL_SCROLLBAR_TYPE			m_sbType;

-	PWL_SCROLL_INFO				m_OriginInfo;

-	CPWL_SBButton*				m_pMinButton;

-	CPWL_SBButton*				m_pMaxButton;

-	CPWL_SBButton*				m_pPosButton;

-	PWL_SCROLL_PRIVATEDATA		m_sData;

-	FX_BOOL						m_bMouseDown;	

-	FX_BOOL						m_bMinOrMax;

-	FX_BOOL						m_bNotifyForever;

-	FX_FLOAT					m_nOldPos;

-	FX_FLOAT					m_fOldPosButton;

-};

-

-#endif // !defined(AFX_PWL_SCROLLBAR_H__DCFEC082_2651_48A4_B8F3_63F1B3CC5E10__INCLUDED_)

-

-

+// 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 _PWL_SCROLLBAR_H_
+#define _PWL_SCROLLBAR_H_
+
+class CPWL_SBButton;
+class CPWL_ScrollBar;
+
+struct PWL_SCROLL_INFO
+{
+public:
+	PWL_SCROLL_INFO() : fContentMin(0.0f), fContentMax(0.0f), fPlateWidth(0.0f), fBigStep(0.0f), fSmallStep(0.0f)
+	{
+	}
+	FX_FLOAT					fContentMin;
+	FX_FLOAT					fContentMax;	
+	FX_FLOAT					fPlateWidth;	
+	FX_FLOAT					fBigStep;
+	FX_FLOAT					fSmallStep;
+};
+
+enum PWL_SCROLLBAR_TYPE
+{
+	SBT_HSCROLL,
+	SBT_VSCROLL
+};
+
+enum PWL_SBBUTTON_TYPE
+{
+	PSBT_MIN,
+	PSBT_MAX,
+	PSBT_POS
+};
+
+class CPWL_SBButton : public CPWL_Wnd  
+{
+public:
+	CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE eButtonType);
+	virtual ~CPWL_SBButton();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual void				OnCreate(PWL_CREATEPARAM & cp);
+	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL				OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
+
+protected:
+	PWL_SCROLLBAR_TYPE			m_eScrollBarType;
+	PWL_SBBUTTON_TYPE			m_eSBButtonType;
+
+	FX_BOOL						m_bMouseDown;
+};
+
+struct PWL_FLOATRANGE
+{
+public:
+	PWL_FLOATRANGE();
+	PWL_FLOATRANGE(FX_FLOAT min,FX_FLOAT max);
+	void Default();
+	void Set(FX_FLOAT min,FX_FLOAT max);
+	FX_BOOL	In(FX_FLOAT x) const;
+	FX_FLOAT GetWidth() const;
+
+	FX_FLOAT fMin,fMax;
+};
+
+struct PWL_SCROLL_PRIVATEDATA
+{
+public:
+	PWL_SCROLL_PRIVATEDATA();
+
+	void Default();
+	void SetScrollRange(FX_FLOAT min,FX_FLOAT max);
+	void SetClientWidth(FX_FLOAT width);
+	void SetSmallStep(FX_FLOAT step);
+	void SetBigStep(FX_FLOAT step);
+	FX_BOOL SetPos(FX_FLOAT pos);
+
+	void AddSmall();
+	void SubSmall();
+	void AddBig();
+	void SubBig();
+
+	PWL_FLOATRANGE				ScrollRange;
+	FX_FLOAT					fClientWidth;
+	FX_FLOAT					fScrollPos;
+	FX_FLOAT					fBigStep;
+	FX_FLOAT					fSmallStep;
+};
+
+class CPWL_ScrollBar : public CPWL_Wnd  
+{
+public:
+	CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL);
+	virtual ~CPWL_ScrollBar();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual void				OnCreate(PWL_CREATEPARAM & cp);
+	virtual void				RePosChildWnd();
+	virtual void				GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void				DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual FX_BOOL				OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual void				OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+
+	virtual void				CreateChildWnd(const PWL_CREATEPARAM & cp);
+	
+	FX_FLOAT					GetScrollBarWidth() const;	
+	PWL_SCROLLBAR_TYPE			GetScrollBarType() const {return m_sbType;};
+
+	void						SetNotifyForever(FX_BOOL bForever) {m_bNotifyForever = bForever;}
+
+protected:			
+	void						SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClientWidth);
+	void						SetScrollPos(FX_FLOAT fPos);
+	void						MovePosButton(FX_BOOL bRefresh);
+	void						SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep);
+	void						NotifyScrollWindow();
+	CPDF_Rect					GetScrollArea() const;
+
+private:
+	void						CreateButtons(const PWL_CREATEPARAM & cp);
+
+	void						OnMinButtonLBDown(const CPDF_Point & point);
+	void						OnMinButtonLBUp(const CPDF_Point & point);
+	void						OnMinButtonMouseMove(const CPDF_Point & point);
+
+	void						OnMaxButtonLBDown(const CPDF_Point & point);
+	void						OnMaxButtonLBUp(const CPDF_Point & point);
+	void						OnMaxButtonMouseMove(const CPDF_Point & point);
+
+	void						OnPosButtonLBDown(const CPDF_Point & point);
+	void						OnPosButtonLBUp(const CPDF_Point & point);
+	void						OnPosButtonMouseMove(const CPDF_Point & point);
+
+	FX_FLOAT					TrueToFace(FX_FLOAT);
+	FX_FLOAT					FaceToTrue(FX_FLOAT);
+
+	virtual	void				TimerProc();
+
+private:
+	PWL_SCROLLBAR_TYPE			m_sbType;
+	PWL_SCROLL_INFO				m_OriginInfo;
+	CPWL_SBButton*				m_pMinButton;
+	CPWL_SBButton*				m_pMaxButton;
+	CPWL_SBButton*				m_pPosButton;
+	PWL_SCROLL_PRIVATEDATA		m_sData;
+	FX_BOOL						m_bMouseDown;	
+	FX_BOOL						m_bMinOrMax;
+	FX_BOOL						m_bNotifyForever;
+	FX_FLOAT					m_nOldPos;
+	FX_FLOAT					m_fOldPosButton;
+};
+
+#endif // !defined(AFX_PWL_SCROLLBAR_H__DCFEC082_2651_48A4_B8F3_63F1B3CC5E10__INCLUDED_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Signature.h b/fpdfsdk/include/pdfwindow/PWL_Signature.h
index 712f740..ec4479b 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Signature.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Signature.h
@@ -1,67 +1,67 @@
-// 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 _PWL_SIGNATURE_H_

-#define _PWL_SIGNATURE_H_

-

-class CPWL_Signature;

-class CPWL_Label;

-class CPWL_Signature_Image;

-

-class CPWL_Signature_Image : public CPWL_Image

-{

-public:

-	CPWL_Signature_Image();

-	virtual ~CPWL_Signature_Image();

-

-	void								SetImage(CFX_DIBSource* pImage);

-	CFX_DIBSource*						GetImage();

-

-protected:

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual void						GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-

-	virtual void						GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);

-

-private:

-	CFX_DIBSource*						m_pImage;

-};

-

-class PWL_CLASS CPWL_Signature : public CPWL_Wnd

-{

-public:

-	CPWL_Signature();

-	virtual ~CPWL_Signature();

-

-	void								SetText(FX_LPCWSTR sText);

-	void								SetDescription(FX_LPCWSTR string);

-	void								SetImage(CFX_DIBSource* pImage);

-	void								SetImageStream(CPDF_Stream * pStream, FX_LPCSTR sImageAlias);

-

-	void								SetTextFlag(FX_BOOL bTextExist);

-	void								SetImageFlag(FX_BOOL bImageExist);

-	void								SetFoxitFlag(FX_BOOL bFlagExist);

-

-protected:

-	virtual void						RePosChildWnd();

-	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);

-

-	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual void						GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-

-private:

-	CPWL_Label*							m_pText;

-	CPWL_Label*							m_pDescription;

-	CPWL_Signature_Image*				m_pImage;

-

-	FX_BOOL								m_bTextExist;

-	FX_BOOL								m_bImageExist;

-	FX_BOOL								m_bFlagExist;

-};

-

-#endif // _PWL_SIGNATURE_H_

-

-

+// 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 _PWL_SIGNATURE_H_
+#define _PWL_SIGNATURE_H_
+
+class CPWL_Signature;
+class CPWL_Label;
+class CPWL_Signature_Image;
+
+class CPWL_Signature_Image : public CPWL_Image
+{
+public:
+	CPWL_Signature_Image();
+	virtual ~CPWL_Signature_Image();
+
+	void								SetImage(CFX_DIBSource* pImage);
+	CFX_DIBSource*						GetImage();
+
+protected:
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual void						GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+
+	virtual void						GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
+
+private:
+	CFX_DIBSource*						m_pImage;
+};
+
+class PWL_CLASS CPWL_Signature : public CPWL_Wnd
+{
+public:
+	CPWL_Signature();
+	virtual ~CPWL_Signature();
+
+	void								SetText(FX_LPCWSTR sText);
+	void								SetDescription(FX_LPCWSTR string);
+	void								SetImage(CFX_DIBSource* pImage);
+	void								SetImageStream(CPDF_Stream * pStream, FX_LPCSTR sImageAlias);
+
+	void								SetTextFlag(FX_BOOL bTextExist);
+	void								SetImageFlag(FX_BOOL bImageExist);
+	void								SetFoxitFlag(FX_BOOL bFlagExist);
+
+protected:
+	virtual void						RePosChildWnd();
+	virtual void						CreateChildWnd(const PWL_CREATEPARAM & cp);
+
+	virtual void						DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual void						GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+
+private:
+	CPWL_Label*							m_pText;
+	CPWL_Label*							m_pDescription;
+	CPWL_Signature_Image*				m_pImage;
+
+	FX_BOOL								m_bTextExist;
+	FX_BOOL								m_bImageExist;
+	FX_BOOL								m_bFlagExist;
+};
+
+#endif // _PWL_SIGNATURE_H_
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
index 5561301..ae882ea 100644
--- a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
+++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
@@ -1,63 +1,63 @@
-// 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 _PWL_SPECIALBUTTON_H_

-#define _PWL_SPECIALBUTTON_H_

-

-#if _MSC_VER > 1000

-#pragma once

-#endif // _MSC_VER > 1000

-

-class PWL_CLASS CPWL_PushButton : public CPWL_Button  

-{

-public:

-	CPWL_PushButton();

-	virtual ~CPWL_PushButton();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual CPDF_Rect			GetFocusRect() const;

-};

-

-class PWL_CLASS CPWL_CheckBox : public CPWL_Button

-{

-public:

-	CPWL_CheckBox();

-	virtual ~CPWL_CheckBox();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point);

-	virtual FX_BOOL				OnChar(FX_WORD nChar);

-

-	void						SetCheck(FX_BOOL bCheck);

-	FX_BOOL						IsChecked() const;

-

-private:

-	FX_BOOL						m_bChecked;

-};

-

-class PWL_CLASS CPWL_RadioButton : public CPWL_Button

-{

-public:

-	CPWL_RadioButton();

-	virtual ~CPWL_RadioButton();

-

-public:

-	virtual CFX_ByteString		GetClassName() const;

-	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point);

-	virtual FX_BOOL				OnChar(FX_WORD nChar);

-

-	void						SetCheck(FX_BOOL bCheck);

-	FX_BOOL						IsChecked() const;

-

-private:

-	FX_BOOL						m_bChecked;

-};

-

-#endif

-

-

+// 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 _PWL_SPECIALBUTTON_H_
+#define _PWL_SPECIALBUTTON_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class PWL_CLASS CPWL_PushButton : public CPWL_Button  
+{
+public:
+	CPWL_PushButton();
+	virtual ~CPWL_PushButton();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual CPDF_Rect			GetFocusRect() const;
+};
+
+class PWL_CLASS CPWL_CheckBox : public CPWL_Button
+{
+public:
+	CPWL_CheckBox();
+	virtual ~CPWL_CheckBox();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point);
+	virtual FX_BOOL				OnChar(FX_WORD nChar);
+
+	void						SetCheck(FX_BOOL bCheck);
+	FX_BOOL						IsChecked() const;
+
+private:
+	FX_BOOL						m_bChecked;
+};
+
+class PWL_CLASS CPWL_RadioButton : public CPWL_Button
+{
+public:
+	CPWL_RadioButton();
+	virtual ~CPWL_RadioButton();
+
+public:
+	virtual CFX_ByteString		GetClassName() const;
+	virtual FX_BOOL				OnLButtonUp(const CPDF_Point & point);
+	virtual FX_BOOL				OnChar(FX_WORD nChar);
+
+	void						SetCheck(FX_BOOL bCheck);
+	FX_BOOL						IsChecked() const;
+
+private:
+	FX_BOOL						m_bChecked;
+};
+
+#endif
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h
index 2eccc36..489eb4a 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Utils.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h
@@ -1,237 +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 _PWL_UTILS_H_

-#define _PWL_UTILS_H_

-

-template<class T> T PWL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }

-template<class T> T PWL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }

-

-#define PWL_PDF2WIN(color)					(FX_BYTE(color*255))

-#define PWL_WIN2PDF(color)					((FX_FLOAT)((FX_FLOAT)color/255.0f))

-

-#define PWL_MAKEDWORD(low,high)				((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16))) 

-#define PWL_GETLOWWORD(dword)				((FX_WORD)(dword))

-#define PWL_GETHIGHWORD(dword)				((FX_WORD)(dword>>16))

-

-#define PWL_ICONTYPE_CHECKMARK				0

-#define PWL_ICONTYPE_CIRCLE					1

-#define PWL_ICONTYPE_COMMENT				2

-#define PWL_ICONTYPE_CROSS					3

-#define PWL_ICONTYPE_HELP					4

-#define PWL_ICONTYPE_INSERTTEXT				5

-#define PWL_ICONTYPE_KEY					6

-#define PWL_ICONTYPE_NEWPARAGRAPH			7

-#define PWL_ICONTYPE_TEXTNOTE				8

-#define PWL_ICONTYPE_PARAGRAPH				9

-#define PWL_ICONTYPE_RIGHTARROW				10

-#define PWL_ICONTYPE_RIGHTPOINTER			11

-#define PWL_ICONTYPE_STAR					12

-#define PWL_ICONTYPE_UPARROW				13

-#define PWL_ICONTYPE_UPLEFTARROW			14

-

-#define PWL_ICONTYPE_GRAPH					15

-#define PWL_ICONTYPE_PAPERCLIP				16

-#define PWL_ICONTYPE_ATTACHMENT				17

-#define PWL_ICONTYPE_TAG					18

-

-#define PWL_ICONTYPE_FOXIT					19

-

-#define PWL_ICONTYPE_UNKNOWN				-1

-

-//checkbox & radiobutton style

-#define PCS_CHECK							0

-#define PCS_CIRCLE							1

-#define PCS_CROSS							2

-#define PCS_DIAMOND							3

-#define PCS_SQUARE							4

-#define PCS_STAR							5

-

-#define	PWL_PI								3.14159265358979f

-#define PWL_BEZIER							0.5522847498308f

-

-//pushbutton layout style

-#define PPBL_LABEL							0

-#define PPBL_ICON							1

-#define PPBL_ICONTOPLABELBOTTOM				2

-#define	PPBL_LABELTOPICONBOTTOM				3

-#define	PPBL_ICONLEFTLABELRIGHT				4

-#define PPBL_LABELLEFTICONRIGHT				5

-#define PPBL_LABELOVERICON					6

-

-class CPWL_Point : public CPDF_Point

-{

-public:

-	CPWL_Point() : CPDF_Point(0.0f,0.0f){}

-	CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx,fy) {}

-	CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {}

-};

-

-enum PWL_PATHDATA_TYPE

-{

-	PWLPT_MOVETO,

-	PWLPT_LINETO,

-	PWLPT_BEZIERTO,

-	PWLPT_UNKNOWN

-};

-

-enum PWL_PATH_TYPE

-{

-	PWLPT_PATHDATA,

-	PWLPT_STREAM

-};

-

-class CPWL_PathData

-{

-public:

-	CPWL_PathData() : point(), type(PWLPT_UNKNOWN){}

-	CPWL_PathData(const CPWL_Point& pt, PWL_PATHDATA_TYPE tp) : point(pt), type(tp) {}

-

-	CPWL_Point								point;

-	PWL_PATHDATA_TYPE						type;

-};

-

-class IPWL_SpellCheck;

-

-class PWL_CLASS CPWL_Utils

-{

-public:

-	static CPDF_Rect						InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);

-	static CPDF_Rect						DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);

-	static FX_BOOL							IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);

-	static FX_BOOL							ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild);

-	static CPDF_Rect						ScaleRect(const CPDF_Rect& rcRect,FX_FLOAT fScale);

-	static CPVT_WordRange					OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);

-	static CPDF_Rect						GetCenterSquare(const CPDF_Rect & rect);

-	static CPWL_Color						SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub);

-	static CPWL_Color						DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide);

-	static CPDF_Rect						MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);

-	static CPDF_Rect						OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y);

-	static CPDF_Point						OffsetPoint(const  CPDF_Point & point,FX_FLOAT x,FX_FLOAT y);

-	static FX_COLORREF						PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTransparancy = 255);

-	static FX_BOOL							IsBlackOrWhite(const CPWL_Color& color);

-	static CPWL_Color						GetReverseColor(const CPWL_Color& color);

-

-	static CFX_ByteString					GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke = TRUE);

-	static CFX_ByteString					GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,

-												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,

-												FX_INT32 nStyle, const CPWL_Dash & dash);

-	static CFX_ByteString					GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,

-												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,

-												FX_INT32 nStyle, const CPWL_Dash & dash);

-	static CFX_ByteString					GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);

-	static CFX_ByteString					GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);

-

-	static CFX_ByteString					GetPushButtonAppStream(const CPDF_Rect & rcBBox,

-														IFX_Edit_FontMap * pFontMap,

-														CPDF_Stream * pIconStream,

-														CPDF_IconFit & IconFit,

-														const CFX_WideString & sLabel,														

-														const CPWL_Color & crText,

-														FX_FLOAT fFontSize,

-														FX_INT32 nLayOut);

-	static CFX_ByteString					GetCheckBoxAppStream(const CPDF_Rect & rcBBox,

-														FX_INT32 nStyle,

-														const CPWL_Color & crText);

-	static CFX_ByteString					GetRadioButtonAppStream(const CPDF_Rect & rcBBox,

-														FX_INT32 nStyle,

-														const CPWL_Color & crText);

-

-	static CFX_ByteString					GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL, 

-														FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);

-	static CFX_ByteString					GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,

-														const CPVT_WordRange * pRange = NULL);

-	static CFX_ByteString					GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck,

-														const CPDF_Point & ptOffset,

-														const CPVT_WordRange * pRange = NULL);

-	static CFX_ByteString					GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,

-														const CFX_WideString & sText, FX_INT32 nAlignmentH, FX_INT32 nAlignmentV,

-														FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText);

-	static CFX_ByteString					GetDropButtonAppStream(const CPDF_Rect & rcBBox);

-

-	static void								DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,

-														const CPWL_Color & color, FX_INT32 nTransparancy);

-	static void								DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-														const CPDF_Rect & rect,const FX_COLORREF & color);

-	static void								DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,

-														const FX_COLORREF & color, FX_FLOAT fWidth);

-	static void								DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-														const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth);

-	static void								DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-												const CPDF_Rect & rect, FX_FLOAT fWidth,

-												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,

-												FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy);

-	static void								DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-														const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color);

-	static void								DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-														FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,

-														FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray);

-	static void								DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, 

-														const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, 

-														IPWL_SpellCheck* pSpellCheck);

-public:

-	static void								ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);

-	static void								ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);

-	

-	static void								ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray);

-	static void								ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);

-

-	static void								ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray);

-	static void								ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);

-

-	static void								PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue);

-

-public:

-	static CFX_ByteString					GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill, 

-												const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);

-	static void								DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,

-												FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, 

-												const CPWL_Color& crStroke, const FX_INT32 nTransparancy);

-

-private:

-	static CFX_ByteString					GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount);

-	static void								GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, FX_INT32 nCount);

-

-	static CFX_ByteString					GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-	static CFX_ByteString					GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-	static CFX_ByteString					GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-	static CFX_ByteString					GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-	static CFX_ByteString					GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-	static CFX_ByteString					GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText);

-

-	static CFX_ByteString					GetAP_Check(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_Circle(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_Cross(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_Diamond(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_Square(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_Star(const CPDF_Rect & crBBox);

-	static CFX_ByteString					GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate);

-

-	static void								GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-	static void								GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);

-};

-

-#endif // !defined(AFX_PWL_UTILS_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)

-

-

+// 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 _PWL_UTILS_H_
+#define _PWL_UTILS_H_
+
+template<class T> T PWL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
+template<class T> T PWL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+
+#define PWL_PDF2WIN(color)					(FX_BYTE(color*255))
+#define PWL_WIN2PDF(color)					((FX_FLOAT)((FX_FLOAT)color/255.0f))
+
+#define PWL_MAKEDWORD(low,high)				((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16))) 
+#define PWL_GETLOWWORD(dword)				((FX_WORD)(dword))
+#define PWL_GETHIGHWORD(dword)				((FX_WORD)(dword>>16))
+
+#define PWL_ICONTYPE_CHECKMARK				0
+#define PWL_ICONTYPE_CIRCLE					1
+#define PWL_ICONTYPE_COMMENT				2
+#define PWL_ICONTYPE_CROSS					3
+#define PWL_ICONTYPE_HELP					4
+#define PWL_ICONTYPE_INSERTTEXT				5
+#define PWL_ICONTYPE_KEY					6
+#define PWL_ICONTYPE_NEWPARAGRAPH			7
+#define PWL_ICONTYPE_TEXTNOTE				8
+#define PWL_ICONTYPE_PARAGRAPH				9
+#define PWL_ICONTYPE_RIGHTARROW				10
+#define PWL_ICONTYPE_RIGHTPOINTER			11
+#define PWL_ICONTYPE_STAR					12
+#define PWL_ICONTYPE_UPARROW				13
+#define PWL_ICONTYPE_UPLEFTARROW			14
+
+#define PWL_ICONTYPE_GRAPH					15
+#define PWL_ICONTYPE_PAPERCLIP				16
+#define PWL_ICONTYPE_ATTACHMENT				17
+#define PWL_ICONTYPE_TAG					18
+
+#define PWL_ICONTYPE_FOXIT					19
+
+#define PWL_ICONTYPE_UNKNOWN				-1
+
+//checkbox & radiobutton style
+#define PCS_CHECK							0
+#define PCS_CIRCLE							1
+#define PCS_CROSS							2
+#define PCS_DIAMOND							3
+#define PCS_SQUARE							4
+#define PCS_STAR							5
+
+#define	PWL_PI								3.14159265358979f
+#define PWL_BEZIER							0.5522847498308f
+
+//pushbutton layout style
+#define PPBL_LABEL							0
+#define PPBL_ICON							1
+#define PPBL_ICONTOPLABELBOTTOM				2
+#define	PPBL_LABELTOPICONBOTTOM				3
+#define	PPBL_ICONLEFTLABELRIGHT				4
+#define PPBL_LABELLEFTICONRIGHT				5
+#define PPBL_LABELOVERICON					6
+
+class CPWL_Point : public CPDF_Point
+{
+public:
+	CPWL_Point() : CPDF_Point(0.0f,0.0f){}
+	CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx,fy) {}
+	CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {}
+};
+
+enum PWL_PATHDATA_TYPE
+{
+	PWLPT_MOVETO,
+	PWLPT_LINETO,
+	PWLPT_BEZIERTO,
+	PWLPT_UNKNOWN
+};
+
+enum PWL_PATH_TYPE
+{
+	PWLPT_PATHDATA,
+	PWLPT_STREAM
+};
+
+class CPWL_PathData
+{
+public:
+	CPWL_PathData() : point(), type(PWLPT_UNKNOWN){}
+	CPWL_PathData(const CPWL_Point& pt, PWL_PATHDATA_TYPE tp) : point(pt), type(tp) {}
+
+	CPWL_Point								point;
+	PWL_PATHDATA_TYPE						type;
+};
+
+class IPWL_SpellCheck;
+
+class PWL_CLASS CPWL_Utils
+{
+public:
+	static CPDF_Rect						InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
+	static CPDF_Rect						DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
+	static FX_BOOL							IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
+	static FX_BOOL							ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild);
+	static CPDF_Rect						ScaleRect(const CPDF_Rect& rcRect,FX_FLOAT fScale);
+	static CPVT_WordRange					OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
+	static CPDF_Rect						GetCenterSquare(const CPDF_Rect & rect);
+	static CPWL_Color						SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub);
+	static CPWL_Color						DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide);
+	static CPDF_Rect						MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
+	static CPDF_Rect						OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y);
+	static CPDF_Point						OffsetPoint(const  CPDF_Point & point,FX_FLOAT x,FX_FLOAT y);
+	static FX_COLORREF						PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTransparancy = 255);
+	static FX_BOOL							IsBlackOrWhite(const CPWL_Color& color);
+	static CPWL_Color						GetReverseColor(const CPWL_Color& color);
+
+	static CFX_ByteString					GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke = TRUE);
+	static CFX_ByteString					GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
+												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
+												FX_INT32 nStyle, const CPWL_Dash & dash);
+	static CFX_ByteString					GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
+												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
+												FX_INT32 nStyle, const CPWL_Dash & dash);
+	static CFX_ByteString					GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
+	static CFX_ByteString					GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
+
+	static CFX_ByteString					GetPushButtonAppStream(const CPDF_Rect & rcBBox,
+														IFX_Edit_FontMap * pFontMap,
+														CPDF_Stream * pIconStream,
+														CPDF_IconFit & IconFit,
+														const CFX_WideString & sLabel,														
+														const CPWL_Color & crText,
+														FX_FLOAT fFontSize,
+														FX_INT32 nLayOut);
+	static CFX_ByteString					GetCheckBoxAppStream(const CPDF_Rect & rcBBox,
+														FX_INT32 nStyle,
+														const CPWL_Color & crText);
+	static CFX_ByteString					GetRadioButtonAppStream(const CPDF_Rect & rcBBox,
+														FX_INT32 nStyle,
+														const CPWL_Color & crText);
+
+	static CFX_ByteString					GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL, 
+														FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
+	static CFX_ByteString					GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
+														const CPVT_WordRange * pRange = NULL);
+	static CFX_ByteString					GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck,
+														const CPDF_Point & ptOffset,
+														const CPVT_WordRange * pRange = NULL);
+	static CFX_ByteString					GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,
+														const CFX_WideString & sText, FX_INT32 nAlignmentH, FX_INT32 nAlignmentV,
+														FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText);
+	static CFX_ByteString					GetDropButtonAppStream(const CPDF_Rect & rcBBox);
+
+	static void								DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
+														const CPWL_Color & color, FX_INT32 nTransparancy);
+	static void								DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+														const CPDF_Rect & rect,const FX_COLORREF & color);
+	static void								DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
+														const FX_COLORREF & color, FX_FLOAT fWidth);
+	static void								DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+														const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth);
+	static void								DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+												const CPDF_Rect & rect, FX_FLOAT fWidth,
+												const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
+												FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy);
+	static void								DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+														const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color);
+	static void								DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+														FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,
+														FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray);
+	static void								DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, 
+														const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, 
+														IPWL_SpellCheck* pSpellCheck);
+public:
+	static void								ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
+	static void								ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
+	
+	static void								ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray);
+	static void								ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
+
+	static void								ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray);
+	static void								ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
+
+	static void								PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue);
+
+public:
+	static CFX_ByteString					GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill, 
+												const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
+	static void								DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+												FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, 
+												const CPWL_Color& crStroke, const FX_INT32 nTransparancy);
+
+private:
+	static CFX_ByteString					GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount);
+	static void								GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, FX_INT32 nCount);
+
+	static CFX_ByteString					GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+	static CFX_ByteString					GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+	static CFX_ByteString					GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+	static CFX_ByteString					GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+	static CFX_ByteString					GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+	static CFX_ByteString					GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
+
+	static CFX_ByteString					GetAP_Check(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_Circle(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_Cross(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_Diamond(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_Square(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_Star(const CPDF_Rect & crBBox);
+	static CFX_ByteString					GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate);
+
+	static void								GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+	static void								GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+};
+
+#endif // !defined(AFX_PWL_UTILS_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h
index 7e9e25d..c3dd9b7 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h
@@ -1,493 +1,493 @@
-// 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 _PWL_WND_H_

-#define _PWL_WND_H_

-

-class IPWL_Provider;

-class CPWL_Wnd;

-class CPWL_MsgControl;

-class CPWL_Wnd;

-class CPWL_ScrollBar;

-class CPWL_Timer;

-class CPWL_TimerHandler;

-class IPWL_SpellCheck;

-class IFX_SystemHandler;

-

-#ifdef FX_READER_DLL

-	#ifdef PWL_EXPORT

-			#define PWL_CLASS		__declspec(dllexport)

-			#define PWL_FUNCTION	PWL_CLASS	

-		#else

-			#define PWL_CLASS

-			#define PWL_FUNCTION

-	#endif

-#else

-	#define PWL_CLASS

-	#define PWL_FUNCTION

-#endif

-

-//window styles

-#define PWS_CHILD							0x80000000L

-#define PWS_BORDER							0x40000000L

-#define PWS_BACKGROUND						0x20000000L

-#define PWS_HSCROLL							0x10000000L

-#define PWS_VSCROLL							0x08000000L

-#define PWS_VISIBLE							0x04000000L

-#define PWS_DISABLE							0x02000000L

-#define PWS_READONLY						0x01000000L

-#define PWS_AUTOFONTSIZE					0x00800000L

-#define PWS_AUTOTRANSPARENT					0x00400000L

-#define PWS_NOREFRESHCLIP					0x00200000L

-

-//edit and label styles

-#define PES_MULTILINE						0x0001L

-#define PES_PASSWORD						0x0002L

-#define PES_LEFT							0x0004L

-#define PES_RIGHT							0x0008L

-#define PES_MIDDLE							0x0010L

-#define PES_TOP								0x0020L

-#define PES_BOTTOM							0x0040L

-#define PES_CENTER							0x0080L

-#define PES_CHARARRAY						0x0100L

-#define PES_AUTOSCROLL						0x0200L

-#define PES_AUTORETURN						0x0400L

-#define PES_UNDO							0x0800L

-#define PES_RICH							0x1000L

-#define PES_SPELLCHECK						0x2000L

-#define PES_TEXTOVERFLOW					0x4000L

-#define PES_NOREAD							0x8000L

-

-//listbox styles

-#define PLBS_MULTIPLESEL					0x0001L

-#define PLBS_HOVERSEL						0x0008L

-

-//combobox styles

-#define PCBS_ALLOWCUSTOMTEXT				0x0001L

-

-//richedit styles

-#define PRES_MULTILINE						0x0001L

-#define PRES_AUTORETURN						0x0002L

-#define PRES_AUTOSCROLL						0x0004L

-#define PRES_SPELLCHECK						0x0008L

-#define PRES_UNDO							0x0100L

-#define PRES_MULTIPAGES						0x0200L

-#define PRES_TEXTOVERFLOW					0x0400L

-

-//border style

-#define PBS_SOLID							0

-#define PBS_DASH							1

-#define PBS_BEVELED							2

-#define PBS_INSET							3

-#define PBS_UNDERLINED						4

-#define PBS_SHADOW							5

-

-//notification messages

-#define PNM_ADDCHILD						0x00000000L

-#define PNM_REMOVECHILD						0x00000001L

-#define PNM_SETSCROLLINFO					0x00000002L

-#define PNM_SETSCROLLPOS					0x00000003L

-#define PNM_SCROLLWINDOW					0x00000004L

-#define PNM_LBUTTONDOWN						0x00000005L

-#define PNM_LBUTTONUP						0x00000006L

-#define PNM_MOUSEMOVE						0x00000007L

-#define	PNM_NOTERESET						0x00000008L

-#define PNM_SETCARETINFO					0x00000009L

-#define PNM_SELCHANGED						0x0000000AL

-#define	PNM_NOTEEDITCHANGED					0x0000000BL

-

-#define PWL_CLASSNAME_EDIT					"CPWL_Edit"

-

-struct CPWL_Dash

-{

-	CPWL_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase)

-	{}

-

-	FX_INT32			nDash;

-	FX_INT32			nGap;

-	FX_INT32			nPhase;

-};

-

-struct PWL_CLASS CPWL_Color

-{

-	CPWL_Color(FX_INT32 type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f)

-		: nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4)

-	{}

-

-	CPWL_Color(FX_INT32 r, FX_INT32 g, FX_INT32 b) :

-		nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0)

-	{}

-	

-	void ConvertColorType(FX_INT32 nColorType);

-

-	/*

-	COLORTYPE_TRANSPARENT

-	COLORTYPE_RGB

-	COLORTYPE_CMYK

-	COLORTYPE_GRAY

-	*/

-	FX_INT32					nColorType; 

-	FX_FLOAT					fColor1,fColor2,fColor3,fColor4;

-};

-

-inline FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2)

-{

-	return c1.nColorType == c2.nColorType && 

-		c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 &&

-		c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 &&

-		c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 &&

-		c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;

-}

-

-inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2)

-{

-	return !operator == (c1, c2);

-}

-

-#define PWL_SCROLLBAR_WIDTH					12.0f

-#define PWL_SCROLLBAR_BUTTON_WIDTH			9.0f

-#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH	2.0f

-#define PWL_SCROLLBAR_TRANSPARANCY			150

-#define PWL_SCROLLBAR_BKCOLOR				CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f)

-#define PWL_DEFAULT_SELTEXTCOLOR			CPWL_Color(COLORTYPE_RGB,1,1,1)

-#define PWL_DEFAULT_SELBACKCOLOR			CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f)

-#define PWL_DEFAULT_BACKCOLOR				PWL_DEFAULT_SELTEXTCOLOR

-#define PWL_DEFAULT_TEXTCOLOR				CPWL_Color(COLORTYPE_RGB,0,0,0)

-#define PWL_DEFAULT_FONTSIZE				9.0f

-#define PWL_DEFAULT_BLACKCOLOR				CPWL_Color(COLORTYPE_GRAY,0)

-#define PWL_DEFAULT_WHITECOLOR				CPWL_Color(COLORTYPE_GRAY,1)

-#define PWL_DEFAULT_HEAVYGRAYCOLOR			CPWL_Color(COLORTYPE_GRAY,0.50)

-#define PWL_DEFAULT_LIGHTGRAYCOLOR			CPWL_Color(COLORTYPE_GRAY,0.75)

-#define PWL_TRIANGLE_HALFLEN				2.0f

-#define	PWL_CBBUTTON_TRIANGLE_HALFLEN		3.0f

-#define PWL_INVALIDATE_INFLATE				2

-

-class IPWL_SpellCheck

-{

-public:

-	virtual FX_BOOL							CheckWord(FX_LPCSTR sWord) = 0;

-	virtual void							SuggestWords(FX_LPCSTR sWord, CFX_ByteStringArray & sSuggest) = 0;	

-};

-

-class IPWL_Provider

-{

-public:

-	//get a matrix which map user space to CWnd client space

-	virtual CPDF_Matrix						GetWindowMatrix(void* pAttachedData) = 0;

-

-	/*

-	0 L"&Undo\tCtrl+Z"

-	1 L"&Redo\tCtrl+Shift+Z"

-	2 L"Cu&t\tCtrl+X"

-	3 L"&Copy\tCtrl+C"

-	4 L"&Paste\tCtrl+V"

-	5 L"&Delete"

-	6  L"&Select All\tCtrl+A"

-	*/

-	virtual CFX_WideString					LoadPopupMenuString(FX_INT32 nIndex) = 0;

-};

-

-class IPWL_FocusHandler

-{

-public:

-	virtual void							OnSetFocus(CPWL_Wnd* pWnd) = 0;

-	virtual void							OnKillFocus(CPWL_Wnd* pWnd) = 0;

-};

-

-struct PWL_CREATEPARAM

-{

-public:

-	PWL_CREATEPARAM() : rcRectWnd(0,0,0,0),

-		pSystemHandler(NULL),

-		pFontMap(NULL),

-		pProvider(NULL),

-		pFocusHandler(NULL),

-		dwFlags(0),

-		sBackgroundColor(),

-		hAttachedWnd(NULL),

-		pSpellCheck(NULL),

-		nBorderStyle(PBS_SOLID),

-		dwBorderWidth(1),

-		sBorderColor(),

-		sTextColor(),

-		sTextStrokeColor(),

-		nTransparency(255),

-		fFontSize(PWL_DEFAULT_FONTSIZE),

-		sDash(3,0,0),	

-		pAttachedData(NULL),

-		pParentWnd(NULL),

-		pMsgControl(NULL),

-		eCursorType(FXCT_ARROW),

-		mtChild(1,0,0,1,0,0)

-	{

-	}

-

-	CPDF_Rect				rcRectWnd;				//required	

-	IFX_SystemHandler*		pSystemHandler;			//required

-	IFX_Edit_FontMap*		pFontMap;				//required for text window

-	IPWL_Provider*			pProvider;				//required for self coordinate

-	IPWL_FocusHandler*		pFocusHandler;			//optional

-	FX_DWORD				dwFlags;				//optional

-	CPWL_Color				sBackgroundColor;		//optional

-	FX_HWND					hAttachedWnd;			//required for no-reader framework

-	IPWL_SpellCheck*		pSpellCheck;			//required for spellchecking

-	FX_INT32				nBorderStyle;			//optional

-	FX_INT32				dwBorderWidth;			//optional

-	CPWL_Color				sBorderColor;			//optional

-	CPWL_Color				sTextColor;				//optional

-	CPWL_Color				sTextStrokeColor;		//optional

-	FX_INT32				nTransparency;			//optional

-	FX_FLOAT				fFontSize;				//optional

-	CPWL_Dash				sDash;					//optional

-	void*					pAttachedData;			//optional

-	CPWL_Wnd*				pParentWnd;				//ignore

-	CPWL_MsgControl*		pMsgControl;			//ignore

-	FX_INT32				eCursorType;			//ignore

-	CPDF_Matrix				mtChild;				//ignore

-};

-

-class CPWL_Timer

-{

-public:

-	CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);

-	virtual ~CPWL_Timer();

-

-	FX_INT32							SetPWLTimer(FX_INT32 nElapse);

-	void								KillPWLTimer();

-	static void 						TimerProc(FX_INT32 idEvent);

-

-private:

-	FX_INT32							m_nTimerID;	

-	CPWL_TimerHandler*					m_pAttached;

-	IFX_SystemHandler*					m_pSystemHandler;

-};

-

-class PWL_CLASS CPWL_TimerHandler

-{

-public:

-	CPWL_TimerHandler();

-	virtual ~CPWL_TimerHandler();

-

-	void								BeginTimer(FX_INT32 nElapse);

-	void								EndTimer();

-	virtual void						TimerProc();

-	virtual IFX_SystemHandler*			GetSystemHandler() const = 0;

-

-private:

-	CPWL_Timer*							m_pTimer;

-};

-

-class PWL_CLASS CPWL_Wnd : public CPWL_TimerHandler

-{

-	friend class CPWL_MsgControl;

-public:

-	CPWL_Wnd();

-	virtual ~CPWL_Wnd();

-

-	void							Create(const PWL_CREATEPARAM & cp);

-	virtual CFX_ByteString			GetClassName() const;	

-	void							Destroy();

-	void							Move(const CPDF_Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh);

-	virtual void					InvalidateRect(CPDF_Rect* pRect = NULL);

-

-	void							GetAppearanceStream(CFX_ByteString & sAppStream);

-	void							DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnKeyUp(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnRButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnRButtonDown(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);

-	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);

-

-	virtual void					SetFocus();

-	virtual void					KillFocus();

-	void							SetCapture();

-	void							ReleaseCapture();

-

-	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);

-	virtual void					SetTextColor(const CPWL_Color & color);

-	virtual void					SetTextStrokeColor(const CPWL_Color & color);

-	virtual void					SetVisible(FX_BOOL bVisible);

-

-	virtual CPDF_Rect				GetFocusRect() const;

-	virtual CPWL_Color				GetBackgroundColor() const;

-	virtual CPWL_Color				GetBorderColor() const;

-	virtual CPWL_Color				GetTextColor() const;

-	virtual CPWL_Color				GetTextStrokeColor() const;

-	virtual FX_FLOAT				GetFontSize() const;

-	virtual FX_INT32				GetInnerBorderWidth() const;

-	virtual CPWL_Color				GetBorderLeftTopColor(FX_INT32 nBorderStyle) const;

-	virtual CPWL_Color				GetBorderRightBottomColor(FX_INT32 nBorderStyle) const;

-

-	virtual FX_BOOL					IsModified() const {return FALSE;}

-

-	virtual void					SetFontSize(FX_FLOAT fFontSize);	

-

-	void							SetBackgroundColor(const CPWL_Color & color);		

-	void							SetBorderColor(const CPWL_Color & color);

-	void							SetBorderWidth(FX_INT32 nBorderWidth);

-	void							SetClipRect(const CPDF_Rect & rect);

-	void							SetBorderStyle(FX_INT32 eBorderStyle);	

-	void							SetBorderDash(const CPWL_Dash & sDash);

-

-	CPDF_Rect						GetOriginWindowRect() const;

-	virtual CPDF_Rect				GetWindowRect() const;

-	virtual CPDF_Rect				GetClientRect() const;

-	CPDF_Point						GetCenterPoint() const;

-	CPDF_Rect						GetClientCenterSquare() const;

-	CPDF_Rect						GetWindowCenterSquare() const;		

-	FX_INT32						GetBorderWidth() const;		

-	FX_BOOL							IsVisible() const {return m_bVisible;}	

-	FX_BOOL							HasFlag(FX_DWORD dwFlags) const;

-	void							AddFlag(FX_DWORD dwFlags);

-	void							RemoveFlag(FX_DWORD dwFlags);

-	CPDF_Rect						GetClipRect() const;		

-	CPWL_Wnd*						GetParentWindow() const;		

-	FX_INT32						GetBorderStyle() const;	

-	CPWL_Dash						GetBorderDash() const;

-	void*							GetAttachedData() const;

-	

-	FX_BOOL							WndHitTest(const CPDF_Point & point) const;

-	FX_BOOL							ClientHitTest(const CPDF_Point & point) const;

-	FX_BOOL							IsCaptureMouse() const;

-

-	const CPWL_Wnd*					GetFocused() const;

-	FX_BOOL							IsFocused() const;

-	FX_BOOL							IsReadOnly() const;

-	CPWL_ScrollBar*					GetVScrollBar() const;

-

-	IFX_Edit_FontMap*				GetFontMap() const;

-	IPWL_Provider*					GetProvider() const;

-	virtual IFX_SystemHandler*		GetSystemHandler() const;

-	IPWL_FocusHandler*				GetFocusHandler() const;

-	

-	FX_INT32						GetTransparency();

-	void							SetTransparency(FX_INT32 nTransparency);

-

-	CPDF_Matrix						GetChildToRoot() const;

-	CPDF_Matrix						GetChildMatrix() const;

-	void							SetChildMatrix(const CPDF_Matrix& mt);

-	CPDF_Matrix						GetWindowMatrix() const;

-

-	virtual CPDF_Point				ChildToParent(const CPDF_Point& point) const;

-	virtual CPDF_Rect				ChildToParent(const CPDF_Rect& rect) const;

-	virtual CPDF_Point				ParentToChild(const CPDF_Point& point) const;

-	virtual CPDF_Rect				ParentToChild(const CPDF_Rect& rect) const;

-

-	//those methods only implemented by listctrl item

-	virtual FX_FLOAT				GetItemHeight(FX_FLOAT fLimitWidth) {return 0;} 

-	virtual FX_FLOAT				GetItemLeftMargin() {return 0;} 

-	virtual FX_FLOAT				GetItemRightMargin() {return 0;} 

-

-	void							EnableWindow(FX_BOOL bEnable);

-	FX_BOOL							IsEnabled();

-	virtual void					SetCursor();

-

-protected:	

-	virtual void					CreateChildWnd(const PWL_CREATEPARAM & cp);

-	virtual void					RePosChildWnd();

-	void							GetAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);

-	virtual void					GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream);

-

-	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-	virtual void					DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);

-

-	virtual void					OnCreate(PWL_CREATEPARAM & cp);

-	virtual void					OnCreated();

-	virtual void					OnDestroy();

-

-	virtual void					OnSetFocus();

-	virtual void					OnKillFocus();

-

-	virtual void					OnEnabled();

-	virtual void					OnDisabled();

-

-	void							SetNotifyFlag(FX_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;};

- 

-	FX_BOOL							IsValid() const;

-	PWL_CREATEPARAM					GetCreationParam() const;		

-	FX_BOOL							IsNotifying() const {return m_bNotifying;}	

-	

-	void							InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew);

-

-	void							PWLtoWnd(const CPDF_Point & point, FX_INT32& x, FX_INT32& y) const;

-	FX_RECT							PWLtoWnd(const CPDF_Rect & rect) const;	

-	FX_HWND							GetAttachedHWnd() const;

-	

-	FX_BOOL							IsWndCaptureMouse(const CPWL_Wnd * pWnd) const;

-	FX_BOOL							IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const;	

-	const CPWL_Wnd*					GetRootWnd() const;	

-

-	FX_BOOL							IsCTRLpressed(FX_DWORD nFlag) const;

-	FX_BOOL							IsSHIFTpressed(FX_DWORD nFlag) const;

-	FX_BOOL							IsALTpressed(FX_DWORD nFlag) const;

-	FX_BOOL							IsINSERTpressed(FX_DWORD nFlag) const;

-

-private:

-	void							AddChild(CPWL_Wnd * pWnd);

-	void							RemoveChild(CPWL_Wnd * pWnd);

-

-	void							CreateScrollBar(const PWL_CREATEPARAM & cp);

-	void							CreateVScrollBar(const PWL_CREATEPARAM & cp);	

-

-	void							AjustStyle();	

-	void							CreateMsgControl();

-	void							DestroyMsgControl();

-	

-	CPWL_MsgControl*				GetMsgControl() const;	

-	

-protected:

-	CFX_ArrayTemplate<CPWL_Wnd*>	m_aChildren;

-

-private:

-	PWL_CREATEPARAM					m_sPrivateParam;

-	

-	CPWL_ScrollBar*					m_pVScrollBar;

-

-	CPDF_Rect						m_rcWindow;

-	CPDF_Rect						m_rcClip;

-

-	FX_BOOL							m_bCreated;			

-	FX_BOOL							m_bVisible;

-	FX_BOOL							m_bNotifying;	

-	FX_BOOL							m_bEnabled;

-};

-

-// #ifndef VK_END

-// 

-// #define VK_END            0x23

-// #define VK_HOME           0x24

-// #define VK_LEFT           0x25

-// #define VK_UP             0x26

-// #define VK_RIGHT          0x27

-// #define VK_DOWN           0x28

-// #define VK_INSERT         0x2D

-// #define VK_DELETE         0x2E

-// 

-// #define VK_BACK           0x08

-// #define VK_TAB            0x09

-// 

-// #define VK_CLEAR          0x0C

-// #define VK_RETURN         0x0D

-// #define VK_ESCAPE         0x1B

-// #define VK_SPACE          0x20

-// #endif

-// 

-// #define VK_NONE			  0

-

-#endif // !defined(AFX_PWL_WND_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)

-

-

+// 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 _PWL_WND_H_
+#define _PWL_WND_H_
+
+class IPWL_Provider;
+class CPWL_Wnd;
+class CPWL_MsgControl;
+class CPWL_Wnd;
+class CPWL_ScrollBar;
+class CPWL_Timer;
+class CPWL_TimerHandler;
+class IPWL_SpellCheck;
+class IFX_SystemHandler;
+
+#ifdef FX_READER_DLL
+	#ifdef PWL_EXPORT
+			#define PWL_CLASS		__declspec(dllexport)
+			#define PWL_FUNCTION	PWL_CLASS	
+		#else
+			#define PWL_CLASS
+			#define PWL_FUNCTION
+	#endif
+#else
+	#define PWL_CLASS
+	#define PWL_FUNCTION
+#endif
+
+//window styles
+#define PWS_CHILD							0x80000000L
+#define PWS_BORDER							0x40000000L
+#define PWS_BACKGROUND						0x20000000L
+#define PWS_HSCROLL							0x10000000L
+#define PWS_VSCROLL							0x08000000L
+#define PWS_VISIBLE							0x04000000L
+#define PWS_DISABLE							0x02000000L
+#define PWS_READONLY						0x01000000L
+#define PWS_AUTOFONTSIZE					0x00800000L
+#define PWS_AUTOTRANSPARENT					0x00400000L
+#define PWS_NOREFRESHCLIP					0x00200000L
+
+//edit and label styles
+#define PES_MULTILINE						0x0001L
+#define PES_PASSWORD						0x0002L
+#define PES_LEFT							0x0004L
+#define PES_RIGHT							0x0008L
+#define PES_MIDDLE							0x0010L
+#define PES_TOP								0x0020L
+#define PES_BOTTOM							0x0040L
+#define PES_CENTER							0x0080L
+#define PES_CHARARRAY						0x0100L
+#define PES_AUTOSCROLL						0x0200L
+#define PES_AUTORETURN						0x0400L
+#define PES_UNDO							0x0800L
+#define PES_RICH							0x1000L
+#define PES_SPELLCHECK						0x2000L
+#define PES_TEXTOVERFLOW					0x4000L
+#define PES_NOREAD							0x8000L
+
+//listbox styles
+#define PLBS_MULTIPLESEL					0x0001L
+#define PLBS_HOVERSEL						0x0008L
+
+//combobox styles
+#define PCBS_ALLOWCUSTOMTEXT				0x0001L
+
+//richedit styles
+#define PRES_MULTILINE						0x0001L
+#define PRES_AUTORETURN						0x0002L
+#define PRES_AUTOSCROLL						0x0004L
+#define PRES_SPELLCHECK						0x0008L
+#define PRES_UNDO							0x0100L
+#define PRES_MULTIPAGES						0x0200L
+#define PRES_TEXTOVERFLOW					0x0400L
+
+//border style
+#define PBS_SOLID							0
+#define PBS_DASH							1
+#define PBS_BEVELED							2
+#define PBS_INSET							3
+#define PBS_UNDERLINED						4
+#define PBS_SHADOW							5
+
+//notification messages
+#define PNM_ADDCHILD						0x00000000L
+#define PNM_REMOVECHILD						0x00000001L
+#define PNM_SETSCROLLINFO					0x00000002L
+#define PNM_SETSCROLLPOS					0x00000003L
+#define PNM_SCROLLWINDOW					0x00000004L
+#define PNM_LBUTTONDOWN						0x00000005L
+#define PNM_LBUTTONUP						0x00000006L
+#define PNM_MOUSEMOVE						0x00000007L
+#define	PNM_NOTERESET						0x00000008L
+#define PNM_SETCARETINFO					0x00000009L
+#define PNM_SELCHANGED						0x0000000AL
+#define	PNM_NOTEEDITCHANGED					0x0000000BL
+
+#define PWL_CLASSNAME_EDIT					"CPWL_Edit"
+
+struct CPWL_Dash
+{
+	CPWL_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase)
+	{}
+
+	FX_INT32			nDash;
+	FX_INT32			nGap;
+	FX_INT32			nPhase;
+};
+
+struct PWL_CLASS CPWL_Color
+{
+	CPWL_Color(FX_INT32 type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f)
+		: nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4)
+	{}
+
+	CPWL_Color(FX_INT32 r, FX_INT32 g, FX_INT32 b) :
+		nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0)
+	{}
+	
+	void ConvertColorType(FX_INT32 nColorType);
+
+	/*
+	COLORTYPE_TRANSPARENT
+	COLORTYPE_RGB
+	COLORTYPE_CMYK
+	COLORTYPE_GRAY
+	*/
+	FX_INT32					nColorType; 
+	FX_FLOAT					fColor1,fColor2,fColor3,fColor4;
+};
+
+inline FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2)
+{
+	return c1.nColorType == c2.nColorType && 
+		c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 &&
+		c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 &&
+		c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 &&
+		c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
+}
+
+inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2)
+{
+	return !operator == (c1, c2);
+}
+
+#define PWL_SCROLLBAR_WIDTH					12.0f
+#define PWL_SCROLLBAR_BUTTON_WIDTH			9.0f
+#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH	2.0f
+#define PWL_SCROLLBAR_TRANSPARANCY			150
+#define PWL_SCROLLBAR_BKCOLOR				CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f)
+#define PWL_DEFAULT_SELTEXTCOLOR			CPWL_Color(COLORTYPE_RGB,1,1,1)
+#define PWL_DEFAULT_SELBACKCOLOR			CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f)
+#define PWL_DEFAULT_BACKCOLOR				PWL_DEFAULT_SELTEXTCOLOR
+#define PWL_DEFAULT_TEXTCOLOR				CPWL_Color(COLORTYPE_RGB,0,0,0)
+#define PWL_DEFAULT_FONTSIZE				9.0f
+#define PWL_DEFAULT_BLACKCOLOR				CPWL_Color(COLORTYPE_GRAY,0)
+#define PWL_DEFAULT_WHITECOLOR				CPWL_Color(COLORTYPE_GRAY,1)
+#define PWL_DEFAULT_HEAVYGRAYCOLOR			CPWL_Color(COLORTYPE_GRAY,0.50)
+#define PWL_DEFAULT_LIGHTGRAYCOLOR			CPWL_Color(COLORTYPE_GRAY,0.75)
+#define PWL_TRIANGLE_HALFLEN				2.0f
+#define	PWL_CBBUTTON_TRIANGLE_HALFLEN		3.0f
+#define PWL_INVALIDATE_INFLATE				2
+
+class IPWL_SpellCheck
+{
+public:
+	virtual FX_BOOL							CheckWord(FX_LPCSTR sWord) = 0;
+	virtual void							SuggestWords(FX_LPCSTR sWord, CFX_ByteStringArray & sSuggest) = 0;	
+};
+
+class IPWL_Provider
+{
+public:
+	//get a matrix which map user space to CWnd client space
+	virtual CPDF_Matrix						GetWindowMatrix(void* pAttachedData) = 0;
+
+	/*
+	0 L"&Undo\tCtrl+Z"
+	1 L"&Redo\tCtrl+Shift+Z"
+	2 L"Cu&t\tCtrl+X"
+	3 L"&Copy\tCtrl+C"
+	4 L"&Paste\tCtrl+V"
+	5 L"&Delete"
+	6  L"&Select All\tCtrl+A"
+	*/
+	virtual CFX_WideString					LoadPopupMenuString(FX_INT32 nIndex) = 0;
+};
+
+class IPWL_FocusHandler
+{
+public:
+	virtual void							OnSetFocus(CPWL_Wnd* pWnd) = 0;
+	virtual void							OnKillFocus(CPWL_Wnd* pWnd) = 0;
+};
+
+struct PWL_CREATEPARAM
+{
+public:
+	PWL_CREATEPARAM() : rcRectWnd(0,0,0,0),
+		pSystemHandler(NULL),
+		pFontMap(NULL),
+		pProvider(NULL),
+		pFocusHandler(NULL),
+		dwFlags(0),
+		sBackgroundColor(),
+		hAttachedWnd(NULL),
+		pSpellCheck(NULL),
+		nBorderStyle(PBS_SOLID),
+		dwBorderWidth(1),
+		sBorderColor(),
+		sTextColor(),
+		sTextStrokeColor(),
+		nTransparency(255),
+		fFontSize(PWL_DEFAULT_FONTSIZE),
+		sDash(3,0,0),	
+		pAttachedData(NULL),
+		pParentWnd(NULL),
+		pMsgControl(NULL),
+		eCursorType(FXCT_ARROW),
+		mtChild(1,0,0,1,0,0)
+	{
+	}
+
+	CPDF_Rect				rcRectWnd;				//required	
+	IFX_SystemHandler*		pSystemHandler;			//required
+	IFX_Edit_FontMap*		pFontMap;				//required for text window
+	IPWL_Provider*			pProvider;				//required for self coordinate
+	IPWL_FocusHandler*		pFocusHandler;			//optional
+	FX_DWORD				dwFlags;				//optional
+	CPWL_Color				sBackgroundColor;		//optional
+	FX_HWND					hAttachedWnd;			//required for no-reader framework
+	IPWL_SpellCheck*		pSpellCheck;			//required for spellchecking
+	FX_INT32				nBorderStyle;			//optional
+	FX_INT32				dwBorderWidth;			//optional
+	CPWL_Color				sBorderColor;			//optional
+	CPWL_Color				sTextColor;				//optional
+	CPWL_Color				sTextStrokeColor;		//optional
+	FX_INT32				nTransparency;			//optional
+	FX_FLOAT				fFontSize;				//optional
+	CPWL_Dash				sDash;					//optional
+	void*					pAttachedData;			//optional
+	CPWL_Wnd*				pParentWnd;				//ignore
+	CPWL_MsgControl*		pMsgControl;			//ignore
+	FX_INT32				eCursorType;			//ignore
+	CPDF_Matrix				mtChild;				//ignore
+};
+
+class CPWL_Timer
+{
+public:
+	CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
+	virtual ~CPWL_Timer();
+
+	FX_INT32							SetPWLTimer(FX_INT32 nElapse);
+	void								KillPWLTimer();
+	static void 						TimerProc(FX_INT32 idEvent);
+
+private:
+	FX_INT32							m_nTimerID;	
+	CPWL_TimerHandler*					m_pAttached;
+	IFX_SystemHandler*					m_pSystemHandler;
+};
+
+class PWL_CLASS CPWL_TimerHandler
+{
+public:
+	CPWL_TimerHandler();
+	virtual ~CPWL_TimerHandler();
+
+	void								BeginTimer(FX_INT32 nElapse);
+	void								EndTimer();
+	virtual void						TimerProc();
+	virtual IFX_SystemHandler*			GetSystemHandler() const = 0;
+
+private:
+	CPWL_Timer*							m_pTimer;
+};
+
+class PWL_CLASS CPWL_Wnd : public CPWL_TimerHandler
+{
+	friend class CPWL_MsgControl;
+public:
+	CPWL_Wnd();
+	virtual ~CPWL_Wnd();
+
+	void							Create(const PWL_CREATEPARAM & cp);
+	virtual CFX_ByteString			GetClassName() const;	
+	void							Destroy();
+	void							Move(const CPDF_Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh);
+	virtual void					InvalidateRect(CPDF_Rect* pRect = NULL);
+
+	void							GetAppearanceStream(CFX_ByteString & sAppStream);
+	void							DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual FX_BOOL					OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnKeyUp(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnChar(FX_WORD nChar, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnRButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnRButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
+	virtual FX_BOOL					OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
+
+	virtual void					SetFocus();
+	virtual void					KillFocus();
+	void							SetCapture();
+	void							ReleaseCapture();
+
+	virtual void					OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
+	virtual void					SetTextColor(const CPWL_Color & color);
+	virtual void					SetTextStrokeColor(const CPWL_Color & color);
+	virtual void					SetVisible(FX_BOOL bVisible);
+
+	virtual CPDF_Rect				GetFocusRect() const;
+	virtual CPWL_Color				GetBackgroundColor() const;
+	virtual CPWL_Color				GetBorderColor() const;
+	virtual CPWL_Color				GetTextColor() const;
+	virtual CPWL_Color				GetTextStrokeColor() const;
+	virtual FX_FLOAT				GetFontSize() const;
+	virtual FX_INT32				GetInnerBorderWidth() const;
+	virtual CPWL_Color				GetBorderLeftTopColor(FX_INT32 nBorderStyle) const;
+	virtual CPWL_Color				GetBorderRightBottomColor(FX_INT32 nBorderStyle) const;
+
+	virtual FX_BOOL					IsModified() const {return FALSE;}
+
+	virtual void					SetFontSize(FX_FLOAT fFontSize);	
+
+	void							SetBackgroundColor(const CPWL_Color & color);		
+	void							SetBorderColor(const CPWL_Color & color);
+	void							SetBorderWidth(FX_INT32 nBorderWidth);
+	void							SetClipRect(const CPDF_Rect & rect);
+	void							SetBorderStyle(FX_INT32 eBorderStyle);	
+	void							SetBorderDash(const CPWL_Dash & sDash);
+
+	CPDF_Rect						GetOriginWindowRect() const;
+	virtual CPDF_Rect				GetWindowRect() const;
+	virtual CPDF_Rect				GetClientRect() const;
+	CPDF_Point						GetCenterPoint() const;
+	CPDF_Rect						GetClientCenterSquare() const;
+	CPDF_Rect						GetWindowCenterSquare() const;		
+	FX_INT32						GetBorderWidth() const;		
+	FX_BOOL							IsVisible() const {return m_bVisible;}	
+	FX_BOOL							HasFlag(FX_DWORD dwFlags) const;
+	void							AddFlag(FX_DWORD dwFlags);
+	void							RemoveFlag(FX_DWORD dwFlags);
+	CPDF_Rect						GetClipRect() const;		
+	CPWL_Wnd*						GetParentWindow() const;		
+	FX_INT32						GetBorderStyle() const;	
+	CPWL_Dash						GetBorderDash() const;
+	void*							GetAttachedData() const;
+	
+	FX_BOOL							WndHitTest(const CPDF_Point & point) const;
+	FX_BOOL							ClientHitTest(const CPDF_Point & point) const;
+	FX_BOOL							IsCaptureMouse() const;
+
+	const CPWL_Wnd*					GetFocused() const;
+	FX_BOOL							IsFocused() const;
+	FX_BOOL							IsReadOnly() const;
+	CPWL_ScrollBar*					GetVScrollBar() const;
+
+	IFX_Edit_FontMap*				GetFontMap() const;
+	IPWL_Provider*					GetProvider() const;
+	virtual IFX_SystemHandler*		GetSystemHandler() const;
+	IPWL_FocusHandler*				GetFocusHandler() const;
+	
+	FX_INT32						GetTransparency();
+	void							SetTransparency(FX_INT32 nTransparency);
+
+	CPDF_Matrix						GetChildToRoot() const;
+	CPDF_Matrix						GetChildMatrix() const;
+	void							SetChildMatrix(const CPDF_Matrix& mt);
+	CPDF_Matrix						GetWindowMatrix() const;
+
+	virtual CPDF_Point				ChildToParent(const CPDF_Point& point) const;
+	virtual CPDF_Rect				ChildToParent(const CPDF_Rect& rect) const;
+	virtual CPDF_Point				ParentToChild(const CPDF_Point& point) const;
+	virtual CPDF_Rect				ParentToChild(const CPDF_Rect& rect) const;
+
+	//those methods only implemented by listctrl item
+	virtual FX_FLOAT				GetItemHeight(FX_FLOAT fLimitWidth) {return 0;} 
+	virtual FX_FLOAT				GetItemLeftMargin() {return 0;} 
+	virtual FX_FLOAT				GetItemRightMargin() {return 0;} 
+
+	void							EnableWindow(FX_BOOL bEnable);
+	FX_BOOL							IsEnabled();
+	virtual void					SetCursor();
+
+protected:	
+	virtual void					CreateChildWnd(const PWL_CREATEPARAM & cp);
+	virtual void					RePosChildWnd();
+	void							GetAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void					GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+	virtual void					GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream);
+
+	virtual void					DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+	virtual void					DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+	virtual void					OnCreate(PWL_CREATEPARAM & cp);
+	virtual void					OnCreated();
+	virtual void					OnDestroy();
+
+	virtual void					OnSetFocus();
+	virtual void					OnKillFocus();
+
+	virtual void					OnEnabled();
+	virtual void					OnDisabled();
+
+	void							SetNotifyFlag(FX_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;};
+ 
+	FX_BOOL							IsValid() const;
+	PWL_CREATEPARAM					GetCreationParam() const;		
+	FX_BOOL							IsNotifying() const {return m_bNotifying;}	
+	
+	void							InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew);
+
+	void							PWLtoWnd(const CPDF_Point & point, FX_INT32& x, FX_INT32& y) const;
+	FX_RECT							PWLtoWnd(const CPDF_Rect & rect) const;	
+	FX_HWND							GetAttachedHWnd() const;
+	
+	FX_BOOL							IsWndCaptureMouse(const CPWL_Wnd * pWnd) const;
+	FX_BOOL							IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const;	
+	const CPWL_Wnd*					GetRootWnd() const;	
+
+	FX_BOOL							IsCTRLpressed(FX_DWORD nFlag) const;
+	FX_BOOL							IsSHIFTpressed(FX_DWORD nFlag) const;
+	FX_BOOL							IsALTpressed(FX_DWORD nFlag) const;
+	FX_BOOL							IsINSERTpressed(FX_DWORD nFlag) const;
+
+private:
+	void							AddChild(CPWL_Wnd * pWnd);
+	void							RemoveChild(CPWL_Wnd * pWnd);
+
+	void							CreateScrollBar(const PWL_CREATEPARAM & cp);
+	void							CreateVScrollBar(const PWL_CREATEPARAM & cp);	
+
+	void							AjustStyle();	
+	void							CreateMsgControl();
+	void							DestroyMsgControl();
+	
+	CPWL_MsgControl*				GetMsgControl() const;	
+	
+protected:
+	CFX_ArrayTemplate<CPWL_Wnd*>	m_aChildren;
+
+private:
+	PWL_CREATEPARAM					m_sPrivateParam;
+	
+	CPWL_ScrollBar*					m_pVScrollBar;
+
+	CPDF_Rect						m_rcWindow;
+	CPDF_Rect						m_rcClip;
+
+	FX_BOOL							m_bCreated;			
+	FX_BOOL							m_bVisible;
+	FX_BOOL							m_bNotifying;	
+	FX_BOOL							m_bEnabled;
+};
+
+// #ifndef VK_END
+// 
+// #define VK_END            0x23
+// #define VK_HOME           0x24
+// #define VK_LEFT           0x25
+// #define VK_UP             0x26
+// #define VK_RIGHT          0x27
+// #define VK_DOWN           0x28
+// #define VK_INSERT         0x2D
+// #define VK_DELETE         0x2E
+// 
+// #define VK_BACK           0x08
+// #define VK_TAB            0x09
+// 
+// #define VK_CLEAR          0x0C
+// #define VK_RETURN         0x0D
+// #define VK_ESCAPE         0x1B
+// #define VK_SPACE          0x20
+// #endif
+// 
+// #define VK_NONE			  0
+
+#endif // !defined(AFX_PWL_WND_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)
+
+