Chromium Code Reviews| 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 XFA_FWL_CORE_CFWL_EDIT_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_EDIT_H_ |
| 8 #define XFA_FWL_CORE_CFWL_EDIT_H_ | 8 #define XFA_FWL_CORE_CFWL_EDIT_H_ |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; | 72 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; |
| 73 void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 73 void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
| 74 void OnProcessMessage(CFWL_Message* pMessage) override; | 74 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 75 void OnProcessEvent(CFWL_Event* pEvent) override; | 75 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 76 void OnDrawWidget(CFX_Graphics* pGraphics, | 76 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 77 const CFX_Matrix* pMatrix) override; | 77 const CFX_Matrix* pMatrix) override; |
| 78 | 78 |
| 79 virtual void SetText(const CFX_WideString& wsText); | 79 virtual void SetText(const CFX_WideString& wsText); |
| 80 | 80 |
| 81 int32_t GetTextLength() const; | 81 int32_t GetTextLength() const; |
| 82 CFX_WideString GetText(int32_t nStart = 0, int32_t nCount = -1) const; | 82 CFX_WideString GetText() const; |
| 83 void ClearText(); | 83 void ClearText(); |
| 84 | 84 |
| 85 void AddSelRange(int32_t nStart, int32_t nCount = -1); | 85 void AddSelRange(int32_t nStart); |
| 86 int32_t CountSelRanges() const; | 86 int32_t CountSelRanges() const; |
| 87 int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const; | 87 int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const; |
| 88 void ClearSelections(); | 88 void ClearSelections(); |
| 89 int32_t GetLimit() const; | 89 int32_t GetLimit() const; |
| 90 void SetLimit(int32_t nLimit); | 90 void SetLimit(int32_t nLimit); |
| 91 void SetAliasChar(FX_WCHAR wAlias); | 91 void SetAliasChar(FX_WCHAR wAlias); |
| 92 bool Copy(CFX_WideString& wsCopy); | 92 bool Copy(CFX_WideString& wsCopy); |
| 93 bool Cut(CFX_WideString& wsCut); | 93 bool Cut(CFX_WideString& wsCut); |
| 94 bool Paste(const CFX_WideString& wsPaste); | 94 bool Paste(const CFX_WideString& wsPaste); |
| 95 bool Redo(const IFDE_TxtEdtDoRecord* pRecord); | 95 bool Redo(const IFDE_TxtEdtDoRecord* pRecord); |
| 96 bool Undo(const IFDE_TxtEdtDoRecord* pRecord); | 96 bool Undo(const IFDE_TxtEdtDoRecord* pRecord); |
| 97 bool Undo(); | 97 bool Undo(); |
| 98 bool Redo(); | 98 bool Redo(); |
| 99 bool CanUndo(); | 99 bool CanUndo(); |
| 100 bool CanRedo(); | 100 bool CanRedo(); |
| 101 | 101 |
| 102 void SetOuter(CFWL_Widget* pOuter); | 102 void SetOuter(CFWL_Widget* pOuter); |
| 103 | 103 |
| 104 void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, | 104 void On_CaretChanged(); |
|
Tom Sepez
2016/12/07 17:33:32
nit: can we lose the _ in these names?
dsinclair
2016/12/07 18:28:49
Done.
| |
| 105 int32_t nPage, | 105 void On_TextChanged(FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); |
| 106 bool bVisible = true); | 106 void On_SelChanged(); |
| 107 void On_TextChanged(CFDE_TxtEdtEngine* pEdit, | 107 bool On_PageLoad(int32_t nPageIndex); |
| 108 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); | 108 bool On_PageUnload(int32_t nPageIndex); |
| 109 void On_SelChanged(CFDE_TxtEdtEngine* pEdit); | 109 void On_AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); |
| 110 bool On_PageLoad(CFDE_TxtEdtEngine* pEdit, | 110 bool On_Validate(CFX_WideString& wsText); |
| 111 int32_t nPageIndex, | |
| 112 int32_t nPurpose); | |
| 113 bool On_PageUnload(CFDE_TxtEdtEngine* pEdit, | |
| 114 int32_t nPageIndex, | |
| 115 int32_t nPurpose); | |
| 116 void On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtDoRecord* pRecord); | |
| 117 bool On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); | |
| 118 void SetScrollOffset(FX_FLOAT fScrollOffset); | 111 void SetScrollOffset(FX_FLOAT fScrollOffset); |
| 119 | 112 |
| 120 protected: | 113 protected: |
| 121 void ShowCaret(CFX_RectF* pRect); | 114 void ShowCaret(CFX_RectF* pRect); |
| 122 void HideCaret(CFX_RectF* pRect); | 115 void HideCaret(CFX_RectF* pRect); |
| 123 const CFX_RectF& GetRTClient() const { return m_rtClient; } | 116 const CFX_RectF& GetRTClient() const { return m_rtClient; } |
| 124 CFDE_TxtEdtEngine* GetTxtEdtEngine() { return &m_EdtEngine; } | 117 CFDE_TxtEdtEngine* GetTxtEdtEngine() { return &m_EdtEngine; } |
| 125 | 118 |
| 126 private: | 119 private: |
| 127 void DrawTextBk(CFX_Graphics* pGraphics, | 120 void DrawTextBk(CFX_Graphics* pGraphics, |
| 128 IFWL_ThemeProvider* pTheme, | 121 IFWL_ThemeProvider* pTheme, |
| 129 const CFX_Matrix* pMatrix = nullptr); | 122 const CFX_Matrix* pMatrix); |
| 130 void DrawContent(CFX_Graphics* pGraphics, | 123 void DrawContent(CFX_Graphics* pGraphics, |
| 131 IFWL_ThemeProvider* pTheme, | 124 IFWL_ThemeProvider* pTheme, |
| 132 const CFX_Matrix* pMatrix = nullptr); | 125 const CFX_Matrix* pMatrix); |
| 126 void DrawSpellCheck(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); | |
| 127 | |
| 133 void UpdateEditEngine(); | 128 void UpdateEditEngine(); |
| 134 void UpdateEditParams(); | 129 void UpdateEditParams(); |
| 135 void UpdateEditLayout(); | 130 void UpdateEditLayout(); |
| 136 bool UpdateOffset(); | 131 bool UpdateOffset(); |
| 137 bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); | 132 bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); |
| 138 void UpdateVAlignment(); | 133 void UpdateVAlignment(); |
| 139 void UpdateCaret(); | 134 void UpdateCaret(); |
| 140 CFWL_ScrollBar* UpdateScroll(); | 135 CFWL_ScrollBar* UpdateScroll(); |
| 141 void Layout(); | 136 void Layout(); |
| 142 void LayoutScrollBar(); | 137 void LayoutScrollBar(); |
| 143 void DeviceToEngine(CFX_PointF& pt); | 138 void DeviceToEngine(CFX_PointF& pt); |
| 144 void InitScrollBar(bool bVert = true); | 139 void InitVerticalScrollBar(); |
| 140 void InitHorizontalScrollBar(); | |
| 145 void InitEngine(); | 141 void InitEngine(); |
| 142 void InitCaret(); | |
| 146 bool ValidateNumberChar(FX_WCHAR cNum); | 143 bool ValidateNumberChar(FX_WCHAR cNum); |
| 147 void InitCaret(); | |
| 148 void ClearRecord(); | 144 void ClearRecord(); |
| 149 bool IsShowScrollBar(bool bVert); | 145 bool IsShowScrollBar(bool bVert); |
| 150 bool IsContentHeightOverflow(); | 146 bool IsContentHeightOverflow(); |
| 151 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); | 147 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); |
| 152 void ProcessInsertError(int32_t iError); | 148 void ProcessInsertError(int32_t iError); |
| 153 | |
| 154 void DrawSpellCheck(CFX_Graphics* pGraphics, | |
| 155 const CFX_Matrix* pMatrix = nullptr); | |
| 156 void AddSpellCheckObj(CFX_Path& PathData, | 149 void AddSpellCheckObj(CFX_Path& PathData, |
| 157 int32_t nStart, | 150 int32_t nStart, |
| 158 int32_t nCount, | 151 int32_t nCount, |
| 159 FX_FLOAT fOffSetX, | 152 FX_FLOAT fOffSetX, |
| 160 FX_FLOAT fOffSetY); | 153 FX_FLOAT fOffSetY); |
| 154 | |
| 161 void DoButtonDown(CFWL_MsgMouse* pMsg); | 155 void DoButtonDown(CFWL_MsgMouse* pMsg); |
| 162 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 156 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
| 163 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 157 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 164 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 158 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 165 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 159 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
| 166 void OnMouseMove(CFWL_MsgMouse* pMsg); | 160 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 167 void OnKeyDown(CFWL_MsgKey* pMsg); | 161 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 168 void OnChar(CFWL_MsgKey* pMsg); | 162 void OnChar(CFWL_MsgKey* pMsg); |
| 169 bool OnScroll(CFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); | 163 bool OnScroll(CFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); |
| 170 | 164 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 185 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; | 179 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; |
| 186 std::unique_ptr<CFWL_Caret> m_pCaret; | 180 std::unique_ptr<CFWL_Caret> m_pCaret; |
| 187 CFX_WideString m_wsCache; | 181 CFX_WideString m_wsCache; |
| 188 CFX_WideString m_wsFont; | 182 CFX_WideString m_wsFont; |
| 189 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; | 183 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; |
| 190 int32_t m_iCurRecord; | 184 int32_t m_iCurRecord; |
| 191 int32_t m_iMaxRecord; | 185 int32_t m_iMaxRecord; |
| 192 }; | 186 }; |
| 193 | 187 |
| 194 #endif // XFA_FWL_CORE_CFWL_EDIT_H_ | 188 #endif // XFA_FWL_CORE_CFWL_EDIT_H_ |
| OLD | NEW |