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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Edit.cpp

Issue 1409743004: Remove dead code that was reactivated when fixing overrides. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 years, 2 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/formfiller/FFL_ListBox.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ListBox.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 "../../../core/include/fxcrt/fx_safe_types.h" 7 #include "../../../core/include/fxcrt/fx_safe_types.h"
8 #include "../../../core/include/fxcrt/fx_xml.h" 8 #include "../../../core/include/fxcrt/fx_xml.h"
9 #include "../../include/pdfwindow/PDFWindow.h" 9 #include "../../include/pdfwindow/PDFWindow.h"
10 #include "../../include/pdfwindow/PWL_Caret.h" 10 #include "../../include/pdfwindow/PWL_Caret.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (IFX_SystemHandler* pSH = GetSystemHandler()) 156 if (IFX_SystemHandler* pSH = GetSystemHandler())
157 swClipboard = pSH->GetClipboardText(GetAttachedHWnd()); 157 swClipboard = pSH->GetClipboardText(GetAttachedHWnd());
158 158
159 if (m_pFillerNotify) { 159 if (m_pFillerNotify) {
160 FX_BOOL bRC = TRUE; 160 FX_BOOL bRC = TRUE;
161 FX_BOOL bExit = FALSE; 161 FX_BOOL bExit = FALSE;
162 CFX_WideString strChangeEx; 162 CFX_WideString strChangeEx;
163 int nSelStart = 0; 163 int nSelStart = 0;
164 int nSelEnd = 0; 164 int nSelEnd = 0;
165 GetSel(nSelStart, nSelEnd); 165 GetSel(nSelStart, nSelEnd);
166 m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), 0, swClipboard, 166 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard,
167 strChangeEx, nSelStart, nSelEnd, TRUE, 167 strChangeEx, nSelStart, nSelEnd, TRUE,
168 bRC, bExit, 0); 168 bRC, bExit, 0);
169 if (!bRC) 169 if (!bRC)
170 return; 170 return;
171 if (bExit) 171 if (bExit)
172 return; 172 return;
173 } 173 }
174 174
175 if (swClipboard.GetLength() > 0) { 175 if (swClipboard.GetLength() > 0) {
176 Clear(); 176 Clear();
177 InsertText(swClipboard.c_str()); 177 InsertText(swClipboard.c_str());
178 } 178 }
179
180 if (m_pFillerNotify) {
181 FX_BOOL bExit = FALSE;
182 m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, 0);
183 if (bExit)
184 return;
185 }
186 } 179 }
187 180
188 void CPWL_Edit::CutText() { 181 void CPWL_Edit::CutText() {
189 if (!CanCut()) 182 if (!CanCut())
190 return; 183 return;
191 184
192 CFX_WideString str = m_pEdit->GetSelText(); 185 CFX_WideString str = m_pEdit->GetSelText();
193 186
194 if (IFX_SystemHandler* pSH = GetSystemHandler()) 187 if (IFX_SystemHandler* pSH = GetSystemHandler())
195 pSH->SetClipboardText(GetAttachedHWnd(), str); 188 pSH->SetClipboardText(GetAttachedHWnd(), str);
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 FX_BOOL bExit = FALSE; 869 FX_BOOL bExit = FALSE;
877 CFX_WideString strChange; 870 CFX_WideString strChange;
878 CFX_WideString strChangeEx; 871 CFX_WideString strChangeEx;
879 872
880 int nSelStart = 0; 873 int nSelStart = 0;
881 int nSelEnd = 0; 874 int nSelEnd = 0;
882 GetSel(nSelStart, nSelEnd); 875 GetSel(nSelStart, nSelEnd);
883 876
884 if (nSelStart == nSelEnd) 877 if (nSelStart == nSelEnd)
885 nSelEnd = nSelStart + 1; 878 nSelEnd = nSelStart + 1;
886 m_pFillerNotify->OnBeforeKeyStroke( 879 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange,
887 TRUE, GetAttachedData(), FWL_VKEY_Delete, strChange, strChangeEx, 880 strChangeEx, nSelStart, nSelEnd, TRUE,
888 nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag); 881 bRC, bExit, nFlag);
889 if (!bRC) 882 if (!bRC)
890 return FALSE; 883 return FALSE;
891 if (bExit) 884 if (bExit)
892 return FALSE; 885 return FALSE;
893 } 886 }
894 } 887 }
895 888
896 FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); 889 FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag);
897 890
898 if (nChar == FWL_VKEY_Delete) {
899 if (m_pFillerNotify) {
900 FX_BOOL bExit = FALSE;
901 m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, nFlag);
902 if (bExit)
903 return FALSE;
904 }
905 }
906
907 // In case of implementation swallow the OnKeyDown event. 891 // In case of implementation swallow the OnKeyDown event.
908 if (IsProceedtoOnChar(nChar, nFlag)) 892 if (IsProceedtoOnChar(nChar, nFlag))
909 return TRUE; 893 return TRUE;
910 894
911 return bRet; 895 return bRet;
912 } 896 }
913 897
914 /** 898 /**
915 *In case of implementation swallow the OnKeyDown event. 899 *In case of implementation swallow the OnKeyDown event.
916 *If the event is swallowed, implementation may do other unexpected things, which 900 *If the event is swallowed, implementation may do other unexpected things, which
(...skipping 16 matching lines...) Expand all
933 } 917 }
934 } 918 }
935 // control characters. 919 // control characters.
936 switch (nKeyCode) { 920 switch (nKeyCode) {
937 case FWL_VKEY_Escape: 921 case FWL_VKEY_Escape:
938 case FWL_VKEY_Back: 922 case FWL_VKEY_Back:
939 case FWL_VKEY_Return: 923 case FWL_VKEY_Return:
940 case FWL_VKEY_Space: 924 case FWL_VKEY_Space:
941 return TRUE; 925 return TRUE;
942 default: 926 default:
943 break; 927 return FALSE;
944 } 928 }
945 return FALSE;
946 } 929 }
947 930
948 FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) { 931 FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
949 if (m_bMouseDown) 932 if (m_bMouseDown)
950 return TRUE; 933 return TRUE;
951 934
952 FX_BOOL bRC = TRUE; 935 FX_BOOL bRC = TRUE;
953 FX_BOOL bExit = FALSE; 936 FX_BOOL bExit = FALSE;
954 937
955 FX_BOOL bCtrl = IsCTRLpressed(nFlag); 938 if (!IsCTRLpressed(nFlag)) {
956 if (!bCtrl) {
957 if (m_pFillerNotify) { 939 if (m_pFillerNotify) {
958 CFX_WideString swChange; 940 CFX_WideString swChange;
959 int32_t nKeyCode;
960 941
961 int nSelStart = 0; 942 int nSelStart = 0;
962 int nSelEnd = 0; 943 int nSelEnd = 0;
963 GetSel(nSelStart, nSelEnd); 944 GetSel(nSelStart, nSelEnd);
964 945
965 switch (nChar) { 946 switch (nChar) {
966 case FWL_VKEY_Back: 947 case FWL_VKEY_Back:
967 nKeyCode = nChar;
968 if (nSelStart == nSelEnd) 948 if (nSelStart == nSelEnd)
969 nSelStart = nSelEnd - 1; 949 nSelStart = nSelEnd - 1;
970 break; 950 break;
971 case FWL_VKEY_Return: 951 case FWL_VKEY_Return:
972 nKeyCode = nChar;
973 break; 952 break;
974 default: 953 default:
975 nKeyCode = 0;
976 swChange += nChar; 954 swChange += nChar;
977 break; 955 break;
978 } 956 }
979 957
980 CFX_WideString strChangeEx; 958 CFX_WideString strChangeEx;
981 m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), nKeyCode, 959 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange,
982 swChange, strChangeEx, nSelStart, 960 strChangeEx, nSelStart, nSelEnd, TRUE,
983 nSelEnd, TRUE, bRC, bExit, nFlag); 961 bRC, bExit, nFlag);
984 } 962 }
985 } 963 }
986 964
987 if (!bRC) 965 if (!bRC)
988 return TRUE; 966 return TRUE;
989 if (bExit) 967 if (bExit)
990 return FALSE; 968 return FALSE;
991 969
992 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { 970 if (IFX_Edit_FontMap* pFontMap = GetFontMap()) {
993 int32_t nOldCharSet = GetCharSet(); 971 int32_t nOldCharSet = GetCharSet();
994 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); 972 int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET);
995 if (nOldCharSet != nNewCharSet) { 973 if (nOldCharSet != nNewCharSet) {
996 SetCharSet(nNewCharSet); 974 SetCharSet(nNewCharSet);
997 } 975 }
998 } 976 }
999 FX_BOOL bRet = CPWL_EditCtrl::OnChar(nChar, nFlag);
1000 977
1001 if (!bCtrl) { 978 return CPWL_EditCtrl::OnChar(nChar, nFlag);
1002 if (m_pFillerNotify) {
1003 m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, nFlag);
1004 if (bExit)
1005 return FALSE;
1006 }
1007 }
1008
1009 return bRet;
1010 } 979 }
1011 980
1012 FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, 981 FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta,
1013 const CPDF_Point& point, 982 const CPDF_Point& point,
1014 FX_DWORD nFlag) { 983 FX_DWORD nFlag) {
1015 if (HasFlag(PES_MULTILINE)) { 984 if (HasFlag(PES_MULTILINE)) {
1016 CPDF_Point ptScroll = GetScrollPos(); 985 CPDF_Point ptScroll = GetScrollPos();
1017 986
1018 if (zDelta > 0) { 987 if (zDelta > 0) {
1019 ptScroll.y += GetFontSize(); 988 ptScroll.y += GetFontSize();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 } 1183 }
1215 1184
1216 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, 1185 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
1217 const CPDF_Point& ptOffset) { 1186 const CPDF_Point& ptOffset) {
1218 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; 1187 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
1219 IFX_Edit::GeneratePageObjects( 1188 IFX_Edit::GeneratePageObjects(
1220 pPageObjects, m_pEdit, ptOffset, NULL, 1189 pPageObjects, m_pEdit, ptOffset, NULL,
1221 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 1190 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
1222 ObjArray); 1191 ObjArray);
1223 } 1192 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_ListBox.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698