diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-03 12:15:53 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-03 18:22:31 +0000 |
commit | fa50df5605a14ca4c9ba440506685981f1c8b04b (patch) | |
tree | 993f3af23213e8c86c62314b502f6144ce13688b /xfa/fxfa/parser/cxfa_caption.cpp | |
parent | 39628b04bc86461426f2dcf5a568f5e9e70ad997 (diff) | |
download | pdfium-fa50df5605a14ca4c9ba440506685981f1c8b04b.tar.xz |
Fold CXFA_CaptionData into CXFA_Caption
This CL folds the CXFA_CaptionData wrapper class into CXFA_Caption.
Change-Id: I65302656a89985dec4d0ec1f42b5eaa95d22aae2
Reviewed-on: https://pdfium-review.googlesource.com/22150
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_caption.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_caption.cpp | 39 |
1 files changed, 39 insertions, 0 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); +} |