| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_SRC_FEE_FX_WORDBREAK_FX_WORDBREAK_IMPL_H_ | |
| 8 #define XFA_SRC_FEE_FX_WORDBREAK_FX_WORDBREAK_IMPL_H_ | |
| 9 | |
| 10 #include <cstdint> | |
| 11 | |
| 12 #include "core/include/fxcrt/fx_string.h" | |
| 13 #include "core/include/fxcrt/fx_system.h" | |
| 14 #include "xfa/src/fee/fx_wordbreak/fx_wordbreak.h" | |
| 15 #include "xfa/src/fee/fx_wordbreak/fx_wordbreak_impl.h" | |
| 16 #include "xfa/src/fee/ifde_txtedtengine.h" | |
| 17 | |
| 18 extern const FX_WORD gs_FX_WordBreak_Table[16]; | |
| 19 extern const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1]; | |
| 20 enum FX_WordBreakProp { | |
| 21 FX_WordBreakProp_None = 0, | |
| 22 FX_WordBreakProp_CR, | |
| 23 FX_WordBreakProp_LF, | |
| 24 FX_WordBreakProp_NewLine, | |
| 25 FX_WordBreakProp_Extend, | |
| 26 FX_WordBreakProp_Format, | |
| 27 FX_WordBreakProp_KataKana, | |
| 28 FX_WordBreakProp_ALetter, | |
| 29 FX_WordBreakProp_MidLetter, | |
| 30 FX_WordBreakProp_MidNum, | |
| 31 FX_WordBreakProp_MidNumLet, | |
| 32 FX_WordBreakProp_Numberic, | |
| 33 FX_WordBreakProp_ExtendNumLet, | |
| 34 }; | |
| 35 FX_WordBreakProp FX_GetWordBreakProperty(FX_WCHAR wcCodePoint); | |
| 36 class CFX_CharIter : public IFX_CharIter { | |
| 37 public: | |
| 38 CFX_CharIter(const CFX_WideString& wsText); | |
| 39 virtual void Release(); | |
| 40 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE); | |
| 41 virtual FX_WCHAR GetChar(); | |
| 42 virtual void SetAt(int32_t nIndex); | |
| 43 virtual int32_t GetAt() const; | |
| 44 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const; | |
| 45 virtual IFX_CharIter* Clone(); | |
| 46 | |
| 47 protected: | |
| 48 ~CFX_CharIter(); | |
| 49 | |
| 50 private: | |
| 51 const CFX_WideString& m_wsText; | |
| 52 int32_t m_nIndex; | |
| 53 }; | |
| 54 class CFX_WordBreak : public IFX_WordBreak { | |
| 55 public: | |
| 56 CFX_WordBreak(); | |
| 57 virtual void Release(); | |
| 58 virtual void Attach(IFX_CharIter* pIter); | |
| 59 virtual void Attach(const CFX_WideString& wsText); | |
| 60 virtual FX_BOOL Next(FX_BOOL bPrev); | |
| 61 virtual void SetAt(int32_t nIndex); | |
| 62 virtual int32_t GetWordPos() const; | |
| 63 virtual int32_t GetWordLength() const; | |
| 64 virtual void GetWord(CFX_WideString& wsWord) const; | |
| 65 virtual FX_BOOL IsEOF(FX_BOOL bTail) const; | |
| 66 | |
| 67 protected: | |
| 68 ~CFX_WordBreak(); | |
| 69 FX_BOOL FindNextBreakPos(IFX_CharIter* pIter, | |
| 70 FX_BOOL bPrev, | |
| 71 FX_BOOL bFromNext = TRUE); | |
| 72 | |
| 73 private: | |
| 74 IFX_CharIter* m_pPreIter; | |
| 75 IFX_CharIter* m_pCurIter; | |
| 76 }; | |
| 77 | |
| 78 #endif // XFA_SRC_FEE_FX_WORDBREAK_FX_WORDBREAK_IMPL_H_ | |
| OLD | NEW |