| 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/fxcrt/include/fx_safe_types.h" | 13 #include "core/fxcrt/include/fx_safe_types.h" |
| 13 #include "core/fxcrt/include/fx_xml.h" | 14 #include "core/fxcrt/include/fx_xml.h" |
| 14 #include "core/include/fxge/fx_ge.h" | 15 #include "core/include/fxge/fx_ge.h" |
| 15 #include "fpdfsdk/pdfwindow/PWL_Caret.h" | 16 #include "fpdfsdk/pdfwindow/PWL_Caret.h" |
| 16 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 17 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
| 17 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" | 18 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
| 18 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 19 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
| 19 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 20 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
| 20 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 21 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 21 #include "public/fpdf_fwlevent.h" | 22 #include "public/fpdf_fwlevent.h" |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 805 |
| 805 return 0.0f; | 806 return 0.0f; |
| 806 } | 807 } |
| 807 | 808 |
| 808 void CPWL_Edit::SetCharArray(int32_t nCharArray) { | 809 void CPWL_Edit::SetCharArray(int32_t nCharArray) { |
| 809 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { | 810 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { |
| 810 m_pEdit->SetCharArray(nCharArray); | 811 m_pEdit->SetCharArray(nCharArray); |
| 811 m_pEdit->SetTextOverflow(TRUE); | 812 m_pEdit->SetTextOverflow(TRUE); |
| 812 | 813 |
| 813 if (HasFlag(PWS_AUTOFONTSIZE)) { | 814 if (HasFlag(PWS_AUTOFONTSIZE)) { |
| 814 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { | 815 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
| 815 FX_FLOAT fFontSize = GetCharArrayAutoFontSize( | 816 FX_FLOAT fFontSize = GetCharArrayAutoFontSize( |
| 816 pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); | 817 pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); |
| 817 if (fFontSize > 0.0f) { | 818 if (fFontSize > 0.0f) { |
| 818 m_pEdit->SetAutoFontSize(FALSE); | 819 m_pEdit->SetAutoFontSize(FALSE); |
| 819 m_pEdit->SetFontSize(fFontSize); | 820 m_pEdit->SetFontSize(fFontSize); |
| 820 } | 821 } |
| 821 } | 822 } |
| 822 } | 823 } |
| 823 } | 824 } |
| 824 } | 825 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 strChangeEx, nSelStart, nSelEnd, TRUE, | 972 strChangeEx, nSelStart, nSelEnd, TRUE, |
| 972 bRC, bExit, nFlag); | 973 bRC, bExit, nFlag); |
| 973 } | 974 } |
| 974 } | 975 } |
| 975 | 976 |
| 976 if (!bRC) | 977 if (!bRC) |
| 977 return TRUE; | 978 return TRUE; |
| 978 if (bExit) | 979 if (bExit) |
| 979 return FALSE; | 980 return FALSE; |
| 980 | 981 |
| 981 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { | 982 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
| 982 int32_t nOldCharSet = GetCharSet(); | 983 int32_t nOldCharSet = GetCharSet(); |
| 983 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); | 984 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); |
| 984 if (nOldCharSet != nNewCharSet) { | 985 if (nOldCharSet != nNewCharSet) { |
| 985 SetCharSet(nNewCharSet); | 986 SetCharSet(nNewCharSet); |
| 986 } | 987 } |
| 987 } | 988 } |
| 988 | 989 |
| 989 return CPWL_EditCtrl::OnChar(nChar, nFlag); | 990 return CPWL_EditCtrl::OnChar(nChar, nFlag); |
| 990 } | 991 } |
| 991 | 992 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 } | 1192 } |
| 1192 | 1193 |
| 1193 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 1194 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 1194 const CFX_FloatPoint& ptOffset) { | 1195 const CFX_FloatPoint& ptOffset) { |
| 1195 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; | 1196 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; |
| 1196 IFX_Edit::GeneratePageObjects( | 1197 IFX_Edit::GeneratePageObjects( |
| 1197 pObjectHolder, m_pEdit, ptOffset, NULL, | 1198 pObjectHolder, m_pEdit, ptOffset, NULL, |
| 1198 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), | 1199 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 1199 ObjArray); | 1200 ObjArray); |
| 1200 } | 1201 } |
| OLD | NEW |