From 17f31183d59ee5371c1fafdb4a72390e863320ae Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 1 Mar 2017 09:31:51 -0500 Subject: Fixup RTFBreak and TextBreak nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ied5d23e18e9194e66d8be8d1057f55d83faada88 Reviewed-on: https://pdfium-review.googlesource.com/2880 Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fgas/layout/fgas_rtfbreak.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'xfa/fgas/layout/fgas_rtfbreak.h') diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 2389442c0d..d99a56bfa1 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -53,11 +53,10 @@ class CFX_RTFPiece { void AppendChar(const CFX_RTFChar& tc) { ASSERT(m_pChars); m_pChars->push_back(tc); - if (m_iWidth < 0) { + if (m_iWidth < 0) m_iWidth = tc.m_iCharWidth; - } else { + else m_iWidth += tc.m_iCharWidth; - } m_iChars++; } @@ -100,9 +99,9 @@ class CFX_RTFPiece { void Reset() { m_dwStatus = CFX_RTFBreakType::Piece; - if (m_iWidth > -1) { + if (m_iWidth > -1) m_iStartPos += m_iWidth; - } + m_iWidth = -1; m_iStartChar += m_iChars; m_iChars = 0; @@ -138,23 +137,28 @@ class CFX_RTFLine { int32_t CountChars() const { return pdfium::CollectionSize(m_LineChars); } + CFX_RTFChar& GetChar(int32_t index) { ASSERT(index >= 0 && index < pdfium::CollectionSize(m_LineChars)); return m_LineChars[index]; } + CFX_RTFChar* GetCharPtr(int32_t index) { ASSERT(index > -1 && index < pdfium::CollectionSize(m_LineChars)); return &m_LineChars[index]; } + int32_t CountPieces() const { return m_LinePieces.GetSize(); } CFX_RTFPiece& GetPiece(int32_t index) const { ASSERT(index > -1 && index < m_LinePieces.GetSize()); return m_LinePieces.GetAt(index); } + CFX_RTFPiece* GetPiecePtr(int32_t index) const { ASSERT(index > -1 && index < m_LinePieces.GetSize()); return m_LinePieces.GetPtrAt(index); } + int32_t GetLineEnd() const { return m_iStart + m_iWidth; } void RemoveAll(bool bLeaveMemory = false) { m_LineChars.clear(); @@ -208,13 +212,14 @@ class CFX_RTFBreak { CFX_RTFBreakType AppendChar_Others(CFX_RTFChar* pCurChar); protected: + void FontChanged(); void SetBreakStatus(); CFX_RTFChar* GetLastChar(int32_t index) const; - CFX_RTFLine* GetRTFLine() const; - CFX_RTFPieceArray* GetRTFPieces() const; + const CFX_RTFLine* GetRTFLine() const; + const CFX_RTFPieceArray* GetRTFPieces() const; FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; int32_t GetLastPositionedTab() const; - bool GetPositionedTab(int32_t& iTabPos) const; + bool GetPositionedTab(int32_t* iTabPos) const; int32_t GetBreakPos(std::vector& tca, int32_t& iEndPos, @@ -226,8 +231,8 @@ class CFX_RTFBreak { bool EndBreak_SplitLine(CFX_RTFLine* pNextLine, bool bAllChars, CFX_RTFBreakType dwStatus); - void EndBreak_BidiLine(CFX_TPOArray& tpos, CFX_RTFBreakType dwStatus); - void EndBreak_Alignment(CFX_TPOArray& tpos, + void EndBreak_BidiLine(CFX_TPOArray* tpos, CFX_RTFBreakType dwStatus); + void EndBreak_Alignment(const CFX_TPOArray& tpos, bool bAllChars, CFX_RTFBreakType dwStatus); -- cgit v1.2.3