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/fm2js/xfa_fm2jsapi.h" | 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
10 #include "xfa/fxfa/parser/xfa_basic_imp.h" | 10 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "xfa/fxfa/parser/xfa_script.h" | 21 #include "xfa/fxfa/parser/xfa_script.h" |
22 #include "xfa/fxfa/parser/xfa_utils.h" | 22 #include "xfa/fxfa/parser/xfa_utils.h" |
23 | 23 |
24 CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() { | 24 CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() { |
25 if (!m_pLayoutProcessor) { | 25 if (!m_pLayoutProcessor) { |
26 m_pLayoutProcessor = new CXFA_LayoutProcessor(this); | 26 m_pLayoutProcessor = new CXFA_LayoutProcessor(this); |
27 ASSERT(m_pLayoutProcessor); | 27 ASSERT(m_pLayoutProcessor); |
28 } | 28 } |
29 return m_pLayoutProcessor; | 29 return m_pLayoutProcessor; |
30 } | 30 } |
31 IXFA_DocLayout* CXFA_Document::GetDocLayout() { | 31 CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() { |
32 return GetLayoutProcessor(); | 32 return GetLayoutProcessor(); |
33 } | 33 } |
34 CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) | 34 CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) |
35 : m_pDocument(pDocument), | 35 : m_pDocument(pDocument), |
36 m_pRootItemLayoutProcessor(NULL), | 36 m_pRootItemLayoutProcessor(NULL), |
37 m_pLayoutPageMgr(NULL), | 37 m_pLayoutPageMgr(NULL), |
38 m_nProgressCounter(0), | 38 m_nProgressCounter(0), |
39 m_bNeeLayout(TRUE) {} | 39 m_bNeeLayout(TRUE) {} |
40 CXFA_LayoutProcessor::~CXFA_LayoutProcessor() { | 40 CXFA_LayoutProcessor::~CXFA_LayoutProcessor() { |
41 ClearLayoutData(); | 41 ClearLayoutData(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 pParentNode)) { | 126 pParentNode)) { |
127 return FALSE; | 127 return FALSE; |
128 } | 128 } |
129 } | 129 } |
130 m_rgChangedContainers.RemoveAll(); | 130 m_rgChangedContainers.RemoveAll(); |
131 return TRUE; | 131 return TRUE; |
132 } | 132 } |
133 int32_t CXFA_LayoutProcessor::CountPages() const { | 133 int32_t CXFA_LayoutProcessor::CountPages() const { |
134 return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0; | 134 return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPageCount() : 0; |
135 } | 135 } |
136 IXFA_LayoutPage* CXFA_LayoutProcessor::GetPage(int32_t index) const { | 136 CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { |
137 return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL; | 137 return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL; |
138 } | 138 } |
139 CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { | 139 CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { |
140 return static_cast<CXFA_LayoutItem*>( | 140 return static_cast<CXFA_LayoutItem*>( |
141 pFormItem->GetUserData(XFA_LAYOUTITEMKEY)); | 141 pFormItem->GetUserData(XFA_LAYOUTITEMKEY)); |
142 } | 142 } |
143 void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { | 143 void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { |
144 if (m_rgChangedContainers.Find(pContainer) < 0) { | 144 if (m_rgChangedContainers.Find(pContainer) < 0) { |
145 m_rgChangedContainers.Add(pContainer); | 145 m_rgChangedContainers.Add(pContainer); |
146 } | 146 } |
(...skipping 17 matching lines...) Expand all Loading... |
164 } | 164 } |
165 CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem) | 165 CXFA_LayoutItem::CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem) |
166 : m_pFormNode(pNode), | 166 : m_pFormNode(pNode), |
167 m_pParent(NULL), | 167 m_pParent(NULL), |
168 m_pNextSibling(NULL), | 168 m_pNextSibling(NULL), |
169 m_pFirstChild(NULL), | 169 m_pFirstChild(NULL), |
170 m_bIsContentLayoutItem(bIsContentLayoutItem) {} | 170 m_bIsContentLayoutItem(bIsContentLayoutItem) {} |
171 CXFA_LayoutItem::~CXFA_LayoutItem() {} | 171 CXFA_LayoutItem::~CXFA_LayoutItem() {} |
172 CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) | 172 CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode) |
173 : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {} | 173 : CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {} |
174 IXFA_DocLayout* CXFA_ContainerLayoutItem::GetLayout() const { | 174 CXFA_LayoutProcessor* CXFA_ContainerLayoutItem::GetLayout() const { |
175 return m_pFormNode->GetDocument()->GetLayoutProcessor(); | 175 return m_pFormNode->GetDocument()->GetLayoutProcessor(); |
176 } | 176 } |
177 int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { | 177 int32_t CXFA_ContainerLayoutItem::GetPageIndex() const { |
178 return m_pFormNode->GetDocument() | 178 return m_pFormNode->GetDocument() |
179 ->GetLayoutProcessor() | 179 ->GetLayoutProcessor() |
180 ->GetLayoutPageMgr() | 180 ->GetLayoutPageMgr() |
181 ->GetPageIndex(this); | 181 ->GetPageIndex(this); |
182 } | 182 } |
183 void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) { | 183 void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) { |
184 size.clear(); | 184 size.clear(); |
(...skipping 14 matching lines...) Expand all Loading... |
199 CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) | 199 CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) |
200 : CXFA_LayoutItem(pNode, TRUE), | 200 : CXFA_LayoutItem(pNode, TRUE), |
201 m_pPrev(NULL), | 201 m_pPrev(NULL), |
202 m_pNext(NULL), | 202 m_pNext(NULL), |
203 m_dwStatus(0) {} | 203 m_dwStatus(0) {} |
204 CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { | 204 CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { |
205 if (m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY) == this) { | 205 if (m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY) == this) { |
206 m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); | 206 m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, NULL); |
207 } | 207 } |
208 } | 208 } |
OLD | NEW |