| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_SRC_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | |
| 8 #define XFA_SRC_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | |
| 9 | |
| 10 #include "xfa/src/fxfa/parser/xfa_doclayout.h" | |
| 11 #include "xfa/src/fxfa/parser/xfa_layout_itemlayout.h" | |
| 12 | |
| 13 class CXFA_ContainerRecord { | |
| 14 public: | |
| 15 CXFA_ContainerRecord(CXFA_ContainerLayoutItem* pPageSet = NULL, | |
| 16 CXFA_ContainerLayoutItem* pPageArea = NULL, | |
| 17 CXFA_ContainerLayoutItem* pContentArea = NULL) | |
| 18 : pCurPageSet(pPageSet), | |
| 19 pCurPageArea(pPageArea), | |
| 20 pCurContentArea(pContentArea) {} | |
| 21 CXFA_ContainerLayoutItem* pCurPageSet; | |
| 22 CXFA_ContainerLayoutItem* pCurPageArea; | |
| 23 CXFA_ContainerLayoutItem* pCurContentArea; | |
| 24 }; | |
| 25 class CXFA_LayoutPageMgr { | |
| 26 public: | |
| 27 CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor); | |
| 28 ~CXFA_LayoutPageMgr(); | |
| 29 FX_BOOL InitLayoutPage(CXFA_Node* pFormNode); | |
| 30 FX_BOOL PrepareFirstPage(CXFA_Node* pRootSubform); | |
| 31 FX_FLOAT GetAvailHeight(); | |
| 32 FX_BOOL GetNextAvailContentHeight(FX_FLOAT fChildHeight); | |
| 33 void SubmitContentItem(CXFA_ContentLayoutItem* pContentLayoutItem, | |
| 34 XFA_ItemLayoutProcessorResult eStatus); | |
| 35 void FinishPaginatedPageSets(); | |
| 36 void SyncLayoutData(); | |
| 37 int32_t GetPageCount() const; | |
| 38 IXFA_LayoutPage* GetPage(int32_t index) const; | |
| 39 int32_t GetPageIndex(const IXFA_LayoutPage* pPage) const; | |
| 40 inline CXFA_ContainerLayoutItem* GetRootLayoutItem() const { | |
| 41 return m_pPageSetLayoutItemRoot; | |
| 42 } | |
| 43 FX_BOOL ProcessBreakBeforeOrAfter(CXFA_Node* pBreakNode, | |
| 44 FX_BOOL bBefore, | |
| 45 CXFA_Node*& pBreakLeaderNode, | |
| 46 CXFA_Node*& pBreakTrailerNode, | |
| 47 FX_BOOL& bCreatePage); | |
| 48 FX_BOOL ProcessOverflow(CXFA_Node* pFormNode, | |
| 49 CXFA_Node*& pLeaderNode, | |
| 50 CXFA_Node*& pTrailerNode, | |
| 51 FX_BOOL bDataMerge = FALSE, | |
| 52 FX_BOOL bCreatePage = TRUE); | |
| 53 CXFA_Node* QueryOverflow(CXFA_Node* pFormNode, | |
| 54 CXFA_LayoutContext* pLayoutContext = NULL); | |
| 55 FX_BOOL ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode, | |
| 56 FX_BOOL bLeader, | |
| 57 CXFA_Node*& pBookendAppendNode); | |
| 58 CXFA_LayoutItem* FindOrCreateLayoutItem(CXFA_Node* pFormNode); | |
| 59 | |
| 60 protected: | |
| 61 FX_BOOL AppendNewPage(FX_BOOL bFirstTemPage = FALSE); | |
| 62 void ReorderPendingLayoutRecordToTail(CXFA_ContainerRecord* pNewRecord, | |
| 63 CXFA_ContainerRecord* pPrevRecord); | |
| 64 void RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, | |
| 65 CXFA_ContainerRecord* pPrevRecord); | |
| 66 inline CXFA_ContainerRecord* GetCurrentContainerRecord() { | |
| 67 CXFA_ContainerRecord* result = | |
| 68 ((CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetAt( | |
| 69 m_pCurrentContainerRecord)); | |
| 70 ASSERT(result); | |
| 71 return result; | |
| 72 } | |
| 73 CXFA_ContainerRecord* CreateContainerRecord(CXFA_Node* pPageNode = NULL, | |
| 74 FX_BOOL bCreateNew = FALSE); | |
| 75 void AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | |
| 76 CXFA_Node* pNewPageArea); | |
| 77 void AddContentAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | |
| 78 CXFA_Node* pContentArea); | |
| 79 FX_BOOL RunBreak(XFA_ELEMENT eBreakType, | |
| 80 XFA_ATTRIBUTEENUM eTargetType, | |
| 81 CXFA_Node* pTarget, | |
| 82 FX_BOOL bStartNew); | |
| 83 CXFA_Node* BreakOverflow(CXFA_Node* pOverflowNode, | |
| 84 CXFA_Node*& pLeaderTemplate, | |
| 85 CXFA_Node*& pTrailerTemplate, | |
| 86 FX_BOOL bCreatePage = TRUE); | |
| 87 FX_BOOL ResolveBookendLeaderOrTrailer(CXFA_Node* pBookendNode, | |
| 88 FX_BOOL bLeader, | |
| 89 CXFA_Node*& pBookendAppendTemplate); | |
| 90 FX_BOOL ExecuteBreakBeforeOrAfter(CXFA_Node* pCurNode, | |
| 91 FX_BOOL bBefore, | |
| 92 CXFA_Node*& pBreakLeaderTemplate, | |
| 93 CXFA_Node*& pBreakTrailerTemplate); | |
| 94 | |
| 95 int32_t CreateMinPageRecord(CXFA_Node* pPageArea, | |
| 96 FX_BOOL bTargetPageArea, | |
| 97 FX_BOOL bCreateLast = FALSE); | |
| 98 void CreateMinPageSetRecord(CXFA_Node* pPageSet, FX_BOOL bCreateAll = FALSE); | |
| 99 void CreateNextMinRecord(CXFA_Node* pRecordNode); | |
| 100 FX_BOOL FindPageAreaFromPageSet(CXFA_Node* pPageSet, | |
| 101 CXFA_Node* pStartChild, | |
| 102 CXFA_Node* pTargetPageArea = NULL, | |
| 103 CXFA_Node* pTargetContentArea = NULL, | |
| 104 FX_BOOL bNewPage = FALSE, | |
| 105 FX_BOOL bQuery = FALSE); | |
| 106 FX_BOOL FindPageAreaFromPageSet_Ordered(CXFA_Node* pPageSet, | |
| 107 CXFA_Node* pStartChild, | |
| 108 CXFA_Node* pTargetPageArea = NULL, | |
| 109 CXFA_Node* pTargetContentArea = NULL, | |
| 110 FX_BOOL bNewPage = FALSE, | |
| 111 FX_BOOL bQuery = FALSE); | |
| 112 FX_BOOL FindPageAreaFromPageSet_SimplexDuplex( | |
| 113 CXFA_Node* pPageSet, | |
| 114 CXFA_Node* pStartChild, | |
| 115 CXFA_Node* pTargetPageArea = NULL, | |
| 116 CXFA_Node* pTargetContentArea = NULL, | |
| 117 FX_BOOL bNewPage = FALSE, | |
| 118 FX_BOOL bQuery = FALSE, | |
| 119 XFA_ATTRIBUTEENUM ePreferredPosition = XFA_ATTRIBUTEENUM_First); | |
| 120 FX_BOOL MatchPageAreaOddOrEven(CXFA_Node* pPageArea, FX_BOOL bLastMatch); | |
| 121 CXFA_Node* GetNextAvailPageArea(CXFA_Node* pTargetPageArea, | |
| 122 CXFA_Node* pTargetContentArea = NULL, | |
| 123 FX_BOOL bNewPage = FALSE, | |
| 124 FX_BOOL bQuery = FALSE); | |
| 125 FX_BOOL GetNextContentArea(CXFA_Node* pTargetContentArea); | |
| 126 void InitPageSetMap(); | |
| 127 void ProcessLastPageSet(); | |
| 128 inline FX_BOOL IsPageSetRootOrderedOccurrence() { | |
| 129 return m_ePageSetMode == XFA_ATTRIBUTEENUM_OrderedOccurrence; | |
| 130 } | |
| 131 void ClearData(); | |
| 132 void ClearRecordList(); | |
| 133 void MergePageSetContents(); | |
| 134 void LayoutPageSetContents(); | |
| 135 void PrepareLayout(); | |
| 136 void SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem); | |
| 137 CXFA_LayoutProcessor* m_pLayoutProcessor; | |
| 138 CXFA_Node* m_pTemplatePageSetRoot; | |
| 139 CXFA_ContainerLayoutItem* m_pPageSetLayoutItemRoot; | |
| 140 CXFA_ContainerLayoutItem* m_pPageSetCurRoot; | |
| 141 FX_POSITION m_pCurrentContainerRecord; | |
| 142 CFX_PtrList m_rgProposedContainerRecord; | |
| 143 CXFA_Node* m_pCurPageArea; | |
| 144 int32_t m_nAvailPages; | |
| 145 int32_t m_nCurPageCount; | |
| 146 XFA_ATTRIBUTEENUM m_ePageSetMode; | |
| 147 FX_BOOL m_bCreateOverFlowPage; | |
| 148 CFX_MapPtrTemplate<CXFA_Node*, int32_t> m_pPageSetMap; | |
| 149 CFX_ArrayTemplate<CXFA_ContainerLayoutItem*> m_PageArray; | |
| 150 }; | |
| 151 | |
| 152 #endif // XFA_SRC_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | |
| OLD | NEW |