summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp294
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp49
-rw-r--r--xfa/fde/ifde_txtedtengine.h13
-rw-r--r--xfa/fwl/cfwl_edit.cpp56
-rw-r--r--xfa/fwl/cfwl_edit.h13
-rw-r--r--xfa/fwl/fwl_widgetdef.h1
6 files changed, 110 insertions, 316 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index 7df4e0fb96..1d357e928f 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -205,9 +205,7 @@ int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) {
m_nCaret++;
m_bBefore = true;
}
- m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical)
- ? m_rtCaret.top
- : m_rtCaret.left;
+ m_fCaretPosReserve = m_rtCaret.left;
m_Param.pEventSink->OnCaretChanged();
m_nAnchorPos = -1;
return m_nCaret;
@@ -234,64 +232,38 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
} else {
m_nAnchorPos = -1;
}
- bool bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical;
+
switch (eMoveCaret) {
case MC_Left: {
- if (bVertical) {
- CFX_PointF ptCaret;
- if (MoveUp(ptCaret)) {
- UpdateCaretIndex(ptCaret);
- }
- } else {
- bool bBefore = true;
- int32_t nIndex = MoveBackward(bBefore);
- if (nIndex >= 0) {
- UpdateCaretRect(nIndex, bBefore);
- }
+ bool bBefore = true;
+ int32_t nIndex = MoveBackward(bBefore);
+ if (nIndex >= 0) {
+ UpdateCaretRect(nIndex, bBefore);
}
- } break;
+ break;
+ }
case MC_Right: {
- if (bVertical) {
- CFX_PointF ptCaret;
- if (MoveDown(ptCaret)) {
- UpdateCaretIndex(ptCaret);
- }
- } else {
- bool bBefore = true;
- int32_t nIndex = MoveForward(bBefore);
- if (nIndex >= 0) {
- UpdateCaretRect(nIndex, bBefore);
- }
+ bool bBefore = true;
+ int32_t nIndex = MoveForward(bBefore);
+ if (nIndex >= 0) {
+ UpdateCaretRect(nIndex, bBefore);
}
- } break;
+ break;
+ }
case MC_Up: {
- if (bVertical) {
- bool bBefore = true;
- int32_t nIndex = MoveBackward(bBefore);
- if (nIndex >= 0) {
- UpdateCaretRect(nIndex, bBefore);
- }
- } else {
- CFX_PointF ptCaret;
- if (MoveUp(ptCaret)) {
- UpdateCaretIndex(ptCaret);
- }
+ CFX_PointF ptCaret;
+ if (MoveUp(ptCaret)) {
+ UpdateCaretIndex(ptCaret);
}
- } break;
+ break;
+ }
case MC_Down: {
- if (bVertical) {
- bool bBefore = true;
- int32_t nIndex = MoveForward(bBefore);
- if (nIndex >= 0) {
- UpdateCaretRect(nIndex, bBefore);
- }
- } else {
- CFX_PointF ptCaret;
- if (MoveDown(ptCaret)) {
- UpdateCaretIndex(ptCaret);
- }
+ CFX_PointF ptCaret;
+ if (MoveDown(ptCaret)) {
+ UpdateCaretIndex(ptCaret);
}
- } break;
+ break;
+ }
case MC_WordBackward:
break;
case MC_WordForward:
@@ -413,10 +385,9 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart,
if (IsSelect()) {
DeleteSelect();
}
- if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo))
- m_Param.pEventSink->OnAddDoRecord(
- pdfium::MakeUnique<CFDE_TxtEdtDoRecord_Insert>(this, m_nCaret, lpBuffer,
- nLength));
+ m_Param.pEventSink->OnAddDoRecord(
+ pdfium::MakeUnique<CFDE_TxtEdtDoRecord_Insert>(this, m_nCaret, lpBuffer,
+ nLength));
m_ChangeInfo.wsPrevText = GetText(0, -1);
Inner_Insert(m_nCaret, lpBuffer, nLength);
@@ -470,12 +441,11 @@ int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) {
if (!m_Param.pEventSink->OnValidate(wsText))
return FDE_TXTEDT_MODIFY_RET_F_Invalidate;
}
- if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) {
- CFX_WideString wsRange = m_pTxtBuf->GetRange(nStart, nCount);
- m_Param.pEventSink->OnAddDoRecord(
- pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>(this, nStart,
- m_nCaret, wsRange));
- }
+ CFX_WideString wsRange = m_pTxtBuf->GetRange(nStart, nCount);
+ m_Param.pEventSink->OnAddDoRecord(
+ pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>(this, nStart,
+ m_nCaret, wsRange));
+
m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete;
m_ChangeInfo.wsDelete = GetText(nStart, nCount);
Inner_DeleteRange(nStart, nCount);
@@ -656,16 +626,12 @@ void CFDE_TxtEdtEngine::ClearSelection() {
bool CFDE_TxtEdtEngine::Redo(const IFDE_TxtEdtDoRecord* pDoRecord) {
if (IsLocked())
return false;
- if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)
- return false;
return pDoRecord->Redo();
}
bool CFDE_TxtEdtEngine::Undo(const IFDE_TxtEdtDoRecord* pDoRecord) {
if (IsLocked())
return false;
- if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)
- return false;
return pDoRecord->Undo();
}
@@ -945,12 +911,11 @@ void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart,
}
ASSERT((nStart + nCount) <= m_pTxtBuf->GetTextLength());
- if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) {
- CFX_WideString wsRange = m_pTxtBuf->GetRange(nStart, nCount);
- m_Param.pEventSink->OnAddDoRecord(
- pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>(
- this, nStart, m_nCaret, wsRange, bSel));
- }
+ CFX_WideString wsRange = m_pTxtBuf->GetRange(nStart, nCount);
+ m_Param.pEventSink->OnAddDoRecord(
+ pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>(
+ this, nStart, m_nCaret, wsRange, bSel));
+
m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete;
m_ChangeInfo.wsDelete = GetText(nStart, nCount);
Inner_DeleteRange(nStart, nCount);
@@ -1046,52 +1011,25 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() {
} else {
dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine;
}
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- dwStyle |= FX_TXTLAYOUTSTYLE_VerticalLayout;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalLayout;
- }
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve) {
- dwStyle |= FX_TXTLAYOUTSTYLE_ReverseLine;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ReverseLine;
- }
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_RTL) {
- dwStyle |= FX_TXTLAYOUTSTYLE_RTLReadingOrder;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_RTLReadingOrder;
- }
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalLayout;
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_ReverseLine;
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_RTLReadingOrder;
+
if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) {
dwStyle |= FX_TXTLAYOUTSTYLE_CombText;
} else {
dwStyle &= ~FX_TXTLAYOUTSTYLE_CombText;
}
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CharVertial) {
- dwStyle |= FX_TXTLAYOUTSTYLE_VerticalChars;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalChars;
- }
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_ExpandTab) {
- dwStyle |= FX_TXTLAYOUTSTYLE_ExpandTab;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ExpandTab;
- }
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_ArabicContext) {
- dwStyle |= FX_TXTLAYOUTSTYLE_ArabicContext;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicContext;
- }
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_ArabicShapes) {
- dwStyle |= FX_TXTLAYOUTSTYLE_ArabicShapes;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicShapes;
- }
+
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalChars;
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_ExpandTab;
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicContext;
+ dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicShapes;
+
m_pTextBreak->SetLayoutStyles(dwStyle);
uint32_t dwAligment = 0;
if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Justified) {
dwAligment |= FX_TXTLINEALIGNMENT_Justified;
- } else if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Distributed) {
- dwAligment |= FX_TXTLINEALIGNMENT_Distributed;
}
if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Center) {
dwAligment |= FX_TXTLINEALIGNMENT_Center;
@@ -1099,25 +1037,16 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() {
dwAligment |= FX_TXTLINEALIGNMENT_Right;
}
m_pTextBreak->SetAlignment(dwAligment);
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) {
- m_pTextBreak->SetLineWidth(m_Param.fPlateHeight);
- } else {
- m_pTextBreak->SetLineWidth(kPageWidthMax);
- }
+
+ if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) {
+ m_pTextBreak->SetLineWidth(m_Param.fPlateWidth);
} else {
- if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) {
- m_pTextBreak->SetLineWidth(m_Param.fPlateWidth);
- } else {
- m_pTextBreak->SetLineWidth(kPageWidthMax);
- }
+ m_pTextBreak->SetLineWidth(kPageWidthMax);
}
+
m_nPageLineCount = m_Param.nLineCount;
if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) {
- FX_FLOAT fCombWidth =
- m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical
- ? m_Param.fPlateHeight
- : m_Param.fPlateWidth;
+ FX_FLOAT fCombWidth = m_Param.fPlateWidth;
if (m_nLimit > 0) {
fCombWidth /= m_nLimit;
}
@@ -1323,85 +1252,34 @@ int32_t CFDE_TxtEdtEngine::MoveBackward(bool& bBefore) {
bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) {
IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
const CFX_RectF& rtContent = pPage->GetContentsBox();
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace;
- ptCaret.y = m_fCaretPosReserve;
- bool bLineReserve =
- !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve);
- if (ptCaret.x < rtContent.left) {
- if (bLineReserve) {
- if (m_nCaretPage == CountPages() - 1) {
- return false;
- }
- } else {
- if (m_nCaretPage == 0) {
- return false;
- }
- }
- if (bLineReserve) {
- m_nCaretPage++;
- } else {
- m_nCaretPage--;
- }
- ptCaret.x -= rtContent.left;
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
- ptCaret.x += pCurPage->GetContentsBox().right();
- }
- } else {
- ptCaret.x = m_fCaretPosReserve;
- ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace;
- if (ptCaret.y < rtContent.top) {
- if (m_nCaretPage == 0) {
- return false;
- }
- ptCaret.y -= rtContent.top;
- m_nCaretPage--;
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
- ptCaret.y += pCurPage->GetContentsBox().bottom();
+ ptCaret.x = m_fCaretPosReserve;
+ ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace;
+ if (ptCaret.y < rtContent.top) {
+ if (m_nCaretPage == 0) {
+ return false;
}
+ ptCaret.y -= rtContent.top;
+ m_nCaretPage--;
+ IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
+ ptCaret.y += pCurPage->GetContentsBox().bottom();
}
+
return true;
}
bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) {
IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
const CFX_RectF& rtContent = pPage->GetContentsBox();
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace;
- ptCaret.y = m_fCaretPosReserve;
- if (ptCaret.x >= rtContent.right()) {
- bool bLineReserve =
- !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve);
- if (bLineReserve) {
- if (m_nCaretPage == 0) {
- return false;
- }
- } else {
- if (m_nCaretPage == CountPages() - 1) {
- return false;
- }
- }
- if (bLineReserve) {
- m_nCaretPage--;
- } else {
- m_nCaretPage++;
- }
- ptCaret.x -= rtContent.right();
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
- ptCaret.x += pCurPage->GetContentsBox().left;
- }
- } else {
- ptCaret.x = m_fCaretPosReserve;
- ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace;
- if (ptCaret.y >= rtContent.bottom()) {
- if (m_nCaretPage == CountPages() - 1) {
- return false;
- }
- ptCaret.y -= rtContent.bottom();
- m_nCaretPage++;
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
- ptCaret.y += pCurPage->GetContentsBox().top;
+ ptCaret.x = m_fCaretPosReserve;
+ ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace;
+ if (ptCaret.y >= rtContent.bottom()) {
+ if (m_nCaretPage == CountPages() - 1) {
+ return false;
}
+ ptCaret.y -= rtContent.bottom();
+ m_nCaretPage++;
+ IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
+ ptCaret.y += pCurPage->GetContentsBox().top;
}
return true;
}
@@ -1542,9 +1420,7 @@ void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, bool bBefore) {
m_nCaret++;
m_bBefore = true;
}
- m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical)
- ? m_rtCaret.top
- : m_rtCaret.left;
+ m_fCaretPosReserve = m_rtCaret.left;
m_Param.pEventSink->OnCaretChanged();
}
@@ -1561,25 +1437,15 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
bBefore = false;
}
int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText);
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- if ((!FX_IsOdd(nBIDILevel) && !bBefore) ||
- (FX_IsOdd(nBIDILevel) && bBefore)) {
- rtCaret.Offset(0, rtCaret.height - 1.0f);
- }
- if (rtCaret.height == 0 && rtCaret.top > 1.0f)
- rtCaret.top -= 1.0f;
+ if ((!FX_IsOdd(nBIDILevel) && !bBefore) ||
+ (FX_IsOdd(nBIDILevel) && bBefore)) {
+ rtCaret.Offset(rtCaret.width - 1.0f, 0);
+ }
+ if (rtCaret.width == 0 && rtCaret.left > 1.0f)
+ rtCaret.left -= 1.0f;
- rtCaret.height = 1.0f;
- } else {
- if ((!FX_IsOdd(nBIDILevel) && !bBefore) ||
- (FX_IsOdd(nBIDILevel) && bBefore)) {
- rtCaret.Offset(rtCaret.width - 1.0f, 0);
- }
- if (rtCaret.width == 0 && rtCaret.left > 1.0f)
- rtCaret.left -= 1.0f;
+ rtCaret.width = 1.0f;
- rtCaret.width = 1.0f;
- }
m_Param.pEventSink->OnPageUnload(m_nCaretPage);
}
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 51621dae1c..ff19d12338 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -83,8 +83,6 @@ int32_t CFDE_TxtEdtPage::GetCharRect(int32_t nIndex,
}
int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) {
- bool bVertical = m_pEditEngine->GetEditParams()->dwLayoutStyles &
- FDE_TEXTEDITLAYOUT_DocVertical;
CFX_PointF ptF = fPoint;
NormalizePt2Rect(ptF, m_rtPageContents, kTolerance);
int32_t nCount = m_PieceMassArr.GetSize();
@@ -95,18 +93,13 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) {
int32_t i = 0;
for (i = 0; i < nCount; i++) {
const FDE_TEXTEDITPIECE* pPiece = m_PieceMassArr.GetPtrAt(i);
- if (!bInLine && (bVertical ? (pPiece->rtPiece.left <= ptF.x &&
- pPiece->rtPiece.right() > ptF.x)
- : (pPiece->rtPiece.top <= ptF.y &&
- pPiece->rtPiece.bottom() > ptF.y))) {
+ if (!bInLine &&
+ (pPiece->rtPiece.top <= ptF.y && pPiece->rtPiece.bottom() > ptF.y)) {
nBgn = nEnd = i;
rtLine = pPiece->rtPiece;
bInLine = true;
} else if (bInLine) {
- if (bVertical ? (!(pPiece->rtPiece.left <= ptF.x &&
- pPiece->rtPiece.right() > ptF.x))
- : (pPiece->rtPiece.bottom() <= ptF.y ||
- pPiece->rtPiece.top > ptF.y)) {
+ if (pPiece->rtPiece.bottom() <= ptF.y || pPiece->rtPiece.top > ptF.y) {
nEnd = i - 1;
break;
} else {
@@ -142,9 +135,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) {
bBefore = true;
return nCaret;
}
- if (bVertical
- ? (ptF.y > ((rectArr[j].top + rectArr[j].bottom()) / 2))
- : (ptF.x > ((rectArr[j].left + rectArr[j].right()) / 2))) {
+ if (ptF.x > ((rectArr[j].left + rectArr[j].right()) / 2)) {
bBefore = FX_IsOdd(pPiece->nBidiLevel);
} else {
bBefore = !FX_IsOdd(pPiece->nBidiLevel);
@@ -293,15 +284,9 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
m_pEndParag->LoadParag();
m_pEndParag->GetLineRange(nEndLine - nEndLineInParag, nPageEnd, nTemp);
nPageEnd += (nTemp - 1);
- bool bVertial = pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical;
- bool bLineReserve =
- !!(pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve);
- FX_FLOAT fLineStart =
- bVertial
- ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f)
- : 0.0f;
- FX_FLOAT fLineStep =
- (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace;
+
+ FX_FLOAT fLineStart = 0.0f;
+ FX_FLOAT fLineStep = pParams->fLineSpace;
FX_FLOAT fLinePos = fLineStart;
if (!m_pTextSet)
m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this);
@@ -366,19 +351,13 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
}
}
}
- if (pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
- TxtEdtPiece.rtPiece.left = fLinePos;
- TxtEdtPiece.rtPiece.top = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
- TxtEdtPiece.rtPiece.width = pParams->fLineSpace;
- TxtEdtPiece.rtPiece.height =
- (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth;
- } else {
- TxtEdtPiece.rtPiece.left = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
- TxtEdtPiece.rtPiece.top = fLinePos;
- TxtEdtPiece.rtPiece.width =
- (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth;
- TxtEdtPiece.rtPiece.height = pParams->fLineSpace;
- }
+
+ TxtEdtPiece.rtPiece.left = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
+ TxtEdtPiece.rtPiece.top = fLinePos;
+ TxtEdtPiece.rtPiece.width =
+ (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth;
+ TxtEdtPiece.rtPiece.height = pParams->fLineSpace;
+
if (bFirstPiece) {
m_rtPageContents = TxtEdtPiece.rtPiece;
bFirstPiece = false;
diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h
index 56b8daa1b6..12f0cd88bf 100644
--- a/xfa/fde/ifde_txtedtengine.h
+++ b/xfa/fde/ifde_txtedtengine.h
@@ -19,27 +19,16 @@ class CFWL_Edit;
#define FDE_TEXTEDITMODE_ReadOnly (1L << 2)
#define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3)
#define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4)
-#define FDE_TEXTEDITMODE_NoRedoUndo (1L << 5)
-#define FDE_TEXTEDITMODE_FIELD_TAB (1L << 6)
-#define FDE_TEXTEDITMODE_FIELD_AUTO (1L << 7)
#define FDE_TEXTEDITMODE_Validate (1L << 8)
#define FDE_TEXTEDITMODE_Password (1L << 9)
-#define FDE_TEXTEDITALIGN_Left (0L << 0)
+#define FDE_TEXTEDITALIGN_Left 0
#define FDE_TEXTEDITALIGN_Center (1L << 0)
#define FDE_TEXTEDITALIGN_Right (2L << 0)
#define FDE_TEXTEDITALIGN_Normal (1L << 3)
#define FDE_TEXTEDITALIGN_Justified (1L << 4)
-#define FDE_TEXTEDITALIGN_Distributed (1L << 5)
-#define FDE_TEXTEDITLAYOUT_DocVertical (1L << 0)
-#define FDE_TEXTEDITLAYOUT_CharVertial (1L << 1)
-#define FDE_TEXTEDITLAYOUT_LineReserve (1L << 2)
-#define FDE_TEXTEDITLAYOUT_RTL (1L << 3)
#define FDE_TEXTEDITLAYOUT_CombText (1L << 4)
-#define FDE_TEXTEDITLAYOUT_ExpandTab (1L << 5)
-#define FDE_TEXTEDITLAYOUT_ArabicContext (1L << 6)
-#define FDE_TEXTEDITLAYOUT_ArabicShapes (1L << 7)
#define FDE_TEXTEDITLAYOUT_LastLineHeight (1L << 8)
enum FDE_TXTEDTMOVECARET {
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 5cf3f2f006..5cd0c90ac8 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -373,14 +373,10 @@ bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
}
bool CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) {
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo)
- return true;
return m_EdtEngine.Redo(pRecord);
}
bool CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) {
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo)
- return true;
return m_EdtEngine.Undo(pRecord);
}
@@ -541,8 +537,7 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
mt.Concat(*pMatrix);
}
- bool bShowSel = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoHideSel) ||
- (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused);
+ bool bShowSel = !!(m_pProperties->m_dwStates & FWL_WGTSTATE_Focused);
if (bShowSel) {
CFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this);
if (pForm) {
@@ -638,18 +633,6 @@ void CFWL_Edit::UpdateEditParams() {
params.nHorzScale = 100;
params.fPlateWidth = m_rtEngine.width;
params.fPlateHeight = m_rtEngine.height;
- if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_RTLLayout)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_RTL;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VerticalLayout)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_DocVertical;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VerticalChars)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_CharVertial;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReverseLine)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_LineReserve;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ArabicShapes)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_ArabicShapes;
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ExpandTab)
- params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_ExpandTab;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText)
params.dwLayoutStyles |= FDE_TEXTEDITLAYOUT_CombText;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_LastLineHeight)
@@ -680,10 +663,6 @@ void CFWL_Edit::UpdateEditParams() {
params.dwAlignment |= FDE_TEXTEDITALIGN_Justified;
break;
}
- case FWL_STYLEEXT_EDT_Distributed: {
- params.dwAlignment |= FDE_TEXTEDITALIGN_Distributed;
- break;
- }
default: {
params.dwAlignment |= FDE_TEXTEDITALIGN_Normal;
break;
@@ -1239,17 +1218,9 @@ bool CFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) {
}
void CFWL_Edit::InitCaret() {
- if (!m_pCaret) {
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) {
- m_pCaret = pdfium::MakeUnique<CFWL_Caret>(
- m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
- m_pCaret->SetParent(this);
- m_pCaret->SetStates(m_pProperties->m_dwStates);
- }
- } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) ==
- 0) {
- m_pCaret.reset();
- }
+ if (!m_pCaret)
+ return;
+ m_pCaret.reset();
}
void CFWL_Edit::ClearRecord() {
@@ -1352,8 +1323,7 @@ void CFWL_Edit::DoButtonDown(CFWL_MessageMouse* pMsg) {
}
void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
- uint32_t dwStyleEx = GetStylesEx();
- bool bRepaint = !!(dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret);
+ bool bRepaint = false;
if (bSet) {
m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
@@ -1363,15 +1333,15 @@ void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
} else if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) {
m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
HideCaret(nullptr);
- if ((dwStyleEx & FWL_STYLEEXT_EDT_NoHideSel) == 0) {
- int32_t nSel = CountSelRanges();
- if (nSel > 0) {
- ClearSelections();
- bRepaint = true;
- }
- m_EdtEngine.SetCaretPos(0, true);
- UpdateOffset();
+
+ int32_t nSel = CountSelRanges();
+ if (nSel > 0) {
+ ClearSelections();
+ bRepaint = true;
}
+ m_EdtEngine.SetCaretPos(0, true);
+ UpdateOffset();
+
ClearRecord();
}
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index f975bb2ba4..4193e735f9 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -21,31 +21,22 @@
#define FWL_STYLEEXT_EDT_ReadOnly (1L << 0)
#define FWL_STYLEEXT_EDT_MultiLine (1L << 1)
#define FWL_STYLEEXT_EDT_WantReturn (1L << 2)
-#define FWL_STYLEEXT_EDT_NoHideSel (1L << 3)
#define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4)
#define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5)
-#define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6)
#define FWL_STYLEEXT_EDT_Validate (1L << 7)
#define FWL_STYLEEXT_EDT_Password (1L << 8)
#define FWL_STYLEEXT_EDT_Number (1L << 9)
-#define FWL_STYLEEXT_EDT_VerticalLayout (1L << 12)
-#define FWL_STYLEEXT_EDT_VerticalChars (1L << 13)
-#define FWL_STYLEEXT_EDT_ReverseLine (1L << 14)
-#define FWL_STYLEEXT_EDT_ArabicShapes (1L << 15)
-#define FWL_STYLEEXT_EDT_ExpandTab (1L << 16)
#define FWL_STYLEEXT_EDT_CombText (1L << 17)
-#define FWL_STYLEEXT_EDT_HNear (0L << 18)
+#define FWL_STYLEEXT_EDT_HNear 0
#define FWL_STYLEEXT_EDT_HCenter (1L << 18)
#define FWL_STYLEEXT_EDT_HFar (2L << 18)
-#define FWL_STYLEEXT_EDT_VNear (0L << 20)
+#define FWL_STYLEEXT_EDT_VNear 0
#define FWL_STYLEEXT_EDT_VCenter (1L << 20)
#define FWL_STYLEEXT_EDT_VFar (2L << 20)
#define FWL_STYLEEXT_EDT_Justified (1L << 22)
-#define FWL_STYLEEXT_EDT_Distributed (2L << 22)
#define FWL_STYLEEXT_EDT_HAlignMask (3L << 18)
#define FWL_STYLEEXT_EDT_VAlignMask (3L << 20)
#define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22)
-#define FWL_STYLEEXT_EDT_InnerCaret (1L << 24)
#define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25)
#define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
#define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
diff --git a/xfa/fwl/fwl_widgetdef.h b/xfa/fwl/fwl_widgetdef.h
index 20013b0e4c..a11c211abd 100644
--- a/xfa/fwl/fwl_widgetdef.h
+++ b/xfa/fwl/fwl_widgetdef.h
@@ -24,7 +24,6 @@
#define FWL_WGTSTYLE_VCenterAlignment (1L << 15)
#define FWL_WGTSTYLE_BottomAlignment (2L << 15)
#define FWL_WGTSTYLE_RTLReading (1L << 17)
-#define FWL_WGTSTYLE_RTLLayout (1L << 18)
#define FWL_WGTSTYLE_EdgeNone (0L << 19)
#define FWL_WGTSTYLE_EdgeFlat (1L << 19)
#define FWL_WGTSTYLE_EdgeRaised (2L << 19)