| 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 "../../../core/include/fxcrt/fx_safe_types.h" | 7 #include "../../../core/include/fxcrt/fx_safe_types.h" |
| 8 #include "../../include/pdfwindow/PDFWindow.h" | 8 #include "../../include/pdfwindow/PDFWindow.h" |
| 9 #include "../../include/pdfwindow/PWL_Caret.h" | 9 #include "../../include/pdfwindow/PWL_Caret.h" |
| 10 #include "../../include/pdfwindow/PWL_Edit.h" | 10 #include "../../include/pdfwindow/PWL_Edit.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void CPWL_Edit::SetText(FX_LPCWSTR csText) | 40 void CPWL_Edit::SetText(FX_LPCWSTR csText) |
| 41 { | 41 { |
| 42 CFX_WideString swText = csText; | 42 CFX_WideString swText = csText; |
| 43 | 43 |
| 44 if (HasFlag(PES_RICH)) | 44 if (HasFlag(PES_RICH)) |
| 45 { | 45 { |
| 46 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); | 46 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); |
| 47 | 47 |
| 48 if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sV
alue.GetLength())) | 48 if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sV
alue.GetLength())) |
| 49 { | 49 { |
| 50 » » » FX_INT32 nCount = pXML->CountChildren(); | 50 » » » int32_t nCount = pXML->CountChildren(); |
| 51 FX_BOOL bFirst = TRUE; | 51 FX_BOOL bFirst = TRUE; |
| 52 | 52 |
| 53 swText.Empty(); | 53 swText.Empty(); |
| 54 | 54 |
| 55 » » » for (FX_INT32 i=0; i<nCount; i++) | 55 » » » for (int32_t i=0; i<nCount; i++) |
| 56 { | 56 { |
| 57 if (CXML_Element * pSubElement = pXML->GetElemen
t(i)) | 57 if (CXML_Element * pSubElement = pXML->GetElemen
t(i)) |
| 58 { | 58 { |
| 59 CFX_ByteString tag=pSubElement->GetTagNa
me(); | 59 CFX_ByteString tag=pSubElement->GetTagNa
me(); |
| 60 if (tag.EqualNoCase("p")) | 60 if (tag.EqualNoCase("p")) |
| 61 { | 61 { |
| 62 int nChild = pSubElement->CountC
hildren(); | 62 int nChild = pSubElement->CountC
hildren(); |
| 63 CFX_WideString swSection; | 63 CFX_WideString swSection; |
| 64 » » » » » » for(FX_INT32 j=0; j<nChild; j++) | 64 » » » » » » for(int32_t j=0; j<nChild; j++) |
| 65 { | 65 { |
| 66 swSection += pSubElement
->GetContent(j); | 66 swSection += pSubElement
->GetContent(j); |
| 67 } | 67 } |
| 68 | 68 |
| 69 if (bFirst)bFirst = FALSE; | 69 if (bFirst)bFirst = FALSE; |
| 70 else | 70 else |
| 71 swText += FWL_VKEY_Retur
n; | 71 swText += FWL_VKEY_Retur
n; |
| 72 swText += swSection; | 72 swText += swSection; |
| 73 } | 73 } |
| 74 } | 74 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 { | 112 { |
| 113 rcClient.right -= PWL_SCROLLBAR_WIDTH; | 113 rcClient.right -= PWL_SCROLLBAR_WIDTH; |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 return rcClient; | 117 return rcClient; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, FX_BOOL bPaint/*
= TRUE*/) | 120 void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, FX_BOOL bPaint/*
= TRUE*/) |
| 121 { | 121 { |
| 122 » m_pEdit->SetAlignmentH((FX_INT32)nFormat, bPaint); | 122 » m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, FX_BOOL bPaint/*
= TRUE*/) | 125 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, FX_BOOL bPaint/*
= TRUE*/) |
| 126 { | 126 { |
| 127 » m_pEdit->SetAlignmentV((FX_INT32)nFormat, bPaint); | 127 » m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); |
| 128 } | 128 } |
| 129 | 129 |
| 130 FX_BOOL CPWL_Edit::CanSelectAll() const | 130 FX_BOOL CPWL_Edit::CanSelectAll() const |
| 131 { | 131 { |
| 132 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); | 132 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 FX_BOOL CPWL_Edit::CanClear() const | 135 FX_BOOL CPWL_Edit::CanClear() const |
| 136 { | 136 { |
| 137 return !IsReadOnly() && m_pEdit->IsSelected(); | 137 return !IsReadOnly() && m_pEdit->IsSelected(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) | 294 void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) |
| 295 { | 295 { |
| 296 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 296 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 297 | 297 |
| 298 CPDF_Rect rcClient = GetClientRect(); | 298 CPDF_Rect rcClient = GetClientRect(); |
| 299 CFX_ByteTextBuf sLine; | 299 CFX_ByteTextBuf sLine; |
| 300 | 300 |
| 301 » FX_INT32 nCharArray = m_pEdit->GetCharArray(); | 301 » int32_t nCharArray = m_pEdit->GetCharArray(); |
| 302 | 302 |
| 303 if (nCharArray > 0) | 303 if (nCharArray > 0) |
| 304 { | 304 { |
| 305 switch (GetBorderStyle()) | 305 switch (GetBorderStyle()) |
| 306 { | 306 { |
| 307 case PBS_SOLID: | 307 case PBS_SOLID: |
| 308 { | 308 { |
| 309 sLine << "q\n" << GetBorderWidth() << " w\n" | 309 sLine << "q\n" << GetBorderWidth() << " w\n" |
| 310 << CPWL_Utils::GetColorAppStream(GetBord
erColor(),FALSE) << " 2 J 0 j\n"; | 310 << CPWL_Utils::GetColorAppStream(GetBord
erColor(),FALSE) << " 2 J 0 j\n"; |
| 311 | 311 |
| 312 » » » » for (FX_INT32 i=1;i<nCharArray;i++) | 312 » » » » for (int32_t i=1;i<nCharArray;i++) |
| 313 { | 313 { |
| 314 sLine << rcClient.left + ((rcClient.righ
t - rcClient.left)/nCharArray)*i << " " | 314 sLine << rcClient.left + ((rcClient.righ
t - rcClient.left)/nCharArray)*i << " " |
| 315 << rcClient.bottom << " m\n" | 315 << rcClient.bottom << " m\n" |
| 316 << rcClient.left + ((rcClient.ri
ght - rcClient.left)/nCharArray)*i << " " | 316 << rcClient.left + ((rcClient.ri
ght - rcClient.left)/nCharArray)*i << " " |
| 317 << rcClient.top << " l S\n";
| 317 << rcClient.top << " l S\n";
|
| 318 } | 318 } |
| 319 | 319 |
| 320 sLine << "Q\n"; | 320 sLine << "Q\n"; |
| 321 } | 321 } |
| 322 break; | 322 break; |
| 323 case PBS_DASH: | 323 case PBS_DASH: |
| 324 { | 324 { |
| 325 sLine << "q\n" << GetBorderWidth() << " w\n" | 325 sLine << "q\n" << GetBorderWidth() << " w\n" |
| 326 << CPWL_Utils::GetColorAppStream(GetBord
erColor(),FALSE) << " 2 J 0 j\n" | 326 << CPWL_Utils::GetColorAppStream(GetBord
erColor(),FALSE) << " 2 J 0 j\n" |
| 327 << "[" << GetBorderDash().nDash << " " | 327 << "[" << GetBorderDash().nDash << " " |
| 328 << GetBorderDash().nGap << "] " | 328 << GetBorderDash().nGap << "] " |
| 329 << GetBorderDash().nPhase << " d\n"; | 329 << GetBorderDash().nPhase << " d\n"; |
| 330 | 330 |
| 331 » » » » for (FX_INT32 i=1;i<nCharArray;i++)» »
» » » | 331 » » » » for (int32_t i=1;i<nCharArray;i++)» »
» » » |
| 332 { | 332 { |
| 333 sLine << rcClient.left + ((rcClient.righ
t - rcClient.left)/nCharArray)*i << " " | 333 sLine << rcClient.left + ((rcClient.righ
t - rcClient.left)/nCharArray)*i << " " |
| 334 << rcClient.bottom << " m\n" | 334 << rcClient.bottom << " m\n" |
| 335 << rcClient.left + ((rcClient.ri
ght - rcClient.left)/nCharArray)*i << " " | 335 << rcClient.left + ((rcClient.ri
ght - rcClient.left)/nCharArray)*i << " " |
| 336 << rcClient.top << " l S\n"; | 336 << rcClient.top << " l S\n"; |
| 337 } | 337 } |
| 338 | 338 |
| 339 sLine << "Q\n"; | 339 sLine << "Q\n"; |
| 340 } | 340 } |
| 341 break; | 341 break; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser
2Device) | 407 void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser
2Device) |
| 408 { | 408 { |
| 409 CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); | 409 CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); |
| 410 | 410 |
| 411 CPDF_Rect rcClient = GetClientRect(); | 411 CPDF_Rect rcClient = GetClientRect(); |
| 412 CFX_ByteTextBuf sLine; | 412 CFX_ByteTextBuf sLine; |
| 413 | 413 |
| 414 » FX_INT32 nCharArray = m_pEdit->GetCharArray(); | 414 » int32_t nCharArray = m_pEdit->GetCharArray(); |
| 415 FX_SAFE_INT32 nCharArraySafe = nCharArray; | 415 FX_SAFE_INT32 nCharArraySafe = nCharArray; |
| 416 nCharArraySafe -= 1; | 416 nCharArraySafe -= 1; |
| 417 nCharArraySafe *= 2; | 417 nCharArraySafe *= 2; |
| 418 | 418 |
| 419 if (nCharArray > 0 && nCharArraySafe.IsValid()) | 419 if (nCharArray > 0 && nCharArraySafe.IsValid()) |
| 420 { | 420 { |
| 421 switch (GetBorderStyle()) | 421 switch (GetBorderStyle()) |
| 422 { | 422 { |
| 423 case PBS_SOLID: | 423 case PBS_SOLID: |
| 424 { | 424 { |
| 425 CFX_GraphStateData gsd; | 425 CFX_GraphStateData gsd; |
| 426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); | 426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); |
| 427 | 427 |
| 428 CFX_PathData path; | 428 CFX_PathData path; |
| 429 path.SetPointCount(nCharArraySafe.ValueOrDie()); | 429 path.SetPointCount(nCharArraySafe.ValueOrDie()); |
| 430 | 430 |
| 431 » » » » for (FX_INT32 i=0; i<nCharArray-1; i++) | 431 » » » » for (int32_t i=0; i<nCharArray-1; i++) |
| 432 { | 432 { |
| 433 path.SetPoint(i*2, rcClient.left + ((rcC
lient.right - rcClient.left)/nCharArray)*(i+1), | 433 path.SetPoint(i*2, rcClient.left + ((rcC
lient.right - rcClient.left)/nCharArray)*(i+1), |
| 434 rcClient.bottom, FXPT_MOVETO); | 434 rcClient.bottom, FXPT_MOVETO); |
| 435 path.SetPoint(i*2+1, rcClient.left + ((r
cClient.right - rcClient.left)/nCharArray)*(i+1), | 435 path.SetPoint(i*2+1, rcClient.left + ((r
cClient.right - rcClient.left)/nCharArray)*(i+1), |
| 436 rcClient.top, FXPT_LINETO); | 436 rcClient.top, FXPT_LINETO); |
| 437 } | 437 } |
| 438 if (path.GetPointCount() > 0) | 438 if (path.GetPointCount() > 0) |
| 439 pDevice->DrawPath(&path, pUser2Device, &
gsd,0, | 439 pDevice->DrawPath(&path, pUser2Device, &
gsd,0, |
| 440 CPWL_Utils::PWLColorToFXColor(Ge
tBorderColor(),255), FXFILL_ALTERNATE); | 440 CPWL_Utils::PWLColorToFXColor(Ge
tBorderColor(),255), FXFILL_ALTERNATE); |
| 441 } | 441 } |
| 442 break; | 442 break; |
| 443 case PBS_DASH: | 443 case PBS_DASH: |
| 444 { | 444 { |
| 445 CFX_GraphStateData gsd; | 445 CFX_GraphStateData gsd; |
| 446 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); | 446 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); |
| 447 | 447 |
| 448 gsd.SetDashCount(2); | 448 gsd.SetDashCount(2); |
| 449 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n
Dash; | 449 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n
Dash; |
| 450 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n
Gap; | 450 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n
Gap; |
| 451 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha
se; | 451 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha
se; |
| 452 | 452 |
| 453 CFX_PathData path; | 453 CFX_PathData path; |
| 454 path.SetPointCount(nCharArraySafe.ValueOrDie()); | 454 path.SetPointCount(nCharArraySafe.ValueOrDie()); |
| 455 | 455 |
| 456 » » » » for (FX_INT32 i=0; i<nCharArray-1; i++) | 456 » » » » for (int32_t i=0; i<nCharArray-1; i++) |
| 457 { | 457 { |
| 458 path.SetPoint(i*2, rcClient.left + ((rcC
lient.right - rcClient.left)/nCharArray)*(i+1), | 458 path.SetPoint(i*2, rcClient.left + ((rcC
lient.right - rcClient.left)/nCharArray)*(i+1), |
| 459 rcClient.bottom, FXPT_MOVETO); | 459 rcClient.bottom, FXPT_MOVETO); |
| 460 path.SetPoint(i*2+1, rcClient.left + ((r
cClient.right - rcClient.left)/nCharArray)*(i+1), | 460 path.SetPoint(i*2+1, rcClient.left + ((r
cClient.right - rcClient.left)/nCharArray)*(i+1), |
| 461 rcClient.top, FXPT_LINETO); | 461 rcClient.top, FXPT_LINETO); |
| 462 } | 462 } |
| 463 if (path.GetPointCount() > 0) | 463 if (path.GetPointCount() > 0) |
| 464 pDevice->DrawPath(&path, pUser2Device, &
gsd,0, | 464 pDevice->DrawPath(&path, pUser2Device, &
gsd,0, |
| 465 CPWL_Utils::PWLColorToFXColor(Ge
tBorderColor(),255), FXFILL_ALTERNATE); | 465 CPWL_Utils::PWLColorToFXColor(Ge
tBorderColor(),255), FXFILL_ALTERNATE); |
| 466 } | 466 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 if (HasFlag(PES_SPELLCHECK) && !swLatin.IsEmpty()) | 556 if (HasFlag(PES_SPELLCHECK) && !swLatin.IsEmpty()) |
| 557 { | 557 { |
| 558 if (m_pSpellCheck) | 558 if (m_pSpellCheck) |
| 559 { | 559 { |
| 560 CFX_ByteString sLatin = CFX_ByteString::FromUnic
ode(swLatin); | 560 CFX_ByteString sLatin = CFX_ByteString::FromUnic
ode(swLatin); |
| 561 | 561 |
| 562 if (!m_pSpellCheck->CheckWord(sLatin)) | 562 if (!m_pSpellCheck->CheckWord(sLatin)) |
| 563 { | 563 { |
| 564 m_pSpellCheck->SuggestWords(sLatin,sSugg
estWords); | 564 m_pSpellCheck->SuggestWords(sLatin,sSugg
estWords); |
| 565 | 565 |
| 566 » » » » » FX_INT32 nSuggest = sSuggestWords.GetSiz
e(); | 566 » » » » » int32_t nSuggest = sSuggestWords.GetSize
(); |
| 567 | 567 |
| 568 » » » » » for (FX_INT32 nWord=0; nWord<nSuggest; n
Word++) | 568 » » » » » for (int32_t nWord=0; nWord<nSuggest; nW
ord++) |
| 569 { | 569 { |
| 570 pSH->AppendMenuItem(hPopup, WM_P
WLEDIT_SUGGEST+nWord, sSuggestWords[nWord].UTF8Decode()); | 570 pSH->AppendMenuItem(hPopup, WM_P
WLEDIT_SUGGEST+nWord, sSuggestWords[nWord].UTF8Decode()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 if (nSuggest > 0) | 573 if (nSuggest > 0) |
| 574 pSH->AppendMenuItem(hPopup, 0, L
""); | 574 pSH->AppendMenuItem(hPopup, 0, L
""); |
| 575 | 575 |
| 576 ptPopup = GetWordRightBottomPoint(wrLati
n.EndPos); | 576 ptPopup = GetWordRightBottomPoint(wrLati
n.EndPos); |
| 577 } | 577 } |
| 578 } | 578 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 636 |
| 637 pSH->AppendMenuItem(hPopup, 0, L""); | 637 pSH->AppendMenuItem(hPopup, 0, L""); |
| 638 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SELECTALL, | 638 pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SELECTALL, |
| 639 pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All"); | 639 pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All"); |
| 640 | 640 |
| 641 if (m_pEdit->GetTotalWords() == 0) | 641 if (m_pEdit->GetTotalWords() == 0) |
| 642 { | 642 { |
| 643 pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE); | 643 pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE); |
| 644 } | 644 } |
| 645 | 645 |
| 646 » FX_INT32 x, y; | 646 » int32_t x, y; |
| 647 PWLtoWnd(ptPopup, x, y); | 647 PWLtoWnd(ptPopup, x, y); |
| 648 pSH->ClientToScreen(GetAttachedHWnd(), x, y); | 648 pSH->ClientToScreen(GetAttachedHWnd(), x, y); |
| 649 pSH->SetCursor(FXCT_ARROW); | 649 pSH->SetCursor(FXCT_ARROW); |
| 650 » FX_INT32 nCmd = pSH->TrackPopupMenu(hPopup, | 650 » int32_t nCmd = pSH->TrackPopupMenu(hPopup, |
| 651 x, | 651 x, |
| 652 y, | 652 y, |
| 653 GetAttachedHWnd()); | 653 GetAttachedHWnd()); |
| 654 | 654 |
| 655 | 655 |
| 656 switch (nCmd) | 656 switch (nCmd) |
| 657 { | 657 { |
| 658 case WM_PWLEDIT_UNDO: | 658 case WM_PWLEDIT_UNDO: |
| 659 Undo(); | 659 Undo(); |
| 660 break; | 660 break; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 729 |
| 730 if (!IsReadOnly()) | 730 if (!IsReadOnly()) |
| 731 { | 731 { |
| 732 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) | 732 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) |
| 733 pFocusHandler->OnKillFocus(this); | 733 pFocusHandler->OnKillFocus(this); |
| 734 } | 734 } |
| 735 | 735 |
| 736 m_bFocus = FALSE; | 736 m_bFocus = FALSE; |
| 737 } | 737 } |
| 738 | 738 |
| 739 void CPWL_Edit::SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint/* = TRUE*/) | 739 void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint/* = TRUE*/) |
| 740 { | 740 { |
| 741 m_pEdit->SetHorzScale(nHorzScale, bPaint); | 741 m_pEdit->SetHorzScale(nHorzScale, bPaint); |
| 742 } | 742 } |
| 743 | 743 |
| 744 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint/* = TRUE*/) | 744 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint/* = TRUE*/) |
| 745 { | 745 { |
| 746 m_pEdit->SetCharSpace(fCharSpace, bPaint); | 746 m_pEdit->SetCharSpace(fCharSpace, bPaint); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint/* = TRUE*/) | 749 void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint/* = TRUE*/) |
| 750 { | 750 { |
| 751 m_pEdit->SetLineLeading(fLineLeading, bPaint); | 751 m_pEdit->SetLineLeading(fLineLeading, bPaint); |
| 752 } | 752 } |
| 753 | 753 |
| 754 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(const CPDF_Point & ptOffset)
const | 754 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(const CPDF_Point & ptOffset)
const |
| 755 { | 755 { |
| 756 CPVT_WordRange wr = GetSelectWordRange(); | 756 CPVT_WordRange wr = GetSelectWordRange(); |
| 757 return CPWL_Utils::GetEditSelAppStream(m_pEdit,ptOffset,&wr); | 757 return CPWL_Utils::GetEditSelAppStream(m_pEdit,ptOffset,&wr); |
| 758 } | 758 } |
| 759 | 759 |
| 760 CPVT_WordRange CPWL_Edit::GetSelectWordRange() const | 760 CPVT_WordRange CPWL_Edit::GetSelectWordRange() const |
| 761 { | 761 { |
| 762 if (m_pEdit->IsSelected()) | 762 if (m_pEdit->IsSelected()) |
| 763 { | 763 { |
| 764 » » FX_INT32 nStart = -1; | 764 » » int32_t nStart = -1; |
| 765 » » FX_INT32 nEnd = -1; | 765 » » int32_t nEnd = -1; |
| 766 | 766 |
| 767 m_pEdit->GetSel(nStart, nEnd); | 767 m_pEdit->GetSel(nStart, nEnd); |
| 768 | 768 |
| 769 CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStart); | 769 CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStart); |
| 770 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEnd); | 770 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEnd); |
| 771 | 771 |
| 772 return CPVT_WordRange(wpStart,wpEnd); | 772 return CPVT_WordRange(wpStart,wpEnd); |
| 773 } | 773 } |
| 774 | 774 |
| 775 return CPVT_WordRange(); | 775 return CPVT_WordRange(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 } | 814 } |
| 815 | 815 |
| 816 return pt; | 816 return pt; |
| 817 } | 817 } |
| 818 | 818 |
| 819 FX_BOOL CPWL_Edit::IsTextFull() const | 819 FX_BOOL CPWL_Edit::IsTextFull() const |
| 820 { | 820 { |
| 821 return m_pEdit->IsTextFull(); | 821 return m_pEdit->IsTextFull(); |
| 822 } | 822 } |
| 823 | 823 |
| 824 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect&
rcPlate, FX_INT32 nCharArray) | 824 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect&
rcPlate, int32_t nCharArray) |
| 825 { | 825 { |
| 826 if (pFont && !pFont->IsStandardFont()) | 826 if (pFont && !pFont->IsStandardFont()) |
| 827 { | 827 { |
| 828 FX_RECT rcBBox; | 828 FX_RECT rcBBox; |
| 829 pFont->GetFontBBox(rcBBox); | 829 pFont->GetFontBBox(rcBBox); |
| 830 | 830 |
| 831 CPDF_Rect rcCell = rcPlate; | 831 CPDF_Rect rcCell = rcPlate; |
| 832 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.W
idth(); | 832 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.W
idth(); |
| 833 FX_FLOAT ydiv = - rcCell.Height() * 1000.0f / rcBBox.Height(); | 833 FX_FLOAT ydiv = - rcCell.Height() * 1000.0f / rcBBox.Height(); |
| 834 | 834 |
| 835 return xdiv < ydiv ? xdiv : ydiv; | 835 return xdiv < ydiv ? xdiv : ydiv; |
| 836 } | 836 } |
| 837 | 837 |
| 838 return 0.0f; | 838 return 0.0f; |
| 839 } | 839 } |
| 840 | 840 |
| 841 void CPWL_Edit::SetCharArray(FX_INT32 nCharArray) | 841 void CPWL_Edit::SetCharArray(int32_t nCharArray) |
| 842 { | 842 { |
| 843 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) | 843 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) |
| 844 { | 844 { |
| 845 m_pEdit->SetCharArray(nCharArray); | 845 m_pEdit->SetCharArray(nCharArray); |
| 846 m_pEdit->SetTextOverflow(TRUE); | 846 m_pEdit->SetTextOverflow(TRUE); |
| 847 | 847 |
| 848 if (HasFlag(PWS_AUTOFONTSIZE)) | 848 if (HasFlag(PWS_AUTOFONTSIZE)) |
| 849 { | 849 { |
| 850 if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) | 850 if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) |
| 851 { | 851 { |
| 852 FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pF
ontMap->GetPDFFont(0), GetClientRect(), nCharArray); | 852 FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pF
ontMap->GetPDFFont(0), GetClientRect(), nCharArray); |
| 853 if (fFontSize > 0.0f) | 853 if (fFontSize > 0.0f) |
| 854 { | 854 { |
| 855 m_pEdit->SetAutoFontSize(FALSE); | 855 m_pEdit->SetAutoFontSize(FALSE); |
| 856 m_pEdit->SetFontSize(fFontSize); | 856 m_pEdit->SetFontSize(fFontSize); |
| 857 } | 857 } |
| 858 } | 858 } |
| 859 } | 859 } |
| 860 } | 860 } |
| 861 } | 861 } |
| 862 | 862 |
| 863 void CPWL_Edit::SetLimitChar(FX_INT32 nLimitChar) | 863 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) |
| 864 { | 864 { |
| 865 m_pEdit->SetLimitChar(nLimitChar); | 865 m_pEdit->SetLimitChar(nLimitChar); |
| 866 } | 866 } |
| 867 | 867 |
| 868 void CPWL_Edit::ReplaceSel(FX_LPCWSTR csText) | 868 void CPWL_Edit::ReplaceSel(FX_LPCWSTR csText) |
| 869 { | 869 { |
| 870 m_pEdit->Clear(); | 870 m_pEdit->Clear(); |
| 871 m_pEdit->InsertText(csText); | 871 m_pEdit->InsertText(csText); |
| 872 } | 872 } |
| 873 | 873 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1009 |
| 1010 FX_BOOL bRC = TRUE; | 1010 FX_BOOL bRC = TRUE; |
| 1011 FX_BOOL bExit = FALSE; | 1011 FX_BOOL bExit = FALSE; |
| 1012 | 1012 |
| 1013 FX_BOOL bCtrl = IsCTRLpressed(nFlag); | 1013 FX_BOOL bCtrl = IsCTRLpressed(nFlag); |
| 1014 if (!bCtrl) | 1014 if (!bCtrl) |
| 1015 { | 1015 { |
| 1016 if (m_pFillerNotify) | 1016 if (m_pFillerNotify) |
| 1017 { | 1017 { |
| 1018 CFX_WideString swChange; | 1018 CFX_WideString swChange; |
| 1019 » » » FX_INT32 nKeyCode; | 1019 » » » int32_t nKeyCode; |
| 1020 | 1020 |
| 1021 int nSelStart = 0; | 1021 int nSelStart = 0; |
| 1022 int nSelEnd = 0; | 1022 int nSelEnd = 0; |
| 1023 GetSel(nSelStart, nSelEnd); | 1023 GetSel(nSelStart, nSelEnd); |
| 1024 | 1024 |
| 1025 switch (nChar) | 1025 switch (nChar) |
| 1026 { | 1026 { |
| 1027 case FWL_VKEY_Back: | 1027 case FWL_VKEY_Back: |
| 1028 nKeyCode = nChar; | 1028 nKeyCode = nChar; |
| 1029 if (nSelStart == nSelEnd) | 1029 if (nSelStart == nSelEnd) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1041 CFX_WideString strChangeEx; | 1041 CFX_WideString strChangeEx; |
| 1042 m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData
(), nKeyCode, swChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag
); | 1042 m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData
(), nKeyCode, swChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag
); |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 if (!bRC) return TRUE; | 1046 if (!bRC) return TRUE; |
| 1047 if (bExit) return FALSE; | 1047 if (bExit) return FALSE; |
| 1048 | 1048 |
| 1049 if (IFX_Edit_FontMap * pFontMap = GetFontMap()) | 1049 if (IFX_Edit_FontMap * pFontMap = GetFontMap()) |
| 1050 { | 1050 { |
| 1051 » » FX_INT32 nOldCharSet = GetCharSet(); | 1051 » » int32_t nOldCharSet = GetCharSet(); |
| 1052 » » FX_INT32 nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAU
LT_CHARSET); | 1052 » » int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAUL
T_CHARSET); |
| 1053 if(nOldCharSet != nNewCharSet) | 1053 if(nOldCharSet != nNewCharSet) |
| 1054 { | 1054 { |
| 1055 SetCharSet(nNewCharSet); | 1055 SetCharSet(nNewCharSet); |
| 1056 } | 1056 } |
| 1057 } | 1057 } |
| 1058 FX_BOOL bRet = CPWL_EditCtrl::OnChar(nChar,nFlag); | 1058 FX_BOOL bRet = CPWL_EditCtrl::OnChar(nChar,nFlag); |
| 1059 | 1059 |
| 1060 if (!bCtrl) | 1060 if (!bCtrl) |
| 1061 { | 1061 { |
| 1062 if (m_pFillerNotify) | 1062 if (m_pFillerNotify) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW
L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); | 1311 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW
L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, | 1314 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, |
| 1315 const CP
DF_Point& ptOffset) | 1315 const CP
DF_Point& ptOffset) |
| 1316 { | 1316 { |
| 1317 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; | 1317 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; |
| 1318 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW
L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); | 1318 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW
L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); |
| 1319 } | 1319 } |
| 1320 | 1320 |
| OLD | NEW |