summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-12 16:55:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-12 16:55:56 -0700
commit17f382a50a7c4e5b6f14f76027a15de4ac17bc4c (patch)
tree337f45c03f9a6f40d30dc0820f29575fd55034b0
parentf1accf62715942e3f833fa57d0e6e1b70f51bae6 (diff)
downloadpdfium-17f382a50a7c4e5b6f14f76027a15de4ac17bc4c.tar.xz
Cleanup various IFX_ text interfaces.
This CL removes IFX_ArabicChar, IFX_RTFBreak, IFX_TxtBreak, IFX_WordBreak, IFX_FormatString, and IFX_GSUBTable. References were updated to be the concrete classes. The CFX_GSUBTable was also removed as it is unused. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1882213002
-rw-r--r--BUILD.gn2
-rw-r--r--core/fpdfapi/fpdf_font/ttgsubtable.cpp31
-rw-r--r--core/fpdfapi/fpdf_font/ttgsubtable.h8
-rw-r--r--core/fxcrt/fx_arabic.cpp9
-rw-r--r--core/fxcrt/include/fx_arabic.h (renamed from core/fxcrt/fx_arabic.h)62
-rw-r--r--core/fxcrt/include/fx_arb.h17
-rw-r--r--core/fxge/include/fx_font.h9
-rw-r--r--pdfium.gyp4
-rw-r--r--xfa/fde/tto/fde_textout.cpp5
-rw-r--r--xfa/fee/fde_txtedtengine.cpp8
-rw-r--r--xfa/fee/fde_txtedtengine.h7
-rw-r--r--xfa/fee/fde_txtedtpage.cpp6
-rw-r--r--xfa/fee/fde_txtedtparag.cpp4
-rw-r--r--xfa/fee/fx_wordbreak/fx_wordbreak.h53
-rw-r--r--xfa/fee/fx_wordbreak/fx_wordbreak_impl.cpp3
-rw-r--r--xfa/fee/fx_wordbreak/fx_wordbreak_impl.h41
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp172
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h200
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp169
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h200
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp7
-rw-r--r--xfa/fgas/localization/fgas_locale.h52
-rw-r--r--xfa/fgas/localization/fgas_localeimp.h96
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp4
-rw-r--r--xfa/fxfa/app/xfa_textlayout.h4
-rw-r--r--xfa/fxfa/parser/xfa_localevalue.cpp24
26 files changed, 478 insertions, 719 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 49adca56a8..80d7f6869f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -646,9 +646,9 @@ static_library("fxcrt") {
]
if (pdf_enable_xfa) {
sources += [
- "core/fxcrt/fx_arabic.cpp",
"core/fxcrt/fx_arabic.h",
"core/fxcrt/fx_basic_maps.cpp",
+ "core/fxcrt/include/fx_arabic.cpp",
"core/fxcrt/include/fx_arb.h",
]
}
diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp
index 321419346d..f6d6400f47 100644
--- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -382,34 +382,3 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw,
rec->Substitute[i] = GetUInt16(sp);
}
}
-FX_BOOL CFX_GSUBTable::GetVerticalGlyph(uint32_t glyphnum,
- uint32_t* vglyphnum) {
- return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum);
-}
-// static
-IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) {
- if (!pFont) {
- return NULL;
- }
- if (!pFont->GetSubData()) {
- unsigned long length = 0;
- int error = FXFT_Load_Sfnt_Table(
- pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length);
- if (!error) {
- pFont->SetSubData(FX_Alloc(uint8_t, length));
- }
- if (!pFont->GetSubData()) {
- return NULL;
- }
- }
- int error =
- FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
- pFont->GetSubData(), NULL);
- if (!error && pFont->GetSubData()) {
- std::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable);
- if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) {
- return pGsubTable.release();
- }
- }
- return NULL;
-}
diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h
index 7a6c66cc2a..0ef2351336 100644
--- a/core/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/fpdfapi/fpdf_font/ttgsubtable.h
@@ -25,6 +25,7 @@ class CFX_GlyphMap {
protected:
CFX_BinaryBuf m_Buffer;
};
+
class CFX_CTTGSUBTable {
public:
CFX_CTTGSUBTable(void) : m_bFeautureMapLoad(FALSE), loaded(false) {}
@@ -352,12 +353,5 @@ class CFX_CTTGSUBTable {
struct TFeatureList FeatureList;
struct TLookupList LookupList;
};
-class CFX_GSUBTable final : public IFX_GSUBTable {
- public:
- ~CFX_GSUBTable() override {}
- FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) override;
-
- CFX_CTTGSUBTable m_GsubImp;
-};
#endif // CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index 95fa8f52a0..803683782d 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/fx_arabic.h"
+#include "core/fxcrt/include/fx_arabic.h"
#include "core/fxcrt/include/fx_ucd.h"
namespace {
@@ -145,9 +145,6 @@ FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) {
return shadda;
}
-IFX_ArabicChar* IFX_ArabicChar::Create() {
- return new CFX_ArabicChar;
-}
FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const {
uint32_t dwRet =
kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK;
@@ -438,10 +435,10 @@ const int32_t gc_FX_BidiNeutralStates[][5] = {
};
const int32_t gc_FX_BidiNeutralActions[][5] = {
{FX_BNAIn, 0, 0, 0, 0},
- {FX_BNAIn, 0, 0, 0, FX_BCL},
+ {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L},
{FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNARn},
{FX_BNAIn, FX_BNALn, FX_BNAEn, FX_BNAEn, FX_BNALnL},
- {FX_BNAIn, 0, 0, 0, FX_BCL},
+ {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L},
{FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNAEn},
};
int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) {
diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/include/fx_arabic.h
index 694bc51020..96fa7954c3 100644
--- a/core/fxcrt/fx_arabic.h
+++ b/core/fxcrt/include/fx_arabic.h
@@ -4,29 +4,36 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCRT_FX_ARABIC_H_
-#define CORE_FXCRT_FX_ARABIC_H_
+#ifndef CORE_FXCRT_INCLUDE_FX_ARABIC_H_
+#define CORE_FXCRT_INCLUDE_FX_ARABIC_H_
#include "core/fxcrt/include/fx_arb.h"
-class CFX_ArabicChar : public IFX_ArabicChar {
+#define FX_BIDIMAXLEVEL 61
+#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L)
+#define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F)
+#define FX_BidiGetResolvedType(a) ((a)&0x0F)
+
+class CFX_ArabicChar {
public:
- virtual void Release() { delete this; }
- virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const;
- virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const;
+ void Release() { delete this; }
+
+ FX_BOOL IsArabicChar(FX_WCHAR wch) const;
+ FX_BOOL IsArabicFormChar(FX_WCHAR wch) const;
- virtual FX_WCHAR GetFormChar(FX_WCHAR wch,
- FX_WCHAR prev = 0,
- FX_WCHAR next = 0) const;
- virtual FX_WCHAR GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next) const;
+ FX_WCHAR GetFormChar(FX_WCHAR wch,
+ FX_WCHAR prev = 0,
+ FX_WCHAR next = 0) const;
+ FX_WCHAR GetFormChar(const CFX_Char* cur,
+ const CFX_Char* prev,
+ const CFX_Char* next) const;
protected:
const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC,
FX_WCHAR& wChar,
FX_CHARTYPE& eType) const;
};
+
void FX_BidiReverseString(CFX_WideString& wsText,
int32_t iStart,
int32_t iCount);
@@ -34,32 +41,9 @@ void FX_BidiSetDeferredRun(CFX_Int32Array& values,
int32_t iStart,
int32_t iCount,
int32_t iValue);
-#define FX_BCON FX_BIDICLASS_ON
-#define FX_BCL FX_BIDICLASS_L
-#define FX_BCR FX_BIDICLASS_R
-#define FX_BCAN FX_BIDICLASS_AN
-#define FX_BCEN FX_BIDICLASS_EN
-#define FX_BCAL FX_BIDICLASS_AL
-#define FX_BCNSM FX_BIDICLASS_NSM
-#define FX_BCCS FX_BIDICLASS_CS
-#define FX_BCES FX_BIDICLASS_ES
-#define FX_BCET FX_BIDICLASS_ET
-#define FX_BCBN FX_BIDICLASS_BN
-#define FX_BCS FX_BIDICLASS_S
-#define FX_BCWS FX_BIDICLASS_WS
-#define FX_BCB FX_BIDICLASS_B
-#define FX_BCRLO FX_BIDICLASS_RLO
-#define FX_BCRLE FX_BIDICLASS_RLE
-#define FX_BCLRO FX_BIDICLASS_LRO
-#define FX_BCLRE FX_BIDICLASS_LRE
-#define FX_BCPDF FX_BIDICLASS_PDF
-#define FX_BCN FX_BIDICLASS_N
void FX_BidiClassify(const CFX_WideString& wsText,
CFX_Int32Array& classes,
FX_BOOL bWS = FALSE);
-#define FX_BIDIMAXLEVEL 61
-#define FX_BidiGreaterEven(a) (FX_IsOdd(a) ? ((a) + 1) : ((a) + 2))
-#define FX_BidiGreaterOdd(a) (FX_IsOdd(a) ? ((a) + 2) : ((a) + 1))
int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
int32_t iDirection,
CFX_Int32Array& classes,
@@ -67,7 +51,7 @@ int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
int32_t iStart,
int32_t iCount,
int32_t iNest = 0);
-#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L)
+
enum FX_BIDIWEAKSTATE {
FX_BIDIWEAKSTATE_xa = 0,
FX_BIDIWEAKSTATE_xr,
@@ -110,6 +94,7 @@ enum FX_BIDIWEAKSTATE {
#define FX_BWSls FX_BIDIWEAKSTATE_ls
#define FX_BWSret FX_BIDIWEAKSTATE_ret
#define FX_BWSlet FX_BIDIWEAKSTATE_let
+
enum FX_BIDIWEAKACTION {
FX_BIDIWEAKACTION_IX = 0x100,
FX_BIDIWEAKACTION_XX = 0x0F,
@@ -156,8 +141,7 @@ enum FX_BIDIWEAKACTION {
#define FX_BWAxIL FX_BIDIWEAKACTION_xIL
#define FX_BWAAxR FX_BIDIWEAKACTION_AxR
#define FX_BWALxx FX_BIDIWEAKACTION_Lxx
-#define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F)
-#define FX_BidiGetResolvedType(a) ((a)&0x0F)
+
void FX_BidiResolveWeak(int32_t iBaseLevel,
CFX_Int32Array& classes,
CFX_Int32Array& levels);
@@ -208,4 +192,4 @@ void FX_BidiReorder(int32_t iBaseLevel,
CFX_WideString& wsText,
const CFX_Int32Array& levels);
-#endif // CORE_FXCRT_FX_ARABIC_H_
+#endif // CORE_FXCRT_INCLUDE_FX_ARABIC_H_
diff --git a/core/fxcrt/include/fx_arb.h b/core/fxcrt/include/fx_arb.h
index 6a0af83150..6928519a80 100644
--- a/core/fxcrt/include/fx_arb.h
+++ b/core/fxcrt/include/fx_arb.h
@@ -10,8 +10,6 @@
#include "core/fxcrt/include/fx_system.h"
#include "core/fxcrt/include/fx_ucd.h"
-class IFX_ArabicChar;
-
struct FX_ARBFORMTABLE {
uint16_t wIsolated;
uint16_t wFinal;
@@ -40,21 +38,6 @@ enum FX_ARBPOSITION {
FX_ARBPOSITION_Medial,
};
-class IFX_ArabicChar {
- public:
- static IFX_ArabicChar* Create();
- virtual ~IFX_ArabicChar() {}
- virtual void Release() = 0;
- virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const = 0;
- virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const = 0;
- virtual FX_WCHAR GetFormChar(FX_WCHAR wch,
- FX_WCHAR prev = 0,
- FX_WCHAR next = 0) const = 0;
- virtual FX_WCHAR GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next) const = 0;
-};
-
void FX_BidiLine(CFX_WideString& wsText, int32_t iBaseLevel = 0);
void FX_BidiLine(CFX_TxtCharArray& chars,
int32_t iCount,
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index 37adc832f4..02ab44d6b8 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -532,15 +532,6 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos,
FX_FLOAT retinaScaleX = 1.0f,
FX_FLOAT retinaScaleY = 1.0f);
-class IFX_GSUBTable {
- public:
- static IFX_GSUBTable* Create(CFX_Font* pFont);
- virtual FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) = 0;
-
- protected:
- virtual ~IFX_GSUBTable() {}
-};
-
CFX_ByteString GetNameFromTT(const uint8_t* name_table,
uint32_t name_table_size,
uint32_t name);
diff --git a/pdfium.gyp b/pdfium.gyp
index 32e2d029a0..4db2e548ff 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -666,10 +666,10 @@
'conditions': [
['pdf_enable_xfa==1', {
'sources': [
- 'core/fxcrt/include/fx_arb.h',
'core/fxcrt/fx_arabic.cpp',
- 'core/fxcrt/fx_arabic.h',
'core/fxcrt/fx_basic_maps.cpp',
+ 'core/fxcrt/include/fx_arabic.h',
+ 'core/fxcrt/include/fx_arb.h',
],
}],
],
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index 265db253fc..d846abc886 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -145,7 +145,7 @@ class CFDE_TextOut : public IFDE_TextOut, public CFX_Target {
void ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr);
void DrawLine(const FDE_LPTTOPIECE pPiece, CFDE_Pen*& pPen);
- IFX_TxtBreak* m_pTxtBreak;
+ CFX_TxtBreak* m_pTxtBreak;
IFX_Font* m_pFont;
FX_FLOAT m_fFontSize;
FX_FLOAT m_fLineSpace;
@@ -209,8 +209,7 @@ CFDE_TextOut::CFDE_TextOut()
m_pCharPos(NULL),
m_iCharPosSize(0),
m_pRenderDevice(NULL) {
- m_pTxtBreak = IFX_TxtBreak::Create(FX_TXTBREAKPOLICY_None);
- FXSYS_assert(m_pTxtBreak != NULL);
+ m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None);
m_Matrix.SetIdentity();
m_rtClip.Reset();
m_rtLogicClip.Reset();
diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp
index ee07790b75..b98f1e141f 100644
--- a/xfa/fee/fde_txtedtengine.cpp
+++ b/xfa/fee/fde_txtedtengine.cpp
@@ -63,9 +63,9 @@ void CFDE_TxtEdtEngine::Release() {
delete this;
}
void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) {
- if (m_pTextBreak == NULL) {
- m_pTextBreak = IFX_TxtBreak::Create(FX_TXTBREAKPOLICY_None);
- }
+ if (!m_pTextBreak)
+ m_pTextBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None);
+
FXSYS_memcpy(&m_Param, &params, sizeof(FDE_TXTEDTPARAMS));
m_wLineEnd = params.wLineBreakChar;
m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto);
@@ -721,7 +721,7 @@ IFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const {
int32_t CFDE_TxtEdtEngine::GetTextBufLength() const {
return m_pTxtBuf->GetTextLength() - 1;
}
-IFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const {
+CFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const {
return m_pTextBreak;
}
int32_t CFDE_TxtEdtEngine::GetLineCount() const {
diff --git a/xfa/fee/fde_txtedtengine.h b/xfa/fee/fde_txtedtengine.h
index 947570e4a4..b122969eae 100644
--- a/xfa/fee/fde_txtedtengine.h
+++ b/xfa/fee/fde_txtedtengine.h
@@ -10,8 +10,9 @@
#include "core/fxcrt/include/fx_string.h"
#include "xfa/fee/ifde_txtedtbuf.h"
#include "xfa/fee/ifde_txtedtengine.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
-class IFX_TxtBreak;
+class CFX_TxtBreak;
class IFX_CharIter;
class CFDE_TxtEdtParag;
class CFDE_TxtEdtDoRecord_Insert;
@@ -105,7 +106,7 @@ class CFDE_TxtEdtEngine : public IFDE_TxtEdtEngine {
virtual IFX_CharIter* CreateCharIter();
IFDE_TxtEdtBuf* GetTextBuf() const;
int32_t GetTextBufLength() const;
- IFX_TxtBreak* GetTextBreak() const;
+ CFX_TxtBreak* GetTextBreak() const;
int32_t GetLineCount() const;
int32_t GetPageLineCount() const;
@@ -173,7 +174,7 @@ class CFDE_TxtEdtEngine : public IFDE_TxtEdtEngine {
void DeleteSelect();
IFDE_TxtEdtBuf* m_pTxtBuf;
- IFX_TxtBreak* m_pTextBreak;
+ CFX_TxtBreak* m_pTextBreak;
FDE_TXTEDTPARAMS m_Param;
CFX_ArrayTemplate<IFDE_TxtEdtPage*> m_PagePtrArray;
CFX_ArrayTemplate<CFDE_TxtEdtParag*> m_ParagPtrArray;
diff --git a/xfa/fee/fde_txtedtpage.cpp b/xfa/fee/fde_txtedtpage.cpp
index f75fcd1426..eaf2627b56 100644
--- a/xfa/fee/fde_txtedtpage.cpp
+++ b/xfa/fee/fde_txtedtpage.cpp
@@ -76,7 +76,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_HVISUALOBJ hText,
}
CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine());
const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
- IFX_TxtBreak* pBreak = pEngine->GetTextBreak();
+ CFX_TxtBreak* pBreak = pEngine->GetTextBreak();
uint32_t dwLayoutStyle = pBreak->GetLayoutStyles();
FX_TXTRUN tr;
tr.pAccess = m_pPage;
@@ -368,7 +368,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) {
if (nIndex < 0) {
return -1;
}
- IFX_WordBreak* pIter = FX_WordBreak_Create();
+ CFX_WordBreak* pIter = new CFX_WordBreak;
pIter->Attach(new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pBuf));
pIter->SetAt(nIndex);
nCount = pIter->GetWordLength();
@@ -395,7 +395,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
wcAlias = m_pEditEngine->GetAliasChar();
}
m_pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pBuf, wcAlias);
- IFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak();
+ CFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak();
pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
pBreak->ClearBreakPieces();
int32_t nPageLineCount = m_pEditEngine->GetPageLineCount();
diff --git a/xfa/fee/fde_txtedtparag.cpp b/xfa/fee/fde_txtedtparag.cpp
index cac8c3c455..00899a140f 100644
--- a/xfa/fee/fde_txtedtparag.cpp
+++ b/xfa/fee/fde_txtedtparag.cpp
@@ -31,7 +31,7 @@ void CFDE_TxtEdtParag::LoadParag() {
((int32_t*)m_lpData)[0]++;
return;
}
- IFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
+ CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams();
FX_WCHAR wcAlias = 0;
@@ -101,7 +101,7 @@ void CFDE_TxtEdtParag::UnloadParag() {
}
}
void CFDE_TxtEdtParag::CalcLines() {
- IFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
+ CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
IFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)pTxtBuf);
int32_t nCount = 0;
diff --git a/xfa/fee/fx_wordbreak/fx_wordbreak.h b/xfa/fee/fx_wordbreak/fx_wordbreak.h
index fb35230136..7192700b9a 100644
--- a/xfa/fee/fx_wordbreak/fx_wordbreak.h
+++ b/xfa/fee/fx_wordbreak/fx_wordbreak.h
@@ -9,22 +9,49 @@
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fee/ifde_txtedtengine.h"
-class IFX_CharIter;
+class CFX_CharIter : public IFX_CharIter {
+ public:
+ CFX_CharIter(const CFX_WideString& wsText);
+ virtual void Release();
+ virtual FX_BOOL Next(FX_BOOL bPrev = FALSE);
+ virtual FX_WCHAR GetChar();
+ virtual void SetAt(int32_t nIndex);
+ virtual int32_t GetAt() const;
+ virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const;
+ virtual IFX_CharIter* Clone();
+
+ protected:
+ ~CFX_CharIter();
-class IFX_WordBreak {
+ private:
+ const CFX_WideString& m_wsText;
+ int32_t m_nIndex;
+};
+class CFX_WordBreak {
public:
- virtual ~IFX_WordBreak() {}
- virtual void Release() = 0;
- virtual void Attach(IFX_CharIter* pIter) = 0;
- virtual void Attach(const CFX_WideString& wsText) = 0;
- virtual FX_BOOL Next(FX_BOOL bPrev) = 0;
- virtual void SetAt(int32_t nIndex) = 0;
- virtual int32_t GetWordPos() const = 0;
- virtual int32_t GetWordLength() const = 0;
- virtual void GetWord(CFX_WideString& wsWord) const = 0;
- virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const = 0;
+ CFX_WordBreak();
+
+ void Release();
+ void Attach(IFX_CharIter* pIter);
+ void Attach(const CFX_WideString& wsText);
+ FX_BOOL Next(FX_BOOL bPrev);
+ void SetAt(int32_t nIndex);
+ int32_t GetWordPos() const;
+ int32_t GetWordLength() const;
+ void GetWord(CFX_WideString& wsWord) const;
+ FX_BOOL IsEOF(FX_BOOL bTail) const;
+
+ protected:
+ ~CFX_WordBreak();
+ FX_BOOL FindNextBreakPos(IFX_CharIter* pIter,
+ FX_BOOL bPrev,
+ FX_BOOL bFromNext = TRUE);
+
+ private:
+ IFX_CharIter* m_pPreIter;
+ IFX_CharIter* m_pCurIter;
};
-IFX_WordBreak* FX_WordBreak_Create();
#endif // XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_
diff --git a/xfa/fee/fx_wordbreak/fx_wordbreak_impl.cpp b/xfa/fee/fx_wordbreak/fx_wordbreak_impl.cpp
index 3f6e240430..e77c5f14bf 100644
--- a/xfa/fee/fx_wordbreak/fx_wordbreak_impl.cpp
+++ b/xfa/fee/fx_wordbreak/fx_wordbreak_impl.cpp
@@ -233,6 +233,3 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
} while (!pIter->IsEOF(!bPrev));
return TRUE;
}
-IFX_WordBreak* FX_WordBreak_Create() {
- return new CFX_WordBreak;
-}
diff --git a/xfa/fee/fx_wordbreak/fx_wordbreak_impl.h b/xfa/fee/fx_wordbreak/fx_wordbreak_impl.h
index 16c429b5fe..5cbd185602 100644
--- a/xfa/fee/fx_wordbreak/fx_wordbreak_impl.h
+++ b/xfa/fee/fx_wordbreak/fx_wordbreak_impl.h
@@ -33,46 +33,5 @@ enum FX_WordBreakProp {
FX_WordBreakProp_ExtendNumLet,
};
FX_WordBreakProp FX_GetWordBreakProperty(FX_WCHAR wcCodePoint);
-class CFX_CharIter : public IFX_CharIter {
- public:
- CFX_CharIter(const CFX_WideString& wsText);
- virtual void Release();
- virtual FX_BOOL Next(FX_BOOL bPrev = FALSE);
- virtual FX_WCHAR GetChar();
- virtual void SetAt(int32_t nIndex);
- virtual int32_t GetAt() const;
- virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const;
- virtual IFX_CharIter* Clone();
-
- protected:
- ~CFX_CharIter();
-
- private:
- const CFX_WideString& m_wsText;
- int32_t m_nIndex;
-};
-class CFX_WordBreak : public IFX_WordBreak {
- public:
- CFX_WordBreak();
- virtual void Release();
- virtual void Attach(IFX_CharIter* pIter);
- virtual void Attach(const CFX_WideString& wsText);
- virtual FX_BOOL Next(FX_BOOL bPrev);
- virtual void SetAt(int32_t nIndex);
- virtual int32_t GetWordPos() const;
- virtual int32_t GetWordLength() const;
- virtual void GetWord(CFX_WideString& wsWord) const;
- virtual FX_BOOL IsEOF(FX_BOOL bTail) const;
-
- protected:
- ~CFX_WordBreak();
- FX_BOOL FindNextBreakPos(IFX_CharIter* pIter,
- FX_BOOL bPrev,
- FX_BOOL bFromNext = TRUE);
-
- private:
- IFX_CharIter* m_pPreIter;
- IFX_CharIter* m_pCurIter;
-};
#endif // XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_IMPL_H_
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 38a2d212af..3adb251254 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -8,179 +8,11 @@
#include <algorithm>
+#include "core/fxcrt/include/fx_arabic.h"
#include "core/fxcrt/include/fx_arb.h"
#include "xfa/fgas/layout/fgas_linebreak.h"
#include "xfa/fgas/layout/fgas_unicode.h"
-namespace {
-
-class CFX_RTFLine {
- public:
- CFX_RTFLine()
- : m_LinePieces(16),
- m_iStart(0),
- m_iWidth(0),
- m_iArabicChars(0),
- m_iMBCSChars(0) {}
- ~CFX_RTFLine() { RemoveAll(); }
- int32_t CountChars() const { return m_LineChars.GetSize(); }
- CFX_RTFChar& GetChar(int32_t index) {
- FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
- return *m_LineChars.GetDataPtr(index);
- }
- CFX_RTFChar* GetCharPtr(int32_t index) {
- FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
- return m_LineChars.GetDataPtr(index);
- }
- int32_t CountPieces() const { return m_LinePieces.GetSize(); }
- CFX_RTFPiece& GetPiece(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
- return m_LinePieces.GetAt(index);
- }
- CFX_RTFPiece* GetPiecePtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
- return m_LinePieces.GetPtrAt(index);
- }
- int32_t GetLineEnd() const { return m_iStart + m_iWidth; }
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
- CFX_RTFChar* pChar;
- IFX_Unknown* pUnknown;
- int32_t iCount = m_LineChars.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- pChar = m_LineChars.GetDataPtr(i);
- if ((pUnknown = pChar->m_pUserData) != NULL) {
- pUnknown->Release();
- }
- }
- m_LineChars.RemoveAll();
- m_LinePieces.RemoveAll(bLeaveMemory);
- m_iWidth = 0;
- m_iArabicChars = 0;
- m_iMBCSChars = 0;
- }
- CFX_RTFCharArray m_LineChars;
- CFX_RTFPieceArray m_LinePieces;
- int32_t m_iStart;
- int32_t m_iWidth;
- int32_t m_iArabicChars;
- int32_t m_iMBCSChars;
-};
-
-class CFX_RTFBreak : public IFX_RTFBreak {
- public:
- CFX_RTFBreak(uint32_t dwPolicies);
- ~CFX_RTFBreak();
- void Release() override { delete this; }
- void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) override;
- void SetLineStartPos(FX_FLOAT fLinePos) override;
- uint32_t GetLayoutStyles() const override { return m_dwLayoutStyles; }
- void SetLayoutStyles(uint32_t dwLayoutStyles) override;
- void SetFont(IFX_Font* pFont) override;
- void SetFontSize(FX_FLOAT fFontSize) override;
- void SetTabWidth(FX_FLOAT fTabWidth) override;
- void AddPositionedTab(FX_FLOAT fTabPos) override;
- void SetPositionedTabs(const CFX_FloatArray& tabs) override;
- void ClearPositionedTabs() override;
- void SetDefaultChar(FX_WCHAR wch) override;
- void SetLineBreakChar(FX_WCHAR wch) override;
- void SetLineBreakTolerance(FX_FLOAT fTolerance) override;
- void SetHorizontalScale(int32_t iScale) override;
- void SetVerticalScale(int32_t iScale) override;
- void SetCharRotation(int32_t iCharRotation) override;
- void SetCharSpace(FX_FLOAT fCharSpace) override;
- void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace) override;
- void SetReadingOrder(FX_BOOL bRTL = FALSE) override;
- void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left) override;
- void SetUserData(IFX_Unknown* pUserData) override;
- uint32_t AppendChar(FX_WCHAR wch) override;
- uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak) override;
- int32_t CountBreakPieces() const override;
- const CFX_RTFPiece* GetBreakPiece(int32_t index) const override;
- void GetLineRect(CFX_RectF& rect) const override;
- void ClearBreakPieces() override;
- void Reset() override;
- int32_t GetDisplayPos(
- const FX_RTFTEXTOBJ* pText,
- FXTEXT_CHARPOS* pCharPos,
- FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const override;
- int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
- CFX_RectFArray& rtArray,
- FX_BOOL bCharBBox = FALSE) const override;
- uint32_t AppendChar_CharCode(FX_WCHAR wch);
- uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation);
-
- protected:
- uint32_t m_dwPolicies;
- IFX_ArabicChar* m_pArabicChar;
- int32_t m_iBoundaryStart;
- int32_t m_iBoundaryEnd;
- uint32_t m_dwLayoutStyles;
- FX_BOOL m_bPagination;
- FX_BOOL m_bVertical;
- FX_BOOL m_bSingleLine;
- FX_BOOL m_bCharCode;
- IFX_Font* m_pFont;
- int32_t m_iFontHeight;
- int32_t m_iFontSize;
- int32_t m_iTabWidth;
- CFX_Int32Array m_PositionedTabs;
- FX_BOOL m_bOrphanLine;
- FX_WCHAR m_wDefChar;
- int32_t m_iDefChar;
- FX_WCHAR m_wLineBreakChar;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
- int32_t m_iLineRotation;
- int32_t m_iCharRotation;
- int32_t m_iRotation;
- int32_t m_iCharSpace;
- FX_BOOL m_bWordSpace;
- int32_t m_iWordSpace;
- FX_BOOL m_bRTL;
- int32_t m_iAlignment;
- IFX_Unknown* m_pUserData;
- uint32_t m_dwCharType;
- uint32_t m_dwIdentity;
- CFX_RTFLine m_RTFLine1;
- CFX_RTFLine m_RTFLine2;
- 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;
- uint32_t GetUnifiedCharType(uint32_t dwType) 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);
-};
-
-} // namespace
-
-IFX_RTFBreak* IFX_RTFBreak::Create(uint32_t dwPolicies) {
- return new CFX_RTFBreak(dwPolicies);
-}
CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
: m_dwPolicies(dwPolicies),
m_pArabicChar(NULL),
@@ -218,7 +50,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
m_pCurLine(NULL),
m_iReady(0),
m_iTolerance(0) {
- m_pArabicChar = IFX_ArabicChar::Create();
+ m_pArabicChar = new CFX_ArabicChar;
m_pCurLine = &m_RTFLine1;
}
CFX_RTFBreak::~CFX_RTFBreak() {
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 83310e9d82..8a66dd9e93 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -14,6 +14,7 @@
#include "xfa/fgas/layout/fgas_textbreak.h"
#include "xfa/fgas/layout/fgas_unicode.h"
+class CFX_ArabicChar;
class IFX_Unknown;
class IFX_Font;
@@ -190,48 +191,165 @@ class CFX_RTFPiece : public CFX_Target {
};
typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray;
-class IFX_RTFBreak {
+class CFX_RTFLine {
public:
- static IFX_RTFBreak* Create(uint32_t dwPolicies);
- virtual ~IFX_RTFBreak() {}
- virtual void Release() = 0;
- virtual void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) = 0;
- virtual void SetLineStartPos(FX_FLOAT fLinePos) = 0;
- virtual uint32_t GetLayoutStyles() const = 0;
- virtual void SetLayoutStyles(uint32_t dwLayoutStyles) = 0;
- virtual void SetFont(IFX_Font* pFont) = 0;
- virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
- virtual void SetTabWidth(FX_FLOAT fTabWidth) = 0;
- virtual void AddPositionedTab(FX_FLOAT fTabPos) = 0;
- virtual void SetPositionedTabs(const CFX_FloatArray& tabs) = 0;
- virtual void ClearPositionedTabs() = 0;
- virtual void SetDefaultChar(FX_WCHAR wch) = 0;
- virtual void SetLineBreakChar(FX_WCHAR wch) = 0;
- virtual void SetLineBreakTolerance(FX_FLOAT fTolerance) = 0;
- virtual void SetHorizontalScale(int32_t iScale) = 0;
- virtual void SetVerticalScale(int32_t iScale) = 0;
- virtual void SetCharRotation(int32_t iCharRotation) = 0;
- virtual void SetCharSpace(FX_FLOAT fCharSpace) = 0;
- virtual void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace) = 0;
- virtual void SetReadingOrder(FX_BOOL bRTL = FALSE) = 0;
- virtual void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left) = 0;
- virtual void SetUserData(IFX_Unknown* pUserData) = 0;
- virtual uint32_t AppendChar(FX_WCHAR wch) = 0;
- virtual uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak) = 0;
- virtual int32_t CountBreakPieces() const = 0;
- virtual const CFX_RTFPiece* GetBreakPiece(int32_t index) const = 0;
- virtual void GetLineRect(CFX_RectF& rect) const = 0;
- virtual void ClearBreakPieces() = 0;
- virtual void Reset() = 0;
- virtual int32_t GetDisplayPos(
- const FX_RTFTEXTOBJ* pText,
- FXTEXT_CHARPOS* pCharPos,
- FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const = 0;
- virtual int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
- CFX_RectFArray& rtArray,
- FX_BOOL bCharBBox = FALSE) const = 0;
+ CFX_RTFLine()
+ : m_LinePieces(16),
+ m_iStart(0),
+ m_iWidth(0),
+ m_iArabicChars(0),
+ m_iMBCSChars(0) {}
+ ~CFX_RTFLine() { RemoveAll(); }
+ int32_t CountChars() const { return m_LineChars.GetSize(); }
+ CFX_RTFChar& GetChar(int32_t index) {
+ FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
+ return *m_LineChars.GetDataPtr(index);
+ }
+ CFX_RTFChar* GetCharPtr(int32_t index) {
+ FXSYS_assert(index > -1 && index < m_LineChars.GetSize());
+ return m_LineChars.GetDataPtr(index);
+ }
+ int32_t CountPieces() const { return m_LinePieces.GetSize(); }
+ CFX_RTFPiece& GetPiece(int32_t index) const {
+ FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
+ return m_LinePieces.GetAt(index);
+ }
+ CFX_RTFPiece* GetPiecePtr(int32_t index) const {
+ FXSYS_assert(index > -1 && index < m_LinePieces.GetSize());
+ return m_LinePieces.GetPtrAt(index);
+ }
+ int32_t GetLineEnd() const { return m_iStart + m_iWidth; }
+ void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ CFX_RTFChar* pChar;
+ IFX_Unknown* pUnknown;
+ int32_t iCount = m_LineChars.GetSize();
+ for (int32_t i = 0; i < iCount; i++) {
+ pChar = m_LineChars.GetDataPtr(i);
+ if ((pUnknown = pChar->m_pUserData) != NULL) {
+ pUnknown->Release();
+ }
+ }
+ m_LineChars.RemoveAll();
+ m_LinePieces.RemoveAll(bLeaveMemory);
+ m_iWidth = 0;
+ m_iArabicChars = 0;
+ m_iMBCSChars = 0;
+ }
+ CFX_RTFCharArray m_LineChars;
+ CFX_RTFPieceArray m_LinePieces;
+ int32_t m_iStart;
+ int32_t m_iWidth;
+ int32_t m_iArabicChars;
+ int32_t m_iMBCSChars;
+};
+
+class CFX_RTFBreak {
+ public:
+ CFX_RTFBreak(uint32_t dwPolicies);
+ ~CFX_RTFBreak();
+ void Release() { delete this; }
+ void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd);
+ void SetLineStartPos(FX_FLOAT fLinePos);
+ uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
+ void SetLayoutStyles(uint32_t dwLayoutStyles);
+ void SetFont(IFX_Font* pFont);
+ void SetFontSize(FX_FLOAT fFontSize);
+ void SetTabWidth(FX_FLOAT fTabWidth);
+ void AddPositionedTab(FX_FLOAT fTabPos);
+ void SetPositionedTabs(const CFX_FloatArray& tabs);
+ void ClearPositionedTabs();
+ void SetDefaultChar(FX_WCHAR wch);
+ void SetLineBreakChar(FX_WCHAR wch);
+ void SetLineBreakTolerance(FX_FLOAT fTolerance);
+ void SetHorizontalScale(int32_t iScale);
+ void SetVerticalScale(int32_t iScale);
+ void SetCharRotation(int32_t iCharRotation);
+ void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace);
+ void SetReadingOrder(FX_BOOL bRTL = FALSE);
+ void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left);
+ void SetUserData(IFX_Unknown* pUserData);
+ uint32_t AppendChar(FX_WCHAR wch);
+ uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak);
+ 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,
+ FX_BOOL bCharCode = FALSE,
+ CFX_WideString* pWSForms = NULL,
+ FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
+ int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
+ CFX_RectFArray& rtArray,
+ FX_BOOL bCharBBox = FALSE) const;
+ uint32_t AppendChar_CharCode(FX_WCHAR wch);
+ uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Control(CFX_RTFChar* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation);
+
+ protected:
+ uint32_t m_dwPolicies;
+ CFX_ArabicChar* m_pArabicChar;
+ int32_t m_iBoundaryStart;
+ int32_t m_iBoundaryEnd;
+ uint32_t m_dwLayoutStyles;
+ FX_BOOL m_bPagination;
+ FX_BOOL m_bVertical;
+ FX_BOOL m_bSingleLine;
+ FX_BOOL m_bCharCode;
+ IFX_Font* m_pFont;
+ int32_t m_iFontHeight;
+ int32_t m_iFontSize;
+ int32_t m_iTabWidth;
+ CFX_Int32Array m_PositionedTabs;
+ FX_BOOL m_bOrphanLine;
+ FX_WCHAR m_wDefChar;
+ int32_t m_iDefChar;
+ FX_WCHAR m_wLineBreakChar;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVerticalScale;
+ int32_t m_iLineRotation;
+ int32_t m_iCharRotation;
+ int32_t m_iRotation;
+ int32_t m_iCharSpace;
+ FX_BOOL m_bWordSpace;
+ int32_t m_iWordSpace;
+ FX_BOOL m_bRTL;
+ int32_t m_iAlignment;
+ IFX_Unknown* m_pUserData;
+ uint32_t m_dwCharType;
+ uint32_t m_dwIdentity;
+ CFX_RTFLine m_RTFLine1;
+ CFX_RTFLine m_RTFLine2;
+ 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;
+ uint32_t GetUnifiedCharType(uint32_t dwType) 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 d33d02c6f2..0face90abd 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -8,177 +8,12 @@
#include <algorithm>
+#include "core/fxcrt/include/fx_arabic.h"
#include "core/fxcrt/include/fx_arb.h"
#include "core/fxcrt/include/fx_memory.h"
#include "xfa/fgas/layout/fgas_linebreak.h"
#include "xfa/fgas/layout/fgas_unicode.h"
-namespace {
-
-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;
- }
- int32_t CountChars() const { return m_pLineChars->GetSize(); }
- CFX_TxtChar* GetCharPtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_pLineChars->GetSize());
- return m_pLineChars->GetDataPtr(index);
- }
- int32_t CountPieces() const { return m_pLinePieces->GetSize(); }
- CFX_TxtPiece* GetPiecePtr(int32_t index) const {
- FXSYS_assert(index > -1 && index < m_pLinePieces->GetSize());
- return m_pLinePieces->GetPtrAt(index);
- }
- void GetString(CFX_WideString& wsStr) const {
- int32_t iCount = m_pLineChars->GetSize();
- FX_WCHAR* pBuf = wsStr.GetBuffer(iCount);
- CFX_Char* pChar;
- for (int32_t i = 0; i < iCount; i++) {
- pChar = m_pLineChars->GetDataPtr(i);
- *pBuf++ = (FX_WCHAR)pChar->m_wCharCode;
- }
- wsStr.ReleaseBuffer(iCount);
- }
- void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
- m_pLineChars->RemoveAll();
- m_pLinePieces->RemoveAll(bLeaveMemory);
- m_iWidth = 0;
- m_iArabicChars = 0;
- }
- CFX_TxtCharArray* m_pLineChars;
- CFX_TxtPieceArray* m_pLinePieces;
- int32_t m_iStart;
- int32_t m_iWidth;
- int32_t m_iArabicChars;
-};
-
-class CFX_TxtBreak : public IFX_TxtBreak {
- public:
- CFX_TxtBreak(uint32_t dwPolicies);
- ~CFX_TxtBreak();
- virtual void Release() { delete this; }
- virtual void SetLineWidth(FX_FLOAT fLineWidth);
- virtual void SetLinePos(FX_FLOAT fLinePos);
- virtual uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
- virtual void SetLayoutStyles(uint32_t dwLayoutStyles);
- virtual void SetFont(IFX_Font* pFont);
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
- virtual void SetDefaultChar(FX_WCHAR wch);
- virtual void SetParagraphBreakChar(FX_WCHAR wch);
- virtual void SetLineBreakTolerance(FX_FLOAT fTolerance);
- virtual void SetHorizontalScale(int32_t iScale);
- virtual void SetVerticalScale(int32_t iScale);
- virtual void SetCharRotation(int32_t iCharRotation);
- virtual void SetCharSpace(FX_FLOAT fCharSpace);
- virtual void SetAlignment(int32_t iAlignment);
- virtual uint32_t GetContextCharStyles() const;
- virtual void SetContextCharStyles(uint32_t dwCharStyles);
- virtual void SetCombWidth(FX_FLOAT fCombWidth);
- virtual void SetUserData(void* pUserData);
- virtual uint32_t AppendChar(FX_WCHAR wch);
- virtual uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
- virtual int32_t CountBreakChars() const;
- virtual int32_t CountBreakPieces() const;
- virtual const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
- virtual void ClearBreakPieces();
- virtual void Reset();
- virtual int32_t GetDisplayPos(
- const FX_TXTRUN* pTxtRun,
- FXTEXT_CHARPOS* pCharPos,
- FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
- virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
- CFX_RectFArray& rtArray,
- FX_BOOL bCharBBox = FALSE) const;
- void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps);
- uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation);
-
- protected:
- uint32_t m_dwPolicies;
- FX_BOOL m_bPagination;
- IFX_ArabicChar* m_pArabicChar;
- int32_t m_iLineWidth;
- uint32_t m_dwLayoutStyles;
- FX_BOOL m_bVertical;
- FX_BOOL m_bArabicContext;
- FX_BOOL m_bArabicShapes;
- FX_BOOL m_bRTL;
- FX_BOOL m_bSingleLine;
- FX_BOOL m_bCombText;
- int32_t m_iArabicContext;
- int32_t m_iCurArabicContext;
- IFX_Font* m_pFont;
- int32_t m_iFontSize;
- FX_BOOL m_bEquidistant;
- int32_t m_iTabWidth;
- FX_WCHAR m_wDefChar;
- FX_WCHAR m_wParagBreakChar;
- int32_t m_iDefChar;
- int32_t m_iLineRotation;
- int32_t m_iCharRotation;
- int32_t m_iRotation;
- int32_t m_iAlignment;
- uint32_t m_dwContextCharStyles;
- int32_t m_iCombWidth;
- void* m_pUserData;
- uint32_t m_dwCharType;
- FX_BOOL m_bCurRTL;
- int32_t m_iCurAlignment;
- FX_BOOL m_bArabicNumber;
- FX_BOOL m_bArabicComma;
- CFX_TxtLine* m_pTxtLine1;
- CFX_TxtLine* m_pTxtLine2;
- CFX_TxtLine* m_pCurLine;
- int32_t m_iReady;
- int32_t m_iTolerance;
- int32_t m_iHorScale;
- int32_t m_iVerScale;
- int32_t m_iCharSpace;
- void SetBreakStatus();
- int32_t GetLineRotation(uint32_t dwStyles) const;
- CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const;
- CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const;
- CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const;
- uint32_t GetUnifiedCharType(uint32_t dwType) const;
- void ResetArabicContext();
- void ResetContextCharStyles();
- void EndBreak_UpdateArabicShapes();
- FX_BOOL EndBreak_SplitLine(CFX_TxtLine* 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);
- int32_t GetBreakPos(CFX_TxtCharArray& ca,
- int32_t& iEndPos,
- FX_BOOL bAllChars = FALSE,
- FX_BOOL bOnlyBrk = FALSE);
- void SplitTextLine(CFX_TxtLine* pCurLine,
- CFX_TxtLine* pNextLine,
- FX_BOOL bAllChars = FALSE);
-};
-
-} // namespace
-
-extern const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32];
-IFX_TxtBreak* IFX_TxtBreak::Create(uint32_t dwPolicies) {
- return new CFX_TxtBreak(dwPolicies);
-}
CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
: m_dwPolicies(dwPolicies),
m_pArabicChar(NULL),
@@ -216,7 +51,7 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
m_iVerScale(100),
m_iCharSpace(0) {
m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0;
- m_pArabicChar = IFX_ArabicChar::Create();
+ m_pArabicChar = new CFX_ArabicChar;
if (m_bPagination) {
m_pTxtLine1 = new CFX_TxtLine(sizeof(CFX_Char));
m_pTxtLine2 = new CFX_TxtLine(sizeof(CFX_Char));
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index af817547d3..b83f2604c8 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -12,12 +12,12 @@
#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/layout/fgas_unicode.h"
-class IFX_Font;
+class CFX_ArabicChar;
class CFX_Char;
-class IFX_TxtAccess;
class CFX_TxtChar;
class CFX_TxtPiece;
-class IFX_TxtBreak;
+class IFX_Font;
+class IFX_TxtAccess;
#define FX_TXTBREAKPOLICY_None 0x00
#define FX_TXTBREAKPOLICY_Pagination 0x01
@@ -177,46 +177,162 @@ class CFX_TxtPiece : public CFX_Target {
};
typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray;
-class IFX_TxtBreak {
+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;
+ }
+ int32_t CountChars() const { return m_pLineChars->GetSize(); }
+ CFX_TxtChar* GetCharPtr(int32_t index) const {
+ FXSYS_assert(index > -1 && index < m_pLineChars->GetSize());
+ return m_pLineChars->GetDataPtr(index);
+ }
+ int32_t CountPieces() const { return m_pLinePieces->GetSize(); }
+ CFX_TxtPiece* GetPiecePtr(int32_t index) const {
+ FXSYS_assert(index > -1 && index < m_pLinePieces->GetSize());
+ return m_pLinePieces->GetPtrAt(index);
+ }
+ void GetString(CFX_WideString& wsStr) const {
+ int32_t iCount = m_pLineChars->GetSize();
+ FX_WCHAR* pBuf = wsStr.GetBuffer(iCount);
+ CFX_Char* pChar;
+ for (int32_t i = 0; i < iCount; i++) {
+ pChar = m_pLineChars->GetDataPtr(i);
+ *pBuf++ = (FX_WCHAR)pChar->m_wCharCode;
+ }
+ wsStr.ReleaseBuffer(iCount);
+ }
+ void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
+ m_pLineChars->RemoveAll();
+ m_pLinePieces->RemoveAll(bLeaveMemory);
+ m_iWidth = 0;
+ m_iArabicChars = 0;
+ }
+ CFX_TxtCharArray* m_pLineChars;
+ CFX_TxtPieceArray* m_pLinePieces;
+ int32_t m_iStart;
+ int32_t m_iWidth;
+ int32_t m_iArabicChars;
+};
+
+class CFX_TxtBreak {
public:
- static IFX_TxtBreak* Create(uint32_t dwPolicies);
- virtual ~IFX_TxtBreak() {}
- virtual void Release() = 0;
- virtual void SetLineWidth(FX_FLOAT fLineWidth) = 0;
- virtual void SetLinePos(FX_FLOAT fLinePos) = 0;
- virtual uint32_t GetLayoutStyles() const = 0;
- virtual void SetLayoutStyles(uint32_t dwLayoutStyles) = 0;
- virtual void SetFont(IFX_Font* pFont) = 0;
- virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
- virtual void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) = 0;
- virtual void SetDefaultChar(FX_WCHAR wch) = 0;
- virtual void SetParagraphBreakChar(FX_WCHAR wch) = 0;
- virtual void SetLineBreakTolerance(FX_FLOAT fTolerance) = 0;
- virtual void SetHorizontalScale(int32_t iScale) = 0;
- virtual void SetVerticalScale(int32_t iScale) = 0;
- virtual void SetCharRotation(int32_t iCharRotation) = 0;
- virtual void SetCharSpace(FX_FLOAT fCharSpace) = 0;
- virtual void SetAlignment(int32_t iAlignment) = 0;
- virtual uint32_t GetContextCharStyles() const = 0;
- virtual void SetContextCharStyles(uint32_t dwCharStyles) = 0;
- virtual void SetCombWidth(FX_FLOAT fCombWidth) = 0;
- virtual void SetUserData(void* pUserData) = 0;
- virtual uint32_t AppendChar(FX_WCHAR wch) = 0;
- virtual uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak) = 0;
- virtual int32_t CountBreakChars() const = 0;
- virtual int32_t CountBreakPieces() const = 0;
- virtual const CFX_TxtPiece* GetBreakPiece(int32_t index) const = 0;
- virtual void ClearBreakPieces() = 0;
- virtual void Reset() = 0;
- virtual int32_t GetDisplayPos(
- const FX_TXTRUN* pTxtRun,
- FXTEXT_CHARPOS* pCharPos,
- FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const = 0;
- virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
- CFX_RectFArray& rtArray,
- FX_BOOL bCharBBox = FALSE) const = 0;
+ CFX_TxtBreak(uint32_t dwPolicies);
+ ~CFX_TxtBreak();
+
+ void Release() { delete this; }
+ void SetLineWidth(FX_FLOAT fLineWidth);
+ void SetLinePos(FX_FLOAT fLinePos);
+ uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
+ void SetLayoutStyles(uint32_t dwLayoutStyles);
+ void SetFont(IFX_Font* pFont);
+ void SetFontSize(FX_FLOAT fFontSize);
+ void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
+ void SetDefaultChar(FX_WCHAR wch);
+ void SetParagraphBreakChar(FX_WCHAR wch);
+ void SetLineBreakTolerance(FX_FLOAT fTolerance);
+ void SetHorizontalScale(int32_t iScale);
+ void SetVerticalScale(int32_t iScale);
+ void SetCharRotation(int32_t iCharRotation);
+ void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetAlignment(int32_t iAlignment);
+ uint32_t GetContextCharStyles() const;
+ void SetContextCharStyles(uint32_t dwCharStyles);
+ void SetCombWidth(FX_FLOAT fCombWidth);
+ void SetUserData(void* pUserData);
+ uint32_t AppendChar(FX_WCHAR wch);
+ uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
+ int32_t CountBreakChars() const;
+ int32_t CountBreakPieces() const;
+ const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
+ void ClearBreakPieces();
+ void Reset();
+ int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun,
+ FXTEXT_CHARPOS* pCharPos,
+ FX_BOOL bCharCode = FALSE,
+ CFX_WideString* pWSForms = NULL,
+ FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
+ int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
+ CFX_RectFArray& rtArray,
+ FX_BOOL bCharBBox = FALSE) const;
+ void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps);
+ uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation);
+ uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation);
+
+ protected:
+ uint32_t m_dwPolicies;
+ FX_BOOL m_bPagination;
+ CFX_ArabicChar* m_pArabicChar;
+ int32_t m_iLineWidth;
+ uint32_t m_dwLayoutStyles;
+ FX_BOOL m_bVertical;
+ FX_BOOL m_bArabicContext;
+ FX_BOOL m_bArabicShapes;
+ FX_BOOL m_bRTL;
+ FX_BOOL m_bSingleLine;
+ FX_BOOL m_bCombText;
+ int32_t m_iArabicContext;
+ int32_t m_iCurArabicContext;
+ IFX_Font* m_pFont;
+ int32_t m_iFontSize;
+ FX_BOOL m_bEquidistant;
+ int32_t m_iTabWidth;
+ FX_WCHAR m_wDefChar;
+ FX_WCHAR m_wParagBreakChar;
+ int32_t m_iDefChar;
+ int32_t m_iLineRotation;
+ int32_t m_iCharRotation;
+ int32_t m_iRotation;
+ int32_t m_iAlignment;
+ uint32_t m_dwContextCharStyles;
+ int32_t m_iCombWidth;
+ void* m_pUserData;
+ uint32_t m_dwCharType;
+ FX_BOOL m_bCurRTL;
+ int32_t m_iCurAlignment;
+ FX_BOOL m_bArabicNumber;
+ FX_BOOL m_bArabicComma;
+ CFX_TxtLine* m_pTxtLine1;
+ CFX_TxtLine* m_pTxtLine2;
+ CFX_TxtLine* m_pCurLine;
+ int32_t m_iReady;
+ int32_t m_iTolerance;
+ int32_t m_iHorScale;
+ int32_t m_iVerScale;
+ int32_t m_iCharSpace;
+ void SetBreakStatus();
+ int32_t GetLineRotation(uint32_t dwStyles) const;
+ CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const;
+ CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const;
+ CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const;
+ uint32_t GetUnifiedCharType(uint32_t dwType) const;
+ void ResetArabicContext();
+ void ResetContextCharStyles();
+ void EndBreak_UpdateArabicShapes();
+ FX_BOOL EndBreak_SplitLine(CFX_TxtLine* 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);
+ int32_t GetBreakPos(CFX_TxtCharArray& ca,
+ int32_t& iEndPos,
+ FX_BOOL bAllChars = FALSE,
+ FX_BOOL bOnlyBrk = FALSE);
+ void SplitTextLine(CFX_TxtLine* pCurLine,
+ CFX_TxtLine* pNextLine,
+ FX_BOOL bAllChars = FALSE);
};
#endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index 5f7074fc1c..1ef92f0d5f 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -456,13 +456,6 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading,
return wsResult;
}
-IFX_FormatString* IFX_FormatString::Create(IFX_LocaleMgr* pLocaleMgr,
- FX_BOOL bUseLCID) {
- if (!pLocaleMgr) {
- return NULL;
- }
- return new CFX_FormatString(pLocaleMgr, bUseLCID);
-}
CFX_FormatString::CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID)
: m_pLocaleMgr(pLocaleMgr), m_bUseLCID(bUseLCID) {}
CFX_FormatString::~CFX_FormatString() {}
diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/fgas_locale.h
index 20b6c1232e..48592a3bb2 100644
--- a/xfa/fgas/localization/fgas_locale.h
+++ b/xfa/fgas/localization/fgas_locale.h
@@ -100,58 +100,6 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate,
FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
CFX_Unitime& datetime,
IFX_Locale* pLocale);
-class IFX_FormatString {
- public:
- static IFX_FormatString* Create(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID);
-
- virtual ~IFX_FormatString() {}
- virtual void Release() = 0;
- virtual void SplitFormatString(const CFX_WideString& wsFormatString,
- CFX_WideStringArray& wsPatterns) = 0;
- virtual FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern) = 0;
- virtual uint16_t GetLCID(const CFX_WideString& wsPattern) = 0;
- virtual CFX_WideString GetLocaleName(const CFX_WideString& wsPattern) = 0;
- virtual FX_BOOL ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue) = 0;
- virtual FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- FX_FLOAT& fValue) = 0;
- virtual FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue) = 0;
- virtual FX_BOOL ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- FX_DATETIMETYPE eDateTimeType,
- CFX_Unitime& dtValue) = 0;
- virtual FX_BOOL ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) = 0;
- virtual FX_BOOL ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) = 0;
- virtual FX_BOOL FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatNum(FX_FLOAT fNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput,
- FX_DATETIMETYPE eDateTimeType) = 0;
- virtual FX_BOOL FormatDateTime(const CFX_Unitime& dt,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatZero(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
- virtual FX_BOOL FormatNull(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) = 0;
-};
class CFX_Decimal {
public:
CFX_Decimal();
diff --git a/xfa/fgas/localization/fgas_localeimp.h b/xfa/fgas/localization/fgas_localeimp.h
index c45ed950b9..c828a6bbd7 100644
--- a/xfa/fgas/localization/fgas_localeimp.h
+++ b/xfa/fgas/localization/fgas_localeimp.h
@@ -44,59 +44,59 @@ class CFX_Locale : public IFX_Locale {
CXML_Element* m_pElement;
};
-class CFX_FormatString : public IFX_FormatString {
+class CFX_FormatString {
public:
CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID);
- virtual void Release() { delete this; }
- virtual void SplitFormatString(const CFX_WideString& wsFormatString,
- CFX_WideStringArray& wsPatterns);
- virtual FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
- virtual uint16_t GetLCID(const CFX_WideString& wsPattern);
- virtual CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
- virtual FX_BOOL ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue);
- virtual FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- FX_FLOAT& fValue);
- virtual FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue);
- virtual FX_BOOL ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- FX_DATETIMETYPE eDateTimeType,
- CFX_Unitime& dtValue);
- virtual FX_BOOL ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
- virtual FX_BOOL ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
- virtual FX_BOOL FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatNum(FX_FLOAT fNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput,
- FX_DATETIMETYPE eDateTimeType);
- virtual FX_BOOL FormatDateTime(const CFX_Unitime& dt,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatZero(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- virtual FX_BOOL FormatNull(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
+ void Release() { delete this; }
+
+ void SplitFormatString(const CFX_WideString& wsFormatString,
+ CFX_WideStringArray& wsPatterns);
+ FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
+ uint16_t GetLCID(const CFX_WideString& wsPattern);
+ CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
+ FX_BOOL ParseText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ FX_FLOAT& fValue);
+ FX_BOOL ParseNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ FX_BOOL ParseDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ FX_DATETIMETYPE eDateTimeType,
+ CFX_Unitime& dtValue);
+ FX_BOOL ParseZero(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ FX_BOOL ParseNull(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ FX_BOOL FormatText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_BOOL FormatNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_BOOL FormatNum(FX_FLOAT fNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_BOOL FormatDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput,
+ FX_DATETIMETYPE eDateTimeType);
+ FX_BOOL FormatDateTime(const CFX_Unitime& dt,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_BOOL FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
+ FX_BOOL FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
protected:
- virtual ~CFX_FormatString();
+ ~CFX_FormatString();
+
IFX_Locale* GetTextFormat(const CFX_WideString& wsPattern,
const CFX_WideStringC& wsCategory,
CFX_WideString& wsPurgePattern);
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index 4a20cbb44d..1ee0dbe6f3 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -736,12 +736,12 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
}
return pXMLContainer;
}
-IFX_RTFBreak* CXFA_TextLayout::CreateBreak(FX_BOOL bDefault) {
+CFX_RTFBreak* CXFA_TextLayout::CreateBreak(FX_BOOL bDefault) {
uint32_t dwStyle = FX_RTFLAYOUTSTYLE_ExpandTab;
if (!bDefault) {
dwStyle |= FX_RTFLAYOUTSTYLE_Pagination;
}
- IFX_RTFBreak* pBreak = IFX_RTFBreak::Create(0);
+ CFX_RTFBreak* pBreak = new CFX_RTFBreak(0);
pBreak->SetLayoutStyles(dwStyle);
pBreak->SetLineBreakChar(L'\n');
pBreak->SetLineBreakTolerance(1);
diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h
index a96c537033..c80e4f6cca 100644
--- a/xfa/fxfa/app/xfa_textlayout.h
+++ b/xfa/fxfa/app/xfa_textlayout.h
@@ -341,7 +341,7 @@ class CXFA_TextLayout {
private:
void GetTextDataNode();
CFDE_XMLNode* GetXMLContainerNode();
- IFX_RTFBreak* CreateBreak(FX_BOOL bDefault);
+ CFX_RTFBreak* CreateBreak(FX_BOOL bDefault);
void InitBreak(FX_FLOAT fLineWidth);
void InitBreak(IFDE_CSSComputedStyle* pStyle,
FDE_CSSDISPLAY eDisplay,
@@ -400,7 +400,7 @@ class CXFA_TextLayout {
CXFA_Node* m_pTextDataNode;
FX_BOOL m_bRichText;
IFX_MEMAllocator* m_pAllocator;
- IFX_RTFBreak* m_pBreak;
+ CFX_RTFBreak* m_pBreak;
CXFA_LoaderContext* m_pLoader;
int32_t m_iLines;
FX_FLOAT m_fMaxWidth;
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index 9bca7b71b9..57c8054168 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -6,6 +6,7 @@
#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include "xfa/fgas/localization/fgas_localeimp.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/xfa_docdata.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
@@ -105,7 +106,10 @@ FX_BOOL CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue,
if (pLocale) {
m_pLocaleMgr->SetDefLocale(pLocale);
}
- IFX_FormatString* pFormat = IFX_FormatString::Create(m_pLocaleMgr, FALSE);
+ CFX_FormatString* pFormat = nullptr;
+ if (m_pLocaleMgr)
+ pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE);
+
CFX_WideStringArray wsPatterns;
pFormat->SplitFormatString(wsPattern, wsPatterns);
FX_BOOL bRet = FALSE;
@@ -462,7 +466,11 @@ FX_BOOL CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
XFA_VALUEPICTURE eValueType) const {
wsResult.Empty();
FX_BOOL bRet = FALSE;
- IFX_FormatString* pFormat = IFX_FormatString::Create(m_pLocaleMgr, FALSE);
+
+ CFX_FormatString* pFormat = nullptr;
+ if (m_pLocaleMgr)
+ pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE);
+
CFX_WideStringArray wsPatterns;
pFormat->SplitFormatString(wsFormat, wsPatterns);
int32_t iCount = wsPatterns.GetSize();
@@ -486,7 +494,11 @@ FX_BOOL CXFA_LocaleValue::FormatSinglePattern(
}
wsResult.Empty();
FX_BOOL bRet = FALSE;
- IFX_FormatString* pFormat = IFX_FormatString::Create(m_pLocaleMgr, FALSE);
+
+ CFX_FormatString* pFormat = nullptr;
+ if (m_pLocaleMgr)
+ pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE);
+
FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
eCategory = XFA_ValugeCategory(eCategory, m_dwType);
switch (eCategory) {
@@ -793,7 +805,11 @@ FX_BOOL CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
if (pLocale) {
m_pLocaleMgr->SetDefLocale(pLocale);
}
- IFX_FormatString* pFormat = IFX_FormatString::Create(m_pLocaleMgr, FALSE);
+
+ CFX_FormatString* pFormat = nullptr;
+ if (m_pLocaleMgr)
+ pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE);
+
CFX_WideStringArray wsPatterns;
pFormat->SplitFormatString(wsPattern, wsPatterns);
FX_BOOL bRet = FALSE;