• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FDE_IFDE_TXTEDTENGINE_H_
8 #define XFA_FDE_IFDE_TXTEDTENGINE_H_
9 
10 #include "core/fxge/fx_dib.h"
11 #include "xfa/fgas/font/cfgas_fontmgr.h"
12 
13 class CFDE_TxtEdtEngine;
14 class IFDE_TxtEdtPage;
15 class CFWL_Edit;
16 
17 #define FDE_TEXTEDITMODE_MultiLines (1L << 0)
18 #define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1)
19 #define FDE_TEXTEDITMODE_ReadOnly (1L << 2)
20 #define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3)
21 #define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4)
22 #define FDE_TEXTEDITMODE_Validate (1L << 8)
23 #define FDE_TEXTEDITMODE_Password (1L << 9)
24 
25 #define FDE_TEXTEDITALIGN_Left 0
26 #define FDE_TEXTEDITALIGN_Center (1L << 0)
27 #define FDE_TEXTEDITALIGN_Right (2L << 0)
28 #define FDE_TEXTEDITALIGN_Normal (1L << 3)
29 #define FDE_TEXTEDITALIGN_Justified (1L << 4)
30 
31 #define FDE_TEXTEDITLAYOUT_CombText (1L << 4)
32 #define FDE_TEXTEDITLAYOUT_LastLineHeight (1L << 8)
33 
34 enum FDE_TXTEDTMOVECARET {
35   MC_MoveNone = 0,
36   MC_Left,
37   MC_Right,
38   MC_Up,
39   MC_Down,
40   MC_WordBackward,
41   MC_WordForward,
42   MC_LineStart,
43   MC_LineEnd,
44   MC_ParagStart,
45   MC_ParagEnd,
46   MC_PageUp,
47   MC_PageDown,
48   MC_Home,
49   MC_End,
50 };
51 
52 enum FDE_TXTEDT_MODIFY_RET {
53   FDE_TXTEDT_MODIFY_RET_F_Tab = -6,
54   FDE_TXTEDT_MODIFY_RET_F_Locked = -5,
55   FDE_TXTEDT_MODIFY_RET_F_Invalidate = -4,
56   FDE_TXTEDT_MODIFY_RET_F_Boundary = -3,
57   FDE_TXTEDT_MODIFY_RET_F_Full = -2,
58   FDE_TXTEDT_MODIFY_RET_F_Normal = -1,
59   FDE_TXTEDT_MODIFY_RET_S_Normal = 0,
60   FDE_TXTEDT_MODIFY_RET_S_Full = 1,
61   FDE_TXTEDT_MODIFY_RET_S_Part = 2,
62   FDE_TXTEDT_MODIFY_RET_S_Empty = 3,
63   FDE_TXTEDT_MODIFY_RET_T_Tab = 4,
64 };
65 
66 enum FDE_TXTEDIT_LINEEND {
67   FDE_TXTEDIT_LINEEND_Auto,
68   FDE_TXTEDIT_LINEEND_CRLF,
69   FDE_TXTEDIT_LINEEND_CR,
70   FDE_TXTEDIT_LINEEND_LF,
71 };
72 
73 struct FDE_TXTEDTPARAMS {
74   FDE_TXTEDTPARAMS();
75   ~FDE_TXTEDTPARAMS();
76 
77   FX_FLOAT fPlateWidth;
78   FX_FLOAT fPlateHeight;
79   int32_t nLineCount;
80   uint32_t dwLayoutStyles;
81   uint32_t dwAlignment;
82   uint32_t dwMode;
83   CFX_RetainPtr<CFGAS_GEFont> pFont;
84   FX_FLOAT fFontSize;
85   FX_ARGB dwFontColor;
86   FX_FLOAT fLineSpace;
87   FX_FLOAT fTabWidth;
88   bool bTabEquidistant;
89   FX_WCHAR wDefChar;
90   FX_WCHAR wLineBreakChar;
91   int32_t nCharRotation;
92   int32_t nLineEnd;
93   int32_t nHorzScale;
94   FX_FLOAT fCharSpace;
95   CFWL_Edit* pEventSink;
96 };
97 
98 enum FDE_TXTEDT_TEXTCHANGE_TYPE {
99   FDE_TXTEDT_TEXTCHANGE_TYPE_Insert = 0,
100   FDE_TXTEDT_TEXTCHANGE_TYPE_Delete,
101   FDE_TXTEDT_TEXTCHANGE_TYPE_Replace,
102 };
103 
104 struct FDE_TXTEDT_TEXTCHANGE_INFO {
105   FDE_TXTEDT_TEXTCHANGE_INFO();
106   ~FDE_TXTEDT_TEXTCHANGE_INFO();
107 
108   int32_t nChangeType;
109   CFX_WideString wsInsert;
110   CFX_WideString wsDelete;
111   CFX_WideString wsPrevText;
112 };
113 
114 #endif  // XFA_FDE_IFDE_TXTEDTENGINE_H_
115