cxfa_para.cpp revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
1// Copyright 2016 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "xfa/fxfa/parser/cxfa_para.h"
8
9#include "xfa/fxfa/parser/cxfa_measurement.h"
10#include "xfa/fxfa/parser/xfa_object.h"
11
12CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {}
13
14int32_t CXFA_Para::GetHorizontalAlign() {
15  XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
16  m_pNode->TryEnum(XFA_ATTRIBUTE_HAlign, eAttr);
17  return eAttr;
18}
19
20int32_t CXFA_Para::GetVerticalAlign() {
21  XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Top;
22  m_pNode->TryEnum(XFA_ATTRIBUTE_VAlign, eAttr);
23  return eAttr;
24}
25
26FX_FLOAT CXFA_Para::GetLineHeight() {
27  CXFA_Measurement ms;
28  m_pNode->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms);
29  return ms.ToUnit(XFA_UNIT_Pt);
30}
31
32FX_FLOAT CXFA_Para::GetMarginLeft() {
33  CXFA_Measurement ms;
34  m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms);
35  return ms.ToUnit(XFA_UNIT_Pt);
36}
37
38FX_FLOAT CXFA_Para::GetMarginRight() {
39  CXFA_Measurement ms;
40  m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms);
41  return ms.ToUnit(XFA_UNIT_Pt);
42}
43
44FX_FLOAT CXFA_Para::GetSpaceAbove() {
45  CXFA_Measurement ms;
46  m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms);
47  return ms.ToUnit(XFA_UNIT_Pt);
48}
49
50FX_FLOAT CXFA_Para::GetSpaceBelow() {
51  CXFA_Measurement ms;
52  m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms);
53  return ms.ToUnit(XFA_UNIT_Pt);
54}
55
56FX_FLOAT CXFA_Para::GetTextIndent() {
57  CXFA_Measurement ms;
58  m_pNode->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms);
59  return ms.ToUnit(XFA_UNIT_Pt);
60}
61