summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2016-03-23 19:29:15 -0400
committerdan sinclair <dsinclair@chromium.org>2016-03-23 19:29:15 -0400
commit89e904b1748114df561ebcb020492d085149664e (patch)
tree0f7803a179241a8ff70c70d49e645268975a98d7 /fpdfsdk/pdfwindow
parent61b2fc718910a5ab2a75ec5026b239ff33bccfdc (diff)
downloadpdfium-89e904b1748114df561ebcb020492d085149664e.tar.xz
Move the fpdfsdk/include/pdfwindow/ headers into fpdfsdk/pdfwindow.
This CL moves all of the pdfwindow headers to live beside their source files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1823153002 .
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_Button.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Button.h27
-rw-r--r--fpdfsdk/pdfwindow/PWL_Caret.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Caret.h53
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.h106
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp14
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h172
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.h181
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.h137
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.h58
-rw-r--r--fpdfsdk/pdfwindow/PWL_IconList.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_IconList.h129
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.h45
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.h122
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListCtrl.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListCtrl.h48
-rw-r--r--fpdfsdk/pdfwindow/PWL_Note.cpp20
-rw-r--r--fpdfsdk/pdfwindow/PWL_Note.h351
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.h157
-rw-r--r--fpdfsdk/pdfwindow/PWL_Signature.cpp10
-rw-r--r--fpdfsdk/pdfwindow/PWL_Signature.h67
-rw-r--r--fpdfsdk/pdfwindow/PWL_SpecialButton.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_SpecialButton.h56
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.h412
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.h472
34 files changed, 2668 insertions, 75 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp
index 1a57784c74..851b5541f1 100644
--- a/fpdfsdk/pdfwindow/PWL_Button.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Button.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Button.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {}
diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h
new file mode 100644
index 0000000000..1fffa36d41
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Button.h
@@ -0,0 +1,27 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_PDFWINDOW_PWL_BUTTON_H_
+#define FPDFSDK_PDFWINDOW_PWL_BUTTON_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_Button : public CPWL_Wnd {
+ public:
+ CPWL_Button();
+ ~CPWL_Button() override;
+
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void OnCreate(PWL_CREATEPARAM& cp) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+
+ protected:
+ FX_BOOL m_bMouseDown;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_BUTTON_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp
index 94a9c7e588..aa6f0182e2 100644
--- a/fpdfsdk/pdfwindow/PWL_Caret.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
+#include "fpdfsdk/pdfwindow/PWL_Caret.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#define PWL_CARET_FLASHINTERVAL 500
diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h
new file mode 100644
index 0000000000..a7cf1d4c05
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Caret.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 FPDFSDK_PDFWINDOW_PWL_CARET_H_
+#define FPDFSDK_PDFWINDOW_PWL_CARET_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+struct PWL_CARET_INFO {
+ public:
+ PWL_CARET_INFO() : bVisible(FALSE), ptHead(0, 0), ptFoot(0, 0) {}
+
+ FX_BOOL bVisible;
+ CFX_FloatPoint ptHead;
+ CFX_FloatPoint ptFoot;
+};
+
+class CPWL_Caret : public CPWL_Wnd {
+ public:
+ CPWL_Caret();
+ ~CPWL_Caret() override;
+
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void InvalidateRect(CFX_FloatRect* pRect = NULL) override;
+ void SetVisible(FX_BOOL bVisible) override {}
+ void TimerProc() override;
+
+ void SetCaret(FX_BOOL bVisible,
+ const CFX_FloatPoint& ptHead,
+ const CFX_FloatPoint& ptFoot);
+ CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset);
+ void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; }
+
+ private:
+ void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset);
+ CFX_FloatRect GetCaretRect() const;
+
+ FX_BOOL m_bFlash;
+ CFX_FloatPoint m_ptHead;
+ CFX_FloatPoint m_ptFoot;
+ FX_FLOAT m_fWidth;
+ int32_t m_nDelay;
+ CFX_FloatRect m_rcInvalid;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_CARET_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
index cf9ce0a5fb..1428e6bf1a 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
@@ -4,14 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h"
+#include "fpdfsdk/pdfwindow/PWL_ComboBox.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
-#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
#define PWLCB_DEFAULTFONTSIZE 12.0f
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h
new file mode 100644
index 0000000000..6d376e1895
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h
@@ -0,0 +1,106 @@
+// 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_PDFWINDOW_PWL_COMBOBOX_H_
+#define FPDFSDK_PDFWINDOW_PWL_COMBOBOX_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_CBEdit : public CPWL_Edit {
+ public:
+ CPWL_CBEdit() {}
+ ~CPWL_CBEdit() override {}
+};
+
+class CPWL_CBListBox : public CPWL_ListBox {
+ public:
+ CPWL_CBListBox() {}
+ ~CPWL_CBListBox() override {}
+
+ // CPWL_ListBox
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+
+ FX_BOOL OnKeyDownWithExit(uint16_t nChar, FX_BOOL& bExit, FX_DWORD nFlag);
+ FX_BOOL OnCharWithExit(uint16_t nChar, FX_BOOL& bExit, FX_DWORD nFlag);
+};
+
+#define PWL_COMBOBOX_BUTTON_WIDTH 13
+
+class CPWL_CBButton : public CPWL_Wnd {
+ public:
+ CPWL_CBButton() {}
+ ~CPWL_CBButton() override {}
+
+ // CPWL_Wnd
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+};
+
+class CPWL_ComboBox : public CPWL_Wnd {
+ public:
+ CPWL_ComboBox();
+ ~CPWL_ComboBox() override {}
+
+ CPWL_Edit* GetEdit() const { return m_pEdit; }
+
+ // CPWL_Wnd:
+ CFX_ByteString GetClassName() const override;
+ void OnCreate(PWL_CREATEPARAM& cp) override;
+ FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void RePosChildWnd() override;
+ CFX_FloatRect GetFocusRect() const override;
+ void SetFocus() override;
+ void KillFocus() override;
+
+ void SetFillerNotify(IPWL_Filler_Notify* pNotify);
+
+ CFX_WideString GetText() const;
+ void SetText(const FX_WCHAR* text);
+
+ void AddString(const FX_WCHAR* str);
+ int32_t GetSelect() const;
+ void SetSelect(int32_t nItemIndex);
+
+ void SetEditSel(int32_t nStartChar, int32_t nEndChar);
+ void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const;
+ void Clear();
+ void SelectAll();
+ FX_BOOL IsPopup() const;
+
+ void SetSelectText();
+
+ void AttachFFLData(void* pData) { m_pFormFiller = pData; }
+
+ private:
+ void CreateEdit(const PWL_CREATEPARAM& cp);
+ void CreateButton(const PWL_CREATEPARAM& cp);
+ void CreateListBox(const PWL_CREATEPARAM& cp);
+ void SetPopup(FX_BOOL bPopup);
+
+ CPWL_CBEdit* m_pEdit;
+ CPWL_CBButton* m_pButton;
+ CPWL_CBListBox* m_pList;
+ FX_BOOL m_bPopup;
+ CFX_FloatRect m_rcOldWindow;
+ int32_t m_nPopupWhere;
+ int32_t m_nSelectItem;
+ IPWL_Filler_Notify* m_pFillerNotify;
+
+ void* m_pFormFiller;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_COMBOBOX_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index affb1be87e..b75c72f149 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
#include <vector>
@@ -12,12 +12,12 @@
#include "core/fxcrt/include/fx_safe_types.h"
#include "core/fxcrt/include/fx_xml.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
-#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Caret.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
#include "third_party/base/stl_util.h"
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
new file mode 100644
index 0000000000..025cf2bf59
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -0,0 +1,172 @@
+// 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_PDFWINDOW_PWL_EDIT_H_
+#define FPDFSDK_PDFWINDOW_PWL_EDIT_H_
+
+#include "core/fxcrt/include/fx_basic.h"
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class IPWL_SpellCheck;
+
+class IPWL_Filler_Notify {
+ public:
+ virtual ~IPWL_Filler_Notify() {}
+ virtual void QueryWherePopup(
+ void* pPrivateData,
+ FX_FLOAT fPopupMin,
+ FX_FLOAT fPopupMax,
+ int32_t& nRet,
+ FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top)
+ virtual void OnBeforeKeyStroke(void* pPrivateData,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ int nSelStart,
+ int nSelEnd,
+ FX_BOOL bKeyDown,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+#ifdef PDF_ENABLE_XFA
+ virtual void OnPopupPreOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+ virtual void OnPopupPostOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+#endif // PDF_ENABLE_XFA
+};
+
+class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
+ public:
+ CPWL_Edit();
+ ~CPWL_Edit() override;
+
+ // CPWL_EditCtrl
+ CFX_ByteString GetClassName() const override;
+ void OnDestroy() override;
+ void OnCreated() override;
+ void RePosChildWnd() override;
+ CFX_FloatRect GetClientRect() const override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseWheel(short zDelta,
+ const CFX_FloatPoint& point,
+ FX_DWORD nFlag) override;
+ FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+ CFX_FloatRect GetFocusRect() const override;
+ void OnSetFocus() override;
+ void OnKillFocus() override;
+
+ 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(int32_t nCharArray);
+ void SetLimitChar(int32_t nLimitChar);
+
+ void SetHorzScale(int32_t 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(const FX_WCHAR* csText);
+ void ReplaceSel(const FX_WCHAR* csText);
+
+ CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const;
+ CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const;
+ CFX_ByteString GetSelectAppearanceStream(
+ const CFX_FloatPoint& ptOffset) const;
+
+ FX_BOOL IsTextFull() const;
+
+ static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont,
+ const CFX_FloatRect& rcPlate,
+ int32_t nCharArray);
+
+ void SetFillerNotify(IPWL_Filler_Notify* pNotify) {
+ m_pFillerNotify = pNotify;
+ }
+
+ void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder,
+ const CFX_FloatPoint& ptOffset,
+ CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder,
+ const CFX_FloatPoint& ptOffset);
+
+ protected:
+ // IFX_Edit_OprNotify
+ void OnInsertWord(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnInsertReturn(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnBackSpace(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnDelete(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnClear(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnSetText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnInsertText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) override;
+ void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) override;
+
+ private:
+ CPVT_WordRange GetSelectWordRange() const;
+ virtual void ShowVScrollBar(FX_BOOL bShow);
+ FX_BOOL IsVScrollBarVisible() const;
+ void SetParamByFlag();
+
+ FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray);
+ CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
+
+ CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
+ const CPVT_WordRange& wr2);
+ CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& 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;
+
+ public:
+ FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, FX_DWORD nFlag);
+
+ private:
+ IPWL_Filler_Notify* m_pFillerNotify;
+ IPWL_SpellCheck* m_pSpellCheck;
+ FX_BOOL m_bFocus;
+ CFX_FloatRect m_rcOldWindow;
+
+ public:
+ void AttachFFLData(void* pData) { m_pFormFiller = pData; }
+
+ private:
+ void* m_pFormFiller;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_EDIT_H_
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 3109052a20..865495a463 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
-#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Caret.h"
+#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h
new file mode 100644
index 0000000000..a61705648d
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h
@@ -0,0 +1,181 @@
+// 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_PDFWINDOW_PWL_EDITCTRL_H_
+#define FPDFSDK_PDFWINDOW_PWL_EDITCTRL_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_Caret;
+class CPWL_Edit;
+class CPWL_EditCtrl;
+class IFX_Edit;
+class IPWL_Edit_Notify;
+struct CPVT_WordPlace;
+
+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 {
+ public:
+ virtual ~IPWL_Edit_Notify() {}
+ // when the position of caret is changed in edit
+ virtual void OnCaretMove(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {}
+ virtual void OnContentChange(const CFX_FloatRect& 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 CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify {
+ friend class CPWL_Edit_Notify;
+
+ public:
+ CPWL_EditCtrl();
+ ~CPWL_EditCtrl() override;
+
+ CFX_FloatRect GetContentRect() const;
+ void GetCaretPos(int32_t& x, int32_t& y) const;
+
+ CFX_WideString GetText() const;
+ void SetSel(int32_t nStartChar, int32_t nEndChar);
+ void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
+ void GetTextRange(const CFX_FloatRect& rect,
+ int32_t& nStartChar,
+ int32_t& nEndChar) const;
+ CFX_WideString GetText(int32_t& nStartChar, int32_t& nEndChar) const;
+ void Clear();
+ void SelectAll();
+
+ int32_t GetCaret() const;
+ void SetCaret(int32_t nPos);
+ int32_t GetTotalWords() const;
+
+ void Paint();
+
+ void EnableRefresh(FX_BOOL bRefresh);
+ CFX_FloatPoint GetScrollPos() const;
+ void SetScrollPos(const CFX_FloatPoint& point);
+
+ void SetEditNotify(IPWL_Edit_Notify* pNotify) { m_pEditNotify = pNotify; }
+
+ void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; }
+ int32_t GetCharSet() const;
+
+ void SetCodePage(int32_t nCodePage) { m_nCodePage = nCodePage; }
+ int32_t 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();
+
+ // CPWL_Wnd
+ void OnCreate(PWL_CREATEPARAM& cp) override;
+ void OnCreated() override;
+ FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void RePosChildWnd() override;
+ void SetFontSize(FX_FLOAT fFontSize) override;
+ FX_FLOAT GetFontSize() const override;
+ void SetCursor() override;
+
+ protected:
+ // IFX_Edit_Notify
+ void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) override {}
+ void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) override;
+ void IOnSetScrollPosX(FX_FLOAT fx) override {}
+ void IOnSetScrollPosY(FX_FLOAT fy) override;
+ void IOnSetCaret(FX_BOOL bVisible,
+ const CFX_FloatPoint& ptHead,
+ const CFX_FloatPoint& ptFoot,
+ const CPVT_WordPlace& place) override;
+ void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps) override;
+ void IOnContentChange(const CFX_FloatRect& rcContent) override;
+ void IOnInvalidateRect(CFX_FloatRect* pRect) override;
+
+ void InsertText(const FX_WCHAR* csText);
+ void SetText(const FX_WCHAR* csText);
+ void CopyText();
+ void PasteText();
+ void CutText();
+ void ShowVScrollBar(FX_BOOL bShow);
+ void InsertWord(uint16_t word, int32_t nCharset);
+ void InsertReturn();
+
+ FX_BOOL IsWndHorV();
+
+ void Delete();
+ void Backspace();
+
+ void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const;
+ void SetCaret(FX_BOOL bVisible,
+ const CFX_FloatPoint& ptHead,
+ const CFX_FloatPoint& ptFoot);
+
+ void SetEditCaret(FX_BOOL bVisible);
+
+ 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:
+ int32_t m_nCharSet;
+ int32_t m_nCodePage;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_EDITCTRL_H_
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 298b744888..0a5eef6b19 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
+#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
namespace {
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h
new file mode 100644
index 0000000000..b344e4fef2
--- /dev/null
+++ b/fpdfsdk/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 FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
+#define FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
+
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+#include "public/fpdf_sysfontinfo.h"
+
+class CPDF_Document;
+class IFX_SystemHandler;
+
+struct CPWL_FontMap_Data {
+ CPDF_Font* pFont;
+ int32_t nCharset;
+ CFX_ByteString sFontName;
+};
+
+struct CPWL_FontMap_Native {
+ int32_t 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
+
+class CPWL_FontMap : public IFX_Edit_FontMap {
+ public:
+ CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
+ ~CPWL_FontMap() override;
+
+ // IFX_Edit_FontMap
+ CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
+ CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
+ int32_t GetWordFontIndex(uint16_t word,
+ int32_t nCharset,
+ int32_t nFontIndex) override;
+ int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override;
+ int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) override;
+
+ void SetSystemHandler(IFX_SystemHandler* pSystemHandler);
+ int32_t GetFontMapCount() const;
+ const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
+ static int32_t GetNativeCharset();
+ CFX_ByteString GetNativeFontName(int32_t nCharset);
+
+ static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset);
+
+ CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
+ CFX_ByteString& sFontName,
+ uint8_t 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,
+ uint8_t nCharset);
+
+ protected:
+ virtual void Initialize();
+ virtual CPDF_Document* GetDocument();
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ int32_t nCharset);
+ virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+
+ FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word);
+
+ void Empty();
+ int32_t GetFontIndex(const CFX_ByteString& sFontName,
+ int32_t nCharset,
+ FX_BOOL bFind);
+ int32_t GetPWLFontIndex(uint16_t word, int32_t nCharset);
+ int32_t AddFontData(CPDF_Font* pFont,
+ const CFX_ByteString& sFontAlias,
+ int32_t nCharset = DEFAULT_CHARSET);
+
+ CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
+ int32_t nCharset);
+ CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
+
+ private:
+ CFX_ByteString GetFontName(int32_t nFontIndex);
+ int32_t FindFont(const CFX_ByteString& sFontName,
+ int32_t nCharset = DEFAULT_CHARSET);
+
+ CFX_ByteString GetNativeFont(int32_t nCharset);
+
+ public:
+ using CharsetFontMap = FPDF_CharsetFontMap;
+ 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 CPWL_DocFontMap : public CPWL_FontMap {
+ public:
+ CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler,
+ CPDF_Document* pAttachedDoc);
+ ~CPWL_DocFontMap() override;
+
+ private:
+ // CPWL_FontMap:
+ CPDF_Document* GetDocument() override;
+
+ CPDF_Document* m_pAttachedDoc;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 3e5911eb26..fb75665ef6 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
+#include "fpdfsdk/pdfwindow/PWL_Icon.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {}
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h
new file mode 100644
index 0000000000..5abf9c26cc
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Icon.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 FPDFSDK_PDFWINDOW_PWL_ICON_H_
+#define FPDFSDK_PDFWINDOW_PWL_ICON_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_Image : public CPWL_Wnd {
+ public:
+ CPWL_Image();
+ ~CPWL_Image() override;
+
+ 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);
+ CFX_Matrix GetImageMatrix();
+ CFX_ByteString GetImageAlias();
+ void SetImageAlias(const FX_CHAR* sImageAlias);
+
+ protected:
+ CPDF_Stream* m_pPDFStream;
+ CFX_ByteString m_sImageAlias;
+};
+
+class CPWL_Icon : public CPWL_Image {
+ public:
+ CPWL_Icon();
+ ~CPWL_Icon() override;
+
+ virtual CPDF_IconFit* GetIconFit() { return m_pIconFit; }
+
+ // CPWL_Image
+ void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override;
+ void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override;
+
+ int32_t 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 // FPDFSDK_PDFWINDOW_PWL_ICON_H_
diff --git a/fpdfsdk/pdfwindow/PWL_IconList.cpp b/fpdfsdk/pdfwindow/PWL_IconList.cpp
index d2418c8ecc..a61bded33b 100644
--- a/fpdfsdk/pdfwindow/PWL_IconList.cpp
+++ b/fpdfsdk/pdfwindow/PWL_IconList.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_IconList.h"
+#include "fpdfsdk/pdfwindow/PWL_IconList.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Label.h"
+#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
#define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f
diff --git a/fpdfsdk/pdfwindow/PWL_IconList.h b/fpdfsdk/pdfwindow/PWL_IconList.h
new file mode 100644
index 0000000000..b9fb2e5c34
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_IconList.h
@@ -0,0 +1,129 @@
+// 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_PDFWINDOW_PWL_ICONLIST_H_
+#define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_
+
+#include "core/fxcrt/include/fx_string.h"
+#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.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 ~IPWL_IconList_Notify() {}
+ virtual void OnNoteListSelChanged(int32_t nItemIndex) = 0;
+};
+
+class CPWL_IconList_Item : public CPWL_Wnd {
+ public:
+ CPWL_IconList_Item();
+ ~CPWL_IconList_Item() override;
+
+ void SetSelect(FX_BOOL bSelected);
+ FX_BOOL IsSelected() const;
+ void SetData(void* pData);
+ void SetIcon(int32_t nIconIndex);
+ void SetText(const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetText() const;
+
+ protected:
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void RePosChildWnd() override;
+ FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void OnEnabled() override;
+ void OnDisabled() override;
+
+ private:
+ int32_t 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(int32_t nListCount);
+ ~CPWL_IconList_Content() override;
+
+ void SetSelect(int32_t nIndex);
+ int32_t GetSelect() const;
+ void SetNotify(IPWL_IconList_Notify* pNotify);
+ void EnableNotify(FX_BOOL bNotify);
+ void SetListData(int32_t nItemIndex, void* pData);
+ void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
+ void SetListString(int32_t nItemIndex, const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetListString(int32_t nItemIndex) const;
+ IPWL_IconList_Notify* GetNotify() const;
+ void ScrollToItem(int32_t nItemIndex);
+
+ protected:
+ // CPWL_ListCtrl
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override;
+
+ private:
+ CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const;
+ void SelectItem(int32_t nItemIndex, FX_BOOL bSelect);
+ int32_t FindItemIndex(const CFX_FloatPoint& point);
+
+ int32_t m_nSelectIndex;
+ IPWL_IconList_Notify* m_pNotify;
+ FX_BOOL m_bEnableNotify;
+ FX_BOOL m_bMouseDown;
+ int32_t m_nListCount;
+};
+
+class CPWL_IconList : public CPWL_Wnd {
+ public:
+ CPWL_IconList(int32_t nListCount);
+ ~CPWL_IconList() override;
+
+ void SetSelect(int32_t nIndex);
+ void SetTopItem(int32_t nIndex);
+ int32_t GetSelect() const;
+ void SetNotify(IPWL_IconList_Notify* pNotify);
+ void EnableNotify(FX_BOOL bNotify);
+ void SetListData(int32_t nItemIndex, void* pData);
+ void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
+ void SetListString(int32_t nItemIndex, const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetListString(int32_t nItemIndex) const;
+
+ protected:
+ // CPWL_Wnd
+ FX_BOOL OnMouseWheel(short zDelta,
+ const CFX_FloatPoint& point,
+ FX_DWORD nFlag) override;
+ void OnCreated() override;
+ void RePosChildWnd() override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+
+ private:
+ CPWL_IconList_Content* m_pListContent;
+ int32_t m_nListCount;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index 5f8d2d8685..cfbeb4362c 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Label.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_Label::CPWL_Label() : m_pEdit(NULL) {
m_pEdit = IFX_Edit::NewEdit();
diff --git a/fpdfsdk/pdfwindow/PWL_Label.h b/fpdfsdk/pdfwindow/PWL_Label.h
new file mode 100644
index 0000000000..7b5a3e52f7
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Label.h
@@ -0,0 +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 FPDFSDK_PDFWINDOW_PWL_LABEL_H_
+#define FPDFSDK_PDFWINDOW_PWL_LABEL_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class IFX_Edit;
+
+class CPWL_Label : public CPWL_Wnd {
+ public:
+ CPWL_Label();
+ ~CPWL_Label() override;
+
+ void SetText(const FX_WCHAR* csText);
+ CFX_WideString GetText() const;
+ void SetLimitChar(int32_t nLimitChar);
+ void SetHorzScale(int32_t nHorzScale);
+ void SetCharSpace(FX_FLOAT fCharSpace);
+ CFX_FloatRect GetContentRect() const;
+ int32_t GetTotalWords();
+ CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const;
+
+ protected:
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void SetFontSize(FX_FLOAT fFontSize) override;
+ FX_FLOAT GetFontSize() const override;
+ void OnCreated() override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void RePosChildWnd() override;
+
+ private:
+ void SetParamByFlag();
+
+ IFX_Edit* m_pEdit;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_LABEL_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index a673455242..244796b81a 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
+#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
-#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "public/fpdf_fwlevent.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h
new file mode 100644
index 0000000000..067aa2f731
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.h
@@ -0,0 +1,122 @@
+// 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_PDFWINDOW_PWL_LISTBOX_H_
+#define FPDFSDK_PDFWINDOW_PWL_LISTBOX_H_
+
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+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);
+ ~CPWL_List_Notify() override;
+
+ // IFX_List_Notify
+ void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) override {}
+ void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) override;
+ void IOnSetScrollPosX(FX_FLOAT fx) override {}
+ void IOnSetScrollPosY(FX_FLOAT fy) override;
+ void IOnInvalidateRect(CFX_FloatRect* pRect) override;
+
+ void IOnSetCaret(FX_BOOL bVisible,
+ const CFX_FloatPoint& ptHead,
+ const CFX_FloatPoint& ptFoot,
+ const CPVT_WordPlace& place);
+ void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps);
+
+ private:
+ CPWL_ListBox* m_pList;
+};
+
+class CPWL_ListBox : public CPWL_Wnd {
+ public:
+ CPWL_ListBox();
+ ~CPWL_ListBox() override;
+
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void OnCreated() override;
+ void OnDestroy() override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseWheel(short zDelta,
+ const CFX_FloatPoint& point,
+ FX_DWORD nFlag) override;
+ void KillFocus() override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ void RePosChildWnd() override;
+ CFX_FloatRect GetFocusRect() const override;
+ void SetFontSize(FX_FLOAT fFontSize) override;
+ FX_FLOAT GetFontSize() const override;
+
+ virtual CFX_WideString GetText() const;
+
+ void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag);
+
+ void AddString(const FX_WCHAR* str);
+ void SetTopVisibleIndex(int32_t nItemIndex);
+ void ScrollToListItem(int32_t nItemIndex);
+ void ResetContent();
+ void Reset();
+ void Select(int32_t nItemIndex);
+ void SetCaret(int32_t nItemIndex);
+ void SetHoverSel(FX_BOOL bHoverSel);
+
+ int32_t GetCount() const;
+ FX_BOOL IsMultipleSel() const;
+ int32_t GetCaretIndex() const;
+ int32_t GetCurSel() const;
+ FX_BOOL IsItemSelected(int32_t nItemIndex) const;
+ int32_t GetTopVisibleIndex() const;
+ int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;
+ CFX_FloatRect GetContentRect() const;
+ FX_FLOAT GetFirstHeight() const;
+ CFX_FloatRect 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 // FPDFSDK_PDFWINDOW_PWL_LISTBOX_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp
index f9482878b9..60bd40a258 100644
--- a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp
@@ -5,8 +5,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_ListCtrl::CPWL_ListCtrl()
: m_rcContent(0, 0, 0, 0),
diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/pdfwindow/PWL_ListCtrl.h
new file mode 100644
index 0000000000..844801978c
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_ListCtrl.h
@@ -0,0 +1,48 @@
+// 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_PDFWINDOW_PWL_LISTCTRL_H_
+#define FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_ListCtrl : public CPWL_Wnd {
+ public:
+ CPWL_ListCtrl();
+ ~CPWL_ListCtrl() override;
+
+ void SetScrollPos(const CFX_FloatPoint& point);
+ CFX_FloatPoint GetScrollPos() const;
+ CFX_FloatRect GetScrollArea() const;
+ void SetItemSpace(FX_FLOAT fSpace);
+ void SetTopSpace(FX_FLOAT fSpace);
+ void SetBottomSpace(FX_FLOAT fSpace);
+ void ResetFace();
+ void ResetContent(int32_t nStart);
+ int32_t GetItemIndex(CPWL_Wnd* pItem);
+ FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth);
+ CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const;
+ CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const;
+ CFX_FloatRect InToOut(const CFX_FloatRect& rect) const;
+ CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const;
+
+ protected:
+ // CPWL_Wnd
+ void RePosChildWnd() override;
+ void DrawChildAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+
+ private:
+ void ResetAll(FX_BOOL bMove, int32_t nStart);
+
+ CFX_FloatRect m_rcContent;
+ CFX_FloatPoint m_ptScroll;
+ FX_FLOAT m_fItemSpace;
+ FX_FLOAT m_fTopSpace;
+ FX_FLOAT m_fBottomSpace;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Note.cpp b/fpdfsdk/pdfwindow/PWL_Note.cpp
index ec7c1c9cde..a2ff7c4a7a 100644
--- a/fpdfsdk/pdfwindow/PWL_Note.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Note.cpp
@@ -4,18 +4,18 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Note.h"
+#include "fpdfsdk/pdfwindow/PWL_Note.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
-#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Button.h"
+#include "fpdfsdk/pdfwindow/PWL_Caret.h"
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_Label.h"
+#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#define POPUP_ITEM_HEAD_BOTTOM 3.0f
#define POPUP_ITEM_BOTTOMWIDTH 1.0f
diff --git a/fpdfsdk/pdfwindow/PWL_Note.h b/fpdfsdk/pdfwindow/PWL_Note.h
new file mode 100644
index 0000000000..e8fdbb89f7
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Note.h
@@ -0,0 +1,351 @@
+// 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_PDFWINDOW_PWL_NOTE_H_
+#define FPDFSDK_PDFWINDOW_PWL_NOTE_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Button.h"
+#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CPWL_Label;
+class CPWL_Note;
+class CPWL_NoteItem;
+class CPWL_Note_CloseBox;
+class CPWL_Note_Contents;
+class CPWL_Note_Edit;
+class CPWL_Note_Icon;
+class CPWL_Note_LBBox;
+class CPWL_Note_Options;
+class CPWL_Note_RBBox;
+class IPWL_NoteHandler;
+class IPWL_NoteItem;
+class IPWL_NoteNotify;
+class IPopup_Note;
+
+class IPWL_NoteNotify {
+ public:
+ virtual ~IPWL_NoteNotify() {}
+ 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(int32_t x, int32_t y) = 0;
+ virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0;
+};
+
+class IPWL_NoteHandler {
+ public:
+ virtual ~IPWL_NoteHandler() {}
+ virtual void OnNoteColorChanged(const CPWL_Color& color) = 0;
+};
+
+class IPWL_NoteItem {
+ public:
+ virtual ~IPWL_NoteItem() {}
+ 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 int32_t CountSubItems() const = 0;
+ virtual IPWL_NoteItem* GetSubItems(int32_t 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 CPWL_Note_Icon : public CPWL_Wnd {
+ public:
+ CPWL_Note_Icon();
+ ~CPWL_Note_Icon() override;
+
+ void SetIconType(int32_t nType);
+
+ protected:
+ // CPWL_Wnd
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+
+ private:
+ int32_t m_nType;
+};
+
+class CPWL_Note_CloseBox : public CPWL_Button {
+ public:
+ CPWL_Note_CloseBox();
+ ~CPWL_Note_CloseBox() override;
+
+ protected:
+ // CPWL_Button
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+
+ private:
+ FX_BOOL m_bMouseDown;
+};
+
+class CPWL_Note_LBBox : public CPWL_Wnd {
+ public:
+ CPWL_Note_LBBox();
+ ~CPWL_Note_LBBox() override;
+
+ protected:
+ // CPWL_Wnd
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+};
+
+class CPWL_Note_RBBox : public CPWL_Wnd {
+ public:
+ CPWL_Note_RBBox();
+ ~CPWL_Note_RBBox() override;
+
+ protected:
+ // CPWL_Wnd
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+};
+
+class CPWL_Note_Edit : public CPWL_Edit {
+ public:
+ CPWL_Note_Edit();
+ ~CPWL_Note_Edit() override;
+
+ void EnableNotify(FX_BOOL bEnable) { m_bEnableNotify = bEnable; }
+
+ // CPWL_Edit
+ FX_FLOAT GetItemLeftMargin() override;
+ FX_FLOAT GetItemRightMargin() override;
+ FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override;
+ void SetText(const FX_WCHAR* csText) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ void RePosChildWnd() override;
+ void OnSetFocus() override;
+ void OnKillFocus() override;
+
+ 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();
+ ~CPWL_Note_Options() override;
+
+ CFX_FloatRect GetContentRect() const;
+ void SetText(const CFX_WideString& sText);
+
+ // CPWL_Wnd
+ void RePosChildWnd() override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void SetTextColor(const CPWL_Color& color) override;
+
+ private:
+ CPWL_Label* m_pText;
+};
+
+class CPWL_Note_Contents : public CPWL_ListCtrl {
+ public:
+ CPWL_Note_Contents();
+ ~CPWL_Note_Contents() override;
+
+ void SetEditFocus(FX_BOOL bLast);
+ CPWL_Edit* GetEdit() const;
+
+ void SetText(const CFX_WideString& sText);
+ CFX_WideString GetText() const;
+
+ CPWL_NoteItem* CreateSubItem();
+ void DeleteSubItem(IPWL_NoteItem* pNoteItem);
+ int32_t CountSubItems() const;
+ IPWL_NoteItem* GetSubItems(int32_t index) const;
+
+ virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point);
+ void EnableRead(FX_BOOL bEnabled);
+ void EnableModify(FX_BOOL bEnabled);
+
+ // CPWL_ListCtrl
+ CFX_ByteString GetClassName() const override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+
+ private:
+ CPWL_Note_Edit* m_pEdit;
+};
+
+class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem {
+ public:
+ CPWL_NoteItem();
+ ~CPWL_NoteItem() override;
+
+ virtual IPWL_NoteItem* GetHitNoteItem(const CFX_FloatPoint& point);
+ virtual IPWL_NoteItem* GetFocusedNoteItem() const;
+
+ virtual FX_BOOL IsTopItem() const { return FALSE; }
+
+ virtual void ResetSubjectName(int32_t nItemIndex);
+ void EnableRead(FX_BOOL bEnabled);
+ void EnableModify(FX_BOOL bEnabled);
+
+ void OnContentsValidate();
+ void OnCreateNoteItem();
+
+ // IPWL_NoteItem
+ void SetPrivateData(void* pData) override;
+ void SetBkColor(const CPWL_Color& color) override;
+ void SetSubjectName(const CFX_WideString& sName) override;
+ void SetAuthorName(const CFX_WideString& sName) override;
+ void SetDateTime(FX_SYSTEMTIME time) override;
+ void SetContents(const CFX_WideString& sContents) override;
+ IPWL_NoteItem* CreateSubItem() override;
+ int32_t CountSubItems() const override;
+ IPWL_NoteItem* GetSubItems(int32_t index) const override;
+ void DeleteSubItem(IPWL_NoteItem* pNoteItem) override;
+ void SetFocus() override { SetNoteFocus(FALSE); }
+ IPWL_NoteItem* GetParentItem() const override;
+ void* GetPrivateData() const override;
+ CFX_WideString GetAuthorName() const override;
+ CPWL_Color GetBkColor() const override;
+ CFX_WideString GetContents() const override;
+ FX_SYSTEMTIME GetDateTime() const override;
+ CFX_WideString GetSubjectName() const override;
+ CPWL_Edit* GetEdit() const override;
+
+ protected:
+ // CPWL_Wnd
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ CFX_ByteString GetClassName() const override;
+ void RePosChildWnd() override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override;
+ FX_FLOAT GetItemLeftMargin() override;
+ FX_FLOAT GetItemRightMargin() override;
+
+ CPWL_NoteItem* CreateNoteItem();
+ CPWL_NoteItem* GetParentNoteItem() const;
+
+ void SetNoteFocus(FX_BOOL bLast);
+ void PopupNoteItemMenu(const CFX_FloatPoint& 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 CPWL_Note : public CPWL_NoteItem {
+ public:
+ CPWL_Note(IPopup_Note* pPopupNote,
+ IPWL_NoteNotify* pNoteNotify,
+ IPWL_NoteHandler* pNoteHandler);
+ ~CPWL_Note() override;
+
+ IPWL_NoteItem* Reply();
+ void EnableNotify(FX_BOOL bEnabled);
+ void SetIconType(int32_t 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& str);
+
+ // CPWL_NoteItem
+ void SetSubjectName(const CFX_WideString& sName) override;
+ void SetAuthorName(const CFX_WideString& sName) override;
+ CFX_WideString GetAuthorName() const override;
+ void SetBkColor(const CPWL_Color& color) override;
+ void ResetSubjectName(int32_t nItemIndex) override {}
+ FX_BOOL IsTopItem() const override { return TRUE; }
+ const CPWL_Note* GetNote() const override;
+ IPWL_NoteNotify* GetNoteNotify() const override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseWheel(short zDelta,
+ const CFX_FloatPoint& point,
+ FX_DWORD nFlag) override;
+ void RePosChildWnd() override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+
+ protected:
+ 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;
+ FX_BOOL m_bEnableNotify;
+ CFX_WideString m_sReplyString;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_NOTE_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index 8b7cfd5b4c..d87f6b5a36 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
new file mode 100644
index 0000000000..1603469ef5
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
@@ -0,0 +1,157 @@
+// 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_PDFWINDOW_PWL_SCROLLBAR_H_
+#define FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Wnd.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);
+ ~CPWL_SBButton() override;
+
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void OnCreate(PWL_CREATEPARAM& cp) override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+
+ 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);
+ ~CPWL_ScrollBar() override;
+
+ // CPWL_Wnd
+ CFX_ByteString GetClassName() const override;
+ void OnCreate(PWL_CREATEPARAM& cp) override;
+ void RePosChildWnd() override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0) override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void TimerProc() override;
+
+ 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();
+ CFX_FloatRect GetScrollArea() const;
+
+ private:
+ void CreateButtons(const PWL_CREATEPARAM& cp);
+
+ void OnMinButtonLBDown(const CFX_FloatPoint& point);
+ void OnMinButtonLBUp(const CFX_FloatPoint& point);
+ void OnMinButtonMouseMove(const CFX_FloatPoint& point);
+
+ void OnMaxButtonLBDown(const CFX_FloatPoint& point);
+ void OnMaxButtonLBUp(const CFX_FloatPoint& point);
+ void OnMaxButtonMouseMove(const CFX_FloatPoint& point);
+
+ void OnPosButtonLBDown(const CFX_FloatPoint& point);
+ void OnPosButtonLBUp(const CFX_FloatPoint& point);
+ void OnPosButtonMouseMove(const CFX_FloatPoint& point);
+
+ FX_FLOAT TrueToFace(FX_FLOAT);
+ FX_FLOAT FaceToTrue(FX_FLOAT);
+
+ 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 // FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp
index a928e4eeb5..72b6ebe7c3 100644
--- a/fpdfsdk/pdfwindow/PWL_Signature.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Signature.h"
+#include "fpdfsdk/pdfwindow/PWL_Signature.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Icon.h"
+#include "fpdfsdk/pdfwindow/PWL_Label.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {}
diff --git a/fpdfsdk/pdfwindow/PWL_Signature.h b/fpdfsdk/pdfwindow/PWL_Signature.h
new file mode 100644
index 0000000000..47d0bb0ae3
--- /dev/null
+++ b/fpdfsdk/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 FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_
+#define FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Icon.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CFX_DIBSource;
+class CPWL_Label;
+
+class CPWL_Signature_Image : public CPWL_Image {
+ public:
+ CPWL_Signature_Image();
+ ~CPWL_Signature_Image() override;
+
+ void SetImage(CFX_DIBSource* pImage);
+ CFX_DIBSource* GetImage();
+
+ protected:
+ // CPWL_Image
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+ void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override;
+
+ private:
+ CFX_DIBSource* m_pImage;
+};
+
+class CPWL_Signature : public CPWL_Wnd {
+ public:
+ CPWL_Signature();
+ ~CPWL_Signature() override;
+
+ void SetText(const FX_WCHAR* sText);
+ void SetDescription(const FX_WCHAR* str);
+ void SetImage(CFX_DIBSource* pImage);
+ void SetImageStream(CPDF_Stream* pStream, const FX_CHAR* sImageAlias);
+
+ void SetTextFlag(FX_BOOL bTextExist);
+ void SetImageFlag(FX_BOOL bImageExist);
+ void SetFoxitFlag(FX_BOOL bFlagExist);
+
+ protected:
+ // CPWL_Wnd
+ void RePosChildWnd() override;
+ void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
+ void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device) override;
+ void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
+
+ 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 // FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_
diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
index 78ded5ebb1..e79865efcf 100644
--- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
+++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
@@ -4,10 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
-#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Button.h"
+#include "fpdfsdk/pdfwindow/PWL_SpecialButton.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CPWL_PushButton::CPWL_PushButton() {}
diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h
new file mode 100644
index 0000000000..5aaf19b3a8
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h
@@ -0,0 +1,56 @@
+// 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_PDFWINDOW_PWL_SPECIALBUTTON_H_
+#define FPDFSDK_PDFWINDOW_PWL_SPECIALBUTTON_H_
+
+#include "fpdfsdk/pdfwindow/PWL_Button.h"
+
+class CPWL_PushButton : public CPWL_Button {
+ public:
+ CPWL_PushButton();
+ ~CPWL_PushButton() override;
+
+ // CPWL_Button
+ CFX_ByteString GetClassName() const override;
+ CFX_FloatRect GetFocusRect() const override;
+};
+
+class CPWL_CheckBox : public CPWL_Button {
+ public:
+ CPWL_CheckBox();
+ ~CPWL_CheckBox() override;
+
+ // CPWL_Button
+ CFX_ByteString GetClassName() const override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+
+ void SetCheck(bool bCheck);
+ bool IsChecked() const;
+
+ private:
+ bool m_bChecked;
+};
+
+class CPWL_RadioButton : public CPWL_Button {
+ public:
+ CPWL_RadioButton();
+ ~CPWL_RadioButton() override;
+
+ // CPWL_Button
+ CFX_ByteString GetClassName() const override;
+ FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
+ FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override;
+
+ void SetCheck(bool bCheck);
+ bool IsChecked() const;
+
+ private:
+ bool m_bChecked;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_SPECIALBUTTON_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index 9ad12abfe6..3622a84912 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include <algorithm>
#include "core/include/fxge/fx_ge.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_Icon.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h
new file mode 100644
index 0000000000..fed1528294
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Utils.h
@@ -0,0 +1,412 @@
+// 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_PDFWINDOW_PWL_UTILS_H_
+#define FPDFSDK_PDFWINDOW_PWL_UTILS_H_
+
+#include "core/include/fpdfdoc/fpdf_vt.h"
+#include "fpdfsdk/include/fxedit/fx_edit.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+
+class CFX_PathData;
+struct CPWL_Color;
+
+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) (uint8_t(color * 255))
+#define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color / 255.0f))
+
+#define PWL_MAKEDWORD(low, high) \
+ ((FX_DWORD)((uint16_t)(low) | (FX_DWORD)(((uint16_t)(high)) << 16)))
+#define PWL_GETLOWWORD(dword) ((uint16_t)(dword))
+#define PWL_GETHIGHWORD(dword) ((uint16_t)(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
+
+// 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 CFX_FloatPoint {
+ public:
+ CPWL_Point() : CFX_FloatPoint(0.0f, 0.0f) {}
+ CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_FloatPoint(fx, fy) {}
+ CPWL_Point(const CPWL_Point& point) : CFX_FloatPoint(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 CPWL_Utils {
+ public:
+ static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
+ static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
+ static FX_BOOL IntersectRect(const CFX_FloatRect& rect1,
+ const CFX_FloatRect& rect2);
+ static FX_BOOL ContainsRect(const CFX_FloatRect& rcParent,
+ const CFX_FloatRect& rcChild);
+ static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale);
+ static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1,
+ const CPVT_WordRange& wr2);
+ static CFX_FloatRect GetCenterSquare(const CFX_FloatRect& rect);
+ static CPWL_Color SubstractColor(const CPWL_Color& sColor,
+ FX_FLOAT fColorSub);
+ static CPWL_Color DevideColor(const CPWL_Color& sColor,
+ FX_FLOAT fColorDevide);
+ static CFX_FloatRect MaxRect(const CFX_FloatRect& rect1,
+ const CFX_FloatRect& rect2);
+ static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect,
+ FX_FLOAT x,
+ FX_FLOAT y);
+ static CFX_FloatPoint OffsetPoint(const CFX_FloatPoint& point,
+ FX_FLOAT x,
+ FX_FLOAT y);
+ static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color,
+ int32_t 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 CFX_FloatRect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ const CPWL_Dash& dash);
+ static CFX_ByteString GetCircleBorderAppStream(
+ const CFX_FloatRect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ const CPWL_Dash& dash);
+ static CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
+ const CPWL_Color& color);
+ static CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
+ const CPWL_Color& color);
+
+ static CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
+ IFX_Edit_FontMap* pFontMap,
+ CPDF_Stream* pIconStream,
+ CPDF_IconFit& IconFit,
+ const CFX_WideString& sLabel,
+ const CPWL_Color& crText,
+ FX_FLOAT fFontSize,
+ int32_t nLayOut);
+ static CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
+ int32_t nStyle,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
+ int32_t nStyle,
+ const CPWL_Color& crText);
+
+ static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange = NULL,
+ FX_BOOL bContinuous = TRUE,
+ uint16_t SubWord = 0);
+ static CFX_ByteString GetEditSelAppStream(
+ IFX_Edit* pEdit,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange = NULL);
+ static CFX_ByteString GetSpellCheckAppStream(
+ IFX_Edit* pEdit,
+ IPWL_SpellCheck* pSpellCheck,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange = NULL);
+ static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox,
+ IFX_Edit_FontMap* pFontMap,
+ const CFX_WideString& sText,
+ int32_t nAlignmentH,
+ int32_t nAlignmentV,
+ FX_FLOAT fFontSize,
+ FX_BOOL bMultiLine,
+ FX_BOOL bAutoReturn,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox);
+
+ static void DrawFillRect(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rect,
+ const CPWL_Color& color,
+ int32_t nTransparancy);
+ static void DrawFillRect(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rect,
+ const FX_COLORREF& color);
+ static void DrawStrokeRect(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rect,
+ const FX_COLORREF& color,
+ FX_FLOAT fWidth);
+ static void DrawStrokeLine(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatPoint& ptMoveTo,
+ const CFX_FloatPoint& ptLineTo,
+ const FX_COLORREF& color,
+ FX_FLOAT fWidth);
+ static void DrawBorder(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatRect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ int32_t nTransparancy);
+ static void DrawFillArea(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ const CFX_FloatPoint* pPts,
+ int32_t nCount,
+ const FX_COLORREF& color);
+ static void DrawShadow(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ FX_BOOL bVertical,
+ FX_BOOL bHorizontal,
+ CFX_FloatRect rect,
+ int32_t nTransparancy,
+ int32_t nStartGray,
+ int32_t nEndGray);
+ static void DrawEditSpellCheck(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ IFX_Edit* pEdit,
+ const CFX_FloatRect& rcClip,
+ const CFX_FloatPoint& 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,
+ int32_t& alpha,
+ FX_FLOAT& red,
+ FX_FLOAT& green,
+ FX_FLOAT& blue);
+
+ public:
+ static CFX_ByteString GetIconAppStream(
+ int32_t nType,
+ const CFX_FloatRect& rect,
+ const CPWL_Color& crFill,
+ const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
+ static void DrawIconAppStream(CFX_RenderDevice* pDevice,
+ CFX_Matrix* pUser2Device,
+ int32_t nType,
+ const CFX_FloatRect& rect,
+ const CPWL_Color& crFill,
+ const CPWL_Color& crStroke,
+ const int32_t nTransparancy);
+
+ private:
+ static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData,
+ int32_t nCount);
+ static void GetPathDataFromArray(CFX_PathData& path,
+ const CPWL_PathData* pPathData,
+ int32_t nCount);
+
+ static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
+ const CPWL_Color& crText);
+
+ static CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox);
+ static CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox,
+ FX_FLOAT fRotate);
+
+ static void GetGraphics_Checkmark(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Circle(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Comment(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Cross(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Help(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_InsertText(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Key(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_NewParagraph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_TextNote(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Paragraph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_RightArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_RightPointer(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Star(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_UpArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Graph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Paperclip(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Attachment(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Tag(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Foxit(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CFX_FloatRect& crBBox,
+ const PWL_PATH_TYPE type);
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_UTILS_H_
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index cb5311f59b..66ad6317c3 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -6,9 +6,9 @@
#include <map>
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
+#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
// Leak the object at shutdown.
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
new file mode 100644
index 0000000000..394e82d9a6
--- /dev/null
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -0,0 +1,472 @@
+// 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_PDFWINDOW_PWL_WND_H_
+#define FPDFSDK_PDFWINDOW_PWL_WND_H_
+
+#include <vector>
+
+#include "core/fxcrt/include/fx_basic.h"
+#include "core/include/fpdfdoc/fpdf_doc.h"
+#include "fpdfsdk/include/fx_systemhandler.h"
+
+class CPWL_MsgControl;
+class CPWL_ScrollBar;
+class CPWL_Timer;
+class CPWL_TimerHandler;
+class CPWL_Wnd;
+class IFX_Edit_FontMap;
+class IFX_SystemHandler;
+class IPWL_Provider;
+class IPWL_SpellCheck;
+
+// 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(int32_t dash, int32_t gap, int32_t phase)
+ : nDash(dash), nGap(gap), nPhase(phase) {}
+
+ int32_t nDash;
+ int32_t nGap;
+ int32_t nPhase;
+};
+
+struct CPWL_Color {
+ CPWL_Color(int32_t 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(int32_t r, int32_t g, int32_t b)
+ : nColorType(COLORTYPE_RGB),
+ fColor1(r / 255.0f),
+ fColor2(g / 255.0f),
+ fColor3(b / 255.0f),
+ fColor4(0) {}
+
+ void ConvertColorType(int32_t other_nColorType);
+
+ /*
+ COLORTYPE_TRANSPARENT
+ COLORTYPE_RGB
+ COLORTYPE_CMYK
+ COLORTYPE_GRAY
+ */
+ int32_t nColorType;
+ FX_FLOAT fColor1, fColor2, fColor3, fColor4;
+};
+
+inline 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 bool operator!=(const CPWL_Color& c1, const CPWL_Color& c2) {
+ return !(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 ~IPWL_SpellCheck() {}
+ virtual FX_BOOL CheckWord(const FX_CHAR* sWord) = 0;
+ virtual void SuggestWords(const FX_CHAR* sWord,
+ std::vector<CFX_ByteString>& sSuggest) = 0;
+};
+
+class IPWL_Provider {
+ public:
+ virtual ~IPWL_Provider() {}
+
+ // get a matrix which map user space to CWnd client space
+ virtual CFX_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(int32_t nIndex) = 0;
+};
+
+class IPWL_FocusHandler {
+ public:
+ virtual ~IPWL_FocusHandler() {}
+ 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) {}
+
+ CFX_FloatRect 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
+ int32_t nBorderStyle; // optional
+ int32_t dwBorderWidth; // optional
+ CPWL_Color sBorderColor; // optional
+ CPWL_Color sTextColor; // optional
+ CPWL_Color sTextStrokeColor; // optional
+ int32_t nTransparency; // optional
+ FX_FLOAT fFontSize; // optional
+ CPWL_Dash sDash; // optional
+ void* pAttachedData; // optional
+ CPWL_Wnd* pParentWnd; // ignore
+ CPWL_MsgControl* pMsgControl; // ignore
+ int32_t eCursorType; // ignore
+ CFX_Matrix mtChild; // ignore
+};
+
+class CPWL_Timer {
+ public:
+ CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
+ virtual ~CPWL_Timer();
+
+ int32_t SetPWLTimer(int32_t nElapse);
+ void KillPWLTimer();
+ static void TimerProc(int32_t idEvent);
+
+ private:
+ int32_t m_nTimerID;
+ CPWL_TimerHandler* m_pAttached;
+ IFX_SystemHandler* m_pSystemHandler;
+};
+
+class CPWL_TimerHandler {
+ public:
+ CPWL_TimerHandler();
+ virtual ~CPWL_TimerHandler();
+
+ void BeginTimer(int32_t nElapse);
+ void EndTimer();
+ virtual void TimerProc();
+ virtual IFX_SystemHandler* GetSystemHandler() const = 0;
+
+ private:
+ CPWL_Timer* m_pTimer;
+};
+
+class CPWL_Wnd : public CPWL_TimerHandler {
+ friend class CPWL_MsgControl;
+
+ public:
+ CPWL_Wnd();
+ ~CPWL_Wnd() override;
+
+ void Create(const PWL_CREATEPARAM& cp);
+ virtual CFX_ByteString GetClassName() const;
+ void InvalidateFocusHandler(IPWL_FocusHandler* handler);
+ void InvalidateProvider(IPWL_Provider* provider);
+ void Destroy();
+ void Move(const CFX_FloatRect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh);
+ virtual void InvalidateRect(CFX_FloatRect* pRect = NULL);
+
+ void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device);
+
+ virtual FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnKeyUp(uint16_t nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonDblClk(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CFX_FloatPoint& point,
+ FX_DWORD nFlag);
+
+ virtual void SetFocus();
+ virtual void KillFocus();
+ void SetCapture();
+ void ReleaseCapture();
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+ virtual void SetTextColor(const CPWL_Color& color);
+ virtual void SetTextStrokeColor(const CPWL_Color& color);
+ virtual void SetVisible(FX_BOOL bVisible);
+
+ virtual CFX_FloatRect 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 int32_t GetInnerBorderWidth() const;
+ virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const;
+ virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const;
+
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+
+ void SetBackgroundColor(const CPWL_Color& color);
+ void SetClipRect(const CFX_FloatRect& rect);
+ void SetBorderStyle(int32_t eBorderStyle);
+
+ virtual CFX_FloatRect GetWindowRect() const;
+ virtual CFX_FloatRect GetClientRect() const;
+ CFX_FloatPoint GetCenterPoint() const;
+ int32_t 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);
+ const CFX_FloatRect& GetClipRect() const;
+ CPWL_Wnd* GetParentWindow() const;
+ int32_t GetBorderStyle() const;
+ const CPWL_Dash& GetBorderDash() const;
+ void* GetAttachedData() const;
+
+ FX_BOOL WndHitTest(const CFX_FloatPoint& point) const;
+ FX_BOOL ClientHitTest(const CFX_FloatPoint& 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;
+ IPWL_FocusHandler* GetFocusHandler() const;
+
+ int32_t GetTransparency();
+ void SetTransparency(int32_t nTransparency);
+
+ CFX_Matrix GetChildToRoot() const;
+ CFX_Matrix GetChildMatrix() const;
+ void SetChildMatrix(const CFX_Matrix& mt);
+ CFX_Matrix GetWindowMatrix() const;
+
+ virtual CFX_FloatPoint ChildToParent(const CFX_FloatPoint& point) const;
+ virtual CFX_FloatRect ChildToParent(const CFX_FloatRect& rect) const;
+ virtual CFX_FloatPoint ParentToChild(const CFX_FloatPoint& point) const;
+ virtual CFX_FloatRect ParentToChild(const CFX_FloatRect& 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:
+ // CPWL_TimerHandler
+ IFX_SystemHandler* GetSystemHandler() const override;
+
+ 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,
+ CFX_Matrix* pUser2Device);
+ virtual void DrawChildAppearance(CFX_RenderDevice* pDevice,
+ CFX_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;
+ const PWL_CREATEPARAM& GetCreationParam() const;
+ FX_BOOL IsNotifying() const { return m_bNotifying; }
+
+ void InvalidateRectMove(const CFX_FloatRect& rcOld,
+ const CFX_FloatRect& rcNew);
+
+ void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const;
+ FX_RECT PWLtoWnd(const CFX_FloatRect& 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 AdjustStyle();
+ void CreateMsgControl();
+ void DestroyMsgControl();
+
+ CPWL_MsgControl* GetMsgControl() const;
+
+ protected:
+ CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren;
+
+ private:
+ PWL_CREATEPARAM m_sPrivateParam;
+
+ CPWL_ScrollBar* m_pVScrollBar;
+
+ CFX_FloatRect m_rcWindow;
+ CFX_FloatRect m_rcClip;
+
+ FX_BOOL m_bCreated;
+ FX_BOOL m_bVisible;
+ FX_BOOL m_bNotifying;
+ FX_BOOL m_bEnabled;
+};
+
+#endif // FPDFSDK_PDFWINDOW_PWL_WND_H_