| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 7 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/parser/xfa_basic_imp.h" | 9 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
| 10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 delete m_pRootItemLayoutProcessor; | 49 delete m_pRootItemLayoutProcessor; |
| 50 m_pRootItemLayoutProcessor = nullptr; | 50 m_pRootItemLayoutProcessor = nullptr; |
| 51 m_nProgressCounter = 0; | 51 m_nProgressCounter = 0; |
| 52 CXFA_Node* pFormPacketNode = | 52 CXFA_Node* pFormPacketNode = |
| 53 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | 53 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); |
| 54 if (!pFormPacketNode) { | 54 if (!pFormPacketNode) { |
| 55 return -1; | 55 return -1; |
| 56 } | 56 } |
| 57 CXFA_Node* pFormRoot = | 57 CXFA_Node* pFormRoot = |
| 58 pFormPacketNode->GetFirstChildByClass(XFA_ELEMENT_Subform); | 58 pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform); |
| 59 if (!pFormRoot) { | 59 if (!pFormRoot) { |
| 60 return -1; | 60 return -1; |
| 61 } | 61 } |
| 62 if (!m_pLayoutPageMgr) { | 62 if (!m_pLayoutPageMgr) { |
| 63 m_pLayoutPageMgr = new CXFA_LayoutPageMgr(this); | 63 m_pLayoutPageMgr = new CXFA_LayoutPageMgr(this); |
| 64 } | 64 } |
| 65 if (!m_pLayoutPageMgr->InitLayoutPage(pFormRoot)) { | 65 if (!m_pLayoutPageMgr->InitLayoutPage(pFormRoot)) { |
| 66 return -1; | 66 return -1; |
| 67 } | 67 } |
| 68 if (!m_pLayoutPageMgr->PrepareFirstPage(pFormRoot)) { | 68 if (!m_pLayoutPageMgr->PrepareFirstPage(pFormRoot)) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { | 172 int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { |
| 173 return m_pFormNode->GetDocument() | 173 return m_pFormNode->GetDocument() |
| 174 ->GetLayoutProcessor() | 174 ->GetLayoutProcessor() |
| 175 ->GetLayoutPageMgr() | 175 ->GetLayoutPageMgr() |
| 176 ->GetPageIndex(this); | 176 ->GetPageIndex(this); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) const { | 179 void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) const { |
| 180 size.clear(); | 180 size.clear(); |
| 181 CXFA_Node* pMedium = m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Medium); | 181 CXFA_Node* pMedium = m_pFormNode->GetFirstChildByClass(XFA_Element::Medium); |
| 182 if (!pMedium) | 182 if (!pMedium) |
| 183 return; | 183 return; |
| 184 | 184 |
| 185 size = CFX_SizeF(pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt), | 185 size = CFX_SizeF(pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt), |
| 186 pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt)); | 186 pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt)); |
| 187 if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) == | 187 if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) == |
| 188 XFA_ATTRIBUTEENUM_Landscape) { | 188 XFA_ATTRIBUTEENUM_Landscape) { |
| 189 size = CFX_SizeF(size.y, size.x); | 189 size = CFX_SizeF(size.y, size.x); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const { | 193 CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const { |
| 194 return m_pFormNode; | 194 return m_pFormNode; |
| 195 } | 195 } |
| 196 CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) | 196 CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) |
| 197 : CXFA_LayoutItem(pNode, TRUE), | 197 : CXFA_LayoutItem(pNode, TRUE), |
| 198 m_pPrev(NULL), | 198 m_pPrev(NULL), |
| 199 m_pNext(NULL), | 199 m_pNext(NULL), |
| 200 m_dwStatus(0) {} | 200 m_dwStatus(0) {} |
| 201 CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { | 201 CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { |
| 202 if (m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY) == this) { | 202 if (m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY) == this) { |
| 203 m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); | 203 m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); |
| 204 } | 204 } |
| 205 } | 205 } |
| OLD | NEW |