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_box.h
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#ifndef XFA_FXFA_PARSER_CXFA_BOX_H_
8#define XFA_FXFA_PARSER_CXFA_BOX_H_
9
10#include <tuple>
11#include <vector>
12
13#include "core/fxcrt/fx_coordinates.h"
14#include "xfa/fgas/graphics/cfgas_gepath.h"
15#include "xfa/fxfa/parser/cxfa_node.h"
16
18class CXFA_Edge;
19class CXFA_Fill;
20class CXFA_Stroke;
21
22class CXFA_Box : public CXFA_Node {
23 public:
25 ~CXFA_Box() override;
26
28 std::tuple<XFA_AttributeValue, bool, float> Get3DStyle();
29
31 CXFA_Edge* GetEdgeIfExists(size_t nIndex);
32 CXFA_Fill* GetOrCreateFillIfPossible();
33
35
36 void Draw(CFGAS_GEGraphics* pGS,
37 const CFX_RectF& rtWidget,
38 const CFX_Matrix& matrix,
39 bool forceRound);
40
41 protected:
42 CXFA_Box(CXFA_Document* pDoc,
43 XFA_PacketType ePacket,
44 Mask<XFA_XDPPACKET> validPackets,
45 XFA_ObjectType oType,
46 XFA_Element eType,
47 pdfium::span<const PropertyData> properties,
48 pdfium::span<const AttributeData> attributes,
49 CJX_Object* js_node);
50
52
53 private:
54 bool IsCircular();
55 absl::optional<int32_t> GetStartAngle();
56 absl::optional<int32_t> GetSweepAngle();
57
58 std::vector<CXFA_Stroke*> GetStrokesInternal(bool bNull);
59 void DrawFill(const std::vector<CXFA_Stroke*>& strokes,
61 CFX_RectF rtWidget,
62 const CFX_Matrix& matrix,
63 bool forceRound);
64 void StrokeArcOrRounded(CFGAS_GEGraphics* pGS,
65 CFX_RectF rtWidget,
66 const CFX_Matrix& matrix,
67 bool forceRound);
68 void GetPathArcOrRounded(CFX_RectF rtDraw,
69 bool forceRound,
70 CFGAS_GEPath* fillPath);
71};
72
73#endif // XFA_FXFA_PARSER_CXFA_BOX_H_
CFX_XMLElement * ToXMLElement(CFX_XMLNode *pNode)
float ToFloat() const
void TransformBy(const CFX_Matrix &mt)
void AddLine(const CFX_PointF &p1, const CFX_PointF &p2)
void MoveTo(const CFX_PointF &point)
void ArcTo(const CFX_PointF &pos, const CFX_SizeF &size, float startAngle, float sweepAngle)
void BezierTo(const CFX_PointF &c1, const CFX_PointF &c2, const CFX_PointF &to)
void AddRectangle(float left, float top, float width, float height)
const CFX_Path & GetPath() const
bool IsEmpty() const
void AddEllipse(const CFX_RectF &rect)
void AddArc(const CFX_PointF &pos, const CFX_SizeF &size, float startAngle, float sweepAngle)
void LineTo(const CFX_PointF &point)
void AddSubpath(const CFGAS_GEPath &path)
void AddNodesOfRunScript(CXFA_Node *pNode)
friend class EventParamScope
void MergeDataFrom(const CFXJSE_MapModule *pSrc)
void SetValue(uint32_t key, int32_t value)
void SetMeasurement(uint32_t key, const CXFA_Measurement &measurement)
void SetString(uint32_t key, const WideString &wsString)
void RemoveKey(uint32_t key)
bool HasKey(uint32_t key) const
WideString GetNamespaceURI() const
void SetAttribute(const WideString &name, const WideString &value)
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:34
WideString GetAttributeByString(WideStringView attr) const
void RemoveAttribute(WideStringView wsAttr)
void ScriptSomMessage(v8::Isolate *pIsolate, v8::Local< v8::Value > *pValue, bool bSetting, SOMMessageType iMessageType)
float GetMeasureInUnit(XFA_Attribute eAttr, XFA_Unit unit) const
void DefineMethods(pdfium::span< const CJX_MethodSpec > methods)
~CJX_Object() override
void SetCDataImpl(XFA_Attribute eAttr, const WideString &wsValue, bool bNotify, bool bScriptModify)
WideString GetContent(bool bScriptModify) const
bool HasMethod(const WideString &func) const
CJX_Object * AsCJXObject() override
CXFA_Object * GetXFAObject() const
Definition cjx_object.h:113
absl::optional< CXFA_Measurement > TryMeasure(XFA_Attribute eAttr, bool bUseDefault) const
CJS_Result RunMethod(CFXJSE_Engine *pScriptContext, const WideString &func, pdfium::span< v8::Local< v8::Value > > params)
void ThrowArgumentMismatchException(v8::Isolate *pIsolate) const
void ThrowIndexOutOfBoundsException(v8::Isolate *pIsolate) const
void SetAttributeByEnum(XFA_Attribute eAttr, const WideString &wsValue, bool bNotify)
void ThrowInvalidPropertyException(v8::Isolate *pIsolate) const
CXFA_Document * GetDocument() const
void ThrowParamCountMismatchException(v8::Isolate *pIsolate, const WideString &method) const
void SetCData(XFA_Attribute eAttr, const WideString &wsValue)
void SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify)
absl::optional< WideString > TryCData(XFA_Attribute eAttr, bool bUseDefault) const
absl::optional< bool > TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const
void SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify)
XFA_AttributeValue GetEnum(XFA_Attribute eAttr) const
void SetAttributeByString(WideStringView wsAttr, const WideString &wsValue)
bool GetBoolean(XFA_Attribute eAttr) const
virtual bool DynamicTypeIs(TypeTag eType) const
void MoveBufferMapData(CXFA_Object *pSrcObj, CXFA_Object *pDstObj)
bool HasAttribute(XFA_Attribute eAttr) const
int32_t GetInteger(XFA_Attribute eAttr) const
WideString GetCData(XFA_Attribute eAttr) const
void TakeCalcDataFrom(CJX_Object *that)
void ThrowException(v8::Isolate *pIsolate, const WideString &str) const
absl::optional< XFA_AttributeValue > TryEnum(XFA_Attribute eAttr, bool bUseDefault) const
absl::optional< WideString > TryAttribute(XFA_Attribute eAttr, bool bUseDefault) const
CXFA_Node * GetXFANode() const
void SetEnum(XFA_Attribute eAttr, XFA_AttributeValue eValue, bool bNotify)
void SetContent(const WideString &wsContent, const WideString &wsXMLValue, bool bNotify, bool bScriptModify, bool bSyncData)
absl::optional< int32_t > TryInteger(XFA_Attribute eAttr, bool bUseDefault) const
CXFA_Measurement GetMeasure(XFA_Attribute eAttr) const
void SetAttributeValue(const WideString &wsValue, const WideString &wsXMLValue)
void SetMeasure(XFA_Attribute eAttr, const CXFA_Measurement &mValue, bool bNotify)
absl::optional< WideString > TryContent(bool bScriptModify, bool bProto) const
absl::optional< float > TryMeasureAsFloat(XFA_Attribute attr) const
void MergeAllData(CXFA_Object *pDstObj)
absl::optional< WideString > TryNamespace() const
WideString GetAttributeByEnum(XFA_Attribute attr) const
CalcData * GetOrCreateCalcData(cppgc::Heap *heap)
void SetAttributeValueImpl(const WideString &wsValue, const WideString &wsXMLValue, bool bNotify, bool bScriptModify)
CJX_Object(CXFA_Object *obj)
void ThrowTooManyOccurrencesException(v8::Isolate *pIsolate, const WideString &obj) const
~CXFA_Border() override
std::tuple< XFA_AttributeValue, bool, float > Get3DStyle()
Definition cxfa_box.cpp:126
std::vector< CXFA_Stroke * > GetStrokes()
Definition cxfa_box.cpp:106
XFA_AttributeValue GetHand()
Definition cxfa_box.cpp:83
CXFA_Edge * GetEdgeIfExists(size_t nIndex)
Definition cxfa_box.cpp:97
size_t CountEdges()
Definition cxfa_box.cpp:93
~CXFA_Box() override
XFA_AttributeValue GetPresence()
Definition cxfa_box.cpp:87
CXFA_Fill * GetOrCreateFillIfPossible()
Definition cxfa_box.cpp:122
void Draw(CFGAS_GEGraphics *pGS, const CFX_RectF &rtWidget, const CFX_Matrix &matrix, bool forceRound)
Definition cxfa_box.cpp:187
CXFA_Box(CXFA_Document *pDoc, XFA_PacketType ePacket, Mask< XFA_XDPPACKET > validPackets, XFA_ObjectType oType, XFA_Element eType, pdfium::span< const PropertyData > properties, pdfium::span< const AttributeData > attributes, CJX_Object *js_node)
Definition cxfa_box.cpp:64
CXFA_Node * GetNodeByID(CXFA_Node *pRoot, WideStringView wsID) const
CXFA_FFNotify * GetNotify() const
CFXJSE_Engine * GetScriptContext() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
static constexpr FX_ARGB kDefaultColor
Definition cxfa_edge.h:14
void OnValueChanging(CXFA_Node *pSender, XFA_Attribute eAttr)
void AddCalcValidate(CXFA_Node *pNode)
void RunSubformIndexChange(CXFA_Subform *pSubformNode)
void SetColor(FX_ARGB color)
Definition cxfa_fill.cpp:64
FX_ARGB GetFillColor() const
Definition cxfa_fill.cpp:73
FX_ARGB GetColor() const
void SetColor(FX_ARGB color)
CXFA_Measurement(float fValue, XFA_Unit eUnit)
float ToUnit(XFA_Unit eUnit) const
WideString ToString() const
CFX_XMLNode * GetXMLMappingNode() const
Definition cxfa_node.h:184
void RemoveChildAndNotify(CXFA_Node *pNode, bool bNotify)
void InsertChildAndNotify(CXFA_Node *pNode, CXFA_Node *pBeforeNode)
CXFA_Node * GetOrCreateProperty(int32_t index, XFA_Element eProperty)
void SendAttributeChangeMessage(XFA_Attribute eAttribute, bool bScriptModify)
WideString GetFormatDataValue(const WideString &wsValue)
CXFA_Node * CreateSamePacketNode(XFA_Element eType)
void UpdateNameHash()
CXFA_Node * GetTemplateNodeIfExists() const
CXFA_Node * GetBindData()
CFX_XMLNode * CreateXMLMappingNode()
void SetToXML(const WideString &value)
std::pair< CXFA_Node *, int32_t > GetProperty(int32_t index, XFA_Element eProperty) const
CXFA_Node * CloneTemplateToForm(bool bRecursive)
CXFA_Node * GetContainerNode()
XFA_AttributeType GetAttributeType(XFA_Attribute type) const
XFA_PacketType GetPacketType() const
Definition cxfa_node.h:146
CXFA_Node * GetItemIfExists(int32_t iIndex)
bool IsNeedSavingXMLNode() const
bool IsInitialized() const
Definition cxfa_node.h:161
CXFA_Node * GetModelNode()
XFA_Element GetElementType() const
Definition cxfa_object.h:91
bool IsNodeV() const
Definition cxfa_object.h:73
bool IsModelNode() const
Definition cxfa_object.h:72
XFA_ObjectType GetObjectType() const
Definition cxfa_object.h:49
bool IsContainerNode() const
Definition cxfa_object.h:69
void GetFillPath(const std::vector< CXFA_Stroke * > &strokes, const CFX_RectF &rtWidget, CFGAS_GEPath *fillPath)
void StrokeLowered(CFGAS_GEGraphics *pGS, CFX_RectF rt, float fThickness, const CFX_Matrix &matrix)
CXFA_Rectangle(CXFA_Document *pDoc, XFA_PacketType ePacket, Mask< XFA_XDPPACKET > validPackets, XFA_ObjectType oType, XFA_Element eType, pdfium::span< const PropertyData > properties, pdfium::span< const AttributeData > attributes, CJX_Object *js_node)
~CXFA_Rectangle() override
void GetPath(const std::vector< CXFA_Stroke * > &strokes, CFX_RectF rtWidget, CFGAS_GEPath &path, int32_t nIndex, bool bStart, bool bCorner)
static CXFA_Rectangle * FromNode(CXFA_Node *pNode)
void Stroke(const std::vector< CXFA_Stroke * > &strokes, CFGAS_GEGraphics *pGS, CFX_RectF rtWidget, const CFX_Matrix &matrix)
void StrokeRaised(CFGAS_GEGraphics *pGS, CFX_RectF rt, float fThickness, const CFX_Matrix &matrix)
void Draw(const std::vector< CXFA_Stroke * > &strokes, CFGAS_GEGraphics *pGS, CFX_RectF rtWidget, const CFX_Matrix &matrix)
void StrokeEtched(CFGAS_GEGraphics *pGS, CFX_RectF rt, float fThickness, const CFX_Matrix &matrix)
void StrokeEmbossed(CFGAS_GEGraphics *pGS, CFX_RectF rt, float fThickness, const CFX_Matrix &matrix)
CXFA_Rectangle(CXFA_Document *doc, XFA_PacketType packet)
void StrokeRect(CFGAS_GEGraphics *pGraphic, const CFX_RectF &rt, float fLineWidth, const CFX_Matrix &matrix, FX_ARGB argbTopLeft, FX_ARGB argbBottomRight)
FX_ARGB GetColor() const
void SetMSThickness(CXFA_Measurement msThinkness)
CXFA_Measurement GetMSThickness() const
void SetColor(FX_ARGB argb)
static CXFA_Subform * FromNode(CXFA_Node *pNode)
XFA_AttributeValue GetNullTest()
void SetScriptMessageText(const WideString &wsMessage)
WideString GetNullMessageText()
WideString GetScriptMessageText()
void SetNullTest(const WideString &wsValue)
void SetNullMessageText(const WideString &wsMessage)
WideString GetFormatMessageText()
void SetFormatMessageText(const WideString &wsMessage)
static ByteString Format(const char *pFormat,...)
ByteString ToUTF8() const
WideString & operator=(WideString &&that) noexcept
CharType operator[](const size_t index) const
Definition widestring.h:146
bool IsEmpty() const
Definition widestring.h:118
const wchar_t * c_str() const
Definition widestring.h:81
WideString(const WideString &other)
static WideString FromASCII(ByteStringView str)
static WideString FormatInteger(int i)
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:216
XFA_ObjectType
Definition cxfa_object.h:21
CXFA_Node * ToNode(CXFA_Object *pObj)
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
int32_t FXSYS_wtoi(const wchar_t *str)
XFA_Unit
Definition fxfa_basic.h:91
XFA_AttributeType
Definition fxfa_basic.h:83
XFA_Attribute
Definition fxfa_basic.h:67
XFA_XDPPACKET
Definition fxfa_basic.h:51
@ XFA_HASHCODE_Template
Definition fxfa_basic.h:35
XFA_Element
Definition fxfa_basic.h:75
XFA_AttributeValue
Definition fxfa_basic.h:60
XFA_PacketType
Definition fxfa_basic.h:44
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
JSMessage
Definition heap.h:12
WideString operator+(const wchar_t *str1, const WideString &str2)
Definition widestring.h:281
Definition fxv8.h:22
bool IsUndefined(v8::Local< v8::Value > value)
Definition fxv8.cpp:19
bool IsNull(v8::Local< v8::Value > value)
Definition fxv8.cpp:23
bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement *pNode, const WideString &wsQualifier, WideString *wsNamespaceURI)
bool XFA_FieldIsMultiListBox(const CXFA_Node *pFieldNode)