summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_layout_itemlayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/xfa_layout_itemlayout.h')
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.h132
1 files changed, 61 insertions, 71 deletions
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h
index b18706b521..b7b35122df 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.h
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.h
@@ -17,7 +17,6 @@
#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1)
#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f)
-#define XFA_LAYOUT_FLOAT_MAX FLT_MAX
class CXFA_ContainerLayoutItem;
class CXFA_ContentLayoutItem;
@@ -26,22 +25,22 @@ class CXFA_LayoutPageMgr;
class CXFA_LayoutProcessor;
class CXFA_Node;
-enum XFA_ItemLayoutProcessorResult {
- XFA_ItemLayoutProcessorResult_Done,
- XFA_ItemLayoutProcessorResult_PageFullBreak,
- XFA_ItemLayoutProcessorResult_RowFullBreak,
- XFA_ItemLayoutProcessorResult_ManualBreak,
+enum class XFA_ItemLayoutProcessorResult {
+ Done,
+ PageFullBreak,
+ RowFullBreak,
+ ManualBreak,
};
-enum XFA_ItemLayoutProcessorStages {
- XFA_ItemLayoutProcessorStages_None,
- XFA_ItemLayoutProcessorStages_BookendLeader,
- XFA_ItemLayoutProcessorStages_BreakBefore,
- XFA_ItemLayoutProcessorStages_Keep,
- XFA_ItemLayoutProcessorStages_Container,
- XFA_ItemLayoutProcessorStages_BreakAfter,
- XFA_ItemLayoutProcessorStages_BookendTrailer,
- XFA_ItemLayoutProcessorStages_Done,
+enum class XFA_ItemLayoutProcessorStages {
+ None,
+ BookendLeader,
+ BreakBefore,
+ Keep,
+ Container,
+ BreakAfter,
+ BookendTrailer,
+ Done,
};
class CXFA_LayoutContext {
@@ -52,7 +51,8 @@ class CXFA_LayoutContext {
m_bCurColumnWidthAvaiable(false),
m_pOverflowProcessor(nullptr),
m_pOverflowNode(nullptr) {}
- ~CXFA_LayoutContext() { m_pOverflowProcessor = nullptr; }
+ ~CXFA_LayoutContext() {}
+
CFX_ArrayTemplate<FX_FLOAT>* m_prgSpecifiedColumnWidths;
FX_FLOAT m_fCurColumnWidth;
bool m_bCurColumnWidthAvaiable;
@@ -67,45 +67,25 @@ class CXFA_ItemLayoutProcessor {
static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor,
CXFA_Node* pNode,
CXFA_Node* pParentNode);
- static void CalculatePositionedContainerPos(CXFA_Node* pNode,
- FX_FLOAT fWidth,
- FX_FLOAT fHeight,
- FX_FLOAT& fAbsoluteX,
- FX_FLOAT& fAbsoluteY);
- static bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
- FX_FLOAT fCurVerticalOffset,
- FX_FLOAT& fProposedSplitPos,
- bool& bAppChange,
- bool bCalculateMargin);
CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr);
~CXFA_ItemLayoutProcessor();
- XFA_ItemLayoutProcessorResult DoLayout(
- bool bUseBreakControl,
- FX_FLOAT fHeightLimit,
- FX_FLOAT fRealHeight = XFA_LAYOUT_FLOAT_MAX,
- CXFA_LayoutContext* pContext = nullptr);
-
- void GetCurrentComponentPos(FX_FLOAT& fAbsoluteX, FX_FLOAT& fAbsoluteY);
+ XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl,
+ FX_FLOAT fHeightLimit,
+ FX_FLOAT fRealHeight,
+ CXFA_LayoutContext* pContext);
+ void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem);
void GetCurrentComponentSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight);
- void SetCurrentComponentPos(FX_FLOAT fAbsoluteX, FX_FLOAT fAbsoluteY);
-
- void SetCurrentComponentSize(FX_FLOAT fWidth, FX_FLOAT fHeight);
CXFA_Node* GetFormNode() { return m_pFormNode; }
bool HasLayoutItem() { return !!m_pLayoutItem; }
CXFA_ContentLayoutItem* ExtractLayoutItem();
+ void SplitLayoutItem(FX_FLOAT fSplitPos);
FX_FLOAT FindSplitPos(FX_FLOAT fProposedSplitPos);
- void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem,
- CXFA_ContentLayoutItem* pSecondParent,
- FX_FLOAT fSplitPos);
- void SplitLayoutItem(FX_FLOAT fSplitPos);
- bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem,
- FX_FLOAT fChildHeight,
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems);
+
bool ProcessKeepForSplite(
CXFA_ItemLayoutProcessor* pParentProcessor,
CXFA_ItemLayoutProcessor* pChildProcessor,
@@ -117,8 +97,37 @@ class CXFA_ItemLayoutProcessor {
bool& bAddedItemInRow,
bool& bForceEndPage,
XFA_ItemLayoutProcessorResult& result);
+ void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode,
+ CXFA_Node* pTrailerNode,
+ CXFA_ContentLayoutItem* pTrailerItem,
+ CXFA_Node* pFormNode);
+ bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem);
+ bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode);
+
+ CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode);
+
+ CXFA_Node* m_pFormNode;
+ CXFA_ContentLayoutItem* m_pLayoutItem;
+ CXFA_Node* m_pCurChildNode;
+ FX_FLOAT m_fUsedSize;
+ CXFA_LayoutPageMgr* m_pPageMgr;
+ std::list<CXFA_Node*> m_PendingNodes;
+ bool m_bBreakPending;
+ CFX_ArrayTemplate<FX_FLOAT> m_rgSpecifiedColumnWidths;
+ CFX_ArrayTemplate<CXFA_ContentLayoutItem*> m_arrayKeepItems;
+ FX_FLOAT m_fLastRowWidth;
+ FX_FLOAT m_fLastRowY;
+ bool m_bUseInheriated;
+ XFA_ItemLayoutProcessorResult m_ePreProcessRs;
+
+ private:
+ void SetCurrentComponentPos(FX_FLOAT fAbsoluteX, FX_FLOAT fAbsoluteY);
+ void SetCurrentComponentSize(FX_FLOAT fWidth, FX_FLOAT fHeight);
+
+ void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem,
+ CXFA_ContentLayoutItem* pSecondParent,
+ FX_FLOAT fSplitPos);
FX_FLOAT InsertKeepLayoutItems();
- void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem);
bool CalculateRowChildPosition(
CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
XFA_ATTRIBUTEENUM eFlowStrategy,
@@ -129,28 +138,23 @@ class CXFA_ItemLayoutProcessor {
FX_FLOAT& fContentCurRowY,
FX_FLOAT fContentCurRowHeight,
FX_FLOAT fContentWidthLimit,
- bool bRootForceTb = false);
-
- void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode,
- CXFA_Node* pTrailerNode,
- CXFA_ContentLayoutItem* pTrailerItem,
- CXFA_Node* pFormNode);
+ bool bRootForceTb);
void ProcessUnUseBinds(CXFA_Node* pFormNode);
- bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem);
- bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode);
- CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode);
+ bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem,
+ FX_FLOAT fChildHeight,
+ CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems);
- private:
- void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext = nullptr);
+ void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext);
void DoLayoutTableContainer(CXFA_Node* pLayoutNode);
XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer(
bool bUseBreakControl,
XFA_ATTRIBUTEENUM eFlowStrategy,
FX_FLOAT fHeightLimit,
FX_FLOAT fRealHeight,
- CXFA_LayoutContext* pContext = nullptr,
- bool bRootForceTb = false);
+ CXFA_LayoutContext* pContext,
+ bool bRootForceTb);
void DoLayoutField();
+
void GotoNextContainerNode(CXFA_Node*& pCurActionNode,
XFA_ItemLayoutProcessorStages& nCurStage,
CXFA_Node* pParentContainer,
@@ -167,29 +171,15 @@ class CXFA_ItemLayoutProcessor {
CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet);
- public:
bool m_bKeepBreakFinish;
bool m_bIsProcessKeep;
CXFA_Node* m_pKeepHeadNode;
CXFA_Node* m_pKeepTailNode;
- CXFA_Node* m_pFormNode;
- CXFA_ContentLayoutItem* m_pLayoutItem;
CXFA_ContentLayoutItem* m_pOldLayoutItem;
- CXFA_Node* m_pCurChildNode;
CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor;
XFA_ItemLayoutProcessorStages m_nCurChildNodeStage;
- FX_FLOAT m_fUsedSize;
- CXFA_LayoutPageMgr* m_pPageMgr;
- std::list<CXFA_Node*> m_PendingNodes;
- bool m_bBreakPending;
- CFX_ArrayTemplate<FX_FLOAT> m_rgSpecifiedColumnWidths;
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> m_arrayKeepItems;
std::map<CXFA_Node*, int32_t> m_PendingNodesCount;
- FX_FLOAT m_fLastRowWidth;
- FX_FLOAT m_fLastRowY;
FX_FLOAT m_fWidthLimite;
- bool m_bUseInheriated;
- XFA_ItemLayoutProcessorResult m_ePreProcessRs;
bool m_bHasAvailHeight;
};