From ec1843d2f61a85a7484627b828da317e4dd9c0a4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 28 Mar 2017 16:04:41 -0400 Subject: Renaming and splitting in xfa/fxfa/parser. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl renames several of the files in xfa/fxfa/parser to match the name of the contained classes. Files with multiple clasess are split apart when renamed. Change-Id: Ice8a1279072ee13c2f62a81946be7f42f9ba6007 Reviewed-on: https://pdfium-review.googlesource.com/3250 Commit-Queue: Nicolás Peña Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_itemlayoutprocessor.h | 172 +++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 xfa/fxfa/parser/cxfa_itemlayoutprocessor.h (limited to 'xfa/fxfa/parser/cxfa_itemlayoutprocessor.h') diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h new file mode 100644 index 0000000000..d5d706e62e --- /dev/null +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h @@ -0,0 +1,172 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ +#define XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ + +#include + +#include +#include +#include +#include + +#include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_coordinates.h" +#include "xfa/fxfa/fxfa_basic.h" + +#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1) +#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f) + +class CXFA_ContainerLayoutItem; +class CXFA_ContentLayoutItem; +class CXFA_ItemLayoutProcessor; +class CXFA_LayoutContext; +class CXFA_LayoutPageMgr; +class CXFA_LayoutProcessor; +class CXFA_Node; + +enum class XFA_ItemLayoutProcessorResult { + Done, + PageFullBreak, + RowFullBreak, + ManualBreak, +}; + +enum class XFA_ItemLayoutProcessorStages { + None, + BookendLeader, + BreakBefore, + Keep, + Container, + BreakAfter, + BookendTrailer, + Done, +}; + +bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode); + +class CXFA_ItemLayoutProcessor { + public: + static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor, + CXFA_Node* pNode, + CXFA_Node* pParentNode); + + CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); + ~CXFA_ItemLayoutProcessor(); + + XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext); + void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem); + + CFX_SizeF GetCurrentComponentSize(); + CXFA_Node* GetFormNode() { return m_pFormNode; } + bool HasLayoutItem() const { return !!m_pLayoutItem; } + CXFA_ContentLayoutItem* ExtractLayoutItem(); + void SplitLayoutItem(float fSplitPos); + + float FindSplitPos(float fProposedSplitPos); + + bool ProcessKeepForSplit( + CXFA_ItemLayoutProcessor* pParentProcessor, + CXFA_ItemLayoutProcessor* pChildProcessor, + XFA_ItemLayoutProcessorResult eRetValue, + std::vector* rgCurLineLayoutItem, + float* fContentCurRowAvailWidth, + float* fContentCurRowHeight, + float* fContentCurRowY, + 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; + float m_fUsedSize; + CXFA_LayoutPageMgr* m_pPageMgr; + std::list m_PendingNodes; + bool m_bBreakPending; + std::vector m_rgSpecifiedColumnWidths; + std::vector m_arrayKeepItems; + float m_fLastRowWidth; + float m_fLastRowY; + bool m_bUseInheriated; + XFA_ItemLayoutProcessorResult m_ePreProcessRs; + + private: + void SetCurrentComponentPos(const CFX_PointF& pos); + void SetCurrentComponentSize(const CFX_SizeF& size); + + void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem, + CXFA_ContentLayoutItem* pSecondParent, + float fSplitPos); + float InsertKeepLayoutItems(); + bool CalculateRowChildPosition( + std::vector (&rgCurLineLayoutItems)[3], + XFA_ATTRIBUTEENUM eFlowStrategy, + bool bContainerHeightAutoSize, + bool bContainerWidthAutoSize, + float* fContentCalculatedWidth, + float* fContentCalculatedHeight, + float* fContentCurRowY, + float fContentCurRowHeight, + float fContentWidthLimit, + bool bRootForceTb); + void ProcessUnUseBinds(CXFA_Node* pFormNode); + bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem, + float fChildHeight, + std::vector* pKeepItems); + + void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext); + void DoLayoutTableContainer(CXFA_Node* pLayoutNode); + XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer( + bool bUseBreakControl, + XFA_ATTRIBUTEENUM eFlowStrategy, + float fHeightLimit, + float fRealHeight, + CXFA_LayoutContext* pContext, + bool bRootForceTb); + void DoLayoutField(); + + void GotoNextContainerNode(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pParentContainer, + bool bUsePageBreak); + + bool ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node*& pNextContainer, + bool& bLastKeepNode); + + bool ProcessKeepNodesForBreakBefore(CXFA_Node*& pCurActionNode, + XFA_ItemLayoutProcessorStages& nCurStage, + CXFA_Node* pContainerNode); + + CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet); + + bool m_bKeepBreakFinish; + bool m_bIsProcessKeep; + CXFA_Node* m_pKeepHeadNode; + CXFA_Node* m_pKeepTailNode; + CXFA_ContentLayoutItem* m_pOldLayoutItem; + CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor; + XFA_ItemLayoutProcessorStages m_nCurChildNodeStage; + std::map m_PendingNodesCount; + float m_fWidthLimite; + bool m_bHasAvailHeight; +}; + +#endif // XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_ -- cgit v1.2.3