summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-04-05 14:54:34 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-05 14:54:34 +0000
commit14f8897509d9db8739951a90488fb1634a497db5 (patch)
treed8f90d40f94afeecffd24090ac1dc3571c0c6587 /xfa/fwl/cfwl_edit.cpp
parent32942201a456ace47c052536cba594be03e9aa6c (diff)
downloadpdfium-14f8897509d9db8739951a90488fb1634a497db5.tar.xz
Remove spellchecking code from XFAchromium/3390
The existing code for spellchecking is non-functional and we are not planning on fixing/finishing it, so removing it, since it currently is marking everything as misspelt. BUG=pdfium:1054 Change-Id: I23aaa13c09aed483376d7d06f47fdf31d890786b Reviewed-on: https://pdfium-review.googlesource.com/29790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 0067cab20a..733961eead 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -19,7 +19,6 @@
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_caret.h"
#include "xfa/fwl/cfwl_event.h"
-#include "xfa/fwl/cfwl_eventcheckword.h"
#include "xfa/fwl/cfwl_eventtextchanged.h"
#include "xfa/fwl/cfwl_eventvalidate.h"
#include "xfa/fwl/cfwl_messagekey.h"
@@ -43,23 +42,6 @@ constexpr int kEditingModifier = FWL_KEYFLAG_Command;
constexpr int kEditingModifier = FWL_KEYFLAG_Ctrl;
#endif
-bool FxEditIsLatinWord(wchar_t c) {
- return c == 0x2D || (c <= 0x005A && c >= 0x0041) ||
- (c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) ||
- c == 0x0027;
-}
-
-void AddSquigglyPath(CXFA_GEPath* pPathData,
- float fStartX,
- float fEndX,
- float fY,
- float fStep) {
- pPathData->MoveTo(CFX_PointF(fStartX, fY));
- int i = 1;
- for (float fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i)
- pPathData->LineTo(CFX_PointF(fx, fY + (i & 1) * fStep));
-}
-
} // namespace
CFWL_Edit::CFWL_Edit(const CFWL_App* app,
@@ -162,80 +144,6 @@ FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) {
return FWL_WidgetHit::Unknown;
}
-void CFWL_Edit::AddSpellCheckObj(CXFA_GEPath& PathData,
- int32_t nStart,
- int32_t nCount,
- float fOffSetX,
- float fOffSetY) {
- float fStep = m_EdtEngine.GetFontSize() / 16.0f;
- float font_ascent = m_EdtEngine.GetFontAscent();
-
- std::vector<CFX_RectF> rects =
- m_EdtEngine.GetCharacterRectsInRange(nStart, nCount);
- for (const auto& rect : rects) {
- float fY = rect.top + font_ascent + fOffSetY;
- float fStartX = rect.left + fOffSetX;
- float fEndX = fStartX + rect.Width();
-
- AddSquigglyPath(&PathData, fStartX, fEndX, fY, fStep);
- }
-}
-
-void CFWL_Edit::DrawSpellCheck(CXFA_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- pGraphics->SaveGraphState();
- if (pMatrix)
- pGraphics->ConcatMatrix(pMatrix);
-
- CFWL_EventCheckWord checkWordEvent(this);
- ByteString sLatinWord;
- CXFA_GEPath pathSpell;
- int32_t nStart = 0;
- float fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
- float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
- WideString wsSpell = GetText();
- int32_t nContentLen = wsSpell.GetLength();
- for (int i = 0; i < nContentLen; i++) {
- if (FxEditIsLatinWord(wsSpell[i])) {
- if (sLatinWord.IsEmpty())
- nStart = i;
- sLatinWord += (char)wsSpell[i];
- continue;
- }
- checkWordEvent.bsWord = sLatinWord;
- checkWordEvent.bCheckWord = true;
- DispatchEvent(&checkWordEvent);
-
- if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) {
- AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX,
- fOffSetY);
- }
- sLatinWord.clear();
- }
-
- checkWordEvent.bsWord = sLatinWord;
- checkWordEvent.bCheckWord = true;
- DispatchEvent(&checkWordEvent);
-
- if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) {
- AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX,
- fOffSetY);
- }
- if (!pathSpell.IsEmpty()) {
- CFX_RectF rtClip = m_rtEngine;
- CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
- if (pMatrix) {
- rtClip = pMatrix->TransformRect(rtClip);
- mt.Concat(*pMatrix);
- }
- pGraphics->SetClipRect(rtClip);
- pGraphics->SetStrokeColor(CXFA_GEColor(0xFFFF0000));
- pGraphics->SetLineWidth(0);
- pGraphics->StrokePath(&pathSpell, nullptr);
- }
- pGraphics->RestoreGraphState();
-}
-
void CFWL_Edit::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) {
if (!pGraphics)
return;
@@ -249,10 +157,6 @@ void CFWL_Edit::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) {
DrawTextBk(pGraphics, pTheme, &matrix);
DrawContent(pGraphics, pTheme, &matrix);
- if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) &&
- !(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly)) {
- DrawSpellCheck(pGraphics, &matrix);
- }
if (HasBorder())
DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix);
}