• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The PDFium Authors
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 #ifndef XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTITEM_H_
8 #define XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTITEM_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "core/fxcrt/mask.h"
12 #include "v8/include/cppgc/persistent.h"
13 #include "xfa/fxfa/fxfa.h"
14 #include "xfa/fxfa/layout/cxfa_layoutitem.h"
15 
16 class CXFA_FFWidget;
17 
18 class CXFA_ContentLayoutItem final : public CXFA_LayoutItem {
19  public:
20   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
21   ~CXFA_ContentLayoutItem() override;
22 
23   void Trace(cppgc::Visitor* visitor) const override;
24 
GetFFWidget()25   CXFA_FFWidget* GetFFWidget() { return m_pFFWidget; }
26 
27   CXFA_ContentLayoutItem* GetFirst();
28   CXFA_ContentLayoutItem* GetLast();
GetPrev()29   CXFA_ContentLayoutItem* GetPrev() const { return m_pPrev; }
GetNext()30   CXFA_ContentLayoutItem* GetNext() const { return m_pNext; }
31   void InsertAfter(CXFA_ContentLayoutItem* pNext);
32 
33   CFX_RectF GetRelativeRect() const;
34   CFX_RectF GetAbsoluteRect() const;
35   size_t GetIndex() const;
36 
SetStatusBits(Mask<XFA_WidgetStatus> val)37   void SetStatusBits(Mask<XFA_WidgetStatus> val) { m_dwStatus |= val; }
ClearStatusBits(Mask<XFA_WidgetStatus> val)38   void ClearStatusBits(Mask<XFA_WidgetStatus> val) { m_dwStatus &= ~val; }
39 
40   // TRUE if all (not any) bits set in |val| are set in |m_dwStatus|.
TestStatusBits(Mask<XFA_WidgetStatus> val)41   bool TestStatusBits(Mask<XFA_WidgetStatus> val) const {
42     return m_dwStatus.TestAll(val);
43   }
44 
45   CFX_PointF m_sPos;
46   CFX_SizeF m_sSize;
47 
48  private:
49   CXFA_ContentLayoutItem(CXFA_Node* pNode, CXFA_FFWidget* pFFWidget);
50   void RemoveSelf();
51 
52   mutable Mask<XFA_WidgetStatus> m_dwStatus;
53   cppgc::Member<CXFA_ContentLayoutItem> m_pPrev;
54   cppgc::Member<CXFA_ContentLayoutItem> m_pNext;
55   cppgc::Member<CXFA_FFWidget> const m_pFFWidget;
56 };
57 
GetFFWidget(CXFA_ContentLayoutItem * item)58 inline CXFA_FFWidget* GetFFWidget(CXFA_ContentLayoutItem* item) {
59   return item ? item->GetFFWidget() : nullptr;
60 }
61 
62 #endif  // XFA_FXFA_LAYOUT_CXFA_CONTENTLAYOUTITEM_H_
63