summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_margindata.cpp
blob: 3af83522630d1f87bda08dccb10e878ac643ecfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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_margindata.h"

CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}

float CXFA_MarginData::GetLeftInset() const {
  return TryLeftInset().value_or(0);
}

float CXFA_MarginData::GetTopInset() const {
  return TryTopInset().value_or(0);
}

float CXFA_MarginData::GetRightInset() const {
  return TryRightInset().value_or(0);
}

float CXFA_MarginData::GetBottomInset() const {
  return TryBottomInset().value_or(0);
}

pdfium::Optional<float> CXFA_MarginData::TryLeftInset() const {
  float value = 0;
  if (TryMeasure(XFA_Attribute::LeftInset, value))
    return {value};
  return {};
}

pdfium::Optional<float> CXFA_MarginData::TryTopInset() const {
  float value = 0;
  if (TryMeasure(XFA_Attribute::TopInset, value))
    return {value};
  return {};
}

pdfium::Optional<float> CXFA_MarginData::TryRightInset() const {
  float value = 0;
  if (TryMeasure(XFA_Attribute::RightInset, value))
    return {value};
  return {};
}

pdfium::Optional<float> CXFA_MarginData::TryBottomInset() const {
  float value = 0;
  if (TryMeasure(XFA_Attribute::BottomInset, value))
    return {value};
  return {};
}