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/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
11 #include "fpdfsdk/fxedit/include/fx_edit.h" | 11 #include "fpdfsdk/fxedit/include/fx_edit.h" |
12 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 12 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
14 | 14 |
| 15 class CPDF_PageObjectHolder; |
| 16 class CPDF_TextObject; |
| 17 class IFX_Edit_UndoItem; |
| 18 |
15 class IPWL_Filler_Notify { | 19 class IPWL_Filler_Notify { |
16 public: | 20 public: |
17 virtual ~IPWL_Filler_Notify() {} | 21 virtual ~IPWL_Filler_Notify() {} |
18 virtual void QueryWherePopup( | 22 virtual void QueryWherePopup( |
19 void* pPrivateData, | 23 void* pPrivateData, |
20 FX_FLOAT fPopupMin, | 24 FX_FLOAT fPopupMin, |
21 FX_FLOAT fPopupMax, | 25 FX_FLOAT fPopupMax, |
22 int32_t& nRet, | 26 int32_t& nRet, |
23 FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) | 27 FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) |
24 virtual void OnBeforeKeyStroke(void* pPrivateData, | 28 virtual void OnBeforeKeyStroke(void* pPrivateData, |
25 CFX_WideString& strChange, | 29 CFX_WideString& strChange, |
26 const CFX_WideString& strChangeEx, | 30 const CFX_WideString& strChangeEx, |
27 int nSelStart, | 31 int nSelStart, |
28 int nSelEnd, | 32 int nSelEnd, |
29 FX_BOOL bKeyDown, | 33 FX_BOOL bKeyDown, |
30 FX_BOOL& bRC, | 34 FX_BOOL& bRC, |
31 FX_BOOL& bExit, | 35 FX_BOOL& bExit, |
32 uint32_t nFlag) = 0; | 36 uint32_t nFlag) = 0; |
33 #ifdef PDF_ENABLE_XFA | 37 #ifdef PDF_ENABLE_XFA |
34 virtual void OnPopupPreOpen(void* pPrivateData, | 38 virtual void OnPopupPreOpen(void* pPrivateData, |
35 FX_BOOL& bExit, | 39 FX_BOOL& bExit, |
36 uint32_t nFlag) = 0; | 40 uint32_t nFlag) = 0; |
37 virtual void OnPopupPostOpen(void* pPrivateData, | 41 virtual void OnPopupPostOpen(void* pPrivateData, |
38 FX_BOOL& bExit, | 42 FX_BOOL& bExit, |
39 uint32_t nFlag) = 0; | 43 uint32_t nFlag) = 0; |
40 #endif // PDF_ENABLE_XFA | 44 #endif // PDF_ENABLE_XFA |
41 }; | 45 }; |
42 | 46 |
43 class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { | 47 class CPWL_Edit : public CPWL_EditCtrl { |
44 public: | 48 public: |
45 CPWL_Edit(); | 49 CPWL_Edit(); |
46 ~CPWL_Edit() override; | 50 ~CPWL_Edit() override; |
47 | 51 |
48 // CPWL_EditCtrl | 52 // CPWL_EditCtrl |
49 CFX_ByteString GetClassName() const override; | 53 CFX_ByteString GetClassName() const override; |
50 void OnDestroy() override; | 54 void OnDestroy() override; |
51 void OnCreated() override; | 55 void OnCreated() override; |
52 void RePosChildWnd() override; | 56 void RePosChildWnd() override; |
53 CFX_FloatRect GetClientRect() const override; | 57 CFX_FloatRect GetClientRect() const override; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 110 |
107 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 111 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
108 const CFX_FloatPoint& ptOffset, | 112 const CFX_FloatPoint& ptOffset, |
109 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 113 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
110 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 114 void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
111 const CFX_FloatPoint& ptOffset); | 115 const CFX_FloatPoint& ptOffset); |
112 | 116 |
113 FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); | 117 FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); |
114 void AttachFFLData(void* pData) { m_pFormFiller = pData; } | 118 void AttachFFLData(void* pData) { m_pFormFiller = pData; } |
115 | 119 |
116 protected: | |
117 // IFX_Edit_OprNotify | |
118 void OnInsertWord(const CPVT_WordPlace& place, | 120 void OnInsertWord(const CPVT_WordPlace& place, |
119 const CPVT_WordPlace& oldplace) override; | 121 const CPVT_WordPlace& oldplace); |
120 void OnInsertReturn(const CPVT_WordPlace& place, | 122 void OnInsertReturn(const CPVT_WordPlace& place, |
121 const CPVT_WordPlace& oldplace) override; | 123 const CPVT_WordPlace& oldplace); |
122 void OnBackSpace(const CPVT_WordPlace& place, | 124 void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
123 const CPVT_WordPlace& oldplace) override; | 125 void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
124 void OnDelete(const CPVT_WordPlace& place, | 126 void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); |
125 const CPVT_WordPlace& oldplace) override; | |
126 void OnClear(const CPVT_WordPlace& place, | |
127 const CPVT_WordPlace& oldplace) override; | |
128 void OnSetText(const CPVT_WordPlace& place, | |
129 const CPVT_WordPlace& oldplace) override; | |
130 void OnInsertText(const CPVT_WordPlace& place, | 127 void OnInsertText(const CPVT_WordPlace& place, |
131 const CPVT_WordPlace& oldplace) override; | 128 const CPVT_WordPlace& oldplace); |
132 void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) override; | 129 void OnAddUndo(IFX_Edit_UndoItem* pUndoItem); |
133 | 130 |
134 private: | 131 private: |
135 CPVT_WordRange GetSelectWordRange() const; | 132 CPVT_WordRange GetSelectWordRange() const; |
136 virtual void ShowVScrollBar(FX_BOOL bShow); | 133 virtual void ShowVScrollBar(FX_BOOL bShow); |
137 FX_BOOL IsVScrollBarVisible() const; | 134 FX_BOOL IsVScrollBarVisible() const; |
138 void SetParamByFlag(); | 135 void SetParamByFlag(); |
139 | 136 |
140 FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); | 137 FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); |
141 CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); | 138 CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); |
142 | 139 |
143 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, | 140 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, |
144 const CPVT_WordRange& wr2); | 141 const CPVT_WordRange& wr2); |
145 CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; | 142 CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; |
146 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; | 143 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; |
147 CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; | 144 CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; |
148 CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, | 145 CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, |
149 FX_BOOL bLatin, | 146 FX_BOOL bLatin, |
150 FX_BOOL bArabic) const; | 147 FX_BOOL bArabic) const; |
151 IPWL_Filler_Notify* m_pFillerNotify; | 148 IPWL_Filler_Notify* m_pFillerNotify; |
152 FX_BOOL m_bFocus; | 149 FX_BOOL m_bFocus; |
153 CFX_FloatRect m_rcOldWindow; | 150 CFX_FloatRect m_rcOldWindow; |
154 void* m_pFormFiller; | 151 void* m_pFormFiller; |
155 }; | 152 }; |
156 | 153 |
157 #endif // FPDFSDK_PDFWINDOW_PWL_EDIT_H_ | 154 #endif // FPDFSDK_PDFWINDOW_PWL_EDIT_H_ |
OLD | NEW |