Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: xfa/fxfa/parser/xfa_layout_itemlayout.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_appadapter.cpp ('k') | xfa/fxfa/parser/xfa_layout_pagemgr_new.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "xfa/fgas/crt/fgas_algorithm.h" 12 #include "xfa/fgas/crt/fgas_algorithm.h"
13 #include "xfa/fxfa/app/xfa_ffnotify.h"
13 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 14 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
14 #include "xfa/fxfa/parser/xfa_docdata.h" 15 #include "xfa/fxfa/parser/xfa_docdata.h"
15 #include "xfa/fxfa/parser/xfa_doclayout.h" 16 #include "xfa/fxfa/parser/xfa_doclayout.h"
16 #include "xfa/fxfa/parser/xfa_document.h" 17 #include "xfa/fxfa/parser/xfa_document.h"
17 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" 18 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
18 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" 19 #include "xfa/fxfa/parser/xfa_layout_appadapter.h"
19 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" 20 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h"
20 #include "xfa/fxfa/parser/xfa_localemgr.h" 21 #include "xfa/fxfa/parser/xfa_localemgr.h"
21 #include "xfa/fxfa/parser/xfa_object.h" 22 #include "xfa/fxfa/parser/xfa_object.h"
22 #include "xfa/fxfa/parser/xfa_parser.h" 23 #include "xfa/fxfa/parser/xfa_parser.h"
24 #include "xfa/fxfa/parser/xfa_parser_imp.h"
23 #include "xfa/fxfa/parser/xfa_script.h" 25 #include "xfa/fxfa/parser/xfa_script.h"
24 #include "xfa/fxfa/parser/xfa_utils.h" 26 #include "xfa/fxfa/parser/xfa_utils.h"
25 27
26 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, 28 CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
27 CXFA_LayoutPageMgr* pPageMgr) 29 CXFA_LayoutPageMgr* pPageMgr)
28 : m_bKeepBreakFinish(FALSE), 30 : m_bKeepBreakFinish(FALSE),
29 m_bIsProcessKeep(FALSE), 31 m_bIsProcessKeep(FALSE),
30 m_pKeepHeadNode(nullptr), 32 m_pKeepHeadNode(nullptr),
31 m_pKeepTailNode(nullptr), 33 m_pKeepTailNode(nullptr),
32 m_pFormNode(pNode), 34 m_pFormNode(pNode),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 FX_BOOL& bAppChange, 86 FX_BOOL& bAppChange,
85 FX_BOOL bCalculateMargin) { 87 FX_BOOL bCalculateMargin) {
86 CXFA_Node* pFormNode = pLayoutItem->m_pFormNode; 88 CXFA_Node* pFormNode = pLayoutItem->m_pFormNode;
87 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION && 89 if (fProposedSplitPos > fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION &&
88 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y - 90 fProposedSplitPos <= fCurVerticalOffset + pLayoutItem->m_sSize.y -
89 XFA_LAYOUT_FLOAT_PERCISION) { 91 XFA_LAYOUT_FLOAT_PERCISION) {
90 switch (pFormNode->GetIntact()) { 92 switch (pFormNode->GetIntact()) {
91 case XFA_ATTRIBUTEENUM_None: { 93 case XFA_ATTRIBUTEENUM_None: {
92 FX_BOOL bAnyChanged = FALSE; 94 FX_BOOL bAnyChanged = FALSE;
93 CXFA_Document* pDocument = pFormNode->GetDocument(); 95 CXFA_Document* pDocument = pFormNode->GetDocument();
94 IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); 96 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
95 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0; 97 FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0;
96 CXFA_Node* pMarginNode = 98 CXFA_Node* pMarginNode =
97 pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); 99 pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin);
98 if (pMarginNode && bCalculateMargin) { 100 if (pMarginNode && bCalculateMargin) {
99 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset) 101 fCurTopMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset)
100 .ToUnit(XFA_UNIT_Pt); 102 .ToUnit(XFA_UNIT_Pt);
101 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset) 103 fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset)
102 .ToUnit(XFA_UNIT_Pt); 104 .ToUnit(XFA_UNIT_Pt);
103 } 105 }
104 FX_BOOL bChanged = TRUE; 106 FX_BOOL bChanged = TRUE;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight; 348 fAddMarginHeight = pSecondLayoutItem->m_sSize.y - fOldHeight;
347 pLayoutItem->AddChild(pChildItem); 349 pLayoutItem->AddChild(pChildItem);
348 } 350 }
349 } 351 }
350 } 352 }
351 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) { 353 void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) {
352 ASSERT(m_pLayoutItem); 354 ASSERT(m_pLayoutItem);
353 SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos); 355 SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos);
354 } 356 }
355 357
356 IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const { 358 CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const {
357 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode; 359 for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode;
358 pCurNode = pCurNode->m_pParent) { 360 pCurNode = pCurNode->m_pParent) {
359 if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) 361 if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea)
360 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode); 362 return static_cast<CXFA_ContainerLayoutItem*>(pCurNode);
361 } 363 }
362 return nullptr; 364 return nullptr;
363 } 365 }
364 366
365 CXFA_Node* CXFA_LayoutItem::GetFormNode() const { 367 CXFA_Node* CXFA_LayoutItem::GetFormNode() const {
366 return m_pFormNode; 368 return m_pFormNode;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem; 546 CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem;
545 if (pLayoutItem) { 547 if (pLayoutItem) {
546 m_pLayoutItem = (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling; 548 m_pLayoutItem = (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling;
547 pLayoutItem->m_pNextSibling = NULL; 549 pLayoutItem->m_pNextSibling = NULL;
548 } 550 }
549 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done && 551 if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages_Done &&
550 ToContentLayoutItem(m_pOldLayoutItem)) { 552 ToContentLayoutItem(m_pOldLayoutItem)) {
551 if (m_pOldLayoutItem->m_pPrev) { 553 if (m_pOldLayoutItem->m_pPrev) {
552 m_pOldLayoutItem->m_pPrev->m_pNext = NULL; 554 m_pOldLayoutItem->m_pPrev->m_pNext = NULL;
553 } 555 }
554 IXFA_Notify* pNotify = 556 CXFA_FFNotify* pNotify =
555 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); 557 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify();
556 IXFA_DocLayout* pDocLayout = 558 CXFA_LayoutProcessor* pDocLayout =
557 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); 559 m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
558 CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem; 560 CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
559 while (pOldLayoutItem) { 561 while (pOldLayoutItem) {
560 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext; 562 CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
561 pNotify->OnLayoutEvent(pDocLayout, pOldLayoutItem, 563 pNotify->OnLayoutEvent(pDocLayout, pOldLayoutItem,
562 XFA_LAYOUTEVENT_ItemRemoving); 564 XFA_LAYOUTEVENT_ItemRemoving);
563 delete pOldLayoutItem; 565 delete pOldLayoutItem;
564 pOldLayoutItem = pNextOldLayoutItem; 566 pOldLayoutItem = pNextOldLayoutItem;
565 } 567 }
566 m_pOldLayoutItem = NULL; 568 m_pOldLayoutItem = NULL;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 default: 609 default:
608 break; 610 break;
609 } 611 }
610 if (bFindRs) { 612 if (bFindRs) {
611 break; 613 break;
612 } 614 }
613 } 615 }
614 return bFindRs; 616 return bFindRs;
615 } 617 }
616 static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { 618 static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
617 IXFA_Notify* pNotify = pGenerateNode->GetDocument()->GetParser()->GetNotify(); 619 CXFA_FFNotify* pNotify =
618 IXFA_DocLayout* pDocLayout = pGenerateNode->GetDocument()->GetDocLayout(); 620 pGenerateNode->GetDocument()->GetParser()->GetNotify();
621 CXFA_LayoutProcessor* pDocLayout =
622 pGenerateNode->GetDocument()->GetDocLayout();
619 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator( 623 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
620 pGenerateNode); 624 pGenerateNode);
621 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 625 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
622 pNode = sIterator.MoveToNext()) { 626 pNode = sIterator.MoveToNext()) {
623 CXFA_ContentLayoutItem* pCurLayoutItem = 627 CXFA_ContentLayoutItem* pCurLayoutItem =
624 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY); 628 (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY);
625 CXFA_ContentLayoutItem* pNextLayoutItem = NULL; 629 CXFA_ContentLayoutItem* pNextLayoutItem = NULL;
626 while (pCurLayoutItem) { 630 while (pCurLayoutItem) {
627 pNextLayoutItem = pCurLayoutItem->m_pNext; 631 pNextLayoutItem = pCurLayoutItem->m_pNext;
628 pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem, 632 pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 void CXFA_ItemLayoutProcessor::DoLayoutField() { 2860 void CXFA_ItemLayoutProcessor::DoLayoutField() {
2857 if (m_pLayoutItem) 2861 if (m_pLayoutItem)
2858 return; 2862 return;
2859 2863
2860 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE); 2864 ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
2861 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); 2865 m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
2862 if (!m_pLayoutItem) { 2866 if (!m_pLayoutItem) {
2863 return; 2867 return;
2864 } 2868 }
2865 CXFA_Document* pDocument = m_pFormNode->GetDocument(); 2869 CXFA_Document* pDocument = m_pFormNode->GetDocument();
2866 IXFA_Notify* pNotify = pDocument->GetParser()->GetNotify(); 2870 CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
2867 FX_FLOAT fHeight = -1; 2871 FX_FLOAT fHeight = -1;
2868 FX_FLOAT fWidth = -1; 2872 FX_FLOAT fWidth = -1;
2869 pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight); 2873 pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight);
2870 int32_t nRotate = 2874 int32_t nRotate =
2871 FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue()); 2875 FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue());
2872 nRotate = XFA_MapRotation(nRotate); 2876 nRotate = XFA_MapRotation(nRotate);
2873 if (nRotate == 90 || nRotate == 270) { 2877 if (nRotate == 90 || nRotate == 270) {
2874 FX_FLOAT fTmp = fWidth; 2878 FX_FLOAT fTmp = fWidth;
2875 fWidth = fHeight; 2879 fWidth = fHeight;
2876 fHeight = fTmp; 2880 fHeight = fTmp;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate); 2963 (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
2960 if (iCount >= iMax) { 2964 if (iCount >= iMax) {
2961 return FALSE; 2965 return FALSE;
2962 } 2966 }
2963 iCount++; 2967 iCount++;
2964 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount)); 2968 m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
2965 return TRUE; 2969 return TRUE;
2966 } 2970 }
2967 return TRUE; 2971 return TRUE;
2968 } 2972 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_appadapter.cpp ('k') | xfa/fxfa/parser/xfa_layout_pagemgr_new.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698