Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cxfa_layoutitem.cpp
Go to the documentation of this file.
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
#
include
"xfa/fxfa/layout/cxfa_layoutitem.h"
8
9
#
include
"fxjs/xfa/cjx_object.h"
10
#
include
"xfa/fxfa/cxfa_ffnotify.h"
11
#
include
"xfa/fxfa/layout/cxfa_contentlayoutitem.h"
12
#
include
"xfa/fxfa/layout/cxfa_layoutprocessor.h"
13
#
include
"xfa/fxfa/layout/cxfa_viewlayoutitem.h"
14
#
include
"xfa/fxfa/parser/cxfa_margin.h"
15
#
include
"xfa/fxfa/parser/cxfa_measurement.h"
16
#
include
"xfa/fxfa/parser/cxfa_node.h"
17
18
void
XFA_ReleaseLayoutItem
(
CXFA_LayoutItem
* pLayoutItem) {
19
CXFA_LayoutItem
* pNode = pLayoutItem->GetFirstChild();
20
while
(pNode) {
21
CXFA_LayoutItem
* pNext = pNode->GetNextSibling();
22
XFA_ReleaseLayoutItem
(
pNode
)
;
23
pNode = pNext;
24
}
25
CXFA_Document* pDocument = pLayoutItem
->
GetFormNode
(
)
->
GetDocument
();
26
CXFA_FFNotify
* pNotify = pDocument
->
GetNotify
(
)
;
27
auto
* pDocLayout = CXFA_LayoutProcessor
::
FromDocument
(
pDocument
)
;
28
pNotify
->
OnLayoutItemRemoving
(
pDocLayout
,
pLayoutItem
)
;
29
if
(pLayoutItem
->
GetFormNode
(
)
->
GetElementType
() ==
XFA_Element
::PageArea) {
30
pNotify
->
OnPageViewEvent
(
ToViewLayoutItem
(
pLayoutItem
)
,
31
CXFA_FFDoc
::
PageViewEvent
::
kPostRemoved
)
;
32
}
33
pLayoutItem->RemoveSelfIfParented();
34
}
35
36
CXFA_LayoutItem
::
CXFA_LayoutItem
(
CXFA_Node
* pNode,
ItemType
type)
37
: m_ItemType(type),
m_pFormNode
(
pNode
) {}
38
39
CXFA_LayoutItem
::~
CXFA_LayoutItem
() =
default
;
40
41
void
CXFA_LayoutItem
::
PreFinalize
() {
42
if
(!m_pFormNode)
43
return
;
44
45
auto
* pJSObj = m_pFormNode->JSObject();
46
if
(pJSObj && pJSObj->GetLayoutItem() ==
this
)
47
pJSObj->SetLayoutItem(
nullptr
);
48
}
49
50
void
CXFA_LayoutItem
::
Trace
(
cppgc
::Visitor* visitor)
const
{
51
GCedTreeNode<CXFA_LayoutItem>::Trace(visitor);
52
visitor->Trace(m_pFormNode);
53
}
54
55
CXFA_ViewLayoutItem*
CXFA_LayoutItem
::
AsViewLayoutItem
() {
56
return
IsViewLayoutItem() ?
static_cast
<CXFA_ViewLayoutItem*>(
this
) :
nullptr
;
57
}
58
59
const
CXFA_ViewLayoutItem*
CXFA_LayoutItem
::
AsViewLayoutItem
()
const
{
60
return
IsViewLayoutItem() ?
static_cast
<
const
CXFA_ViewLayoutItem*>(
this
)
61
:
nullptr
;
62
}
63
64
CXFA_ContentLayoutItem*
CXFA_LayoutItem
::
AsContentLayoutItem
() {
65
return
IsContentLayoutItem() ?
static_cast
<CXFA_ContentLayoutItem*>(
this
)
66
:
nullptr
;
67
}
68
69
const
CXFA_ContentLayoutItem*
CXFA_LayoutItem
::
AsContentLayoutItem
()
const
{
70
return
IsContentLayoutItem()
71
?
static_cast
<
const
CXFA_ContentLayoutItem*>(
this
)
72
:
nullptr
;
73
}
74
75
const
CXFA_ViewLayoutItem*
CXFA_LayoutItem
::
GetPage
()
const
{
76
for
(
CXFA_LayoutItem
* pCurNode =
const_cast
<
CXFA_LayoutItem
*>(
this
); pCurNode;
77
pCurNode = pCurNode->GetParent()) {
78
if
(pCurNode->m_pFormNode->GetElementType() ==
XFA_Element
::PageArea)
79
return
pCurNode
->
AsViewLayoutItem
(
)
;
80
}
81
return
nullptr
;
82
}
83
84
void
CXFA_LayoutItem
::
SetFormNode
(
CXFA_Node
* pNode) {
85
// Not in header, assignment requires complete type, not just forward decl.
86
m_pFormNode = pNode;
87
}
CXFA_Document::GetNotify
CXFA_FFNotify * GetNotify() const
Definition
cxfa_document.h:98
CXFA_FFDoc
Definition
cxfa_ffdoc.h:55
CXFA_FFDoc::PageViewEvent
PageViewEvent
Definition
cxfa_ffdoc.h:59
CXFA_FFDoc::PageViewEvent::kPostRemoved
@ kPostRemoved
Definition
cxfa_ffdoc.h:61
CXFA_FFNotify
Definition
cxfa_ffnotify.h:26
CXFA_FFNotify::OnPageViewEvent
void OnPageViewEvent(CXFA_ViewLayoutItem *pSender, CXFA_FFDoc::PageViewEvent eEvent)
Definition
cxfa_ffnotify.cpp:54
CXFA_FFNotify::OnLayoutItemRemoving
void OnLayoutItemRemoving(CXFA_LayoutProcessor *pLayout, CXFA_LayoutItem *pSender)
Definition
cxfa_ffnotify.cpp:510
CXFA_LayoutItem
Definition
cxfa_layoutitem.h:20
CXFA_LayoutItem::PreFinalize
void PreFinalize()
Definition
cxfa_layoutitem.cpp:41
CXFA_LayoutItem::GetPage
const CXFA_ViewLayoutItem * GetPage() const
Definition
cxfa_layoutitem.cpp:75
CXFA_LayoutItem::AsViewLayoutItem
CXFA_ViewLayoutItem * AsViewLayoutItem()
Definition
cxfa_layoutitem.cpp:55
CXFA_LayoutItem::SetFormNode
void SetFormNode(CXFA_Node *pNode)
Definition
cxfa_layoutitem.cpp:84
CXFA_LayoutItem::~CXFA_LayoutItem
~CXFA_LayoutItem() override
CXFA_LayoutItem::AsContentLayoutItem
CXFA_ContentLayoutItem * AsContentLayoutItem()
Definition
cxfa_layoutitem.cpp:64
CXFA_LayoutItem::GetFormNode
CXFA_Node * GetFormNode() const
Definition
cxfa_layoutitem.h:40
CXFA_LayoutItem::CXFA_LayoutItem
CXFA_LayoutItem(CXFA_Node *pNode, ItemType type)
Definition
cxfa_layoutitem.cpp:36
CXFA_LayoutItem::AsContentLayoutItem
const CXFA_ContentLayoutItem * AsContentLayoutItem() const
Definition
cxfa_layoutitem.cpp:69
CXFA_LayoutItem::ItemType
ItemType
Definition
cxfa_layoutitem.h:44
CXFA_LayoutItem::Trace
void Trace(cppgc::Visitor *visitor) const override
Definition
cxfa_layoutitem.cpp:50
CXFA_LayoutItem::AsViewLayoutItem
const CXFA_ViewLayoutItem * AsViewLayoutItem() const
Definition
cxfa_layoutitem.cpp:59
CXFA_LayoutProcessor::FromDocument
static CXFA_LayoutProcessor * FromDocument(const CXFA_Document *pXFADoc)
Definition
cxfa_layoutprocessor.cpp:24
CXFA_Node
Definition
cxfa_node.h:94
CXFA_Object::GetElementType
XFA_Element GetElementType() const
Definition
cxfa_object.h:91
CXFA_Object::GetDocument
CXFA_Document * GetDocument() const
Definition
cxfa_object.h:48
ToViewLayoutItem
CXFA_ViewLayoutItem * ToViewLayoutItem(CXFA_LayoutItem *item)
Definition
cxfa_layoutitem.h:52
XFA_ReleaseLayoutItem
void XFA_ReleaseLayoutItem(CXFA_LayoutItem *pLayoutItem)
Definition
cxfa_layoutitem.cpp:18
XFA_Element
XFA_Element
Definition
fxfa_basic.h:75
cppgc
Definition
heap.h:12
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
layout
cxfa_layoutitem.cpp
Generated on
for Qt by
1.18.0