| 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 "xfa/fxfa/parser/cxfa_widgetdata.h" | 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxbarcode/include/BC_Library.h" | 10 #include "xfa/fxbarcode/include/BC_Library.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return TRUE; | 70 return TRUE; |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode) | 75 CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode) |
| 76 : CXFA_Data(pNode), | 76 : CXFA_Data(pNode), |
| 77 m_bIsNull(TRUE), | 77 m_bIsNull(TRUE), |
| 78 m_bPreNull(TRUE), | 78 m_bPreNull(TRUE), |
| 79 m_pUiChildNode(NULL), | 79 m_pUiChildNode(NULL), |
| 80 m_eUIType(XFA_ELEMENT_UNKNOWN) {} | 80 m_eUIType(XFA_Element::Unknown) {} |
| 81 | 81 |
| 82 CXFA_Node* CXFA_WidgetData::GetUIChild() { | 82 CXFA_Node* CXFA_WidgetData::GetUIChild() { |
| 83 if (m_eUIType == XFA_ELEMENT_UNKNOWN) | 83 if (m_eUIType == XFA_Element::Unknown) |
| 84 m_pUiChildNode = XFA_CreateUIChild(m_pNode, m_eUIType); | 84 m_pUiChildNode = XFA_CreateUIChild(m_pNode, m_eUIType); |
| 85 | 85 |
| 86 return m_pUiChildNode; | 86 return m_pUiChildNode; |
| 87 } | 87 } |
| 88 | 88 |
| 89 XFA_ELEMENT CXFA_WidgetData::GetUIType() { | 89 XFA_Element CXFA_WidgetData::GetUIType() { |
| 90 GetUIChild(); | 90 GetUIChild(); |
| 91 return m_eUIType; | 91 return m_eUIType; |
| 92 } | 92 } |
| 93 | 93 |
| 94 CFX_WideString CXFA_WidgetData::GetRawValue() { | 94 CFX_WideString CXFA_WidgetData::GetRawValue() { |
| 95 return m_pNode->GetContent(); | 95 return m_pNode->GetContent(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 int32_t CXFA_WidgetData::GetAccess(FX_BOOL bTemplate) { | 98 int32_t CXFA_WidgetData::GetAccess(FX_BOOL bTemplate) { |
| 99 if (bTemplate) { | 99 if (bTemplate) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 118 CXFA_Measurement ms; | 118 CXFA_Measurement ms; |
| 119 if (!m_pNode->TryMeasure(XFA_ATTRIBUTE_Rotate, ms, FALSE)) | 119 if (!m_pNode->TryMeasure(XFA_ATTRIBUTE_Rotate, ms, FALSE)) |
| 120 return 0; | 120 return 0; |
| 121 | 121 |
| 122 int32_t iRotate = FXSYS_round(ms.GetValue()); | 122 int32_t iRotate = FXSYS_round(ms.GetValue()); |
| 123 iRotate = XFA_MapRotation(iRotate); | 123 iRotate = XFA_MapRotation(iRotate); |
| 124 return iRotate / 90 * 90; | 124 return iRotate / 90 * 90; |
| 125 } | 125 } |
| 126 | 126 |
| 127 CXFA_Border CXFA_WidgetData::GetBorder(FX_BOOL bModified) { | 127 CXFA_Border CXFA_WidgetData::GetBorder(FX_BOOL bModified) { |
| 128 return CXFA_Border(m_pNode->GetProperty(0, XFA_ELEMENT_Border, bModified)); | 128 return CXFA_Border(m_pNode->GetProperty(0, XFA_Element::Border, bModified)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 CXFA_Caption CXFA_WidgetData::GetCaption(FX_BOOL bModified) { | 131 CXFA_Caption CXFA_WidgetData::GetCaption(FX_BOOL bModified) { |
| 132 return CXFA_Caption(m_pNode->GetProperty(0, XFA_ELEMENT_Caption, bModified)); | 132 return CXFA_Caption(m_pNode->GetProperty(0, XFA_Element::Caption, bModified)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 CXFA_Font CXFA_WidgetData::GetFont(FX_BOOL bModified) { | 135 CXFA_Font CXFA_WidgetData::GetFont(FX_BOOL bModified) { |
| 136 return CXFA_Font(m_pNode->GetProperty(0, XFA_ELEMENT_Font, bModified)); | 136 return CXFA_Font(m_pNode->GetProperty(0, XFA_Element::Font, bModified)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 CXFA_Margin CXFA_WidgetData::GetMargin(FX_BOOL bModified) { | 139 CXFA_Margin CXFA_WidgetData::GetMargin(FX_BOOL bModified) { |
| 140 return CXFA_Margin(m_pNode->GetProperty(0, XFA_ELEMENT_Margin, bModified)); | 140 return CXFA_Margin(m_pNode->GetProperty(0, XFA_Element::Margin, bModified)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 CXFA_Para CXFA_WidgetData::GetPara(FX_BOOL bModified) { | 143 CXFA_Para CXFA_WidgetData::GetPara(FX_BOOL bModified) { |
| 144 return CXFA_Para(m_pNode->GetProperty(0, XFA_ELEMENT_Para, bModified)); | 144 return CXFA_Para(m_pNode->GetProperty(0, XFA_Element::Para, bModified)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void CXFA_WidgetData::GetEventList(CXFA_NodeArray& events) { | 147 void CXFA_WidgetData::GetEventList(CXFA_NodeArray& events) { |
| 148 m_pNode->GetNodeList(events, 0, XFA_ELEMENT_Event); | 148 m_pNode->GetNodeList(events, 0, XFA_Element::Event); |
| 149 } | 149 } |
| 150 | 150 |
| 151 int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity, | 151 int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity, |
| 152 CXFA_NodeArray& events, | 152 CXFA_NodeArray& events, |
| 153 FX_BOOL bIsFormReady) { | 153 FX_BOOL bIsFormReady) { |
| 154 CXFA_NodeArray allEvents; | 154 CXFA_NodeArray allEvents; |
| 155 GetEventList(allEvents); | 155 GetEventList(allEvents); |
| 156 int32_t iCount = allEvents.GetSize(); | 156 int32_t iCount = allEvents.GetSize(); |
| 157 for (int32_t i = 0; i < iCount; i++) { | 157 for (int32_t i = 0; i < iCount; i++) { |
| 158 CXFA_Event event(allEvents[i]); | 158 CXFA_Event event(allEvents[i]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 170 } else { | 170 } else { |
| 171 events.Add(allEvents[i]); | 171 events.Add(allEvents[i]); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 return events.GetSize(); | 175 return events.GetSize(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 CXFA_Value CXFA_WidgetData::GetDefaultValue(FX_BOOL bModified) { | 178 CXFA_Value CXFA_WidgetData::GetDefaultValue(FX_BOOL bModified) { |
| 179 CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); | 179 CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); |
| 180 return CXFA_Value(pTemNode | 180 return CXFA_Value( |
| 181 ? pTemNode->GetProperty(0, XFA_ELEMENT_Value, bModified) | 181 pTemNode ? pTemNode->GetProperty(0, XFA_Element::Value, bModified) |
| 182 : nullptr); | 182 : nullptr); |
| 183 } | 183 } |
| 184 | 184 |
| 185 CXFA_Value CXFA_WidgetData::GetFormValue(FX_BOOL bModified) { | 185 CXFA_Value CXFA_WidgetData::GetFormValue(FX_BOOL bModified) { |
| 186 return CXFA_Value(m_pNode->GetProperty(0, XFA_ELEMENT_Value, bModified)); | 186 return CXFA_Value(m_pNode->GetProperty(0, XFA_Element::Value, bModified)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 CXFA_Calculate CXFA_WidgetData::GetCalculate(FX_BOOL bModified) { | 189 CXFA_Calculate CXFA_WidgetData::GetCalculate(FX_BOOL bModified) { |
| 190 return CXFA_Calculate( | 190 return CXFA_Calculate( |
| 191 m_pNode->GetProperty(0, XFA_ELEMENT_Calculate, bModified)); | 191 m_pNode->GetProperty(0, XFA_Element::Calculate, bModified)); |
| 192 } | 192 } |
| 193 | 193 |
| 194 CXFA_Validate CXFA_WidgetData::GetValidate(FX_BOOL bModified) { | 194 CXFA_Validate CXFA_WidgetData::GetValidate(FX_BOOL bModified) { |
| 195 return CXFA_Validate( | 195 return CXFA_Validate( |
| 196 m_pNode->GetProperty(0, XFA_ELEMENT_Validate, bModified)); | 196 m_pNode->GetProperty(0, XFA_Element::Validate, bModified)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 CXFA_Bind CXFA_WidgetData::GetBind(FX_BOOL bModified) { | 199 CXFA_Bind CXFA_WidgetData::GetBind(FX_BOOL bModified) { |
| 200 return CXFA_Bind(m_pNode->GetProperty(0, XFA_ELEMENT_Bind, bModified)); | 200 return CXFA_Bind(m_pNode->GetProperty(0, XFA_Element::Bind, bModified)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 CXFA_Assist CXFA_WidgetData::GetAssist(FX_BOOL bModified) { | 203 CXFA_Assist CXFA_WidgetData::GetAssist(FX_BOOL bModified) { |
| 204 return CXFA_Assist(m_pNode->GetProperty(0, XFA_ELEMENT_Assist, bModified)); | 204 return CXFA_Assist(m_pNode->GetProperty(0, XFA_Element::Assist, bModified)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 FX_BOOL CXFA_WidgetData::GetWidth(FX_FLOAT& fWidth) { | 207 FX_BOOL CXFA_WidgetData::GetWidth(FX_FLOAT& fWidth) { |
| 208 return TryMeasure(XFA_ATTRIBUTE_W, fWidth); | 208 return TryMeasure(XFA_ATTRIBUTE_W, fWidth); |
| 209 } | 209 } |
| 210 | 210 |
| 211 FX_BOOL CXFA_WidgetData::GetHeight(FX_FLOAT& fHeight) { | 211 FX_BOOL CXFA_WidgetData::GetHeight(FX_FLOAT& fHeight) { |
| 212 return TryMeasure(XFA_ATTRIBUTE_H, fHeight); | 212 return TryMeasure(XFA_ATTRIBUTE_H, fHeight); |
| 213 } | 213 } |
| 214 | 214 |
| 215 FX_BOOL CXFA_WidgetData::GetMinWidth(FX_FLOAT& fMinWidth) { | 215 FX_BOOL CXFA_WidgetData::GetMinWidth(FX_FLOAT& fMinWidth) { |
| 216 return TryMeasure(XFA_ATTRIBUTE_MinW, fMinWidth); | 216 return TryMeasure(XFA_ATTRIBUTE_MinW, fMinWidth); |
| 217 } | 217 } |
| 218 | 218 |
| 219 FX_BOOL CXFA_WidgetData::GetMinHeight(FX_FLOAT& fMinHeight) { | 219 FX_BOOL CXFA_WidgetData::GetMinHeight(FX_FLOAT& fMinHeight) { |
| 220 return TryMeasure(XFA_ATTRIBUTE_MinH, fMinHeight); | 220 return TryMeasure(XFA_ATTRIBUTE_MinH, fMinHeight); |
| 221 } | 221 } |
| 222 | 222 |
| 223 FX_BOOL CXFA_WidgetData::GetMaxWidth(FX_FLOAT& fMaxWidth) { | 223 FX_BOOL CXFA_WidgetData::GetMaxWidth(FX_FLOAT& fMaxWidth) { |
| 224 return TryMeasure(XFA_ATTRIBUTE_MaxW, fMaxWidth); | 224 return TryMeasure(XFA_ATTRIBUTE_MaxW, fMaxWidth); |
| 225 } | 225 } |
| 226 | 226 |
| 227 FX_BOOL CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) { | 227 FX_BOOL CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) { |
| 228 return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight); | 228 return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight); |
| 229 } | 229 } |
| 230 | 230 |
| 231 CXFA_Border CXFA_WidgetData::GetUIBorder(FX_BOOL bModified) { | 231 CXFA_Border CXFA_WidgetData::GetUIBorder(FX_BOOL bModified) { |
| 232 CXFA_Node* pUIChild = GetUIChild(); | 232 CXFA_Node* pUIChild = GetUIChild(); |
| 233 return CXFA_Border( | 233 return CXFA_Border( |
| 234 pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Border, bModified) | 234 pUIChild ? pUIChild->GetProperty(0, XFA_Element::Border, bModified) |
| 235 : nullptr); | 235 : nullptr); |
| 236 } | 236 } |
| 237 | 237 |
| 238 CXFA_Margin CXFA_WidgetData::GetUIMargin(FX_BOOL bModified) { | 238 CXFA_Margin CXFA_WidgetData::GetUIMargin(FX_BOOL bModified) { |
| 239 CXFA_Node* pUIChild = GetUIChild(); | 239 CXFA_Node* pUIChild = GetUIChild(); |
| 240 return CXFA_Margin( | 240 return CXFA_Margin( |
| 241 pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Margin, bModified) | 241 pUIChild ? pUIChild->GetProperty(0, XFA_Element::Margin, bModified) |
| 242 : nullptr); | 242 : nullptr); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void CXFA_WidgetData::GetUIMargin(CFX_RectF& rtUIMargin) { | 245 void CXFA_WidgetData::GetUIMargin(CFX_RectF& rtUIMargin) { |
| 246 rtUIMargin.Reset(); | 246 rtUIMargin.Reset(); |
| 247 CXFA_Margin mgUI = GetUIMargin(); | 247 CXFA_Margin mgUI = GetUIMargin(); |
| 248 if (!mgUI) | 248 if (!mgUI) |
| 249 return; | 249 return; |
| 250 | 250 |
| 251 CXFA_Border border = GetUIBorder(); | 251 CXFA_Border border = GetUIBorder(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 rtUIMargin.Set(fLeftInset, fTopInset, fRightInset, fBottomInset); | 277 rtUIMargin.Set(fLeftInset, fTopInset, fRightInset, fBottomInset); |
| 278 } | 278 } |
| 279 | 279 |
| 280 int32_t CXFA_WidgetData::GetButtonHighlight() { | 280 int32_t CXFA_WidgetData::GetButtonHighlight() { |
| 281 CXFA_Node* pUIChild = GetUIChild(); | 281 CXFA_Node* pUIChild = GetUIChild(); |
| 282 if (pUIChild) | 282 if (pUIChild) |
| 283 return pUIChild->GetEnum(XFA_ATTRIBUTE_Highlight); | 283 return pUIChild->GetEnum(XFA_ATTRIBUTE_Highlight); |
| 284 return XFA_GetAttributeDefaultValue_Enum( | 284 return XFA_GetAttributeDefaultValue_Enum( |
| 285 XFA_ELEMENT_Button, XFA_ATTRIBUTE_Highlight, XFA_XDPPACKET_Form); | 285 XFA_Element::Button, XFA_ATTRIBUTE_Highlight, XFA_XDPPACKET_Form); |
| 286 } | 286 } |
| 287 | 287 |
| 288 FX_BOOL CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, | 288 FX_BOOL CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, |
| 289 FX_BOOL& bRichText) { | 289 FX_BOOL& bRichText) { |
| 290 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) { | 290 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { |
| 291 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); | 291 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 292 while (pText) { | 292 while (pText) { |
| 293 CFX_WideStringC wsName; | 293 CFX_WideStringC wsName; |
| 294 pText->TryCData(XFA_ATTRIBUTE_Name, wsName); | 294 pText->TryCData(XFA_ATTRIBUTE_Name, wsName); |
| 295 if (wsName == FX_WSTRC(L"rollover")) { | 295 if (wsName == FX_WSTRC(L"rollover")) { |
| 296 pText->TryContent(wsRollover); | 296 pText->TryContent(wsRollover); |
| 297 bRichText = pText->GetClassID() == XFA_ELEMENT_ExData; | 297 bRichText = pText->GetClassID() == XFA_Element::ExData; |
| 298 return !wsRollover.IsEmpty(); | 298 return !wsRollover.IsEmpty(); |
| 299 } | 299 } |
| 300 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); | 300 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 return FALSE; | 303 return FALSE; |
| 304 } | 304 } |
| 305 | 305 |
| 306 FX_BOOL CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown, | 306 FX_BOOL CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown, |
| 307 FX_BOOL& bRichText) { | 307 FX_BOOL& bRichText) { |
| 308 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) { | 308 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { |
| 309 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); | 309 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 310 while (pText) { | 310 while (pText) { |
| 311 CFX_WideStringC wsName; | 311 CFX_WideStringC wsName; |
| 312 pText->TryCData(XFA_ATTRIBUTE_Name, wsName); | 312 pText->TryCData(XFA_ATTRIBUTE_Name, wsName); |
| 313 if (wsName == FX_WSTRC(L"down")) { | 313 if (wsName == FX_WSTRC(L"down")) { |
| 314 pText->TryContent(wsDown); | 314 pText->TryContent(wsDown); |
| 315 bRichText = pText->GetClassID() == XFA_ELEMENT_ExData; | 315 bRichText = pText->GetClassID() == XFA_Element::ExData; |
| 316 return !wsDown.IsEmpty(); | 316 return !wsDown.IsEmpty(); |
| 317 } | 317 } |
| 318 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); | 318 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 return FALSE; | 321 return FALSE; |
| 322 } | 322 } |
| 323 | 323 |
| 324 int32_t CXFA_WidgetData::GetCheckButtonShape() { | 324 int32_t CXFA_WidgetData::GetCheckButtonShape() { |
| 325 CXFA_Node* pUIChild = GetUIChild(); | 325 CXFA_Node* pUIChild = GetUIChild(); |
| 326 if (pUIChild) | 326 if (pUIChild) |
| 327 return pUIChild->GetEnum(XFA_ATTRIBUTE_Shape); | 327 return pUIChild->GetEnum(XFA_ATTRIBUTE_Shape); |
| 328 return XFA_GetAttributeDefaultValue_Enum( | 328 return XFA_GetAttributeDefaultValue_Enum( |
| 329 XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Shape, XFA_XDPPACKET_Form); | 329 XFA_Element::CheckButton, XFA_ATTRIBUTE_Shape, XFA_XDPPACKET_Form); |
| 330 } | 330 } |
| 331 | 331 |
| 332 int32_t CXFA_WidgetData::GetCheckButtonMark() { | 332 int32_t CXFA_WidgetData::GetCheckButtonMark() { |
| 333 CXFA_Node* pUIChild = GetUIChild(); | 333 CXFA_Node* pUIChild = GetUIChild(); |
| 334 if (pUIChild) | 334 if (pUIChild) |
| 335 return pUIChild->GetEnum(XFA_ATTRIBUTE_Mark); | 335 return pUIChild->GetEnum(XFA_ATTRIBUTE_Mark); |
| 336 return XFA_GetAttributeDefaultValue_Enum( | 336 return XFA_GetAttributeDefaultValue_Enum( |
| 337 XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Mark, XFA_XDPPACKET_Form); | 337 XFA_Element::CheckButton, XFA_ATTRIBUTE_Mark, XFA_XDPPACKET_Form); |
| 338 } | 338 } |
| 339 | 339 |
| 340 FX_BOOL CXFA_WidgetData::IsRadioButton() { | 340 FX_BOOL CXFA_WidgetData::IsRadioButton() { |
| 341 if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent)) | 341 if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent)) |
| 342 return pParent->GetClassID() == XFA_ELEMENT_ExclGroup; | 342 return pParent->GetClassID() == XFA_Element::ExclGroup; |
| 343 return FALSE; | 343 return FALSE; |
| 344 } | 344 } |
| 345 | 345 |
| 346 FX_FLOAT CXFA_WidgetData::GetCheckButtonSize() { | 346 FX_FLOAT CXFA_WidgetData::GetCheckButtonSize() { |
| 347 CXFA_Node* pUIChild = GetUIChild(); | 347 CXFA_Node* pUIChild = GetUIChild(); |
| 348 if (pUIChild) | 348 if (pUIChild) |
| 349 return pUIChild->GetMeasure(XFA_ATTRIBUTE_Size).ToUnit(XFA_UNIT_Pt); | 349 return pUIChild->GetMeasure(XFA_ATTRIBUTE_Size).ToUnit(XFA_UNIT_Pt); |
| 350 return XFA_GetAttributeDefaultValue_Measure( | 350 return XFA_GetAttributeDefaultValue_Measure( |
| 351 XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_Size, XFA_XDPPACKET_Form) | 351 XFA_Element::CheckButton, XFA_ATTRIBUTE_Size, XFA_XDPPACKET_Form) |
| 352 .ToUnit(XFA_UNIT_Pt); | 352 .ToUnit(XFA_UNIT_Pt); |
| 353 } | 353 } |
| 354 | 354 |
| 355 FX_BOOL CXFA_WidgetData::IsAllowNeutral() { | 355 FX_BOOL CXFA_WidgetData::IsAllowNeutral() { |
| 356 CXFA_Node* pUIChild = GetUIChild(); | 356 CXFA_Node* pUIChild = GetUIChild(); |
| 357 if (pUIChild) | 357 if (pUIChild) |
| 358 return pUIChild->GetBoolean(XFA_ATTRIBUTE_AllowNeutral); | 358 return pUIChild->GetBoolean(XFA_ATTRIBUTE_AllowNeutral); |
| 359 return XFA_GetAttributeDefaultValue_Boolean( | 359 return XFA_GetAttributeDefaultValue_Boolean( |
| 360 XFA_ELEMENT_CheckButton, XFA_ATTRIBUTE_AllowNeutral, XFA_XDPPACKET_Form); | 360 XFA_Element::CheckButton, XFA_ATTRIBUTE_AllowNeutral, XFA_XDPPACKET_Form); |
| 361 } | 361 } |
| 362 | 362 |
| 363 XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { | 363 XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { |
| 364 CFX_WideString wsValue = GetRawValue(); | 364 CFX_WideString wsValue = GetRawValue(); |
| 365 if (wsValue.IsEmpty()) | 365 if (wsValue.IsEmpty()) |
| 366 return XFA_CHECKSTATE_Off; | 366 return XFA_CHECKSTATE_Off; |
| 367 | 367 |
| 368 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) { | 368 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { |
| 369 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); | 369 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 370 int32_t i = 0; | 370 int32_t i = 0; |
| 371 while (pText) { | 371 while (pText) { |
| 372 CFX_WideString wsContent; | 372 CFX_WideString wsContent; |
| 373 if (pText->TryContent(wsContent) && (wsContent == wsValue)) | 373 if (pText->TryContent(wsContent) && (wsContent == wsValue)) |
| 374 return (XFA_CHECKSTATE)i; | 374 return (XFA_CHECKSTATE)i; |
| 375 | 375 |
| 376 i++; | 376 i++; |
| 377 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); | 377 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 return XFA_CHECKSTATE_Off; | 380 return XFA_CHECKSTATE_Off; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { | 383 void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { |
| 384 CXFA_WidgetData exclGroup(GetExclGroupNode()); | 384 CXFA_WidgetData exclGroup(GetExclGroupNode()); |
| 385 if (exclGroup) { | 385 if (exclGroup) { |
| 386 CFX_WideString wsValue; | 386 CFX_WideString wsValue; |
| 387 if (eCheckState != XFA_CHECKSTATE_Off) { | 387 if (eCheckState != XFA_CHECKSTATE_Off) { |
| 388 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) { | 388 if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { |
| 389 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); | 389 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 390 if (pText) | 390 if (pText) |
| 391 pText->TryContent(wsValue); | 391 pText->TryContent(wsValue); |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 CXFA_Node* pChild = | 394 CXFA_Node* pChild = |
| 395 exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); | 395 exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 396 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 396 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 397 if (pChild->GetClassID() != XFA_ELEMENT_Field) | 397 if (pChild->GetClassID() != XFA_Element::Field) |
| 398 continue; | 398 continue; |
| 399 | 399 |
| 400 CXFA_Node* pItem = pChild->GetChild(0, XFA_ELEMENT_Items); | 400 CXFA_Node* pItem = pChild->GetChild(0, XFA_Element::Items); |
| 401 if (!pItem) | 401 if (!pItem) |
| 402 continue; | 402 continue; |
| 403 | 403 |
| 404 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); | 404 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 405 if (!pItemchild) | 405 if (!pItemchild) |
| 406 continue; | 406 continue; |
| 407 | 407 |
| 408 CFX_WideString text = pItemchild->GetContent(); | 408 CFX_WideString text = pItemchild->GetContent(); |
| 409 CFX_WideString wsChildValue = text; | 409 CFX_WideString wsChildValue = text; |
| 410 if (wsValue != text) { | 410 if (wsValue != text) { |
| 411 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); | 411 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 412 if (pItemchild) | 412 if (pItemchild) |
| 413 wsChildValue = pItemchild->GetContent(); | 413 wsChildValue = pItemchild->GetContent(); |
| 414 else | 414 else |
| 415 wsChildValue.clear(); | 415 wsChildValue.clear(); |
| 416 } | 416 } |
| 417 CXFA_WidgetData ch(pChild); | 417 CXFA_WidgetData ch(pChild); |
| 418 ch.SyncValue(wsChildValue, bNotify); | 418 ch.SyncValue(wsChildValue, bNotify); |
| 419 } | 419 } |
| 420 exclGroup.SyncValue(wsValue, bNotify); | 420 exclGroup.SyncValue(wsValue, bNotify); |
| 421 } else { | 421 } else { |
| 422 CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items); | 422 CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items); |
| 423 if (!pItems) | 423 if (!pItems) |
| 424 return; | 424 return; |
| 425 | 425 |
| 426 int32_t i = -1; | 426 int32_t i = -1; |
| 427 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); | 427 CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 428 CFX_WideString wsContent; | 428 CFX_WideString wsContent; |
| 429 while (pText) { | 429 while (pText) { |
| 430 i++; | 430 i++; |
| 431 if (i == eCheckState) { | 431 if (i == eCheckState) { |
| 432 pText->TryContent(wsContent); | 432 pText->TryContent(wsContent); |
| 433 break; | 433 break; |
| 434 } | 434 } |
| 435 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); | 435 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 436 } | 436 } |
| 437 SyncValue(wsContent, bNotify); | 437 SyncValue(wsContent, bNotify); |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 | 440 |
| 441 CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { | 441 CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { |
| 442 CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent)); | 442 CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 443 if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) | 443 if (!pExcl || pExcl->GetClassID() != XFA_Element::ExclGroup) |
| 444 return NULL; | 444 return NULL; |
| 445 return pExcl; | 445 return pExcl; |
| 446 } | 446 } |
| 447 | 447 |
| 448 CXFA_Node* CXFA_WidgetData::GetSelectedMember() { | 448 CXFA_Node* CXFA_WidgetData::GetSelectedMember() { |
| 449 CXFA_Node* pSelectedMember = NULL; | 449 CXFA_Node* pSelectedMember = NULL; |
| 450 CFX_WideString wsState = GetRawValue(); | 450 CFX_WideString wsState = GetRawValue(); |
| 451 if (wsState.IsEmpty()) | 451 if (wsState.IsEmpty()) |
| 452 return pSelectedMember; | 452 return pSelectedMember; |
| 453 | 453 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 476 return nullptr; | 476 return nullptr; |
| 477 } | 477 } |
| 478 | 478 |
| 479 void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, | 479 void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, |
| 480 bool bNotify, | 480 bool bNotify, |
| 481 FX_BOOL bScriptModify, | 481 FX_BOOL bScriptModify, |
| 482 FX_BOOL bSyncData) { | 482 FX_BOOL bSyncData) { |
| 483 CFX_WideString wsExclGroup; | 483 CFX_WideString wsExclGroup; |
| 484 for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 484 for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
| 485 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 485 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 486 if (pNode->GetClassID() != XFA_ELEMENT_Field) | 486 if (pNode->GetClassID() != XFA_Element::Field) |
| 487 continue; | 487 continue; |
| 488 | 488 |
| 489 CXFA_Node* pItem = pNode->GetChild(0, XFA_ELEMENT_Items); | 489 CXFA_Node* pItem = pNode->GetChild(0, XFA_Element::Items); |
| 490 if (!pItem) | 490 if (!pItem) |
| 491 continue; | 491 continue; |
| 492 | 492 |
| 493 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); | 493 CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 494 if (!pItemchild) | 494 if (!pItemchild) |
| 495 continue; | 495 continue; |
| 496 | 496 |
| 497 CFX_WideString wsChildValue = pItemchild->GetContent(); | 497 CFX_WideString wsChildValue = pItemchild->GetContent(); |
| 498 if (wsValue != wsChildValue) { | 498 if (wsValue != wsChildValue) { |
| 499 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); | 499 pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() { | 516 CXFA_Node* CXFA_WidgetData::GetExclGroupFirstMember() { |
| 517 CXFA_Node* pExcl = GetNode(); | 517 CXFA_Node* pExcl = GetNode(); |
| 518 if (!pExcl) | 518 if (!pExcl) |
| 519 return NULL; | 519 return NULL; |
| 520 | 520 |
| 521 CXFA_Node* pNode = pExcl->GetNodeItem(XFA_NODEITEM_FirstChild); | 521 CXFA_Node* pNode = pExcl->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 522 while (pNode) { | 522 while (pNode) { |
| 523 if (pNode->GetClassID() == XFA_ELEMENT_Field) | 523 if (pNode->GetClassID() == XFA_Element::Field) |
| 524 return pNode; | 524 return pNode; |
| 525 | 525 |
| 526 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 526 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 527 } | 527 } |
| 528 return NULL; | 528 return NULL; |
| 529 } | 529 } |
| 530 CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { | 530 CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { |
| 531 if (!pNode) | 531 if (!pNode) |
| 532 return NULL; | 532 return NULL; |
| 533 | 533 |
| 534 CXFA_Node* pNodeField = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 534 CXFA_Node* pNodeField = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 535 while (pNodeField) { | 535 while (pNodeField) { |
| 536 if (pNodeField->GetClassID() == XFA_ELEMENT_Field) | 536 if (pNodeField->GetClassID() == XFA_Element::Field) |
| 537 return pNodeField; | 537 return pNodeField; |
| 538 | 538 |
| 539 pNodeField = pNodeField->GetNodeItem(XFA_NODEITEM_NextSibling); | 539 pNodeField = pNodeField->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 540 } | 540 } |
| 541 return NULL; | 541 return NULL; |
| 542 } | 542 } |
| 543 | 543 |
| 544 int32_t CXFA_WidgetData::GetChoiceListCommitOn() { | 544 int32_t CXFA_WidgetData::GetChoiceListCommitOn() { |
| 545 CXFA_Node* pUIChild = GetUIChild(); | 545 CXFA_Node* pUIChild = GetUIChild(); |
| 546 if (pUIChild) | 546 if (pUIChild) |
| 547 return pUIChild->GetEnum(XFA_ATTRIBUTE_CommitOn); | 547 return pUIChild->GetEnum(XFA_ATTRIBUTE_CommitOn); |
| 548 return XFA_GetAttributeDefaultValue_Enum( | 548 return XFA_GetAttributeDefaultValue_Enum( |
| 549 XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_CommitOn, XFA_XDPPACKET_Form); | 549 XFA_Element::ChoiceList, XFA_ATTRIBUTE_CommitOn, XFA_XDPPACKET_Form); |
| 550 } | 550 } |
| 551 | 551 |
| 552 FX_BOOL CXFA_WidgetData::IsChoiceListAllowTextEntry() { | 552 FX_BOOL CXFA_WidgetData::IsChoiceListAllowTextEntry() { |
| 553 CXFA_Node* pUIChild = GetUIChild(); | 553 CXFA_Node* pUIChild = GetUIChild(); |
| 554 if (pUIChild) | 554 if (pUIChild) |
| 555 return pUIChild->GetBoolean(XFA_ATTRIBUTE_TextEntry); | 555 return pUIChild->GetBoolean(XFA_ATTRIBUTE_TextEntry); |
| 556 return XFA_GetAttributeDefaultValue_Boolean( | 556 return XFA_GetAttributeDefaultValue_Boolean( |
| 557 XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_TextEntry, XFA_XDPPACKET_Form); | 557 XFA_Element::ChoiceList, XFA_ATTRIBUTE_TextEntry, XFA_XDPPACKET_Form); |
| 558 } | 558 } |
| 559 | 559 |
| 560 int32_t CXFA_WidgetData::GetChoiceListOpen() { | 560 int32_t CXFA_WidgetData::GetChoiceListOpen() { |
| 561 CXFA_Node* pUIChild = GetUIChild(); | 561 CXFA_Node* pUIChild = GetUIChild(); |
| 562 if (pUIChild) | 562 if (pUIChild) |
| 563 return pUIChild->GetEnum(XFA_ATTRIBUTE_Open); | 563 return pUIChild->GetEnum(XFA_ATTRIBUTE_Open); |
| 564 return XFA_GetAttributeDefaultValue_Enum( | 564 return XFA_GetAttributeDefaultValue_Enum( |
| 565 XFA_ELEMENT_ChoiceList, XFA_ATTRIBUTE_Open, XFA_XDPPACKET_Form); | 565 XFA_Element::ChoiceList, XFA_ATTRIBUTE_Open, XFA_XDPPACKET_Form); |
| 566 } | 566 } |
| 567 | 567 |
| 568 FX_BOOL CXFA_WidgetData::IsListBox() { | 568 FX_BOOL CXFA_WidgetData::IsListBox() { |
| 569 int32_t iOpenMode = GetChoiceListOpen(); | 569 int32_t iOpenMode = GetChoiceListOpen(); |
| 570 return (iOpenMode == XFA_ATTRIBUTEENUM_Always || | 570 return (iOpenMode == XFA_ATTRIBUTEENUM_Always || |
| 571 iOpenMode == XFA_ATTRIBUTEENUM_MultiSelect); | 571 iOpenMode == XFA_ATTRIBUTEENUM_MultiSelect); |
| 572 } | 572 } |
| 573 | 573 |
| 574 int32_t CXFA_WidgetData::CountChoiceListItems(FX_BOOL bSaveValue) { | 574 int32_t CXFA_WidgetData::CountChoiceListItems(FX_BOOL bSaveValue) { |
| 575 CXFA_NodeArray pItems; | 575 CXFA_NodeArray pItems; |
| 576 CXFA_Node* pItem = NULL; | 576 CXFA_Node* pItem = NULL; |
| 577 int32_t iCount = 0; | 577 int32_t iCount = 0; |
| 578 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 578 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 579 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 579 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 580 if (pNode->GetClassID() != XFA_ELEMENT_Items) | 580 if (pNode->GetClassID() != XFA_Element::Items) |
| 581 continue; | 581 continue; |
| 582 | 582 |
| 583 iCount++; | 583 iCount++; |
| 584 pItems.Add(pNode); | 584 pItems.Add(pNode); |
| 585 if (iCount == 2) | 585 if (iCount == 2) |
| 586 break; | 586 break; |
| 587 } | 587 } |
| 588 if (iCount == 0) | 588 if (iCount == 0) |
| 589 return 0; | 589 return 0; |
| 590 | 590 |
| 591 pItem = pItems[0]; | 591 pItem = pItems[0]; |
| 592 if (iCount > 1) { | 592 if (iCount > 1) { |
| 593 FX_BOOL bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save); | 593 FX_BOOL bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save); |
| 594 FX_BOOL bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save); | 594 FX_BOOL bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save); |
| 595 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) | 595 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) |
| 596 pItem = pItems[1]; | 596 pItem = pItems[1]; |
| 597 } | 597 } |
| 598 pItems.RemoveAll(); | 598 pItems.RemoveAll(); |
| 599 return pItem->CountChildren(XFA_ELEMENT_UNKNOWN); | 599 return pItem->CountChildren(XFA_Element::Unknown); |
| 600 } | 600 } |
| 601 | 601 |
| 602 FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, | 602 FX_BOOL CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, |
| 603 int32_t nIndex, | 603 int32_t nIndex, |
| 604 FX_BOOL bSaveValue) { | 604 FX_BOOL bSaveValue) { |
| 605 wsText.clear(); | 605 wsText.clear(); |
| 606 CXFA_NodeArray pItemsArray; | 606 CXFA_NodeArray pItemsArray; |
| 607 CXFA_Node* pItems = NULL; | 607 CXFA_Node* pItems = nullptr; |
| 608 int32_t iCount = 0; | 608 int32_t iCount = 0; |
| 609 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 609 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 610 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 610 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 611 if (pNode->GetClassID() != XFA_ELEMENT_Items) | 611 if (pNode->GetClassID() != XFA_Element::Items) |
| 612 continue; | 612 continue; |
| 613 | 613 |
| 614 iCount++; | 614 iCount++; |
| 615 pItemsArray.Add(pNode); | 615 pItemsArray.Add(pNode); |
| 616 if (iCount == 2) | 616 if (iCount == 2) |
| 617 break; | 617 break; |
| 618 } | 618 } |
| 619 if (iCount == 0) | 619 if (iCount == 0) |
| 620 return FALSE; | 620 return FALSE; |
| 621 | 621 |
| 622 pItems = pItemsArray[0]; | 622 pItems = pItemsArray[0]; |
| 623 if (iCount > 1) { | 623 if (iCount > 1) { |
| 624 FX_BOOL bItemOneHasSave = pItemsArray[0]->GetBoolean(XFA_ATTRIBUTE_Save); | 624 FX_BOOL bItemOneHasSave = pItemsArray[0]->GetBoolean(XFA_ATTRIBUTE_Save); |
| 625 FX_BOOL bItemTwoHasSave = pItemsArray[1]->GetBoolean(XFA_ATTRIBUTE_Save); | 625 FX_BOOL bItemTwoHasSave = pItemsArray[1]->GetBoolean(XFA_ATTRIBUTE_Save); |
| 626 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) | 626 if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) |
| 627 pItems = pItemsArray[1]; | 627 pItems = pItemsArray[1]; |
| 628 } | 628 } |
| 629 if (pItems) { | 629 if (pItems) { |
| 630 CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_ELEMENT_UNKNOWN); | 630 CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_Element::Unknown); |
| 631 if (pItem) { | 631 if (pItem) { |
| 632 pItem->TryContent(wsText); | 632 pItem->TryContent(wsText); |
| 633 return TRUE; | 633 return TRUE; |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 return FALSE; | 636 return FALSE; |
| 637 } | 637 } |
| 638 | 638 |
| 639 void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray, | 639 void CXFA_WidgetData::GetChoiceListItems(CFX_WideStringArray& wsTextArray, |
| 640 FX_BOOL bSaveValue) { | 640 FX_BOOL bSaveValue) { |
| 641 CXFA_NodeArray pItems; | 641 CXFA_NodeArray pItems; |
| 642 CXFA_Node* pItem = NULL; | 642 CXFA_Node* pItem = NULL; |
| 643 int32_t iCount = 0; | 643 int32_t iCount = 0; |
| 644 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 644 CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 645 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 645 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 646 if (pNode->GetClassID() != XFA_ELEMENT_Items) | 646 if (pNode->GetClassID() != XFA_Element::Items) |
| 647 continue; | 647 continue; |
| 648 | 648 |
| 649 iCount++; | 649 iCount++; |
| 650 pItems.Add(pNode); | 650 pItems.Add(pNode); |
| 651 if (iCount == 2) | 651 if (iCount == 2) |
| 652 break; | 652 break; |
| 653 } | 653 } |
| 654 if (iCount == 0) | 654 if (iCount == 0) |
| 655 return; | 655 return; |
| 656 | 656 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 FX_BOOL bNotify) { | 868 FX_BOOL bNotify) { |
| 869 CFX_WideString wsNewValue(wsValue); | 869 CFX_WideString wsNewValue(wsValue); |
| 870 if (wsNewValue.IsEmpty()) | 870 if (wsNewValue.IsEmpty()) |
| 871 wsNewValue = wsLabel; | 871 wsNewValue = wsLabel; |
| 872 | 872 |
| 873 CXFA_NodeArray listitems; | 873 CXFA_NodeArray listitems; |
| 874 int32_t iCount = 0; | 874 int32_t iCount = 0; |
| 875 CXFA_Node* pItemNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 875 CXFA_Node* pItemNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 876 for (; pItemNode; | 876 for (; pItemNode; |
| 877 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 877 pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 878 if (pItemNode->GetClassID() != XFA_ELEMENT_Items) | 878 if (pItemNode->GetClassID() != XFA_Element::Items) |
| 879 continue; | 879 continue; |
| 880 | 880 |
| 881 listitems.Add(pItemNode); | 881 listitems.Add(pItemNode); |
| 882 iCount++; | 882 iCount++; |
| 883 } | 883 } |
| 884 if (iCount < 1) { | 884 if (iCount < 1) { |
| 885 CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); | 885 CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_Element::Items); |
| 886 m_pNode->InsertChild(-1, pItems); | 886 m_pNode->InsertChild(-1, pItems); |
| 887 InsertListTextItem(pItems, wsLabel, nIndex); | 887 InsertListTextItem(pItems, wsLabel, nIndex); |
| 888 CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); | 888 CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_Element::Items); |
| 889 m_pNode->InsertChild(-1, pSaveItems); | 889 m_pNode->InsertChild(-1, pSaveItems); |
| 890 pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); | 890 pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); |
| 891 InsertListTextItem(pSaveItems, wsNewValue, nIndex); | 891 InsertListTextItem(pSaveItems, wsNewValue, nIndex); |
| 892 } else if (iCount > 1) { | 892 } else if (iCount > 1) { |
| 893 for (int32_t i = 0; i < 2; i++) { | 893 for (int32_t i = 0; i < 2; i++) { |
| 894 CXFA_Node* pNode = listitems[i]; | 894 CXFA_Node* pNode = listitems[i]; |
| 895 FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save); | 895 FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save); |
| 896 if (bHasSave) | 896 if (bHasSave) |
| 897 InsertListTextItem(pNode, wsNewValue, nIndex); | 897 InsertListTextItem(pNode, wsNewValue, nIndex); |
| 898 else | 898 else |
| 899 InsertListTextItem(pNode, wsLabel, nIndex); | 899 InsertListTextItem(pNode, wsLabel, nIndex); |
| 900 } | 900 } |
| 901 } else { | 901 } else { |
| 902 CXFA_Node* pNode = listitems[0]; | 902 CXFA_Node* pNode = listitems[0]; |
| 903 pNode->SetBoolean(XFA_ATTRIBUTE_Save, FALSE); | 903 pNode->SetBoolean(XFA_ATTRIBUTE_Save, FALSE); |
| 904 pNode->SetEnum(XFA_ATTRIBUTE_Presence, XFA_ATTRIBUTEENUM_Visible); | 904 pNode->SetEnum(XFA_ATTRIBUTE_Presence, XFA_ATTRIBUTEENUM_Visible); |
| 905 CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); | 905 CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_Element::Items); |
| 906 m_pNode->InsertChild(-1, pSaveItems); | 906 m_pNode->InsertChild(-1, pSaveItems); |
| 907 pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); | 907 pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); |
| 908 pSaveItems->SetEnum(XFA_ATTRIBUTE_Presence, XFA_ATTRIBUTEENUM_Hidden); | 908 pSaveItems->SetEnum(XFA_ATTRIBUTE_Presence, XFA_ATTRIBUTEENUM_Hidden); |
| 909 listitems.RemoveAll(); | 909 listitems.RemoveAll(); |
| 910 CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 910 CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 911 int32_t i = 0; | 911 int32_t i = 0; |
| 912 while (pListNode) { | 912 while (pListNode) { |
| 913 CFX_WideString wsOldValue; | 913 CFX_WideString wsOldValue; |
| 914 pListNode->TryContent(wsOldValue); | 914 pListNode->TryContent(wsOldValue); |
| 915 InsertListTextItem(pSaveItems, wsOldValue, i); | 915 InsertListTextItem(pSaveItems, wsOldValue, i); |
| 916 i++; | 916 i++; |
| 917 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 917 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 918 } | 918 } |
| 919 InsertListTextItem(pNode, wsLabel, nIndex); | 919 InsertListTextItem(pNode, wsLabel, nIndex); |
| 920 InsertListTextItem(pSaveItems, wsNewValue, nIndex); | 920 InsertListTextItem(pSaveItems, wsNewValue, nIndex); |
| 921 } | 921 } |
| 922 if (!bNotify) | 922 if (!bNotify) |
| 923 return; | 923 return; |
| 924 | 924 |
| 925 m_pNode->GetDocument()->GetNotify()->OnWidgetListItemAdded( | 925 m_pNode->GetDocument()->GetNotify()->OnWidgetListItemAdded( |
| 926 this, wsLabel.c_str(), wsValue.c_str(), nIndex); | 926 this, wsLabel.c_str(), wsValue.c_str(), nIndex); |
| 927 } | 927 } |
| 928 | 928 |
| 929 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, | 929 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, |
| 930 CFX_WideString& wsLabel) { | 930 CFX_WideString& wsLabel) { |
| 931 int32_t iCount = 0; | 931 int32_t iCount = 0; |
| 932 CXFA_NodeArray listitems; | 932 CXFA_NodeArray listitems; |
| 933 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 933 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 934 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 934 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 935 if (pItems->GetClassID() != XFA_ELEMENT_Items) | 935 if (pItems->GetClassID() != XFA_Element::Items) |
| 936 continue; | 936 continue; |
| 937 | 937 |
| 938 iCount++; | 938 iCount++; |
| 939 listitems.Add(pItems); | 939 listitems.Add(pItems); |
| 940 } | 940 } |
| 941 if (iCount <= 1) { | 941 if (iCount <= 1) { |
| 942 wsLabel = wsValue; | 942 wsLabel = wsValue; |
| 943 } else { | 943 } else { |
| 944 CXFA_Node* pLabelItems = listitems[0]; | 944 CXFA_Node* pLabelItems = listitems[0]; |
| 945 FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); | 945 FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 959 pChildItem->TryContent(wsContent); | 959 pChildItem->TryContent(wsContent); |
| 960 if (wsContent == wsValue) { | 960 if (wsContent == wsValue) { |
| 961 iSearch = iCount; | 961 iSearch = iCount; |
| 962 break; | 962 break; |
| 963 } | 963 } |
| 964 iCount++; | 964 iCount++; |
| 965 } | 965 } |
| 966 if (iSearch < 0) | 966 if (iSearch < 0) |
| 967 return; | 967 return; |
| 968 if (CXFA_Node* pText = | 968 if (CXFA_Node* pText = |
| 969 pLabelItems->GetChild(iSearch, XFA_ELEMENT_UNKNOWN)) { | 969 pLabelItems->GetChild(iSearch, XFA_Element::Unknown)) { |
| 970 pText->TryContent(wsLabel); | 970 pText->TryContent(wsLabel); |
| 971 } | 971 } |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 | 974 |
| 975 void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, | 975 void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, |
| 976 CFX_WideString& wsValue) { | 976 CFX_WideString& wsValue) { |
| 977 int32_t iCount = 0; | 977 int32_t iCount = 0; |
| 978 CXFA_NodeArray listitems; | 978 CXFA_NodeArray listitems; |
| 979 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 979 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 980 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 980 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 981 if (pItems->GetClassID() != XFA_ELEMENT_Items) | 981 if (pItems->GetClassID() != XFA_Element::Items) |
| 982 continue; | 982 continue; |
| 983 | 983 |
| 984 iCount++; | 984 iCount++; |
| 985 listitems.Add(pItems); | 985 listitems.Add(pItems); |
| 986 } | 986 } |
| 987 if (iCount <= 1) { | 987 if (iCount <= 1) { |
| 988 wsValue = wsLabel; | 988 wsValue = wsLabel; |
| 989 } else { | 989 } else { |
| 990 CXFA_Node* pLabelItems = listitems[0]; | 990 CXFA_Node* pLabelItems = listitems[0]; |
| 991 FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); | 991 FX_BOOL bSave = pLabelItems->GetBoolean(XFA_ATTRIBUTE_Save); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1004 pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1004 pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1005 pChildItem->TryContent(wsContent); | 1005 pChildItem->TryContent(wsContent); |
| 1006 if (wsContent == wsLabel) { | 1006 if (wsContent == wsLabel) { |
| 1007 iSearch = iCount; | 1007 iSearch = iCount; |
| 1008 break; | 1008 break; |
| 1009 } | 1009 } |
| 1010 iCount++; | 1010 iCount++; |
| 1011 } | 1011 } |
| 1012 if (iSearch < 0) | 1012 if (iSearch < 0) |
| 1013 return; | 1013 return; |
| 1014 if (CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_ELEMENT_UNKNOWN)) | 1014 if (CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_Element::Unknown)) |
| 1015 pText->TryContent(wsValue); | 1015 pText->TryContent(wsValue); |
| 1016 } | 1016 } |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex, | 1019 FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex, |
| 1020 FX_BOOL bNotify, | 1020 FX_BOOL bNotify, |
| 1021 FX_BOOL bScriptModify, | 1021 FX_BOOL bScriptModify, |
| 1022 FX_BOOL bSyncData) { | 1022 FX_BOOL bSyncData) { |
| 1023 FX_BOOL bSetValue = FALSE; | 1023 FX_BOOL bSetValue = FALSE; |
| 1024 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1024 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1025 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1025 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1026 if (pItems->GetClassID() != XFA_ELEMENT_Items) | 1026 if (pItems->GetClassID() != XFA_Element::Items) |
| 1027 continue; | 1027 continue; |
| 1028 | 1028 |
| 1029 if (nIndex < 0) { | 1029 if (nIndex < 0) { |
| 1030 while (CXFA_Node* pNode = pItems->GetNodeItem(XFA_NODEITEM_FirstChild)) { | 1030 while (CXFA_Node* pNode = pItems->GetNodeItem(XFA_NODEITEM_FirstChild)) { |
| 1031 pItems->RemoveChild(pNode); | 1031 pItems->RemoveChild(pNode); |
| 1032 } | 1032 } |
| 1033 } else { | 1033 } else { |
| 1034 if (!bSetValue && pItems->GetBoolean(XFA_ATTRIBUTE_Save)) { | 1034 if (!bSetValue && pItems->GetBoolean(XFA_ATTRIBUTE_Save)) { |
| 1035 SetItemState(nIndex, FALSE, true, bScriptModify, bSyncData); | 1035 SetItemState(nIndex, FALSE, true, bScriptModify, bSyncData); |
| 1036 bSetValue = TRUE; | 1036 bSetValue = TRUE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1056 CXFA_Node* pUIChild = GetUIChild(); | 1056 CXFA_Node* pUIChild = GetUIChild(); |
| 1057 if (pUIChild) | 1057 if (pUIChild) |
| 1058 return pUIChild->GetEnum(XFA_ATTRIBUTE_HScrollPolicy); | 1058 return pUIChild->GetEnum(XFA_ATTRIBUTE_HScrollPolicy); |
| 1059 return XFA_ATTRIBUTEENUM_Auto; | 1059 return XFA_ATTRIBUTEENUM_Auto; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 int32_t CXFA_WidgetData::GetNumberOfCells() { | 1062 int32_t CXFA_WidgetData::GetNumberOfCells() { |
| 1063 CXFA_Node* pUIChild = GetUIChild(); | 1063 CXFA_Node* pUIChild = GetUIChild(); |
| 1064 if (!pUIChild) | 1064 if (!pUIChild) |
| 1065 return -1; | 1065 return -1; |
| 1066 if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_ELEMENT_Comb)) | 1066 if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_Element::Comb)) |
| 1067 return pNode->GetInteger(XFA_ATTRIBUTE_NumberOfCells); | 1067 return pNode->GetInteger(XFA_ATTRIBUTE_NumberOfCells); |
| 1068 return -1; | 1068 return -1; |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 CFX_WideString CXFA_WidgetData::GetBarcodeType() { | 1071 CFX_WideString CXFA_WidgetData::GetBarcodeType() { |
| 1072 CXFA_Node* pUIChild = GetUIChild(); | 1072 CXFA_Node* pUIChild = GetUIChild(); |
| 1073 return pUIChild ? CFX_WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type)) | 1073 return pUIChild ? CFX_WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type)) |
| 1074 : CFX_WideString(); | 1074 : CFX_WideString(); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 return TRUE; | 1244 return TRUE; |
| 1245 } | 1245 } |
| 1246 return FALSE; | 1246 return FALSE; |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) { | 1249 void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) { |
| 1250 CXFA_Node* pUIChild = GetUIChild(); | 1250 CXFA_Node* pUIChild = GetUIChild(); |
| 1251 if (pUIChild) { | 1251 if (pUIChild) { |
| 1252 pUIChild->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord); | 1252 pUIChild->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord); |
| 1253 } else { | 1253 } else { |
| 1254 wsPassWord = XFA_GetAttributeDefaultValue_Cdata(XFA_ELEMENT_PasswordEdit, | 1254 wsPassWord = XFA_GetAttributeDefaultValue_Cdata(XFA_Element::PasswordEdit, |
| 1255 XFA_ATTRIBUTE_PasswordChar, | 1255 XFA_ATTRIBUTE_PasswordChar, |
| 1256 XFA_XDPPACKET_Form); | 1256 XFA_XDPPACKET_Form); |
| 1257 } | 1257 } |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 FX_BOOL CXFA_WidgetData::IsMultiLine() { | 1260 FX_BOOL CXFA_WidgetData::IsMultiLine() { |
| 1261 CXFA_Node* pUIChild = GetUIChild(); | 1261 CXFA_Node* pUIChild = GetUIChild(); |
| 1262 if (pUIChild) | 1262 if (pUIChild) |
| 1263 return pUIChild->GetBoolean(XFA_ATTRIBUTE_MultiLine); | 1263 return pUIChild->GetBoolean(XFA_ATTRIBUTE_MultiLine); |
| 1264 return XFA_GetAttributeDefaultValue_Boolean( | 1264 return XFA_GetAttributeDefaultValue_Boolean( |
| 1265 XFA_ELEMENT_TextEdit, XFA_ATTRIBUTE_MultiLine, XFA_XDPPACKET_Form); | 1265 XFA_Element::TextEdit, XFA_ATTRIBUTE_MultiLine, XFA_XDPPACKET_Form); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 int32_t CXFA_WidgetData::GetVerticalScrollPolicy() { | 1268 int32_t CXFA_WidgetData::GetVerticalScrollPolicy() { |
| 1269 CXFA_Node* pUIChild = GetUIChild(); | 1269 CXFA_Node* pUIChild = GetUIChild(); |
| 1270 if (pUIChild) | 1270 if (pUIChild) |
| 1271 return pUIChild->GetEnum(XFA_ATTRIBUTE_VScrollPolicy); | 1271 return pUIChild->GetEnum(XFA_ATTRIBUTE_VScrollPolicy); |
| 1272 return XFA_GetAttributeDefaultValue_Enum( | 1272 return XFA_GetAttributeDefaultValue_Enum( |
| 1273 XFA_ELEMENT_TextEdit, XFA_ATTRIBUTE_VScrollPolicy, XFA_XDPPACKET_Form); | 1273 XFA_Element::TextEdit, XFA_ATTRIBUTE_VScrollPolicy, XFA_XDPPACKET_Form); |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 int32_t CXFA_WidgetData::GetMaxChars(XFA_ELEMENT& eType) { | 1276 int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) { |
| 1277 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) { | 1277 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { |
| 1278 if (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) { | 1278 if (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) { |
| 1279 switch (pChild->GetClassID()) { | 1279 switch (pChild->GetClassID()) { |
| 1280 case XFA_ELEMENT_Text: | 1280 case XFA_Element::Text: |
| 1281 eType = XFA_ELEMENT_Text; | 1281 eType = XFA_Element::Text; |
| 1282 return pChild->GetInteger(XFA_ATTRIBUTE_MaxChars); | 1282 return pChild->GetInteger(XFA_ATTRIBUTE_MaxChars); |
| 1283 case XFA_ELEMENT_ExData: { | 1283 case XFA_Element::ExData: { |
| 1284 eType = XFA_ELEMENT_ExData; | 1284 eType = XFA_Element::ExData; |
| 1285 int32_t iMax = pChild->GetInteger(XFA_ATTRIBUTE_MaxLength); | 1285 int32_t iMax = pChild->GetInteger(XFA_ATTRIBUTE_MaxLength); |
| 1286 return iMax < 0 ? 0 : iMax; | 1286 return iMax < 0 ? 0 : iMax; |
| 1287 } | 1287 } |
| 1288 default: | 1288 default: |
| 1289 break; | 1289 break; |
| 1290 } | 1290 } |
| 1291 } | 1291 } |
| 1292 } | 1292 } |
| 1293 return 0; | 1293 return 0; |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 FX_BOOL CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) { | 1296 FX_BOOL CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) { |
| 1297 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) { | 1297 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { |
| 1298 if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal)) | 1298 if (CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal)) |
| 1299 return pChild->TryInteger(XFA_ATTRIBUTE_FracDigits, iFracDigits); | 1299 return pChild->TryInteger(XFA_ATTRIBUTE_FracDigits, iFracDigits); |
| 1300 } | 1300 } |
| 1301 iFracDigits = -1; | 1301 iFracDigits = -1; |
| 1302 return FALSE; | 1302 return FALSE; |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 FX_BOOL CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { | 1305 FX_BOOL CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { |
| 1306 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Value)) { | 1306 if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { |
| 1307 if (CXFA_Node* pChild = pNode->GetChild(0, XFA_ELEMENT_Decimal)) | 1307 if (CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal)) |
| 1308 return pChild->TryInteger(XFA_ATTRIBUTE_LeadDigits, iLeadDigits); | 1308 return pChild->TryInteger(XFA_ATTRIBUTE_LeadDigits, iLeadDigits); |
| 1309 } | 1309 } |
| 1310 iLeadDigits = -1; | 1310 iLeadDigits = -1; |
| 1311 return FALSE; | 1311 return FALSE; |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, | 1314 FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, |
| 1315 XFA_VALUEPICTURE eValueType) { | 1315 XFA_VALUEPICTURE eValueType) { |
| 1316 if (wsValue.IsEmpty()) { | 1316 if (wsValue.IsEmpty()) { |
| 1317 SyncValue(wsValue, true); | 1317 SyncValue(wsValue, true); |
| 1318 return TRUE; | 1318 return TRUE; |
| 1319 } | 1319 } |
| 1320 m_bPreNull = m_bIsNull; | 1320 m_bPreNull = m_bIsNull; |
| 1321 m_bIsNull = FALSE; | 1321 m_bIsNull = FALSE; |
| 1322 CFX_WideString wsNewText(wsValue); | 1322 CFX_WideString wsNewText(wsValue); |
| 1323 CFX_WideString wsPicture; | 1323 CFX_WideString wsPicture; |
| 1324 GetPictureContent(wsPicture, eValueType); | 1324 GetPictureContent(wsPicture, eValueType); |
| 1325 FX_BOOL bValidate = TRUE; | 1325 FX_BOOL bValidate = TRUE; |
| 1326 FX_BOOL bSyncData = FALSE; | 1326 FX_BOOL bSyncData = FALSE; |
| 1327 CXFA_Node* pNode = GetUIChild(); | 1327 CXFA_Node* pNode = GetUIChild(); |
| 1328 if (!pNode) | 1328 if (!pNode) |
| 1329 return TRUE; | 1329 return TRUE; |
| 1330 | 1330 |
| 1331 XFA_ELEMENT uiType = pNode->GetClassID(); | 1331 XFA_Element uiType = pNode->GetClassID(); |
| 1332 if (!wsPicture.IsEmpty()) { | 1332 if (!wsPicture.IsEmpty()) { |
| 1333 CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); | 1333 CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); |
| 1334 IFX_Locale* pLocale = GetLocal(); | 1334 IFX_Locale* pLocale = GetLocal(); |
| 1335 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); | 1335 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); |
| 1336 bValidate = | 1336 bValidate = |
| 1337 widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture); | 1337 widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture); |
| 1338 if (bValidate) { | 1338 if (bValidate) { |
| 1339 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNewText, | 1339 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNewText, |
| 1340 wsPicture, pLocale, pLocalMgr); | 1340 wsPicture, pLocale, pLocalMgr); |
| 1341 wsNewText = widgetValue.GetValue(); | 1341 wsNewText = widgetValue.GetValue(); |
| 1342 if (uiType == XFA_ELEMENT_NumericEdit) { | 1342 if (uiType == XFA_Element::NumericEdit) { |
| 1343 int32_t iLeadDigits = 0; | 1343 int32_t iLeadDigits = 0; |
| 1344 int32_t iFracDigits = 0; | 1344 int32_t iFracDigits = 0; |
| 1345 GetLeadDigits(iLeadDigits); | 1345 GetLeadDigits(iLeadDigits); |
| 1346 GetFracDigits(iFracDigits); | 1346 GetFracDigits(iFracDigits); |
| 1347 wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits); | 1347 wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits); |
| 1348 } | 1348 } |
| 1349 bSyncData = TRUE; | 1349 bSyncData = TRUE; |
| 1350 } | 1350 } |
| 1351 } else { | 1351 } else { |
| 1352 if (uiType == XFA_ELEMENT_NumericEdit) { | 1352 if (uiType == XFA_Element::NumericEdit) { |
| 1353 if (wsNewText != FX_WSTRC(L"0")) { | 1353 if (wsNewText != FX_WSTRC(L"0")) { |
| 1354 int32_t iLeadDigits = 0; | 1354 int32_t iLeadDigits = 0; |
| 1355 int32_t iFracDigits = 0; | 1355 int32_t iFracDigits = 0; |
| 1356 GetLeadDigits(iLeadDigits); | 1356 GetLeadDigits(iLeadDigits); |
| 1357 GetFracDigits(iFracDigits); | 1357 GetFracDigits(iFracDigits); |
| 1358 wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits); | 1358 wsNewText = NumericLimit(wsNewText, iLeadDigits, iFracDigits); |
| 1359 } | 1359 } |
| 1360 bSyncData = TRUE; | 1360 bSyncData = TRUE; |
| 1361 } | 1361 } |
| 1362 } | 1362 } |
| 1363 if (uiType != XFA_ELEMENT_NumericEdit || bSyncData) | 1363 if (uiType != XFA_Element::NumericEdit || bSyncData) |
| 1364 SyncValue(wsNewText, true); | 1364 SyncValue(wsNewText, true); |
| 1365 | 1365 |
| 1366 return bValidate; | 1366 return bValidate; |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture, | 1369 FX_BOOL CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture, |
| 1370 XFA_VALUEPICTURE ePicture) { | 1370 XFA_VALUEPICTURE ePicture) { |
| 1371 if (ePicture == XFA_VALUEPICTURE_Raw) | 1371 if (ePicture == XFA_VALUEPICTURE_Raw) |
| 1372 return FALSE; | 1372 return FALSE; |
| 1373 | 1373 |
| 1374 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); | 1374 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); |
| 1375 switch (ePicture) { | 1375 switch (ePicture) { |
| 1376 case XFA_VALUEPICTURE_Display: { | 1376 case XFA_VALUEPICTURE_Display: { |
| 1377 if (CXFA_Node* pFormat = m_pNode->GetChild(0, XFA_ELEMENT_Format)) { | 1377 if (CXFA_Node* pFormat = m_pNode->GetChild(0, XFA_Element::Format)) { |
| 1378 if (CXFA_Node* pPicture = pFormat->GetChild(0, XFA_ELEMENT_Picture)) { | 1378 if (CXFA_Node* pPicture = pFormat->GetChild(0, XFA_Element::Picture)) { |
| 1379 if (pPicture->TryContent(wsPicture)) | 1379 if (pPicture->TryContent(wsPicture)) |
| 1380 return TRUE; | 1380 return TRUE; |
| 1381 } | 1381 } |
| 1382 } | 1382 } |
| 1383 CFX_WideString wsDataPicture, wsTimePicture; | 1383 CFX_WideString wsDataPicture, wsTimePicture; |
| 1384 IFX_Locale* pLocale = GetLocal(); | 1384 IFX_Locale* pLocale = GetLocal(); |
| 1385 if (!pLocale) | 1385 if (!pLocale) |
| 1386 return FALSE; | 1386 return FALSE; |
| 1387 | 1387 |
| 1388 uint32_t dwType = widgetValue.GetType(); | 1388 uint32_t dwType = widgetValue.GetType(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1405 case XFA_VT_DECIMAL: | 1405 case XFA_VT_DECIMAL: |
| 1406 case XFA_VT_FLOAT: | 1406 case XFA_VT_FLOAT: |
| 1407 break; | 1407 break; |
| 1408 default: | 1408 default: |
| 1409 break; | 1409 break; |
| 1410 } | 1410 } |
| 1411 return TRUE; | 1411 return TRUE; |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 case XFA_VALUEPICTURE_Edit: { | 1414 case XFA_VALUEPICTURE_Edit: { |
| 1415 CXFA_Node* pUI = m_pNode->GetChild(0, XFA_ELEMENT_Ui); | 1415 CXFA_Node* pUI = m_pNode->GetChild(0, XFA_Element::Ui); |
| 1416 if (pUI) { | 1416 if (pUI) { |
| 1417 if (CXFA_Node* pPicture = pUI->GetChild(0, XFA_ELEMENT_Picture)) { | 1417 if (CXFA_Node* pPicture = pUI->GetChild(0, XFA_Element::Picture)) { |
| 1418 if (pPicture->TryContent(wsPicture)) | 1418 if (pPicture->TryContent(wsPicture)) |
| 1419 return TRUE; | 1419 return TRUE; |
| 1420 } | 1420 } |
| 1421 } | 1421 } |
| 1422 { | 1422 { |
| 1423 CFX_WideString wsDataPicture, wsTimePicture; | 1423 CFX_WideString wsDataPicture, wsTimePicture; |
| 1424 IFX_Locale* pLocale = GetLocal(); | 1424 IFX_Locale* pLocale = GetLocal(); |
| 1425 if (!pLocale) { | 1425 if (!pLocale) { |
| 1426 return FALSE; | 1426 return FALSE; |
| 1427 } | 1427 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 | 1486 |
| 1487 if (eValueType == XFA_VALUEPICTURE_Display) | 1487 if (eValueType == XFA_VALUEPICTURE_Display) |
| 1488 GetItemLabel(wsValue.AsStringC(), wsValue); | 1488 GetItemLabel(wsValue.AsStringC(), wsValue); |
| 1489 | 1489 |
| 1490 CFX_WideString wsPicture; | 1490 CFX_WideString wsPicture; |
| 1491 GetPictureContent(wsPicture, eValueType); | 1491 GetPictureContent(wsPicture, eValueType); |
| 1492 CXFA_Node* pNode = GetUIChild(); | 1492 CXFA_Node* pNode = GetUIChild(); |
| 1493 if (!pNode) | 1493 if (!pNode) |
| 1494 return TRUE; | 1494 return TRUE; |
| 1495 | 1495 |
| 1496 XFA_ELEMENT uiType = GetUIChild()->GetClassID(); | 1496 XFA_Element uiType = GetUIChild()->GetClassID(); |
| 1497 switch (uiType) { | 1497 switch (uiType) { |
| 1498 case XFA_ELEMENT_ChoiceList: { | 1498 case XFA_Element::ChoiceList: { |
| 1499 if (eValueType == XFA_VALUEPICTURE_Display) { | 1499 if (eValueType == XFA_VALUEPICTURE_Display) { |
| 1500 int32_t iSelItemIndex = GetSelectedItem(0); | 1500 int32_t iSelItemIndex = GetSelectedItem(0); |
| 1501 if (iSelItemIndex >= 0) { | 1501 if (iSelItemIndex >= 0) { |
| 1502 GetChoiceListItem(wsValue, iSelItemIndex); | 1502 GetChoiceListItem(wsValue, iSelItemIndex); |
| 1503 wsPicture.clear(); | 1503 wsPicture.clear(); |
| 1504 } | 1504 } |
| 1505 } | 1505 } |
| 1506 } break; | 1506 } break; |
| 1507 case XFA_ELEMENT_NumericEdit: | 1507 case XFA_Element::NumericEdit: |
| 1508 if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { | 1508 if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { |
| 1509 IFX_Locale* pLocale = GetLocal(); | 1509 IFX_Locale* pLocale = GetLocal(); |
| 1510 if (eValueType == XFA_VALUEPICTURE_Display && pLocale) { | 1510 if (eValueType == XFA_VALUEPICTURE_Display && pLocale) { |
| 1511 CFX_WideString wsOutput; | 1511 CFX_WideString wsOutput; |
| 1512 NormalizeNumStr(wsValue, wsOutput); | 1512 NormalizeNumStr(wsValue, wsOutput); |
| 1513 FormatNumStr(wsOutput, pLocale, wsOutput); | 1513 FormatNumStr(wsOutput, pLocale, wsOutput); |
| 1514 wsValue = wsOutput; | 1514 wsValue = wsOutput; |
| 1515 } | 1515 } |
| 1516 } | 1516 } |
| 1517 break; | 1517 break; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 if (wsValue.IsEmpty()) | 1582 if (wsValue.IsEmpty()) |
| 1583 return TRUE; | 1583 return TRUE; |
| 1584 | 1584 |
| 1585 CFX_WideString wsPicture; | 1585 CFX_WideString wsPicture; |
| 1586 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); | 1586 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); |
| 1587 if (wsPicture.IsEmpty()) | 1587 if (wsPicture.IsEmpty()) |
| 1588 return TRUE; | 1588 return TRUE; |
| 1589 | 1589 |
| 1590 if (IFX_Locale* pLocale = GetLocal()) { | 1590 if (IFX_Locale* pLocale = GetLocal()) { |
| 1591 ASSERT(GetNode()); | 1591 ASSERT(GetNode()); |
| 1592 CXFA_Node* pNodeValue = GetNode()->GetChild(0, XFA_ELEMENT_Value); | 1592 CXFA_Node* pNodeValue = GetNode()->GetChild(0, XFA_Element::Value); |
| 1593 if (!pNodeValue) | 1593 if (!pNodeValue) |
| 1594 return FALSE; | 1594 return FALSE; |
| 1595 | 1595 |
| 1596 CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 1596 CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1597 if (!pValueChild) | 1597 if (!pValueChild) |
| 1598 return FALSE; | 1598 return FALSE; |
| 1599 | 1599 |
| 1600 int32_t iVTType = XFA_VT_NULL; | 1600 int32_t iVTType = XFA_VT_NULL; |
| 1601 XFA_ELEMENT eType = pValueChild->GetClassID(); | 1601 XFA_Element eType = pValueChild->GetClassID(); |
| 1602 switch (eType) { | 1602 switch (eType) { |
| 1603 case XFA_ELEMENT_Decimal: | 1603 case XFA_Element::Decimal: |
| 1604 iVTType = XFA_VT_DECIMAL; | 1604 iVTType = XFA_VT_DECIMAL; |
| 1605 break; | 1605 break; |
| 1606 case XFA_ELEMENT_Float: | 1606 case XFA_Element::Float: |
| 1607 iVTType = XFA_VT_FLOAT; | 1607 iVTType = XFA_VT_FLOAT; |
| 1608 break; | 1608 break; |
| 1609 case XFA_ELEMENT_Date: | 1609 case XFA_Element::Date: |
| 1610 iVTType = XFA_VT_DATE; | 1610 iVTType = XFA_VT_DATE; |
| 1611 break; | 1611 break; |
| 1612 case XFA_ELEMENT_Time: | 1612 case XFA_Element::Time: |
| 1613 iVTType = XFA_VT_TIME; | 1613 iVTType = XFA_VT_TIME; |
| 1614 break; | 1614 break; |
| 1615 case XFA_ELEMENT_DateTime: | 1615 case XFA_Element::DateTime: |
| 1616 iVTType = XFA_VT_DATETIME; | 1616 iVTType = XFA_VT_DATETIME; |
| 1617 break; | 1617 break; |
| 1618 case XFA_ELEMENT_Boolean: | 1618 case XFA_Element::Boolean: |
| 1619 iVTType = XFA_VT_BOOLEAN; | 1619 iVTType = XFA_VT_BOOLEAN; |
| 1620 break; | 1620 break; |
| 1621 case XFA_ELEMENT_Integer: | 1621 case XFA_Element::Integer: |
| 1622 iVTType = XFA_VT_INTEGER; | 1622 iVTType = XFA_VT_INTEGER; |
| 1623 break; | 1623 break; |
| 1624 case XFA_ELEMENT_Text: | 1624 case XFA_Element::Text: |
| 1625 iVTType = XFA_VT_TEXT; | 1625 iVTType = XFA_VT_TEXT; |
| 1626 break; | 1626 break; |
| 1627 default: | 1627 default: |
| 1628 iVTType = XFA_VT_NULL; | 1628 iVTType = XFA_VT_NULL; |
| 1629 break; | 1629 break; |
| 1630 } | 1630 } |
| 1631 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); | 1631 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); |
| 1632 CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr); | 1632 CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr); |
| 1633 switch (widgetValue.GetType()) { | 1633 switch (widgetValue.GetType()) { |
| 1634 case XFA_VT_DATE: { | 1634 case XFA_VT_DATE: { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); | 1731 CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); |
| 1732 if (pContainerWidgetData) | 1732 if (pContainerWidgetData) |
| 1733 pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue); | 1733 pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue); |
| 1734 | 1734 |
| 1735 m_pNode->SetContent(wsValue, wsFormatValue, bNotify); | 1735 m_pNode->SetContent(wsValue, wsFormatValue, bNotify); |
| 1736 } | 1736 } |
| 1737 | 1737 |
| 1738 void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, | 1738 void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, |
| 1739 const CFX_WideString& wsText, | 1739 const CFX_WideString& wsText, |
| 1740 int32_t nIndex) { | 1740 int32_t nIndex) { |
| 1741 CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_ELEMENT_Text); | 1741 CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_Element::Text); |
| 1742 pItems->InsertChild(nIndex, pText); | 1742 pItems->InsertChild(nIndex, pText); |
| 1743 pText->SetContent(wsText, wsText, FALSE, FALSE, FALSE); | 1743 pText->SetContent(wsText, wsText, FALSE, FALSE, FALSE); |
| 1744 } | 1744 } |
| 1745 | 1745 |
| 1746 CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, | 1746 CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, |
| 1747 int32_t iLead, | 1747 int32_t iLead, |
| 1748 int32_t iTread) const { | 1748 int32_t iTread) const { |
| 1749 if ((iLead == -1) && (iTread == -1)) | 1749 if ((iLead == -1) && (iTread == -1)) |
| 1750 return wsValue; | 1750 return wsValue; |
| 1751 | 1751 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1779 } | 1779 } |
| 1780 } | 1780 } |
| 1781 } else if (wc == L'.') { | 1781 } else if (wc == L'.') { |
| 1782 iTread_ = 0; | 1782 iTread_ = 0; |
| 1783 iLead = -1; | 1783 iLead = -1; |
| 1784 } | 1784 } |
| 1785 wsRet += wc; | 1785 wsRet += wc; |
| 1786 } | 1786 } |
| 1787 return wsRet; | 1787 return wsRet; |
| 1788 } | 1788 } |
| OLD | NEW |