summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/cfwl_edit.cpp96
-rw-r--r--xfa/fwl/cfwl_edit.h6
-rw-r--r--xfa/fwl/cfwl_event.h1
-rw-r--r--xfa/fwl/cfwl_eventcheckword.cpp12
-rw-r--r--xfa/fwl/cfwl_eventcheckword.h21
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp12
-rw-r--r--xfa/fxfa/cxfa_fftextedit.h1
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp10
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h5
9 files changed, 0 insertions, 164 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);
}
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index 9c667f5e14..894315de82 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -114,7 +114,6 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate {
void DrawContent(CXFA_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
- void DrawSpellCheck(CXFA_Graphics* pGraphics, const CFX_Matrix* pMatrix);
void UpdateEditEngine();
void UpdateEditParams();
@@ -134,11 +133,6 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate {
bool ValidateNumberChar(wchar_t cNum);
bool IsShowScrollBar(bool bVert);
bool IsContentHeightOverflow();
- void AddSpellCheckObj(CXFA_GEPath& PathData,
- int32_t nStart,
- int32_t nCount,
- float fOffSetX,
- float fOffSetY);
void SetCursorPosition(size_t position);
void UpdateCursorRect();
diff --git a/xfa/fwl/cfwl_event.h b/xfa/fwl/cfwl_event.h
index 01e3914b8b..787f8c2640 100644
--- a/xfa/fwl/cfwl_event.h
+++ b/xfa/fwl/cfwl_event.h
@@ -20,7 +20,6 @@ class CFWL_Event {
public:
enum class Type {
CheckStateChanged,
- CheckWord,
Click,
Close,
EditChanged,
diff --git a/xfa/fwl/cfwl_eventcheckword.cpp b/xfa/fwl/cfwl_eventcheckword.cpp
deleted file mode 100644
index fb0ce6e77e..0000000000
--- a/xfa/fwl/cfwl_eventcheckword.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fwl/cfwl_eventcheckword.h"
-
-CFWL_EventCheckWord::CFWL_EventCheckWord(CFWL_Widget* pSrcTarget)
- : CFWL_Event(CFWL_Event::Type::CheckWord, pSrcTarget) {}
-
-CFWL_EventCheckWord::~CFWL_EventCheckWord() {}
diff --git a/xfa/fwl/cfwl_eventcheckword.h b/xfa/fwl/cfwl_eventcheckword.h
deleted file mode 100644
index fafe3d3278..0000000000
--- a/xfa/fwl/cfwl_eventcheckword.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CFWL_EVENTCHECKWORD_H_
-#define XFA_FWL_CFWL_EVENTCHECKWORD_H_
-
-#include "xfa/fwl/cfwl_event.h"
-
-class CFWL_EventCheckWord : public CFWL_Event {
- public:
- explicit CFWL_EventCheckWord(CFWL_Widget* pSrcTarget);
- ~CFWL_EventCheckWord() override;
-
- ByteString bsWord;
- bool bCheckWord;
-};
-
-#endif // XFA_FWL_CFWL_EVENTCHECKWORD_H_
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 51ee1478e1..9861b5253c 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -10,7 +10,6 @@
#include "xfa/fwl/cfwl_datetimepicker.h"
#include "xfa/fwl/cfwl_edit.h"
-#include "xfa/fwl/cfwl_eventcheckword.h"
#include "xfa/fwl/cfwl_eventtarget.h"
#include "xfa/fwl/cfwl_eventtextchanged.h"
#include "xfa/fwl/cfwl_messagekillfocus.h"
@@ -327,11 +326,6 @@ void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Full, &eParam);
}
-bool CXFA_FFTextEdit::CheckWord(const ByteStringView& sWord) {
- return sWord.IsEmpty() ||
- m_pNode->GetFFWidgetType() != XFA_FFWidgetType::kTextEdit;
-}
-
void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
m_pOldDelegate->OnProcessMessage(pMessage);
}
@@ -350,12 +344,6 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
OnTextFull(m_pNormalWidget.get());
break;
}
- case CFWL_Event::Type::CheckWord: {
- WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
- CFWL_EventCheckWord* event = static_cast<CFWL_EventCheckWord*>(pEvent);
- event->bCheckWord = CheckWord(event->bsWord.AsStringView());
- break;
- }
default:
break;
}
diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h
index e21bcb1da1..1388db5099 100644
--- a/xfa/fxfa/cxfa_fftextedit.h
+++ b/xfa/fxfa/cxfa_fftextedit.h
@@ -39,7 +39,6 @@ class CXFA_FFTextEdit : public CXFA_FFField {
const WideString& wsChanged,
const WideString& wsPrevText);
void OnTextFull(CFWL_Widget* pWidget);
- bool CheckWord(const ByteStringView& sWord);
// CXFA_FFWidget
bool CanUndo() override;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index f16e1ea573..629f3bd188 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -501,16 +501,6 @@ FormFieldType CXFA_FFWidget::GetFormFieldType() {
return FormFieldType::kXFA;
}
-void CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf,
- std::vector<ByteString>* pWords) {
- pWords->clear();
-}
-
-bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
- const ByteStringView& bsReplace) {
- return false;
-}
-
CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) {
CFX_Matrix mt = GetRotateMatrix();
if (mt.IsIdentity())
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 2b72aa54a1..5098230b62 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -138,11 +138,6 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
virtual FormFieldType GetFormFieldType();
- // TODO(tsepez): Implement or remove.
- void GetSuggestWords(CFX_PointF pointf, std::vector<ByteString>* pWords);
- bool ReplaceSpellCheckWord(CFX_PointF pointf,
- const ByteStringView& bsReplace);
-
CXFA_FFPageView* GetPageView() const { return m_pPageView; }
void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
const CFX_RectF& GetWidgetRect() const;