summaryrefslogtreecommitdiff
path: root/xfa/fde/cfde_txtedtpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/cfde_txtedtpage.cpp')
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp49
1 files changed, 14 insertions, 35 deletions
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;