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_ffwidgetacc.h" | 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 switch (eUIType) { | 203 switch (eUIType) { |
204 case XFA_ELEMENT_ImageEdit: { | 204 case XFA_ELEMENT_ImageEdit: { |
205 CXFA_Value imageValue = GetDefaultValue(); | 205 CXFA_Value imageValue = GetDefaultValue(); |
206 CXFA_Image image = imageValue.GetImage(); | 206 CXFA_Image image = imageValue.GetImage(); |
207 CFX_WideString wsContentType, wsHref; | 207 CFX_WideString wsContentType, wsHref; |
208 if (image) { | 208 if (image) { |
209 image.GetContent(wsValue); | 209 image.GetContent(wsValue); |
210 image.GetContentType(wsContentType); | 210 image.GetContentType(wsContentType); |
211 image.GetHref(wsHref); | 211 image.GetHref(wsHref); |
212 } | 212 } |
213 SetImageEdit(wsContentType.AsStringC(), wsHref.AsStringC(), | 213 SetImageEdit(wsContentType, wsHref, wsValue); |
214 wsValue.AsStringC()); | |
215 } break; | 214 } break; |
216 case XFA_ELEMENT_ExclGroup: { | 215 case XFA_ELEMENT_ExclGroup: { |
217 CXFA_Node* pNextChild = m_pNode->GetNodeItem( | 216 CXFA_Node* pNextChild = m_pNode->GetNodeItem( |
218 XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode); | 217 XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode); |
219 while (pNextChild) { | 218 while (pNextChild) { |
220 CXFA_Node* pChild = pNextChild; | 219 CXFA_Node* pChild = pNextChild; |
221 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pChild->GetWidgetData(); | 220 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pChild->GetWidgetData(); |
222 if (!pAcc) { | 221 if (!pAcc) { |
223 continue; | 222 continue; |
224 } | 223 } |
(...skipping 20 matching lines...) Expand all Loading... |
245 case XFA_ELEMENT_ChoiceList: | 244 case XFA_ELEMENT_ChoiceList: |
246 ClearAllSelections(); | 245 ClearAllSelections(); |
247 default: | 246 default: |
248 if (CXFA_Value defValue = GetDefaultValue()) { | 247 if (CXFA_Value defValue = GetDefaultValue()) { |
249 defValue.GetChildValueContent(wsValue); | 248 defValue.GetChildValueContent(wsValue); |
250 } | 249 } |
251 SetValue(wsValue, XFA_VALUEPICTURE_Raw); | 250 SetValue(wsValue, XFA_VALUEPICTURE_Raw); |
252 break; | 251 break; |
253 } | 252 } |
254 } | 253 } |
255 void CXFA_WidgetAcc::SetImageEdit(const CFX_WideStringC& wsContentType, | 254 void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, |
256 const CFX_WideStringC& wsHref, | 255 const CFX_WideString& wsHref, |
257 const CFX_WideStringC& wsData) { | 256 const CFX_WideString& wsData) { |
258 CXFA_Image image = GetFormValue().GetImage(); | 257 CXFA_Image image = GetFormValue().GetImage(); |
259 if (image) { | 258 if (image) { |
260 image.SetContentType(wsContentType); | 259 image.SetContentType(CFX_WideString(wsContentType)); |
261 image.SetHref(wsHref); | 260 image.SetHref(wsHref); |
262 } | 261 } |
263 CFX_WideString wsFormatValue(wsData); | 262 CFX_WideString wsFormatValue(wsData); |
264 GetFormatDataValue(wsData, wsFormatValue); | 263 GetFormatDataValue(wsData, wsFormatValue); |
265 m_pNode->SetContent(wsData, wsFormatValue, TRUE); | 264 m_pNode->SetContent(wsData, wsFormatValue, TRUE); |
266 CXFA_Node* pBind = GetDatasets(); | 265 CXFA_Node* pBind = GetDatasets(); |
267 if (!pBind) { | 266 if (!pBind) { |
268 image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); | 267 image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); |
269 return; | 268 return; |
270 } | 269 } |
271 pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); | 270 pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); |
272 CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild); | 271 CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild); |
273 if (pHrefNode) { | 272 if (pHrefNode) { |
274 pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref); | 273 pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref); |
275 } else { | 274 } else { |
276 CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); | 275 CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); |
277 ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element); | 276 ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element); |
278 static_cast<CFDE_XMLElement*>(pXMLNode) | 277 static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref); |
279 ->SetString(FX_WSTRC(L"href"), wsHref); | |
280 } | 278 } |
281 } | 279 } |
282 | 280 |
283 CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() { | 281 CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() { |
284 CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent); | 282 CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent); |
285 if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) { | 283 if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) { |
286 return NULL; | 284 return NULL; |
287 } | 285 } |
288 return (CXFA_WidgetAcc*)pExcl->GetWidgetData(); | 286 return (CXFA_WidgetAcc*)pExcl->GetWidgetData(); |
289 } | 287 } |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 if (pIDNode) { | 1680 if (pIDNode) { |
1683 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); | 1681 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); |
1684 } | 1682 } |
1685 if (pEmbAcc) { | 1683 if (pEmbAcc) { |
1686 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 1684 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
1687 return TRUE; | 1685 return TRUE; |
1688 } | 1686 } |
1689 } | 1687 } |
1690 return FALSE; | 1688 return FALSE; |
1691 } | 1689 } |
OLD | NEW |