summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp51
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h64
2 files changed, 17 insertions, 98 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index e2cfaaaec3..dd3f34c739 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -863,38 +863,6 @@ const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const {
return pRTFPieces->GetPtrAt(index);
}
-void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const {
- rect.top = 0;
- const CFX_RTFLine* pRTFLine = GetRTFLine();
- if (!pRTFLine) {
- rect.left = ((FX_FLOAT)m_iBoundaryStart) / 20000.0f;
- rect.width = rect.height = 0;
- return;
- }
-
- rect.left = static_cast<FX_FLOAT>(pRTFLine->m_iStart) / 20000.0f;
- rect.width = static_cast<FX_FLOAT>(pRTFLine->m_iWidth) / 20000.0f;
- const CFX_RTFPieceArray& rtfPieces = pRTFLine->m_LinePieces;
- int32_t iCount = rtfPieces.GetSize();
- if (iCount < 1) {
- rect.width = 0;
- return;
- }
-
- CFX_RTFPiece* pBreakPiece;
- int32_t iLineHeight = 0;
- int32_t iMax;
- for (int32_t i = 0; i < iCount; i++) {
- pBreakPiece = rtfPieces.GetPtrAt(i);
- int32_t iFontHeight = FXSYS_round(pBreakPiece->m_iFontHeight *
- pBreakPiece->m_iVerticalScale / 100.0f);
- iMax = std::max(pBreakPiece->m_iFontSize, iFontHeight);
- if (i == 0 || iLineHeight < iMax)
- iLineHeight = iMax;
- }
- rect.height = static_cast<FX_FLOAT>(iLineHeight) / 20.0f;
-}
-
void CFX_RTFBreak::ClearBreakPieces() {
const CFX_RTFLine* pRTFLine = GetRTFLine();
if (pRTFLine)
@@ -910,9 +878,7 @@ void CFX_RTFBreak::Reset() {
int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
- bool bCharCode,
- CFX_WideString* pWSForms,
- FX_AdjustCharDisplayPos pAdjustPos) const {
+ bool bCharCode) const {
if (!pText || pText->iLength < 1)
return 0;
@@ -1001,8 +967,6 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
pCharPos->m_ExtGID = pCharPos->m_GlyphIndex;
#endif
pCharPos->m_FontCharWidth = iCharWidth;
- if (pWSForms)
- *pWSForms += wForm;
}
iCharHeight = 1000;
@@ -1011,15 +975,8 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
if (bRTLPiece && dwCharType != FX_CHARTYPE_Combination)
fX -= fCharWidth;
- if (!bEmptyChar) {
- CFX_PointF ptOffset;
- bool bAdjusted = false;
- if (pAdjustPos) {
- bAdjusted =
- pAdjustPos(wForm, false, pFont, fFontSize, false, ptOffset);
- }
- pCharPos->m_Origin = CFX_PointF(fX + ptOffset.x, fY - ptOffset.y);
- }
+ if (!bEmptyChar)
+ pCharPos->m_Origin = CFX_PointF(fX, fY);
if (!bRTLPiece && dwCharType != FX_CHARTYPE_Combination)
fX += fCharWidth;
@@ -1079,7 +1036,7 @@ CFX_RTFLine::CFX_RTFLine()
m_iMBCSChars(0) {}
CFX_RTFLine::~CFX_RTFLine() {
- RemoveAll();
+ RemoveAll(false);
}
FX_RTFTEXTOBJ::FX_RTFTEXTOBJ()
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index d99a56bfa1..81ec60ee48 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -50,33 +50,15 @@ class CFX_RTFPiece {
CFX_RTFPiece();
~CFX_RTFPiece();
- void AppendChar(const CFX_RTFChar& tc) {
- ASSERT(m_pChars);
- m_pChars->push_back(tc);
- if (m_iWidth < 0)
- m_iWidth = tc.m_iCharWidth;
- else
- m_iWidth += tc.m_iCharWidth;
- m_iChars++;
- }
-
int32_t GetEndPos() const {
return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
}
- int32_t GetLength() const { return m_iChars; }
- int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
-
CFX_RTFChar& GetChar(int32_t index) {
ASSERT(index > -1 && index < m_iChars && m_pChars);
return (*m_pChars)[m_iStartChar + index];
}
- CFX_RTFChar* GetCharPtr(int32_t index) const {
- ASSERT(index > -1 && index < m_iChars && m_pChars);
- return &(*m_pChars)[m_iStartChar + index];
- }
-
void GetString(FX_WCHAR* pText) const {
ASSERT(pText);
int32_t iEndChar = m_iStartChar + m_iChars;
@@ -84,12 +66,6 @@ class CFX_RTFPiece {
*pText++ = static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
}
- void GetString(CFX_WideString& wsText) const {
- FX_WCHAR* pText = wsText.GetBuffer(m_iChars);
- GetString(pText);
- wsText.ReleaseBuffer(m_iChars);
- }
-
void GetWidths(int32_t* pWidths) const {
ASSERT(pWidths);
int32_t iEndChar = m_iStartChar + m_iChars;
@@ -143,24 +119,8 @@ class CFX_RTFLine {
return m_LineChars[index];
}
- CFX_RTFChar* GetCharPtr(int32_t index) {
- ASSERT(index > -1 && index < pdfium::CollectionSize<int32_t>(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) {
+ void RemoveAll(bool bLeaveMemory) {
m_LineChars.clear();
m_LinePieces.RemoveAll(bLeaveMemory);
m_iWidth = 0;
@@ -186,32 +146,34 @@ class CFX_RTFBreak {
void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
void SetFontSize(FX_FLOAT fFontSize);
void SetTabWidth(FX_FLOAT fTabWidth);
- void AddPositionedTab(FX_FLOAT fTabPos);
void SetLineBreakTolerance(FX_FLOAT fTolerance);
void SetHorizontalScale(int32_t iScale);
void SetVerticalScale(int32_t iScale);
void SetCharSpace(FX_FLOAT fCharSpace);
void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; }
void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData);
- CFX_RTFBreakType AppendChar(FX_WCHAR wch);
+
+ void AddPositionedTab(FX_FLOAT fTabPos);
+
CFX_RTFBreakType EndBreak(CFX_RTFBreakType dwStatus);
int32_t CountBreakPieces() const;
const CFX_RTFPiece* GetBreakPiece(int32_t index) const;
- void GetLineRect(CFX_RectF& rect) const;
void ClearBreakPieces();
+
void Reset();
+
int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
- bool bCharCode = false,
- CFX_WideString* pWSForms = nullptr,
- FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
+ bool bCharCode) const;
+
+ CFX_RTFBreakType AppendChar(FX_WCHAR wch);
CFX_RTFBreakType AppendChar_Combination(CFX_RTFChar* pCurChar);
CFX_RTFBreakType AppendChar_Tab(CFX_RTFChar* pCurChar);
CFX_RTFBreakType AppendChar_Control(CFX_RTFChar* pCurChar);
CFX_RTFBreakType AppendChar_Arabic(CFX_RTFChar* pCurChar);
CFX_RTFBreakType AppendChar_Others(CFX_RTFChar* pCurChar);
- protected:
+ private:
void FontChanged();
void SetBreakStatus();
CFX_RTFChar* GetLastChar(int32_t index) const;
@@ -223,11 +185,11 @@ class CFX_RTFBreak {
int32_t GetBreakPos(std::vector<CFX_RTFChar>& tca,
int32_t& iEndPos,
- bool bAllChars = false,
- bool bOnlyBrk = false);
+ bool bAllChars,
+ bool bOnlyBrk);
void SplitTextLine(CFX_RTFLine* pCurLine,
CFX_RTFLine* pNextLine,
- bool bAllChars = false);
+ bool bAllChars);
bool EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bool bAllChars,
CFX_RTFBreakType dwStatus);