summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_image.cpp34
-rw-r--r--xfa/fxfa/parser/cxfa_image.h12
-rw-r--r--xfa/fxfa/parser/cxfa_imagedata.cpp48
-rw-r--r--xfa/fxfa/parser/cxfa_imagedata.h33
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_value.h4
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp21
7 files changed, 61 insertions, 96 deletions
diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp
index 928738109e..88ca977bb2 100644
--- a/xfa/fxfa/parser/cxfa_image.cpp
+++ b/xfa/fxfa/parser/cxfa_image.cpp
@@ -39,3 +39,37 @@ CXFA_Image::CXFA_Image(CXFA_Document* doc, XFA_PacketType packet)
kName) {}
CXFA_Image::~CXFA_Image() {}
+
+XFA_AttributeEnum CXFA_Image::GetAspect() {
+ return JSObject()->GetEnum(XFA_Attribute::Aspect);
+}
+
+WideString CXFA_Image::GetContentType() {
+ return JSObject()->TryCData(XFA_Attribute::ContentType, true).value_or(L"");
+}
+
+WideString CXFA_Image::GetHref() {
+ return JSObject()->TryCData(XFA_Attribute::Href, true).value_or(L"");
+}
+
+XFA_AttributeEnum CXFA_Image::GetTransferEncoding() {
+ return static_cast<XFA_AttributeEnum>(
+ JSObject()->GetEnum(XFA_Attribute::TransferEncoding));
+}
+
+WideString CXFA_Image::GetContent() {
+ return JSObject()->TryContent(false, true).value_or(L"");
+}
+
+void CXFA_Image::SetContentType(const WideString& wsContentType) {
+ JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, false, false);
+}
+
+void CXFA_Image::SetHref(const WideString& wsHref) {
+ JSObject()->SetCData(XFA_Attribute::Href, wsHref, false, false);
+}
+
+void CXFA_Image::SetTransferEncoding(XFA_AttributeEnum iTransferEncoding) {
+ JSObject()->SetEnum(XFA_Attribute::TransferEncoding, iTransferEncoding,
+ false);
+}
diff --git a/xfa/fxfa/parser/cxfa_image.h b/xfa/fxfa/parser/cxfa_image.h
index 07ebf9d5d7..3670863a3b 100644
--- a/xfa/fxfa/parser/cxfa_image.h
+++ b/xfa/fxfa/parser/cxfa_image.h
@@ -13,6 +13,18 @@ class CXFA_Image : public CXFA_Node {
public:
CXFA_Image(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Image() override;
+
+ XFA_AttributeEnum GetAspect();
+ WideString GetContent();
+
+ WideString GetHref();
+ void SetHref(const WideString& wsHref);
+
+ XFA_AttributeEnum GetTransferEncoding();
+ void SetTransferEncoding(XFA_AttributeEnum iTransferEncoding);
+
+ WideString GetContentType();
+ void SetContentType(const WideString& wsContentType);
};
#endif // XFA_FXFA_PARSER_CXFA_IMAGE_H_
diff --git a/xfa/fxfa/parser/cxfa_imagedata.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp
deleted file mode 100644
index cacbf9558d..0000000000
--- a/xfa/fxfa/parser/cxfa_imagedata.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/parser/cxfa_imagedata.h"
-
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_ImageData::CXFA_ImageData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-XFA_AttributeEnum CXFA_ImageData::GetAspect() const {
- return m_pNode->JSObject()->GetEnum(XFA_Attribute::Aspect);
-}
-
-WideString CXFA_ImageData::GetContentType() const {
- return m_pNode->JSObject()
- ->TryCData(XFA_Attribute::ContentType, true)
- .value_or(L"");
-}
-
-WideString CXFA_ImageData::GetHref() const {
- return m_pNode->JSObject()->TryCData(XFA_Attribute::Href, true).value_or(L"");
-}
-
-XFA_AttributeEnum CXFA_ImageData::GetTransferEncoding() const {
- return static_cast<XFA_AttributeEnum>(
- m_pNode->JSObject()->GetEnum(XFA_Attribute::TransferEncoding));
-}
-
-WideString CXFA_ImageData::GetContent() const {
- return m_pNode->JSObject()->TryContent(false, true).value_or(L"");
-}
-
-void CXFA_ImageData::SetContentType(const WideString& wsContentType) {
- m_pNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType,
- false, false);
-}
-
-void CXFA_ImageData::SetHref(const WideString& wsHref) {
- m_pNode->JSObject()->SetCData(XFA_Attribute::Href, wsHref, false, false);
-}
-
-void CXFA_ImageData::SetTransferEncoding(XFA_AttributeEnum iTransferEncoding) {
- m_pNode->JSObject()->SetEnum(XFA_Attribute::TransferEncoding,
- iTransferEncoding, false);
-}
diff --git a/xfa/fxfa/parser/cxfa_imagedata.h b/xfa/fxfa/parser/cxfa_imagedata.h
deleted file mode 100644
index 9030918541..0000000000
--- a/xfa/fxfa/parser/cxfa_imagedata.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_
-#define XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxfa/parser/cxfa_datadata.h"
-
-class CXFA_Node;
-
-class CXFA_ImageData : public CXFA_DataData {
- public:
- explicit CXFA_ImageData(CXFA_Node* pNode);
-
- XFA_AttributeEnum GetAspect() const;
- WideString GetContent() const;
-
- WideString GetHref() const;
- void SetHref(const WideString& wsHref);
-
- XFA_AttributeEnum GetTransferEncoding() const;
- void SetTransferEncoding(XFA_AttributeEnum iTransferEncoding);
-
- WideString GetContentType() const;
- void SetContentType(const WideString& wsContentType);
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index bc5f9faeff..99cca777dc 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -9,6 +9,7 @@
#include "fxjs/xfa/cjx_value.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/parser/cxfa_arc.h"
+#include "xfa/fxfa/parser/cxfa_image.h"
#include "xfa/fxfa/parser/cxfa_line.h"
#include "xfa/fxfa/parser/cxfa_rectangle.h"
@@ -86,6 +87,6 @@ CXFA_ExDataData CXFA_Value::GetExData() const {
return CXFA_ExDataData(GetNodeItem(XFA_NODEITEM_FirstChild));
}
-CXFA_ImageData CXFA_Value::GetImageData() const {
- return CXFA_ImageData(GetNodeItem(XFA_NODEITEM_FirstChild));
+CXFA_Image* CXFA_Value::GetImage() const {
+ return static_cast<CXFA_Image*>(GetNodeItem(XFA_NODEITEM_FirstChild));
}
diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h
index b5de965557..91483b8832 100644
--- a/xfa/fxfa/parser/cxfa_value.h
+++ b/xfa/fxfa/parser/cxfa_value.h
@@ -10,11 +10,11 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_datadata.h"
#include "xfa/fxfa/parser/cxfa_exdatadata.h"
-#include "xfa/fxfa/parser/cxfa_imagedata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_text.h"
class CXFA_Arc;
+class CXFA_Image;
class CXFA_Line;
class CXFA_Rectangle;
@@ -30,7 +30,7 @@ class CXFA_Value : public CXFA_Node {
CXFA_Rectangle* GetRectangle() const;
CXFA_Text* GetText() const;
CXFA_ExDataData GetExData() const;
- CXFA_ImageData GetImageData() const;
+ CXFA_Image* GetImage() const;
};
#endif // XFA_FXFA_PARSER_CXFA_VALUE_H_
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 5a36083e88..c98597f78e 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -19,6 +19,7 @@
#include "xfa/fxfa/parser/cxfa_datagroup.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_form.h"
+#include "xfa/fxfa/parser/cxfa_image.h"
#include "xfa/fxfa/parser/cxfa_items.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
@@ -137,14 +138,13 @@ void CreateDataBinding(CXFA_Node* pFormNode,
WideString wsValue;
switch (eUIType) {
case XFA_Element::ImageEdit: {
- CXFA_ImageData imageData =
- defValue ? defValue->GetImageData() : CXFA_ImageData(nullptr);
+ CXFA_Image* image = defValue ? defValue->GetImage() : nullptr;
WideString wsContentType;
WideString wsHref;
- if (imageData.HasValidNode()) {
- wsValue = imageData.GetContent();
- wsContentType = imageData.GetContentType();
- wsHref = imageData.GetHref();
+ if (image) {
+ wsValue = image->GetContent();
+ wsContentType = image->GetContentType();
+ wsHref = image->GetHref();
}
CFX_XMLElement* pXMLDataElement =
static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
@@ -290,9 +290,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
case XFA_Element::ImageEdit: {
FormValueNode_SetChildContent(defValue, wsNormalizeValue,
XFA_Element::Image);
- CXFA_ImageData imageData =
- defValue ? defValue->GetImageData() : CXFA_ImageData(nullptr);
- if (imageData.HasValidNode()) {
+ CXFA_Image* image = defValue ? defValue->GetImage() : nullptr;
+ if (image) {
CFX_XMLElement* pXMLDataElement =
static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
@@ -302,12 +301,12 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (!wsContentType.IsEmpty()) {
pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType,
wsContentType, false, false);
- imageData.SetContentType(wsContentType);
+ image->SetContentType(wsContentType);
}
WideString wsHref = pXMLDataElement->GetString(L"href");
if (!wsHref.IsEmpty())
- imageData.SetHref(wsHref);
+ image->SetHref(wsHref);
}
break;
}