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

Side by Side Diff: xfa/src/fde/fde_iterator.cpp

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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/src/fde/fde_iterator.h ('k') | xfa/src/fde/fde_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "xfa/src/fde/fde_iterator.h"
8
9 #include "xfa/src/fgas/crt/fgas_utils.h"
10
11 IFDE_VisualSetIterator* IFDE_VisualSetIterator::Create() {
12 return new CFDE_VisualSetIterator;
13 }
14 CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {}
15 CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {
16 m_CanvasStack.RemoveAll();
17 }
18 FX_BOOL CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) {
19 FXSYS_assert(pCanvas != NULL);
20 m_CanvasStack.RemoveAll();
21 FDE_CANVASITEM canvas;
22 canvas.hCanvas = NULL;
23 canvas.pCanvas = pCanvas;
24 canvas.hPos = pCanvas->GetFirstPosition(NULL);
25 if (canvas.hPos == NULL) {
26 return FALSE;
27 }
28 return m_CanvasStack.Push(canvas) == 0;
29 }
30 FX_BOOL CFDE_VisualSetIterator::FilterObjects(FX_DWORD dwObjects) {
31 if (m_CanvasStack.GetSize() == 0) {
32 return FALSE;
33 }
34 while (m_CanvasStack.GetSize() > 1) {
35 m_CanvasStack.Pop();
36 }
37 m_dwFilter = dwObjects & ~(FX_DWORD)FDE_VISUALOBJ_Widget;
38 if (dwObjects & FDE_VISUALOBJ_Widget) {
39 m_dwFilter |= 0xFF00;
40 }
41 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement();
42 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL);
43 pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(NULL);
44 return pCanvas->hPos != NULL;
45 }
46 void CFDE_VisualSetIterator::Reset() {
47 FilterObjects(m_dwFilter);
48 }
49 FDE_HVISUALOBJ CFDE_VisualSetIterator::GetNext(IFDE_VisualSet*& pVisualSet,
50 FDE_HVISUALOBJ* phCanvasObj,
51 IFDE_CanvasSet** ppCanvasSet) {
52 while (m_CanvasStack.GetSize() > 0) {
53 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement();
54 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL);
55 if (pCanvas->hPos == NULL) {
56 if (m_CanvasStack.GetSize() == 1) {
57 break;
58 }
59 m_CanvasStack.Pop();
60 continue;
61 }
62 do {
63 FDE_HVISUALOBJ hObj = pCanvas->pCanvas->GetNext(
64 pCanvas->hCanvas, pCanvas->hPos, pVisualSet);
65 FXSYS_assert(hObj != NULL);
66 FDE_VISUALOBJTYPE eType = pVisualSet->GetType();
67 if (eType == FDE_VISUALOBJ_Canvas) {
68 FDE_CANVASITEM canvas;
69 canvas.hCanvas = hObj;
70 canvas.pCanvas = (IFDE_CanvasSet*)pVisualSet;
71 canvas.hPos = canvas.pCanvas->GetFirstPosition(hObj);
72 m_CanvasStack.Push(canvas);
73 break;
74 }
75 FX_DWORD dwObj =
76 (eType == FDE_VISUALOBJ_Widget)
77 ? (FX_DWORD)((IFDE_WidgetSet*)pVisualSet)->GetWidgetType(hObj)
78 : (FX_DWORD)eType;
79 if ((m_dwFilter & dwObj) != 0) {
80 if (ppCanvasSet) {
81 *ppCanvasSet = pCanvas->pCanvas;
82 }
83 if (phCanvasObj) {
84 *phCanvasObj = pCanvas->hCanvas;
85 }
86 return hObj;
87 }
88 } while (pCanvas->hPos != NULL);
89 }
90 if (ppCanvasSet) {
91 *ppCanvasSet = NULL;
92 }
93 if (phCanvasObj) {
94 *phCanvasObj = NULL;
95 }
96 pVisualSet = NULL;
97 return NULL;
98 }
OLDNEW
« no previous file with comments | « xfa/src/fde/fde_iterator.h ('k') | xfa/src/fde/fde_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698