summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn1
-rw-r--r--xfa/fde/cfde_rendercontext.cpp3
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp55
-rw-r--r--xfa/fde/cfde_txtedtengine.h74
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp1
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp1
-rw-r--r--xfa/fde/ifde_txtedtengine.h111
-rw-r--r--xfa/fwl/cfwl_edit.cpp8
8 files changed, 88 insertions, 166 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 846e8a5ec8..5b8b337a67 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1479,7 +1479,6 @@ if (pdf_enable_xfa) {
"xfa/fde/cfde_visualsetiterator.cpp",
"xfa/fde/cfde_visualsetiterator.h",
"xfa/fde/ifde_txtedtdorecord.h",
- "xfa/fde/ifde_txtedtengine.h",
"xfa/fde/ifde_txtedtpage.h",
"xfa/fgas/crt/cfgas_formatstring.cpp",
"xfa/fgas/crt/cfgas_formatstring.h",
diff --git a/xfa/fde/cfde_rendercontext.cpp b/xfa/fde/cfde_rendercontext.cpp
index 7e7baebee2..dd6dfa0aee 100644
--- a/xfa/fde/cfde_rendercontext.cpp
+++ b/xfa/fde/cfde_rendercontext.cpp
@@ -11,9 +11,6 @@
#include "xfa/fde/cfde_renderdevice.h"
#include "xfa/fde/cfde_txtedttextset.h"
-#define FDE_PATHRENDER_Stroke 1
-#define FDE_PATHRENDER_Fill 2
-
CFDE_RenderContext::CFDE_RenderContext()
: m_pRenderDevice(nullptr), m_Transform() {
m_Transform.SetIdentity();
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index aaf0d21712..4701d452aa 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -25,6 +25,22 @@ namespace {
const uint32_t kPageWidthMax = 0xffff;
const uint32_t kUnicodeParagraphSeparator = 0x2029;
+enum FDE_TXTEDT_MODIFY_RET {
+ FDE_TXTEDT_MODIFY_RET_F_Locked = -5,
+ FDE_TXTEDT_MODIFY_RET_F_Invalidate = -4,
+ FDE_TXTEDT_MODIFY_RET_F_Boundary = -3,
+ FDE_TXTEDT_MODIFY_RET_F_Full = -2,
+ FDE_TXTEDT_MODIFY_RET_S_Normal = 0,
+ FDE_TXTEDT_MODIFY_RET_S_Part = 2,
+};
+
+enum FDE_TXTEDIT_LINEEND {
+ FDE_TXTEDIT_LINEEND_Auto,
+ FDE_TXTEDIT_LINEEND_CRLF,
+ FDE_TXTEDIT_LINEEND_CR,
+ FDE_TXTEDIT_LINEEND_LF,
+};
+
} // namespace
FDE_TXTEDTPARAMS::FDE_TXTEDTPARAMS()
@@ -252,26 +268,12 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
UpdateCaretIndex(ptCaret);
break;
}
- case MC_WordBackward:
- break;
- case MC_WordForward:
- break;
case MC_LineStart:
MoveLineStart();
break;
case MC_LineEnd:
MoveLineEnd();
break;
- case MC_ParagStart:
- MoveParagStart();
- break;
- case MC_ParagEnd:
- MoveParagEnd();
- break;
- case MC_PageDown:
- break;
- case MC_PageUp:
- break;
case MC_Home:
MoveHome();
break;
@@ -1281,31 +1283,6 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() {
return true;
}
-bool CFDE_TxtEdtEngine::MoveParagStart() {
- FDE_TXTEDTPARAGPOS ParagPos;
- TextPos2ParagPos(m_bBefore ? m_nCaret : m_nCaret - 1, ParagPos);
- UpdateCaretRect(m_ParagPtrArray[ParagPos.nParagIndex]->GetStartIndex(), true);
- return true;
-}
-
-bool CFDE_TxtEdtEngine::MoveParagEnd() {
- int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1;
- FDE_TXTEDTPARAGPOS ParagPos;
- TextPos2ParagPos(nIndex, ParagPos);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex].get();
- nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1;
- wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex);
- if (wChar == L'\n' && nIndex > 0) {
- nIndex--;
- wChar = m_pTxtBuf->GetCharByIndex(nIndex);
- if (wChar != L'\r') {
- nIndex++;
- }
- }
- UpdateCaretRect(nIndex, true);
- return true;
-}
-
bool CFDE_TxtEdtEngine::MoveHome() {
UpdateCaretRect(0, true);
return true;
diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h
index 31883fc3c8..2a38e4ea81 100644
--- a/xfa/fde/cfde_txtedtengine.h
+++ b/xfa/fde/cfde_txtedtengine.h
@@ -11,15 +11,85 @@
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fde/ifde_txtedtengine.h"
+#include "core/fxcrt/cfx_seekablestreamproxy.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/fx_dib.h"
class CFDE_TxtEdtBuf;
class CFDE_TxtEdtPage;
class CFDE_TxtEdtParag;
+class CFGAS_GEFont;
+class CFWL_Edit;
class CFX_TxtBreak;
class IFDE_TxtEdtDoRecord;
class IFX_CharIter;
+#define FDE_TEXTEDITMODE_MultiLines (1L << 0)
+#define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1)
+#define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3)
+#define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4)
+#define FDE_TEXTEDITMODE_Validate (1L << 8)
+#define FDE_TEXTEDITMODE_Password (1L << 9)
+
+#define FDE_TEXTEDITALIGN_Left 0
+#define FDE_TEXTEDITALIGN_Center (1L << 0)
+#define FDE_TEXTEDITALIGN_Right (1L << 1)
+#define FDE_TEXTEDITALIGN_Justified (1L << 4)
+
+#define FDE_TEXTEDITLAYOUT_CombText (1L << 4)
+#define FDE_TEXTEDITLAYOUT_LastLineHeight (1L << 8)
+
+enum FDE_TXTEDTMOVECARET {
+ MC_MoveNone = 0,
+ MC_Left,
+ MC_Right,
+ MC_Up,
+ MC_Down,
+ MC_LineStart,
+ MC_LineEnd,
+ MC_Home,
+ MC_End,
+};
+
+struct FDE_TXTEDTPARAMS {
+ FDE_TXTEDTPARAMS();
+ ~FDE_TXTEDTPARAMS();
+
+ float fPlateWidth;
+ float fPlateHeight;
+ int32_t nLineCount;
+ uint32_t dwLayoutStyles;
+ uint32_t dwAlignment;
+ uint32_t dwMode;
+ CFX_RetainPtr<CFGAS_GEFont> pFont;
+ float fFontSize;
+ FX_ARGB dwFontColor;
+ float fLineSpace;
+ float fTabWidth;
+ wchar_t wDefChar;
+ wchar_t wLineBreakChar;
+ int32_t nLineEnd;
+ int32_t nHorzScale;
+ float fCharSpace;
+ CFWL_Edit* pEventSink;
+};
+
+enum FDE_TXTEDT_TEXTCHANGE_TYPE {
+ FDE_TXTEDT_TEXTCHANGE_TYPE_Insert = 0,
+ FDE_TXTEDT_TEXTCHANGE_TYPE_Delete,
+ FDE_TXTEDT_TEXTCHANGE_TYPE_Replace,
+};
+
+struct FDE_TXTEDT_TEXTCHANGE_INFO {
+ FDE_TXTEDT_TEXTCHANGE_INFO();
+ ~FDE_TXTEDT_TEXTCHANGE_INFO();
+
+ int32_t nChangeType;
+ CFX_WideString wsInsert;
+ CFX_WideString wsDelete;
+ CFX_WideString wsPrevText;
+};
+
class CFDE_TxtEdtEngine {
public:
CFDE_TxtEdtEngine();
@@ -132,8 +202,6 @@ class CFDE_TxtEdtEngine {
bool MoveDown(CFX_PointF& ptCaret);
bool MoveLineStart();
bool MoveLineEnd();
- bool MoveParagStart();
- bool MoveParagEnd();
bool MoveHome();
bool MoveEnd();
bool IsFitArea(CFX_WideString& wsText);
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 4f1e8fb7f0..5008ca15ce 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -15,7 +15,6 @@
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtparag.h"
#include "xfa/fde/cfde_txtedttextset.h"
-#include "xfa/fde/ifde_txtedtengine.h"
#include "xfa/fgas/layout/cfx_txtbreak.h"
namespace {
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index c6b13007c9..31b935759f 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -14,7 +14,6 @@
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fde/ifde_txtedtengine.h"
#include "xfa/fgas/layout/cfx_txtbreak.h"
CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h
deleted file mode 100644
index 7fef6f0315..0000000000
--- a/xfa/fde/ifde_txtedtengine.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2014 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_FDE_IFDE_TXTEDTENGINE_H_
-#define XFA_FDE_IFDE_TXTEDTENGINE_H_
-
-#include "core/fxge/fx_dib.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-
-class CFDE_TxtEdtEngine;
-class CFWL_Edit;
-
-#define FDE_TEXTEDITMODE_MultiLines (1L << 0)
-#define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1)
-#define FDE_TEXTEDITMODE_ReadOnly (1L << 2)
-#define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3)
-#define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4)
-#define FDE_TEXTEDITMODE_Validate (1L << 8)
-#define FDE_TEXTEDITMODE_Password (1L << 9)
-
-#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_TEXTEDITLAYOUT_CombText (1L << 4)
-#define FDE_TEXTEDITLAYOUT_LastLineHeight (1L << 8)
-
-enum FDE_TXTEDTMOVECARET {
- MC_MoveNone = 0,
- MC_Left,
- MC_Right,
- MC_Up,
- MC_Down,
- MC_WordBackward,
- MC_WordForward,
- MC_LineStart,
- MC_LineEnd,
- MC_ParagStart,
- MC_ParagEnd,
- MC_PageUp,
- MC_PageDown,
- MC_Home,
- MC_End,
-};
-
-enum FDE_TXTEDT_MODIFY_RET {
- FDE_TXTEDT_MODIFY_RET_F_Tab = -6,
- FDE_TXTEDT_MODIFY_RET_F_Locked = -5,
- FDE_TXTEDT_MODIFY_RET_F_Invalidate = -4,
- FDE_TXTEDT_MODIFY_RET_F_Boundary = -3,
- FDE_TXTEDT_MODIFY_RET_F_Full = -2,
- FDE_TXTEDT_MODIFY_RET_F_Normal = -1,
- FDE_TXTEDT_MODIFY_RET_S_Normal = 0,
- FDE_TXTEDT_MODIFY_RET_S_Full = 1,
- FDE_TXTEDT_MODIFY_RET_S_Part = 2,
- FDE_TXTEDT_MODIFY_RET_S_Empty = 3,
- FDE_TXTEDT_MODIFY_RET_T_Tab = 4,
-};
-
-enum FDE_TXTEDIT_LINEEND {
- FDE_TXTEDIT_LINEEND_Auto,
- FDE_TXTEDIT_LINEEND_CRLF,
- FDE_TXTEDIT_LINEEND_CR,
- FDE_TXTEDIT_LINEEND_LF,
-};
-
-struct FDE_TXTEDTPARAMS {
- FDE_TXTEDTPARAMS();
- ~FDE_TXTEDTPARAMS();
-
- float fPlateWidth;
- float fPlateHeight;
- int32_t nLineCount;
- uint32_t dwLayoutStyles;
- uint32_t dwAlignment;
- uint32_t dwMode;
- CFX_RetainPtr<CFGAS_GEFont> pFont;
- float fFontSize;
- FX_ARGB dwFontColor;
- float fLineSpace;
- float fTabWidth;
- wchar_t wDefChar;
- wchar_t wLineBreakChar;
- int32_t nLineEnd;
- int32_t nHorzScale;
- float fCharSpace;
- CFWL_Edit* pEventSink;
-};
-
-enum FDE_TXTEDT_TEXTCHANGE_TYPE {
- FDE_TXTEDT_TEXTCHANGE_TYPE_Insert = 0,
- FDE_TXTEDT_TEXTCHANGE_TYPE_Delete,
- FDE_TXTEDT_TEXTCHANGE_TYPE_Replace,
-};
-
-struct FDE_TXTEDT_TEXTCHANGE_INFO {
- FDE_TXTEDT_TEXTCHANGE_INFO();
- ~FDE_TXTEDT_TEXTCHANGE_INFO();
-
- int32_t nChangeType;
- CFX_WideString wsInsert;
- CFX_WideString wsDelete;
- CFX_WideString wsPrevText;
-};
-
-#endif // XFA_FDE_IFDE_TXTEDTENGINE_H_
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 53fec0576e..a261041534 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -639,10 +639,8 @@ void CFWL_Edit::UpdateEditParams() {
params.dwAlignment |= FDE_TEXTEDITALIGN_Justified;
break;
}
- default: {
- params.dwAlignment |= FDE_TEXTEDITALIGN_Normal;
+ default:
break;
- }
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) {
params.dwMode |= FDE_TEXTEDITMODE_MultiLines;
@@ -660,10 +658,6 @@ void CFWL_Edit::UpdateEditParams() {
0) {
params.dwMode |= FDE_TEXTEDITMODE_LimitArea_Horz;
}
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) ||
- (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
- params.dwMode |= FDE_TEXTEDITMODE_ReadOnly;
- }
IFWL_ThemeProvider* theme = GetAvailableTheme();
CFWL_ThemePart part;