Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Edit.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../core/include/fxcrt/fx_safe_types.h" 7 #include "../../../core/include/fxcrt/fx_safe_types.h"
8 #include "../../../core/include/fxcrt/fx_xml.h" 8 #include "../../../core/include/fxcrt/fx_xml.h"
9 #include "../../include/pdfwindow/PDFWindow.h" 9 #include "../../include/pdfwindow/PDFWindow.h"
10 #include "../../include/pdfwindow/PWL_Caret.h" 10 #include "../../include/pdfwindow/PWL_Caret.h"
11 #include "../../include/pdfwindow/PWL_Edit.h" 11 #include "../../include/pdfwindow/PWL_Edit.h"
12 #include "../../include/pdfwindow/PWL_EditCtrl.h" 12 #include "../../include/pdfwindow/PWL_EditCtrl.h"
13 #include "../../include/pdfwindow/PWL_FontMap.h" 13 #include "../../include/pdfwindow/PWL_FontMap.h"
14 #include "../../include/pdfwindow/PWL_ScrollBar.h" 14 #include "../../include/pdfwindow/PWL_ScrollBar.h"
15 #include "../../include/pdfwindow/PWL_Utils.h" 15 #include "../../include/pdfwindow/PWL_Utils.h"
16 #include "../../include/pdfwindow/PWL_Wnd.h" 16 #include "../../include/pdfwindow/PWL_Wnd.h"
17 17
18 /* ---------------------------- CPWL_Edit ------------------------------ */ 18 /* ---------------------------- CPWL_Edit ------------------------------ */
19 19
20 CPWL_Edit::CPWL_Edit() : m_pFillerNotify(NULL), 20 CPWL_Edit::CPWL_Edit() : m_pFillerNotify(NULL),
21 m_pSpellCheck(NULL), 21 m_pSpellCheck(NULL),
22 » m_bFocus(FALSE) 22 » m_bFocus(false)
23 { 23 {
24 m_pFormFiller = NULL; 24 m_pFormFiller = NULL;
25 } 25 }
26 26
27 CPWL_Edit::~CPWL_Edit() 27 CPWL_Edit::~CPWL_Edit()
28 { 28 {
29 » ASSERT(m_bFocus == FALSE); 29 » ASSERT(m_bFocus == false);
30 } 30 }
31 31
32 CFX_ByteString CPWL_Edit::GetClassName() const 32 CFX_ByteString CPWL_Edit::GetClassName() const
33 { 33 {
34 return PWL_CLASSNAME_EDIT; 34 return PWL_CLASSNAME_EDIT;
35 } 35 }
36 36
37 void CPWL_Edit::OnDestroy() 37 void CPWL_Edit::OnDestroy()
38 { 38 {
39 } 39 }
40 40
41 void CPWL_Edit::SetText(const FX_WCHAR* csText) 41 void CPWL_Edit::SetText(const FX_WCHAR* csText)
42 { 42 {
43 CFX_WideString swText = csText; 43 CFX_WideString swText = csText;
44 44
45 if (HasFlag(PES_RICH)) 45 if (HasFlag(PES_RICH))
46 { 46 {
47 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); 47 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText);
48 48
49 if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sV alue.GetLength())) 49 if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sV alue.GetLength()))
50 { 50 {
51 int32_t nCount = pXML->CountChildren(); 51 int32_t nCount = pXML->CountChildren();
52 » » » FX_BOOL bFirst = TRUE; 52 » » » bool bFirst = true;
53 53
54 swText.Empty(); 54 swText.Empty();
55 55
56 for (int32_t i=0; i<nCount; i++) 56 for (int32_t i=0; i<nCount; i++)
57 { 57 {
58 if (CXML_Element * pSubElement = pXML->GetElemen t(i)) 58 if (CXML_Element * pSubElement = pXML->GetElemen t(i))
59 { 59 {
60 CFX_ByteString tag=pSubElement->GetTagNa me(); 60 CFX_ByteString tag=pSubElement->GetTagNa me();
61 if (tag.EqualNoCase("p")) 61 if (tag.EqualNoCase("p"))
62 { 62 {
63 int nChild = pSubElement->CountC hildren(); 63 int nChild = pSubElement->CountC hildren();
64 CFX_WideString swSection; 64 CFX_WideString swSection;
65 for(int32_t j=0; j<nChild; j++) 65 for(int32_t j=0; j<nChild; j++)
66 { 66 {
67 swSection += pSubElement ->GetContent(j); 67 swSection += pSubElement ->GetContent(j);
68 } 68 }
69 69
70 » » » » » » if (bFirst)bFirst = FALSE; 70 » » » » » » if (bFirst)bFirst = false;
71 else 71 else
72 swText += FWL_VKEY_Retur n; 72 swText += FWL_VKEY_Retur n;
73 swText += swSection; 73 swText += swSection;
74 } 74 }
75 } 75 }
76 } 76 }
77 77
78 delete pXML; 78 delete pXML;
79 } 79 }
80 } 80 }
81 81
82 m_pEdit->SetText(swText.c_str()); 82 m_pEdit->SetText(swText.c_str());
83 } 83 }
84 84
85 void CPWL_Edit::RePosChildWnd() 85 void CPWL_Edit::RePosChildWnd()
86 { 86 {
87 if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { 87 if (CPWL_ScrollBar * pVSB = GetVScrollBar()) {
88 CPDF_Rect rcWindow = m_rcOldWindow; 88 CPDF_Rect rcWindow = m_rcOldWindow;
89 CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right, 89 CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right,
90 rcWindow.bottom, 90 rcWindow.bottom,
91 rcWindow.right + PWL_SCROLLBAR_WIDTH, 91 rcWindow.right + PWL_SCROLLBAR_WIDTH,
92 rcWindow.top); 92 rcWindow.top);
93 pVSB->Move(rcVScroll, TRUE, FALSE); 93 pVSB->Move(rcVScroll, true, false);
94 } 94 }
95 95
96 if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) 96 if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW))
97 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetClientRect( ),1.0f)); //+1 for caret beside border 97 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetClientRect( ),1.0f)); //+1 for caret beside border
98 98
99 CPWL_EditCtrl::RePosChildWnd(); 99 CPWL_EditCtrl::RePosChildWnd();
100 } 100 }
101 101
102 CPDF_Rect CPWL_Edit::GetClientRect() const 102 CPDF_Rect CPWL_Edit::GetClientRect() const
103 { 103 {
104 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)( GetBorderWidth()+GetInnerBorderWidth())); 104 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)( GetBorderWidth()+GetInnerBorderWidth()));
105 105
106 if (CPWL_ScrollBar * pVSB = GetVScrollBar()) 106 if (CPWL_ScrollBar * pVSB = GetVScrollBar())
107 { 107 {
108 if (pVSB->IsVisible()) 108 if (pVSB->IsVisible())
109 { 109 {
110 rcClient.right -= PWL_SCROLLBAR_WIDTH; 110 rcClient.right -= PWL_SCROLLBAR_WIDTH;
111 } 111 }
112 } 112 }
113 113
114 return rcClient; 114 return rcClient;
115 } 115 }
116 116
117 void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, FX_BOOL bPaint/* = TRUE*/) 117 void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, bool bPaint/* = true*/)
118 { 118 {
119 m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint); 119 m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint);
120 } 120 }
121 121
122 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, FX_BOOL bPaint/* = TRUE*/) 122 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, bool bPaint/* = true*/)
123 { 123 {
124 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); 124 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint);
125 } 125 }
126 126
127 FX_BOOL»CPWL_Edit::CanSelectAll() const 127 bool» CPWL_Edit::CanSelectAll() const
128 { 128 {
129 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); 129 return GetSelectWordRange() != m_pEdit->GetWholeWordRange();
130 } 130 }
131 131
132 FX_BOOL»CPWL_Edit::CanClear() const 132 bool» CPWL_Edit::CanClear() const
133 { 133 {
134 return !IsReadOnly() && m_pEdit->IsSelected(); 134 return !IsReadOnly() && m_pEdit->IsSelected();
135 } 135 }
136 136
137 FX_BOOL»CPWL_Edit::CanCopy() const 137 bool» CPWL_Edit::CanCopy() const
138 { 138 {
139 return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSel ected(); 139 return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSel ected();
140 } 140 }
141 141
142 FX_BOOL»CPWL_Edit::CanCut() const 142 bool» CPWL_Edit::CanCut() const
143 { 143 {
144 return CanCopy() && !IsReadOnly(); 144 return CanCopy() && !IsReadOnly();
145 } 145 }
146 146
147 FX_BOOL»CPWL_Edit::CanPaste() const 147 bool» CPWL_Edit::CanPaste() const
148 { 148 {
149 » if (IsReadOnly()) return FALSE; 149 » if (IsReadOnly()) return false;
150 150
151 CFX_WideString swClipboard; 151 CFX_WideString swClipboard;
152 if (IFX_SystemHandler* pSH = GetSystemHandler()) 152 if (IFX_SystemHandler* pSH = GetSystemHandler())
153 swClipboard = pSH->GetClipboardText(GetAttachedHWnd()); 153 swClipboard = pSH->GetClipboardText(GetAttachedHWnd());
154 154
155 return !swClipboard.IsEmpty(); 155 return !swClipboard.IsEmpty();
156 } 156 }
157 157
158 void CPWL_Edit::CopyText() 158 void CPWL_Edit::CopyText()
159 { 159 {
160 if (!CanCopy()) return; 160 if (!CanCopy()) return;
161 161
162 CFX_WideString str = m_pEdit->GetSelText(); 162 CFX_WideString str = m_pEdit->GetSelText();
163 163
164 if (IFX_SystemHandler* pSH = GetSystemHandler()) 164 if (IFX_SystemHandler* pSH = GetSystemHandler())
165 pSH->SetClipboardText(GetAttachedHWnd(), str); 165 pSH->SetClipboardText(GetAttachedHWnd(), str);
166 } 166 }
167 167
168 void CPWL_Edit::PasteText() 168 void CPWL_Edit::PasteText()
169 { 169 {
170 if (!CanPaste()) return; 170 if (!CanPaste()) return;
171 171
172 CFX_WideString swClipboard; 172 CFX_WideString swClipboard;
173 if (IFX_SystemHandler* pSH = GetSystemHandler()) 173 if (IFX_SystemHandler* pSH = GetSystemHandler())
174 swClipboard = pSH->GetClipboardText(GetAttachedHWnd()); 174 swClipboard = pSH->GetClipboardText(GetAttachedHWnd());
175 175
176 if (m_pFillerNotify) 176 if (m_pFillerNotify)
177 { 177 {
178 » » FX_BOOL bRC = TRUE; 178 » » bool bRC = true;
179 » » FX_BOOL bExit = FALSE; 179 » » bool bExit = false;
180 CFX_WideString strChangeEx; 180 CFX_WideString strChangeEx;
181 int nSelStart = 0; 181 int nSelStart = 0;
182 int nSelEnd = 0; 182 int nSelEnd = 0;
183 GetSel(nSelStart, nSelEnd); 183 GetSel(nSelStart, nSelEnd);
184 » » m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), 0 , swClipboard, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, 0); 184 » » m_pFillerNotify->OnBeforeKeyStroke(true, GetAttachedData(), 0 , swClipboard, strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, 0);
185 if (!bRC) return; 185 if (!bRC) return;
186 if (bExit) return; 186 if (bExit) return;
187 } 187 }
188 188
189 if (swClipboard.GetLength() > 0) 189 if (swClipboard.GetLength() > 0)
190 { 190 {
191 Clear(); 191 Clear();
192 InsertText(swClipboard.c_str()); 192 InsertText(swClipboard.c_str());
193 } 193 }
194 194
195 if (m_pFillerNotify) 195 if (m_pFillerNotify)
196 { 196 {
197 » » FX_BOOL bExit = FALSE; 197 » » bool bExit = false;
198 » » m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit ,0); 198 » » m_pFillerNotify->OnAfterKeyStroke(true, GetAttachedData(), bExit ,0);
199 if (bExit) return; 199 if (bExit) return;
200 } 200 }
201 } 201 }
202 202
203 void CPWL_Edit::CutText() 203 void CPWL_Edit::CutText()
204 { 204 {
205 if (!CanCut()) return; 205 if (!CanCut()) return;
206 206
207 CFX_WideString str = m_pEdit->GetSelText(); 207 CFX_WideString str = m_pEdit->GetSelText();
208 208
(...skipping 11 matching lines...) Expand all
220 { 220 {
221 pScroll->RemoveFlag(PWS_AUTOTRANSPARENT); 221 pScroll->RemoveFlag(PWS_AUTOTRANSPARENT);
222 pScroll->SetTransparency(255); 222 pScroll->SetTransparency(255);
223 } 223 }
224 224
225 SetParamByFlag(); 225 SetParamByFlag();
226 226
227 m_rcOldWindow = GetWindowRect(); 227 m_rcOldWindow = GetWindowRect();
228 228
229 m_pEdit->SetOprNotify(this); 229 m_pEdit->SetOprNotify(this);
230 » m_pEdit->EnableOprNotify(TRUE); 230 » m_pEdit->EnableOprNotify(true);
231 } 231 }
232 232
233 void CPWL_Edit::SetParamByFlag() 233 void CPWL_Edit::SetParamByFlag()
234 { 234 {
235 if (HasFlag(PES_RIGHT)) 235 if (HasFlag(PES_RIGHT))
236 { 236 {
237 » » m_pEdit->SetAlignmentH(2, FALSE); 237 » » m_pEdit->SetAlignmentH(2, false);
238 } 238 }
239 else if (HasFlag(PES_MIDDLE)) 239 else if (HasFlag(PES_MIDDLE))
240 { 240 {
241 » » m_pEdit->SetAlignmentH(1, FALSE); 241 » » m_pEdit->SetAlignmentH(1, false);
242 } 242 }
243 else 243 else
244 { 244 {
245 » » m_pEdit->SetAlignmentH(0, FALSE); 245 » » m_pEdit->SetAlignmentH(0, false);
246 } 246 }
247 247
248 if (HasFlag(PES_BOTTOM)) 248 if (HasFlag(PES_BOTTOM))
249 { 249 {
250 » » m_pEdit->SetAlignmentV(2, FALSE); 250 » » m_pEdit->SetAlignmentV(2, false);
251 } 251 }
252 else if (HasFlag(PES_CENTER)) 252 else if (HasFlag(PES_CENTER))
253 { 253 {
254 » » m_pEdit->SetAlignmentV(1, FALSE); 254 » » m_pEdit->SetAlignmentV(1, false);
255 } 255 }
256 else 256 else
257 { 257 {
258 » » m_pEdit->SetAlignmentV(0, FALSE); 258 » » m_pEdit->SetAlignmentV(0, false);
259 } 259 }
260 260
261 if (HasFlag(PES_PASSWORD)) 261 if (HasFlag(PES_PASSWORD))
262 { 262 {
263 » » m_pEdit->SetPasswordChar('*', FALSE); 263 » » m_pEdit->SetPasswordChar('*', false);
264 } 264 }
265 265
266 » m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); 266 » m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), false);
267 » m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); 267 » m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), false);
268 » m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); 268 » m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), false);
269 » m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); 269 » m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), false);
270 m_pEdit->EnableUndo(HasFlag(PES_UNDO)); 270 m_pEdit->EnableUndo(HasFlag(PES_UNDO));
271 271
272 if (HasFlag(PES_TEXTOVERFLOW)) 272 if (HasFlag(PES_TEXTOVERFLOW))
273 { 273 {
274 SetClipRect(CPDF_Rect(0.0f,0.0f,0.0f,0.0f)); 274 SetClipRect(CPDF_Rect(0.0f,0.0f,0.0f,0.0f));
275 » » m_pEdit->SetTextOverflow(TRUE, FALSE); 275 » » m_pEdit->SetTextOverflow(true, false);
276 } 276 }
277 else 277 else
278 { 278 {
279 if (m_pEditCaret) 279 if (m_pEditCaret)
280 { 280 {
281 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetCli entRect(),1.0f)); //+1 for caret beside border 281 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetCli entRect(),1.0f)); //+1 for caret beside border
282 } 282 }
283 } 283 }
284 284
285 if (HasFlag(PES_SPELLCHECK)) 285 if (HasFlag(PES_SPELLCHECK))
(...skipping 11 matching lines...) Expand all
297 297
298 int32_t nCharArray = m_pEdit->GetCharArray(); 298 int32_t nCharArray = m_pEdit->GetCharArray();
299 299
300 if (nCharArray > 0) 300 if (nCharArray > 0)
301 { 301 {
302 switch (GetBorderStyle()) 302 switch (GetBorderStyle())
303 { 303 {
304 case PBS_SOLID: 304 case PBS_SOLID:
305 { 305 {
306 sLine << "q\n" << GetBorderWidth() << " w\n" 306 sLine << "q\n" << GetBorderWidth() << " w\n"
307 » » » » » << CPWL_Utils::GetColorAppStream(GetBord erColor(),FALSE) << " 2 J 0 j\n"; 307 » » » » » << CPWL_Utils::GetColorAppStream(GetBord erColor(),false) << " 2 J 0 j\n";
308 308
309 for (int32_t i=1;i<nCharArray;i++) 309 for (int32_t i=1;i<nCharArray;i++)
310 { 310 {
311 sLine << rcClient.left + ((rcClient.righ t - rcClient.left)/nCharArray)*i << " " 311 sLine << rcClient.left + ((rcClient.righ t - rcClient.left)/nCharArray)*i << " "
312 << rcClient.bottom << " m\n" 312 << rcClient.bottom << " m\n"
313 << rcClient.left + ((rcClient.ri ght - rcClient.left)/nCharArray)*i << " " 313 << rcClient.left + ((rcClient.ri ght - rcClient.left)/nCharArray)*i << " "
314 << rcClient.top << " l S\n"; 314 << rcClient.top << " l S\n";
315 } 315 }
316 316
317 sLine << "Q\n"; 317 sLine << "Q\n";
318 } 318 }
319 break; 319 break;
320 case PBS_DASH: 320 case PBS_DASH:
321 { 321 {
322 sLine << "q\n" << GetBorderWidth() << " w\n" 322 sLine << "q\n" << GetBorderWidth() << " w\n"
323 » » » » » << CPWL_Utils::GetColorAppStream(GetBord erColor(),FALSE) << " 2 J 0 j\n" 323 » » » » » << CPWL_Utils::GetColorAppStream(GetBord erColor(),false) << " 2 J 0 j\n"
324 << "[" << GetBorderDash().nDash << " " 324 << "[" << GetBorderDash().nDash << " "
325 << GetBorderDash().nGap << "] " 325 << GetBorderDash().nGap << "] "
326 << GetBorderDash().nPhase << " d\n"; 326 << GetBorderDash().nPhase << " d\n";
327 327
328 for (int32_t i=1;i<nCharArray;i++) 328 for (int32_t i=1;i<nCharArray;i++)
329 { 329 {
330 sLine << rcClient.left + ((rcClient.righ t - rcClient.left)/nCharArray)*i << " " 330 sLine << rcClient.left + ((rcClient.righ t - rcClient.left)/nCharArray)*i << " "
331 << rcClient.bottom << " m\n" 331 << rcClient.bottom << " m\n"
332 << rcClient.left + ((rcClient.ri ght - rcClient.left)/nCharArray)*i << " " 332 << rcClient.left + ((rcClient.ri ght - rcClient.left)/nCharArray)*i << " "
333 << rcClient.top << " l S\n"; 333 << rcClient.top << " l S\n";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffs et, 376 CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffs et,
377 &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordCh ar()); 377 &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordCh ar());
378 378
379 if (sEditAfter.GetLength() > 0) 379 if (sEditAfter.GetLength() > 0)
380 sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditAfter<< "ET\n"; 380 sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditAfter<< "ET\n";
381 381
382 if (HasFlag(PES_SPELLCHECK)) 382 if (HasFlag(PES_SPELLCHECK))
383 { 383 {
384 CFX_ByteString sSpellCheck = CPWL_Utils::GetSpellCheckAppStream( m_pEdit, m_pSpellCheck, ptOffset, &wrVisible); 384 CFX_ByteString sSpellCheck = CPWL_Utils::GetSpellCheckAppStream( m_pEdit, m_pSpellCheck, ptOffset, &wrVisible);
385 if (sSpellCheck.GetLength() > 0) 385 if (sSpellCheck.GetLength() > 0)
386 » » » sText << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORT YPE_RGB,1,0,0),FALSE) << sSpellCheck; 386 » » » sText << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORT YPE_RGB,1,0,0),false) << sSpellCheck;
387 } 387 }
388 388
389 if (sText.GetLength() > 0) 389 if (sText.GetLength() > 0)
390 { 390 {
391 CPDF_Rect rcClient = GetClientRect(); 391 CPDF_Rect rcClient = GetClientRect();
392 sAppStream << "q\n/Tx BMC\n"; 392 sAppStream << "q\n/Tx BMC\n";
393 393
394 if (!HasFlag(PES_TEXTOVERFLOW)) 394 if (!HasFlag(PES_TEXTOVERFLOW))
395 sAppStream << rcClient.left << " " << rcClient.bottom << " " 395 sAppStream << rcClient.left << " " << rcClient.bottom << " "
396 << rcClient.right - rcClient.left << " " << rcCl ient.top - rcClient.bottom << " re W n\n"; 396 << rcClient.right - rcClient.left << " " << rcCl ient.top - rcClient.bottom << " re W n\n";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTranspare ncy()), 480 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTranspare ncy()),
481 rcClip,CPDF_Point(0.0f,0.0f),pRange, pSysHandler, m_pFormFiller) ; 481 rcClip,CPDF_Point(0.0f,0.0f),pRange, pSysHandler, m_pFormFiller) ;
482 482
483 if (HasFlag(PES_SPELLCHECK)) 483 if (HasFlag(PES_SPELLCHECK))
484 { 484 {
485 CPWL_Utils::DrawEditSpellCheck(pDevice,pUser2Device,m_pEdit,rcCl ip, 485 CPWL_Utils::DrawEditSpellCheck(pDevice,pUser2Device,m_pEdit,rcCl ip,
486 CPDF_Point(0.0f,0.0f),pRange, GetCreationParam().pSpellC heck); 486 CPDF_Point(0.0f,0.0f),pRange, GetCreationParam().pSpellC heck);
487 } 487 }
488 } 488 }
489 489
490 FX_BOOL CPWL_Edit::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) 490 bool CPWL_Edit::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
491 { 491 {
492 CPWL_Wnd::OnLButtonDown(point,nFlag); 492 CPWL_Wnd::OnLButtonDown(point,nFlag);
493 493
494 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) 494 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point))
495 { 495 {
496 if (m_bMouseDown) 496 if (m_bMouseDown)
497 InvalidateRect(); 497 InvalidateRect();
498 498
499 » » m_bMouseDown = TRUE; 499 » » m_bMouseDown = true;
500 SetCapture(); 500 SetCapture();
501 501
502 m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(n Flag)); 502 m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(n Flag));
503 } 503 }
504 504
505 » return TRUE; 505 » return true;
506 } 506 }
507 507
508 FX_BOOL»CPWL_Edit::OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag) 508 bool» CPWL_Edit::OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag)
509 { 509 {
510 CPWL_Wnd::OnLButtonDblClk(point, nFlag); 510 CPWL_Wnd::OnLButtonDblClk(point, nFlag);
511 511
512 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) 512 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point))
513 { 513 {
514 m_pEdit->SelectAll(); 514 m_pEdit->SelectAll();
515 } 515 }
516 516
517 » return TRUE; 517 » return true;
518 } 518 }
519 519
520 #define WM_PWLEDIT_UNDO 0x01 520 #define WM_PWLEDIT_UNDO 0x01
521 #define WM_PWLEDIT_REDO 0x02 521 #define WM_PWLEDIT_REDO 0x02
522 #define WM_PWLEDIT_CUT 0x03 522 #define WM_PWLEDIT_CUT 0x03
523 #define WM_PWLEDIT_COPY 0x04 523 #define WM_PWLEDIT_COPY 0x04
524 #define WM_PWLEDIT_PASTE 0x05 524 #define WM_PWLEDIT_PASTE 0x05
525 #define WM_PWLEDIT_DELETE 0x06 525 #define WM_PWLEDIT_DELETE 0x06
526 #define WM_PWLEDIT_SELECTALL 0x07 526 #define WM_PWLEDIT_SELECTALL 0x07
527 #define WM_PWLEDIT_SUGGEST 0x08 527 #define WM_PWLEDIT_SUGGEST 0x08
528 528
529 FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) 529 bool CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
530 { 530 {
531 » if (m_bMouseDown) return FALSE; 531 » if (m_bMouseDown) return false;
532 532
533 CPWL_Wnd::OnRButtonUp(point, nFlag); 533 CPWL_Wnd::OnRButtonUp(point, nFlag);
534 534
535 » if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) return TRUE; 535 » if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) return true;
536 536
537 IFX_SystemHandler* pSH = GetSystemHandler(); 537 IFX_SystemHandler* pSH = GetSystemHandler();
538 » if (!pSH) return FALSE; 538 » if (!pSH) return false;
539 539
540 SetFocus(); 540 SetFocus();
541 541
542 CPVT_WordRange wrLatin = GetLatinWordsRange(point); 542 CPVT_WordRange wrLatin = GetLatinWordsRange(point);
543 CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin); 543 CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin);
544 544
545 FX_HMENU hPopup = pSH->CreatePopupMenu(); 545 FX_HMENU hPopup = pSH->CreatePopupMenu();
546 » if (!hPopup) return FALSE; 546 » if (!hPopup) return false;
547 547
548 CFX_ByteStringArray sSuggestWords; 548 CFX_ByteStringArray sSuggestWords;
549 CPDF_Point ptPopup = point; 549 CPDF_Point ptPopup = point;
550 550
551 if (!IsReadOnly()) 551 if (!IsReadOnly())
552 { 552 {
553 if (HasFlag(PES_SPELLCHECK) && !swLatin.IsEmpty()) 553 if (HasFlag(PES_SPELLCHECK) && !swLatin.IsEmpty())
554 { 554 {
555 if (m_pSpellCheck) 555 if (m_pSpellCheck)
556 { 556 {
(...skipping 23 matching lines...) Expand all
580 580
581 if (HasFlag(PES_UNDO)) 581 if (HasFlag(PES_UNDO))
582 { 582 {
583 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_UNDO, 583 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_UNDO,
584 pProvider ? pProvider->LoadPopupMenuString(0) : L"&Undo" ); 584 pProvider ? pProvider->LoadPopupMenuString(0) : L"&Undo" );
585 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_REDO, 585 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_REDO,
586 pProvider ? pProvider->LoadPopupMenuString(1) : L"&Redo" ); 586 pProvider ? pProvider->LoadPopupMenuString(1) : L"&Redo" );
587 pSH->AppendMenuItem(hPopup, 0, L""); 587 pSH->AppendMenuItem(hPopup, 0, L"");
588 588
589 if (!m_pEdit->CanUndo()) 589 if (!m_pEdit->CanUndo())
590 » » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_UNDO, FALSE); 590 » » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_UNDO, false);
591 if (!m_pEdit->CanRedo()) 591 if (!m_pEdit->CanRedo())
592 » » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_REDO, FALSE); 592 » » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_REDO, false);
593 } 593 }
594 594
595 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT, 595 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT,
596 pProvider ? pProvider->LoadPopupMenuString(2) : L"Cu&t"); 596 pProvider ? pProvider->LoadPopupMenuString(2) : L"Cu&t");
597 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY, 597 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY,
598 pProvider ? pProvider->LoadPopupMenuString(3) : L"&Copy"); 598 pProvider ? pProvider->LoadPopupMenuString(3) : L"&Copy");
599 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_PASTE, 599 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_PASTE,
600 pProvider ? pProvider->LoadPopupMenuString(4) : L"&Paste"); 600 pProvider ? pProvider->LoadPopupMenuString(4) : L"&Paste");
601 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE, 601 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE,
602 pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete"); 602 pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete");
603 603
604 CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd()); 604 CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd());
605 if (swText.IsEmpty()) 605 if (swText.IsEmpty())
606 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); 606 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, false);
607 607
608 if (!m_pEdit->IsSelected()) 608 if (!m_pEdit->IsSelected())
609 { 609 {
610 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE); 610 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, false);
611 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE); 611 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, false);
612 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE); 612 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, false);
613 } 613 }
614 614
615 if (IsReadOnly()) 615 if (IsReadOnly())
616 { 616 {
617 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE); 617 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, false);
618 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE); 618 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, false);
619 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); 619 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, false);
620 } 620 }
621 621
622 if (HasFlag(PES_PASSWORD)) 622 if (HasFlag(PES_PASSWORD))
623 { 623 {
624 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE); 624 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, false);
625 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE); 625 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, false);
626 } 626 }
627 627
628 if (HasFlag(PES_NOREAD)) 628 if (HasFlag(PES_NOREAD))
629 { 629 {
630 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE); 630 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, false);
631 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE); 631 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, false);
632 } 632 }
633 633
634 pSH->AppendMenuItem(hPopup, 0, L""); 634 pSH->AppendMenuItem(hPopup, 0, L"");
635 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SELECTALL, 635 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SELECTALL,
636 pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All"); 636 pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All");
637 637
638 if (m_pEdit->GetTotalWords() == 0) 638 if (m_pEdit->GetTotalWords() == 0)
639 { 639 {
640 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE); 640 » » pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, false);
641 } 641 }
642 642
643 int32_t x, y; 643 int32_t x, y;
644 PWLtoWnd(ptPopup, x, y); 644 PWLtoWnd(ptPopup, x, y);
645 pSH->ClientToScreen(GetAttachedHWnd(), x, y); 645 pSH->ClientToScreen(GetAttachedHWnd(), x, y);
646 pSH->SetCursor(FXCT_ARROW); 646 pSH->SetCursor(FXCT_ARROW);
647 int32_t nCmd = pSH->TrackPopupMenu(hPopup, 647 int32_t nCmd = pSH->TrackPopupMenu(hPopup,
648 x, 648 x,
649 y, 649 y,
650 GetAttachedHWnd()); 650 GetAttachedHWnd());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 case WM_PWLEDIT_SUGGEST + 4: 692 case WM_PWLEDIT_SUGGEST + 4:
693 SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit-> WordPlaceToWordIndex(wrLatin.EndPos)); 693 SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit-> WordPlaceToWordIndex(wrLatin.EndPos));
694 ReplaceSel(sSuggestWords[4].UTF8Decode().c_str()); 694 ReplaceSel(sSuggestWords[4].UTF8Decode().c_str());
695 break; 695 break;
696 default: 696 default:
697 break; 697 break;
698 } 698 }
699 699
700 pSH->DestroyMenu(hPopup); 700 pSH->DestroyMenu(hPopup);
701 701
702 » return TRUE; 702 » return true;
703 } 703 }
704 704
705 void CPWL_Edit::OnSetFocus() 705 void CPWL_Edit::OnSetFocus()
706 { 706 {
707 » SetEditCaret(TRUE); 707 » SetEditCaret(true);
708 708
709 if (!IsReadOnly()) 709 if (!IsReadOnly())
710 { 710 {
711 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) 711 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler())
712 pFocusHandler->OnSetFocus(this); 712 pFocusHandler->OnSetFocus(this);
713 } 713 }
714 714
715 » m_bFocus = TRUE; 715 » m_bFocus = true;
716 } 716 }
717 717
718 void CPWL_Edit::OnKillFocus() 718 void CPWL_Edit::OnKillFocus()
719 { 719 {
720 » ShowVScrollBar(FALSE); 720 » ShowVScrollBar(false);
721 721
722 m_pEdit->SelectNone(); 722 m_pEdit->SelectNone();
723 » SetCaret(FALSE, CPDF_Point(0.0f,0.0f), CPDF_Point(0.0f,0.0f)); 723 » SetCaret(false, CPDF_Point(0.0f,0.0f), CPDF_Point(0.0f,0.0f));
724 724
725 SetCharSet(0); 725 SetCharSet(0);
726 726
727 if (!IsReadOnly()) 727 if (!IsReadOnly())
728 { 728 {
729 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) 729 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler())
730 pFocusHandler->OnKillFocus(this); 730 pFocusHandler->OnKillFocus(this);
731 } 731 }
732 732
733 » m_bFocus = FALSE; 733 » m_bFocus = false;
734 } 734 }
735 735
736 void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint/* = TRUE*/) 736 void CPWL_Edit::SetHorzScale(int32_t nHorzScale, bool bPaint/* = true*/)
737 { 737 {
738 m_pEdit->SetHorzScale(nHorzScale, bPaint); 738 m_pEdit->SetHorzScale(nHorzScale, bPaint);
739 } 739 }
740 740
741 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint/* = TRUE*/) 741 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, bool bPaint/* = true*/)
742 { 742 {
743 m_pEdit->SetCharSpace(fCharSpace, bPaint); 743 m_pEdit->SetCharSpace(fCharSpace, bPaint);
744 } 744 }
745 745
746 void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint/* = TRUE*/) 746 void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading, bool bPaint/* = true*/)
747 { 747 {
748 m_pEdit->SetLineLeading(fLineLeading, bPaint); 748 m_pEdit->SetLineLeading(fLineLeading, bPaint);
749 } 749 }
750 750
751 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(const CPDF_Point & ptOffset) const 751 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(const CPDF_Point & ptOffset) const
752 { 752 {
753 CPVT_WordRange wr = GetSelectWordRange(); 753 CPVT_WordRange wr = GetSelectWordRange();
754 return CPWL_Utils::GetEditSelAppStream(m_pEdit,ptOffset,&wr); 754 return CPWL_Utils::GetEditSelAppStream(m_pEdit,ptOffset,&wr);
755 } 755 }
756 756
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 { 806 {
807 pt = CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord .y + word.fDescent); 807 pt = CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord .y + word.fDescent);
808 } 808 }
809 809
810 pIterator->SetAt(wpOld); 810 pIterator->SetAt(wpOld);
811 } 811 }
812 812
813 return pt; 813 return pt;
814 } 814 }
815 815
816 FX_BOOL»CPWL_Edit::IsTextFull() const 816 bool» CPWL_Edit::IsTextFull() const
817 { 817 {
818 return m_pEdit->IsTextFull(); 818 return m_pEdit->IsTextFull();
819 } 819 }
820 820
821 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray) 821 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray)
822 { 822 {
823 if (pFont && !pFont->IsStandardFont()) 823 if (pFont && !pFont->IsStandardFont())
824 { 824 {
825 FX_RECT rcBBox; 825 FX_RECT rcBBox;
826 pFont->GetFontBBox(rcBBox); 826 pFont->GetFontBBox(rcBBox);
827 827
828 CPDF_Rect rcCell = rcPlate; 828 CPDF_Rect rcCell = rcPlate;
829 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.W idth(); 829 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.W idth();
830 FX_FLOAT ydiv = - rcCell.Height() * 1000.0f / rcBBox.Height(); 830 FX_FLOAT ydiv = - rcCell.Height() * 1000.0f / rcBBox.Height();
831 831
832 return xdiv < ydiv ? xdiv : ydiv; 832 return xdiv < ydiv ? xdiv : ydiv;
833 } 833 }
834 834
835 return 0.0f; 835 return 0.0f;
836 } 836 }
837 837
838 void CPWL_Edit::SetCharArray(int32_t nCharArray) 838 void CPWL_Edit::SetCharArray(int32_t nCharArray)
839 { 839 {
840 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) 840 if (HasFlag(PES_CHARARRAY) && nCharArray > 0)
841 { 841 {
842 m_pEdit->SetCharArray(nCharArray); 842 m_pEdit->SetCharArray(nCharArray);
843 » » m_pEdit->SetTextOverflow(TRUE); 843 » » m_pEdit->SetTextOverflow(true);
844 844
845 if (HasFlag(PWS_AUTOFONTSIZE)) 845 if (HasFlag(PWS_AUTOFONTSIZE))
846 { 846 {
847 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) 847 if (IFX_Edit_FontMap* pFontMap = GetFontMap())
848 { 848 {
849 FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pF ontMap->GetPDFFont(0), GetClientRect(), nCharArray); 849 FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pF ontMap->GetPDFFont(0), GetClientRect(), nCharArray);
850 if (fFontSize > 0.0f) 850 if (fFontSize > 0.0f)
851 { 851 {
852 » » » » » m_pEdit->SetAutoFontSize(FALSE); 852 » » » » » m_pEdit->SetAutoFontSize(false);
853 m_pEdit->SetFontSize(fFontSize); 853 m_pEdit->SetFontSize(fFontSize);
854 } 854 }
855 } 855 }
856 } 856 }
857 } 857 }
858 } 858 }
859 859
860 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) 860 void CPWL_Edit::SetLimitChar(int32_t nLimitChar)
861 { 861 {
862 m_pEdit->SetLimitChar(nLimitChar); 862 m_pEdit->SetLimitChar(nLimitChar);
863 } 863 }
864 864
865 void CPWL_Edit::ReplaceSel(const FX_WCHAR* csText) 865 void CPWL_Edit::ReplaceSel(const FX_WCHAR* csText)
866 { 866 {
867 m_pEdit->Clear(); 867 m_pEdit->Clear();
868 m_pEdit->InsertText(csText); 868 m_pEdit->InsertText(csText);
869 } 869 }
870 870
871 CPDF_Rect CPWL_Edit::GetFocusRect() const 871 CPDF_Rect CPWL_Edit::GetFocusRect() const
872 { 872 {
873 return CPDF_Rect(); 873 return CPDF_Rect();
874 } 874 }
875 875
876 void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) 876 void CPWL_Edit::ShowVScrollBar(bool bShow)
877 { 877 {
878 if (CPWL_ScrollBar * pScroll = GetVScrollBar()) 878 if (CPWL_ScrollBar * pScroll = GetVScrollBar())
879 { 879 {
880 if (bShow) 880 if (bShow)
881 { 881 {
882 if (!pScroll->IsVisible()) 882 if (!pScroll->IsVisible())
883 { 883 {
884 » » » » pScroll->SetVisible(TRUE); 884 » » » » pScroll->SetVisible(true);
885 CPDF_Rect rcWindow = GetWindowRect(); 885 CPDF_Rect rcWindow = GetWindowRect();
886 m_rcOldWindow = rcWindow; 886 m_rcOldWindow = rcWindow;
887 rcWindow.right += PWL_SCROLLBAR_WIDTH; 887 rcWindow.right += PWL_SCROLLBAR_WIDTH;
888 » » » » Move(rcWindow, TRUE, TRUE); 888 » » » » Move(rcWindow, true, true);
889 } 889 }
890 } 890 }
891 else 891 else
892 { 892 {
893 if (pScroll->IsVisible()) 893 if (pScroll->IsVisible())
894 { 894 {
895 » » » » pScroll->SetVisible(FALSE); 895 » » » » pScroll->SetVisible(false);
896 » » » » Move(m_rcOldWindow, TRUE, TRUE); 896 » » » » Move(m_rcOldWindow, true, true);
897 } 897 }
898 } 898 }
899 } 899 }
900 } 900 }
901 901
902 FX_BOOL»CPWL_Edit::IsVScrollBarVisible() const 902 bool» CPWL_Edit::IsVScrollBarVisible() const
903 { 903 {
904 if (CPWL_ScrollBar * pScroll = GetVScrollBar()) 904 if (CPWL_ScrollBar * pScroll = GetVScrollBar())
905 { 905 {
906 return pScroll->IsVisible(); 906 return pScroll->IsVisible();
907 } 907 }
908 908
909 » return FALSE; 909 » return false;
910 } 910 }
911 911
912 void CPWL_Edit::EnableSpellCheck(FX_BOOL bEnabled) 912 void CPWL_Edit::EnableSpellCheck(bool bEnabled)
913 { 913 {
914 if (bEnabled) 914 if (bEnabled)
915 AddFlag(PES_SPELLCHECK); 915 AddFlag(PES_SPELLCHECK);
916 else 916 else
917 RemoveFlag(PES_SPELLCHECK); 917 RemoveFlag(PES_SPELLCHECK);
918 } 918 }
919 919
920 FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) 920 bool CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag)
921 { 921 {
922 » if (m_bMouseDown) return TRUE; 922 » if (m_bMouseDown) return true;
923 923
924 if (nChar == FWL_VKEY_Delete) 924 if (nChar == FWL_VKEY_Delete)
925 { 925 {
926 if (m_pFillerNotify) 926 if (m_pFillerNotify)
927 { 927 {
928 » » » FX_BOOL bRC = TRUE; 928 » » » bool bRC = true;
929 » » » FX_BOOL bExit = FALSE; 929 » » » bool bExit = false;
930 CFX_WideString strChange; 930 CFX_WideString strChange;
931 CFX_WideString strChangeEx; 931 CFX_WideString strChangeEx;
932 932
933 int nSelStart = 0; 933 int nSelStart = 0;
934 int nSelEnd = 0; 934 int nSelEnd = 0;
935 GetSel(nSelStart, nSelEnd); 935 GetSel(nSelStart, nSelEnd);
936 936
937 if (nSelStart == nSelEnd) 937 if (nSelStart == nSelEnd)
938 nSelEnd = nSelStart + 1; 938 nSelEnd = nSelStart + 1;
939 » » » m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData (), FWL_VKEY_Delete, strChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExi t, nFlag); 939 » » » m_pFillerNotify->OnBeforeKeyStroke(true, GetAttachedData (), FWL_VKEY_Delete, strChange, strChangeEx, nSelStart, nSelEnd, true, bRC, bExi t, nFlag);
940 » » » if (!bRC) return FALSE; 940 » » » if (!bRC) return false;
941 » » » if (bExit) return FALSE; 941 » » » if (bExit) return false;
942 } 942 }
943 } 943 }
944 944
945 » FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); 945 » bool bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag);
946 946
947 if (nChar == FWL_VKEY_Delete) 947 if (nChar == FWL_VKEY_Delete)
948 { 948 {
949 if (m_pFillerNotify) 949 if (m_pFillerNotify)
950 { 950 {
951 » » » FX_BOOL bExit = FALSE; 951 » » » bool bExit = false;
952 » » » m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData( ), bExit,nFlag); 952 » » » m_pFillerNotify->OnAfterKeyStroke(true, GetAttachedData( ), bExit,nFlag);
953 » » » if (bExit) return FALSE; 953 » » » if (bExit) return false;
954 } 954 }
955 } 955 }
956 956
957 //In case of implementation swallow the OnKeyDown event. 957 //In case of implementation swallow the OnKeyDown event.
958 if(IsProceedtoOnChar(nChar, nFlag)) 958 if(IsProceedtoOnChar(nChar, nFlag))
959 » » » return TRUE; 959 » » » return true;
960 960
961 return bRet; 961 return bRet;
962 } 962 }
963 963
964 /** 964 /**
965 *In case of implementation swallow the OnKeyDown event. 965 *In case of implementation swallow the OnKeyDown event.
966 *If the event is swallowed, implementation may do other unexpected things, which is not the control means to do. 966 *If the event is swallowed, implementation may do other unexpected things, which is not the control means to do.
967 */ 967 */
968 FX_BOOL CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag) 968 bool CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag)
969 { 969 {
970 970
971 » FX_BOOL bCtrl = IsCTRLpressed(nFlag); 971 » bool bCtrl = IsCTRLpressed(nFlag);
972 » FX_BOOL bAlt = IsALTpressed(nFlag); 972 » bool bAlt = IsALTpressed(nFlag);
973 if(bCtrl && !bAlt) 973 if(bCtrl && !bAlt)
974 { 974 {
975 //hot keys for edit control. 975 //hot keys for edit control.
976 switch(nKeyCode) 976 switch(nKeyCode)
977 { 977 {
978 case 'C': 978 case 'C':
979 case 'V': 979 case 'V':
980 case 'X': 980 case 'X':
981 case 'A': 981 case 'A':
982 case 'Z': 982 case 'Z':
983 » » » return TRUE; 983 » » » return true;
984 default: 984 default:
985 break; 985 break;
986 } 986 }
987 } 987 }
988 //control characters. 988 //control characters.
989 switch(nKeyCode) 989 switch(nKeyCode)
990 { 990 {
991 case FWL_VKEY_Escape: 991 case FWL_VKEY_Escape:
992 case FWL_VKEY_Back: 992 case FWL_VKEY_Back:
993 case FWL_VKEY_Return: 993 case FWL_VKEY_Return:
994 case FWL_VKEY_Space: 994 case FWL_VKEY_Space:
995 » » return TRUE; 995 » » return true;
996 default: 996 default:
997 break; 997 break;
998 } 998 }
999 » return FALSE; 999 » return false;
1000 1000
1001 } 1001 }
1002 1002
1003 FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) 1003 bool CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag)
1004 { 1004 {
1005 » if (m_bMouseDown) return TRUE; 1005 » if (m_bMouseDown) return true;
1006 1006
1007 » FX_BOOL bRC = TRUE; 1007 » bool bRC = true;
1008 » FX_BOOL bExit = FALSE; 1008 » bool bExit = false;
1009 1009
1010 » FX_BOOL bCtrl = IsCTRLpressed(nFlag); 1010 » bool bCtrl = IsCTRLpressed(nFlag);
1011 if (!bCtrl) 1011 if (!bCtrl)
1012 { 1012 {
1013 if (m_pFillerNotify) 1013 if (m_pFillerNotify)
1014 { 1014 {
1015 CFX_WideString swChange; 1015 CFX_WideString swChange;
1016 int32_t nKeyCode; 1016 int32_t nKeyCode;
1017 1017
1018 int nSelStart = 0; 1018 int nSelStart = 0;
1019 int nSelEnd = 0; 1019 int nSelEnd = 0;
1020 GetSel(nSelStart, nSelEnd); 1020 GetSel(nSelStart, nSelEnd);
1021 1021
1022 switch (nChar) 1022 switch (nChar)
1023 { 1023 {
1024 case FWL_VKEY_Back: 1024 case FWL_VKEY_Back:
1025 nKeyCode = nChar; 1025 nKeyCode = nChar;
1026 if (nSelStart == nSelEnd) 1026 if (nSelStart == nSelEnd)
1027 nSelStart = nSelEnd - 1; 1027 nSelStart = nSelEnd - 1;
1028 break; 1028 break;
1029 case FWL_VKEY_Return: 1029 case FWL_VKEY_Return:
1030 nKeyCode = nChar; 1030 nKeyCode = nChar;
1031 break; 1031 break;
1032 default: 1032 default:
1033 nKeyCode = 0; 1033 nKeyCode = 0;
1034 swChange += nChar; 1034 swChange += nChar;
1035 break; 1035 break;
1036 } 1036 }
1037 1037
1038 CFX_WideString strChangeEx; 1038 CFX_WideString strChangeEx;
1039 » » » m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData (), nKeyCode, swChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag ); 1039 » » » m_pFillerNotify->OnBeforeKeyStroke(true, GetAttachedData (), nKeyCode, swChange, strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag );
1040 } 1040 }
1041 } 1041 }
1042 1042
1043 » if (!bRC) return TRUE; 1043 » if (!bRC) return true;
1044 » if (bExit) return FALSE; 1044 » if (bExit) return false;
1045 1045
1046 if (IFX_Edit_FontMap * pFontMap = GetFontMap()) 1046 if (IFX_Edit_FontMap * pFontMap = GetFontMap())
1047 { 1047 {
1048 int32_t nOldCharSet = GetCharSet(); 1048 int32_t nOldCharSet = GetCharSet();
1049 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAUL T_CHARSET); 1049 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAUL T_CHARSET);
1050 if(nOldCharSet != nNewCharSet) 1050 if(nOldCharSet != nNewCharSet)
1051 { 1051 {
1052 SetCharSet(nNewCharSet); 1052 SetCharSet(nNewCharSet);
1053 } 1053 }
1054 } 1054 }
1055 » FX_BOOL bRet = CPWL_EditCtrl::OnChar(nChar,nFlag); 1055 » bool bRet = CPWL_EditCtrl::OnChar(nChar,nFlag);
1056 1056
1057 if (!bCtrl) 1057 if (!bCtrl)
1058 { 1058 {
1059 if (m_pFillerNotify) 1059 if (m_pFillerNotify)
1060 { 1060 {
1061 » » » m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData( ), bExit,nFlag); 1061 » » » m_pFillerNotify->OnAfterKeyStroke(true, GetAttachedData( ), bExit,nFlag);
1062 » » » if (bExit) return FALSE; 1062 » » » if (bExit) return false;
1063 } 1063 }
1064 } 1064 }
1065 1065
1066 return bRet; 1066 return bRet;
1067 } 1067 }
1068 1068
1069 FX_BOOL»CPWL_Edit::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag) 1069 bool» CPWL_Edit::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
1070 { 1070 {
1071 if (HasFlag(PES_MULTILINE)) 1071 if (HasFlag(PES_MULTILINE))
1072 { 1072 {
1073 CPDF_Point ptScroll = GetScrollPos(); 1073 CPDF_Point ptScroll = GetScrollPos();
1074 1074
1075 if (zDelta > 0) 1075 if (zDelta > 0)
1076 { 1076 {
1077 ptScroll.y += GetFontSize(); 1077 ptScroll.y += GetFontSize();
1078 } 1078 }
1079 else 1079 else
1080 { 1080 {
1081 ptScroll.y -= GetFontSize(); 1081 ptScroll.y -= GetFontSize();
1082 } 1082 }
1083 SetScrollPos(ptScroll); 1083 SetScrollPos(ptScroll);
1084 1084
1085 » » return TRUE; 1085 » » return true;
1086 } 1086 }
1087 1087
1088 » return FALSE; 1088 » return false;
1089 } 1089 }
1090 1090
1091 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace & oldplace) 1091 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace & oldplace)
1092 { 1092 {
1093 if (HasFlag(PES_SPELLCHECK)) 1093 if (HasFlag(PES_SPELLCHECK))
1094 { 1094 {
1095 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(ol dplace),GetLatinWordsRange(place))); 1095 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(ol dplace),GetLatinWordsRange(place)));
1096 } 1096 }
1097 1097
1098 if (m_pEditNotify) 1098 if (m_pEditNotify)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 else 1198 else
1199 { 1199 {
1200 wrRet.EndPos = wr1.EndPos; 1200 wrRet.EndPos = wr1.EndPos;
1201 } 1201 }
1202 1202
1203 return wrRet; 1203 return wrRet;
1204 } 1204 }
1205 1205
1206 CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CPDF_Point& point) const 1206 CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CPDF_Point& point) const
1207 { 1207 {
1208 » return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); 1208 » return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false);
1209 } 1209 }
1210 1210
1211 CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CPVT_WordPlace & place) const 1211 CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CPVT_WordPlace & place) const
1212 { 1212 {
1213 » return GetSameWordsRange(place, TRUE, FALSE); 1213 » return GetSameWordsRange(place, true, false);
1214 } 1214 }
1215 1215
1216 CPVT_WordRange CPWL_Edit::GetArabicWordsRange(const CPVT_WordPlace & place) cons t 1216 CPVT_WordRange CPWL_Edit::GetArabicWordsRange(const CPVT_WordPlace & place) cons t
1217 { 1217 {
1218 » return GetSameWordsRange(place, FALSE, TRUE); 1218 » return GetSameWordsRange(place, false, true);
1219 } 1219 }
1220 1220
1221 #define PWL_ISARABICWORD(word) ((word >= 0x0600 && word <= 0x06FF) || (word >= 0 xFB50 && word <= 0xFEFC)) 1221 #define PWL_ISARABICWORD(word) ((word >= 0x0600 && word <= 0x06FF) || (word >= 0 xFB50 && word <= 0xFEFC))
1222 1222
1223 CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO L bLatin, FX_BOOL bArabic) const 1223 CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, bool b Latin, bool bArabic) const
1224 { 1224 {
1225 CPVT_WordRange range; 1225 CPVT_WordRange range;
1226 1226
1227 if (IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator()) 1227 if (IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator())
1228 { 1228 {
1229 CPVT_Word wordinfo; 1229 CPVT_Word wordinfo;
1230 CPVT_WordPlace wpStart(place),wpEnd(place); 1230 CPVT_WordPlace wpStart(place),wpEnd(place);
1231 pIterator->SetAt(place); 1231 pIterator->SetAt(place);
1232 1232
1233 if (bLatin) 1233 if (bLatin)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1308 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1309 } 1309 }
1310 1310
1311 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, 1311 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
1312 const CP DF_Point& ptOffset) 1312 const CP DF_Point& ptOffset)
1313 { 1313 {
1314 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; 1314 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
1315 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1315 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1316 } 1316 }
1317 1317
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698