diff options
author | thestig <thestig@chromium.org> | 2016-06-14 13:15:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-14 13:15:08 -0700 |
commit | e7b0a2d5c47a88fb29ed9d100d670e7185b8d213 (patch) | |
tree | 4a66d454a30813fb032972296137c596871dd0b6 /core/fpdftext/include/cpdf_textpage.h | |
parent | 979070b3ef34aa36ef14e2a09260b057e0265916 (diff) | |
download | pdfium-e7b0a2d5c47a88fb29ed9d100d670e7185b8d213.tar.xz |
Clean up CPDF_TextPage.
- Use more enums to better describe return results.
- Simplify code.
Review-Url: https://codereview.chromium.org/2064223002
Diffstat (limited to 'core/fpdftext/include/cpdf_textpage.h')
-rw-r--r-- | core/fpdftext/include/cpdf_textpage.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/core/fpdftext/include/cpdf_textpage.h b/core/fpdftext/include/cpdf_textpage.h index c7c673c23e..0c1efdf34a 100644 --- a/core/fpdftext/include/cpdf_textpage.h +++ b/core/fpdftext/include/cpdf_textpage.h @@ -99,6 +99,19 @@ class CPDF_TextPage { FX_BOOL bContains = FALSE); private: + enum class TextOrientation { + Unknown, + Horizontal, + Vertical, + }; + + enum class GenerateCharacter { + None, + Space, + LineBreak, + Hyphen, + }; + FX_BOOL IsHyphen(FX_WCHAR curChar); bool IsControlChar(const PAGECHAR_INFO& charInfo); void ProcessObject(); @@ -109,8 +122,8 @@ class CPDF_TextPage { const CFX_Matrix& formMatrix, const CPDF_PageObjectList* pObjList, CPDF_PageObjectList::const_iterator ObjPos); - int ProcessInsertObject(const CPDF_TextObject* pObj, - const CFX_Matrix& formMatrix); + GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj, + const CFX_Matrix& formMatrix); FX_BOOL GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info); FX_BOOL IsSameAsPreTextObject(CPDF_TextObject* pTextObj, const CPDF_PageObjectList* pObjList, @@ -122,11 +135,13 @@ class CPDF_TextPage { FPDFText_MarkedContent PreMarkedContent(PDFTEXT_Obj pObj); void ProcessMarkedContent(PDFTEXT_Obj pObj); void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; - void FindPreviousTextObject(void); + void FindPreviousTextObject(); void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info); void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info); - int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); - int32_t FindTextlineFlowDirection(); + TextOrientation GetTextObjectWritingMode( + const CPDF_TextObject* pTextObj) const; + TextOrientation FindTextlineFlowOrientation() const; + void AppendGeneratedCharacter(FX_WCHAR unicode, const CFX_Matrix& formMatrix); void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, @@ -147,7 +162,7 @@ class CPDF_TextPage { CFX_ArrayTemplate<FPDF_SEGMENT> m_Segments; std::vector<CFX_FloatRect> m_SelRects; CFX_ArrayTemplate<PDFTEXT_Obj> m_LineObj; - int32_t m_TextlineDir; + TextOrientation m_TextlineDir; CFX_FloatRect m_CurlineRect; }; |