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 #ifndef XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ 8 #define XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_system.h" 13 #include "xfa/fxfa/parser/xfa_object.h" 14 15 class CXFA_ContainerLayoutItem; 16 class CXFA_Document; 17 class CXFA_ItemLayoutProcessor; 18 class CXFA_LayoutItem; 19 class CXFA_LayoutPageMgr; 20 class CXFA_Node; 21 class IFX_Pause; 22 23 class CXFA_LayoutProcessor { 24 public: 25 explicit CXFA_LayoutProcessor(CXFA_Document* pDocument); 26 ~CXFA_LayoutProcessor(); 27 28 CXFA_Document* GetDocument() const; 29 int32_t StartLayout(bool bForceRestart = false); 30 int32_t DoLayout(IFX_Pause* pPause = nullptr); 31 bool IncrementLayout(); 32 int32_t CountPages() const; 33 CXFA_ContainerLayoutItem* GetPage(int32_t index) const; 34 CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); 35 void AddChangedContainer(CXFA_Node* pContainer); SetForceReLayout(bool bForceRestart)36 void SetForceReLayout(bool bForceRestart) { m_bNeeLayout = bForceRestart; } 37 CXFA_ContainerLayoutItem* GetRootLayoutItem() const; GetRootRootItemLayoutProcessor()38 CXFA_ItemLayoutProcessor* GetRootRootItemLayoutProcessor() const { 39 return m_pRootItemLayoutProcessor.get(); 40 } GetLayoutPageMgr()41 CXFA_LayoutPageMgr* GetLayoutPageMgr() const { 42 return m_pLayoutPageMgr.get(); 43 } 44 45 private: 46 bool IsNeedLayout(); 47 48 CXFA_Document* const m_pDocument; 49 std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor; 50 std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr; 51 CXFA_NodeArray m_rgChangedContainers; 52 uint32_t m_nProgressCounter; 53 bool m_bNeeLayout; 54 }; 55 56 #endif // XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ 57