Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cxfa_ffdocview.cpp
Go to the documentation of this file.
1// Copyright 2014 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/cxfa_ffdocview.h"
8
9#include <set>
10#include <utility>
11
12#include "core/fxcrt/fx_extension.h"
13#include "core/fxcrt/stl_util.h"
14#include "core/fxcrt/xml/cfx_xmlparser.h"
15#include "fxjs/gc/container_trace.h"
16#include "fxjs/xfa/cfxjse_engine.h"
17#include "fxjs/xfa/cjx_object.h"
18#include "third_party/base/check_op.h"
19#include "third_party/base/containers/contains.h"
20#include "xfa/fxfa/cxfa_ffapp.h"
21#include "xfa/fxfa/cxfa_ffbarcode.h"
22#include "xfa/fxfa/cxfa_ffcheckbutton.h"
23#include "xfa/fxfa/cxfa_ffdoc.h"
24#include "xfa/fxfa/cxfa_ffexclgroup.h"
25#include "xfa/fxfa/cxfa_fffield.h"
26#include "xfa/fxfa/cxfa_ffimage.h"
27#include "xfa/fxfa/cxfa_ffimageedit.h"
28#include "xfa/fxfa/cxfa_ffpageview.h"
29#include "xfa/fxfa/cxfa_ffpushbutton.h"
30#include "xfa/fxfa/cxfa_ffsignature.h"
31#include "xfa/fxfa/cxfa_fftext.h"
32#include "xfa/fxfa/cxfa_ffwidget.h"
33#include "xfa/fxfa/cxfa_ffwidgethandler.h"
34#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
35#include "xfa/fxfa/cxfa_readynodeiterator.h"
36#include "xfa/fxfa/cxfa_textprovider.h"
37#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
38#include "xfa/fxfa/parser/cxfa_acrobat.h"
39#include "xfa/fxfa/parser/cxfa_binditems.h"
40#include "xfa/fxfa/parser/cxfa_calculate.h"
41#include "xfa/fxfa/parser/cxfa_pageset.h"
42#include "xfa/fxfa/parser/cxfa_present.h"
43#include "xfa/fxfa/parser/cxfa_subform.h"
44#include "xfa/fxfa/parser/cxfa_validate.h"
45#include "xfa/fxfa/parser/xfa_utils.h"
46
47namespace {
48
49bool IsValidXMLNameString(const WideString& str) {
50 bool first = true;
51 for (const auto ch : str) {
52 if (!CFX_XMLParser::IsXMLNameChar(ch, first)) {
53 return false;
54 }
55 first = false;
56 }
57 return true;
58}
59
60} // namespace
61
64 XFA_AttributeValue::DocClose, XFA_AttributeValue::DocReady,
66 XFA_AttributeValue::Full, XFA_AttributeValue::IndexChange,
67 XFA_AttributeValue::Initialize, XFA_AttributeValue::MouseDown,
68 XFA_AttributeValue::MouseEnter, XFA_AttributeValue::MouseExit,
69 XFA_AttributeValue::MouseUp, XFA_AttributeValue::PostExecute,
70 XFA_AttributeValue::PostOpen, XFA_AttributeValue::PostPrint,
71 XFA_AttributeValue::PostSave, XFA_AttributeValue::PostSign,
72 XFA_AttributeValue::PostSubmit, XFA_AttributeValue::PreExecute,
73 XFA_AttributeValue::PreOpen, XFA_AttributeValue::PrePrint,
74 XFA_AttributeValue::PreSave, XFA_AttributeValue::PreSign,
75 XFA_AttributeValue::PreSubmit, XFA_AttributeValue::Ready,
76 XFA_AttributeValue::Unknown,
77};
78
81 m_pDocView->LockUpdate();
82}
83
85 m_pDocView->UnlockUpdate();
86 m_pDocView->UpdateDocView();
87}
88
89CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
90
91CXFA_FFDocView::~CXFA_FFDocView() = default;
92
93void CXFA_FFDocView::Trace(cppgc::Visitor* visitor) const {
94 visitor->Trace(m_pDoc);
95 visitor->Trace(m_pWidgetHandler);
96 visitor->Trace(m_pFocusNode);
97 visitor->Trace(m_pFocusWidget);
98 ContainerTrace(visitor, m_ValidateNodes);
99 ContainerTrace(visitor, m_CalculateNodes);
100 ContainerTrace(visitor, m_NewAddedNodes);
101 ContainerTrace(visitor, m_BindItems);
102 ContainerTrace(visitor, m_IndexChangedSubforms);
103}
104
105void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
106 RunBindItems();
109}
110
112 m_iStatus = LayoutStatus::kStart;
113 m_pDoc->GetXFADoc()->DoProtoMerge();
114 m_pDoc->GetXFADoc()->DoDataMerge();
115
116 int32_t iStatus = GetLayoutProcessor()->StartLayout();
117 if (iStatus < 0)
118 return iStatus;
119
120 CXFA_Node* pRootItem =
121 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
122 if (!pRootItem)
123 return iStatus;
124
125 InitLayout(pRootItem);
126 InitCalculate(pRootItem);
127 InitValidate(pRootItem);
128
130 m_iStatus = LayoutStatus::kStart;
131 return iStatus;
132}
133
135 int32_t iStatus = GetLayoutProcessor()->DoLayout();
136 if (iStatus != 100)
137 return iStatus;
138
139 m_iStatus = LayoutStatus::kDoing;
140 return iStatus;
141}
142
144 CXFA_Node* pRootItem =
145 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
146 if (!pRootItem)
147 return;
148
149 CXFA_Subform* pSubformNode =
150 pRootItem->GetChild<CXFA_Subform>(0, XFA_Element::Subform, false);
151 if (!pSubformNode)
152 return;
153
154 CXFA_PageSet* pPageSetNode =
155 pSubformNode->GetFirstChildByClass<CXFA_PageSet>(XFA_Element::PageSet);
156 if (!pPageSetNode)
157 return;
158
159 RunCalculateWidgets();
160 RunValidate();
161
162 InitLayout(pPageSetNode);
163 InitCalculate(pPageSetNode);
164 InitValidate(pPageSetNode);
165
166 ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true);
169
170 RunCalculateWidgets();
171 RunValidate();
172
173 if (RunLayout())
175
176 m_CalculateNodes.clear();
177 if (m_pFocusNode && !m_pFocusWidget)
178 SetFocusNode(m_pFocusNode);
179
180 m_iStatus = LayoutStatus::kEnd;
181}
182
183void CXFA_FFDocView::AddNullTestMsg(const WideString& msg) {
184 m_NullTestMsgArray.push_back(msg);
185}
186
187void CXFA_FFDocView::ShowNullTestMsg() {
188 int32_t iCount = fxcrt::CollectionSize<int32_t>(m_NullTestMsgArray);
189 CXFA_FFApp* pApp = m_pDoc->GetApp();
190 CXFA_FFApp::CallbackIface* pAppProvider = pApp->GetAppProvider();
191 if (pAppProvider && iCount) {
192 int32_t remaining = iCount > 7 ? iCount - 7 : 0;
193 iCount -= remaining;
194 WideString wsMsg;
195 for (int32_t i = 0; i < iCount; i++)
196 wsMsg += m_NullTestMsgArray[i] + L"\n";
197
198 if (remaining > 0) {
199 wsMsg += L"\n" + WideString::Format(
200 L"Message limit exceeded. Remaining %d "
201 L"validation errors not reported.",
202 remaining);
203 }
204 pAppProvider->MsgBox(wsMsg, pAppProvider->GetAppTitle(),
205 static_cast<uint32_t>(AlertIcon::kStatus),
206 static_cast<uint32_t>(AlertButton::kOK));
207 }
208 m_NullTestMsgArray.clear();
209}
210
212 if (IsUpdateLocked())
213 return;
214
216 while (!m_NewAddedNodes.empty()) {
217 CXFA_Node* pNode = m_NewAddedNodes.front();
218 m_NewAddedNodes.pop_front();
219 InitCalculate(pNode);
220 InitValidate(pNode);
222 }
223
224 RunSubformIndexChange();
225 RunCalculateWidgets();
226 RunValidate();
227
228 ShowNullTestMsg();
229
230 if (RunLayout() && m_bLayoutEvent)
231 RunEventLayoutReady();
232
233 m_bLayoutEvent = false;
234 m_CalculateNodes.clear();
236}
237
239 CXFA_FFWidget* pWidget = GetWidgetForNode(pNode);
240 CXFA_FFWidget* pNext = nullptr;
241 for (; pWidget; pWidget = pNext) {
242 pNext = pWidget->GetNextFFWidget();
243 if (pWidget == pExcept || !pWidget->IsLoaded() ||
245 pWidget->IsFocused())) {
246 continue;
247 }
248 pWidget->UpdateFWLData();
249 pWidget->InvalidateRect();
250 }
251}
252
254 CXFA_LayoutProcessor* pProcessor = GetLayoutProcessor();
255 return pProcessor ? pProcessor->CountPages() : 0;
256}
257
258CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) const {
259 CXFA_LayoutProcessor* pProcessor = GetLayoutProcessor();
260 if (!pProcessor)
261 return nullptr;
262
263 auto* pPage = pProcessor->GetPage(nIndex);
264 return pPage ? pPage->GetPageView() : nullptr;
265}
266
267CXFA_LayoutProcessor* CXFA_FFDocView::GetLayoutProcessor() const {
268 return CXFA_LayoutProcessor::FromDocument(m_pDoc->GetXFADoc());
269}
270
271bool CXFA_FFDocView::ResetSingleNodeData(CXFA_Node* pNode) {
272 XFA_Element eType = pNode->GetElementType();
273 if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup)
274 return false;
275
276 pNode->ResetData();
277 UpdateUIDisplay(pNode, nullptr);
278 CXFA_Validate* validate = pNode->GetValidateIfExists();
279 if (!validate)
280 return true;
281
284 return true;
285}
286
288 m_bLayoutEvent = true;
289 bool bChanged = false;
290 CXFA_Node* pFormNode = nullptr;
291 if (pNode) {
292 bChanged = ResetSingleNodeData(pNode);
293 pFormNode = pNode;
294 } else {
295 pFormNode = GetRootSubform();
296 }
297 if (!pFormNode)
298 return;
299
300 if (pFormNode->GetElementType() != XFA_Element::Field &&
301 pFormNode->GetElementType() != XFA_Element::ExclGroup) {
302 CXFA_ReadyNodeIterator it(pFormNode);
303 while (CXFA_Node* next_node = it.MoveToNext()) {
304 bChanged |= ResetSingleNodeData(next_node);
305 if (next_node->GetElementType() == XFA_Element::ExclGroup)
306 it.SkipTree();
307 }
308 }
309 if (bChanged)
310 m_pDoc->SetChangeMark();
311}
312
317
318CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
319 if (!m_pWidgetHandler) {
320 m_pWidgetHandler = cppgc::MakeGarbageCollected<CXFA_FFWidgetHandler>(
321 m_pDoc->GetHeap()->GetAllocationHandle(), this);
322 }
323 return m_pWidgetHandler;
324}
325
327 if (pNewFocus == m_pFocusWidget)
328 return false;
329
330 if (m_pFocusWidget) {
331 CXFA_ContentLayoutItem* pItem = m_pFocusWidget->GetLayoutItem();
334 if (!m_pFocusWidget->IsLoaded())
335 m_pFocusWidget->LoadWidget();
336 if (!m_pFocusWidget->OnSetFocus(m_pFocusWidget))
337 m_pFocusWidget.Clear();
338 }
339 }
340 if (m_pFocusWidget) {
341 if (!m_pFocusWidget->OnKillFocus(pNewFocus))
342 return false;
343 }
344
345 if (pNewFocus) {
348 if (!pNewFocus->IsLoaded())
349 pNewFocus->LoadWidget();
350 if (!pNewFocus->OnSetFocus(m_pFocusWidget))
351 pNewFocus = nullptr;
352 }
353 }
354 if (pNewFocus) {
355 CXFA_Node* node = pNewFocus->GetNode();
356 m_pFocusNode = node->IsWidgetReady() ? node : nullptr;
357 m_pFocusWidget = pNewFocus;
358 } else {
359 m_pFocusNode.Clear();
360 m_pFocusWidget.Clear();
361 }
362 return true;
363}
364
366 CXFA_FFWidget* pNewFocus = node ? GetWidgetForNode(node) : nullptr;
367 if (!SetFocus(pNewFocus))
368 return;
369
370 m_pFocusNode = node;
371 if (m_iStatus != LayoutStatus::kEnd)
372 return;
373
374 m_pDoc->SetFocusWidget(m_pFocusWidget);
375}
376
378 if (m_pFocusNode != pWidget->GetNode())
379 return;
380
381 m_pFocusNode.Clear();
382 m_pFocusWidget.Clear();
383}
384
386 CXFA_Node* pNode,
387 CXFA_EventParam* pParam) {
388 if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
390 if (pNode && pNode->GetElementType() == XFA_Element::Draw)
392
393 switch (pParam->m_eType) {
395 return pNode->ProcessCalculate(pDocView);
398 return pNode->ProcessValidate(pDocView, 0x01);
401 CXFA_Calculate* calc = pNode->GetCalculateIfExists();
402 if (!calc)
404 if (pNode->IsUserInteractive())
406 return pNode->ExecuteScript(pDocView, calc->GetScriptIfExists(), pParam);
407 }
408 default:
409 return pNode->ProcessEvent(pDocView, kXFAEventActivity[pParam->m_eType],
410 pParam);
411 }
412}
413
415 CXFA_Node* pFormNode,
416 XFA_EVENTTYPE eEventType,
417 bool bIsFormReady,
418 bool bRecursive) {
419 if (!pFormNode)
421
422 XFA_Element elementType = pFormNode->GetElementType();
423 if (elementType == XFA_Element::Field) {
424 if (eEventType == XFA_EVENT_IndexChange)
426
427 if (!pFormNode->IsWidgetReady())
429
430 CXFA_EventParam eParam(eEventType);
431 eParam.m_bIsFormReady = bIsFormReady;
432 return XFA_ProcessEvent(this, pFormNode, &eParam);
433 }
434
436 if (bRecursive) {
437 for (CXFA_Node* pNode = pFormNode->GetFirstContainerChild(); pNode;
438 pNode = pNode->GetNextContainerSibling()) {
439 elementType = pNode->GetElementType();
440 if (elementType != XFA_Element::Variables &&
441 elementType != XFA_Element::Draw) {
443 &iRet, ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
444 bRecursive));
445 }
446 }
447 }
448 if (!pFormNode->IsWidgetReady())
449 return iRet;
450
451 CXFA_EventParam eParam(eEventType);
452 eParam.m_bIsFormReady = bIsFormReady;
453
454 XFA_EventErrorAccumulate(&iRet, XFA_ProcessEvent(this, pFormNode, &eParam));
455 return iRet;
456}
457
459 CXFA_FFWidget* pRefWidget) {
460 if (!IsValidXMLNameString(wsName)) {
461 return nullptr;
462 }
463 CFXJSE_Engine* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
464 CXFA_Node* pRefNode = nullptr;
465 if (pRefWidget) {
466 CXFA_Node* node = pRefWidget->GetNode();
467 pRefNode = node->IsWidgetReady() ? node : nullptr;
468 }
469 WideString wsExpression = (!pRefNode ? L"$form." : L"") + wsName;
470 absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
471 pScriptContext->ResolveObjects(
472 pRefNode, wsExpression.AsStringView(),
473 Mask<XFA_ResolveFlag>{
474 XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kProperties,
475 XFA_ResolveFlag::kSiblings, XFA_ResolveFlag::kParent});
476 if (!maybeResult.has_value())
477 return nullptr;
478
479 if (maybeResult.value().type == CFXJSE_Engine::ResolveResult::Type::kNodes) {
480 CXFA_Node* pNode = maybeResult.value().objects.front()->AsNode();
481 if (pNode && pNode->IsWidgetReady())
482 return GetWidgetForNode(pNode);
483 }
484 return nullptr;
485}
486
487void CXFA_FFDocView::OnPageViewEvent(CXFA_ViewLayoutItem* pSender,
488 CXFA_FFDoc::PageViewEvent eEvent) {
489 CXFA_FFPageView* pFFPageView = pSender ? pSender->GetPageView() : nullptr;
490 m_pDoc->OnPageViewEvent(pFFPageView, eEvent);
491}
492
493void CXFA_FFDocView::InvalidateRect(CXFA_FFPageView* pPageView,
494 const CFX_RectF& rtInvalidate) {
495 m_pDoc->InvalidateRect(pPageView, rtInvalidate);
496}
497
500 m_bInLayoutStatus = true;
501
502 CXFA_LayoutProcessor* pProcessor = GetLayoutProcessor();
503 if (!pProcessor->IncrementLayout() && pProcessor->StartLayout() < 100) {
504 pProcessor->DoLayout();
506 m_bInLayoutStatus = false;
507 m_pDoc->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
508 return true;
509 }
510
511 m_bInLayoutStatus = false;
512 m_pDoc->OnPageViewEvent(nullptr, CXFA_FFDoc::PageViewEvent::kStopLayout);
514 return false;
515}
516
517void CXFA_FFDocView::RunSubformIndexChange() {
518 std::set<CXFA_Node*> seen;
519 while (!m_IndexChangedSubforms.empty()) {
520 CXFA_Node* pSubformNode = m_IndexChangedSubforms.front();
521 m_IndexChangedSubforms.pop_front();
522 bool bInserted = seen.insert(pSubformNode).second;
523 if (!bInserted || !pSubformNode->IsWidgetReady())
524 continue;
525
527 pSubformNode->ProcessEvent(this, XFA_AttributeValue::IndexChange, &eParam);
528 }
529}
530
532 m_NewAddedNodes.push_back(pNode);
533 InitLayout(pNode);
534}
535
536void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Subform* pNode) {
537 if (!pdfium::Contains(m_IndexChangedSubforms, pNode))
538 m_IndexChangedSubforms.push_back(pNode);
539}
540
542 CXFA_Node* pRootItem =
543 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
544 if (!pRootItem)
545 return;
546
548}
549
551 CXFA_Node* pCurrentNode =
552 !m_CalculateNodes.empty() ? m_CalculateNodes.back() : nullptr;
553 if (pCurrentNode != node)
554 m_CalculateNodes.push_back(node);
555}
556
558 CJX_Object::CalcData* pGlobalData = pNodeChange->JSObject()->GetCalcData();
559 if (!pGlobalData)
560 return;
561
562 for (auto& pResult : pGlobalData->m_Globals) {
563 if (!pResult->HasRemovedChildren() && pResult->IsWidgetReady())
564 AddCalculateNode(pResult);
565 }
566}
567
568size_t CXFA_FFDocView::RunCalculateRecursive(size_t index) {
569 while (index < m_CalculateNodes.size()) {
570 CXFA_Node* node = m_CalculateNodes[index];
571
573 size_t recurse = node->JSObject()->GetCalcRecursionCount() + 1;
574 node->JSObject()->SetCalcRecursionCount(recurse);
575 if (recurse > 11)
576 break;
578 node->IsWidgetReady()) {
580 }
581
582 index = RunCalculateRecursive(++index);
583 }
584 return index;
585}
586
587XFA_EventError CXFA_FFDocView::RunCalculateWidgets() {
588 if (!m_pDoc->IsCalculationsEnabled())
590
591 if (!m_CalculateNodes.empty())
592 RunCalculateRecursive(0);
593
594 for (CXFA_Node* node : m_CalculateNodes)
595 node->JSObject()->SetCalcRecursionCount(0);
596
597 m_CalculateNodes.clear();
599}
600
602 if (!pdfium::Contains(m_ValidateNodes, node))
603 m_ValidateNodes.push_back(node);
604}
605
606void CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
608}
609
613 RunCalculateWidgets();
614 RunValidate();
615}
616
617bool CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
618 if (!m_pDoc->IsValidationsEnabled())
619 return false;
620
622 m_ValidateNodes.clear();
623 return true;
624}
625
626bool CXFA_FFDocView::RunValidate() {
627 if (!m_pDoc->IsValidationsEnabled())
628 return false;
629
630 while (!m_ValidateNodes.empty()) {
631 CXFA_Node* node = m_ValidateNodes.front();
632 m_ValidateNodes.pop_front();
633 if (!node->HasRemovedChildren())
634 node->ProcessValidate(this, 0);
635 }
636 return true;
637}
638
639bool CXFA_FFDocView::RunEventLayoutReady() {
640 CXFA_Node* pRootItem =
641 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
642 if (!pRootItem)
643 return false;
644
647 return true;
648}
649
650void CXFA_FFDocView::RunBindItems() {
651 while (!m_BindItems.empty()) {
652 CXFA_BindItems* item = m_BindItems.front();
653 m_BindItems.pop_front();
654 if (item->HasRemovedChildren())
655 continue;
656
657 CXFA_Node* pWidgetNode = item->GetParent();
658 if (!pWidgetNode || !pWidgetNode->IsWidgetReady())
659 continue;
660
661 CFXJSE_Engine* pScriptContext =
662 pWidgetNode->GetDocument()->GetScriptContext();
663 WideString wsRef = item->GetRef();
664 absl::optional<CFXJSE_Engine::ResolveResult> maybeRS =
665 pScriptContext->ResolveObjects(
666 pWidgetNode, wsRef.AsStringView(),
667 Mask<XFA_ResolveFlag>{
668 XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kProperties,
669 XFA_ResolveFlag::kSiblings, XFA_ResolveFlag::kParent,
670 XFA_ResolveFlag::kALL});
671 pWidgetNode->DeleteItem(-1, false, false);
672 if (!maybeRS.has_value() ||
673 maybeRS.value().type != CFXJSE_Engine::ResolveResult::Type::kNodes ||
674 maybeRS.value().objects.empty()) {
675 continue;
676 }
677 WideString wsValueRef = item->GetValueRef();
678 WideString wsLabelRef = item->GetLabelRef();
679 const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
680 const bool bLabelUseContent =
681 wsLabelRef.IsEmpty() || wsLabelRef.EqualsASCII("$");
682 const bool bValueUseContent =
683 wsValueRef.IsEmpty() || wsValueRef.EqualsASCII("$");
684 WideString wsValue;
685 WideString wsLabel;
686 uint32_t uValueHash = FX_HashCode_GetW(wsValueRef.AsStringView());
687 for (auto& refObject : maybeRS.value().objects) {
688 CXFA_Node* refNode = refObject->AsNode();
689 if (!refNode)
690 continue;
691
692 if (bValueUseContent) {
693 wsValue = refNode->JSObject()->GetContent(false);
694 } else {
695 CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash);
696 wsValue = nodeValue ? nodeValue->JSObject()->GetContent(false)
697 : refNode->JSObject()->GetContent(false);
698 }
699
700 if (!bUseValue) {
701 if (bLabelUseContent) {
702 wsLabel = refNode->JSObject()->GetContent(false);
703 } else {
704 CXFA_Node* nodeLabel =
705 refNode->GetFirstChildByName(wsLabelRef.AsStringView());
706 if (nodeLabel)
707 wsLabel = nodeLabel->JSObject()->GetContent(false);
708 }
709 } else {
710 wsLabel = wsValue;
711 }
712 pWidgetNode->InsertItem(wsLabel, wsValue, false);
713 }
714 }
715}
716
718 if (m_iStatus != LayoutStatus::kEnd)
719 return;
720
721 m_pDoc->SetChangeMark();
722}
723
725 CXFA_Node* pFormPacketNode =
726 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
727 if (!pFormPacketNode)
728 return nullptr;
729
730 return pFormPacketNode->GetFirstChildByClass<CXFA_Subform>(
731 XFA_Element::Subform);
732}
friend class EventParamScope
static bool IsXMLNameChar(wchar_t ch, bool bFirstChar)
WideString GetRef()
WideString GetLabelRef()
WideString GetValueRef()
CXFA_Script * GetScriptIfExists()
bool TestStatusBits(Mask< XFA_WidgetStatus > val) const
XFA_EVENTTYPE m_eType
CXFA_EventParam(XFA_EVENTTYPE type)
virtual WideString GetAppTitle() const =0
virtual int32_t MsgBox(const WideString &wsMessage, const WideString &wsTitle, uint32_t dwIconType, uint32_t dwButtonType)=0
CallbackIface * GetAppProvider() const
Definition cxfa_ffapp.h:144
UpdateScope(CXFA_FFDocView *pDocView)
void InvalidateRect(CXFA_FFPageView *pPageView, const CFX_RectF &rtInvalidate)
CXFA_FFWidgetHandler * GetWidgetHandler()
void AddValidateNode(CXFA_Node *node)
void ResetNode(CXFA_Node *pNode)
void AddCalculateNodeNotify(CXFA_Node *pNodeChange)
CXFA_FFDoc * GetDoc() const
bool SetFocus(CXFA_FFWidget *pNewFocus)
void DeleteLayoutItem(CXFA_FFWidget *pWidget)
void AddNewFormNode(CXFA_Node *pNode)
void OnPageViewEvent(CXFA_ViewLayoutItem *pSender, CXFA_FFDoc::PageViewEvent eEvent)
CXFA_FFWidget * GetWidgetByName(const WideString &wsName, CXFA_FFWidget *pRefWidget)
CXFA_FFPageView * GetPageView(int32_t nIndex) const
void SetFocusNode(CXFA_Node *pNode)
void AddCalculateNode(CXFA_Node *node)
CXFA_LayoutProcessor * GetLayoutProcessor() const
int32_t CountPageViews() const
XFA_EventError ExecEventActivityByDeepFirst(CXFA_Node *pFormNode, XFA_EVENTTYPE eEventType, bool bIsFormReady, bool bRecursive)
CXFA_Node * GetRootSubform()
void AddNullTestMsg(const WideString &msg)
void ProcessValueChanged(CXFA_Node *node)
void UpdateUIDisplay(CXFA_Node *pNode, CXFA_FFWidget *pExcept)
CXFA_FFWidget * GetWidgetForNode(CXFA_Node *node)
void AddIndexChangedSubform(CXFA_Subform *pNode)
bool IsValidationsEnabled() const
CXFA_FFWidget * GetNextFFWidget() const
virtual bool UpdateFWLData()
bool IsFocused() const
virtual bool IsLoaded()
CXFA_Node * GetNode() const
virtual bool LoadWidget()
CXFA_ContentLayoutItem * GetLayoutItem() const
CXFA_LayoutItem * GetLayoutItem(CXFA_Node *pFormItem)
CXFA_ViewLayoutItem * GetPage(int32_t index) const
CXFA_Node * GetFirstContainerChild() const
CXFA_Node * GetNextContainerSibling() const
CXFA_Validate * GetValidateIfExists() const
CXFA_Calculate * GetCalculateIfExists() const
bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify)
void SetFlag(XFA_NodeFlag dwFlag)
XFA_EventError ExecuteScript(CXFA_FFDocView *pDocView, CXFA_Script *script, CXFA_EventParam *pEventParam)
bool IsUserInteractive() const
Definition cxfa_node.h:162
XFA_EventError ProcessEvent(CXFA_FFDocView *pDocView, XFA_AttributeValue iActivity, CXFA_EventParam *pEventParam)
bool IsWidgetReady() const
Definition cxfa_node.h:327
void ResetData()
XFA_FFWidgetType GetFFWidgetType()
XFA_EventError ProcessValidate(CXFA_FFDocView *pDocView, int32_t iFlags)
XFA_EventError ProcessCalculate(CXFA_FFDocView *pDocView)
bool HasRemovedChildren() const
Definition cxfa_node.h:174
XFA_Element GetElementType() const
Definition cxfa_object.h:91
CXFA_Document * GetDocument() const
Definition cxfa_object.h:48
CXFA_ReadyNodeIterator(CXFA_Node *pTravelRoot)
CXFA_FFPageView * GetPageView() const
WideString & operator+=(const WideString &str)
bool operator==(const WideString &other) const
static WideString Format(const wchar_t *pFormat,...)
bool IsEmpty() const
Definition widestring.h:118
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:216
CXFA_FFWidget * GetFFWidget(CXFA_ContentLayoutItem *item)
XFA_EVENTTYPE
@ XFA_EVENT_InitCalculate
@ XFA_EVENT_Initialize
@ XFA_EVENT_DocReady
@ XFA_EVENT_Unknown
@ XFA_EVENT_Calculate
@ XFA_EVENT_Validate
@ XFA_EVENT_Ready
@ XFA_EVENT_IndexChange
@ XFA_EVENT_DocClose
static XFA_EventError XFA_ProcessEvent(CXFA_FFDocView *pDocView, CXFA_Node *pNode, CXFA_EventParam *pParam)
const XFA_AttributeValue kXFAEventActivity[]
XFA_FFWidgetType
CXFA_ContentLayoutItem * ToContentLayoutItem(CXFA_LayoutItem *item)
XFA_NodeFlag
Definition cxfa_node.h:77
AlertIcon
Definition fxfa.h:20
AlertButton
Definition fxfa.h:11
XFA_EventError
Definition fxfa.h:54
XFA_WidgetStatus
Definition fxfa.h:61
XFA_Element
Definition fxfa_basic.h:75
XFA_AttributeValue
Definition fxfa_basic.h:60
Definition heap.h:12
WideString operator+(const wchar_t *str1, const WideString &str2)
Definition widestring.h:281
void XFA_EventErrorAccumulate(XFA_EventError *pAcc, XFA_EventError eNew)