dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 1 | // Copyright 2016 PDFium Authors. All rights reserved. |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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 | |
dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 7 | #ifndef XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ |
| 8 | #define XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
tsepez | 469f6da | 2017-01-05 19:21:39 -0800 | [diff] [blame] | 10 | #include <memory> |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 11 | #include <vector> |
tsepez | 469f6da | 2017-01-05 19:21:39 -0800 | [diff] [blame] | 12 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 13 | #include "core/fxcrt/fx_system.h" |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame^] | 14 | #include "core/fxcrt/unowned_ptr.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 15 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 16 | class CXFA_ContainerLayoutItem; |
dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 17 | class CXFA_Document; |
| 18 | class CXFA_ItemLayoutProcessor; |
| 19 | class CXFA_LayoutItem; |
| 20 | class CXFA_LayoutPageMgr; |
| 21 | class CXFA_Node; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 22 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 23 | class CXFA_LayoutProcessor { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 24 | public: |
Dan Sinclair | 85c8e7f | 2016-11-21 13:50:32 -0500 | [diff] [blame] | 25 | explicit CXFA_LayoutProcessor(CXFA_Document* pDocument); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 26 | ~CXFA_LayoutProcessor(); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 27 | |
| 28 | CXFA_Document* GetDocument() const; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 29 | int32_t StartLayout(bool bForceRestart = false); |
Dan Sinclair | df673c2 | 2017-05-04 12:09:52 -0400 | [diff] [blame] | 30 | int32_t DoLayout(); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 31 | bool IncrementLayout(); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 32 | int32_t CountPages() const; |
| 33 | CXFA_ContainerLayoutItem* GetPage(int32_t index) const; |
| 34 | CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 35 | void AddChangedContainer(CXFA_Node* pContainer); |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 36 | void SetForceReLayout(bool bForceRestart) { m_bNeedLayout = bForceRestart; } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 37 | CXFA_ContainerLayoutItem* GetRootLayoutItem() const; |
tsepez | 469f6da | 2017-01-05 19:21:39 -0800 | [diff] [blame] | 38 | CXFA_ItemLayoutProcessor* GetRootRootItemLayoutProcessor() const { |
| 39 | return m_pRootItemLayoutProcessor.get(); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 40 | } |
tsepez | 469f6da | 2017-01-05 19:21:39 -0800 | [diff] [blame] | 41 | CXFA_LayoutPageMgr* GetLayoutPageMgr() const { |
| 42 | return m_pLayoutPageMgr.get(); |
| 43 | } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 44 | |
dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 45 | private: |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 46 | bool IsNeedLayout(); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 47 | |
Dan Sinclair | aee0db0 | 2017-09-21 16:53:58 -0400 | [diff] [blame^] | 48 | UnownedPtr<CXFA_Document> const m_pDocument; |
tsepez | 469f6da | 2017-01-05 19:21:39 -0800 | [diff] [blame] | 49 | std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor; |
| 50 | std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr; |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 51 | std::vector<CXFA_Node*> m_rgChangedContainers; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 52 | uint32_t m_nProgressCounter; |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 53 | bool m_bNeedLayout; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 54 | }; |
| 55 | |
dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 56 | #endif // XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_ |