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

Side by Side Diff: fpdfsdk/src/fxedit/fxet_edit.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 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/fxedit/fxet_ap.cpp ('k') | fpdfsdk/src/fxedit/fxet_list.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 "../../include/fxedit/fxet_stub.h" 7 #include "../../include/fxedit/fxet_stub.h"
8 #include "../../include/fxedit/fxet_edit.h" 8 #include "../../include/fxedit/fxet_edit.h"
9 9
10 #define FX_EDIT_UNDO_MAXITEM 10000 10 #define FX_EDIT_UNDO_MAXITEM 10000
11 11
12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- * / 12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- * /
13 13
14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : 14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) :
15 m_pEdit(pEdit), 15 m_pEdit(pEdit),
16 m_pVTIterator(pVTIterator) 16 m_pVTIterator(pVTIterator)
17 { 17 {
18 } 18 }
19 19
20 CFX_Edit_Iterator::~CFX_Edit_Iterator() 20 CFX_Edit_Iterator::~CFX_Edit_Iterator()
21 { 21 {
22 } 22 }
23 23
24 FX_BOOL CFX_Edit_Iterator::NextWord() 24 bool CFX_Edit_Iterator::NextWord()
25 { 25 {
26 return m_pVTIterator->NextWord(); 26 return m_pVTIterator->NextWord();
27 } 27 }
28 28
29 FX_BOOL CFX_Edit_Iterator::NextLine() 29 bool CFX_Edit_Iterator::NextLine()
30 { 30 {
31 return m_pVTIterator->NextLine(); 31 return m_pVTIterator->NextLine();
32 } 32 }
33 33
34 FX_BOOL CFX_Edit_Iterator::NextSection() 34 bool CFX_Edit_Iterator::NextSection()
35 { 35 {
36 return m_pVTIterator->NextSection(); 36 return m_pVTIterator->NextSection();
37 } 37 }
38 38
39 FX_BOOL CFX_Edit_Iterator::PrevWord() 39 bool CFX_Edit_Iterator::PrevWord()
40 { 40 {
41 return m_pVTIterator->PrevWord(); 41 return m_pVTIterator->PrevWord();
42 } 42 }
43 43
44 FX_BOOL CFX_Edit_Iterator::PrevLine() 44 bool CFX_Edit_Iterator::PrevLine()
45 { 45 {
46 return m_pVTIterator->PrevLine(); 46 return m_pVTIterator->PrevLine();
47 } 47 }
48 48
49 FX_BOOL CFX_Edit_Iterator::PrevSection() 49 bool CFX_Edit_Iterator::PrevSection()
50 { 50 {
51 return m_pVTIterator->PrevSection(); 51 return m_pVTIterator->PrevSection();
52 } 52 }
53 53
54 FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word & word) const 54 bool CFX_Edit_Iterator::GetWord(CPVT_Word & word) const
55 { 55 {
56 ASSERT(m_pEdit); 56 ASSERT(m_pEdit);
57 57
58 if (m_pVTIterator->GetWord(word)) 58 if (m_pVTIterator->GetWord(word))
59 { 59 {
60 word.ptWord = m_pEdit->VTToEdit(word.ptWord); 60 word.ptWord = m_pEdit->VTToEdit(word.ptWord);
61 return TRUE; 61 return true;
62 } 62 }
63 return FALSE; 63 return false;
64 } 64 }
65 65
66 FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const 66 bool CFX_Edit_Iterator::GetLine(CPVT_Line & line) const
67 { 67 {
68 ASSERT(m_pEdit); 68 ASSERT(m_pEdit);
69 69
70 if (m_pVTIterator->GetLine(line)) 70 if (m_pVTIterator->GetLine(line))
71 { 71 {
72 line.ptLine = m_pEdit->VTToEdit(line.ptLine); 72 line.ptLine = m_pEdit->VTToEdit(line.ptLine);
73 return TRUE; 73 return true;
74 } 74 }
75 return FALSE; 75 return false;
76 } 76 }
77 77
78 FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section & section) const 78 bool CFX_Edit_Iterator::GetSection(CPVT_Section & section) const
79 { 79 {
80 ASSERT(m_pEdit); 80 ASSERT(m_pEdit);
81 81
82 if (m_pVTIterator->GetSection(section)) 82 if (m_pVTIterator->GetSection(section))
83 { 83 {
84 section.rcSection = m_pEdit->VTToEdit(section.rcSection); 84 section.rcSection = m_pEdit->VTToEdit(section.rcSection);
85 return TRUE; 85 return true;
86 } 86 }
87 return FALSE; 87 return false;
88 } 88 }
89 89
90 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) 90 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex)
91 { 91 {
92 m_pVTIterator->SetAt(nWordIndex); 92 m_pVTIterator->SetAt(nWordIndex);
93 } 93 }
94 94
95 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) 95 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place)
96 { 96 {
97 m_pVTIterator->SetAt(place); 97 m_pVTIterator->SetAt(place);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32 _t nFontIndex) 160 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32 _t nFontIndex)
161 { 161 {
162 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); 162 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex);
163 } 163 }
164 164
165 int32_t CFX_Edit_Provider::GetDefaultFontIndex() 165 int32_t CFX_Edit_Provider::GetDefaultFontIndex()
166 { 166 {
167 return 0; 167 return 0;
168 } 168 }
169 169
170 FX_BOOL CFX_Edit_Provider::IsLatinWord(FX_WORD word) 170 bool CFX_Edit_Provider::IsLatinWord(FX_WORD word)
171 { 171 {
172 return FX_EDIT_ISLATINWORD(word); 172 return FX_EDIT_ISLATINWORD(word);
173 } 173 }
174 174
175 /* --------------------------------- CFX_Edit_Refresh -------------------------- ------- */ 175 /* --------------------------------- CFX_Edit_Refresh -------------------------- ------- */
176 176
177 CFX_Edit_Refresh::CFX_Edit_Refresh() 177 CFX_Edit_Refresh::CFX_Edit_Refresh()
178 { 178 {
179 } 179 }
180 180
(...skipping 22 matching lines...) Expand all
203 203
204 { 204 {
205 for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) 205 for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++)
206 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i)) 206 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i))
207 m_RefreshRects.Add(pNewRect->m_rcLine); 207 m_RefreshRects.Add(pNewRect->m_rcLine);
208 } 208 }
209 } 209 }
210 210
211 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) 211 void CFX_Edit_Refresh::Analyse(int32_t nAlignment)
212 { 212 {
213 FX_BOOL bLineTopChanged = FALSE; 213 bool bLineTopChanged = false;
214 CPDF_Rect rcResult; 214 CPDF_Rect rcResult;
215 FX_FLOAT fWidthDiff; 215 FX_FLOAT fWidthDiff;
216 216
217 int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetSize( )); 217 int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetSize( ));
218 int32_t i = 0; 218 int32_t i = 0;
219 219
220 while (i < szMax) 220 while (i < szMax)
221 { 221 {
222 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); 222 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i);
223 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); 223 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i);
224 224
225 if (pOldRect) 225 if (pOldRect)
226 { 226 {
227 if (pNewRect) 227 if (pNewRect)
228 { 228 {
229 if (bLineTopChanged) 229 if (bLineTopChanged)
230 { 230 {
231 rcResult = pOldRect->m_rcLine; 231 rcResult = pOldRect->m_rcLine;
232 rcResult.Union(pNewRect->m_rcLine); 232 rcResult.Union(pNewRect->m_rcLine);
233 m_RefreshRects.Add(rcResult); 233 m_RefreshRects.Add(rcResult);
234 } 234 }
235 else 235 else
236 { 236 {
237 if (*pNewRect != *pOldRect) 237 if (*pNewRect != *pOldRect)
238 { 238 {
239 if (!pNewRect->IsSameTop(*pOldRect) || !pNewRect->IsSame Height(*pOldRect)) 239 if (!pNewRect->IsSameTop(*pOldRect) || !pNewRect->IsSame Height(*pOldRect))
240 { 240 {
241 bLineTopChanged = TRUE; 241 bLineTopChanged = true;
242 continue; 242 continue;
243 } 243 }
244 244
245 if (nAlignment == 0) 245 if (nAlignment == 0)
246 { 246 {
247 if (pNewRect->m_wrLine.BeginPos != pOldRect->m_wrLin e.BeginPos) 247 if (pNewRect->m_wrLine.BeginPos != pOldRect->m_wrLin e.BeginPos)
248 { 248 {
249 rcResult = pOldRect->m_rcLine; 249 rcResult = pOldRect->m_rcLine;
250 rcResult.Union(pNewRect->m_rcLine); 250 rcResult.Union(pNewRect->m_rcLine);
251 m_RefreshRects.Add(rcResult); 251 m_RefreshRects.Add(rcResult);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 void CFX_Edit_Refresh::EndRefresh() 318 void CFX_Edit_Refresh::EndRefresh()
319 { 319 {
320 m_RefreshRects.Empty(); 320 m_RefreshRects.Empty();
321 } 321 }
322 322
323 /* ------------------------------------- CFX_Edit_Undo ------------------------- ------------ */ 323 /* ------------------------------------- CFX_Edit_Undo ------------------------- ------------ */
324 324
325 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), 325 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0),
326 m_nBufSize(nBufsize), 326 m_nBufSize(nBufsize),
327 m_bModified(FALSE), 327 m_bModified(false),
328 m_bVirgin(TRUE), 328 m_bVirgin(true),
329 m_bWorking(FALSE) 329 m_bWorking(false)
330 { 330 {
331 } 331 }
332 332
333 CFX_Edit_Undo::~CFX_Edit_Undo() 333 CFX_Edit_Undo::~CFX_Edit_Undo()
334 { 334 {
335 Reset(); 335 Reset();
336 } 336 }
337 337
338 FX_BOOL CFX_Edit_Undo::CanUndo() const 338 bool CFX_Edit_Undo::CanUndo() const
339 { 339 {
340 return m_nCurUndoPos > 0; 340 return m_nCurUndoPos > 0;
341 } 341 }
342 342
343 void CFX_Edit_Undo::Undo() 343 void CFX_Edit_Undo::Undo()
344 { 344 {
345 m_bWorking = TRUE; 345 m_bWorking = true;
346 346
347 if (m_nCurUndoPos > 0) 347 if (m_nCurUndoPos > 0)
348 { 348 {
349 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-1); 349 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-1);
350 ASSERT(pItem != NULL); 350 ASSERT(pItem != NULL);
351 351
352 pItem->Undo(); 352 pItem->Undo();
353 353
354 m_nCurUndoPos--; 354 m_nCurUndoPos--;
355 m_bModified = (m_nCurUndoPos != 0); 355 m_bModified = (m_nCurUndoPos != 0);
356 } 356 }
357 357
358 m_bWorking = FALSE; 358 m_bWorking = false;
359 } 359 }
360 360
361 FX_BOOL CFX_Edit_Undo::CanRedo() const 361 bool CFX_Edit_Undo::CanRedo() const
362 { 362 {
363 return m_nCurUndoPos < m_UndoItemStack.GetSize(); 363 return m_nCurUndoPos < m_UndoItemStack.GetSize();
364 } 364 }
365 365
366 void CFX_Edit_Undo::Redo() 366 void CFX_Edit_Undo::Redo()
367 { 367 {
368 m_bWorking = TRUE; 368 m_bWorking = true;
369 369
370 int32_t nStackSize = m_UndoItemStack.GetSize(); 370 int32_t nStackSize = m_UndoItemStack.GetSize();
371 371
372 if (m_nCurUndoPos < nStackSize) 372 if (m_nCurUndoPos < nStackSize)
373 { 373 {
374 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos); 374 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos);
375 ASSERT(pItem != NULL); 375 ASSERT(pItem != NULL);
376 376
377 pItem->Redo(); 377 pItem->Redo();
378 378
379 m_nCurUndoPos++; 379 m_nCurUndoPos++;
380 m_bModified = (m_nCurUndoPos != 0); 380 m_bModified = (m_nCurUndoPos != 0);
381 } 381 }
382 382
383 m_bWorking = FALSE; 383 m_bWorking = false;
384 } 384 }
385 385
386 FX_BOOL CFX_Edit_Undo::IsWorking() const 386 bool CFX_Edit_Undo::IsWorking() const
387 { 387 {
388 return m_bWorking; 388 return m_bWorking;
389 } 389 }
390 390
391 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) 391 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem)
392 { 392 {
393 ASSERT(!m_bWorking); 393 ASSERT(!m_bWorking);
394 ASSERT(pItem != NULL); 394 ASSERT(pItem != NULL);
395 ASSERT(m_nBufSize > 1); 395 ASSERT(m_nBufSize > 1);
396 396
397 if (m_nCurUndoPos < m_UndoItemStack.GetSize()) 397 if (m_nCurUndoPos < m_UndoItemStack.GetSize())
398 RemoveTails(); 398 RemoveTails();
399 399
400 if (m_UndoItemStack.GetSize() >= m_nBufSize) 400 if (m_UndoItemStack.GetSize() >= m_nBufSize)
401 { 401 {
402 RemoveHeads(); 402 RemoveHeads();
403 m_bVirgin = FALSE; 403 m_bVirgin = false;
404 } 404 }
405 405
406 m_UndoItemStack.Add(pItem); 406 m_UndoItemStack.Add(pItem);
407 m_nCurUndoPos = m_UndoItemStack.GetSize(); 407 m_nCurUndoPos = m_UndoItemStack.GetSize();
408 408
409 m_bModified = (m_nCurUndoPos != 0); 409 m_bModified = (m_nCurUndoPos != 0);
410 } 410 }
411 411
412 FX_BOOL CFX_Edit_Undo::IsModified() const 412 bool CFX_Edit_Undo::IsModified() const
413 { 413 {
414 return m_bVirgin ? m_bModified : TRUE; 414 return m_bVirgin ? m_bModified : true;
415 } 415 }
416 416
417 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) 417 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex)
418 { 418 {
419 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) 419 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize())
420 return m_UndoItemStack.GetAt(nIndex); 420 return m_UndoItemStack.GetAt(nIndex);
421 421
422 return NULL; 422 return NULL;
423 } 423 }
424 424
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 delete m_Items[i]; 462 delete m_Items[i];
463 } 463 }
464 464
465 m_Items.RemoveAll(); 465 m_Items.RemoveAll();
466 } 466 }
467 467
468 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) 468 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem)
469 { 469 {
470 ASSERT(pUndoItem != NULL); 470 ASSERT(pUndoItem != NULL);
471 471
472 pUndoItem->SetFirst(FALSE); 472 pUndoItem->SetFirst(false);
473 pUndoItem->SetLast(FALSE); 473 pUndoItem->SetLast(false);
474 474
475 m_Items.Add(pUndoItem); 475 m_Items.Add(pUndoItem);
476 476
477 if (m_sTitle.IsEmpty()) 477 if (m_sTitle.IsEmpty())
478 m_sTitle = pUndoItem->GetUndoTitle(); 478 m_sTitle = pUndoItem->GetUndoTitle();
479 } 479 }
480 480
481 void CFX_Edit_GroupUndoItem::UpdateItems() 481 void CFX_Edit_GroupUndoItem::UpdateItems()
482 { 482 {
483 if (m_Items.GetSize() > 0) 483 if (m_Items.GetSize() > 0)
484 { 484 {
485 CFX_Edit_UndoItem* pFirstItem = m_Items[0]; 485 CFX_Edit_UndoItem* pFirstItem = m_Items[0];
486 ASSERT(pFirstItem != NULL); 486 ASSERT(pFirstItem != NULL);
487 pFirstItem->SetFirst(TRUE); 487 pFirstItem->SetFirst(true);
488 488
489 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; 489 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1];
490 ASSERT(pLastItem != NULL); 490 ASSERT(pLastItem != NULL);
491 pLastItem->SetLast(TRUE); 491 pLastItem->SetLast(true);
492 } 492 }
493 } 493 }
494 494
495 void CFX_Edit_GroupUndoItem::Undo() 495 void CFX_Edit_GroupUndoItem::Undo()
496 { 496 {
497 for (int i=m_Items.GetSize()-1; i>=0; i--) 497 for (int i=m_Items.GetSize()-1; i>=0; i--)
498 { 498 {
499 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; 499 CFX_Edit_UndoItem* pUndoItem = m_Items[i];
500 ASSERT(pUndoItem != NULL); 500 ASSERT(pUndoItem != NULL);
501 501
(...skipping 30 matching lines...) Expand all
532 CFXEU_InsertWord::~CFXEU_InsertWord() 532 CFXEU_InsertWord::~CFXEU_InsertWord()
533 { 533 {
534 } 534 }
535 535
536 void CFXEU_InsertWord::Redo() 536 void CFXEU_InsertWord::Redo()
537 { 537 {
538 if (m_pEdit) 538 if (m_pEdit)
539 { 539 {
540 m_pEdit->SelectNone(); 540 m_pEdit->SelectNone();
541 m_pEdit->SetCaret(m_wpOld); 541 m_pEdit->SetCaret(m_wpOld);
542 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); 542 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false,true);
543 } 543 }
544 } 544 }
545 545
546 void CFXEU_InsertWord::Undo() 546 void CFXEU_InsertWord::Undo()
547 { 547 {
548 if (m_pEdit) 548 if (m_pEdit)
549 { 549 {
550 m_pEdit->SelectNone(); 550 m_pEdit->SelectNone();
551 m_pEdit->SetCaret(m_wpNew); 551 m_pEdit->SetCaret(m_wpNew);
552 m_pEdit->Backspace(FALSE,TRUE); 552 m_pEdit->Backspace(false,true);
553 } 553 }
554 } 554 }
555 555
556 /* -------------------------------------------------------------------------- */ 556 /* -------------------------------------------------------------------------- */
557 557
558 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, 558 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
559 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) : 559 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) :
560 m_pEdit(pEdit), 560 m_pEdit(pEdit),
561 m_wpOld(wpOldPlace), 561 m_wpOld(wpOldPlace),
562 m_wpNew(wpNewPlace), 562 m_wpNew(wpNewPlace),
563 m_SecProps(), 563 m_SecProps(),
564 m_WordProps() 564 m_WordProps()
565 { 565 {
566 if (pSecProps) 566 if (pSecProps)
567 m_SecProps = *pSecProps; 567 m_SecProps = *pSecProps;
568 if (pWordProps) 568 if (pWordProps)
569 m_WordProps = *pWordProps; 569 m_WordProps = *pWordProps;
570 } 570 }
571 571
572 CFXEU_InsertReturn::~CFXEU_InsertReturn() 572 CFXEU_InsertReturn::~CFXEU_InsertReturn()
573 { 573 {
574 } 574 }
575 575
576 void CFXEU_InsertReturn::Redo() 576 void CFXEU_InsertReturn::Redo()
577 { 577 {
578 if (m_pEdit) 578 if (m_pEdit)
579 { 579 {
580 m_pEdit->SelectNone(); 580 m_pEdit->SelectNone();
581 m_pEdit->SetCaret(m_wpOld); 581 m_pEdit->SetCaret(m_wpOld);
582 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); 582 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,true);
583 } 583 }
584 } 584 }
585 585
586 void CFXEU_InsertReturn::Undo() 586 void CFXEU_InsertReturn::Undo()
587 { 587 {
588 if (m_pEdit) 588 if (m_pEdit)
589 { 589 {
590 m_pEdit->SelectNone(); 590 m_pEdit->SelectNone();
591 m_pEdit->SetCaret(m_wpNew); 591 m_pEdit->SetCaret(m_wpNew);
592 m_pEdit->Backspace(FALSE,TRUE); 592 m_pEdit->Backspace(false,true);
593 } 593 }
594 } 594 }
595 595
596 /* -------------------------------------------------------------------------- */ 596 /* -------------------------------------------------------------------------- */
597 //CFXEU_Backspace 597 //CFXEU_Backspace
598 598
599 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP lace, const CPVT_WordPlace & wpNewPlace, 599 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP lace, const CPVT_WordPlace & wpNewPlace,
600 FX_WORD word, int32_t charset, 600 FX_WORD word, int32_t charset,
601 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps) : 601 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps) :
602 m_pEdit(pEdit), 602 m_pEdit(pEdit),
603 m_wpOld(wpOldPlace), 603 m_wpOld(wpOldPlace),
604 m_wpNew(wpNewPlace), 604 m_wpNew(wpNewPlace),
605 m_Word(word), 605 m_Word(word),
606 m_nCharset(charset), 606 m_nCharset(charset),
607 m_SecProps(SecProps), 607 m_SecProps(SecProps),
608 m_WordProps(WordProps) 608 m_WordProps(WordProps)
609 { 609 {
610 } 610 }
611 611
612 CFXEU_Backspace::~CFXEU_Backspace() 612 CFXEU_Backspace::~CFXEU_Backspace()
613 { 613 {
614 } 614 }
615 615
616 void CFXEU_Backspace::Redo() 616 void CFXEU_Backspace::Redo()
617 { 617 {
618 if (m_pEdit) 618 if (m_pEdit)
619 { 619 {
620 m_pEdit->SelectNone(); 620 m_pEdit->SelectNone();
621 m_pEdit->SetCaret(m_wpOld); 621 m_pEdit->SetCaret(m_wpOld);
622 m_pEdit->Backspace(FALSE,TRUE); 622 m_pEdit->Backspace(false,true);
623 } 623 }
624 } 624 }
625 625
626 void CFXEU_Backspace::Undo() 626 void CFXEU_Backspace::Undo()
627 { 627 {
628 if (m_pEdit) 628 if (m_pEdit)
629 { 629 {
630 m_pEdit->SelectNone(); 630 m_pEdit->SelectNone();
631 m_pEdit->SetCaret(m_wpNew); 631 m_pEdit->SetCaret(m_wpNew);
632 if (m_wpNew.SecCmp(m_wpOld) != 0) 632 if (m_wpNew.SecCmp(m_wpOld) != 0)
633 { 633 {
634 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); 634 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,true);
635 } 635 }
636 else 636 else
637 { 637 {
638 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); 638 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false,true);
639 } 639 }
640 } 640 }
641 } 641 }
642 642
643 /* -------------------------------------------------------------------------- */ 643 /* -------------------------------------------------------------------------- */
644 //CFXEU_Delete 644 //CFXEU_Delete
645 645
646 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, 646 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
647 FX_WORD word, int32_t charset, 647 FX_WORD word, int32_t charset,
648 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps, FX_BOOL bSecEnd) : 648 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps, bool bSecEnd) :
649 m_pEdit(pEdit), 649 m_pEdit(pEdit),
650 m_wpOld(wpOldPlace), 650 m_wpOld(wpOldPlace),
651 m_wpNew(wpNewPlace), 651 m_wpNew(wpNewPlace),
652 m_Word(word), 652 m_Word(word),
653 m_nCharset(charset), 653 m_nCharset(charset),
654 m_SecProps(SecProps), 654 m_SecProps(SecProps),
655 m_WordProps(WordProps), 655 m_WordProps(WordProps),
656 m_bSecEnd(bSecEnd) 656 m_bSecEnd(bSecEnd)
657 { 657 {
658 } 658 }
659 659
660 CFXEU_Delete::~CFXEU_Delete() 660 CFXEU_Delete::~CFXEU_Delete()
661 { 661 {
662 } 662 }
663 663
664 void CFXEU_Delete::Redo() 664 void CFXEU_Delete::Redo()
665 { 665 {
666 if (m_pEdit) 666 if (m_pEdit)
667 { 667 {
668 m_pEdit->SelectNone(); 668 m_pEdit->SelectNone();
669 m_pEdit->SetCaret(m_wpOld); 669 m_pEdit->SetCaret(m_wpOld);
670 m_pEdit->Delete(FALSE,TRUE); 670 m_pEdit->Delete(false,true);
671 } 671 }
672 } 672 }
673 673
674 void CFXEU_Delete::Undo() 674 void CFXEU_Delete::Undo()
675 { 675 {
676 if (m_pEdit) 676 if (m_pEdit)
677 { 677 {
678 m_pEdit->SelectNone(); 678 m_pEdit->SelectNone();
679 m_pEdit->SetCaret(m_wpNew); 679 m_pEdit->SetCaret(m_wpNew);
680 if (m_bSecEnd) 680 if (m_bSecEnd)
681 { 681 {
682 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); 682 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,true);
683 } 683 }
684 else 684 else
685 { 685 {
686 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); 686 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false,true);
687 } 687 }
688 } 688 }
689 } 689 }
690 690
691 /* -------------------------------------------------------------------------- */ 691 /* -------------------------------------------------------------------------- */
692 //CFXEU_Clear 692 //CFXEU_Clear
693 693
694 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText) : 694 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText) :
695 m_pEdit(pEdit), 695 m_pEdit(pEdit),
696 m_wrSel(wrSel), 696 m_wrSel(wrSel),
697 m_swText(swText) 697 m_swText(swText)
698 { 698 {
699 } 699 }
700 700
701 CFXEU_Clear::~CFXEU_Clear() 701 CFXEU_Clear::~CFXEU_Clear()
702 { 702 {
703 } 703 }
704 704
705 void CFXEU_Clear::Redo() 705 void CFXEU_Clear::Redo()
706 { 706 {
707 if (m_pEdit) 707 if (m_pEdit)
708 { 708 {
709 m_pEdit->SelectNone(); 709 m_pEdit->SelectNone();
710 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); 710 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos);
711 m_pEdit->Clear(FALSE,TRUE); 711 m_pEdit->Clear(false,true);
712 } 712 }
713 } 713 }
714 714
715 void CFXEU_Clear::Undo() 715 void CFXEU_Clear::Undo()
716 { 716 {
717 if (m_pEdit) 717 if (m_pEdit)
718 { 718 {
719 m_pEdit->SelectNone(); 719 m_pEdit->SelectNone();
720 m_pEdit->SetCaret(m_wrSel.BeginPos); 720 m_pEdit->SetCaret(m_wrSel.BeginPos);
721 m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NULL, FALSE , TRUE); 721 m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NULL, false , true);
722 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); 722 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos);
723 } 723 }
724 } 724 }
725 725
726 /* -------------------------------------------------------------------------- */ 726 /* -------------------------------------------------------------------------- */
727 //CFXEU_ClearRich 727 //CFXEU_ClearRich
728 728
729 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP lace, const CPVT_WordPlace & wpNewPlace, 729 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP lace, const CPVT_WordPlace & wpNewPlace,
730 const CPVT_WordRange & wrSel, FX_WORD word, int32 _t charset, 730 const CPVT_WordRange & wrSel, FX_WORD word, int32 _t charset,
731 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps) : 731 const CPVT_SecProps & SecProps, const CPVT_WordPr ops & WordProps) :
(...skipping 11 matching lines...) Expand all
743 CFXEU_ClearRich::~CFXEU_ClearRich() 743 CFXEU_ClearRich::~CFXEU_ClearRich()
744 { 744 {
745 } 745 }
746 746
747 void CFXEU_ClearRich::Redo() 747 void CFXEU_ClearRich::Redo()
748 { 748 {
749 if (m_pEdit && IsLast()) 749 if (m_pEdit && IsLast())
750 { 750 {
751 m_pEdit->SelectNone(); 751 m_pEdit->SelectNone();
752 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); 752 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos);
753 m_pEdit->Clear(FALSE,TRUE); 753 m_pEdit->Clear(false,true);
754 } 754 }
755 } 755 }
756 756
757 void CFXEU_ClearRich::Undo() 757 void CFXEU_ClearRich::Undo()
758 { 758 {
759 if (m_pEdit) 759 if (m_pEdit)
760 { 760 {
761 m_pEdit->SelectNone(); 761 m_pEdit->SelectNone();
762 m_pEdit->SetCaret(m_wpOld); 762 m_pEdit->SetCaret(m_wpOld);
763 if (m_wpNew.SecCmp(m_wpOld) != 0) 763 if (m_wpNew.SecCmp(m_wpOld) != 0)
764 { 764 {
765 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,FALSE); 765 m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,false);
766 } 766 }
767 else 767 else
768 { 768 {
769 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,FALSE); 769 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false,false);
770 } 770 }
771 771
772 if (IsFirst()) 772 if (IsFirst())
773 { 773 {
774 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos); 774 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos);
775 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); 775 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos);
776 } 776 }
777 } 777 }
778 } 778 }
779 /* -------------------------------------------------------------------------- */ 779 /* -------------------------------------------------------------------------- */
(...skipping 19 matching lines...) Expand all
799 CFXEU_InsertText::~CFXEU_InsertText() 799 CFXEU_InsertText::~CFXEU_InsertText()
800 { 800 {
801 } 801 }
802 802
803 void CFXEU_InsertText::Redo() 803 void CFXEU_InsertText::Redo()
804 { 804 {
805 if (m_pEdit && IsLast()) 805 if (m_pEdit && IsLast())
806 { 806 {
807 m_pEdit->SelectNone(); 807 m_pEdit->SelectNone();
808 m_pEdit->SetCaret(m_wpOld); 808 m_pEdit->SetCaret(m_wpOld);
809 m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &m_WordPr ops, FALSE, TRUE); 809 m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &m_WordPr ops, false, true);
810 } 810 }
811 } 811 }
812 812
813 void CFXEU_InsertText::Undo() 813 void CFXEU_InsertText::Undo()
814 { 814 {
815 if (m_pEdit) 815 if (m_pEdit)
816 { 816 {
817 m_pEdit->SelectNone(); 817 m_pEdit->SelectNone();
818 m_pEdit->SetSel(m_wpOld,m_wpNew); 818 m_pEdit->SetSel(m_wpOld,m_wpNew);
819 m_pEdit->Clear(FALSE,TRUE); 819 m_pEdit->Clear(false,true);
820 } 820 }
821 } 821 }
822 822
823 /* -------------------------------------------------------------------------- */ 823 /* -------------------------------------------------------------------------- */
824 824
825 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl ace, EDIT_PROPS_E ep, 825 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl ace, EDIT_PROPS_E ep,
826 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, 826 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops,
827 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range) 827 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range)
828 : m_pEdit(pEdit), 828 : m_pEdit(pEdit),
829 m_wpPlace(place), 829 m_wpPlace(place),
830 m_wrPlace(range), 830 m_wrPlace(range),
831 m_eProps(ep), 831 m_eProps(ep),
832 m_OldSecProps(oldsecprops), 832 m_OldSecProps(oldsecprops),
833 m_NewSecProps(newsecprops), 833 m_NewSecProps(newsecprops),
834 m_OldWordProps(oldwordprops), 834 m_OldWordProps(oldwordprops),
835 m_NewWordProps(newwordprops) 835 m_NewWordProps(newwordprops)
836 { 836 {
837 } 837 }
838 838
839 CFXEU_SetSecProps::~CFXEU_SetSecProps() 839 CFXEU_SetSecProps::~CFXEU_SetSecProps()
840 { 840 {
841 } 841 }
842 842
843 void CFXEU_SetSecProps::Redo() 843 void CFXEU_SetSecProps::Redo()
844 { 844 {
845 if (m_pEdit) 845 if (m_pEdit)
846 { 846 {
847 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWordProps,m _wrPlace,FALSE); 847 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWordProps,m _wrPlace,false);
848 if (IsLast()) 848 if (IsLast())
849 { 849 {
850 m_pEdit->SelectNone(); 850 m_pEdit->SelectNone();
851 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); 851 m_pEdit->PaintSetProps(m_eProps,m_wrPlace);
852 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); 852 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos);
853 } 853 }
854 } 854 }
855 } 855 }
856 856
857 void CFXEU_SetSecProps::Undo() 857 void CFXEU_SetSecProps::Undo()
858 { 858 {
859 if (m_pEdit) 859 if (m_pEdit)
860 { 860 {
861 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWordProps,m _wrPlace,FALSE); 861 m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWordProps,m _wrPlace,false);
862 if (IsFirst()) 862 if (IsFirst())
863 { 863 {
864 m_pEdit->SelectNone(); 864 m_pEdit->SelectNone();
865 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); 865 m_pEdit->PaintSetProps(m_eProps,m_wrPlace);
866 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); 866 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos);
867 } 867 }
868 } 868 }
869 } 869 }
870 870
871 /* -------------------------------------------------------------------------- */ 871 /* -------------------------------------------------------------------------- */
(...skipping 10 matching lines...) Expand all
882 } 882 }
883 883
884 CFXEU_SetWordProps::~CFXEU_SetWordProps() 884 CFXEU_SetWordProps::~CFXEU_SetWordProps()
885 { 885 {
886 } 886 }
887 887
888 void CFXEU_SetWordProps::Redo() 888 void CFXEU_SetWordProps::Redo()
889 { 889 {
890 if (m_pEdit) 890 if (m_pEdit)
891 { 891 {
892 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPlace,FALSE ); 892 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPlace,false );
893 if (IsLast()) 893 if (IsLast())
894 { 894 {
895 m_pEdit->SelectNone(); 895 m_pEdit->SelectNone();
896 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); 896 m_pEdit->PaintSetProps(m_eProps,m_wrPlace);
897 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); 897 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos);
898 } 898 }
899 } 899 }
900 } 900 }
901 901
902 void CFXEU_SetWordProps::Undo() 902 void CFXEU_SetWordProps::Undo()
903 { 903 {
904 if (m_pEdit) 904 if (m_pEdit)
905 { 905 {
906 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPlace,FALSE ); 906 m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPlace,false );
907 if (IsFirst()) 907 if (IsFirst())
908 { 908 {
909 m_pEdit->SelectNone(); 909 m_pEdit->SelectNone();
910 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); 910 m_pEdit->PaintSetProps(m_eProps,m_wrPlace);
911 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); 911 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos);
912 } 912 }
913 } 913 }
914 } 914 }
915 915
916 /* ------------------------------------- CFX_Edit ------------------------------ ------- */ 916 /* ------------------------------------- CFX_Edit ------------------------------ ------- */
917 917
918 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : 918 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) :
919 m_pVT(pVT), 919 m_pVT(pVT),
920 m_pNotify(NULL), 920 m_pNotify(NULL),
921 m_pOprNotify(NULL), 921 m_pOprNotify(NULL),
922 m_pVTProvide(NULL), 922 m_pVTProvide(NULL),
923 m_wpCaret(-1,-1,-1), 923 m_wpCaret(-1,-1,-1),
924 m_wpOldCaret(-1,-1,-1), 924 m_wpOldCaret(-1,-1,-1),
925 m_SelState(), 925 m_SelState(),
926 m_ptScrollPos(0,0), 926 m_ptScrollPos(0,0),
927 m_ptRefreshScrollPos(0,0), 927 m_ptRefreshScrollPos(0,0),
928 m_bEnableScroll(FALSE), 928 m_bEnableScroll(false),
929 m_pIterator(NULL), 929 m_pIterator(NULL),
930 m_ptCaret(0.0f,0.0f), 930 m_ptCaret(0.0f,0.0f),
931 m_Undo(FX_EDIT_UNDO_MAXITEM), 931 m_Undo(FX_EDIT_UNDO_MAXITEM),
932 m_nAlignment(0), 932 m_nAlignment(0),
933 m_bNotifyFlag(FALSE), 933 m_bNotifyFlag(false),
934 m_bEnableOverflow(FALSE), 934 m_bEnableOverflow(false),
935 m_bEnableRefresh(TRUE), 935 m_bEnableRefresh(true),
936 m_rcOldContent(0.0f,0.0f,0.0f,0.0f), 936 m_rcOldContent(0.0f,0.0f,0.0f,0.0f),
937 m_bEnableUndo(TRUE), 937 m_bEnableUndo(true),
938 m_bNotify(TRUE), 938 m_bNotify(true),
939 m_bOprNotify(FALSE), 939 m_bOprNotify(false),
940 m_pGroupUndoItem(NULL) 940 m_pGroupUndoItem(NULL)
941 { 941 {
942 ASSERT(pVT != NULL); 942 ASSERT(pVT != NULL);
943 } 943 }
944 944
945 CFX_Edit::~CFX_Edit() 945 CFX_Edit::~CFX_Edit()
946 { 946 {
947 delete m_pVTProvide; 947 delete m_pVTProvide;
948 m_pVTProvide = NULL; 948 m_pVTProvide = NULL;
949 delete m_pIterator; 949 delete m_pIterator;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 } 995 }
996 996
997 IFX_Edit_FontMap* CFX_Edit::GetFontMap() 997 IFX_Edit_FontMap* CFX_Edit::GetFontMap()
998 { 998 {
999 if (m_pVTProvide) 999 if (m_pVTProvide)
1000 return m_pVTProvide->GetFontMap(); 1000 return m_pVTProvide->GetFontMap();
1001 1001
1002 return NULL; 1002 return NULL;
1003 } 1003 }
1004 1004
1005 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) 1005 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, bool bPaint/* = true*/)
1006 { 1006 {
1007 m_pVT->SetPlateRect(rect); 1007 m_pVT->SetPlateRect(rect);
1008 m_ptScrollPos = CPDF_Point(rect.left,rect.top); 1008 m_ptScrollPos = CPDF_Point(rect.left,rect.top);
1009 if (bPaint) Paint(); 1009 if (bPaint) Paint();
1010 } 1010 }
1011 1011
1012 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) 1012 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, bool bPaint/* = true*/)
1013 { 1013 {
1014 m_pVT->SetAlignment(nFormat); 1014 m_pVT->SetAlignment(nFormat);
1015 if (bPaint) Paint(); 1015 if (bPaint) Paint();
1016 } 1016 }
1017 1017
1018 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) 1018 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, bool bPaint/* = true*/)
1019 { 1019 {
1020 m_nAlignment = nFormat; 1020 m_nAlignment = nFormat;
1021 if (bPaint) Paint(); 1021 if (bPaint) Paint();
1022 } 1022 }
1023 1023
1024 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR UE*/) 1024 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, bool bPaint/* = true* /)
1025 { 1025 {
1026 m_pVT->SetPasswordChar(wSubWord); 1026 m_pVT->SetPasswordChar(wSubWord);
1027 if (bPaint) Paint(); 1027 if (bPaint) Paint();
1028 } 1028 }
1029 1029
1030 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE* /) 1030 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, bool bPaint/* = true*/)
1031 { 1031 {
1032 m_pVT->SetLimitChar(nLimitChar); 1032 m_pVT->SetLimitChar(nLimitChar);
1033 if (bPaint) Paint(); 1033 if (bPaint) Paint();
1034 } 1034 }
1035 1035
1036 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE* /) 1036 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, bool bPaint/* = true*/)
1037 { 1037 {
1038 m_pVT->SetCharArray(nCharArray); 1038 m_pVT->SetCharArray(nCharArray);
1039 if (bPaint) Paint(); 1039 if (bPaint) Paint();
1040 } 1040 }
1041 1041
1042 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T RUE*/) 1042 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, bool bPaint/* = true */)
1043 { 1043 {
1044 m_pVT->SetCharSpace(fCharSpace); 1044 m_pVT->SetCharSpace(fCharSpace);
1045 if (bPaint) Paint(); 1045 if (bPaint) Paint();
1046 } 1046 }
1047 1047
1048 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRU E*/) 1048 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, bool bPaint/* = true*/ )
1049 { 1049 {
1050 m_pVT->SetHorzScale(nHorzScale); 1050 m_pVT->SetHorzScale(nHorzScale);
1051 if (bPaint) Paint(); 1051 if (bPaint) Paint();
1052 } 1052 }
1053 1053
1054 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR UE*/) 1054 void CFX_Edit::SetMultiLine(bool bMultiLine/* =true */, bool bPaint/* = true*/)
1055 { 1055 {
1056 m_pVT->SetMultiLine(bMultiLine); 1056 m_pVT->SetMultiLine(bMultiLine);
1057 if (bPaint) Paint(); 1057 if (bPaint) Paint();
1058 } 1058 }
1059 1059
1060 void CFX_Edit::SetAutoReturn(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/ ) 1060 void CFX_Edit::SetAutoReturn(bool bAuto/* =true */, bool bPaint/* = true*/)
1061 { 1061 {
1062 m_pVT->SetAutoReturn(bAuto); 1062 m_pVT->SetAutoReturn(bAuto);
1063 if (bPaint) Paint(); 1063 if (bPaint) Paint();
1064 } 1064 }
1065 1065
1066 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =TRUE */, FX_BOOL bPaint/* = TRUE*/) 1066 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =true */, bool bPaint/* = true*/)
1067 { 1067 {
1068 m_pVT->SetLineLeading(fLineLeading); 1068 m_pVT->SetLineLeading(fLineLeading);
1069 if (bPaint) Paint(); 1069 if (bPaint) Paint();
1070 } 1070 }
1071 1071
1072 void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE */) 1072 void CFX_Edit::SetAutoFontSize(bool bAuto/* =true */, bool bPaint/* = true*/)
1073 { 1073 {
1074 m_pVT->SetAutoFontSize(bAuto); 1074 m_pVT->SetAutoFontSize(bAuto);
1075 if (bPaint) Paint(); 1075 if (bPaint) Paint();
1076 } 1076 }
1077 1077
1078 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint/* = TRUE*/) 1078 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, bool bPaint/* = true*/)
1079 { 1079 {
1080 m_pVT->SetFontSize(fFontSize); 1080 m_pVT->SetFontSize(fFontSize);
1081 if (bPaint) Paint(); 1081 if (bPaint) Paint();
1082 } 1082 }
1083 1083
1084 void CFX_Edit::SetAutoScroll(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/ ) 1084 void CFX_Edit::SetAutoScroll(bool bAuto/* =true */, bool bPaint/* = true*/)
1085 { 1085 {
1086 m_bEnableScroll = bAuto; 1086 m_bEnableScroll = bAuto;
1087 if (bPaint) Paint(); 1087 if (bPaint) Paint();
1088 } 1088 }
1089 1089
1090 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* = TRUE*/) 1090 void CFX_Edit::SetTextOverflow(bool bAllowed /*= false*/, bool bPaint/* = true*/ )
1091 { 1091 {
1092 m_bEnableOverflow = bAllowed; 1092 m_bEnableOverflow = bAllowed;
1093 if (bPaint) Paint(); 1093 if (bPaint) Paint();
1094 } 1094 }
1095 1095
1096 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) 1096 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar)
1097 { 1097 {
1098 if (m_pVT->IsValid()) 1098 if (m_pVT->IsValid())
1099 { 1099 {
1100 if (nStartChar == 0 && nEndChar < 0) 1100 if (nStartChar == 0 && nEndChar < 0)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 } 1186 }
1187 1187
1188 CFX_WideString CFX_Edit::GetText() const 1188 CFX_WideString CFX_Edit::GetText() const
1189 { 1189 {
1190 CFX_WideString swRet; 1190 CFX_WideString swRet;
1191 1191
1192 if (m_pVT->IsValid()) 1192 if (m_pVT->IsValid())
1193 { 1193 {
1194 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 1194 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
1195 { 1195 {
1196 FX_BOOL bRich = m_pVT->IsRichText(); 1196 bool bRich = m_pVT->IsRichText();
1197 1197
1198 pIterator->SetAt(0); 1198 pIterator->SetAt(0);
1199 1199
1200 CPVT_Word wordinfo; 1200 CPVT_Word wordinfo;
1201 CPVT_WordPlace oldplace = pIterator->GetAt(); 1201 CPVT_WordPlace oldplace = pIterator->GetAt();
1202 while (pIterator->NextWord()) 1202 while (pIterator->NextWord())
1203 { 1203 {
1204 CPVT_WordPlace place = pIterator->GetAt(); 1204 CPVT_WordPlace place = pIterator->GetAt();
1205 1205
1206 if (pIterator->GetWord(wordinfo)) 1206 if (pIterator->GetWord(wordinfo))
(...skipping 21 matching lines...) Expand all
1228 1228
1229 return swRet; 1229 return swRet;
1230 } 1230 }
1231 1231
1232 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const 1232 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const
1233 { 1233 {
1234 CFX_WideString swRet; 1234 CFX_WideString swRet;
1235 1235
1236 if (m_pVT->IsValid()) 1236 if (m_pVT->IsValid())
1237 { 1237 {
1238 FX_BOOL bRich = m_pVT->IsRichText(); 1238 bool bRich = m_pVT->IsRichText();
1239 1239
1240 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 1240 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
1241 { 1241 {
1242 CPVT_WordRange wrTemp = range; 1242 CPVT_WordRange wrTemp = range;
1243 m_pVT->UpdateWordPlace(wrTemp.BeginPos); 1243 m_pVT->UpdateWordPlace(wrTemp.BeginPos);
1244 m_pVT->UpdateWordPlace(wrTemp.EndPos); 1244 m_pVT->UpdateWordPlace(wrTemp.EndPos);
1245 pIterator->SetAt(wrTemp.BeginPos); 1245 pIterator->SetAt(wrTemp.BeginPos);
1246 1246
1247 CPVT_Word wordinfo; 1247 CPVT_Word wordinfo;
1248 CPVT_WordPlace oldplace = wrTemp.BeginPos; 1248 CPVT_WordPlace oldplace = wrTemp.BeginPos;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 wrRet.EndPos = wr2.EndPos; 1324 wrRet.EndPos = wr2.EndPos;
1325 } 1325 }
1326 else 1326 else
1327 { 1327 {
1328 wrRet.EndPos = wr1.EndPos; 1328 wrRet.EndPos = wr1.EndPos;
1329 } 1329 }
1330 1330
1331 return wrRet; 1331 return wrRet;
1332 } 1332 }
1333 1333
1334 FX_BOOL CFX_Edit::IsRichText() const 1334 bool CFX_Edit::IsRichText() const
1335 { 1335 {
1336 return m_pVT->IsRichText(); 1336 return m_pVT->IsRichText();
1337 } 1337 }
1338 1338
1339 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE */) 1339 void CFX_Edit::SetRichText(bool bRichText/* =true */, bool bPaint/* = true*/)
1340 { 1340 {
1341 m_pVT->SetRichText(bRichText); 1341 m_pVT->SetRichText(bRichText);
1342 if (bPaint) Paint(); 1342 if (bPaint) Paint();
1343 } 1343 }
1344 1344
1345 FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) 1345 bool CFX_Edit::SetRichFontIndex(int32_t nFontIndex)
1346 { 1346 {
1347 CPVT_WordProps WordProps; 1347 CPVT_WordProps WordProps;
1348 WordProps.nFontIndex = nFontIndex; 1348 WordProps.nFontIndex = nFontIndex;
1349 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); 1349 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps);
1350 } 1350 }
1351 1351
1352 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) 1352 bool CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize)
1353 { 1353 {
1354 CPVT_WordProps WordProps; 1354 CPVT_WordProps WordProps;
1355 WordProps.fFontSize = fFontSize; 1355 WordProps.fFontSize = fFontSize;
1356 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); 1356 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps);
1357 } 1357 }
1358 1358
1359 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) 1359 bool CFX_Edit::SetRichTextColor(FX_COLORREF dwColor)
1360 { 1360 {
1361 CPVT_WordProps WordProps; 1361 CPVT_WordProps WordProps;
1362 WordProps.dwWordColor = dwColor; 1362 WordProps.dwWordColor = dwColor;
1363 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); 1363 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps);
1364 } 1364 }
1365 1365
1366 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) 1366 bool CFX_Edit::SetRichTextScript(int32_t nScriptType)
1367 { 1367 {
1368 CPVT_WordProps WordProps; 1368 CPVT_WordProps WordProps;
1369 WordProps.nScriptType = nScriptType; 1369 WordProps.nScriptType = nScriptType;
1370 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); 1370 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps);
1371 } 1371 }
1372 1372
1373 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) 1373 bool CFX_Edit::SetRichTextBold(bool bBold)
1374 { 1374 {
1375 CPVT_WordProps WordProps; 1375 CPVT_WordProps WordProps;
1376 if (bBold) 1376 if (bBold)
1377 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; 1377 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD;
1378 return SetRichTextProps(EP_BOLD,NULL,&WordProps); 1378 return SetRichTextProps(EP_BOLD,NULL,&WordProps);
1379 } 1379 }
1380 1380
1381 FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) 1381 bool CFX_Edit::SetRichTextItalic(bool bItalic)
1382 { 1382 {
1383 CPVT_WordProps WordProps; 1383 CPVT_WordProps WordProps;
1384 if (bItalic) 1384 if (bItalic)
1385 WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; 1385 WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC;
1386 return SetRichTextProps(EP_ITALIC,NULL,&WordProps); 1386 return SetRichTextProps(EP_ITALIC,NULL,&WordProps);
1387 } 1387 }
1388 1388
1389 FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) 1389 bool CFX_Edit::SetRichTextUnderline(bool bUnderline)
1390 { 1390 {
1391 CPVT_WordProps WordProps; 1391 CPVT_WordProps WordProps;
1392 if (bUnderline) 1392 if (bUnderline)
1393 WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; 1393 WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE;
1394 return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps); 1394 return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps);
1395 } 1395 }
1396 1396
1397 FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) 1397 bool CFX_Edit::SetRichTextCrossout(bool bCrossout)
1398 { 1398 {
1399 CPVT_WordProps WordProps; 1399 CPVT_WordProps WordProps;
1400 if (bCrossout) 1400 if (bCrossout)
1401 WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; 1401 WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT;
1402 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); 1402 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps);
1403 } 1403 }
1404 1404
1405 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) 1405 bool CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace)
1406 { 1406 {
1407 CPVT_WordProps WordProps; 1407 CPVT_WordProps WordProps;
1408 WordProps.fCharSpace = fCharSpace; 1408 WordProps.fCharSpace = fCharSpace;
1409 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); 1409 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps);
1410 } 1410 }
1411 1411
1412 FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) 1412 bool CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/)
1413 { 1413 {
1414 CPVT_WordProps WordProps; 1414 CPVT_WordProps WordProps;
1415 WordProps.nHorzScale = nHorzScale; 1415 WordProps.nHorzScale = nHorzScale;
1416 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); 1416 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps);
1417 } 1417 }
1418 1418
1419 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) 1419 bool CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading)
1420 { 1420 {
1421 CPVT_SecProps SecProps; 1421 CPVT_SecProps SecProps;
1422 SecProps.fLineLeading = fLineLeading; 1422 SecProps.fLineLeading = fLineLeading;
1423 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); 1423 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL);
1424 } 1424 }
1425 1425
1426 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) 1426 bool CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent)
1427 { 1427 {
1428 CPVT_SecProps SecProps; 1428 CPVT_SecProps SecProps;
1429 SecProps.fLineIndent = fLineIndent; 1429 SecProps.fLineIndent = fLineIndent;
1430 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); 1430 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL);
1431 } 1431 }
1432 1432
1433 FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) 1433 bool CFX_Edit::SetRichTextAlignment(int32_t nAlignment)
1434 { 1434 {
1435 CPVT_SecProps SecProps; 1435 CPVT_SecProps SecProps;
1436 SecProps.nAlignment = nAlignment; 1436 SecProps.nAlignment = nAlignment;
1437 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); 1437 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL);
1438 } 1438 }
1439 1439
1440 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS ecProps, const CPVT_WordProps * pWordProps) 1440 bool CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pSecP rops, const CPVT_WordProps * pWordProps)
1441 { 1441 {
1442 FX_BOOL bSet = FALSE; 1442 bool bSet = false;
1443 FX_BOOL bSet1,bSet2; 1443 bool bSet1,bSet2;
1444 if (m_pVT->IsValid() && m_pVT->IsRichText()) 1444 if (m_pVT->IsValid() && m_pVT->IsRichText())
1445 { 1445 {
1446 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 1446 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
1447 { 1447 {
1448 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); 1448 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange();
1449 1449
1450 m_pVT->UpdateWordPlace(wrTemp.BeginPos); 1450 m_pVT->UpdateWordPlace(wrTemp.BeginPos);
1451 m_pVT->UpdateWordPlace(wrTemp.EndPos); 1451 m_pVT->UpdateWordPlace(wrTemp.EndPos);
1452 pIterator->SetAt(wrTemp.BeginPos); 1452 pIterator->SetAt(wrTemp.BeginPos);
1453 1453
1454 BeginGroupUndo(L"");; 1454 BeginGroupUndo(L"");;
1455 1455
1456 bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWordProps,wrTem p,TRUE); 1456 bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWordProps,wrTem p,true);
1457 1457
1458 while (pIterator->NextWord()) 1458 while (pIterator->NextWord())
1459 { 1459 {
1460 CPVT_WordPlace place = pIterator->GetAt(); 1460 CPVT_WordPlace place = pIterator->GetAt();
1461 if (place.WordCmp(wrTemp.EndPos) > 0) break; 1461 if (place.WordCmp(wrTemp.EndPos) > 0) break;
1462 bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,TRU E); 1462 bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,tru e);
1463 bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,TRUE); 1463 bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,true);
1464 1464
1465 if (!bSet) 1465 if (!bSet)
1466 bSet = (bSet1 || bSet2); 1466 bSet = (bSet1 || bSet2);
1467 } 1467 }
1468 1468
1469 EndGroupUndo(); 1469 EndGroupUndo();
1470 1470
1471 if (bSet) 1471 if (bSet)
1472 { 1472 {
1473 PaintSetProps(eProps,wrTemp); 1473 PaintSetProps(eProps,wrTemp);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos), 1509 CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos),
1510 m_pVT->GetSectionEndPlace(wr.EndPos)); 1510 m_pVT->GetSectionEndPlace(wr.EndPos));
1511 Refresh(RP_ANALYSE,&wrRefresh); 1511 Refresh(RP_ANALYSE,&wrRefresh);
1512 1512
1513 SetCaretOrigin(); 1513 SetCaretOrigin();
1514 SetCaretInfo(); 1514 SetCaretInfo();
1515 break; 1515 break;
1516 } 1516 }
1517 } 1517 }
1518 1518
1519 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 1519 bool CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
1520 const CPVT_SecProps * pSecProps, const CPVT_WordP rops * pWordProps, 1520 const CPVT_SecProps * pSecProps, const CPVT_WordP rops * pWordProps,
1521 const CPVT_WordRange & wr, FX_BOOL bAddUndo) 1521 const CPVT_WordRange & wr, bool bAddUndo)
1522 { 1522 {
1523 if (m_pVT->IsValid() && m_pVT->IsRichText()) 1523 if (m_pVT->IsValid() && m_pVT->IsRichText())
1524 { 1524 {
1525 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 1525 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
1526 { 1526 {
1527 FX_BOOL bSet = FALSE; 1527 bool bSet = false;
1528 CPVT_Section secinfo; 1528 CPVT_Section secinfo;
1529 CPVT_Section OldSecinfo; 1529 CPVT_Section OldSecinfo;
1530 1530
1531 CPVT_WordPlace oldplace = pIterator->GetAt(); 1531 CPVT_WordPlace oldplace = pIterator->GetAt();
1532 1532
1533 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT || eProps == EP_ALIGNMENT) 1533 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT || eProps == EP_ALIGNMENT)
1534 { 1534 {
1535 if (pSecProps) 1535 if (pSecProps)
1536 { 1536 {
1537 pIterator->SetAt(place); 1537 pIterator->SetAt(place);
1538 if (pIterator->GetSection(secinfo)) 1538 if (pIterator->GetSection(secinfo))
1539 { 1539 {
1540 if (bAddUndo) OldSecinfo = secinfo; 1540 if (bAddUndo) OldSecinfo = secinfo;
1541 1541
1542 switch(eProps) 1542 switch(eProps)
1543 { 1543 {
1544 case EP_LINELEADING: 1544 case EP_LINELEADING:
1545 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLead ing,pSecProps->fLineLeading)) 1545 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLead ing,pSecProps->fLineLeading))
1546 { 1546 {
1547 secinfo.SecProps.fLineLeading = pSecProps->fLine Leading; 1547 secinfo.SecProps.fLineLeading = pSecProps->fLine Leading;
1548 bSet = TRUE; 1548 bSet = true;
1549 } 1549 }
1550 break; 1550 break;
1551 case EP_LINEINDENT: 1551 case EP_LINEINDENT:
1552 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineInde nt,pSecProps->fLineIndent)) 1552 if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineInde nt,pSecProps->fLineIndent))
1553 { 1553 {
1554 secinfo.SecProps.fLineIndent = pSecProps->fLineI ndent; 1554 secinfo.SecProps.fLineIndent = pSecProps->fLineI ndent;
1555 bSet = TRUE; 1555 bSet = true;
1556 } 1556 }
1557 break; 1557 break;
1558 case EP_ALIGNMENT: 1558 case EP_ALIGNMENT:
1559 if (secinfo.SecProps.nAlignment != pSecProps->nAlign ment) 1559 if (secinfo.SecProps.nAlignment != pSecProps->nAlign ment)
1560 { 1560 {
1561 secinfo.SecProps.nAlignment = pSecProps->nAlignm ent; 1561 secinfo.SecProps.nAlignment = pSecProps->nAlignm ent;
1562 bSet = TRUE; 1562 bSet = true;
1563 } 1563 }
1564 break; 1564 break;
1565 default: 1565 default:
1566 break; 1566 break;
1567 } 1567 }
1568 } 1568 }
1569 } 1569 }
1570 } 1570 }
1571 else 1571 else
1572 { 1572 {
1573 if (pWordProps && place == m_pVT->GetSectionBeginPlace(place)) 1573 if (pWordProps && place == m_pVT->GetSectionBeginPlace(place))
1574 { 1574 {
1575 pIterator->SetAt(place); 1575 pIterator->SetAt(place);
1576 if (pIterator->GetSection(secinfo)) 1576 if (pIterator->GetSection(secinfo))
1577 { 1577 {
1578 if (bAddUndo) OldSecinfo = secinfo; 1578 if (bAddUndo) OldSecinfo = secinfo;
1579 1579
1580 switch(eProps) 1580 switch(eProps)
1581 { 1581 {
1582 case EP_FONTINDEX: 1582 case EP_FONTINDEX:
1583 if (secinfo.WordProps.nFontIndex != pWordProps->nFon tIndex) 1583 if (secinfo.WordProps.nFontIndex != pWordProps->nFon tIndex)
1584 { 1584 {
1585 secinfo.WordProps.nFontIndex = pWordProps->nFont Index; 1585 secinfo.WordProps.nFontIndex = pWordProps->nFont Index;
1586 bSet = TRUE; 1586 bSet = true;
1587 } 1587 }
1588 break; 1588 break;
1589 case EP_FONTSIZE: 1589 case EP_FONTSIZE:
1590 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fFontSiz e,pWordProps->fFontSize)) 1590 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fFontSiz e,pWordProps->fFontSize))
1591 { 1591 {
1592 secinfo.WordProps.fFontSize = pWordProps->fFontS ize; 1592 secinfo.WordProps.fFontSize = pWordProps->fFontS ize;
1593 bSet = TRUE; 1593 bSet = true;
1594 } 1594 }
1595 break; 1595 break;
1596 case EP_WORDCOLOR: 1596 case EP_WORDCOLOR:
1597 if (secinfo.WordProps.dwWordColor != pWordProps->dwW ordColor) 1597 if (secinfo.WordProps.dwWordColor != pWordProps->dwW ordColor)
1598 { 1598 {
1599 secinfo.WordProps.dwWordColor = pWordProps->dwWo rdColor; 1599 secinfo.WordProps.dwWordColor = pWordProps->dwWo rdColor;
1600 bSet = TRUE; 1600 bSet = true;
1601 } 1601 }
1602 break; 1602 break;
1603 case EP_SCRIPTTYPE: 1603 case EP_SCRIPTTYPE:
1604 if (secinfo.WordProps.nScriptType != pWordProps->nSc riptType) 1604 if (secinfo.WordProps.nScriptType != pWordProps->nSc riptType)
1605 { 1605 {
1606 secinfo.WordProps.nScriptType = pWordProps->nScr iptType; 1606 secinfo.WordProps.nScriptType = pWordProps->nScr iptType;
1607 bSet = TRUE; 1607 bSet = true;
1608 } 1608 }
1609 break; 1609 break;
1610 case EP_CHARSPACE: 1610 case EP_CHARSPACE:
1611 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpa ce,pWordProps->fCharSpace)) 1611 if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpa ce,pWordProps->fCharSpace))
1612 { 1612 {
1613 secinfo.WordProps.fCharSpace = pWordProps->fChar Space; 1613 secinfo.WordProps.fCharSpace = pWordProps->fChar Space;
1614 bSet = TRUE; 1614 bSet = true;
1615 } 1615 }
1616 break; 1616 break;
1617 case EP_HORZSCALE: 1617 case EP_HORZSCALE:
1618 if (secinfo.WordProps.nHorzScale != pWordProps->nHor zScale) 1618 if (secinfo.WordProps.nHorzScale != pWordProps->nHor zScale)
1619 { 1619 {
1620 secinfo.WordProps.nHorzScale = pWordProps->nHorz Scale; 1620 secinfo.WordProps.nHorzScale = pWordProps->nHorz Scale;
1621 bSet = TRUE; 1621 bSet = true;
1622 } 1622 }
1623 break; 1623 break;
1624 case EP_UNDERLINE: 1624 case EP_UNDERLINE:
1625 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE ) 1625 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE )
1626 { 1626 {
1627 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_UNDERLINE) == 0) 1627 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_UNDERLINE) == 0)
1628 { 1628 {
1629 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_UNDERLINE; 1629 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_UNDERLINE;
1630 bSet = TRUE; 1630 bSet = true;
1631 } 1631 }
1632 } 1632 }
1633 else 1633 else
1634 { 1634 {
1635 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_UNDERLINE) != 0) 1635 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_UNDERLINE) != 0)
1636 { 1636 {
1637 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_UNDERLINE; 1637 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_UNDERLINE;
1638 bSet = TRUE; 1638 bSet = true;
1639 } 1639 }
1640 } 1640 }
1641 break; 1641 break;
1642 case EP_CROSSOUT: 1642 case EP_CROSSOUT:
1643 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) 1643 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT)
1644 { 1644 {
1645 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_CROSSOUT) == 0) 1645 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_CROSSOUT) == 0)
1646 { 1646 {
1647 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_CROSSOUT; 1647 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_CROSSOUT;
1648 bSet = TRUE; 1648 bSet = true;
1649 } 1649 }
1650 } 1650 }
1651 else 1651 else
1652 { 1652 {
1653 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_CROSSOUT) != 0) 1653 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_CROSSOUT) != 0)
1654 { 1654 {
1655 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_CROSSOUT; 1655 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_CROSSOUT;
1656 bSet = TRUE; 1656 bSet = true;
1657 } 1657 }
1658 } 1658 }
1659 break; 1659 break;
1660 case EP_BOLD: 1660 case EP_BOLD:
1661 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) 1661 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD)
1662 { 1662 {
1663 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_BOLD) == 0) 1663 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_BOLD) == 0)
1664 { 1664 {
1665 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_BOLD; 1665 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_BOLD;
1666 bSet = TRUE; 1666 bSet = true;
1667 } 1667 }
1668 } 1668 }
1669 else 1669 else
1670 { 1670 {
1671 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_BOLD) != 0) 1671 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_BOLD) != 0)
1672 { 1672 {
1673 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_BOLD; 1673 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_BOLD;
1674 bSet = TRUE; 1674 bSet = true;
1675 } 1675 }
1676 } 1676 }
1677 break; 1677 break;
1678 case EP_ITALIC: 1678 case EP_ITALIC:
1679 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) 1679 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC)
1680 { 1680 {
1681 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_ITALIC) == 0) 1681 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_ITALIC) == 0)
1682 { 1682 {
1683 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_ITALIC; 1683 secinfo.WordProps.nWordStyle |= PVTWORD_STYL E_ITALIC;
1684 bSet = TRUE; 1684 bSet = true;
1685 } 1685 }
1686 } 1686 }
1687 else 1687 else
1688 { 1688 {
1689 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_ITALIC) != 0) 1689 if ((secinfo.WordProps.nWordStyle & PVTWORD_STYL E_ITALIC) != 0)
1690 { 1690 {
1691 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_ITALIC; 1691 secinfo.WordProps.nWordStyle &= ~PVTWORD_STY LE_ITALIC;
1692 bSet = TRUE; 1692 bSet = true;
1693 } 1693 }
1694 } 1694 }
1695 break; 1695 break;
1696 default: 1696 default:
1697 break; 1697 break;
1698 } 1698 }
1699 } 1699 }
1700 } 1700 }
1701 } 1701 }
1702 1702
1703 if (bSet) 1703 if (bSet)
1704 { 1704 {
1705 pIterator->SetSection(secinfo); 1705 pIterator->SetSection(secinfo);
1706 1706
1707 if (bAddUndo && m_bEnableUndo) 1707 if (bAddUndo && m_bEnableUndo)
1708 { 1708 {
1709 AddEditUndoItem(new CFXEU_SetSecProps 1709 AddEditUndoItem(new CFXEU_SetSecProps
1710 (this,place,eProps,OldSecinfo.SecProps,OldSecinfo.WordPr ops,secinfo.SecProps,secinfo.WordProps,wr)); 1710 (this,place,eProps,OldSecinfo.SecProps,OldSecinfo.WordPr ops,secinfo.SecProps,secinfo.WordProps,wr));
1711 } 1711 }
1712 } 1712 }
1713 1713
1714 pIterator->SetAt(oldplace); 1714 pIterator->SetAt(oldplace);
1715 1715
1716 return bSet; 1716 return bSet;
1717 } 1717 }
1718 } 1718 }
1719 1719
1720 return FALSE; 1720 return false;
1721 } 1721 }
1722 1722
1723 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place , 1723 bool CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
1724 const CPVT_WordProps * pWordProps, const CPVT_Wo rdRange & wr, FX_BOOL bAddUndo) 1724 const CPVT_WordProps * pWordProps, const CPVT_Wo rdRange & wr, bool bAddUndo)
1725 { 1725 {
1726 if (m_pVT->IsValid() && m_pVT->IsRichText()) 1726 if (m_pVT->IsValid() && m_pVT->IsRichText())
1727 { 1727 {
1728 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 1728 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
1729 { 1729 {
1730 FX_BOOL bSet = FALSE; 1730 bool bSet = false;
1731 CPVT_Word wordinfo; 1731 CPVT_Word wordinfo;
1732 CPVT_Word OldWordinfo; 1732 CPVT_Word OldWordinfo;
1733 1733
1734 CPVT_WordPlace oldplace = pIterator->GetAt(); 1734 CPVT_WordPlace oldplace = pIterator->GetAt();
1735 1735
1736 if (pWordProps) 1736 if (pWordProps)
1737 { 1737 {
1738 pIterator->SetAt(place); 1738 pIterator->SetAt(place);
1739 if (pIterator->GetWord(wordinfo)) 1739 if (pIterator->GetWord(wordinfo))
1740 { 1740 {
1741 if (bAddUndo) OldWordinfo = wordinfo; 1741 if (bAddUndo) OldWordinfo = wordinfo;
1742 1742
1743 switch(eProps) 1743 switch(eProps)
1744 { 1744 {
1745 case EP_FONTINDEX: 1745 case EP_FONTINDEX:
1746 if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIn dex) 1746 if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIn dex)
1747 { 1747 {
1748 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) 1748 if (IFX_Edit_FontMap* pFontMap = GetFontMap())
1749 { 1749 {
1750 wordinfo.WordProps.nFontIndex = pFontMap->GetWor dFontIndex(wordinfo.Word,wordinfo.nCharset,pWordProps->nFontIndex); 1750 wordinfo.WordProps.nFontIndex = pFontMap->GetWor dFontIndex(wordinfo.Word,wordinfo.nCharset,pWordProps->nFontIndex);
1751 } 1751 }
1752 bSet = TRUE; 1752 bSet = true;
1753 } 1753 }
1754 break; 1754 break;
1755 case EP_FONTSIZE: 1755 case EP_FONTSIZE:
1756 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize,p WordProps->fFontSize)) 1756 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize,p WordProps->fFontSize))
1757 { 1757 {
1758 wordinfo.WordProps.fFontSize = pWordProps->fFontSize ; 1758 wordinfo.WordProps.fFontSize = pWordProps->fFontSize ;
1759 bSet = TRUE; 1759 bSet = true;
1760 } 1760 }
1761 break; 1761 break;
1762 case EP_WORDCOLOR: 1762 case EP_WORDCOLOR:
1763 if (wordinfo.WordProps.dwWordColor != pWordProps->dwWord Color) 1763 if (wordinfo.WordProps.dwWordColor != pWordProps->dwWord Color)
1764 { 1764 {
1765 wordinfo.WordProps.dwWordColor = pWordProps->dwWordC olor; 1765 wordinfo.WordProps.dwWordColor = pWordProps->dwWordC olor;
1766 bSet = TRUE; 1766 bSet = true;
1767 } 1767 }
1768 break; 1768 break;
1769 case EP_SCRIPTTYPE: 1769 case EP_SCRIPTTYPE:
1770 if (wordinfo.WordProps.nScriptType != pWordProps->nScrip tType) 1770 if (wordinfo.WordProps.nScriptType != pWordProps->nScrip tType)
1771 { 1771 {
1772 wordinfo.WordProps.nScriptType = pWordProps->nScript Type; 1772 wordinfo.WordProps.nScriptType = pWordProps->nScript Type;
1773 bSet = TRUE; 1773 bSet = true;
1774 } 1774 }
1775 break; 1775 break;
1776 case EP_CHARSPACE: 1776 case EP_CHARSPACE:
1777 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fCharSpace, pWordProps->fCharSpace)) 1777 if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fCharSpace, pWordProps->fCharSpace))
1778 { 1778 {
1779 wordinfo.WordProps.fCharSpace = pWordProps->fCharSpa ce; 1779 wordinfo.WordProps.fCharSpace = pWordProps->fCharSpa ce;
1780 bSet = TRUE; 1780 bSet = true;
1781 } 1781 }
1782 break; 1782 break;
1783 case EP_HORZSCALE: 1783 case EP_HORZSCALE:
1784 if (wordinfo.WordProps.nHorzScale != pWordProps->nHorzSc ale) 1784 if (wordinfo.WordProps.nHorzScale != pWordProps->nHorzSc ale)
1785 { 1785 {
1786 wordinfo.WordProps.nHorzScale = pWordProps->nHorzSca le; 1786 wordinfo.WordProps.nHorzScale = pWordProps->nHorzSca le;
1787 bSet = TRUE; 1787 bSet = true;
1788 } 1788 }
1789 break; 1789 break;
1790 case EP_UNDERLINE: 1790 case EP_UNDERLINE:
1791 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE) 1791 if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE)
1792 { 1792 {
1793 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U NDERLINE) == 0) 1793 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U NDERLINE) == 0)
1794 { 1794 {
1795 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_U NDERLINE; 1795 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_U NDERLINE;
1796 bSet = TRUE; 1796 bSet = true;
1797 } 1797 }
1798 } 1798 }
1799 else 1799 else
1800 { 1800 {
1801 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U NDERLINE) != 0) 1801 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_U NDERLINE) != 0)
1802 { 1802 {
1803 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ UNDERLINE; 1803 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ UNDERLINE;
1804 bSet = TRUE; 1804 bSet = true;
1805 } 1805 }
1806 } 1806 }
1807 break; 1807 break;
1808 case EP_CROSSOUT: 1808 case EP_CROSSOUT:
1809 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) 1809 if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT)
1810 { 1810 {
1811 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C ROSSOUT) == 0) 1811 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C ROSSOUT) == 0)
1812 { 1812 {
1813 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_C ROSSOUT; 1813 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_C ROSSOUT;
1814 bSet = TRUE; 1814 bSet = true;
1815 } 1815 }
1816 } 1816 }
1817 else 1817 else
1818 { 1818 {
1819 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C ROSSOUT) != 0) 1819 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_C ROSSOUT) != 0)
1820 { 1820 {
1821 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ CROSSOUT; 1821 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ CROSSOUT;
1822 bSet = TRUE; 1822 bSet = true;
1823 } 1823 }
1824 } 1824 }
1825 break; 1825 break;
1826 case EP_BOLD: 1826 case EP_BOLD:
1827 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) 1827 if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD)
1828 { 1828 {
1829 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B OLD) == 0) 1829 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B OLD) == 0)
1830 { 1830 {
1831 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_B OLD; 1831 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_B OLD;
1832 bSet = TRUE; 1832 bSet = true;
1833 } 1833 }
1834 } 1834 }
1835 else 1835 else
1836 { 1836 {
1837 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B OLD) != 0) 1837 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_B OLD) != 0)
1838 { 1838 {
1839 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ BOLD; 1839 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ BOLD;
1840 bSet = TRUE; 1840 bSet = true;
1841 } 1841 }
1842 } 1842 }
1843 break; 1843 break;
1844 case EP_ITALIC: 1844 case EP_ITALIC:
1845 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) 1845 if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC)
1846 { 1846 {
1847 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I TALIC) == 0) 1847 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I TALIC) == 0)
1848 { 1848 {
1849 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_I TALIC; 1849 wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_I TALIC;
1850 bSet = TRUE; 1850 bSet = true;
1851 } 1851 }
1852 } 1852 }
1853 else 1853 else
1854 { 1854 {
1855 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I TALIC) != 0) 1855 if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_I TALIC) != 0)
1856 { 1856 {
1857 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ ITALIC; 1857 wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ ITALIC;
1858 bSet = TRUE; 1858 bSet = true;
1859 } 1859 }
1860 } 1860 }
1861 break; 1861 break;
1862 default: 1862 default:
1863 break; 1863 break;
1864 } 1864 }
1865 } 1865 }
1866 } 1866 }
1867 1867
1868 if (bSet) 1868 if (bSet)
1869 { 1869 {
1870 pIterator->SetWord(wordinfo); 1870 pIterator->SetWord(wordinfo);
1871 1871
1872 if (bAddUndo && m_bEnableUndo) 1872 if (bAddUndo && m_bEnableUndo)
1873 { 1873 {
1874 AddEditUndoItem(new CFXEU_SetWordProps 1874 AddEditUndoItem(new CFXEU_SetWordProps
1875 (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordPr ops,wr)); 1875 (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordPr ops,wr));
1876 } 1876 }
1877 } 1877 }
1878 1878
1879 pIterator->SetAt(oldplace); 1879 pIterator->SetAt(oldplace);
1880 return bSet; 1880 return bSet;
1881 } 1881 }
1882 } 1882 }
1883 1883
1884 return FALSE; 1884 return false;
1885 } 1885 }
1886 1886
1887 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET* /, 1887 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET* /,
1888 const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_Wo rdProps * pWordProps /*= NULL*/) 1888 const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_Wo rdProps * pWordProps /*= NULL*/)
1889 { 1889 {
1890 SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); 1890 SetText(text,charset,pSecProps,pWordProps,true,true);
1891 } 1891 }
1892 1892
1893 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/ , const CPVT_WordProps * pWordProps /*= NULL*/) 1893 bool CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/, c onst CPVT_WordProps * pWordProps /*= NULL*/)
1894 { 1894 {
1895 return InsertWord(word,charset,pWordProps,TRUE,TRUE); 1895 return InsertWord(word,charset,pWordProps,true,true);
1896 } 1896 }
1897 1897
1898 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) 1898 bool CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const CPV T_WordProps * pWordProps /*= NULL*/)
1899 { 1899 {
1900 return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); 1900 return InsertReturn(pSecProps,pWordProps,true,true);
1901 } 1901 }
1902 1902
1903 FX_BOOL CFX_Edit::Backspace() 1903 bool CFX_Edit::Backspace()
1904 { 1904 {
1905 return Backspace(TRUE,TRUE); 1905 return Backspace(true,true);
1906 } 1906 }
1907 1907
1908 FX_BOOL CFX_Edit::Delete() 1908 bool CFX_Edit::Delete()
1909 { 1909 {
1910 return Delete(TRUE,TRUE); 1910 return Delete(true,true);
1911 } 1911 }
1912 1912
1913 FX_BOOL CFX_Edit::Clear() 1913 bool CFX_Edit::Clear()
1914 { 1914 {
1915 return Clear(TRUE,TRUE); 1915 return Clear(true,true);
1916 } 1916 }
1917 1917
1918 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_C HARSET*/, 1918 bool CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_CHAR SET*/,
1919 const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) 1919 const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/)
1920 { 1920 {
1921 return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); 1921 return InsertText(text,charset,pSecProps,pWordProps,true,true);
1922 } 1922 }
1923 1923
1924 FX_FLOAT CFX_Edit::GetFontSize() const 1924 FX_FLOAT CFX_Edit::GetFontSize() const
1925 { 1925 {
1926 return m_pVT->GetFontSize(); 1926 return m_pVT->GetFontSize();
1927 } 1927 }
1928 1928
1929 FX_WORD CFX_Edit::GetPasswordChar() const 1929 FX_WORD CFX_Edit::GetPasswordChar() const
1930 { 1930 {
1931 return m_pVT->GetPasswordChar(); 1931 return m_pVT->GetPasswordChar();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 void CFX_Edit::SetContentChanged() 2032 void CFX_Edit::SetContentChanged()
2033 { 2033 {
2034 if (m_bNotify && m_pNotify) 2034 if (m_bNotify && m_pNotify)
2035 { 2035 {
2036 CPDF_Rect rcContent = m_pVT->GetContentRect(); 2036 CPDF_Rect rcContent = m_pVT->GetContentRect();
2037 if (rcContent.Width() != m_rcOldContent.Width() || 2037 if (rcContent.Width() != m_rcOldContent.Width() ||
2038 rcContent.Height() != m_rcOldContent.Height()) 2038 rcContent.Height() != m_rcOldContent.Height())
2039 { 2039 {
2040 if (!m_bNotifyFlag) 2040 if (!m_bNotifyFlag)
2041 { 2041 {
2042 m_bNotifyFlag = TRUE; 2042 m_bNotifyFlag = true;
2043 m_pNotify->IOnContentChange(rcContent); 2043 m_pNotify->IOnContentChange(rcContent);
2044 m_bNotifyFlag = FALSE; 2044 m_bNotifyFlag = false;
2045 } 2045 }
2046 m_rcOldContent = rcContent; 2046 m_rcOldContent = rcContent;
2047 } 2047 }
2048 } 2048 }
2049 } 2049 }
2050 2050
2051 void CFX_Edit::SelectAll() 2051 void CFX_Edit::SelectAll()
2052 { 2052 {
2053 if (m_pVT->IsValid()) 2053 if (m_pVT->IsValid())
2054 { 2054 {
(...skipping 13 matching lines...) Expand all
2068 { 2068 {
2069 if (m_SelState.IsExist()) 2069 if (m_SelState.IsExist())
2070 { 2070 {
2071 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); 2071 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange();
2072 m_SelState.Default(); 2072 m_SelState.Default();
2073 Refresh(RP_OPTIONAL,&wrTemp); 2073 Refresh(RP_OPTIONAL,&wrTemp);
2074 } 2074 }
2075 } 2075 }
2076 } 2076 }
2077 2077
2078 FX_BOOL CFX_Edit::IsSelected() const 2078 bool CFX_Edit::IsSelected() const
2079 { 2079 {
2080 return m_SelState.IsExist(); 2080 return m_SelState.IsExist();
2081 } 2081 }
2082 2082
2083 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const 2083 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const
2084 { 2084 {
2085 CPDF_Rect rcContent = m_pVT->GetContentRect(); 2085 CPDF_Rect rcContent = m_pVT->GetContentRect();
2086 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); 2086 CPDF_Rect rcPlate = m_pVT->GetPlateRect();
2087 2087
2088 FX_FLOAT fPadding = 0.0f; 2088 FX_FLOAT fPadding = 0.0f;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2146
2147 void CFX_Edit::SetScrollInfo() 2147 void CFX_Edit::SetScrollInfo()
2148 { 2148 {
2149 if (m_bNotify && m_pNotify) 2149 if (m_bNotify && m_pNotify)
2150 { 2150 {
2151 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); 2151 CPDF_Rect rcPlate = m_pVT->GetPlateRect();
2152 CPDF_Rect rcContent = m_pVT->GetContentRect(); 2152 CPDF_Rect rcContent = m_pVT->GetContentRect();
2153 2153
2154 if (!m_bNotifyFlag) 2154 if (!m_bNotifyFlag)
2155 { 2155 {
2156 m_bNotifyFlag = TRUE; 2156 m_bNotifyFlag = true;
2157 m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, 2157 m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right,
2158 rcContent.left, rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); 2158 rcContent.left, rcContent.right, rcPlate.Width() / 3, rcPlate.Width());
2159 2159
2160 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, 2160 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top,
2161 rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPla te.Height()); 2161 rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPla te.Height());
2162 m_bNotifyFlag = FALSE; 2162 m_bNotifyFlag = false;
2163 } 2163 }
2164 } 2164 }
2165 } 2165 }
2166 2166
2167 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) 2167 void CFX_Edit::SetScrollPosX(FX_FLOAT fx)
2168 { 2168 {
2169 if (!m_bEnableScroll) return; 2169 if (!m_bEnableScroll) return;
2170 2170
2171 if (m_pVT->IsValid()) 2171 if (m_pVT->IsValid())
2172 { 2172 {
2173 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) 2173 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx))
2174 { 2174 {
2175 m_ptScrollPos.x = fx; 2175 m_ptScrollPos.x = fx;
2176 Refresh(RP_NOANALYSE); 2176 Refresh(RP_NOANALYSE);
2177 2177
2178 if (m_bNotify && m_pNotify) 2178 if (m_bNotify && m_pNotify)
2179 { 2179 {
2180 if (!m_bNotifyFlag) 2180 if (!m_bNotifyFlag)
2181 { 2181 {
2182 m_bNotifyFlag = TRUE; 2182 m_bNotifyFlag = true;
2183 m_pNotify->IOnSetScrollPosX(fx); 2183 m_pNotify->IOnSetScrollPosX(fx);
2184 m_bNotifyFlag = FALSE; 2184 m_bNotifyFlag = false;
2185 } 2185 }
2186 } 2186 }
2187 } 2187 }
2188 } 2188 }
2189 } 2189 }
2190 2190
2191 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) 2191 void CFX_Edit::SetScrollPosY(FX_FLOAT fy)
2192 { 2192 {
2193 if (!m_bEnableScroll) return; 2193 if (!m_bEnableScroll) return;
2194 2194
2195 if (m_pVT->IsValid()) 2195 if (m_pVT->IsValid())
2196 { 2196 {
2197 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) 2197 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy))
2198 { 2198 {
2199 m_ptScrollPos.y = fy; 2199 m_ptScrollPos.y = fy;
2200 Refresh(RP_NOANALYSE); 2200 Refresh(RP_NOANALYSE);
2201 2201
2202 if (m_bNotify && m_pNotify) 2202 if (m_bNotify && m_pNotify)
2203 { 2203 {
2204 if (!m_bNotifyFlag) 2204 if (!m_bNotifyFlag)
2205 { 2205 {
2206 m_bNotifyFlag = TRUE; 2206 m_bNotifyFlag = true;
2207 m_pNotify->IOnSetScrollPosY(fy); 2207 m_pNotify->IOnSetScrollPosY(fy);
2208 m_bNotifyFlag = FALSE; 2208 m_bNotifyFlag = false;
2209 } 2209 }
2210 } 2210 }
2211 } 2211 }
2212 } 2212 }
2213 } 2213 }
2214 2214
2215 void CFX_Edit::SetScrollPos(const CPDF_Point & point) 2215 void CFX_Edit::SetScrollPos(const CPDF_Point & point)
2216 { 2216 {
2217 SetScrollPosX(point.x); 2217 SetScrollPosX(point.x);
2218 SetScrollPosY(point.y); 2218 SetScrollPosY(point.y);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 // if (pRange1) RefreshPushRandomRects(*pRange1); 2366 // if (pRange1) RefreshPushRandomRects(*pRange1);
2367 // if (pRange2) RefreshPushRandomRects(*pRange2); 2367 // if (pRange2) RefreshPushRandomRects(*pRange2);
2368 // break; 2368 // break;
2369 // } 2369 // }
2370 // } 2370 // }
2371 2371
2372 if (m_bNotify && m_pNotify) 2372 if (m_bNotify && m_pNotify)
2373 { 2373 {
2374 if (!m_bNotifyFlag) 2374 if (!m_bNotifyFlag)
2375 { 2375 {
2376 m_bNotifyFlag = TRUE; 2376 m_bNotifyFlag = true;
2377 if (const CFX_Edit_RectArray * pRects = m_Refresh.GetRefreshRect s()) 2377 if (const CFX_Edit_RectArray * pRects = m_Refresh.GetRefreshRect s())
2378 { 2378 {
2379 for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) 2379 for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++)
2380 m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); 2380 m_pNotify->IOnInvalidateRect(pRects->GetAt(i));
2381 } 2381 }
2382 m_bNotifyFlag = FALSE; 2382 m_bNotifyFlag = false;
2383 } 2383 }
2384 } 2384 }
2385 2385
2386 m_Refresh.EndRefresh(); 2386 m_Refresh.EndRefresh();
2387 } 2387 }
2388 } 2388 }
2389 2389
2390 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) 2390 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr)
2391 { 2391 {
2392 if (m_pVT->IsValid()) 2392 if (m_pVT->IsValid())
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 { 2492 {
2493 CPDF_Rect rcWord(wordinfo.ptWord.x, 2493 CPDF_Rect rcWord(wordinfo.ptWord.x,
2494 lineinfo.ptLine.y + lineinfo.fLineDescent, 2494 lineinfo.ptLine.y + lineinfo.fLineDescent,
2495 wordinfo.ptWord.x + wordinfo.fWidth, 2495 wordinfo.ptWord.x + wordinfo.fWidth,
2496 lineinfo.ptLine.y + lineinfo.fLineAscent); 2496 lineinfo.ptLine.y + lineinfo.fLineAscent);
2497 2497
2498 if (m_bNotify && m_pNotify) 2498 if (m_bNotify && m_pNotify)
2499 { 2499 {
2500 if (!m_bNotifyFlag) 2500 if (!m_bNotifyFlag)
2501 { 2501 {
2502 m_bNotifyFlag = TRUE; 2502 m_bNotifyFlag = true;
2503 CPDF_Rect rcRefresh = VTToEdit(rcWord); 2503 CPDF_Rect rcRefresh = VTToEdit(rcWord);
2504 m_pNotify->IOnInvalidateRect(&rcRefresh); 2504 m_pNotify->IOnInvalidateRect(&rcRefresh);
2505 m_bNotifyFlag = FALSE; 2505 m_bNotifyFlag = false;
2506 } 2506 }
2507 } 2507 }
2508 } 2508 }
2509 else 2509 else
2510 { 2510 {
2511 CPDF_Rect rcLine(lineinfo.ptLine.x, 2511 CPDF_Rect rcLine(lineinfo.ptLine.x,
2512 lineinfo.ptLine.y + lineinfo.fLineDescent, 2512 lineinfo.ptLine.y + lineinfo.fLineDescent,
2513 lineinfo.ptLine.x + lineinfo.fLineWidth, 2513 lineinfo.ptLine.x + lineinfo.fLineWidth,
2514 lineinfo.ptLine.y + lineinfo.fLineAscent); 2514 lineinfo.ptLine.y + lineinfo.fLineAscent);
2515 2515
2516 if (m_bNotify && m_pNotify) 2516 if (m_bNotify && m_pNotify)
2517 { 2517 {
2518 if (!m_bNotifyFlag) 2518 if (!m_bNotifyFlag)
2519 { 2519 {
2520 m_bNotifyFlag = TRUE; 2520 m_bNotifyFlag = true;
2521 CPDF_Rect rcRefresh = VTToEdit(rcLine); 2521 CPDF_Rect rcRefresh = VTToEdit(rcLine);
2522 m_pNotify->IOnInvalidateRect(&rcRefresh); 2522 m_pNotify->IOnInvalidateRect(&rcRefresh);
2523 m_bNotifyFlag = FALSE; 2523 m_bNotifyFlag = false;
2524 } 2524 }
2525 } 2525 }
2526 2526
2527 pIterator->NextLine(); 2527 pIterator->NextLine();
2528 } 2528 }
2529 } 2529 }
2530 } 2530 }
2531 } 2531 }
2532 2532
2533 void CFX_Edit::SetCaret(const CPVT_WordPlace & place) 2533 void CFX_Edit::SetCaret(const CPVT_WordPlace & place)
(...skipping 24 matching lines...) Expand all
2558 } 2558 }
2559 else if (pIterator->GetLine(line)) 2559 else if (pIterator->GetLine(line))
2560 { 2560 {
2561 ptHead.x = line.ptLine.x; 2561 ptHead.x = line.ptLine.x;
2562 ptHead.y = line.ptLine.y + line.fLineAscent; 2562 ptHead.y = line.ptLine.y + line.fLineAscent;
2563 ptFoot.x = line.ptLine.x; 2563 ptFoot.x = line.ptLine.x;
2564 ptFoot.y = line.ptLine.y + line.fLineDescent; 2564 ptFoot.y = line.ptLine.y + line.fLineDescent;
2565 } 2565 }
2566 } 2566 }
2567 2567
2568 m_bNotifyFlag = TRUE; 2568 m_bNotifyFlag = true;
2569 m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEd it(ptFoot), m_wpCaret); 2569 m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEd it(ptFoot), m_wpCaret);
2570 m_bNotifyFlag = FALSE; 2570 m_bNotifyFlag = false;
2571 } 2571 }
2572 } 2572 }
2573 2573
2574 SetCaretChange(); 2574 SetCaretChange();
2575 } 2575 }
2576 2576
2577 void CFX_Edit::SetCaretChange() 2577 void CFX_Edit::SetCaretChange()
2578 { 2578 {
2579 if (m_wpCaret == m_wpOldCaret) return; 2579 if (m_wpCaret == m_wpOldCaret) return;
2580 2580
(...skipping 15 matching lines...) Expand all
2596 } 2596 }
2597 2597
2598 if (pIterator->GetWord(word)) 2598 if (pIterator->GetWord(word))
2599 { 2599 {
2600 WordProps = word.WordProps; 2600 WordProps = word.WordProps;
2601 } 2601 }
2602 } 2602 }
2603 2603
2604 if (!m_bNotifyFlag) 2604 if (!m_bNotifyFlag)
2605 { 2605 {
2606 m_bNotifyFlag = TRUE; 2606 m_bNotifyFlag = true;
2607 m_pNotify->IOnCaretChange(SecProps,WordProps); 2607 m_pNotify->IOnCaretChange(SecProps,WordProps);
2608 m_bNotifyFlag = FALSE; 2608 m_bNotifyFlag = false;
2609 } 2609 }
2610 } 2610 }
2611 } 2611 }
2612 2612
2613 void CFX_Edit::SetCaret(int32_t nPos) 2613 void CFX_Edit::SetCaret(int32_t nPos)
2614 { 2614 {
2615 if (m_pVT->IsValid()) 2615 if (m_pVT->IsValid())
2616 { 2616 {
2617 SelectNone(); 2617 SelectNone();
2618 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); 2618 SetCaret(m_pVT->WordIndexToWordPlace(nPos));
2619 m_SelState.Set(m_wpCaret,m_wpCaret); 2619 m_SelState.Set(m_wpCaret,m_wpCaret);
2620 2620
2621 ScrollToCaret(); 2621 ScrollToCaret();
2622 SetCaretOrigin(); 2622 SetCaretOrigin();
2623 SetCaretInfo(); 2623 SetCaretInfo();
2624 } 2624 }
2625 } 2625 }
2626 2626
2627 void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl ) 2627 void CFX_Edit::OnMouseDown(const CPDF_Point & point,bool bShift,bool bCtrl)
2628 { 2628 {
2629 if (m_pVT->IsValid()) 2629 if (m_pVT->IsValid())
2630 { 2630 {
2631 SelectNone(); 2631 SelectNone();
2632 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); 2632 SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
2633 m_SelState.Set(m_wpCaret,m_wpCaret); 2633 m_SelState.Set(m_wpCaret,m_wpCaret);
2634 2634
2635 ScrollToCaret(); 2635 ScrollToCaret();
2636 SetCaretOrigin(); 2636 SetCaretOrigin();
2637 SetCaretInfo(); 2637 SetCaretInfo();
2638 } 2638 }
2639 } 2639 }
2640 2640
2641 void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl ) 2641 void CFX_Edit::OnMouseMove(const CPDF_Point & point,bool bShift,bool bCtrl)
2642 { 2642 {
2643 if (m_pVT->IsValid()) 2643 if (m_pVT->IsValid())
2644 { 2644 {
2645 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); 2645 SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
2646 2646
2647 if (m_wpCaret != m_wpOldCaret) 2647 if (m_wpCaret != m_wpOldCaret)
2648 { 2648 {
2649 m_SelState.SetEndPos(m_wpCaret); 2649 m_SelState.SetEndPos(m_wpCaret);
2650 2650
2651 ScrollToCaret(); 2651 ScrollToCaret();
2652 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); 2652 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret);
2653 Refresh(RP_OPTIONAL,&wr); 2653 Refresh(RP_OPTIONAL,&wr);
2654 SetCaretOrigin(); 2654 SetCaretOrigin();
2655 SetCaretInfo(); 2655 SetCaretInfo();
2656 } 2656 }
2657 } 2657 }
2658 } 2658 }
2659 2659
2660 void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) 2660 void CFX_Edit::OnVK_UP(bool bShift,bool bCtrl)
2661 { 2661 {
2662 if (m_pVT->IsValid()) 2662 if (m_pVT->IsValid())
2663 { 2663 {
2664 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); 2664 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret));
2665 2665
2666 if (bShift) 2666 if (bShift)
2667 { 2667 {
2668 if (m_SelState.IsExist()) 2668 if (m_SelState.IsExist())
2669 m_SelState.SetEndPos(m_wpCaret); 2669 m_SelState.SetEndPos(m_wpCaret);
2670 else 2670 else
(...skipping 10 matching lines...) Expand all
2681 else 2681 else
2682 { 2682 {
2683 SelectNone(); 2683 SelectNone();
2684 2684
2685 ScrollToCaret(); 2685 ScrollToCaret();
2686 SetCaretInfo(); 2686 SetCaretInfo();
2687 } 2687 }
2688 } 2688 }
2689 } 2689 }
2690 2690
2691 void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) 2691 void CFX_Edit::OnVK_DOWN(bool bShift,bool bCtrl)
2692 { 2692 {
2693 if (m_pVT->IsValid()) 2693 if (m_pVT->IsValid())
2694 { 2694 {
2695 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret)); 2695 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret));
2696 2696
2697 if (bShift) 2697 if (bShift)
2698 { 2698 {
2699 if (m_SelState.IsExist()) 2699 if (m_SelState.IsExist())
2700 m_SelState.SetEndPos(m_wpCaret); 2700 m_SelState.SetEndPos(m_wpCaret);
2701 else 2701 else
(...skipping 10 matching lines...) Expand all
2712 else 2712 else
2713 { 2713 {
2714 SelectNone(); 2714 SelectNone();
2715 2715
2716 ScrollToCaret(); 2716 ScrollToCaret();
2717 SetCaretInfo(); 2717 SetCaretInfo();
2718 } 2718 }
2719 } 2719 }
2720 } 2720 }
2721 2721
2722 void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) 2722 void CFX_Edit::OnVK_LEFT(bool bShift,bool bCtrl)
2723 { 2723 {
2724 if (m_pVT->IsValid()) 2724 if (m_pVT->IsValid())
2725 { 2725 {
2726 if (bShift) 2726 if (bShift)
2727 { 2727 {
2728 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && 2728 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
2729 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) 2729 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret))
2730 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 2730 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
2731 2731
2732 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 2732 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); 2766 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
2767 2767
2768 ScrollToCaret(); 2768 ScrollToCaret();
2769 SetCaretOrigin(); 2769 SetCaretOrigin();
2770 SetCaretInfo(); 2770 SetCaretInfo();
2771 } 2771 }
2772 } 2772 }
2773 } 2773 }
2774 } 2774 }
2775 2775
2776 void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) 2776 void CFX_Edit::OnVK_RIGHT(bool bShift,bool bCtrl)
2777 { 2777 {
2778 if (m_pVT->IsValid()) 2778 if (m_pVT->IsValid())
2779 { 2779 {
2780 if (bShift) 2780 if (bShift)
2781 { 2781 {
2782 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 2782 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
2783 2783
2784 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && 2784 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
2785 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) 2785 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret))
2786 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 2786 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); 2820 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
2821 2821
2822 ScrollToCaret(); 2822 ScrollToCaret();
2823 SetCaretOrigin(); 2823 SetCaretOrigin();
2824 SetCaretInfo(); 2824 SetCaretInfo();
2825 } 2825 }
2826 } 2826 }
2827 } 2827 }
2828 } 2828 }
2829 2829
2830 void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) 2830 void CFX_Edit::OnVK_HOME(bool bShift,bool bCtrl)
2831 { 2831 {
2832 if (m_pVT->IsValid()) 2832 if (m_pVT->IsValid())
2833 { 2833 {
2834 if (bShift) 2834 if (bShift)
2835 { 2835 {
2836 if (bCtrl) 2836 if (bCtrl)
2837 SetCaret(m_pVT->GetBeginWordPlace()); 2837 SetCaret(m_pVT->GetBeginWordPlace());
2838 else 2838 else
2839 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); 2839 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
2840 2840
(...skipping 28 matching lines...) Expand all
2869 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); 2869 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
2870 2870
2871 ScrollToCaret(); 2871 ScrollToCaret();
2872 SetCaretOrigin(); 2872 SetCaretOrigin();
2873 SetCaretInfo(); 2873 SetCaretInfo();
2874 } 2874 }
2875 } 2875 }
2876 } 2876 }
2877 } 2877 }
2878 2878
2879 void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) 2879 void CFX_Edit::OnVK_END(bool bShift,bool bCtrl)
2880 { 2880 {
2881 if (m_pVT->IsValid()) 2881 if (m_pVT->IsValid())
2882 { 2882 {
2883 if (bShift) 2883 if (bShift)
2884 { 2884 {
2885 if (bCtrl) 2885 if (bCtrl)
2886 SetCaret(m_pVT->GetEndWordPlace()); 2886 SetCaret(m_pVT->GetEndWordPlace());
2887 else 2887 else
2888 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); 2888 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
2889 2889
(...skipping 29 matching lines...) Expand all
2919 2919
2920 ScrollToCaret(); 2920 ScrollToCaret();
2921 SetCaretOrigin(); 2921 SetCaretOrigin();
2922 SetCaretInfo(); 2922 SetCaretInfo();
2923 } 2923 }
2924 } 2924 }
2925 } 2925 }
2926 } 2926 }
2927 2927
2928 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset, 2928 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset,
2929 const CPVT_SecProps * pSecProps,const CPVT_WordProps * p WordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) 2929 const CPVT_SecProps * pSecProps,const CPVT_WordProps * p WordProps, bool bAddUndo, bool bPaint)
2930 { 2930 {
2931 Empty(); 2931 Empty();
2932 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProps); 2932 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProps);
2933 if (bPaint) Paint(); 2933 if (bPaint) Paint();
2934 if (m_bOprNotify && m_pOprNotify) 2934 if (m_bOprNotify && m_pOprNotify)
2935 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); 2935 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret);
2936 //if (bAddUndo) 2936 //if (bAddUndo)
2937 } 2937 }
2938 2938
2939 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) 2939 bool CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps, bool bAddUndo, bool bPaint)
2940 { 2940 {
2941 if (IsTextOverflow()) return FALSE; 2941 if (IsTextOverflow()) return false;
2942 2942
2943 if (m_pVT->IsValid()) 2943 if (m_pVT->IsValid())
2944 { 2944 {
2945 m_pVT->UpdateWordPlace(m_wpCaret); 2945 m_pVT->UpdateWordPlace(m_wpCaret);
2946 2946
2947 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(word, ch arset),pWordProps)); 2947 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(word, ch arset),pWordProps));
2948 m_SelState.Set(m_wpCaret,m_wpCaret); 2948 m_SelState.Set(m_wpCaret,m_wpCaret);
2949 2949
2950 if (m_wpCaret != m_wpOldCaret) 2950 if (m_wpCaret != m_wpOldCaret)
2951 { 2951 {
2952 if (bAddUndo && m_bEnableUndo) 2952 if (bAddUndo && m_bEnableUndo)
2953 { 2953 {
2954 AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOldCaret,m_wpCaret ,word,charset,pWordProps)); 2954 AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOldCaret,m_wpCaret ,word,charset,pWordProps));
2955 } 2955 }
2956 2956
2957 if (bPaint) 2957 if (bPaint)
2958 PaintInsertText(m_wpOldCaret, m_wpCaret); 2958 PaintInsertText(m_wpOldCaret, m_wpCaret);
2959 2959
2960 if (m_bOprNotify && m_pOprNotify) 2960 if (m_bOprNotify && m_pOprNotify)
2961 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); 2961 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret);
2962 2962
2963 return TRUE; 2963 return true;
2964 } 2964 }
2965 } 2965 }
2966 2966
2967 return FALSE; 2967 return false;
2968 } 2968 }
2969 2969
2970 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr ops * pWordProps, 2970 bool CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,
2971 FX_BOOL bAddUndo, FX_BOOL bPaint) 2971 bool bAddUndo, bool bPaint)
2972 { 2972 {
2973 if (IsTextOverflow()) return FALSE; 2973 if (IsTextOverflow()) return false;
2974 2974
2975 if (m_pVT->IsValid()) 2975 if (m_pVT->IsValid())
2976 { 2976 {
2977 m_pVT->UpdateWordPlace(m_wpCaret); 2977 m_pVT->UpdateWordPlace(m_wpCaret);
2978 SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps)); 2978 SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps));
2979 m_SelState.Set(m_wpCaret,m_wpCaret); 2979 m_SelState.Set(m_wpCaret,m_wpCaret);
2980 2980
2981 if (m_wpCaret != m_wpOldCaret) 2981 if (m_wpCaret != m_wpOldCaret)
2982 { 2982 {
2983 if (bAddUndo && m_bEnableUndo) 2983 if (bAddUndo && m_bEnableUndo)
2984 { 2984 {
2985 AddEditUndoItem(new CFXEU_InsertReturn(this,m_wpOldCaret,m_wpCar et,pSecProps,pWordProps)); 2985 AddEditUndoItem(new CFXEU_InsertReturn(this,m_wpOldCaret,m_wpCar et,pSecProps,pWordProps));
2986 } 2986 }
2987 2987
2988 if (bPaint) 2988 if (bPaint)
2989 { 2989 {
2990 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); 2990 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
2991 ScrollToCaret(); 2991 ScrollToCaret();
2992 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); 2992 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos);
2993 Refresh(RP_ANALYSE, &wr); 2993 Refresh(RP_ANALYSE, &wr);
2994 SetCaretOrigin(); 2994 SetCaretOrigin();
2995 SetCaretInfo(); 2995 SetCaretInfo();
2996 } 2996 }
2997 2997
2998 if (m_bOprNotify && m_pOprNotify) 2998 if (m_bOprNotify && m_pOprNotify)
2999 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); 2999 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret);
3000 3000
3001 return TRUE; 3001 return true;
3002 } 3002 }
3003 } 3003 }
3004 3004
3005 return FALSE; 3005 return false;
3006 } 3006 }
3007 3007
3008 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) 3008 bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint)
3009 { 3009 {
3010 if (m_pVT->IsValid()) 3010 if (m_pVT->IsValid())
3011 { 3011 {
3012 if (m_wpCaret == m_pVT->GetBeginWordPlace()) return FALSE; 3012 if (m_wpCaret == m_pVT->GetBeginWordPlace()) return false;
3013 3013
3014 CPVT_Section section; 3014 CPVT_Section section;
3015 CPVT_Word word; 3015 CPVT_Word word;
3016 3016
3017 if (bAddUndo) 3017 if (bAddUndo)
3018 { 3018 {
3019 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 3019 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
3020 { 3020 {
3021 pIterator->SetAt(m_wpCaret); 3021 pIterator->SetAt(m_wpCaret);
3022 pIterator->GetSection(section); 3022 pIterator->GetSection(section);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3055 3055
3056 Refresh(RP_ANALYSE, &wr); 3056 Refresh(RP_ANALYSE, &wr);
3057 3057
3058 SetCaretOrigin(); 3058 SetCaretOrigin();
3059 SetCaretInfo(); 3059 SetCaretInfo();
3060 } 3060 }
3061 3061
3062 if (m_bOprNotify && m_pOprNotify) 3062 if (m_bOprNotify && m_pOprNotify)
3063 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); 3063 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret);
3064 3064
3065 return TRUE; 3065 return true;
3066 } 3066 }
3067 } 3067 }
3068 3068
3069 return FALSE; 3069 return false;
3070 } 3070 }
3071 3071
3072 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) 3072 bool CFX_Edit::Delete(bool bAddUndo, bool bPaint)
3073 { 3073 {
3074 if (m_pVT->IsValid()) 3074 if (m_pVT->IsValid())
3075 { 3075 {
3076 if (m_wpCaret == m_pVT->GetEndWordPlace()) return FALSE; 3076 if (m_wpCaret == m_pVT->GetEndWordPlace()) return false;
3077 3077
3078 CPVT_Section section; 3078 CPVT_Section section;
3079 CPVT_Word word; 3079 CPVT_Word word;
3080 3080
3081 if (bAddUndo) 3081 if (bAddUndo)
3082 { 3082 {
3083 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 3083 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
3084 { 3084 {
3085 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); 3085 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret));
3086 pIterator->GetSection(section); 3086 pIterator->GetSection(section);
3087 pIterator->GetWord(word); 3087 pIterator->GetWord(word);
3088 } 3088 }
3089 } 3089 }
3090 3090
3091 m_pVT->UpdateWordPlace(m_wpCaret); 3091 m_pVT->UpdateWordPlace(m_wpCaret);
3092 FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); 3092 bool bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret));
3093 3093
3094 SetCaret(m_pVT->DeleteWord(m_wpCaret)); 3094 SetCaret(m_pVT->DeleteWord(m_wpCaret));
3095 m_SelState.Set(m_wpCaret,m_wpCaret); 3095 m_SelState.Set(m_wpCaret,m_wpCaret);
3096 3096
3097 if (bAddUndo && m_bEnableUndo) 3097 if (bAddUndo && m_bEnableUndo)
3098 { 3098 {
3099 if (bSecEnd) 3099 if (bSecEnd)
3100 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,wor d.Word,word.nCharset, 3100 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,wor d.Word,word.nCharset,
3101 section.SecProps,section.WordProps,bSecEnd)); 3101 section.SecProps,section.WordProps,bSecEnd));
3102 else 3102 else
(...skipping 16 matching lines...) Expand all
3119 3119
3120 Refresh(RP_ANALYSE, &wr); 3120 Refresh(RP_ANALYSE, &wr);
3121 3121
3122 SetCaretOrigin(); 3122 SetCaretOrigin();
3123 SetCaretInfo(); 3123 SetCaretInfo();
3124 } 3124 }
3125 3125
3126 if (m_bOprNotify && m_pOprNotify) 3126 if (m_bOprNotify && m_pOprNotify)
3127 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); 3127 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret);
3128 3128
3129 return TRUE; 3129 return true;
3130 } 3130 }
3131 3131
3132 return FALSE; 3132 return false;
3133 } 3133 }
3134 3134
3135 FX_BOOL CFX_Edit::Empty() 3135 bool CFX_Edit::Empty()
3136 { 3136 {
3137 if (m_pVT->IsValid()) 3137 if (m_pVT->IsValid())
3138 { 3138 {
3139 m_pVT->DeleteWords(GetWholeWordRange()); 3139 m_pVT->DeleteWords(GetWholeWordRange());
3140 SetCaret(m_pVT->GetBeginWordPlace()); 3140 SetCaret(m_pVT->GetBeginWordPlace());
3141 3141
3142 return TRUE; 3142 return true;
3143 } 3143 }
3144 3144
3145 return FALSE; 3145 return false;
3146 } 3146 }
3147 3147
3148 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) 3148 bool CFX_Edit::Clear(bool bAddUndo, bool bPaint)
3149 { 3149 {
3150 if (m_pVT->IsValid()) 3150 if (m_pVT->IsValid())
3151 { 3151 {
3152 if (m_SelState.IsExist()) 3152 if (m_SelState.IsExist())
3153 { 3153 {
3154 CPVT_WordRange range = m_SelState.ConvertToWordRange(); 3154 CPVT_WordRange range = m_SelState.ConvertToWordRange();
3155 3155
3156 if (bAddUndo && m_bEnableUndo) 3156 if (bAddUndo && m_bEnableUndo)
3157 { 3157 {
3158 if (m_pVT->IsRichText()) 3158 if (m_pVT->IsRichText())
(...skipping 18 matching lines...) Expand all
3177 if (pIterator->GetSection(secinfo)) 3177 if (pIterator->GetSection(secinfo))
3178 { 3178 {
3179 AddEditUndoItem(new CFXEU_ClearRich(this,old place,place,range,wordinfo.Word, 3179 AddEditUndoItem(new CFXEU_ClearRich(this,old place,place,range,wordinfo.Word,
3180 wordinfo.nCharset,secinfo.SecProps,secin fo.WordProps)); 3180 wordinfo.nCharset,secinfo.SecProps,secin fo.WordProps));
3181 } 3181 }
3182 } 3182 }
3183 else 3183 else
3184 { 3184 {
3185 if (pIterator->GetWord(wordinfo)) 3185 if (pIterator->GetWord(wordinfo))
3186 { 3186 {
3187 oldplace = m_pVT->AjustLineHeader(oldplace,T RUE); 3187 oldplace = m_pVT->AjustLineHeader(oldplace,t rue);
3188 place = m_pVT->AjustLineHeader(place,TRUE); 3188 place = m_pVT->AjustLineHeader(place,true);
3189 3189
3190 AddEditUndoItem(new CFXEU_ClearRich(this,old place,place,range,wordinfo.Word, 3190 AddEditUndoItem(new CFXEU_ClearRich(this,old place,place,range,wordinfo.Word,
3191 wordinfo.nCharset,secinfo.SecProps,wordi nfo.WordProps)); 3191 wordinfo.nCharset,secinfo.SecProps,wordi nfo.WordProps));
3192 } 3192 }
3193 } 3193 }
3194 }while (pIterator->PrevWord()); 3194 }while (pIterator->PrevWord());
3195 } 3195 }
3196 EndGroupUndo(); 3196 EndGroupUndo();
3197 } 3197 }
3198 else 3198 else
(...skipping 14 matching lines...) Expand all
3213 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); 3213 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos);
3214 Refresh(RP_ANALYSE, &wr); 3214 Refresh(RP_ANALYSE, &wr);
3215 3215
3216 SetCaretOrigin(); 3216 SetCaretOrigin();
3217 SetCaretInfo(); 3217 SetCaretInfo();
3218 } 3218 }
3219 3219
3220 if (m_bOprNotify && m_pOprNotify) 3220 if (m_bOprNotify && m_pOprNotify)
3221 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); 3221 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret);
3222 3222
3223 return TRUE; 3223 return true;
3224 } 3224 }
3225 } 3225 }
3226 3226
3227 return FALSE; 3227 return false;
3228 } 3228 }
3229 3229
3230 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset, 3230 bool CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset,
3231 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWor dProps, FX_BOOL bAddUndo, FX_BOOL bPaint) 3231 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWor dProps, bool bAddUndo, bool bPaint)
3232 { 3232 {
3233 if (IsTextOverflow()) return FALSE; 3233 if (IsTextOverflow()) return false;
3234 3234
3235 m_pVT->UpdateWordPlace(m_wpCaret); 3235 m_pVT->UpdateWordPlace(m_wpCaret);
3236 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); 3236 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps));
3237 m_SelState.Set(m_wpCaret,m_wpCaret); 3237 m_SelState.Set(m_wpCaret,m_wpCaret);
3238 3238
3239 if (m_wpCaret != m_wpOldCaret) 3239 if (m_wpCaret != m_wpOldCaret)
3240 { 3240 {
3241 if (bAddUndo && m_bEnableUndo) 3241 if (bAddUndo && m_bEnableUndo)
3242 { 3242 {
3243 AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m_wpCaret,tex t,charset,pSecProps,pWordProps)); 3243 AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m_wpCaret,tex t,charset,pSecProps,pWordProps));
3244 } 3244 }
3245 3245
3246 if (bPaint) 3246 if (bPaint)
3247 PaintInsertText(m_wpOldCaret, m_wpCaret); 3247 PaintInsertText(m_wpOldCaret, m_wpCaret);
3248 3248
3249 if (m_bOprNotify && m_pOprNotify) 3249 if (m_bOprNotify && m_pOprNotify)
3250 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); 3250 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret);
3251 3251
3252 return TRUE; 3252 return true;
3253 } 3253 }
3254 return FALSE; 3254 return false;
3255 } 3255 }
3256 3256
3257 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac e & wpNew) 3257 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac e & wpNew)
3258 { 3258 {
3259 if (m_pVT->IsValid()) 3259 if (m_pVT->IsValid())
3260 { 3260 {
3261 RearrangePart(CPVT_WordRange(wpOld,wpNew)); 3261 RearrangePart(CPVT_WordRange(wpOld,wpNew));
3262 ScrollToCaret(); 3262 ScrollToCaret();
3263 3263
3264 CPVT_WordRange wr; 3264 CPVT_WordRange wr;
3265 if (m_wpCaret.LineCmp(wpOld) !=0) 3265 if (m_wpCaret.LineCmp(wpOld) !=0)
3266 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectio nEndPlace(wpNew)); 3266 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectio nEndPlace(wpNew));
3267 else 3267 else
3268 wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); 3268 wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew));
3269 Refresh(RP_ANALYSE, &wr); 3269 Refresh(RP_ANALYSE, &wr);
3270 SetCaretOrigin(); 3270 SetCaretOrigin();
3271 SetCaretInfo(); 3271 SetCaretInfo();
3272 } 3272 }
3273 } 3273 }
3274 3274
3275 FX_BOOL CFX_Edit::Redo() 3275 bool CFX_Edit::Redo()
3276 { 3276 {
3277 if (m_bEnableUndo) 3277 if (m_bEnableUndo)
3278 { 3278 {
3279 if (m_Undo.CanRedo()) 3279 if (m_Undo.CanRedo())
3280 { 3280 {
3281 m_Undo.Redo(); 3281 m_Undo.Redo();
3282 return TRUE; 3282 return true;
3283 } 3283 }
3284 } 3284 }
3285 3285
3286 return FALSE; 3286 return false;
3287 } 3287 }
3288 3288
3289 FX_BOOL CFX_Edit::Undo() 3289 bool CFX_Edit::Undo()
3290 { 3290 {
3291 if (m_bEnableUndo) 3291 if (m_bEnableUndo)
3292 { 3292 {
3293 if (m_Undo.CanUndo()) 3293 if (m_Undo.CanUndo())
3294 { 3294 {
3295 m_Undo.Undo(); 3295 m_Undo.Undo();
3296 return TRUE; 3296 return true;
3297 } 3297 }
3298 } 3298 }
3299 3299
3300 return FALSE; 3300 return false;
3301 } 3301 }
3302 3302
3303 void CFX_Edit::SetCaretOrigin() 3303 void CFX_Edit::SetCaretOrigin()
3304 { 3304 {
3305 if (m_pVT->IsValid()) 3305 if (m_pVT->IsValid())
3306 { 3306 {
3307 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) 3307 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator())
3308 { 3308 {
3309 pIterator->SetAt(m_wpCaret); 3309 pIterator->SetAt(m_wpCaret);
3310 CPVT_Word word; 3310 CPVT_Word word;
(...skipping 21 matching lines...) Expand all
3332 } 3332 }
3333 3333
3334 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const 3334 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const
3335 { 3335 {
3336 if (m_pVT->IsValid()) 3336 if (m_pVT->IsValid())
3337 return m_pVT->WordIndexToWordPlace(index); 3337 return m_pVT->WordIndexToWordPlace(index);
3338 3338
3339 return CPVT_WordPlace(); 3339 return CPVT_WordPlace();
3340 } 3340 }
3341 3341
3342 FX_BOOL CFX_Edit::IsTextFull() const 3342 bool CFX_Edit::IsTextFull() const
3343 { 3343 {
3344 int32_t nTotalWords = m_pVT->GetTotalWords(); 3344 int32_t nTotalWords = m_pVT->GetTotalWords();
3345 int32_t nLimitChar = m_pVT->GetLimitChar(); 3345 int32_t nLimitChar = m_pVT->GetLimitChar();
3346 int32_t nCharArray = m_pVT->GetCharArray(); 3346 int32_t nCharArray = m_pVT->GetCharArray();
3347 3347
3348 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) 3348 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar)
3349 || (nCharArray>0 && nTotalWords >= nCharArray); 3349 || (nCharArray>0 && nTotalWords >= nCharArray);
3350 } 3350 }
3351 3351
3352 FX_BOOL CFX_Edit::IsTextOverflow() const 3352 bool CFX_Edit::IsTextOverflow() const
3353 { 3353 {
3354 if (!m_bEnableScroll && !m_bEnableOverflow) 3354 if (!m_bEnableScroll && !m_bEnableOverflow)
3355 { 3355 {
3356 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); 3356 CPDF_Rect rcPlate = m_pVT->GetPlateRect();
3357 CPDF_Rect rcContent = m_pVT->GetContentRect(); 3357 CPDF_Rect rcContent = m_pVT->GetContentRect();
3358 3358
3359 if (m_pVT->IsMultiLine() && GetTotalLines() > 1) 3359 if (m_pVT->IsMultiLine() && GetTotalLines() > 1)
3360 { 3360 {
3361 if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Height())) retu rn TRUE; 3361 if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Height())) retu rn true;
3362 } 3362 }
3363 3363
3364 if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) return TRU E; 3364 if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) return tru e;
3365 } 3365 }
3366 3366
3367 return FALSE; 3367 return false;
3368 } 3368 }
3369 3369
3370 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const 3370 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const
3371 { 3371 {
3372 return m_pVT->GetLineBeginPlace(place); 3372 return m_pVT->GetLineBeginPlace(place);
3373 } 3373 }
3374 3374
3375 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const 3375 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const
3376 { 3376 {
3377 return m_pVT->GetLineEndPlace(place); 3377 return m_pVT->GetLineEndPlace(place);
3378 } 3378 }
3379 3379
3380 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons t 3380 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons t
3381 { 3381 {
3382 return m_pVT->GetSectionBeginPlace(place); 3382 return m_pVT->GetSectionBeginPlace(place);
3383 } 3383 }
3384 3384
3385 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const 3385 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const
3386 { 3386 {
3387 return m_pVT->GetSectionEndPlace(place); 3387 return m_pVT->GetSectionEndPlace(place);
3388 } 3388 }
3389 3389
3390 FX_BOOL CFX_Edit::CanUndo() const 3390 bool CFX_Edit::CanUndo() const
3391 { 3391 {
3392 if (m_bEnableUndo) 3392 if (m_bEnableUndo)
3393 { 3393 {
3394 return m_Undo.CanUndo(); 3394 return m_Undo.CanUndo();
3395 } 3395 }
3396 3396
3397 return FALSE; 3397 return false;
3398 } 3398 }
3399 3399
3400 FX_BOOL CFX_Edit::CanRedo() const 3400 bool CFX_Edit::CanRedo() const
3401 { 3401 {
3402 if (m_bEnableUndo) 3402 if (m_bEnableUndo)
3403 { 3403 {
3404 return m_Undo.CanRedo(); 3404 return m_Undo.CanRedo();
3405 } 3405 }
3406 3406
3407 return FALSE; 3407 return false;
3408 } 3408 }
3409 3409
3410 FX_BOOL CFX_Edit::IsModified() const 3410 bool CFX_Edit::IsModified() const
3411 { 3411 {
3412 if (m_bEnableUndo) 3412 if (m_bEnableUndo)
3413 { 3413 {
3414 return m_Undo.IsModified(); 3414 return m_Undo.IsModified();
3415 } 3415 }
3416 3416
3417 return FALSE; 3417 return false;
3418 } 3418 }
3419 3419
3420 void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) 3420 void CFX_Edit::EnableRefresh(bool bRefresh)
3421 { 3421 {
3422 m_bEnableRefresh = bRefresh; 3422 m_bEnableRefresh = bRefresh;
3423 } 3423 }
3424 3424
3425 void CFX_Edit::EnableUndo(FX_BOOL bUndo) 3425 void CFX_Edit::EnableUndo(bool bUndo)
3426 { 3426 {
3427 m_bEnableUndo = bUndo; 3427 m_bEnableUndo = bUndo;
3428 } 3428 }
3429 3429
3430 void CFX_Edit::EnableNotify(FX_BOOL bNotify) 3430 void CFX_Edit::EnableNotify(bool bNotify)
3431 { 3431 {
3432 m_bNotify = bNotify; 3432 m_bNotify = bNotify;
3433 } 3433 }
3434 3434
3435 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) 3435 void CFX_Edit::EnableOprNotify(bool bNotify)
3436 { 3436 {
3437 m_bOprNotify = bNotify; 3437 m_bOprNotify = bNotify;
3438 } 3438 }
3439 3439
3440 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const 3440 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const
3441 { 3441 {
3442 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) 3442 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator())
3443 { 3443 {
3444 CPVT_WordPlace wpOld = pIterator->GetAt(); 3444 CPVT_WordPlace wpOld = pIterator->GetAt();
3445 3445
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 } 3546 }
3547 } 3547 }
3548 3548
3549 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) 3549 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem)
3550 { 3550 {
3551 m_Undo.AddItem(pUndoItem); 3551 m_Undo.AddItem(pUndoItem);
3552 if (m_bOprNotify && m_pOprNotify) 3552 if (m_bOprNotify && m_pOprNotify)
3553 m_pOprNotify->OnAddUndo(pUndoItem); 3553 m_pOprNotify->OnAddUndo(pUndoItem);
3554 } 3554 }
3555 3555
OLDNEW
« no previous file with comments | « fpdfsdk/src/fxedit/fxet_ap.cpp ('k') | fpdfsdk/src/fxedit/fxet_list.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698