7#ifndef XFA_FXFA_CXFA_TEXTPARSER_H_
8#define XFA_FXFA_CXFA_TEXTPARSER_H_
16#include "core/fxcrt/css/cfx_css.h"
17#include "core/fxcrt/css/cfx_csscomputedstyle.h"
18#include "core/fxcrt/css/cfx_cssdeclaration.h"
19#include "core/fxcrt/retain_ptr.h"
20#include "core/fxcrt/widestring.h"
21#include "core/fxge/dib/fx_dib.h"
22#include "fxjs/gc/heap.h"
23#include "third_party/abseil-cpp/absl/types/optional.h"
24#include "v8/include/cppgc/garbage-collected.h"
25#include "xfa/fxfa/fxfa_basic.h"
44 return m_pParentStyle;
50 void SetDecls(std::vector<
const CFX_CSSDeclaration*>&& decl);
56 RetainPtr<
const CFX_CSSComputedStyle> m_pParentStyle;
58 std::vector<
const CFX_CSSDeclaration*> decls_;
64 void Trace(cppgc::Visitor* visitor)
const {}
74 RetainPtr<
const CFX_CSSComputedStyle> pParentStyle);
81 int32_t
CountTabs(
const CFX_CSSComputedStyle* pStyle)
const;
83 bool IsSpaceRun(
const CFX_CSSComputedStyle* pStyle)
const;
84 bool GetTabstops(
const CFX_CSSComputedStyle* pStyle,
89 const CFX_CSSComputedStyle* pStyle)
const;
91 const CFX_CSSComputedStyle* pStyle)
const;
93 const CFX_CSSComputedStyle* pStyle,
96 const CFX_CSSComputedStyle* pStyle)
const;
98 const CFX_CSSComputedStyle* pStyle)
const;
101 const CFX_CSSComputedStyle* pStyle)
const;
103 const CFX_CSSComputedStyle* pStyle)
const;
105 const CFX_CSSComputedStyle* pStyle)
const;
107 const CFX_CSSComputedStyle* pStyle)
const;
109 const CFX_CSSComputedStyle* pStyle,
111 float fVerScale)
const;
129 WideString GetTagName() {
return m_wsTagName; }
131 void SetTagName(
const WideString& wsName) { m_wsTagName = wsName; }
132 void SetAttribute(
const WideString& wsAttr,
const WideString& wsValue) {
133 m_Attributes.insert({wsAttr, wsValue});
136 WideString GetAttribute(
const WideString& wsAttr) {
137 return m_Attributes[wsAttr];
140 bool m_bTagAvailable =
false;
141 bool m_bContent =
false;
144 WideString m_wsTagName;
145 std::map<WideString, WideString> m_Attributes;
149 std::unique_ptr<TagProvider> ParseTagInfo(
const CFX_XMLNode* pXMLNode);
153 const CFX_CSSComputedStyle* pParentStyle);
154 std::unique_ptr<CFX_CSSStyleSheet> LoadDefaultSheetStyle();
155 RetainPtr<CFX_CSSComputedStyle> CreateStyle(
156 const CFX_CSSComputedStyle* pParentStyle);
158 bool m_bParsed =
false;
159 bool m_cssInitialized =
false;
160 std::unique_ptr<CFX_CSSStyleSelector> m_pSelector;
161 std::map<
const CFX_XMLNode*, std::unique_ptr<Context>>
162 m_mapXMLNodeToParseContext;
CFX_XMLElement * ToXMLElement(CFX_XMLNode *pNode)
const CFX_XMLText * ToXMLText(const CFX_XMLNode *pNode)
static bool DrawString(CFX_RenderDevice *device, FX_ARGB color, const RetainPtr< CFGAS_GEFont > &pFont, pdfium::span< TextCharPos > pCharPos, float fFontSize, const CFX_Matrix &matrix)
int32_t GetHorizontalScale() const
int32_t GetFontSize() const
int32_t GetCharCount() const
int32_t GetStartPos() const
const CFGAS_TextUserData * GetUserData() const
int32_t GetVerticalScale() const
int32_t GetBidiLevel() const
WideString GetString() const
void SetMarginWidth(const CFX_CSSRect &rect)
const CFX_CSSLength & GetTextIndent() const
const CFX_CSSRect * GetMarginWidth() const
CFX_CSSTextAlign GetTextAlign() const
const CFX_CSSRect * GetPaddingWidth() const
CFX_CSSLength & Set(CFX_CSSLengthUnit eUnit, float fValue)
void AppendLine(const CFX_PointF &pt1, const CFX_PointF &pt2)
FX_RECT GetOuterRect() const
bool SetClip_Rect(const FX_RECT &pRect)
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
void RestoreState(bool bKeepSaved)
WideString GetLocalTagName() const
WideString GetAttribute(const WideString &name) const
virtual Type GetType() const =0
const WideString & GetText() const
XFA_AttributeValue GetHorizontalAlign()
XFA_AttributeValue GetVerticalAlign()
float StartLayout(float fWidth)
WideString GetLinkURLAtPoint(const CFX_PointF &point)
CFX_SizeF CalcSize(const CFX_SizeF &minSize, const CFX_SizeF &maxSize)
bool DrawString(CFX_RenderDevice *pFxDevice, const CFX_Matrix &mtDoc2Device, const CFX_RectF &rtClip, size_t szBlockIndex)
float DoLayout(float fTextHeight)
float DoSplitLayout(size_t szBlockIndex, float fCalcHeight, float fTextHeight)
float Layout(const CFX_SizeF &size)
void ItemBlocks(const CFX_RectF &rtText, size_t szBlockIndex)
void SetDecls(std::vector< const CFX_CSSDeclaration * > &&decl)
void SetDisplay(CFX_CSSDisplay eDisplay)
void SetParentStyle(RetainPtr< const CFX_CSSComputedStyle > style)
RetainPtr< const CFX_CSSComputedStyle > GetParentStyle() const
CFX_CSSDisplay GetDisplay() const
const std::vector< const CFX_CSSDeclaration * > & GetDecls() const
int32_t GetUnderline(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
float GetFontSize(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
float GetTabInterval(const CFX_CSSComputedStyle *pStyle) const
bool GetTabstops(const CFX_CSSComputedStyle *pStyle, CXFA_TextTabstopsContext *pTabstopContext)
Context * GetParseContextFromMap(const CFX_XMLNode *pXMLNode)
XFA_AttributeValue GetUnderlinePeriod(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
XFA_AttributeValue GetVAlign(CXFA_TextProvider *pTextProvider) const
int32_t CountTabs(const CFX_CSSComputedStyle *pStyle) const
float GetBaseline(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
virtual ~CXFA_TextParser()
float GetLineHeight(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle, bool bFirst, float fVerScale) const
bool TagValidate(const WideString &str) const
int32_t GetHorScale(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle, const CFX_XMLNode *pXMLNode) const
RetainPtr< CFX_CSSComputedStyle > CreateRootStyle(CXFA_TextProvider *pTextProvider)
bool IsSpaceRun(const CFX_CSSComputedStyle *pStyle) const
RetainPtr< CFGAS_GEFont > GetFont(CXFA_FFDoc *doc, CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
int32_t GetLinethrough(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
void DoParse(const CFX_XMLNode *pXMLContainer, CXFA_TextProvider *pTextProvider)
FX_ARGB GetColor(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
int32_t GetVerScale(CXFA_TextProvider *pTextProvider, const CFX_CSSComputedStyle *pStyle) const
absl::optional< WideString > GetEmbeddedObj(const CXFA_TextProvider *pTextProvider, const CFX_XMLNode *pXMLNode)
void Trace(cppgc::Visitor *visitor) const
RetainPtr< CFX_CSSComputedStyle > ComputeStyle(const CFX_XMLNode *pXMLNode, RetainPtr< const CFX_CSSComputedStyle > pParentStyle)
static WideString Format(const wchar_t *pFormat,...)
WideString & operator=(WideString &&that) noexcept
WideString & operator+=(wchar_t ch)
WideString & operator=(const WideString &that)
bool EqualsASCII(ByteStringView that) const
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
constexpr CFX_FillRenderOptions()