| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_PDFWINDOW_PWL_EDIT_H_ | 7 #ifndef FPDFSDK_PDFWINDOW_PWL_EDIT_H_ |
| 8 #define FPDFSDK_PDFWINDOW_PWL_EDIT_H_ | 8 #define FPDFSDK_PDFWINDOW_PWL_EDIT_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_basic.h" | 10 #include "core/fxcrt/fx_basic.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 void* pPrivateData, | 23 void* pPrivateData, |
| 24 FX_FLOAT fPopupMin, | 24 FX_FLOAT fPopupMin, |
| 25 FX_FLOAT fPopupMax, | 25 FX_FLOAT fPopupMax, |
| 26 int32_t& nRet, | 26 int32_t& nRet, |
| 27 FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) | 27 FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) |
| 28 virtual void OnBeforeKeyStroke(void* pPrivateData, | 28 virtual void OnBeforeKeyStroke(void* pPrivateData, |
| 29 CFX_WideString& strChange, | 29 CFX_WideString& strChange, |
| 30 const CFX_WideString& strChangeEx, | 30 const CFX_WideString& strChangeEx, |
| 31 int nSelStart, | 31 int nSelStart, |
| 32 int nSelEnd, | 32 int nSelEnd, |
| 33 FX_BOOL bKeyDown, | 33 bool bKeyDown, |
| 34 FX_BOOL& bRC, | 34 bool& bRC, |
| 35 FX_BOOL& bExit, | 35 bool& bExit, |
| 36 uint32_t nFlag) = 0; | 36 uint32_t nFlag) = 0; |
| 37 #ifdef PDF_ENABLE_XFA | 37 #ifdef PDF_ENABLE_XFA |
| 38 virtual void OnPopupPreOpen(void* pPrivateData, | 38 virtual void OnPopupPreOpen(void* pPrivateData, |
| 39 FX_BOOL& bExit, | 39 bool& bExit, |
| 40 uint32_t nFlag) = 0; | 40 uint32_t nFlag) = 0; |
| 41 virtual void OnPopupPostOpen(void* pPrivateData, | 41 virtual void OnPopupPostOpen(void* pPrivateData, |
| 42 FX_BOOL& bExit, | 42 bool& bExit, |
| 43 uint32_t nFlag) = 0; | 43 uint32_t nFlag) = 0; |
| 44 #endif // PDF_ENABLE_XFA | 44 #endif // PDF_ENABLE_XFA |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class CPWL_Edit : public CPWL_EditCtrl { | 47 class CPWL_Edit : public CPWL_EditCtrl { |
| 48 public: | 48 public: |
| 49 CPWL_Edit(); | 49 CPWL_Edit(); |
| 50 ~CPWL_Edit() override; | 50 ~CPWL_Edit() override; |
| 51 | 51 |
| 52 // CPWL_EditCtrl | 52 // CPWL_EditCtrl |
| 53 CFX_ByteString GetClassName() const override; | 53 CFX_ByteString GetClassName() const override; |
| 54 void OnDestroy() override; | 54 void OnDestroy() override; |
| 55 void OnCreated() override; | 55 void OnCreated() override; |
| 56 void RePosChildWnd() override; | 56 void RePosChildWnd() override; |
| 57 CFX_FloatRect GetClientRect() const override; | 57 CFX_FloatRect GetClientRect() const override; |
| 58 void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; | 58 void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; |
| 59 void DrawThisAppearance(CFX_RenderDevice* pDevice, | 59 void DrawThisAppearance(CFX_RenderDevice* pDevice, |
| 60 CFX_Matrix* pUser2Device) override; | 60 CFX_Matrix* pUser2Device) override; |
| 61 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | 61 bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; |
| 62 FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; | 62 bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; |
| 63 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | 63 bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; |
| 64 FX_BOOL OnMouseWheel(short zDelta, | 64 bool OnMouseWheel(short zDelta, |
| 65 const CFX_FloatPoint& point, | 65 const CFX_FloatPoint& point, |
| 66 uint32_t nFlag) override; | 66 uint32_t nFlag) override; |
| 67 FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; | 67 bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; |
| 68 FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; | 68 bool OnChar(uint16_t nChar, uint32_t nFlag) override; |
| 69 CFX_FloatRect GetFocusRect() const override; | 69 CFX_FloatRect GetFocusRect() const override; |
| 70 void OnSetFocus() override; | 70 void OnSetFocus() override; |
| 71 void OnKillFocus() override; | 71 void OnKillFocus() override; |
| 72 | 72 |
| 73 void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, | 73 void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, |
| 74 FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center | 74 bool bPaint = true); // 0:top 1:bottom 2:center |
| 75 | 75 |
| 76 void SetCharArray(int32_t nCharArray); | 76 void SetCharArray(int32_t nCharArray); |
| 77 void SetLimitChar(int32_t nLimitChar); | 77 void SetLimitChar(int32_t nLimitChar); |
| 78 | 78 |
| 79 void SetCharSpace(FX_FLOAT fCharSpace); | 79 void SetCharSpace(FX_FLOAT fCharSpace); |
| 80 | 80 |
| 81 FX_BOOL CanSelectAll() const; | 81 bool CanSelectAll() const; |
| 82 FX_BOOL CanClear() const; | 82 bool CanClear() const; |
| 83 FX_BOOL CanCopy() const; | 83 bool CanCopy() const; |
| 84 FX_BOOL CanCut() const; | 84 bool CanCut() const; |
| 85 | 85 |
| 86 void CutText(); | 86 void CutText(); |
| 87 | 87 |
| 88 void SetText(const CFX_WideString& csText); | 88 void SetText(const CFX_WideString& csText); |
| 89 void ReplaceSel(const CFX_WideString& csText); | 89 void ReplaceSel(const CFX_WideString& csText); |
| 90 | 90 |
| 91 CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; | 91 CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; |
| 92 CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; | 92 CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; |
| 93 CFX_ByteString GetSelectAppearanceStream( | 93 CFX_ByteString GetSelectAppearanceStream( |
| 94 const CFX_FloatPoint& ptOffset) const; | 94 const CFX_FloatPoint& ptOffset) const; |
| 95 | 95 |
| 96 FX_BOOL IsTextFull() const; | 96 bool IsTextFull() const; |
| 97 | 97 |
| 98 static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, | 98 static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, |
| 99 const CFX_FloatRect& rcPlate, | 99 const CFX_FloatRect& rcPlate, |
| 100 int32_t nCharArray); | 100 int32_t nCharArray); |
| 101 | 101 |
| 102 void SetFillerNotify(IPWL_Filler_Notify* pNotify) { | 102 void SetFillerNotify(IPWL_Filler_Notify* pNotify) { |
| 103 m_pFillerNotify = pNotify; | 103 m_pFillerNotify = pNotify; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 106 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 107 const CFX_FloatPoint& ptOffset, | 107 const CFX_FloatPoint& ptOffset, |
| 108 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 108 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 109 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 109 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 110 const CFX_FloatPoint& ptOffset); | 110 const CFX_FloatPoint& ptOffset); |
| 111 | 111 |
| 112 FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); | 112 bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); |
| 113 void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } | 113 void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } |
| 114 | 114 |
| 115 void OnInsertWord(const CPVT_WordPlace& place, | 115 void OnInsertWord(const CPVT_WordPlace& place, |
| 116 const CPVT_WordPlace& oldplace); | 116 const CPVT_WordPlace& oldplace); |
| 117 void OnInsertReturn(const CPVT_WordPlace& place, | 117 void OnInsertReturn(const CPVT_WordPlace& place, |
| 118 const CPVT_WordPlace& oldplace); | 118 const CPVT_WordPlace& oldplace); |
| 119 void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); | 119 void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
| 120 void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); | 120 void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
| 121 void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); | 121 void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
| 122 void OnInsertText(const CPVT_WordPlace& place, | 122 void OnInsertText(const CPVT_WordPlace& place, |
| 123 const CPVT_WordPlace& oldplace); | 123 const CPVT_WordPlace& oldplace); |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 CPVT_WordRange GetSelectWordRange() const; | 126 CPVT_WordRange GetSelectWordRange() const; |
| 127 virtual void ShowVScrollBar(FX_BOOL bShow); | 127 virtual void ShowVScrollBar(bool bShow); |
| 128 FX_BOOL IsVScrollBarVisible() const; | 128 bool IsVScrollBarVisible() const; |
| 129 void SetParamByFlag(); | 129 void SetParamByFlag(); |
| 130 | 130 |
| 131 FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); | 131 FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); |
| 132 CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); | 132 CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); |
| 133 | 133 |
| 134 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, | 134 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, |
| 135 const CPVT_WordRange& wr2); | 135 const CPVT_WordRange& wr2); |
| 136 CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; | 136 CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; |
| 137 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; | 137 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; |
| 138 CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; | 138 CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; |
| 139 CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, | 139 CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, |
| 140 FX_BOOL bLatin, | 140 bool bLatin, |
| 141 FX_BOOL bArabic) const; | 141 bool bArabic) const; |
| 142 IPWL_Filler_Notify* m_pFillerNotify; | 142 IPWL_Filler_Notify* m_pFillerNotify; |
| 143 FX_BOOL m_bFocus; | 143 bool m_bFocus; |
| 144 CFX_FloatRect m_rcOldWindow; | 144 CFX_FloatRect m_rcOldWindow; |
| 145 CFFL_FormFiller* m_pFormFiller; // Not owned. | 145 CFFL_FormFiller* m_pFormFiller; // Not owned. |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 #endif // FPDFSDK_PDFWINDOW_PWL_EDIT_H_ | 148 #endif // FPDFSDK_PDFWINDOW_PWL_EDIT_H_ |
| OLD | NEW |