| 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_FEE_FDE_TXTEDTENGINE_H_ | 7 #ifndef XFA_FEE_FDE_TXTEDTENGINE_H_ |
| 8 #define XFA_FEE_FDE_TXTEDTENGINE_H_ | 8 #define XFA_FEE_FDE_TXTEDTENGINE_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_string.h" | 10 #include "core/fxcrt/include/fx_string.h" |
| 11 #include "xfa/fee/fde_txtedtbuf.h" | 11 #include "xfa/fee/fde_txtedtbuf.h" |
| 12 #include "xfa/fee/ifde_txtedtengine.h" | 12 #include "xfa/fee/ifde_txtedtengine.h" |
| 13 #include "xfa/fgas/layout/fgas_textbreak.h" | 13 #include "xfa/fgas/layout/fgas_textbreak.h" |
| 14 | 14 |
| 15 class CFX_TxtBreak; | 15 class CFX_TxtBreak; |
| 16 class IFX_CharIter; | 16 class IFX_CharIter; |
| 17 class CFDE_TxtEdtParag; | 17 class CFDE_TxtEdtParag; |
| 18 class CFDE_TxtEdtDoRecord_Insert; | 18 class CFDE_TxtEdtDoRecord_Insert; |
| 19 class CFDE_TxtEdtDoRecord_DeleteRange; | 19 class CFDE_TxtEdtDoRecord_DeleteRange; |
| 20 | 20 |
| 21 class IFDE_TxtEdtDoRecord { | 21 class IFDE_TxtEdtDoRecord { |
| 22 public: | 22 public: |
| 23 static IFDE_TxtEdtDoRecord* Create(const CFX_ByteStringC& bsDoRecord); | |
| 24 virtual ~IFDE_TxtEdtDoRecord() {} | 23 virtual ~IFDE_TxtEdtDoRecord() {} |
| 25 virtual void Release() = 0; | 24 |
| 26 virtual FX_BOOL Redo() = 0; | 25 virtual FX_BOOL Redo() const = 0; |
| 27 virtual FX_BOOL Undo() = 0; | 26 virtual FX_BOOL Undo() const = 0; |
| 28 virtual void Serialize(CFX_ByteString& bsDoRecord) const = 0; | |
| 29 }; | 27 }; |
| 30 | 28 |
| 31 class CFDE_TxtEdtEngine { | 29 class CFDE_TxtEdtEngine { |
| 32 public: | 30 public: |
| 33 CFDE_TxtEdtEngine(); | 31 CFDE_TxtEdtEngine(); |
| 34 | 32 |
| 35 void Release(); | 33 void Release(); |
| 36 | 34 |
| 37 void SetEditParams(const FDE_TXTEDTPARAMS& params); | 35 void SetEditParams(const FDE_TXTEDTPARAMS& params); |
| 38 FDE_TXTEDTPARAMS* GetEditParams(); | 36 FDE_TXTEDTPARAMS* GetEditParams(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 void SetLimit(int32_t nLimit); | 65 void SetLimit(int32_t nLimit); |
| 68 void SetAliasChar(FX_WCHAR wcAlias); | 66 void SetAliasChar(FX_WCHAR wcAlias); |
| 69 | 67 |
| 70 void RemoveSelRange(int32_t nStart, int32_t nCount = -1); | 68 void RemoveSelRange(int32_t nStart, int32_t nCount = -1); |
| 71 | 69 |
| 72 void AddSelRange(int32_t nStart, int32_t nCount = -1); | 70 void AddSelRange(int32_t nStart, int32_t nCount = -1); |
| 73 int32_t CountSelRanges(); | 71 int32_t CountSelRanges(); |
| 74 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | 72 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); |
| 75 void ClearSelection(); | 73 void ClearSelection(); |
| 76 | 74 |
| 77 FX_BOOL Redo(const CFX_ByteStringC& bsRedo); | 75 FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); |
| 78 FX_BOOL Undo(const CFX_ByteStringC& bsUndo); | 76 FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); |
| 79 | 77 |
| 80 int32_t StartLayout(); | 78 int32_t StartLayout(); |
| 81 int32_t DoLayout(IFX_Pause* pPause); | 79 int32_t DoLayout(IFX_Pause* pPause); |
| 82 void EndLayout(); | 80 void EndLayout(); |
| 83 | 81 |
| 84 FX_BOOL Optimize(IFX_Pause* pPause = NULL); | 82 FX_BOOL Optimize(IFX_Pause* pPause = NULL); |
| 85 int32_t CountParags() const; | 83 int32_t CountParags() const; |
| 86 CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const; | 84 CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const; |
| 87 IFX_CharIter* CreateCharIter(); | 85 IFX_CharIter* CreateCharIter(); |
| 88 CFDE_TxtEdtBuf* GetTextBuf() const; | 86 CFDE_TxtEdtBuf* GetTextBuf() const; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 int32_t m_nLimit; | 186 int32_t m_nLimit; |
| 189 FX_WCHAR m_wcAliasChar; | 187 FX_WCHAR m_wcAliasChar; |
| 190 int32_t m_nFirstLineEnd; | 188 int32_t m_nFirstLineEnd; |
| 191 FX_BOOL m_bAutoLineEnd; | 189 FX_BOOL m_bAutoLineEnd; |
| 192 FX_WCHAR m_wLineEnd; | 190 FX_WCHAR m_wLineEnd; |
| 193 FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; | 191 FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; |
| 194 }; | 192 }; |
| 195 | 193 |
| 196 class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { | 194 class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { |
| 197 public: | 195 public: |
| 198 CFDE_TxtEdtDoRecord_Insert(const CFX_ByteStringC& bsDoRecord); | |
| 199 CFDE_TxtEdtDoRecord_Insert(CFDE_TxtEdtEngine* pEngine, | 196 CFDE_TxtEdtDoRecord_Insert(CFDE_TxtEdtEngine* pEngine, |
| 200 int32_t nCaret, | 197 int32_t nCaret, |
| 201 const FX_WCHAR* lpText, | 198 const FX_WCHAR* lpText, |
| 202 int32_t nLength); | 199 int32_t nLength); |
| 203 virtual void Release(); | 200 ~CFDE_TxtEdtDoRecord_Insert() override; |
| 204 virtual FX_BOOL Undo(); | |
| 205 virtual FX_BOOL Redo(); | |
| 206 virtual void Serialize(CFX_ByteString& bsDoRecord) const; | |
| 207 | 201 |
| 208 protected: | 202 FX_BOOL Undo() const override; |
| 209 ~CFDE_TxtEdtDoRecord_Insert(); | 203 FX_BOOL Redo() const override; |
| 210 void Deserialize(const CFX_ByteStringC& bsDoRecord); | |
| 211 | 204 |
| 212 private: | 205 private: |
| 213 CFDE_TxtEdtEngine* m_pEngine; | 206 CFDE_TxtEdtEngine* m_pEngine; |
| 214 int32_t m_nCaret; | 207 int32_t m_nCaret; |
| 215 CFX_WideString m_wsInsert; | 208 CFX_WideString m_wsInsert; |
| 216 }; | 209 }; |
| 217 | 210 |
| 218 class CFDE_TxtEdtDoRecord_DeleteRange : public IFDE_TxtEdtDoRecord { | 211 class CFDE_TxtEdtDoRecord_DeleteRange : public IFDE_TxtEdtDoRecord { |
| 219 public: | 212 public: |
| 220 CFDE_TxtEdtDoRecord_DeleteRange(const CFX_ByteStringC& bsDoRecord); | |
| 221 CFDE_TxtEdtDoRecord_DeleteRange(CFDE_TxtEdtEngine* pEngine, | 213 CFDE_TxtEdtDoRecord_DeleteRange(CFDE_TxtEdtEngine* pEngine, |
| 222 int32_t nIndex, | 214 int32_t nIndex, |
| 223 int32_t nCaret, | 215 int32_t nCaret, |
| 224 const CFX_WideString& wsRange, | 216 const CFX_WideString& wsRange, |
| 225 FX_BOOL bSel = FALSE); | 217 FX_BOOL bSel = FALSE); |
| 226 virtual void Release(); | 218 ~CFDE_TxtEdtDoRecord_DeleteRange() override; |
| 227 virtual FX_BOOL Undo(); | |
| 228 virtual FX_BOOL Redo(); | |
| 229 virtual void Serialize(CFX_ByteString& bsDoRecord) const; | |
| 230 | 219 |
| 231 protected: | 220 FX_BOOL Undo() const override; |
| 232 ~CFDE_TxtEdtDoRecord_DeleteRange(); | 221 FX_BOOL Redo() const override; |
| 233 void Deserialize(const CFX_ByteStringC& bsDoRecord); | |
| 234 | 222 |
| 235 private: | 223 private: |
| 236 CFDE_TxtEdtEngine* m_pEngine; | 224 CFDE_TxtEdtEngine* m_pEngine; |
| 237 FX_BOOL m_bSel; | 225 FX_BOOL m_bSel; |
| 238 int32_t m_nIndex; | 226 int32_t m_nIndex; |
| 239 int32_t m_nCaret; | 227 int32_t m_nCaret; |
| 240 CFX_WideString m_wsRange; | 228 CFX_WideString m_wsRange; |
| 241 }; | 229 }; |
| 242 | 230 |
| 243 #endif // XFA_FEE_FDE_TXTEDTENGINE_H_ | 231 #endif // XFA_FEE_FDE_TXTEDTENGINE_H_ |
| OLD | NEW |