summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp46
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h94
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp46
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h50
4 files changed, 137 insertions, 99 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index eed37df35d..848f7f4e93 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -1516,3 +1516,49 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
}
return iLength;
}
+
+CFX_RTFPiece::CFX_RTFPiece()
+ : m_dwStatus(FX_RTFBREAK_PieceBreak),
+ m_iStartPos(0),
+ m_iWidth(-1),
+ m_iStartChar(0),
+ m_iChars(0),
+ m_iBidiLevel(0),
+ m_iBidiPos(0),
+ m_iFontSize(0),
+ m_iFontHeight(0),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_dwLayoutStyles(0),
+ m_dwIdentity(0),
+ m_pChars(NULL),
+ m_pUserData(NULL) {}
+
+CFX_RTFPiece::~CFX_RTFPiece() {
+ Reset();
+}
+
+CFX_RTFLine::CFX_RTFLine()
+ : m_LinePieces(16),
+ m_iStart(0),
+ m_iWidth(0),
+ m_iArabicChars(0),
+ m_iMBCSChars(0) {}
+
+CFX_RTFLine::~CFX_RTFLine() {
+ RemoveAll();
+}
+
+FX_RTFTEXTOBJ::FX_RTFTEXTOBJ()
+ : pStr(nullptr),
+ pWidths(nullptr),
+ iLength(0),
+ pFont(nullptr),
+ fFontSize(12.0f),
+ dwLayoutStyles(0),
+ iCharRotation(0),
+ iBidiLevel(0),
+ pRect(nullptr),
+ wLineBreakChar(L'\n'),
+ iHorizontalScale(100),
+ iVerticalScale(100) {}
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 83d83a6c45..993dc50f97 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -64,20 +64,7 @@ class CFGAS_GEFont;
#define FX_RTFLINEALIGNMENT_HigherMask 0x0C
struct FX_RTFTEXTOBJ {
- FX_RTFTEXTOBJ() {
- pStr = NULL;
- pWidths = NULL;
- iLength = 0;
- pFont = NULL;
- fFontSize = 12.0f;
- dwLayoutStyles = 0;
- iCharRotation = 0;
- iBidiLevel = 0;
- pRect = NULL;
- wLineBreakChar = L'\n';
- iHorizontalScale = 100;
- iVerticalScale = 100;
- }
+ FX_RTFTEXTOBJ();
const FX_WCHAR* pStr;
int32_t* pWidths;
@@ -95,23 +82,9 @@ struct FX_RTFTEXTOBJ {
class CFX_RTFPiece : public CFX_Target {
public:
- CFX_RTFPiece()
- : m_dwStatus(FX_RTFBREAK_PieceBreak),
- m_iStartPos(0),
- m_iWidth(-1),
- m_iStartChar(0),
- m_iChars(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_iFontSize(0),
- m_iFontHeight(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100),
- m_dwLayoutStyles(0),
- m_dwIdentity(0),
- m_pChars(NULL),
- m_pUserData(NULL) {}
- ~CFX_RTFPiece() { Reset(); }
+ CFX_RTFPiece();
+ ~CFX_RTFPiece() override;
+
void AppendChar(const CFX_RTFChar& tc) {
ASSERT(m_pChars != NULL);
m_pChars->Add(tc);
@@ -171,6 +144,7 @@ class CFX_RTFPiece : public CFX_Target {
m_iHorizontalScale = 100;
m_iVerticalScale = 100;
}
+
uint32_t m_dwStatus;
int32_t m_iStartPos;
int32_t m_iWidth;
@@ -187,17 +161,14 @@ class CFX_RTFPiece : public CFX_Target {
CFX_RTFCharArray* m_pChars;
IFX_Retainable* m_pUserData;
};
+
typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray;
class CFX_RTFLine {
public:
- CFX_RTFLine()
- : m_LinePieces(16),
- m_iStart(0),
- m_iWidth(0),
- m_iArabicChars(0),
- m_iMBCSChars(0) {}
- ~CFX_RTFLine() { RemoveAll(); }
+ CFX_RTFLine();
+ ~CFX_RTFLine();
+
int32_t CountChars() const { return m_LineChars.GetSize(); }
CFX_RTFChar& GetChar(int32_t index) {
ASSERT(index > -1 && index < m_LineChars.GetSize());
@@ -233,6 +204,7 @@ class CFX_RTFLine {
m_iArabicChars = 0;
m_iMBCSChars = 0;
}
+
CFX_RTFCharArray m_LineChars;
CFX_RTFPieceArray m_LinePieces;
int32_t m_iStart;
@@ -290,6 +262,30 @@ class CFX_RTFBreak {
uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation);
protected:
+ int32_t GetLineRotation(uint32_t dwStyles) const;
+ void SetBreakStatus();
+ CFX_RTFChar* GetLastChar(int32_t index) const;
+ CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const;
+ CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const;
+ FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const;
+ int32_t GetLastPositionedTab() const;
+ FX_BOOL GetPositionedTab(int32_t& iTabPos) const;
+
+ int32_t GetBreakPos(CFX_RTFCharArray& tca,
+ int32_t& iEndPos,
+ FX_BOOL bAllChars = FALSE,
+ FX_BOOL bOnlyBrk = FALSE);
+ void SplitTextLine(CFX_RTFLine* pCurLine,
+ CFX_RTFLine* pNextLine,
+ FX_BOOL bAllChars = FALSE);
+ FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine,
+ FX_BOOL bAllChars,
+ uint32_t dwStatus);
+ void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
+ void EndBreak_Alignment(CFX_TPOArray& tpos,
+ FX_BOOL bAllChars,
+ uint32_t dwStatus);
+
uint32_t m_dwPolicies;
int32_t m_iBoundaryStart;
int32_t m_iBoundaryEnd;
@@ -325,28 +321,6 @@ class CFX_RTFBreak {
CFX_RTFLine* m_pCurLine;
int32_t m_iReady;
int32_t m_iTolerance;
- int32_t GetLineRotation(uint32_t dwStyles) const;
- void SetBreakStatus();
- CFX_RTFChar* GetLastChar(int32_t index) const;
- CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const;
- CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const;
- FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const;
- int32_t GetLastPositionedTab() const;
- FX_BOOL GetPositionedTab(int32_t& iTabPos) const;
- int32_t GetBreakPos(CFX_RTFCharArray& tca,
- int32_t& iEndPos,
- FX_BOOL bAllChars = FALSE,
- FX_BOOL bOnlyBrk = FALSE);
- void SplitTextLine(CFX_RTFLine* pCurLine,
- CFX_RTFLine* pNextLine,
- FX_BOOL bAllChars = FALSE);
- FX_BOOL EndBreak_SplitLine(CFX_RTFLine* pNextLine,
- FX_BOOL bAllChars,
- uint32_t dwStatus);
- void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
- void EndBreak_Alignment(CFX_TPOArray& tpos,
- FX_BOOL bAllChars,
- uint32_t dwStatus);
};
#endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index c8d33baa80..8eebbed76a 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -1662,3 +1662,49 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
}
return iLength;
}
+
+FX_TXTRUN::FX_TXTRUN()
+ : pAccess(nullptr),
+ pIdentity(nullptr),
+ pWidths(nullptr),
+ iLength(0),
+ pFont(nullptr),
+ fFontSize(12),
+ dwStyles(0),
+ iHorizontalScale(100),
+ iVerticalScale(100),
+ iCharRotation(0),
+ dwCharStyles(0),
+ pRect(nullptr),
+ wLineBreakChar(L'\n'),
+ bSkipSpace(TRUE) {}
+
+FX_TXTRUN::~FX_TXTRUN() {}
+
+FX_TXTRUN::FX_TXTRUN(const FX_TXTRUN& other) = default;
+
+CFX_TxtPiece::CFX_TxtPiece()
+ : m_dwStatus(FX_TXTBREAK_PieceBreak),
+ m_iStartPos(0),
+ m_iWidth(-1),
+ m_iStartChar(0),
+ m_iChars(0),
+ m_iBidiLevel(0),
+ m_iBidiPos(0),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_dwCharStyles(0),
+ m_pChars(NULL),
+ m_pUserData(NULL) {}
+
+CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize)
+ : m_iStart(0), m_iWidth(0), m_iArabicChars(0) {
+ m_pLineChars = new CFX_TxtCharArray;
+ m_pLinePieces = new CFX_TxtPieceArray(16);
+}
+
+CFX_TxtLine::~CFX_TxtLine() {
+ RemoveAll();
+ delete m_pLineChars;
+ delete m_pLinePieces;
+}
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 94fa79f5a6..020fa1a3d3 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -82,21 +82,9 @@ class IFX_TxtAccess {
};
struct FX_TXTRUN {
- FX_TXTRUN()
- : pAccess(nullptr),
- pIdentity(nullptr),
- pWidths(nullptr),
- iLength(0),
- pFont(nullptr),
- fFontSize(12),
- dwStyles(0),
- iHorizontalScale(100),
- iVerticalScale(100),
- iCharRotation(0),
- dwCharStyles(0),
- pRect(nullptr),
- wLineBreakChar(L'\n'),
- bSkipSpace(TRUE) {}
+ FX_TXTRUN();
+ FX_TXTRUN(const FX_TXTRUN& other);
+ ~FX_TXTRUN();
IFX_TxtAccess* pAccess;
const FDE_TEXTEDITPIECE* pIdentity;
@@ -117,19 +105,8 @@ struct FX_TXTRUN {
class CFX_TxtPiece : public CFX_Target {
public:
- CFX_TxtPiece()
- : m_dwStatus(FX_TXTBREAK_PieceBreak),
- m_iStartPos(0),
- m_iWidth(-1),
- m_iStartChar(0),
- m_iChars(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100),
- m_dwCharStyles(0),
- m_pChars(NULL),
- m_pUserData(NULL) {}
+ CFX_TxtPiece();
+
int32_t GetEndPos() const {
return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
}
@@ -148,7 +125,6 @@ class CFX_TxtPiece : public CFX_Target {
*pText++ = (FX_WCHAR)pChar->m_wCharCode;
}
}
-
void GetString(CFX_WideString& wsText) const {
FX_WCHAR* pText = wsText.GetBuffer(m_iChars);
GetString(pText);
@@ -163,6 +139,7 @@ class CFX_TxtPiece : public CFX_Target {
*pWidths++ = pChar->m_iCharWidth;
}
}
+
uint32_t m_dwStatus;
int32_t m_iStartPos;
int32_t m_iWidth;
@@ -176,20 +153,14 @@ class CFX_TxtPiece : public CFX_Target {
CFX_TxtCharArray* m_pChars;
void* m_pUserData;
};
+
typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray;
class CFX_TxtLine {
public:
- CFX_TxtLine(int32_t iBlockSize)
- : m_iStart(0), m_iWidth(0), m_iArabicChars(0) {
- m_pLineChars = new CFX_TxtCharArray;
- m_pLinePieces = new CFX_TxtPieceArray(16);
- }
- ~CFX_TxtLine() {
- RemoveAll();
- delete m_pLineChars;
- delete m_pLinePieces;
- }
+ CFX_TxtLine(int32_t iBlockSize);
+ ~CFX_TxtLine();
+
int32_t CountChars() const { return m_pLineChars->GetSize(); }
CFX_TxtChar* GetCharPtr(int32_t index) const {
ASSERT(index > -1 && index < m_pLineChars->GetSize());
@@ -216,6 +187,7 @@ class CFX_TxtLine {
m_iWidth = 0;
m_iArabicChars = 0;
}
+
CFX_TxtCharArray* m_pLineChars;
CFX_TxtPieceArray* m_pLinePieces;
int32_t m_iStart;