| 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 #ifndef XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ |
| 8 #define XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | 8 #define XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ |
| 9 | 9 |
| 10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 11 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" | 11 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" |
| 12 | 12 |
| 13 class CXFA_ContainerRecord { | 13 class CXFA_ContainerRecord { |
| 14 public: | 14 public: |
| 15 CXFA_ContainerRecord(CXFA_ContainerLayoutItem* pPageSet = NULL, | 15 CXFA_ContainerRecord(CXFA_ContainerLayoutItem* pPageSet = nullptr, |
| 16 CXFA_ContainerLayoutItem* pPageArea = NULL, | 16 CXFA_ContainerLayoutItem* pPageArea = nullptr, |
| 17 CXFA_ContainerLayoutItem* pContentArea = NULL) | 17 CXFA_ContainerLayoutItem* pContentArea = nullptr) |
| 18 : pCurPageSet(pPageSet), | 18 : pCurPageSet(pPageSet), |
| 19 pCurPageArea(pPageArea), | 19 pCurPageArea(pPageArea), |
| 20 pCurContentArea(pContentArea) {} | 20 pCurContentArea(pContentArea) {} |
| 21 CXFA_ContainerLayoutItem* pCurPageSet; | 21 CXFA_ContainerLayoutItem* pCurPageSet; |
| 22 CXFA_ContainerLayoutItem* pCurPageArea; | 22 CXFA_ContainerLayoutItem* pCurPageArea; |
| 23 CXFA_ContainerLayoutItem* pCurContentArea; | 23 CXFA_ContainerLayoutItem* pCurContentArea; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class CXFA_LayoutPageMgr { | 26 class CXFA_LayoutPageMgr { |
| 27 public: | 27 public: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 FX_BOOL bBefore, | 46 FX_BOOL bBefore, |
| 47 CXFA_Node*& pBreakLeaderNode, | 47 CXFA_Node*& pBreakLeaderNode, |
| 48 CXFA_Node*& pBreakTrailerNode, | 48 CXFA_Node*& pBreakTrailerNode, |
| 49 FX_BOOL& bCreatePage); | 49 FX_BOOL& bCreatePage); |
| 50 FX_BOOL ProcessOverflow(CXFA_Node* pFormNode, | 50 FX_BOOL ProcessOverflow(CXFA_Node* pFormNode, |
| 51 CXFA_Node*& pLeaderNode, | 51 CXFA_Node*& pLeaderNode, |
| 52 CXFA_Node*& pTrailerNode, | 52 CXFA_Node*& pTrailerNode, |
| 53 FX_BOOL bDataMerge = FALSE, | 53 FX_BOOL bDataMerge = FALSE, |
| 54 FX_BOOL bCreatePage = TRUE); | 54 FX_BOOL bCreatePage = TRUE); |
| 55 CXFA_Node* QueryOverflow(CXFA_Node* pFormNode, | 55 CXFA_Node* QueryOverflow(CXFA_Node* pFormNode, |
| 56 CXFA_LayoutContext* pLayoutContext = NULL); | 56 CXFA_LayoutContext* pLayoutContext = nullptr); |
| 57 FX_BOOL ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode, | 57 FX_BOOL ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode, |
| 58 FX_BOOL bLeader, | 58 FX_BOOL bLeader, |
| 59 CXFA_Node*& pBookendAppendNode); | 59 CXFA_Node*& pBookendAppendNode); |
| 60 CXFA_LayoutItem* FindOrCreateLayoutItem(CXFA_Node* pFormNode); | 60 CXFA_LayoutItem* FindOrCreateLayoutItem(CXFA_Node* pFormNode); |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 FX_BOOL AppendNewPage(FX_BOOL bFirstTemPage = FALSE); | 63 FX_BOOL AppendNewPage(FX_BOOL bFirstTemPage = FALSE); |
| 64 void ReorderPendingLayoutRecordToTail(CXFA_ContainerRecord* pNewRecord, | 64 void ReorderPendingLayoutRecordToTail(CXFA_ContainerRecord* pNewRecord, |
| 65 CXFA_ContainerRecord* pPrevRecord); | 65 CXFA_ContainerRecord* pPrevRecord); |
| 66 void RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, | 66 void RemoveLayoutRecord(CXFA_ContainerRecord* pNewRecord, |
| 67 CXFA_ContainerRecord* pPrevRecord); | 67 CXFA_ContainerRecord* pPrevRecord); |
| 68 inline CXFA_ContainerRecord* GetCurrentContainerRecord() { | 68 inline CXFA_ContainerRecord* GetCurrentContainerRecord() { |
| 69 CXFA_ContainerRecord* result = | 69 CXFA_ContainerRecord* result = |
| 70 ((CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetAt( | 70 ((CXFA_ContainerRecord*)m_rgProposedContainerRecord.GetAt( |
| 71 m_pCurrentContainerRecord)); | 71 m_pCurrentContainerRecord)); |
| 72 ASSERT(result); | 72 ASSERT(result); |
| 73 return result; | 73 return result; |
| 74 } | 74 } |
| 75 CXFA_ContainerRecord* CreateContainerRecord(CXFA_Node* pPageNode = NULL, | 75 CXFA_ContainerRecord* CreateContainerRecord(CXFA_Node* pPageNode = nullptr, |
| 76 FX_BOOL bCreateNew = FALSE); | 76 FX_BOOL bCreateNew = FALSE); |
| 77 void AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | 77 void AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, |
| 78 CXFA_Node* pNewPageArea); | 78 CXFA_Node* pNewPageArea); |
| 79 void AddContentAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, | 79 void AddContentAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, |
| 80 CXFA_Node* pContentArea); | 80 CXFA_Node* pContentArea); |
| 81 FX_BOOL RunBreak(XFA_Element eBreakType, | 81 FX_BOOL RunBreak(XFA_Element eBreakType, |
| 82 XFA_ATTRIBUTEENUM eTargetType, | 82 XFA_ATTRIBUTEENUM eTargetType, |
| 83 CXFA_Node* pTarget, | 83 CXFA_Node* pTarget, |
| 84 FX_BOOL bStartNew); | 84 FX_BOOL bStartNew); |
| 85 CXFA_Node* BreakOverflow(CXFA_Node* pOverflowNode, | 85 CXFA_Node* BreakOverflow(CXFA_Node* pOverflowNode, |
| 86 CXFA_Node*& pLeaderTemplate, | 86 CXFA_Node*& pLeaderTemplate, |
| 87 CXFA_Node*& pTrailerTemplate, | 87 CXFA_Node*& pTrailerTemplate, |
| 88 FX_BOOL bCreatePage = TRUE); | 88 FX_BOOL bCreatePage = TRUE); |
| 89 FX_BOOL ResolveBookendLeaderOrTrailer(CXFA_Node* pBookendNode, | 89 FX_BOOL ResolveBookendLeaderOrTrailer(CXFA_Node* pBookendNode, |
| 90 FX_BOOL bLeader, | 90 FX_BOOL bLeader, |
| 91 CXFA_Node*& pBookendAppendTemplate); | 91 CXFA_Node*& pBookendAppendTemplate); |
| 92 FX_BOOL ExecuteBreakBeforeOrAfter(CXFA_Node* pCurNode, | 92 FX_BOOL ExecuteBreakBeforeOrAfter(CXFA_Node* pCurNode, |
| 93 FX_BOOL bBefore, | 93 FX_BOOL bBefore, |
| 94 CXFA_Node*& pBreakLeaderTemplate, | 94 CXFA_Node*& pBreakLeaderTemplate, |
| 95 CXFA_Node*& pBreakTrailerTemplate); | 95 CXFA_Node*& pBreakTrailerTemplate); |
| 96 | 96 |
| 97 int32_t CreateMinPageRecord(CXFA_Node* pPageArea, | 97 int32_t CreateMinPageRecord(CXFA_Node* pPageArea, |
| 98 FX_BOOL bTargetPageArea, | 98 FX_BOOL bTargetPageArea, |
| 99 FX_BOOL bCreateLast = FALSE); | 99 FX_BOOL bCreateLast = FALSE); |
| 100 void CreateMinPageSetRecord(CXFA_Node* pPageSet, FX_BOOL bCreateAll = FALSE); | 100 void CreateMinPageSetRecord(CXFA_Node* pPageSet, FX_BOOL bCreateAll = FALSE); |
| 101 void CreateNextMinRecord(CXFA_Node* pRecordNode); | 101 void CreateNextMinRecord(CXFA_Node* pRecordNode); |
| 102 FX_BOOL FindPageAreaFromPageSet(CXFA_Node* pPageSet, | 102 FX_BOOL FindPageAreaFromPageSet(CXFA_Node* pPageSet, |
| 103 CXFA_Node* pStartChild, | 103 CXFA_Node* pStartChild, |
| 104 CXFA_Node* pTargetPageArea = NULL, | 104 CXFA_Node* pTargetPageArea = nullptr, |
| 105 CXFA_Node* pTargetContentArea = NULL, | 105 CXFA_Node* pTargetContentArea = nullptr, |
| 106 FX_BOOL bNewPage = FALSE, | 106 FX_BOOL bNewPage = FALSE, |
| 107 FX_BOOL bQuery = FALSE); | 107 FX_BOOL bQuery = FALSE); |
| 108 FX_BOOL FindPageAreaFromPageSet_Ordered(CXFA_Node* pPageSet, | 108 FX_BOOL FindPageAreaFromPageSet_Ordered( |
| 109 CXFA_Node* pStartChild, | 109 CXFA_Node* pPageSet, |
| 110 CXFA_Node* pTargetPageArea = NULL, | 110 CXFA_Node* pStartChild, |
| 111 CXFA_Node* pTargetContentArea = NULL, | 111 CXFA_Node* pTargetPageArea = nullptr, |
| 112 FX_BOOL bNewPage = FALSE, | 112 CXFA_Node* pTargetContentArea = nullptr, |
| 113 FX_BOOL bQuery = FALSE); | 113 FX_BOOL bNewPage = FALSE, |
| 114 FX_BOOL bQuery = FALSE); |
| 114 FX_BOOL FindPageAreaFromPageSet_SimplexDuplex( | 115 FX_BOOL FindPageAreaFromPageSet_SimplexDuplex( |
| 115 CXFA_Node* pPageSet, | 116 CXFA_Node* pPageSet, |
| 116 CXFA_Node* pStartChild, | 117 CXFA_Node* pStartChild, |
| 117 CXFA_Node* pTargetPageArea = NULL, | 118 CXFA_Node* pTargetPageArea = nullptr, |
| 118 CXFA_Node* pTargetContentArea = NULL, | 119 CXFA_Node* pTargetContentArea = nullptr, |
| 119 FX_BOOL bNewPage = FALSE, | 120 FX_BOOL bNewPage = FALSE, |
| 120 FX_BOOL bQuery = FALSE, | 121 FX_BOOL bQuery = FALSE, |
| 121 XFA_ATTRIBUTEENUM ePreferredPosition = XFA_ATTRIBUTEENUM_First); | 122 XFA_ATTRIBUTEENUM ePreferredPosition = XFA_ATTRIBUTEENUM_First); |
| 122 FX_BOOL MatchPageAreaOddOrEven(CXFA_Node* pPageArea, FX_BOOL bLastMatch); | 123 FX_BOOL MatchPageAreaOddOrEven(CXFA_Node* pPageArea, FX_BOOL bLastMatch); |
| 123 CXFA_Node* GetNextAvailPageArea(CXFA_Node* pTargetPageArea, | 124 CXFA_Node* GetNextAvailPageArea(CXFA_Node* pTargetPageArea, |
| 124 CXFA_Node* pTargetContentArea = NULL, | 125 CXFA_Node* pTargetContentArea = nullptr, |
| 125 FX_BOOL bNewPage = FALSE, | 126 FX_BOOL bNewPage = FALSE, |
| 126 FX_BOOL bQuery = FALSE); | 127 FX_BOOL bQuery = FALSE); |
| 127 FX_BOOL GetNextContentArea(CXFA_Node* pTargetContentArea); | 128 FX_BOOL GetNextContentArea(CXFA_Node* pTargetContentArea); |
| 128 void InitPageSetMap(); | 129 void InitPageSetMap(); |
| 129 void ProcessLastPageSet(); | 130 void ProcessLastPageSet(); |
| 130 inline FX_BOOL IsPageSetRootOrderedOccurrence() { | 131 inline FX_BOOL IsPageSetRootOrderedOccurrence() { |
| 131 return m_ePageSetMode == XFA_ATTRIBUTEENUM_OrderedOccurrence; | 132 return m_ePageSetMode == XFA_ATTRIBUTEENUM_OrderedOccurrence; |
| 132 } | 133 } |
| 133 void ClearData(); | 134 void ClearData(); |
| 134 void ClearRecordList(); | 135 void ClearRecordList(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 145 CXFA_Node* m_pCurPageArea; | 146 CXFA_Node* m_pCurPageArea; |
| 146 int32_t m_nAvailPages; | 147 int32_t m_nAvailPages; |
| 147 int32_t m_nCurPageCount; | 148 int32_t m_nCurPageCount; |
| 148 XFA_ATTRIBUTEENUM m_ePageSetMode; | 149 XFA_ATTRIBUTEENUM m_ePageSetMode; |
| 149 FX_BOOL m_bCreateOverFlowPage; | 150 FX_BOOL m_bCreateOverFlowPage; |
| 150 CFX_MapPtrTemplate<CXFA_Node*, int32_t> m_pPageSetMap; | 151 CFX_MapPtrTemplate<CXFA_Node*, int32_t> m_pPageSetMap; |
| 151 CFX_ArrayTemplate<CXFA_ContainerLayoutItem*> m_PageArray; | 152 CFX_ArrayTemplate<CXFA_ContainerLayoutItem*> m_PageArray; |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 #endif // XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ | 155 #endif // XFA_FXFA_PARSER_XFA_LAYOUT_PAGEMGR_NEW_H_ |
| OLD | NEW |