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 "fpdfsdk/pdfwindow/PWL_Edit.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Edit.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
12 #include "core/fpdfdoc/include/cpvt_word.h" | 12 #include "core/fpdfdoc/include/cpvt_word.h" |
13 #include "core/fxcrt/include/fx_safe_types.h" | 13 #include "core/fxcrt/include/fx_safe_types.h" |
14 #include "core/fxcrt/include/fx_xml.h" | 14 #include "core/fxcrt/include/fx_xml.h" |
15 #include "core/fxge/include/cfx_graphstatedata.h" | 15 #include "core/fxge/include/cfx_graphstatedata.h" |
16 #include "core/fxge/include/cfx_pathdata.h" | 16 #include "core/fxge/include/cfx_pathdata.h" |
17 #include "core/fxge/include/cfx_renderdevice.h" | 17 #include "core/fxge/include/cfx_renderdevice.h" |
| 18 #include "core/fxge/include/fx_font.h" |
18 #include "fpdfsdk/fxedit/include/fxet_edit.h" | 19 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
19 #include "fpdfsdk/pdfwindow/PWL_Caret.h" | 20 #include "fpdfsdk/pdfwindow/PWL_Caret.h" |
20 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 21 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
21 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" | 22 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
22 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 23 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
23 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 24 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
24 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 25 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
25 #include "public/fpdf_fwlevent.h" | 26 #include "public/fpdf_fwlevent.h" |
26 #include "third_party/base/stl_util.h" | 27 #include "third_party/base/stl_util.h" |
27 | 28 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 558 } |
558 } | 559 } |
559 } | 560 } |
560 | 561 |
561 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { | 562 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { |
562 m_pEdit->SetLimitChar(nLimitChar); | 563 m_pEdit->SetLimitChar(nLimitChar); |
563 } | 564 } |
564 | 565 |
565 void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { | 566 void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { |
566 m_pEdit->Clear(); | 567 m_pEdit->Clear(); |
567 m_pEdit->InsertText(wsText, DEFAULT_CHARSET); | 568 m_pEdit->InsertText(wsText, FXFONT_DEFAULT_CHARSET); |
568 } | 569 } |
569 | 570 |
570 CFX_FloatRect CPWL_Edit::GetFocusRect() const { | 571 CFX_FloatRect CPWL_Edit::GetFocusRect() const { |
571 return CFX_FloatRect(); | 572 return CFX_FloatRect(); |
572 } | 573 } |
573 | 574 |
574 void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { | 575 void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { |
575 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { | 576 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
576 if (bShow) { | 577 if (bShow) { |
577 if (!pScroll->IsVisible()) { | 578 if (!pScroll->IsVisible()) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 } | 702 } |
702 } | 703 } |
703 | 704 |
704 if (!bRC) | 705 if (!bRC) |
705 return TRUE; | 706 return TRUE; |
706 if (bExit) | 707 if (bExit) |
707 return FALSE; | 708 return FALSE; |
708 | 709 |
709 if (IPVT_FontMap* pFontMap = GetFontMap()) { | 710 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
710 int32_t nOldCharSet = GetCharSet(); | 711 int32_t nOldCharSet = GetCharSet(); |
711 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); | 712 int32_t nNewCharSet = |
| 713 pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET); |
712 if (nOldCharSet != nNewCharSet) { | 714 if (nOldCharSet != nNewCharSet) { |
713 SetCharSet(nNewCharSet); | 715 SetCharSet(nNewCharSet); |
714 } | 716 } |
715 } | 717 } |
716 | 718 |
717 return CPWL_EditCtrl::OnChar(nChar, nFlag); | 719 return CPWL_EditCtrl::OnChar(nChar, nFlag); |
718 } | 720 } |
719 | 721 |
720 FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, | 722 FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, |
721 const CFX_FloatPoint& point, | 723 const CFX_FloatPoint& point, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 } | 886 } |
885 | 887 |
886 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 888 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
887 const CFX_FloatPoint& ptOffset) { | 889 const CFX_FloatPoint& ptOffset) { |
888 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; | 890 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; |
889 CFX_Edit::GeneratePageObjects( | 891 CFX_Edit::GeneratePageObjects( |
890 pObjectHolder, m_pEdit.get(), ptOffset, nullptr, | 892 pObjectHolder, m_pEdit.get(), ptOffset, nullptr, |
891 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), | 893 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
892 ObjArray); | 894 ObjArray); |
893 } | 895 } |
OLD | NEW |