| 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 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" | 7 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 int32_t iStrLen, | 26 int32_t iStrLen, |
| 27 FX_WCHAR delimiter, | 27 FX_WCHAR delimiter, |
| 28 CFX_WideStringArray& pieces) { | 28 CFX_WideStringArray& pieces) { |
| 29 if (!pStr) | 29 if (!pStr) |
| 30 return 0; | 30 return 0; |
| 31 if (iStrLen < 0) | 31 if (iStrLen < 0) |
| 32 iStrLen = FXSYS_wcslen(pStr); | 32 iStrLen = FXSYS_wcslen(pStr); |
| 33 | 33 |
| 34 const FX_WCHAR* pToken = pStr; | 34 const FX_WCHAR* pToken = pStr; |
| 35 const FX_WCHAR* pEnd = pStr + iStrLen; | 35 const FX_WCHAR* pEnd = pStr + iStrLen; |
| 36 while (TRUE) { | 36 while (true) { |
| 37 if (pStr >= pEnd || delimiter == *pStr) { | 37 if (pStr >= pEnd || delimiter == *pStr) { |
| 38 CFX_WideString sub(pToken, pStr - pToken); | 38 CFX_WideString sub(pToken, pStr - pToken); |
| 39 pieces.Add(sub); | 39 pieces.Add(sub); |
| 40 pToken = pStr + 1; | 40 pToken = pStr + 1; |
| 41 if (pStr >= pEnd) | 41 if (pStr >= pEnd) |
| 42 break; | 42 break; |
| 43 } | 43 } |
| 44 pStr++; | 44 pStr++; |
| 45 } | 45 } |
| 46 return pieces.GetSize(); | 46 return pieces.GetSize(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, | 51 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, |
| 52 CXFA_LayoutPageMgr* pPageMgr) | 52 CXFA_LayoutPageMgr* pPageMgr) |
| 53 : m_bKeepBreakFinish(FALSE), | 53 : m_bKeepBreakFinish(false), |
| 54 m_bIsProcessKeep(FALSE), | 54 m_bIsProcessKeep(false), |
| 55 m_pKeepHeadNode(nullptr), | 55 m_pKeepHeadNode(nullptr), |
| 56 m_pKeepTailNode(nullptr), | 56 m_pKeepTailNode(nullptr), |
| 57 m_pFormNode(pNode), | 57 m_pFormNode(pNode), |
| 58 m_pLayoutItem(nullptr), | 58 m_pLayoutItem(nullptr), |
| 59 m_pOldLayoutItem(nullptr), | 59 m_pOldLayoutItem(nullptr), |
| 60 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), | 60 m_pCurChildNode(XFA_LAYOUT_INVALIDNODE), |
| 61 m_pCurChildPreprocessor(nullptr), | 61 m_pCurChildPreprocessor(nullptr), |
| 62 m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages_None), | 62 m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages_None), |
| 63 m_fUsedSize(0), | 63 m_fUsedSize(0), |
| 64 m_pPageMgr(pPageMgr), | 64 m_pPageMgr(pPageMgr), |
| 65 m_bBreakPending(TRUE), | 65 m_bBreakPending(true), |
| 66 m_fLastRowWidth(0), | 66 m_fLastRowWidth(0), |
| 67 m_fLastRowY(0), | 67 m_fLastRowY(0), |
| 68 m_fWidthLimite(0), | 68 m_fWidthLimite(0), |
| 69 m_bUseInheriated(FALSE), | 69 m_bUseInheriated(false), |
| 70 m_ePreProcessRs(XFA_ItemLayoutProcessorResult_Done), | 70 m_ePreProcessRs(XFA_ItemLayoutProcessorResult_Done), |
| 71 m_bHasAvailHeight(TRUE) { | 71 m_bHasAvailHeight(true) { |
| 72 ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || | 72 ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || |
| 73 m_pFormNode->GetElementType() == XFA_Element::Form)); | 73 m_pFormNode->GetElementType() == XFA_Element::Form)); |
| 74 m_pOldLayoutItem = | 74 m_pOldLayoutItem = |
| 75 (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); | 75 (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); |
| 76 } | 76 } |
| 77 | 77 |
| 78 CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} | 78 CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} |
| 79 | 79 |
| 80 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( | 80 CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( |
| 81 CXFA_Node* pFormNode) { | 81 CXFA_Node* pFormNode) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 while (pPrevLayoutItem->m_pNext) { | 97 while (pPrevLayoutItem->m_pNext) { |
| 98 pPrevLayoutItem = pPrevLayoutItem->m_pNext; | 98 pPrevLayoutItem = pPrevLayoutItem->m_pNext; |
| 99 } | 99 } |
| 100 pPrevLayoutItem->m_pNext = pLayoutItem; | 100 pPrevLayoutItem->m_pNext = pLayoutItem; |
| 101 pLayoutItem->m_pPrev = pPrevLayoutItem; | 101 pLayoutItem->m_pPrev = pPrevLayoutItem; |
| 102 } else { | 102 } else { |
| 103 pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem); | 103 pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem); |
| 104 } | 104 } |
| 105 return pLayoutItem; | 105 return pLayoutItem; |
| 106 } | 106 } |
| 107 FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( | 107 bool CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos( |
| 108 CXFA_ContentLayoutItem* pLayoutItem, | 108 CXFA_ContentLayoutItem* pLayoutItem, |
| 109 FX_FLOAT fCurVerticalOffset, | 109 FX_FLOAT fCurVerticalOffset, |
| 110 FX_FLOAT& fProposedSplitPos, | 110 FX_FLOAT& fProposedSplitPos, |
| 111 FX_BOOL& bAppChange, | 111 bool& bAppChange, |
| 112 FX_BOOL bCalculateMargin) { | 112 bool bCalculateMargin) { |
| 113 CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; | 113 CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; |
| 114 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION && | 114 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION && |
| 115 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y - | 115 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y - |
| 116 XFA_LAYOUT_FLOAT_PERCISION) { | 116 XFA_LAYOUT_FLOAT_PERCISION) { |
| 117 switch (pFormNode->GetIntact()) { | 117 switch (pFormNode->GetIntact()) { |
| 118 case XFA_ATTRIBUTEENUM_None: { | 118 case XFA_ATTRIBUTEENUM_None: { |
| 119 FX_BOOL bAnyChanged = FALSE; | 119 bool bAnyChanged = false; |
| 120 CXFA_Document* pDocument = pFormNode->GetDocument(); | 120 CXFA_Document* pDocument = pFormNode->GetDocument(); |
| 121 CXFA_FFNotify* pNotify = pDocument->GetNotify(); | 121 CXFA_FFNotify* pNotify = pDocument->GetNotify(); |
| 122 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; | 122 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; |
| 123 CXFA_Node* pMarginNode = | 123 CXFA_Node* pMarginNode = |
| 124 pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 124 pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 125 if (pMarginNode && bCalculateMargin) { | 125 if (pMarginNode && bCalculateMargin) { |
| 126 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) | 126 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) |
| 127 .ToUnit(XFA_UNIT_Pt); | 127 .ToUnit(XFA_UNIT_Pt); |
| 128 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) | 128 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) |
| 129 .ToUnit(XFA_UNIT_Pt); | 129 .ToUnit(XFA_UNIT_Pt); |
| 130 } | 130 } |
| 131 FX_BOOL bChanged = TRUE; | 131 bool bChanged = true; |
| 132 while (bChanged) { | 132 while (bChanged) { |
| 133 bChanged = FALSE; | 133 bChanged = false; |
| 134 { | 134 { |
| 135 FX_FLOAT fRelSplitPos = fProposedSplitPos - fCurVerticalOffset; | 135 FX_FLOAT fRelSplitPos = fProposedSplitPos - fCurVerticalOffset; |
| 136 if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), | 136 if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(), |
| 137 fRelSplitPos)) { | 137 fRelSplitPos)) { |
| 138 bAnyChanged = TRUE; | 138 bAnyChanged = true; |
| 139 bChanged = TRUE; | 139 bChanged = true; |
| 140 fProposedSplitPos = fCurVerticalOffset + fRelSplitPos; | 140 fProposedSplitPos = fCurVerticalOffset + fRelSplitPos; |
| 141 bAppChange = TRUE; | 141 bAppChange = true; |
| 142 if (fProposedSplitPos <= | 142 if (fProposedSplitPos <= |
| 143 fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { | 143 fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { |
| 144 return TRUE; | 144 return true; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 FX_FLOAT fRelSplitPos = fProposedSplitPos - fCurBottomMargin; | 148 FX_FLOAT fRelSplitPos = fProposedSplitPos - fCurBottomMargin; |
| 149 for (CXFA_ContentLayoutItem* pChildItem = | 149 for (CXFA_ContentLayoutItem* pChildItem = |
| 150 (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; | 150 (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; |
| 151 pChildItem; | 151 pChildItem; |
| 152 pChildItem = | 152 pChildItem = |
| 153 (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { | 153 (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) { |
| 154 FX_FLOAT fChildOffset = | 154 FX_FLOAT fChildOffset = |
| 155 fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; | 155 fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y; |
| 156 FX_BOOL bChange = FALSE; | 156 bool bChange = false; |
| 157 if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos, | 157 if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos, |
| 158 bChange, bCalculateMargin)) { | 158 bChange, bCalculateMargin)) { |
| 159 if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && | 159 if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION && |
| 160 bChange) { | 160 bChange) { |
| 161 fProposedSplitPos = fRelSplitPos - fCurTopMargin; | 161 fProposedSplitPos = fRelSplitPos - fCurTopMargin; |
| 162 } else { | 162 } else { |
| 163 fProposedSplitPos = fRelSplitPos + fCurBottomMargin; | 163 fProposedSplitPos = fRelSplitPos + fCurBottomMargin; |
| 164 } | 164 } |
| 165 bAnyChanged = TRUE; | 165 bAnyChanged = true; |
| 166 bChanged = TRUE; | 166 bChanged = true; |
| 167 if (fProposedSplitPos <= | 167 if (fProposedSplitPos <= |
| 168 fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { | 168 fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) { |
| 169 return TRUE; | 169 return true; |
| 170 } | 170 } |
| 171 if (bAnyChanged) { | 171 if (bAnyChanged) { |
| 172 break; | 172 break; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return bAnyChanged; | 177 return bAnyChanged; |
| 178 } break; | 178 } break; |
| 179 case XFA_ATTRIBUTEENUM_ContentArea: | 179 case XFA_ATTRIBUTEENUM_ContentArea: |
| 180 case XFA_ATTRIBUTEENUM_PageArea: { | 180 case XFA_ATTRIBUTEENUM_PageArea: { |
| 181 fProposedSplitPos = fCurVerticalOffset; | 181 fProposedSplitPos = fCurVerticalOffset; |
| 182 return TRUE; | 182 return true; |
| 183 } | 183 } |
| 184 default: | 184 default: |
| 185 return FALSE; | 185 return false; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 return FALSE; | 188 return false; |
| 189 } | 189 } |
| 190 static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout( | 190 static XFA_ATTRIBUTEENUM XFA_ItemLayoutProcessor_GetLayout(CXFA_Node* pFormNode, |
| 191 CXFA_Node* pFormNode, | 191 bool& bRootForceTb) { |
| 192 FX_BOOL& bRootForceTb) { | 192 bRootForceTb = false; |
| 193 bRootForceTb = FALSE; | |
| 194 XFA_ATTRIBUTEENUM eLayoutMode; | 193 XFA_ATTRIBUTEENUM eLayoutMode; |
| 195 if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, FALSE)) { | 194 if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, false)) { |
| 196 return eLayoutMode; | 195 return eLayoutMode; |
| 197 } | 196 } |
| 198 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 197 CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 199 if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { | 198 if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) { |
| 200 bRootForceTb = TRUE; | 199 bRootForceTb = true; |
| 201 return XFA_ATTRIBUTEENUM_Tb; | 200 return XFA_ATTRIBUTEENUM_Tb; |
| 202 } | 201 } |
| 203 return XFA_ATTRIBUTEENUM_Position; | 202 return XFA_ATTRIBUTEENUM_Position; |
| 204 } | 203 } |
| 205 static FX_BOOL XFA_ExistContainerKeep(CXFA_Node* pCurNode, FX_BOOL bPreFind) { | 204 static bool XFA_ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) { |
| 206 if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { | 205 if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode)) { |
| 207 return FALSE; | 206 return false; |
| 208 } | 207 } |
| 209 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; | 208 XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling; |
| 210 if (!bPreFind) { | 209 if (!bPreFind) { |
| 211 eItemType = XFA_NODEITEM_NextSibling; | 210 eItemType = XFA_NODEITEM_NextSibling; |
| 212 } | 211 } |
| 213 CXFA_Node* pPreContainer = | 212 CXFA_Node* pPreContainer = |
| 214 pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); | 213 pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode); |
| 215 if (!pPreContainer) { | 214 if (!pPreContainer) { |
| 216 return FALSE; | 215 return false; |
| 217 } | 216 } |
| 218 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); | 217 CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep); |
| 219 if (pKeep) { | 218 if (pKeep) { |
| 220 XFA_ATTRIBUTEENUM ePrevious; | 219 XFA_ATTRIBUTEENUM ePrevious; |
| 221 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; | 220 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous; |
| 222 if (!bPreFind) { | 221 if (!bPreFind) { |
| 223 eKeepType = XFA_ATTRIBUTE_Next; | 222 eKeepType = XFA_ATTRIBUTE_Next; |
| 224 } | 223 } |
| 225 if (pKeep->TryEnum(eKeepType, ePrevious, FALSE)) { | 224 if (pKeep->TryEnum(eKeepType, ePrevious, false)) { |
| 226 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || | 225 if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea || |
| 227 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { | 226 ePrevious == XFA_ATTRIBUTEENUM_PageArea) { |
| 228 return TRUE; | 227 return true; |
| 229 } | 228 } |
| 230 } | 229 } |
| 231 } | 230 } |
| 232 pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep); | 231 pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep); |
| 233 if (!pKeep) { | 232 if (!pKeep) { |
| 234 return FALSE; | 233 return false; |
| 235 } | 234 } |
| 236 XFA_ATTRIBUTEENUM eNext; | 235 XFA_ATTRIBUTEENUM eNext; |
| 237 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; | 236 XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next; |
| 238 if (!bPreFind) { | 237 if (!bPreFind) { |
| 239 eKeepType = XFA_ATTRIBUTE_Previous; | 238 eKeepType = XFA_ATTRIBUTE_Previous; |
| 240 } | 239 } |
| 241 if (!pKeep->TryEnum(eKeepType, eNext, FALSE)) { | 240 if (!pKeep->TryEnum(eKeepType, eNext, false)) { |
| 242 return FALSE; | 241 return false; |
| 243 } | 242 } |
| 244 if (eNext == XFA_ATTRIBUTEENUM_ContentArea || | 243 if (eNext == XFA_ATTRIBUTEENUM_ContentArea || |
| 245 eNext == XFA_ATTRIBUTEENUM_PageArea) { | 244 eNext == XFA_ATTRIBUTEENUM_PageArea) { |
| 246 return TRUE; | 245 return true; |
| 247 } | 246 } |
| 248 return FALSE; | 247 return false; |
| 249 } | 248 } |
| 250 FX_FLOAT CXFA_ItemLayoutProcessor::FindSplitPos(FX_FLOAT fProposedSplitPos) { | 249 FX_FLOAT CXFA_ItemLayoutProcessor::FindSplitPos(FX_FLOAT fProposedSplitPos) { |
| 251 ASSERT(m_pLayoutItem); | 250 ASSERT(m_pLayoutItem); |
| 252 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 251 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 253 FX_BOOL bCalculateMargin = TRUE; | 252 bool bCalculateMargin = true; |
| 254 if (eLayout == XFA_ATTRIBUTEENUM_Position) { | 253 if (eLayout == XFA_ATTRIBUTEENUM_Position) { |
| 255 bCalculateMargin = FALSE; | 254 bCalculateMargin = false; |
| 256 } | 255 } |
| 257 while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { | 256 while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { |
| 258 FX_BOOL bAppChange = FALSE; | 257 bool bAppChange = false; |
| 259 if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, fProposedSplitPos, bAppChange, | 258 if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, fProposedSplitPos, bAppChange, |
| 260 bCalculateMargin)) { | 259 bCalculateMargin)) { |
| 261 break; | 260 break; |
| 262 } | 261 } |
| 263 } | 262 } |
| 264 return fProposedSplitPos; | 263 return fProposedSplitPos; |
| 265 } | 264 } |
| 266 void CXFA_ItemLayoutProcessor::SplitLayoutItem( | 265 void CXFA_ItemLayoutProcessor::SplitLayoutItem( |
| 267 CXFA_ContentLayoutItem* pLayoutItem, | 266 CXFA_ContentLayoutItem* pLayoutItem, |
| 268 CXFA_ContentLayoutItem* pSecondParent, | 267 CXFA_ContentLayoutItem* pSecondParent, |
| 269 FX_FLOAT fSplitPos) { | 268 FX_FLOAT fSplitPos) { |
| 270 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; | 269 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; |
| 271 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 270 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 272 FX_BOOL bCalculateMargin = TRUE; | 271 bool bCalculateMargin = true; |
| 273 if (eLayout == XFA_ATTRIBUTEENUM_Position) { | 272 if (eLayout == XFA_ATTRIBUTEENUM_Position) { |
| 274 bCalculateMargin = FALSE; | 273 bCalculateMargin = false; |
| 275 } | 274 } |
| 276 CXFA_Node* pMarginNode = | 275 CXFA_Node* pMarginNode = |
| 277 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 276 pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 278 if (pMarginNode && bCalculateMargin) { | 277 if (pMarginNode && bCalculateMargin) { |
| 279 fCurTopMargin = | 278 fCurTopMargin = |
| 280 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 279 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
| 281 fCurBottomMargin = | 280 fCurBottomMargin = |
| 282 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 281 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
| 283 } | 282 } |
| 284 CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; | 283 CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 pLayoutItem->m_pFirstChild = nullptr; | 317 pLayoutItem->m_pFirstChild = nullptr; |
| 319 FX_FLOAT lHeightForKeep = 0; | 318 FX_FLOAT lHeightForKeep = 0; |
| 320 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; | 319 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; |
| 321 FX_FLOAT fAddMarginHeight = 0; | 320 FX_FLOAT fAddMarginHeight = 0; |
| 322 for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; | 321 for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr; |
| 323 pChildItem; pChildItem = pChildNext) { | 322 pChildItem; pChildItem = pChildNext) { |
| 324 pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; | 323 pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling; |
| 325 pChildItem->m_pNextSibling = nullptr; | 324 pChildItem->m_pNextSibling = nullptr; |
| 326 if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + | 325 if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin + |
| 327 XFA_LAYOUT_FLOAT_PERCISION) { | 326 XFA_LAYOUT_FLOAT_PERCISION) { |
| 328 if (!XFA_ExistContainerKeep(pChildItem->m_pFormNode, TRUE)) { | 327 if (!XFA_ExistContainerKeep(pChildItem->m_pFormNode, true)) { |
| 329 pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; | 328 pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin; |
| 330 pChildItem->m_sPos.y += lHeightForKeep; | 329 pChildItem->m_sPos.y += lHeightForKeep; |
| 331 pChildItem->m_sPos.y += fAddMarginHeight; | 330 pChildItem->m_sPos.y += fAddMarginHeight; |
| 332 pSecondLayoutItem->AddChild(pChildItem); | 331 pSecondLayoutItem->AddChild(pChildItem); |
| 333 } else { | 332 } else { |
| 334 if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { | 333 if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) { |
| 335 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); | 334 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); |
| 336 iIndex++) { | 335 iIndex++) { |
| 337 CXFA_ContentLayoutItem* pPreItem = keepLayoutItems[iIndex]; | 336 CXFA_ContentLayoutItem* pPreItem = keepLayoutItems[iIndex]; |
| 338 pLayoutItem->RemoveChild(pPreItem); | 337 pLayoutItem->RemoveChild(pPreItem); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 353 } | 352 } |
| 354 pChildItem->m_sPos.y -= fSplitPos; | 353 pChildItem->m_sPos.y -= fSplitPos; |
| 355 pChildItem->m_sPos.y += lHeightForKeep; | 354 pChildItem->m_sPos.y += lHeightForKeep; |
| 356 pChildItem->m_sPos.y += fAddMarginHeight; | 355 pChildItem->m_sPos.y += fAddMarginHeight; |
| 357 pSecondLayoutItem->AddChild(pChildItem); | 356 pSecondLayoutItem->AddChild(pChildItem); |
| 358 } | 357 } |
| 359 } else if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= | 358 } else if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >= |
| 360 fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + | 359 fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y + |
| 361 pChildItem->m_sSize.y) { | 360 pChildItem->m_sSize.y) { |
| 362 pLayoutItem->AddChild(pChildItem); | 361 pLayoutItem->AddChild(pChildItem); |
| 363 if (XFA_ExistContainerKeep(pChildItem->m_pFormNode, FALSE)) { | 362 if (XFA_ExistContainerKeep(pChildItem->m_pFormNode, false)) { |
| 364 keepLayoutItems.Add(pChildItem); | 363 keepLayoutItems.Add(pChildItem); |
| 365 } else { | 364 } else { |
| 366 keepLayoutItems.RemoveAll(); | 365 keepLayoutItems.RemoveAll(); |
| 367 } | 366 } |
| 368 } else { | 367 } else { |
| 369 FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.y; | 368 FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.y; |
| 370 SplitLayoutItem( | 369 SplitLayoutItem( |
| 371 pChildItem, pSecondLayoutItem, | 370 pChildItem, pSecondLayoutItem, |
| 372 fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); | 371 fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y); |
| 373 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; | 372 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 386 if (pCurNode->m_pFormNode->GetElementType() == XFA_Element::PageArea) | 385 if (pCurNode->m_pFormNode->GetElementType() == XFA_Element::PageArea) |
| 387 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); | 386 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); |
| 388 } | 387 } |
| 389 return nullptr; | 388 return nullptr; |
| 390 } | 389 } |
| 391 | 390 |
| 392 CXFA_Node* CXFA_LayoutItem::GetFormNode() const { | 391 CXFA_Node* CXFA_LayoutItem::GetFormNode() const { |
| 393 return m_pFormNode; | 392 return m_pFormNode; |
| 394 } | 393 } |
| 395 | 394 |
| 396 void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const { | 395 void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, bool bRelative) const { |
| 397 ASSERT(m_bIsContentLayoutItem); | 396 ASSERT(m_bIsContentLayoutItem); |
| 398 const CXFA_ContentLayoutItem* pThis = | 397 const CXFA_ContentLayoutItem* pThis = |
| 399 static_cast<const CXFA_ContentLayoutItem*>(this); | 398 static_cast<const CXFA_ContentLayoutItem*>(this); |
| 400 CFX_PointF sPos = pThis->m_sPos; | 399 CFX_PointF sPos = pThis->m_sPos; |
| 401 CFX_SizeF sSize = pThis->m_sSize; | 400 CFX_SizeF sSize = pThis->m_sSize; |
| 402 if (!bRelative) { | 401 if (!bRelative) { |
| 403 for (CXFA_LayoutItem* pLayoutItem = pThis->m_pParent; pLayoutItem; | 402 for (CXFA_LayoutItem* pLayoutItem = pThis->m_pParent; pLayoutItem; |
| 404 pLayoutItem = pLayoutItem->m_pParent) { | 403 pLayoutItem = pLayoutItem->m_pParent) { |
| 405 if (CXFA_ContentLayoutItem* pContent = | 404 if (CXFA_ContentLayoutItem* pContent = |
| 406 pLayoutItem->AsContentLayoutItem()) { | 405 pLayoutItem->AsContentLayoutItem()) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; | 588 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; |
| 590 pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem); | 589 pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem); |
| 591 if (pOldLayoutItem->m_pParent) | 590 if (pOldLayoutItem->m_pParent) |
| 592 pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem); | 591 pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem); |
| 593 delete pOldLayoutItem; | 592 delete pOldLayoutItem; |
| 594 pOldLayoutItem = pNextOldLayoutItem; | 593 pOldLayoutItem = pNextOldLayoutItem; |
| 595 } | 594 } |
| 596 m_pOldLayoutItem = nullptr; | 595 m_pOldLayoutItem = nullptr; |
| 597 return pLayoutItem; | 596 return pLayoutItem; |
| 598 } | 597 } |
| 599 static FX_BOOL XFA_ItemLayoutProcessor_FindBreakNode( | 598 static bool XFA_ItemLayoutProcessor_FindBreakNode( |
| 600 CXFA_Node* pContainerNode, | 599 CXFA_Node* pContainerNode, |
| 601 CXFA_Node*& pCurActionNode, | 600 CXFA_Node*& pCurActionNode, |
| 602 XFA_ItemLayoutProcessorStages& nCurStage, | 601 XFA_ItemLayoutProcessorStages& nCurStage, |
| 603 FX_BOOL bBreakBefore) { | 602 bool bBreakBefore) { |
| 604 FX_BOOL bFindRs = FALSE; | 603 bool bFindRs = false; |
| 605 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; | 604 for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode; |
| 606 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 605 pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 607 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; | 606 XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before; |
| 608 if (!bBreakBefore) { | 607 if (!bBreakBefore) { |
| 609 eAttributeType = XFA_ATTRIBUTE_After; | 608 eAttributeType = XFA_ATTRIBUTE_After; |
| 610 } | 609 } |
| 611 switch (pBreakNode->GetElementType()) { | 610 switch (pBreakNode->GetElementType()) { |
| 612 case XFA_Element::BreakBefore: { | 611 case XFA_Element::BreakBefore: { |
| 613 if (bBreakBefore) { | 612 if (bBreakBefore) { |
| 614 pCurActionNode = pBreakNode; | 613 pCurActionNode = pBreakNode; |
| 615 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; | 614 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; |
| 616 bFindRs = TRUE; | 615 bFindRs = true; |
| 617 } | 616 } |
| 618 } break; | 617 } break; |
| 619 case XFA_Element::BreakAfter: { | 618 case XFA_Element::BreakAfter: { |
| 620 if (!bBreakBefore) { | 619 if (!bBreakBefore) { |
| 621 pCurActionNode = pBreakNode; | 620 pCurActionNode = pBreakNode; |
| 622 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; | 621 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; |
| 623 bFindRs = TRUE; | 622 bFindRs = true; |
| 624 } | 623 } |
| 625 } break; | 624 } break; |
| 626 case XFA_Element::Break: | 625 case XFA_Element::Break: |
| 627 if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { | 626 if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) { |
| 628 pCurActionNode = pBreakNode; | 627 pCurActionNode = pBreakNode; |
| 629 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; | 628 nCurStage = XFA_ItemLayoutProcessorStages_BreakBefore; |
| 630 if (!bBreakBefore) { | 629 if (!bBreakBefore) { |
| 631 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; | 630 nCurStage = XFA_ItemLayoutProcessorStages_BreakAfter; |
| 632 } | 631 } |
| 633 bFindRs = TRUE; | 632 bFindRs = true; |
| 634 break; | 633 break; |
| 635 } | 634 } |
| 636 default: | 635 default: |
| 637 break; | 636 break; |
| 638 } | 637 } |
| 639 if (bFindRs) { | 638 if (bFindRs) { |
| 640 break; | 639 break; |
| 641 } | 640 } |
| 642 } | 641 } |
| 643 return bFindRs; | 642 return bFindRs; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 659 delete pCurLayoutItem; | 658 delete pCurLayoutItem; |
| 660 pCurLayoutItem = pNextLayoutItem; | 659 pCurLayoutItem = pNextLayoutItem; |
| 661 } | 660 } |
| 662 } | 661 } |
| 663 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); | 662 pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode); |
| 664 } | 663 } |
| 665 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( | 664 void CXFA_ItemLayoutProcessor::XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 666 CXFA_Node*& pCurActionNode, | 665 CXFA_Node*& pCurActionNode, |
| 667 XFA_ItemLayoutProcessorStages& nCurStage, | 666 XFA_ItemLayoutProcessorStages& nCurStage, |
| 668 CXFA_Node* pParentContainer, | 667 CXFA_Node* pParentContainer, |
| 669 FX_BOOL bUsePageBreak) { | 668 bool bUsePageBreak) { |
| 670 CXFA_Node* pEntireContainer = pParentContainer; | 669 CXFA_Node* pEntireContainer = pParentContainer; |
| 671 CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE; | 670 CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE; |
| 672 switch (nCurStage) { | 671 switch (nCurStage) { |
| 673 case XFA_ItemLayoutProcessorStages_BreakBefore: | 672 case XFA_ItemLayoutProcessorStages_BreakBefore: |
| 674 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 673 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
| 675 pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent); | 674 pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 676 } break; | 675 } break; |
| 677 case XFA_ItemLayoutProcessorStages_Keep: | 676 case XFA_ItemLayoutProcessorStages_Keep: |
| 678 case XFA_ItemLayoutProcessorStages_Container: | 677 case XFA_ItemLayoutProcessorStages_Container: |
| 679 pChildContainer = pCurActionNode; | 678 pChildContainer = pCurActionNode; |
| 680 break; | 679 break; |
| 681 default: | 680 default: |
| 682 pChildContainer = XFA_LAYOUT_INVALIDNODE; | 681 pChildContainer = XFA_LAYOUT_INVALIDNODE; |
| 683 break; | 682 break; |
| 684 } | 683 } |
| 685 switch (nCurStage) { | 684 switch (nCurStage) { |
| 686 case XFA_ItemLayoutProcessorStages_Keep: { | 685 case XFA_ItemLayoutProcessorStages_Keep: { |
| 687 CXFA_Node* pBreakAfterNode = | 686 CXFA_Node* pBreakAfterNode = |
| 688 pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); | 687 pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 689 if (!m_bKeepBreakFinish && | 688 if (!m_bKeepBreakFinish && |
| 690 XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, | 689 XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, |
| 691 nCurStage, FALSE)) { | 690 nCurStage, false)) { |
| 692 return; | 691 return; |
| 693 } | 692 } |
| 694 goto CheckNextChildContainer; | 693 goto CheckNextChildContainer; |
| 695 } | 694 } |
| 696 case XFA_ItemLayoutProcessorStages_None: { | 695 case XFA_ItemLayoutProcessorStages_None: { |
| 697 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 696 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
| 698 case XFA_ItemLayoutProcessorStages_BookendLeader: | 697 case XFA_ItemLayoutProcessorStages_BookendLeader: |
| 699 for (CXFA_Node* pBookendNode = | 698 for (CXFA_Node* pBookendNode = |
| 700 pCurActionNode == XFA_LAYOUT_INVALIDNODE | 699 pCurActionNode == XFA_LAYOUT_INVALIDNODE |
| 701 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) | 700 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 714 } | 713 } |
| 715 } | 714 } |
| 716 { | 715 { |
| 717 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 716 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
| 718 case XFA_ItemLayoutProcessorStages_BreakBefore: | 717 case XFA_ItemLayoutProcessorStages_BreakBefore: |
| 719 if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) { | 718 if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) { |
| 720 CXFA_Node* pBreakBeforeNode = | 719 CXFA_Node* pBreakBeforeNode = |
| 721 pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 720 pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 722 if (!m_bKeepBreakFinish && | 721 if (!m_bKeepBreakFinish && |
| 723 XFA_ItemLayoutProcessor_FindBreakNode( | 722 XFA_ItemLayoutProcessor_FindBreakNode( |
| 724 pBreakBeforeNode, pCurActionNode, nCurStage, TRUE)) { | 723 pBreakBeforeNode, pCurActionNode, nCurStage, true)) { |
| 725 return; | 724 return; |
| 726 } | 725 } |
| 727 if (m_bIsProcessKeep) { | 726 if (m_bIsProcessKeep) { |
| 728 if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage, | 727 if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage, |
| 729 pChildContainer)) { | 728 pChildContainer)) { |
| 730 return; | 729 return; |
| 731 } | 730 } |
| 732 goto CheckNextChildContainer; | 731 goto CheckNextChildContainer; |
| 733 } | 732 } |
| 734 pCurActionNode = pChildContainer; | 733 pCurActionNode = pChildContainer; |
| 735 nCurStage = XFA_ItemLayoutProcessorStages_Container; | 734 nCurStage = XFA_ItemLayoutProcessorStages_Container; |
| 736 return; | 735 return; |
| 737 } | 736 } |
| 738 goto CheckNextChildContainer; | 737 goto CheckNextChildContainer; |
| 739 } | 738 } |
| 740 case XFA_ItemLayoutProcessorStages_Container: { | 739 case XFA_ItemLayoutProcessorStages_Container: { |
| 741 pCurActionNode = XFA_LAYOUT_INVALIDNODE; | 740 pCurActionNode = XFA_LAYOUT_INVALIDNODE; |
| 742 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 741 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
| 743 if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) { | 742 if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) { |
| 744 CXFA_Node* pBreakAfterNode = | 743 CXFA_Node* pBreakAfterNode = |
| 745 pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); | 744 pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 746 if (!m_bKeepBreakFinish && | 745 if (!m_bKeepBreakFinish && |
| 747 XFA_ItemLayoutProcessor_FindBreakNode( | 746 XFA_ItemLayoutProcessor_FindBreakNode( |
| 748 pBreakAfterNode, pCurActionNode, nCurStage, FALSE)) { | 747 pBreakAfterNode, pCurActionNode, nCurStage, false)) { |
| 749 return; | 748 return; |
| 750 } | 749 } |
| 751 } else { | 750 } else { |
| 752 CXFA_Node* pBreakAfterNode = | 751 CXFA_Node* pBreakAfterNode = |
| 753 pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 752 pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 754 if (XFA_ItemLayoutProcessor_FindBreakNode( | 753 if (XFA_ItemLayoutProcessor_FindBreakNode( |
| 755 pBreakAfterNode, pCurActionNode, nCurStage, FALSE)) { | 754 pBreakAfterNode, pCurActionNode, nCurStage, false)) { |
| 756 return; | 755 return; |
| 757 } | 756 } |
| 758 } | 757 } |
| 759 goto CheckNextChildContainer; | 758 goto CheckNextChildContainer; |
| 760 } | 759 } |
| 761 } | 760 } |
| 762 CheckNextChildContainer : { | 761 CheckNextChildContainer : { |
| 763 CXFA_Node* pNextChildContainer = | 762 CXFA_Node* pNextChildContainer = |
| 764 pChildContainer == XFA_LAYOUT_INVALIDNODE | 763 pChildContainer == XFA_LAYOUT_INVALIDNODE |
| 765 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild, | 764 ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild, |
| 766 XFA_ObjectType::ContainerNode) | 765 XFA_ObjectType::ContainerNode) |
| 767 : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, | 766 : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, |
| 768 XFA_ObjectType::ContainerNode); | 767 XFA_ObjectType::ContainerNode); |
| 769 while (pNextChildContainer && | 768 while (pNextChildContainer && |
| 770 pNextChildContainer->IsLayoutGeneratedNode()) { | 769 pNextChildContainer->IsLayoutGeneratedNode()) { |
| 771 CXFA_Node* pSaveNode = pNextChildContainer; | 770 CXFA_Node* pSaveNode = pNextChildContainer; |
| 772 pNextChildContainer = pNextChildContainer->GetNodeItem( | 771 pNextChildContainer = pNextChildContainer->GetNodeItem( |
| 773 XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode); | 772 XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode); |
| 774 if (pSaveNode->IsUnusedNode()) | 773 if (pSaveNode->IsUnusedNode()) |
| 775 XFA_DeleteLayoutGeneratedNode(pSaveNode); | 774 XFA_DeleteLayoutGeneratedNode(pSaveNode); |
| 776 } | 775 } |
| 777 if (!pNextChildContainer) { | 776 if (!pNextChildContainer) { |
| 778 goto NoMoreChildContainer; | 777 goto NoMoreChildContainer; |
| 779 } | 778 } |
| 780 FX_BOOL bLastKeep = FALSE; | 779 bool bLastKeep = false; |
| 781 if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage, | 780 if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage, |
| 782 pNextChildContainer, bLastKeep)) { | 781 pNextChildContainer, bLastKeep)) { |
| 783 return; | 782 return; |
| 784 } | 783 } |
| 785 if (!m_bKeepBreakFinish && !bLastKeep && | 784 if (!m_bKeepBreakFinish && !bLastKeep && |
| 786 XFA_ItemLayoutProcessor_FindBreakNode( | 785 XFA_ItemLayoutProcessor_FindBreakNode( |
| 787 pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild), | 786 pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild), |
| 788 pCurActionNode, nCurStage, TRUE)) { | 787 pCurActionNode, nCurStage, true)) { |
| 789 return; | 788 return; |
| 790 } | 789 } |
| 791 pCurActionNode = pNextChildContainer; | 790 pCurActionNode = pNextChildContainer; |
| 792 if (m_bIsProcessKeep) { | 791 if (m_bIsProcessKeep) { |
| 793 nCurStage = XFA_ItemLayoutProcessorStages_Keep; | 792 nCurStage = XFA_ItemLayoutProcessorStages_Keep; |
| 794 } else { | 793 } else { |
| 795 nCurStage = XFA_ItemLayoutProcessorStages_Container; | 794 nCurStage = XFA_ItemLayoutProcessorStages_Container; |
| 796 } | 795 } |
| 797 return; | 796 return; |
| 798 } | 797 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 814 default: | 813 default: |
| 815 break; | 814 break; |
| 816 } | 815 } |
| 817 } | 816 } |
| 818 } | 817 } |
| 819 default: | 818 default: |
| 820 pCurActionNode = nullptr; | 819 pCurActionNode = nullptr; |
| 821 nCurStage = XFA_ItemLayoutProcessorStages_Done; | 820 nCurStage = XFA_ItemLayoutProcessorStages_Done; |
| 822 } | 821 } |
| 823 } | 822 } |
| 824 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( | 823 bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( |
| 825 CXFA_Node*& pCurActionNode, | 824 CXFA_Node*& pCurActionNode, |
| 826 XFA_ItemLayoutProcessorStages& nCurStage, | 825 XFA_ItemLayoutProcessorStages& nCurStage, |
| 827 CXFA_Node*& pNextContainer, | 826 CXFA_Node*& pNextContainer, |
| 828 FX_BOOL& bLastKeepNode) { | 827 bool& bLastKeepNode) { |
| 829 const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; | 828 const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; |
| 830 FX_BOOL bNextKeep = FALSE; | 829 bool bNextKeep = false; |
| 831 if (XFA_ExistContainerKeep(pNextContainer, FALSE)) { | 830 if (XFA_ExistContainerKeep(pNextContainer, false)) { |
| 832 bNextKeep = TRUE; | 831 bNextKeep = true; |
| 833 } | 832 } |
| 834 if (bNextKeep && !bCanSplit) { | 833 if (bNextKeep && !bCanSplit) { |
| 835 if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { | 834 if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { |
| 836 m_pKeepHeadNode = pNextContainer; | 835 m_pKeepHeadNode = pNextContainer; |
| 837 m_bIsProcessKeep = TRUE; | 836 m_bIsProcessKeep = true; |
| 838 } | 837 } |
| 839 } else { | 838 } else { |
| 840 if (m_bIsProcessKeep && m_pKeepHeadNode) { | 839 if (m_bIsProcessKeep && m_pKeepHeadNode) { |
| 841 m_pKeepTailNode = pNextContainer; | 840 m_pKeepTailNode = pNextContainer; |
| 842 if (!m_bKeepBreakFinish && | 841 if (!m_bKeepBreakFinish && |
| 843 XFA_ItemLayoutProcessor_FindBreakNode( | 842 XFA_ItemLayoutProcessor_FindBreakNode( |
| 844 pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), | 843 pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild), |
| 845 pCurActionNode, nCurStage, TRUE)) { | 844 pCurActionNode, nCurStage, true)) { |
| 846 return TRUE; | 845 return true; |
| 847 } else { | 846 } else { |
| 848 pNextContainer = m_pKeepHeadNode; | 847 pNextContainer = m_pKeepHeadNode; |
| 849 m_bKeepBreakFinish = TRUE; | 848 m_bKeepBreakFinish = true; |
| 850 m_pKeepHeadNode = nullptr; | 849 m_pKeepHeadNode = nullptr; |
| 851 m_pKeepTailNode = nullptr; | 850 m_pKeepTailNode = nullptr; |
| 852 m_bIsProcessKeep = FALSE; | 851 m_bIsProcessKeep = false; |
| 853 } | 852 } |
| 854 } else { | 853 } else { |
| 855 if (m_bKeepBreakFinish) { | 854 if (m_bKeepBreakFinish) { |
| 856 bLastKeepNode = TRUE; | 855 bLastKeepNode = true; |
| 857 } | 856 } |
| 858 m_bKeepBreakFinish = FALSE; | 857 m_bKeepBreakFinish = false; |
| 859 } | 858 } |
| 860 } | 859 } |
| 861 return FALSE; | 860 return false; |
| 862 } | 861 } |
| 863 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( | 862 bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( |
| 864 CXFA_Node*& pCurActionNode, | 863 CXFA_Node*& pCurActionNode, |
| 865 XFA_ItemLayoutProcessorStages& nCurStage, | 864 XFA_ItemLayoutProcessorStages& nCurStage, |
| 866 CXFA_Node* pContainerNode) { | 865 CXFA_Node* pContainerNode) { |
| 867 if (m_pKeepTailNode == pContainerNode) { | 866 if (m_pKeepTailNode == pContainerNode) { |
| 868 pCurActionNode = m_pKeepHeadNode; | 867 pCurActionNode = m_pKeepHeadNode; |
| 869 m_bKeepBreakFinish = TRUE; | 868 m_bKeepBreakFinish = true; |
| 870 m_pKeepHeadNode = nullptr; | 869 m_pKeepHeadNode = nullptr; |
| 871 m_pKeepTailNode = nullptr; | 870 m_pKeepTailNode = nullptr; |
| 872 m_bIsProcessKeep = FALSE; | 871 m_bIsProcessKeep = false; |
| 873 nCurStage = XFA_ItemLayoutProcessorStages_Container; | 872 nCurStage = XFA_ItemLayoutProcessorStages_Container; |
| 874 return TRUE; | 873 return true; |
| 875 } | 874 } |
| 876 CXFA_Node* pBreakAfterNode = | 875 CXFA_Node* pBreakAfterNode = |
| 877 pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 876 pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 878 if (XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, | 877 if (XFA_ItemLayoutProcessor_FindBreakNode(pBreakAfterNode, pCurActionNode, |
| 879 nCurStage, FALSE)) { | 878 nCurStage, false)) { |
| 880 return TRUE; | 879 return true; |
| 881 } | 880 } |
| 882 return FALSE; | 881 return false; |
| 883 } | 882 } |
| 884 FX_BOOL XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) { | 883 bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) { |
| 885 XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence); | 884 XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence); |
| 886 return ePresence == XFA_ATTRIBUTEENUM_Visible || | 885 return ePresence == XFA_ATTRIBUTEENUM_Visible || |
| 887 ePresence == XFA_ATTRIBUTEENUM_Invisible; | 886 ePresence == XFA_ATTRIBUTEENUM_Invisible; |
| 888 } | 887 } |
| 889 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 888 static inline void XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
| 890 CXFA_Node* pFormNode, | 889 CXFA_Node* pFormNode, |
| 891 FX_FLOAT& fContainerWidth, | 890 FX_FLOAT& fContainerWidth, |
| 892 FX_FLOAT& fContainerHeight, | 891 FX_FLOAT& fContainerHeight, |
| 893 FX_BOOL& bContainerWidthAutoSize, | 892 bool& bContainerWidthAutoSize, |
| 894 FX_BOOL& bContainerHeightAutoSize) { | 893 bool& bContainerHeightAutoSize) { |
| 895 fContainerWidth = 0; | 894 fContainerWidth = 0; |
| 896 fContainerHeight = 0; | 895 fContainerHeight = 0; |
| 897 bContainerWidthAutoSize = TRUE; | 896 bContainerWidthAutoSize = true; |
| 898 bContainerHeightAutoSize = TRUE; | 897 bContainerHeightAutoSize = true; |
| 899 XFA_Element eType = pFormNode->GetElementType(); | 898 XFA_Element eType = pFormNode->GetElementType(); |
| 900 CXFA_Measurement mTmpValue; | 899 CXFA_Measurement mTmpValue; |
| 901 if (bContainerWidthAutoSize && | 900 if (bContainerWidthAutoSize && |
| 902 (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && | 901 (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && |
| 903 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, FALSE) && | 902 pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) && |
| 904 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 903 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
| 905 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); | 904 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 906 bContainerWidthAutoSize = FALSE; | 905 bContainerWidthAutoSize = false; |
| 907 } | 906 } |
| 908 if (bContainerHeightAutoSize && | 907 if (bContainerHeightAutoSize && |
| 909 (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && | 908 (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) && |
| 910 pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, FALSE) && | 909 pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) && |
| 911 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 910 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
| 912 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); | 911 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 913 bContainerHeightAutoSize = FALSE; | 912 bContainerHeightAutoSize = false; |
| 914 } | 913 } |
| 915 if (bContainerWidthAutoSize && eType == XFA_Element::Subform && | 914 if (bContainerWidthAutoSize && eType == XFA_Element::Subform && |
| 916 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, FALSE) && | 915 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) && |
| 917 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 916 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
| 918 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); | 917 fContainerWidth = mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 919 bContainerWidthAutoSize = FALSE; | 918 bContainerWidthAutoSize = false; |
| 920 } | 919 } |
| 921 if (bContainerHeightAutoSize && eType == XFA_Element::Subform && | 920 if (bContainerHeightAutoSize && eType == XFA_Element::Subform && |
| 922 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, FALSE) && | 921 pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) && |
| 923 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { | 922 mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { |
| 924 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); | 923 fContainerHeight = mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 925 bContainerHeightAutoSize = FALSE; | 924 bContainerHeightAutoSize = false; |
| 926 } | 925 } |
| 927 } | 926 } |
| 928 static inline void | 927 static inline void |
| 929 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 928 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
| 930 CXFA_Node* pFormNode, | 929 CXFA_Node* pFormNode, |
| 931 FX_BOOL bContainerWidthAutoSize, | 930 bool bContainerWidthAutoSize, |
| 932 FX_FLOAT fContentCalculatedWidth, | 931 FX_FLOAT fContentCalculatedWidth, |
| 933 FX_FLOAT& fContainerWidth, | 932 FX_FLOAT& fContainerWidth, |
| 934 FX_BOOL bContainerHeightAutoSize, | 933 bool bContainerHeightAutoSize, |
| 935 FX_FLOAT fContentCalculatedHeight, | 934 FX_FLOAT fContentCalculatedHeight, |
| 936 FX_FLOAT& fContainerHeight) { | 935 FX_FLOAT& fContainerHeight) { |
| 937 CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 936 CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 938 CXFA_Measurement mTmpValue; | 937 CXFA_Measurement mTmpValue; |
| 939 if (bContainerWidthAutoSize) { | 938 if (bContainerWidthAutoSize) { |
| 940 fContainerWidth = fContentCalculatedWidth; | 939 fContainerWidth = fContentCalculatedWidth; |
| 941 if (pMarginNode) { | 940 if (pMarginNode) { |
| 942 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, FALSE)) { | 941 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false)) { |
| 943 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); | 942 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 944 } | 943 } |
| 945 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, FALSE)) { | 944 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false)) { |
| 946 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); | 945 fContainerWidth += mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 947 } | 946 } |
| 948 } | 947 } |
| 949 } | 948 } |
| 950 if (bContainerHeightAutoSize) { | 949 if (bContainerHeightAutoSize) { |
| 951 fContainerHeight = fContentCalculatedHeight; | 950 fContainerHeight = fContentCalculatedHeight; |
| 952 if (pMarginNode) { | 951 if (pMarginNode) { |
| 953 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, FALSE)) { | 952 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false)) { |
| 954 fContainerHeight += mTmpValue.ToUnit(XFA_UNIT_Pt); | 953 fContainerHeight += mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 955 } | 954 } |
| 956 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, | 955 if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue, |
| 957 FALSE)) { | 956 false)) { |
| 958 fContainerHeight += mTmpValue.ToUnit(XFA_UNIT_Pt); | 957 fContainerHeight += mTmpValue.ToUnit(XFA_UNIT_Pt); |
| 959 } | 958 } |
| 960 } | 959 } |
| 961 } | 960 } |
| 962 } | 961 } |
| 963 void CXFA_ItemLayoutProcessor::CalculatePositionedContainerPos( | 962 void CXFA_ItemLayoutProcessor::CalculatePositionedContainerPos( |
| 964 CXFA_Node* pNode, | 963 CXFA_Node* pNode, |
| 965 FX_FLOAT fWidth, | 964 FX_FLOAT fWidth, |
| 966 FX_FLOAT fHeight, | 965 FX_FLOAT fHeight, |
| 967 FX_FLOAT& fAbsoluteX, | 966 FX_FLOAT& fAbsoluteX, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 case 1: | 1025 case 1: |
| 1027 fAbsoluteX -= fWidth / 2; | 1026 fAbsoluteX -= fWidth / 2; |
| 1028 break; | 1027 break; |
| 1029 case 2: | 1028 case 2: |
| 1030 fAbsoluteX -= fWidth; | 1029 fAbsoluteX -= fWidth; |
| 1031 break; | 1030 break; |
| 1032 default: | 1031 default: |
| 1033 break; | 1032 break; |
| 1034 } | 1033 } |
| 1035 } | 1034 } |
| 1036 FX_BOOL CXFA_ItemLayoutProcessor::IncrementRelayoutNode( | 1035 bool CXFA_ItemLayoutProcessor::IncrementRelayoutNode( |
| 1037 CXFA_LayoutProcessor* pLayoutProcessor, | 1036 CXFA_LayoutProcessor* pLayoutProcessor, |
| 1038 CXFA_Node* pNode, | 1037 CXFA_Node* pNode, |
| 1039 CXFA_Node* pParentNode) { | 1038 CXFA_Node* pParentNode) { |
| 1040 return FALSE; | 1039 return false; |
| 1041 } | 1040 } |
| 1042 void CXFA_ItemLayoutProcessor::DoLayoutPageArea( | 1041 void CXFA_ItemLayoutProcessor::DoLayoutPageArea( |
| 1043 CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { | 1042 CXFA_ContainerLayoutItem* pPageAreaLayoutItem) { |
| 1044 CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; | 1043 CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode; |
| 1045 CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; | 1044 CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE; |
| 1046 XFA_ItemLayoutProcessorStages nCurChildNodeStage = | 1045 XFA_ItemLayoutProcessorStages nCurChildNodeStage = |
| 1047 XFA_ItemLayoutProcessorStages_None; | 1046 XFA_ItemLayoutProcessorStages_None; |
| 1048 CXFA_LayoutItem* pBeforeItem = nullptr; | 1047 CXFA_LayoutItem* pBeforeItem = nullptr; |
| 1049 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1048 for (XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1050 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE); | 1049 pCurChildNode, nCurChildNodeStage, pFormNode, false); |
| 1051 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1050 pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1052 pCurChildNode, nCurChildNodeStage, pFormNode, FALSE)) { | 1051 pCurChildNode, nCurChildNodeStage, pFormNode, false)) { |
| 1053 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1052 if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
| 1054 continue; | 1053 continue; |
| 1055 } | 1054 } |
| 1056 if (pCurChildNode->GetElementType() == XFA_Element::Variables) { | 1055 if (pCurChildNode->GetElementType() == XFA_Element::Variables) { |
| 1057 continue; | 1056 continue; |
| 1058 } | 1057 } |
| 1059 CXFA_ItemLayoutProcessor* pProcessor = | 1058 CXFA_ItemLayoutProcessor* pProcessor = |
| 1060 new CXFA_ItemLayoutProcessor(pCurChildNode, nullptr); | 1059 new CXFA_ItemLayoutProcessor(pCurChildNode, nullptr); |
| 1061 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 1060 pProcessor->DoLayout(false, XFA_LAYOUT_FLOAT_MAX); |
| 1062 if (!pProcessor->HasLayoutItem()) { | 1061 if (!pProcessor->HasLayoutItem()) { |
| 1063 delete pProcessor; | 1062 delete pProcessor; |
| 1064 continue; | 1063 continue; |
| 1065 } | 1064 } |
| 1066 FX_FLOAT fWidth, fHeight; | 1065 FX_FLOAT fWidth, fHeight; |
| 1067 pProcessor->GetCurrentComponentSize(fWidth, fHeight); | 1066 pProcessor->GetCurrentComponentSize(fWidth, fHeight); |
| 1068 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; | 1067 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; |
| 1069 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, | 1068 CalculatePositionedContainerPos(pCurChildNode, fWidth, fHeight, fAbsoluteX, |
| 1070 fAbsoluteY); | 1069 fAbsoluteY); |
| 1071 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1070 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1098 pLayoutItem = pNextLayoutItem; | 1097 pLayoutItem = pNextLayoutItem; |
| 1099 } | 1098 } |
| 1100 } | 1099 } |
| 1101 } | 1100 } |
| 1102 void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( | 1101 void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( |
| 1103 CXFA_LayoutContext* pContext) { | 1102 CXFA_LayoutContext* pContext) { |
| 1104 if (m_pLayoutItem) | 1103 if (m_pLayoutItem) |
| 1105 return; | 1104 return; |
| 1106 | 1105 |
| 1107 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 1106 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
| 1108 FX_BOOL bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) != | 1107 bool bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) != |
| 1109 XFA_ATTRIBUTEENUM_Position); | 1108 XFA_ATTRIBUTEENUM_Position); |
| 1110 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1109 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
| 1111 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1110 bool bContainerWidthAutoSize = true, bContainerHeightAutoSize = true; |
| 1112 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1111 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
| 1113 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, | 1112 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, |
| 1114 bContainerHeightAutoSize); | 1113 bContainerHeightAutoSize); |
| 1115 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 1114 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
| 1116 FX_FLOAT fHiddenContentCalculatedWidth = 0, | 1115 FX_FLOAT fHiddenContentCalculatedWidth = 0, |
| 1117 fHiddenContentCalculatedHeight = 0; | 1116 fHiddenContentCalculatedHeight = 0; |
| 1118 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { | 1117 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { |
| 1119 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1118 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1120 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); | 1119 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false); |
| 1121 } | 1120 } |
| 1122 int32_t iColIndex = 0; | 1121 int32_t iColIndex = 0; |
| 1123 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1122 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1124 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { | 1123 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { |
| 1125 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1124 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
| 1126 continue; | 1125 continue; |
| 1127 } | 1126 } |
| 1128 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { | 1127 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { |
| 1129 continue; | 1128 continue; |
| 1130 } | 1129 } |
| 1131 CXFA_ItemLayoutProcessor* pProcessor = | 1130 CXFA_ItemLayoutProcessor* pProcessor = |
| 1132 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 1131 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
| 1133 if (pContext && pContext->m_prgSpecifiedColumnWidths) { | 1132 if (pContext && pContext->m_prgSpecifiedColumnWidths) { |
| 1134 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); | 1133 int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan); |
| 1135 if (iColSpan <= | 1134 if (iColSpan <= |
| 1136 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { | 1135 pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) { |
| 1137 pContext->m_fCurColumnWidth = 0; | 1136 pContext->m_fCurColumnWidth = 0; |
| 1138 pContext->m_bCurColumnWidthAvaiable = TRUE; | 1137 pContext->m_bCurColumnWidthAvaiable = true; |
| 1139 if (iColSpan == -1) | 1138 if (iColSpan == -1) |
| 1140 iColSpan = pContext->m_prgSpecifiedColumnWidths->GetSize(); | 1139 iColSpan = pContext->m_prgSpecifiedColumnWidths->GetSize(); |
| 1141 for (int32_t i = 0; iColIndex + i < iColSpan; ++i) { | 1140 for (int32_t i = 0; iColIndex + i < iColSpan; ++i) { |
| 1142 pContext->m_fCurColumnWidth += | 1141 pContext->m_fCurColumnWidth += |
| 1143 pContext->m_prgSpecifiedColumnWidths->GetAt(iColIndex + i); | 1142 pContext->m_prgSpecifiedColumnWidths->GetAt(iColIndex + i); |
| 1144 } | 1143 } |
| 1145 if (pContext->m_fCurColumnWidth == 0) | 1144 if (pContext->m_fCurColumnWidth == 0) |
| 1146 pContext->m_bCurColumnWidthAvaiable = FALSE; | 1145 pContext->m_bCurColumnWidthAvaiable = false; |
| 1147 iColIndex += iColSpan >= 0 ? iColSpan : 0; | 1146 iColIndex += iColSpan >= 0 ? iColSpan : 0; |
| 1148 } | 1147 } |
| 1149 } | 1148 } |
| 1150 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, | 1149 pProcessor->DoLayout(false, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, |
| 1151 pContext); | 1150 pContext); |
| 1152 if (!pProcessor->HasLayoutItem()) { | 1151 if (!pProcessor->HasLayoutItem()) { |
| 1153 delete pProcessor; | 1152 delete pProcessor; |
| 1154 continue; | 1153 continue; |
| 1155 } | 1154 } |
| 1156 FX_FLOAT fWidth, fHeight; | 1155 FX_FLOAT fWidth, fHeight; |
| 1157 pProcessor->GetCurrentComponentSize(fWidth, fHeight); | 1156 pProcessor->GetCurrentComponentSize(fWidth, fHeight); |
| 1158 FX_BOOL bChangeParentSize = FALSE; | 1157 bool bChangeParentSize = false; |
| 1159 if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { | 1158 if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { |
| 1160 bChangeParentSize = TRUE; | 1159 bChangeParentSize = true; |
| 1161 } | 1160 } |
| 1162 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; | 1161 FX_FLOAT fAbsoluteX = 0, fAbsoluteY = 0; |
| 1163 if (!bIgnoreXY) { | 1162 if (!bIgnoreXY) { |
| 1164 CalculatePositionedContainerPos(m_pCurChildNode, fWidth, fHeight, | 1163 CalculatePositionedContainerPos(m_pCurChildNode, fWidth, fHeight, |
| 1165 fAbsoluteX, fAbsoluteY); | 1164 fAbsoluteX, fAbsoluteY); |
| 1166 } | 1165 } |
| 1167 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); | 1166 pProcessor->SetCurrentComponentPos(fAbsoluteX, fAbsoluteY); |
| 1168 if (bContainerWidthAutoSize) { | 1167 if (bContainerWidthAutoSize) { |
| 1169 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; | 1168 FX_FLOAT fChildSuppliedWidth = fAbsoluteX + fWidth; |
| 1170 if (bChangeParentSize) { | 1169 if (bChangeParentSize) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 } | 1225 } |
| 1227 break; | 1226 break; |
| 1228 } | 1227 } |
| 1229 case XFA_Element::Draw: | 1228 case XFA_Element::Draw: |
| 1230 case XFA_Element::Field: { | 1229 case XFA_Element::Field: { |
| 1231 pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, fWidth, | 1230 pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, fWidth, |
| 1232 fHeight); | 1231 fHeight); |
| 1233 break; | 1232 break; |
| 1234 } | 1233 } |
| 1235 default: | 1234 default: |
| 1236 ASSERT(FALSE); | 1235 ASSERT(false); |
| 1237 } | 1236 } |
| 1238 } | 1237 } |
| 1239 static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( | 1238 static inline void XFA_ItemLayoutProcessor_RelocateTableRowCells( |
| 1240 CXFA_ContentLayoutItem* pLayoutRow, | 1239 CXFA_ContentLayoutItem* pLayoutRow, |
| 1241 const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths, | 1240 const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths, |
| 1242 XFA_ATTRIBUTEENUM eLayout) { | 1241 XFA_ATTRIBUTEENUM eLayout) { |
| 1243 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1242 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
| 1244 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1243 bool bContainerWidthAutoSize = true, bContainerHeightAutoSize = true; |
| 1245 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1244 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
| 1246 pLayoutRow->m_pFormNode, fContainerWidth, fContainerHeight, | 1245 pLayoutRow->m_pFormNode, fContainerWidth, fContainerHeight, |
| 1247 bContainerWidthAutoSize, bContainerHeightAutoSize); | 1246 bContainerWidthAutoSize, bContainerHeightAutoSize); |
| 1248 CXFA_Node* pMarginNode = | 1247 CXFA_Node* pMarginNode = |
| 1249 pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 1248 pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 1250 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; | 1249 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; |
| 1251 if (pMarginNode) { | 1250 if (pMarginNode) { |
| 1252 fLeftInset = | 1251 fLeftInset = |
| 1253 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 1252 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
| 1254 fTopInset = | 1253 fTopInset = |
| 1255 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 1254 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
| 1256 fRightInset = | 1255 fRightInset = |
| 1257 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 1256 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
| 1258 fBottomInset = | 1257 fBottomInset = |
| 1259 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 1258 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
| 1260 } | 1259 } |
| 1261 FX_FLOAT fContentWidthLimit = | 1260 FX_FLOAT fContentWidthLimit = |
| 1262 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX | 1261 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX |
| 1263 : fContainerWidth - fLeftInset - fRightInset; | 1262 : fContainerWidth - fLeftInset - fRightInset; |
| 1264 FX_FLOAT fContentCurrentHeight = | 1263 FX_FLOAT fContentCurrentHeight = |
| 1265 pLayoutRow->m_sSize.y - fTopInset - fBottomInset; | 1264 pLayoutRow->m_sSize.y - fTopInset - fBottomInset; |
| 1266 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 1265 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
| 1267 FX_FLOAT fCurrentColX = 0; | 1266 FX_FLOAT fCurrentColX = 0; |
| 1268 int32_t nCurrentColIdx = 0; | 1267 int32_t nCurrentColIdx = 0; |
| 1269 FX_BOOL bMetWholeRowCell = FALSE; | 1268 bool bMetWholeRowCell = false; |
| 1270 for (CXFA_ContentLayoutItem* pLayoutChild = | 1269 for (CXFA_ContentLayoutItem* pLayoutChild = |
| 1271 (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; | 1270 (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; |
| 1272 pLayoutChild; | 1271 pLayoutChild; |
| 1273 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { | 1272 pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) { |
| 1274 int32_t nOriginalColSpan = | 1273 int32_t nOriginalColSpan = |
| 1275 pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); | 1274 pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); |
| 1276 int32_t nColSpan = nOriginalColSpan; | 1275 int32_t nColSpan = nOriginalColSpan; |
| 1277 FX_FLOAT fColSpanWidth = 0; | 1276 FX_FLOAT fColSpanWidth = 0; |
| 1278 if (nColSpan == -1 || | 1277 if (nColSpan == -1 || |
| 1279 nCurrentColIdx + nColSpan > rgSpecifiedColumnWidths.GetSize()) { | 1278 nCurrentColIdx + nColSpan > rgSpecifiedColumnWidths.GetSize()) { |
| 1280 nColSpan = rgSpecifiedColumnWidths.GetSize() - nCurrentColIdx; | 1279 nColSpan = rgSpecifiedColumnWidths.GetSize() - nCurrentColIdx; |
| 1281 } | 1280 } |
| 1282 for (int32_t i = 0; i < nColSpan; i++) { | 1281 for (int32_t i = 0; i < nColSpan; i++) { |
| 1283 fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; | 1282 fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i]; |
| 1284 } | 1283 } |
| 1285 if (nColSpan != nOriginalColSpan) { | 1284 if (nColSpan != nOriginalColSpan) { |
| 1286 fColSpanWidth = bMetWholeRowCell ? 0 : std::max(fColSpanWidth, | 1285 fColSpanWidth = bMetWholeRowCell ? 0 : std::max(fColSpanWidth, |
| 1287 pLayoutChild->m_sSize.y); | 1286 pLayoutChild->m_sSize.y); |
| 1288 } | 1287 } |
| 1289 if (nOriginalColSpan == -1) { | 1288 if (nOriginalColSpan == -1) { |
| 1290 bMetWholeRowCell = TRUE; | 1289 bMetWholeRowCell = true; |
| 1291 } | 1290 } |
| 1292 pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); | 1291 pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0); |
| 1293 pLayoutChild->m_sSize.x = fColSpanWidth; | 1292 pLayoutChild->m_sSize.x = fColSpanWidth; |
| 1294 if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { | 1293 if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode)) { |
| 1295 fCurrentColX += fColSpanWidth; | 1294 fCurrentColX += fColSpanWidth; |
| 1296 nCurrentColIdx += nColSpan; | 1295 nCurrentColIdx += nColSpan; |
| 1297 FX_FLOAT fNewHeight = | 1296 FX_FLOAT fNewHeight = |
| 1298 bContainerHeightAutoSize ? -1 : fContentCurrentHeight; | 1297 bContainerHeightAutoSize ? -1 : fContentCurrentHeight; |
| 1299 XFA_ItemLayoutProcessor_UpdateWidgetSize(pLayoutChild, fColSpanWidth, | 1298 XFA_ItemLayoutProcessor_UpdateWidgetSize(pLayoutChild, fColSpanWidth, |
| 1300 fNewHeight); | 1299 fNewHeight); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { | 1374 void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { |
| 1376 if (m_pLayoutItem) | 1375 if (m_pLayoutItem) |
| 1377 return; | 1376 return; |
| 1378 | 1377 |
| 1379 if (!pLayoutNode) { | 1378 if (!pLayoutNode) { |
| 1380 pLayoutNode = m_pFormNode; | 1379 pLayoutNode = m_pFormNode; |
| 1381 } | 1380 } |
| 1382 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); | 1381 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); |
| 1383 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 1382 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
| 1384 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 1383 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
| 1385 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 1384 bool bContainerWidthAutoSize = true, bContainerHeightAutoSize = true; |
| 1386 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 1385 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
| 1387 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, | 1386 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, |
| 1388 bContainerHeightAutoSize); | 1387 bContainerHeightAutoSize); |
| 1389 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 1388 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
| 1390 CXFA_Node* pMarginNode = | 1389 CXFA_Node* pMarginNode = |
| 1391 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 1390 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 1392 FX_FLOAT fLeftInset = 0; | 1391 FX_FLOAT fLeftInset = 0; |
| 1393 FX_FLOAT fRightInset = 0; | 1392 FX_FLOAT fRightInset = 0; |
| 1394 if (pMarginNode) { | 1393 if (pMarginNode) { |
| 1395 fLeftInset = | 1394 fLeftInset = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1417 } | 1416 } |
| 1418 } | 1417 } |
| 1419 } | 1418 } |
| 1420 int32_t iSpecifiedColumnCount = m_rgSpecifiedColumnWidths.GetSize(); | 1419 int32_t iSpecifiedColumnCount = m_rgSpecifiedColumnWidths.GetSize(); |
| 1421 CXFA_LayoutContext layoutContext; | 1420 CXFA_LayoutContext layoutContext; |
| 1422 layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; | 1421 layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths; |
| 1423 CXFA_LayoutContext* pLayoutContext = | 1422 CXFA_LayoutContext* pLayoutContext = |
| 1424 iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; | 1423 iSpecifiedColumnCount > 0 ? &layoutContext : nullptr; |
| 1425 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { | 1424 if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) { |
| 1426 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1425 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1427 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE); | 1426 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false); |
| 1428 } | 1427 } |
| 1429 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( | 1428 for (; m_pCurChildNode; XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 1430 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, FALSE)) { | 1429 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) { |
| 1431 layoutContext.m_bCurColumnWidthAvaiable = FALSE; | 1430 layoutContext.m_bCurColumnWidthAvaiable = false; |
| 1432 layoutContext.m_fCurColumnWidth = 0; | 1431 layoutContext.m_fCurColumnWidth = 0; |
| 1433 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { | 1432 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Container) { |
| 1434 continue; | 1433 continue; |
| 1435 } | 1434 } |
| 1436 CXFA_ItemLayoutProcessor* pProcessor = | 1435 CXFA_ItemLayoutProcessor* pProcessor = |
| 1437 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 1436 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
| 1438 pProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, | 1437 pProcessor->DoLayout(false, XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, |
| 1439 pLayoutContext); | 1438 pLayoutContext); |
| 1440 if (!pProcessor->HasLayoutItem()) { | 1439 if (!pProcessor->HasLayoutItem()) { |
| 1441 delete pProcessor; | 1440 delete pProcessor; |
| 1442 continue; | 1441 continue; |
| 1443 } | 1442 } |
| 1444 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); | 1443 m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem()); |
| 1445 delete pProcessor; | 1444 delete pProcessor; |
| 1446 } | 1445 } |
| 1447 int32_t iRowCount = 0, iColCount = 0; | 1446 int32_t iRowCount = 0, iColCount = 0; |
| 1448 { | 1447 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1469 (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { | 1468 (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { |
| 1470 rgRowItems.Add(pRowLayoutCell); | 1469 rgRowItems.Add(pRowLayoutCell); |
| 1471 int32_t iColSpan = | 1470 int32_t iColSpan = |
| 1472 pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); | 1471 pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan); |
| 1473 rgRowItemsSpan.Add(iColSpan); | 1472 rgRowItemsSpan.Add(iColSpan); |
| 1474 rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.x); | 1473 rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.x); |
| 1475 } | 1474 } |
| 1476 } | 1475 } |
| 1477 iRowCount = rgRowItems.GetSize(); | 1476 iRowCount = rgRowItems.GetSize(); |
| 1478 iColCount = 0; | 1477 iColCount = 0; |
| 1479 FX_BOOL bMoreColumns = TRUE; | 1478 bool bMoreColumns = true; |
| 1480 while (bMoreColumns) { | 1479 while (bMoreColumns) { |
| 1481 bMoreColumns = FALSE; | 1480 bMoreColumns = false; |
| 1482 FX_BOOL bAutoCol = FALSE; | 1481 bool bAutoCol = false; |
| 1483 for (int32_t i = 0; i < iRowCount; i++) { | 1482 for (int32_t i = 0; i < iRowCount; i++) { |
| 1484 while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || | 1483 while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 || |
| 1485 !XFA_ItemLayoutProcessor_IsTakingSpace( | 1484 !XFA_ItemLayoutProcessor_IsTakingSpace( |
| 1486 rgRowItems[i]->m_pFormNode))) { | 1485 rgRowItems[i]->m_pFormNode))) { |
| 1487 CXFA_ContentLayoutItem* pNewCell = | 1486 CXFA_ContentLayoutItem* pNewCell = |
| 1488 (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; | 1487 (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling; |
| 1489 if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( | 1488 if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace( |
| 1490 rgRowItems[i]->m_pFormNode)) { | 1489 rgRowItems[i]->m_pFormNode)) { |
| 1491 pNewCell = nullptr; | 1490 pNewCell = nullptr; |
| 1492 } | 1491 } |
| 1493 rgRowItems[i] = pNewCell; | 1492 rgRowItems[i] = pNewCell; |
| 1494 rgRowItemsSpan[i] = | 1493 rgRowItemsSpan[i] = |
| 1495 pNewCell | 1494 pNewCell |
| 1496 ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) | 1495 ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan) |
| 1497 : 0; | 1496 : 0; |
| 1498 rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; | 1497 rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.x : 0; |
| 1499 } | 1498 } |
| 1500 CXFA_ContentLayoutItem* pCell = rgRowItems[i]; | 1499 CXFA_ContentLayoutItem* pCell = rgRowItems[i]; |
| 1501 if (!pCell) { | 1500 if (!pCell) { |
| 1502 continue; | 1501 continue; |
| 1503 } | 1502 } |
| 1504 bMoreColumns = TRUE; | 1503 bMoreColumns = true; |
| 1505 if (rgRowItemsSpan[i] == 1) { | 1504 if (rgRowItemsSpan[i] == 1) { |
| 1506 if (iColCount >= iSpecifiedColumnCount) { | 1505 if (iColCount >= iSpecifiedColumnCount) { |
| 1507 for (int32_t j = 0, c = iColCount + 1 - | 1506 for (int32_t j = 0, c = iColCount + 1 - |
| 1508 m_rgSpecifiedColumnWidths.GetSize(); | 1507 m_rgSpecifiedColumnWidths.GetSize(); |
| 1509 j < c; j++) { | 1508 j < c; j++) { |
| 1510 m_rgSpecifiedColumnWidths.Add(0); | 1509 m_rgSpecifiedColumnWidths.Add(0); |
| 1511 } | 1510 } |
| 1512 } | 1511 } |
| 1513 if (m_rgSpecifiedColumnWidths[iColCount] < | 1512 if (m_rgSpecifiedColumnWidths[iColCount] < |
| 1514 XFA_LAYOUT_FLOAT_PERCISION) { | 1513 XFA_LAYOUT_FLOAT_PERCISION) { |
| 1515 bAutoCol = TRUE; | 1514 bAutoCol = true; |
| 1516 } | 1515 } |
| 1517 if (bAutoCol && | 1516 if (bAutoCol && |
| 1518 m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) { | 1517 m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) { |
| 1519 m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i]; | 1518 m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i]; |
| 1520 } | 1519 } |
| 1521 } | 1520 } |
| 1522 } | 1521 } |
| 1523 if (bMoreColumns) { | 1522 if (bMoreColumns) { |
| 1524 FX_FLOAT fFinalColumnWidth = 0.0f; | 1523 FX_FLOAT fFinalColumnWidth = 0.0f; |
| 1525 if (iColCount < m_rgSpecifiedColumnWidths.GetSize()) | 1524 if (iColCount < m_rgSpecifiedColumnWidths.GetSize()) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 switch (eLayout) { | 1613 switch (eLayout) { |
| 1615 case XFA_ATTRIBUTEENUM_Row: | 1614 case XFA_ATTRIBUTEENUM_Row: |
| 1616 case XFA_ATTRIBUTEENUM_Rl_row: | 1615 case XFA_ATTRIBUTEENUM_Rl_row: |
| 1617 XFA_ItemLayoutProcessor_RelocateTableRowCells( | 1616 XFA_ItemLayoutProcessor_RelocateTableRowCells( |
| 1618 pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths, eLayout); | 1617 pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths, eLayout); |
| 1619 break; | 1618 break; |
| 1620 default: | 1619 default: |
| 1621 break; | 1620 break; |
| 1622 } | 1621 } |
| 1623 } | 1622 } |
| 1624 FX_BOOL CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( | 1623 bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( |
| 1625 CXFA_ContentLayoutItem* pTrailerItem) { | 1624 CXFA_ContentLayoutItem* pTrailerItem) { |
| 1626 if (!pTrailerItem) { | 1625 if (!pTrailerItem) { |
| 1627 return FALSE; | 1626 return false; |
| 1628 } | 1627 } |
| 1629 FX_FLOAT fWidth = pTrailerItem->m_sSize.x; | 1628 FX_FLOAT fWidth = pTrailerItem->m_sSize.x; |
| 1630 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 1629 XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 1631 if (eLayout != XFA_ATTRIBUTEENUM_Tb && m_fWidthLimite > fWidth) { | 1630 if (eLayout != XFA_ATTRIBUTEENUM_Tb && m_fWidthLimite > fWidth) { |
| 1632 return FALSE; | 1631 return false; |
| 1633 } | 1632 } |
| 1634 return TRUE; | 1633 return true; |
| 1635 } | 1634 } |
| 1636 static void XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( | 1635 static void XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( |
| 1637 CXFA_ItemLayoutProcessor* pProcessor, | 1636 CXFA_ItemLayoutProcessor* pProcessor, |
| 1638 FX_FLOAT fSplitPos, | 1637 FX_FLOAT fSplitPos, |
| 1639 CXFA_ContentLayoutItem* pTrailerLayoutItem, | 1638 CXFA_ContentLayoutItem* pTrailerLayoutItem, |
| 1640 FX_BOOL bUseInherited = FALSE) { | 1639 bool bUseInherited = false) { |
| 1641 if (!pTrailerLayoutItem) { | 1640 if (!pTrailerLayoutItem) { |
| 1642 return; | 1641 return; |
| 1643 } | 1642 } |
| 1644 FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.y; | 1643 FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.y; |
| 1645 if (bUseInherited) { | 1644 if (bUseInherited) { |
| 1646 FX_FLOAT fNewSplitPos = 0; | 1645 FX_FLOAT fNewSplitPos = 0; |
| 1647 if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) { | 1646 if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION) { |
| 1648 fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); | 1647 fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight); |
| 1649 } | 1648 } |
| 1650 if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { | 1649 if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 pLeaderLayoutItem->m_sSize.x) / | 1740 pLeaderLayoutItem->m_sSize.x) / |
| 1742 2; | 1741 2; |
| 1743 break; | 1742 break; |
| 1744 } | 1743 } |
| 1745 pProcessor->m_pLayoutItem->m_sSize.y += fHeight; | 1744 pProcessor->m_pLayoutItem->m_sSize.y += fHeight; |
| 1746 pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); | 1745 pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem); |
| 1747 } | 1746 } |
| 1748 static void XFA_ItemLayoutProcessor_AddPendingNode( | 1747 static void XFA_ItemLayoutProcessor_AddPendingNode( |
| 1749 CXFA_ItemLayoutProcessor* pProcessor, | 1748 CXFA_ItemLayoutProcessor* pProcessor, |
| 1750 CXFA_Node* pPendingNode, | 1749 CXFA_Node* pPendingNode, |
| 1751 FX_BOOL bBreakPending) { | 1750 bool bBreakPending) { |
| 1752 pProcessor->m_PendingNodes.push_back(pPendingNode); | 1751 pProcessor->m_PendingNodes.push_back(pPendingNode); |
| 1753 pProcessor->m_bBreakPending = bBreakPending; | 1752 pProcessor->m_bBreakPending = bBreakPending; |
| 1754 } | 1753 } |
| 1755 static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems( | 1754 static FX_FLOAT XFA_ItemLayoutProcessor_InsertPendingItems( |
| 1756 CXFA_ItemLayoutProcessor* pProcessor, | 1755 CXFA_ItemLayoutProcessor* pProcessor, |
| 1757 CXFA_Node* pCurChildNode) { | 1756 CXFA_Node* pCurChildNode) { |
| 1758 FX_FLOAT fTotalHeight = 0; | 1757 FX_FLOAT fTotalHeight = 0; |
| 1759 if (pProcessor->m_PendingNodes.empty()) { | 1758 if (pProcessor->m_PendingNodes.empty()) { |
| 1760 return fTotalHeight; | 1759 return fTotalHeight; |
| 1761 } | 1760 } |
| 1762 if (!pProcessor->m_pLayoutItem) { | 1761 if (!pProcessor->m_pLayoutItem) { |
| 1763 pProcessor->m_pLayoutItem = | 1762 pProcessor->m_pLayoutItem = |
| 1764 pProcessor->CreateContentLayoutItem(pCurChildNode); | 1763 pProcessor->CreateContentLayoutItem(pCurChildNode); |
| 1765 pProcessor->m_pLayoutItem->m_sSize.clear(); | 1764 pProcessor->m_pLayoutItem->m_sSize.clear(); |
| 1766 } | 1765 } |
| 1767 while (!pProcessor->m_PendingNodes.empty()) { | 1766 while (!pProcessor->m_PendingNodes.empty()) { |
| 1768 std::unique_ptr<CXFA_ItemLayoutProcessor> pPendingProcessor( | 1767 std::unique_ptr<CXFA_ItemLayoutProcessor> pPendingProcessor( |
| 1769 new CXFA_ItemLayoutProcessor(pProcessor->m_PendingNodes.front(), | 1768 new CXFA_ItemLayoutProcessor(pProcessor->m_PendingNodes.front(), |
| 1770 nullptr)); | 1769 nullptr)); |
| 1771 pProcessor->m_PendingNodes.pop_front(); | 1770 pProcessor->m_PendingNodes.pop_front(); |
| 1772 pPendingProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 1771 pPendingProcessor->DoLayout(false, XFA_LAYOUT_FLOAT_MAX); |
| 1773 CXFA_ContentLayoutItem* pPendingLayoutItem = | 1772 CXFA_ContentLayoutItem* pPendingLayoutItem = |
| 1774 pPendingProcessor->HasLayoutItem() | 1773 pPendingProcessor->HasLayoutItem() |
| 1775 ? pPendingProcessor->ExtractLayoutItem() | 1774 ? pPendingProcessor->ExtractLayoutItem() |
| 1776 : nullptr; | 1775 : nullptr; |
| 1777 if (pPendingLayoutItem) { | 1776 if (pPendingLayoutItem) { |
| 1778 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(pProcessor, | 1777 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(pProcessor, |
| 1779 pPendingLayoutItem); | 1778 pPendingLayoutItem); |
| 1780 if (pProcessor->m_bBreakPending) { | 1779 if (pProcessor->m_bBreakPending) { |
| 1781 fTotalHeight += pPendingLayoutItem->m_sSize.y; | 1780 fTotalHeight += pPendingLayoutItem->m_sSize.y; |
| 1782 } | 1781 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1794 for (int32_t iIndex = m_arrayKeepItems.GetSize() - 1; iIndex >= 0; | 1793 for (int32_t iIndex = m_arrayKeepItems.GetSize() - 1; iIndex >= 0; |
| 1795 iIndex--) { | 1794 iIndex--) { |
| 1796 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(this, | 1795 XFA_ItemLayoutProcessor_AddLeaderAfterSplit(this, |
| 1797 m_arrayKeepItems[iIndex]); | 1796 m_arrayKeepItems[iIndex]); |
| 1798 fTotalHeight += m_arrayKeepItems[iIndex]->m_sSize.y; | 1797 fTotalHeight += m_arrayKeepItems[iIndex]->m_sSize.y; |
| 1799 } | 1798 } |
| 1800 m_arrayKeepItems.RemoveAll(); | 1799 m_arrayKeepItems.RemoveAll(); |
| 1801 } | 1800 } |
| 1802 return fTotalHeight; | 1801 return fTotalHeight; |
| 1803 } | 1802 } |
| 1804 FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepForSplite( | 1803 bool CXFA_ItemLayoutProcessor::ProcessKeepForSplite( |
| 1805 CXFA_ItemLayoutProcessor* pParentProcessor, | 1804 CXFA_ItemLayoutProcessor* pParentProcessor, |
| 1806 CXFA_ItemLayoutProcessor* pChildProcessor, | 1805 CXFA_ItemLayoutProcessor* pChildProcessor, |
| 1807 XFA_ItemLayoutProcessorResult eRetValue, | 1806 XFA_ItemLayoutProcessorResult eRetValue, |
| 1808 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& rgCurLineLayoutItem, | 1807 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& rgCurLineLayoutItem, |
| 1809 FX_FLOAT& fContentCurRowAvailWidth, | 1808 FX_FLOAT& fContentCurRowAvailWidth, |
| 1810 FX_FLOAT& fContentCurRowHeight, | 1809 FX_FLOAT& fContentCurRowHeight, |
| 1811 FX_FLOAT& fContentCurRowY, | 1810 FX_FLOAT& fContentCurRowY, |
| 1812 FX_BOOL& bAddedItemInRow, | 1811 bool& bAddedItemInRow, |
| 1813 FX_BOOL& bForceEndPage, | 1812 bool& bForceEndPage, |
| 1814 XFA_ItemLayoutProcessorResult& result) { | 1813 XFA_ItemLayoutProcessorResult& result) { |
| 1815 if (!pParentProcessor || !pChildProcessor) { | 1814 if (!pParentProcessor || !pChildProcessor) { |
| 1816 return FALSE; | 1815 return false; |
| 1817 } | 1816 } |
| 1818 if (pParentProcessor->m_pCurChildNode->GetIntact() != | 1817 if (pParentProcessor->m_pCurChildNode->GetIntact() != |
| 1819 XFA_ATTRIBUTEENUM_None || | 1818 XFA_ATTRIBUTEENUM_None || |
| 1820 !pChildProcessor->m_bHasAvailHeight) { | 1819 !pChildProcessor->m_bHasAvailHeight) { |
| 1821 if (XFA_ExistContainerKeep(pParentProcessor->m_pCurChildNode, TRUE)) { | 1820 if (XFA_ExistContainerKeep(pParentProcessor->m_pCurChildNode, true)) { |
| 1822 FX_FLOAT fChildWidth, fChildHeight; | 1821 FX_FLOAT fChildWidth, fChildHeight; |
| 1823 pChildProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 1822 pChildProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
| 1824 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; | 1823 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems; |
| 1825 if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, | 1824 if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem, |
| 1826 fChildHeight, keepLayoutItems)) { | 1825 fChildHeight, keepLayoutItems)) { |
| 1827 m_arrayKeepItems.RemoveAll(); | 1826 m_arrayKeepItems.RemoveAll(); |
| 1828 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); iIndex++) { | 1827 for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); iIndex++) { |
| 1829 CXFA_ContentLayoutItem* pItem = keepLayoutItems.GetAt(iIndex); | 1828 CXFA_ContentLayoutItem* pItem = keepLayoutItems.GetAt(iIndex); |
| 1830 pParentProcessor->m_pLayoutItem->RemoveChild(pItem); | 1829 pParentProcessor->m_pLayoutItem->RemoveChild(pItem); |
| 1831 fContentCurRowY -= pItem->m_sSize.y; | 1830 fContentCurRowY -= pItem->m_sSize.y; |
| 1832 m_arrayKeepItems.Add(pItem); | 1831 m_arrayKeepItems.Add(pItem); |
| 1833 } | 1832 } |
| 1834 bAddedItemInRow = TRUE; | 1833 bAddedItemInRow = true; |
| 1835 bForceEndPage = TRUE; | 1834 bForceEndPage = true; |
| 1836 result = XFA_ItemLayoutProcessorResult_PageFullBreak; | 1835 result = XFA_ItemLayoutProcessorResult_PageFullBreak; |
| 1837 return TRUE; | 1836 return true; |
| 1838 } | 1837 } |
| 1839 rgCurLineLayoutItem.Add(pChildProcessor->ExtractLayoutItem()); | 1838 rgCurLineLayoutItem.Add(pChildProcessor->ExtractLayoutItem()); |
| 1840 bAddedItemInRow = TRUE; | 1839 bAddedItemInRow = true; |
| 1841 fContentCurRowAvailWidth -= fChildWidth; | 1840 fContentCurRowAvailWidth -= fChildWidth; |
| 1842 if (fContentCurRowHeight < fChildHeight) { | 1841 if (fContentCurRowHeight < fChildHeight) { |
| 1843 fContentCurRowHeight = fChildHeight; | 1842 fContentCurRowHeight = fChildHeight; |
| 1844 } | 1843 } |
| 1845 result = eRetValue; | 1844 result = eRetValue; |
| 1846 return TRUE; | 1845 return true; |
| 1847 } | 1846 } |
| 1848 } | 1847 } |
| 1849 return FALSE; | 1848 return false; |
| 1850 } | 1849 } |
| 1851 FX_BOOL CXFA_ItemLayoutProcessor::JudgePutNextPage( | 1850 bool CXFA_ItemLayoutProcessor::JudgePutNextPage( |
| 1852 CXFA_ContentLayoutItem* pParentLayoutItem, | 1851 CXFA_ContentLayoutItem* pParentLayoutItem, |
| 1853 FX_FLOAT fChildHeight, | 1852 FX_FLOAT fChildHeight, |
| 1854 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems) { | 1853 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>& pKeepItems) { |
| 1855 if (!pParentLayoutItem) { | 1854 if (!pParentLayoutItem) { |
| 1856 return FALSE; | 1855 return false; |
| 1857 } | 1856 } |
| 1858 FX_FLOAT fItemsHeight = 0; | 1857 FX_FLOAT fItemsHeight = 0; |
| 1859 for (CXFA_ContentLayoutItem* pChildLayoutItem = | 1858 for (CXFA_ContentLayoutItem* pChildLayoutItem = |
| 1860 (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; | 1859 (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild; |
| 1861 pChildLayoutItem; | 1860 pChildLayoutItem; |
| 1862 pChildLayoutItem = | 1861 pChildLayoutItem = |
| 1863 (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { | 1862 (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) { |
| 1864 if (XFA_ExistContainerKeep(pChildLayoutItem->m_pFormNode, FALSE)) { | 1863 if (XFA_ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) { |
| 1865 pKeepItems.Add(pChildLayoutItem); | 1864 pKeepItems.Add(pChildLayoutItem); |
| 1866 fItemsHeight += pChildLayoutItem->m_sSize.y; | 1865 fItemsHeight += pChildLayoutItem->m_sSize.y; |
| 1867 } else { | 1866 } else { |
| 1868 pKeepItems.RemoveAll(); | 1867 pKeepItems.RemoveAll(); |
| 1869 fItemsHeight = 0; | 1868 fItemsHeight = 0; |
| 1870 } | 1869 } |
| 1871 } | 1870 } |
| 1872 fItemsHeight += fChildHeight; | 1871 fItemsHeight += fChildHeight; |
| 1873 if (m_pPageMgr->GetNextAvailContentHeight(fItemsHeight)) { | 1872 if (m_pPageMgr->GetNextAvailContentHeight(fItemsHeight)) { |
| 1874 return TRUE; | 1873 return true; |
| 1875 } | 1874 } |
| 1876 return FALSE; | 1875 return false; |
| 1877 } | 1876 } |
| 1878 void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { | 1877 void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { |
| 1879 if (!pFormNode) { | 1878 if (!pFormNode) { |
| 1880 return; | 1879 return; |
| 1881 } | 1880 } |
| 1882 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( | 1881 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( |
| 1883 pFormNode); | 1882 pFormNode); |
| 1884 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; | 1883 for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode; |
| 1885 pNode = sIterator.MoveToNext()) { | 1884 pNode = sIterator.MoveToNext()) { |
| 1886 if (pNode->IsContainerNode()) { | 1885 if (pNode->IsContainerNode()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1913 if (pTrailerNode && pFormNode) { | 1912 if (pTrailerNode && pFormNode) { |
| 1914 pFormNode->RemoveChild(pTrailerNode); | 1913 pFormNode->RemoveChild(pTrailerNode); |
| 1915 } | 1914 } |
| 1916 if (pTrailerItem) { | 1915 if (pTrailerItem) { |
| 1917 XFA_ReleaseLayoutItem(pTrailerItem); | 1916 XFA_ReleaseLayoutItem(pTrailerItem); |
| 1918 } | 1917 } |
| 1919 } | 1918 } |
| 1920 static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( | 1919 static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 1921 CXFA_ItemLayoutProcessor* pThis, | 1920 CXFA_ItemLayoutProcessor* pThis, |
| 1922 CXFA_ItemLayoutProcessor* pProcessor, | 1921 CXFA_ItemLayoutProcessor* pProcessor, |
| 1923 FX_BOOL bContainerWidthAutoSize, | 1922 bool bContainerWidthAutoSize, |
| 1924 FX_BOOL bContainerHeightAutoSize, | 1923 bool bContainerHeightAutoSize, |
| 1925 FX_FLOAT fContainerHeight, | 1924 FX_FLOAT fContainerHeight, |
| 1926 XFA_ATTRIBUTEENUM eFlowStrategy, | 1925 XFA_ATTRIBUTEENUM eFlowStrategy, |
| 1927 uint8_t& uCurHAlignState, | 1926 uint8_t& uCurHAlignState, |
| 1928 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], | 1927 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], |
| 1929 FX_BOOL bUseBreakControl, | 1928 bool bUseBreakControl, |
| 1930 FX_FLOAT fAvailHeight, | 1929 FX_FLOAT fAvailHeight, |
| 1931 FX_FLOAT fRealHeight, | 1930 FX_FLOAT fRealHeight, |
| 1932 FX_FLOAT& fContentCurRowY, | 1931 FX_FLOAT& fContentCurRowY, |
| 1933 FX_FLOAT& fContentWidthLimit, | 1932 FX_FLOAT& fContentWidthLimit, |
| 1934 FX_FLOAT& fContentCurRowAvailWidth, | 1933 FX_FLOAT& fContentCurRowAvailWidth, |
| 1935 FX_FLOAT& fContentCurRowHeight, | 1934 FX_FLOAT& fContentCurRowHeight, |
| 1936 FX_BOOL& bAddedItemInRow, | 1935 bool& bAddedItemInRow, |
| 1937 FX_BOOL& bForceEndPage, | 1936 bool& bForceEndPage, |
| 1938 CXFA_LayoutContext* pLayoutContext = nullptr, | 1937 CXFA_LayoutContext* pLayoutContext = nullptr, |
| 1939 FX_BOOL bNewRow = FALSE) { | 1938 bool bNewRow = false) { |
| 1940 FX_BOOL bTakeSpace = | 1939 bool bTakeSpace = |
| 1941 XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); | 1940 XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); |
| 1942 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( | 1941 uint8_t uHAlign = XFA_ItemLayoutProcessor_HAlignEnumToInt( |
| 1943 pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); | 1942 pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign)); |
| 1944 if (bContainerWidthAutoSize) { | 1943 if (bContainerWidthAutoSize) { |
| 1945 uHAlign = 0; | 1944 uHAlign = 0; |
| 1946 } | 1945 } |
| 1947 if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && uHAlign < uCurHAlignState) || | 1946 if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb && uHAlign < uCurHAlignState) || |
| 1948 (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && uHAlign > uCurHAlignState)) { | 1947 (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb && uHAlign > uCurHAlignState)) { |
| 1949 return XFA_ItemLayoutProcessorResult_RowFullBreak; | 1948 return XFA_ItemLayoutProcessorResult_RowFullBreak; |
| 1950 } | 1949 } |
| 1951 uCurHAlignState = uHAlign; | 1950 uCurHAlignState = uHAlign; |
| 1952 FX_BOOL bIsOwnSplite = | 1951 bool bIsOwnSplite = |
| 1953 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None; | 1952 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None; |
| 1954 FX_BOOL bUseRealHeight = | 1953 bool bUseRealHeight = |
| 1955 bTakeSpace && bContainerHeightAutoSize && bIsOwnSplite && | 1954 bTakeSpace && bContainerHeightAutoSize && bIsOwnSplite && |
| 1956 pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() == | 1955 pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() == |
| 1957 XFA_ATTRIBUTEENUM_None; | 1956 XFA_ATTRIBUTEENUM_None; |
| 1958 FX_BOOL bIsTransHeight = bTakeSpace; | 1957 bool bIsTransHeight = bTakeSpace; |
| 1959 if (bIsTransHeight && !bIsOwnSplite) { | 1958 if (bIsTransHeight && !bIsOwnSplite) { |
| 1960 FX_BOOL bRootForceTb = FALSE; | 1959 bool bRootForceTb = false; |
| 1961 XFA_ATTRIBUTEENUM eLayoutStrategy = XFA_ItemLayoutProcessor_GetLayout( | 1960 XFA_ATTRIBUTEENUM eLayoutStrategy = XFA_ItemLayoutProcessor_GetLayout( |
| 1962 pProcessor->m_pFormNode, bRootForceTb); | 1961 pProcessor->m_pFormNode, bRootForceTb); |
| 1963 if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb || | 1962 if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb || |
| 1964 eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) { | 1963 eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) { |
| 1965 bIsTransHeight = FALSE; | 1964 bIsTransHeight = false; |
| 1966 } | 1965 } |
| 1967 } | 1966 } |
| 1968 FX_BOOL bUseInherited = FALSE; | 1967 bool bUseInherited = false; |
| 1969 CXFA_LayoutContext layoutContext; | 1968 CXFA_LayoutContext layoutContext; |
| 1970 if (pThis->m_pPageMgr) { | 1969 if (pThis->m_pPageMgr) { |
| 1971 CXFA_Node* pOverflowNode = | 1970 CXFA_Node* pOverflowNode = |
| 1972 pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode); | 1971 pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode); |
| 1973 if (pOverflowNode) { | 1972 if (pOverflowNode) { |
| 1974 layoutContext.m_pOverflowNode = pOverflowNode; | 1973 layoutContext.m_pOverflowNode = pOverflowNode; |
| 1975 layoutContext.m_pOverflowProcessor = pThis; | 1974 layoutContext.m_pOverflowProcessor = pThis; |
| 1976 pLayoutContext = &layoutContext; | 1975 pLayoutContext = &layoutContext; |
| 1977 } | 1976 } |
| 1978 } | 1977 } |
| 1979 XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult_Done; | 1978 XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult_Done; |
| 1980 if (!bNewRow || | 1979 if (!bNewRow || |
| 1981 pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult_Done) { | 1980 pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult_Done) { |
| 1982 eRetValue = pProcessor->DoLayout( | 1981 eRetValue = pProcessor->DoLayout( |
| 1983 bTakeSpace ? bUseBreakControl : FALSE, | 1982 bTakeSpace ? bUseBreakControl : false, |
| 1984 bUseRealHeight ? fRealHeight - fContentCurRowY : XFA_LAYOUT_FLOAT_MAX, | 1983 bUseRealHeight ? fRealHeight - fContentCurRowY : XFA_LAYOUT_FLOAT_MAX, |
| 1985 bIsTransHeight ? fRealHeight - fContentCurRowY : XFA_LAYOUT_FLOAT_MAX, | 1984 bIsTransHeight ? fRealHeight - fContentCurRowY : XFA_LAYOUT_FLOAT_MAX, |
| 1986 pLayoutContext); | 1985 pLayoutContext); |
| 1987 pProcessor->m_ePreProcessRs = eRetValue; | 1986 pProcessor->m_ePreProcessRs = eRetValue; |
| 1988 } else { | 1987 } else { |
| 1989 eRetValue = pProcessor->m_ePreProcessRs; | 1988 eRetValue = pProcessor->m_ePreProcessRs; |
| 1990 pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult_Done; | 1989 pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult_Done; |
| 1991 } | 1990 } |
| 1992 if (pProcessor->HasLayoutItem() == FALSE) { | 1991 if (pProcessor->HasLayoutItem() == false) { |
| 1993 return eRetValue; | 1992 return eRetValue; |
| 1994 } | 1993 } |
| 1995 FX_FLOAT fChildWidth, fChildHeight; | 1994 FX_FLOAT fChildWidth, fChildHeight; |
| 1996 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 1995 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
| 1997 if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { | 1996 if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) { |
| 1998 fRealHeight = XFA_LAYOUT_FLOAT_MAX; | 1997 fRealHeight = XFA_LAYOUT_FLOAT_MAX; |
| 1999 fAvailHeight = XFA_LAYOUT_FLOAT_MAX; | 1998 fAvailHeight = XFA_LAYOUT_FLOAT_MAX; |
| 2000 } | 1999 } |
| 2001 if (!bTakeSpace || | 2000 if (!bTakeSpace || |
| 2002 (fChildWidth <= fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) || | 2001 (fChildWidth <= fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) || |
| 2003 (fContentWidthLimit - fContentCurRowAvailWidth <= | 2002 (fContentWidthLimit - fContentCurRowAvailWidth <= |
| 2004 XFA_LAYOUT_FLOAT_PERCISION)) { | 2003 XFA_LAYOUT_FLOAT_PERCISION)) { |
| 2005 CXFA_Node* pOverflowLeaderNode = nullptr; | 2004 CXFA_Node* pOverflowLeaderNode = nullptr; |
| 2006 CXFA_Node* pOverflowTrailerNode = nullptr; | 2005 CXFA_Node* pOverflowTrailerNode = nullptr; |
| 2007 CXFA_Node* pFormNode = nullptr; | 2006 CXFA_Node* pFormNode = nullptr; |
| 2008 CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; | 2007 CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr; |
| 2009 FX_BOOL bIsAddTrailerHeight = FALSE; | 2008 bool bIsAddTrailerHeight = false; |
| 2010 if (pThis->m_pPageMgr && | 2009 if (pThis->m_pPageMgr && |
| 2011 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { | 2010 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { |
| 2012 pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); | 2011 pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode); |
| 2013 if (!pFormNode && pLayoutContext && | 2012 if (!pFormNode && pLayoutContext && |
| 2014 pLayoutContext->m_pOverflowProcessor) { | 2013 pLayoutContext->m_pOverflowProcessor) { |
| 2015 pFormNode = pLayoutContext->m_pOverflowNode; | 2014 pFormNode = pLayoutContext->m_pOverflowNode; |
| 2016 bUseInherited = TRUE; | 2015 bUseInherited = true; |
| 2017 } | 2016 } |
| 2018 if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, | 2017 if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, |
| 2019 pOverflowTrailerNode, FALSE, | 2018 pOverflowTrailerNode, false, |
| 2020 FALSE)) { | 2019 false)) { |
| 2021 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { | 2020 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) { |
| 2022 if (pOverflowTrailerNode) { | 2021 if (pOverflowTrailerNode) { |
| 2023 CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = | 2022 CXFA_ItemLayoutProcessor* pOverflowLeaderProcessor = |
| 2024 new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, nullptr); | 2023 new CXFA_ItemLayoutProcessor(pOverflowTrailerNode, nullptr); |
| 2025 pOverflowLeaderProcessor->DoLayout(FALSE, XFA_LAYOUT_FLOAT_MAX); | 2024 pOverflowLeaderProcessor->DoLayout(false, XFA_LAYOUT_FLOAT_MAX); |
| 2026 pTrailerLayoutItem = | 2025 pTrailerLayoutItem = |
| 2027 pOverflowLeaderProcessor->HasLayoutItem() | 2026 pOverflowLeaderProcessor->HasLayoutItem() |
| 2028 ? pOverflowLeaderProcessor->ExtractLayoutItem() | 2027 ? pOverflowLeaderProcessor->ExtractLayoutItem() |
| 2029 : nullptr; | 2028 : nullptr; |
| 2030 delete pOverflowLeaderProcessor; | 2029 delete pOverflowLeaderProcessor; |
| 2031 } | 2030 } |
| 2032 if (bUseInherited) { | 2031 if (bUseInherited) { |
| 2033 bIsAddTrailerHeight = | 2032 bIsAddTrailerHeight = |
| 2034 pThis->IsAddNewRowForTrailer(pTrailerLayoutItem); | 2033 pThis->IsAddNewRowForTrailer(pTrailerLayoutItem); |
| 2035 } else { | 2034 } else { |
| 2036 bIsAddTrailerHeight = | 2035 bIsAddTrailerHeight = |
| 2037 pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); | 2036 pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem); |
| 2038 } | 2037 } |
| 2039 if (bIsAddTrailerHeight) { | 2038 if (bIsAddTrailerHeight) { |
| 2040 FX_FLOAT fTrailerHeight = pTrailerLayoutItem->m_sSize.y; | 2039 FX_FLOAT fTrailerHeight = pTrailerLayoutItem->m_sSize.y; |
| 2041 fChildHeight += fTrailerHeight; | 2040 fChildHeight += fTrailerHeight; |
| 2042 bIsAddTrailerHeight = TRUE; | 2041 bIsAddTrailerHeight = true; |
| 2043 } | 2042 } |
| 2044 } | 2043 } |
| 2045 } | 2044 } |
| 2046 } | 2045 } |
| 2047 if (!bTakeSpace || | 2046 if (!bTakeSpace || |
| 2048 fContentCurRowY + fChildHeight <= | 2047 fContentCurRowY + fChildHeight <= |
| 2049 fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || | 2048 fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION || |
| 2050 (!bContainerHeightAutoSize && | 2049 (!bContainerHeightAutoSize && |
| 2051 pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= | 2050 pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >= |
| 2052 fContainerHeight)) { | 2051 fContainerHeight)) { |
| 2053 if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult_Done) { | 2052 if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult_Done) { |
| 2054 if (pProcessor->m_bUseInheriated) { | 2053 if (pProcessor->m_bUseInheriated) { |
| 2055 if (pTrailerLayoutItem) { | 2054 if (pTrailerLayoutItem) { |
| 2056 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( | 2055 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( |
| 2057 pProcessor, fChildHeight, pTrailerLayoutItem); | 2056 pProcessor, fChildHeight, pTrailerLayoutItem); |
| 2058 } | 2057 } |
| 2059 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2058 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
| 2060 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, | 2059 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, |
| 2061 pOverflowLeaderNode, FALSE); | 2060 pOverflowLeaderNode, false); |
| 2062 } | 2061 } |
| 2063 pProcessor->m_bUseInheriated = FALSE; | 2062 pProcessor->m_bUseInheriated = false; |
| 2064 } else { | 2063 } else { |
| 2065 if (bIsAddTrailerHeight) { | 2064 if (bIsAddTrailerHeight) { |
| 2066 fChildHeight -= pTrailerLayoutItem->m_sSize.y; | 2065 fChildHeight -= pTrailerLayoutItem->m_sSize.y; |
| 2067 } | 2066 } |
| 2068 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2067 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2069 pOverflowTrailerNode, | 2068 pOverflowTrailerNode, |
| 2070 pTrailerLayoutItem, pFormNode); | 2069 pTrailerLayoutItem, pFormNode); |
| 2071 } | 2070 } |
| 2072 CXFA_ContentLayoutItem* pChildLayoutItem = | 2071 CXFA_ContentLayoutItem* pChildLayoutItem = |
| 2073 pProcessor->ExtractLayoutItem(); | 2072 pProcessor->ExtractLayoutItem(); |
| 2074 if (XFA_ExistContainerKeep(pProcessor->m_pFormNode, FALSE) && | 2073 if (XFA_ExistContainerKeep(pProcessor->m_pFormNode, false) && |
| 2075 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { | 2074 pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { |
| 2076 pThis->m_arrayKeepItems.Add(pChildLayoutItem); | 2075 pThis->m_arrayKeepItems.Add(pChildLayoutItem); |
| 2077 } else { | 2076 } else { |
| 2078 pThis->m_arrayKeepItems.RemoveAll(); | 2077 pThis->m_arrayKeepItems.RemoveAll(); |
| 2079 } | 2078 } |
| 2080 rgCurLineLayoutItems[uHAlign].Add(pChildLayoutItem); | 2079 rgCurLineLayoutItems[uHAlign].Add(pChildLayoutItem); |
| 2081 bAddedItemInRow = TRUE; | 2080 bAddedItemInRow = true; |
| 2082 if (bTakeSpace) { | 2081 if (bTakeSpace) { |
| 2083 fContentCurRowAvailWidth -= fChildWidth; | 2082 fContentCurRowAvailWidth -= fChildWidth; |
| 2084 if (fContentCurRowHeight < fChildHeight) { | 2083 if (fContentCurRowHeight < fChildHeight) { |
| 2085 fContentCurRowHeight = fChildHeight; | 2084 fContentCurRowHeight = fChildHeight; |
| 2086 } | 2085 } |
| 2087 } | 2086 } |
| 2088 return XFA_ItemLayoutProcessorResult_Done; | 2087 return XFA_ItemLayoutProcessorResult_Done; |
| 2089 } else { | 2088 } else { |
| 2090 if (eRetValue == XFA_ItemLayoutProcessorResult_PageFullBreak) { | 2089 if (eRetValue == XFA_ItemLayoutProcessorResult_PageFullBreak) { |
| 2091 if (pProcessor->m_bUseInheriated) { | 2090 if (pProcessor->m_bUseInheriated) { |
| 2092 if (pTrailerLayoutItem) { | 2091 if (pTrailerLayoutItem) { |
| 2093 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( | 2092 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( |
| 2094 pProcessor, fChildHeight, pTrailerLayoutItem); | 2093 pProcessor, fChildHeight, pTrailerLayoutItem); |
| 2095 } | 2094 } |
| 2096 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2095 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
| 2097 XFA_ItemLayoutProcessor_AddPendingNode( | 2096 XFA_ItemLayoutProcessor_AddPendingNode( |
| 2098 pProcessor, pOverflowLeaderNode, FALSE); | 2097 pProcessor, pOverflowLeaderNode, false); |
| 2099 } | 2098 } |
| 2100 pProcessor->m_bUseInheriated = FALSE; | 2099 pProcessor->m_bUseInheriated = false; |
| 2101 } else { | 2100 } else { |
| 2102 if (bIsAddTrailerHeight) { | 2101 if (bIsAddTrailerHeight) { |
| 2103 fChildHeight -= pTrailerLayoutItem->m_sSize.y; | 2102 fChildHeight -= pTrailerLayoutItem->m_sSize.y; |
| 2104 } | 2103 } |
| 2105 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2104 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2106 pOverflowTrailerNode, | 2105 pOverflowTrailerNode, |
| 2107 pTrailerLayoutItem, pFormNode); | 2106 pTrailerLayoutItem, pFormNode); |
| 2108 } | 2107 } |
| 2109 } | 2108 } |
| 2110 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2109 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
| 2111 bAddedItemInRow = TRUE; | 2110 bAddedItemInRow = true; |
| 2112 fContentCurRowAvailWidth -= fChildWidth; | 2111 fContentCurRowAvailWidth -= fChildWidth; |
| 2113 if (fContentCurRowHeight < fChildHeight) { | 2112 if (fContentCurRowHeight < fChildHeight) { |
| 2114 fContentCurRowHeight = fChildHeight; | 2113 fContentCurRowHeight = fChildHeight; |
| 2115 } | 2114 } |
| 2116 return eRetValue; | 2115 return eRetValue; |
| 2117 } | 2116 } |
| 2118 } else { | 2117 } else { |
| 2119 XFA_ItemLayoutProcessorResult eResult; | 2118 XFA_ItemLayoutProcessorResult eResult; |
| 2120 if (pThis->ProcessKeepForSplite( | 2119 if (pThis->ProcessKeepForSplite( |
| 2121 pThis, pProcessor, eRetValue, rgCurLineLayoutItems[uHAlign], | 2120 pThis, pProcessor, eRetValue, rgCurLineLayoutItems[uHAlign], |
| 2122 fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY, | 2121 fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY, |
| 2123 bAddedItemInRow, bForceEndPage, eResult)) { | 2122 bAddedItemInRow, bForceEndPage, eResult)) { |
| 2124 return eResult; | 2123 return eResult; |
| 2125 } | 2124 } |
| 2126 bForceEndPage = TRUE; | 2125 bForceEndPage = true; |
| 2127 FX_FLOAT fSplitPos = | 2126 FX_FLOAT fSplitPos = |
| 2128 pProcessor->FindSplitPos(fAvailHeight - fContentCurRowY); | 2127 pProcessor->FindSplitPos(fAvailHeight - fContentCurRowY); |
| 2129 if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { | 2128 if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { |
| 2130 XFA_ATTRIBUTEENUM eLayout = | 2129 XFA_ATTRIBUTEENUM eLayout = |
| 2131 pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 2130 pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 2132 if (eLayout == XFA_ATTRIBUTEENUM_Tb && | 2131 if (eLayout == XFA_ATTRIBUTEENUM_Tb && |
| 2133 eRetValue == XFA_ItemLayoutProcessorResult_Done) { | 2132 eRetValue == XFA_ItemLayoutProcessorResult_Done) { |
| 2134 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2133 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2135 pOverflowTrailerNode, | 2134 pOverflowTrailerNode, |
| 2136 pTrailerLayoutItem, pFormNode); | 2135 pTrailerLayoutItem, pFormNode); |
| 2137 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2136 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
| 2138 bAddedItemInRow = TRUE; | 2137 bAddedItemInRow = true; |
| 2139 if (bTakeSpace) { | 2138 if (bTakeSpace) { |
| 2140 fContentCurRowAvailWidth -= fChildWidth; | 2139 fContentCurRowAvailWidth -= fChildWidth; |
| 2141 if (fContentCurRowHeight < fChildHeight) { | 2140 if (fContentCurRowHeight < fChildHeight) { |
| 2142 fContentCurRowHeight = fChildHeight; | 2141 fContentCurRowHeight = fChildHeight; |
| 2143 } | 2142 } |
| 2144 } | 2143 } |
| 2145 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2144 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
| 2146 } | 2145 } |
| 2147 CXFA_Node* pTempLeaderNode = nullptr; | 2146 CXFA_Node* pTempLeaderNode = nullptr; |
| 2148 CXFA_Node* pTempTrailerNode = nullptr; | 2147 CXFA_Node* pTempTrailerNode = nullptr; |
| 2149 if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && | 2148 if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated && |
| 2150 eRetValue != XFA_ItemLayoutProcessorResult_PageFullBreak) { | 2149 eRetValue != XFA_ItemLayoutProcessorResult_PageFullBreak) { |
| 2151 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, | 2150 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, |
| 2152 pTempTrailerNode, FALSE, TRUE); | 2151 pTempTrailerNode, false, true); |
| 2153 } | 2152 } |
| 2154 if (pTrailerLayoutItem && bIsAddTrailerHeight) { | 2153 if (pTrailerLayoutItem && bIsAddTrailerHeight) { |
| 2155 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( | 2154 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit( |
| 2156 pProcessor, fSplitPos, pTrailerLayoutItem, bUseInherited); | 2155 pProcessor, fSplitPos, pTrailerLayoutItem, bUseInherited); |
| 2157 } else { | 2156 } else { |
| 2158 pProcessor->SplitLayoutItem(fSplitPos); | 2157 pProcessor->SplitLayoutItem(fSplitPos); |
| 2159 } | 2158 } |
| 2160 if (bUseInherited) { | 2159 if (bUseInherited) { |
| 2161 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2160 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2162 pOverflowTrailerNode, | 2161 pOverflowTrailerNode, |
| 2163 pTrailerLayoutItem, pFormNode); | 2162 pTrailerLayoutItem, pFormNode); |
| 2164 pThis->m_bUseInheriated = TRUE; | 2163 pThis->m_bUseInheriated = true; |
| 2165 } else { | 2164 } else { |
| 2166 CXFA_LayoutItem* firstChild = | 2165 CXFA_LayoutItem* firstChild = |
| 2167 pProcessor->m_pLayoutItem->m_pFirstChild; | 2166 pProcessor->m_pLayoutItem->m_pFirstChild; |
| 2168 if (firstChild && !firstChild->m_pNextSibling && | 2167 if (firstChild && !firstChild->m_pNextSibling && |
| 2169 firstChild->m_pFormNode->IsLayoutGeneratedNode()) { | 2168 firstChild->m_pFormNode->IsLayoutGeneratedNode()) { |
| 2170 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2169 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2171 pOverflowTrailerNode, | 2170 pOverflowTrailerNode, |
| 2172 pTrailerLayoutItem, pFormNode); | 2171 pTrailerLayoutItem, pFormNode); |
| 2173 } else { | 2172 } else { |
| 2174 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2173 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
| 2175 XFA_ItemLayoutProcessor_AddPendingNode( | 2174 XFA_ItemLayoutProcessor_AddPendingNode( |
| 2176 pProcessor, pOverflowLeaderNode, FALSE); | 2175 pProcessor, pOverflowLeaderNode, false); |
| 2177 } | 2176 } |
| 2178 } | 2177 } |
| 2179 } | 2178 } |
| 2180 if (pProcessor->m_pLayoutItem->m_pNextSibling) { | 2179 if (pProcessor->m_pLayoutItem->m_pNextSibling) { |
| 2181 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 2180 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
| 2182 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2181 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
| 2183 bAddedItemInRow = TRUE; | 2182 bAddedItemInRow = true; |
| 2184 if (bTakeSpace) { | 2183 if (bTakeSpace) { |
| 2185 fContentCurRowAvailWidth -= fChildWidth; | 2184 fContentCurRowAvailWidth -= fChildWidth; |
| 2186 if (fContentCurRowHeight < fChildHeight) { | 2185 if (fContentCurRowHeight < fChildHeight) { |
| 2187 fContentCurRowHeight = fChildHeight; | 2186 fContentCurRowHeight = fChildHeight; |
| 2188 } | 2187 } |
| 2189 } | 2188 } |
| 2190 } | 2189 } |
| 2191 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2190 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
| 2192 } else if (fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { | 2191 } else if (fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) { |
| 2193 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); | 2192 pProcessor->GetCurrentComponentSize(fChildWidth, fChildHeight); |
| 2194 if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { | 2193 if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(fChildHeight)) { |
| 2195 CXFA_Node* pTempLeaderNode = nullptr; | 2194 CXFA_Node* pTempLeaderNode = nullptr; |
| 2196 CXFA_Node* pTempTrailerNode = nullptr; | 2195 CXFA_Node* pTempTrailerNode = nullptr; |
| 2197 if (pThis->m_pPageMgr) { | 2196 if (pThis->m_pPageMgr) { |
| 2198 if (!pFormNode && pLayoutContext) { | 2197 if (!pFormNode && pLayoutContext) { |
| 2199 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; | 2198 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; |
| 2200 } | 2199 } |
| 2201 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, | 2200 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode, |
| 2202 pTempTrailerNode, FALSE, TRUE); | 2201 pTempTrailerNode, false, true); |
| 2203 } | 2202 } |
| 2204 if (bUseInherited) { | 2203 if (bUseInherited) { |
| 2205 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2204 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2206 pOverflowTrailerNode, | 2205 pOverflowTrailerNode, |
| 2207 pTrailerLayoutItem, pFormNode); | 2206 pTrailerLayoutItem, pFormNode); |
| 2208 pThis->m_bUseInheriated = TRUE; | 2207 pThis->m_bUseInheriated = true; |
| 2209 } | 2208 } |
| 2210 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2209 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
| 2211 } | 2210 } |
| 2212 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); | 2211 rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem()); |
| 2213 bAddedItemInRow = TRUE; | 2212 bAddedItemInRow = true; |
| 2214 if (bTakeSpace) { | 2213 if (bTakeSpace) { |
| 2215 fContentCurRowAvailWidth -= fChildWidth; | 2214 fContentCurRowAvailWidth -= fChildWidth; |
| 2216 if (fContentCurRowHeight < fChildHeight) { | 2215 if (fContentCurRowHeight < fChildHeight) { |
| 2217 fContentCurRowHeight = fChildHeight; | 2216 fContentCurRowHeight = fChildHeight; |
| 2218 } | 2217 } |
| 2219 } | 2218 } |
| 2220 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { | 2219 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { |
| 2221 bForceEndPage = FALSE; | 2220 bForceEndPage = false; |
| 2222 } | 2221 } |
| 2223 return eRetValue; | 2222 return eRetValue; |
| 2224 } else { | 2223 } else { |
| 2225 XFA_ATTRIBUTEENUM eLayout = | 2224 XFA_ATTRIBUTEENUM eLayout = |
| 2226 pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); | 2225 pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 2227 if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None && | 2226 if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None && |
| 2228 eLayout == XFA_ATTRIBUTEENUM_Tb) { | 2227 eLayout == XFA_ATTRIBUTEENUM_Tb) { |
| 2229 if (pThis->m_pPageMgr) { | 2228 if (pThis->m_pPageMgr) { |
| 2230 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, | 2229 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, |
| 2231 pOverflowTrailerNode, FALSE, | 2230 pOverflowTrailerNode, false, |
| 2232 TRUE); | 2231 true); |
| 2233 } | 2232 } |
| 2234 if (pTrailerLayoutItem) { | 2233 if (pTrailerLayoutItem) { |
| 2235 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit(pProcessor, fSplitPos, | 2234 XFA_ItemLayoutProcessor_AddTrailerBeforeSplit(pProcessor, fSplitPos, |
| 2236 pTrailerLayoutItem); | 2235 pTrailerLayoutItem); |
| 2237 } | 2236 } |
| 2238 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { | 2237 if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode)) { |
| 2239 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, | 2238 XFA_ItemLayoutProcessor_AddPendingNode(pProcessor, |
| 2240 pOverflowLeaderNode, FALSE); | 2239 pOverflowLeaderNode, false); |
| 2241 } | 2240 } |
| 2242 } else { | 2241 } else { |
| 2243 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { | 2242 if (eRetValue == XFA_ItemLayoutProcessorResult_Done) { |
| 2244 if (!pFormNode && pLayoutContext) { | 2243 if (!pFormNode && pLayoutContext) { |
| 2245 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; | 2244 pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode; |
| 2246 } | 2245 } |
| 2247 if (pThis->m_pPageMgr) { | 2246 if (pThis->m_pPageMgr) { |
| 2248 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, | 2247 pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode, |
| 2249 pOverflowTrailerNode, FALSE, | 2248 pOverflowTrailerNode, false, |
| 2250 TRUE); | 2249 true); |
| 2251 } | 2250 } |
| 2252 if (bUseInherited) { | 2251 if (bUseInherited) { |
| 2253 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, | 2252 pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, |
| 2254 pOverflowTrailerNode, | 2253 pOverflowTrailerNode, |
| 2255 pTrailerLayoutItem, pFormNode); | 2254 pTrailerLayoutItem, pFormNode); |
| 2256 pThis->m_bUseInheriated = TRUE; | 2255 pThis->m_bUseInheriated = true; |
| 2257 } | 2256 } |
| 2258 } | 2257 } |
| 2259 } | 2258 } |
| 2260 return XFA_ItemLayoutProcessorResult_PageFullBreak; | 2259 return XFA_ItemLayoutProcessorResult_PageFullBreak; |
| 2261 } | 2260 } |
| 2262 } | 2261 } |
| 2263 } else { | 2262 } else { |
| 2264 return XFA_ItemLayoutProcessorResult_RowFullBreak; | 2263 return XFA_ItemLayoutProcessorResult_RowFullBreak; |
| 2265 } | 2264 } |
| 2266 return XFA_ItemLayoutProcessorResult_Done; | 2265 return XFA_ItemLayoutProcessorResult_Done; |
| 2267 } | 2266 } |
| 2268 | 2267 |
| 2269 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( | 2268 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( |
| 2270 FX_BOOL bUseBreakControl, | 2269 bool bUseBreakControl, |
| 2271 XFA_ATTRIBUTEENUM eFlowStrategy, | 2270 XFA_ATTRIBUTEENUM eFlowStrategy, |
| 2272 FX_FLOAT fHeightLimit, | 2271 FX_FLOAT fHeightLimit, |
| 2273 FX_FLOAT fRealHeight, | 2272 FX_FLOAT fRealHeight, |
| 2274 CXFA_LayoutContext* pContext, | 2273 CXFA_LayoutContext* pContext, |
| 2275 FX_BOOL bRootForceTb) { | 2274 bool bRootForceTb) { |
| 2276 m_bHasAvailHeight = TRUE; | 2275 m_bHasAvailHeight = true; |
| 2277 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; | 2276 FX_FLOAT fContainerWidth = 0, fContainerHeight = 0; |
| 2278 FX_BOOL bBreakDone = FALSE; | 2277 bool bBreakDone = false; |
| 2279 FX_BOOL bContainerWidthAutoSize = TRUE, bContainerHeightAutoSize = TRUE; | 2278 bool bContainerWidthAutoSize = true, bContainerHeightAutoSize = true; |
| 2280 FX_BOOL bForceEndPage = FALSE; | 2279 bool bForceEndPage = false; |
| 2281 FX_BOOL bIsManualBreak = FALSE; | 2280 bool bIsManualBreak = false; |
| 2282 if (m_pCurChildPreprocessor) { | 2281 if (m_pCurChildPreprocessor) { |
| 2283 m_pCurChildPreprocessor->m_ePreProcessRs = | 2282 m_pCurChildPreprocessor->m_ePreProcessRs = |
| 2284 XFA_ItemLayoutProcessorResult_Done; | 2283 XFA_ItemLayoutProcessorResult_Done; |
| 2285 } | 2284 } |
| 2286 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( | 2285 XFA_ItemLayoutProcessor_CalculateContainerSpecfiedSize( |
| 2287 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, | 2286 m_pFormNode, fContainerWidth, fContainerHeight, bContainerWidthAutoSize, |
| 2288 bContainerHeightAutoSize); | 2287 bContainerHeightAutoSize); |
| 2289 if (pContext && pContext->m_bCurColumnWidthAvaiable) { | 2288 if (pContext && pContext->m_bCurColumnWidthAvaiable) { |
| 2290 bContainerWidthAutoSize = FALSE; | 2289 bContainerWidthAutoSize = false; |
| 2291 fContainerWidth = pContext->m_fCurColumnWidth; | 2290 fContainerWidth = pContext->m_fCurColumnWidth; |
| 2292 } | 2291 } |
| 2293 if (!bContainerHeightAutoSize) { | 2292 if (!bContainerHeightAutoSize) { |
| 2294 fContainerHeight -= m_fUsedSize; | 2293 fContainerHeight -= m_fUsedSize; |
| 2295 } | 2294 } |
| 2296 if (!bContainerHeightAutoSize) { | 2295 if (!bContainerHeightAutoSize) { |
| 2297 CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); | 2296 CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 2298 FX_BOOL bFocrTb = FALSE; | 2297 bool bFocrTb = false; |
| 2299 if (pParentNode && | 2298 if (pParentNode && |
| 2300 XFA_ItemLayoutProcessor_GetLayout(pParentNode, bFocrTb) == | 2299 XFA_ItemLayoutProcessor_GetLayout(pParentNode, bFocrTb) == |
| 2301 XFA_ATTRIBUTEENUM_Row) { | 2300 XFA_ATTRIBUTEENUM_Row) { |
| 2302 CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem( | 2301 CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem( |
| 2303 XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); | 2302 XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode); |
| 2304 if (pChildContainer && | 2303 if (pChildContainer && |
| 2305 pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, | 2304 pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling, |
| 2306 XFA_ObjectType::ContainerNode)) { | 2305 XFA_ObjectType::ContainerNode)) { |
| 2307 fContainerHeight = 0; | 2306 fContainerHeight = 0; |
| 2308 bContainerHeightAutoSize = TRUE; | 2307 bContainerHeightAutoSize = true; |
| 2309 } | 2308 } |
| 2310 } | 2309 } |
| 2311 } | 2310 } |
| 2312 CXFA_Node* pMarginNode = | 2311 CXFA_Node* pMarginNode = |
| 2313 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); | 2312 m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); |
| 2314 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; | 2313 FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; |
| 2315 if (pMarginNode) { | 2314 if (pMarginNode) { |
| 2316 fLeftInset = | 2315 fLeftInset = |
| 2317 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); | 2316 pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); |
| 2318 fTopInset = | 2317 fTopInset = |
| 2319 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); | 2318 pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); |
| 2320 fRightInset = | 2319 fRightInset = |
| 2321 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); | 2320 pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); |
| 2322 fBottomInset = | 2321 fBottomInset = |
| 2323 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); | 2322 pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); |
| 2324 } | 2323 } |
| 2325 FX_FLOAT fContentWidthLimit = | 2324 FX_FLOAT fContentWidthLimit = |
| 2326 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX | 2325 bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX |
| 2327 : fContainerWidth - fLeftInset - fRightInset; | 2326 : fContainerWidth - fLeftInset - fRightInset; |
| 2328 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; | 2327 FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; |
| 2329 FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; | 2328 FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset; |
| 2330 if (fAvailHeight < 0) { | 2329 if (fAvailHeight < 0) { |
| 2331 m_bHasAvailHeight = FALSE; | 2330 m_bHasAvailHeight = false; |
| 2332 } | 2331 } |
| 2333 fRealHeight = fRealHeight - fTopInset - fBottomInset; | 2332 fRealHeight = fRealHeight - fTopInset - fBottomInset; |
| 2334 FX_FLOAT fContentCurRowY = 0; | 2333 FX_FLOAT fContentCurRowY = 0; |
| 2335 CXFA_ContentLayoutItem* pLayoutChild = nullptr; | 2334 CXFA_ContentLayoutItem* pLayoutChild = nullptr; |
| 2336 if (m_pLayoutItem) { | 2335 if (m_pLayoutItem) { |
| 2337 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && | 2336 if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done && |
| 2338 eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { | 2337 eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) { |
| 2339 pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; | 2338 pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild; |
| 2340 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; | 2339 for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext; |
| 2341 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { | 2340 pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2365 } | 2364 } |
| 2366 if (pLayoutChild) { | 2365 if (pLayoutChild) { |
| 2367 fContentCurRowY = pLayoutChild->m_sPos.y; | 2366 fContentCurRowY = pLayoutChild->m_sPos.y; |
| 2368 } else { | 2367 } else { |
| 2369 fContentCurRowY = fContentCalculatedHeight; | 2368 fContentCurRowY = fContentCalculatedHeight; |
| 2370 } | 2369 } |
| 2371 } | 2370 } |
| 2372 fContentCurRowY += InsertKeepLayoutItems(); | 2371 fContentCurRowY += InsertKeepLayoutItems(); |
| 2373 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_None) { | 2372 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_None) { |
| 2374 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2373 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 2375 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2374 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, true); |
| 2376 } | 2375 } |
| 2377 fContentCurRowY += | 2376 fContentCurRowY += |
| 2378 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); | 2377 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); |
| 2379 if (m_pCurChildPreprocessor && | 2378 if (m_pCurChildPreprocessor && |
| 2380 m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Container) { | 2379 m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Container) { |
| 2381 if (XFA_ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), FALSE)) { | 2380 if (XFA_ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) { |
| 2382 m_pKeepHeadNode = m_pCurChildNode; | 2381 m_pKeepHeadNode = m_pCurChildNode; |
| 2383 m_bIsProcessKeep = TRUE; | 2382 m_bIsProcessKeep = true; |
| 2384 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Keep; | 2383 m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages_Keep; |
| 2385 } | 2384 } |
| 2386 } | 2385 } |
| 2387 while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done) { | 2386 while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages_Done) { |
| 2388 FX_FLOAT fContentCurRowHeight = 0; | 2387 FX_FLOAT fContentCurRowHeight = 0; |
| 2389 FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit; | 2388 FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit; |
| 2390 m_fWidthLimite = fContentCurRowAvailWidth; | 2389 m_fWidthLimite = fContentCurRowAvailWidth; |
| 2391 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; | 2390 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3]; |
| 2392 uint8_t uCurHAlignState = | 2391 uint8_t uCurHAlignState = |
| 2393 (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); | 2392 (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 pLayoutNextTemp->m_pParent = nullptr; | 2438 pLayoutNextTemp->m_pParent = nullptr; |
| 2440 CXFA_ContentLayoutItem* pSaveLayoutNext = | 2439 CXFA_ContentLayoutItem* pSaveLayoutNext = |
| 2441 (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; | 2440 (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling; |
| 2442 pLayoutNextTemp->m_pNextSibling = nullptr; | 2441 pLayoutNextTemp->m_pNextSibling = nullptr; |
| 2443 pLayoutNextTemp = pSaveLayoutNext; | 2442 pLayoutNextTemp = pSaveLayoutNext; |
| 2444 } | 2443 } |
| 2445 pLayoutChild = nullptr; | 2444 pLayoutChild = nullptr; |
| 2446 } | 2445 } |
| 2447 while (m_pCurChildNode) { | 2446 while (m_pCurChildNode) { |
| 2448 CXFA_ItemLayoutProcessor* pProcessor = nullptr; | 2447 CXFA_ItemLayoutProcessor* pProcessor = nullptr; |
| 2449 FX_BOOL bAddedItemInRow = FALSE; | 2448 bool bAddedItemInRow = false; |
| 2450 fContentCurRowY += | 2449 fContentCurRowY += |
| 2451 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); | 2450 XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode); |
| 2452 switch (m_nCurChildNodeStage) { | 2451 switch (m_nCurChildNodeStage) { |
| 2453 case XFA_ItemLayoutProcessorStages_Keep: | 2452 case XFA_ItemLayoutProcessorStages_Keep: |
| 2454 case XFA_ItemLayoutProcessorStages_None: | 2453 case XFA_ItemLayoutProcessorStages_None: |
| 2455 break; | 2454 break; |
| 2456 case XFA_ItemLayoutProcessorStages_BreakBefore: { | 2455 case XFA_ItemLayoutProcessorStages_BreakBefore: { |
| 2457 for (int32_t iIndex = 0; iIndex < m_arrayKeepItems.GetSize(); | 2456 for (int32_t iIndex = 0; iIndex < m_arrayKeepItems.GetSize(); |
| 2458 iIndex++) { | 2457 iIndex++) { |
| 2459 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); | 2458 CXFA_ContentLayoutItem* pItem = m_arrayKeepItems.GetAt(iIndex); |
| 2460 m_pLayoutItem->RemoveChild(pItem); | 2459 m_pLayoutItem->RemoveChild(pItem); |
| 2461 fContentCalculatedHeight -= pItem->m_sSize.y; | 2460 fContentCalculatedHeight -= pItem->m_sSize.y; |
| 2462 } | 2461 } |
| 2463 CXFA_Node* pLeaderNode = nullptr; | 2462 CXFA_Node* pLeaderNode = nullptr; |
| 2464 CXFA_Node* pTrailerNode = nullptr; | 2463 CXFA_Node* pTrailerNode = nullptr; |
| 2465 FX_BOOL bCreatePage = FALSE; | 2464 bool bCreatePage = false; |
| 2466 if (bUseBreakControl && m_pPageMgr && | 2465 if (bUseBreakControl && m_pPageMgr && |
| 2467 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, TRUE, | 2466 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true, |
| 2468 pLeaderNode, pTrailerNode, | 2467 pLeaderNode, pTrailerNode, |
| 2469 bCreatePage) && | 2468 bCreatePage) && |
| 2470 m_pFormNode->GetElementType() != XFA_Element::Form && | 2469 m_pFormNode->GetElementType() != XFA_Element::Form && |
| 2471 bCreatePage) { | 2470 bCreatePage) { |
| 2472 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2471 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
| 2473 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); | 2472 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, true); |
| 2474 } | 2473 } |
| 2475 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2474 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
| 2476 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 2475 if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 2477 ->GetElementType() == XFA_Element::Form && | 2476 ->GetElementType() == XFA_Element::Form && |
| 2478 !m_pLayoutItem) { | 2477 !m_pLayoutItem) { |
| 2479 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, | 2478 XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode, |
| 2480 TRUE); | 2479 true); |
| 2481 } else { | 2480 } else { |
| 2482 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2481 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
| 2483 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2482 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
| 2484 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2483 XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2485 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2484 this, pTempProcessor.get(), bContainerWidthAutoSize, |
| 2486 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2485 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2487 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2486 uCurHAlignState, rgCurLineLayoutItems, false, |
| 2488 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2487 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
| 2489 fContentWidthLimit, fContentCurRowAvailWidth, | 2488 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2490 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2489 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2491 pContext); | 2490 pContext); |
| 2492 } | 2491 } |
| 2493 } | 2492 } |
| 2494 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2493 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 2495 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2494 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, true); |
| 2496 bForceEndPage = TRUE; | 2495 bForceEndPage = true; |
| 2497 bIsManualBreak = TRUE; | 2496 bIsManualBreak = true; |
| 2498 goto SuspendAndCreateNewRow; | 2497 goto SuspendAndCreateNewRow; |
| 2499 } | 2498 } |
| 2500 } break; | 2499 } break; |
| 2501 case XFA_ItemLayoutProcessorStages_BreakAfter: { | 2500 case XFA_ItemLayoutProcessorStages_BreakAfter: { |
| 2502 CXFA_Node* pLeaderNode = nullptr; | 2501 CXFA_Node* pLeaderNode = nullptr; |
| 2503 CXFA_Node* pTrailerNode = nullptr; | 2502 CXFA_Node* pTrailerNode = nullptr; |
| 2504 FX_BOOL bCreatePage = FALSE; | 2503 bool bCreatePage = false; |
| 2505 if (bUseBreakControl && m_pPageMgr && | 2504 if (bUseBreakControl && m_pPageMgr && |
| 2506 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, FALSE, | 2505 m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false, |
| 2507 pLeaderNode, pTrailerNode, | 2506 pLeaderNode, pTrailerNode, |
| 2508 bCreatePage) && | 2507 bCreatePage) && |
| 2509 m_pFormNode->GetElementType() != XFA_Element::Form) { | 2508 m_pFormNode->GetElementType() != XFA_Element::Form) { |
| 2510 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { | 2509 if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) { |
| 2511 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2510 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
| 2512 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); | 2511 new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr)); |
| 2513 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2512 XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2514 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2513 this, pTempProcessor.get(), bContainerWidthAutoSize, |
| 2515 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2514 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2516 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2515 uCurHAlignState, rgCurLineLayoutItems, false, |
| 2517 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2516 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
| 2518 fContentWidthLimit, fContentCurRowAvailWidth, | 2517 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2519 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2518 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2520 pContext); | 2519 pContext); |
| 2521 } | 2520 } |
| 2522 if (!bCreatePage) { | 2521 if (!bCreatePage) { |
| 2523 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2522 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
| 2524 CalculateRowChildPosition( | 2523 CalculateRowChildPosition( |
| 2525 rgCurLineLayoutItems, eFlowStrategy, | 2524 rgCurLineLayoutItems, eFlowStrategy, |
| 2526 bContainerHeightAutoSize, bContainerWidthAutoSize, | 2525 bContainerHeightAutoSize, bContainerWidthAutoSize, |
| 2527 fContentCalculatedWidth, fContentCalculatedHeight, | 2526 fContentCalculatedWidth, fContentCalculatedHeight, |
| 2528 fContentCurRowY, fContentCurRowHeight, fContentWidthLimit); | 2527 fContentCurRowY, fContentCurRowHeight, fContentWidthLimit); |
| 2529 rgCurLineLayoutItems->RemoveAll(); | 2528 rgCurLineLayoutItems->RemoveAll(); |
| 2530 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( | 2529 std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor( |
| 2531 new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr)); | 2530 new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr)); |
| 2532 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2531 XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2533 this, pTempProcessor.get(), bContainerWidthAutoSize, | 2532 this, pTempProcessor.get(), bContainerWidthAutoSize, |
| 2534 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2533 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2535 uCurHAlignState, rgCurLineLayoutItems, FALSE, | 2534 uCurHAlignState, rgCurLineLayoutItems, false, |
| 2536 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, | 2535 XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY, |
| 2537 fContentWidthLimit, fContentCurRowAvailWidth, | 2536 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2538 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2537 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2539 pContext); | 2538 pContext); |
| 2540 } | 2539 } |
| 2541 } else { | 2540 } else { |
| 2542 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { | 2541 if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) { |
| 2543 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, TRUE); | 2542 XFA_ItemLayoutProcessor_AddPendingNode(this, pLeaderNode, true); |
| 2544 } | 2543 } |
| 2545 } | 2544 } |
| 2546 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2545 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 2547 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2546 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, true); |
| 2548 if (bCreatePage) { | 2547 if (bCreatePage) { |
| 2549 bForceEndPage = TRUE; | 2548 bForceEndPage = true; |
| 2550 bIsManualBreak = TRUE; | 2549 bIsManualBreak = true; |
| 2551 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done) { | 2550 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done) { |
| 2552 bBreakDone = TRUE; | 2551 bBreakDone = true; |
| 2553 } | 2552 } |
| 2554 } | 2553 } |
| 2555 goto SuspendAndCreateNewRow; | 2554 goto SuspendAndCreateNewRow; |
| 2556 } | 2555 } |
| 2557 } break; | 2556 } break; |
| 2558 case XFA_ItemLayoutProcessorStages_BookendLeader: { | 2557 case XFA_ItemLayoutProcessorStages_BookendLeader: { |
| 2559 CXFA_Node* pLeaderNode = nullptr; | 2558 CXFA_Node* pLeaderNode = nullptr; |
| 2560 if (m_pCurChildPreprocessor) { | 2559 if (m_pCurChildPreprocessor) { |
| 2561 pProcessor = m_pCurChildPreprocessor; | 2560 pProcessor = m_pCurChildPreprocessor; |
| 2562 m_pCurChildPreprocessor = nullptr; | 2561 m_pCurChildPreprocessor = nullptr; |
| 2563 } else if (m_pPageMgr && | 2562 } else if (m_pPageMgr && |
| 2564 m_pPageMgr->ProcessBookendLeaderOrTrailer( | 2563 m_pPageMgr->ProcessBookendLeaderOrTrailer( |
| 2565 m_pCurChildNode, TRUE, pLeaderNode)) { | 2564 m_pCurChildNode, true, pLeaderNode)) { |
| 2566 pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, m_pPageMgr); | 2565 pProcessor = new CXFA_ItemLayoutProcessor(pLeaderNode, m_pPageMgr); |
| 2567 } | 2566 } |
| 2568 if (pProcessor) { | 2567 if (pProcessor) { |
| 2569 if (XFA_ItemLayoutProcessor_InsertFlowedItem( | 2568 if (XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2570 this, pProcessor, bContainerWidthAutoSize, | 2569 this, pProcessor, bContainerWidthAutoSize, |
| 2571 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2570 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2572 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2571 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
| 2573 fAvailHeight, fRealHeight, fContentCurRowY, | 2572 fAvailHeight, fRealHeight, fContentCurRowY, |
| 2574 fContentWidthLimit, fContentCurRowAvailWidth, | 2573 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2575 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2574 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2576 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2575 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
| 2577 goto SuspendAndCreateNewRow; | 2576 goto SuspendAndCreateNewRow; |
| 2578 } else { | 2577 } else { |
| 2579 delete pProcessor; | 2578 delete pProcessor; |
| 2580 pProcessor = nullptr; | 2579 pProcessor = nullptr; |
| 2581 } | 2580 } |
| 2582 } | 2581 } |
| 2583 } break; | 2582 } break; |
| 2584 case XFA_ItemLayoutProcessorStages_BookendTrailer: { | 2583 case XFA_ItemLayoutProcessorStages_BookendTrailer: { |
| 2585 CXFA_Node* pTrailerNode = nullptr; | 2584 CXFA_Node* pTrailerNode = nullptr; |
| 2586 if (m_pCurChildPreprocessor) { | 2585 if (m_pCurChildPreprocessor) { |
| 2587 pProcessor = m_pCurChildPreprocessor; | 2586 pProcessor = m_pCurChildPreprocessor; |
| 2588 m_pCurChildPreprocessor = nullptr; | 2587 m_pCurChildPreprocessor = nullptr; |
| 2589 } else if (m_pPageMgr && | 2588 } else if (m_pPageMgr && |
| 2590 m_pPageMgr->ProcessBookendLeaderOrTrailer( | 2589 m_pPageMgr->ProcessBookendLeaderOrTrailer( |
| 2591 m_pCurChildNode, FALSE, pTrailerNode)) { | 2590 m_pCurChildNode, false, pTrailerNode)) { |
| 2592 pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, m_pPageMgr); | 2591 pProcessor = new CXFA_ItemLayoutProcessor(pTrailerNode, m_pPageMgr); |
| 2593 } | 2592 } |
| 2594 if (pProcessor) { | 2593 if (pProcessor) { |
| 2595 if (XFA_ItemLayoutProcessor_InsertFlowedItem( | 2594 if (XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2596 this, pProcessor, bContainerWidthAutoSize, | 2595 this, pProcessor, bContainerWidthAutoSize, |
| 2597 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2596 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2598 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2597 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
| 2599 fAvailHeight, fRealHeight, fContentCurRowY, | 2598 fAvailHeight, fRealHeight, fContentCurRowY, |
| 2600 fContentWidthLimit, fContentCurRowAvailWidth, | 2599 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2601 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2600 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2602 pContext) != XFA_ItemLayoutProcessorResult_Done) { | 2601 pContext) != XFA_ItemLayoutProcessorResult_Done) { |
| 2603 goto SuspendAndCreateNewRow; | 2602 goto SuspendAndCreateNewRow; |
| 2604 } else { | 2603 } else { |
| 2605 delete pProcessor; | 2604 delete pProcessor; |
| 2606 pProcessor = nullptr; | 2605 pProcessor = nullptr; |
| 2607 } | 2606 } |
| 2608 } | 2607 } |
| 2609 } break; | 2608 } break; |
| 2610 case XFA_ItemLayoutProcessorStages_Container: | 2609 case XFA_ItemLayoutProcessorStages_Container: |
| 2611 ASSERT(m_pCurChildNode->IsContainerNode()); | 2610 ASSERT(m_pCurChildNode->IsContainerNode()); |
| 2612 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { | 2611 if (m_pCurChildNode->GetElementType() == XFA_Element::Variables) { |
| 2613 break; | 2612 break; |
| 2614 } | 2613 } |
| 2615 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && | 2614 if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION && |
| 2616 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { | 2615 XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) { |
| 2617 bForceEndPage = TRUE; | 2616 bForceEndPage = true; |
| 2618 goto SuspendAndCreateNewRow; | 2617 goto SuspendAndCreateNewRow; |
| 2619 } | 2618 } |
| 2620 if (m_pCurChildNode->IsContainerNode()) { | 2619 if (m_pCurChildNode->IsContainerNode()) { |
| 2621 FX_BOOL bNewRow = FALSE; | 2620 bool bNewRow = false; |
| 2622 if (m_pCurChildPreprocessor) { | 2621 if (m_pCurChildPreprocessor) { |
| 2623 pProcessor = m_pCurChildPreprocessor; | 2622 pProcessor = m_pCurChildPreprocessor; |
| 2624 m_pCurChildPreprocessor = nullptr; | 2623 m_pCurChildPreprocessor = nullptr; |
| 2625 bNewRow = TRUE; | 2624 bNewRow = true; |
| 2626 } else { | 2625 } else { |
| 2627 pProcessor = | 2626 pProcessor = |
| 2628 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); | 2627 new CXFA_ItemLayoutProcessor(m_pCurChildNode, m_pPageMgr); |
| 2629 } | 2628 } |
| 2630 XFA_ItemLayoutProcessor_InsertPendingItems(pProcessor, | 2629 XFA_ItemLayoutProcessor_InsertPendingItems(pProcessor, |
| 2631 m_pCurChildNode); | 2630 m_pCurChildNode); |
| 2632 XFA_ItemLayoutProcessorResult rs = | 2631 XFA_ItemLayoutProcessorResult rs = |
| 2633 XFA_ItemLayoutProcessor_InsertFlowedItem( | 2632 XFA_ItemLayoutProcessor_InsertFlowedItem( |
| 2634 this, pProcessor, bContainerWidthAutoSize, | 2633 this, pProcessor, bContainerWidthAutoSize, |
| 2635 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, | 2634 bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, |
| 2636 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, | 2635 uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl, |
| 2637 fAvailHeight, fRealHeight, fContentCurRowY, | 2636 fAvailHeight, fRealHeight, fContentCurRowY, |
| 2638 fContentWidthLimit, fContentCurRowAvailWidth, | 2637 fContentWidthLimit, fContentCurRowAvailWidth, |
| 2639 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, | 2638 fContentCurRowHeight, bAddedItemInRow, bForceEndPage, |
| 2640 pContext, bNewRow); | 2639 pContext, bNewRow); |
| 2641 switch (rs) { | 2640 switch (rs) { |
| 2642 case XFA_ItemLayoutProcessorResult_ManualBreak: | 2641 case XFA_ItemLayoutProcessorResult_ManualBreak: |
| 2643 bIsManualBreak = TRUE; | 2642 bIsManualBreak = true; |
| 2644 case XFA_ItemLayoutProcessorResult_PageFullBreak: | 2643 case XFA_ItemLayoutProcessorResult_PageFullBreak: |
| 2645 bForceEndPage = TRUE; | 2644 bForceEndPage = true; |
| 2646 case XFA_ItemLayoutProcessorResult_RowFullBreak: | 2645 case XFA_ItemLayoutProcessorResult_RowFullBreak: |
| 2647 goto SuspendAndCreateNewRow; | 2646 goto SuspendAndCreateNewRow; |
| 2648 case XFA_ItemLayoutProcessorResult_Done: | 2647 case XFA_ItemLayoutProcessorResult_Done: |
| 2649 default: | 2648 default: |
| 2650 fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems( | 2649 fContentCurRowY += XFA_ItemLayoutProcessor_InsertPendingItems( |
| 2651 pProcessor, m_pCurChildNode); | 2650 pProcessor, m_pCurChildNode); |
| 2652 delete pProcessor; | 2651 delete pProcessor; |
| 2653 pProcessor = nullptr; | 2652 pProcessor = nullptr; |
| 2654 } | 2653 } |
| 2655 } | 2654 } |
| 2656 break; | 2655 break; |
| 2657 case XFA_ItemLayoutProcessorStages_Done: | 2656 case XFA_ItemLayoutProcessorStages_Done: |
| 2658 break; | 2657 break; |
| 2659 default: | 2658 default: |
| 2660 break; | 2659 break; |
| 2661 } | 2660 } |
| 2662 XFA_ItemLayoutProcessor_GotoNextContainerNode( | 2661 XFA_ItemLayoutProcessor_GotoNextContainerNode( |
| 2663 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, TRUE); | 2662 m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, true); |
| 2664 if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb) { | 2663 if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb) { |
| 2665 break; | 2664 break; |
| 2666 } else { | 2665 } else { |
| 2667 continue; | 2666 continue; |
| 2668 } | 2667 } |
| 2669 SuspendAndCreateNewRow: | 2668 SuspendAndCreateNewRow: |
| 2670 if (pProcessor) { | 2669 if (pProcessor) { |
| 2671 m_pCurChildPreprocessor = pProcessor; | 2670 m_pCurChildPreprocessor = pProcessor; |
| 2672 } | 2671 } |
| 2673 break; | 2672 break; |
| 2674 } | 2673 } |
| 2675 CalculateRowChildPosition(rgCurLineLayoutItems, eFlowStrategy, | 2674 CalculateRowChildPosition(rgCurLineLayoutItems, eFlowStrategy, |
| 2676 bContainerHeightAutoSize, bContainerWidthAutoSize, | 2675 bContainerHeightAutoSize, bContainerWidthAutoSize, |
| 2677 fContentCalculatedWidth, fContentCalculatedHeight, | 2676 fContentCalculatedWidth, fContentCalculatedHeight, |
| 2678 fContentCurRowY, fContentCurRowHeight, | 2677 fContentCurRowY, fContentCurRowHeight, |
| 2679 fContentWidthLimit, bRootForceTb); | 2678 fContentWidthLimit, bRootForceTb); |
| 2680 m_fWidthLimite = fContentCurRowAvailWidth; | 2679 m_fWidthLimite = fContentCurRowAvailWidth; |
| 2681 if (bForceEndPage) { | 2680 if (bForceEndPage) { |
| 2682 break; | 2681 break; |
| 2683 } | 2682 } |
| 2684 } | 2683 } |
| 2685 FX_BOOL bRetValue = | 2684 bool bRetValue = m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done && |
| 2686 m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done && | 2685 m_PendingNodes.empty(); |
| 2687 m_PendingNodes.empty(); | |
| 2688 if (bBreakDone) { | 2686 if (bBreakDone) { |
| 2689 bRetValue = FALSE; | 2687 bRetValue = false; |
| 2690 } | 2688 } |
| 2691 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( | 2689 XFA_ItemLayoutProcessor_CalculateContainerComponentSizeFromContentSize( |
| 2692 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, | 2690 m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth, |
| 2693 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, | 2691 fContainerWidth, bContainerHeightAutoSize, fContentCalculatedHeight, |
| 2694 fContainerHeight); | 2692 fContainerHeight); |
| 2695 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || | 2693 if (fContainerHeight >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem || |
| 2696 bRetValue) { | 2694 bRetValue) { |
| 2697 if (!m_pLayoutItem) { | 2695 if (!m_pLayoutItem) { |
| 2698 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 2696 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
| 2699 } | 2697 } |
| 2700 if (fContainerHeight < 0) { | 2698 if (fContainerHeight < 0) { |
| 2701 fContainerHeight = 0; | 2699 fContainerHeight = 0; |
| 2702 } | 2700 } |
| 2703 SetCurrentComponentSize(fContainerWidth, fContainerHeight); | 2701 SetCurrentComponentSize(fContainerWidth, fContainerHeight); |
| 2704 if (bForceEndPage) { | 2702 if (bForceEndPage) { |
| 2705 m_fUsedSize = 0; | 2703 m_fUsedSize = 0; |
| 2706 } else { | 2704 } else { |
| 2707 m_fUsedSize += m_pLayoutItem->m_sSize.y; | 2705 m_fUsedSize += m_pLayoutItem->m_sSize.y; |
| 2708 } | 2706 } |
| 2709 } | 2707 } |
| 2710 return bRetValue | 2708 return bRetValue |
| 2711 ? XFA_ItemLayoutProcessorResult_Done | 2709 ? XFA_ItemLayoutProcessorResult_Done |
| 2712 : (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak | 2710 : (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak |
| 2713 : XFA_ItemLayoutProcessorResult_PageFullBreak); | 2711 : XFA_ItemLayoutProcessorResult_PageFullBreak); |
| 2714 } | 2712 } |
| 2715 | 2713 |
| 2716 FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition( | 2714 bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition( |
| 2717 CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3], | 2715 CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3], |
| 2718 XFA_ATTRIBUTEENUM eFlowStrategy, | 2716 XFA_ATTRIBUTEENUM eFlowStrategy, |
| 2719 FX_BOOL bContainerHeightAutoSize, | 2717 bool bContainerHeightAutoSize, |
| 2720 FX_BOOL bContainerWidthAutoSize, | 2718 bool bContainerWidthAutoSize, |
| 2721 FX_FLOAT& fContentCalculatedWidth, | 2719 FX_FLOAT& fContentCalculatedWidth, |
| 2722 FX_FLOAT& fContentCalculatedHeight, | 2720 FX_FLOAT& fContentCalculatedHeight, |
| 2723 FX_FLOAT& fContentCurRowY, | 2721 FX_FLOAT& fContentCurRowY, |
| 2724 FX_FLOAT fContentCurRowHeight, | 2722 FX_FLOAT fContentCurRowHeight, |
| 2725 FX_FLOAT fContentWidthLimit, | 2723 FX_FLOAT fContentWidthLimit, |
| 2726 FX_BOOL bRootForceTb) { | 2724 bool bRootForceTb) { |
| 2727 int32_t nGroupLengths[3] = {0, 0, 0}; | 2725 int32_t nGroupLengths[3] = {0, 0, 0}; |
| 2728 FX_FLOAT fGroupWidths[3] = {0, 0, 0}; | 2726 FX_FLOAT fGroupWidths[3] = {0, 0, 0}; |
| 2729 int32_t nTotalLength = 0; | 2727 int32_t nTotalLength = 0; |
| 2730 for (int32_t i = 0; i < 3; i++) { | 2728 for (int32_t i = 0; i < 3; i++) { |
| 2731 nGroupLengths[i] = rgCurLineLayoutItems[i].GetSize(); | 2729 nGroupLengths[i] = rgCurLineLayoutItems[i].GetSize(); |
| 2732 for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) { | 2730 for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) { |
| 2733 nTotalLength++; | 2731 nTotalLength++; |
| 2734 if (XFA_ItemLayoutProcessor_IsTakingSpace( | 2732 if (XFA_ItemLayoutProcessor_IsTakingSpace( |
| 2735 rgCurLineLayoutItems[i][j]->m_pFormNode)) { | 2733 rgCurLineLayoutItems[i][j]->m_pFormNode)) { |
| 2736 fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.x; | 2734 fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.x; |
| 2737 } | 2735 } |
| 2738 } | 2736 } |
| 2739 } | 2737 } |
| 2740 if (!nTotalLength) { | 2738 if (!nTotalLength) { |
| 2741 if (bContainerHeightAutoSize) { | 2739 if (bContainerHeightAutoSize) { |
| 2742 FX_FLOAT fNewHeight = fContentCurRowY; | 2740 FX_FLOAT fNewHeight = fContentCurRowY; |
| 2743 if (fContentCalculatedHeight > fNewHeight) { | 2741 if (fContentCalculatedHeight > fNewHeight) { |
| 2744 fContentCalculatedHeight = fNewHeight; | 2742 fContentCalculatedHeight = fNewHeight; |
| 2745 } | 2743 } |
| 2746 } | 2744 } |
| 2747 return FALSE; | 2745 return false; |
| 2748 } | 2746 } |
| 2749 if (!m_pLayoutItem) { | 2747 if (!m_pLayoutItem) { |
| 2750 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); | 2748 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); |
| 2751 } | 2749 } |
| 2752 if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { | 2750 if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) { |
| 2753 FX_FLOAT fCurPos; | 2751 FX_FLOAT fCurPos; |
| 2754 fCurPos = 0; | 2752 fCurPos = 0; |
| 2755 for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { | 2753 for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) { |
| 2756 if (bRootForceTb) { | 2754 if (bRootForceTb) { |
| 2757 FX_FLOAT fAbsoluteX, fAbsoluteY; | 2755 FX_FLOAT fAbsoluteX, fAbsoluteY; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2859 if (fContentCalculatedWidth < fChildSuppliedWidth) { | 2857 if (fContentCalculatedWidth < fChildSuppliedWidth) { |
| 2860 fContentCalculatedWidth = fChildSuppliedWidth; | 2858 fContentCalculatedWidth = fChildSuppliedWidth; |
| 2861 } | 2859 } |
| 2862 } | 2860 } |
| 2863 if (bContainerHeightAutoSize) { | 2861 if (bContainerHeightAutoSize) { |
| 2864 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; | 2862 FX_FLOAT fChildSuppliedHeight = fContentCurRowY; |
| 2865 if (fContentCalculatedHeight < fChildSuppliedHeight) { | 2863 if (fContentCalculatedHeight < fChildSuppliedHeight) { |
| 2866 fContentCalculatedHeight = fChildSuppliedHeight; | 2864 fContentCalculatedHeight = fChildSuppliedHeight; |
| 2867 } | 2865 } |
| 2868 } | 2866 } |
| 2869 return TRUE; | 2867 return true; |
| 2870 } | 2868 } |
| 2871 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( | 2869 CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent( |
| 2872 CXFA_Node* pSubformSet) { | 2870 CXFA_Node* pSubformSet) { |
| 2873 if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { | 2871 if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) { |
| 2874 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); | 2872 CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent); |
| 2875 while (pParent) { | 2873 while (pParent) { |
| 2876 if (pParent->GetElementType() != XFA_Element::SubformSet) { | 2874 if (pParent->GetElementType() != XFA_Element::SubformSet) { |
| 2877 return pParent; | 2875 return pParent; |
| 2878 } | 2876 } |
| 2879 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); | 2877 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2899 FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); | 2897 FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); |
| 2900 nRotate = XFA_MapRotation(nRotate); | 2898 nRotate = XFA_MapRotation(nRotate); |
| 2901 if (nRotate == 90 || nRotate == 270) { | 2899 if (nRotate == 90 || nRotate == 270) { |
| 2902 FX_FLOAT fTmp = fWidth; | 2900 FX_FLOAT fTmp = fWidth; |
| 2903 fWidth = fHeight; | 2901 fWidth = fHeight; |
| 2904 fHeight = fTmp; | 2902 fHeight = fTmp; |
| 2905 } | 2903 } |
| 2906 SetCurrentComponentSize(fWidth, fHeight); | 2904 SetCurrentComponentSize(fWidth, fHeight); |
| 2907 } | 2905 } |
| 2908 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( | 2906 XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout( |
| 2909 FX_BOOL bUseBreakControl, | 2907 bool bUseBreakControl, |
| 2910 FX_FLOAT fHeightLimit, | 2908 FX_FLOAT fHeightLimit, |
| 2911 FX_FLOAT fRealHeight, | 2909 FX_FLOAT fRealHeight, |
| 2912 CXFA_LayoutContext* pContext) { | 2910 CXFA_LayoutContext* pContext) { |
| 2913 switch (m_pFormNode->GetElementType()) { | 2911 switch (m_pFormNode->GetElementType()) { |
| 2914 case XFA_Element::Subform: | 2912 case XFA_Element::Subform: |
| 2915 case XFA_Element::Area: | 2913 case XFA_Element::Area: |
| 2916 case XFA_Element::ExclGroup: | 2914 case XFA_Element::ExclGroup: |
| 2917 case XFA_Element::SubformSet: { | 2915 case XFA_Element::SubformSet: { |
| 2918 FX_BOOL bRootForceTb = FALSE; | 2916 bool bRootForceTb = false; |
| 2919 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); | 2917 CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode); |
| 2920 XFA_ATTRIBUTEENUM eLayoutStrategy = | 2918 XFA_ATTRIBUTEENUM eLayoutStrategy = |
| 2921 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); | 2919 XFA_ItemLayoutProcessor_GetLayout(pLayoutNode, bRootForceTb); |
| 2922 switch (eLayoutStrategy) { | 2920 switch (eLayoutStrategy) { |
| 2923 case XFA_ATTRIBUTEENUM_Tb: | 2921 case XFA_ATTRIBUTEENUM_Tb: |
| 2924 case XFA_ATTRIBUTEENUM_Lr_tb: | 2922 case XFA_ATTRIBUTEENUM_Lr_tb: |
| 2925 case XFA_ATTRIBUTEENUM_Rl_tb: | 2923 case XFA_ATTRIBUTEENUM_Rl_tb: |
| 2926 return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, | 2924 return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy, |
| 2927 fHeightLimit, fRealHeight, pContext, | 2925 fHeightLimit, fRealHeight, pContext, |
| 2928 bRootForceTb); | 2926 bRootForceTb); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2964 } | 2962 } |
| 2965 void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(FX_FLOAT fAbsoluteX, | 2963 void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(FX_FLOAT fAbsoluteX, |
| 2966 FX_FLOAT fAbsoluteY) { | 2964 FX_FLOAT fAbsoluteY) { |
| 2967 m_pLayoutItem->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY); | 2965 m_pLayoutItem->m_sPos = CFX_PointF(fAbsoluteX, fAbsoluteY); |
| 2968 } | 2966 } |
| 2969 void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth, | 2967 void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth, |
| 2970 FX_FLOAT fHeight) { | 2968 FX_FLOAT fHeight) { |
| 2971 m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight); | 2969 m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight); |
| 2972 } | 2970 } |
| 2973 | 2971 |
| 2974 FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( | 2972 bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( |
| 2975 CXFA_Node* pFormNode) { | 2973 CXFA_Node* pFormNode) { |
| 2976 if (!pFormNode) | 2974 if (!pFormNode) |
| 2977 return FALSE; | 2975 return false; |
| 2978 | 2976 |
| 2979 CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); | 2977 CXFA_Node* pTemplate = pFormNode->GetTemplateNode(); |
| 2980 if (!pTemplate) | 2978 if (!pTemplate) |
| 2981 pTemplate = pFormNode; | 2979 pTemplate = pFormNode; |
| 2982 | 2980 |
| 2983 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur)); | 2981 CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur)); |
| 2984 int32_t iMax = NodeOccur.GetMax(); | 2982 int32_t iMax = NodeOccur.GetMax(); |
| 2985 if (iMax < 0) | 2983 if (iMax < 0) |
| 2986 return TRUE; | 2984 return true; |
| 2987 | 2985 |
| 2988 int32_t iCount = m_PendingNodesCount[pTemplate]; | 2986 int32_t iCount = m_PendingNodesCount[pTemplate]; |
| 2989 if (iCount >= iMax) | 2987 if (iCount >= iMax) |
| 2990 return FALSE; | 2988 return false; |
| 2991 | 2989 |
| 2992 m_PendingNodesCount[pTemplate] = iCount + 1; | 2990 m_PendingNodesCount[pTemplate] = iCount + 1; |
| 2993 return TRUE; | 2991 return true; |
| 2994 } | 2992 } |
| OLD | NEW |