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/parser/xfa_utils.h" | 7 #include "xfa/fxfa/parser/xfa_utils.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 eUIType = XFA_Element::DefaultUi; | 55 eUIType = XFA_Element::DefaultUi; |
56 eWidgetType = eValueType; | 56 eWidgetType = eValueType; |
57 break; | 57 break; |
58 default: | 58 default: |
59 break; | 59 break; |
60 } | 60 } |
61 CXFA_Node* pUIChild = NULL; | 61 CXFA_Node* pUIChild = NULL; |
62 CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); | 62 CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); |
63 CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); | 63 CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); |
64 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 64 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
65 XFA_Element eChild = pChild->GetElementType(); | 65 XFA_Element eChildType = pChild->GetElementType(); |
66 if (eChild == XFA_Element::Extras || eChild == XFA_Element::Picture) { | 66 if (eChildType == XFA_Element::Extras || |
| 67 eChildType == XFA_Element::Picture) { |
67 continue; | 68 continue; |
68 } | 69 } |
69 const XFA_PROPERTY* pProperty = | 70 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
70 XFA_GetPropertyOfElement(XFA_Element::Ui, eChild, XFA_XDPPACKET_Form); | 71 XFA_Element::Ui, eChildType, XFA_XDPPACKET_Form); |
71 if (pProperty && (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { | 72 if (pProperty && (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { |
72 pUIChild = pChild; | 73 pUIChild = pChild; |
73 break; | 74 break; |
74 } | 75 } |
75 } | 76 } |
76 if (eType == XFA_Element::Draw) { | 77 if (eType == XFA_Element::Draw) { |
77 XFA_Element eDraw = | 78 XFA_Element eDraw = |
78 pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; | 79 pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; |
79 switch (eDraw) { | 80 switch (eDraw) { |
80 case XFA_Element::TextEdit: | 81 case XFA_Element::TextEdit: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 CXFA_Node* pNodeValue = | 147 CXFA_Node* pNodeValue = |
147 pWidgetData->GetNode()->GetChild(0, XFA_Element::Value); | 148 pWidgetData->GetNode()->GetChild(0, XFA_Element::Value); |
148 if (!pNodeValue) { | 149 if (!pNodeValue) { |
149 return CXFA_LocaleValue(); | 150 return CXFA_LocaleValue(); |
150 } | 151 } |
151 CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 152 CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
152 if (!pValueChild) { | 153 if (!pValueChild) { |
153 return CXFA_LocaleValue(); | 154 return CXFA_LocaleValue(); |
154 } | 155 } |
155 int32_t iVTType = XFA_VT_NULL; | 156 int32_t iVTType = XFA_VT_NULL; |
156 XFA_Element eType = pValueChild->GetElementType(); | 157 switch (pValueChild->GetElementType()) { |
157 switch (eType) { | |
158 case XFA_Element::Decimal: | 158 case XFA_Element::Decimal: |
159 iVTType = XFA_VT_DECIMAL; | 159 iVTType = XFA_VT_DECIMAL; |
160 break; | 160 break; |
161 case XFA_Element::Float: | 161 case XFA_Element::Float: |
162 iVTType = XFA_VT_FLOAT; | 162 iVTType = XFA_VT_FLOAT; |
163 break; | 163 break; |
164 case XFA_Element::Date: | 164 case XFA_Element::Date: |
165 iVTType = XFA_VT_DATE; | 165 iVTType = XFA_VT_DATE; |
166 break; | 166 break; |
167 case XFA_Element::Time: | 167 case XFA_Element::Time: |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { | 362 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { |
363 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); | 363 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); |
364 return XFA_WideStringToDouble(wsValue); | 364 return XFA_WideStringToDouble(wsValue); |
365 } | 365 } |
366 | 366 |
367 int32_t XFA_MapRotation(int32_t nRotation) { | 367 int32_t XFA_MapRotation(int32_t nRotation) { |
368 nRotation = nRotation % 360; | 368 nRotation = nRotation % 360; |
369 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; | 369 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; |
370 return nRotation; | 370 return nRotation; |
371 } | 371 } |
OLD | NEW |