summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/include/pdfwindow')
-rw-r--r--fpdfsdk/include/pdfwindow/IPDFWindow.h28
-rw-r--r--fpdfsdk/include/pdfwindow/PDFWindow.h28
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Button.h28
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Caret.h58
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ComboBox.h115
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Edit.h138
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_EditCtrl.h171
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_FontMap.h137
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Icon.h59
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_IconList.h125
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Label.h51
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ListBox.h103
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ListCtrl.h53
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Note.h355
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ScrollBar.h166
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Signature.h67
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_SpecialButton.h63
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Utils.h237
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Wnd.h493
19 files changed, 2475 insertions, 0 deletions
diff --git a/fpdfsdk/include/pdfwindow/IPDFWindow.h b/fpdfsdk/include/pdfwindow/IPDFWindow.h
new file mode 100644
index 0000000000..53b96a64fd
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/IPDFWindow.h
@@ -0,0 +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_
diff --git a/fpdfsdk/include/pdfwindow/PDFWindow.h b/fpdfsdk/include/pdfwindow/PDFWindow.h
new file mode 100644
index 0000000000..22703e1f01
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PDFWindow.h
@@ -0,0 +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
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Button.h b/fpdfsdk/include/pdfwindow/PWL_Button.h
new file mode 100644
index 0000000000..202a0d1152
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Button.h
@@ -0,0 +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_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h
new file mode 100644
index 0000000000..4586d471ad
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h
@@ -0,0 +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_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
new file mode 100644
index 0000000000..f64b636c44
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
@@ -0,0 +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_)
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h
new file mode 100644
index 0000000000..71f675600d
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h
@@ -0,0 +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
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
new file mode 100644
index 0000000000..3df0f4c23f
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
@@ -0,0 +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
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
new file mode 100644
index 0000000000..858bb2a398
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
@@ -0,0 +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
diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h
new file mode 100644
index 0000000000..d6b121e800
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h
@@ -0,0 +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_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h
new file mode 100644
index 0000000000..e5192901e8
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h
@@ -0,0 +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_
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h
new file mode 100644
index 0000000000..16bd1ae39a
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Label.h
@@ -0,0 +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
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
new file mode 100644
index 0000000000..6ef82c82c6
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
@@ -0,0 +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_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
new file mode 100644
index 0000000000..3a3b922e68
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
@@ -0,0 +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
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h
new file mode 100644
index 0000000000..89308e63e4
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Note.h
@@ -0,0 +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
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
new file mode 100644
index 0000000000..3196b2209e
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
@@ -0,0 +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_)
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Signature.h b/fpdfsdk/include/pdfwindow/PWL_Signature.h
new file mode 100644
index 0000000000..712f7408ea
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Signature.h
@@ -0,0 +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_
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
new file mode 100644
index 0000000000..55613014a0
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
@@ -0,0 +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
+
+
diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h
new file mode 100644
index 0000000000..2eccc363fd
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h
@@ -0,0 +1,237 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _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
new file mode 100644
index 0000000000..7e9e25d07a
--- /dev/null
+++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h
@@ -0,0 +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_)
+
+