summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_widgetacc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 20:09:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 20:09:43 +0000
commit0821c95ee9f132f77f3670a7dbbf114a82a6b9a0 (patch)
treefd736c2764ee7b1e187995548a608ed431601ac7 /xfa/fxfa/cxfa_widgetacc.cpp
parentdcbb8e53e604178dc97d12846ddbdef88be41297 (diff)
downloadpdfium-0821c95ee9f132f77f3670a7dbbf114a82a6b9a0.tar.xz
Fold CXFA_ValueData into CXFA_Value
The CXFA_ValueData class is a thin wrapper around the CXFA_Value, this CL moves the methods from CXFA_ValueData into CXFA_Value. Change-Id: I2c57e93e5c4675b82af71cf75f2dfc0fb12e4b20 Reviewed-on: https://pdfium-review.googlesource.com/21170 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_widgetacc.cpp')
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 74717b998c..65c4649fed 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -25,6 +25,7 @@
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
+#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/xfa_utils.h"
class CXFA_WidgetLayoutData {
@@ -70,11 +71,11 @@ class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData {
if (m_pDIBitmap)
return true;
- CXFA_ValueData valueData = pAcc->GetFormValueData();
- if (!valueData.HasValidNode())
+ CXFA_Value* value = pAcc->GetFormValue();
+ if (!value)
return false;
- CXFA_ImageData imageData = valueData.GetImageData();
+ CXFA_ImageData imageData = value->GetImageData();
if (!imageData.HasValidNode())
return false;
@@ -130,11 +131,11 @@ class CXFA_ImageEditData : public CXFA_FieldLayoutData {
if (m_pDIBitmap)
return true;
- CXFA_ValueData valueData = pAcc->GetFormValueData();
- if (!valueData.HasValidNode())
+ CXFA_Value* value = pAcc->GetFormValue();
+ if (!value)
return false;
- CXFA_ImageData imageData = valueData.GetImageData();
+ CXFA_ImageData imageData = value->GetImageData();
CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageData, m_bNamedImage,
m_iImageXDpi, m_iImageYDpi));
@@ -171,8 +172,9 @@ void CXFA_WidgetAcc::ResetData() {
XFA_Element eUIType = GetUIType();
switch (eUIType) {
case XFA_Element::ImageEdit: {
- CXFA_ValueData imageValueData = GetDefaultValueData();
- CXFA_ImageData imageData = imageValueData.GetImageData();
+ CXFA_Value* imageValue = GetDefaultValue();
+ CXFA_ImageData imageData =
+ imageValue ? imageValue->GetImageData() : CXFA_ImageData(nullptr);
WideString wsContentType, wsHref;
if (imageData.HasValidNode()) {
wsValue = imageData.GetContent();
@@ -194,9 +196,9 @@ void CXFA_WidgetAcc::ResetData() {
bool done = false;
if (wsValue.IsEmpty()) {
- CXFA_ValueData defValueData = pAcc->GetDefaultValueData();
- if (defValueData.HasValidNode()) {
- wsValue = defValueData.GetChildValueContent();
+ CXFA_Value* defValue = pAcc->GetDefaultValue();
+ if (defValue) {
+ wsValue = defValue->GetChildValueContent();
SetValue(XFA_VALUEPICTURE_Raw, wsValue);
pAcc->SetValue(XFA_VALUEPICTURE_Raw, wsValue);
done = true;
@@ -223,9 +225,9 @@ void CXFA_WidgetAcc::ResetData() {
case XFA_Element::ChoiceList:
ClearAllSelections();
default: {
- CXFA_ValueData defValueData = GetDefaultValueData();
- if (defValueData.HasValidNode())
- wsValue = defValueData.GetChildValueContent();
+ CXFA_Value* defValue = GetDefaultValue();
+ if (defValue)
+ wsValue = defValue->GetChildValueContent();
SetValue(XFA_VALUEPICTURE_Raw, wsValue);
break;
@@ -236,7 +238,8 @@ void CXFA_WidgetAcc::ResetData() {
void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType,
const WideString& wsHref,
const WideString& wsData) {
- CXFA_ImageData imageData = GetFormValueData().GetImageData();
+ CXFA_ImageData imageData =
+ GetFormValue() ? GetFormValue()->GetImageData() : CXFA_ImageData(nullptr);
if (imageData.HasValidNode()) {
imageData.SetContentType(WideString(wsContentType));
imageData.SetHref(wsHref);
@@ -497,9 +500,9 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
if (!bVersionFlag) {
CXFA_CaptionData captionData = GetCaptionData();
if (captionData.HasValidNode()) {
- CXFA_ValueData capValue = captionData.GetValueData();
- if (capValue.HasValidNode()) {
- CXFA_TextData captionTextData = capValue.GetTextData();
+ CXFA_Value* capValue = captionData.GetValue();
+ if (capValue) {
+ CXFA_TextData captionTextData = capValue->GetTextData();
if (captionTextData.HasValidNode())
wsCaptionName = captionTextData.GetContent();
}