summaryrefslogtreecommitdiff
path: root/xfa/fgas
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas')
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp118
-rw-r--r--xfa/fgas/crt/fgas_utils.cpp22
-rw-r--r--xfa/fgas/crt/fgas_utils.h15
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp4
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h3
-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
9 files changed, 231 insertions, 167 deletions
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 59eb99bcf0..458cf5edad 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -205,7 +205,8 @@ enum FX_STREAMTYPE {
class CFX_Stream : public IFX_Stream {
public:
CFX_Stream();
- ~CFX_Stream();
+ ~CFX_Stream() override;
+
FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
FX_BOOL LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess);
@@ -214,28 +215,30 @@ class CFX_Stream : public IFX_Stream {
int32_t iFileSize,
uint32_t dwAccess,
FX_BOOL bReleaseBufferRead);
- virtual void Release();
- virtual IFX_Stream* Retain();
- virtual uint32_t GetAccessModes() const { return m_dwAccess; }
- virtual int32_t GetLength() const;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset);
- virtual int32_t GetPosition();
- virtual FX_BOOL IsEOF() const;
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = NULL);
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength);
- virtual void Flush();
- virtual FX_BOOL SetLength(int32_t iLength);
- virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual uint16_t GetCodePage() const;
- virtual uint16_t SetCodePage(uint16_t wCodePage);
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength);
+
+ // IFX_Stream
+ void Release() override;
+ IFX_Stream* Retain() override;
+ uint32_t GetAccessModes() const override;
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ FX_BOOL IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ FX_BOOL& bEOS,
+ int32_t const* pByteSize = NULL) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
+ void Flush() override;
+ FX_BOOL SetLength(int32_t iLength) override;
+ int32_t GetBOM(uint8_t bom[4]) const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+ IFX_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
FX_STREAMTYPE m_eStreamType;
@@ -251,33 +254,31 @@ class CFX_Stream : public IFX_Stream {
class CFX_TextStream : public IFX_Stream {
public:
CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream);
- ~CFX_TextStream();
- virtual void Release();
- virtual IFX_Stream* Retain();
-
- virtual uint32_t GetAccessModes() const;
- virtual int32_t GetLength() const;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset);
- virtual int32_t GetPosition();
- virtual FX_BOOL IsEOF() const;
-
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = NULL);
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength);
- virtual void Flush();
- virtual FX_BOOL SetLength(int32_t iLength);
+ ~CFX_TextStream() override;
- virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual uint16_t GetCodePage() const;
- virtual uint16_t SetCodePage(uint16_t wCodePage);
-
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength);
+ // IFX_Stream
+ void Release() override;
+ IFX_Stream* Retain() override;
+ uint32_t GetAccessModes() const override;
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ FX_BOOL IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ FX_BOOL& bEOS,
+ int32_t const* pByteSize = NULL) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
+ void Flush() override;
+ FX_BOOL SetLength(int32_t iLength) override;
+ int32_t GetBOM(uint8_t bom[4]) const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+ IFX_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
uint16_t m_wCodePage;
@@ -294,10 +295,12 @@ class CFX_TextStream : public IFX_Stream {
class CFGAS_FileRead : public IFX_FileRead {
public:
CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream);
- virtual ~CFGAS_FileRead();
- virtual void Release() { delete this; }
- virtual FX_FILESIZE GetSize();
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+ ~CFGAS_FileRead() override;
+
+ // IFX_FileRead
+ void Release() override;
+ FX_FILESIZE GetSize() override;
+ FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
protected:
FX_BOOL m_bReleaseStream;
@@ -1260,6 +1263,11 @@ IFX_Stream* CFX_Stream::Retain() {
m_iRefCount++;
return this;
}
+
+uint32_t CFX_Stream::GetAccessModes() const {
+ return m_dwAccess;
+}
+
int32_t CFX_Stream::GetLength() const {
if (m_pStreamImp == NULL) {
return -1;
@@ -1510,3 +1518,7 @@ FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer,
int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size);
return iLen == (int32_t)size;
}
+
+void CFGAS_FileRead::Release() {
+ delete this;
+}
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
index 4f15fc4845..6db7aa35ab 100644
--- a/xfa/fgas/crt/fgas_utils.cpp
+++ b/xfa/fgas/crt/fgas_utils.cpp
@@ -12,14 +12,8 @@
class FX_BASEARRAYDATA : public CFX_Target {
public:
- FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize)
- : iGrowSize(growsize),
- iBlockSize(blocksize),
- iTotalCount(0),
- iBlockCount(0),
- pBuffer(nullptr) {}
-
- ~FX_BASEARRAYDATA() { FX_Free(pBuffer); }
+ FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize);
+ ~FX_BASEARRAYDATA() override;
int32_t iGrowSize;
int32_t iBlockSize;
@@ -27,6 +21,18 @@ class FX_BASEARRAYDATA : public CFX_Target {
int32_t iBlockCount;
uint8_t* pBuffer;
};
+
+FX_BASEARRAYDATA::FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize)
+ : iGrowSize(growsize),
+ iBlockSize(blocksize),
+ iTotalCount(0),
+ iBlockCount(0),
+ pBuffer(nullptr) {}
+
+FX_BASEARRAYDATA::~FX_BASEARRAYDATA() {
+ FX_Free(pBuffer);
+}
+
CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) {
ASSERT(iGrowSize > 0 && iBlockSize > 0);
m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize);
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index 6fef23d968..f01d115b3e 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -15,7 +15,8 @@ class FX_BASEARRAYDATA;
class CFX_BaseArray : public CFX_Target {
protected:
CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize);
- ~CFX_BaseArray();
+ ~CFX_BaseArray() override;
+
int32_t GetSize() const;
int32_t GetBlockSize() const;
uint8_t* AddSpaceTo(int32_t index);
@@ -184,7 +185,8 @@ class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray {
class CFX_BaseMassArrayImp : public CFX_Target {
public:
CFX_BaseMassArrayImp(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseMassArrayImp();
+ ~CFX_BaseMassArrayImp() override;
+
uint8_t* AddSpace() { return AddSpaceTo(m_iBlockCount); }
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
@@ -213,7 +215,8 @@ class CFX_BaseMassArrayImp : public CFX_Target {
class CFX_BaseMassArray : public CFX_Target {
protected:
CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseMassArray();
+ ~CFX_BaseMassArray() override;
+
int32_t GetSize() const;
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
@@ -360,7 +363,8 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
class CFX_BaseDiscreteArray : public CFX_Target {
protected:
CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseDiscreteArray();
+ ~CFX_BaseDiscreteArray() override;
+
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
void RemoveAll();
@@ -391,7 +395,8 @@ typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray;
class CFX_BaseStack : public CFX_Target {
protected:
CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseStack();
+ ~CFX_BaseStack() override;
+
uint8_t* Push();
void Pop();
uint8_t* GetTopElement() const;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index c6c1b19ef7..fc839e9209 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -42,6 +42,10 @@ CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() {
m_Fonts[i]->Release();
}
+void CFGAS_StdFontMgrImp::Release() {
+ delete this;
+}
+
CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index b20c942a36..11d91fc7f5 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -24,7 +24,7 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr {
~CFGAS_StdFontMgrImp() override;
// IFGAS_FontMgr:
- void Release() override { delete this; }
+ void Release() override;
CFGAS_GEFont* GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
@@ -65,7 +65,6 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr {
uint16_t wCodePage,
uint32_t dwUSB = 999,
FX_WCHAR wUnicode = 0);
- CFGAS_GEFont* GetFont(FX_FONTDESCRIPTOR const* pFD, uint32_t dwFontStyles);
FX_LPEnumAllFonts m_pEnumerator;
CFX_FontDescriptors m_FontFaces;
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;