summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_caption.cpp39
-rw-r--r--xfa/fxfa/parser/cxfa_caption.h12
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.cpp56
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.h30
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h5
6 files changed, 57 insertions, 91 deletions
diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp
index 8148b443e5..1af834a277 100644
--- a/xfa/fxfa/parser/cxfa_caption.cpp
+++ b/xfa/fxfa/parser/cxfa_caption.cpp
@@ -8,6 +8,10 @@
#include "fxjs/xfa/cjx_caption.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_font.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_value.h"
namespace {
@@ -42,3 +46,38 @@ CXFA_Caption::CXFA_Caption(CXFA_Document* doc, XFA_PacketType packet)
pdfium::MakeUnique<CJX_Caption>(this)) {}
CXFA_Caption::~CXFA_Caption() {}
+
+bool CXFA_Caption::IsVisible() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::Presence, true)
+ .value_or(XFA_AttributeEnum::Visible) ==
+ XFA_AttributeEnum::Visible;
+}
+
+bool CXFA_Caption::IsHidden() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::Presence, true)
+ .value_or(XFA_AttributeEnum::Visible) == XFA_AttributeEnum::Hidden;
+}
+
+XFA_AttributeEnum CXFA_Caption::GetPlacementType() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::Placement, true)
+ .value_or(XFA_AttributeEnum::Left);
+}
+
+float CXFA_Caption::GetReserve() const {
+ return JSObject()->GetMeasure(XFA_Attribute::Reserve).ToUnit(XFA_Unit::Pt);
+}
+
+CXFA_Margin* CXFA_Caption::GetMargin() {
+ return GetChild<CXFA_Margin>(0, XFA_Element::Margin, false);
+}
+
+CXFA_FontData CXFA_Caption::GetFontData() {
+ return CXFA_FontData(GetChild<CXFA_Font>(0, XFA_Element::Font, false));
+}
+
+CXFA_Value* CXFA_Caption::GetValue() {
+ return GetChild<CXFA_Value>(0, XFA_Element::Value, false);
+}
diff --git a/xfa/fxfa/parser/cxfa_caption.h b/xfa/fxfa/parser/cxfa_caption.h
index 8d6ce13fb9..7a52254d77 100644
--- a/xfa/fxfa/parser/cxfa_caption.h
+++ b/xfa/fxfa/parser/cxfa_caption.h
@@ -7,12 +7,24 @@
#ifndef XFA_FXFA_PARSER_CXFA_CAPTION_H_
#define XFA_FXFA_PARSER_CXFA_CAPTION_H_
+#include "xfa/fxfa/parser/cxfa_fontdata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+class CXFA_Margin;
+class CXFA_Value;
+
class CXFA_Caption : public CXFA_Node {
public:
CXFA_Caption(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Caption() override;
+
+ bool IsVisible();
+ bool IsHidden();
+ XFA_AttributeEnum GetPlacementType();
+ float GetReserve() const;
+ CXFA_Margin* GetMargin();
+ CXFA_FontData GetFontData();
+ CXFA_Value* GetValue();
};
#endif // XFA_FXFA_PARSER_CXFA_CAPTION_H_
diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp
deleted file mode 100644
index 276d10c354..0000000000
--- a/xfa/fxfa/parser/cxfa_captiondata.cpp
+++ /dev/null
@@ -1,56 +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_captiondata.h"
-
-#include "xfa/fxfa/parser/cxfa_font.h"
-#include "xfa/fxfa/parser/cxfa_margin.h"
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/cxfa_node.h"
-#include "xfa/fxfa/parser/cxfa_value.h"
-
-CXFA_CaptionData::CXFA_CaptionData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-bool CXFA_CaptionData::IsVisible() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::Presence, true)
- .value_or(XFA_AttributeEnum::Visible) ==
- XFA_AttributeEnum::Visible;
-}
-
-bool CXFA_CaptionData::IsHidden() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::Presence, true)
- .value_or(XFA_AttributeEnum::Visible) == XFA_AttributeEnum::Hidden;
-}
-
-XFA_AttributeEnum CXFA_CaptionData::GetPlacementType() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::Placement, true)
- .value_or(XFA_AttributeEnum::Left);
-}
-
-float CXFA_CaptionData::GetReserve() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::Reserve)
- .ToUnit(XFA_Unit::Pt);
-}
-
-CXFA_Margin* CXFA_CaptionData::GetMargin() const {
- return m_pNode ? m_pNode->GetChild<CXFA_Margin>(0, XFA_Element::Margin, false)
- : nullptr;
-}
-
-CXFA_FontData CXFA_CaptionData::GetFontData() const {
- return CXFA_FontData(
- m_pNode ? m_pNode->GetChild<CXFA_Font>(0, XFA_Element::Font, false)
- : nullptr);
-}
-
-CXFA_Value* CXFA_CaptionData::GetValue() const {
- return m_pNode ? m_pNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false)
- : nullptr;
-}
diff --git a/xfa/fxfa/parser/cxfa_captiondata.h b/xfa/fxfa/parser/cxfa_captiondata.h
deleted file mode 100644
index 4b526b6754..0000000000
--- a/xfa/fxfa/parser/cxfa_captiondata.h
+++ /dev/null
@@ -1,30 +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_CAPTIONDATA_H_
-#define XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_
-
-#include "xfa/fxfa/parser/cxfa_datadata.h"
-#include "xfa/fxfa/parser/cxfa_fontdata.h"
-
-class CXFA_Margin;
-class CXFA_Node;
-class CXFA_Value;
-
-class CXFA_CaptionData : public CXFA_DataData {
- public:
- explicit CXFA_CaptionData(CXFA_Node* pNode);
-
- bool IsVisible() const;
- bool IsHidden() const;
- XFA_AttributeEnum GetPlacementType() const;
- float GetReserve() const;
- CXFA_Margin* GetMargin() const;
- CXFA_FontData GetFontData() const;
- CXFA_Value* GetValue() const;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 8fef4b4418..1351c77be2 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -265,9 +265,9 @@ CXFA_Border* CXFA_WidgetData::GetBorder(bool bModified) {
bModified);
}
-CXFA_CaptionData CXFA_WidgetData::GetCaptionData() {
- return CXFA_CaptionData(m_pNode->JSObject()->GetProperty<CXFA_Caption>(
- 0, XFA_Element::Caption, false));
+CXFA_Caption* CXFA_WidgetData::GetCaption() {
+ return m_pNode->JSObject()->GetProperty<CXFA_Caption>(0, XFA_Element::Caption,
+ false);
}
CXFA_FontData CXFA_WidgetData::GetFontData(bool bModified) {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index d8dee8a2a3..57548e329c 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -15,7 +15,6 @@
#include "core/fxcrt/fx_system.h"
#include "fxbarcode/BC_Library.h"
#include "xfa/fxfa/parser/cxfa_binddata.h"
-#include "xfa/fxfa/parser/cxfa_captiondata.h"
#include "xfa/fxfa/parser/cxfa_datadata.h"
#include "xfa/fxfa/parser/cxfa_fontdata.h"
@@ -34,9 +33,11 @@ enum XFA_VALUEPICTURE {
class CXFA_Border;
class CXFA_Calculate;
+class CXFA_Caption;
class CXFA_Margin;
class CXFA_Node;
class CXFA_Para;
+class CXFA_Value;
class CXFA_Validate;
class IFX_Locale;
@@ -59,7 +60,7 @@ class CXFA_WidgetData : public CXFA_DataData {
bool IsMultiLine();
CXFA_Border* GetBorder(bool bModified);
- CXFA_CaptionData GetCaptionData();
+ CXFA_Caption* GetCaption();
CXFA_FontData GetFontData(bool bModified);
CXFA_Margin* GetMargin();
CXFA_Para* GetPara();