| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfdoc/cpdf_formcontrol.h" | 7 #include "core/fpdfdoc/cpdf_formcontrol.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 CFX_ByteString csOn = GetOnStateName(); | 131 CFX_ByteString csOn = GetOnStateName(); |
| 132 CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS"); | 132 CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS"); |
| 133 return csAS == csOn; | 133 return csAS == csOn; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool CPDF_FormControl::IsDefaultChecked() const { | 136 bool CPDF_FormControl::IsDefaultChecked() const { |
| 137 ASSERT(GetType() == CPDF_FormField::CheckBox || | 137 ASSERT(GetType() == CPDF_FormField::CheckBox || |
| 138 GetType() == CPDF_FormField::RadioButton); | 138 GetType() == CPDF_FormField::RadioButton); |
| 139 CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV"); | 139 CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV"); |
| 140 if (!pDV) | 140 if (!pDV) |
| 141 return FALSE; | 141 return false; |
| 142 | 142 |
| 143 CFX_ByteString csDV = pDV->GetString(); | 143 CFX_ByteString csDV = pDV->GetString(); |
| 144 CFX_ByteString csOn = GetOnStateName(); | 144 CFX_ByteString csOn = GetOnStateName(); |
| 145 return (csDV == csOn); | 145 return (csDV == csOn); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void CPDF_FormControl::CheckControl(FX_BOOL bChecked) { | 148 void CPDF_FormControl::CheckControl(bool bChecked) { |
| 149 ASSERT(GetType() == CPDF_FormField::CheckBox || | 149 ASSERT(GetType() == CPDF_FormField::CheckBox || |
| 150 GetType() == CPDF_FormField::RadioButton); | 150 GetType() == CPDF_FormField::RadioButton); |
| 151 CFX_ByteString csOn = GetOnStateName(); | 151 CFX_ByteString csOn = GetOnStateName(); |
| 152 CFX_ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off"); | 152 CFX_ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off"); |
| 153 CFX_ByteString csAS = "Off"; | 153 CFX_ByteString csAS = "Off"; |
| 154 if (bChecked) | 154 if (bChecked) |
| 155 csAS = csOn; | 155 csAS = csOn; |
| 156 if (csOldAS == csAS) | 156 if (csOldAS == csAS) |
| 157 return; | 157 return; |
| 158 m_pWidgetDict->SetNameFor("AS", csAS); | 158 m_pWidgetDict->SetNameFor("AS", csAS); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (!m_pWidgetDict) | 321 if (!m_pWidgetDict) |
| 322 return 0; | 322 return 0; |
| 323 if (m_pWidgetDict->KeyExist("Q")) | 323 if (m_pWidgetDict->KeyExist("Q")) |
| 324 return m_pWidgetDict->GetIntegerFor("Q", 0); | 324 return m_pWidgetDict->GetIntegerFor("Q", 0); |
| 325 | 325 |
| 326 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q"); | 326 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q"); |
| 327 if (pObj) | 327 if (pObj) |
| 328 return pObj->GetInteger(); | 328 return pObj->GetInteger(); |
| 329 return m_pField->m_pForm->GetFormAlignment(); | 329 return m_pField->m_pForm->GetFormAlignment(); |
| 330 } | 330 } |
| OLD | NEW |