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
cjx_draw.cpp
Go to the documentation of this file.
1// Copyright 2017 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 "fxjs/xfa/cjx_draw.h"
8
9#include "fxjs/fxv8.h"
10#include "fxjs/xfa/cfxjse_value.h"
11#include "third_party/base/check.h"
12#include "v8/include/v8-primitive.h"
13#include "v8/include/v8-value.h"
14#include "xfa/fxfa/parser/cxfa_draw.h"
15
16CJX_Draw::CJX_Draw(CXFA_Draw* node) : CJX_Container(node) {}
17
18CJX_Draw::~CJX_Draw() = default;
19
20bool CJX_Draw::DynamicTypeIs(TypeTag eType) const {
21 return eType == static_type__ || ParentType__::DynamicTypeIs(eType);
22}
23
24void CJX_Draw::rawValue(v8::Isolate* pIsolate,
25 v8::Local<v8::Value>* pValue,
26 bool bSetting,
27 XFA_Attribute eAttribute) {
28 defaultValue(pIsolate, pValue, bSetting, eAttribute);
29}
30
31void CJX_Draw::defaultValue(v8::Isolate* pIsolate,
32 v8::Local<v8::Value>* pValue,
33 bool bSetting,
34 XFA_Attribute eAttribute) {
35 if (!bSetting) {
36 ByteString content = GetContent(true).ToUTF8();
37 *pValue = content.IsEmpty()
38 ? fxv8::NewNullHelper(pIsolate).As<v8::Value>()
39 : fxv8::NewStringHelper(pIsolate, content.AsStringView())
40 .As<v8::Value>();
41 return;
42 }
43
44 if (!pValue || !fxv8::IsString(*pValue))
45 return;
46
47 DCHECK(GetXFANode()->IsWidgetReady());
48 if (GetXFANode()->GetFFWidgetType() != XFA_FFWidgetType::kText)
49 return;
50
51 WideString wsNewValue = fxv8::ReentrantToWideStringHelper(pIsolate, *pValue);
52 SetContent(wsNewValue, wsNewValue, true, true, true);
53}
bool DynamicTypeIs(TypeTag eType) const override
bool DynamicTypeIs(TypeTag eType) const override
Definition cjx_draw.cpp:20
~CJX_Draw() override
WideString GetContent(bool bScriptModify) const
CXFA_Node * GetXFANode() const
void SetContent(const WideString &wsContent, const WideString &wsXMLValue, bool bNotify, bool bScriptModify, bool bSyncData)
XFA_FFWidgetType
XFA_Attribute
Definition fxfa_basic.h:67
Definition fxv8.h:22
bool IsString(v8::Local< v8::Value > value)
Definition fxv8.cpp:31