OLD | NEW |
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 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 if (m_pVTIterator->GetSection(section)) | 99 if (m_pVTIterator->GetSection(section)) |
100 { | 100 { |
101 section.rcSection = m_pEdit->VTToEdit(section.rcSection); | 101 section.rcSection = m_pEdit->VTToEdit(section.rcSection); |
102 return TRUE; | 102 return TRUE; |
103 } | 103 } |
104 | 104 |
105 return FALSE; | 105 return FALSE; |
106 } | 106 } |
107 | 107 |
108 void CFX_Edit_Iterator::SetAt(FX_INT32 nWordIndex) | 108 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) |
109 { | 109 { |
110 ASSERT(m_pVTIterator != NULL); | 110 ASSERT(m_pVTIterator != NULL); |
111 | 111 |
112 m_pVTIterator->SetAt(nWordIndex); | 112 m_pVTIterator->SetAt(nWordIndex); |
113 } | 113 } |
114 | 114 |
115 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) | 115 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) |
116 { | 116 { |
117 ASSERT(m_pVTIterator != NULL); | 117 ASSERT(m_pVTIterator != NULL); |
118 | 118 |
(...skipping 21 matching lines...) Expand all Loading... |
140 | 140 |
141 CFX_Edit_Provider::~CFX_Edit_Provider() | 141 CFX_Edit_Provider::~CFX_Edit_Provider() |
142 { | 142 { |
143 } | 143 } |
144 | 144 |
145 IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() | 145 IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() |
146 { | 146 { |
147 return m_pFontMap; | 147 return m_pFontMap; |
148 } | 148 } |
149 | 149 |
150 FX_INT32 CFX_Edit_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_I
NT32 nWordStyle) | 150 int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_
t nWordStyle) |
151 { | 151 { |
152 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 152 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
153 { | 153 { |
154 FX_DWORD charcode = word; | 154 FX_DWORD charcode = word; |
155 | 155 |
156 if (pPDFFont->IsUnicodeCompatible()) | 156 if (pPDFFont->IsUnicodeCompatible()) |
157 charcode = pPDFFont->CharCodeFromUnicode(word); | 157 charcode = pPDFFont->CharCodeFromUnicode(word); |
158 else | 158 else |
159 charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, w
ord); | 159 charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, w
ord); |
160 | 160 |
161 if (charcode != -1) | 161 if (charcode != -1) |
162 return pPDFFont->GetCharWidthF(charcode); | 162 return pPDFFont->GetCharWidthF(charcode); |
163 } | 163 } |
164 | 164 |
165 return 0; | 165 return 0; |
166 } | 166 } |
167 | 167 |
168 FX_INT32 CFX_Edit_Provider::GetTypeAscent(FX_INT32 nFontIndex) | 168 int32_t CFX_Edit_Provider::GetTypeAscent(int32_t nFontIndex) |
169 { | 169 { |
170 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 170 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
171 return pPDFFont->GetTypeAscent(); | 171 return pPDFFont->GetTypeAscent(); |
172 | 172 |
173 return 0; | 173 return 0; |
174 } | 174 } |
175 | 175 |
176 FX_INT32 CFX_Edit_Provider::GetTypeDescent(FX_INT32 nFontIndex) | 176 int32_t CFX_Edit_Provider::GetTypeDescent(int32_t nFontIndex) |
177 { | 177 { |
178 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) | 178 if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) |
179 return pPDFFont->GetTypeDescent(); | 179 return pPDFFont->GetTypeDescent(); |
180 | 180 |
181 return 0; | 181 return 0; |
182 } | 182 } |
183 | 183 |
184 FX_INT32 CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_
INT32 nFontIndex) | 184 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) |
185 { | 185 { |
186 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); | 186 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); |
187 } | 187 } |
188 | 188 |
189 FX_INT32 CFX_Edit_Provider::GetDefaultFontIndex() | 189 int32_t CFX_Edit_Provider::GetDefaultFontIndex() |
190 { | 190 { |
191 return 0; | 191 return 0; |
192 } | 192 } |
193 | 193 |
194 FX_BOOL CFX_Edit_Provider::IsLatinWord(FX_WORD word) | 194 FX_BOOL CFX_Edit_Provider::IsLatinWord(FX_WORD word) |
195 { | 195 { |
196 return FX_EDIT_ISLATINWORD(word); | 196 return FX_EDIT_ISLATINWORD(word); |
197 } | 197 } |
198 | 198 |
199 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ | 199 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ |
(...skipping 13 matching lines...) Expand all Loading... |
213 } | 213 } |
214 | 214 |
215 void CFX_Edit_Refresh::Push(const CPVT_WordRange & linerange,const CPDF_Rect & r
ect) | 215 void CFX_Edit_Refresh::Push(const CPVT_WordRange & linerange,const CPDF_Rect & r
ect) |
216 { | 216 { |
217 m_NewLineRects.Add(linerange,rect); | 217 m_NewLineRects.Add(linerange,rect); |
218 } | 218 } |
219 | 219 |
220 void CFX_Edit_Refresh::NoAnalyse() | 220 void CFX_Edit_Refresh::NoAnalyse() |
221 { | 221 { |
222 { | 222 { |
223 » » for (FX_INT32 i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) | 223 » » for (int32_t i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) |
224 if (CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(
i)) | 224 if (CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(
i)) |
225 m_RefreshRects.Add(pOldRect->m_rcLine); | 225 m_RefreshRects.Add(pOldRect->m_rcLine); |
226 } | 226 } |
227 | 227 |
228 { | 228 { |
229 » » for (FX_INT32 i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) | 229 » » for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) |
230 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(
i)) | 230 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(
i)) |
231 m_RefreshRects.Add(pNewRect->m_rcLine); | 231 m_RefreshRects.Add(pNewRect->m_rcLine); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 void CFX_Edit_Refresh::Analyse(FX_INT32 nAlignment) | 235 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) |
236 { | 236 { |
237 FX_BOOL bLineTopChanged = FALSE; | 237 FX_BOOL bLineTopChanged = FALSE; |
238 CPDF_Rect rcResult; | 238 CPDF_Rect rcResult; |
239 FX_FLOAT fWidthDiff; | 239 FX_FLOAT fWidthDiff; |
240 | 240 |
241 » FX_INT32 szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.Get
Size()); | 241 » int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetS
ize()); |
242 » FX_INT32 i = 0; | 242 » int32_t i = 0; |
243 | 243 |
244 while (i < szMax) | 244 while (i < szMax) |
245 { | 245 { |
246 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); | 246 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); |
247 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); | 247 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); |
248 | 248 |
249 if (pOldRect) | 249 if (pOldRect) |
250 { | 250 { |
251 if (pNewRect) | 251 if (pNewRect) |
252 { | 252 { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return &m_RefreshRects; | 339 return &m_RefreshRects; |
340 } | 340 } |
341 | 341 |
342 void CFX_Edit_Refresh::EndRefresh() | 342 void CFX_Edit_Refresh::EndRefresh() |
343 { | 343 { |
344 m_RefreshRects.Empty(); | 344 m_RefreshRects.Empty(); |
345 } | 345 } |
346 | 346 |
347 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ | 347 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ |
348 | 348 |
349 CFX_Edit_Undo::CFX_Edit_Undo(FX_INT32 nBufsize) : m_nCurUndoPos(0), | 349 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), |
350 m_nBufSize(nBufsize), | 350 m_nBufSize(nBufsize), |
351 m_bModified(FALSE), | 351 m_bModified(FALSE), |
352 m_bVirgin(TRUE), | 352 m_bVirgin(TRUE), |
353 m_bWorking(FALSE) | 353 m_bWorking(FALSE) |
354 { | 354 { |
355 } | 355 } |
356 | 356 |
357 CFX_Edit_Undo::~CFX_Edit_Undo() | 357 CFX_Edit_Undo::~CFX_Edit_Undo() |
358 { | 358 { |
359 Reset(); | 359 Reset(); |
(...skipping 24 matching lines...) Expand all Loading... |
384 | 384 |
385 FX_BOOL CFX_Edit_Undo::CanRedo() const | 385 FX_BOOL CFX_Edit_Undo::CanRedo() const |
386 { | 386 { |
387 return m_nCurUndoPos < m_UndoItemStack.GetSize(); | 387 return m_nCurUndoPos < m_UndoItemStack.GetSize(); |
388 } | 388 } |
389 | 389 |
390 void CFX_Edit_Undo::Redo() | 390 void CFX_Edit_Undo::Redo() |
391 { | 391 { |
392 m_bWorking = TRUE; | 392 m_bWorking = TRUE; |
393 | 393 |
394 » FX_INT32 nStackSize = m_UndoItemStack.GetSize(); | 394 » int32_t nStackSize = m_UndoItemStack.GetSize(); |
395 | 395 |
396 if (m_nCurUndoPos < nStackSize) | 396 if (m_nCurUndoPos < nStackSize) |
397 { | 397 { |
398 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos)
; | 398 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos)
; |
399 ASSERT(pItem != NULL); | 399 ASSERT(pItem != NULL); |
400 | 400 |
401 pItem->Redo(); | 401 pItem->Redo(); |
402 | 402 |
403 m_nCurUndoPos++; | 403 m_nCurUndoPos++; |
404 m_bModified = (m_nCurUndoPos != 0); | 404 m_bModified = (m_nCurUndoPos != 0); |
(...skipping 29 matching lines...) Expand all Loading... |
434 } | 434 } |
435 | 435 |
436 FX_BOOL CFX_Edit_Undo::IsModified() const | 436 FX_BOOL CFX_Edit_Undo::IsModified() const |
437 { | 437 { |
438 if (m_bVirgin) | 438 if (m_bVirgin) |
439 return m_bModified; | 439 return m_bModified; |
440 else | 440 else |
441 return TRUE; | 441 return TRUE; |
442 } | 442 } |
443 | 443 |
444 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(FX_INT32 nIndex) | 444 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) |
445 { | 445 { |
446 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) | 446 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) |
447 return m_UndoItemStack.GetAt(nIndex); | 447 return m_UndoItemStack.GetAt(nIndex); |
448 | 448 |
449 return NULL; | 449 return NULL; |
450 } | 450 } |
451 | 451 |
452 void CFX_Edit_Undo::RemoveHeads() | 452 void CFX_Edit_Undo::RemoveHeads() |
453 { | 453 { |
454 ASSERT(m_UndoItemStack.GetSize() > 1); | 454 ASSERT(m_UndoItemStack.GetSize() > 1); |
455 | 455 |
456 delete m_UndoItemStack.GetAt(0); | 456 delete m_UndoItemStack.GetAt(0); |
457 m_UndoItemStack.RemoveAt(0); | 457 m_UndoItemStack.RemoveAt(0); |
458 } | 458 } |
459 | 459 |
460 void CFX_Edit_Undo::RemoveTails() | 460 void CFX_Edit_Undo::RemoveTails() |
461 { | 461 { |
462 » for (FX_INT32 i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) | 462 » for (int32_t i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) |
463 { | 463 { |
464 delete m_UndoItemStack.GetAt(i); | 464 delete m_UndoItemStack.GetAt(i); |
465 m_UndoItemStack.RemoveAt(i); | 465 m_UndoItemStack.RemoveAt(i); |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 void CFX_Edit_Undo::Reset() | 469 void CFX_Edit_Undo::Reset() |
470 { | 470 { |
471 » for (FX_INT32 i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) | 471 » for (int32_t i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) |
472 { | 472 { |
473 delete m_UndoItemStack.GetAt(i); | 473 delete m_UndoItemStack.GetAt(i); |
474 } | 474 } |
475 m_nCurUndoPos = 0; | 475 m_nCurUndoPos = 0; |
476 m_UndoItemStack.RemoveAll(); | 476 m_UndoItemStack.RemoveAll(); |
477 } | 477 } |
478 | 478 |
479 /* -------------------------------- CFX_Edit_GroupUndoItem ---------------------
----------- */ | 479 /* -------------------------------- CFX_Edit_GroupUndoItem ---------------------
----------- */ |
480 | 480 |
481 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) : m
_sTitle(sTitle) | 481 CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) : m
_sTitle(sTitle) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 542 } |
543 | 543 |
544 CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() | 544 CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() |
545 { | 545 { |
546 return m_sTitle; | 546 return m_sTitle; |
547 } | 547 } |
548 | 548 |
549 /* ------------------------------------- CFX_Edit_UndoItem derived classes -----
-------------------------------- */ | 549 /* ------------------------------------- CFX_Edit_UndoItem derived classes -----
-------------------------------- */ |
550 | 550 |
551 CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, | 551 CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, |
552 » » » » » » » » FX_WORD word, F
X_INT32 charset, const CPVT_WordProps * pWordProps) | 552 » » » » » » » » FX_WORD word, i
nt32_t charset, const CPVT_WordProps * pWordProps) |
553 : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word)
, m_nCharset(charset), m_WordProps() | 553 : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word)
, m_nCharset(charset), m_WordProps() |
554 { | 554 { |
555 if (pWordProps) | 555 if (pWordProps) |
556 m_WordProps = *pWordProps; | 556 m_WordProps = *pWordProps; |
557 } | 557 } |
558 | 558 |
559 CFXEU_InsertWord::~CFXEU_InsertWord() | 559 CFXEU_InsertWord::~CFXEU_InsertWord() |
560 { | 560 { |
561 } | 561 } |
562 | 562 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 m_pEdit->SelectNone(); | 617 m_pEdit->SelectNone(); |
618 m_pEdit->SetCaret(m_wpNew); | 618 m_pEdit->SetCaret(m_wpNew); |
619 m_pEdit->Backspace(FALSE,TRUE); | 619 m_pEdit->Backspace(FALSE,TRUE); |
620 } | 620 } |
621 } | 621 } |
622 | 622 |
623 /* -------------------------------------------------------------------------- */ | 623 /* -------------------------------------------------------------------------- */ |
624 //CFXEU_Backspace | 624 //CFXEU_Backspace |
625 | 625 |
626 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 626 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
627 » » » » » » » FX_WORD word, FX_INT3
2 charset, | 627 » » » » » » » FX_WORD word, int32_t
charset, |
628 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 628 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : |
629 m_pEdit(pEdit), | 629 m_pEdit(pEdit), |
630 m_wpOld(wpOldPlace), | 630 m_wpOld(wpOldPlace), |
631 m_wpNew(wpNewPlace), | 631 m_wpNew(wpNewPlace), |
632 m_Word(word), | 632 m_Word(word), |
633 m_nCharset(charset), | 633 m_nCharset(charset), |
634 m_SecProps(SecProps), | 634 m_SecProps(SecProps), |
635 m_WordProps(WordProps)
| 635 m_WordProps(WordProps)
|
636 { | 636 { |
637 } | 637 } |
(...skipping 26 matching lines...) Expand all Loading... |
664 { | 664 { |
665 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); | 665 m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); |
666 } | 666 } |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 /* -------------------------------------------------------------------------- */ | 670 /* -------------------------------------------------------------------------- */ |
671 //CFXEU_Delete | 671 //CFXEU_Delete |
672 | 672 |
673 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, | 673 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, |
674 » » » » » » » FX_WORD word, FX_INT3
2 charset, | 674 » » » » » » » FX_WORD word, int32_t
charset, |
675 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd) : | 675 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd) : |
676 m_pEdit(pEdit), | 676 m_pEdit(pEdit), |
677 m_wpOld(wpOldPlace), | 677 m_wpOld(wpOldPlace), |
678 m_wpNew(wpNewPlace), | 678 m_wpNew(wpNewPlace), |
679 m_Word(word), | 679 m_Word(word), |
680 m_nCharset(charset), | 680 m_nCharset(charset), |
681 m_SecProps(SecProps), | 681 m_SecProps(SecProps), |
682 m_WordProps(WordProps), | 682 m_WordProps(WordProps), |
683 m_bSecEnd(bSecEnd) | 683 m_bSecEnd(bSecEnd) |
684 { | 684 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 m_pEdit->SetCaret(m_wrSel.BeginPos); | 747 m_pEdit->SetCaret(m_wrSel.BeginPos); |
748 m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NUL
L, FALSE, TRUE); | 748 m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NUL
L, FALSE, TRUE); |
749 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 749 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
750 } | 750 } |
751 } | 751 } |
752 | 752 |
753 /* -------------------------------------------------------------------------- */ | 753 /* -------------------------------------------------------------------------- */ |
754 //CFXEU_ClearRich | 754 //CFXEU_ClearRich |
755 | 755 |
756 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 756 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
757 » » » » » » » const CPVT_WordRange
& wrSel, FX_WORD word, FX_INT32 charset, | 757 » » » » » » » const CPVT_WordRange
& wrSel, FX_WORD word, int32_t charset, |
758 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 758 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : |
759 m_pEdit(pEdit), | 759 m_pEdit(pEdit), |
760 m_wpOld(wpOldPlace), | 760 m_wpOld(wpOldPlace), |
761 m_wpNew(wpNewPlace), | 761 m_wpNew(wpNewPlace), |
762 m_wrSel(wrSel), | 762 m_wrSel(wrSel), |
763 m_Word(word), | 763 m_Word(word), |
764 m_nCharset(charset), | 764 m_nCharset(charset), |
765 m_SecProps(SecProps), | 765 m_SecProps(SecProps), |
766 m_WordProps(WordProps)
| 766 m_WordProps(WordProps)
|
767 { | 767 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 { | 800 { |
801 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos
); | 801 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos
); |
802 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 802 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
803 } | 803 } |
804 } | 804 } |
805 } | 805 } |
806 /* -------------------------------------------------------------------------- */ | 806 /* -------------------------------------------------------------------------- */ |
807 //CFXEU_InsertText | 807 //CFXEU_InsertText |
808 | 808 |
809 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, | 809 CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl
dPlace, const CPVT_WordPlace & wpNewPlace, |
810 » » » » » » » const CFX_WideString
& swText, FX_INT32 charset, | 810 » » » » » » » const CFX_WideString
& swText, int32_t charset, |
811 const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps) : | 811 const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps) : |
812 m_pEdit(pEdit), | 812 m_pEdit(pEdit), |
813 m_wpOld(wpOldPlace), | 813 m_wpOld(wpOldPlace), |
814 m_wpNew(wpNewPlace), | 814 m_wpNew(wpNewPlace), |
815 m_swText(swText), | 815 m_swText(swText), |
816 m_nCharset(charset), | 816 m_nCharset(charset), |
817 m_SecProps(), | 817 m_SecProps(), |
818 m_WordProps()
| 818 m_WordProps()
|
819 { | 819 { |
820 if (pSecProps) | 820 if (pSecProps) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 return NULL; | 1039 return NULL; |
1040 } | 1040 } |
1041 | 1041 |
1042 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) | 1042 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) |
1043 { | 1043 { |
1044 m_pVT->SetPlateRect(rect); | 1044 m_pVT->SetPlateRect(rect); |
1045 m_ptScrollPos = CPDF_Point(rect.left,rect.top); | 1045 m_ptScrollPos = CPDF_Point(rect.left,rect.top); |
1046 if (bPaint) Paint(); | 1046 if (bPaint) Paint(); |
1047 } | 1047 } |
1048 | 1048 |
1049 void CFX_Edit::SetAlignmentH(FX_INT32 nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/
) | 1049 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) |
1050 { | 1050 { |
1051 m_pVT->SetAlignment(nFormat); | 1051 m_pVT->SetAlignment(nFormat); |
1052 if (bPaint) Paint(); | 1052 if (bPaint) Paint(); |
1053 } | 1053 } |
1054 | 1054 |
1055 void CFX_Edit::SetAlignmentV(FX_INT32 nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/
) | 1055 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) |
1056 { | 1056 { |
1057 m_nAlignment = nFormat; | 1057 m_nAlignment = nFormat; |
1058 if (bPaint) Paint(); | 1058 if (bPaint) Paint(); |
1059 } | 1059 } |
1060 | 1060 |
1061 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR
UE*/) | 1061 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR
UE*/) |
1062 { | 1062 { |
1063 m_pVT->SetPasswordChar(wSubWord); | 1063 m_pVT->SetPasswordChar(wSubWord); |
1064 if (bPaint) Paint(); | 1064 if (bPaint) Paint(); |
1065 } | 1065 } |
1066 | 1066 |
1067 void CFX_Edit::SetLimitChar(FX_INT32 nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE
*/) | 1067 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*
/) |
1068 { | 1068 { |
1069 m_pVT->SetLimitChar(nLimitChar); | 1069 m_pVT->SetLimitChar(nLimitChar); |
1070 if (bPaint) Paint(); | 1070 if (bPaint) Paint(); |
1071 } | 1071 } |
1072 | 1072 |
1073 void CFX_Edit::SetCharArray(FX_INT32 nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE
*/) | 1073 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*
/) |
1074 { | 1074 { |
1075 m_pVT->SetCharArray(nCharArray); | 1075 m_pVT->SetCharArray(nCharArray); |
1076 if (bPaint) Paint(); | 1076 if (bPaint) Paint(); |
1077 } | 1077 } |
1078 | 1078 |
1079 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T
RUE*/) | 1079 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T
RUE*/) |
1080 { | 1080 { |
1081 m_pVT->SetCharSpace(fCharSpace); | 1081 m_pVT->SetCharSpace(fCharSpace); |
1082 if (bPaint) Paint(); | 1082 if (bPaint) Paint(); |
1083 } | 1083 } |
1084 | 1084 |
1085 void CFX_Edit::SetHorzScale(FX_INT32 nHorzScale/* =100 */, FX_BOOL bPaint/* = TR
UE*/) | 1085 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRU
E*/) |
1086 { | 1086 { |
1087 m_pVT->SetHorzScale(nHorzScale); | 1087 m_pVT->SetHorzScale(nHorzScale); |
1088 if (bPaint) Paint(); | 1088 if (bPaint) Paint(); |
1089 } | 1089 } |
1090 | 1090 |
1091 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR
UE*/) | 1091 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR
UE*/) |
1092 { | 1092 { |
1093 m_pVT->SetMultiLine(bMultiLine); | 1093 m_pVT->SetMultiLine(bMultiLine); |
1094 if (bPaint) Paint(); | 1094 if (bPaint) Paint(); |
1095 } | 1095 } |
(...skipping 27 matching lines...) Expand all Loading... |
1123 m_bEnableScroll = bAuto; | 1123 m_bEnableScroll = bAuto; |
1124 if (bPaint) Paint(); | 1124 if (bPaint) Paint(); |
1125 } | 1125 } |
1126 | 1126 |
1127 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* =
TRUE*/) | 1127 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* =
TRUE*/) |
1128 { | 1128 { |
1129 m_bEnableOverflow = bAllowed; | 1129 m_bEnableOverflow = bAllowed; |
1130 if (bPaint) Paint(); | 1130 if (bPaint) Paint(); |
1131 } | 1131 } |
1132 | 1132 |
1133 void CFX_Edit::SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) | 1133 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) |
1134 { | 1134 { |
1135 if (m_pVT->IsValid()) | 1135 if (m_pVT->IsValid()) |
1136 { | 1136 { |
1137 if (nStartChar == 0 && nEndChar < 0) | 1137 if (nStartChar == 0 && nEndChar < 0) |
1138 { | 1138 { |
1139 SelectAll(); | 1139 SelectAll(); |
1140 } | 1140 } |
1141 else if (nStartChar < 0) | 1141 else if (nStartChar < 0) |
1142 { | 1142 { |
1143 this->SelectNone(); | 1143 this->SelectNone(); |
(...skipping 30 matching lines...) Expand all Loading... |
1174 SetCaretInfo(); | 1174 SetCaretInfo(); |
1175 } | 1175 } |
1176 else | 1176 else |
1177 { | 1177 { |
1178 ScrollToCaret(); | 1178 ScrollToCaret(); |
1179 SetCaretInfo(); | 1179 SetCaretInfo(); |
1180 } | 1180 } |
1181 } | 1181 } |
1182 } | 1182 } |
1183 | 1183 |
1184 void CFX_Edit::GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const | 1184 void CFX_Edit::GetSel(int32_t & nStartChar, int32_t & nEndChar) const |
1185 { | 1185 { |
1186 nStartChar = -1; | 1186 nStartChar = -1; |
1187 nEndChar = -1; | 1187 nEndChar = -1; |
1188 | 1188 |
1189 if (m_pVT->IsValid()) | 1189 if (m_pVT->IsValid()) |
1190 { | 1190 { |
1191 if (m_SelState.IsExist()) | 1191 if (m_SelState.IsExist()) |
1192 { | 1192 { |
1193 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) | 1193 if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos)<0) |
1194 { | 1194 { |
1195 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.BeginPos); | 1195 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.BeginPos); |
1196 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.EndPos); | 1196 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.EndPos); |
1197 } | 1197 } |
1198 else | 1198 else |
1199 { | 1199 { |
1200 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.EndPos); | 1200 nStartChar = m_pVT->WordPlaceToWordIndex(m_SelSt
ate.EndPos); |
1201 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.BeginPos); | 1201 nEndChar = m_pVT->WordPlaceToWordIndex(m_SelStat
e.BeginPos); |
1202 } | 1202 } |
1203 } | 1203 } |
1204 else | 1204 else |
1205 { | 1205 { |
1206 nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1206 nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); |
1207 nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1207 nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret); |
1208 } | 1208 } |
1209 } | 1209 } |
1210 } | 1210 } |
1211 | 1211 |
1212 FX_INT32 CFX_Edit::GetCaret() const | 1212 int32_t CFX_Edit::GetCaret() const |
1213 { | 1213 { |
1214 if (m_pVT->IsValid()) | 1214 if (m_pVT->IsValid()) |
1215 return m_pVT->WordPlaceToWordIndex(m_wpCaret); | 1215 return m_pVT->WordPlaceToWordIndex(m_wpCaret); |
1216 | 1216 |
1217 return -1; | 1217 return -1; |
1218 } | 1218 } |
1219 | 1219 |
1220 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const | 1220 CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const |
1221 { | 1221 { |
1222 return m_wpCaret; | 1222 return m_wpCaret; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 } | 1312 } |
1313 | 1313 |
1314 return swRet; | 1314 return swRet; |
1315 } | 1315 } |
1316 | 1316 |
1317 CFX_WideString CFX_Edit::GetSelText() const | 1317 CFX_WideString CFX_Edit::GetSelText() const |
1318 { | 1318 { |
1319 return GetRangeText(m_SelState.ConvertToWordRange()); | 1319 return GetRangeText(m_SelState.ConvertToWordRange()); |
1320 } | 1320 } |
1321 | 1321 |
1322 FX_INT32 CFX_Edit::GetTotalWords() const | 1322 int32_t CFX_Edit::GetTotalWords() const |
1323 { | 1323 { |
1324 return m_pVT->GetTotalWords(); | 1324 return m_pVT->GetTotalWords(); |
1325 } | 1325 } |
1326 | 1326 |
1327 FX_INT32 CFX_Edit::GetTotalLines() const | 1327 int32_t CFX_Edit::GetTotalLines() const |
1328 { | 1328 { |
1329 » FX_INT32 nLines = 0; | 1329 » int32_t nLines = 0; |
1330 | 1330 |
1331 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) | 1331 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) |
1332 { | 1332 { |
1333 pIterator->SetAt(0); | 1333 pIterator->SetAt(0); |
1334 while (pIterator->NextLine()) | 1334 while (pIterator->NextLine()) |
1335 nLines++; | 1335 nLines++; |
1336 } | 1336 } |
1337 | 1337 |
1338 return nLines+1; | 1338 return nLines+1; |
1339 } | 1339 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 { | 1372 { |
1373 return m_pVT->IsRichText(); | 1373 return m_pVT->IsRichText(); |
1374 } | 1374 } |
1375 | 1375 |
1376 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) | 1376 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) |
1377 { | 1377 { |
1378 m_pVT->SetRichText(bRichText); | 1378 m_pVT->SetRichText(bRichText); |
1379 if (bPaint) Paint(); | 1379 if (bPaint) Paint(); |
1380 } | 1380 } |
1381 | 1381 |
1382 FX_BOOL CFX_Edit::SetRichFontIndex(FX_INT32 nFontIndex) | 1382 FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) |
1383 { | 1383 { |
1384 CPVT_WordProps WordProps; | 1384 CPVT_WordProps WordProps; |
1385 WordProps.nFontIndex = nFontIndex; | 1385 WordProps.nFontIndex = nFontIndex; |
1386 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); | 1386 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); |
1387 } | 1387 } |
1388 | 1388 |
1389 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) | 1389 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) |
1390 { | 1390 { |
1391 CPVT_WordProps WordProps; | 1391 CPVT_WordProps WordProps; |
1392 WordProps.fFontSize = fFontSize; | 1392 WordProps.fFontSize = fFontSize; |
1393 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); | 1393 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); |
1394 } | 1394 } |
1395 | 1395 |
1396 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) | 1396 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) |
1397 { | 1397 { |
1398 CPVT_WordProps WordProps; | 1398 CPVT_WordProps WordProps; |
1399 WordProps.dwWordColor = dwColor; | 1399 WordProps.dwWordColor = dwColor; |
1400 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); | 1400 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); |
1401 } | 1401 } |
1402 | 1402 |
1403 FX_BOOL CFX_Edit::SetRichTextScript(FX_INT32 nScriptType) | 1403 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) |
1404 { | 1404 { |
1405 CPVT_WordProps WordProps; | 1405 CPVT_WordProps WordProps; |
1406 WordProps.nScriptType = nScriptType; | 1406 WordProps.nScriptType = nScriptType; |
1407 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); | 1407 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); |
1408 } | 1408 } |
1409 | 1409 |
1410 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) | 1410 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) |
1411 { | 1411 { |
1412 CPVT_WordProps WordProps; | 1412 CPVT_WordProps WordProps; |
1413 if (bBold) | 1413 if (bBold) |
(...skipping 25 matching lines...) Expand all Loading... |
1439 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); | 1439 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); |
1440 } | 1440 } |
1441 | 1441 |
1442 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) | 1442 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) |
1443 { | 1443 { |
1444 CPVT_WordProps WordProps; | 1444 CPVT_WordProps WordProps; |
1445 WordProps.fCharSpace = fCharSpace; | 1445 WordProps.fCharSpace = fCharSpace; |
1446 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); | 1446 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); |
1447 } | 1447 } |
1448 | 1448 |
1449 FX_BOOL CFX_Edit::SetRichTextHorzScale(FX_INT32 nHorzScale /*= 100*/) | 1449 FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) |
1450 { | 1450 { |
1451 CPVT_WordProps WordProps; | 1451 CPVT_WordProps WordProps; |
1452 WordProps.nHorzScale = nHorzScale; | 1452 WordProps.nHorzScale = nHorzScale; |
1453 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); | 1453 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); |
1454 } | 1454 } |
1455 | 1455 |
1456 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) | 1456 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) |
1457 { | 1457 { |
1458 CPVT_SecProps SecProps; | 1458 CPVT_SecProps SecProps; |
1459 SecProps.fLineLeading = fLineLeading; | 1459 SecProps.fLineLeading = fLineLeading; |
1460 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); | 1460 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); |
1461 } | 1461 } |
1462 | 1462 |
1463 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) | 1463 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) |
1464 { | 1464 { |
1465 CPVT_SecProps SecProps; | 1465 CPVT_SecProps SecProps; |
1466 SecProps.fLineIndent = fLineIndent; | 1466 SecProps.fLineIndent = fLineIndent; |
1467 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); | 1467 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); |
1468 } | 1468 } |
1469 | 1469 |
1470 FX_BOOL»CFX_Edit::SetRichTextAlignment(FX_INT32 nAlignment) | 1470 FX_BOOL»CFX_Edit::SetRichTextAlignment(int32_t nAlignment) |
1471 { | 1471 { |
1472 CPVT_SecProps SecProps; | 1472 CPVT_SecProps SecProps; |
1473 SecProps.nAlignment = nAlignment; | 1473 SecProps.nAlignment = nAlignment; |
1474 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); | 1474 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); |
1475 } | 1475 } |
1476 | 1476 |
1477 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS
ecProps, const CPVT_WordProps * pWordProps) | 1477 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS
ecProps, const CPVT_WordProps * pWordProps) |
1478 { | 1478 { |
1479 FX_BOOL bSet = FALSE; | 1479 FX_BOOL bSet = FALSE; |
1480 FX_BOOL bSet1,bSet2; | 1480 FX_BOOL bSet1,bSet2; |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 } | 1914 } |
1915 | 1915 |
1916 pIterator->SetAt(oldplace); | 1916 pIterator->SetAt(oldplace); |
1917 return bSet; | 1917 return bSet; |
1918 } | 1918 } |
1919 } | 1919 } |
1920 | 1920 |
1921 return FALSE; | 1921 return FALSE; |
1922 } | 1922 } |
1923 | 1923 |
1924 void CFX_Edit::SetText(FX_LPCWSTR text,FX_INT32 charset /*= DEFAULT_CHARSET*/, | 1924 void CFX_Edit::SetText(FX_LPCWSTR text,int32_t charset /*= DEFAULT_CHARSET*/, |
1925 const CPVT_SecProps * pSecProps
/*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1925 const CPVT_SecProps * pSecProps
/*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) |
1926 { | 1926 { |
1927 SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1927 SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); |
1928 } | 1928 } |
1929 | 1929 |
1930 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, FX_INT32 charset /*= DEFAULT_CHARSET*
/, const CPVT_WordProps * pWordProps /*= NULL*/) | 1930 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/
, const CPVT_WordProps * pWordProps /*= NULL*/) |
1931 { | 1931 { |
1932 return InsertWord(word,charset,pWordProps,TRUE,TRUE); | 1932 return InsertWord(word,charset,pWordProps,TRUE,TRUE); |
1933 } | 1933 } |
1934 | 1934 |
1935 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) | 1935 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) |
1936 { | 1936 { |
1937 return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); | 1937 return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); |
1938 } | 1938 } |
1939 | 1939 |
1940 FX_BOOL CFX_Edit::Backspace() | 1940 FX_BOOL CFX_Edit::Backspace() |
1941 { | 1941 { |
1942 return Backspace(TRUE,TRUE); | 1942 return Backspace(TRUE,TRUE); |
1943 } | 1943 } |
1944 | 1944 |
1945 FX_BOOL CFX_Edit::Delete() | 1945 FX_BOOL CFX_Edit::Delete() |
1946 { | 1946 { |
1947 return Delete(TRUE,TRUE); | 1947 return Delete(TRUE,TRUE); |
1948 } | 1948 } |
1949 | 1949 |
1950 FX_BOOL CFX_Edit::Clear() | 1950 FX_BOOL CFX_Edit::Clear() |
1951 { | 1951 { |
1952 return Clear(TRUE,TRUE); | 1952 return Clear(TRUE,TRUE); |
1953 } | 1953 } |
1954 | 1954 |
1955 FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, FX_INT32 charset /*= DEFAULT_CHARS
ET*/, | 1955 FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, int32_t charset /*= DEFAULT_CHARSE
T*/, |
1956 const CPVT_SecPr
ops * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1956 const CPVT_SecPr
ops * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) |
1957 { | 1957 { |
1958 return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1958 return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); |
1959 } | 1959 } |
1960 | 1960 |
1961 FX_FLOAT CFX_Edit::GetFontSize() const | 1961 FX_FLOAT CFX_Edit::GetFontSize() const |
1962 { | 1962 { |
1963 return m_pVT->GetFontSize(); | 1963 return m_pVT->GetFontSize(); |
1964 } | 1964 } |
1965 | 1965 |
1966 FX_WORD CFX_Edit::GetPasswordChar() const | 1966 FX_WORD CFX_Edit::GetPasswordChar() const |
1967 { | 1967 { |
1968 return m_pVT->GetPasswordChar(); | 1968 return m_pVT->GetPasswordChar(); |
1969 } | 1969 } |
1970 | 1970 |
1971 FX_INT32 CFX_Edit::GetCharArray() const | 1971 int32_t CFX_Edit::GetCharArray() const |
1972 { | 1972 { |
1973 return m_pVT->GetCharArray(); | 1973 return m_pVT->GetCharArray(); |
1974 } | 1974 } |
1975 | 1975 |
1976 CPDF_Rect CFX_Edit::GetPlateRect() const | 1976 CPDF_Rect CFX_Edit::GetPlateRect() const |
1977 { | 1977 { |
1978 return m_pVT->GetPlateRect(); | 1978 return m_pVT->GetPlateRect(); |
1979 } | 1979 } |
1980 | 1980 |
1981 CPDF_Rect CFX_Edit::GetContentRect() const | 1981 CPDF_Rect CFX_Edit::GetContentRect() const |
1982 { | 1982 { |
1983 return VTToEdit(m_pVT->GetContentRect()); | 1983 return VTToEdit(m_pVT->GetContentRect()); |
1984 } | 1984 } |
1985 | 1985 |
1986 FX_INT32 CFX_Edit::GetHorzScale() const | 1986 int32_t CFX_Edit::GetHorzScale() const |
1987 { | 1987 { |
1988 return m_pVT->GetHorzScale(); | 1988 return m_pVT->GetHorzScale(); |
1989 } | 1989 } |
1990 | 1990 |
1991 FX_FLOAT CFX_Edit::GetCharSpace() const | 1991 FX_FLOAT CFX_Edit::GetCharSpace() const |
1992 { | 1992 { |
1993 return m_pVT->GetCharSpace(); | 1993 return m_pVT->GetCharSpace(); |
1994 } | 1994 } |
1995 | 1995 |
1996 // inner methods | 1996 // inner methods |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 // } | 2406 // } |
2407 // } | 2407 // } |
2408 | 2408 |
2409 if (m_bNotify && m_pNotify) | 2409 if (m_bNotify && m_pNotify) |
2410 { | 2410 { |
2411 if (!m_bNotifyFlag) | 2411 if (!m_bNotifyFlag) |
2412 { | 2412 { |
2413 m_bNotifyFlag = TRUE; | 2413 m_bNotifyFlag = TRUE; |
2414 if (const CFX_Edit_RectArray * pRects = m_Refres
h.GetRefreshRects()) | 2414 if (const CFX_Edit_RectArray * pRects = m_Refres
h.GetRefreshRects()) |
2415 { | 2415 { |
2416 » » » » » for (FX_INT32 i = 0, sz = pRects->GetSiz
e(); i < sz; i++) | 2416 » » » » » for (int32_t i = 0, sz = pRects->GetSize
(); i < sz; i++) |
2417 m_pNotify->IOnInvalidateRect(pRe
cts->GetAt(i)); | 2417 m_pNotify->IOnInvalidateRect(pRe
cts->GetAt(i)); |
2418 } | 2418 } |
2419 m_bNotifyFlag = FALSE; | 2419 m_bNotifyFlag = FALSE; |
2420 } | 2420 } |
2421 } | 2421 } |
2422 | 2422 |
2423 m_Refresh.EndRefresh(); | 2423 m_Refresh.EndRefresh(); |
2424 } | 2424 } |
2425 } | 2425 } |
2426 | 2426 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 | 2640 |
2641 if (!m_bNotifyFlag) | 2641 if (!m_bNotifyFlag) |
2642 { | 2642 { |
2643 m_bNotifyFlag = TRUE; | 2643 m_bNotifyFlag = TRUE; |
2644 m_pNotify->IOnCaretChange(SecProps,WordProps); | 2644 m_pNotify->IOnCaretChange(SecProps,WordProps); |
2645 m_bNotifyFlag = FALSE; | 2645 m_bNotifyFlag = FALSE; |
2646 } | 2646 } |
2647 } | 2647 } |
2648 } | 2648 } |
2649 | 2649 |
2650 void CFX_Edit::SetCaret(FX_INT32 nPos) | 2650 void CFX_Edit::SetCaret(int32_t nPos) |
2651 { | 2651 { |
2652 if (m_pVT->IsValid()) | 2652 if (m_pVT->IsValid()) |
2653 { | 2653 { |
2654 SelectNone(); | 2654 SelectNone(); |
2655 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); | 2655 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); |
2656 m_SelState.Set(m_wpCaret,m_wpCaret); | 2656 m_SelState.Set(m_wpCaret,m_wpCaret); |
2657 | 2657 |
2658 ScrollToCaret(); | 2658 ScrollToCaret(); |
2659 SetCaretOrigin(); | 2659 SetCaretOrigin(); |
2660 SetCaretInfo(); | 2660 SetCaretInfo(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2955 SetCaret(m_pVT->GetLineEndPlace(m_wpCare
t)); | 2955 SetCaret(m_pVT->GetLineEndPlace(m_wpCare
t)); |
2956 | 2956 |
2957 ScrollToCaret(); | 2957 ScrollToCaret(); |
2958 SetCaretOrigin(); | 2958 SetCaretOrigin(); |
2959 SetCaretInfo(); | 2959 SetCaretInfo(); |
2960 } | 2960 } |
2961 } | 2961 } |
2962 } | 2962 } |
2963 } | 2963 } |
2964 | 2964 |
2965 void CFX_Edit::SetText(FX_LPCWSTR text,FX_INT32 charset, | 2965 void CFX_Edit::SetText(FX_LPCWSTR text,int32_t charset, |
2966 const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2966 const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
2967 { | 2967 { |
2968 Empty(); | 2968 Empty(); |
2969 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProp
s); | 2969 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProp
s); |
2970 if (bPaint) Paint(); | 2970 if (bPaint) Paint(); |
2971 if (m_bOprNotify && m_pOprNotify) | 2971 if (m_bOprNotify && m_pOprNotify) |
2972 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); | 2972 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); |
2973 //if (bAddUndo) | 2973 //if (bAddUndo) |
2974 } | 2974 } |
2975 | 2975 |
2976 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProp
s * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2976 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps
* pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
2977 { | 2977 { |
2978 if (IsTextOverflow()) return FALSE; | 2978 if (IsTextOverflow()) return FALSE; |
2979 | 2979 |
2980 if (m_pVT->IsValid()) | 2980 if (m_pVT->IsValid()) |
2981 { | 2981 { |
2982 m_pVT->UpdateWordPlace(m_wpCaret); | 2982 m_pVT->UpdateWordPlace(m_wpCaret); |
2983 | 2983 |
2984 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(
word, charset),pWordProps)); | 2984 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(
word, charset),pWordProps)); |
2985 m_SelState.Set(m_wpCaret,m_wpCaret); | 2985 m_SelState.Set(m_wpCaret,m_wpCaret); |
2986 | 2986 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3257 if (m_bOprNotify && m_pOprNotify) | 3257 if (m_bOprNotify && m_pOprNotify) |
3258 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); | 3258 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); |
3259 | 3259 |
3260 return TRUE; | 3260 return TRUE; |
3261 } | 3261 } |
3262 } | 3262 } |
3263 | 3263 |
3264 return FALSE; | 3264 return FALSE; |
3265 } | 3265 } |
3266 | 3266 |
3267 FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, FX_INT32 charset, | 3267 FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, int32_t charset, |
3268 const CPVT_SecProps * pSecProps, const C
PVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 3268 const CPVT_SecProps * pSecProps, const C
PVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) |
3269 { | 3269 { |
3270 if (IsTextOverflow()) return FALSE; | 3270 if (IsTextOverflow()) return FALSE; |
3271 | 3271 |
3272 m_pVT->UpdateWordPlace(m_wpCaret); | 3272 m_pVT->UpdateWordPlace(m_wpCaret); |
3273 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); | 3273 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); |
3274 m_SelState.Set(m_wpCaret,m_wpCaret); | 3274 m_SelState.Set(m_wpCaret,m_wpCaret); |
3275 | 3275 |
3276 if (m_wpCaret != m_wpOldCaret) | 3276 if (m_wpCaret != m_wpOldCaret) |
3277 { | 3277 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3353 } | 3353 } |
3354 else if (pIterator->GetLine(line)) | 3354 else if (pIterator->GetLine(line)) |
3355 { | 3355 { |
3356 m_ptCaret.x = line.ptLine.x; | 3356 m_ptCaret.x = line.ptLine.x; |
3357 m_ptCaret.y = line.ptLine.y; | 3357 m_ptCaret.y = line.ptLine.y; |
3358 } | 3358 } |
3359 } | 3359 } |
3360 } | 3360 } |
3361 } | 3361 } |
3362 | 3362 |
3363 FX_INT32 CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const | 3363 int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const |
3364 { | 3364 { |
3365 if (m_pVT->IsValid()) | 3365 if (m_pVT->IsValid()) |
3366 return m_pVT->WordPlaceToWordIndex(place); | 3366 return m_pVT->WordPlaceToWordIndex(place); |
3367 | 3367 |
3368 return -1; | 3368 return -1; |
3369 } | 3369 } |
3370 | 3370 |
3371 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(FX_INT32 index) const | 3371 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const |
3372 { | 3372 { |
3373 if (m_pVT->IsValid()) | 3373 if (m_pVT->IsValid()) |
3374 return m_pVT->WordIndexToWordPlace(index); | 3374 return m_pVT->WordIndexToWordPlace(index); |
3375 | 3375 |
3376 return CPVT_WordPlace(); | 3376 return CPVT_WordPlace(); |
3377 } | 3377 } |
3378 | 3378 |
3379 FX_BOOL CFX_Edit::IsTextFull() const | 3379 FX_BOOL CFX_Edit::IsTextFull() const |
3380 { | 3380 { |
3381 » FX_INT32 nTotalWords = m_pVT->GetTotalWords(); | 3381 » int32_t nTotalWords = m_pVT->GetTotalWords(); |
3382 » FX_INT32 nLimitChar = m_pVT->GetLimitChar(); | 3382 » int32_t nLimitChar = m_pVT->GetLimitChar(); |
3383 » FX_INT32 nCharArray = m_pVT->GetCharArray(); | 3383 » int32_t nCharArray = m_pVT->GetCharArray(); |
3384 | 3384 |
3385 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) | 3385 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) |
3386 || (nCharArray>0 && nTotalWords >= nCharArray); | 3386 || (nCharArray>0 && nTotalWords >= nCharArray); |
3387 } | 3387 } |
3388 | 3388 |
3389 FX_BOOL CFX_Edit::IsTextOverflow() const | 3389 FX_BOOL CFX_Edit::IsTextOverflow() const |
3390 { | 3390 { |
3391 if (!m_bEnableScroll && !m_bEnableOverflow) | 3391 if (!m_bEnableScroll && !m_bEnableOverflow) |
3392 { | 3392 { |
3393 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 3393 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3503 pIterator->GetLine(line); | 3503 pIterator->GetLine(line); |
3504 | 3504 |
3505 pIterator->SetAt(wpOld); | 3505 pIterator->SetAt(wpOld); |
3506 | 3506 |
3507 return line.ptLine.y + line.fLineDescent; | 3507 return line.ptLine.y + line.fLineDescent; |
3508 } | 3508 } |
3509 | 3509 |
3510 return 0.0f; | 3510 return 0.0f; |
3511 } | 3511 } |
3512 | 3512 |
3513 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR te
xt, FX_INT32 charset, | 3513 CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR te
xt, int32_t charset, |
3514 const
CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) | 3514 const
CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) |
3515 { | 3515 { |
3516 CPVT_WordPlace wp = place; | 3516 CPVT_WordPlace wp = place; |
3517 | 3517 |
3518 if (m_pVT->IsValid()) | 3518 if (m_pVT->IsValid()) |
3519 { | 3519 { |
3520 CFX_WideString sText = text; | 3520 CFX_WideString sText = text; |
3521 | 3521 |
3522 » » for (FX_INT32 i = 0, sz = sText.GetLength(); i < sz; i++) | 3522 » » for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) |
3523 { | 3523 { |
3524 FX_WORD word = sText[i]; | 3524 FX_WORD word = sText[i]; |
3525 switch (word) | 3525 switch (word) |
3526 { | 3526 { |
3527 case 0x0D: | 3527 case 0x0D: |
3528 wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); | 3528 wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); |
3529 if (sText[i+1] == 0x0A) | 3529 if (sText[i+1] == 0x0A) |
3530 i++; | 3530 i++; |
3531 break; | 3531 break; |
3532 case 0x0A: | 3532 case 0x0A: |
3533 wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); | 3533 wp = m_pVT->InsertSection(wp,pSecProps,pWordProp
s); |
3534 if (sText[i+1] == 0x0D) | 3534 if (sText[i+1] == 0x0D) |
3535 i++; | 3535 i++; |
3536 break; | 3536 break; |
3537 case 0x09: | 3537 case 0x09: |
3538 word = 0x20; | 3538 word = 0x20; |
3539 default: | 3539 default: |
3540 wp = m_pVT->InsertWord(wp,word,GetCharSetFromUni
code(word, charset),pWordProps); | 3540 wp = m_pVT->InsertWord(wp,word,GetCharSetFromUni
code(word, charset),pWordProps); |
3541 break; | 3541 break; |
3542 } | 3542 } |
3543 } | 3543 } |
3544 } | 3544 } |
3545 | 3545 |
3546 return wp; | 3546 return wp; |
3547 } | 3547 } |
3548 | 3548 |
3549 FX_INT32 CFX_Edit::GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) | 3549 int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) |
3550 { | 3550 { |
3551 if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) | 3551 if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) |
3552 return pFontMap->CharSetFromUnicode(word, nOldCharset); | 3552 return pFontMap->CharSetFromUnicode(word, nOldCharset); |
3553 else | 3553 else |
3554 return nOldCharset; | 3554 return nOldCharset; |
3555 } | 3555 } |
3556 | 3556 |
3557 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) | 3557 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) |
3558 { | 3558 { |
3559 ASSERT(m_pGroupUndoItem == NULL); | 3559 ASSERT(m_pGroupUndoItem == NULL); |
(...skipping 24 matching lines...) Expand all Loading... |
3584 } | 3584 } |
3585 } | 3585 } |
3586 | 3586 |
3587 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) | 3587 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) |
3588 { | 3588 { |
3589 m_Undo.AddItem(pUndoItem); | 3589 m_Undo.AddItem(pUndoItem); |
3590 if (m_bOprNotify && m_pOprNotify) | 3590 if (m_bOprNotify && m_pOprNotify) |
3591 m_pOprNotify->OnAddUndo(pUndoItem); | 3591 m_pOprNotify->OnAddUndo(pUndoItem); |
3592 } | 3592 } |
3593 | 3593 |
OLD | NEW |