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 CXFA_Para(CXFA_Node * pNode)12CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {} 13 GetHorizontalAlign()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 GetVerticalAlign()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 GetLineHeight()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 GetMarginLeft()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 GetMarginRight()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 GetSpaceAbove()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 GetSpaceBelow()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 GetTextIndent()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