| 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_ITEMLAYOUT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ |
| 8 #define XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ | 8 #define XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ |
| 9 | 9 |
| 10 #include <float.h> | 10 #include <float.h> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 XFA_ItemLayoutProcessorStages_Keep, | 40 XFA_ItemLayoutProcessorStages_Keep, |
| 41 XFA_ItemLayoutProcessorStages_Container, | 41 XFA_ItemLayoutProcessorStages_Container, |
| 42 XFA_ItemLayoutProcessorStages_BreakAfter, | 42 XFA_ItemLayoutProcessorStages_BreakAfter, |
| 43 XFA_ItemLayoutProcessorStages_BookendTrailer, | 43 XFA_ItemLayoutProcessorStages_BookendTrailer, |
| 44 XFA_ItemLayoutProcessorStages_Done, | 44 XFA_ItemLayoutProcessorStages_Done, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class CXFA_LayoutContext { | 47 class CXFA_LayoutContext { |
| 48 public: | 48 public: |
| 49 CXFA_LayoutContext() | 49 CXFA_LayoutContext() |
| 50 : m_prgSpecifiedColumnWidths(NULL), | 50 : m_prgSpecifiedColumnWidths(nullptr), |
| 51 m_fCurColumnWidth(0), | 51 m_fCurColumnWidth(0), |
| 52 m_bCurColumnWidthAvaiable(FALSE), | 52 m_bCurColumnWidthAvaiable(FALSE), |
| 53 m_pOverflowProcessor(NULL), | 53 m_pOverflowProcessor(nullptr), |
| 54 m_pOverflowNode(NULL) {} | 54 m_pOverflowNode(nullptr) {} |
| 55 ~CXFA_LayoutContext() { m_pOverflowProcessor = NULL; } | 55 ~CXFA_LayoutContext() { m_pOverflowProcessor = nullptr; } |
| 56 CFX_ArrayTemplate<FX_FLOAT>* m_prgSpecifiedColumnWidths; | 56 CFX_ArrayTemplate<FX_FLOAT>* m_prgSpecifiedColumnWidths; |
| 57 FX_FLOAT m_fCurColumnWidth; | 57 FX_FLOAT m_fCurColumnWidth; |
| 58 FX_BOOL m_bCurColumnWidthAvaiable; | 58 FX_BOOL m_bCurColumnWidthAvaiable; |
| 59 CXFA_ItemLayoutProcessor* m_pOverflowProcessor; | 59 CXFA_ItemLayoutProcessor* m_pOverflowProcessor; |
| 60 CXFA_Node* m_pOverflowNode; | 60 CXFA_Node* m_pOverflowNode; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class CXFA_ItemLayoutProcessor { | 63 class CXFA_ItemLayoutProcessor { |
| 64 public: | 64 public: |
| 65 CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); | 65 CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); |
| 66 ~CXFA_ItemLayoutProcessor(); | 66 ~CXFA_ItemLayoutProcessor(); |
| 67 | 67 |
| 68 XFA_ItemLayoutProcessorResult DoLayout( | 68 XFA_ItemLayoutProcessorResult DoLayout( |
| 69 FX_BOOL bUseBreakControl, | 69 FX_BOOL bUseBreakControl, |
| 70 FX_FLOAT fHeightLimit, | 70 FX_FLOAT fHeightLimit, |
| 71 FX_FLOAT fRealHeight = XFA_LAYOUT_FLOAT_MAX, | 71 FX_FLOAT fRealHeight = XFA_LAYOUT_FLOAT_MAX, |
| 72 CXFA_LayoutContext* pContext = NULL); | 72 CXFA_LayoutContext* pContext = nullptr); |
| 73 | 73 |
| 74 void GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, FX_FLOAT& fAbsoluteY); | 74 void GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, FX_FLOAT& fAbsoluteY); |
| 75 | 75 |
| 76 void GetCurrentComponentSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight); | 76 void GetCurrentComponentSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight); |
| 77 | 77 |
| 78 void SetCurrentComponentPos(FX_FLOAT fAbsoluteX, FX_FLOAT fAbsoluteY); | 78 void SetCurrentComponentPos(FX_FLOAT fAbsoluteX, FX_FLOAT fAbsoluteY); |
| 79 | 79 |
| 80 void SetCurrentComponentSize(FX_FLOAT fWidth, FX_FLOAT fHeight); | 80 void SetCurrentComponentSize(FX_FLOAT fWidth, FX_FLOAT fHeight); |
| 81 inline CXFA_Node* GetFormNode() { return m_pFormNode; } | 81 CXFA_Node* GetFormNode() { return m_pFormNode; } |
| 82 inline FX_BOOL HasLayoutItem() { return m_pLayoutItem != NULL; } | 82 FX_BOOL HasLayoutItem() { return !!m_pLayoutItem; } |
| 83 CXFA_ContentLayoutItem* ExtractLayoutItem(); | 83 CXFA_ContentLayoutItem* ExtractLayoutItem(); |
| 84 | 84 |
| 85 static FX_BOOL IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, | 85 static FX_BOOL IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, |
| 86 CXFA_Node* pNode, | 86 CXFA_Node* pNode, |
| 87 CXFA_Node* pParentNode); | 87 CXFA_Node* pParentNode); |
| 88 static void CalculatePositionedContainerPos(CXFA_Node* pNode, | 88 static void CalculatePositionedContainerPos(CXFA_Node* pNode, |
| 89 FX_FLOAT fWidth, | 89 FX_FLOAT fWidth, |
| 90 FX_FLOAT fHeight, | 90 FX_FLOAT fHeight, |
| 91 FX_FLOAT& fAbsoluteX, | 91 FX_FLOAT& fAbsoluteX, |
| 92 FX_FLOAT& fAbsoluteY); | 92 FX_FLOAT& fAbsoluteY); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode, | 132 void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode, |
| 133 CXFA_Node* pTrailerNode, | 133 CXFA_Node* pTrailerNode, |
| 134 CXFA_ContentLayoutItem* pTrailerItem, | 134 CXFA_ContentLayoutItem* pTrailerItem, |
| 135 CXFA_Node* pFormNode); | 135 CXFA_Node* pFormNode); |
| 136 void ProcessUnUseBinds(CXFA_Node* pFormNode); | 136 void ProcessUnUseBinds(CXFA_Node* pFormNode); |
| 137 FX_BOOL IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem); | 137 FX_BOOL IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem); |
| 138 FX_BOOL JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode); | 138 FX_BOOL JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode); |
| 139 CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode); | 139 CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode); |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext = NULL); | 142 void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext = nullptr); |
| 143 void DoLayoutTableContainer(CXFA_Node* pLayoutNode); | 143 void DoLayoutTableContainer(CXFA_Node* pLayoutNode); |
| 144 XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( | 144 XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( |
| 145 FX_BOOL bUseBreakControl, | 145 FX_BOOL bUseBreakControl, |
| 146 XFA_ATTRIBUTEENUM eFlowStrategy, | 146 XFA_ATTRIBUTEENUM eFlowStrategy, |
| 147 FX_FLOAT fHeightLimit, | 147 FX_FLOAT fHeightLimit, |
| 148 FX_FLOAT fRealHeight, | 148 FX_FLOAT fRealHeight, |
| 149 CXFA_LayoutContext* pContext = NULL, | 149 CXFA_LayoutContext* pContext = nullptr, |
| 150 FX_BOOL bRootForceTb = FALSE); | 150 FX_BOOL bRootForceTb = FALSE); |
| 151 void DoLayoutField(); | 151 void DoLayoutField(); |
| 152 void XFA_ItemLayoutProcessor_GotoNextContainerNode( | 152 void XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 153 CXFA_Node*& pCurActionNode, | 153 CXFA_Node*& pCurActionNode, |
| 154 XFA_ItemLayoutProcessorStages& nCurStage, | 154 XFA_ItemLayoutProcessorStages& nCurStage, |
| 155 CXFA_Node* pParentContainer, | 155 CXFA_Node* pParentContainer, |
| 156 FX_BOOL bUsePageBreak); | 156 FX_BOOL bUsePageBreak); |
| 157 | 157 |
| 158 FX_BOOL ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode, | 158 FX_BOOL ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode, |
| 159 XFA_ItemLayoutProcessorStages& nCurStage, | 159 XFA_ItemLayoutProcessorStages& nCurStage, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 188 FX_FLOAT m_fLastRowWidth; | 188 FX_FLOAT m_fLastRowWidth; |
| 189 FX_FLOAT m_fLastRowY; | 189 FX_FLOAT m_fLastRowY; |
| 190 FX_FLOAT m_fWidthLimite; | 190 FX_FLOAT m_fWidthLimite; |
| 191 FX_BOOL m_bUseInheriated; | 191 FX_BOOL m_bUseInheriated; |
| 192 XFA_ItemLayoutProcessorResult m_ePreProcessRs; | 192 XFA_ItemLayoutProcessorResult m_ePreProcessRs; |
| 193 FX_BOOL m_bHasAvailHeight; | 193 FX_BOOL m_bHasAvailHeight; |
| 194 }; | 194 }; |
| 195 FX_BOOL XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode); | 195 FX_BOOL XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode); |
| 196 | 196 |
| 197 #endif // XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ | 197 #endif // XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_ |
| OLD | NEW |