| 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_fffield.h" | 7 #include "xfa/fxfa/app/xfa_fffield.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/ifwl_edit.h" | 9 #include "xfa/fwl/basewidget/ifwl_edit.h" |
| 10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 CXFA_FFField::~CXFA_FFField() { | 29 CXFA_FFField::~CXFA_FFField() { |
| 30 CXFA_FFField::UnloadWidget(); | 30 CXFA_FFField::UnloadWidget(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 FX_BOOL CXFA_FFField::GetBBox(CFX_RectF& rtBox, | 33 FX_BOOL CXFA_FFField::GetBBox(CFX_RectF& rtBox, |
| 34 uint32_t dwStatus, | 34 uint32_t dwStatus, |
| 35 FX_BOOL bDrawFocus) { | 35 FX_BOOL bDrawFocus) { |
| 36 if (!bDrawFocus) | 36 if (!bDrawFocus) |
| 37 return CXFA_FFWidget::GetBBox(rtBox, dwStatus); | 37 return CXFA_FFWidget::GetBBox(rtBox, dwStatus); |
| 38 | 38 |
| 39 XFA_ELEMENT type = (XFA_ELEMENT)m_pDataAcc->GetUIType(); | 39 XFA_Element type = m_pDataAcc->GetUIType(); |
| 40 if (type == XFA_ELEMENT_Button || type == XFA_ELEMENT_CheckButton || | 40 if (type == XFA_Element::Button || type == XFA_Element::CheckButton || |
| 41 type == XFA_ELEMENT_ImageEdit || type == XFA_ELEMENT_Signature || | 41 type == XFA_Element::ImageEdit || type == XFA_Element::Signature || |
| 42 type == XFA_ELEMENT_ChoiceList) { | 42 type == XFA_Element::ChoiceList) { |
| 43 rtBox = m_rtUI; | 43 rtBox = m_rtUI; |
| 44 CFX_Matrix mt; | 44 CFX_Matrix mt; |
| 45 GetRotateMatrix(mt); | 45 GetRotateMatrix(mt); |
| 46 mt.TransformRect(rtBox); | 46 mt.TransformRect(rtBox); |
| 47 return TRUE; | 47 return TRUE; |
| 48 } | 48 } |
| 49 return FALSE; | 49 return FALSE; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, | 52 void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 SetFWLThemeProvider(); | 120 SetFWLThemeProvider(); |
| 121 m_pDataAcc->LoadCaption(); | 121 m_pDataAcc->LoadCaption(); |
| 122 PerformLayout(); | 122 PerformLayout(); |
| 123 return TRUE; | 123 return TRUE; |
| 124 } | 124 } |
| 125 void CXFA_FFField::UnloadWidget() { | 125 void CXFA_FFField::UnloadWidget() { |
| 126 delete m_pNormalWidget; | 126 delete m_pNormalWidget; |
| 127 m_pNormalWidget = nullptr; | 127 m_pNormalWidget = nullptr; |
| 128 } | 128 } |
| 129 void CXFA_FFField::SetEditScrollOffset() { | 129 void CXFA_FFField::SetEditScrollOffset() { |
| 130 XFA_ELEMENT eType = m_pDataAcc->GetUIType(); | 130 XFA_Element eType = m_pDataAcc->GetUIType(); |
| 131 if (eType == XFA_ELEMENT_TextEdit || eType == XFA_ELEMENT_NumericEdit || | 131 if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit || |
| 132 eType == XFA_ELEMENT_PasswordEdit) { | 132 eType == XFA_Element::PasswordEdit) { |
| 133 FX_FLOAT fScrollOffset = 0; | 133 FX_FLOAT fScrollOffset = 0; |
| 134 CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); | 134 CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); |
| 135 if (pPrev) { | 135 if (pPrev) { |
| 136 CFX_RectF rtMargin; | 136 CFX_RectF rtMargin; |
| 137 m_pDataAcc->GetUIMargin(rtMargin); | 137 m_pDataAcc->GetUIMargin(rtMargin); |
| 138 fScrollOffset = -rtMargin.top; | 138 fScrollOffset = -rtMargin.top; |
| 139 } | 139 } |
| 140 while (pPrev) { | 140 while (pPrev) { |
| 141 fScrollOffset += pPrev->m_rtUI.height; | 141 fScrollOffset += pPrev->m_rtUI.height; |
| 142 pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev()); | 142 pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev()); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 void CXFA_FFField::UpdateFWL() { | 318 void CXFA_FFField::UpdateFWL() { |
| 319 if (m_pNormalWidget) { | 319 if (m_pNormalWidget) { |
| 320 m_pNormalWidget->Update(); | 320 m_pNormalWidget->Update(); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 uint32_t CXFA_FFField::UpdateUIProperty() { | 323 uint32_t CXFA_FFField::UpdateUIProperty() { |
| 324 CXFA_Node* pUiNode = m_pDataAcc->GetUIChild(); | 324 CXFA_Node* pUiNode = m_pDataAcc->GetUIChild(); |
| 325 uint32_t dwStyle = 0; | 325 uint32_t dwStyle = 0; |
| 326 if (pUiNode && pUiNode->GetClassID() == XFA_ELEMENT_DefaultUi) { | 326 if (pUiNode && pUiNode->GetClassID() == XFA_Element::DefaultUi) { |
| 327 dwStyle = FWL_STYLEEXT_EDT_ReadOnly; | 327 dwStyle = FWL_STYLEEXT_EDT_ReadOnly; |
| 328 } | 328 } |
| 329 return dwStyle; | 329 return dwStyle; |
| 330 } | 330 } |
| 331 void CXFA_FFField::SetFWLRect() { | 331 void CXFA_FFField::SetFWLRect() { |
| 332 if (!m_pNormalWidget) { | 332 if (!m_pNormalWidget) { |
| 333 return; | 333 return; |
| 334 } | 334 } |
| 335 CFX_RectF rtUi = m_rtUI; | 335 CFX_RectF rtUi = m_rtUI; |
| 336 if (rtUi.width < 1.0) | 336 if (rtUi.width < 1.0) |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); | 818 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); |
| 819 break; | 819 break; |
| 820 } | 820 } |
| 821 default: | 821 default: |
| 822 break; | 822 break; |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, | 826 void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, |
| 827 const CFX_Matrix* pMatrix) {} | 827 const CFX_Matrix* pMatrix) {} |
| OLD | NEW |