| 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_FDE_CFDE_TXTEDTENGINE_H_ | 7 #ifndef XFA_FDE_CFDE_TXTEDTENGINE_H_ |
| 8 #define XFA_FDE_CFDE_TXTEDTENGINE_H_ | 8 #define XFA_FDE_CFDE_TXTEDTENGINE_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 IFDE_TxtEdtPage* GetPage(int32_t nIndex); | 29 IFDE_TxtEdtPage* GetPage(int32_t nIndex); |
| 30 | 30 |
| 31 void SetTextByStream(IFX_Stream* pStream); | 31 void SetTextByStream(IFX_Stream* pStream); |
| 32 void SetText(const CFX_WideString& wsText); | 32 void SetText(const CFX_WideString& wsText); |
| 33 int32_t GetTextLength() const; | 33 int32_t GetTextLength() const; |
| 34 void GetText(CFX_WideString& wsText, int32_t nStart, int32_t nCount = -1); | 34 void GetText(CFX_WideString& wsText, int32_t nStart, int32_t nCount = -1); |
| 35 void ClearText(); | 35 void ClearText(); |
| 36 | 36 |
| 37 int32_t GetCaretRect(CFX_RectF& rtCaret) const; | 37 int32_t GetCaretRect(CFX_RectF& rtCaret) const; |
| 38 int32_t GetCaretPos() const; | 38 int32_t GetCaretPos() const; |
| 39 int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore); | 39 int32_t SetCaretPos(int32_t nIndex, bool bBefore); |
| 40 int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, | 40 int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, |
| 41 FX_BOOL bShift = FALSE, | 41 bool bShift = false, |
| 42 FX_BOOL bCtrl = FALSE); | 42 bool bCtrl = false); |
| 43 void Lock(); | 43 void Lock(); |
| 44 void Unlock(); | 44 void Unlock(); |
| 45 FX_BOOL IsLocked() const; | 45 bool IsLocked() const; |
| 46 | 46 |
| 47 int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); | 47 int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); |
| 48 int32_t Delete(int32_t nStart, FX_BOOL bBackspace = FALSE); | 48 int32_t Delete(int32_t nStart, bool bBackspace = false); |
| 49 int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); | 49 int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); |
| 50 int32_t Replace(int32_t nStart, | 50 int32_t Replace(int32_t nStart, |
| 51 int32_t nLength, | 51 int32_t nLength, |
| 52 const CFX_WideString& wsReplace); | 52 const CFX_WideString& wsReplace); |
| 53 | 53 |
| 54 void SetLimit(int32_t nLimit); | 54 void SetLimit(int32_t nLimit); |
| 55 void SetAliasChar(FX_WCHAR wcAlias); | 55 void SetAliasChar(FX_WCHAR wcAlias); |
| 56 | 56 |
| 57 void RemoveSelRange(int32_t nStart, int32_t nCount = -1); | 57 void RemoveSelRange(int32_t nStart, int32_t nCount = -1); |
| 58 | 58 |
| 59 void AddSelRange(int32_t nStart, int32_t nCount = -1); | 59 void AddSelRange(int32_t nStart, int32_t nCount = -1); |
| 60 int32_t CountSelRanges(); | 60 int32_t CountSelRanges(); |
| 61 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | 61 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); |
| 62 void ClearSelection(); | 62 void ClearSelection(); |
| 63 | 63 |
| 64 FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); | 64 bool Redo(const IFDE_TxtEdtDoRecord* pRecord); |
| 65 FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); | 65 bool Undo(const IFDE_TxtEdtDoRecord* pRecord); |
| 66 | 66 |
| 67 int32_t StartLayout(); | 67 int32_t StartLayout(); |
| 68 int32_t DoLayout(IFX_Pause* pPause); | 68 int32_t DoLayout(IFX_Pause* pPause); |
| 69 void EndLayout(); | 69 void EndLayout(); |
| 70 | 70 |
| 71 FX_BOOL Optimize(IFX_Pause* pPause = nullptr); | 71 bool Optimize(IFX_Pause* pPause = nullptr); |
| 72 int32_t CountParags() const; | 72 int32_t CountParags() const; |
| 73 CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const; | 73 CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const; |
| 74 IFX_CharIter* CreateCharIter(); | 74 IFX_CharIter* CreateCharIter(); |
| 75 CFDE_TxtEdtBuf* GetTextBuf() const; | 75 CFDE_TxtEdtBuf* GetTextBuf() const; |
| 76 int32_t GetTextBufLength() const; | 76 int32_t GetTextBufLength() const; |
| 77 CFX_TxtBreak* GetTextBreak() const; | 77 CFX_TxtBreak* GetTextBreak() const; |
| 78 int32_t GetLineCount() const; | 78 int32_t GetLineCount() const; |
| 79 int32_t GetPageLineCount() const; | 79 int32_t GetPageLineCount() const; |
| 80 | 80 |
| 81 int32_t Line2Parag(int32_t nStartParag, | 81 int32_t Line2Parag(int32_t nStartParag, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 int32_t nIndex, | 107 int32_t nIndex, |
| 108 const FX_WCHAR* lpText, | 108 const FX_WCHAR* lpText, |
| 109 int32_t nLength); | 109 int32_t nLength); |
| 110 void GetPreReplaceText(CFX_WideString& wsText, | 110 void GetPreReplaceText(CFX_WideString& wsText, |
| 111 int32_t nIndex, | 111 int32_t nIndex, |
| 112 int32_t nOriginLength, | 112 int32_t nOriginLength, |
| 113 const FX_WCHAR* lpText, | 113 const FX_WCHAR* lpText, |
| 114 int32_t nLength); | 114 int32_t nLength); |
| 115 | 115 |
| 116 void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); | 116 void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); |
| 117 void DeleteRange_DoRecord(int32_t nStart, | 117 void DeleteRange_DoRecord(int32_t nStart, int32_t nCount, bool bSel = false); |
| 118 int32_t nCount, | |
| 119 FX_BOOL bSel = FALSE); | |
| 120 void ResetEngine(); | 118 void ResetEngine(); |
| 121 void RebuildParagraphs(); | 119 void RebuildParagraphs(); |
| 122 void RemoveAllParags(); | 120 void RemoveAllParags(); |
| 123 void RemoveAllPages(); | 121 void RemoveAllPages(); |
| 124 void UpdateParags(); | 122 void UpdateParags(); |
| 125 void UpdatePages(); | 123 void UpdatePages(); |
| 126 void UpdateTxtBreak(); | 124 void UpdateTxtBreak(); |
| 127 | 125 |
| 128 FX_BOOL ReplaceParagEnd(FX_WCHAR*& lpText, | 126 bool ReplaceParagEnd(FX_WCHAR*& lpText, |
| 129 int32_t& nLength, | 127 int32_t& nLength, |
| 130 FX_BOOL bPreIsCR = FALSE); | 128 bool bPreIsCR = false); |
| 131 void RecoverParagEnd(CFX_WideString& wsText); | 129 void RecoverParagEnd(CFX_WideString& wsText); |
| 132 int32_t MovePage2Char(int32_t nIndex); | 130 int32_t MovePage2Char(int32_t nIndex); |
| 133 void TextPos2ParagPos(int32_t nIndex, FDE_TXTEDTPARAGPOS& ParagPos) const; | 131 void TextPos2ParagPos(int32_t nIndex, FDE_TXTEDTPARAGPOS& ParagPos) const; |
| 134 int32_t MoveForward(FX_BOOL& bBefore); | 132 int32_t MoveForward(bool& bBefore); |
| 135 int32_t MoveBackward(FX_BOOL& bBefore); | 133 int32_t MoveBackward(bool& bBefore); |
| 136 FX_BOOL MoveUp(CFX_PointF& ptCaret); | 134 bool MoveUp(CFX_PointF& ptCaret); |
| 137 FX_BOOL MoveDown(CFX_PointF& ptCaret); | 135 bool MoveDown(CFX_PointF& ptCaret); |
| 138 FX_BOOL MoveLineStart(); | 136 bool MoveLineStart(); |
| 139 FX_BOOL MoveLineEnd(); | 137 bool MoveLineEnd(); |
| 140 FX_BOOL MoveParagStart(); | 138 bool MoveParagStart(); |
| 141 FX_BOOL MoveParagEnd(); | 139 bool MoveParagEnd(); |
| 142 FX_BOOL MoveHome(); | 140 bool MoveHome(); |
| 143 FX_BOOL MoveEnd(); | 141 bool MoveEnd(); |
| 144 FX_BOOL IsFitArea(CFX_WideString& wsText); | 142 bool IsFitArea(CFX_WideString& wsText); |
| 145 void UpdateCaretRect(int32_t nIndex, FX_BOOL bBefore = TRUE); | 143 void UpdateCaretRect(int32_t nIndex, bool bBefore = true); |
| 146 void GetCaretRect(CFX_RectF& rtCaret, | 144 void GetCaretRect(CFX_RectF& rtCaret, |
| 147 int32_t nPageIndex, | 145 int32_t nPageIndex, |
| 148 int32_t nCaret, | 146 int32_t nCaret, |
| 149 FX_BOOL bBefore = TRUE); | 147 bool bBefore = true); |
| 150 void UpdateCaretIndex(const CFX_PointF& ptCaret); | 148 void UpdateCaretIndex(const CFX_PointF& ptCaret); |
| 151 | 149 |
| 152 FX_BOOL IsSelect(); | 150 bool IsSelect(); |
| 153 void DeleteSelect(); | 151 void DeleteSelect(); |
| 154 | 152 |
| 155 std::unique_ptr<CFDE_TxtEdtBuf> m_pTxtBuf; | 153 std::unique_ptr<CFDE_TxtEdtBuf> m_pTxtBuf; |
| 156 std::unique_ptr<CFX_TxtBreak> m_pTextBreak; | 154 std::unique_ptr<CFX_TxtBreak> m_pTextBreak; |
| 157 FDE_TXTEDTPARAMS m_Param; | 155 FDE_TXTEDTPARAMS m_Param; |
| 158 CFX_ArrayTemplate<IFDE_TxtEdtPage*> m_PagePtrArray; | 156 CFX_ArrayTemplate<IFDE_TxtEdtPage*> m_PagePtrArray; |
| 159 CFX_ArrayTemplate<CFDE_TxtEdtParag*> m_ParagPtrArray; | 157 CFX_ArrayTemplate<CFDE_TxtEdtParag*> m_ParagPtrArray; |
| 160 CFX_ArrayTemplate<FDE_TXTEDTSELRANGE*> m_SelRangePtrArr; | 158 CFX_ArrayTemplate<FDE_TXTEDTSELRANGE*> m_SelRangePtrArr; |
| 161 int32_t m_nPageLineCount; | 159 int32_t m_nPageLineCount; |
| 162 int32_t m_nLineCount; | 160 int32_t m_nLineCount; |
| 163 int32_t m_nAnchorPos; | 161 int32_t m_nAnchorPos; |
| 164 int32_t m_nLayoutPos; | 162 int32_t m_nLayoutPos; |
| 165 FX_FLOAT m_fCaretPosReserve; | 163 FX_FLOAT m_fCaretPosReserve; |
| 166 int32_t m_nCaret; | 164 int32_t m_nCaret; |
| 167 FX_BOOL m_bBefore; | 165 bool m_bBefore; |
| 168 int32_t m_nCaretPage; | 166 int32_t m_nCaretPage; |
| 169 CFX_RectF m_rtCaret; | 167 CFX_RectF m_rtCaret; |
| 170 uint32_t m_dwFindFlags; | 168 uint32_t m_dwFindFlags; |
| 171 FX_BOOL m_bLock; | 169 bool m_bLock; |
| 172 int32_t m_nLimit; | 170 int32_t m_nLimit; |
| 173 FX_WCHAR m_wcAliasChar; | 171 FX_WCHAR m_wcAliasChar; |
| 174 int32_t m_nFirstLineEnd; | 172 int32_t m_nFirstLineEnd; |
| 175 FX_BOOL m_bAutoLineEnd; | 173 bool m_bAutoLineEnd; |
| 176 FX_WCHAR m_wLineEnd; | 174 FX_WCHAR m_wLineEnd; |
| 177 FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; | 175 FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; |
| 178 }; | 176 }; |
| 179 | 177 |
| 180 #endif // XFA_FDE_CFDE_TXTEDTENGINE_H_ | 178 #endif // XFA_FDE_CFDE_TXTEDTENGINE_H_ |
| OLD | NEW |