| 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 "xfa/fxfa/app/xfa_fftextedit.h" | 7 #include "xfa/fxfa/app/xfa_fftextedit.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 FX_FLOAT fy) { | 110 FX_FLOAT fy) { |
| 111 if (!PtInActiveRect(fx, fy)) { | 111 if (!PtInActiveRect(fx, fy)) { |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 if (!IsFocused()) { | 114 if (!IsFocused()) { |
| 115 m_dwStatus |= XFA_WidgetStatus_Focused; | 115 m_dwStatus |= XFA_WidgetStatus_Focused; |
| 116 UpdateFWLData(); | 116 UpdateFWLData(); |
| 117 AddInvalidateRect(); | 117 AddInvalidateRect(); |
| 118 } | 118 } |
| 119 SetButtonDown(true); | 119 SetButtonDown(true); |
| 120 CFWL_MsgMouse ms; | 120 CFWL_MsgMouse ms(nullptr, m_pNormalWidget); |
| 121 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; | 121 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; |
| 122 ms.m_dwFlags = dwFlags; | 122 ms.m_dwFlags = dwFlags; |
| 123 ms.m_fx = fx; | 123 ms.m_fx = fx; |
| 124 ms.m_fy = fy; | 124 ms.m_fy = fy; |
| 125 ms.m_pDstTarget = m_pNormalWidget; | |
| 126 FWLToClient(ms.m_fx, ms.m_fy); | 125 FWLToClient(ms.m_fx, ms.m_fy); |
| 127 TranslateFWLMessage(&ms); | 126 TranslateFWLMessage(&ms); |
| 128 return true; | 127 return true; |
| 129 } | 128 } |
| 130 bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, | 129 bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, |
| 131 FX_FLOAT fx, | 130 FX_FLOAT fx, |
| 132 FX_FLOAT fy) { | 131 FX_FLOAT fy) { |
| 133 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { | 132 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { |
| 134 return false; | 133 return false; |
| 135 } | 134 } |
| 136 if (!PtInActiveRect(fx, fy)) { | 135 if (!PtInActiveRect(fx, fy)) { |
| 137 return false; | 136 return false; |
| 138 } | 137 } |
| 139 if (!IsFocused()) { | 138 if (!IsFocused()) { |
| 140 m_dwStatus |= XFA_WidgetStatus_Focused; | 139 m_dwStatus |= XFA_WidgetStatus_Focused; |
| 141 UpdateFWLData(); | 140 UpdateFWLData(); |
| 142 AddInvalidateRect(); | 141 AddInvalidateRect(); |
| 143 } | 142 } |
| 144 SetButtonDown(true); | 143 SetButtonDown(true); |
| 145 CFWL_MsgMouse ms; | 144 CFWL_MsgMouse ms(nullptr, nullptr); |
| 146 ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; | 145 ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; |
| 147 ms.m_dwFlags = dwFlags; | 146 ms.m_dwFlags = dwFlags; |
| 148 ms.m_fx = fx; | 147 ms.m_fx = fx; |
| 149 ms.m_fy = fy; | 148 ms.m_fy = fy; |
| 150 FWLToClient(ms.m_fx, ms.m_fy); | 149 FWLToClient(ms.m_fx, ms.m_fy); |
| 151 TranslateFWLMessage(&ms); | 150 TranslateFWLMessage(&ms); |
| 152 return true; | 151 return true; |
| 153 } | 152 } |
| 154 bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 153 bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
| 155 if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) | 154 if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) |
| 156 return false; | 155 return false; |
| 157 | 156 |
| 158 GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); | 157 GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); |
| 159 return true; | 158 return true; |
| 160 } | 159 } |
| 161 bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { | 160 bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { |
| 162 m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; | 161 m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; |
| 163 if (!IsFocused()) { | 162 if (!IsFocused()) { |
| 164 m_dwStatus |= XFA_WidgetStatus_Focused; | 163 m_dwStatus |= XFA_WidgetStatus_Focused; |
| 165 UpdateFWLData(); | 164 UpdateFWLData(); |
| 166 AddInvalidateRect(); | 165 AddInvalidateRect(); |
| 167 } | 166 } |
| 168 CXFA_FFWidget::OnSetFocus(pOldWidget); | 167 CXFA_FFWidget::OnSetFocus(pOldWidget); |
| 169 CFWL_MsgSetFocus ms; | 168 CFWL_MsgSetFocus ms(nullptr, m_pNormalWidget); |
| 170 ms.m_pDstTarget = m_pNormalWidget; | |
| 171 ms.m_pSrcTarget = nullptr; | |
| 172 TranslateFWLMessage(&ms); | 169 TranslateFWLMessage(&ms); |
| 173 return true; | 170 return true; |
| 174 } | 171 } |
| 175 bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { | 172 bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { |
| 176 CFWL_MsgKillFocus ms; | 173 CFWL_MsgKillFocus ms(nullptr, m_pNormalWidget); |
| 177 ms.m_pDstTarget = m_pNormalWidget; | |
| 178 ms.m_pSrcTarget = nullptr; | |
| 179 TranslateFWLMessage(&ms); | 174 TranslateFWLMessage(&ms); |
| 180 m_dwStatus &= ~XFA_WidgetStatus_Focused; | 175 m_dwStatus &= ~XFA_WidgetStatus_Focused; |
| 181 SetEditScrollOffset(); | 176 SetEditScrollOffset(); |
| 182 ProcessCommittedData(); | 177 ProcessCommittedData(); |
| 183 UpdateFWLData(); | 178 UpdateFWLData(); |
| 184 AddInvalidateRect(); | 179 AddInvalidateRect(); |
| 185 CXFA_FFWidget::OnKillFocus(pNewWidget); | 180 CXFA_FFWidget::OnKillFocus(pNewWidget); |
| 186 m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; | 181 m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; |
| 187 return true; | 182 return true; |
| 188 } | 183 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 return true; | 326 return true; |
| 332 return false; | 327 return false; |
| 333 } | 328 } |
| 334 | 329 |
| 335 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { | 330 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { |
| 336 m_pOldDelegate->OnProcessMessage(pMessage); | 331 m_pOldDelegate->OnProcessMessage(pMessage); |
| 337 } | 332 } |
| 338 | 333 |
| 339 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { | 334 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { |
| 340 CXFA_FFField::OnProcessEvent(pEvent); | 335 CXFA_FFField::OnProcessEvent(pEvent); |
| 341 switch (pEvent->GetClassID()) { | 336 switch (pEvent->GetType()) { |
| 342 case CFWL_EventType::TextChanged: { | 337 case CFWL_Event::Type::TextChanged: { |
| 343 CFWL_EvtTextChanged* event = static_cast<CFWL_EvtTextChanged*>(pEvent); | 338 CFWL_EvtTextChanged* event = static_cast<CFWL_EvtTextChanged*>(pEvent); |
| 344 CFX_WideString wsChange; | 339 CFX_WideString wsChange; |
| 345 OnTextChanged(m_pNormalWidget, wsChange, event->wsPrevText); | 340 OnTextChanged(m_pNormalWidget, wsChange, event->wsPrevText); |
| 346 break; | 341 break; |
| 347 } | 342 } |
| 348 case CFWL_EventType::TextFull: { | 343 case CFWL_Event::Type::TextFull: { |
| 349 OnTextFull(m_pNormalWidget); | 344 OnTextFull(m_pNormalWidget); |
| 350 break; | 345 break; |
| 351 } | 346 } |
| 352 case CFWL_EventType::CheckWord: { | 347 case CFWL_Event::Type::CheckWord: { |
| 353 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); | 348 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); |
| 354 CFWL_EvtCheckWord* event = static_cast<CFWL_EvtCheckWord*>(pEvent); | 349 CFWL_EvtCheckWord* event = static_cast<CFWL_EvtCheckWord*>(pEvent); |
| 355 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); | 350 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); |
| 356 break; | 351 break; |
| 357 } | 352 } |
| 358 default: | 353 default: |
| 359 break; | 354 break; |
| 360 } | 355 } |
| 361 m_pOldDelegate->OnProcessEvent(pEvent); | 356 m_pOldDelegate->OnProcessEvent(pEvent); |
| 362 } | 357 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 406 } |
| 412 dwExtendedStyle |= GetAlignment(); | 407 dwExtendedStyle |= GetAlignment(); |
| 413 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || | 408 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || |
| 414 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 409 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
| 415 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; | 410 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; |
| 416 } | 411 } |
| 417 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); | 412 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); |
| 418 } | 413 } |
| 419 | 414 |
| 420 void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { | 415 void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { |
| 421 if (pEvent->GetClassID() == CFWL_EventType::Validate) { | 416 if (pEvent->GetType() == CFWL_Event::Type::Validate) { |
| 422 CFWL_EvtValidate* event = static_cast<CFWL_EvtValidate*>(pEvent); | 417 CFWL_EvtValidate* event = static_cast<CFWL_EvtValidate*>(pEvent); |
| 423 event->bValidate = OnValidate(m_pNormalWidget, event->wsInsert); | 418 event->bValidate = OnValidate(m_pNormalWidget, event->wsInsert); |
| 424 return; | 419 return; |
| 425 } | 420 } |
| 426 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 421 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
| 427 } | 422 } |
| 428 | 423 |
| 429 bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, | 424 bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, |
| 430 CFX_WideString& wsText) { | 425 CFX_WideString& wsText) { |
| 431 CFX_WideString wsPattern; | 426 CFX_WideString wsPattern; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 pDateTime->Update(); | 671 pDateTime->Update(); |
| 677 GetDoc()->GetDocEnvironment()->SetFocusWidget(GetDoc(), nullptr); | 672 GetDoc()->GetDocEnvironment()->SetFocusWidget(GetDoc(), nullptr); |
| 678 CXFA_EventParam eParam; | 673 CXFA_EventParam eParam; |
| 679 eParam.m_eType = XFA_EVENT_Change; | 674 eParam.m_eType = XFA_EVENT_Change; |
| 680 eParam.m_pTarget = m_pDataAcc; | 675 eParam.m_pTarget = m_pDataAcc; |
| 681 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); | 676 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); |
| 682 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); | 677 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); |
| 683 } | 678 } |
| 684 | 679 |
| 685 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { | 680 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { |
| 686 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { | 681 if (pEvent->GetType() == CFWL_Event::Type::SelectChanged) { |
| 687 CFWL_EvtSelectChanged* event = static_cast<CFWL_EvtSelectChanged*>(pEvent); | 682 CFWL_EvtSelectChanged* event = static_cast<CFWL_EvtSelectChanged*>(pEvent); |
| 688 OnSelectChanged(m_pNormalWidget, event->iYear, event->iMonth, event->iDay); | 683 OnSelectChanged(m_pNormalWidget, event->iYear, event->iMonth, event->iDay); |
| 689 return; | 684 return; |
| 690 } | 685 } |
| 691 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 686 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
| 692 } | 687 } |
| OLD | NEW |