summaryrefslogtreecommitdiff
path: root/xfa/src/fxfa/parser/xfa_layout_appadapter.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-08 13:49:22 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-08 13:49:22 -0500
commit6cdf084fa40a62eb33185171622ad12d95c6009e (patch)
treedaeea24a81365ed27582f280b7f19add0cb7b0d7 /xfa/src/fxfa/parser/xfa_layout_appadapter.cpp
parent653e0797debddb4e9aecbc6cde65748d43b18b79 (diff)
downloadpdfium-6cdf084fa40a62eb33185171622ad12d95c6009e.tar.xz
Remove xfa/src/fxfa/src/common and xfa/src/fxfa/src
This Cl moves the code in xfa/src/fxfa/src/common to the diretory which contains the respective implementations and removes the xfa/src/fxfa/src/common directory. It them moves all of the code in xfa/src/fxfa/src up one level and removes the xfa/src/fxfa/src directory. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1770073003 .
Diffstat (limited to 'xfa/src/fxfa/parser/xfa_layout_appadapter.cpp')
-rw-r--r--xfa/src/fxfa/parser/xfa_layout_appadapter.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/xfa/src/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/src/fxfa/parser/xfa_layout_appadapter.cpp
new file mode 100644
index 0000000000..bf79c83a38
--- /dev/null
+++ b/xfa/src/fxfa/parser/xfa_layout_appadapter.cpp
@@ -0,0 +1,62 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/src/fxfa/parser/xfa_layout_appadapter.h"
+
+#include "xfa/src/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/src/fxfa/parser/xfa_docdata.h"
+#include "xfa/src/fxfa/parser/xfa_doclayout.h"
+#include "xfa/src/fxfa/parser/xfa_document.h"
+#include "xfa/src/fxfa/parser/xfa_document_layout_imp.h"
+#include "xfa/src/fxfa/parser/xfa_layout_itemlayout.h"
+#include "xfa/src/fxfa/parser/xfa_layout_pagemgr_new.h"
+#include "xfa/src/fxfa/parser/xfa_localemgr.h"
+#include "xfa/src/fxfa/parser/xfa_object.h"
+#include "xfa/src/fxfa/parser/xfa_parser.h"
+#include "xfa/src/fxfa/parser/xfa_script.h"
+#include "xfa/src/fxfa/parser/xfa_utils.h"
+
+FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant) {
+ FX_DWORD dwRelevant = XFA_LAYOUTSTATUS_Viewable | XFA_LAYOUTSTATUS_Printable;
+ CFX_WideStringC wsRelevant;
+ if (pFormItem->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant)) {
+ if (wsRelevant == FX_WSTRC(L"+print") || wsRelevant == FX_WSTRC(L"print")) {
+ dwRelevant &= ~XFA_LAYOUTSTATUS_Viewable;
+ } else if (wsRelevant == FX_WSTRC(L"-print")) {
+ dwRelevant &= ~XFA_LAYOUTSTATUS_Printable;
+ }
+ }
+ if (!(dwParentRelvant & XFA_LAYOUTSTATUS_Viewable) &&
+ (dwRelevant != XFA_LAYOUTSTATUS_Viewable)) {
+ dwRelevant &= ~XFA_LAYOUTSTATUS_Viewable;
+ }
+ if (!(dwParentRelvant & XFA_LAYOUTSTATUS_Printable) &&
+ (dwRelevant != XFA_LAYOUTSTATUS_Printable)) {
+ dwRelevant &= ~XFA_LAYOUTSTATUS_Printable;
+ }
+ return dwRelevant;
+}
+void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
+ CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
+ IXFA_Notify* pNotify =
+ pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify();
+ IXFA_DocLayout* pDocLayout =
+ pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
+ while (pNode) {
+ CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
+ pNode->m_pParent = nullptr;
+ pNotify->OnLayoutEvent(pDocLayout, static_cast<CXFA_LayoutItem*>(pNode),
+ XFA_LAYOUTEVENT_ItemRemoving);
+ XFA_ReleaseLayoutItem(pNode);
+ pNode = pNext;
+ }
+ pNotify->OnLayoutEvent(pDocLayout, pLayoutItem, XFA_LAYOUTEVENT_ItemRemoving);
+ if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) {
+ pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem),
+ XFA_PAGEEVENT_PageRemoved);
+ }
+ delete pLayoutItem;
+}