diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
commit | b048f791a15f2da781a01eba5b09eb9d389f9c11 (patch) | |
tree | 6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/include/pdfwindow | |
parent | c8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff) | |
download | pdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz |
clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163' | \
xargs ../../buildtools/mac/clang-format -i
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/include/pdfwindow')
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Button.h | 21 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Caret.h | 72 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_ComboBox.h | 148 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Edit.h | 276 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_EditCtrl.h | 315 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_FontMap.h | 207 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Icon.h | 73 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_IconList.h | 202 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Label.h | 58 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_ListBox.h | 180 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_ListCtrl.h | 66 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Note.h | 585 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_ScrollBar.h | 273 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Signature.h | 74 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_SpecialButton.h | 61 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Utils.h | 598 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Wnd.h | 829 |
17 files changed, 2146 insertions, 1892 deletions
diff --git a/fpdfsdk/include/pdfwindow/PWL_Button.h b/fpdfsdk/include/pdfwindow/PWL_Button.h index 4937841819..363556762f 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Button.h +++ b/fpdfsdk/include/pdfwindow/PWL_Button.h @@ -9,19 +9,18 @@ #include "PWL_Wnd.h" -class CPWL_Button : public CPWL_Wnd -{ -public: - CPWL_Button(); - virtual ~CPWL_Button(); +class CPWL_Button : public CPWL_Wnd { + public: + CPWL_Button(); + virtual ~CPWL_Button(); - virtual CFX_ByteString GetClassName() const; - virtual void OnCreate(PWL_CREATEPARAM & cp); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); + virtual CFX_ByteString GetClassName() const; + virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); -protected: - FX_BOOL m_bMouseDown; + protected: + FX_BOOL m_bMouseDown; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_BUTTON_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h index 6838bc49e7..7e61eeb66e 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h @@ -9,45 +9,43 @@ #include "PWL_Wnd.h" -struct PWL_CARET_INFO -{ -public: - PWL_CARET_INFO() : bVisible(FALSE), ptHead(0,0), ptFoot(0,0) - { - } - - FX_BOOL bVisible; - CPDF_Point ptHead; - CPDF_Point ptFoot; -}; +struct PWL_CARET_INFO { + public: + PWL_CARET_INFO() : bVisible(FALSE), ptHead(0, 0), ptFoot(0, 0) {} + FX_BOOL bVisible; + CPDF_Point ptHead; + CPDF_Point ptFoot; +}; -class CPWL_Caret : public CPWL_Wnd -{ -public: - CPWL_Caret(); - virtual ~CPWL_Caret(); - - virtual CFX_ByteString GetClassName() const; - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual void InvalidateRect(CPDF_Rect * pRect = NULL); - virtual void SetVisible(FX_BOOL bVisible) {} - virtual void TimerProc(); - void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot); - CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset); - void SetInvalidRect(CPDF_Rect rc) {m_rcInvalid = rc;} - -private: - void GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset); - CPDF_Rect GetCaretRect() const; - - FX_BOOL m_bFlash; - CPDF_Point m_ptHead; - CPDF_Point m_ptFoot; - FX_FLOAT m_fWidth; - int32_t m_nDelay; - CPDF_Rect m_rcInvalid; +class CPWL_Caret : public CPWL_Wnd { + public: + CPWL_Caret(); + virtual ~CPWL_Caret(); + + virtual CFX_ByteString GetClassName() const; + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual void InvalidateRect(CPDF_Rect* pRect = NULL); + virtual void SetVisible(FX_BOOL bVisible) {} + virtual void TimerProc(); + void SetCaret(FX_BOOL bVisible, + const CPDF_Point& ptHead, + const CPDF_Point& ptFoot); + CFX_ByteString GetCaretAppearanceStream(const CPDF_Point& ptOffset); + void SetInvalidRect(CPDF_Rect rc) { m_rcInvalid = rc; } + + private: + void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CPDF_Point& ptOffset); + CPDF_Rect GetCaretRect() const; + + FX_BOOL m_bFlash; + CPDF_Point m_ptHead; + CPDF_Point m_ptFoot; + FX_FLOAT m_fWidth; + int32_t m_nDelay; + CPDF_Rect m_rcInvalid; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_CARET_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h index 7a86ccd0c2..98ae7ca986 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h @@ -11,108 +11,108 @@ #include "PWL_ListBox.h" #include "PWL_Wnd.h" -class CPWL_CBEdit : public CPWL_Edit -{ -public: - CPWL_CBEdit(){}; - virtual ~CPWL_CBEdit(){}; +class CPWL_CBEdit : public CPWL_Edit { + public: + CPWL_CBEdit(){}; + virtual ~CPWL_CBEdit(){}; }; -class CPWL_CBListBox : public CPWL_ListBox -{ -public: - CPWL_CBListBox(){}; - virtual ~CPWL_CBListBox(){}; +class CPWL_CBListBox : public CPWL_ListBox { + public: + CPWL_CBListBox(){}; + virtual ~CPWL_CBListBox(){}; -public: - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); + public: + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); - FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag); - FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag); + FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); + FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); }; -#define PWL_COMBOBOX_BUTTON_WIDTH 13 +#define PWL_COMBOBOX_BUTTON_WIDTH 13 -class CPWL_CBButton : public CPWL_Wnd -{ -public: - CPWL_CBButton(){}; - virtual ~CPWL_CBButton(){}; +class CPWL_CBButton : public CPWL_Wnd { + public: + CPWL_CBButton(){}; + virtual ~CPWL_CBButton(){}; -public: - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); + public: + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); }; -class CPWL_ComboBox : public CPWL_Wnd -{ -public: - CPWL_ComboBox(); - operator CPWL_Edit* () {return m_pEdit;} +class CPWL_ComboBox : public CPWL_Wnd { + public: + CPWL_ComboBox(); + operator CPWL_Edit*() { return m_pEdit; } + + public: + virtual CFX_ByteString GetClassName() const; + virtual void OnCreate(PWL_CREATEPARAM& cp); -public: - virtual CFX_ByteString GetClassName() const; - virtual void OnCreate(PWL_CREATEPARAM & cp); + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void RePosChildWnd(); + virtual CPDF_Rect GetFocusRect() const; - virtual CPDF_Rect GetFocusRect() const; + virtual void SetFocus(); + virtual void KillFocus(); - virtual void SetFocus(); - virtual void KillFocus(); + FX_BOOL IsModified() const; - FX_BOOL IsModified() const; + public: + void SetFillerNotify(IPWL_Filler_Notify* pNotify); -public: - void SetFillerNotify(IPWL_Filler_Notify* pNotify); + CFX_WideString GetText() const; + void SetText(const FX_WCHAR* text); - CFX_WideString GetText() const; - void SetText(const FX_WCHAR* text); + void AddString(const FX_WCHAR* string); + int32_t GetSelect() const; + void SetSelect(int32_t nItemIndex); - void AddString(const FX_WCHAR* string); - 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 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 SetSelectText(); + private: + void CreateEdit(const PWL_CREATEPARAM& cp); + void CreateButton(const PWL_CREATEPARAM& cp); + void CreateListBox(const PWL_CREATEPARAM& cp); -private: - void CreateEdit(const PWL_CREATEPARAM & cp); - void CreateButton(const PWL_CREATEPARAM & cp); - void CreateListBox(const PWL_CREATEPARAM & cp); + void SetPopup(FX_BOOL bPopup); - void SetPopup(FX_BOOL bPopup); + private: + CPWL_CBEdit* m_pEdit; + CPWL_CBButton* m_pButton; + CPWL_CBListBox* m_pList; -private: - CPWL_CBEdit* m_pEdit; - CPWL_CBButton* m_pButton; - CPWL_CBListBox* m_pList; + FX_BOOL m_bPopup; + CPDF_Rect m_rcOldWindow; + int32_t m_nPopupWhere; + int32_t m_nSelectItem; + IPWL_Filler_Notify* m_pFillerNotify; - FX_BOOL m_bPopup; - CPDF_Rect m_rcOldWindow; - int32_t m_nPopupWhere; - int32_t m_nSelectItem; - IPWL_Filler_Notify* m_pFillerNotify; + public: + void AttachFFLData(void* pData) { m_pFormFiller = pData; } -public: - void AttachFFLData(void* pData) {m_pFormFiller = pData;} -private: - void* m_pFormFiller; + private: + void* m_pFormFiller; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index 5c90ff704b..ea1b3ef636 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -15,128 +15,164 @@ class CPWL_Edit; class IPWL_Filler_Notify; 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(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, - CFX_WideString & strChange, const CFX_WideString& strChangeEx, - int nSelStart, int nSelEnd, - FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0; - virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0; +class 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(FX_BOOL bEditOrList, + void* pPrivateData, + int32_t nKeyCode, + CFX_WideString& strChange, + const CFX_WideString& strChangeEx, + int nSelStart, + int nSelEnd, + FX_BOOL bKeyDown, + FX_BOOL& bRC, + FX_BOOL& bExit, + FX_DWORD nFlag) = 0; + virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, + void* pPrivateData, + FX_BOOL& bExit, + FX_DWORD nFlag) = 0; }; -class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify -{ -public: - CPWL_Edit(); - virtual ~CPWL_Edit(); - -public: - virtual CFX_ByteString GetClassName() const; - virtual void OnDestroy(); - virtual void OnCreated(); - virtual void RePosChildWnd(); - virtual CPDF_Rect GetClientRect() const; - - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - - virtual CPDF_Rect GetFocusRect() const; - -public: - void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE); //0:left 1:right 2:middle - void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE); //0:top 1:bottom 2:center - - void SetCharArray(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 CPDF_Point & ptOffset) const; - CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset) const; - CFX_ByteString GetSelectAppearanceStream(const CPDF_Point & ptOffset) const; - - FX_BOOL IsTextFull() const; - - static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray); - - void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;} - - void GeneratePageObjects(CPDF_PageObjects* pPageObjects, - const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); - void GeneratePageObjects(CPDF_PageObjects* pPageObjects, - const CPDF_Point& ptOffset); - -protected: - virtual void OnSetFocus(); - virtual void OnKillFocus(); - -protected: - virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem); - -private: - CPVT_WordRange GetSelectWordRange() const; - virtual void ShowVScrollBar(FX_BOOL bShow); - FX_BOOL IsVScrollBarVisible() const; - void SetParamByFlag(); - - FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); - CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); - - CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - CPVT_WordRange GetLatinWordsRange(const CPDF_Point & point) const; - CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const; - CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace & place) const; - CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const; - - void AjustArabicWords(const CPVT_WordRange& wr); -public: - FX_BOOL IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag); -private: - IPWL_Filler_Notify* m_pFillerNotify; - IPWL_SpellCheck* m_pSpellCheck; - FX_BOOL m_bFocus; - CPDF_Rect m_rcOldWindow; -public: - void AttachFFLData(void* pData) {m_pFormFiller = pData;} -private: - void* m_pFormFiller; +class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { + public: + CPWL_Edit(); + virtual ~CPWL_Edit(); + + public: + virtual CFX_ByteString GetClassName() const; + virtual void OnDestroy(); + virtual void OnCreated(); + virtual void RePosChildWnd(); + virtual CPDF_Rect GetClientRect() const; + + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag); + + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + + virtual CPDF_Rect GetFocusRect() const; + + public: + void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, + FX_BOOL bPaint = TRUE); // 0:left 1:right 2:middle + void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, + FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center + + void SetCharArray(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 CPDF_Point& ptOffset) const; + CFX_ByteString GetCaretAppearanceStream(const CPDF_Point& ptOffset) const; + CFX_ByteString GetSelectAppearanceStream(const CPDF_Point& ptOffset) const; + + FX_BOOL IsTextFull() const; + + static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, + const CPDF_Rect& rcPlate, + int32_t nCharArray); + + void SetFillerNotify(IPWL_Filler_Notify* pNotify) { + m_pFillerNotify = pNotify; + } + + void GeneratePageObjects(CPDF_PageObjects* pPageObjects, + const CPDF_Point& ptOffset, + CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); + void GeneratePageObjects(CPDF_PageObjects* pPageObjects, + const CPDF_Point& ptOffset); + + protected: + virtual void OnSetFocus(); + virtual void OnKillFocus(); + + protected: + virtual void OnInsertWord(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnInsertReturn(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnBackSpace(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnDelete(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnClear(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnSetText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnInsertText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace); + virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem); + + private: + CPVT_WordRange GetSelectWordRange() const; + virtual void ShowVScrollBar(FX_BOOL bShow); + FX_BOOL IsVScrollBarVisible() const; + void SetParamByFlag(); + + FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); + CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); + + CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, + const CPVT_WordRange& wr2); + CPVT_WordRange GetLatinWordsRange(const CPDF_Point& point) const; + CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; + CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; + CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, + FX_BOOL bLatin, + FX_BOOL bArabic) const; + + void AjustArabicWords(const CPVT_WordRange& wr); + + public: + FX_BOOL IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag); + + private: + IPWL_Filler_Notify* m_pFillerNotify; + IPWL_SpellCheck* m_pSpellCheck; + FX_BOOL m_bFocus; + CPDF_Rect m_rcOldWindow; + + public: + void AttachFFLData(void* pData) { m_pFormFiller = pData; } + + private: + void* m_pFormFiller; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDIT_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h index 273b3842c8..784ec61140 100644 --- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h @@ -18,159 +18,172 @@ 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_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 CPDF_Rect& rcContent) {} + // OprType: 0 InsertWord + // 1 InsertReturn + // 2 BackSpace + // 3 Delete + // 4 Clear + // 5 InsertText + // 6 SetText + virtual void OnInsertWord(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnInsertReturn(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnBackSpace(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnDelete(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnClear(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnInsertText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnSetText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) {} + virtual void OnAddUndo(CPWL_Edit* pEdit) {} }; -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 CPDF_Rect& rcContent){} - //OprType: 0 InsertWord - //1 InsertReturn - //2 BackSpace - //3 Delete - //4 Clear - //5 InsertText - //6 SetText - virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){} - virtual void OnAddUndo(CPWL_Edit* pEdit) {} -}; - -class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify -{ - friend class CPWL_Edit_Notify; - -public: - CPWL_EditCtrl(); - virtual ~CPWL_EditCtrl(); - -public: - virtual void OnCreate(PWL_CREATEPARAM & cp); - virtual void OnCreated(); - - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void RePosChildWnd(); - virtual void SetFontSize(FX_FLOAT fFontSize); - virtual FX_FLOAT GetFontSize() const; - -public: - virtual void SetText(const FX_WCHAR* csText); - - virtual void CopyText(); - virtual void PasteText(); - virtual void CutText(); - - CPDF_Rect GetContentRect() const; - void GetCaretPos(int32_t& x, int32_t& y) const; - FX_BOOL IsModified() 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 CPDF_Rect& 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); - CPDF_Point GetScrollPos() const; - void SetScrollPos(const CPDF_Point& 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(); -protected: - virtual void ShowVScrollBar(FX_BOOL bShow); - - virtual void InsertWord(FX_WORD word, int32_t nCharset); - virtual void InsertReturn(); - virtual void InsertText(const FX_WCHAR* csText); - - virtual void SetCursor(); - FX_BOOL IsWndHorV(); - - void Delete(); - void Backspace(); - -protected: - void GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const; - void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot); - - void SetEditCaret(FX_BOOL bVisible); - -protected: - virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, FX_FLOAT fBigStep){} - virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, FX_FLOAT fBigStep); - virtual void IOnSetScrollPosX(FX_FLOAT fx){} - virtual void IOnSetScrollPosY(FX_FLOAT fy); - virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place); - virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps); - virtual void IOnContentChange(const CPDF_Rect& rcContent); - virtual void IOnInvalidateRect(CPDF_Rect * pRect); - -private: - void CreateEditCaret(const PWL_CREATEPARAM & cp); - -protected: - IFX_Edit* m_pEdit; - CPWL_Caret* m_pEditCaret; - FX_BOOL m_bMouseDown; - IPWL_Edit_Notify* m_pEditNotify; - -private: - int32_t m_nCharSet; - int32_t m_nCodePage; +class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { + friend class CPWL_Edit_Notify; + + public: + CPWL_EditCtrl(); + virtual ~CPWL_EditCtrl(); + + public: + virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual void OnCreated(); + + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void RePosChildWnd(); + virtual void SetFontSize(FX_FLOAT fFontSize); + virtual FX_FLOAT GetFontSize() const; + + public: + virtual void SetText(const FX_WCHAR* csText); + + virtual void CopyText(); + virtual void PasteText(); + virtual void CutText(); + + CPDF_Rect GetContentRect() const; + void GetCaretPos(int32_t& x, int32_t& y) const; + FX_BOOL IsModified() 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 CPDF_Rect& 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); + CPDF_Point GetScrollPos() const; + void SetScrollPos(const CPDF_Point& 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(); + + protected: + virtual void ShowVScrollBar(FX_BOOL bShow); + + virtual void InsertWord(FX_WORD word, int32_t nCharset); + virtual void InsertReturn(); + virtual void InsertText(const FX_WCHAR* csText); + + virtual void SetCursor(); + FX_BOOL IsWndHorV(); + + void Delete(); + void Backspace(); + + protected: + void GetCaretInfo(CPDF_Point& ptHead, CPDF_Point& ptFoot) const; + void SetCaret(FX_BOOL bVisible, + const CPDF_Point& ptHead, + const CPDF_Point& ptFoot); + + void SetEditCaret(FX_BOOL bVisible); + + protected: + virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep) {} + virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep); + virtual void IOnSetScrollPosX(FX_FLOAT fx) {} + virtual void IOnSetScrollPosY(FX_FLOAT fy); + virtual void IOnSetCaret(FX_BOOL bVisible, + const CPDF_Point& ptHead, + const CPDF_Point& ptFoot, + const CPVT_WordPlace& place); + virtual void IOnCaretChange(const CPVT_SecProps& secProps, + const CPVT_WordProps& wordProps); + virtual void IOnContentChange(const CPDF_Rect& rcContent); + virtual void IOnInvalidateRect(CPDF_Rect* pRect); + + private: + void CreateEditCaret(const PWL_CREATEPARAM& cp); + + protected: + IFX_Edit* m_pEdit; + CPWL_Caret* m_pEditCaret; + FX_BOOL m_bMouseDown; + IPWL_Edit_Notify* m_pEditNotify; + + private: + int32_t m_nCharSet; + int32_t m_nCodePage; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h index 562d5df9c1..0f5124ca02 100644 --- a/fpdfsdk/include/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h @@ -13,118 +13,127 @@ class CPDF_Document; class IFX_SystemHandler; -struct CPWL_FontMap_Data -{ - CPDF_Font* pFont; - int32_t nCharset; - CFX_ByteString sFontName; +struct CPWL_FontMap_Data { + CPDF_Font* pFont; + int32_t nCharset; + CFX_ByteString sFontName; }; -struct CPWL_FontMap_Native -{ - 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 +#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); - virtual ~CPWL_FontMap(); - - virtual CPDF_Font* GetPDFFont(int32_t nFontIndex); - virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); - virtual int32_t GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t nFontIndex); - virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word); - virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset); - -public: - virtual void Initial(const FX_CHAR* fontname = NULL); - void SetSystemHandler(IFX_SystemHandler* pSystemHandler); - - int32_t GetFontMapCount() const; - const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; - -public: - 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 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, FX_WORD word); - - virtual CPDF_Document* GetDocument(); - - void Empty(); - int32_t GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind); - int32_t GetPWLFontIndex(FX_WORD 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_FontMap : public IFX_Edit_FontMap { + public: + CPWL_FontMap(IFX_SystemHandler* pSystemHandler); + virtual ~CPWL_FontMap(); + + virtual CPDF_Font* GetPDFFont(int32_t nFontIndex); + virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); + virtual int32_t GetWordFontIndex(FX_WORD word, + int32_t nCharset, + int32_t nFontIndex); + virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word); + virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset); + + public: + virtual void Initial(const FX_CHAR* fontname = NULL); + void SetSystemHandler(IFX_SystemHandler* pSystemHandler); + + int32_t GetFontMapCount() const; + const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; + + public: + 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 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, FX_WORD word); + + virtual CPDF_Document* GetDocument(); + + void Empty(); + int32_t GetFontIndex(const CFX_ByteString& sFontName, + int32_t nCharset, + FX_BOOL bFind); + int32_t GetPWLFontIndex(FX_WORD 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); - virtual ~CPWL_DocFontMap(); +class CPWL_DocFontMap : public CPWL_FontMap { + public: + CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, + CPDF_Document* pAttachedDoc); + virtual ~CPWL_DocFontMap(); - virtual CPDF_Document* GetDocument(); + virtual CPDF_Document* GetDocument(); -private: - CPDF_Document* m_pAttachedDoc; + private: + CPDF_Document* m_pAttachedDoc; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h index cff4e8ca69..7183f0245c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h @@ -10,51 +10,48 @@ #include "../../../core/include/fxcrt/fx_string.h" #include "PWL_Wnd.h" -class CPWL_Image : public CPWL_Wnd -{ -public: - CPWL_Image(); - virtual ~CPWL_Image(); - - virtual CFX_ByteString GetImageAppStream(); - - virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale); - virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y); - virtual CPDF_Stream * GetPDFStream(); - -public: - void SetPDFStream(CPDF_Stream* pStream); - void GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight); - CPDF_Matrix GetImageMatrix(); - CFX_ByteString GetImageAlias(); - void SetImageAlias(const FX_CHAR* sImageAlias); - -protected: - CPDF_Stream* m_pPDFStream; - CFX_ByteString m_sImageAlias; +class CPWL_Image : public CPWL_Wnd { + public: + CPWL_Image(); + virtual ~CPWL_Image(); + + virtual CFX_ByteString GetImageAppStream(); + + virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale); + virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y); + virtual CPDF_Stream* GetPDFStream(); + + public: + void SetPDFStream(CPDF_Stream* pStream); + void GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight); + CPDF_Matrix GetImageMatrix(); + CFX_ByteString GetImageAlias(); + void SetImageAlias(const FX_CHAR* sImageAlias); + + protected: + CPDF_Stream* m_pPDFStream; + CFX_ByteString m_sImageAlias; }; -class CPWL_Icon : public CPWL_Image -{ -public: - CPWL_Icon(); - virtual ~CPWL_Icon(); +class CPWL_Icon : public CPWL_Image { + public: + CPWL_Icon(); + virtual ~CPWL_Icon(); - virtual CPDF_IconFit * GetIconFit(){return m_pIconFit;}; + virtual CPDF_IconFit* GetIconFit() { return m_pIconFit; }; - virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale); - virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y); + virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale); + virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y); - int32_t GetScaleMethod(); - FX_BOOL IsProportionalScale(); - void GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom); - FX_BOOL GetFittingBounds(); + 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;}; + void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }; -private: - CPDF_IconFit * m_pIconFit; + private: + CPDF_IconFit* m_pIconFit; }; - #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_ICON_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h index b8bc3d2957..30a12dcd9b 100644 --- a/fpdfsdk/include/pdfwindow/PWL_IconList.h +++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h @@ -17,112 +17,114 @@ 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 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(); - virtual ~CPWL_IconList_Item(); - - virtual CFX_ByteString GetClassName() const; - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void RePosChildWnd(); - - void SetSelect(FX_BOOL bSelected); - FX_BOOL IsSelected() const; - void SetData(void* pData); - void SetIcon(int32_t nIconIndex); - void SetText(const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetText() const; - -protected: - virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual void OnEnabled(); - virtual void OnDisabled(); - -private: - int32_t m_nIconIndex; - void* m_pData; - FX_BOOL m_bSelected; - CPWL_Label* m_pText; - CPWL_Color m_crIcon; +class CPWL_IconList_Item : public CPWL_Wnd { + public: + CPWL_IconList_Item(); + virtual ~CPWL_IconList_Item(); + + virtual CFX_ByteString GetClassName() const; + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void RePosChildWnd(); + + void SetSelect(FX_BOOL bSelected); + FX_BOOL IsSelected() const; + void SetData(void* pData); + void SetIcon(int32_t nIconIndex); + void SetText(const CFX_WideString& str); + void SetIconFillColor(const CPWL_Color& color); + CFX_WideString GetText() const; + + protected: + virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + virtual void OnEnabled(); + virtual void OnDisabled(); + + private: + 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); - virtual ~CPWL_IconList_Content(); - - 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: - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - -private: - CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; - void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); - int32_t FindItemIndex(const CPDF_Point& 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_Content : public CPWL_ListCtrl { + public: + CPWL_IconList_Content(int32_t nListCount); + virtual ~CPWL_IconList_Content(); + + 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: + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + + private: + CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; + void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); + int32_t FindItemIndex(const CPDF_Point& 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); - virtual ~CPWL_IconList(); - - virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - - 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: - virtual void OnCreated(); - virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - -private: - CPWL_IconList_Content* m_pListContent; - int32_t m_nListCount; +class CPWL_IconList : public CPWL_Wnd { + public: + CPWL_IconList(int32_t nListCount); + virtual ~CPWL_IconList(); + + virtual FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag); + + 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: + virtual void OnCreated(); + virtual void RePosChildWnd(); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + + private: + CPWL_IconList_Content* m_pListContent; + int32_t m_nListCount; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_ICONLIST_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h index 3df547e0b2..b6cb7f557c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Label.h +++ b/fpdfsdk/include/pdfwindow/PWL_Label.h @@ -11,35 +11,35 @@ class IFX_Edit; -class CPWL_Label : public CPWL_Wnd -{ -public: - CPWL_Label(); - virtual ~CPWL_Label(); - - virtual CFX_ByteString GetClassName() const; - virtual void SetFontSize(FX_FLOAT fFontSize); - virtual FX_FLOAT GetFontSize() const; - - 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); - CPDF_Rect GetContentRect() const; - int32_t GetTotalWords(); - CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const; - -protected: - virtual void OnCreated(); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void RePosChildWnd(); - -private: - void SetParamByFlag(); - - IFX_Edit* m_pEdit; +class CPWL_Label : public CPWL_Wnd { + public: + CPWL_Label(); + virtual ~CPWL_Label(); + + virtual CFX_ByteString GetClassName() const; + virtual void SetFontSize(FX_FLOAT fFontSize); + virtual FX_FLOAT GetFontSize() const; + + 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); + CPDF_Rect GetContentRect() const; + int32_t GetTotalWords(); + CFX_ByteString GetTextAppearanceStream(const CPDF_Point& ptOffset) const; + + protected: + virtual void OnCreated(); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void RePosChildWnd(); + + private: + void SetParamByFlag(); + + IFX_Edit* m_pEdit; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LABEL_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h index 7c37fb30ef..b9372eff9c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h @@ -15,89 +15,107 @@ class CPWL_List_Notify; class CPWL_ListBox; class IPWL_Filler_Notify; -class CPWL_List_Notify : public IFX_List_Notify -{ -public: - CPWL_List_Notify(CPWL_ListBox * pList); - virtual ~CPWL_List_Notify(); - - void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, FX_FLOAT fBigStep){} - void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, - FX_FLOAT fSmallStep, FX_FLOAT fBigStep); - void IOnSetScrollPosX(FX_FLOAT fx){} - void IOnSetScrollPosY(FX_FLOAT fy); - void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place); - void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps); - void IOnInvalidateRect(CPDF_Rect * pRect); - -private: - CPWL_ListBox* m_pList; +class CPWL_List_Notify : public IFX_List_Notify { + public: + CPWL_List_Notify(CPWL_ListBox* pList); + virtual ~CPWL_List_Notify(); + + void IOnSetScrollInfoX(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep) {} + void IOnSetScrollInfoY(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep); + void IOnSetScrollPosX(FX_FLOAT fx) {} + void IOnSetScrollPosY(FX_FLOAT fy); + void IOnSetCaret(FX_BOOL bVisible, + const CPDF_Point& ptHead, + const CPDF_Point& ptFoot, + const CPVT_WordPlace& place); + void IOnCaretChange(const CPVT_SecProps& secProps, + const CPVT_WordProps& wordProps); + void IOnInvalidateRect(CPDF_Rect* pRect); + + private: + CPWL_ListBox* m_pList; }; -class CPWL_ListBox : public CPWL_Wnd -{ -public: - CPWL_ListBox(); - virtual ~CPWL_ListBox(); - - virtual CFX_ByteString GetClassName() const; - virtual void OnCreated(); - virtual void OnDestroy(); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - virtual void KillFocus(); - - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - virtual void RePosChildWnd(); - virtual CFX_WideString GetText() const; - virtual CPDF_Rect GetFocusRect() const; - virtual void SetFontSize(FX_FLOAT fFontSize); - virtual FX_FLOAT GetFontSize() const; - - void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag); - - void AddString(const FX_WCHAR* string); - 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; - CPDF_Rect GetContentRect() const; - FX_FLOAT GetFirstHeight() const; - CPDF_Rect GetListRect() const; - - void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;} - -protected: - IFX_List* m_pList; - CPWL_List_Notify* m_pListNotify; - FX_BOOL m_bMouseDown; - FX_BOOL m_bHoverSel; - IPWL_Filler_Notify* m_pFillerNotify; -public: - void AttachFFLData(void* pData) {m_pFormFiller = pData;} -private: - void* m_pFormFiller; +class CPWL_ListBox : public CPWL_Wnd { + public: + CPWL_ListBox(); + virtual ~CPWL_ListBox(); + + virtual CFX_ByteString GetClassName() const; + virtual void OnCreated(); + virtual void OnDestroy(); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag); + virtual void KillFocus(); + + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + virtual void RePosChildWnd(); + virtual CFX_WideString GetText() const; + virtual CPDF_Rect GetFocusRect() const; + virtual void SetFontSize(FX_FLOAT fFontSize); + virtual FX_FLOAT GetFontSize() const; + + void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag); + + void AddString(const FX_WCHAR* string); + 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; + CPDF_Rect GetContentRect() const; + FX_FLOAT GetFirstHeight() const; + CPDF_Rect GetListRect() const; + + void SetFillerNotify(IPWL_Filler_Notify* pNotify) { + m_pFillerNotify = pNotify; + } + + protected: + IFX_List* m_pList; + CPWL_List_Notify* m_pListNotify; + FX_BOOL m_bMouseDown; + FX_BOOL m_bHoverSel; + IPWL_Filler_Notify* m_pFillerNotify; + + public: + void AttachFFLData(void* pData) { m_pFormFiller = pData; } + + private: + void* m_pFormFiller; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h index c107a0cf5e..cd90692150 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h @@ -9,39 +9,39 @@ #include "PWL_Wnd.h" -class CPWL_ListCtrl : public CPWL_Wnd -{ -public: - CPWL_ListCtrl(); - virtual ~CPWL_ListCtrl(); - - void SetScrollPos(const CPDF_Point& point); - CPDF_Point GetScrollPos() const; - CPDF_Rect GetScrollArea() const; - void SetItemSpace(FX_FLOAT fSpace); - void SetTopSpace(FX_FLOAT fSpace); - void SetBottomSpace(FX_FLOAT fSpace); - void ResetFace(); - void ResetContent(int32_t nStart); - int32_t GetItemIndex(CPWL_Wnd* pItem); - FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth); - CPDF_Point InToOut(const CPDF_Point& point) const; - CPDF_Point OutToIn(const CPDF_Point& point) const; - CPDF_Rect InToOut(const CPDF_Rect& rect) const; - CPDF_Rect OutToIn(const CPDF_Rect& rect) const; - -protected: - virtual void RePosChildWnd(); - virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - -private: - void ResetAll(FX_BOOL bMove,int32_t nStart); - - CPDF_Rect m_rcContent; - CPDF_Point m_ptScroll; - FX_FLOAT m_fItemSpace; - FX_FLOAT m_fTopSpace; - FX_FLOAT m_fBottomSpace; +class CPWL_ListCtrl : public CPWL_Wnd { + public: + CPWL_ListCtrl(); + virtual ~CPWL_ListCtrl(); + + void SetScrollPos(const CPDF_Point& point); + CPDF_Point GetScrollPos() const; + CPDF_Rect GetScrollArea() const; + void SetItemSpace(FX_FLOAT fSpace); + void SetTopSpace(FX_FLOAT fSpace); + void SetBottomSpace(FX_FLOAT fSpace); + void ResetFace(); + void ResetContent(int32_t nStart); + int32_t GetItemIndex(CPWL_Wnd* pItem); + FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth); + CPDF_Point InToOut(const CPDF_Point& point) const; + CPDF_Point OutToIn(const CPDF_Point& point) const; + CPDF_Rect InToOut(const CPDF_Rect& rect) const; + CPDF_Rect OutToIn(const CPDF_Rect& rect) const; + + protected: + virtual void RePosChildWnd(); + virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + private: + void ResetAll(FX_BOOL bMove, int32_t nStart); + + CPDF_Rect m_rcContent; + CPDF_Point m_ptScroll; + FX_FLOAT m_fItemSpace; + FX_FLOAT m_fTopSpace; + FX_FLOAT m_fBottomSpace; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTCTRL_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h index 29b7857e20..4f18fa20d0 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Note.h +++ b/fpdfsdk/include/pdfwindow/PWL_Note.h @@ -28,333 +28,342 @@ 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_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_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 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(); - virtual ~CPWL_Note_Icon(); +class CPWL_Note_Icon : public CPWL_Wnd { + public: + CPWL_Note_Icon(); + virtual ~CPWL_Note_Icon(); - void SetIconType(int32_t nType); + void SetIconType(int32_t nType); -public: + public: + protected: + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); -protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - -private: - int32_t m_nType; + private: + int32_t m_nType; }; -class CPWL_Note_CloseBox : public CPWL_Button -{ -public: - CPWL_Note_CloseBox(); - virtual ~CPWL_Note_CloseBox(); +class CPWL_Note_CloseBox : public CPWL_Button { + public: + CPWL_Note_CloseBox(); + virtual ~CPWL_Note_CloseBox(); -protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); + protected: + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); -private: - FX_BOOL m_bMouseDown; + private: + FX_BOOL m_bMouseDown; }; -class CPWL_Note_LBBox : public CPWL_Wnd -{ -public: - CPWL_Note_LBBox(); - virtual ~CPWL_Note_LBBox(); +class CPWL_Note_LBBox : public CPWL_Wnd { + public: + CPWL_Note_LBBox(); + virtual ~CPWL_Note_LBBox(); -protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); + protected: + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); }; -class CPWL_Note_RBBox : public CPWL_Wnd -{ -public: - CPWL_Note_RBBox(); - virtual ~CPWL_Note_RBBox(); +class CPWL_Note_RBBox : public CPWL_Wnd { + public: + CPWL_Note_RBBox(); + virtual ~CPWL_Note_RBBox(); -protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); + protected: + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); }; -class CPWL_Note_Edit : public CPWL_Edit -{ -public: - CPWL_Note_Edit(); - virtual ~CPWL_Note_Edit(); - - void EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;} - virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); - FX_FLOAT GetItemLeftMargin(); - FX_FLOAT GetItemRightMargin(); - - virtual void SetText(const FX_WCHAR* csText); - -protected: - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - virtual void RePosChildWnd(); - virtual void OnSetFocus(); - virtual void OnKillFocus(); - -private: - FX_BOOL m_bEnableNotify; - FX_FLOAT m_fOldItemHeight; - FX_BOOL m_bSizeChanged; - FX_FLOAT m_fOldMin; - FX_FLOAT m_fOldMax; +class CPWL_Note_Edit : public CPWL_Edit { + public: + CPWL_Note_Edit(); + virtual ~CPWL_Note_Edit(); + + void EnableNotify(FX_BOOL bEnable) { m_bEnableNotify = bEnable; } + virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); + FX_FLOAT GetItemLeftMargin(); + FX_FLOAT GetItemRightMargin(); + + virtual void SetText(const FX_WCHAR* csText); + + protected: + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + virtual void RePosChildWnd(); + virtual void OnSetFocus(); + virtual void OnKillFocus(); + + private: + FX_BOOL m_bEnableNotify; + FX_FLOAT m_fOldItemHeight; + FX_BOOL m_bSizeChanged; + FX_FLOAT m_fOldMin; + FX_FLOAT m_fOldMax; }; -class CPWL_Note_Options : public CPWL_Wnd -{ -public: - CPWL_Note_Options(); - virtual ~CPWL_Note_Options(); +class CPWL_Note_Options : public CPWL_Wnd { + public: + CPWL_Note_Options(); + virtual ~CPWL_Note_Options(); - CPDF_Rect GetContentRect() const; - virtual void SetTextColor(const CPWL_Color & color); - void SetText(const CFX_WideString& sText); + CPDF_Rect GetContentRect() const; + virtual void SetTextColor(const CPWL_Color& color); + void SetText(const CFX_WideString& sText); -protected: - virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); + protected: + virtual void RePosChildWnd(); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); -private: - CPWL_Label* m_pText; + private: + CPWL_Label* m_pText; }; -class CPWL_Note_Contents : public CPWL_ListCtrl -{ -public: - CPWL_Note_Contents(); - virtual ~CPWL_Note_Contents(); +class CPWL_Note_Contents : public CPWL_ListCtrl { + public: + CPWL_Note_Contents(); + virtual ~CPWL_Note_Contents(); - virtual CFX_ByteString GetClassName() const; - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual CFX_ByteString GetClassName() const; + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); - void SetEditFocus(FX_BOOL bLast); - CPWL_Edit* GetEdit() const; + void SetEditFocus(FX_BOOL bLast); + CPWL_Edit* GetEdit() const; -public: - void SetText(const CFX_WideString& sText); - CFX_WideString GetText() const; + public: + 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; + CPWL_NoteItem* CreateSubItem(); + void DeleteSubItem(IPWL_NoteItem* pNoteItem); + int32_t CountSubItems() const; + IPWL_NoteItem* GetSubItems(int32_t index) const; - virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); - void EnableRead(FX_BOOL bEnabled); - void EnableModify(FX_BOOL bEnabled); + virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); + void EnableRead(FX_BOOL bEnabled); + void EnableModify(FX_BOOL bEnabled); -protected: - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); + protected: + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); -private: - CPWL_Note_Edit* m_pEdit; + private: + CPWL_Note_Edit* m_pEdit; }; -class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem -{ -public: - CPWL_NoteItem(); - virtual ~CPWL_NoteItem(); - -public: - virtual void SetPrivateData(void* pData); - virtual void SetBkColor(const CPWL_Color& color); - virtual void SetSubjectName(const CFX_WideString& sName); - virtual void SetAuthorName(const CFX_WideString& sName); - virtual void SetDateTime(FX_SYSTEMTIME time); - virtual void SetContents(const CFX_WideString& sContents); - - virtual IPWL_NoteItem* CreateSubItem(); - virtual int32_t CountSubItems() const; - virtual IPWL_NoteItem* GetSubItems(int32_t index) const; - virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem); - virtual void SetFocus(){SetNoteFocus(FALSE);} - - virtual IPWL_NoteItem* GetParentItem() const; - virtual void* GetPrivateData() const; - virtual CFX_WideString GetAuthorName() const; - virtual CPWL_Color GetBkColor() const; - virtual CFX_WideString GetContents() const; - virtual FX_SYSTEMTIME GetDateTime() const; - virtual CFX_WideString GetSubjectName() const; - virtual FX_BOOL IsTopItem() const { return FALSE;} - virtual CPWL_Edit* GetEdit() const; - -public: - virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); - virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual CFX_ByteString GetClassName() const; - virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); - virtual IPWL_NoteItem* GetFocusedNoteItem() const; - - virtual void ResetSubjectName(int32_t nItemIndex); - void EnableRead(FX_BOOL bEnabled); - void EnableModify(FX_BOOL bEnabled); - -protected: - virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - -public: - virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); - virtual FX_FLOAT GetItemLeftMargin(); - virtual FX_FLOAT GetItemRightMargin(); - CPWL_NoteItem* CreateNoteItem(); - CPWL_NoteItem* GetParentNoteItem() const; - - void SetNoteFocus(FX_BOOL bLast); - void OnContentsValidate(); - - void OnCreateNoteItem(); - -protected: - void PopupNoteItemMenu(const CPDF_Point& point); - - virtual const CPWL_Note* GetNote() const; - virtual IPWL_NoteNotify* GetNoteNotify() const; - -protected: - CPWL_Label* m_pSubject; - CPWL_Label* m_pDateTime; - CPWL_Note_Contents* m_pContents; - -private: - void* m_pPrivateData; - FX_SYSTEMTIME m_dtNote; - CFX_WideString m_sAuthor; - - FX_FLOAT m_fOldItemHeight; - FX_BOOL m_bSizeChanged; - FX_BOOL m_bAllowModify; +class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem { + public: + CPWL_NoteItem(); + virtual ~CPWL_NoteItem(); + + public: + virtual void SetPrivateData(void* pData); + virtual void SetBkColor(const CPWL_Color& color); + virtual void SetSubjectName(const CFX_WideString& sName); + virtual void SetAuthorName(const CFX_WideString& sName); + virtual void SetDateTime(FX_SYSTEMTIME time); + virtual void SetContents(const CFX_WideString& sContents); + + virtual IPWL_NoteItem* CreateSubItem(); + virtual int32_t CountSubItems() const; + virtual IPWL_NoteItem* GetSubItems(int32_t index) const; + virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem); + virtual void SetFocus() { SetNoteFocus(FALSE); } + + virtual IPWL_NoteItem* GetParentItem() const; + virtual void* GetPrivateData() const; + virtual CFX_WideString GetAuthorName() const; + virtual CPWL_Color GetBkColor() const; + virtual CFX_WideString GetContents() const; + virtual FX_SYSTEMTIME GetDateTime() const; + virtual CFX_WideString GetSubjectName() const; + virtual FX_BOOL IsTopItem() const { return FALSE; } + virtual CPWL_Edit* GetEdit() const; + + public: + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual CFX_ByteString GetClassName() const; + virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); + virtual IPWL_NoteItem* GetFocusedNoteItem() const; + + virtual void ResetSubjectName(int32_t nItemIndex); + void EnableRead(FX_BOOL bEnabled); + void EnableModify(FX_BOOL bEnabled); + + protected: + virtual void RePosChildWnd(); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + + public: + virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); + virtual FX_FLOAT GetItemLeftMargin(); + virtual FX_FLOAT GetItemRightMargin(); + CPWL_NoteItem* CreateNoteItem(); + CPWL_NoteItem* GetParentNoteItem() const; + + void SetNoteFocus(FX_BOOL bLast); + void OnContentsValidate(); + + void OnCreateNoteItem(); + + protected: + void PopupNoteItemMenu(const CPDF_Point& point); + + virtual const CPWL_Note* GetNote() const; + virtual IPWL_NoteNotify* GetNoteNotify() const; + + protected: + CPWL_Label* m_pSubject; + CPWL_Label* m_pDateTime; + CPWL_Note_Contents* m_pContents; + + private: + void* m_pPrivateData; + FX_SYSTEMTIME m_dtNote; + CFX_WideString m_sAuthor; + + FX_FLOAT m_fOldItemHeight; + FX_BOOL m_bSizeChanged; + FX_BOOL m_bAllowModify; }; -class CPWL_Note : public CPWL_NoteItem -{ -public: - CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler); - virtual ~CPWL_Note(); - -public: - virtual void SetSubjectName(const CFX_WideString& sName); - virtual void SetAuthorName(const CFX_WideString& sName); - virtual CFX_WideString GetAuthorName() const; - virtual void SetBkColor(const CPWL_Color& color); - virtual void ResetSubjectName(int32_t nItemIndex){} - virtual FX_BOOL IsTopItem() const {return TRUE;} - virtual const CPWL_Note* GetNote() const; - virtual IPWL_NoteNotify* GetNoteNotify() const; - -public: - IPWL_NoteItem* Reply(); - void EnableNotify(FX_BOOL bEnabled); - void SetIconType(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& string); - - //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options - int32_t NoteHitTest(const CPDF_Point& point) const; - CPDF_Rect GetCaptionRect() const {return m_rcCaption;} - IPopup_Note* GetPopupNote() const {return m_pPopupNote;} - -public: - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - -protected: - virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - - FX_BOOL ResetScrollBar(); - void RePosNoteChildren(); - FX_BOOL ScrollBarShouldVisible(); - -private: - CPWL_Label* m_pAuthor; - CPWL_Note_Icon* m_pIcon; - CPWL_Note_CloseBox* m_pCloseBox; - CPWL_Note_LBBox* m_pLBBox; - CPWL_Note_RBBox* m_pRBBox; - CPWL_ScrollBar* m_pContentsBar; - CPWL_Note_Options* m_pOptions; - IPWL_NoteNotify* m_pNoteNotify; - FX_BOOL m_bResizing; - PWL_SCROLL_INFO m_OldScrollInfo; - CPDF_Rect m_rcCaption; - FX_BOOL m_bEnalbleNotify; - IPopup_Note* m_pPopupNote; - CFX_WideString m_sReplyString; +class CPWL_Note : public CPWL_NoteItem { + public: + CPWL_Note(IPopup_Note* pPopupNote, + IPWL_NoteNotify* pNoteNotify, + IPWL_NoteHandler* pNoteHandler); + virtual ~CPWL_Note(); + + public: + virtual void SetSubjectName(const CFX_WideString& sName); + virtual void SetAuthorName(const CFX_WideString& sName); + virtual CFX_WideString GetAuthorName() const; + virtual void SetBkColor(const CPWL_Color& color); + virtual void ResetSubjectName(int32_t nItemIndex) {} + virtual FX_BOOL IsTopItem() const { return TRUE; } + virtual const CPWL_Note* GetNote() const; + virtual IPWL_NoteNotify* GetNoteNotify() const; + + public: + IPWL_NoteItem* Reply(); + void EnableNotify(FX_BOOL bEnabled); + void SetIconType(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& string); + + // 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close + // / 5-options + int32_t NoteHitTest(const CPDF_Point& point) const; + CPDF_Rect GetCaptionRect() const { return m_rcCaption; } + IPopup_Note* GetPopupNote() const { return m_pPopupNote; } + + public: + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag); + + protected: + virtual void RePosChildWnd(); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + + FX_BOOL ResetScrollBar(); + void RePosNoteChildren(); + FX_BOOL ScrollBarShouldVisible(); + + private: + CPWL_Label* m_pAuthor; + CPWL_Note_Icon* m_pIcon; + CPWL_Note_CloseBox* m_pCloseBox; + CPWL_Note_LBBox* m_pLBBox; + CPWL_Note_RBBox* m_pRBBox; + CPWL_ScrollBar* m_pContentsBar; + CPWL_Note_Options* m_pOptions; + IPWL_NoteNotify* m_pNoteNotify; + FX_BOOL m_bResizing; + PWL_SCROLL_INFO m_OldScrollInfo; + CPDF_Rect m_rcCaption; + FX_BOOL m_bEnalbleNotify; + IPopup_Note* m_pPopupNote; + CFX_WideString m_sReplyString; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_NOTE_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h index 0390222545..a149a01416 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h @@ -12,155 +12,150 @@ 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; +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_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL }; -enum PWL_SBBUTTON_TYPE -{ - PSBT_MIN, - PSBT_MAX, - PSBT_POS -}; +enum PWL_SBBUTTON_TYPE { PSBT_MIN, PSBT_MAX, PSBT_POS }; + +class CPWL_SBButton : public CPWL_Wnd { + public: + CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, + PWL_SBBUTTON_TYPE eButtonType); + virtual ~CPWL_SBButton(); -class CPWL_SBButton : public CPWL_Wnd -{ -public: - CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE eButtonType); - virtual ~CPWL_SBButton(); - -public: - virtual CFX_ByteString GetClassName() const; - virtual void OnCreate(PWL_CREATEPARAM & cp); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - -protected: - PWL_SCROLLBAR_TYPE m_eScrollBarType; - PWL_SBBUTTON_TYPE m_eSBButtonType; - - FX_BOOL m_bMouseDown; + public: + virtual CFX_ByteString GetClassName() const; + virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); + + protected: + PWL_SCROLLBAR_TYPE m_eScrollBarType; + PWL_SBBUTTON_TYPE m_eSBButtonType; + + FX_BOOL m_bMouseDown; }; -struct PWL_FLOATRANGE -{ -public: - PWL_FLOATRANGE(); - PWL_FLOATRANGE(FX_FLOAT min,FX_FLOAT max); - void Default(); - void Set(FX_FLOAT min,FX_FLOAT max); - FX_BOOL In(FX_FLOAT x) const; - FX_FLOAT GetWidth() const; - - FX_FLOAT fMin,fMax; +struct PWL_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; +struct PWL_SCROLL_PRIVATEDATA { + public: + PWL_SCROLL_PRIVATEDATA(); + + void Default(); + void SetScrollRange(FX_FLOAT min, FX_FLOAT max); + void SetClientWidth(FX_FLOAT width); + void SetSmallStep(FX_FLOAT step); + void SetBigStep(FX_FLOAT step); + FX_BOOL SetPos(FX_FLOAT pos); + + void AddSmall(); + void SubSmall(); + void AddBig(); + void SubBig(); + + PWL_FLOATRANGE ScrollRange; + FX_FLOAT fClientWidth; + FX_FLOAT fScrollPos; + FX_FLOAT fBigStep; + FX_FLOAT fSmallStep; }; -class CPWL_ScrollBar : public CPWL_Wnd -{ -public: - CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL); - virtual ~CPWL_ScrollBar(); - -public: - virtual CFX_ByteString GetClassName() const; - virtual void OnCreate(PWL_CREATEPARAM & cp); - virtual void RePosChildWnd(); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); - - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - - FX_FLOAT GetScrollBarWidth() const; - PWL_SCROLLBAR_TYPE GetScrollBarType() const {return m_sbType;}; - - void SetNotifyForever(FX_BOOL bForever) {m_bNotifyForever = bForever;} - -protected: - void SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClientWidth); - void SetScrollPos(FX_FLOAT fPos); - void MovePosButton(FX_BOOL bRefresh); - void SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep); - void NotifyScrollWindow(); - CPDF_Rect GetScrollArea() const; - -private: - void CreateButtons(const PWL_CREATEPARAM & cp); - - void OnMinButtonLBDown(const CPDF_Point & point); - void OnMinButtonLBUp(const CPDF_Point & point); - void OnMinButtonMouseMove(const CPDF_Point & point); - - void OnMaxButtonLBDown(const CPDF_Point & point); - void OnMaxButtonLBUp(const CPDF_Point & point); - void OnMaxButtonMouseMove(const CPDF_Point & point); - - void OnPosButtonLBDown(const CPDF_Point & point); - void OnPosButtonLBUp(const CPDF_Point & point); - void OnPosButtonMouseMove(const CPDF_Point & point); - - FX_FLOAT TrueToFace(FX_FLOAT); - FX_FLOAT FaceToTrue(FX_FLOAT); - - virtual void TimerProc(); - -private: - PWL_SCROLLBAR_TYPE m_sbType; - PWL_SCROLL_INFO m_OriginInfo; - CPWL_SBButton* m_pMinButton; - CPWL_SBButton* m_pMaxButton; - CPWL_SBButton* m_pPosButton; - PWL_SCROLL_PRIVATEDATA m_sData; - FX_BOOL m_bMouseDown; - FX_BOOL m_bMinOrMax; - FX_BOOL m_bNotifyForever; - FX_FLOAT m_nOldPos; - FX_FLOAT m_fOldPosButton; +class CPWL_ScrollBar : public CPWL_Wnd { + public: + CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL); + virtual ~CPWL_ScrollBar(); + + public: + virtual CFX_ByteString GetClassName() const; + virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual void RePosChildWnd(); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0); + + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + + FX_FLOAT GetScrollBarWidth() const; + PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; }; + + void SetNotifyForever(FX_BOOL bForever) { m_bNotifyForever = bForever; } + + protected: + void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth); + void SetScrollPos(FX_FLOAT fPos); + void MovePosButton(FX_BOOL bRefresh); + void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep); + void NotifyScrollWindow(); + CPDF_Rect GetScrollArea() const; + + private: + void CreateButtons(const PWL_CREATEPARAM& cp); + + void OnMinButtonLBDown(const CPDF_Point& point); + void OnMinButtonLBUp(const CPDF_Point& point); + void OnMinButtonMouseMove(const CPDF_Point& point); + + void OnMaxButtonLBDown(const CPDF_Point& point); + void OnMaxButtonLBUp(const CPDF_Point& point); + void OnMaxButtonMouseMove(const CPDF_Point& point); + + void OnPosButtonLBDown(const CPDF_Point& point); + void OnPosButtonLBUp(const CPDF_Point& point); + void OnPosButtonMouseMove(const CPDF_Point& point); + + FX_FLOAT TrueToFace(FX_FLOAT); + FX_FLOAT FaceToTrue(FX_FLOAT); + + virtual void TimerProc(); + + private: + PWL_SCROLLBAR_TYPE m_sbType; + PWL_SCROLL_INFO m_OriginInfo; + CPWL_SBButton* m_pMinButton; + CPWL_SBButton* m_pMaxButton; + CPWL_SBButton* m_pPosButton; + PWL_SCROLL_PRIVATEDATA m_sData; + FX_BOOL m_bMouseDown; + FX_BOOL m_bMinOrMax; + FX_BOOL m_bNotifyForever; + FX_FLOAT m_nOldPos; + FX_FLOAT m_fOldPosButton; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SCROLLBAR_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Signature.h b/fpdfsdk/include/pdfwindow/PWL_Signature.h index d9be322a7d..c48d4e9708 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Signature.h +++ b/fpdfsdk/include/pdfwindow/PWL_Signature.h @@ -13,55 +13,55 @@ class CFX_DIBSource; class CPWL_Label; -class CPWL_Signature_Image : public CPWL_Image -{ -public: - CPWL_Signature_Image(); - virtual ~CPWL_Signature_Image(); +class CPWL_Signature_Image : public CPWL_Image { + public: + CPWL_Signature_Image(); + virtual ~CPWL_Signature_Image(); - void SetImage(CFX_DIBSource* pImage); - CFX_DIBSource* GetImage(); + void SetImage(CFX_DIBSource* pImage); + CFX_DIBSource* GetImage(); -protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); + protected: + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); - virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale); + virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale); -private: - CFX_DIBSource* m_pImage; + private: + CFX_DIBSource* m_pImage; }; -class CPWL_Signature : public CPWL_Wnd -{ -public: - CPWL_Signature(); - virtual ~CPWL_Signature(); +class CPWL_Signature : public CPWL_Wnd { + public: + CPWL_Signature(); + virtual ~CPWL_Signature(); - void SetText(const FX_WCHAR* sText); - void SetDescription(const FX_WCHAR* string); - void SetImage(CFX_DIBSource* pImage); - void SetImageStream(CPDF_Stream * pStream, const FX_CHAR* sImageAlias); + void SetText(const FX_WCHAR* sText); + void SetDescription(const FX_WCHAR* string); + 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); + void SetTextFlag(FX_BOOL bTextExist); + void SetImageFlag(FX_BOOL bImageExist); + void SetFoxitFlag(FX_BOOL bFlagExist); -protected: - virtual void RePosChildWnd(); - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); + protected: + virtual void RePosChildWnd(); + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); -private: - CPWL_Label* m_pText; - CPWL_Label* m_pDescription; - CPWL_Signature_Image* m_pImage; + 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; + FX_BOOL m_bTextExist; + FX_BOOL m_bImageExist; + FX_BOOL m_bFlagExist; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SIGNATURE_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h index 31787d79ed..8cfe819a67 100644 --- a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h @@ -9,48 +9,45 @@ #include "PWL_Button.h" -class CPWL_PushButton : public CPWL_Button -{ -public: - CPWL_PushButton(); - virtual ~CPWL_PushButton(); - - virtual CFX_ByteString GetClassName() const; - virtual CPDF_Rect GetFocusRect() const; +class CPWL_PushButton : public CPWL_Button { + public: + CPWL_PushButton(); + virtual ~CPWL_PushButton(); + + virtual CFX_ByteString GetClassName() const; + virtual CPDF_Rect GetFocusRect() const; }; -class CPWL_CheckBox : public CPWL_Button -{ -public: - CPWL_CheckBox(); - virtual ~CPWL_CheckBox(); +class CPWL_CheckBox : public CPWL_Button { + public: + CPWL_CheckBox(); + virtual ~CPWL_CheckBox(); - virtual CFX_ByteString GetClassName() const; - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual CFX_ByteString GetClassName() const; + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - void SetCheck(FX_BOOL bCheck); - FX_BOOL IsChecked() const; + void SetCheck(FX_BOOL bCheck); + FX_BOOL IsChecked() const; -private: - FX_BOOL m_bChecked; + private: + FX_BOOL m_bChecked; }; -class CPWL_RadioButton : public CPWL_Button -{ -public: - CPWL_RadioButton(); - virtual ~CPWL_RadioButton(); +class CPWL_RadioButton : public CPWL_Button { + public: + CPWL_RadioButton(); + virtual ~CPWL_RadioButton(); - virtual CFX_ByteString GetClassName() const; - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual CFX_ByteString GetClassName() const; + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - void SetCheck(FX_BOOL bCheck); - FX_BOOL IsChecked() const; + void SetCheck(FX_BOOL bCheck); + FX_BOOL IsChecked() const; -private: - FX_BOOL m_bChecked; + private: + FX_BOOL m_bChecked; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SPECIALBUTTON_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h index b58f30e399..e797510d50 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h @@ -8,236 +8,406 @@ #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_UTILS_H_ #include "../../../core/include/fpdfapi/fpdf_parser.h" // For CPDF_Point. -#include "../../../core/include/fpdfdoc/fpdf_vt.h" // For CPVT_WordRange. +#include "../../../core/include/fpdfdoc/fpdf_vt.h" // For CPVT_WordRange. #include "../fxedit/fx_edit.h" #include "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)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16))) -#define PWL_GETLOWWORD(dword) ((FX_WORD)(dword)) -#define PWL_GETHIGHWORD(dword) ((FX_WORD)(dword>>16)) - -#define PWL_ICONTYPE_CHECKMARK 0 -#define PWL_ICONTYPE_CIRCLE 1 -#define PWL_ICONTYPE_COMMENT 2 -#define PWL_ICONTYPE_CROSS 3 -#define PWL_ICONTYPE_HELP 4 -#define PWL_ICONTYPE_INSERTTEXT 5 -#define PWL_ICONTYPE_KEY 6 -#define PWL_ICONTYPE_NEWPARAGRAPH 7 -#define PWL_ICONTYPE_TEXTNOTE 8 -#define PWL_ICONTYPE_PARAGRAPH 9 -#define PWL_ICONTYPE_RIGHTARROW 10 -#define PWL_ICONTYPE_RIGHTPOINTER 11 -#define PWL_ICONTYPE_STAR 12 -#define PWL_ICONTYPE_UPARROW 13 -#define PWL_ICONTYPE_UPLEFTARROW 14 - -#define PWL_ICONTYPE_GRAPH 15 -#define PWL_ICONTYPE_PAPERCLIP 16 -#define PWL_ICONTYPE_ATTACHMENT 17 -#define PWL_ICONTYPE_TAG 18 - -#define PWL_ICONTYPE_FOXIT 19 - -#define PWL_ICONTYPE_UNKNOWN -1 - -//checkbox & radiobutton style -#define PCS_CHECK 0 -#define PCS_CIRCLE 1 -#define PCS_CROSS 2 -#define PCS_DIAMOND 3 -#define PCS_SQUARE 4 -#define PCS_STAR 5 - -#define PWL_PI 3.14159265358979f -#define PWL_BEZIER 0.5522847498308f - -//pushbutton layout style -#define PPBL_LABEL 0 -#define PPBL_ICON 1 -#define PPBL_ICONTOPLABELBOTTOM 2 -#define PPBL_LABELTOPICONBOTTOM 3 -#define PPBL_ICONLEFTLABELRIGHT 4 -#define PPBL_LABELLEFTICONRIGHT 5 -#define PPBL_LABELOVERICON 6 - -class CPWL_Point : public CPDF_Point -{ -public: - CPWL_Point() : CPDF_Point(0.0f,0.0f){} - CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx,fy) {} - CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {} +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)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high)) << 16))) +#define PWL_GETLOWWORD(dword) ((FX_WORD)(dword)) +#define PWL_GETHIGHWORD(dword) ((FX_WORD)(dword >> 16)) + +#define PWL_ICONTYPE_CHECKMARK 0 +#define PWL_ICONTYPE_CIRCLE 1 +#define PWL_ICONTYPE_COMMENT 2 +#define PWL_ICONTYPE_CROSS 3 +#define PWL_ICONTYPE_HELP 4 +#define PWL_ICONTYPE_INSERTTEXT 5 +#define PWL_ICONTYPE_KEY 6 +#define PWL_ICONTYPE_NEWPARAGRAPH 7 +#define PWL_ICONTYPE_TEXTNOTE 8 +#define PWL_ICONTYPE_PARAGRAPH 9 +#define PWL_ICONTYPE_RIGHTARROW 10 +#define PWL_ICONTYPE_RIGHTPOINTER 11 +#define PWL_ICONTYPE_STAR 12 +#define PWL_ICONTYPE_UPARROW 13 +#define PWL_ICONTYPE_UPLEFTARROW 14 + +#define PWL_ICONTYPE_GRAPH 15 +#define PWL_ICONTYPE_PAPERCLIP 16 +#define PWL_ICONTYPE_ATTACHMENT 17 +#define PWL_ICONTYPE_TAG 18 + +#define PWL_ICONTYPE_FOXIT 19 + +#define PWL_ICONTYPE_UNKNOWN -1 + +// checkbox & radiobutton style +#define PCS_CHECK 0 +#define PCS_CIRCLE 1 +#define PCS_CROSS 2 +#define PCS_DIAMOND 3 +#define PCS_SQUARE 4 +#define PCS_STAR 5 + +#define PWL_PI 3.14159265358979f +#define PWL_BEZIER 0.5522847498308f + +// pushbutton layout style +#define PPBL_LABEL 0 +#define PPBL_ICON 1 +#define PPBL_ICONTOPLABELBOTTOM 2 +#define PPBL_LABELTOPICONBOTTOM 3 +#define PPBL_ICONLEFTLABELRIGHT 4 +#define PPBL_LABELLEFTICONRIGHT 5 +#define PPBL_LABELOVERICON 6 + +class CPWL_Point : public CPDF_Point { + public: + CPWL_Point() : CPDF_Point(0.0f, 0.0f) {} + CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx, fy) {} + CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {} }; -enum PWL_PATHDATA_TYPE -{ - PWLPT_MOVETO, - PWLPT_LINETO, - PWLPT_BEZIERTO, - PWLPT_UNKNOWN +enum PWL_PATHDATA_TYPE { + PWLPT_MOVETO, + PWLPT_LINETO, + PWLPT_BEZIERTO, + PWLPT_UNKNOWN }; -enum PWL_PATH_TYPE -{ - PWLPT_PATHDATA, - PWLPT_STREAM -}; +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) {} +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; + CPWL_Point point; + PWL_PATHDATA_TYPE type; }; class IPWL_SpellCheck; -class CPWL_Utils -{ -public: - static CPDF_Rect InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize); - static CPDF_Rect DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize); - static FX_BOOL IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2); - static FX_BOOL ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild); - static CPDF_Rect ScaleRect(const CPDF_Rect& rcRect,FX_FLOAT fScale); - static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - static CPDF_Rect GetCenterSquare(const CPDF_Rect & rect); - static CPWL_Color SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub); - static CPWL_Color DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide); - static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2); - static CPDF_Rect OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y); - static CPDF_Point OffsetPoint(const CPDF_Point & point,FX_FLOAT x,FX_FLOAT y); - static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, 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 CPDF_Rect & 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 CPDF_Rect & 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 CPDF_Rect & rect,const CPWL_Color & color); - static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color); - - static CFX_ByteString GetPushButtonAppStream(const CPDF_Rect & rcBBox, - IFX_Edit_FontMap * pFontMap, - CPDF_Stream * pIconStream, - CPDF_IconFit & IconFit, - const CFX_WideString & sLabel, - const CPWL_Color & crText, - FX_FLOAT fFontSize, - int32_t nLayOut); - static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect & rcBBox, - int32_t nStyle, - const CPWL_Color & crText); - static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect & rcBBox, - int32_t nStyle, - const CPWL_Color & crText); - - static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL, - FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0); - static CFX_ByteString GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, - const CPVT_WordRange * pRange = NULL); - static CFX_ByteString GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck, - const CPDF_Point & ptOffset, - const CPVT_WordRange * pRange = NULL); - static CFX_ByteString GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap, - const CFX_WideString & sText, int32_t nAlignmentH, int32_t nAlignmentV, - FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText); - static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect & rcBBox); - - static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect, - const CPWL_Color & color, int32_t nTransparancy); - static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - const CPDF_Rect & rect,const FX_COLORREF & color); - static void DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect, - const FX_COLORREF & color, FX_FLOAT fWidth); - static void DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth); - static void DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - const CPDF_Rect & rect, FX_FLOAT fWidth, - const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom, - int32_t nStyle, const CPWL_Dash & dash, int32_t nTransparancy); - static void DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - const CPDF_Point* pPts, int32_t nCount, const FX_COLORREF& color); - static void DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect, - int32_t nTransparancy, int32_t nStartGray, int32_t nEndGray); - static void DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, - const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, - IPWL_SpellCheck* pSpellCheck); -public: - static void ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB); - static void ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK); - - static void ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray); - static void ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB); - - static void ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray); - static void ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK); - - static void PWLColorToARGB(const CPWL_Color& color, int32_t& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue); - -public: - static CFX_ByteString GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill, - const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR); - static void DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - int32_t nType, const CPDF_Rect & 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 CPDF_Rect & rcBBox, const CPWL_Color & crText); - static CFX_ByteString GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText); - static CFX_ByteString GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText); - static CFX_ByteString GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText); - static CFX_ByteString GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText); - static CFX_ByteString GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText); - - static CFX_ByteString GetAP_Check(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_Circle(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_Cross(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_Diamond(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_Square(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_Star(const CPDF_Rect & crBBox); - static CFX_ByteString GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate); - - static void GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); - static void GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type); +class CPWL_Utils { + public: + static CPDF_Rect InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize); + static CPDF_Rect DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize); + static FX_BOOL IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2); + static FX_BOOL ContainsRect(const CPDF_Rect& rcParent, + const CPDF_Rect& rcChild); + static CPDF_Rect ScaleRect(const CPDF_Rect& rcRect, FX_FLOAT fScale); + static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, + const CPVT_WordRange& wr2); + static CPDF_Rect GetCenterSquare(const CPDF_Rect& rect); + static CPWL_Color SubstractColor(const CPWL_Color& sColor, + FX_FLOAT fColorSub); + static CPWL_Color DevideColor(const CPWL_Color& sColor, + FX_FLOAT fColorDevide); + static CPDF_Rect MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2); + static CPDF_Rect OffsetRect(const CPDF_Rect& rect, FX_FLOAT x, FX_FLOAT y); + static CPDF_Point OffsetPoint(const CPDF_Point& point, + FX_FLOAT x, + FX_FLOAT y); + static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, + 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 CPDF_Rect& 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 CPDF_Rect& 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 CPDF_Rect& rect, + const CPWL_Color& color); + static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect& rect, + const CPWL_Color& color); + + static CFX_ByteString GetPushButtonAppStream(const CPDF_Rect& rcBBox, + IFX_Edit_FontMap* pFontMap, + CPDF_Stream* pIconStream, + CPDF_IconFit& IconFit, + const CFX_WideString& sLabel, + const CPWL_Color& crText, + FX_FLOAT fFontSize, + int32_t nLayOut); + static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect& rcBBox, + int32_t nStyle, + const CPWL_Color& crText); + static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect& rcBBox, + int32_t nStyle, + const CPWL_Color& crText); + + static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit, + const CPDF_Point& ptOffset, + const CPVT_WordRange* pRange = NULL, + FX_BOOL bContinuous = TRUE, + FX_WORD SubWord = 0); + static CFX_ByteString GetEditSelAppStream( + IFX_Edit* pEdit, + const CPDF_Point& ptOffset, + const CPVT_WordRange* pRange = NULL); + static CFX_ByteString GetSpellCheckAppStream( + IFX_Edit* pEdit, + IPWL_SpellCheck* pSpellCheck, + const CPDF_Point& ptOffset, + const CPVT_WordRange* pRange = NULL); + static CFX_ByteString GetTextAppStream(const CPDF_Rect& rcBBox, + IFX_Edit_FontMap* pFontMap, + const CFX_WideString& sText, + int32_t nAlignmentH, + int32_t nAlignmentV, + FX_FLOAT fFontSize, + FX_BOOL bMultiLine, + FX_BOOL bAutoReturn, + const CPWL_Color& crText); + static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect& rcBBox); + + static void DrawFillRect(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Rect& rect, + const CPWL_Color& color, + int32_t nTransparancy); + static void DrawFillRect(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Rect& rect, + const FX_COLORREF& color); + static void DrawStrokeRect(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Rect& rect, + const FX_COLORREF& color, + FX_FLOAT fWidth); + static void DrawStrokeLine(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Point& ptMoveTo, + const CPDF_Point& ptLineTo, + const FX_COLORREF& color, + FX_FLOAT fWidth); + static void DrawBorder(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Rect& rect, + FX_FLOAT fWidth, + const CPWL_Color& color, + const CPWL_Color& crLeftTop, + const CPWL_Color& crRightBottom, + int32_t nStyle, + const CPWL_Dash& dash, + int32_t nTransparancy); + static void DrawFillArea(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Point* pPts, + int32_t nCount, + const FX_COLORREF& color); + static void DrawShadow(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + FX_BOOL bVertical, + FX_BOOL bHorizontal, + CPDF_Rect rect, + int32_t nTransparancy, + int32_t nStartGray, + int32_t nEndGray); + static void DrawEditSpellCheck(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + IFX_Edit* pEdit, + const CPDF_Rect& rcClip, + const CPDF_Point& ptOffset, + const CPVT_WordRange* pRange, + IPWL_SpellCheck* pSpellCheck); + + public: + static void ConvertCMYK2RGB(FX_FLOAT dC, + FX_FLOAT dM, + FX_FLOAT dY, + FX_FLOAT dK, + FX_FLOAT& dR, + FX_FLOAT& dG, + FX_FLOAT& dB); + static void ConvertRGB2CMYK(FX_FLOAT dR, + FX_FLOAT dG, + FX_FLOAT dB, + FX_FLOAT& dC, + FX_FLOAT& dM, + FX_FLOAT& dY, + FX_FLOAT& dK); + + static void ConvertRGB2GRAY(FX_FLOAT dR, + FX_FLOAT dG, + FX_FLOAT dB, + FX_FLOAT& dGray); + static void ConvertGRAY2RGB(FX_FLOAT dGray, + FX_FLOAT& dR, + FX_FLOAT& dG, + FX_FLOAT& dB); + + static void ConvertCMYK2GRAY(FX_FLOAT dC, + FX_FLOAT dM, + FX_FLOAT dY, + FX_FLOAT dK, + FX_FLOAT& dGray); + static void ConvertGRAY2CMYK(FX_FLOAT dGray, + FX_FLOAT& dC, + FX_FLOAT& dM, + FX_FLOAT& dY, + FX_FLOAT& dK); + + static void PWLColorToARGB(const CPWL_Color& color, + int32_t& alpha, + FX_FLOAT& red, + FX_FLOAT& green, + FX_FLOAT& blue); + + public: + static CFX_ByteString GetIconAppStream( + int32_t nType, + const CPDF_Rect& rect, + const CPWL_Color& crFill, + const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR); + static void DrawIconAppStream(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + int32_t nType, + const CPDF_Rect& 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 CPDF_Rect& rcBBox, + const CPWL_Color& crText); + static CFX_ByteString GetAppStream_Circle(const CPDF_Rect& rcBBox, + const CPWL_Color& crText); + static CFX_ByteString GetAppStream_Cross(const CPDF_Rect& rcBBox, + const CPWL_Color& crText); + static CFX_ByteString GetAppStream_Diamond(const CPDF_Rect& rcBBox, + const CPWL_Color& crText); + static CFX_ByteString GetAppStream_Square(const CPDF_Rect& rcBBox, + const CPWL_Color& crText); + static CFX_ByteString GetAppStream_Star(const CPDF_Rect& rcBBox, + const CPWL_Color& crText); + + static CFX_ByteString GetAP_Check(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_Circle(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_Cross(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_Diamond(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_Square(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_Star(const CPDF_Rect& crBBox); + static CFX_ByteString GetAP_HalfCircle(const CPDF_Rect& crBBox, + FX_FLOAT fRotate); + + static void GetGraphics_Checkmark(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Circle(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Comment(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Cross(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Help(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_InsertText(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Key(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_NewParagraph(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_TextNote(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Paragraph(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_RightArrow(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_RightPointer(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Star(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_UpArrow(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Graph(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Paperclip(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Attachment(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Tag(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); + static void GetGraphics_Foxit(CFX_ByteString& sPathData, + CFX_PathData& path, + const CPDF_Rect& crBBox, + const PWL_PATH_TYPE type); }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_UTILS_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index f2b996c747..63fd28b6d1 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -21,443 +21,454 @@ 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; +// 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; +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 FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2) -{ - return c1.nColorType == c2.nColorType && - c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 && - c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 && - c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 && - c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001; +inline FX_BOOL operator==(const CPWL_Color& c1, const CPWL_Color& c2) { + return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 && + c1.fColor1 - c2.fColor1 > -0.0001 && + c1.fColor2 - c2.fColor2 < 0.0001 && + c1.fColor2 - c2.fColor2 > -0.0001 && + c1.fColor3 - c2.fColor3 < 0.0001 && + c1.fColor3 - c2.fColor3 > -0.0001 && + c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001; } -inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2) -{ - return !operator == (c1, c2); +inline FX_BOOL operator!=(const CPWL_Color& c1, const CPWL_Color& c2) { + return !operator==(c1, c2); } -#define PWL_SCROLLBAR_WIDTH 12.0f -#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f -#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f -#define PWL_SCROLLBAR_TRANSPARANCY 150 -#define PWL_SCROLLBAR_BKCOLOR CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f) -#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB,1,1,1) -#define PWL_DEFAULT_SELBACKCOLOR CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f) -#define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR -#define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB,0,0,0) -#define PWL_DEFAULT_FONTSIZE 9.0f -#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY,0) -#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY,1) -#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.50) -#define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.75) -#define PWL_TRIANGLE_HALFLEN 2.0f -#define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f -#define PWL_INVALIDATE_INFLATE 2 - -class IPWL_SpellCheck -{ -public: - virtual ~IPWL_SpellCheck() { } - virtual FX_BOOL CheckWord(const FX_CHAR* sWord) = 0; - virtual void SuggestWords(const FX_CHAR* sWord, CFX_ByteStringArray & sSuggest) = 0; +#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, + CFX_ByteStringArray& sSuggest) = 0; }; -class IPWL_Provider -{ -public: - virtual ~IPWL_Provider() { } - - //get a matrix which map user space to CWnd client space - virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0; - - /* - 0 L"&Undo\tCtrl+Z" - 1 L"&Redo\tCtrl+Shift+Z" - 2 L"Cu&t\tCtrl+X" - 3 L"&Copy\tCtrl+C" - 4 L"&Paste\tCtrl+V" - 5 L"&Delete" - 6 L"&Select All\tCtrl+A" - */ - virtual CFX_WideString LoadPopupMenuString(int32_t nIndex) = 0; +class IPWL_Provider { + public: + virtual ~IPWL_Provider() {} + + // get a matrix which map user space to CWnd client space + virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0; + + /* + 0 L"&Undo\tCtrl+Z" + 1 L"&Redo\tCtrl+Shift+Z" + 2 L"Cu&t\tCtrl+X" + 3 L"&Copy\tCtrl+C" + 4 L"&Paste\tCtrl+V" + 5 L"&Delete" + 6 L"&Select All\tCtrl+A" + */ + virtual CFX_WideString LoadPopupMenuString(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; +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) - { - } - - CPDF_Rect rcRectWnd; //required - IFX_SystemHandler* pSystemHandler; //required - IFX_Edit_FontMap* pFontMap; //required for text window - IPWL_Provider* pProvider; //required for self coordinate - IPWL_FocusHandler* pFocusHandler; //optional - FX_DWORD dwFlags; //optional - CPWL_Color sBackgroundColor; //optional - FX_HWND hAttachedWnd; //required for no-reader framework - IPWL_SpellCheck* pSpellCheck; //required for spellchecking - 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 - CPDF_Matrix mtChild; //ignore +struct PWL_CREATEPARAM { + public: + PWL_CREATEPARAM() + : rcRectWnd(0, 0, 0, 0), + pSystemHandler(NULL), + pFontMap(NULL), + pProvider(NULL), + pFocusHandler(NULL), + dwFlags(0), + sBackgroundColor(), + hAttachedWnd(NULL), + pSpellCheck(NULL), + nBorderStyle(PBS_SOLID), + dwBorderWidth(1), + sBorderColor(), + sTextColor(), + sTextStrokeColor(), + nTransparency(255), + fFontSize(PWL_DEFAULT_FONTSIZE), + sDash(3, 0, 0), + pAttachedData(NULL), + pParentWnd(NULL), + pMsgControl(NULL), + eCursorType(FXCT_ARROW), + mtChild(1, 0, 0, 1, 0, 0) {} + + CPDF_Rect rcRectWnd; // required + IFX_SystemHandler* pSystemHandler; // required + IFX_Edit_FontMap* pFontMap; // required for text window + IPWL_Provider* pProvider; // required for self coordinate + IPWL_FocusHandler* pFocusHandler; // optional + FX_DWORD dwFlags; // optional + CPWL_Color sBackgroundColor; // optional + FX_HWND hAttachedWnd; // required for no-reader framework + IPWL_SpellCheck* pSpellCheck; // required for spellchecking + 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 + CPDF_Matrix mtChild; // ignore }; -class CPWL_Timer -{ -public: - CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler); - virtual ~CPWL_Timer(); +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); + 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; + private: + int32_t m_nTimerID; + CPWL_TimerHandler* m_pAttached; + IFX_SystemHandler* m_pSystemHandler; }; -class CPWL_TimerHandler -{ -public: - CPWL_TimerHandler(); - virtual ~CPWL_TimerHandler(); +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; + void BeginTimer(int32_t nElapse); + void EndTimer(); + virtual void TimerProc(); + virtual IFX_SystemHandler* GetSystemHandler() const = 0; -private: - CPWL_Timer* m_pTimer; + private: + CPWL_Timer* m_pTimer; }; -class CPWL_Wnd : public CPWL_TimerHandler -{ - friend class CPWL_MsgControl; -public: - CPWL_Wnd(); - virtual ~CPWL_Wnd(); - - void Create(const PWL_CREATEPARAM & cp); - virtual CFX_ByteString GetClassName() const; - void Destroy(); - void Move(const CPDF_Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh); - virtual void InvalidateRect(CPDF_Rect* pRect = NULL); - - void GetAppearanceStream(CFX_ByteString & sAppStream); - void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnRButtonDown(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - - virtual void SetFocus(); - virtual void KillFocus(); - void SetCapture(); - void ReleaseCapture(); - - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, 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 CPDF_Rect GetFocusRect() const; - virtual CPWL_Color GetBackgroundColor() const; - virtual CPWL_Color GetBorderColor() const; - virtual CPWL_Color GetTextColor() const; - virtual CPWL_Color GetTextStrokeColor() const; - virtual FX_FLOAT GetFontSize() const; - virtual int32_t GetInnerBorderWidth() const; - virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const; - virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const; - - virtual FX_BOOL IsModified() const {return FALSE;} - - virtual void SetFontSize(FX_FLOAT fFontSize); - - void SetBackgroundColor(const CPWL_Color & color); - void SetBorderColor(const CPWL_Color & color); - void SetBorderWidth(int32_t nBorderWidth); - void SetClipRect(const CPDF_Rect & rect); - void SetBorderStyle(int32_t eBorderStyle); - void SetBorderDash(const CPWL_Dash & sDash); - - CPDF_Rect GetOriginWindowRect() const; - virtual CPDF_Rect GetWindowRect() const; - virtual CPDF_Rect GetClientRect() const; - CPDF_Point GetCenterPoint() const; - CPDF_Rect GetClientCenterSquare() const; - CPDF_Rect GetWindowCenterSquare() const; - 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); - CPDF_Rect GetClipRect() const; - CPWL_Wnd* GetParentWindow() const; - int32_t GetBorderStyle() const; - CPWL_Dash GetBorderDash() const; - void* GetAttachedData() const; - - FX_BOOL WndHitTest(const CPDF_Point & point) const; - FX_BOOL ClientHitTest(const CPDF_Point & point) const; - FX_BOOL IsCaptureMouse() const; - - const CPWL_Wnd* GetFocused() const; - FX_BOOL IsFocused() const; - FX_BOOL IsReadOnly() const; - CPWL_ScrollBar* GetVScrollBar() const; - - IFX_Edit_FontMap* GetFontMap() const; - IPWL_Provider* GetProvider() const; - virtual IFX_SystemHandler* GetSystemHandler() const; - IPWL_FocusHandler* GetFocusHandler() const; - - int32_t GetTransparency(); - void SetTransparency(int32_t nTransparency); - - CPDF_Matrix GetChildToRoot() const; - CPDF_Matrix GetChildMatrix() const; - void SetChildMatrix(const CPDF_Matrix& mt); - CPDF_Matrix GetWindowMatrix() const; - - virtual CPDF_Point ChildToParent(const CPDF_Point& point) const; - virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const; - virtual CPDF_Point ParentToChild(const CPDF_Point& point) const; - virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const; - - //those methods only implemented by listctrl item - virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) {return 0;} - virtual FX_FLOAT GetItemLeftMargin() {return 0;} - virtual FX_FLOAT GetItemRightMargin() {return 0;} - - void EnableWindow(FX_BOOL bEnable); - FX_BOOL IsEnabled(); - virtual void SetCursor(); - -protected: - virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void RePosChildWnd(); - void GetAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream); - virtual void GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream); - - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); - - virtual void OnCreate(PWL_CREATEPARAM & cp); - virtual void OnCreated(); - virtual void OnDestroy(); - - virtual void OnSetFocus(); - virtual void OnKillFocus(); - - virtual void OnEnabled(); - virtual void OnDisabled(); - - void SetNotifyFlag(FX_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;}; - - FX_BOOL IsValid() const; - PWL_CREATEPARAM GetCreationParam() const; - FX_BOOL IsNotifying() const {return m_bNotifying;} - - void InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew); - - void PWLtoWnd(const CPDF_Point & point, int32_t& x, int32_t& y) const; - FX_RECT PWLtoWnd(const CPDF_Rect & rect) const; - FX_HWND GetAttachedHWnd() const; - - FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const; - FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const; - const CPWL_Wnd* GetRootWnd() const; - - FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const; - FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const; - FX_BOOL IsALTpressed(FX_DWORD nFlag) const; - FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const; - -private: - void AddChild(CPWL_Wnd * pWnd); - void RemoveChild(CPWL_Wnd * pWnd); - - void CreateScrollBar(const PWL_CREATEPARAM & cp); - void CreateVScrollBar(const PWL_CREATEPARAM & cp); - - void AjustStyle(); - void CreateMsgControl(); - void DestroyMsgControl(); - - CPWL_MsgControl* GetMsgControl() const; - -protected: - CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren; +class CPWL_Wnd : public CPWL_TimerHandler { + friend class CPWL_MsgControl; + + public: + CPWL_Wnd(); + virtual ~CPWL_Wnd(); + + void Create(const PWL_CREATEPARAM& cp); + virtual CFX_ByteString GetClassName() const; + void Destroy(); + void Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh); + virtual void InvalidateRect(CPDF_Rect* pRect = NULL); + + void GetAppearanceStream(CFX_ByteString& sAppStream); + void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); + + virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); + virtual FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag); + + virtual void SetFocus(); + virtual void KillFocus(); + void SetCapture(); + void ReleaseCapture(); + + virtual void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + 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 CPDF_Rect GetFocusRect() const; + virtual CPWL_Color GetBackgroundColor() const; + virtual CPWL_Color GetBorderColor() const; + virtual CPWL_Color GetTextColor() const; + virtual CPWL_Color GetTextStrokeColor() const; + virtual FX_FLOAT GetFontSize() const; + virtual int32_t GetInnerBorderWidth() const; + virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const; + virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const; + + virtual FX_BOOL IsModified() const { return FALSE; } + + virtual void SetFontSize(FX_FLOAT fFontSize); + + void SetBackgroundColor(const CPWL_Color& color); + void SetBorderColor(const CPWL_Color& color); + void SetBorderWidth(int32_t nBorderWidth); + void SetClipRect(const CPDF_Rect& rect); + void SetBorderStyle(int32_t eBorderStyle); + void SetBorderDash(const CPWL_Dash& sDash); + + CPDF_Rect GetOriginWindowRect() const; + virtual CPDF_Rect GetWindowRect() const; + virtual CPDF_Rect GetClientRect() const; + CPDF_Point GetCenterPoint() const; + CPDF_Rect GetClientCenterSquare() const; + CPDF_Rect GetWindowCenterSquare() const; + 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); + CPDF_Rect GetClipRect() const; + CPWL_Wnd* GetParentWindow() const; + int32_t GetBorderStyle() const; + CPWL_Dash GetBorderDash() const; + void* GetAttachedData() const; + + FX_BOOL WndHitTest(const CPDF_Point& point) const; + FX_BOOL ClientHitTest(const CPDF_Point& point) const; + FX_BOOL IsCaptureMouse() const; + + const CPWL_Wnd* GetFocused() const; + FX_BOOL IsFocused() const; + FX_BOOL IsReadOnly() const; + CPWL_ScrollBar* GetVScrollBar() const; + + IFX_Edit_FontMap* GetFontMap() const; + IPWL_Provider* GetProvider() const; + virtual IFX_SystemHandler* GetSystemHandler() const; + IPWL_FocusHandler* GetFocusHandler() const; + + int32_t GetTransparency(); + void SetTransparency(int32_t nTransparency); + + CPDF_Matrix GetChildToRoot() const; + CPDF_Matrix GetChildMatrix() const; + void SetChildMatrix(const CPDF_Matrix& mt); + CPDF_Matrix GetWindowMatrix() const; + + virtual CPDF_Point ChildToParent(const CPDF_Point& point) const; + virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const; + virtual CPDF_Point ParentToChild(const CPDF_Point& point) const; + virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const; + + // those methods only implemented by listctrl item + virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) { return 0; } + virtual FX_FLOAT GetItemLeftMargin() { return 0; } + virtual FX_FLOAT GetItemRightMargin() { return 0; } + + void EnableWindow(FX_BOOL bEnable); + FX_BOOL IsEnabled(); + virtual void SetCursor(); + + protected: + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void RePosChildWnd(); + void GetAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); + virtual void GetChildAppearanceStream(CFX_ByteTextBuf& sAppStream); + + virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device); + + virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual void OnCreated(); + virtual void OnDestroy(); + + virtual void OnSetFocus(); + virtual void OnKillFocus(); + + virtual void OnEnabled(); + virtual void OnDisabled(); + + void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; }; + + FX_BOOL IsValid() const; + PWL_CREATEPARAM GetCreationParam() const; + FX_BOOL IsNotifying() const { return m_bNotifying; } + + void InvalidateRectMove(const CPDF_Rect& rcOld, const CPDF_Rect& rcNew); + + void PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const; + FX_RECT PWLtoWnd(const CPDF_Rect& rect) const; + FX_HWND GetAttachedHWnd() const; + + FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; + FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; + const CPWL_Wnd* GetRootWnd() const; + + FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const; + FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const; + FX_BOOL IsALTpressed(FX_DWORD nFlag) const; + FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const; + + private: + void AddChild(CPWL_Wnd* pWnd); + void RemoveChild(CPWL_Wnd* pWnd); + + void CreateScrollBar(const PWL_CREATEPARAM& cp); + void CreateVScrollBar(const PWL_CREATEPARAM& cp); + + void AjustStyle(); + void CreateMsgControl(); + void DestroyMsgControl(); + + CPWL_MsgControl* GetMsgControl() const; + + protected: + CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren; -private: - PWL_CREATEPARAM m_sPrivateParam; + private: + PWL_CREATEPARAM m_sPrivateParam; - CPWL_ScrollBar* m_pVScrollBar; + CPWL_ScrollBar* m_pVScrollBar; - CPDF_Rect m_rcWindow; - CPDF_Rect m_rcClip; + CPDF_Rect m_rcWindow; + CPDF_Rect m_rcClip; - FX_BOOL m_bCreated; - FX_BOOL m_bVisible; - FX_BOOL m_bNotifying; - FX_BOOL m_bEnabled; + FX_BOOL m_bCreated; + FX_BOOL m_bVisible; + FX_BOOL m_bNotifying; + FX_BOOL m_bEnabled; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ |